@lovrabet/rabetbase-cli 2.5.0-beta.5 → 2.5.0
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/api/generate-sdk-config-file.js +1 -1
- package/lib/auth/auth-server-ui.js +1 -1
- package/lib/auth/auth-server.js +1 -1
- package/lib/auth/constant.js +1 -1
- package/lib/auth/get-cookie.js +1 -1
- package/lib/auth/get-session-user.js +1 -1
- package/lib/auth/is-session-valid.js +1 -1
- package/lib/auth/login-success-html.js +1 -1
- package/lib/auth/logout.js +1 -1
- package/lib/cli-flags.js +1 -1
- package/lib/cli.js +1 -1
- package/lib/commands/api/generate.js +1 -1
- package/lib/commands/api/index.js +1 -1
- package/lib/commands/api/list.js +1 -1
- package/lib/commands/api/pull.js +1 -1
- package/lib/commands/api/shared.js +1 -1
- package/lib/commands/app/index.js +1 -1
- package/lib/commands/app/list.js +1 -1
- package/lib/commands/app/members-list.js +1 -1
- package/lib/commands/app/remote-directory.js +1 -1
- package/lib/commands/app/shared.js +1 -1
- package/lib/commands/app-config/delete.js +1 -1
- package/lib/commands/app-config/get.js +1 -1
- package/lib/commands/app-config/index.js +1 -1
- package/lib/commands/app-config/list.js +1 -1
- package/lib/commands/app-config/set.js +1 -1
- package/lib/commands/app-config/shared.js +1 -1
- package/lib/commands/auth/index.js +1 -1
- package/lib/commands/bff/create.js +1 -1
- package/lib/commands/bff/delete.js +1 -1
- package/lib/commands/bff/detail.js +1 -1
- package/lib/commands/bff/index.js +1 -1
- package/lib/commands/bff/list.js +1 -1
- package/lib/commands/bff/pull.js +1 -1
- package/lib/commands/bff/push.js +1 -1
- package/lib/commands/bff/status.js +1 -1
- package/lib/commands/cli-skill/index.js +1 -1
- package/lib/commands/cli-update.js +1 -1
- package/lib/commands/codegen/index.js +1 -1
- package/lib/commands/codegen/sdk.js +1 -1
- package/lib/commands/codegen/sql.js +1 -1
- package/lib/commands/common/app-registry.js +1 -1
- package/lib/commands/common/app-selector.js +1 -1
- package/lib/commands/common/async-task.js +1 -1
- package/lib/commands/common/dry-run.js +1 -1
- package/lib/commands/common/flags.js +1 -1
- package/lib/commands/common/local-file.js +1 -1
- package/lib/commands/common/validate.js +1 -1
- package/lib/commands/config/delete.js +1 -1
- package/lib/commands/config/get.js +1 -1
- package/lib/commands/config/index.js +1 -1
- package/lib/commands/config/init.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/dataset/business-group-update.js +1 -1
- package/lib/commands/dataset/business-groups.js +1 -1
- package/lib/commands/dataset/capability.js +1 -1
- package/lib/commands/dataset/delete.js +1 -1
- package/lib/commands/dataset/detail.js +1 -1
- package/lib/commands/dataset/extend-update.js +1 -1
- package/lib/commands/dataset/field-update.js +1 -1
- package/lib/commands/dataset/generate.js +1 -1
- package/lib/commands/dataset/index.js +1 -1
- package/lib/commands/dataset/list.js +1 -1
- package/lib/commands/dataset/operations.js +1 -1
- package/lib/commands/dataset/relation-audit.js +1 -1
- package/lib/commands/dataset/relation-create.js +1 -1
- package/lib/commands/dataset/relation-delete.js +1 -1
- package/lib/commands/dataset/relation-shared.js +1 -1
- package/lib/commands/dataset/relation-update.js +1 -1
- package/lib/commands/dataset/relations.js +1 -1
- package/lib/commands/dataset/rename.js +1 -1
- package/lib/commands/dataset/restore.js +1 -1
- package/lib/commands/db/analysis-batching.js +1 -1
- package/lib/commands/db/analyze-batch-plan.js +1 -1
- package/lib/commands/db/analyze-cancel.js +1 -1
- package/lib/commands/db/analyze-start.js +1 -1
- package/lib/commands/db/analyze-status.js +1 -1
- package/lib/commands/db/create.js +1 -1
- package/lib/commands/db/delete.js +1 -1
- package/lib/commands/db/detail.js +1 -1
- package/lib/commands/db/diff-refresh-start.js +1 -1
- package/lib/commands/db/diff-refresh-status.js +1 -1
- package/lib/commands/db/diff.js +1 -1
- package/lib/commands/db/index.js +1 -1
- package/lib/commands/db/list.js +1 -1
- package/lib/commands/db/shared.js +1 -1
- package/lib/commands/db/table-diff-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/issue/index.js +1 -1
- package/lib/commands/issue/nudge.js +1 -1
- package/lib/commands/issue/report.js +1 -1
- package/lib/commands/issue/shared.js +1 -1
- package/lib/commands/kb/create.js +1 -1
- package/lib/commands/kb/delete.js +1 -1
- package/lib/commands/kb/detail.js +1 -1
- package/lib/commands/kb/index.js +1 -1
- package/lib/commands/kb/list.js +1 -1
- package/lib/commands/kb/search.js +1 -1
- package/lib/commands/kb/shared.js +1 -1
- package/lib/commands/kb/update.js +1 -1
- package/lib/commands/logs/index.js +1 -1
- package/lib/commands/menu/asset-update.js +1 -1
- package/lib/commands/menu/delete.js +1 -1
- package/lib/commands/menu/external-link-create.js +1 -1
- package/lib/commands/menu/external-link-update.js +1 -1
- package/lib/commands/menu/group-create.js +1 -1
- package/lib/commands/menu/group-update.js +1 -1
- package/lib/commands/menu/index.js +1 -1
- package/lib/commands/menu/list.js +1 -1
- package/lib/commands/menu/move.js +1 -1
- package/lib/commands/menu/regroup-start.js +1 -1
- package/lib/commands/menu/rename.js +1 -1
- package/lib/commands/menu/shared/compare-table.js +1 -1
- package/lib/commands/menu/shared/delete-plan.js +1 -1
- package/lib/commands/menu/shared/facts.js +1 -1
- package/lib/commands/menu/shared/index.js +1 -1
- package/lib/commands/menu/shared/inquirer.js +1 -1
- package/lib/commands/menu/shared/local-pages.js +1 -1
- package/lib/commands/menu/shared/logic.js +1 -1
- package/lib/commands/menu/shared/mutations.js +1 -1
- package/lib/commands/menu/shared/service.js +1 -1
- package/lib/commands/menu/shared/sync-core.js +1 -1
- package/lib/commands/menu/shared/update-core.js +1 -1
- package/lib/commands/menu/shared/valid-url.js +1 -1
- package/lib/commands/menu/sync.js +1 -1
- package/lib/commands/menu/visibility-update.js +1 -1
- package/lib/commands/notification/config-create.js +1 -1
- package/lib/commands/notification/config-delete.js +1 -1
- package/lib/commands/notification/config-list.js +1 -1
- package/lib/commands/notification/config-update.js +1 -1
- package/lib/commands/notification/index.js +1 -1
- package/lib/commands/notification/shared.js +1 -1
- package/lib/commands/ocr/index.js +1 -1
- package/lib/commands/page/create.js +1 -1
- package/lib/commands/page/custom/detail.js +1 -1
- package/lib/commands/page/custom/list.js +1 -1
- package/lib/commands/page/custom/publish.js +1 -1
- package/lib/commands/page/custom/shared.js +1 -1
- package/lib/commands/page/custom/syntax.js +1 -1
- package/lib/commands/page/custom/template.js +1 -1
- package/lib/commands/page/custom/update.js +1 -1
- package/lib/commands/page/data-list-status.js +1 -1
- package/lib/commands/page/generate-start.js +1 -1
- package/lib/commands/page/generate-status.js +1 -1
- package/lib/commands/page/index.js +1 -1
- package/lib/commands/page/pull.js +1 -1
- package/lib/commands/page/push.js +1 -1
- package/lib/commands/page/relation-audit.js +1 -1
- package/lib/commands/page/restore.js +1 -1
- package/lib/commands/page/shared.js +1 -1
- package/lib/commands/page/sync.js +1 -1
- package/lib/commands/project/create/enhanced-guided-create.js +1 -1
- package/lib/commands/project/create/format-elapsed.js +1 -1
- package/lib/commands/project/create/main.js +1 -1
- package/lib/commands/project/create/materialize-project-template.js +1 -1
- package/lib/commands/project/create/project-name.js +1 -1
- package/lib/commands/project/create/project-template-archive.js +1 -1
- package/lib/commands/project/create/project-template-path.js +1 -1
- package/lib/commands/project/create/use-copy-project-template.js +1 -1
- package/lib/commands/project/create/use-format-code.js +1 -1
- package/lib/commands/project/create/use-install-dependencies.js +1 -1
- package/lib/commands/project/index.js +1 -1
- package/lib/commands/project/upgrade.js +1 -1
- package/lib/commands/registry.js +1 -1
- package/lib/commands/role/delete.js +1 -1
- package/lib/commands/role/detail.js +1 -1
- package/lib/commands/role/index.js +1 -1
- package/lib/commands/role/list.js +1 -1
- package/lib/commands/role/shared.js +1 -1
- package/lib/commands/role/update.js +1 -1
- package/lib/commands/role/user-add.js +1 -1
- package/lib/commands/role/user-remove.js +1 -1
- package/lib/commands/role/user-resolve.js +1 -1
- package/lib/commands/run/index.js +1 -1
- package/lib/commands/schema.js +1 -1
- package/lib/commands/sql/create.js +1 -1
- package/lib/commands/sql/delete.js +1 -1
- package/lib/commands/sql/detail.js +1 -1
- package/lib/commands/sql/exec.js +1 -1
- package/lib/commands/sql/index.js +1 -1
- package/lib/commands/sql/list.js +1 -1
- package/lib/commands/sql/pull.js +1 -1
- package/lib/commands/sql/push.js +1 -1
- package/lib/commands/sql/shared.js +1 -1
- package/lib/commands/sql/status.js +1 -1
- package/lib/commands/sql/validate.js +1 -1
- package/lib/commands/task/index.js +1 -1
- package/lib/commands/task/status.js +1 -1
- package/lib/commands/tenant/index.js +1 -1
- package/lib/commands/tenant/members-list.js +1 -1
- package/lib/commands/tenant/shared.js +1 -1
- package/lib/commands/user-account/dingding-sandbox-bind.js +1 -1
- package/lib/commands/user-account/index.js +1 -1
- package/lib/commands/workspace/add.js +1 -1
- package/lib/commands/workspace/index.js +1 -1
- package/lib/commands/workspace/remove.js +1 -1
- package/lib/config/domain-config.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/region.js +1 -1
- package/lib/constant/risk.js +1 -1
- package/lib/context/app-resolver.js +1 -1
- package/lib/context/auth-resolver.js +1 -1
- package/lib/context/config-loader.js +1 -1
- package/lib/context.js +1 -1
- package/lib/core/alias-resolver.js +1 -1
- package/lib/core/api-client.js +1 -1
- package/lib/core/bff/config.js +1 -1
- package/lib/core/bff/file-system.js +1 -1
- package/lib/core/bff/hash.js +1 -1
- package/lib/core/bff/lock.js +1 -1
- package/lib/core/bff/utils.js +1 -1
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/page/file-system.js +1 -1
- package/lib/core/page/hash.js +1 -1
- package/lib/core/page/lock.js +1 -1
- package/lib/core/sql-index-auditor.js +1 -1
- package/lib/core/sql-sync/config.js +1 -1
- package/lib/core/sql-sync/file-system.js +1 -1
- package/lib/core/sql-sync/hash.js +1 -1
- package/lib/core/sql-sync/lock.js +1 -1
- package/lib/core/sql-sync/utils.js +1 -1
- package/lib/core/sql-validator.js +1 -1
- package/lib/errors.js +1 -1
- package/lib/framework/build-all-flags.js +1 -1
- package/lib/framework/error-output.js +1 -1
- package/lib/framework/explicit-yes.js +1 -1
- package/lib/framework/flags.js +1 -1
- package/lib/framework/help.js +1 -1
- package/lib/framework/index.js +1 -1
- package/lib/framework/output.js +1 -1
- package/lib/framework/response.js +1 -1
- package/lib/framework/runner-alias.js +1 -1
- package/lib/framework/runner.js +1 -1
- package/lib/framework/schema-export.js +1 -1
- package/lib/framework/types.js +1 -1
- package/lib/generated/build-info.d.ts +4 -4
- package/lib/generated/build-info.js +1 -1
- package/lib/help.js +1 -1
- package/lib/postinstall.js +1 -1
- package/lib/runtime/confirmation.js +1 -1
- package/lib/runtime/event.js +1 -1
- package/lib/runtime/index.js +1 -1
- package/lib/runtime/queue.js +1 -1
- package/lib/runtime/resolve.js +1 -1
- package/lib/skills/builtin-skill.js +1 -1
- package/lib/skills/main.js +1 -1
- package/lib/skills/npx-skills-add.js +1 -1
- package/lib/skills/skill-presence.js +1 -1
- package/lib/telemetry/cli-command-trace.js +1 -1
- package/lib/telemetry/cli-help-trace.js +1 -1
- package/lib/telemetry/ensure-cli-otel-config.js +1 -1
- package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
- package/lib/telemetry/send-cli-trace-log.js +1 -1
- package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
- package/lib/utils/ai_config.js +1 -1
- package/lib/utils/apply-jq-filter.js +1 -1
- package/lib/utils/cdn-config.js +1 -1
- package/lib/utils/check-sdk-version.js +1 -1
- package/lib/utils/cli-version-check.js +1 -1
- package/lib/utils/cli-version-policy.js +1 -1
- package/lib/utils/config.js +1 -1
- package/lib/utils/entity-with-id.js +1 -1
- package/lib/utils/file-utils.js +1 -1
- package/lib/utils/guides-cdn.js +1 -1
- package/lib/utils/http-client.js +1 -1
- package/lib/utils/is-non-interactive.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/params.js +1 -1
- package/lib/utils/platform.js +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.js +1 -1
- package/lib/utils/update-notice.js +1 -1
- package/lib/utils/version.js +1 -1
- package/lib/utils/with-active-cookie.js +1 -1
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +1 -1
- package/skills/rabetbase/SKILL.md +2 -2
- package/skills/rabetbase.manifest.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
const a178_0x19e903=a178_0x355e;(function(_0xf37989,_0x2fd630){const _0x5c76e2=a178_0x355e,_0x5a3f30=_0xf37989();while(!![]){try{const _0x119cab=-parseInt(_0x5c76e2(0x1cf))/0x1*(-parseInt(_0x5c76e2(0x1d1))/0x2)+parseInt(_0x5c76e2(0x1ad))/0x3+parseInt(_0x5c76e2(0x1ac))/0x4*(-parseInt(_0x5c76e2(0x1ce))/0x5)+parseInt(_0x5c76e2(0x1b5))/0x6*(-parseInt(_0x5c76e2(0x198))/0x7)+parseInt(_0x5c76e2(0x1a5))/0x8+-parseInt(_0x5c76e2(0x1a1))/0x9*(-parseInt(_0x5c76e2(0x1b1))/0xa)+parseInt(_0x5c76e2(0x196))/0xb*(-parseInt(_0x5c76e2(0x18a))/0xc);if(_0x119cab===_0x2fd630)break;else _0x5a3f30['push'](_0x5a3f30['shift']());}catch(_0x341dea){_0x5a3f30['push'](_0x5a3f30['shift']());}}}(a178_0x55da,0x2e257));import{getTenantMembers,listDevUserRoleRelations,listAppRoles}from'../../core/api-client.js';import{getSessionUserInfo}from'../../auth/get-session-user.js';import{CliErrors}from'../../errors.js';export const ROLE_ID_FLAG={'name':'id','type':a178_0x19e903(0x1c4),'required':!![],'description':a178_0x19e903(0x1a0)};export const ROLE_REF_FLAG={'name':a178_0x19e903(0x1b9),'type':'string','required':!![],'description':'Role\x20id\x20or\x20exact\x20role\x20name'};export const USER_REF_FLAG={'name':a178_0x19e903(0x189),'type':'string','required':!![],'description':'User\x20id,\x20username,\x20or\x20nickname\x20to\x20resolve\x20to\x20a\x20userId'};export const NAME_FLAG={'name':a178_0x19e903(0x188),'type':a178_0x19e903(0x1c2),'required':!![],'description':a178_0x19e903(0x1a2)};export const USER_NAME_FLAG={'name':a178_0x19e903(0x188),'type':'string','required':!![],'description':'Nickname\x20or\x20username\x20to\x20resolve\x20to\x20a\x20userId'};export const REMARK_FLAG={'name':a178_0x19e903(0x186),'type':'string','required':![],'description':'Optional\x20role\x20remark/description'};function a178_0x55da(){const _0x6dd09a=['Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.','\x20is\x20already\x20a\x20member\x20of\x20role\x20','36256phcywd','Pass\x20--user\x20<id|name>.','1387946BFNkNK','validation','nickname','Pass\x20--role\x20<id|name>.','username','push','dryRun','/smartapi/permit/user-role/delete','Role\x20id\x20(from\x20`role\x20list`)','284499ViHcLD','Role\x20name','roleType','\x20is\x20not\x20a\x20member\x20of\x20role\x20','1943992exMNrX','ADMIN','\x20duplicate\x20memberships\x20for\x20user\x20','tenant_code','Role\x20name\x20\x22','\x22:\x20','Check\x20the\x20nickname/username.\x20','8ptGTTF','18957pIJSQg','\x20members\x20of\x20the\x20OWNER\x20role.','user-add','trim','50BKWoCc','userCount','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles,\x20or\x20pass\x20--role\x20<id>.',';\x20no\x20change.','6jCNBuK','test','join','Cannot\x20resolve\x20current\x20tenant.\x20Run\x20`rabetbase\x20auth\x20login`\x20first.','role','expectUserCount','Only\x20CUSTOM\x20roles\x20can\x20be\x20modified\x20or\x20deleted.','toLowerCase','filter','roleName','totalCount','userId','map','string','str','number','Missing\x20user\x20reference.','flagMissing','length','Role\x20id\x20','\x20built-in\x20role\x20','tenant','includes','\x22\x20is\x20ambiguous\x20(ids:\x20','flag','277775vppcZO','15721xVzyYC','Multiple\x20tenant\x20members\x20match\x20\x22','12ZdLSpg','Pass\x20--user\x20<id>.','No\x20tenant\x20member\x20matches\x20\x22','remark','appCode','name','user','12GMAJHJ','Use\x20the\x20platform\x20ownership-transfer\x20workflow\x20to\x20change\x20the\x20application\x20owner.','find','/smartapi/permit/user-role/create','dev','DEV','\x20not\x20found\x20in\x20app\x20','\x20member(s)\x20but\x20role\x20has\x20','\x22\x20not\x20found\x20in\x20app\x20','permitCount'];a178_0x55da=function(){return _0x6dd09a;};return a178_0x55da();}export const EXPECT_USER_COUNT_FLAG={'name':'expect-user-count','type':a178_0x19e903(0x1c4),'required':![],'description':'Anti-drift\x20guard:\x20fail\x20if\x20the\x20role\x27s\x20current\x20member\x20count\x20differs'};export const BUILTIN_ROLE_TYPES=[a178_0x19e903(0x1a6),a178_0x19e903(0x18f),'OWNER'];export function isBuiltinRole(_0x49e8a5){const _0x3d863f=a178_0x19e903;return BUILTIN_ROLE_TYPES[_0x3d863f(0x1cb)](_0x49e8a5);}export function assertCustomRole(_0x870e7d,_0x225b41){const _0xe5f7a0=a178_0x19e903;if(_0x870e7d[_0xe5f7a0(0x1a3)]!=='CUSTOM')throw CliErrors['validation']('Cannot\x20'+_0x225b41+_0xe5f7a0(0x1c9)+_0x870e7d[_0xe5f7a0(0x1be)]+'\x20('+_0x870e7d[_0xe5f7a0(0x1a3)]+').',_0xe5f7a0(0x1bb));}export function projectRole(_0x537951){const _0x395319=a178_0x19e903;return{'id':_0x537951['id'],'roleName':_0x537951[_0x395319(0x1be)],'roleType':_0x537951[_0x395319(0x1a3)],'remark':_0x537951[_0x395319(0x186)],'userCount':_0x537951[_0x395319(0x1b2)],'permitCount':_0x537951[_0x395319(0x193)],'builtin':isBuiltinRole(_0x537951[_0x395319(0x1a3)])};}export async function resolveRoleRef(_0x41846e,_0x29a86a){const _0x13713d=a178_0x19e903,_0x122129=_0x29a86a[_0x13713d(0x1b0)]();if(!_0x122129)throw CliErrors['validation']('Missing\x20role\x20reference.',_0x13713d(0x19b));if(/^\d+$/[_0x13713d(0x1b6)](_0x122129))return getRoleById(_0x41846e,Number(_0x122129));const _0x11465=await listAllAppRoles(_0x41846e),_0xdddaf6=_0x11465[_0x13713d(0x1bd)](_0x2813ed=>_0x2813ed['roleName']===_0x122129);if(_0xdddaf6['length']===0x0)throw CliErrors[_0x13713d(0x199)](_0x13713d(0x1a9)+_0x122129+_0x13713d(0x192)+_0x41846e+'.',_0x13713d(0x1b3));if(_0xdddaf6['length']>0x1){const _0x356d8f=_0xdddaf6[_0x13713d(0x1c1)](_0x4f3d58=>_0x4f3d58['id'])[_0x13713d(0x1b7)](',\x20');throw CliErrors['validation'](_0x13713d(0x1a9)+_0x122129+_0x13713d(0x1cc)+_0x356d8f+').','Disambiguate\x20with\x20--role\x20<id>.');}return _0xdddaf6[0x0];}export async function getRoleById(_0x2e384a,_0x29ee3b){const _0x7a555=a178_0x19e903,_0x581774=await listAllAppRoles(_0x2e384a),_0x564e5b=_0x581774[_0x7a555(0x1bd)](_0x3a1a18=>_0x3a1a18['id']===_0x29ee3b&&(!_0x3a1a18[_0x7a555(0x187)]||_0x3a1a18[_0x7a555(0x187)]===_0x2e384a));if(_0x564e5b[_0x7a555(0x1c7)]!==0x1)throw CliErrors[_0x7a555(0x199)](_0x7a555(0x1c8)+_0x29ee3b+_0x7a555(0x190)+_0x2e384a+'.',_0x7a555(0x194));return _0x564e5b[0x0];}async function listAllAppRoles(_0x85e207){const _0x4ff196=a178_0x19e903,_0x37a36c=0x64,_0x55155e=[];for(let _0x586ab6=0x1;;_0x586ab6+=0x1){const {items:_0x2de4b3,paging:_0x51a7e8}=await listAppRoles(_0x85e207,{'currentPage':_0x586ab6,'pageSize':_0x37a36c});_0x55155e['push'](..._0x2de4b3);if(_0x2de4b3[_0x4ff196(0x1c7)]<_0x37a36c||_0x51a7e8&&_0x55155e[_0x4ff196(0x1c7)]>=_0x51a7e8[_0x4ff196(0x1bf)])return _0x55155e;}}export async function resolveTenantCode(){const _0x256e72=a178_0x19e903,_0x15dba9=await getSessionUserInfo(),_0x15e8bc=_0x15dba9?.[_0x256e72(0x189)]?.[_0x256e72(0x1ca)]?.[_0x256e72(0x1a8)];if(!_0x15e8bc)throw CliErrors['authRequired'](_0x256e72(0x1b8));return _0x15e8bc;}function matchMember(_0x453b4d,_0x376673){const _0x42a002=a178_0x19e903,_0x3cbfa2=_0x376673[_0x42a002(0x1b0)]()[_0x42a002(0x1bc)]();return(_0x453b4d[_0x42a002(0x19a)]??'')['toLowerCase']()===_0x3cbfa2||(_0x453b4d[_0x42a002(0x19c)]??'')[_0x42a002(0x1bc)]()===_0x3cbfa2;}function a178_0x355e(_0x3cf0a1,_0x20f0a2){_0x3cf0a1=_0x3cf0a1-0x186;const _0x55da6f=a178_0x55da();let _0x355e91=_0x55da6f[_0x3cf0a1];return _0x355e91;}export async function resolveUserRef(_0x17acc1,_0x576931=a178_0x19e903(0x1d2)){const _0x1314eb=a178_0x19e903,_0x2e2541=_0x17acc1[_0x1314eb(0x1b0)]();if(!_0x2e2541)throw CliErrors[_0x1314eb(0x199)](_0x1314eb(0x1c5),_0x1314eb(0x197));const _0x1e58e8=await resolveTenantCode(),_0xe70493=await getTenantMembers(_0x1e58e8);if(/^\d+$/[_0x1314eb(0x1b6)](_0x2e2541)){const _0xd6eadb=Number(_0x2e2541),_0x1e9bfd=_0xe70493[_0x1314eb(0x18c)](_0x4f3c36=>_0x4f3c36[_0x1314eb(0x1c0)]===_0xd6eadb);return{'userId':_0xd6eadb,'username':_0x1e9bfd?.['username']??String(_0xd6eadb),'nickname':_0x1e9bfd?.['nickname'],'matchedBy':'id'};}const _0x5ed2f6=_0xe70493[_0x1314eb(0x1bd)](_0x45d488=>matchMember(_0x45d488,_0x2e2541));if(_0x5ed2f6[_0x1314eb(0x1c7)]===0x0)throw CliErrors[_0x1314eb(0x199)](_0x1314eb(0x1d3)+_0x2e2541+'\x22.',_0x1314eb(0x1ab)+_0x576931);if(_0x5ed2f6['length']>0x1){const _0x2ef22c=_0x5ed2f6[_0x1314eb(0x1c1)](_0x371f43=>(_0x371f43[_0x1314eb(0x19a)]??_0x371f43[_0x1314eb(0x19c)]??'?')+'('+_0x371f43[_0x1314eb(0x1c0)]+')')[_0x1314eb(0x1b7)](',\x20');throw CliErrors[_0x1314eb(0x199)](_0x1314eb(0x1d0)+_0x2e2541+_0x1314eb(0x1aa)+_0x2ef22c+'.',_0x576931);}const _0x210f69=_0x5ed2f6[0x0];return{'userId':_0x210f69['userId'],'username':_0x210f69[_0x1314eb(0x19c)]??String(_0x210f69[_0x1314eb(0x1c0)]),'nickname':_0x210f69['nickname'],'matchedBy':_0x1314eb(0x188)};}export const CREATE_USER_ROLE_PATH=a178_0x19e903(0x18d);export const DELETE_USER_ROLE_PATH=a178_0x19e903(0x19f);export function computeRoleUserMutation(_0x5dd141){const _0x20c905=a178_0x19e903,{operation:_0x131bda,appCode:_0x18ca11,role:_0x101e02,relations:_0x441bc2,user:_0x12a03c}=_0x5dd141,_0x455e8f=[...new Set(_0x441bc2[_0x20c905(0x1c1)](_0x35038e=>_0x35038e[_0x20c905(0x1c0)]))],_0x266e94=[];if(_0x5dd141[_0x20c905(0x1ba)]!==undefined&&_0x5dd141[_0x20c905(0x1ba)]!==_0x455e8f[_0x20c905(0x1c7)])throw CliErrors['validation']('Anti-drift\x20check\x20failed:\x20expected\x20'+_0x5dd141['expectUserCount']+_0x20c905(0x191)+_0x455e8f[_0x20c905(0x1c7)]+'.','Re-run\x20`role\x20detail`\x20/\x20`role\x20list`\x20and\x20retry\x20with\x20the\x20current\x20count.');const _0x56f1c4=_0x455e8f[_0x20c905(0x1cb)](_0x12a03c[_0x20c905(0x1c0)]),_0x62b055=_0x441bc2['filter'](_0x18cdcd=>_0x18cdcd[_0x20c905(0x1c0)]===_0x12a03c['userId'])[_0x20c905(0x1c1)](_0x22d5a6=>_0x22d5a6['id']),_0x4f4e0b=_0x131bda===_0x20c905(0x1af)?!_0x56f1c4:_0x56f1c4;let _0x23b63d=_0x455e8f;_0x131bda===_0x20c905(0x1af)?_0x56f1c4?_0x266e94['push']('User\x20'+_0x12a03c['userId']+_0x20c905(0x195)+_0x101e02[_0x20c905(0x1be)]+_0x20c905(0x1b4)):_0x23b63d=[..._0x455e8f,_0x12a03c['userId']]:!_0x56f1c4?_0x266e94[_0x20c905(0x19d)]('User\x20'+_0x12a03c['userId']+_0x20c905(0x1a4)+_0x101e02['roleName']+_0x20c905(0x1b4)):(_0x23b63d=_0x455e8f[_0x20c905(0x1bd)](_0x4c48e6=>_0x4c48e6!==_0x12a03c['userId']),_0x62b055[_0x20c905(0x1c7)]>0x1&&_0x266e94[_0x20c905(0x19d)]('Removed\x20'+_0x62b055[_0x20c905(0x1c7)]+_0x20c905(0x1a7)+_0x12a03c[_0x20c905(0x1c0)]+'.'));const _0x5d910d={'scope':_0x20c905(0x18e),'operation':_0x131bda,'selector':{'appCode':_0x18ca11,'roleId':_0x101e02['id'],'roleName':_0x101e02[_0x20c905(0x1be)],'userId':_0x12a03c[_0x20c905(0x1c0)]},'before':{'userIds':_0x455e8f},'after':{'userIds':_0x23b63d},'dryRun':_0x5dd141[_0x20c905(0x19e)],'backend':{'method':'POST','path':_0x131bda==='user-add'?CREATE_USER_ROLE_PATH:DELETE_USER_ROLE_PATH},'warnings':_0x266e94};return{'mutation':_0x5d910d,'changed':_0x4f4e0b,'matchingRelationIds':_0x62b055};}export async function loadDevRoleRelations(_0x42d653,_0x33e29c){const _0x57bc55=a178_0x19e903,_0x2cb412=0x64,_0x5b1b21=[];for(let _0x22fb65=0x1;;_0x22fb65+=0x1){const {items:_0x4a25d0,paging:_0x4e3278}=await listDevUserRoleRelations(_0x42d653,{'roleId':_0x33e29c,'currentPage':_0x22fb65,'pageSize':_0x2cb412});_0x5b1b21['push'](..._0x4a25d0);if(_0x4a25d0[_0x57bc55(0x1c7)]<_0x2cb412||_0x4e3278&&_0x5b1b21['length']>=_0x4e3278['totalCount'])return _0x5b1b21;}}export function readRoleRef(_0x2082c9){const _0x380bdd=a178_0x19e903,_0x2001a9=_0x2082c9[_0x380bdd(0x1c3)](_0x380bdd(0x1b9))[_0x380bdd(0x1b0)]();if(!_0x2001a9)throw CliErrors[_0x380bdd(0x1c6)](_0x380bdd(0x1b9),'Pass\x20--role\x20<id|name>.');return _0x2001a9;}export async function prepareUserMutation(_0x22e066,_0x561f86,_0x54ab2e){const _0x258e5a=a178_0x19e903,_0x1e462b=readRoleRef(_0x22e066),_0x704c9e=_0x22e066[_0x258e5a(0x1c3)]('user')[_0x258e5a(0x1b0)]();if(!_0x704c9e)throw CliErrors[_0x258e5a(0x1c6)](_0x258e5a(0x189),'Pass\x20--user\x20<id|name>.');const _0x5edddd=_0x22e066[_0x258e5a(0x1cd)]('expect-user-count'),_0x17d688=_0x5edddd===undefined||_0x5edddd===null?undefined:Number(_0x5edddd),_0x5b6aec=await resolveRoleRef(_0x22e066[_0x258e5a(0x187)],_0x1e462b);if(_0x5b6aec['roleType']==='OWNER')throw CliErrors[_0x258e5a(0x199)]('Cannot\x20'+_0x561f86+_0x258e5a(0x1ae),_0x258e5a(0x18b));const _0x184fef=await resolveUserRef(_0x704c9e),_0x4bc4d7=await loadDevRoleRelations(_0x22e066[_0x258e5a(0x187)],_0x5b6aec['id']);return{...computeRoleUserMutation({'operation':_0x561f86,'appCode':_0x22e066[_0x258e5a(0x187)],'role':_0x5b6aec,'relations':_0x4bc4d7,'user':{'userId':_0x184fef[_0x258e5a(0x1c0)],'username':_0x184fef[_0x258e5a(0x19c)],'nickname':_0x184fef[_0x258e5a(0x19a)]},'dryRun':_0x54ab2e,..._0x17d688!==undefined?{'expectUserCount':_0x17d688}:{}}),'role':_0x5b6aec,'user':_0x184fef};}
|
|
1
|
+
const a178_0x1bf84c=a178_0x1c5d;(function(_0x555d14,_0x3e5b74){const _0x4f744b=a178_0x1c5d,_0x377e63=_0x555d14();while(!![]){try{const _0x30da00=parseInt(_0x4f744b(0x188))/0x1*(-parseInt(_0x4f744b(0x160))/0x2)+parseInt(_0x4f744b(0x185))/0x3+parseInt(_0x4f744b(0x17d))/0x4+parseInt(_0x4f744b(0x15c))/0x5*(parseInt(_0x4f744b(0x16b))/0x6)+parseInt(_0x4f744b(0x157))/0x7+parseInt(_0x4f744b(0x167))/0x8+-parseInt(_0x4f744b(0x178))/0x9;if(_0x30da00===_0x3e5b74)break;else _0x377e63['push'](_0x377e63['shift']());}catch(_0x4afdd0){_0x377e63['push'](_0x377e63['shift']());}}}(a178_0x5236,0xde3dd));import{getTenantMembers,listDevUserRoleRelations,listAppRoles}from'../../core/api-client.js';import{getSessionUserInfo}from'../../auth/get-session-user.js';import{CliErrors}from'../../errors.js';function a178_0x5236(){const _0x155656=['Role\x20id\x20','\x20members\x20of\x20the\x20OWNER\x20role.','Optional\x20role\x20remark/description','flagMissing','User\x20','number','Missing\x20role\x20reference.','Anti-drift\x20check\x20failed:\x20expected\x20','str','trim','\x20is\x20already\x20a\x20member\x20of\x20role\x20','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles,\x20or\x20pass\x20--role\x20<id>.','totalCount',';\x20no\x20change.','filter','\x20is\x20not\x20a\x20member\x20of\x20role\x20','592172SbRnjs','\x20not\x20found\x20in\x20app\x20','\x22\x20is\x20ambiguous\x20(ids:\x20','toLowerCase','expect-user-count','4110515JJQOgP','validation','nickname','CUSTOM','1532956meFUTj','Missing\x20user\x20reference.','find','Check\x20the\x20nickname/username.\x20','user-add','Anti-drift\x20guard:\x20fail\x20if\x20the\x20role\x27s\x20current\x20member\x20count\x20differs','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.','13785584DGDUIL','ADMIN','roleType','\x20duplicate\x20memberships\x20for\x20user\x20','12mRqyGf','name','push','Cannot\x20','Disambiguate\x20with\x20--role\x20<id>.','tenant_code','Role\x20id\x20(from\x20`role\x20list`)','\x20member(s)\x20but\x20role\x20has\x20','string','role','/smartapi/permit/user-role/create','permitCount','Pass\x20--role\x20<id|name>.','24434721yTHXBb','expectUserCount','Role\x20id\x20or\x20exact\x20role\x20name','userId','Pass\x20--user\x20<id|name>.','3660656JYqbsU','authRequired','user','OWNER','includes','dryRun','map','flag','2373186SVgcgr','Nickname\x20or\x20username\x20to\x20resolve\x20to\x20a\x20userId','Pass\x20--user\x20<id>.','2DHrQNC','userCount','tenant','username','appCode','Only\x20CUSTOM\x20roles\x20can\x20be\x20modified\x20or\x20deleted.','Role\x20name\x20\x22','roleName','remark','test','length','/smartapi/permit/user-role/delete'];a178_0x5236=function(){return _0x155656;};return a178_0x5236();}export const ROLE_ID_FLAG={'name':'id','type':a178_0x1bf84c(0x14c),'required':!![],'description':a178_0x1bf84c(0x171)};export const ROLE_REF_FLAG={'name':'role','type':'string','required':!![],'description':a178_0x1bf84c(0x17a)};export const USER_REF_FLAG={'name':'user','type':'string','required':!![],'description':'User\x20id,\x20username,\x20or\x20nickname\x20to\x20resolve\x20to\x20a\x20userId'};export const NAME_FLAG={'name':a178_0x1bf84c(0x16c),'type':a178_0x1bf84c(0x173),'required':!![],'description':'Role\x20name'};export const USER_NAME_FLAG={'name':a178_0x1bf84c(0x16c),'type':a178_0x1bf84c(0x173),'required':!![],'description':a178_0x1bf84c(0x186)};export const REMARK_FLAG={'name':a178_0x1bf84c(0x143),'type':'string','required':![],'description':a178_0x1bf84c(0x149)};export const EXPECT_USER_COUNT_FLAG={'name':'expect-user-count','type':a178_0x1bf84c(0x14c),'required':![],'description':a178_0x1bf84c(0x165)};export const BUILTIN_ROLE_TYPES=[a178_0x1bf84c(0x168),'DEV','OWNER'];export function isBuiltinRole(_0x3d5fe2){const _0x516e9b=a178_0x1bf84c;return BUILTIN_ROLE_TYPES[_0x516e9b(0x181)](_0x3d5fe2);}export function assertCustomRole(_0x749aa7,_0x2c2b29){const _0xcf551f=a178_0x1bf84c;if(_0x749aa7[_0xcf551f(0x169)]!==_0xcf551f(0x15f))throw CliErrors[_0xcf551f(0x15d)]('Cannot\x20'+_0x2c2b29+'\x20built-in\x20role\x20'+_0x749aa7['roleName']+'\x20('+_0x749aa7['roleType']+').',_0xcf551f(0x18d));}export function projectRole(_0x1b0b34){const _0x3f5373=a178_0x1bf84c;return{'id':_0x1b0b34['id'],'roleName':_0x1b0b34[_0x3f5373(0x142)],'roleType':_0x1b0b34['roleType'],'remark':_0x1b0b34[_0x3f5373(0x143)],'userCount':_0x1b0b34[_0x3f5373(0x189)],'permitCount':_0x1b0b34[_0x3f5373(0x176)],'builtin':isBuiltinRole(_0x1b0b34[_0x3f5373(0x169)])};}export async function resolveRoleRef(_0x348cd8,_0x51190b){const _0x1f613a=a178_0x1bf84c,_0xeb4715=_0x51190b[_0x1f613a(0x150)]();if(!_0xeb4715)throw CliErrors['validation'](_0x1f613a(0x14d),_0x1f613a(0x177));if(/^\d+$/[_0x1f613a(0x144)](_0xeb4715))return getRoleById(_0x348cd8,Number(_0xeb4715));const _0x3ec2d7=await listAllAppRoles(_0x348cd8),_0x1086fb=_0x3ec2d7[_0x1f613a(0x155)](_0x5196d2=>_0x5196d2[_0x1f613a(0x142)]===_0xeb4715);if(_0x1086fb['length']===0x0)throw CliErrors[_0x1f613a(0x15d)](_0x1f613a(0x141)+_0xeb4715+'\x22\x20not\x20found\x20in\x20app\x20'+_0x348cd8+'.',_0x1f613a(0x152));if(_0x1086fb[_0x1f613a(0x145)]>0x1){const _0x10af14=_0x1086fb[_0x1f613a(0x183)](_0x2f8573=>_0x2f8573['id'])['join'](',\x20');throw CliErrors[_0x1f613a(0x15d)]('Role\x20name\x20\x22'+_0xeb4715+_0x1f613a(0x159)+_0x10af14+').',_0x1f613a(0x16f));}return _0x1086fb[0x0];}export async function getRoleById(_0x4704ac,_0x4ef812){const _0x49c92a=a178_0x1bf84c,_0x1b94bd=await listAllAppRoles(_0x4704ac),_0x1d9128=_0x1b94bd['filter'](_0xcd5507=>_0xcd5507['id']===_0x4ef812&&(!_0xcd5507[_0x49c92a(0x18c)]||_0xcd5507[_0x49c92a(0x18c)]===_0x4704ac));if(_0x1d9128[_0x49c92a(0x145)]!==0x1)throw CliErrors[_0x49c92a(0x15d)](_0x49c92a(0x147)+_0x4ef812+_0x49c92a(0x158)+_0x4704ac+'.',_0x49c92a(0x166));return _0x1d9128[0x0];}async function listAllAppRoles(_0x57151f){const _0x3deaf6=a178_0x1bf84c,_0x2bfc2e=0x64,_0x2b667f=[];for(let _0x9f84fb=0x1;;_0x9f84fb+=0x1){const {items:_0x5d1af2,paging:_0x5924a2}=await listAppRoles(_0x57151f,{'currentPage':_0x9f84fb,'pageSize':_0x2bfc2e});_0x2b667f[_0x3deaf6(0x16d)](..._0x5d1af2);if(_0x5d1af2[_0x3deaf6(0x145)]<_0x2bfc2e||_0x5924a2&&_0x2b667f[_0x3deaf6(0x145)]>=_0x5924a2[_0x3deaf6(0x153)])return _0x2b667f;}}export async function resolveTenantCode(){const _0x2c9566=a178_0x1bf84c,_0x38e360=await getSessionUserInfo(),_0x443903=_0x38e360?.[_0x2c9566(0x17f)]?.[_0x2c9566(0x18a)]?.[_0x2c9566(0x170)];if(!_0x443903)throw CliErrors[_0x2c9566(0x17e)]('Cannot\x20resolve\x20current\x20tenant.\x20Run\x20`rabetbase\x20auth\x20login`\x20first.');return _0x443903;}function a178_0x1c5d(_0x497bd2,_0x6f48fe){_0x497bd2=_0x497bd2-0x141;const _0x5236cc=a178_0x5236();let _0x1c5db1=_0x5236cc[_0x497bd2];return _0x1c5db1;}function matchMember(_0x4e176c,_0x300b28){const _0x41e5ba=a178_0x1bf84c,_0x7c3098=_0x300b28['trim']()[_0x41e5ba(0x15a)]();return(_0x4e176c[_0x41e5ba(0x15e)]??'')[_0x41e5ba(0x15a)]()===_0x7c3098||(_0x4e176c[_0x41e5ba(0x18b)]??'')['toLowerCase']()===_0x7c3098;}export async function resolveUserRef(_0x2eab44,_0x3474c5=a178_0x1bf84c(0x187)){const _0x1eb35b=a178_0x1bf84c,_0x1bfd4f=_0x2eab44['trim']();if(!_0x1bfd4f)throw CliErrors['validation'](_0x1eb35b(0x161),'Pass\x20--user\x20<id|name>.');const _0x3a0ee4=await resolveTenantCode(),_0x2272c6=await getTenantMembers(_0x3a0ee4);if(/^\d+$/[_0x1eb35b(0x144)](_0x1bfd4f)){const _0x36d6b5=Number(_0x1bfd4f),_0x1d05a7=_0x2272c6[_0x1eb35b(0x162)](_0x15ae4b=>_0x15ae4b[_0x1eb35b(0x17b)]===_0x36d6b5);return{'userId':_0x36d6b5,'username':_0x1d05a7?.[_0x1eb35b(0x18b)]??String(_0x36d6b5),'nickname':_0x1d05a7?.[_0x1eb35b(0x15e)],'matchedBy':'id'};}const _0x1357eb=_0x2272c6[_0x1eb35b(0x155)](_0x2333b2=>matchMember(_0x2333b2,_0x1bfd4f));if(_0x1357eb[_0x1eb35b(0x145)]===0x0)throw CliErrors[_0x1eb35b(0x15d)]('No\x20tenant\x20member\x20matches\x20\x22'+_0x1bfd4f+'\x22.',_0x1eb35b(0x163)+_0x3474c5);if(_0x1357eb[_0x1eb35b(0x145)]>0x1){const _0x26d64e=_0x1357eb[_0x1eb35b(0x183)](_0x388ef1=>(_0x388ef1[_0x1eb35b(0x15e)]??_0x388ef1[_0x1eb35b(0x18b)]??'?')+'('+_0x388ef1['userId']+')')['join'](',\x20');throw CliErrors[_0x1eb35b(0x15d)]('Multiple\x20tenant\x20members\x20match\x20\x22'+_0x1bfd4f+'\x22:\x20'+_0x26d64e+'.',_0x3474c5);}const _0x216489=_0x1357eb[0x0];return{'userId':_0x216489['userId'],'username':_0x216489[_0x1eb35b(0x18b)]??String(_0x216489[_0x1eb35b(0x17b)]),'nickname':_0x216489[_0x1eb35b(0x15e)],'matchedBy':_0x1eb35b(0x16c)};}export const CREATE_USER_ROLE_PATH=a178_0x1bf84c(0x175);export const DELETE_USER_ROLE_PATH=a178_0x1bf84c(0x146);export function computeRoleUserMutation(_0x3300ed){const _0x1d090b=a178_0x1bf84c,{operation:_0x4d977b,appCode:_0x2d6b92,role:_0x112f95,relations:_0x237d4b,user:_0x2c697a}=_0x3300ed,_0x4598c5=[...new Set(_0x237d4b[_0x1d090b(0x183)](_0x419afe=>_0x419afe[_0x1d090b(0x17b)]))],_0x36192d=[];if(_0x3300ed[_0x1d090b(0x179)]!==undefined&&_0x3300ed[_0x1d090b(0x179)]!==_0x4598c5['length'])throw CliErrors[_0x1d090b(0x15d)](_0x1d090b(0x14e)+_0x3300ed[_0x1d090b(0x179)]+_0x1d090b(0x172)+_0x4598c5[_0x1d090b(0x145)]+'.','Re-run\x20`role\x20detail`\x20/\x20`role\x20list`\x20and\x20retry\x20with\x20the\x20current\x20count.');const _0x9cbea=_0x4598c5[_0x1d090b(0x181)](_0x2c697a[_0x1d090b(0x17b)]),_0x3b7c75=_0x237d4b[_0x1d090b(0x155)](_0x3992c9=>_0x3992c9[_0x1d090b(0x17b)]===_0x2c697a[_0x1d090b(0x17b)])['map'](_0xea21f3=>_0xea21f3['id']),_0x5b2ee0=_0x4d977b===_0x1d090b(0x164)?!_0x9cbea:_0x9cbea;let _0x164d4c=_0x4598c5;_0x4d977b===_0x1d090b(0x164)?_0x9cbea?_0x36192d[_0x1d090b(0x16d)]('User\x20'+_0x2c697a['userId']+_0x1d090b(0x151)+_0x112f95[_0x1d090b(0x142)]+_0x1d090b(0x154)):_0x164d4c=[..._0x4598c5,_0x2c697a[_0x1d090b(0x17b)]]:!_0x9cbea?_0x36192d[_0x1d090b(0x16d)](_0x1d090b(0x14b)+_0x2c697a[_0x1d090b(0x17b)]+_0x1d090b(0x156)+_0x112f95[_0x1d090b(0x142)]+_0x1d090b(0x154)):(_0x164d4c=_0x4598c5['filter'](_0x41b886=>_0x41b886!==_0x2c697a[_0x1d090b(0x17b)]),_0x3b7c75[_0x1d090b(0x145)]>0x1&&_0x36192d[_0x1d090b(0x16d)]('Removed\x20'+_0x3b7c75[_0x1d090b(0x145)]+_0x1d090b(0x16a)+_0x2c697a['userId']+'.'));const _0x5436ef={'scope':'dev','operation':_0x4d977b,'selector':{'appCode':_0x2d6b92,'roleId':_0x112f95['id'],'roleName':_0x112f95['roleName'],'userId':_0x2c697a[_0x1d090b(0x17b)]},'before':{'userIds':_0x4598c5},'after':{'userIds':_0x164d4c},'dryRun':_0x3300ed[_0x1d090b(0x182)],'backend':{'method':'POST','path':_0x4d977b===_0x1d090b(0x164)?CREATE_USER_ROLE_PATH:DELETE_USER_ROLE_PATH},'warnings':_0x36192d};return{'mutation':_0x5436ef,'changed':_0x5b2ee0,'matchingRelationIds':_0x3b7c75};}export async function loadDevRoleRelations(_0x4af39a,_0x549706){const _0x48696b=a178_0x1bf84c,_0x523797=0x64,_0x25c6ed=[];for(let _0x648f0e=0x1;;_0x648f0e+=0x1){const {items:_0x1df40b,paging:_0x537c45}=await listDevUserRoleRelations(_0x4af39a,{'roleId':_0x549706,'currentPage':_0x648f0e,'pageSize':_0x523797});_0x25c6ed[_0x48696b(0x16d)](..._0x1df40b);if(_0x1df40b[_0x48696b(0x145)]<_0x523797||_0x537c45&&_0x25c6ed['length']>=_0x537c45[_0x48696b(0x153)])return _0x25c6ed;}}export function readRoleRef(_0x683bcb){const _0x556505=a178_0x1bf84c,_0x847bfe=_0x683bcb[_0x556505(0x14f)](_0x556505(0x174))[_0x556505(0x150)]();if(!_0x847bfe)throw CliErrors[_0x556505(0x14a)](_0x556505(0x174),_0x556505(0x177));return _0x847bfe;}export async function prepareUserMutation(_0x292442,_0x261321,_0x26f083){const _0x53bf73=a178_0x1bf84c,_0x474bad=readRoleRef(_0x292442),_0x1c8d70=_0x292442[_0x53bf73(0x14f)](_0x53bf73(0x17f))[_0x53bf73(0x150)]();if(!_0x1c8d70)throw CliErrors[_0x53bf73(0x14a)]('user',_0x53bf73(0x17c));const _0x1d4645=_0x292442[_0x53bf73(0x184)](_0x53bf73(0x15b)),_0xf2d283=_0x1d4645===undefined||_0x1d4645===null?undefined:Number(_0x1d4645),_0x132f81=await resolveRoleRef(_0x292442[_0x53bf73(0x18c)],_0x474bad);if(_0x132f81['roleType']===_0x53bf73(0x180))throw CliErrors[_0x53bf73(0x15d)](_0x53bf73(0x16e)+_0x261321+_0x53bf73(0x148),'Use\x20the\x20platform\x20ownership-transfer\x20workflow\x20to\x20change\x20the\x20application\x20owner.');const _0x4df3c2=await resolveUserRef(_0x1c8d70),_0x4569d1=await loadDevRoleRelations(_0x292442[_0x53bf73(0x18c)],_0x132f81['id']);return{...computeRoleUserMutation({'operation':_0x261321,'appCode':_0x292442[_0x53bf73(0x18c)],'role':_0x132f81,'relations':_0x4569d1,'user':{'userId':_0x4df3c2['userId'],'username':_0x4df3c2[_0x53bf73(0x18b)],'nickname':_0x4df3c2[_0x53bf73(0x15e)]},'dryRun':_0x26f083,..._0xf2d283!==undefined?{'expectUserCount':_0xf2d283}:{}}),'role':_0x132f81,'user':_0x4df3c2};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a179_0x5abfc8=a179_0x1919;(function(_0x122ebd,_0xbc74d9){const _0x357a24=a179_0x1919,_0x13d3ed=_0x122ebd();while(!![]){try{const _0x14dc03=-parseInt(_0x357a24(0xbb))/0x1+parseInt(_0x357a24(0xc5))/0x2+-parseInt(_0x357a24(0xc6))/0x3*(-parseInt(_0x357a24(0xc1))/0x4)+parseInt(_0x357a24(0xbe))/0x5*(-parseInt(_0x357a24(0xb0))/0x6)+parseInt(_0x357a24(0xc9))/0x7+-parseInt(_0x357a24(0xbc))/0x8*(-parseInt(_0x357a24(0xb2))/0x9)+-parseInt(_0x357a24(0xba))/0xa;if(_0x14dc03===_0xbc74d9)break;else _0x13d3ed['push'](_0x13d3ed['shift']());}catch(_0x5a7015){_0x13d3ed['push'](_0x13d3ed['shift']());}}}(a179_0x2eab,0xd912f));import{updateAppRole}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';function a179_0x2eab(){const _0x51674d=['validation','2718420LrGJlk','1454591hVaHss','168648PCiFVO','Update\x20a\x20CUSTOM\x20role\x27s\x20name/remark\x20(built-in\x20roles\x20rejected)','266945ZNjeYI','update','appCode','609624KloLtI','dev','Updated\x20role\x20','Role\x20name\x20cannot\x20exceed\x2064\x20characters.','3282206KDuHKh','21rKzeZK','trim','New\x20role\x20name','8253735BtKZPh','flag','name','150DIwcKy','roleName','27qjgKdi','num','--name\x20cannot\x20be\x20empty.','string','length','POST','remark'];a179_0x2eab=function(){return _0x51674d;};return a179_0x2eab();}import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{assertCustomRole,getRoleById,projectRole,REMARK_FLAG,ROLE_ID_FLAG}from'../../commands/role/shared.js';const UPDATE_PATH='/smartapi/permit/role/update';function a179_0x1919(_0x122b74,_0x1b5b2d){_0x122b74=_0x122b74-0xae;const _0x2eab75=a179_0x2eab();let _0x1919ad=_0x2eab75[_0x122b74];return _0x1919ad;}function readPatch(_0x5929cb){const _0x235f06=a179_0x1919,_0x1c0a12=_0x5929cb[_0x235f06(0xae)](_0x235f06(0xaf)),_0x3d5a30=_0x5929cb['flag'](_0x235f06(0xb8)),_0x16c551={};if(_0x1c0a12!==undefined&&_0x1c0a12!==null){const _0x30b982=String(_0x1c0a12)[_0x235f06(0xc7)]();if(!_0x30b982)throw CliErrors[_0x235f06(0xb9)](_0x235f06(0xb4));if(_0x30b982[_0x235f06(0xb6)]>0x40)throw CliErrors[_0x235f06(0xb9)](_0x235f06(0xc4));_0x16c551[_0x235f06(0xb1)]=_0x30b982;}_0x3d5a30!==undefined&&_0x3d5a30!==null&&(_0x16c551['remark']=String(_0x3d5a30));if(_0x16c551[_0x235f06(0xb1)]===undefined&&_0x16c551[_0x235f06(0xb8)]===undefined)throw CliErrors['validation']('Nothing\x20to\x20update.','Pass\x20at\x20least\x20one\x20of\x20--name\x20/\x20--remark.');return _0x16c551;}export const roleUpdate={'service':'role','command':'update','description':a179_0x5abfc8(0xbd),'risk':'write','flags':[ROLE_ID_FLAG,{...REMARK_FLAG},{'name':'name','type':a179_0x5abfc8(0xb5),'required':![],'description':a179_0x5abfc8(0xc8)},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x2053ed){readPatch(_0x2053ed);},async 'dryRun'(_0xaf197f){const _0x1bfd7a=a179_0x5abfc8,_0x5f370b=_0xaf197f['num']('id'),_0x2cad7b=readPatch(_0xaf197f),_0x502f6e=await getRoleById(_0xaf197f['appCode'],_0x5f370b);return assertCustomRole(_0x502f6e,'update'),asDryRunResult({'scope':'dev','operation':_0x1bfd7a(0xbf),'selector':{'appCode':_0xaf197f[_0x1bfd7a(0xc0)],'roleId':_0x5f370b,'roleName':_0x502f6e['roleName']},'before':projectRole(_0x502f6e),'after':projectRole({..._0x502f6e,..._0x2cad7b[_0x1bfd7a(0xb1)]!==undefined?{'roleName':_0x2cad7b[_0x1bfd7a(0xb1)]}:{},..._0x2cad7b[_0x1bfd7a(0xb8)]!==undefined?{'remark':_0x2cad7b[_0x1bfd7a(0xb8)]}:{}}),'dryRun':!![],'backend':{'method':'POST','path':UPDATE_PATH},'warnings':[]},{'method':_0x1bfd7a(0xb7),'url':UPDATE_PATH});},async 'execute'(_0x24834f){const _0x529b91=a179_0x5abfc8,_0x21466b=_0x24834f[_0x529b91(0xb3)]('id'),_0x1b9798=readPatch(_0x24834f),_0x58a891=await getRoleById(_0x24834f['appCode'],_0x21466b);assertCustomRole(_0x58a891,'update'),await updateAppRole({'id':_0x21466b,'appCode':_0x24834f[_0x529b91(0xc0)],..._0x1b9798[_0x529b91(0xb1)]!==undefined?{'roleName':_0x1b9798['roleName']}:{},..._0x1b9798[_0x529b91(0xb8)]!==undefined?{'remark':_0x1b9798[_0x529b91(0xb8)]}:{}});const _0x453ef3=await getRoleById(_0x24834f[_0x529b91(0xc0)],_0x21466b);return{'ok':!![],'data':{'scope':_0x529b91(0xc2),'operation':_0x529b91(0xbf),'selector':{'appCode':_0x24834f[_0x529b91(0xc0)],'roleId':_0x21466b,'roleName':_0x453ef3[_0x529b91(0xb1)]},'before':projectRole(_0x58a891),'after':projectRole(_0x453ef3),'dryRun':![],'backend':{'method':_0x529b91(0xb7),'path':UPDATE_PATH},'warnings':[]},'message':_0x529b91(0xc3)+_0x453ef3[_0x529b91(0xb1)]+'\x20(id='+_0x21466b+')'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a180_0x9a0b79=a180_0x5699;(function(_0x2da9c3,_0x51d79a){const _0x2871ca=a180_0x5699,_0x5a3aba=_0x2da9c3();while(!![]){try{const _0x34923d=-parseInt(_0x2871ca(0xe0))/0x1*(-parseInt(_0x2871ca(0xd5))/0x2)+-parseInt(_0x2871ca(0xdb))/0x3+parseInt(_0x2871ca(0xd8))/0x4+parseInt(_0x2871ca(0xd7))/0x5+parseInt(_0x2871ca(0xe6))/0x6*(-parseInt(_0x2871ca(0xec))/0x7)+parseInt(_0x2871ca(0xe4))/0x8*(parseInt(_0x2871ca(0xdf))/0x9)+-parseInt(_0x2871ca(0xda))/0xa*(parseInt(_0x2871ca(0xe9))/0xb);if(_0x34923d===_0x51d79a)break;else _0x5a3aba['push'](_0x5a3aba['shift']());}catch(_0xcb90a0){_0x5a3aba['push'](_0x5a3aba['shift']());}}}(a180_0x3076,0x26975));import{createDevUserRole}from'../../core/api-client.js';function a180_0x5699(_0x2ad421,_0x514419){_0x2ad421=_0x2ad421-0xd4;const _0x307689=a180_0x3076();let _0x569984=_0x307689[_0x2ad421];return _0x569984;}import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{EXPECT_USER_COUNT_FLAG,CREATE_USER_ROLE_PATH,prepareUserMutation,ROLE_REF_FLAG,USER_REF_FLAG}from'../../commands/role/shared.js';function a180_0x3076(){const _0x1ea2d7=['userId','Added\x20user\x20','14zqxikM','appCode','91538UEfZqT','username','1306175EjyICI','1147760OghNdE','roleType','270YNvjXp','537774aoMXWC','POST','\x20already\x20in\x20role\x20','user-add','4302xidWJZ','4HdJDCS','roleId','role','No\x20change:\x20user\x20','232hOJdEs','high-risk-write','529026NNGdRE','selector','roleName','94292HydGvr'];a180_0x3076=function(){return _0x1ea2d7;};return a180_0x3076();}export const roleUserAdd={'service':a180_0x9a0b79(0xe2),'command':a180_0x9a0b79(0xde),'description':'Add\x20a\x20user\x20to\x20a\x20role\x20(OWNER\x20rejected);\x20requires\x20--yes','risk':a180_0x9a0b79(0xe5),'flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x5de45d){const _0x471952=a180_0x9a0b79,{mutation:_0x20a101}=await prepareUserMutation(_0x5de45d,'user-add',!![]);return asDryRunResult(_0x20a101,{'method':_0x471952(0xdc),'url':CREATE_USER_ROLE_PATH});},async 'execute'(_0x3af5d5){const _0x2041a5=a180_0x9a0b79,{mutation:_0x408350,changed:_0x3c3257,role:_0x4c7e6b,user:_0x5269ab}=await prepareUserMutation(_0x3af5d5,_0x2041a5(0xde),![]);return _0x3c3257&&await createDevUserRole({'appCode':_0x3af5d5[_0x2041a5(0xd4)],'userId':_0x5269ab[_0x2041a5(0xea)],'username':_0x5269ab[_0x2041a5(0xd6)],'roleType':_0x4c7e6b[_0x2041a5(0xd9)],'roleId':_0x408350[_0x2041a5(0xe7)][_0x2041a5(0xe1)]}),{'ok':!![],'data':_0x408350,'message':_0x3c3257?_0x2041a5(0xeb)+_0x408350[_0x2041a5(0xe7)][_0x2041a5(0xea)]+'\x20to\x20role\x20'+_0x408350[_0x2041a5(0xe7)]['roleName']:_0x2041a5(0xe3)+_0x408350[_0x2041a5(0xe7)]['userId']+_0x2041a5(0xdd)+_0x408350[_0x2041a5(0xe7)][_0x2041a5(0xe8)]};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a181_0x2db40e=a181_0x1713;(function(_0x3fa9ad,_0x123e52){const _0x190c77=a181_0x1713,_0x5a986e=_0x3fa9ad();while(!![]){try{const _0x3ae059=parseInt(_0x190c77(0x188))/0x1+-parseInt(_0x190c77(0x181))/0x2+parseInt(_0x190c77(0x180))/0x3*(parseInt(_0x190c77(0x187))/0x4)+parseInt(_0x190c77(0x17f))/0x5*(parseInt(_0x190c77(0x184))/0x6)+parseInt(_0x190c77(0x18a))/0x7+-parseInt(_0x190c77(0x18c))/0x8*(parseInt(_0x190c77(0x189))/0x9)+-parseInt(_0x190c77(0x182))/0xa;if(_0x3ae059===_0x123e52)break;else _0x5a986e['push'](_0x5a986e['shift']());}catch(_0x4ae341){_0x5a986e['push'](_0x5a986e['shift']());}}}(a181_0x5c3e,0x2ef2a));function a181_0x5c3e(){const _0x1602ec=['No\x20change:\x20user\x20','selector','roleName','65SEjdSd','57bImvVZ','305094DwstPk','621410slroVK','POST','136002qjmmwx','user-remove','Remove\x20a\x20user\x20from\x20a\x20role\x20(OWNER\x20rejected);\x20requires\x20--yes','27932FbktSt','160945ZoRGSU','2873241gyExsm','965594ZHRBLg','Removed\x20user\x20','8eTkhXT'];a181_0x5c3e=function(){return _0x1602ec;};return a181_0x5c3e();}import{deleteDevUserRole}from'../../core/api-client.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{EXPECT_USER_COUNT_FLAG,DELETE_USER_ROLE_PATH,prepareUserMutation,ROLE_REF_FLAG,USER_REF_FLAG}from'../../commands/role/shared.js';function a181_0x1713(_0x18b4f8,_0x6516ff){_0x18b4f8=_0x18b4f8-0x17d;const _0x5c3ef6=a181_0x5c3e();let _0x171369=_0x5c3ef6[_0x18b4f8];return _0x171369;}export const roleUserRemove={'service':'role','command':'user-remove','description':a181_0x2db40e(0x186),'risk':'high-risk-write','flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x411ec8){const _0x119035=a181_0x2db40e,{mutation:_0x14a978}=await prepareUserMutation(_0x411ec8,_0x119035(0x185),!![]);return asDryRunResult(_0x14a978,{'method':_0x119035(0x183),'url':DELETE_USER_ROLE_PATH});},async 'execute'(_0x16f8da){const _0x328b2b=a181_0x2db40e,{matchingRelationIds:_0x187f71,mutation:_0x388dd5,changed:_0x32be71}=await prepareUserMutation(_0x16f8da,'user-remove',![]);if(_0x32be71)for(const _0x2023a5 of _0x187f71){await deleteDevUserRole(_0x2023a5);}return{'ok':!![],'data':_0x388dd5,'message':_0x32be71?_0x328b2b(0x18b)+_0x388dd5[_0x328b2b(0x17d)]['userId']+'\x20from\x20role\x20'+_0x388dd5[_0x328b2b(0x17d)][_0x328b2b(0x17e)]:_0x328b2b(0x18d)+_0x388dd5[_0x328b2b(0x17d)]['userId']+'\x20not\x20in\x20role\x20'+_0x388dd5[_0x328b2b(0x17d)][_0x328b2b(0x17e)]};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a182_0x21e074=a182_0x5a7e;(function(_0xef7313,_0x1ff7a8){const _0x2081ce=a182_0x5a7e,_0x50859d=_0xef7313();while(!![]){try{const _0x15b0d=-parseInt(_0x2081ce(0xf4))/0x1*(parseInt(_0x2081ce(0xe7))/0x2)+-parseInt(_0x2081ce(0xfc))/0x3*(parseInt(_0x2081ce(0xfb))/0x4)+parseInt(_0x2081ce(0xf0))/0x5*(parseInt(_0x2081ce(0xee))/0x6)+-parseInt(_0x2081ce(0xf6))/0x7*(-parseInt(_0x2081ce(0xf2))/0x8)+parseInt(_0x2081ce(0xe8))/0x9+-parseInt(_0x2081ce(0xe9))/0xa*(-parseInt(_0x2081ce(0xfd))/0xb)+parseInt(_0x2081ce(0xea))/0xc*(-parseInt(_0x2081ce(0xe5))/0xd);if(_0x15b0d===_0x1ff7a8)break;else _0x50859d['push'](_0x50859d['shift']());}catch(_0x14e9bd){_0x50859d['push'](_0x50859d['shift']());}}}(a182_0x4fed,0xb0334));import{CliErrors}from'../../errors.js';function a182_0x4fed(){const _0x54431a=['6vIipqG','role','6377780yUltTe','user-resolve','16pzBCfH','userId','5mCoGEW','Pass\x20--name\x20<nickname|username>.','2179387UbhmVi','nickname','trim','flagMissing','matchedBy','303528hBxQuB','3ppJJze','234652YuWVbY','13ulNVdg','str','445196PNqlIk','10098495GVATyM','340JywvaW','22019916ZpoXwA','read','username','name'];a182_0x4fed=function(){return _0x54431a;};return a182_0x4fed();}function a182_0x5a7e(_0xc15b27,_0x4a7bf6){_0xc15b27=_0xc15b27-0xe5;const _0x4fed62=a182_0x4fed();let _0x5a7e94=_0x4fed62[_0xc15b27];return _0x5a7e94;}import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{resolveUserRef,USER_NAME_FLAG}from'../../commands/role/shared.js';export const roleUserResolve={'service':a182_0x21e074(0xef),'command':a182_0x21e074(0xf1),'description':'Resolve\x20a\x20nickname/username\x20to\x20a\x20userId\x20(tenant\x20member\x20directory)','risk':a182_0x21e074(0xeb),'flags':[USER_NAME_FLAG,APPCODE_FLAG_OPTIONAL],async 'validate'(_0x2c8f46){const _0x5e4490=a182_0x21e074;if(!_0x2c8f46[_0x5e4490(0xe6)](_0x5e4490(0xed))[_0x5e4490(0xf8)]())throw CliErrors[_0x5e4490(0xf9)]('name',_0x5e4490(0xf5));},async 'execute'(_0x1f1f0b){const _0x458afb=a182_0x21e074,_0x4682fd=_0x1f1f0b[_0x458afb(0xe6)](_0x458afb(0xed))[_0x458afb(0xf8)](),_0x3e480c=await resolveUserRef(_0x4682fd,'Select\x20a\x20listed\x20userId,\x20then\x20pass\x20it\x20to\x20`role\x20user-add`\x20or\x20`role\x20user-remove`\x20with\x20--user\x20<id>.');return{'ok':!![],'data':{'user':{'userId':_0x3e480c[_0x458afb(0xf3)],'username':_0x3e480c[_0x458afb(0xec)],'nickname':_0x3e480c[_0x458afb(0xf7)],'matchedBy':_0x3e480c[_0x458afb(0xfa)]}},'message':'Resolved\x20\x22'+_0x4682fd+'\x22\x20→\x20userId\x20'+_0x3e480c[_0x458afb(0xf3)]};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a183_0x5b0922=a183_0x16d9;function a183_0x4092(){const _0x26011c=['start','Enable\x20watch\x20mode\x20for\x20preview','80952uOwWek','9EzLSFW','close','vite\x20build\x20--watch\x20exited\x20with\x20code\x20','boolean','\x20run\x20start','join','Script\x20name\x20defined\x20in\x20package.json','\x20run\x20preview','\x20run\x20preview\x20--watch','pnpm-lock.yaml','21642VzIoPd','\x22\x20not\x20found\x20in\x20package.json.','belowMinimum','\x20\x20EXAMPLES','bun.lockb','args','inherit','Available:\x20','length','node_modules','package.json','33VHszWS','--watch','8790310NxdHEV','error','36NebpUJ','35ELiKdU','\x20run\x20<script>\x0a','push','needsUpgrade','keys','.bin','scripts','No\x20scripts\x20defined\x20in\x20package.json.','yarn','preview','vite','9067408RXwUAz','parse','validation','watch','slice','542040ssNOIH','log','write','dev','Script\x20\x22','312780VVhAfv','all','\x20\x20\x20\x20','2114qXtKVs','bool','22518108ebuWwF','build','run'];a183_0x4092=function(){return _0x26011c;};return a183_0x4092();}(function(_0x1f61b3,_0xfe3456){const _0x26c9bf=a183_0x16d9,_0x1f46fe=_0x1f61b3();while(!![]){try{const _0x5b84c6=-parseInt(_0x26c9bf(0x134))/0x1+parseInt(_0x26c9bf(0x13e))/0x2*(-parseInt(_0x26c9bf(0x158))/0x3)+-parseInt(_0x26c9bf(0x169))/0x4*(parseInt(_0x26c9bf(0x159))/0x5)+parseInt(_0x26c9bf(0x149))/0x6*(-parseInt(_0x26c9bf(0x137))/0x7)+-parseInt(_0x26c9bf(0x164))/0x8+-parseInt(_0x26c9bf(0x13f))/0x9*(parseInt(_0x26c9bf(0x156))/0xa)+-parseInt(_0x26c9bf(0x154))/0xb*(-parseInt(_0x26c9bf(0x139))/0xc);if(_0x5b84c6===_0xfe3456)break;else _0x1f46fe['push'](_0x1f46fe['shift']());}catch(_0x3217a8){_0x1f46fe['push'](_0x1f46fe['shift']());}}}(a183_0x4092,0xbe996));import{readFileSync,existsSync}from'node:fs';import{CLI_BIN_NAME}from'../../constant/cli.js';function a183_0x16d9(_0x3005e3,_0x5588e0){_0x3005e3=_0x3005e3-0x131;const _0x4092d2=a183_0x4092();let _0x16d92a=_0x4092d2[_0x3005e3];return _0x16d92a;}import{resolve,delimiter,join}from'node:path';import{spawn}from'node:child_process';import{CliErrors}from'../../errors.js';import{checkSdkVersion,printSdkUpgradeWarning}from'../../utils/check-sdk-version.js';import{assertCliVersionSupported,checkCliVersion,printCliUpgradeWarning}from'../../utils/cli-version-check.js';const VERSION_CHECK_SCRIPTS=new Set([a183_0x5b0922(0x13c),a183_0x5b0922(0x132)]);function readPackageScripts(_0x129057){const _0x449e71=a183_0x5b0922,_0xa403f4=resolve(_0x129057,_0x449e71(0x153));if(!existsSync(_0xa403f4))return null;try{const _0x3af487=JSON[_0x449e71(0x165)](readFileSync(_0xa403f4,'utf-8'));return _0x3af487[_0x449e71(0x15f)]??{};}catch{return null;}}function detectPackageManager(_0x28ef96){const _0x2a58d3=a183_0x5b0922;if(existsSync(resolve(_0x28ef96,_0x2a58d3(0x14d)))||existsSync(resolve(_0x28ef96,'bun.lock')))return'bun';if(existsSync(resolve(_0x28ef96,_0x2a58d3(0x148))))return'pnpm';if(existsSync(resolve(_0x28ef96,'yarn.lock')))return _0x2a58d3(0x161);return'npm';}async function versionCheck(_0x67ed69){const _0x379569=a183_0x5b0922,_0x3998bb=await checkCliVersion();(_0x3998bb['needsUpgrade']||_0x3998bb[_0x379569(0x14b)])&&(printCliUpgradeWarning(_0x3998bb),assertCliVersionSupported(_0x3998bb));const _0x5ee6e5=await checkSdkVersion(_0x67ed69);if(_0x5ee6e5[_0x379569(0x15c)])printSdkUpgradeWarning(_0x5ee6e5);}function spawnScript(_0x518afd,_0x45ebca,_0x510253,_0x4a03ae){return new Promise((_0x1c1450,_0x2279fa)=>{const _0x28cf7f=a183_0x16d9,_0x2ea4c3=['run',_0x45ebca,..._0x510253],_0x4060d3=spawn(_0x518afd,_0x2ea4c3,{'cwd':_0x4a03ae,'stdio':_0x28cf7f(0x14f),'shell':!![],'env':{...process.env,'PATH':''+join(_0x4a03ae,_0x28cf7f(0x152),_0x28cf7f(0x15e))+delimiter+process.env.PATH}});_0x4060d3['on']('close',_0xaf50c3=>{if(_0xaf50c3===0x0||_0xaf50c3===null)_0x1c1450();else _0x2279fa(new Error(_0x518afd+'\x20run\x20'+_0x45ebca+'\x20exited\x20with\x20code\x20'+_0xaf50c3));}),_0x4060d3['on'](_0x28cf7f(0x157),_0x2279fa);});}function spawnViteBuildWatch(_0x321896){return new Promise((_0x3a7832,_0x109df4)=>{const _0x2d93eb=a183_0x16d9,_0xf03ade=spawn(_0x2d93eb(0x163),[_0x2d93eb(0x13a),_0x2d93eb(0x155)],{'cwd':_0x321896,'stdio':'inherit','shell':!![],'env':{...process.env,'PATH':''+join(_0x321896,'node_modules',_0x2d93eb(0x15e))+delimiter+process.env.PATH}});_0xf03ade['on'](_0x2d93eb(0x140),_0x156772=>{const _0x3a6367=_0x2d93eb;if(_0x156772===0x0||_0x156772===null)_0x3a7832();else _0x109df4(new Error(_0x3a6367(0x141)+_0x156772));}),_0xf03ade['on']('error',_0x109df4);});}function spawnVitePreview(_0x59c2a6){return new Promise((_0x43a1fa,_0xc84201)=>{const _0x27e491=a183_0x16d9,_0x3794c4=spawn(_0x27e491(0x163),[_0x27e491(0x162)],{'cwd':_0x59c2a6,'stdio':_0x27e491(0x14f),'shell':!![],'env':{...process.env,'PATH':''+join(_0x59c2a6,_0x27e491(0x152),'.bin')+delimiter+process.env.PATH}});_0x3794c4['on'](_0x27e491(0x140),_0xe7a640=>{if(_0xe7a640===0x0||_0xe7a640===null)_0x43a1fa();else _0xc84201(new Error('vite\x20preview\x20exited\x20with\x20code\x20'+_0xe7a640));}),_0x3794c4['on']('error',_0xc84201);});}const runFlags=[{'name':'watch','type':a183_0x5b0922(0x142),'description':a183_0x5b0922(0x13d),'default':![]}];export const runDefinition={'service':a183_0x5b0922(0x13b),'command':a183_0x5b0922(0x13b),'description':'Run\x20a\x20package.json\x20script','risk':a183_0x5b0922(0x131),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':'script','description':a183_0x5b0922(0x145),'required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x5a7e51=a183_0x5b0922,_0x218bec=[];return _0x218bec['push'](_0x5a7e51(0x14c)),_0x218bec['push'](_0x5a7e51(0x136)+CLI_BIN_NAME+_0x5a7e51(0x143)),_0x218bec['push'](_0x5a7e51(0x136)+CLI_BIN_NAME+'\x20run\x20build'),_0x218bec[_0x5a7e51(0x15b)]('\x20\x20\x20\x20'+CLI_BIN_NAME+_0x5a7e51(0x146)),_0x218bec['push'](_0x5a7e51(0x136)+CLI_BIN_NAME+_0x5a7e51(0x147)),_0x218bec[_0x5a7e51(0x144)]('\x0a');},async 'execute'(_0x4f24ae){const _0x15473a=a183_0x5b0922,_0x23001c=process['cwd'](),_0x6ee3e1=_0x4f24ae[_0x15473a(0x14e)][0x0],_0x3bc851=_0x4f24ae[_0x15473a(0x14e)][_0x15473a(0x168)](0x1),_0x535a31=readPackageScripts(_0x23001c);if(!_0x535a31)throw CliErrors['validation']('No\x20package.json\x20found\x20in\x20current\x20directory.');if(!_0x6ee3e1){const _0x1d5000=Object[_0x15473a(0x15d)](_0x535a31);if(_0x1d5000[_0x15473a(0x151)]===0x0)console[_0x15473a(0x16a)](_0x15473a(0x160));else{console[_0x15473a(0x16a)]('\x0a\x20\x20Available\x20scripts:\x0a');for(const _0x4f8ea9 of _0x1d5000){console['log'](_0x15473a(0x136)+_0x4f8ea9);}console['log']('\x0a\x20\x20Usage:\x20'+CLI_BIN_NAME+_0x15473a(0x15a));}return{'ok':!![]};}if(!_0x535a31[_0x6ee3e1])throw CliErrors[_0x15473a(0x166)](_0x15473a(0x133)+_0x6ee3e1+_0x15473a(0x14a),_0x15473a(0x150)+(Object['keys'](_0x535a31)[_0x15473a(0x144)](',\x20')||'(none)'));const _0x132b67=detectPackageManager(_0x23001c);VERSION_CHECK_SCRIPTS['has'](_0x6ee3e1)&&await versionCheck(_0x23001c);if(_0x6ee3e1===_0x15473a(0x162)&&_0x4f24ae[_0x15473a(0x138)](_0x15473a(0x167)))return await Promise[_0x15473a(0x135)]([spawnViteBuildWatch(_0x23001c),spawnVitePreview(_0x23001c)]),{'ok':!![]};return await spawnScript(_0x132b67,_0x6ee3e1,_0x3bc851,_0x23001c),{'ok':!![]};}};
|
package/lib/commands/schema.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a184_0x596b61=a184_0x4f0a;(function(_0x2c2047,_0x226434){const _0x4e4e82=a184_0x4f0a,_0x193200=_0x2c2047();while(!![]){try{const _0x40c10d=-parseInt(_0x4e4e82(0x170))/0x1*(parseInt(_0x4e4e82(0x174))/0x2)+parseInt(_0x4e4e82(0x16b))/0x3+-parseInt(_0x4e4e82(0x16f))/0x4*(parseInt(_0x4e4e82(0x175))/0x5)+parseInt(_0x4e4e82(0x173))/0x6*(parseInt(_0x4e4e82(0x167))/0x7)+parseInt(_0x4e4e82(0x16a))/0x8*(parseInt(_0x4e4e82(0x176))/0x9)+-parseInt(_0x4e4e82(0x16c))/0xa+parseInt(_0x4e4e82(0x169))/0xb;if(_0x40c10d===_0x226434)break;else _0x193200['push'](_0x193200['shift']());}catch(_0x586e03){_0x193200['push'](_0x193200['shift']());}}}(a184_0x502f,0xa96e4));function a184_0x4f0a(_0x593dc2,_0xc6d344){_0x593dc2=_0x593dc2-0x167;const _0x502fb6=a184_0x502f();let _0x4f0ad3=_0x502fb6[_0x593dc2];return _0x4f0ad3;}import{buildSchemaPayload}from'../framework/schema-export.js';async function execute(_0x5a3230){const _0x37e86a=await buildSchemaPayload();return{'ok':!![],'data':_0x37e86a};}export const schemaDefinition={'service':a184_0x596b61(0x168),'command':a184_0x596b61(0x171),'description':a184_0x596b61(0x16e),'risk':a184_0x596b61(0x16d),'requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':a184_0x596b61(0x172),'flags':[],'execute':execute};function a184_0x502f(){const _0x185f58=['3429339ZxyAFA','8209590dLoxpd','read','Export\x20machine-readable\x20command\x20schema\x20(JSON)','8060QtamXW','1091863RCPjKI','export','json','6OhYemh','2sgwIVn','2165XEMCgH','248463fRyqtV','3565982HjJlTy','schema','13413532xQpMPK','176jRwENK'];a184_0x502f=function(){return _0x185f58;};return a184_0x502f();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a185_0x549dc7=a185_0x5265;(function(_0x46a6a8,_0x34b2a3){const _0x48bae7=a185_0x5265,_0x575eed=_0x46a6a8();while(!![]){try{const _0x15ff3e=parseInt(_0x48bae7(0x13b))/0x1*(-parseInt(_0x48bae7(0x102))/0x2)+-parseInt(_0x48bae7(0x12d))/0x3*(parseInt(_0x48bae7(0x13e))/0x4)+parseInt(_0x48bae7(0x12b))/0x5*(parseInt(_0x48bae7(0x109))/0x6)+parseInt(_0x48bae7(0xf8))/0x7+-parseInt(_0x48bae7(0x10d))/0x8*(-parseInt(_0x48bae7(0x12e))/0x9)+parseInt(_0x48bae7(0xf7))/0xa*(parseInt(_0x48bae7(0x11c))/0xb)+-parseInt(_0x48bae7(0x119))/0xc*(parseInt(_0x48bae7(0x10f))/0xd);if(_0x15ff3e===_0x34b2a3)break;else _0x575eed['push'](_0x575eed['shift']());}catch(_0x478276){_0x575eed['push'](_0x575eed['shift']());}}}(a185_0x4cb3,0x7a015));import{writeFile}from'node:fs/promises';import{input,select}from'@inquirer/prompts';import{createSqlQuery}from'../../core/api-client.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{buildSqlRelativePath}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function generateSqlTemplate(_0x3c7c2b){const _0x195d97=a185_0x5265;if(_0x3c7c2b==='mybatisXml')return[_0x195d97(0x117),_0x195d97(0xfb),_0x195d97(0x131),''][_0x195d97(0x12f)]('\x0a');return[_0x195d97(0x121),''][_0x195d97(0x12f)]('\x0a');}export const sqlCreate={'service':a185_0x549dc7(0x137),'command':a185_0x549dc7(0x128),'description':a185_0x549dc7(0x113),'risk':a185_0x549dc7(0x130),'flags':[{'name':'name','type':'string','description':a185_0x549dc7(0x122)},{'name':a185_0x549dc7(0x115),'type':a185_0x549dc7(0x118),'description':a185_0x549dc7(0x124)},{'name':a185_0x549dc7(0x103),'type':a185_0x549dc7(0x135),'enum':['sql',a185_0x549dc7(0x105)],'description':'Local\x20SQL\x20file\x20mode'}],async 'validate'(_0x5245a5){const _0xea3f13=a185_0x549dc7;if(!_0x5245a5[_0xea3f13(0x13a)])return;if(!_0x5245a5[_0xea3f13(0x125)](_0xea3f13(0xfd))['trim']())throw CliErrors[_0xea3f13(0x129)]('name','--name\x20is\x20required\x20in\x20non-interactive\x20mode.');const _0x46ebf4=resolveProvidedDbId(_0x5245a5);if(typeof _0x46ebf4!=='number'||!Number[_0xea3f13(0x139)](_0x46ebf4)||_0x46ebf4<=0x0)throw CliErrors[_0xea3f13(0x129)]('db-id',_0xea3f13(0x126));if(!_0x5245a5[_0xea3f13(0x125)](_0xea3f13(0x103))[_0xea3f13(0x114)]())throw CliErrors[_0xea3f13(0x129)](_0xea3f13(0x103),_0xea3f13(0x100));},async 'dryRun'(_0x18fb11){const _0x16a2b3=a185_0x549dc7,_0xd4e307=loadSqlProjectConfig(_0x18fb11['appCode']),{sqlName:_0x52f1d6,dbId:_0x5160ce,dbName:_0x51b5ad,mode:_0x12d2aa}=await resolveSqlNewInputs(_0x18fb11),_0x21250a=buildSqlRelativePath(_0x16a2b3(0xf9),_0x52f1d6,_0x51b5ad,_0x12d2aa,_0x5160ce),_0x2b9d1d=_0xd4e307[_0x16a2b3(0x11f)]+'/'+_0x21250a;return{'method':_0x16a2b3(0xfc),'url':_0x16a2b3(0xff),'body':{'appCode':_0x18fb11[_0x16a2b3(0x112)],'sqlName':_0x52f1d6,'dbId':_0x5160ce,'mode':_0x12d2aa,'localPath':_0x2b9d1d},'description':'Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20'+_0xd4e307[_0x16a2b3(0x11f)]};},async 'execute'(_0x468ebb){const _0x316043=a185_0x549dc7,_0x24081c=loadSqlProjectConfig(_0x468ebb[_0x316043(0x112)]),{sqlName:_0x3b8bc7,dbId:_0x3c94ab,dbName:_0x5732ff,mode:_0xfe1c4d}=await resolveSqlNewInputs(_0x468ebb),_0xd93ca4=generateSqlTemplate(_0xfe1c4d),_0x53abf0=await createSqlQuery({'appCode':_0x468ebb[_0x316043(0x112)],'sqlName':_0x3b8bc7,'dbId':_0x3c94ab,'sqlContent':_0xd93ca4}),_0x12b0f4=ensureRemoteSqlContent(_0x53abf0),_0x1e5e40=_0x5732ff||await getDbName(_0x468ebb['appCode'],_0x3c94ab)[_0x316043(0x111)](()=>undefined),_0x344604=buildSqlRelativePath(_0x53abf0[_0x316043(0x138)],_0x53abf0[_0x316043(0x10a)],_0x1e5e40,_0xfe1c4d,_0x3c94ab),_0x596045=_0x24081c[_0x316043(0x11f)]+'/'+_0x344604,_0xb52678=buildLocalSqlFileContent({'sqlCode':_0x53abf0[_0x316043(0x138)],'sqlName':_0x53abf0['sqlName'],'dbId':_0x53abf0[_0x316043(0x11b)]},_0x12b0f4,{'dbName':_0x1e5e40,'mode':_0xfe1c4d,'syncedAt':new Date()[_0x316043(0x106)](),'description':_0x53abf0[_0x316043(0xfe)]});if(await fileExists(_0x596045))throw CliErrors[_0x316043(0x13c)](_0x316043(0x101)+_0x596045);await ensureParentDirectory(_0x596045),await writeFile(_0x596045,_0xb52678,_0x316043(0x12c));const _0x238feb=await readSqlLockFile(_0x24081c[_0x316043(0x107)]),{lockData:_0xb57c4,appLock:_0x5490a6}=ensureSqlLockScope(_0x238feb??createEmptySqlLock(),_0x24081c['appCode'],_0x24081c[_0x316043(0x127)],'new');return _0x5490a6[_0x316043(0x116)][_0x53abf0[_0x316043(0x138)]]={...buildSqlLockEntry(_0x53abf0,_0x12b0f4,computeSqlContentHash(_0xb52678),{'dbName':_0x1e5e40}),'path':_0x344604,'mode':_0xfe1c4d},_0x5490a6[_0x316043(0x120)]=new Date()[_0x316043(0x106)](),await writeSqlLockFile(_0x24081c['lockFilePath'],_0xb57c4),{'ok':!![],'data':{'id':_0x53abf0['id'],'sqlCode':_0x53abf0[_0x316043(0x138)],'sqlName':_0x53abf0[_0x316043(0x10a)],'dbId':_0x53abf0[_0x316043(0x11b)],'path':_0x596045,'mode':_0xfe1c4d},'message':_0x316043(0x104)+_0x53abf0[_0x316043(0x138)]};}};async function resolveSqlNewInputs(_0x148574){const _0x1a3b99=await resolveSqlNameInput(_0x148574),{dbId:_0x4dd2a1,dbName:_0x528a7c}=await resolveDbSelection(_0x148574),_0x93eb40=await resolveSqlModeInput(_0x148574);return{'sqlName':_0x1a3b99,'dbId':_0x4dd2a1,'dbName':_0x528a7c,'mode':_0x93eb40};}async function resolveSqlNameInput(_0xc18e11){const _0x3af86d=a185_0x549dc7,_0x2a850d=_0xc18e11[_0x3af86d(0x125)]('name')['trim']();if(_0x2a850d)return _0x2a850d;if(_0xc18e11['nonInteractive'])throw CliErrors[_0x3af86d(0x129)](_0x3af86d(0xfd),_0x3af86d(0x13f));return(await input({'message':_0x3af86d(0x10b),'validate':_0x5d5025=>_0x5d5025[_0x3af86d(0x114)]()?!![]:'SQL\x20name\x20cannot\x20be\x20empty'}))[_0x3af86d(0x114)]();}async function resolveDbSelection(_0x5c9b44){const _0x1a8b97=a185_0x549dc7,_0x154874=resolveProvidedDbId(_0x5c9b44);if(typeof _0x154874==='number'&&Number[_0x1a8b97(0x139)](_0x154874)&&_0x154874>0x0)return{'dbId':_0x154874,'dbName':await getDbName(_0x5c9b44[_0x1a8b97(0x112)],_0x154874)[_0x1a8b97(0x111)](()=>undefined)};if(_0x5c9b44['nonInteractive'])throw CliErrors['flagMissing'](_0x1a8b97(0x115),_0x1a8b97(0x126));const _0x566612=await listDatabases(_0x5c9b44['appCode'])[_0x1a8b97(0x111)](()=>[]);if(_0x566612['length']===0x1)return{'dbId':_0x566612[0x0][_0x1a8b97(0x11b)],'dbName':_0x566612[0x0][_0x1a8b97(0x10c)]};if(_0x566612[_0x1a8b97(0x108)]>0x1){const _0x47c601=await select({'message':_0x1a8b97(0x133),'choices':[..._0x566612[_0x1a8b97(0x136)](_0x1b8529=>({'name':_0x1b8529['dbName']+'\x20('+_0x1b8529[_0x1a8b97(0x11b)]+')','value':serializeDbSelection(_0x1b8529)})),{'name':_0x1a8b97(0x110),'value':_0x1a8b97(0x10e)}]});if(_0x47c601!==_0x1a8b97(0x10e))return deserializeDbSelection(_0x47c601);}const _0x415847=await input({'message':_0x1a8b97(0x134),'validate':_0x5e3bf5=>{const _0x32c645=_0x1a8b97,_0x26d873=_0x5e3bf5[_0x32c645(0x114)]();if(!_0x26d873)return'dbId\x20cannot\x20be\x20empty';const _0x2fd624=Number(_0x26d873);if(!Number['isInteger'](_0x2fd624)||_0x2fd624<=0x0)return _0x32c645(0x123);return!![];}});return{'dbId':Number(_0x415847[_0x1a8b97(0x114)]())};}function a185_0x5265(_0x2b4556,_0x5a1e5d){_0x2b4556=_0x2b4556-0xf7;const _0x4cb30f=a185_0x4cb3();let _0x52656b=_0x4cb30f[_0x2b4556];return _0x52656b;}function a185_0x4cb3(){const _0x31abe3=['create','flagMissing','For\x20MyBatis\x20XML\x20SQL\x20with\x20dynamic\x20tags','115BWyLbd','utf8','12210RarwGx','2979afeVLR','join','write','</select>','Select\x20the\x20local\x20SQL\x20mode:','Select\x20the\x20target\x20database:','Target\x20database\x20dbId:','string','map','sql','sqlCode','isFinite','nonInteractive','244PuZJYs','validation','MyBatis\x20XML\x20(mybatisXml)','8pMSACw','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','1402510RNIMMS','5570397DdKDgz','<server-generated-sqlCode>','Invalid\x20database\x20selection\x20payload:\x20','\x20\x20SELECT\x201\x20AS\x20id','POST','name','description','/smartapi/custom/saveUserCustomSql','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','File\x20already\x20exists:\x20','3212ObFifs','mode','Created\x20SQL\x20query\x20','mybatisXml','toISOString','lockFilePath','length','115302QndGXs','sqlName','SQL\x20name:','dbName','14712qqxBZb','__manual__','14130805keqQzI','✎\x20Enter\x20dbId\x20manually','catch','appCode','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','trim','db-id','sqls','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','number','12kLOTDs','parse','dbId','11vuHslQ','For\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20statements\x20that\x20run\x20directly','Plain\x20SQL\x20(sql)','sqlRootDir','lastSync','SELECT\x201\x20AS\x20id;','SQL\x20query\x20display\x20name','dbId\x20must\x20be\x20a\x20positive\x20integer','Target\x20database\x20ID','str','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','sqlRoot'];a185_0x4cb3=function(){return _0x31abe3;};return a185_0x4cb3();}async function resolveSqlModeInput(_0x2f20b3){const _0x56a770=a185_0x549dc7,_0x228dc9=_0x2f20b3[_0x56a770(0x125)]('mode')[_0x56a770(0x114)]();if(_0x228dc9===_0x56a770(0x137)||_0x228dc9===_0x56a770(0x105))return _0x228dc9;if(_0x2f20b3['nonInteractive'])throw CliErrors['flagMissing'](_0x56a770(0x103),'--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');return await select({'message':_0x56a770(0x132),'choices':[{'name':_0x56a770(0x11e),'value':'sql','description':_0x56a770(0x11d)},{'name':_0x56a770(0x13d),'value':'mybatisXml','description':_0x56a770(0x12a)}]});}function serializeDbSelection(_0x27902a){const _0x2a257f=a185_0x549dc7;return JSON['stringify']({'dbId':_0x27902a[_0x2a257f(0x11b)],'dbName':_0x27902a[_0x2a257f(0x10c)]});}function deserializeDbSelection(_0x3ce428){const _0x3c7fcd=a185_0x549dc7;try{const _0x2b5493=JSON[_0x3c7fcd(0x11a)](_0x3ce428);if(typeof _0x2b5493['dbId']==='number'&&Number['isFinite'](_0x2b5493[_0x3c7fcd(0x11b)]))return{'dbId':_0x2b5493[_0x3c7fcd(0x11b)],'dbName':_0x2b5493[_0x3c7fcd(0x10c)]};}catch{}throw CliErrors[_0x3c7fcd(0x13c)](_0x3c7fcd(0xfa)+_0x3ce428);}function resolveProvidedDbId(_0x4c3cd8){const _0x1b4e9b=a185_0x549dc7,_0x30f258=_0x4c3cd8['flag'](_0x1b4e9b(0x115));if(typeof _0x30f258===_0x1b4e9b(0x118)&&Number[_0x1b4e9b(0x139)](_0x30f258))return _0x30f258;return undefined;}
|
|
1
|
+
const a185_0xe38f20=a185_0x48ff;(function(_0x2e396d,_0x686bce){const _0x58e6d6=a185_0x48ff,_0x47517f=_0x2e396d();while(!![]){try{const _0x1a3eea=parseInt(_0x58e6d6(0x200))/0x1+-parseInt(_0x58e6d6(0x1d8))/0x2*(-parseInt(_0x58e6d6(0x1e2))/0x3)+parseInt(_0x58e6d6(0x201))/0x4*(parseInt(_0x58e6d6(0x207))/0x5)+parseInt(_0x58e6d6(0x1fd))/0x6*(parseInt(_0x58e6d6(0x1cb))/0x7)+parseInt(_0x58e6d6(0x1fa))/0x8*(parseInt(_0x58e6d6(0x1de))/0x9)+-parseInt(_0x58e6d6(0x1f4))/0xa+-parseInt(_0x58e6d6(0x210))/0xb*(parseInt(_0x58e6d6(0x206))/0xc);if(_0x1a3eea===_0x686bce)break;else _0x47517f['push'](_0x47517f['shift']());}catch(_0x5ee7f9){_0x47517f['push'](_0x47517f['shift']());}}}(a185_0x2124,0x5d12e));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';function a185_0x2124(){const _0x3819e7=['\x20\x20SELECT\x201\x20AS\x20id','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','77rhpLxk','appCode','MyBatis\x20XML\x20(mybatisXml)','7qIpFIA','Select\x20the\x20local\x20SQL\x20mode:','flag','dbId','description','Local\x20SQL\x20file\x20mode','File\x20already\x20exists:\x20','utf8','toISOString','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','</select>','lastSync','validation','54654bSeqVD','POST','isInteger','sqlRootDir','str','trim','9243tMrGcV','SELECT\x201\x20AS\x20id;','name','length','66fvJHIJ','map','sqlName','flagMissing','nonInteractive','number','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','dbId\x20must\x20be\x20a\x20positive\x20integer','Invalid\x20database\x20selection\x20payload:\x20','dbName','join','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','lockFilePath','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','write','Target\x20database\x20ID','Plain\x20SQL\x20(sql)','sqlRoot','3031430OGzZHX','db-id','stringify','mybatisXml','parse','__manual__','4360rQRhxj','SQL\x20name\x20cannot\x20be\x20empty','SQL\x20name:','2173854ICcZAe','isFinite','✎\x20Enter\x20dbId\x20manually','514804LcfFHs','270212KgfgJh','Select\x20the\x20target\x20database:','sql','For\x20MyBatis\x20XML\x20SQL\x20with\x20dynamic\x20tags','mode','3015372MwRRRH','30cVTurU','Target\x20database\x20dbId:','catch','create','/smartapi/custom/saveUserCustomSql','sqlCode','string'];a185_0x2124=function(){return _0x3819e7;};return a185_0x2124();}import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';function a185_0x48ff(_0x4ed106,_0x5d0f38){_0x4ed106=_0x4ed106-0x1c9;const _0x2124fe=a185_0x2124();let _0x48ff72=_0x2124fe[_0x4ed106];return _0x48ff72;}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(_0x276263){const _0x436d55=a185_0x48ff;if(_0x276263==='mybatisXml')return[_0x436d55(0x1ed),_0x436d55(0x20e),_0x436d55(0x1d5),''][_0x436d55(0x1ec)]('\x0a');return[_0x436d55(0x1df),''][_0x436d55(0x1ec)]('\x0a');}export const sqlCreate={'service':'sql','command':a185_0xe38f20(0x20a),'description':a185_0xe38f20(0x20f),'risk':a185_0xe38f20(0x1f0),'flags':[{'name':'name','type':a185_0xe38f20(0x20d),'description':'SQL\x20query\x20display\x20name'},{'name':a185_0xe38f20(0x1f5),'type':'number','description':a185_0xe38f20(0x1f1)},{'name':'mode','type':a185_0xe38f20(0x20d),'enum':[a185_0xe38f20(0x203),a185_0xe38f20(0x1f7)],'description':a185_0xe38f20(0x1d0)}],async 'validate'(_0x98bf6b){const _0x5514ac=a185_0xe38f20;if(!_0x98bf6b[_0x5514ac(0x1e6)])return;if(!_0x98bf6b[_0x5514ac(0x1dc)]('name')[_0x5514ac(0x1dd)]())throw CliErrors[_0x5514ac(0x1e5)](_0x5514ac(0x1e0),_0x5514ac(0x1e8));const _0x3561ba=resolveProvidedDbId(_0x98bf6b);if(typeof _0x3561ba!==_0x5514ac(0x1e7)||!Number['isFinite'](_0x3561ba)||_0x3561ba<=0x0)throw CliErrors[_0x5514ac(0x1e5)]('db-id',_0x5514ac(0x1d4));if(!_0x98bf6b[_0x5514ac(0x1dc)](_0x5514ac(0x205))['trim']())throw CliErrors[_0x5514ac(0x1e5)](_0x5514ac(0x205),'--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');},async 'dryRun'(_0x1d028d){const _0x97619a=a185_0xe38f20,_0x267bd4=loadSqlProjectConfig(_0x1d028d['appCode']),{sqlName:_0x2223b9,dbId:_0x42c569,dbName:_0x2540dc,mode:_0x449e85}=await resolveSqlNewInputs(_0x1d028d),_0x9743b7=buildSqlRelativePath('<server-generated-sqlCode>',_0x2223b9,_0x2540dc,_0x449e85,_0x42c569),_0x29c732=_0x267bd4[_0x97619a(0x1db)]+'/'+_0x9743b7;return{'method':_0x97619a(0x1d9),'url':_0x97619a(0x20b),'body':{'appCode':_0x1d028d[_0x97619a(0x1c9)],'sqlName':_0x2223b9,'dbId':_0x42c569,'mode':_0x449e85,'localPath':_0x29c732},'description':_0x97619a(0x1ef)+_0x267bd4[_0x97619a(0x1db)]};},async 'execute'(_0x392f28){const _0x3b2b4f=a185_0xe38f20,_0x29ec56=loadSqlProjectConfig(_0x392f28[_0x3b2b4f(0x1c9)]),{sqlName:_0x4b0b71,dbId:_0x3dbb32,dbName:_0xe6de3d,mode:_0x3d2ef7}=await resolveSqlNewInputs(_0x392f28),_0x4276f7=generateSqlTemplate(_0x3d2ef7),_0x4bb2ec=await createSqlQuery({'appCode':_0x392f28[_0x3b2b4f(0x1c9)],'sqlName':_0x4b0b71,'dbId':_0x3dbb32,'sqlContent':_0x4276f7}),_0x164547=ensureRemoteSqlContent(_0x4bb2ec),_0x1b1be3=_0xe6de3d||await getDbName(_0x392f28['appCode'],_0x3dbb32)[_0x3b2b4f(0x209)](()=>undefined),_0x5a595b=buildSqlRelativePath(_0x4bb2ec[_0x3b2b4f(0x20c)],_0x4bb2ec[_0x3b2b4f(0x1e4)],_0x1b1be3,_0x3d2ef7,_0x3dbb32),_0x496438=_0x29ec56[_0x3b2b4f(0x1db)]+'/'+_0x5a595b,_0x36ab7c=buildLocalSqlFileContent({'sqlCode':_0x4bb2ec[_0x3b2b4f(0x20c)],'sqlName':_0x4bb2ec[_0x3b2b4f(0x1e4)],'dbId':_0x4bb2ec[_0x3b2b4f(0x1ce)]},_0x164547,{'dbName':_0x1b1be3,'mode':_0x3d2ef7,'syncedAt':new Date()[_0x3b2b4f(0x1d3)](),'description':_0x4bb2ec[_0x3b2b4f(0x1cf)]});if(await fileExists(_0x496438))throw CliErrors['validation'](_0x3b2b4f(0x1d1)+_0x496438);await ensureParentDirectory(_0x496438),await writeFile(_0x496438,_0x36ab7c,_0x3b2b4f(0x1d2));const _0x218f1e=await readSqlLockFile(_0x29ec56['lockFilePath']),{lockData:_0x1ccf9f,appLock:_0x3a018d}=ensureSqlLockScope(_0x218f1e??createEmptySqlLock(),_0x29ec56[_0x3b2b4f(0x1c9)],_0x29ec56[_0x3b2b4f(0x1f3)],'new');return _0x3a018d['sqls'][_0x4bb2ec[_0x3b2b4f(0x20c)]]={...buildSqlLockEntry(_0x4bb2ec,_0x164547,computeSqlContentHash(_0x36ab7c),{'dbName':_0x1b1be3}),'path':_0x5a595b,'mode':_0x3d2ef7},_0x3a018d[_0x3b2b4f(0x1d6)]=new Date()[_0x3b2b4f(0x1d3)](),await writeSqlLockFile(_0x29ec56[_0x3b2b4f(0x1ee)],_0x1ccf9f),{'ok':!![],'data':{'id':_0x4bb2ec['id'],'sqlCode':_0x4bb2ec[_0x3b2b4f(0x20c)],'sqlName':_0x4bb2ec['sqlName'],'dbId':_0x4bb2ec['dbId'],'path':_0x496438,'mode':_0x3d2ef7},'message':'Created\x20SQL\x20query\x20'+_0x4bb2ec['sqlCode']};}};async function resolveSqlNewInputs(_0xd90520){const _0x49916d=await resolveSqlNameInput(_0xd90520),{dbId:_0x6270ca,dbName:_0x3d62b4}=await resolveDbSelection(_0xd90520),_0x3a6ce2=await resolveSqlModeInput(_0xd90520);return{'sqlName':_0x49916d,'dbId':_0x6270ca,'dbName':_0x3d62b4,'mode':_0x3a6ce2};}async function resolveSqlNameInput(_0x27954c){const _0x21e6de=a185_0xe38f20,_0x4465df=_0x27954c[_0x21e6de(0x1dc)](_0x21e6de(0x1e0))['trim']();if(_0x4465df)return _0x4465df;if(_0x27954c[_0x21e6de(0x1e6)])throw CliErrors[_0x21e6de(0x1e5)](_0x21e6de(0x1e0),_0x21e6de(0x1e8));return(await input({'message':_0x21e6de(0x1fc),'validate':_0x9fa908=>_0x9fa908[_0x21e6de(0x1dd)]()?!![]:_0x21e6de(0x1fb)}))[_0x21e6de(0x1dd)]();}async function resolveDbSelection(_0xf75c86){const _0x429d6b=a185_0xe38f20,_0x1c967d=resolveProvidedDbId(_0xf75c86);if(typeof _0x1c967d==='number'&&Number[_0x429d6b(0x1fe)](_0x1c967d)&&_0x1c967d>0x0)return{'dbId':_0x1c967d,'dbName':await getDbName(_0xf75c86[_0x429d6b(0x1c9)],_0x1c967d)['catch'](()=>undefined)};if(_0xf75c86[_0x429d6b(0x1e6)])throw CliErrors[_0x429d6b(0x1e5)](_0x429d6b(0x1f5),_0x429d6b(0x1d4));const _0x5183a8=await listDatabases(_0xf75c86[_0x429d6b(0x1c9)])['catch'](()=>[]);if(_0x5183a8[_0x429d6b(0x1e1)]===0x1)return{'dbId':_0x5183a8[0x0][_0x429d6b(0x1ce)],'dbName':_0x5183a8[0x0][_0x429d6b(0x1eb)]};if(_0x5183a8[_0x429d6b(0x1e1)]>0x1){const _0x26c50d=await select({'message':_0x429d6b(0x202),'choices':[..._0x5183a8[_0x429d6b(0x1e3)](_0x407fb6=>({'name':_0x407fb6[_0x429d6b(0x1eb)]+'\x20('+_0x407fb6['dbId']+')','value':serializeDbSelection(_0x407fb6)})),{'name':_0x429d6b(0x1ff),'value':_0x429d6b(0x1f9)}]});if(_0x26c50d!==_0x429d6b(0x1f9))return deserializeDbSelection(_0x26c50d);}const _0x3d8f1f=await input({'message':_0x429d6b(0x208),'validate':_0x5ac167=>{const _0x36e74e=_0x429d6b,_0xd651e4=_0x5ac167[_0x36e74e(0x1dd)]();if(!_0xd651e4)return'dbId\x20cannot\x20be\x20empty';const _0xa71210=Number(_0xd651e4);if(!Number[_0x36e74e(0x1da)](_0xa71210)||_0xa71210<=0x0)return _0x36e74e(0x1e9);return!![];}});return{'dbId':Number(_0x3d8f1f['trim']())};}async function resolveSqlModeInput(_0x3d0a8d){const _0x2ffde0=a185_0xe38f20,_0x48cbf0=_0x3d0a8d[_0x2ffde0(0x1dc)]('mode')[_0x2ffde0(0x1dd)]();if(_0x48cbf0===_0x2ffde0(0x203)||_0x48cbf0===_0x2ffde0(0x1f7))return _0x48cbf0;if(_0x3d0a8d[_0x2ffde0(0x1e6)])throw CliErrors[_0x2ffde0(0x1e5)]('mode','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');return await select({'message':_0x2ffde0(0x1cc),'choices':[{'name':_0x2ffde0(0x1f2),'value':'sql','description':'For\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20statements\x20that\x20run\x20directly'},{'name':_0x2ffde0(0x1ca),'value':_0x2ffde0(0x1f7),'description':_0x2ffde0(0x204)}]});}function serializeDbSelection(_0x44f9a4){const _0x1deefd=a185_0xe38f20;return JSON[_0x1deefd(0x1f6)]({'dbId':_0x44f9a4['dbId'],'dbName':_0x44f9a4[_0x1deefd(0x1eb)]});}function deserializeDbSelection(_0x58a555){const _0x3544a3=a185_0xe38f20;try{const _0x426fd5=JSON[_0x3544a3(0x1f8)](_0x58a555);if(typeof _0x426fd5[_0x3544a3(0x1ce)]===_0x3544a3(0x1e7)&&Number[_0x3544a3(0x1fe)](_0x426fd5[_0x3544a3(0x1ce)]))return{'dbId':_0x426fd5[_0x3544a3(0x1ce)],'dbName':_0x426fd5[_0x3544a3(0x1eb)]};}catch{}throw CliErrors[_0x3544a3(0x1d7)](_0x3544a3(0x1ea)+_0x58a555);}function resolveProvidedDbId(_0x3f6770){const _0x4a0113=a185_0xe38f20,_0x23434b=_0x3f6770[_0x4a0113(0x1cd)](_0x4a0113(0x1f5));if(typeof _0x23434b===_0x4a0113(0x1e7)&&Number[_0x4a0113(0x1fe)](_0x23434b))return _0x23434b;return undefined;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a186_0x689056=a186_0x46e3;(function(_0x4decff,_0x1bc46b){const _0x242d6d=a186_0x46e3,_0xbf7f03=_0x4decff();while(!![]){try{const _0x16a8a1=-parseInt(_0x242d6d(0x161))/0x1+-parseInt(_0x242d6d(0x15c))/0x2+parseInt(_0x242d6d(0x173))/0x3*(parseInt(_0x242d6d(0x168))/0x4)+-parseInt(_0x242d6d(0x163))/0x5+parseInt(_0x242d6d(0x180))/0x6+parseInt(_0x242d6d(0x15f))/0x7+parseInt(_0x242d6d(0x166))/0x8*(parseInt(_0x242d6d(0x16d))/0x9);if(_0x16a8a1===_0x1bc46b)break;else _0xbf7f03['push'](_0xbf7f03['shift']());}catch(_0x52af03){_0xbf7f03['push'](_0xbf7f03['shift']());}}}(a186_0x2f66,0x99275));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';function a186_0x2f66(){const _0x22b6e5=['32WNdfVD','toISOString','sqlRoot','Would\x20delete\x20SQL\x20','trashDir','4443813qvtnnS','fromEntries','validation','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','/smartapi/custom/deleteUserCustomSql','POST','94395GHowse','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','lockFilePath','length','projectRoot','appCode','\x20(local\x20file\x20moved\x20to\x20trash)','str','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','sqlcode','startsWith','sqlRootDir','3085500qoSkEC','trashedTo','666556MRKABA','high-risk-write','delete','3017693gCocwP','entries','916189SFkXaE','sqls','4007780aJbIYv','lastSync','Deleted\x20','24XmMUnM','remoteId'];a186_0x2f66=function(){return _0x22b6e5;};return a186_0x2f66();}import{dirname,join,relative,resolve,sep}from'node:path';function a186_0x46e3(_0x49b47c,_0x348b44){_0x49b47c=_0x49b47c-0x15c;const _0x2f66bb=a186_0x2f66();let _0x46e31c=_0x2f66bb[_0x49b47c];return _0x46e31c;}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':'sql','command':a186_0x689056(0x15e),'description':a186_0x689056(0x170),'risk':a186_0x689056(0x15d),'flags':[SQLCODE_FLAG],async 'validate'(_0x279aca){const _0x5a4741=a186_0x689056,_0x25021d=loadSqlProjectConfig(_0x279aca[_0x5a4741(0x179)]),_0x5c9849=await readSqlLockFile(_0x25021d['lockFilePath']);if(!_0x5c9849)throw CliErrors['validation'](_0x5a4741(0x17c));},async 'dryRun'(_0x908410){const _0x4d48c2=a186_0x689056,_0x806875=loadSqlProjectConfig(_0x908410[_0x4d48c2(0x179)]),_0x4dfafb=await readSqlLockFile(_0x806875[_0x4d48c2(0x176)]);if(!_0x4dfafb)throw CliErrors[_0x4d48c2(0x16f)]('SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.');const {appLock:_0x3d37fd}=ensureSqlLockScope(_0x4dfafb,_0x908410[_0x4d48c2(0x179)],_0x806875[_0x4d48c2(0x16a)],_0x4d48c2(0x15e)),_0x5c498e=_0x908410[_0x4d48c2(0x17b)](_0x4d48c2(0x17d)),_0x1a06a3=_0x3d37fd['sqls'][_0x5c498e];if(!_0x1a06a3)throw CliErrors[_0x4d48c2(0x16f)](_0x4d48c2(0x175)+_0x5c498e+'\x22.');return{'method':_0x4d48c2(0x172),'url':_0x4d48c2(0x171),'body':{'sqlCode':_0x5c498e,'id':_0x1a06a3[_0x4d48c2(0x167)],'localPath':resolveLocalSqlFilePath(_0x806875,_0x5c498e,_0x1a06a3)},'description':_0x4d48c2(0x16b)+_0x5c498e+_0x4d48c2(0x174)+_0x806875[_0x4d48c2(0x16c)]};},async 'execute'(_0x5670b5){const _0x2e6c5f=a186_0x689056,_0xf01ba4=loadSqlProjectConfig(_0x5670b5['appCode']),_0x48cba3=await readSqlLockFile(_0xf01ba4[_0x2e6c5f(0x176)]);if(!_0x48cba3)throw CliErrors[_0x2e6c5f(0x16f)]('SQL\x20lock\x20file\x20not\x20found.');const {lockData:_0x52d2aa,appLock:_0x17ce34}=ensureSqlLockScope(_0x48cba3,_0x5670b5[_0x2e6c5f(0x179)],_0xf01ba4[_0x2e6c5f(0x16a)],_0x2e6c5f(0x15e)),_0x1e08b5=_0x5670b5[_0x2e6c5f(0x17b)](_0x2e6c5f(0x17d)),_0x5503ee=_0x17ce34[_0x2e6c5f(0x162)][_0x1e08b5];if(!_0x5503ee)throw CliErrors[_0x2e6c5f(0x16f)](_0x2e6c5f(0x175)+_0x1e08b5+'\x22.');await deleteSqlQuery({'id':_0x5503ee[_0x2e6c5f(0x167)],'sqlCode':_0x1e08b5}),_0x17ce34['sqls']=Object[_0x2e6c5f(0x16e)](Object[_0x2e6c5f(0x160)](_0x17ce34[_0x2e6c5f(0x162)])['filter'](([_0x5cb836])=>_0x5cb836!==_0x1e08b5)),_0x17ce34[_0x2e6c5f(0x164)]=new Date()['toISOString'](),await writeSqlLockFile(_0xf01ba4[_0x2e6c5f(0x176)],_0x52d2aa);const _0x3649e7=resolveLocalSqlFilePath(_0xf01ba4,_0x1e08b5,_0x5503ee);let _0x35f114;await fileExists(_0x3649e7)&&(_0x35f114=await moveToTrash(_0xf01ba4[_0x2e6c5f(0x178)],_0xf01ba4[_0x2e6c5f(0x16c)],_0x3649e7),await cleanupEmptyDirectories(dirname(_0x3649e7),_0xf01ba4[_0x2e6c5f(0x17f)]));const _0xb8ca75={'deleted':_0x1e08b5,'remoteId':_0x5503ee[_0x2e6c5f(0x167)]};if(_0x35f114)_0xb8ca75[_0x2e6c5f(0x181)]=_0x35f114;return{'ok':!![],'data':_0xb8ca75,'message':_0x2e6c5f(0x165)+_0x1e08b5+(_0x35f114?_0x2e6c5f(0x17a):'')};}};async function moveToTrash(_0x432fba,_0x3f9bcc,_0xbb338d){const _0x151664=a186_0x689056,_0x4b0de8=new Date()[_0x151664(0x169)]()['replace'](/[:.]/g,'-'),_0x24d846=relative(_0x432fba,_0xbb338d),_0xe662b6=join(_0x3f9bcc,_0x4b0de8,_0x24d846);return await mkdir(dirname(_0xe662b6),{'recursive':!![]}),await rename(_0xbb338d,_0xe662b6),_0xe662b6;}async function cleanupEmptyDirectories(_0x4c45bb,_0x19b983){const _0x3a2e57=a186_0x689056;let _0x547099=resolve(_0x4c45bb);const _0x493458=resolve(_0x19b983);while(_0x547099[_0x3a2e57(0x17e)](''+_0x493458+sep)||_0x547099===_0x493458){if(_0x547099===_0x493458)return;try{const _0x2f4076=await readdir(_0x547099);if(_0x2f4076[_0x3a2e57(0x177)]>0x0)return;await rmdir(_0x547099);}catch{return;}_0x547099=dirname(_0x547099);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a187_0x4c3a65=a187_0x2a75;function a187_0x4880(){const _0x5a7f75=['Return\x20full\x20raw\x20SQL\x20query\x20object','10oTnqpB','1135962zdnLtq','sqlContent','4492IhrvrO','12520571jqViUn','6418sYjdKB','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','verbose','7265BzuPbG','9alvJOy','bool','sqlcode','read','19803311EsWJMf','appCode','160212hLrcUW','4972808QbhErN','sql','str','317miMoln','boolean','sqlName','dbId'];a187_0x4880=function(){return _0x5a7f75;};return a187_0x4880();}(function(_0x3acc8e,_0x506518){const _0x460d0b=a187_0x2a75,_0x3f889e=_0x3acc8e();while(!![]){try{const _0x2a62b8=parseInt(_0x460d0b(0x1fa))/0x1*(-parseInt(_0x460d0b(0x1ec))/0x2)+-parseInt(_0x460d0b(0x1e8))/0x3+-parseInt(_0x460d0b(0x1ea))/0x4*(-parseInt(_0x460d0b(0x1ef))/0x5)+parseInt(_0x460d0b(0x1f6))/0x6+-parseInt(_0x460d0b(0x1eb))/0x7+-parseInt(_0x460d0b(0x1f7))/0x8*(-parseInt(_0x460d0b(0x1f0))/0x9)+-parseInt(_0x460d0b(0x1e7))/0xa*(-parseInt(_0x460d0b(0x1f4))/0xb);if(_0x2a62b8===_0x506518)break;else _0x3f889e['push'](_0x3f889e['shift']());}catch(_0x52a89d){_0x3f889e['push'](_0x3f889e['shift']());}}}(a187_0x4880,0xdab13));import{getSqlQueryInfo}from'../../core/api-client.js';function a187_0x2a75(_0x314e81,_0x41d92a){_0x314e81=_0x314e81-0x1e3;const _0x4880fe=a187_0x4880();let _0x2a7587=_0x4880fe[_0x314e81];return _0x2a7587;}import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':a187_0x4c3a65(0x1f8),'command':'detail','description':a187_0x4c3a65(0x1ed),'risk':a187_0x4c3a65(0x1f3),'flags':[SQLCODE_FLAG,{'name':'verbose','type':a187_0x4c3a65(0x1e3),'description':a187_0x4c3a65(0x1e6)}],async 'execute'(_0xdd7c7c){const _0x3495cb=a187_0x4c3a65,_0x4bf880=await getSqlQueryInfo(_0xdd7c7c[_0x3495cb(0x1f5)],_0xdd7c7c[_0x3495cb(0x1f9)](_0x3495cb(0x1f2))),_0x432a7e=_0xdd7c7c[_0x3495cb(0x1f1)](_0x3495cb(0x1ee));if(_0x432a7e)return{'ok':!![],'data':_0x4bf880};const _0x1af7cc=_0x4bf880[_0x3495cb(0x1e5)]?await getDbName(_0xdd7c7c[_0x3495cb(0x1f5)],_0x4bf880[_0x3495cb(0x1e5)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x4bf880['sqlCode'],'sqlName':_0x4bf880[_0x3495cb(0x1e4)],'db':_0x1af7cc?_0x1af7cc+'\x20('+_0x4bf880['dbId']+')':_0x4bf880[_0x3495cb(0x1e5)]??'','description':_0x4bf880['description']??'','sqlContent':_0x4bf880[_0x3495cb(0x1e9)]??''}};}};
|
package/lib/commands/sql/exec.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a188_0x3ecefe=a188_0x136b;(function(_0x161539,_0x4e3324){const _0x4ba639=a188_0x136b,_0x140df6=_0x161539();while(!![]){try{const _0x12ac11=parseInt(_0x4ba639(0x1c3))/0x1+parseInt(_0x4ba639(0x1cd))/0x2*(parseInt(_0x4ba639(0x1d0))/0x3)+-parseInt(_0x4ba639(0x1bd))/0x4+-parseInt(_0x4ba639(0x1c8))/0x5*(parseInt(_0x4ba639(0x1d3))/0x6)+parseInt(_0x4ba639(0x1cf))/0x7*(parseInt(_0x4ba639(0x1d1))/0x8)+-parseInt(_0x4ba639(0x1bc))/0x9+parseInt(_0x4ba639(0x1c0))/0xa*(-parseInt(_0x4ba639(0x1c5))/0xb);if(_0x12ac11===_0x4e3324)break;else _0x140df6['push'](_0x140df6['shift']());}catch(_0x5635fb){_0x140df6['push'](_0x140df6['shift']());}}}(a188_0xdc2e,0x76f00));function a188_0xdc2e(){const _0x6ca9ff=['22FqFCSa','\x20row(s)\x20in\x20','execError','5RYdGTj','Returned\x20','params','now','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','1795354xGVlBl','str','91SsuUOI','3PWVBJn','347648EKlVnF','appCode','423606YrqaVX','execResult','read','6113700nQiIta','3291652qZIqjL','length','sqlcode','852810UdTNmN','exec','SQL\x20execution\x20failed','767939QBpgLw','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)'];a188_0xdc2e=function(){return _0x6ca9ff;};return a188_0xdc2e();}import{executeSql}from'../../core/api-client.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';import{parseJsonParams}from'../../utils/params.js';function a188_0x136b(_0x389963,_0x644cc6){_0x389963=_0x389963-0x1ba;const _0xdc2e85=a188_0xdc2e();let _0x136bd7=_0xdc2e85[_0x389963];return _0x136bd7;}export const sqlExec={'service':'sql','command':a188_0x3ecefe(0x1c1),'description':a188_0x3ecefe(0x1cc),'risk':a188_0x3ecefe(0x1bb),'flags':[SQLCODE_FLAG,{'name':a188_0x3ecefe(0x1ca),'type':'string','description':a188_0x3ecefe(0x1c4)}],async 'execute'(_0x105777){const _0x505d48=a188_0x3ecefe,_0x4d64db=parseJsonParams(_0x105777[_0x505d48(0x1ce)](_0x505d48(0x1ca))),_0x35e5e1=Date['now'](),_0xe1686d=await executeSql(_0x105777[_0x505d48(0x1d2)],_0x105777['str'](_0x505d48(0x1bf)),_0x4d64db),_0xecedf3=Date[_0x505d48(0x1cb)]()-_0x35e5e1,_0x51dc5f=_0xe1686d?.[_0x505d48(0x1ba)]??_0xe1686d,_0x950a16=_0xe1686d?.['execSuccess']??!![];if(!_0x950a16)return{'ok':![],'data':{'error':_0xe1686d?.[_0x505d48(0x1c7)]||_0x505d48(0x1c2),'elapsed':_0xecedf3},'message':'SQL\x20execution\x20failed'};const _0x3ca88a=Array['isArray'](_0x51dc5f)?_0x51dc5f:[];return{'ok':!![],'data':{'rows':_0x3ca88a,'rowCount':_0x3ca88a[_0x505d48(0x1be)],'elapsed':_0xecedf3},'message':_0x505d48(0x1c9)+_0x3ca88a[_0x505d48(0x1be)]+_0x505d48(0x1c6)+_0xecedf3+'ms'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x1c23e1,_0x268210){const _0x56c75a=a189_0x2558,_0x5e3ab4=_0x1c23e1();while(!![]){try{const _0x40dcdd=-parseInt(_0x56c75a(0x196))/0x1*(-parseInt(_0x56c75a(0x195))/0x2)+-parseInt(_0x56c75a(0x191))/0x3+parseInt(_0x56c75a(0x18f))/0x4*(-parseInt(_0x56c75a(0x197))/0x5)+parseInt(_0x56c75a(0x193))/0x6+-parseInt(_0x56c75a(0x194))/0x7*(parseInt(_0x56c75a(0x190))/0x8)+-parseInt(_0x56c75a(0x192))/0x9*(-parseInt(_0x56c75a(0x198))/0xa)+parseInt(_0x56c75a(0x18e))/0xb;if(_0x40dcdd===_0x268210)break;else _0x5e3ab4['push'](_0x5e3ab4['shift']());}catch(_0x2ae45c){_0x5e3ab4['push'](_0x5e3ab4['shift']());}}}(a189_0x1362,0xafb52));import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';import{sqlExec}from'../../commands/sql/exec.js';import{sqlPull}from'../../commands/sql/pull.js';import{sqlCreate}from'../../commands/sql/create.js';import{sqlStatus}from'../../commands/sql/status.js';function a189_0x2558(_0x1da206,_0x25f892){_0x1da206=_0x1da206-0x18e;const _0x13629f=a189_0x1362();let _0x255869=_0x13629f[_0x1da206];return _0x255869;}import{sqlPush}from'../../commands/sql/push.js';import{sqlDelete}from'../../commands/sql/delete.js';function a189_0x1362(){const _0x330514=['235368cARxxX','4242474BRLklG','5359991rubOpV','20iUjHHW','31796Wqmvas','410uhWbqS','550nGVsCp','6032653RFmQVL','13996CesaXI','8gRMkGl','3718479PXIDjG'];a189_0x1362=function(){return _0x330514;};return a189_0x1362();}export const sqlDefinitions=[sqlList,sqlDetail,sqlStatus,sqlCreate,sqlPush,sqlValidate,sqlExec,sqlPull,sqlDelete];
|
package/lib/commands/sql/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a190_0x3c6c22=a190_0x1a51;(function(_0x458300,_0x3d6704){const _0x1b8122=a190_0x1a51,_0x42a9d5=_0x458300();while(!![]){try{const _0x162197=parseInt(_0x1b8122(0xce))/0x1+parseInt(_0x1b8122(0xf2))/0x2+parseInt(_0x1b8122(0xe4))/0x3*(parseInt(_0x1b8122(0xe2))/0x4)+-parseInt(_0x1b8122(0xdf))/0x5*(parseInt(_0x1b8122(0xe8))/0x6)+-parseInt(_0x1b8122(0xe0))/0x7*(parseInt(_0x1b8122(0xeb))/0x8)+parseInt(_0x1b8122(0xdd))/0x9*(-parseInt(_0x1b8122(0xed))/0xa)+parseInt(_0x1b8122(0xd1))/0xb*(parseInt(_0x1b8122(0xd8))/0xc);if(_0x162197===_0x3d6704)break;else _0x42a9d5['push'](_0x42a9d5['shift']());}catch(_0x5655b1){_0x42a9d5['push'](_0x42a9d5['shift']());}}}(a190_0x5616,0x77941));import{listSqlQueries}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a190_0x1a51(_0x433f92,_0x51903a){_0x433f92=_0x433f92-0xcb;const _0x56163c=a190_0x5616();let _0x1a51fb=_0x56163c[_0x433f92];return _0x1a51fb;}export const sqlList={'service':a190_0x3c6c22(0xd9),'command':a190_0x3c6c22(0xd4),'description':a190_0x3c6c22(0xf0),'risk':a190_0x3c6c22(0xe5),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a190_0x3c6c22(0xec),'type':a190_0x3c6c22(0xcc),'description':a190_0x3c6c22(0xcb)},{'name':a190_0x3c6c22(0xcf),'type':a190_0x3c6c22(0xe3),'description':a190_0x3c6c22(0xe6),'default':0x1},{'name':a190_0x3c6c22(0xde),'type':a190_0x3c6c22(0xe3),'description':a190_0x3c6c22(0xf1)},{'name':a190_0x3c6c22(0xcd),'type':'boolean','description':a190_0x3c6c22(0xd5)}],async 'execute'(_0x406838){const _0x375d83=a190_0x3c6c22,_0x507951=await listSqlQueries(_0x406838['appCode'],{'sqlCode':_0x406838[_0x375d83(0xee)](_0x375d83(0xea))||undefined,'sqlName':_0x406838['str'](_0x375d83(0xec))||undefined,'currentPage':_0x406838[_0x375d83(0xda)](_0x375d83(0xcf)),'pageSize':_0x406838['num'](_0x375d83(0xde),0x32)}),_0x63faf1=_0x406838[_0x375d83(0xd7)](_0x375d83(0xcd)),_0x3d6618=_0x507951[_0x375d83(0xd2)]??[],_0x3b4bd7=_0x507951[_0x375d83(0xd6)]?.['totalCount']??_0x3d6618['length'];let _0x3f4dd7;return _0x63faf1?_0x3f4dd7=_0x3d6618:_0x3f4dd7=await Promise[_0x375d83(0xd0)](_0x3d6618[_0x375d83(0xf4)](async _0x4b204f=>{const _0x3ebd5b=_0x375d83;let _0x1a1c7a;try{_0x1a1c7a=_0x4b204f[_0x3ebd5b(0xdb)]?await getDbName(_0x406838[_0x3ebd5b(0xe7)],_0x4b204f[_0x3ebd5b(0xdb)]):undefined;}catch{}return{'sqlCode':_0x4b204f[_0x3ebd5b(0xe1)],'sqlName':_0x4b204f[_0x3ebd5b(0xd3)],'description':_0x4b204f[_0x3ebd5b(0xf5)]??'','db':_0x1a1c7a?_0x1a1c7a+'\x20('+_0x4b204f[_0x3ebd5b(0xdb)]+')':_0x4b204f[_0x3ebd5b(0xdb)]??''};})),{'ok':!![],'data':_0x3f4dd7,'message':_0x3d6618[_0x375d83(0xf3)]===0x0?_0x375d83(0xdc):_0x375d83(0xef)+_0x3d6618['length']+_0x375d83(0xe9)+_0x3b4bd7+').'};}};function a190_0x5616(){const _0x33d56d=['verbose','9959RhXkSU','page','all','12543157lRLSVE','tableData','sqlName','list','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','paging','bool','12GbyFoc','sql','num','dbId','No\x20custom\x20SQL\x20queries\x20found.','9IangVs','pagesize','89035hNaHtC','7KuCygn','sqlCode','52PXmgoE','number','64662oCYsFY','read','Page\x20number','appCode','132PSRFZY','\x20SQL\x20queries\x20(total:\x20','sqlcode','4112592PNuDlI','name','2303550brTXji','str','Found\x20','List\x20custom\x20SQL\x20queries','Page\x20size','391056vbrLZZ','length','map','description','Filter\x20by\x20SQL\x20name','string'];a190_0x5616=function(){return _0x33d56d;};return a190_0x5616();}
|
package/lib/commands/sql/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a191_0x16900d=a191_0x1647;(function(_0x4714cb,_0x297929){const _0x625372=a191_0x1647,_0x301b2e=_0x4714cb();while(!![]){try{const _0x3c14e2=parseInt(_0x625372(0x147))/0x1*(-parseInt(_0x625372(0x13a))/0x2)+parseInt(_0x625372(0x139))/0x3+parseInt(_0x625372(0x145))/0x4*(-parseInt(_0x625372(0x13b))/0x5)+-parseInt(_0x625372(0x14a))/0x6+-parseInt(_0x625372(0x16c))/0x7+-parseInt(_0x625372(0x142))/0x8+parseInt(_0x625372(0x146))/0x9;if(_0x3c14e2===_0x297929)break;else _0x301b2e['push'](_0x301b2e['shift']());}catch(_0x17f9c9){_0x301b2e['push'](_0x301b2e['shift']());}}}(a191_0x57ab,0x33566));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';function a191_0x57ab(){const _0x33846c=['split','apps','sqlContent','sqls','join','path','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','catch','No\x20remote\x20SQL\x20queries\x20matched.','name','Pull\x20complete:\x20','\x20SQL\x20file(s)\x20into\x20','length','sqlRoot','local\x20differs\x20from\x20remote','\x20skipped,\x20','470155bWyyMb','sqlRootDir','utf8','lockFilePath','skipped','845481KtuoKK','644230SHbKvT','67415iuYWSj','sql','sqlcode','unchanged','test','pull','dbId','1704584lhHELx','nonInteractive','cancelled','24Rinisz','6308127pQvFUg','1rIvNLG','force','sqlCode','535206xDtavk','\x20written,\x20','sqlName','read','toISOString','trimStart','Would\x20pull\x20','mybatisXml','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','push','lastSync','replace','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','\x20failed','str','description','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','appCode'];a191_0x57ab=function(){return _0x33846c;};return a191_0x57ab();}import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';const PAGE_SIZE=0x64;function a191_0x1647(_0x127087,_0x528f46){_0x127087=_0x127087-0x139;const _0x57abc5=a191_0x57ab();let _0x16479b=_0x57abc5[_0x127087];return _0x16479b;}async function fetchAllSqlQueries(_0x47f226,_0xd4d4){const _0x172bc4=a191_0x1647,_0x19b515=[];let _0x3f3f85=0x1;while(!![]){const _0x922679=await listSqlQueries(_0x47f226,{'currentPage':_0x3f3f85,'pageSize':PAGE_SIZE,'sqlCode':_0xd4d4[_0x172bc4(0x149)],'sqlName':_0xd4d4[_0x172bc4(0x14c)]}),_0x100847=_0x922679['tableData']??[];_0x19b515[_0x172bc4(0x153)](..._0x100847);if(_0x100847[_0x172bc4(0x168)]===0x0)break;const _0x247794=_0x922679['paging']?.['totalCount'];if(_0x247794!=null?_0x19b515[_0x172bc4(0x168)]>=_0x247794:_0x100847[_0x172bc4(0x168)]<PAGE_SIZE)break;_0x3f3f85++;}return _0x19b515;}async function ensureSqlContent(_0x14c299){const _0x124e43=a191_0x1647;if(_0x14c299['sqlContent']!=null&&String(_0x14c299[_0x124e43(0x15e)])['length']>0x0)return _0x14c299;return getSqlQueryDetail(_0x14c299[_0x124e43(0x149)]);}export const sqlPull={'service':a191_0x16900d(0x13c),'command':'pull','description':a191_0x16900d(0x152),'risk':a191_0x16900d(0x14d),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a191_0x16900d(0x165),'type':'string','description':'Filter\x20by\x20SQL\x20display\x20name'},{'name':a191_0x16900d(0x148),'type':'boolean','description':'Force\x20overwrite\x20local\x20unsynced\x20changes'}],async 'dryRun'(_0x54485d){const _0x4356e7=a191_0x16900d,_0x5893a8=loadSqlProjectConfig(_0x54485d['appCode']),_0x11063a=await readSqlLockFile(_0x5893a8['lockFilePath']),{appLock:_0x5e3f0b}=ensureSqlLockScope(_0x11063a??createEmptySqlLock(),_0x5893a8['appCode'],_0x5893a8[_0x4356e7(0x169)],_0x4356e7(0x140)),_0x552031=await fetchAllSqlQueries(_0x54485d[_0x4356e7(0x15b)],{'sqlCode':_0x54485d[_0x4356e7(0x158)](_0x4356e7(0x13d))||undefined,'sqlName':_0x54485d[_0x4356e7(0x158)](_0x4356e7(0x165))||undefined}),_0x2a0638=[];for(const _0x1d81fe of _0x552031){const _0x3a5784=await ensureSqlContent(_0x1d81fe),_0x11816a=ensureRemoteSqlContent(_0x3a5784),_0x68b56c=detectModeFromSql(_0x3a5784),_0x5d0bd1=_0x3a5784['dbId']?await getDbName(_0x54485d[_0x4356e7(0x15b)],Number(_0x3a5784[_0x4356e7(0x141)]))[_0x4356e7(0x163)](()=>undefined):undefined,_0x78ae3d=buildLocalSqlFileContent({'sqlCode':_0x3a5784['sqlCode'],'sqlName':_0x3a5784[_0x4356e7(0x14c)],'dbId':_0x3a5784[_0x4356e7(0x141)]},_0x11816a,{'dbName':_0x5d0bd1,'mode':_0x68b56c,'syncedAt':new Date()[_0x4356e7(0x14e)](),'description':_0x3a5784[_0x4356e7(0x159)]}),_0x28d3f9=buildSqlLockEntry(_0x3a5784,_0x11816a,'',{'dbName':_0x5d0bd1}),_0x2c5828=resolveLocalSqlFilePath(_0x5893a8,_0x3a5784[_0x4356e7(0x149)],_0x28d3f9);let _0xce1d08='would_pull',_0xaa1e0a;if(await fileExists(_0x2c5828)){const _0x1de376=await readFile(_0x2c5828,_0x4356e7(0x16e));isEquivalentPulledSqlFile(_0x1de376,_0x78ae3d,_0x68b56c)?(_0xce1d08=_0x4356e7(0x170),_0xaa1e0a=_0x4356e7(0x13e)):(_0xce1d08='conflict',_0xaa1e0a=_0x4356e7(0x15a));}_0x2a0638[_0x4356e7(0x153)]({'sqlCode':_0x3a5784[_0x4356e7(0x149)],'sqlName':_0x3a5784[_0x4356e7(0x14c)],'filePath':_0x2c5828,'status':_0xce1d08,'reason':_0xaa1e0a});}return{'method':'POST','url':_0x4356e7(0x156),'body':{'appCode':_0x54485d[_0x4356e7(0x15b)],'sqlCode':_0x54485d[_0x4356e7(0x158)]('sqlcode')||null,'sqlName':_0x54485d[_0x4356e7(0x158)](_0x4356e7(0x165))||null,'files':_0x2a0638},'description':_0x4356e7(0x150)+_0x2a0638[_0x4356e7(0x168)]+_0x4356e7(0x167)+_0x5893a8['sqlRootDir']};},async 'execute'(_0x1bbc8a){const _0x4d6a21=a191_0x16900d,_0xce1401=loadSqlProjectConfig(_0x1bbc8a[_0x4d6a21(0x15b)]),_0x186fdc=await readSqlLockFile(_0xce1401[_0x4d6a21(0x16f)]),{lockData:_0x47ed9d,appLock:_0x40974c}=ensureSqlLockScope(_0x186fdc??createEmptySqlLock(),_0xce1401[_0x4d6a21(0x15b)],_0xce1401['sqlRoot'],_0x4d6a21(0x140)),_0x2363c=_0x1bbc8a['bool'](_0x4d6a21(0x148)),_0x3179eb=await fetchAllSqlQueries(_0x1bbc8a[_0x4d6a21(0x15b)],{'sqlCode':_0x1bbc8a['str'](_0x4d6a21(0x13d))||undefined,'sqlName':_0x1bbc8a['str']('name')||undefined});if(_0x3179eb[_0x4d6a21(0x168)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x4d6a21(0x164)};const _0x3275e9=[],_0xea552e=[];for(const _0x5dbf55 of _0x3179eb){try{_0x3275e9[_0x4d6a21(0x153)](await ensureSqlContent(_0x5dbf55));}catch(_0x35e31b){_0xea552e['push']({'sqlCode':_0x5dbf55[_0x4d6a21(0x149)],'error':_0x35e31b instanceof Error?_0x35e31b['message']:String(_0x35e31b)});}}if(_0x2363c&&!_0x1bbc8a[_0x4d6a21(0x143)]){let _0x5711a5=![];for(const _0x5dd278 of _0x3275e9){const _0x324b71=detectModeFromSql(_0x5dd278),_0x2e5c02=_0x5dd278[_0x4d6a21(0x141)]?await getDbName(_0x1bbc8a[_0x4d6a21(0x15b)],Number(_0x5dd278[_0x4d6a21(0x141)]))[_0x4d6a21(0x163)](()=>undefined):undefined,_0x166ff1=buildLocalSqlFileContent({'sqlCode':_0x5dd278[_0x4d6a21(0x149)],'sqlName':_0x5dd278[_0x4d6a21(0x14c)],'dbId':_0x5dd278[_0x4d6a21(0x141)]},ensureRemoteSqlContent(_0x5dd278),{'dbName':_0x2e5c02,'mode':_0x324b71,'syncedAt':new Date()['toISOString'](),'description':_0x5dd278[_0x4d6a21(0x159)]}),_0x56a4ed=resolveLocalSqlFilePath(_0xce1401,_0x5dd278['sqlCode'],buildSqlLockEntry(_0x5dd278,ensureRemoteSqlContent(_0x5dd278),'',{'dbName':_0x2e5c02}));if(await fileExists(_0x56a4ed)){const _0x4515d0=await readFile(_0x56a4ed,_0x4d6a21(0x16e));if(!isEquivalentPulledSqlFile(_0x4515d0,_0x166ff1,_0x324b71)){_0x5711a5=!![];break;}}}if(_0x5711a5){const _0x157545=await confirmForceOverwrite(_0x4d6a21(0x162));if(!_0x157545)throw CliErrors[_0x4d6a21(0x144)]('Force\x20pull\x20cancelled.');}}const _0x1f3caa=cloneSqlLockData(_0x47ed9d),_0x5a22b7=_0x1f3caa[_0x4d6a21(0x15d)][_0xce1401[_0x4d6a21(0x15b)]],_0x1be0e5=[],_0x48c8a3=[];for(const _0x2b2deb of _0x3275e9){const _0x2167dc=_0x5a22b7['sqls'][_0x2b2deb[_0x4d6a21(0x149)]],_0x633535=ensureRemoteSqlContent(_0x2b2deb),_0x5bae6f=detectModeFromSql(_0x2b2deb),_0x5753c5=_0x2b2deb[_0x4d6a21(0x141)]?await getDbName(_0x1bbc8a[_0x4d6a21(0x15b)],Number(_0x2b2deb['dbId']))[_0x4d6a21(0x163)](()=>undefined):undefined,_0x25790d=buildLocalSqlFileContent({'sqlCode':_0x2b2deb['sqlCode'],'sqlName':_0x2b2deb['sqlName'],'dbId':_0x2b2deb[_0x4d6a21(0x141)]},_0x633535,{'dbName':_0x5753c5,'mode':_0x5bae6f,'syncedAt':new Date()['toISOString'](),'description':_0x2b2deb[_0x4d6a21(0x159)]}),_0x1390a3=buildSqlLockEntry(_0x2b2deb,_0x633535,computeSqlContentHash(_0x25790d),{'dbName':_0x5753c5}),_0x168f39=_0x1390a3['path'],_0x4b18ad=join(_0xce1401['sqlRootDir'],_0x168f39);try{if(await fileExists(_0x4b18ad)){const _0x3ef75d=await readFile(_0x4b18ad,_0x4d6a21(0x16e));if(isEquivalentPulledSqlFile(_0x3ef75d,_0x25790d,_0x5bae6f)){_0x48c8a3[_0x4d6a21(0x153)]({'sqlCode':_0x2b2deb[_0x4d6a21(0x149)],'reason':'unchanged'}),_0x5a22b7[_0x4d6a21(0x15f)][_0x2b2deb['sqlCode']]={..._0x1390a3,'hash':computeSqlContentHash(_0x3ef75d),'path':_0x168f39};continue;}if(!_0x2363c){_0x48c8a3['push']({'sqlCode':_0x2b2deb[_0x4d6a21(0x149)],'reason':_0x4d6a21(0x16a)});continue;}}const _0x32b74d=_0x2167dc?.['path']?join(_0xce1401[_0x4d6a21(0x16d)],_0x2167dc[_0x4d6a21(0x161)]):undefined;_0x32b74d&&_0x32b74d!==_0x4b18ad&&await fileExists(_0x32b74d)&&await rm(_0x32b74d,{'force':!![]}),await ensureParentDirectory(_0x4b18ad),await writeFile(_0x4b18ad,_0x25790d,_0x4d6a21(0x16e)),_0x5a22b7[_0x4d6a21(0x15f)][_0x2b2deb[_0x4d6a21(0x149)]]={..._0x1390a3,'path':_0x168f39},_0x1be0e5[_0x4d6a21(0x153)]({'sqlCode':_0x2b2deb[_0x4d6a21(0x149)],'filePath':_0x4b18ad});}catch(_0x57d8a8){_0xea552e[_0x4d6a21(0x153)]({'sqlCode':_0x2b2deb[_0x4d6a21(0x149)],'error':_0x57d8a8 instanceof Error?_0x57d8a8['message']:String(_0x57d8a8)});}}return _0x5a22b7[_0x4d6a21(0x154)]=new Date()[_0x4d6a21(0x14e)](),await writeSqlLockFile(_0xce1401[_0x4d6a21(0x16f)],_0x1f3caa),{'ok':_0xea552e[_0x4d6a21(0x168)]===0x0,'data':{'pulled':_0x1be0e5,'skipped':_0x48c8a3,'failed':_0xea552e},'message':_0x4d6a21(0x166)+_0x1be0e5[_0x4d6a21(0x168)]+_0x4d6a21(0x14b)+_0x48c8a3['length']+_0x4d6a21(0x16b)+_0xea552e['length']+_0x4d6a21(0x157)};}};function detectModeFromSql(_0x36f75e){const _0x3efa31=a191_0x16900d,_0x2ba589=ensureRemoteSqlContent(_0x36f75e),_0x16450d=stripLocalSqlMetadata(_0x2ba589,_0x3efa31(0x151))[_0x3efa31(0x14f)]();if(/^<(select|insert|update|delete)\b/i[_0x3efa31(0x13f)](_0x16450d))return _0x3efa31(0x151);return'sql';}function isEquivalentPulledSqlFile(_0x1ba76e,_0x30b73f,_0xdd3d49){return normalizePullComparableContent(_0x1ba76e,_0xdd3d49)===normalizePullComparableContent(_0x30b73f,_0xdd3d49);}function normalizePullComparableContent(_0x2a4668,_0x8e90cc){const _0x4365c3=a191_0x16900d,_0x3530f1=_0x2a4668[_0x4365c3(0x155)](/\r\n/g,'\x0a')[_0x4365c3(0x15c)]('\x0a'),_0x475b9f=_0x3530f1['filter'](_0x1e2e70=>!isSyncedAtMetadataLine(_0x1e2e70,_0x8e90cc));return _0x475b9f[_0x4365c3(0x160)]('\x0a');}function isSyncedAtMetadataLine(_0x20feed,_0x1d22b9){const _0x526094=a191_0x16900d;if(_0x1d22b9===_0x526094(0x151))return/^\s*<!--\s*@lovrabet\.syncedAt:/['test'](_0x20feed);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x526094(0x13f)](_0x20feed);}
|
|
1
|
+
const a191_0x234989=a191_0x2817;(function(_0x33cee9,_0x524716){const _0x1f47f8=a191_0x2817,_0xcaff54=_0x33cee9();while(!![]){try{const _0x5efe69=-parseInt(_0x1f47f8(0x182))/0x1+parseInt(_0x1f47f8(0x189))/0x2*(parseInt(_0x1f47f8(0x1b4))/0x3)+parseInt(_0x1f47f8(0x191))/0x4+-parseInt(_0x1f47f8(0x1ae))/0x5*(parseInt(_0x1f47f8(0x193))/0x6)+parseInt(_0x1f47f8(0x18e))/0x7*(-parseInt(_0x1f47f8(0x1a8))/0x8)+-parseInt(_0x1f47f8(0x17b))/0x9+-parseInt(_0x1f47f8(0x185))/0xa*(-parseInt(_0x1f47f8(0x192))/0xb);if(_0x5efe69===_0x524716)break;else _0xcaff54['push'](_0xcaff54['shift']());}catch(_0x5aa001){_0xcaff54['push'](_0xcaff54['shift']());}}}(a191_0x59be,0xc9f1e));function a191_0x59be(){const _0xd13431=['lastSync','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','POST','description','Force\x20overwrite\x20local\x20unsynced\x20changes','Would\x20pull\x20','1294575MljbUm','tableData','length','2241380ErCSkJ','catch','string','No\x20remote\x20SQL\x20queries\x20matched.','8PSFTRS','sqlRoot','local\x20differs\x20from\x20remote','cancelled','pull','8799oHAdpn','sqls','read','3887380KIUWUh','209QhXMKs','18sguBLA','lockFilePath','dbId','unchanged','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','toISOString','join','mybatisXml','\x20SQL\x20file(s)\x20into\x20','name','bool','Pull\x20complete:\x20','nonInteractive','path','skipped','boolean','sqlcode','sqlRootDir','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','message','sqlCode','7272mTzfsB','sqlName','utf8','push','totalCount','str','2238525HiKtYG','filter','paging','appCode','sqlContent','Filter\x20by\x20SQL\x20display\x20name','228210mELais','apps','test','sql','8345502hgCFrB'];a191_0x59be=function(){return _0xd13431;};return a191_0x59be();}import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x48f8e0,_0x2986af){const _0xd12cbe=a191_0x2817,_0xec1332=[];let _0x187b43=0x1;while(!![]){const _0x61b273=await listSqlQueries(_0x48f8e0,{'currentPage':_0x187b43,'pageSize':PAGE_SIZE,'sqlCode':_0x2986af[_0xd12cbe(0x1a7)],'sqlName':_0x2986af[_0xd12cbe(0x1a9)]}),_0x56b383=_0x61b273[_0xd12cbe(0x183)]??[];_0xec1332['push'](..._0x56b383);if(_0x56b383[_0xd12cbe(0x184)]===0x0)break;const _0x365880=_0x61b273[_0xd12cbe(0x1b0)]?.[_0xd12cbe(0x1ac)];if(_0x365880!=null?_0xec1332[_0xd12cbe(0x184)]>=_0x365880:_0x56b383[_0xd12cbe(0x184)]<PAGE_SIZE)break;_0x187b43++;}return _0xec1332;}async function ensureSqlContent(_0xfad991){const _0x4eebd5=a191_0x2817;if(_0xfad991['sqlContent']!=null&&String(_0xfad991[_0x4eebd5(0x1b2)])[_0x4eebd5(0x184)]>0x0)return _0xfad991;return getSqlQueryDetail(_0xfad991[_0x4eebd5(0x1a7)]);}export const sqlPull={'service':a191_0x234989(0x1b7),'command':'pull','description':a191_0x234989(0x1a5),'risk':a191_0x234989(0x190),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'name','type':a191_0x234989(0x187),'description':a191_0x234989(0x1b3)},{'name':'force','type':a191_0x234989(0x1a2),'description':a191_0x234989(0x180)}],async 'dryRun'(_0x3eed74){const _0x37cb81=a191_0x234989,_0x21eeda=loadSqlProjectConfig(_0x3eed74[_0x37cb81(0x1b1)]),_0x112f46=await readSqlLockFile(_0x21eeda['lockFilePath']),{appLock:_0x3b037c}=ensureSqlLockScope(_0x112f46??createEmptySqlLock(),_0x21eeda[_0x37cb81(0x1b1)],_0x21eeda[_0x37cb81(0x18a)],_0x37cb81(0x18d)),_0x491105=await fetchAllSqlQueries(_0x3eed74[_0x37cb81(0x1b1)],{'sqlCode':_0x3eed74[_0x37cb81(0x1ad)](_0x37cb81(0x1a3))||undefined,'sqlName':_0x3eed74[_0x37cb81(0x1ad)](_0x37cb81(0x19c))||undefined}),_0x5e892c=[];for(const _0x345c59 of _0x491105){const _0x11c83a=await ensureSqlContent(_0x345c59),_0x142307=ensureRemoteSqlContent(_0x11c83a),_0x31fe7c=detectModeFromSql(_0x11c83a),_0x243eed=_0x11c83a[_0x37cb81(0x195)]?await getDbName(_0x3eed74['appCode'],Number(_0x11c83a[_0x37cb81(0x195)]))[_0x37cb81(0x186)](()=>undefined):undefined,_0x924240=buildLocalSqlFileContent({'sqlCode':_0x11c83a[_0x37cb81(0x1a7)],'sqlName':_0x11c83a['sqlName'],'dbId':_0x11c83a['dbId']},_0x142307,{'dbName':_0x243eed,'mode':_0x31fe7c,'syncedAt':new Date()[_0x37cb81(0x198)](),'description':_0x11c83a[_0x37cb81(0x17f)]}),_0x28e78b=buildSqlLockEntry(_0x11c83a,_0x142307,'',{'dbName':_0x243eed}),_0x18cff4=resolveLocalSqlFilePath(_0x21eeda,_0x11c83a[_0x37cb81(0x1a7)],_0x28e78b);let _0x3b1e12='would_pull',_0x1871f2;if(await fileExists(_0x18cff4)){const _0x11f8f3=await readFile(_0x18cff4,_0x37cb81(0x1aa));isEquivalentPulledSqlFile(_0x11f8f3,_0x924240,_0x31fe7c)?(_0x3b1e12=_0x37cb81(0x1a1),_0x1871f2=_0x37cb81(0x196)):(_0x3b1e12='conflict',_0x1871f2='local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)');}_0x5e892c[_0x37cb81(0x1ab)]({'sqlCode':_0x11c83a['sqlCode'],'sqlName':_0x11c83a['sqlName'],'filePath':_0x18cff4,'status':_0x3b1e12,'reason':_0x1871f2});}return{'method':_0x37cb81(0x17e),'url':_0x37cb81(0x17d),'body':{'appCode':_0x3eed74[_0x37cb81(0x1b1)],'sqlCode':_0x3eed74[_0x37cb81(0x1ad)](_0x37cb81(0x1a3))||null,'sqlName':_0x3eed74[_0x37cb81(0x1ad)](_0x37cb81(0x19c))||null,'files':_0x5e892c},'description':_0x37cb81(0x181)+_0x5e892c['length']+_0x37cb81(0x19b)+_0x21eeda[_0x37cb81(0x1a4)]};},async 'execute'(_0x4b4ef9){const _0x4682d7=a191_0x234989,_0x24da17=loadSqlProjectConfig(_0x4b4ef9[_0x4682d7(0x1b1)]),_0xde2060=await readSqlLockFile(_0x24da17['lockFilePath']),{lockData:_0x57ccaa,appLock:_0x79603f}=ensureSqlLockScope(_0xde2060??createEmptySqlLock(),_0x24da17['appCode'],_0x24da17['sqlRoot'],_0x4682d7(0x18d)),_0x550dba=_0x4b4ef9[_0x4682d7(0x19d)]('force'),_0x5b77e0=await fetchAllSqlQueries(_0x4b4ef9['appCode'],{'sqlCode':_0x4b4ef9['str'](_0x4682d7(0x1a3))||undefined,'sqlName':_0x4b4ef9[_0x4682d7(0x1ad)]('name')||undefined});if(_0x5b77e0[_0x4682d7(0x184)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x4682d7(0x188)};const _0x495ec8=[],_0x2662d7=[];for(const _0x21c3fd of _0x5b77e0){try{_0x495ec8[_0x4682d7(0x1ab)](await ensureSqlContent(_0x21c3fd));}catch(_0xf1c4c1){_0x2662d7[_0x4682d7(0x1ab)]({'sqlCode':_0x21c3fd[_0x4682d7(0x1a7)],'error':_0xf1c4c1 instanceof Error?_0xf1c4c1[_0x4682d7(0x1a6)]:String(_0xf1c4c1)});}}if(_0x550dba&&!_0x4b4ef9[_0x4682d7(0x19f)]){let _0x54af62=![];for(const _0x372be4 of _0x495ec8){const _0x26cb29=detectModeFromSql(_0x372be4),_0x5a03c1=_0x372be4['dbId']?await getDbName(_0x4b4ef9[_0x4682d7(0x1b1)],Number(_0x372be4[_0x4682d7(0x195)]))['catch'](()=>undefined):undefined,_0x222535=buildLocalSqlFileContent({'sqlCode':_0x372be4['sqlCode'],'sqlName':_0x372be4[_0x4682d7(0x1a9)],'dbId':_0x372be4['dbId']},ensureRemoteSqlContent(_0x372be4),{'dbName':_0x5a03c1,'mode':_0x26cb29,'syncedAt':new Date()[_0x4682d7(0x198)](),'description':_0x372be4[_0x4682d7(0x17f)]}),_0x3456e8=resolveLocalSqlFilePath(_0x24da17,_0x372be4[_0x4682d7(0x1a7)],buildSqlLockEntry(_0x372be4,ensureRemoteSqlContent(_0x372be4),'',{'dbName':_0x5a03c1}));if(await fileExists(_0x3456e8)){const _0x1448f3=await readFile(_0x3456e8,_0x4682d7(0x1aa));if(!isEquivalentPulledSqlFile(_0x1448f3,_0x222535,_0x26cb29)){_0x54af62=!![];break;}}}if(_0x54af62){const _0x3bc1f6=await confirmForceOverwrite(_0x4682d7(0x197));if(!_0x3bc1f6)throw CliErrors[_0x4682d7(0x18c)]('Force\x20pull\x20cancelled.');}}const _0x45d7e9=cloneSqlLockData(_0x57ccaa),_0x280503=_0x45d7e9[_0x4682d7(0x1b5)][_0x24da17['appCode']],_0x212cd0=[],_0x4fe3aa=[];for(const _0x2b26e8 of _0x495ec8){const _0x32e4dc=_0x280503[_0x4682d7(0x18f)][_0x2b26e8[_0x4682d7(0x1a7)]],_0x1344d7=ensureRemoteSqlContent(_0x2b26e8),_0x59d717=detectModeFromSql(_0x2b26e8),_0x22fe6b=_0x2b26e8['dbId']?await getDbName(_0x4b4ef9[_0x4682d7(0x1b1)],Number(_0x2b26e8['dbId']))[_0x4682d7(0x186)](()=>undefined):undefined,_0x44323b=buildLocalSqlFileContent({'sqlCode':_0x2b26e8[_0x4682d7(0x1a7)],'sqlName':_0x2b26e8[_0x4682d7(0x1a9)],'dbId':_0x2b26e8[_0x4682d7(0x195)]},_0x1344d7,{'dbName':_0x22fe6b,'mode':_0x59d717,'syncedAt':new Date()['toISOString'](),'description':_0x2b26e8[_0x4682d7(0x17f)]}),_0x1df3a0=buildSqlLockEntry(_0x2b26e8,_0x1344d7,computeSqlContentHash(_0x44323b),{'dbName':_0x22fe6b}),_0xe6a69b=_0x1df3a0['path'],_0x460151=join(_0x24da17[_0x4682d7(0x1a4)],_0xe6a69b);try{if(await fileExists(_0x460151)){const _0x59fd72=await readFile(_0x460151,'utf8');if(isEquivalentPulledSqlFile(_0x59fd72,_0x44323b,_0x59d717)){_0x4fe3aa[_0x4682d7(0x1ab)]({'sqlCode':_0x2b26e8[_0x4682d7(0x1a7)],'reason':_0x4682d7(0x196)}),_0x280503[_0x4682d7(0x18f)][_0x2b26e8[_0x4682d7(0x1a7)]]={..._0x1df3a0,'hash':computeSqlContentHash(_0x59fd72),'path':_0xe6a69b};continue;}if(!_0x550dba){_0x4fe3aa[_0x4682d7(0x1ab)]({'sqlCode':_0x2b26e8[_0x4682d7(0x1a7)],'reason':_0x4682d7(0x18b)});continue;}}const _0x5d80be=_0x32e4dc?.[_0x4682d7(0x1a0)]?join(_0x24da17[_0x4682d7(0x1a4)],_0x32e4dc[_0x4682d7(0x1a0)]):undefined;_0x5d80be&&_0x5d80be!==_0x460151&&await fileExists(_0x5d80be)&&await rm(_0x5d80be,{'force':!![]}),await ensureParentDirectory(_0x460151),await writeFile(_0x460151,_0x44323b,_0x4682d7(0x1aa)),_0x280503['sqls'][_0x2b26e8[_0x4682d7(0x1a7)]]={..._0x1df3a0,'path':_0xe6a69b},_0x212cd0[_0x4682d7(0x1ab)]({'sqlCode':_0x2b26e8[_0x4682d7(0x1a7)],'filePath':_0x460151});}catch(_0xe08b68){_0x2662d7[_0x4682d7(0x1ab)]({'sqlCode':_0x2b26e8[_0x4682d7(0x1a7)],'error':_0xe08b68 instanceof Error?_0xe08b68['message']:String(_0xe08b68)});}}return _0x280503[_0x4682d7(0x17c)]=new Date()[_0x4682d7(0x198)](),await writeSqlLockFile(_0x24da17[_0x4682d7(0x194)],_0x45d7e9),{'ok':_0x2662d7[_0x4682d7(0x184)]===0x0,'data':{'pulled':_0x212cd0,'skipped':_0x4fe3aa,'failed':_0x2662d7},'message':_0x4682d7(0x19e)+_0x212cd0[_0x4682d7(0x184)]+'\x20written,\x20'+_0x4fe3aa[_0x4682d7(0x184)]+'\x20skipped,\x20'+_0x2662d7[_0x4682d7(0x184)]+'\x20failed'};}};function a191_0x2817(_0x5b4b6e,_0x11a151){_0x5b4b6e=_0x5b4b6e-0x17b;const _0x59beab=a191_0x59be();let _0x2817f5=_0x59beab[_0x5b4b6e];return _0x2817f5;}function detectModeFromSql(_0x391ea0){const _0xf3b6a3=a191_0x234989,_0x54e0f5=ensureRemoteSqlContent(_0x391ea0),_0x246f4e=stripLocalSqlMetadata(_0x54e0f5,'mybatisXml')['trimStart']();if(/^<(select|insert|update|delete)\b/i[_0xf3b6a3(0x1b6)](_0x246f4e))return _0xf3b6a3(0x19a);return _0xf3b6a3(0x1b7);}function isEquivalentPulledSqlFile(_0x5e1251,_0x1f19f0,_0x240ae6){return normalizePullComparableContent(_0x5e1251,_0x240ae6)===normalizePullComparableContent(_0x1f19f0,_0x240ae6);}function normalizePullComparableContent(_0x521b0a,_0x293452){const _0x46fcbf=a191_0x234989,_0x6b0fbd=_0x521b0a['replace'](/\r\n/g,'\x0a')['split']('\x0a'),_0x5a2fc0=_0x6b0fbd[_0x46fcbf(0x1af)](_0x391959=>!isSyncedAtMetadataLine(_0x391959,_0x293452));return _0x5a2fc0[_0x46fcbf(0x199)]('\x0a');}function isSyncedAtMetadataLine(_0x112784,_0x1cec30){const _0x832cf6=a191_0x234989;if(_0x1cec30===_0x832cf6(0x19a))return/^\s*<!--\s*@lovrabet\.syncedAt:/['test'](_0x112784);return/^\s*--\s*@lovrabet\.syncedAt:/['test'](_0x112784);}
|