@lovrabet/rabetbase-cli 2.4.4 → 2.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/api-doc.js +1 -1
- package/lib/api/fetch-model-list.js +1 -1
- package/lib/api/generate-api-file.js +1 -1
- package/lib/auth/auth-server-ui.js +1 -1
- package/lib/auth/auth-server.js +1 -1
- package/lib/auth/constant.js +1 -1
- package/lib/auth/get-cookie.js +1 -1
- package/lib/auth/get-session-user.js +1 -1
- package/lib/auth/is-session-valid.js +1 -1
- package/lib/auth/login-success-html.js +1 -1
- package/lib/auth/logout.js +1 -1
- package/lib/cli-flags.js +1 -1
- package/lib/cli.js +1 -1
- package/lib/commands/api/generate.js +1 -1
- package/lib/commands/api/index.js +1 -1
- package/lib/commands/api/list.js +1 -1
- package/lib/commands/api/pull.js +1 -1
- package/lib/commands/api/shared.js +1 -1
- package/lib/commands/app/index.js +1 -1
- package/lib/commands/app/list.js +1 -1
- package/lib/commands/app/members-list.js +1 -1
- package/lib/commands/app/remote-directory.js +1 -1
- package/lib/commands/app/shared.js +1 -1
- package/lib/commands/app-config/delete.js +1 -1
- package/lib/commands/app-config/get.js +1 -1
- package/lib/commands/app-config/index.js +1 -1
- package/lib/commands/app-config/list.js +1 -1
- package/lib/commands/app-config/set.js +1 -1
- package/lib/commands/app-config/shared.js +1 -1
- package/lib/commands/auth/index.js +1 -1
- package/lib/commands/bff/create.js +1 -1
- package/lib/commands/bff/delete.js +1 -1
- package/lib/commands/bff/detail.js +1 -1
- package/lib/commands/bff/index.js +1 -1
- package/lib/commands/bff/list.js +1 -1
- package/lib/commands/bff/pull.js +1 -1
- package/lib/commands/bff/push.js +1 -1
- package/lib/commands/bff/status.js +1 -1
- package/lib/commands/cli-skill/index.js +1 -1
- package/lib/commands/cli-update.js +1 -1
- package/lib/commands/codegen/index.js +1 -1
- package/lib/commands/codegen/sdk.js +1 -1
- package/lib/commands/codegen/sql.js +1 -1
- package/lib/commands/common/app-registry.js +1 -1
- package/lib/commands/common/app-selector.js +1 -1
- package/lib/commands/common/async-task.js +1 -1
- package/lib/commands/common/dry-run.js +1 -1
- package/lib/commands/common/flags.d.ts +1 -0
- package/lib/commands/common/flags.js +1 -1
- package/lib/commands/common/local-file.js +1 -1
- package/lib/commands/common/validate.js +1 -1
- package/lib/commands/config/get.js +1 -1
- package/lib/commands/config/index.js +1 -1
- package/lib/commands/config/list.js +1 -1
- package/lib/commands/config/set.js +1 -1
- package/lib/commands/config/shared.js +1 -1
- package/lib/commands/data/filter.js +1 -1
- package/lib/commands/data/getOne.js +1 -1
- package/lib/commands/data/index.js +1 -1
- package/lib/commands/data/shared.js +1 -1
- package/lib/commands/dataset/business-group-update.js +1 -1
- package/lib/commands/{permit/index.d.ts → dataset/business-groups.d.ts} +1 -1
- package/lib/commands/dataset/business-groups.js +1 -0
- 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.d.ts +15 -1
- package/lib/commands/db/shared.js +1 -1
- package/lib/commands/db/tables.js +1 -1
- package/lib/commands/db/test.js +1 -1
- package/lib/commands/db/update.js +1 -1
- package/lib/commands/doctor.js +1 -1
- package/lib/commands/file/index.js +1 -1
- package/lib/commands/init/index.js +1 -1
- package/lib/commands/issue/index.js +1 -1
- package/lib/commands/issue/nudge.js +1 -1
- package/lib/commands/issue/report.js +1 -1
- package/lib/commands/issue/shared.js +1 -1
- package/lib/commands/kb/create.js +1 -1
- package/lib/commands/kb/delete.js +1 -1
- package/lib/commands/kb/detail.js +1 -1
- package/lib/commands/kb/index.js +1 -1
- package/lib/commands/kb/list.js +1 -1
- package/lib/commands/kb/shared.js +1 -1
- package/lib/commands/kb/update.js +1 -1
- package/lib/commands/logs/index.js +1 -1
- package/lib/commands/menu/asset-update.js +1 -1
- package/lib/commands/menu/delete.js +1 -1
- package/lib/commands/menu/external-link-create.js +1 -1
- package/lib/commands/menu/external-link-update.js +1 -1
- package/lib/commands/menu/group-create.js +1 -1
- package/lib/commands/menu/group-update.js +1 -1
- package/lib/commands/menu/index.js +1 -1
- package/lib/commands/menu/list.js +1 -1
- package/lib/commands/menu/move.js +1 -1
- package/lib/commands/menu/regroup-start.js +1 -1
- package/lib/commands/menu/rename.js +1 -1
- package/lib/commands/menu/shared/compare-table.js +1 -1
- package/lib/commands/menu/shared/delete-plan.js +1 -1
- package/lib/commands/menu/shared/facts.js +1 -1
- package/lib/commands/menu/shared/index.js +1 -1
- package/lib/commands/menu/shared/inquirer.js +1 -1
- package/lib/commands/menu/shared/local-pages.js +1 -1
- package/lib/commands/menu/shared/logic.js +1 -1
- package/lib/commands/menu/shared/mutations.js +1 -1
- package/lib/commands/menu/shared/service.js +1 -1
- package/lib/commands/menu/shared/sync-core.js +1 -1
- package/lib/commands/menu/shared/update-core.js +1 -1
- package/lib/commands/menu/shared/valid-url.js +1 -1
- package/lib/commands/menu/sync.js +1 -1
- package/lib/commands/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/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/react/create.js +1 -1
- package/lib/commands/page/react/detail.js +1 -1
- package/lib/commands/page/react/list.js +1 -1
- package/lib/commands/page/react/publish.js +1 -1
- package/lib/commands/page/react/shared.js +1 -1
- package/lib/commands/page/react/syntax.js +1 -1
- package/lib/commands/page/react/template.js +1 -1
- package/lib/commands/page/react/update.js +1 -1
- package/lib/commands/page/relation-audit.js +1 -1
- package/lib/commands/page/restore.js +1 -1
- package/lib/commands/page/shared.js +1 -1
- package/lib/commands/page/standard-page-status.js +1 -1
- package/lib/commands/page/sync.js +1 -1
- package/lib/commands/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.d.ts +15 -17
- package/lib/commands/role/shared.js +1 -1
- package/lib/commands/role/update.js +1 -1
- package/lib/commands/role/user-add.js +1 -1
- package/lib/commands/role/user-remove.js +1 -1
- package/lib/commands/role/user-resolve.js +1 -1
- package/lib/commands/run/index.js +1 -1
- package/lib/commands/schema.js +1 -1
- package/lib/commands/sql/create.js +1 -1
- package/lib/commands/sql/delete.js +1 -1
- package/lib/commands/sql/detail.js +1 -1
- package/lib/commands/sql/exec.js +1 -1
- package/lib/commands/sql/index.js +1 -1
- package/lib/commands/sql/list.js +1 -1
- package/lib/commands/sql/pull.js +1 -1
- package/lib/commands/sql/push.js +1 -1
- package/lib/commands/sql/shared.js +1 -1
- package/lib/commands/sql/status.js +1 -1
- package/lib/commands/sql/validate.js +1 -1
- package/lib/commands/task/index.js +1 -1
- package/lib/commands/task/status.js +1 -1
- package/lib/commands/tenant/index.js +1 -1
- package/lib/commands/tenant/members-list.js +1 -1
- package/lib/commands/tenant/shared.js +1 -1
- package/lib/commands/user-account/dingding-sandbox-bind.js +1 -1
- package/lib/commands/user-account/index.js +1 -1
- package/lib/commands/workspace/add.js +1 -1
- package/lib/commands/workspace/index.js +1 -1
- package/lib/commands/workspace/remove.js +1 -1
- package/lib/config/schema.js +1 -1
- package/lib/constant/cdn.js +1 -1
- package/lib/constant/cli.js +1 -1
- package/lib/constant/defaults.js +1 -1
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/constant/output.js +1 -1
- package/lib/constant/paths.js +1 -1
- package/lib/constant/risk.js +1 -1
- package/lib/context/app-resolver.js +1 -1
- package/lib/context/auth-resolver.js +1 -1
- package/lib/context/config-loader.js +1 -1
- package/lib/context.js +1 -1
- package/lib/core/alias-resolver.js +1 -1
- package/lib/core/api-client.d.ts +70 -79
- package/lib/core/api-client.js +1 -1
- package/lib/core/bff/config.js +1 -1
- package/lib/core/bff/file-system.d.ts +1 -0
- package/lib/core/bff/file-system.js +1 -1
- package/lib/core/bff/hash.js +1 -1
- package/lib/core/bff/lock.js +1 -1
- package/lib/core/bff/utils.js +1 -1
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/page/file-system.js +1 -1
- package/lib/core/page/hash.js +1 -1
- package/lib/core/page/lock.js +1 -1
- package/lib/core/sql-index-auditor.js +1 -1
- package/lib/core/sql-sync/config.js +1 -1
- package/lib/core/sql-sync/file-system.js +1 -1
- package/lib/core/sql-sync/hash.js +1 -1
- package/lib/core/sql-sync/lock.js +1 -1
- package/lib/core/sql-sync/utils.js +1 -1
- package/lib/core/sql-validator.js +1 -1
- package/lib/errors.js +1 -1
- package/lib/framework/build-all-flags.js +1 -1
- package/lib/framework/error-output.js +1 -1
- package/lib/framework/explicit-yes.js +1 -1
- package/lib/framework/flags.js +1 -1
- package/lib/framework/help.js +1 -1
- package/lib/framework/index.js +1 -1
- package/lib/framework/output.js +1 -1
- package/lib/framework/response.js +1 -1
- package/lib/framework/runner-alias.js +1 -1
- package/lib/framework/runner.js +1 -1
- package/lib/framework/schema-export.js +1 -1
- package/lib/framework/types.js +1 -1
- package/lib/generated/build-info.d.ts +4 -4
- package/lib/generated/build-info.js +1 -1
- package/lib/help.js +1 -1
- package/lib/postinstall.js +1 -1
- package/lib/runtime/confirmation.js +1 -1
- package/lib/runtime/event.js +1 -1
- package/lib/runtime/index.js +1 -1
- package/lib/runtime/queue.js +1 -1
- package/lib/runtime/resolve.js +1 -1
- package/lib/skills/builtin-skill.js +1 -1
- package/lib/skills/main.js +1 -1
- package/lib/skills/npx-skills-add.js +1 -1
- package/lib/skills/skill-presence.js +1 -1
- package/lib/telemetry/cli-command-trace.js +1 -1
- package/lib/telemetry/cli-help-trace.js +1 -1
- package/lib/telemetry/ensure-cli-otel-config.js +1 -1
- package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
- package/lib/telemetry/send-cli-trace-log.js +1 -1
- package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
- package/lib/utils/ai_config.js +1 -1
- package/lib/utils/apply-jq-filter.js +1 -1
- package/lib/utils/cdn-config.js +1 -1
- package/lib/utils/check-sdk-version.js +1 -1
- package/lib/utils/cli-version-check.js +1 -1
- package/lib/utils/cli-version-policy.js +1 -1
- package/lib/utils/config.js +1 -1
- package/lib/utils/entity-with-id.js +1 -1
- package/lib/utils/file-utils.js +1 -1
- package/lib/utils/guides-cdn.js +1 -1
- package/lib/utils/http-client.js +1 -1
- package/lib/utils/is-non-interactive.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/params.js +1 -1
- package/lib/utils/platform.js +1 -1
- package/lib/utils/rules-cdn.js +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.js +1 -1
- package/lib/utils/update-notice.js +1 -1
- package/lib/utils/version.js +1 -1
- package/lib/utils/with-active-cookie.js +1 -1
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +1 -1
- package/skills/rabetbase/SKILL.md +18 -24
- package/skills/rabetbase/guides/database-connection-workflow.md +6 -2
- package/skills/rabetbase/references/rabetbase-dataset-business-groups.md +28 -0
- package/skills/rabetbase/references/rabetbase-dataset-delete.md +7 -5
- package/skills/rabetbase/references/rabetbase-dataset-list.md +6 -6
- package/skills/rabetbase/references/rabetbase-dataset-restore.md +5 -5
- package/skills/rabetbase/references/rabetbase-db-create.md +3 -0
- package/skills/rabetbase/references/rabetbase-db-delete.md +10 -2
- package/skills/rabetbase/references/rabetbase-db-detail.md +2 -0
- package/skills/rabetbase/references/rabetbase-db-list.md +3 -2
- package/skills/rabetbase/references/rabetbase-db-update.md +4 -2
- package/skills/rabetbase/references/rabetbase-role-list.md +9 -17
- package/skills/rabetbase/references/rabetbase-role-user-add.md +44 -16
- package/skills/rabetbase/references/rabetbase-role-user-resolve.md +2 -2
- package/skills/rabetbase.manifest.json +4 -7
- package/lib/commands/permit/index.js +0 -1
- package/lib/commands/permit/page-get.d.ts +0 -2
- package/lib/commands/permit/page-get.js +0 -1
- package/lib/commands/permit/page-set.d.ts +0 -2
- package/lib/commands/permit/page-set.js +0 -1
- package/lib/commands/permit/role-apis-set.d.ts +0 -2
- package/lib/commands/permit/role-apis-set.js +0 -1
- package/lib/commands/permit/role-menus-set.d.ts +0 -2
- package/lib/commands/permit/role-menus-set.js +0 -1
- package/lib/commands/permit/role-menus.d.ts +0 -2
- package/lib/commands/permit/role-menus.js +0 -1
- package/lib/commands/permit/shared.d.ts +0 -74
- package/lib/commands/permit/shared.js +0 -1
- package/lib/commands/role/create.d.ts +0 -2
- package/lib/commands/role/create.js +0 -1
- package/skills/rabetbase/guides/role-permit-workflow.md +0 -127
- package/skills/rabetbase/references/rabetbase-permit-page-set.md +0 -69
- package/skills/rabetbase/references/rabetbase-permit-role-apis-set.md +0 -53
- package/skills/rabetbase/references/rabetbase-permit-role-menus-set.md +0 -57
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
* role service 共享逻辑(SSOT)
|
|
3
3
|
*
|
|
4
4
|
* 集中:内置角色守卫、角色引用解析(id 单查 / name 全分页)、
|
|
5
|
-
* 查人(tenant
|
|
5
|
+
* 查人(tenant 成员目录)、研发态关系分页读取、原子成员变更、投影与写命令输出信封。
|
|
6
6
|
* 命令文件只引用这里,不重复合并/守卫规则(见 AGENTS.md 声明式方法论 SSOT)。
|
|
7
7
|
*/
|
|
8
|
-
import { type AppRole, type
|
|
8
|
+
import { type AppRole, type DevUserRoleRelation } from "../../core/api-client.js";
|
|
9
9
|
import type { FlagDef, RuntimeContext } from "../../framework/types.js";
|
|
10
10
|
export declare const ROLE_ID_FLAG: FlagDef;
|
|
11
11
|
export declare const ROLE_REF_FLAG: FlagDef;
|
|
@@ -19,8 +19,6 @@ export declare const BUILTIN_ROLE_TYPES: AppRole["roleType"][];
|
|
|
19
19
|
export declare function isBuiltinRole(roleType: string): boolean;
|
|
20
20
|
/** update / delete:仅允许 CUSTOM 角色 */
|
|
21
21
|
export declare function assertCustomRole(role: AppRole, action: string): void;
|
|
22
|
-
/** role-menus-set / role-apis-set:拒绝改 DEV / ADMIN 的权限矩阵 */
|
|
23
|
-
export declare function assertPermConfigurable(role: AppRole): void;
|
|
24
22
|
export interface RoleProjection {
|
|
25
23
|
id: number;
|
|
26
24
|
roleName: string;
|
|
@@ -53,6 +51,7 @@ export interface UserResolution {
|
|
|
53
51
|
*/
|
|
54
52
|
export declare function resolveUserRef(ref: string): Promise<UserResolution>;
|
|
55
53
|
export interface RoleUserMutationData {
|
|
54
|
+
scope: "dev";
|
|
56
55
|
operation: "user-add" | "user-remove";
|
|
57
56
|
selector: {
|
|
58
57
|
appCode: string;
|
|
@@ -73,17 +72,13 @@ export interface RoleUserMutationData {
|
|
|
73
72
|
};
|
|
74
73
|
warnings: string[];
|
|
75
74
|
}
|
|
76
|
-
export declare const
|
|
77
|
-
|
|
78
|
-
* 计算 user-add / user-remove 的全量回写结果与 before/after。
|
|
79
|
-
* 只改目标 role 的 userList,其余 role 原样带回。
|
|
80
|
-
* 返回 { roleList, mutation, changed };changed=false 表示无需写(幂等)。
|
|
81
|
-
*/
|
|
75
|
+
export declare const CREATE_USER_ROLE_PATH = "/smartapi/permit/user-role/create";
|
|
76
|
+
export declare const DELETE_USER_ROLE_PATH = "/smartapi/permit/user-role/delete";
|
|
82
77
|
export declare function computeRoleUserMutation(params: {
|
|
83
78
|
operation: "user-add" | "user-remove";
|
|
84
79
|
appCode: string;
|
|
85
|
-
|
|
86
|
-
|
|
80
|
+
role: AppRole;
|
|
81
|
+
relations: DevUserRoleRelation[];
|
|
87
82
|
user: {
|
|
88
83
|
userId: number;
|
|
89
84
|
username: string;
|
|
@@ -92,16 +87,19 @@ export declare function computeRoleUserMutation(params: {
|
|
|
92
87
|
dryRun: boolean;
|
|
93
88
|
expectUserCount?: number;
|
|
94
89
|
}): {
|
|
95
|
-
roleList: RoleUsers[];
|
|
96
90
|
mutation: RoleUserMutationData;
|
|
97
91
|
changed: boolean;
|
|
92
|
+
matchingRelationIds: number[];
|
|
98
93
|
};
|
|
99
|
-
/**
|
|
100
|
-
export declare function
|
|
94
|
+
/** 分页读取目标研发态角色的关系记录,避免整表覆盖。 */
|
|
95
|
+
export declare function loadDevRoleRelations(appCode: string, roleId: number): Promise<DevUserRoleRelation[]>;
|
|
101
96
|
/** 供命令 ctx 读取角色引用 flag 的小工具 */
|
|
102
97
|
export declare function readRoleRef(ctx: RuntimeContext): string;
|
|
103
98
|
/**
|
|
104
99
|
* user-add / user-remove 的完整前置编排(供两个命令的 dryRun / execute 共用):
|
|
105
|
-
* 解析角色引用 → 解析用户 →
|
|
100
|
+
* 解析角色引用 → 解析用户 → 读取目标角色关系 → 计算原子写入与 before/after。
|
|
106
101
|
*/
|
|
107
|
-
export declare function prepareUserMutation(ctx: RuntimeContext, operation: "user-add" | "user-remove", dryRun: boolean): Promise<ReturnType<typeof computeRoleUserMutation
|
|
102
|
+
export declare function prepareUserMutation(ctx: RuntimeContext, operation: "user-add" | "user-remove", dryRun: boolean): Promise<ReturnType<typeof computeRoleUserMutation> & {
|
|
103
|
+
role: AppRole;
|
|
104
|
+
user: UserResolution;
|
|
105
|
+
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a184_0x2b58e8=a184_0xbdd4;(function(_0x8252c5,_0x2260e6){const _0x52f8a5=a184_0xbdd4,_0x53d173=_0x8252c5();while(!![]){try{const _0x4a1318=-parseInt(_0x52f8a5(0x1f0))/0x1+-parseInt(_0x52f8a5(0x1d8))/0x2+-parseInt(_0x52f8a5(0x1fe))/0x3*(parseInt(_0x52f8a5(0x1c1))/0x4)+parseInt(_0x52f8a5(0x1cb))/0x5*(parseInt(_0x52f8a5(0x1c7))/0x6)+-parseInt(_0x52f8a5(0x1ed))/0x7+parseInt(_0x52f8a5(0x1d6))/0x8*(parseInt(_0x52f8a5(0x1d1))/0x9)+parseInt(_0x52f8a5(0x1cc))/0xa*(parseInt(_0x52f8a5(0x1e5))/0xb);if(_0x4a1318===_0x2260e6)break;else _0x53d173['push'](_0x53d173['shift']());}catch(_0x44d1ff){_0x53d173['push'](_0x53d173['shift']());}}}(a184_0x4b94,0xb2641));import{getAppRole,getTenantMembers,listAppRoles,listRoleUsers}from'../../core/api-client.js';import{getSessionUserInfo}from'../../auth/get-session-user.js';import{CliErrors}from'../../errors.js';function a184_0xbdd4(_0x4fa63e,_0x5ad8a0){_0x4fa63e=_0x4fa63e-0x1bb;const _0x4b94d7=a184_0x4b94();let _0xbdd417=_0x4b94d7[_0x4fa63e];return _0xbdd417;}export const ROLE_ID_FLAG={'name':'id','type':a184_0x2b58e8(0x1be),'required':!![],'description':'Role\x20id\x20(from\x20`role\x20list`)'};export const ROLE_REF_FLAG={'name':a184_0x2b58e8(0x1bd),'type':'string','required':!![],'description':'Role\x20id\x20or\x20role\x20name\x20(CUSTOM\x20roles\x20may\x20be\x20referenced\x20by\x20name)'};export const USER_REF_FLAG={'name':a184_0x2b58e8(0x1c6),'type':a184_0x2b58e8(0x1d9),'required':!![],'description':a184_0x2b58e8(0x1bb)};export const NAME_FLAG={'name':a184_0x2b58e8(0x1f7),'type':a184_0x2b58e8(0x1d9),'required':!![],'description':a184_0x2b58e8(0x1de)};export const USER_NAME_FLAG={'name':a184_0x2b58e8(0x1f7),'type':'string','required':!![],'description':a184_0x2b58e8(0x1cf)};export const REMARK_FLAG={'name':a184_0x2b58e8(0x1fa),'type':a184_0x2b58e8(0x1d9),'required':![],'description':'Optional\x20role\x20remark/description'};export const EXPECT_USER_COUNT_FLAG={'name':a184_0x2b58e8(0x1f2),'type':a184_0x2b58e8(0x1be),'required':![],'description':a184_0x2b58e8(0x1f4)};function a184_0x4b94(){const _0x341e9c=['Role\x20id\x20','82608WAcbDw','roleName',';\x20no\x20change.','ADMIN','\x20member(s)\x20but\x20role\x20has\x20','user','5556ijcbjy','toLowerCase','Missing\x20user\x20reference.','roleType','4520dzXxaW','20kYbqEr','User\x20','userId','Nickname\x20or\x20username\x20to\x20resolve\x20to\x20a\x20userId','flag','135nwtVsH','str','splice','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles,\x20or\x20pass\x20--role\x20<id>.','Only\x20CUSTOM\x20roles\x20can\x20be\x20modified\x20or\x20deleted.','582008pQWISk','filter','1992090kMPsiE','string','\x20built-in\x20role\x20','DEV','Pass\x20--role\x20<id|name>.','expectUserCount','Role\x20name','DEV\x20/\x20ADMIN\x20keep\x20full\x20access\x20by\x20design;\x20configure\x20a\x20CUSTOM\x20role\x20instead.','Multiple\x20tenant\x20members\x20match\x20\x22','trim','Role\x20name\x20\x22','CUSTOM','tenant_code','13684429kTfsRl','userCount','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.','Check\x20the\x20nickname/username,\x20or\x20pass\x20--user\x20<id>.','userList','\x22:\x20','\x20is\x20not\x20a\x20member\x20of\x20role\x20','includes','10133802RinTcB','Cannot\x20','nickname','230079jnjhTU','Anti-drift\x20check\x20failed:\x20expected\x20','expect-user-count','appCode','Anti-drift\x20guard:\x20fail\x20if\x20the\x20role\x27s\x20current\x20member\x20count\x20differs','POST','username','name','test','\x20is\x20already\x20a\x20member\x20of\x20role\x20','remark','flagMissing','Cannot\x20change\x20the\x20permission\x20matrix\x20of\x20built-in\x20role\x20','Disambiguate\x20with\x20--role\x20<id>.','147qLebuh','dryRun','/smartapi/permit/user-role/update-user-list','validation','authRequired','\x20not\x20found\x20in\x20the\x20user-role\x20list.','user-add','totalCount','map','length','tenant','findIndex','join','User\x20id,\x20username,\x20or\x20nickname\x20to\x20resolve\x20to\x20a\x20userId','Re-run\x20`role\x20detail`\x20/\x20`role\x20list`\x20and\x20retry\x20with\x20the\x20current\x20count.','role','number','push'];a184_0x4b94=function(){return _0x341e9c;};return a184_0x4b94();}export const BUILTIN_ROLE_TYPES=[a184_0x2b58e8(0x1c4),a184_0x2b58e8(0x1db),'USER'];export function isBuiltinRole(_0x50d879){const _0x3a90d6=a184_0x2b58e8;return BUILTIN_ROLE_TYPES[_0x3a90d6(0x1ec)](_0x50d879);}export function assertCustomRole(_0x396c97,_0x179734){const _0x580a2d=a184_0x2b58e8;if(_0x396c97[_0x580a2d(0x1ca)]!==_0x580a2d(0x1e3))throw CliErrors[_0x580a2d(0x201)](_0x580a2d(0x1ee)+_0x179734+_0x580a2d(0x1da)+_0x396c97['roleName']+'\x20('+_0x396c97['roleType']+').',_0x580a2d(0x1d5));}export function assertPermConfigurable(_0x5cc18e){const _0x4ec77e=a184_0x2b58e8;if(_0x5cc18e[_0x4ec77e(0x1ca)]===_0x4ec77e(0x1db)||_0x5cc18e[_0x4ec77e(0x1ca)]===_0x4ec77e(0x1c4))throw CliErrors[_0x4ec77e(0x201)](_0x4ec77e(0x1fc)+_0x5cc18e[_0x4ec77e(0x1c2)]+'\x20('+_0x5cc18e[_0x4ec77e(0x1ca)]+').',_0x4ec77e(0x1df));}export function projectRole(_0x2a7821){const _0x41c4bd=a184_0x2b58e8;return{'id':_0x2a7821['id'],'roleName':_0x2a7821[_0x41c4bd(0x1c2)],'roleType':_0x2a7821[_0x41c4bd(0x1ca)],'remark':_0x2a7821[_0x41c4bd(0x1fa)],'userCount':_0x2a7821[_0x41c4bd(0x1e6)],'permitCount':_0x2a7821['permitCount'],'builtin':isBuiltinRole(_0x2a7821[_0x41c4bd(0x1ca)])};}export async function resolveRoleRef(_0x4138a,_0x451cc7){const _0x50bd7a=a184_0x2b58e8,_0x232f9a=_0x451cc7['trim']();if(!_0x232f9a)throw CliErrors['validation']('Missing\x20role\x20reference.',_0x50bd7a(0x1dc));if(/^\d+$/[_0x50bd7a(0x1f8)](_0x232f9a))return getRoleById(_0x4138a,Number(_0x232f9a));const _0x4605a3=await listAllAppRoles(_0x4138a),_0x4f518c=_0x4605a3[_0x50bd7a(0x1d7)](_0x429e9c=>_0x429e9c['roleName']===_0x232f9a);if(_0x4f518c[_0x50bd7a(0x207)]===0x0)throw CliErrors[_0x50bd7a(0x201)](_0x50bd7a(0x1e2)+_0x232f9a+'\x22\x20not\x20found\x20in\x20app\x20'+_0x4138a+'.',_0x50bd7a(0x1d4));if(_0x4f518c[_0x50bd7a(0x207)]>0x1){const _0x23b6be=_0x4f518c[_0x50bd7a(0x206)](_0x22408f=>_0x22408f['id'])[_0x50bd7a(0x20a)](',\x20');throw CliErrors[_0x50bd7a(0x201)](_0x50bd7a(0x1e2)+_0x232f9a+'\x22\x20is\x20ambiguous\x20(ids:\x20'+_0x23b6be+').',_0x50bd7a(0x1fd));}return _0x4f518c[0x0];}export async function getRoleById(_0x54d434,_0x70fb3){const _0x48683f=a184_0x2b58e8,_0x5bb89f=await getAppRole(_0x70fb3);if(!_0x5bb89f)throw CliErrors[_0x48683f(0x201)]('Role\x20id\x20'+_0x70fb3+'\x20not\x20found\x20in\x20app\x20'+_0x54d434+'.','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.');return _0x5bb89f;}async function listAllAppRoles(_0x28adb7){const _0x97fc3d=a184_0x2b58e8,_0x38f410=0x64,_0x1b3f76=[];for(let _0x16d031=0x1;;_0x16d031+=0x1){const {items:_0xf48251,paging:_0x230646}=await listAppRoles(_0x28adb7,{'currentPage':_0x16d031,'pageSize':_0x38f410});_0x1b3f76['push'](..._0xf48251);if(_0xf48251[_0x97fc3d(0x207)]<_0x38f410||_0x230646&&_0x1b3f76[_0x97fc3d(0x207)]>=_0x230646[_0x97fc3d(0x205)])return _0x1b3f76;}}export async function resolveTenantCode(){const _0x18410f=a184_0x2b58e8,_0x33f6d0=await getSessionUserInfo(),_0x31d337=_0x33f6d0?.[_0x18410f(0x1c6)]?.[_0x18410f(0x208)]?.[_0x18410f(0x1e4)];if(!_0x31d337)throw CliErrors[_0x18410f(0x202)]('Cannot\x20resolve\x20current\x20tenant.\x20Run\x20`rabetbase\x20auth\x20login`\x20first.');return _0x31d337;}function matchMember(_0xb170da,_0x2815a6){const _0x366ed2=a184_0x2b58e8,_0x362665=_0x2815a6['trim']()[_0x366ed2(0x1c8)]();return(_0xb170da['nickname']??'')[_0x366ed2(0x1c8)]()===_0x362665||(_0xb170da[_0x366ed2(0x1f6)]??'')['toLowerCase']()===_0x362665;}export async function resolveUserRef(_0x40a643){const _0x117bed=a184_0x2b58e8,_0x3e53a3=_0x40a643[_0x117bed(0x1e1)]();if(!_0x3e53a3)throw CliErrors[_0x117bed(0x201)](_0x117bed(0x1c9),'Pass\x20--user\x20<id|name>.');const _0x1a6324=await resolveTenantCode(),_0x1ef98b=await getTenantMembers(_0x1a6324);if(/^\d+$/[_0x117bed(0x1f8)](_0x3e53a3)){const _0x28e948=Number(_0x3e53a3),_0x271c42=_0x1ef98b['find'](_0x143e3b=>_0x143e3b['userId']===_0x28e948);return{'userId':_0x28e948,'username':_0x271c42?.[_0x117bed(0x1f6)]??String(_0x28e948),'nickname':_0x271c42?.[_0x117bed(0x1ef)],'matchedBy':'id'};}const _0x58e008=_0x1ef98b['filter'](_0x1dee2e=>matchMember(_0x1dee2e,_0x3e53a3));if(_0x58e008[_0x117bed(0x207)]===0x0)throw CliErrors[_0x117bed(0x201)]('No\x20tenant\x20member\x20matches\x20\x22'+_0x3e53a3+'\x22.',_0x117bed(0x1e8));if(_0x58e008[_0x117bed(0x207)]>0x1){const _0xf7421c=_0x58e008[_0x117bed(0x206)](_0x430b64=>(_0x430b64[_0x117bed(0x1ef)]??_0x430b64[_0x117bed(0x1f6)]??'?')+'('+_0x430b64[_0x117bed(0x1ce)]+')')[_0x117bed(0x20a)](',\x20');throw CliErrors[_0x117bed(0x201)](_0x117bed(0x1e0)+_0x3e53a3+_0x117bed(0x1ea)+_0xf7421c+'.','Disambiguate\x20with\x20--user\x20<id>.');}const _0x5438d1=_0x58e008[0x0];return{'userId':_0x5438d1['userId'],'username':_0x5438d1[_0x117bed(0x1f6)]??String(_0x5438d1[_0x117bed(0x1ce)]),'nickname':_0x5438d1[_0x117bed(0x1ef)],'matchedBy':'name'};}export const UPDATE_USER_LIST_PATH=a184_0x2b58e8(0x200);function userIdsOf(_0x16dd22){const _0x10dae8=a184_0x2b58e8;return(_0x16dd22?.[_0x10dae8(0x1e9)]??[])[_0x10dae8(0x206)](_0x558289=>_0x558289[_0x10dae8(0x1ce)]);}export function computeRoleUserMutation(_0xd518ef){const _0x4fc736=a184_0x2b58e8,{operation:_0x2fc291,appCode:_0x11f6dc,roleUsers:_0x309f81,targetRoleId:_0x36ae6d,user:_0x536b42}=_0xd518ef,_0x45259a=_0x309f81['find'](_0x30c32f=>_0x30c32f['id']===_0x36ae6d);if(!_0x45259a)throw CliErrors[_0x4fc736(0x201)](_0x4fc736(0x1c0)+_0x36ae6d+_0x4fc736(0x203),_0x4fc736(0x1e7));const _0x44beef=userIdsOf(_0x45259a),_0x508b4a=[];if(_0xd518ef[_0x4fc736(0x1dd)]!==undefined&&_0xd518ef[_0x4fc736(0x1dd)]!==_0x44beef['length'])throw CliErrors[_0x4fc736(0x201)](_0x4fc736(0x1f1)+_0xd518ef['expectUserCount']+_0x4fc736(0x1c5)+_0x44beef[_0x4fc736(0x207)]+'.',_0x4fc736(0x1bc));const _0x4a49da=_0x44beef[_0x4fc736(0x1ec)](_0x536b42[_0x4fc736(0x1ce)]);let _0x781a=![];const _0x271a8a=[..._0x45259a[_0x4fc736(0x1e9)]];if(_0x2fc291===_0x4fc736(0x204))_0x4a49da?_0x508b4a[_0x4fc736(0x1bf)](_0x4fc736(0x1cd)+_0x536b42[_0x4fc736(0x1ce)]+_0x4fc736(0x1f9)+_0x45259a['roleName']+_0x4fc736(0x1c3)):(_0x271a8a['push']({'userId':_0x536b42[_0x4fc736(0x1ce)],'username':_0x536b42[_0x4fc736(0x1f6)],..._0x536b42[_0x4fc736(0x1ef)]?{'nickname':_0x536b42['nickname']}:{}}),_0x781a=!![]);else{if(!_0x4a49da)_0x508b4a['push']('User\x20'+_0x536b42['userId']+_0x4fc736(0x1eb)+_0x45259a[_0x4fc736(0x1c2)]+_0x4fc736(0x1c3));else{const _0x48bf5d=_0x271a8a[_0x4fc736(0x209)](_0x2928bb=>_0x2928bb[_0x4fc736(0x1ce)]===_0x536b42['userId']);if(_0x48bf5d>=0x0)_0x271a8a[_0x4fc736(0x1d3)](_0x48bf5d,0x1);_0x781a=!![];}}const _0x252040=_0x309f81['map'](_0x32ed3f=>_0x32ed3f['id']===_0x36ae6d?{..._0x32ed3f,'userList':_0x271a8a}:_0x32ed3f),_0x5a62f4=_0x271a8a[_0x4fc736(0x206)](_0x968a45=>_0x968a45['userId']),_0x583d84={'operation':_0x2fc291,'selector':{'appCode':_0x11f6dc,'roleId':_0x36ae6d,'roleName':_0x45259a[_0x4fc736(0x1c2)],'userId':_0x536b42[_0x4fc736(0x1ce)]},'before':{'userIds':_0x44beef},'after':{'userIds':_0x5a62f4},'dryRun':_0xd518ef[_0x4fc736(0x1ff)],'backend':{'method':_0x4fc736(0x1f5),'path':UPDATE_USER_LIST_PATH},'warnings':_0x508b4a};return{'roleList':_0x252040,'mutation':_0x583d84,'changed':_0x781a};}export async function loadRoleUsers(_0x39d6c2){return listRoleUsers(_0x39d6c2);}export function readRoleRef(_0x508d9c){const _0x39fde0=a184_0x2b58e8,_0x3732ea=_0x508d9c[_0x39fde0(0x1d2)](_0x39fde0(0x1bd))[_0x39fde0(0x1e1)]();if(!_0x3732ea)throw CliErrors[_0x39fde0(0x1fb)]('role','Pass\x20--role\x20<id|name>.');return _0x3732ea;}export async function prepareUserMutation(_0x8d0d4e,_0x497ad4,_0x43e754){const _0x42fbfd=a184_0x2b58e8,_0x2e28ad=readRoleRef(_0x8d0d4e),_0x4e368d=_0x8d0d4e[_0x42fbfd(0x1d2)](_0x42fbfd(0x1c6))[_0x42fbfd(0x1e1)]();if(!_0x4e368d)throw CliErrors[_0x42fbfd(0x1fb)](_0x42fbfd(0x1c6),'Pass\x20--user\x20<id|name>.');const _0x35097a=_0x8d0d4e[_0x42fbfd(0x1d0)]('expect-user-count'),_0x560248=_0x35097a===undefined||_0x35097a===null?undefined:Number(_0x35097a),_0x262555=await resolveRoleRef(_0x8d0d4e[_0x42fbfd(0x1f3)],_0x2e28ad),_0x51062b=await resolveUserRef(_0x4e368d),_0x930f4b=await loadRoleUsers(_0x8d0d4e[_0x42fbfd(0x1f3)]);return computeRoleUserMutation({'operation':_0x497ad4,'appCode':_0x8d0d4e[_0x42fbfd(0x1f3)],'roleUsers':_0x930f4b,'targetRoleId':_0x262555['id'],'user':{'userId':_0x51062b['userId'],'username':_0x51062b[_0x42fbfd(0x1f6)],'nickname':_0x51062b[_0x42fbfd(0x1ef)]},'dryRun':_0x43e754,..._0x560248!==undefined?{'expectUserCount':_0x560248}:{}});}
|
|
1
|
+
const a177_0xa877c=a177_0x3873;(function(_0x41618c,_0x216f64){const _0x1f3cf0=a177_0x3873,_0x301eaa=_0x41618c();while(!![]){try{const _0x4908c9=parseInt(_0x1f3cf0(0x7e))/0x1+-parseInt(_0x1f3cf0(0xb1))/0x2+-parseInt(_0x1f3cf0(0x91))/0x3*(parseInt(_0x1f3cf0(0x90))/0x4)+-parseInt(_0x1f3cf0(0x7b))/0x5*(-parseInt(_0x1f3cf0(0xa8))/0x6)+-parseInt(_0x1f3cf0(0x89))/0x7*(parseInt(_0x1f3cf0(0xae))/0x8)+-parseInt(_0x1f3cf0(0x7f))/0x9+parseInt(_0x1f3cf0(0xa9))/0xa;if(_0x4908c9===_0x216f64)break;else _0x301eaa['push'](_0x301eaa['shift']());}catch(_0x5a90d){_0x301eaa['push'](_0x301eaa['shift']());}}}(a177_0x448f,0xdbed0));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':a177_0xa877c(0x8d),'required':!![],'description':a177_0xa877c(0x79)};export const ROLE_REF_FLAG={'name':'role','type':a177_0xa877c(0x80),'required':!![],'description':'Role\x20id\x20or\x20exact\x20role\x20name'};export const USER_REF_FLAG={'name':a177_0xa877c(0xbf),'type':a177_0xa877c(0x80),'required':!![],'description':a177_0xa877c(0x84)};function a177_0x3873(_0xa594f1,_0x9b6fa8){_0xa594f1=_0xa594f1-0x76;const _0x448f0a=a177_0x448f();let _0x38738b=_0x448f0a[_0xa594f1];return _0x38738b;}export const NAME_FLAG={'name':a177_0xa877c(0x92),'type':a177_0xa877c(0x80),'required':!![],'description':a177_0xa877c(0xbd)};export const USER_NAME_FLAG={'name':a177_0xa877c(0x92),'type':a177_0xa877c(0x80),'required':!![],'description':a177_0xa877c(0xc1)};export const REMARK_FLAG={'name':'remark','type':a177_0xa877c(0x80),'required':![],'description':a177_0xa877c(0x81)};export const EXPECT_USER_COUNT_FLAG={'name':a177_0xa877c(0xba),'type':a177_0xa877c(0x8d),'required':![],'description':a177_0xa877c(0x97)};export const BUILTIN_ROLE_TYPES=[a177_0xa877c(0x7c),a177_0xa877c(0x9b),'OWNER'];export function isBuiltinRole(_0x228db3){const _0x1b3b32=a177_0xa877c;return BUILTIN_ROLE_TYPES[_0x1b3b32(0x98)](_0x228db3);}export function assertCustomRole(_0x55d820,_0x1f338e){const _0x2426b8=a177_0xa877c;if(_0x55d820[_0x2426b8(0x86)]!==_0x2426b8(0xbb))throw CliErrors[_0x2426b8(0x95)]('Cannot\x20'+_0x1f338e+'\x20built-in\x20role\x20'+_0x55d820[_0x2426b8(0xb7)]+'\x20('+_0x55d820[_0x2426b8(0x86)]+').','Only\x20CUSTOM\x20roles\x20can\x20be\x20modified\x20or\x20deleted.');}export function projectRole(_0x360b4f){const _0x36d26f=a177_0xa877c;return{'id':_0x360b4f['id'],'roleName':_0x360b4f['roleName'],'roleType':_0x360b4f[_0x36d26f(0x86)],'remark':_0x360b4f[_0x36d26f(0x7a)],'userCount':_0x360b4f[_0x36d26f(0x8f)],'permitCount':_0x360b4f['permitCount'],'builtin':isBuiltinRole(_0x360b4f[_0x36d26f(0x86)])};}function a177_0x448f(){const _0x47dff9=['name','dev','\x22:\x20','validation','tenant','Anti-drift\x20guard:\x20fail\x20if\x20the\x20role\x27s\x20current\x20member\x20count\x20differs','includes','Pass\x20--role\x20<id|name>.','Role\x20name\x20\x22','DEV','Re-run\x20`role\x20detail`\x20/\x20`role\x20list`\x20and\x20retry\x20with\x20the\x20current\x20count.','User\x20','Disambiguate\x20with\x20--user\x20<id>.','Check\x20the\x20nickname/username,\x20or\x20pass\x20--user\x20<id>.','\x20member(s)\x20but\x20role\x20has\x20','join','\x20is\x20already\x20a\x20member\x20of\x20role\x20','Removed\x20','expectUserCount','trim',';\x20no\x20change.','test','414SbwfCc','36764990QZvqJa','totalCount','/smartapi/permit/user-role/create','flagMissing','Role\x20id\x20','4785824ULSuJn','str','flag','1236894hHuUfl','username','No\x20tenant\x20member\x20matches\x20\x22','\x20members\x20of\x20the\x20OWNER\x20role.','filter','role','roleName','Use\x20the\x20platform\x20ownership-transfer\x20workflow\x20to\x20change\x20the\x20application\x20owner.','appCode','expect-user-count','CUSTOM','\x22\x20is\x20ambiguous\x20(ids:\x20','Role\x20name','\x20not\x20found\x20in\x20app\x20','user','push','Nickname\x20or\x20username\x20to\x20resolve\x20to\x20a\x20userId','toLowerCase','\x20duplicate\x20memberships\x20for\x20user\x20','map','Role\x20id\x20(from\x20`role\x20list`)','remark','37545IkXxft','ADMIN','nickname','337031VChSSw','5987583iPCLQV','string','Optional\x20role\x20remark/description','Anti-drift\x20check\x20failed:\x20expected\x20','tenant_code','User\x20id,\x20username,\x20or\x20nickname\x20to\x20resolve\x20to\x20a\x20userId','userId','roleType','Missing\x20user\x20reference.','length','21flvrVJ','Missing\x20role\x20reference.','Pass\x20--user\x20<id|name>.','authRequired','number','user-add','userCount','2209668qkqVaa','3lsHpxW'];a177_0x448f=function(){return _0x47dff9;};return a177_0x448f();}export async function resolveRoleRef(_0x434023,_0x99ca10){const _0xcd1899=a177_0xa877c,_0x3d75bf=_0x99ca10[_0xcd1899(0xa5)]();if(!_0x3d75bf)throw CliErrors[_0xcd1899(0x95)](_0xcd1899(0x8a),'Pass\x20--role\x20<id|name>.');if(/^\d+$/['test'](_0x3d75bf))return getRoleById(_0x434023,Number(_0x3d75bf));const _0x54a421=await listAllAppRoles(_0x434023),_0x39b6d6=_0x54a421[_0xcd1899(0xb5)](_0x35e6c9=>_0x35e6c9[_0xcd1899(0xb7)]===_0x3d75bf);if(_0x39b6d6[_0xcd1899(0x88)]===0x0)throw CliErrors[_0xcd1899(0x95)](_0xcd1899(0x9a)+_0x3d75bf+'\x22\x20not\x20found\x20in\x20app\x20'+_0x434023+'.','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles,\x20or\x20pass\x20--role\x20<id>.');if(_0x39b6d6[_0xcd1899(0x88)]>0x1){const _0x19adfa=_0x39b6d6[_0xcd1899(0x78)](_0x1df87d=>_0x1df87d['id'])[_0xcd1899(0xa1)](',\x20');throw CliErrors[_0xcd1899(0x95)](_0xcd1899(0x9a)+_0x3d75bf+_0xcd1899(0xbc)+_0x19adfa+').','Disambiguate\x20with\x20--role\x20<id>.');}return _0x39b6d6[0x0];}export async function getRoleById(_0x14a0c2,_0x50c7ca){const _0x35df89=a177_0xa877c,_0x5ce763=await listAllAppRoles(_0x14a0c2),_0x1c9117=_0x5ce763[_0x35df89(0xb5)](_0x1a8a00=>_0x1a8a00['id']===_0x50c7ca&&(!_0x1a8a00[_0x35df89(0xb9)]||_0x1a8a00[_0x35df89(0xb9)]===_0x14a0c2));if(_0x1c9117['length']!==0x1)throw CliErrors['validation'](_0x35df89(0xad)+_0x50c7ca+_0x35df89(0xbe)+_0x14a0c2+'.','Run\x20`role\x20list`\x20to\x20see\x20available\x20roles.');return _0x1c9117[0x0];}async function listAllAppRoles(_0x2a190d){const _0xd9644b=a177_0xa877c,_0x26079a=0x64,_0x37c7aa=[];for(let _0x13a634=0x1;;_0x13a634+=0x1){const {items:_0x317cfe,paging:_0x9bd44b}=await listAppRoles(_0x2a190d,{'currentPage':_0x13a634,'pageSize':_0x26079a});_0x37c7aa[_0xd9644b(0xc0)](..._0x317cfe);if(_0x317cfe[_0xd9644b(0x88)]<_0x26079a||_0x9bd44b&&_0x37c7aa[_0xd9644b(0x88)]>=_0x9bd44b[_0xd9644b(0xaa)])return _0x37c7aa;}}export async function resolveTenantCode(){const _0x5210d2=a177_0xa877c,_0x39f538=await getSessionUserInfo(),_0x2d7414=_0x39f538?.[_0x5210d2(0xbf)]?.[_0x5210d2(0x96)]?.[_0x5210d2(0x83)];if(!_0x2d7414)throw CliErrors[_0x5210d2(0x8c)]('Cannot\x20resolve\x20current\x20tenant.\x20Run\x20`rabetbase\x20auth\x20login`\x20first.');return _0x2d7414;}function matchMember(_0x4f7266,_0x5d9c6e){const _0x1e5706=a177_0xa877c,_0x470e84=_0x5d9c6e[_0x1e5706(0xa5)]()['toLowerCase']();return(_0x4f7266[_0x1e5706(0x7d)]??'')[_0x1e5706(0x76)]()===_0x470e84||(_0x4f7266[_0x1e5706(0xb2)]??'')[_0x1e5706(0x76)]()===_0x470e84;}export async function resolveUserRef(_0x39b7b9){const _0x140267=a177_0xa877c,_0x5e2bfa=_0x39b7b9[_0x140267(0xa5)]();if(!_0x5e2bfa)throw CliErrors['validation'](_0x140267(0x87),_0x140267(0x8b));const _0x1120f2=await resolveTenantCode(),_0x45e61c=await getTenantMembers(_0x1120f2);if(/^\d+$/[_0x140267(0xa7)](_0x5e2bfa)){const _0x2e9d35=Number(_0x5e2bfa),_0x5d1f6e=_0x45e61c['find'](_0x11772c=>_0x11772c[_0x140267(0x85)]===_0x2e9d35);return{'userId':_0x2e9d35,'username':_0x5d1f6e?.[_0x140267(0xb2)]??String(_0x2e9d35),'nickname':_0x5d1f6e?.[_0x140267(0x7d)],'matchedBy':'id'};}const _0x5aad98=_0x45e61c['filter'](_0x537241=>matchMember(_0x537241,_0x5e2bfa));if(_0x5aad98['length']===0x0)throw CliErrors[_0x140267(0x95)](_0x140267(0xb3)+_0x5e2bfa+'\x22.',_0x140267(0x9f));if(_0x5aad98['length']>0x1){const _0x3bfcdc=_0x5aad98[_0x140267(0x78)](_0x109420=>(_0x109420[_0x140267(0x7d)]??_0x109420[_0x140267(0xb2)]??'?')+'('+_0x109420['userId']+')')[_0x140267(0xa1)](',\x20');throw CliErrors[_0x140267(0x95)]('Multiple\x20tenant\x20members\x20match\x20\x22'+_0x5e2bfa+_0x140267(0x94)+_0x3bfcdc+'.',_0x140267(0x9e));}const _0xa13b4f=_0x5aad98[0x0];return{'userId':_0xa13b4f['userId'],'username':_0xa13b4f['username']??String(_0xa13b4f['userId']),'nickname':_0xa13b4f[_0x140267(0x7d)],'matchedBy':_0x140267(0x92)};}export const CREATE_USER_ROLE_PATH=a177_0xa877c(0xab);export const DELETE_USER_ROLE_PATH='/smartapi/permit/user-role/delete';export function computeRoleUserMutation(_0x4cfd84){const _0x457759=a177_0xa877c,{operation:_0x55b95b,appCode:_0xa72d95,role:_0x320083,relations:_0x5338d4,user:_0x3437f1}=_0x4cfd84,_0x22ddb2=[...new Set(_0x5338d4[_0x457759(0x78)](_0x274977=>_0x274977[_0x457759(0x85)]))],_0x185e59=[];if(_0x4cfd84['expectUserCount']!==undefined&&_0x4cfd84['expectUserCount']!==_0x22ddb2[_0x457759(0x88)])throw CliErrors[_0x457759(0x95)](_0x457759(0x82)+_0x4cfd84[_0x457759(0xa4)]+_0x457759(0xa0)+_0x22ddb2[_0x457759(0x88)]+'.',_0x457759(0x9c));const _0x40c60d=_0x22ddb2['includes'](_0x3437f1[_0x457759(0x85)]),_0x45f510=_0x5338d4[_0x457759(0xb5)](_0x2fbd4b=>_0x2fbd4b[_0x457759(0x85)]===_0x3437f1['userId'])['map'](_0x19a978=>_0x19a978['id']),_0xdbbc4d=_0x55b95b===_0x457759(0x8e)?!_0x40c60d:_0x40c60d;let _0x4648cb=_0x22ddb2;_0x55b95b==='user-add'?_0x40c60d?_0x185e59['push'](_0x457759(0x9d)+_0x3437f1['userId']+_0x457759(0xa2)+_0x320083[_0x457759(0xb7)]+_0x457759(0xa6)):_0x4648cb=[..._0x22ddb2,_0x3437f1['userId']]:!_0x40c60d?_0x185e59[_0x457759(0xc0)](_0x457759(0x9d)+_0x3437f1[_0x457759(0x85)]+'\x20is\x20not\x20a\x20member\x20of\x20role\x20'+_0x320083['roleName']+_0x457759(0xa6)):(_0x4648cb=_0x22ddb2[_0x457759(0xb5)](_0x1d1c53=>_0x1d1c53!==_0x3437f1[_0x457759(0x85)]),_0x45f510[_0x457759(0x88)]>0x1&&_0x185e59[_0x457759(0xc0)](_0x457759(0xa3)+_0x45f510[_0x457759(0x88)]+_0x457759(0x77)+_0x3437f1[_0x457759(0x85)]+'.'));const _0xc35c7c={'scope':_0x457759(0x93),'operation':_0x55b95b,'selector':{'appCode':_0xa72d95,'roleId':_0x320083['id'],'roleName':_0x320083['roleName'],'userId':_0x3437f1[_0x457759(0x85)]},'before':{'userIds':_0x22ddb2},'after':{'userIds':_0x4648cb},'dryRun':_0x4cfd84['dryRun'],'backend':{'method':'POST','path':_0x55b95b==='user-add'?CREATE_USER_ROLE_PATH:DELETE_USER_ROLE_PATH},'warnings':_0x185e59};return{'mutation':_0xc35c7c,'changed':_0xdbbc4d,'matchingRelationIds':_0x45f510};}export async function loadDevRoleRelations(_0x377bfd,_0x1a2ba2){const _0x1f9e2e=a177_0xa877c,_0x553428=0x64,_0x28e0a3=[];for(let _0x7e75fd=0x1;;_0x7e75fd+=0x1){const {items:_0x2dcf5d,paging:_0xd215b3}=await listDevUserRoleRelations(_0x377bfd,{'roleId':_0x1a2ba2,'currentPage':_0x7e75fd,'pageSize':_0x553428});_0x28e0a3[_0x1f9e2e(0xc0)](..._0x2dcf5d);if(_0x2dcf5d[_0x1f9e2e(0x88)]<_0x553428||_0xd215b3&&_0x28e0a3[_0x1f9e2e(0x88)]>=_0xd215b3[_0x1f9e2e(0xaa)])return _0x28e0a3;}}export function readRoleRef(_0x37c5e9){const _0x56b8d0=a177_0xa877c,_0x2a18c2=_0x37c5e9[_0x56b8d0(0xaf)](_0x56b8d0(0xb6))[_0x56b8d0(0xa5)]();if(!_0x2a18c2)throw CliErrors[_0x56b8d0(0xac)](_0x56b8d0(0xb6),_0x56b8d0(0x99));return _0x2a18c2;}export async function prepareUserMutation(_0x413950,_0x12bf6f,_0x1fd54c){const _0x13b85a=a177_0xa877c,_0x1014ca=readRoleRef(_0x413950),_0xff3a25=_0x413950[_0x13b85a(0xaf)](_0x13b85a(0xbf))['trim']();if(!_0xff3a25)throw CliErrors[_0x13b85a(0xac)](_0x13b85a(0xbf),_0x13b85a(0x8b));const _0x41f452=_0x413950[_0x13b85a(0xb0)](_0x13b85a(0xba)),_0x4dc20b=_0x41f452===undefined||_0x41f452===null?undefined:Number(_0x41f452),_0x9b0dc9=await resolveRoleRef(_0x413950['appCode'],_0x1014ca);if(_0x9b0dc9['roleType']==='OWNER')throw CliErrors['validation']('Cannot\x20'+_0x12bf6f+_0x13b85a(0xb4),_0x13b85a(0xb8));const _0x57222e=await resolveUserRef(_0xff3a25),_0x1dc1aa=await loadDevRoleRelations(_0x413950[_0x13b85a(0xb9)],_0x9b0dc9['id']);return{...computeRoleUserMutation({'operation':_0x12bf6f,'appCode':_0x413950[_0x13b85a(0xb9)],'role':_0x9b0dc9,'relations':_0x1dc1aa,'user':{'userId':_0x57222e[_0x13b85a(0x85)],'username':_0x57222e[_0x13b85a(0xb2)],'nickname':_0x57222e['nickname']},'dryRun':_0x1fd54c,..._0x4dc20b!==undefined?{'expectUserCount':_0x4dc20b}:{}}),'role':_0x9b0dc9,'user':_0x57222e};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a178_0x1358ec=a178_0x1bf9;(function(_0x3775f9,_0x1a70da){const _0x4dfe71=a178_0x1bf9,_0x824647=_0x3775f9();while(!![]){try{const _0x1bd1e6=-parseInt(_0x4dfe71(0x1f3))/0x1+parseInt(_0x4dfe71(0x20a))/0x2*(parseInt(_0x4dfe71(0x204))/0x3)+parseInt(_0x4dfe71(0x1f4))/0x4*(parseInt(_0x4dfe71(0x201))/0x5)+-parseInt(_0x4dfe71(0x1eb))/0x6*(parseInt(_0x4dfe71(0x206))/0x7)+-parseInt(_0x4dfe71(0x1f6))/0x8*(parseInt(_0x4dfe71(0x1ec))/0x9)+-parseInt(_0x4dfe71(0x209))/0xa+parseInt(_0x4dfe71(0x208))/0xb;if(_0x1bd1e6===_0x1a70da)break;else _0x824647['push'](_0x824647['shift']());}catch(_0x6896fe){_0x824647['push'](_0x824647['shift']());}}}(a178_0x436d,0xe895d));import{updateAppRole}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{assertCustomRole,getRoleById,projectRole,REMARK_FLAG,ROLE_ID_FLAG}from'../../commands/role/shared.js';const UPDATE_PATH=a178_0x1358ec(0x207);function readPatch(_0x2e4a2a){const _0x38b1e9=a178_0x1358ec,_0x2b2674=_0x2e4a2a[_0x38b1e9(0x1ed)](_0x38b1e9(0x1f5)),_0x338c7b=_0x2e4a2a['flag'](_0x38b1e9(0x1e9)),_0x1e809f={};if(_0x2b2674!==undefined&&_0x2b2674!==null){const _0x5a3d9e=String(_0x2b2674)[_0x38b1e9(0x1f7)]();if(!_0x5a3d9e)throw CliErrors[_0x38b1e9(0x1f9)](_0x38b1e9(0x1fa));if(_0x5a3d9e[_0x38b1e9(0x1ff)]>0x40)throw CliErrors[_0x38b1e9(0x1f9)](_0x38b1e9(0x1f1));_0x1e809f[_0x38b1e9(0x1f2)]=_0x5a3d9e;}_0x338c7b!==undefined&&_0x338c7b!==null&&(_0x1e809f[_0x38b1e9(0x1e9)]=String(_0x338c7b));if(_0x1e809f[_0x38b1e9(0x1f2)]===undefined&&_0x1e809f[_0x38b1e9(0x1e9)]===undefined)throw CliErrors[_0x38b1e9(0x1f9)](_0x38b1e9(0x1fb),'Pass\x20at\x20least\x20one\x20of\x20--name\x20/\x20--remark.');return _0x1e809f;}function a178_0x436d(){const _0x2af1e4=['role','update','159cesoil','\x20(id=','28eRKrAH','/smartapi/permit/role/update','10043704tJbSAZ','5754310TtbMHc','38108YHzmqJ','remark','New\x20role\x20name','1544658huwQSH','2269305vShdrX','flag','string','dev','Updated\x20role\x20','Role\x20name\x20cannot\x20exceed\x2064\x20characters.','roleName','177421WDmifA','4XEuMHR','name','16KbCwyD','trim','POST','validation','--name\x20cannot\x20be\x20empty.','Nothing\x20to\x20update.','Update\x20a\x20CUSTOM\x20role\x27s\x20name/remark\x20(built-in\x20roles\x20rejected)','write','num','length','appCode','6583285pDwTEi'];a178_0x436d=function(){return _0x2af1e4;};return a178_0x436d();}function a178_0x1bf9(_0x236cb3,_0xf5878d){_0x236cb3=_0x236cb3-0x1e9;const _0x436d3b=a178_0x436d();let _0x1bf96a=_0x436d3b[_0x236cb3];return _0x1bf96a;}export const roleUpdate={'service':a178_0x1358ec(0x202),'command':a178_0x1358ec(0x203),'description':a178_0x1358ec(0x1fc),'risk':a178_0x1358ec(0x1fd),'flags':[ROLE_ID_FLAG,{...REMARK_FLAG},{'name':a178_0x1358ec(0x1f5),'type':a178_0x1358ec(0x1ee),'required':![],'description':a178_0x1358ec(0x1ea)},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x19263f){readPatch(_0x19263f);},async 'dryRun'(_0x366894){const _0x344fe1=a178_0x1358ec,_0x40f1ff=_0x366894[_0x344fe1(0x1fe)]('id'),_0xfa8855=readPatch(_0x366894),_0x236d5a=await getRoleById(_0x366894[_0x344fe1(0x200)],_0x40f1ff);return assertCustomRole(_0x236d5a,_0x344fe1(0x203)),asDryRunResult({'scope':_0x344fe1(0x1ef),'operation':_0x344fe1(0x203),'selector':{'appCode':_0x366894[_0x344fe1(0x200)],'roleId':_0x40f1ff,'roleName':_0x236d5a[_0x344fe1(0x1f2)]},'before':projectRole(_0x236d5a),'after':projectRole({..._0x236d5a,..._0xfa8855['roleName']!==undefined?{'roleName':_0xfa8855[_0x344fe1(0x1f2)]}:{},..._0xfa8855[_0x344fe1(0x1e9)]!==undefined?{'remark':_0xfa8855[_0x344fe1(0x1e9)]}:{}}),'dryRun':!![],'backend':{'method':_0x344fe1(0x1f8),'path':UPDATE_PATH},'warnings':[]},{'method':'POST','url':UPDATE_PATH});},async 'execute'(_0x1f0e46){const _0x4f65bb=a178_0x1358ec,_0x3a8ea4=_0x1f0e46[_0x4f65bb(0x1fe)]('id'),_0x24d89e=readPatch(_0x1f0e46),_0x13fecc=await getRoleById(_0x1f0e46[_0x4f65bb(0x200)],_0x3a8ea4);assertCustomRole(_0x13fecc,_0x4f65bb(0x203)),await updateAppRole({'id':_0x3a8ea4,'appCode':_0x1f0e46[_0x4f65bb(0x200)],..._0x24d89e[_0x4f65bb(0x1f2)]!==undefined?{'roleName':_0x24d89e[_0x4f65bb(0x1f2)]}:{},..._0x24d89e[_0x4f65bb(0x1e9)]!==undefined?{'remark':_0x24d89e[_0x4f65bb(0x1e9)]}:{}});const _0x2b9f9b=await getRoleById(_0x1f0e46[_0x4f65bb(0x200)],_0x3a8ea4);return{'ok':!![],'data':{'scope':_0x4f65bb(0x1ef),'operation':_0x4f65bb(0x203),'selector':{'appCode':_0x1f0e46[_0x4f65bb(0x200)],'roleId':_0x3a8ea4,'roleName':_0x2b9f9b[_0x4f65bb(0x1f2)]},'before':projectRole(_0x13fecc),'after':projectRole(_0x2b9f9b),'dryRun':![],'backend':{'method':'POST','path':UPDATE_PATH},'warnings':[]},'message':_0x4f65bb(0x1f0)+_0x2b9f9b[_0x4f65bb(0x1f2)]+_0x4f65bb(0x205)+_0x3a8ea4+')'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a179_0x14cb(_0x3ceb13,_0x520c09){_0x3ceb13=_0x3ceb13-0x90;const _0x33c6ad=a179_0x33c6();let _0x14cbfe=_0x33c6ad[_0x3ceb13];return _0x14cbfe;}const a179_0x53ae6d=a179_0x14cb;(function(_0x2e3510,_0x27c862){const _0x436ccd=a179_0x14cb,_0x4f7b1a=_0x2e3510();while(!![]){try{const _0x434ecd=-parseInt(_0x436ccd(0x9c))/0x1*(-parseInt(_0x436ccd(0xa5))/0x2)+parseInt(_0x436ccd(0x9b))/0x3+-parseInt(_0x436ccd(0xa3))/0x4+parseInt(_0x436ccd(0xa1))/0x5+parseInt(_0x436ccd(0x9f))/0x6+parseInt(_0x436ccd(0x96))/0x7*(parseInt(_0x436ccd(0x9a))/0x8)+-parseInt(_0x436ccd(0x97))/0x9;if(_0x434ecd===_0x27c862)break;else _0x4f7b1a['push'](_0x4f7b1a['shift']());}catch(_0x57c7cf){_0x4f7b1a['push'](_0x4f7b1a['shift']());}}}(a179_0x33c6,0x5b1bd));import{createDevUserRole}from'../../core/api-client.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a179_0x33c6(){const _0x648fba=['roleType','49357pgYTpw','8991828LLlczO','Added\x20user\x20','Add\x20a\x20user\x20to\x20a\x20role\x20(OWNER\x20rejected);\x20requires\x20--yes','112xmhYdt','1595997NsIgIJ','153514kzGdOp','selector','roleId','3241140VteuMc','role','375295cCwRWK','username','108812JVWZjR','roleName','2MCogCA','user-add','appCode','high-risk-write','No\x20change:\x20user\x20','\x20to\x20role\x20','userId'];a179_0x33c6=function(){return _0x648fba;};return a179_0x33c6();}import{asDryRunResult}from'../../commands/common/dry-run.js';import{EXPECT_USER_COUNT_FLAG,CREATE_USER_ROLE_PATH,prepareUserMutation,ROLE_REF_FLAG,USER_REF_FLAG}from'../../commands/role/shared.js';export const roleUserAdd={'service':a179_0x53ae6d(0xa0),'command':a179_0x53ae6d(0xa6),'description':a179_0x53ae6d(0x99),'risk':a179_0x53ae6d(0x91),'flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x1def1f){const _0x3e6af8=a179_0x53ae6d,{mutation:_0x214bd9}=await prepareUserMutation(_0x1def1f,_0x3e6af8(0xa6),!![]);return asDryRunResult(_0x214bd9,{'method':'POST','url':CREATE_USER_ROLE_PATH});},async 'execute'(_0xa40120){const _0x20f8b9=a179_0x53ae6d,{mutation:_0x36c61c,changed:_0x43b1e4,role:_0x1a8b32,user:_0x2564a8}=await prepareUserMutation(_0xa40120,_0x20f8b9(0xa6),![]);return _0x43b1e4&&await createDevUserRole({'appCode':_0xa40120[_0x20f8b9(0x90)],'userId':_0x2564a8[_0x20f8b9(0x94)],'username':_0x2564a8[_0x20f8b9(0xa2)],'roleType':_0x1a8b32[_0x20f8b9(0x95)],'roleId':_0x36c61c[_0x20f8b9(0x9d)][_0x20f8b9(0x9e)]}),{'ok':!![],'data':_0x36c61c,'message':_0x43b1e4?_0x20f8b9(0x98)+_0x36c61c[_0x20f8b9(0x9d)][_0x20f8b9(0x94)]+_0x20f8b9(0x93)+_0x36c61c['selector'][_0x20f8b9(0xa4)]:_0x20f8b9(0x92)+_0x36c61c[_0x20f8b9(0x9d)][_0x20f8b9(0x94)]+'\x20already\x20in\x20role\x20'+_0x36c61c[_0x20f8b9(0x9d)][_0x20f8b9(0xa4)]};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a180_0x5ce8fe=a180_0x4062;(function(_0xacc81a,_0x3fedd8){const _0x4a22f5=a180_0x4062,_0x307173=_0xacc81a();while(!![]){try{const _0x347357=parseInt(_0x4a22f5(0x89))/0x1+-parseInt(_0x4a22f5(0x84))/0x2*(parseInt(_0x4a22f5(0x8c))/0x3)+-parseInt(_0x4a22f5(0x8f))/0x4+parseInt(_0x4a22f5(0x86))/0x5*(parseInt(_0x4a22f5(0x81))/0x6)+parseInt(_0x4a22f5(0x7f))/0x7*(-parseInt(_0x4a22f5(0x8e))/0x8)+-parseInt(_0x4a22f5(0x80))/0x9+parseInt(_0x4a22f5(0x85))/0xa;if(_0x347357===_0x3fedd8)break;else _0x307173['push'](_0x307173['shift']());}catch(_0x1ba395){_0x307173['push'](_0x307173['shift']());}}}(a180_0x3f92,0x95e73));import{deleteDevUserRole}from'../../core/api-client.js';function a180_0x4062(_0x18b4d5,_0x3a1cf7){_0x18b4d5=_0x18b4d5-0x7b;const _0x3f9289=a180_0x3f92();let _0x406282=_0x3f9289[_0x18b4d5];return _0x406282;}function a180_0x3f92(){const _0x5a9f89=['userId','selector','\x20not\x20in\x20role\x20','\x20from\x20role\x20','7bRFPDo','9630891CJVOTy','18ZCjmCC','Remove\x20a\x20user\x20from\x20a\x20role\x20(OWNER\x20rejected);\x20requires\x20--yes','high-risk-write','2qCeIMr','20781960ujbNNa','1301555JbAmNn','Removed\x20user\x20','No\x20change:\x20user\x20','394454lunCOO','user-remove','roleName','3100473rzvUQA','POST','1791760TcBEZM','1248080eOEAtV','role'];a180_0x3f92=function(){return _0x5a9f89;};return a180_0x3f92();}import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{EXPECT_USER_COUNT_FLAG,DELETE_USER_ROLE_PATH,prepareUserMutation,ROLE_REF_FLAG,USER_REF_FLAG}from'../../commands/role/shared.js';export const roleUserRemove={'service':a180_0x5ce8fe(0x90),'command':a180_0x5ce8fe(0x8a),'description':a180_0x5ce8fe(0x82),'risk':a180_0x5ce8fe(0x83),'flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x38c803){const _0x5b6927=a180_0x5ce8fe,{mutation:_0x1c3b7c}=await prepareUserMutation(_0x38c803,_0x5b6927(0x8a),!![]);return asDryRunResult(_0x1c3b7c,{'method':_0x5b6927(0x8d),'url':DELETE_USER_ROLE_PATH});},async 'execute'(_0x4d1d07){const _0x3b6388=a180_0x5ce8fe,{matchingRelationIds:_0x45942b,mutation:_0x4847ec,changed:_0x318194}=await prepareUserMutation(_0x4d1d07,_0x3b6388(0x8a),![]);if(_0x318194)for(const _0x4b4764 of _0x45942b){await deleteDevUserRole(_0x4b4764);}return{'ok':!![],'data':_0x4847ec,'message':_0x318194?_0x3b6388(0x87)+_0x4847ec[_0x3b6388(0x7c)]['userId']+_0x3b6388(0x7e)+_0x4847ec['selector'][_0x3b6388(0x8b)]:_0x3b6388(0x88)+_0x4847ec[_0x3b6388(0x7c)][_0x3b6388(0x7b)]+_0x3b6388(0x7d)+_0x4847ec[_0x3b6388(0x7c)][_0x3b6388(0x8b)]};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a181_0x2bdae9=a181_0x2b5c;(function(_0x28d779,_0x1d8c0a){const _0x16f72d=a181_0x2b5c,_0x1067f1=_0x28d779();while(!![]){try{const _0x25b7c6=-parseInt(_0x16f72d(0x18c))/0x1+parseInt(_0x16f72d(0x18b))/0x2+parseInt(_0x16f72d(0x190))/0x3+-parseInt(_0x16f72d(0x18d))/0x4+-parseInt(_0x16f72d(0x195))/0x5+-parseInt(_0x16f72d(0x18e))/0x6*(parseInt(_0x16f72d(0x194))/0x7)+parseInt(_0x16f72d(0x18f))/0x8;if(_0x25b7c6===_0x1d8c0a)break;else _0x1067f1['push'](_0x1067f1['shift']());}catch(_0x1a13b3){_0x1067f1['push'](_0x1067f1['shift']());}}}(a181_0x3900,0xde3c9));function a181_0x3900(){const _0x19b546=['307072iRWoGR','514476CUlTNA','7225324UgmWJl','96EbdgwM','30134480SGjnhv','4155480AsBXYT','\x22\x20→\x20userId\x20','name','flagMissing','196217zOEyQt','8129610iFDfLr','read','matchedBy','trim','userId','str','role','user-resolve'];a181_0x3900=function(){return _0x19b546;};return a181_0x3900();}import{CliErrors}from'../../errors.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a181_0x2b5c(_0x5b52c4,_0x165297){_0x5b52c4=_0x5b52c4-0x188;const _0x390012=a181_0x3900();let _0x2b5c78=_0x390012[_0x5b52c4];return _0x2b5c78;}import{resolveUserRef,USER_NAME_FLAG}from'../../commands/role/shared.js';export const roleUserResolve={'service':a181_0x2bdae9(0x189),'command':a181_0x2bdae9(0x18a),'description':'Resolve\x20a\x20nickname/username\x20to\x20a\x20userId\x20(tenant\x20member\x20directory)','risk':a181_0x2bdae9(0x196),'flags':[USER_NAME_FLAG,APPCODE_FLAG_OPTIONAL],async 'validate'(_0x36eace){const _0x22ff63=a181_0x2bdae9;if(!_0x36eace['str'](_0x22ff63(0x192))[_0x22ff63(0x198)]())throw CliErrors[_0x22ff63(0x193)](_0x22ff63(0x192),'Pass\x20--name\x20<nickname|username>.');},async 'execute'(_0x3fa09b){const _0xfaa2f6=a181_0x2bdae9,_0x174f09=_0x3fa09b[_0xfaa2f6(0x188)](_0xfaa2f6(0x192))['trim'](),_0x5ca574=await resolveUserRef(_0x174f09);return{'ok':!![],'data':{'user':{'userId':_0x5ca574[_0xfaa2f6(0x199)],'username':_0x5ca574['username'],'nickname':_0x5ca574['nickname'],'matchedBy':_0x5ca574[_0xfaa2f6(0x197)]}},'message':'Resolved\x20\x22'+_0x174f09+_0xfaa2f6(0x191)+_0x5ca574[_0xfaa2f6(0x199)]};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a182_0x3d3ea3=a182_0x3bc2;function a182_0x4d7c(){const _0x36cc09=['boolean','bun','pnpm','180768rsNlDK','scripts','18495851MAiopz','parse','bun.lockb','keys','--watch','vite\x20preview\x20exited\x20with\x20code\x20','\x20run\x20build','No\x20scripts\x20defined\x20in\x20package.json.','args','\x0a\x20\x20Usage:\x20','Available:\x20','needsUpgrade','validation','17323PoLaeu','preview','12871523PtWELF','Script\x20name\x20defined\x20in\x20package.json','vite\x20build\x20--watch\x20exited\x20with\x20code\x20','vite','log','28278vtzZpu','21wYzLBv','bun.lock','belowMinimum','watch','bool','push','1112rjbNSD','error','.bin','15528260vjfwkO','\x20run\x20preview\x20--watch','run','\x20run\x20','\x22\x20not\x20found\x20in\x20package.json.','node_modules','yarn.lock','\x20\x20\x20\x20','pnpm-lock.yaml','\x20run\x20<script>\x0a','(none)','write','6VwdOpv','has','build','\x20run\x20start','cwd','npm','Enable\x20watch\x20mode\x20for\x20preview','\x0a\x20\x20Available\x20scripts:\x0a','utf-8','2099540nTMVvJ','15GkzEsu','script','No\x20package.json\x20found\x20in\x20current\x20directory.','close','inherit','\x20run\x20preview'];a182_0x4d7c=function(){return _0x36cc09;};return a182_0x4d7c();}(function(_0x1b3552,_0x281013){const _0x49b5c2=a182_0x3bc2,_0x2a79ea=_0x1b3552();while(!![]){try{const _0x294cdf=parseInt(_0x49b5c2(0x1e3))/0x1+-parseInt(_0x49b5c2(0x213))/0x2*(-parseInt(_0x49b5c2(0x1eb))/0x3)+-parseInt(_0x49b5c2(0x209))/0x4*(-parseInt(_0x49b5c2(0x20a))/0x5)+-parseInt(_0x49b5c2(0x200))/0x6*(parseInt(_0x49b5c2(0x1e5))/0x7)+parseInt(_0x49b5c2(0x1f1))/0x8*(parseInt(_0x49b5c2(0x1ea))/0x9)+-parseInt(_0x49b5c2(0x1f4))/0xa+parseInt(_0x49b5c2(0x215))/0xb;if(_0x294cdf===_0x281013)break;else _0x2a79ea['push'](_0x2a79ea['shift']());}catch(_0x41e9f9){_0x2a79ea['push'](_0x2a79ea['shift']());}}}(a182_0x4d7c,0xe83be));import{readFileSync,existsSync}from'node:fs';import{CLI_BIN_NAME}from'../../constant/cli.js';import{resolve,delimiter,join}from'node:path';import{spawn}from'node:child_process';import{CliErrors}from'../../errors.js';import{checkSdkVersion,printSdkUpgradeWarning}from'../../utils/check-sdk-version.js';import{assertCliVersionSupported,checkCliVersion,printCliUpgradeWarning}from'../../utils/cli-version-check.js';const VERSION_CHECK_SCRIPTS=new Set(['start','dev']);function a182_0x3bc2(_0x22583f,_0x3e438c){_0x22583f=_0x22583f-0x1d7;const _0x4d7ca6=a182_0x4d7c();let _0x3bc272=_0x4d7ca6[_0x22583f];return _0x3bc272;}function readPackageScripts(_0x30708f){const _0x46b0a7=a182_0x3bc2,_0x1980fb=resolve(_0x30708f,'package.json');if(!existsSync(_0x1980fb))return null;try{const _0x13968d=JSON[_0x46b0a7(0x1d7)](readFileSync(_0x1980fb,_0x46b0a7(0x208)));return _0x13968d[_0x46b0a7(0x214)]??{};}catch{return null;}}function detectPackageManager(_0x324c65){const _0xa21266=a182_0x3bc2;if(existsSync(resolve(_0x324c65,_0xa21266(0x1d8)))||existsSync(resolve(_0x324c65,_0xa21266(0x1ec))))return _0xa21266(0x211);if(existsSync(resolve(_0x324c65,_0xa21266(0x1fc))))return _0xa21266(0x212);if(existsSync(resolve(_0x324c65,_0xa21266(0x1fa))))return'yarn';return _0xa21266(0x205);}async function versionCheck(_0x51556d){const _0x456779=a182_0x3bc2,_0x119f90=await checkCliVersion();(_0x119f90['needsUpgrade']||_0x119f90[_0x456779(0x1ed)])&&(printCliUpgradeWarning(_0x119f90),assertCliVersionSupported(_0x119f90));const _0x379593=await checkSdkVersion(_0x51556d);if(_0x379593[_0x456779(0x1e1)])printSdkUpgradeWarning(_0x379593);}function spawnScript(_0x5aa92b,_0x562c56,_0x157be7,_0x3234a5){return new Promise((_0x2fb929,_0x1772dd)=>{const _0x427951=a182_0x3bc2,_0x1d385e=['run',_0x562c56,..._0x157be7],_0x1e4e8d=spawn(_0x5aa92b,_0x1d385e,{'cwd':_0x3234a5,'stdio':_0x427951(0x20e),'shell':!![],'env':{...process.env,'PATH':''+join(_0x3234a5,_0x427951(0x1f9),_0x427951(0x1f3))+delimiter+process.env.PATH}});_0x1e4e8d['on']('close',_0xf639ff=>{const _0xbad69b=_0x427951;if(_0xf639ff===0x0||_0xf639ff===null)_0x2fb929();else _0x1772dd(new Error(_0x5aa92b+_0xbad69b(0x1f7)+_0x562c56+'\x20exited\x20with\x20code\x20'+_0xf639ff));}),_0x1e4e8d['on'](_0x427951(0x1f2),_0x1772dd);});}function spawnViteBuildWatch(_0x1e6775){return new Promise((_0x4c6dcf,_0x343df5)=>{const _0x4b57b2=a182_0x3bc2,_0x3bf68d=spawn(_0x4b57b2(0x1e8),[_0x4b57b2(0x202),_0x4b57b2(0x1da)],{'cwd':_0x1e6775,'stdio':'inherit','shell':!![],'env':{...process.env,'PATH':''+join(_0x1e6775,'node_modules',_0x4b57b2(0x1f3))+delimiter+process.env.PATH}});_0x3bf68d['on'](_0x4b57b2(0x20d),_0xb96cb3=>{const _0x5cca8f=_0x4b57b2;if(_0xb96cb3===0x0||_0xb96cb3===null)_0x4c6dcf();else _0x343df5(new Error(_0x5cca8f(0x1e7)+_0xb96cb3));}),_0x3bf68d['on'](_0x4b57b2(0x1f2),_0x343df5);});}function spawnVitePreview(_0x2d235c){return new Promise((_0x2f69ac,_0x3680ee)=>{const _0x5927e7=a182_0x3bc2,_0x36651c=spawn(_0x5927e7(0x1e8),[_0x5927e7(0x1e4)],{'cwd':_0x2d235c,'stdio':_0x5927e7(0x20e),'shell':!![],'env':{...process.env,'PATH':''+join(_0x2d235c,_0x5927e7(0x1f9),_0x5927e7(0x1f3))+delimiter+process.env.PATH}});_0x36651c['on'](_0x5927e7(0x20d),_0x52ccae=>{const _0x2292d9=_0x5927e7;if(_0x52ccae===0x0||_0x52ccae===null)_0x2f69ac();else _0x3680ee(new Error(_0x2292d9(0x1db)+_0x52ccae));}),_0x36651c['on'](_0x5927e7(0x1f2),_0x3680ee);});}const runFlags=[{'name':a182_0x3d3ea3(0x1ee),'type':a182_0x3d3ea3(0x210),'description':a182_0x3d3ea3(0x206),'default':![]}];export const runDefinition={'service':a182_0x3d3ea3(0x1f6),'command':'run','description':'Run\x20a\x20package.json\x20script','risk':a182_0x3d3ea3(0x1ff),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':a182_0x3d3ea3(0x20b),'description':a182_0x3d3ea3(0x1e6),'required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x200463=a182_0x3d3ea3,_0x9c9db6=[];return _0x9c9db6[_0x200463(0x1f0)]('\x20\x20EXAMPLES'),_0x9c9db6[_0x200463(0x1f0)](_0x200463(0x1fb)+CLI_BIN_NAME+_0x200463(0x203)),_0x9c9db6['push'](_0x200463(0x1fb)+CLI_BIN_NAME+_0x200463(0x1dc)),_0x9c9db6[_0x200463(0x1f0)](_0x200463(0x1fb)+CLI_BIN_NAME+_0x200463(0x20f)),_0x9c9db6[_0x200463(0x1f0)]('\x20\x20\x20\x20'+CLI_BIN_NAME+_0x200463(0x1f5)),_0x9c9db6['join']('\x0a');},async 'execute'(_0xa7fa67){const _0x590706=a182_0x3d3ea3,_0x2c015c=process[_0x590706(0x204)](),_0x1303f9=_0xa7fa67['args'][0x0],_0x540184=_0xa7fa67[_0x590706(0x1de)]['slice'](0x1),_0x19acb5=readPackageScripts(_0x2c015c);if(!_0x19acb5)throw CliErrors[_0x590706(0x1e2)](_0x590706(0x20c));if(!_0x1303f9){const _0x3ce00a=Object['keys'](_0x19acb5);if(_0x3ce00a['length']===0x0)console[_0x590706(0x1e9)](_0x590706(0x1dd));else{console[_0x590706(0x1e9)](_0x590706(0x207));for(const _0x5e6fec of _0x3ce00a){console[_0x590706(0x1e9)](_0x590706(0x1fb)+_0x5e6fec);}console['log'](_0x590706(0x1df)+CLI_BIN_NAME+_0x590706(0x1fd));}return{'ok':!![]};}if(!_0x19acb5[_0x1303f9])throw CliErrors[_0x590706(0x1e2)]('Script\x20\x22'+_0x1303f9+_0x590706(0x1f8),_0x590706(0x1e0)+(Object[_0x590706(0x1d9)](_0x19acb5)['join'](',\x20')||_0x590706(0x1fe)));const _0x571306=detectPackageManager(_0x2c015c);VERSION_CHECK_SCRIPTS[_0x590706(0x201)](_0x1303f9)&&await versionCheck(_0x2c015c);if(_0x1303f9===_0x590706(0x1e4)&&_0xa7fa67[_0x590706(0x1ef)](_0x590706(0x1ee)))return await Promise['all']([spawnViteBuildWatch(_0x2c015c),spawnVitePreview(_0x2c015c)]),{'ok':!![]};return await spawnScript(_0x571306,_0x1303f9,_0x540184,_0x2c015c),{'ok':!![]};}};
|
package/lib/commands/schema.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a183_0x1846bd=a183_0x1ac8;function a183_0x1ac8(_0x681f3,_0x22c6fe){_0x681f3=_0x681f3-0x1be;const _0x292b97=a183_0x292b();let _0x1ac89e=_0x292b97[_0x681f3];return _0x1ac89e;}(function(_0x53eaa3,_0x314591){const _0x3c7555=a183_0x1ac8,_0x3e0694=_0x53eaa3();while(!![]){try{const _0x5e0809=parseInt(_0x3c7555(0x1c6))/0x1+-parseInt(_0x3c7555(0x1bf))/0x2+parseInt(_0x3c7555(0x1c1))/0x3+-parseInt(_0x3c7555(0x1c7))/0x4+-parseInt(_0x3c7555(0x1c3))/0x5*(-parseInt(_0x3c7555(0x1be))/0x6)+parseInt(_0x3c7555(0x1c5))/0x7+-parseInt(_0x3c7555(0x1c0))/0x8;if(_0x5e0809===_0x314591)break;else _0x3e0694['push'](_0x3e0694['shift']());}catch(_0x2363fd){_0x3e0694['push'](_0x3e0694['shift']());}}}(a183_0x292b,0x9188d));import{buildSchemaPayload}from'../framework/schema-export.js';async function execute(_0x530cb6){const _0x546a3e=await buildSchemaPayload();return{'ok':!![],'data':_0x546a3e};}function a183_0x292b(){const _0x40530f=['438003OdNlQy','Export\x20machine-readable\x20command\x20schema\x20(JSON)','82490nDDBYM','schema','5016900JbTQwV','500268hMYPdd','3935616UJqCnd','318DuUQsL','1286102ChLuXu','114392KQLnWl'];a183_0x292b=function(){return _0x40530f;};return a183_0x292b();}export const schemaDefinition={'service':a183_0x1846bd(0x1c4),'command':'export','description':a183_0x1846bd(0x1c2),'risk':'read','requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':'json','flags':[],'execute':execute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a191_0x5d46b3=a191_0x259a;(function(_0x423951,_0x5dd6b3){const _0x388853=a191_0x259a,_0x28ec13=_0x423951();while(!![]){try{const _0x63cd0a=-parseInt(_0x388853(0x91))/0x1*(-parseInt(_0x388853(0x82))/0x2)+-parseInt(_0x388853(0x88))/0x3*(-parseInt(_0x388853(0x74))/0x4)+-parseInt(_0x388853(0x7c))/0x5*(parseInt(_0x388853(0x7a))/0x6)+-parseInt(_0x388853(0x9b))/0x7*(parseInt(_0x388853(0x72))/0x8)+-parseInt(_0x388853(0xae))/0x9+-parseInt(_0x388853(0xb1))/0xa*(-parseInt(_0x388853(0x71))/0xb)+-parseInt(_0x388853(0x77))/0xc*(-parseInt(_0x388853(0x87))/0xd);if(_0x63cd0a===_0x5dd6b3)break;else _0x28ec13['push'](_0x28ec13['shift']());}catch(_0x269aee){_0x28ec13['push'](_0x28ec13['shift']());}}}(a191_0x5569,0x73ca1));import{writeFile}from'node:fs/promises';function a191_0x5569(){const _0xeaeab1=['适合带动态标签的\x20MyBatis\x20XML\x20SQL','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','Local\x20SQL\x20file\x20mode','description','5899478vTRArs','9474TpkXSv','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','validation','toISOString','flagMissing','join','Invalid\x20database\x20selection\x20payload:\x20','dbName','sql','2wJgLst','__manual__','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','number','str','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','mode','stringify','lastSync','dbId\x20不能为空','21LilQsU','sqlRootDir','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','db-id','Target\x20database\x20ID','✎\x20手动输入\x20dbId','write','new','请选择本地\x20SQL\x20模式:','适合直接执行的普通\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20语句','SELECT\x201\x20AS\x20id;','string','appCode','sqlName','utf8','SQL\x20名称不能为空','SQL\x20query\x20display\x20name','请选择目标数据库:','catch','595548YCOzBp','mybatisXml','length','50IXeYqE','sqlRoot','普通\x20SQL(sql)','请输入\x20SQL\x20名称:','606925guLtDc','1868656wumshg','sqls','556fYNfEL','map','nonInteractive','12NKWbmS','trim','dbId','1309452aGqJYT','sqlCode','10Xihiac','POST','isFinite','name','isInteger','请输入目标数据库\x20dbId:','509032NiTsas'];a191_0x5569=function(){return _0xeaeab1;};return a191_0x5569();}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';function a191_0x259a(_0x124f97,_0x12d53d){_0x124f97=_0x124f97-0x70;const _0x5569ea=a191_0x5569();let _0x259a34=_0x5569ea[_0x124f97];return _0x259a34;}import{CliErrors}from'../../errors.js';import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function generateSqlTemplate(_0x43743a){const _0x18b6ee=a191_0x259a;if(_0x43743a===_0x18b6ee(0xaf))return[_0x18b6ee(0x89),'\x20\x20SELECT\x201\x20AS\x20id','</select>',''][_0x18b6ee(0x8d)]('\x0a');return[_0x18b6ee(0xa5),''][_0x18b6ee(0x8d)]('\x0a');}export const sqlCreate={'service':a191_0x5d46b3(0x90),'command':'create','description':'Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','risk':a191_0x5d46b3(0xa1),'flags':[{'name':'name','type':a191_0x5d46b3(0xa6),'description':a191_0x5d46b3(0xab)},{'name':a191_0x5d46b3(0x9e),'type':a191_0x5d46b3(0x94),'description':a191_0x5d46b3(0x9f)},{'name':'mode','type':a191_0x5d46b3(0xa6),'enum':[a191_0x5d46b3(0x90),a191_0x5d46b3(0xaf)],'description':a191_0x5d46b3(0x85)}],async 'validate'(_0x889349){const _0x5b24f2=a191_0x5d46b3;if(!_0x889349[_0x5b24f2(0x76)])return;if(!_0x889349[_0x5b24f2(0x95)](_0x5b24f2(0x7f))[_0x5b24f2(0x78)]())throw CliErrors[_0x5b24f2(0x8c)](_0x5b24f2(0x7f),_0x5b24f2(0x9d));const _0x2ad156=resolveProvidedDbId(_0x889349);if(typeof _0x2ad156!=='number'||!Number[_0x5b24f2(0x7e)](_0x2ad156)||_0x2ad156<=0x0)throw CliErrors[_0x5b24f2(0x8c)](_0x5b24f2(0x9e),_0x5b24f2(0x84));if(!_0x889349[_0x5b24f2(0x95)]('mode')[_0x5b24f2(0x78)]())throw CliErrors[_0x5b24f2(0x8c)]('mode',_0x5b24f2(0x96));},async 'dryRun'(_0x56df83){const _0x2447bb=a191_0x5d46b3,_0x1afde9=loadSqlProjectConfig(_0x56df83[_0x2447bb(0xa7)]),{sqlName:_0x46ebb7,dbId:_0x1edf6d,dbName:_0x5c6eb1,mode:_0x5dce17}=await resolveSqlNewInputs(_0x56df83),_0x3f7983=buildSqlRelativePath('<server-generated-sqlCode>',_0x46ebb7,_0x5c6eb1,_0x5dce17,_0x1edf6d),_0x4278b2=_0x1afde9[_0x2447bb(0x9c)]+'/'+_0x3f7983;return{'method':_0x2447bb(0x7d),'url':'/smartapi/custom/saveUserCustomSql','body':{'appCode':_0x56df83['appCode'],'sqlName':_0x46ebb7,'dbId':_0x1edf6d,'mode':_0x5dce17,'localPath':_0x4278b2},'description':_0x2447bb(0x93)+_0x1afde9[_0x2447bb(0x9c)]};},async 'execute'(_0x3d0a22){const _0x1f4565=a191_0x5d46b3,_0xd28dc1=loadSqlProjectConfig(_0x3d0a22['appCode']),{sqlName:_0x59db43,dbId:_0x53ce8e,dbName:_0x311fb6,mode:_0x5a1867}=await resolveSqlNewInputs(_0x3d0a22),_0x147140=generateSqlTemplate(_0x5a1867),_0x402560=await createSqlQuery({'appCode':_0x3d0a22[_0x1f4565(0xa7)],'sqlName':_0x59db43,'dbId':_0x53ce8e,'sqlContent':_0x147140}),_0x502365=ensureRemoteSqlContent(_0x402560),_0x21bb53=_0x311fb6||await getDbName(_0x3d0a22[_0x1f4565(0xa7)],_0x53ce8e)[_0x1f4565(0xad)](()=>undefined),_0x385581=buildSqlRelativePath(_0x402560[_0x1f4565(0x7b)],_0x402560['sqlName'],_0x21bb53,_0x5a1867,_0x53ce8e),_0xa30790=_0xd28dc1[_0x1f4565(0x9c)]+'/'+_0x385581,_0x5ee49e=buildLocalSqlFileContent({'sqlCode':_0x402560[_0x1f4565(0x7b)],'sqlName':_0x402560[_0x1f4565(0xa8)],'dbId':_0x402560[_0x1f4565(0x79)]},_0x502365,{'dbName':_0x21bb53,'mode':_0x5a1867,'syncedAt':new Date()[_0x1f4565(0x8b)](),'description':_0x402560[_0x1f4565(0x86)]});if(await fileExists(_0xa30790))throw CliErrors[_0x1f4565(0x8a)]('File\x20already\x20exists:\x20'+_0xa30790);await ensureParentDirectory(_0xa30790),await writeFile(_0xa30790,_0x5ee49e,_0x1f4565(0xa9));const _0x45e3f1=await readSqlLockFile(_0xd28dc1['lockFilePath']),{lockData:_0x1cad03,appLock:_0x46fbbe}=ensureSqlLockScope(_0x45e3f1??createEmptySqlLock(),_0xd28dc1[_0x1f4565(0xa7)],_0xd28dc1[_0x1f4565(0xb2)],_0x1f4565(0xa2));return _0x46fbbe[_0x1f4565(0x73)][_0x402560[_0x1f4565(0x7b)]]={...buildSqlLockEntry(_0x402560,_0x502365,computeSqlContentHash(_0x5ee49e),{'dbName':_0x21bb53}),'path':_0x385581,'mode':_0x5a1867},_0x46fbbe[_0x1f4565(0x99)]=new Date()[_0x1f4565(0x8b)](),await writeSqlLockFile(_0xd28dc1['lockFilePath'],_0x1cad03),{'ok':!![],'data':{'id':_0x402560['id'],'sqlCode':_0x402560[_0x1f4565(0x7b)],'sqlName':_0x402560[_0x1f4565(0xa8)],'dbId':_0x402560[_0x1f4565(0x79)],'path':_0xa30790,'mode':_0x5a1867},'message':'Created\x20SQL\x20query\x20'+_0x402560[_0x1f4565(0x7b)]};}};async function resolveSqlNewInputs(_0x19c605){const _0x462531=await resolveSqlNameInput(_0x19c605),{dbId:_0x2a7f7b,dbName:_0x2cd7c9}=await resolveDbSelection(_0x19c605),_0x117516=await resolveSqlModeInput(_0x19c605);return{'sqlName':_0x462531,'dbId':_0x2a7f7b,'dbName':_0x2cd7c9,'mode':_0x117516};}async function resolveSqlNameInput(_0x508450){const _0x441506=a191_0x5d46b3,_0x1f5c09=_0x508450[_0x441506(0x95)](_0x441506(0x7f))[_0x441506(0x78)]();if(_0x1f5c09)return _0x1f5c09;if(_0x508450['nonInteractive'])throw CliErrors[_0x441506(0x8c)](_0x441506(0x7f),_0x441506(0x9d));return(await input({'message':_0x441506(0x70),'validate':_0x5940f0=>_0x5940f0[_0x441506(0x78)]()?!![]:_0x441506(0xaa)}))[_0x441506(0x78)]();}async function resolveDbSelection(_0x5acb26){const _0x3b9fe7=a191_0x5d46b3,_0x1d9ad6=resolveProvidedDbId(_0x5acb26);if(typeof _0x1d9ad6===_0x3b9fe7(0x94)&&Number['isFinite'](_0x1d9ad6)&&_0x1d9ad6>0x0)return{'dbId':_0x1d9ad6,'dbName':await getDbName(_0x5acb26['appCode'],_0x1d9ad6)[_0x3b9fe7(0xad)](()=>undefined)};if(_0x5acb26[_0x3b9fe7(0x76)])throw CliErrors[_0x3b9fe7(0x8c)](_0x3b9fe7(0x9e),_0x3b9fe7(0x84));const _0x47c5a7=await listDatabases(_0x5acb26[_0x3b9fe7(0xa7)])['catch'](()=>[]);if(_0x47c5a7['length']===0x1)return{'dbId':_0x47c5a7[0x0]['dbId'],'dbName':_0x47c5a7[0x0]['dbName']};if(_0x47c5a7[_0x3b9fe7(0xb0)]>0x1){const _0xb14569=await select({'message':_0x3b9fe7(0xac),'choices':[..._0x47c5a7[_0x3b9fe7(0x75)](_0x4e9158=>({'name':_0x4e9158[_0x3b9fe7(0x8f)]+'\x20('+_0x4e9158[_0x3b9fe7(0x79)]+')','value':serializeDbSelection(_0x4e9158)})),{'name':_0x3b9fe7(0xa0),'value':_0x3b9fe7(0x92)}]});if(_0xb14569!=='__manual__')return deserializeDbSelection(_0xb14569);}const _0x1b2f11=await input({'message':_0x3b9fe7(0x81),'validate':_0x3b0dfa=>{const _0x2d35f9=_0x3b9fe7,_0x358861=_0x3b0dfa[_0x2d35f9(0x78)]();if(!_0x358861)return _0x2d35f9(0x9a);const _0x49f452=Number(_0x358861);if(!Number[_0x2d35f9(0x80)](_0x49f452)||_0x49f452<=0x0)return'dbId\x20必须为正整数';return!![];}});return{'dbId':Number(_0x1b2f11[_0x3b9fe7(0x78)]())};}async function resolveSqlModeInput(_0x50b5b1){const _0x598b9e=a191_0x5d46b3,_0x434e61=_0x50b5b1['str'](_0x598b9e(0x97))[_0x598b9e(0x78)]();if(_0x434e61==='sql'||_0x434e61===_0x598b9e(0xaf))return _0x434e61;if(_0x50b5b1[_0x598b9e(0x76)])throw CliErrors[_0x598b9e(0x8c)](_0x598b9e(0x97),_0x598b9e(0x96));return await select({'message':_0x598b9e(0xa3),'choices':[{'name':_0x598b9e(0xb3),'value':_0x598b9e(0x90),'description':_0x598b9e(0xa4)},{'name':'MyBatis\x20XML(mybatisXml)','value':'mybatisXml','description':_0x598b9e(0x83)}]});}function serializeDbSelection(_0x710f12){const _0x2aa626=a191_0x5d46b3;return JSON[_0x2aa626(0x98)]({'dbId':_0x710f12['dbId'],'dbName':_0x710f12[_0x2aa626(0x8f)]});}function deserializeDbSelection(_0x3210f7){const _0x2343bc=a191_0x5d46b3;try{const _0x25e1f4=JSON['parse'](_0x3210f7);if(typeof _0x25e1f4[_0x2343bc(0x79)]===_0x2343bc(0x94)&&Number['isFinite'](_0x25e1f4[_0x2343bc(0x79)]))return{'dbId':_0x25e1f4[_0x2343bc(0x79)],'dbName':_0x25e1f4[_0x2343bc(0x8f)]};}catch{}throw CliErrors[_0x2343bc(0x8a)](_0x2343bc(0x8e)+_0x3210f7);}function resolveProvidedDbId(_0x364ce5){const _0xb55e29=a191_0x5d46b3,_0x3262f7=_0x364ce5['flag'](_0xb55e29(0x9e));if(typeof _0x3262f7==='number'&&Number['isFinite'](_0x3262f7))return _0x3262f7;return undefined;}
|
|
1
|
+
const a184_0x17ea2a=a184_0x1f1d;(function(_0x5e3b35,_0x4c1dfe){const _0x3477a0=a184_0x1f1d,_0x280730=_0x5e3b35();while(!![]){try{const _0x1b74e7=parseInt(_0x3477a0(0x10d))/0x1+parseInt(_0x3477a0(0x11f))/0x2+parseInt(_0x3477a0(0xeb))/0x3+parseInt(_0x3477a0(0x109))/0x4*(parseInt(_0x3477a0(0x107))/0x5)+-parseInt(_0x3477a0(0x100))/0x6+-parseInt(_0x3477a0(0xf2))/0x7+-parseInt(_0x3477a0(0xf7))/0x8*(parseInt(_0x3477a0(0xed))/0x9);if(_0x1b74e7===_0x4c1dfe)break;else _0x280730['push'](_0x280730['shift']());}catch(_0x1fe016){_0x280730['push'](_0x280730['shift']());}}}(a184_0x1a73,0x487ff));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';function a184_0x1f1d(_0x3591e8,_0x3a90ff){_0x3591e8=_0x3591e8-0xe0;const _0x1a73e7=a184_0x1a73();let _0x1f1d49=_0x1a73e7[_0x3591e8];return _0x1f1d49;}import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{buildSqlRelativePath}from'../../core/sql-sync/utils.js';function a184_0x1a73(){const _0xc5f6cd=['MyBatis\x20XML(mybatisXml)','✎\x20手动输入\x20dbId','str','dbId\x20不能为空','map','write','Invalid\x20database\x20selection\x20payload:\x20','请选择本地\x20SQL\x20模式:','请输入目标数据库\x20dbId:','lastSync','__manual__','catch','Created\x20SQL\x20query\x20','isInteger','416452IRKLTT','Local\x20SQL\x20file\x20mode','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','toISOString','create','sqlCode','length','string','File\x20already\x20exists:\x20','name','dbName','stringify','db-id','1330116ujDIYG','new','27SmBqZZ','dbId\x20必须为正整数','validation','trim','number','2291254PaRHgl','SQL\x20query\x20display\x20name','sql','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','sqls','1546368hxBZEB','appCode','Target\x20database\x20ID','utf8','</select>','sqlName','dbId','<server-generated-sqlCode>','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','845418xwFMya','mode','mybatisXml','join','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','flag','flagMissing','85010pTWqOn','sqlRootDir','100bXXLZu','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','SELECT\x201\x20AS\x20id;','POST','268424ehKkOt','nonInteractive','isFinite','适合带动态标签的\x20MyBatis\x20XML\x20SQL'];a184_0x1a73=function(){return _0xc5f6cd;};return a184_0x1a73();}import{CliErrors}from'../../errors.js';import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function generateSqlTemplate(_0x2d5468){const _0x76ca03=a184_0x1f1d;if(_0x2d5468===_0x76ca03(0x102))return[_0x76ca03(0x10a),'\x20\x20SELECT\x201\x20AS\x20id',_0x76ca03(0xfb),''][_0x76ca03(0x103)]('\x0a');return[_0x76ca03(0x10b),'']['join']('\x0a');}export const sqlCreate={'service':'sql','command':a184_0x17ea2a(0xe2),'description':'Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','risk':a184_0x17ea2a(0x116),'flags':[{'name':a184_0x17ea2a(0xe7),'type':a184_0x17ea2a(0xe5),'description':a184_0x17ea2a(0xf3)},{'name':a184_0x17ea2a(0xea),'type':a184_0x17ea2a(0xf1),'description':a184_0x17ea2a(0xf9)},{'name':a184_0x17ea2a(0x101),'type':a184_0x17ea2a(0xe5),'enum':[a184_0x17ea2a(0xf4),'mybatisXml'],'description':a184_0x17ea2a(0x120)}],async 'validate'(_0x1e872f){const _0x42ffc2=a184_0x17ea2a;if(!_0x1e872f['nonInteractive'])return;if(!_0x1e872f[_0x42ffc2(0x113)](_0x42ffc2(0xe7))[_0x42ffc2(0xf0)]())throw CliErrors[_0x42ffc2(0x106)](_0x42ffc2(0xe7),_0x42ffc2(0xe0));const _0x50c504=resolveProvidedDbId(_0x1e872f);if(typeof _0x50c504!=='number'||!Number[_0x42ffc2(0x10f)](_0x50c504)||_0x50c504<=0x0)throw CliErrors['flagMissing'](_0x42ffc2(0xea),_0x42ffc2(0xf5));if(!_0x1e872f['str'](_0x42ffc2(0x101))[_0x42ffc2(0xf0)]())throw CliErrors[_0x42ffc2(0x106)]('mode',_0x42ffc2(0x104));},async 'dryRun'(_0x35fa68){const _0x13cd56=a184_0x17ea2a,_0x1bcfa5=loadSqlProjectConfig(_0x35fa68[_0x13cd56(0xf8)]),{sqlName:_0x22dbcd,dbId:_0xae6863,dbName:_0x182617,mode:_0x40099e}=await resolveSqlNewInputs(_0x35fa68),_0x3e455d=buildSqlRelativePath(_0x13cd56(0xfe),_0x22dbcd,_0x182617,_0x40099e,_0xae6863),_0x522983=_0x1bcfa5['sqlRootDir']+'/'+_0x3e455d;return{'method':_0x13cd56(0x10c),'url':'/smartapi/custom/saveUserCustomSql','body':{'appCode':_0x35fa68[_0x13cd56(0xf8)],'sqlName':_0x22dbcd,'dbId':_0xae6863,'mode':_0x40099e,'localPath':_0x522983},'description':_0x13cd56(0xff)+_0x1bcfa5[_0x13cd56(0x108)]};},async 'execute'(_0x5e32f1){const _0x4304f2=a184_0x17ea2a,_0xa761bd=loadSqlProjectConfig(_0x5e32f1['appCode']),{sqlName:_0xa98927,dbId:_0xc27f41,dbName:_0x258e19,mode:_0x4438a}=await resolveSqlNewInputs(_0x5e32f1),_0x20f238=generateSqlTemplate(_0x4438a),_0x52447f=await createSqlQuery({'appCode':_0x5e32f1[_0x4304f2(0xf8)],'sqlName':_0xa98927,'dbId':_0xc27f41,'sqlContent':_0x20f238}),_0x289cfb=ensureRemoteSqlContent(_0x52447f),_0x3b4a46=_0x258e19||await getDbName(_0x5e32f1['appCode'],_0xc27f41)[_0x4304f2(0x11c)](()=>undefined),_0x3d1d18=buildSqlRelativePath(_0x52447f['sqlCode'],_0x52447f['sqlName'],_0x3b4a46,_0x4438a,_0xc27f41),_0x1fb5e6=_0xa761bd[_0x4304f2(0x108)]+'/'+_0x3d1d18,_0x3ad4e8=buildLocalSqlFileContent({'sqlCode':_0x52447f[_0x4304f2(0xe3)],'sqlName':_0x52447f[_0x4304f2(0xfc)],'dbId':_0x52447f['dbId']},_0x289cfb,{'dbName':_0x3b4a46,'mode':_0x4438a,'syncedAt':new Date()[_0x4304f2(0xe1)](),'description':_0x52447f['description']});if(await fileExists(_0x1fb5e6))throw CliErrors[_0x4304f2(0xef)](_0x4304f2(0xe6)+_0x1fb5e6);await ensureParentDirectory(_0x1fb5e6),await writeFile(_0x1fb5e6,_0x3ad4e8,_0x4304f2(0xfa));const _0xbe2d51=await readSqlLockFile(_0xa761bd['lockFilePath']),{lockData:_0x296bd4,appLock:_0x26471c}=ensureSqlLockScope(_0xbe2d51??createEmptySqlLock(),_0xa761bd[_0x4304f2(0xf8)],_0xa761bd['sqlRoot'],_0x4304f2(0xec));return _0x26471c[_0x4304f2(0xf6)][_0x52447f['sqlCode']]={...buildSqlLockEntry(_0x52447f,_0x289cfb,computeSqlContentHash(_0x3ad4e8),{'dbName':_0x3b4a46}),'path':_0x3d1d18,'mode':_0x4438a},_0x26471c[_0x4304f2(0x11a)]=new Date()[_0x4304f2(0xe1)](),await writeSqlLockFile(_0xa761bd['lockFilePath'],_0x296bd4),{'ok':!![],'data':{'id':_0x52447f['id'],'sqlCode':_0x52447f[_0x4304f2(0xe3)],'sqlName':_0x52447f[_0x4304f2(0xfc)],'dbId':_0x52447f['dbId'],'path':_0x1fb5e6,'mode':_0x4438a},'message':_0x4304f2(0x11d)+_0x52447f['sqlCode']};}};async function resolveSqlNewInputs(_0x426f26){const _0x531412=await resolveSqlNameInput(_0x426f26),{dbId:_0x46a44b,dbName:_0xfb3533}=await resolveDbSelection(_0x426f26),_0x6ed5a1=await resolveSqlModeInput(_0x426f26);return{'sqlName':_0x531412,'dbId':_0x46a44b,'dbName':_0xfb3533,'mode':_0x6ed5a1};}async function resolveSqlNameInput(_0x20a4c2){const _0x4a3bd8=a184_0x17ea2a,_0x416ea6=_0x20a4c2['str'](_0x4a3bd8(0xe7))[_0x4a3bd8(0xf0)]();if(_0x416ea6)return _0x416ea6;if(_0x20a4c2[_0x4a3bd8(0x10e)])throw CliErrors[_0x4a3bd8(0x106)](_0x4a3bd8(0xe7),_0x4a3bd8(0xe0));return(await input({'message':'请输入\x20SQL\x20名称:','validate':_0x284c8a=>_0x284c8a[_0x4a3bd8(0xf0)]()?!![]:'SQL\x20名称不能为空'}))[_0x4a3bd8(0xf0)]();}async function resolveDbSelection(_0x5faf8d){const _0x4270d0=a184_0x17ea2a,_0xd582c0=resolveProvidedDbId(_0x5faf8d);if(typeof _0xd582c0===_0x4270d0(0xf1)&&Number['isFinite'](_0xd582c0)&&_0xd582c0>0x0)return{'dbId':_0xd582c0,'dbName':await getDbName(_0x5faf8d['appCode'],_0xd582c0)[_0x4270d0(0x11c)](()=>undefined)};if(_0x5faf8d['nonInteractive'])throw CliErrors[_0x4270d0(0x106)](_0x4270d0(0xea),_0x4270d0(0xf5));const _0x2925f9=await listDatabases(_0x5faf8d[_0x4270d0(0xf8)])['catch'](()=>[]);if(_0x2925f9[_0x4270d0(0xe4)]===0x1)return{'dbId':_0x2925f9[0x0][_0x4270d0(0xfd)],'dbName':_0x2925f9[0x0]['dbName']};if(_0x2925f9['length']>0x1){const _0x2d39bc=await select({'message':'请选择目标数据库:','choices':[..._0x2925f9[_0x4270d0(0x115)](_0x734b2d=>({'name':_0x734b2d[_0x4270d0(0xe8)]+'\x20('+_0x734b2d[_0x4270d0(0xfd)]+')','value':serializeDbSelection(_0x734b2d)})),{'name':_0x4270d0(0x112),'value':'__manual__'}]});if(_0x2d39bc!==_0x4270d0(0x11b))return deserializeDbSelection(_0x2d39bc);}const _0x411f2c=await input({'message':_0x4270d0(0x119),'validate':_0x10c149=>{const _0x33d5cf=_0x4270d0,_0x1bf166=_0x10c149[_0x33d5cf(0xf0)]();if(!_0x1bf166)return _0x33d5cf(0x114);const _0x178a00=Number(_0x1bf166);if(!Number[_0x33d5cf(0x11e)](_0x178a00)||_0x178a00<=0x0)return _0x33d5cf(0xee);return!![];}});return{'dbId':Number(_0x411f2c['trim']())};}async function resolveSqlModeInput(_0x18b84f){const _0x26db8e=a184_0x17ea2a,_0x424721=_0x18b84f[_0x26db8e(0x113)](_0x26db8e(0x101))[_0x26db8e(0xf0)]();if(_0x424721===_0x26db8e(0xf4)||_0x424721===_0x26db8e(0x102))return _0x424721;if(_0x18b84f[_0x26db8e(0x10e)])throw CliErrors['flagMissing'](_0x26db8e(0x101),_0x26db8e(0x104));return await select({'message':_0x26db8e(0x118),'choices':[{'name':'普通\x20SQL(sql)','value':_0x26db8e(0xf4),'description':'适合直接执行的普通\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20语句'},{'name':_0x26db8e(0x111),'value':_0x26db8e(0x102),'description':_0x26db8e(0x110)}]});}function serializeDbSelection(_0x1e18e3){const _0x4bffb4=a184_0x17ea2a;return JSON[_0x4bffb4(0xe9)]({'dbId':_0x1e18e3['dbId'],'dbName':_0x1e18e3[_0x4bffb4(0xe8)]});}function deserializeDbSelection(_0x13ae92){const _0x217810=a184_0x17ea2a;try{const _0x5cef3b=JSON['parse'](_0x13ae92);if(typeof _0x5cef3b[_0x217810(0xfd)]==='number'&&Number[_0x217810(0x10f)](_0x5cef3b[_0x217810(0xfd)]))return{'dbId':_0x5cef3b[_0x217810(0xfd)],'dbName':_0x5cef3b[_0x217810(0xe8)]};}catch{}throw CliErrors['validation'](_0x217810(0x117)+_0x13ae92);}function resolveProvidedDbId(_0x3120cf){const _0x3bdb2b=a184_0x17ea2a,_0x22b77f=_0x3120cf[_0x3bdb2b(0x105)](_0x3bdb2b(0xea));if(typeof _0x22b77f===_0x3bdb2b(0xf1)&&Number[_0x3bdb2b(0x10f)](_0x22b77f))return _0x22b77f;return undefined;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a185_0x31f5(_0x4da8a0,_0x2f2550){_0x4da8a0=_0x4da8a0-0x173;const _0x4045f4=a185_0x4045();let _0x31f58e=_0x4045f4[_0x4da8a0];return _0x31f58e;}const a185_0x183710=a185_0x31f5;(function(_0x500f84,_0x485291){const _0x8eec9b=a185_0x31f5,_0x184740=_0x500f84();while(!![]){try{const _0x41beb0=parseInt(_0x8eec9b(0x199))/0x1+-parseInt(_0x8eec9b(0x191))/0x2*(parseInt(_0x8eec9b(0x188))/0x3)+parseInt(_0x8eec9b(0x192))/0x4+-parseInt(_0x8eec9b(0x194))/0x5+parseInt(_0x8eec9b(0x17f))/0x6+-parseInt(_0x8eec9b(0x184))/0x7+-parseInt(_0x8eec9b(0x196))/0x8*(parseInt(_0x8eec9b(0x18a))/0x9);if(_0x41beb0===_0x485291)break;else _0x184740['push'](_0x184740['shift']());}catch(_0x849a96){_0x184740['push'](_0x184740['shift']());}}}(a185_0x4045,0x87361));function a185_0x4045(){const _0x458538=['length','validation','SQL\x20lock\x20file\x20not\x20found.','1658262SUUfyf','replace','trashDir','/smartapi/custom/deleteUserCustomSql','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20','5041876EtjmVn','delete','sqls','toISOString','3LneEOV','sqlcode','65601DrFaix','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','startsWith','sqlRoot','Would\x20delete\x20SQL\x20','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','1170978sebtwi','4397448fRHOaE','fromEntries','833475VGurkS','projectRoot','128NGtNTo','sqlRootDir','entries','767162ZeXnTN','\x20(local\x20file\x20moved\x20to\x20trash)','filter','sql','str','lockFilePath','POST','lastSync','remoteId','appCode','trashedTo'];a185_0x4045=function(){return _0x458538;};return a185_0x4045();}import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{deleteSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{fileExists}from'../../core/bff/file-system.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDelete={'service':a185_0x183710(0x174),'command':a185_0x183710(0x185),'description':a185_0x183710(0x18f),'risk':'high-risk-write','flags':[SQLCODE_FLAG],async 'validate'(_0xab95ae){const _0x1ad1e0=a185_0x183710,_0x41443b=loadSqlProjectConfig(_0xab95ae[_0x1ad1e0(0x17a)]),_0x1d9f02=await readSqlLockFile(_0x41443b['lockFilePath']);if(!_0x1d9f02)throw CliErrors[_0x1ad1e0(0x17d)](_0x1ad1e0(0x190));},async 'dryRun'(_0x28b389){const _0x5d9dc4=a185_0x183710,_0x301dcb=loadSqlProjectConfig(_0x28b389[_0x5d9dc4(0x17a)]),_0x4a8b26=await readSqlLockFile(_0x301dcb[_0x5d9dc4(0x176)]);if(!_0x4a8b26)throw CliErrors[_0x5d9dc4(0x17d)](_0x5d9dc4(0x190));const {appLock:_0x38f9b1}=ensureSqlLockScope(_0x4a8b26,_0x28b389[_0x5d9dc4(0x17a)],_0x301dcb['sqlRoot'],_0x5d9dc4(0x185)),_0x8d57c9=_0x28b389[_0x5d9dc4(0x175)](_0x5d9dc4(0x189)),_0x5d8d4e=_0x38f9b1[_0x5d9dc4(0x186)][_0x8d57c9];if(!_0x5d8d4e)throw CliErrors[_0x5d9dc4(0x17d)](_0x5d9dc4(0x18b)+_0x8d57c9+'\x22.');return{'method':_0x5d9dc4(0x177),'url':_0x5d9dc4(0x182),'body':{'sqlCode':_0x8d57c9,'id':_0x5d8d4e[_0x5d9dc4(0x179)],'localPath':resolveLocalSqlFilePath(_0x301dcb,_0x8d57c9,_0x5d8d4e)},'description':_0x5d9dc4(0x18e)+_0x8d57c9+_0x5d9dc4(0x183)+_0x301dcb[_0x5d9dc4(0x181)]};},async 'execute'(_0xc8b155){const _0x3bedf2=a185_0x183710,_0x29f819=loadSqlProjectConfig(_0xc8b155['appCode']),_0x557630=await readSqlLockFile(_0x29f819[_0x3bedf2(0x176)]);if(!_0x557630)throw CliErrors[_0x3bedf2(0x17d)](_0x3bedf2(0x17e));const {lockData:_0x3f5116,appLock:_0x1ec4b3}=ensureSqlLockScope(_0x557630,_0xc8b155['appCode'],_0x29f819[_0x3bedf2(0x18d)],_0x3bedf2(0x185)),_0x3fe719=_0xc8b155[_0x3bedf2(0x175)](_0x3bedf2(0x189)),_0x373cae=_0x1ec4b3[_0x3bedf2(0x186)][_0x3fe719];if(!_0x373cae)throw CliErrors['validation'](_0x3bedf2(0x18b)+_0x3fe719+'\x22.');await deleteSqlQuery({'id':_0x373cae[_0x3bedf2(0x179)],'sqlCode':_0x3fe719}),_0x1ec4b3['sqls']=Object[_0x3bedf2(0x193)](Object[_0x3bedf2(0x198)](_0x1ec4b3[_0x3bedf2(0x186)])[_0x3bedf2(0x173)](([_0x9d8e3e])=>_0x9d8e3e!==_0x3fe719)),_0x1ec4b3[_0x3bedf2(0x178)]=new Date()[_0x3bedf2(0x187)](),await writeSqlLockFile(_0x29f819['lockFilePath'],_0x3f5116);const _0x3d0104=resolveLocalSqlFilePath(_0x29f819,_0x3fe719,_0x373cae);let _0x12d221;await fileExists(_0x3d0104)&&(_0x12d221=await moveToTrash(_0x29f819[_0x3bedf2(0x195)],_0x29f819[_0x3bedf2(0x181)],_0x3d0104),await cleanupEmptyDirectories(dirname(_0x3d0104),_0x29f819[_0x3bedf2(0x197)]));const _0x126829={'deleted':_0x3fe719,'remoteId':_0x373cae[_0x3bedf2(0x179)]};if(_0x12d221)_0x126829[_0x3bedf2(0x17b)]=_0x12d221;return{'ok':!![],'data':_0x126829,'message':'Deleted\x20'+_0x3fe719+(_0x12d221?_0x3bedf2(0x19a):'')};}};async function moveToTrash(_0x303227,_0x36a38d,_0x115749){const _0x2940fd=a185_0x183710,_0x3e3d03=new Date()[_0x2940fd(0x187)]()[_0x2940fd(0x180)](/[:.]/g,'-'),_0x3f3c3d=relative(_0x303227,_0x115749),_0x3c3509=join(_0x36a38d,_0x3e3d03,_0x3f3c3d);return await mkdir(dirname(_0x3c3509),{'recursive':!![]}),await rename(_0x115749,_0x3c3509),_0x3c3509;}async function cleanupEmptyDirectories(_0x5243d6,_0x1ac64e){const _0x176004=a185_0x183710;let _0xfd60c4=resolve(_0x5243d6);const _0xb0af75=resolve(_0x1ac64e);while(_0xfd60c4[_0x176004(0x18c)](''+_0xb0af75+sep)||_0xfd60c4===_0xb0af75){if(_0xfd60c4===_0xb0af75)return;try{const _0x5c3800=await readdir(_0xfd60c4);if(_0x5c3800[_0x176004(0x17c)]>0x0)return;await rmdir(_0xfd60c4);}catch{return;}_0xfd60c4=dirname(_0xfd60c4);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a186_0xc620(_0x5c03b0,_0xae9062){_0x5c03b0=_0x5c03b0-0x74;const _0x19cde9=a186_0x19cd();let _0xc6206d=_0x19cde9[_0x5c03b0];return _0xc6206d;}const a186_0x532156=a186_0xc620;(function(_0x4f0773,_0x5d265c){const _0xb3d94c=a186_0xc620,_0x4ce16b=_0x4f0773();while(!![]){try{const _0x3571b4=-parseInt(_0xb3d94c(0x81))/0x1+parseInt(_0xb3d94c(0x87))/0x2*(-parseInt(_0xb3d94c(0x86))/0x3)+-parseInt(_0xb3d94c(0x7a))/0x4*(parseInt(_0xb3d94c(0x7b))/0x5)+-parseInt(_0xb3d94c(0x82))/0x6*(parseInt(_0xb3d94c(0x84))/0x7)+-parseInt(_0xb3d94c(0x7d))/0x8*(-parseInt(_0xb3d94c(0x85))/0x9)+parseInt(_0xb3d94c(0x7e))/0xa+parseInt(_0xb3d94c(0x89))/0xb;if(_0x3571b4===_0x5d265c)break;else _0x4ce16b['push'](_0x4ce16b['shift']());}catch(_0x12cfd0){_0x4ce16b['push'](_0x4ce16b['shift']());}}}(a186_0x19cd,0xec4f0));import{getSqlQueryInfo}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';function a186_0x19cd(){const _0x1bc7d5=['read','dbId','detail','Return\x20full\x20raw\x20SQL\x20query\x20object','boolean','sqlcode','bool','sqlName','11420dftKwj','1080AddBaq','sql','48eiUaRg','1444960SPqwzb','appCode','verbose','410317MQQorg','1332QHaeVM','str','3409JXUWXQ','1091421ScimWE','3xAwtAp','107698zfclai','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','14132470QrKDGe'];a186_0x19cd=function(){return _0x1bc7d5;};return a186_0x19cd();}export const sqlDetail={'service':a186_0x532156(0x7c),'command':a186_0x532156(0x74),'description':a186_0x532156(0x88),'risk':a186_0x532156(0x8a),'flags':[SQLCODE_FLAG,{'name':a186_0x532156(0x80),'type':a186_0x532156(0x76),'description':a186_0x532156(0x75)}],async 'execute'(_0x42d9a3){const _0x46dcf6=a186_0x532156,_0x1707ab=await getSqlQueryInfo(_0x42d9a3[_0x46dcf6(0x7f)],_0x42d9a3[_0x46dcf6(0x83)](_0x46dcf6(0x77))),_0x4507b6=_0x42d9a3[_0x46dcf6(0x78)](_0x46dcf6(0x80));if(_0x4507b6)return{'ok':!![],'data':_0x1707ab};const _0x508a21=_0x1707ab['dbId']?await getDbName(_0x42d9a3['appCode'],_0x1707ab[_0x46dcf6(0x8b)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x1707ab['sqlCode'],'sqlName':_0x1707ab[_0x46dcf6(0x79)],'db':_0x508a21?_0x508a21+'\x20('+_0x1707ab[_0x46dcf6(0x8b)]+')':_0x1707ab['dbId']??'','description':_0x1707ab['description']??'','sqlContent':_0x1707ab['sqlContent']??''}};}};
|
package/lib/commands/sql/exec.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a187_0x332709=a187_0xfbeb;function a187_0x2909(){const _0x57319e=['read','6dfCkjq','execResult','str','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','1577415omACRA','172668XZdbcZ','Returned\x20','execError','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','1786284TRuMZG','params','\x20row(s)\x20in\x20','SQL\x20execution\x20failed','525338xFymuG','1944RVXPFw','length','isArray','4032081PagRxP','appCode','4382JmfeRA','now','sql','935456HcRJED'];a187_0x2909=function(){return _0x57319e;};return a187_0x2909();}(function(_0x433789,_0x57d8d9){const _0x106927=a187_0xfbeb,_0x1fee53=_0x433789();while(!![]){try{const _0x1f46da=parseInt(_0x106927(0x1c1))/0x1+-parseInt(_0x106927(0x1b9))/0x2*(-parseInt(_0x106927(0x1b4))/0x3)+parseInt(_0x106927(0x1bd))/0x4+-parseInt(_0x106927(0x1b8))/0x5+-parseInt(_0x106927(0x1c2))/0x6*(parseInt(_0x106927(0x1af))/0x7)+parseInt(_0x106927(0x1b2))/0x8+-parseInt(_0x106927(0x1ad))/0x9;if(_0x1f46da===_0x57d8d9)break;else _0x1fee53['push'](_0x1fee53['shift']());}catch(_0x42a607){_0x1fee53['push'](_0x1fee53['shift']());}}}(a187_0x2909,0x48119));function a187_0xfbeb(_0x405f64,_0xac21f5){_0x405f64=_0x405f64-0x1ad;const _0x2909e3=a187_0x2909();let _0xfbeb77=_0x2909e3[_0x405f64];return _0xfbeb77;}import{executeSql}from'../../core/api-client.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';import{parseJsonParams}from'../../utils/params.js';export const sqlExec={'service':a187_0x332709(0x1b1),'command':'exec','description':a187_0x332709(0x1bc),'risk':a187_0x332709(0x1b3),'flags':[SQLCODE_FLAG,{'name':a187_0x332709(0x1be),'type':'string','description':a187_0x332709(0x1b7)}],async 'execute'(_0x7ed86){const _0x3d5146=a187_0x332709,_0x34e2cd=parseJsonParams(_0x7ed86[_0x3d5146(0x1b6)]('params')),_0x1debaa=Date[_0x3d5146(0x1b0)](),_0x30a3dc=await executeSql(_0x7ed86[_0x3d5146(0x1ae)],_0x7ed86[_0x3d5146(0x1b6)]('sqlcode'),_0x34e2cd),_0x4a2b37=Date[_0x3d5146(0x1b0)]()-_0x1debaa,_0x375158=_0x30a3dc?.[_0x3d5146(0x1b5)]??_0x30a3dc,_0x27ae88=_0x30a3dc?.['execSuccess']??!![];if(!_0x27ae88)return{'ok':![],'data':{'error':_0x30a3dc?.[_0x3d5146(0x1bb)]||_0x3d5146(0x1c0),'elapsed':_0x4a2b37},'message':'SQL\x20execution\x20failed'};const _0x415c73=Array[_0x3d5146(0x1c4)](_0x375158)?_0x375158:[];return{'ok':!![],'data':{'rows':_0x415c73,'rowCount':_0x415c73['length'],'elapsed':_0x4a2b37},'message':_0x3d5146(0x1ba)+_0x415c73[_0x3d5146(0x1c3)]+_0x3d5146(0x1bf)+_0x4a2b37+'ms'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a188_0x1f53(_0x2d4372,_0x24cf84){_0x2d4372=_0x2d4372-0x1d0;const _0x8242a6=a188_0x8242();let _0x1f531e=_0x8242a6[_0x2d4372];return _0x1f531e;}(function(_0x1fe869,_0x12a86d){const _0x79f9d2=a188_0x1f53,_0x495677=_0x1fe869();while(!![]){try{const _0x30b67b=parseInt(_0x79f9d2(0x1d6))/0x1+parseInt(_0x79f9d2(0x1d8))/0x2*(parseInt(_0x79f9d2(0x1da))/0x3)+parseInt(_0x79f9d2(0x1d2))/0x4*(-parseInt(_0x79f9d2(0x1d9))/0x5)+parseInt(_0x79f9d2(0x1d0))/0x6+-parseInt(_0x79f9d2(0x1d7))/0x7*(-parseInt(_0x79f9d2(0x1d5))/0x8)+parseInt(_0x79f9d2(0x1d1))/0x9+-parseInt(_0x79f9d2(0x1d3))/0xa*(parseInt(_0x79f9d2(0x1d4))/0xb);if(_0x30b67b===_0x12a86d)break;else _0x495677['push'](_0x495677['shift']());}catch(_0x121ffa){_0x495677['push'](_0x495677['shift']());}}}(a188_0x8242,0xe5897));import{sqlList}from'../../commands/sql/list.js';function a188_0x8242(){const _0x2c5b55=['3165010CBJRHl','3745nHRrlH','3yfxQKj','9459684GUWamS','5490513waiGgJ','3996bhOSXI','4263890ZIJhRE','121qDEfgi','1552FeasxU','1554759wBErwW','38059WSxpGL'];a188_0x8242=function(){return _0x2c5b55;};return a188_0x8242();}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';import{sqlPush}from'../../commands/sql/push.js';import{sqlDelete}from'../../commands/sql/delete.js';export const sqlDefinitions=[sqlList,sqlDetail,sqlStatus,sqlCreate,sqlPush,sqlValidate,sqlExec,sqlPull,sqlDelete];
|
package/lib/commands/sql/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a189_0x4edeb5=a189_0x2dea;(function(_0x5a5c05,_0x2379a2){const _0xc1328e=a189_0x2dea,_0x3157d6=_0x5a5c05();while(!![]){try{const _0x408a40=-parseInt(_0xc1328e(0xf3))/0x1*(-parseInt(_0xc1328e(0xf2))/0x2)+parseInt(_0xc1328e(0xde))/0x3*(-parseInt(_0xc1328e(0xe1))/0x4)+parseInt(_0xc1328e(0xe3))/0x5+-parseInt(_0xc1328e(0xef))/0x6*(-parseInt(_0xc1328e(0xf1))/0x7)+-parseInt(_0xc1328e(0xe8))/0x8*(-parseInt(_0xc1328e(0xee))/0x9)+-parseInt(_0xc1328e(0xf5))/0xa+-parseInt(_0xc1328e(0xf7))/0xb;if(_0x408a40===_0x2379a2)break;else _0x3157d6['push'](_0x3157d6['shift']());}catch(_0xb0e348){_0x3157d6['push'](_0x3157d6['shift']());}}}(a189_0x43dd,0xc1203));function a189_0x2dea(_0x4275a5,_0x49ccc8){_0x4275a5=_0x4275a5-0xde;const _0x43dd98=a189_0x43dd();let _0x2dea6a=_0x43dd98[_0x4275a5];return _0x2dea6a;}import{listSqlQueries}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a189_0x43dd(){const _0x246f2a=['all','148cgYkzs','Page\x20number','5325085aMfvUw','length','dbId','No\x20custom\x20SQL\x20queries\x20found.','name','7032SHjzte','num','paging','tableData','pagesize','Found\x20','10818yMhBzN','6SPvrLP','sql','394898JIqYsR','52942MXNsCo','31dZROQR','sqlcode','14760260SLyCGb','Page\x20size','7737004lLZsoz','List\x20custom\x20SQL\x20queries','str','list','Filter\x20by\x20SQL\x20name','page','boolean','verbose','\x20SQL\x20queries\x20(total:\x20','2283MtnYLb','number'];a189_0x43dd=function(){return _0x246f2a;};return a189_0x43dd();}export const sqlList={'service':a189_0x4edeb5(0xf0),'command':a189_0x4edeb5(0xfa),'description':a189_0x4edeb5(0xf8),'risk':'read','flags':[SQLCODE_FLAG_OPTIONAL,{'name':'name','type':'string','description':a189_0x4edeb5(0xfb)},{'name':a189_0x4edeb5(0xfc),'type':a189_0x4edeb5(0xdf),'description':a189_0x4edeb5(0xe2),'default':0x1},{'name':a189_0x4edeb5(0xec),'type':a189_0x4edeb5(0xdf),'description':a189_0x4edeb5(0xf6)},{'name':a189_0x4edeb5(0xfe),'type':a189_0x4edeb5(0xfd),'description':'Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content'}],async 'execute'(_0x1198e5){const _0x54b436=a189_0x4edeb5,_0x507cf2=await listSqlQueries(_0x1198e5['appCode'],{'sqlCode':_0x1198e5[_0x54b436(0xf9)](_0x54b436(0xf4))||undefined,'sqlName':_0x1198e5[_0x54b436(0xf9)](_0x54b436(0xe7))||undefined,'currentPage':_0x1198e5[_0x54b436(0xe9)]('page'),'pageSize':_0x1198e5['num']('pagesize',0x32)}),_0x5868b3=_0x1198e5['bool'](_0x54b436(0xfe)),_0x3220c8=_0x507cf2[_0x54b436(0xeb)]??[],_0x21d3f5=_0x507cf2[_0x54b436(0xea)]?.['totalCount']??_0x3220c8[_0x54b436(0xe4)];let _0x5a9024;return _0x5868b3?_0x5a9024=_0x3220c8:_0x5a9024=await Promise[_0x54b436(0xe0)](_0x3220c8['map'](async _0x4ec019=>{const _0x522a8f=_0x54b436;let _0x2a5dee;try{_0x2a5dee=_0x4ec019[_0x522a8f(0xe5)]?await getDbName(_0x1198e5['appCode'],_0x4ec019[_0x522a8f(0xe5)]):undefined;}catch{}return{'sqlCode':_0x4ec019['sqlCode'],'sqlName':_0x4ec019['sqlName'],'description':_0x4ec019['description']??'','db':_0x2a5dee?_0x2a5dee+'\x20('+_0x4ec019[_0x522a8f(0xe5)]+')':_0x4ec019['dbId']??''};})),{'ok':!![],'data':_0x5a9024,'message':_0x3220c8[_0x54b436(0xe4)]===0x0?_0x54b436(0xe6):_0x54b436(0xed)+_0x3220c8[_0x54b436(0xe4)]+_0x54b436(0xff)+_0x21d3f5+').'};}};
|