@lovrabet/rabetbase-cli 2.3.16-beta.4 → 2.3.16-beta.6
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.d.ts +9 -0
- package/lib/api/api-doc.js +1 -1
- package/lib/api/fetch-model-list.d.ts +2 -0
- package/lib/api/fetch-model-list.js +1 -1
- package/lib/api/generate-api-file.d.ts +8 -0
- package/lib/api/generate-api-file.js +1 -1
- package/lib/auth/auth-server-ui.d.ts +13 -0
- package/lib/auth/auth-server-ui.js +1 -1
- package/lib/auth/auth-server.d.ts +25 -0
- package/lib/auth/auth-server.js +1 -1
- package/lib/auth/constant.d.ts +2 -0
- package/lib/auth/constant.js +1 -1
- package/lib/auth/get-cookie.d.ts +1 -0
- package/lib/auth/get-cookie.js +1 -1
- package/lib/auth/get-session-user.d.ts +51 -0
- package/lib/auth/get-session-user.js +1 -1
- package/lib/auth/is-session-valid.d.ts +1 -0
- package/lib/auth/is-session-valid.js +1 -1
- package/lib/auth/login-success-html.d.ts +5 -0
- package/lib/auth/login-success-html.js +1 -1
- package/lib/auth/logout.d.ts +1 -0
- package/lib/auth/logout.js +1 -1
- package/lib/cli-flags.d.ts +12 -0
- package/lib/cli-flags.js +1 -1
- package/lib/cli.d.ts +2 -0
- package/lib/cli.js +1 -1
- package/lib/commands/api/generate.d.ts +2 -0
- package/lib/commands/api/generate.js +1 -1
- package/lib/commands/api/index.d.ts +2 -0
- package/lib/commands/api/index.js +1 -1
- package/lib/commands/api/list.d.ts +2 -0
- package/lib/commands/api/list.js +1 -1
- package/lib/commands/api/pull.d.ts +2 -0
- package/lib/commands/api/pull.js +1 -1
- package/lib/commands/api/shared.d.ts +18 -0
- package/lib/commands/api/shared.js +1 -1
- package/lib/commands/app/index.d.ts +5 -0
- package/lib/commands/app/index.js +1 -1
- package/lib/commands/app/list.d.ts +10 -0
- package/lib/commands/app/list.js +1 -1
- package/lib/commands/app/members-list.d.ts +2 -0
- package/lib/commands/app/members-list.js +1 -1
- package/lib/commands/app/remote-directory.d.ts +11 -0
- package/lib/commands/app/remote-directory.js +1 -1
- package/lib/commands/app/shared.d.ts +46 -0
- package/lib/commands/app/shared.js +1 -1
- package/lib/commands/app-config/delete.d.ts +2 -0
- package/lib/commands/app-config/delete.js +1 -1
- package/lib/commands/app-config/get.d.ts +2 -0
- package/lib/commands/app-config/get.js +1 -1
- package/lib/commands/app-config/index.d.ts +2 -0
- package/lib/commands/app-config/index.js +1 -1
- package/lib/commands/app-config/list.d.ts +2 -0
- package/lib/commands/app-config/list.js +1 -1
- package/lib/commands/app-config/set.d.ts +2 -0
- package/lib/commands/app-config/set.js +1 -1
- package/lib/commands/app-config/shared.d.ts +105 -0
- package/lib/commands/app-config/shared.js +1 -1
- package/lib/commands/auth/index.d.ts +2 -0
- package/lib/commands/auth/index.js +1 -1
- package/lib/commands/bff/create.d.ts +4 -0
- package/lib/commands/bff/create.js +1 -1
- package/lib/commands/bff/delete.d.ts +2 -0
- package/lib/commands/bff/delete.js +1 -1
- package/lib/commands/bff/detail.d.ts +2 -0
- package/lib/commands/bff/detail.js +1 -1
- package/lib/commands/bff/index.d.ts +5 -0
- package/lib/commands/bff/index.js +1 -1
- package/lib/commands/bff/list.d.ts +2 -0
- package/lib/commands/bff/list.js +1 -1
- package/lib/commands/bff/pull.d.ts +2 -0
- package/lib/commands/bff/pull.js +1 -1
- package/lib/commands/bff/push.d.ts +2 -0
- package/lib/commands/bff/push.js +1 -1
- package/lib/commands/bff/status.d.ts +2 -0
- package/lib/commands/bff/status.js +1 -1
- package/lib/commands/cli-skill/index.d.ts +8 -0
- package/lib/commands/cli-skill/index.js +1 -1
- package/lib/commands/cli-update.d.ts +2 -0
- package/lib/commands/cli-update.js +1 -1
- package/lib/commands/codegen/index.d.ts +2 -0
- package/lib/commands/codegen/index.js +1 -1
- package/lib/commands/codegen/sdk.d.ts +2 -0
- package/lib/commands/codegen/sdk.js +1 -1
- package/lib/commands/codegen/sql.d.ts +2 -0
- package/lib/commands/codegen/sql.js +1 -1
- package/lib/commands/common/app-registry.d.ts +17 -0
- package/lib/commands/common/app-registry.js +1 -1
- package/lib/commands/common/app-selector.d.ts +17 -0
- package/lib/commands/common/app-selector.js +1 -1
- package/lib/commands/common/async-task.d.ts +11 -0
- package/lib/commands/common/async-task.js +1 -1
- package/lib/commands/common/dry-run.d.ts +12 -0
- package/lib/commands/common/dry-run.js +1 -1
- package/lib/commands/common/flags.d.ts +26 -0
- package/lib/commands/common/flags.js +1 -1
- package/lib/commands/common/local-file.d.ts +6 -0
- package/lib/commands/common/local-file.js +1 -1
- package/lib/commands/common/validate.d.ts +13 -0
- package/lib/commands/common/validate.js +1 -1
- package/lib/commands/config/get.d.ts +5 -0
- package/lib/commands/config/get.js +1 -1
- package/lib/commands/config/index.d.ts +5 -0
- package/lib/commands/config/index.js +1 -1
- package/lib/commands/config/list.d.ts +5 -0
- package/lib/commands/config/list.js +1 -1
- package/lib/commands/config/set.d.ts +5 -0
- package/lib/commands/config/set.js +1 -1
- package/lib/commands/config/shared.d.ts +16 -0
- package/lib/commands/config/shared.js +1 -1
- package/lib/commands/data/filter.d.ts +7 -0
- package/lib/commands/data/filter.js +1 -1
- package/lib/commands/data/getOne.d.ts +7 -0
- package/lib/commands/data/getOne.js +1 -1
- package/lib/commands/data/index.d.ts +8 -0
- package/lib/commands/data/index.js +1 -1
- package/lib/commands/data/shared.d.ts +33 -0
- package/lib/commands/data/shared.js +1 -1
- package/lib/commands/dataset/business-group-update.d.ts +18 -0
- package/lib/commands/dataset/business-group-update.js +1 -1
- package/lib/commands/dataset/capability.d.ts +11 -0
- package/lib/commands/dataset/capability.js +1 -1
- package/lib/commands/dataset/delete.d.ts +2 -0
- package/lib/commands/dataset/delete.js +1 -1
- package/lib/commands/dataset/detail.d.ts +2 -0
- package/lib/commands/dataset/detail.js +1 -1
- package/lib/commands/dataset/extend-update.d.ts +26 -0
- package/lib/commands/dataset/extend-update.js +1 -1
- package/lib/commands/dataset/field-update.d.ts +27 -0
- package/lib/commands/dataset/field-update.js +1 -1
- package/lib/commands/dataset/generate.d.ts +3 -0
- package/lib/commands/dataset/generate.js +1 -1
- package/lib/commands/dataset/index.d.ts +2 -0
- package/lib/commands/dataset/index.js +1 -1
- package/lib/commands/dataset/list.d.ts +2 -0
- package/lib/commands/dataset/list.js +1 -1
- package/lib/commands/dataset/operations.d.ts +2 -0
- package/lib/commands/dataset/operations.js +1 -1
- package/lib/commands/dataset/relation-audit.d.ts +2 -0
- package/lib/commands/dataset/relation-audit.js +1 -1
- package/lib/commands/dataset/relation-create.d.ts +2 -0
- package/lib/commands/dataset/relation-create.js +1 -1
- package/lib/commands/dataset/relation-delete.d.ts +2 -0
- package/lib/commands/dataset/relation-delete.js +1 -1
- package/lib/commands/dataset/relation-shared.d.ts +128 -0
- package/lib/commands/dataset/relation-shared.js +1 -1
- package/lib/commands/dataset/relation-update.d.ts +2 -0
- package/lib/commands/dataset/relation-update.js +1 -1
- package/lib/commands/dataset/relations.d.ts +53 -0
- package/lib/commands/dataset/relations.js +1 -1
- package/lib/commands/dataset/rename.d.ts +17 -0
- package/lib/commands/dataset/rename.js +1 -1
- package/lib/commands/dataset/restore.d.ts +2 -0
- package/lib/commands/dataset/restore.js +1 -1
- package/lib/commands/db/analysis-batching.d.ts +30 -0
- package/lib/commands/db/analysis-batching.js +1 -1
- package/lib/commands/db/analyze-batch-plan.d.ts +2 -0
- package/lib/commands/db/analyze-batch-plan.js +1 -1
- package/lib/commands/db/analyze-cancel.d.ts +2 -0
- package/lib/commands/db/analyze-cancel.js +1 -1
- package/lib/commands/db/analyze-start.d.ts +2 -0
- package/lib/commands/db/analyze-start.js +1 -1
- package/lib/commands/db/analyze-status.d.ts +2 -0
- package/lib/commands/db/analyze-status.js +1 -1
- package/lib/commands/db/create.d.ts +2 -0
- package/lib/commands/db/create.js +1 -1
- package/lib/commands/db/delete.d.ts +2 -0
- package/lib/commands/db/delete.js +1 -1
- package/lib/commands/db/detail.d.ts +2 -0
- package/lib/commands/db/detail.js +1 -1
- package/lib/commands/db/diff.d.ts +2 -0
- package/lib/commands/db/diff.js +1 -1
- package/lib/commands/db/index.d.ts +5 -0
- package/lib/commands/db/index.js +1 -1
- package/lib/commands/db/list.d.ts +2 -0
- package/lib/commands/db/list.js +1 -1
- package/lib/commands/db/shared.d.ts +15 -0
- package/lib/commands/db/shared.js +1 -1
- package/lib/commands/db/tables.d.ts +2 -0
- package/lib/commands/db/tables.js +1 -1
- package/lib/commands/db/test.d.ts +2 -0
- package/lib/commands/db/test.js +1 -1
- package/lib/commands/db/update.d.ts +2 -0
- package/lib/commands/db/update.js +1 -1
- package/lib/commands/doctor.d.ts +2 -0
- package/lib/commands/doctor.js +1 -1
- package/lib/commands/file/index.d.ts +2 -0
- package/lib/commands/file/index.js +1 -1
- package/lib/commands/init/index.d.ts +11 -0
- package/lib/commands/init/index.js +1 -1
- package/lib/commands/issue/index.d.ts +2 -0
- package/lib/commands/issue/index.js +1 -1
- package/lib/commands/issue/nudge.d.ts +23 -0
- package/lib/commands/issue/nudge.js +1 -1
- package/lib/commands/issue/report.d.ts +2 -0
- package/lib/commands/issue/report.js +1 -1
- package/lib/commands/issue/shared.d.ts +32 -0
- package/lib/commands/issue/shared.js +1 -1
- package/lib/commands/kb/create.d.ts +2 -0
- package/lib/commands/kb/create.js +1 -1
- package/lib/commands/kb/delete.d.ts +2 -0
- package/lib/commands/kb/delete.js +1 -1
- package/lib/commands/kb/detail.d.ts +2 -0
- package/lib/commands/kb/detail.js +1 -1
- package/lib/commands/kb/index.d.ts +2 -0
- package/lib/commands/kb/index.js +1 -1
- package/lib/commands/kb/list.d.ts +2 -0
- package/lib/commands/kb/list.js +1 -1
- package/lib/commands/kb/shared.d.ts +33 -0
- package/lib/commands/kb/shared.js +1 -1
- package/lib/commands/kb/update.d.ts +2 -0
- package/lib/commands/kb/update.js +1 -1
- package/lib/commands/logs/index.d.ts +5 -0
- package/lib/commands/logs/index.js +1 -1
- package/lib/commands/menu/asset-update.d.ts +2 -0
- package/lib/commands/menu/asset-update.js +1 -1
- package/lib/commands/menu/delete.d.ts +2 -0
- package/lib/commands/menu/delete.js +1 -1
- package/lib/commands/menu/external-link-create.d.ts +3 -0
- package/lib/commands/menu/external-link-create.js +1 -1
- package/lib/commands/menu/external-link-update.d.ts +2 -0
- package/lib/commands/menu/external-link-update.js +1 -1
- package/lib/commands/menu/group-create.d.ts +2 -0
- package/lib/commands/menu/group-create.js +1 -1
- package/lib/commands/menu/group-update.d.ts +2 -0
- package/lib/commands/menu/group-update.js +1 -1
- package/lib/commands/menu/index.d.ts +17 -0
- package/lib/commands/menu/index.js +1 -1
- package/lib/commands/menu/list.d.ts +2 -0
- package/lib/commands/menu/list.js +1 -1
- package/lib/commands/menu/move.d.ts +2 -0
- package/lib/commands/menu/move.js +1 -1
- package/lib/commands/menu/regroup-start.d.ts +2 -0
- package/lib/commands/menu/regroup-start.js +1 -1
- package/lib/commands/menu/rename.d.ts +2 -0
- package/lib/commands/menu/rename.js +1 -1
- package/lib/commands/menu/shared/compare-table.d.ts +27 -0
- package/lib/commands/menu/shared/compare-table.js +1 -1
- package/lib/commands/menu/shared/delete-plan.d.ts +51 -0
- package/lib/commands/menu/shared/delete-plan.js +1 -1
- package/lib/commands/menu/shared/facts.d.ts +12 -0
- package/lib/commands/menu/shared/facts.js +1 -1
- package/lib/commands/menu/shared/index.d.ts +12 -0
- package/lib/commands/menu/shared/index.js +1 -1
- package/lib/commands/menu/shared/inquirer.d.ts +10 -0
- package/lib/commands/menu/shared/inquirer.js +1 -1
- package/lib/commands/menu/shared/local-pages.d.ts +12 -0
- package/lib/commands/menu/shared/local-pages.js +1 -1
- package/lib/commands/menu/shared/logic.d.ts +28 -0
- package/lib/commands/menu/shared/logic.js +1 -1
- package/lib/commands/menu/shared/mutations.d.ts +69 -0
- package/lib/commands/menu/shared/mutations.js +1 -1
- package/lib/commands/menu/shared/service.d.ts +17 -0
- package/lib/commands/menu/shared/service.js +1 -1
- package/lib/commands/menu/shared/sync-core.d.ts +7 -0
- package/lib/commands/menu/shared/sync-core.js +1 -1
- package/lib/commands/menu/shared/types.d.ts +162 -0
- package/lib/commands/menu/shared/update-core.d.ts +11 -0
- package/lib/commands/menu/shared/update-core.js +1 -1
- package/lib/commands/menu/shared/valid-url.d.ts +6 -0
- package/lib/commands/menu/shared/valid-url.js +1 -1
- package/lib/commands/menu/sync.d.ts +2 -0
- package/lib/commands/menu/sync.js +1 -1
- package/lib/commands/notification/config-list.d.ts +2 -0
- package/lib/commands/notification/config-list.js +1 -1
- package/lib/commands/notification/index.d.ts +2 -0
- package/lib/commands/notification/index.js +1 -1
- package/lib/commands/ocr/index.d.ts +2 -0
- package/lib/commands/ocr/index.js +1 -1
- package/lib/commands/page/generate-start.d.ts +2 -0
- package/lib/commands/page/generate-start.js +1 -1
- package/lib/commands/page/generate-status.d.ts +2 -0
- package/lib/commands/page/generate-status.js +1 -1
- package/lib/commands/page/index.d.ts +2 -0
- package/lib/commands/page/index.js +1 -1
- package/lib/commands/page/pull.d.ts +2 -0
- package/lib/commands/page/pull.js +1 -1
- package/lib/commands/page/push.d.ts +2 -0
- package/lib/commands/page/push.js +1 -1
- package/lib/commands/page/relation-audit.d.ts +2 -0
- package/lib/commands/page/relation-audit.js +1 -1
- package/lib/commands/page/restore.d.ts +2 -0
- package/lib/commands/page/restore.js +1 -1
- package/lib/commands/page/shared.d.ts +105 -0
- package/lib/commands/page/shared.js +1 -1
- package/lib/commands/page/standard-page-status.d.ts +2 -0
- package/lib/commands/page/standard-page-status.js +1 -1
- package/lib/commands/page/sync.d.ts +2 -0
- package/lib/commands/page/sync.js +1 -1
- package/lib/commands/permit/index.d.ts +2 -0
- package/lib/commands/permit/index.js +1 -1
- package/lib/commands/permit/page-get.d.ts +2 -0
- package/lib/commands/permit/page-get.js +1 -1
- package/lib/commands/permit/page-set.d.ts +2 -0
- package/lib/commands/permit/page-set.js +1 -1
- package/lib/commands/permit/role-apis-set.d.ts +2 -0
- package/lib/commands/permit/role-apis-set.js +1 -1
- package/lib/commands/permit/role-menus-set.d.ts +2 -0
- package/lib/commands/permit/role-menus-set.js +1 -1
- package/lib/commands/permit/role-menus.d.ts +2 -0
- package/lib/commands/permit/role-menus.js +1 -1
- package/lib/commands/permit/shared.d.ts +74 -0
- package/lib/commands/permit/shared.js +1 -1
- package/lib/commands/project/create/enhanced-guided-create.d.ts +7 -0
- package/lib/commands/project/create/enhanced-guided-create.js +1 -1
- package/lib/commands/project/create/format-elapsed.d.ts +1 -0
- package/lib/commands/project/create/format-elapsed.js +1 -1
- package/lib/commands/project/create/main.d.ts +6 -0
- package/lib/commands/project/create/main.js +1 -1
- package/lib/commands/project/create/non-interactive.d.ts +9 -0
- package/lib/commands/project/create/non-interactive.js +1 -1
- package/lib/commands/project/create/project-template-path.d.ts +4 -0
- package/lib/commands/project/create/project-template-path.js +1 -1
- package/lib/commands/project/create/use-copy-project-template.d.ts +1 -0
- package/lib/commands/project/create/use-copy-project-template.js +1 -1
- package/lib/commands/project/create/use-format-code.d.ts +1 -0
- package/lib/commands/project/create/use-format-code.js +1 -1
- package/lib/commands/project/create/use-install-dependencies.d.ts +1 -0
- package/lib/commands/project/create/use-install-dependencies.js +1 -1
- package/lib/commands/project/index.d.ts +2 -0
- package/lib/commands/project/index.js +1 -1
- package/lib/commands/project/upgrade.d.ts +1 -0
- package/lib/commands/project/upgrade.js +1 -1
- package/lib/commands/registry.d.ts +66 -0
- package/lib/commands/registry.js +1 -1
- package/lib/commands/role/create.d.ts +2 -0
- package/lib/commands/role/create.js +1 -1
- package/lib/commands/role/delete.d.ts +2 -0
- package/lib/commands/role/delete.js +1 -1
- package/lib/commands/role/detail.d.ts +2 -0
- package/lib/commands/role/detail.js +1 -1
- package/lib/commands/role/index.d.ts +2 -0
- package/lib/commands/role/index.js +1 -1
- package/lib/commands/role/list.d.ts +2 -0
- package/lib/commands/role/list.js +1 -1
- package/lib/commands/role/shared.d.ts +107 -0
- package/lib/commands/role/shared.js +1 -1
- package/lib/commands/role/update.d.ts +2 -0
- package/lib/commands/role/update.js +1 -1
- package/lib/commands/role/user-add.d.ts +2 -0
- package/lib/commands/role/user-add.js +1 -1
- package/lib/commands/role/user-remove.d.ts +2 -0
- package/lib/commands/role/user-remove.js +1 -1
- package/lib/commands/role/user-resolve.d.ts +2 -0
- package/lib/commands/role/user-resolve.js +1 -1
- package/lib/commands/run/index.d.ts +2 -0
- package/lib/commands/run/index.js +1 -1
- package/lib/commands/schema.d.ts +5 -0
- package/lib/commands/schema.js +1 -1
- package/lib/commands/sql/create.d.ts +10 -0
- package/lib/commands/sql/create.js +1 -1
- package/lib/commands/sql/delete.d.ts +5 -0
- package/lib/commands/sql/delete.js +1 -1
- package/lib/commands/sql/detail.d.ts +2 -0
- package/lib/commands/sql/detail.js +1 -1
- package/lib/commands/sql/exec.d.ts +2 -0
- package/lib/commands/sql/exec.js +1 -1
- package/lib/commands/sql/index.d.ts +5 -0
- package/lib/commands/sql/index.js +1 -1
- package/lib/commands/sql/list.d.ts +2 -0
- package/lib/commands/sql/list.js +1 -1
- package/lib/commands/sql/pull.d.ts +5 -0
- package/lib/commands/sql/pull.js +1 -1
- package/lib/commands/sql/push.d.ts +5 -0
- package/lib/commands/sql/push.js +1 -1
- package/lib/commands/sql/shared.d.ts +23 -0
- package/lib/commands/sql/shared.js +1 -1
- package/lib/commands/sql/status.d.ts +5 -0
- package/lib/commands/sql/status.js +1 -1
- package/lib/commands/sql/validate.d.ts +2 -0
- package/lib/commands/sql/validate.js +1 -1
- package/lib/commands/task/index.d.ts +2 -0
- package/lib/commands/task/index.js +1 -1
- package/lib/commands/task/status.d.ts +2 -0
- package/lib/commands/task/status.js +1 -1
- package/lib/commands/tenant/index.d.ts +2 -0
- package/lib/commands/tenant/index.js +1 -1
- package/lib/commands/tenant/members-list.d.ts +2 -0
- package/lib/commands/tenant/members-list.js +1 -1
- package/lib/commands/tenant/shared.d.ts +10 -0
- package/lib/commands/tenant/shared.js +1 -1
- package/lib/commands/workspace/add.d.ts +6 -0
- package/lib/commands/workspace/add.js +1 -1
- package/lib/commands/workspace/index.d.ts +11 -0
- package/lib/commands/workspace/index.js +1 -1
- package/lib/commands/workspace/remove.d.ts +6 -0
- package/lib/commands/workspace/remove.js +1 -1
- package/lib/config/schema.d.ts +50 -0
- package/lib/config/schema.js +1 -1
- package/lib/constant/cdn.d.ts +1 -0
- package/lib/constant/cdn.js +1 -1
- package/lib/constant/cli.d.ts +34 -0
- package/lib/constant/cli.js +1 -1
- package/lib/constant/defaults.d.ts +10 -0
- package/lib/constant/defaults.js +1 -1
- package/lib/constant/domain.d.ts +14 -0
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.d.ts +11 -0
- package/lib/constant/env.js +1 -1
- package/lib/constant/output.d.ts +1 -0
- package/lib/constant/output.js +1 -1
- package/lib/constant/paths.d.ts +5 -0
- package/lib/constant/paths.js +1 -1
- package/lib/constant/risk.d.ts +1 -0
- package/lib/constant/risk.js +1 -1
- package/lib/context/app-resolver.d.ts +36 -0
- package/lib/context/app-resolver.js +1 -1
- package/lib/context/auth-resolver.d.ts +5 -0
- package/lib/context/auth-resolver.js +1 -1
- package/lib/context/config-loader.d.ts +61 -0
- package/lib/context/config-loader.js +1 -1
- package/lib/context.d.ts +102 -0
- package/lib/context.js +1 -1
- package/lib/core/alias-resolver.d.ts +31 -0
- package/lib/core/alias-resolver.js +1 -1
- package/lib/core/api-client.d.ts +1018 -0
- package/lib/core/api-client.js +1 -1
- package/lib/core/bff/config.d.ts +8 -0
- package/lib/core/bff/config.js +1 -1
- package/lib/core/bff/file-system.d.ts +28 -0
- package/lib/core/bff/file-system.js +1 -1
- package/lib/core/bff/hash.d.ts +7 -0
- package/lib/core/bff/hash.js +1 -1
- package/lib/core/bff/lock.d.ts +25 -0
- package/lib/core/bff/lock.js +1 -1
- package/lib/core/bff/types.d.ts +92 -0
- package/lib/core/bff/utils.d.ts +25 -0
- package/lib/core/bff/utils.js +1 -1
- package/lib/core/db-resolver.d.ts +43 -0
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/page/file-system.d.ts +6 -0
- package/lib/core/page/file-system.js +1 -1
- package/lib/core/page/hash.d.ts +4 -0
- package/lib/core/page/hash.js +1 -1
- package/lib/core/page/lock.d.ts +8 -0
- package/lib/core/page/lock.js +1 -1
- package/lib/core/page/types.d.ts +22 -0
- package/lib/core/sql-index-auditor.d.ts +33 -0
- package/lib/core/sql-index-auditor.js +1 -1
- package/lib/core/sql-sync/config.d.ts +7 -0
- package/lib/core/sql-sync/config.js +1 -1
- package/lib/core/sql-sync/file-system.d.ts +7 -0
- package/lib/core/sql-sync/file-system.js +1 -1
- package/lib/core/sql-sync/hash.d.ts +5 -0
- package/lib/core/sql-sync/hash.js +1 -1
- package/lib/core/sql-sync/lock.d.ts +14 -0
- package/lib/core/sql-sync/lock.js +1 -1
- package/lib/core/sql-sync/types.d.ts +43 -0
- package/lib/core/sql-sync/utils.d.ts +10 -0
- package/lib/core/sql-sync/utils.js +1 -1
- package/lib/core/sql-validator.d.ts +34 -0
- package/lib/core/sql-validator.js +1 -1
- package/lib/errors.d.ts +3 -0
- package/lib/errors.js +1 -1
- package/lib/framework/build-all-flags.d.ts +2 -0
- package/lib/framework/build-all-flags.js +1 -1
- package/lib/framework/error-output.d.ts +9 -0
- package/lib/framework/error-output.js +1 -1
- package/lib/framework/explicit-yes.d.ts +3 -0
- package/lib/framework/explicit-yes.js +1 -1
- package/lib/framework/flags.d.ts +3 -0
- package/lib/framework/flags.js +1 -1
- package/lib/framework/help.d.ts +4 -0
- package/lib/framework/help.js +1 -1
- package/lib/framework/index.d.ts +11 -0
- package/lib/framework/index.js +1 -1
- package/lib/framework/output.d.ts +15 -0
- package/lib/framework/output.js +1 -1
- package/lib/framework/response.d.ts +2 -0
- package/lib/framework/response.js +1 -1
- package/lib/framework/runner-alias.d.ts +14 -0
- package/lib/framework/runner-alias.js +1 -1
- package/lib/framework/runner.d.ts +36 -0
- package/lib/framework/runner.js +1 -1
- package/lib/framework/schema-export.d.ts +3 -0
- package/lib/framework/schema-export.js +1 -1
- package/lib/framework/types.d.ts +63 -0
- package/lib/framework/types.js +1 -1
- package/lib/generated/build-info.d.ts +4 -0
- package/lib/generated/build-info.js +1 -1
- package/lib/help.d.ts +1 -0
- package/lib/help.js +1 -1
- package/lib/runtime/confirmation.d.ts +4 -0
- package/lib/runtime/confirmation.js +1 -0
- package/lib/runtime/event.d.ts +5 -0
- package/lib/runtime/event.js +1 -0
- package/lib/runtime/index.d.ts +7 -0
- package/lib/runtime/index.js +1 -0
- package/lib/runtime/queue.d.ts +5 -0
- package/lib/runtime/queue.js +1 -0
- package/lib/runtime/resolve.d.ts +8 -0
- package/lib/runtime/resolve.js +1 -0
- package/lib/runtime/types.d.ts +50 -0
- package/lib/runtime/types.js +1 -0
- package/lib/skills/main.d.ts +41 -0
- package/lib/skills/main.js +1 -1
- package/lib/skills/npx-skills-add.d.ts +99 -0
- package/lib/skills/npx-skills-add.js +1 -1
- package/lib/skills/skill-presence.d.ts +44 -0
- package/lib/skills/skill-presence.js +1 -1
- package/lib/telemetry/cli-command-trace.d.ts +12 -0
- package/lib/telemetry/cli-command-trace.js +1 -1
- package/lib/telemetry/cli-help-trace.d.ts +8 -0
- package/lib/telemetry/cli-help-trace.js +1 -1
- package/lib/telemetry/ensure-cli-otel-config.d.ts +6 -0
- package/lib/telemetry/ensure-cli-otel-config.js +1 -1
- package/lib/telemetry/register-otel-exit-shutdown.d.ts +3 -0
- package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
- package/lib/telemetry/send-cli-trace-log.d.ts +17 -0
- package/lib/telemetry/send-cli-trace-log.js +1 -1
- package/lib/telemetry/send-platform-issue-collect-log.d.ts +26 -0
- package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
- package/lib/types/index.d.ts +93 -0
- package/lib/utils/ai_config.d.ts +47 -0
- package/lib/utils/ai_config.js +1 -1
- package/lib/utils/apply-jq-filter.d.ts +1 -0
- package/lib/utils/apply-jq-filter.js +1 -1
- package/lib/utils/cdn-config.d.ts +42 -0
- package/lib/utils/cdn-config.js +1 -1
- package/lib/utils/check-sdk-version.d.ts +23 -0
- package/lib/utils/check-sdk-version.js +1 -1
- package/lib/utils/cli-version-check.d.ts +37 -0
- package/lib/utils/cli-version-check.js +1 -1
- package/lib/utils/cli-version-policy.d.ts +9 -0
- package/lib/utils/cli-version-policy.js +1 -1
- package/lib/utils/config.d.ts +42 -0
- package/lib/utils/config.js +1 -1
- package/lib/utils/copy-directory.d.ts +1 -0
- package/lib/utils/copy-directory.js +1 -1
- package/lib/utils/entity-with-id.d.ts +30 -0
- package/lib/utils/entity-with-id.js +1 -1
- package/lib/utils/file-utils.d.ts +25 -0
- package/lib/utils/file-utils.js +1 -1
- package/lib/utils/guides-cdn.d.ts +80 -0
- package/lib/utils/guides-cdn.js +1 -1
- package/lib/utils/http-client.d.ts +30 -0
- package/lib/utils/http-client.js +1 -1
- package/lib/utils/is-non-interactive.d.ts +7 -0
- package/lib/utils/is-non-interactive.js +1 -1
- package/lib/utils/logger.d.ts +62 -0
- package/lib/utils/logger.js +1 -1
- package/lib/utils/params.d.ts +15 -0
- package/lib/utils/params.js +1 -1
- package/lib/utils/platform.d.ts +21 -0
- package/lib/utils/platform.js +1 -1
- package/lib/utils/rules-cdn.d.ts +38 -0
- package/lib/utils/rules-cdn.js +1 -1
- package/lib/utils/sleep.d.ts +1 -0
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.d.ts +55 -0
- package/lib/utils/template-replacer.js +1 -1
- package/lib/utils/update-notice.d.ts +10 -0
- package/lib/utils/update-notice.js +1 -1
- package/lib/utils/version.d.ts +1 -0
- package/lib/utils/version.js +1 -1
- package/lib/utils/with-active-cookie.d.ts +1 -0
- package/lib/utils/with-active-cookie.js +1 -1
- package/lib/utils/write-cli-side-channel.d.ts +6 -0
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +9 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a169_0xdfbb37=a169_0x18d2;(function(_0x2b8940,_0x92571a){const _0x5753cc=a169_0x18d2,_0xc74409=_0x2b8940();while(!![]){try{const _0x5ad707=-parseInt(_0x5753cc(0xb6))/0x1+-parseInt(_0x5753cc(0xbe))/0x2+parseInt(_0x5753cc(0xa6))/0x3+parseInt(_0x5753cc(0xb3))/0x4+-parseInt(_0x5753cc(0xac))/0x5*(parseInt(_0x5753cc(0xbb))/0x6)+parseInt(_0x5753cc(0xb1))/0x7*(parseInt(_0x5753cc(0xc0))/0x8)+-parseInt(_0x5753cc(0xb5))/0x9*(-parseInt(_0x5753cc(0xb2))/0xa);if(_0x5ad707===_0x92571a)break;else _0xc74409['push'](_0xc74409['shift']());}catch(_0x213a1c){_0xc74409['push'](_0xc74409['shift']());}}}(a169_0x403f,0xdeb32));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=a169_0xdfbb37(0xaf);function a169_0x403f(){const _0x5e608f=['validation','\x20(id=','2536566TjzkTu','Pass\x20at\x20least\x20one\x20of\x20--name\x20/\x20--remark.','1645792ZbIfxh','appCode','355272DdlfGA','roleName','update','--name\x20cannot\x20be\x20empty.','Role\x20name\x20cannot\x20exceed\x2064\x20characters.','length','1021475cMkWJB','trim','Updated\x20role\x20','/smartapi/permit/role/update','write','56qAyYbS','1803370Bcacgf','7155360ESoLFG','POST','45lMEuWp','1661395qXdQCX','remark','num','flag','name','18JdUGGI'];a169_0x403f=function(){return _0x5e608f;};return a169_0x403f();}function a169_0x18d2(_0x257215,_0x364ba9){_0x257215=_0x257215-0xa5;const _0x403f3c=a169_0x403f();let _0x18d23d=_0x403f3c[_0x257215];return _0x18d23d;}function readPatch(_0x13b641){const _0x471123=a169_0xdfbb37,_0x400af1=_0x13b641['flag'](_0x471123(0xba)),_0x233f11=_0x13b641[_0x471123(0xb9)](_0x471123(0xb7)),_0x28904e={};if(_0x400af1!==undefined&&_0x400af1!==null){const _0x25bafb=String(_0x400af1)[_0x471123(0xad)]();if(!_0x25bafb)throw CliErrors[_0x471123(0xbc)](_0x471123(0xa9));if(_0x25bafb[_0x471123(0xab)]>0x40)throw CliErrors[_0x471123(0xbc)](_0x471123(0xaa));_0x28904e[_0x471123(0xa7)]=_0x25bafb;}_0x233f11!==undefined&&_0x233f11!==null&&(_0x28904e[_0x471123(0xb7)]=String(_0x233f11));if(_0x28904e[_0x471123(0xa7)]===undefined&&_0x28904e[_0x471123(0xb7)]===undefined)throw CliErrors[_0x471123(0xbc)]('Nothing\x20to\x20update.',_0x471123(0xbf));return _0x28904e;}export const roleUpdate={'service':'role','command':a169_0xdfbb37(0xa8),'description':'Update\x20a\x20CUSTOM\x20role\x27s\x20name/remark\x20(DEV/ADMIN\x20rejected)','risk':a169_0xdfbb37(0xb0),'flags':[ROLE_ID_FLAG,{...REMARK_FLAG},{'name':a169_0xdfbb37(0xba),'type':'string','required':![],'description':'New\x20role\x20name'},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x32a4e7){readPatch(_0x32a4e7);},async 'dryRun'(_0x2bdcd7){const _0x7d911a=a169_0xdfbb37,_0x2cec36=_0x2bdcd7[_0x7d911a(0xb8)]('id'),_0x388ce2=readPatch(_0x2bdcd7),_0x14652f=await getRoleById(_0x2bdcd7[_0x7d911a(0xa5)],_0x2cec36);return assertCustomRole(_0x14652f,'update'),asDryRunResult({'operation':_0x7d911a(0xa8),'selector':{'appCode':_0x2bdcd7[_0x7d911a(0xa5)],'roleId':_0x2cec36,'roleName':_0x14652f[_0x7d911a(0xa7)]},'before':projectRole(_0x14652f),'after':projectRole({..._0x14652f,..._0x388ce2[_0x7d911a(0xa7)]!==undefined?{'roleName':_0x388ce2['roleName']}:{},..._0x388ce2['remark']!==undefined?{'remark':_0x388ce2[_0x7d911a(0xb7)]}:{}}),'dryRun':!![],'backend':{'method':_0x7d911a(0xb4),'path':UPDATE_PATH},'warnings':[]},{'method':_0x7d911a(0xb4),'url':UPDATE_PATH});},async 'execute'(_0x349904){const _0x15f7b0=a169_0xdfbb37,_0x5371b9=_0x349904[_0x15f7b0(0xb8)]('id'),_0x31173b=readPatch(_0x349904),_0x27be5f=await getRoleById(_0x349904[_0x15f7b0(0xa5)],_0x5371b9);assertCustomRole(_0x27be5f,_0x15f7b0(0xa8)),await updateAppRole({'id':_0x5371b9,'appCode':_0x349904[_0x15f7b0(0xa5)],..._0x31173b[_0x15f7b0(0xa7)]!==undefined?{'roleName':_0x31173b[_0x15f7b0(0xa7)]}:{},..._0x31173b[_0x15f7b0(0xb7)]!==undefined?{'remark':_0x31173b[_0x15f7b0(0xb7)]}:{}});const _0x341178=await getRoleById(_0x349904[_0x15f7b0(0xa5)],_0x5371b9);return{'ok':!![],'data':{'operation':_0x15f7b0(0xa8),'selector':{'appCode':_0x349904[_0x15f7b0(0xa5)],'roleId':_0x5371b9,'roleName':_0x341178['roleName']},'before':projectRole(_0x27be5f),'after':projectRole(_0x341178),'dryRun':![],'backend':{'method':_0x15f7b0(0xb4),'path':UPDATE_PATH},'warnings':[]},'message':_0x15f7b0(0xae)+_0x341178[_0x15f7b0(0xa7)]+_0x15f7b0(0xbd)+_0x5371b9+')'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a170_0x53ee88=a170_0x4a16;function a170_0x549f(){const _0x27255b=['2IDlZyn','4332pcUITH','POST','122868swHfLd','657763BZdCUZ','1342530hoxQDv','75somHHd','14888nFawYm','roleName','47368hQPozS','Added\x20user\x20','Add\x20a\x20user\x20to\x20a\x20role\x20(internal\x20merge\x20+\x20anti-drift);\x20requires\x20--yes','559cAInMk','\x20already\x20in\x20role\x20','\x20to\x20role\x20','10mIlJcj','appCode','3630BiuUwL','selector','5160331HoZvYr','userId','user-add','2177kOJacY','role'];a170_0x549f=function(){return _0x27255b;};return a170_0x549f();}(function(_0x556795,_0x119359){const _0x9015df=a170_0x4a16,_0x2ce141=_0x556795();while(!![]){try{const _0x365bc5=-parseInt(_0x9015df(0xf7))/0x1*(-parseInt(_0x9015df(0xf3))/0x2)+parseInt(_0x9015df(0xe1))/0x3*(-parseInt(_0x9015df(0xe4))/0x4)+parseInt(_0x9015df(0xec))/0x5*(parseInt(_0x9015df(0xf4))/0x6)+-parseInt(_0x9015df(0xf1))/0x7*(parseInt(_0x9015df(0xe2))/0x8)+parseInt(_0x9015df(0xf8))/0x9+parseInt(_0x9015df(0xea))/0xa*(parseInt(_0x9015df(0xee))/0xb)+parseInt(_0x9015df(0xf6))/0xc*(-parseInt(_0x9015df(0xe7))/0xd);if(_0x365bc5===_0x119359)break;else _0x2ce141['push'](_0x2ce141['shift']());}catch(_0x4c3d2a){_0x2ce141['push'](_0x2ce141['shift']());}}}(a170_0x549f,0x76708));function a170_0x4a16(_0x31d269,_0x4d3bcc){_0x31d269=_0x31d269-0xe1;const _0x549fd7=a170_0x549f();let _0x4a1608=_0x549fd7[_0x31d269];return _0x4a1608;}import{updateRoleUsers}from'../../core/api-client.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{EXPECT_USER_COUNT_FLAG,prepareUserMutation,ROLE_REF_FLAG,UPDATE_USER_LIST_PATH,USER_REF_FLAG}from'../../commands/role/shared.js';export const roleUserAdd={'service':a170_0x53ee88(0xf2),'command':a170_0x53ee88(0xf0),'description':a170_0x53ee88(0xe6),'risk':'high-risk-write','flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x126574){const _0x4e7f60=a170_0x53ee88,{mutation:_0xd64f28}=await prepareUserMutation(_0x126574,_0x4e7f60(0xf0),!![]);return asDryRunResult(_0xd64f28,{'method':_0x4e7f60(0xf5),'url':UPDATE_USER_LIST_PATH});},async 'execute'(_0x7bb7c){const _0x177826=a170_0x53ee88,{roleList:_0x96ba3,mutation:_0x55ba78,changed:_0x56cdd0}=await prepareUserMutation(_0x7bb7c,_0x177826(0xf0),![]);return _0x56cdd0&&await updateRoleUsers(_0x7bb7c[_0x177826(0xeb)],_0x96ba3),{'ok':!![],'data':_0x55ba78,'message':_0x56cdd0?_0x177826(0xe5)+_0x55ba78[_0x177826(0xed)][_0x177826(0xef)]+_0x177826(0xe9)+_0x55ba78['selector']['roleName']:'No\x20change:\x20user\x20'+_0x55ba78[_0x177826(0xed)][_0x177826(0xef)]+_0x177826(0xe8)+_0x55ba78[_0x177826(0xed)][_0x177826(0xe3)]};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a171_0x54fcab=a171_0xd8f5;(function(_0xec5e10,_0x10ef8f){const _0x1ee03a=a171_0xd8f5,_0x35c93b=_0xec5e10();while(!![]){try{const _0x53377b=parseInt(_0x1ee03a(0x177))/0x1*(parseInt(_0x1ee03a(0x174))/0x2)+-parseInt(_0x1ee03a(0x173))/0x3*(parseInt(_0x1ee03a(0x183))/0x4)+-parseInt(_0x1ee03a(0x179))/0x5*(-parseInt(_0x1ee03a(0x17f))/0x6)+-parseInt(_0x1ee03a(0x180))/0x7+parseInt(_0x1ee03a(0x185))/0x8+parseInt(_0x1ee03a(0x17c))/0x9*(-parseInt(_0x1ee03a(0x189))/0xa)+parseInt(_0x1ee03a(0x17e))/0xb;if(_0x53377b===_0x10ef8f)break;else _0x35c93b['push'](_0x35c93b['shift']());}catch(_0x9386e2){_0x35c93b['push'](_0x35c93b['shift']());}}}(a171_0x3371,0xa8068));import{updateRoleUsers}from'../../core/api-client.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a171_0xd8f5(_0x28911e,_0x30ec5e){_0x28911e=_0x28911e-0x173;const _0x337161=a171_0x3371();let _0xd8f535=_0x337161[_0x28911e];return _0xd8f535;}import{asDryRunResult}from'../../commands/common/dry-run.js';import{EXPECT_USER_COUNT_FLAG,prepareUserMutation,ROLE_REF_FLAG,UPDATE_USER_LIST_PATH,USER_REF_FLAG}from'../../commands/role/shared.js';export const roleUserRemove={'service':'role','command':a171_0x54fcab(0x184),'description':a171_0x54fcab(0x181),'risk':a171_0x54fcab(0x182),'flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x2c6356){const _0x1834a5=a171_0x54fcab,{mutation:_0x2630e5}=await prepareUserMutation(_0x2c6356,_0x1834a5(0x184),!![]);return asDryRunResult(_0x2630e5,{'method':_0x1834a5(0x17b),'url':UPDATE_USER_LIST_PATH});},async 'execute'(_0x5f36fc){const _0x51d734=a171_0x54fcab,{roleList:_0x46d70d,mutation:_0x215dcf,changed:_0x5c5e85}=await prepareUserMutation(_0x5f36fc,_0x51d734(0x184),![]);return _0x5c5e85&&await updateRoleUsers(_0x5f36fc[_0x51d734(0x187)],_0x46d70d),{'ok':!![],'data':_0x215dcf,'message':_0x5c5e85?_0x51d734(0x175)+_0x215dcf['selector'][_0x51d734(0x17a)]+_0x51d734(0x176)+_0x215dcf[_0x51d734(0x188)][_0x51d734(0x186)]:_0x51d734(0x178)+_0x215dcf['selector'][_0x51d734(0x17a)]+_0x51d734(0x17d)+_0x215dcf[_0x51d734(0x188)][_0x51d734(0x186)]};}};function a171_0x3371(){const _0x49337d=['31326NhOMno','4751754gXpqtT','Remove\x20a\x20user\x20from\x20a\x20role\x20(internal\x20merge\x20+\x20anti-drift);\x20requires\x20--yes','high-risk-write','4653892RtWrRQ','user-remove','1529008VRdkJz','roleName','appCode','selector','12990HlfsGR','3YAchus','1010736RHArgg','Removed\x20user\x20','\x20from\x20role\x20','2WnjVxX','No\x20change:\x20user\x20','355icjWtX','userId','POST','4878SGsHEq','\x20not\x20in\x20role\x20','18282352ESrfRy'];a171_0x3371=function(){return _0x49337d;};return a171_0x3371();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a172_0x19ba(){const _0x1e3336=['userId','6hEmrNr','2860767bpzUNH','2591729awGMCi','username','704918KHaNfB','user-resolve','1228875SrfEHH','read','nickname','2827770ZnQVQy','str','name','flagMissing','5757544ZhWCbP','1074188ReRAEN','6jcOOcO','Resolve\x20a\x20nickname/username\x20to\x20a\x20userId\x20(tenant\x20member\x20directory)','2tAbQew'];a172_0x19ba=function(){return _0x1e3336;};return a172_0x19ba();}const a172_0x5f2e45=a172_0xf736;(function(_0x3502a2,_0x2c6a71){const _0x288f0e=a172_0xf736,_0x367a21=_0x3502a2();while(!![]){try{const _0x110fe8=parseInt(_0x288f0e(0x1af))/0x1*(parseInt(_0x288f0e(0x1b5))/0x2)+parseInt(_0x288f0e(0x1ad))/0x3*(parseInt(_0x288f0e(0x1ac))/0x4)+parseInt(_0x288f0e(0x1b7))/0x5+parseInt(_0x288f0e(0x1b1))/0x6*(-parseInt(_0x288f0e(0x1b3))/0x7)+-parseInt(_0x288f0e(0x1ab))/0x8+parseInt(_0x288f0e(0x1b2))/0x9+-parseInt(_0x288f0e(0x1ba))/0xa;if(_0x110fe8===_0x2c6a71)break;else _0x367a21['push'](_0x367a21['shift']());}catch(_0x24dc9c){_0x367a21['push'](_0x367a21['shift']());}}}(a172_0x19ba,0x69b25));function a172_0xf736(_0xc2cfc0,_0xca1826){_0xc2cfc0=_0xc2cfc0-0x1ab;const _0x19ba04=a172_0x19ba();let _0xf736e8=_0x19ba04[_0xc2cfc0];return _0xf736e8;}import{CliErrors}from'../../errors.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{resolveUserRef,USER_NAME_FLAG}from'../../commands/role/shared.js';export const roleUserResolve={'service':'role','command':a172_0x5f2e45(0x1b6),'description':a172_0x5f2e45(0x1ae),'risk':a172_0x5f2e45(0x1b8),'flags':[USER_NAME_FLAG,APPCODE_FLAG_OPTIONAL],async 'validate'(_0x37e1ca){const _0x2964bb=a172_0x5f2e45;if(!_0x37e1ca['str']('name')['trim']())throw CliErrors[_0x2964bb(0x1bd)](_0x2964bb(0x1bc),'Pass\x20--name\x20<nickname|username>.');},async 'execute'(_0x1d5abe){const _0x592d95=a172_0x5f2e45,_0x3805e3=_0x1d5abe[_0x592d95(0x1bb)](_0x592d95(0x1bc))['trim'](),_0x43a63e=await resolveUserRef(_0x3805e3);return{'ok':!![],'data':{'user':{'userId':_0x43a63e[_0x592d95(0x1b0)],'username':_0x43a63e[_0x592d95(0x1b4)],'nickname':_0x43a63e[_0x592d95(0x1b9)],'matchedBy':_0x43a63e['matchedBy']}},'message':'Resolved\x20\x22'+_0x3805e3+'\x22\x20→\x20userId\x20'+_0x43a63e[_0x592d95(0x1b0)]};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a173_0x54a909=a173_0x349c;(function(_0x214b82,_0xc6898c){const _0x56d8b3=a173_0x349c,_0x584142=_0x214b82();while(!![]){try{const _0x477594=parseInt(_0x56d8b3(0xc1))/0x1+-parseInt(_0x56d8b3(0xae))/0x2*(-parseInt(_0x56d8b3(0xb4))/0x3)+parseInt(_0x56d8b3(0xd6))/0x4+-parseInt(_0x56d8b3(0xe4))/0x5+parseInt(_0x56d8b3(0xd8))/0x6+-parseInt(_0x56d8b3(0xcd))/0x7+parseInt(_0x56d8b3(0xc3))/0x8*(parseInt(_0x56d8b3(0xda))/0x9);if(_0x477594===_0xc6898c)break;else _0x584142['push'](_0x584142['shift']());}catch(_0x52928b){_0x584142['push'](_0x584142['shift']());}}}(a173_0x5d51,0x88f38));function a173_0x349c(_0xa27ee0,_0x58937b){_0xa27ee0=_0xa27ee0-0xab;const _0x5d5118=a173_0x5d51();let _0x349c94=_0x5d5118[_0xa27ee0];return _0x349c94;}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',a173_0x54a909(0xc7)]);function readPackageScripts(_0x18ddd6){const _0xd27841=a173_0x54a909,_0x433598=resolve(_0x18ddd6,'package.json');if(!existsSync(_0x433598))return null;try{const _0x2d814d=JSON[_0xd27841(0xca)](readFileSync(_0x433598,_0xd27841(0xe2)));return _0x2d814d[_0xd27841(0xd3)]??{};}catch{return null;}}function detectPackageManager(_0x333539){const _0xa9bad5=a173_0x54a909;if(existsSync(resolve(_0x333539,'bun.lockb'))||existsSync(resolve(_0x333539,_0xa9bad5(0xc5))))return _0xa9bad5(0xd9);if(existsSync(resolve(_0x333539,_0xa9bad5(0xb1))))return _0xa9bad5(0xb9);if(existsSync(resolve(_0x333539,_0xa9bad5(0xc2))))return _0xa9bad5(0xbd);return'npm';}function a173_0x5d51(){const _0xb2dc37=['42984oZgTLO','yarn.lock','1074760IQVTFw','belowMinimum','bun.lock','watch','dev','join','\x20run\x20preview','parse','\x22\x20not\x20found\x20in\x20package.json.','.bin','620158BXWDuV','vite\x20preview\x20exited\x20with\x20code\x20','run','\x20\x20EXAMPLES','length','\x20run\x20build','scripts','has','error','711428IXleHa','\x20\x20\x20\x20','3430578omNBNe','bun','45kGFEoL','\x20run\x20preview\x20--watch','vite\x20build\x20--watch\x20exited\x20with\x20code\x20','Script\x20\x22','boolean','keys','Available:\x20','log','utf-8','No\x20package.json\x20found\x20in\x20current\x20directory.','5398985GfRSLC','\x0a\x20\x20Usage:\x20','all','close','Script\x20name\x20defined\x20in\x20package.json','88338cRZRvy','cwd','build','pnpm-lock.yaml','\x20run\x20','slice','18IMMQlO','needsUpgrade','inherit','validation','push','pnpm','preview','node_modules','\x0a\x20\x20Available\x20scripts:\x0a','yarn','args','No\x20scripts\x20defined\x20in\x20package.json.','\x20exited\x20with\x20code\x20'];a173_0x5d51=function(){return _0xb2dc37;};return a173_0x5d51();}async function versionCheck(_0x4f4f75){const _0x223a46=a173_0x54a909,_0x504467=await checkCliVersion();(_0x504467[_0x223a46(0xb5)]||_0x504467[_0x223a46(0xc4)])&&(printCliUpgradeWarning(_0x504467),assertCliVersionSupported(_0x504467));const _0x3582e3=await checkSdkVersion(_0x4f4f75);if(_0x3582e3[_0x223a46(0xb5)])printSdkUpgradeWarning(_0x3582e3);}function spawnScript(_0x5513e9,_0x18d30d,_0x3c5946,_0x5c119f){return new Promise((_0x38484c,_0xe09456)=>{const _0xcbc8a6=a173_0x349c,_0x288278=[_0xcbc8a6(0xcf),_0x18d30d,..._0x3c5946],_0x58b6b5=spawn(_0x5513e9,_0x288278,{'cwd':_0x5c119f,'stdio':_0xcbc8a6(0xb6),'shell':!![],'env':{...process.env,'PATH':''+join(_0x5c119f,_0xcbc8a6(0xbb),'.bin')+delimiter+process.env.PATH}});_0x58b6b5['on']('close',_0x32a184=>{const _0x18b581=_0xcbc8a6;if(_0x32a184===0x0||_0x32a184===null)_0x38484c();else _0xe09456(new Error(_0x5513e9+_0x18b581(0xb2)+_0x18d30d+_0x18b581(0xc0)+_0x32a184));}),_0x58b6b5['on'](_0xcbc8a6(0xd5),_0xe09456);});}function spawnViteBuildWatch(_0x3e3eaf){return new Promise((_0x2b1d4b,_0x559c52)=>{const _0xf853db=a173_0x349c,_0x1b0ee6=spawn('vite',[_0xf853db(0xb0),'--watch'],{'cwd':_0x3e3eaf,'stdio':_0xf853db(0xb6),'shell':!![],'env':{...process.env,'PATH':''+join(_0x3e3eaf,_0xf853db(0xbb),_0xf853db(0xcc))+delimiter+process.env.PATH}});_0x1b0ee6['on'](_0xf853db(0xac),_0x2c4cf6=>{const _0xf8149c=_0xf853db;if(_0x2c4cf6===0x0||_0x2c4cf6===null)_0x2b1d4b();else _0x559c52(new Error(_0xf8149c(0xdc)+_0x2c4cf6));}),_0x1b0ee6['on'](_0xf853db(0xd5),_0x559c52);});}function spawnVitePreview(_0x580986){return new Promise((_0x1bd58d,_0x29b133)=>{const _0x4737c8=a173_0x349c,_0x4f269b=spawn('vite',['preview'],{'cwd':_0x580986,'stdio':_0x4737c8(0xb6),'shell':!![],'env':{...process.env,'PATH':''+join(_0x580986,_0x4737c8(0xbb),_0x4737c8(0xcc))+delimiter+process.env.PATH}});_0x4f269b['on'](_0x4737c8(0xac),_0x1ac896=>{const _0x4efc83=_0x4737c8;if(_0x1ac896===0x0||_0x1ac896===null)_0x1bd58d();else _0x29b133(new Error(_0x4efc83(0xce)+_0x1ac896));}),_0x4f269b['on'](_0x4737c8(0xd5),_0x29b133);});}const runFlags=[{'name':a173_0x54a909(0xc6),'type':a173_0x54a909(0xde),'description':'Enable\x20watch\x20mode\x20for\x20preview','default':![]}];export const runDefinition={'service':a173_0x54a909(0xcf),'command':a173_0x54a909(0xcf),'description':'Run\x20a\x20package.json\x20script','risk':'high-risk-write','requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':'script','description':a173_0x54a909(0xad),'required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x567ca3=a173_0x54a909,_0x1d5e63=[];return _0x1d5e63[_0x567ca3(0xb8)](_0x567ca3(0xd0)),_0x1d5e63['push'](_0x567ca3(0xd7)+CLI_BIN_NAME+'\x20run\x20start'),_0x1d5e63['push']('\x20\x20\x20\x20'+CLI_BIN_NAME+_0x567ca3(0xd2)),_0x1d5e63[_0x567ca3(0xb8)]('\x20\x20\x20\x20'+CLI_BIN_NAME+_0x567ca3(0xc9)),_0x1d5e63['push'](_0x567ca3(0xd7)+CLI_BIN_NAME+_0x567ca3(0xdb)),_0x1d5e63[_0x567ca3(0xc8)]('\x0a');},async 'execute'(_0x5ae788){const _0x573166=a173_0x54a909,_0x28099f=process[_0x573166(0xaf)](),_0x461350=_0x5ae788[_0x573166(0xbe)][0x0],_0x1fb6c5=_0x5ae788['args'][_0x573166(0xb3)](0x1),_0x328012=readPackageScripts(_0x28099f);if(!_0x328012)throw CliErrors['validation'](_0x573166(0xe3));if(!_0x461350){const _0x310081=Object['keys'](_0x328012);if(_0x310081[_0x573166(0xd1)]===0x0)console[_0x573166(0xe1)](_0x573166(0xbf));else{console['log'](_0x573166(0xbc));for(const _0x2e9650 of _0x310081){console['log'](_0x573166(0xd7)+_0x2e9650);}console[_0x573166(0xe1)](_0x573166(0xe5)+CLI_BIN_NAME+'\x20run\x20<script>\x0a');}return{'ok':!![]};}if(!_0x328012[_0x461350])throw CliErrors[_0x573166(0xb7)](_0x573166(0xdd)+_0x461350+_0x573166(0xcb),_0x573166(0xe0)+(Object[_0x573166(0xdf)](_0x328012)['join'](',\x20')||'(none)'));const _0x3c6f41=detectPackageManager(_0x28099f);VERSION_CHECK_SCRIPTS[_0x573166(0xd4)](_0x461350)&&await versionCheck(_0x28099f);if(_0x461350===_0x573166(0xba)&&_0x5ae788['bool']('watch'))return await Promise[_0x573166(0xab)]([spawnViteBuildWatch(_0x28099f),spawnVitePreview(_0x28099f)]),{'ok':!![]};return await spawnScript(_0x3c6f41,_0x461350,_0x1fb6c5,_0x28099f),{'ok':!![]};}};
|
package/lib/commands/schema.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a174_0x58bcba=a174_0x1ffb;(function(_0x3c808f,_0x38b752){const _0x27b360=a174_0x1ffb,_0x24684c=_0x3c808f();while(!![]){try{const _0x40ea7f=-parseInt(_0x27b360(0xc3))/0x1+-parseInt(_0x27b360(0xc1))/0x2*(parseInt(_0x27b360(0xc5))/0x3)+-parseInt(_0x27b360(0xc9))/0x4*(parseInt(_0x27b360(0xce))/0x5)+parseInt(_0x27b360(0xcf))/0x6+parseInt(_0x27b360(0xcb))/0x7*(parseInt(_0x27b360(0xc6))/0x8)+parseInt(_0x27b360(0xca))/0x9+-parseInt(_0x27b360(0xcc))/0xa*(parseInt(_0x27b360(0xcd))/0xb);if(_0x40ea7f===_0x38b752)break;else _0x24684c['push'](_0x24684c['shift']());}catch(_0x21307b){_0x24684c['push'](_0x24684c['shift']());}}}(a174_0x562d,0x18e19));import{buildSchemaPayload}from'../framework/schema-export.js';async function execute(_0x142385){const _0x50a676=await buildSchemaPayload();return{'ok':!![],'data':_0x50a676};}function a174_0x562d(){const _0x281302=['json','981gKHpaP','1352064hqMsrg','Export\x20machine-readable\x20command\x20schema\x20(JSON)','read','52SJJhEK','1584891tXBWMa','7SdduHY','2199030dREkqO','11EhZtWP','48295GRAMXM','1166160gvpOum','schema','374YPhqHU','export','30935DDyZez'];a174_0x562d=function(){return _0x281302;};return a174_0x562d();}function a174_0x1ffb(_0x73a4d3,_0x4c0d6c){_0x73a4d3=_0x73a4d3-0xc0;const _0x562d83=a174_0x562d();let _0x1ffbfa=_0x562d83[_0x73a4d3];return _0x1ffbfa;}export const schemaDefinition={'service':a174_0x58bcba(0xc0),'command':a174_0x58bcba(0xc2),'description':a174_0x58bcba(0xc7),'risk':a174_0x58bcba(0xc8),'requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':a174_0x58bcba(0xc4),'flags':[],'execute':execute};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* sql create —— 声明式命令:创建新的本地自定义 SQL 资产
|
|
3
|
+
*
|
|
4
|
+
* 说明:
|
|
5
|
+
* - 当前阶段不支持完全离线创建
|
|
6
|
+
* - 会先调用远端创建 SQL,拿到服务端生成的 sqlCode
|
|
7
|
+
* - 再落本地文件与 sql.lock.json
|
|
8
|
+
*/
|
|
9
|
+
import type { CommandDefinition } from "../../framework/types.js";
|
|
10
|
+
export declare const sqlCreate: CommandDefinition;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a175_0x5f2026=a175_0x40db;(function(_0x3c73f3,_0x452553){const _0x95de78=a175_0x40db,_0x12b1f2=_0x3c73f3();while(!![]){try{const _0x2f6219=parseInt(_0x95de78(0xfa))/0x1+parseInt(_0x95de78(0x117))/0x2*(-parseInt(_0x95de78(0x109))/0x3)+-parseInt(_0x95de78(0x12d))/0x4*(parseInt(_0x95de78(0x103))/0x5)+parseInt(_0x95de78(0x10d))/0x6+parseInt(_0x95de78(0x102))/0x7*(-parseInt(_0x95de78(0x11f))/0x8)+-parseInt(_0x95de78(0x118))/0x9+parseInt(_0x95de78(0xf5))/0xa*(parseInt(_0x95de78(0x13b))/0xb);if(_0x2f6219===_0x452553)break;else _0x12b1f2['push'](_0x12b1f2['shift']());}catch(_0x5520ba){_0x12b1f2['push'](_0x12b1f2['shift']());}}}(a175_0x29f2,0x37da7));import{writeFile}from'node:fs/promises';import{input,select}from'@inquirer/prompts';import{createSqlQuery}from'../../core/api-client.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{buildSqlRelativePath}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function a175_0x29f2(){const _0x25faa7=['3DOVmUj','map','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','✎\x20手动输入\x20dbId','2136684HzvFZG','SQL\x20query\x20display\x20name','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','nonInteractive','toISOString','string','lastSync','parse','普通\x20SQL(sql)','str','163810MWTnzN','1823022iGQbXq','appCode','sqlCode','validation','请选择本地\x20SQL\x20模式:','POST','number','1544cVoEde','</select>','SELECT\x201\x20AS\x20id;','Target\x20database\x20ID','File\x20already\x20exists:\x20','length','sqlName','flag','flagMissing','Created\x20SQL\x20query\x20','dbId\x20必须为正整数','utf8','sqlRootDir','name','4QcJyJO','SQL\x20名称不能为空','mode','Local\x20SQL\x20file\x20mode','sql','/smartapi/custom/saveUserCustomSql','__manual__','write','sqlRoot','Invalid\x20database\x20selection\x20payload:\x20','join','lockFilePath','create','db-id','11GHWbrp','trim','dbId','912090RkrlKx','dbId\x20不能为空','适合直接执行的普通\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20语句','description','dbName','289506WcyilQ','MyBatis\x20XML(mybatisXml)','请选择目标数据库:','stringify','new','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','mybatisXml','请输入\x20SQL\x20名称:','5082AbsgcE','417365IKEewu','isFinite','<server-generated-sqlCode>','适合带动态标签的\x20MyBatis\x20XML\x20SQL','catch','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>'];a175_0x29f2=function(){return _0x25faa7;};return a175_0x29f2();}function generateSqlTemplate(_0x10e6bf){const _0x22aed3=a175_0x40db;if(_0x10e6bf==='mybatisXml')return[_0x22aed3(0x108),'\x20\x20SELECT\x201\x20AS\x20id',_0x22aed3(0x120),''][_0x22aed3(0x137)]('\x0a');return[_0x22aed3(0x121),'']['join']('\x0a');}export const sqlCreate={'service':a175_0x5f2026(0x131),'command':a175_0x5f2026(0x139),'description':'Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','risk':a175_0x5f2026(0x134),'flags':[{'name':a175_0x5f2026(0x12c),'type':a175_0x5f2026(0x112),'description':a175_0x5f2026(0x10e)},{'name':'db-id','type':a175_0x5f2026(0x11e),'description':a175_0x5f2026(0x122)},{'name':a175_0x5f2026(0x12f),'type':'string','enum':[a175_0x5f2026(0x131),'mybatisXml'],'description':a175_0x5f2026(0x130)}],async 'validate'(_0x5e42b1){const _0x283bfc=a175_0x5f2026;if(!_0x5e42b1[_0x283bfc(0x110)])return;if(!_0x5e42b1[_0x283bfc(0x116)](_0x283bfc(0x12c))[_0x283bfc(0x13c)]())throw CliErrors[_0x283bfc(0x127)](_0x283bfc(0x12c),_0x283bfc(0x10b));const _0x2c145e=resolveProvidedDbId(_0x5e42b1);if(typeof _0x2c145e!=='number'||!Number[_0x283bfc(0x104)](_0x2c145e)||_0x2c145e<=0x0)throw CliErrors[_0x283bfc(0x127)](_0x283bfc(0x13a),'--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.');if(!_0x5e42b1[_0x283bfc(0x116)](_0x283bfc(0x12f))['trim']())throw CliErrors[_0x283bfc(0x127)](_0x283bfc(0x12f),_0x283bfc(0xff));},async 'dryRun'(_0x3aaec2){const _0x39d543=a175_0x5f2026,_0x203a99=loadSqlProjectConfig(_0x3aaec2[_0x39d543(0x119)]),{sqlName:_0x4a5eef,dbId:_0x43e60f,dbName:_0x2c8d10,mode:_0x1e0c1c}=await resolveSqlNewInputs(_0x3aaec2),_0x5d0755=buildSqlRelativePath(_0x39d543(0x105),_0x4a5eef,_0x2c8d10,_0x1e0c1c,_0x43e60f),_0x1d6140=_0x203a99[_0x39d543(0x12b)]+'/'+_0x5d0755;return{'method':_0x39d543(0x11d),'url':_0x39d543(0x132),'body':{'appCode':_0x3aaec2['appCode'],'sqlName':_0x4a5eef,'dbId':_0x43e60f,'mode':_0x1e0c1c,'localPath':_0x1d6140},'description':'Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20'+_0x203a99[_0x39d543(0x12b)]};},async 'execute'(_0xa7f20e){const _0x2abf62=a175_0x5f2026,_0x506208=loadSqlProjectConfig(_0xa7f20e[_0x2abf62(0x119)]),{sqlName:_0x1c22cb,dbId:_0x56a819,dbName:_0x35b75a,mode:_0x510b8a}=await resolveSqlNewInputs(_0xa7f20e),_0x30c3e1=generateSqlTemplate(_0x510b8a),_0x5afabc=await createSqlQuery({'appCode':_0xa7f20e[_0x2abf62(0x119)],'sqlName':_0x1c22cb,'dbId':_0x56a819,'sqlContent':_0x30c3e1}),_0x58f9b4=ensureRemoteSqlContent(_0x5afabc),_0x3f5ba4=_0x35b75a||await getDbName(_0xa7f20e[_0x2abf62(0x119)],_0x56a819)[_0x2abf62(0x107)](()=>undefined),_0x1d58b3=buildSqlRelativePath(_0x5afabc[_0x2abf62(0x11a)],_0x5afabc[_0x2abf62(0x125)],_0x3f5ba4,_0x510b8a,_0x56a819),_0x1568ee=_0x506208[_0x2abf62(0x12b)]+'/'+_0x1d58b3,_0x250cdb=buildLocalSqlFileContent({'sqlCode':_0x5afabc[_0x2abf62(0x11a)],'sqlName':_0x5afabc[_0x2abf62(0x125)],'dbId':_0x5afabc[_0x2abf62(0xf4)]},_0x58f9b4,{'dbName':_0x3f5ba4,'mode':_0x510b8a,'syncedAt':new Date()[_0x2abf62(0x111)](),'description':_0x5afabc[_0x2abf62(0xf8)]});if(await fileExists(_0x1568ee))throw CliErrors[_0x2abf62(0x11b)](_0x2abf62(0x123)+_0x1568ee);await ensureParentDirectory(_0x1568ee),await writeFile(_0x1568ee,_0x250cdb,_0x2abf62(0x12a));const _0x47165d=await readSqlLockFile(_0x506208[_0x2abf62(0x138)]),{lockData:_0xabf227,appLock:_0x1f5fbc}=ensureSqlLockScope(_0x47165d??createEmptySqlLock(),_0x506208[_0x2abf62(0x119)],_0x506208[_0x2abf62(0x135)],_0x2abf62(0xfe));return _0x1f5fbc['sqls'][_0x5afabc['sqlCode']]={...buildSqlLockEntry(_0x5afabc,_0x58f9b4,computeSqlContentHash(_0x250cdb),{'dbName':_0x3f5ba4}),'path':_0x1d58b3,'mode':_0x510b8a},_0x1f5fbc[_0x2abf62(0x113)]=new Date()[_0x2abf62(0x111)](),await writeSqlLockFile(_0x506208[_0x2abf62(0x138)],_0xabf227),{'ok':!![],'data':{'id':_0x5afabc['id'],'sqlCode':_0x5afabc[_0x2abf62(0x11a)],'sqlName':_0x5afabc[_0x2abf62(0x125)],'dbId':_0x5afabc[_0x2abf62(0xf4)],'path':_0x1568ee,'mode':_0x510b8a},'message':_0x2abf62(0x128)+_0x5afabc[_0x2abf62(0x11a)]};}};async function resolveSqlNewInputs(_0x15d0bd){const _0x1a6713=await resolveSqlNameInput(_0x15d0bd),{dbId:_0x564bdb,dbName:_0x519f59}=await resolveDbSelection(_0x15d0bd),_0x1dec90=await resolveSqlModeInput(_0x15d0bd);return{'sqlName':_0x1a6713,'dbId':_0x564bdb,'dbName':_0x519f59,'mode':_0x1dec90};}function a175_0x40db(_0x451162,_0x1b3f4a){_0x451162=_0x451162-0xf4;const _0x29f232=a175_0x29f2();let _0x40dbd2=_0x29f232[_0x451162];return _0x40dbd2;}async function resolveSqlNameInput(_0x5bd59d){const _0x19fd35=a175_0x5f2026,_0x19ed27=_0x5bd59d[_0x19fd35(0x116)](_0x19fd35(0x12c))[_0x19fd35(0x13c)]();if(_0x19ed27)return _0x19ed27;if(_0x5bd59d['nonInteractive'])throw CliErrors[_0x19fd35(0x127)](_0x19fd35(0x12c),_0x19fd35(0x10b));return(await input({'message':_0x19fd35(0x101),'validate':_0x4a0cd4=>_0x4a0cd4[_0x19fd35(0x13c)]()?!![]:_0x19fd35(0x12e)}))[_0x19fd35(0x13c)]();}async function resolveDbSelection(_0x326279){const _0x3d258d=a175_0x5f2026,_0x521753=resolveProvidedDbId(_0x326279);if(typeof _0x521753===_0x3d258d(0x11e)&&Number[_0x3d258d(0x104)](_0x521753)&&_0x521753>0x0)return{'dbId':_0x521753,'dbName':await getDbName(_0x326279[_0x3d258d(0x119)],_0x521753)[_0x3d258d(0x107)](()=>undefined)};if(_0x326279[_0x3d258d(0x110)])throw CliErrors[_0x3d258d(0x127)]('db-id',_0x3d258d(0x10f));const _0x2fc22a=await listDatabases(_0x326279[_0x3d258d(0x119)])[_0x3d258d(0x107)](()=>[]);if(_0x2fc22a[_0x3d258d(0x124)]===0x1)return{'dbId':_0x2fc22a[0x0][_0x3d258d(0xf4)],'dbName':_0x2fc22a[0x0][_0x3d258d(0xf9)]};if(_0x2fc22a[_0x3d258d(0x124)]>0x1){const _0x2e0be4=await select({'message':_0x3d258d(0xfc),'choices':[..._0x2fc22a[_0x3d258d(0x10a)](_0x37f34c=>({'name':_0x37f34c[_0x3d258d(0xf9)]+'\x20('+_0x37f34c['dbId']+')','value':serializeDbSelection(_0x37f34c)})),{'name':_0x3d258d(0x10c),'value':_0x3d258d(0x133)}]});if(_0x2e0be4!==_0x3d258d(0x133))return deserializeDbSelection(_0x2e0be4);}const _0x3e5878=await input({'message':'请输入目标数据库\x20dbId:','validate':_0x23a860=>{const _0x3d0603=_0x3d258d,_0x44dd62=_0x23a860['trim']();if(!_0x44dd62)return _0x3d0603(0xf6);const _0x57ff09=Number(_0x44dd62);if(!Number['isInteger'](_0x57ff09)||_0x57ff09<=0x0)return _0x3d0603(0x129);return!![];}});return{'dbId':Number(_0x3e5878['trim']())};}async function resolveSqlModeInput(_0x5dbe72){const _0xce9648=a175_0x5f2026,_0x34d80c=_0x5dbe72[_0xce9648(0x116)](_0xce9648(0x12f))[_0xce9648(0x13c)]();if(_0x34d80c==='sql'||_0x34d80c===_0xce9648(0x100))return _0x34d80c;if(_0x5dbe72['nonInteractive'])throw CliErrors[_0xce9648(0x127)](_0xce9648(0x12f),_0xce9648(0xff));return await select({'message':_0xce9648(0x11c),'choices':[{'name':_0xce9648(0x115),'value':_0xce9648(0x131),'description':_0xce9648(0xf7)},{'name':_0xce9648(0xfb),'value':_0xce9648(0x100),'description':_0xce9648(0x106)}]});}function serializeDbSelection(_0x5601f1){const _0xe0eaf8=a175_0x5f2026;return JSON[_0xe0eaf8(0xfd)]({'dbId':_0x5601f1[_0xe0eaf8(0xf4)],'dbName':_0x5601f1[_0xe0eaf8(0xf9)]});}function deserializeDbSelection(_0x2b1a2c){const _0x1cc91b=a175_0x5f2026;try{const _0x48ba50=JSON[_0x1cc91b(0x114)](_0x2b1a2c);if(typeof _0x48ba50[_0x1cc91b(0xf4)]===_0x1cc91b(0x11e)&&Number[_0x1cc91b(0x104)](_0x48ba50[_0x1cc91b(0xf4)]))return{'dbId':_0x48ba50[_0x1cc91b(0xf4)],'dbName':_0x48ba50[_0x1cc91b(0xf9)]};}catch{}throw CliErrors['validation'](_0x1cc91b(0x136)+_0x2b1a2c);}function resolveProvidedDbId(_0x1752a2){const _0x5bf01d=a175_0x5f2026,_0x3d13ca=_0x1752a2[_0x5bf01d(0x126)]('db-id');if(typeof _0x3d13ca===_0x5bf01d(0x11e)&&Number[_0x5bf01d(0x104)](_0x3d13ca))return _0x3d13ca;return undefined;}
|
|
1
|
+
const a175_0x5c7eb8=a175_0x1e5a;function a175_0x1e5a(_0x1a4447,_0x405a07){_0x1a4447=_0x1a4447-0x115;const _0x26fb81=a175_0x26fb();let _0x1e5ae2=_0x26fb81[_0x1a4447];return _0x1e5ae2;}(function(_0x543e71,_0xff66b2){const _0x3bad61=a175_0x1e5a,_0x4be675=_0x543e71();while(!![]){try{const _0x327c80=parseInt(_0x3bad61(0x11a))/0x1*(-parseInt(_0x3bad61(0x148))/0x2)+parseInt(_0x3bad61(0x11d))/0x3*(-parseInt(_0x3bad61(0x117))/0x4)+-parseInt(_0x3bad61(0x143))/0x5*(parseInt(_0x3bad61(0x151))/0x6)+parseInt(_0x3bad61(0x125))/0x7*(-parseInt(_0x3bad61(0x128))/0x8)+-parseInt(_0x3bad61(0x149))/0x9*(-parseInt(_0x3bad61(0x13b))/0xa)+-parseInt(_0x3bad61(0x11f))/0xb+-parseInt(_0x3bad61(0x157))/0xc*(-parseInt(_0x3bad61(0x138))/0xd);if(_0x327c80===_0xff66b2)break;else _0x4be675['push'](_0x4be675['shift']());}catch(_0x12f2bf){_0x4be675['push'](_0x4be675['shift']());}}}(a175_0x26fb,0x3d4fb));import{writeFile}from'node:fs/promises';import{input,select}from'@inquirer/prompts';import{createSqlQuery}from'../../core/api-client.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{buildSqlRelativePath}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function generateSqlTemplate(_0x1ddf4c){const _0x2c267b=a175_0x1e5a;if(_0x1ddf4c===_0x2c267b(0x116))return[_0x2c267b(0x126),_0x2c267b(0x14d),_0x2c267b(0x153),'']['join']('\x0a');return['SELECT\x201\x20AS\x20id;',''][_0x2c267b(0x14b)]('\x0a');}export const sqlCreate={'service':a175_0x5c7eb8(0x14a),'command':'create','description':a175_0x5c7eb8(0x134),'risk':a175_0x5c7eb8(0x131),'flags':[{'name':'name','type':'string','description':a175_0x5c7eb8(0x147)},{'name':a175_0x5c7eb8(0x11e),'type':a175_0x5c7eb8(0x11c),'description':a175_0x5c7eb8(0x118)},{'name':a175_0x5c7eb8(0x14f),'type':a175_0x5c7eb8(0x139),'enum':[a175_0x5c7eb8(0x14a),a175_0x5c7eb8(0x116)],'description':a175_0x5c7eb8(0x158)}],async 'validate'(_0x179944){const _0x112d57=a175_0x5c7eb8;if(!_0x179944[_0x112d57(0x11b)])return;if(!_0x179944[_0x112d57(0x152)](_0x112d57(0x115))[_0x112d57(0x141)]())throw CliErrors[_0x112d57(0x14e)](_0x112d57(0x115),_0x112d57(0x130));const _0x44d8a4=resolveProvidedDbId(_0x179944);if(typeof _0x44d8a4!==_0x112d57(0x11c)||!Number[_0x112d57(0x142)](_0x44d8a4)||_0x44d8a4<=0x0)throw CliErrors[_0x112d57(0x14e)](_0x112d57(0x11e),_0x112d57(0x13f));if(!_0x179944[_0x112d57(0x152)](_0x112d57(0x14f))[_0x112d57(0x141)]())throw CliErrors['flagMissing']('mode',_0x112d57(0x15a));},async 'dryRun'(_0x4f3f99){const _0x5b9f0f=a175_0x5c7eb8,_0x34baa4=loadSqlProjectConfig(_0x4f3f99[_0x5b9f0f(0x150)]),{sqlName:_0x33ca29,dbId:_0x2f4e4a,dbName:_0x1f797d,mode:_0x3a45f4}=await resolveSqlNewInputs(_0x4f3f99),_0x422adb=buildSqlRelativePath(_0x5b9f0f(0x145),_0x33ca29,_0x1f797d,_0x3a45f4,_0x2f4e4a),_0x39a337=_0x34baa4[_0x5b9f0f(0x15e)]+'/'+_0x422adb;return{'method':_0x5b9f0f(0x137),'url':_0x5b9f0f(0x146),'body':{'appCode':_0x4f3f99[_0x5b9f0f(0x150)],'sqlName':_0x33ca29,'dbId':_0x2f4e4a,'mode':_0x3a45f4,'localPath':_0x39a337},'description':_0x5b9f0f(0x13a)+_0x34baa4[_0x5b9f0f(0x15e)]};},async 'execute'(_0xb05be4){const _0x2a7b4b=a175_0x5c7eb8,_0x255c4e=loadSqlProjectConfig(_0xb05be4[_0x2a7b4b(0x150)]),{sqlName:_0x2fe8cf,dbId:_0x5bc276,dbName:_0x21ace9,mode:_0x4ac2bb}=await resolveSqlNewInputs(_0xb05be4),_0x12c303=generateSqlTemplate(_0x4ac2bb),_0x22d817=await createSqlQuery({'appCode':_0xb05be4[_0x2a7b4b(0x150)],'sqlName':_0x2fe8cf,'dbId':_0x5bc276,'sqlContent':_0x12c303}),_0x6ea4ac=ensureRemoteSqlContent(_0x22d817),_0x58437e=_0x21ace9||await getDbName(_0xb05be4[_0x2a7b4b(0x150)],_0x5bc276)[_0x2a7b4b(0x121)](()=>undefined),_0x4604a7=buildSqlRelativePath(_0x22d817[_0x2a7b4b(0x15b)],_0x22d817['sqlName'],_0x58437e,_0x4ac2bb,_0x5bc276),_0x39d132=_0x255c4e[_0x2a7b4b(0x15e)]+'/'+_0x4604a7,_0x421ef2=buildLocalSqlFileContent({'sqlCode':_0x22d817[_0x2a7b4b(0x15b)],'sqlName':_0x22d817[_0x2a7b4b(0x12d)],'dbId':_0x22d817[_0x2a7b4b(0x12a)]},_0x6ea4ac,{'dbName':_0x58437e,'mode':_0x4ac2bb,'syncedAt':new Date()[_0x2a7b4b(0x13c)](),'description':_0x22d817[_0x2a7b4b(0x15c)]});if(await fileExists(_0x39d132))throw CliErrors[_0x2a7b4b(0x122)](_0x2a7b4b(0x160)+_0x39d132);await ensureParentDirectory(_0x39d132),await writeFile(_0x39d132,_0x421ef2,'utf8');const _0x324391=await readSqlLockFile(_0x255c4e[_0x2a7b4b(0x156)]),{lockData:_0x4e88bf,appLock:_0x3b86c1}=ensureSqlLockScope(_0x324391??createEmptySqlLock(),_0x255c4e['appCode'],_0x255c4e[_0x2a7b4b(0x12e)],_0x2a7b4b(0x155));return _0x3b86c1[_0x2a7b4b(0x133)][_0x22d817['sqlCode']]={...buildSqlLockEntry(_0x22d817,_0x6ea4ac,computeSqlContentHash(_0x421ef2),{'dbName':_0x58437e}),'path':_0x4604a7,'mode':_0x4ac2bb},_0x3b86c1[_0x2a7b4b(0x12b)]=new Date()[_0x2a7b4b(0x13c)](),await writeSqlLockFile(_0x255c4e[_0x2a7b4b(0x156)],_0x4e88bf),{'ok':!![],'data':{'id':_0x22d817['id'],'sqlCode':_0x22d817[_0x2a7b4b(0x15b)],'sqlName':_0x22d817['sqlName'],'dbId':_0x22d817[_0x2a7b4b(0x12a)],'path':_0x39d132,'mode':_0x4ac2bb},'message':_0x2a7b4b(0x124)+_0x22d817[_0x2a7b4b(0x15b)]};}};async function resolveSqlNewInputs(_0x1728fc){const _0x407f67=await resolveSqlNameInput(_0x1728fc),{dbId:_0x541de4,dbName:_0x194c18}=await resolveDbSelection(_0x1728fc),_0x1cb6f4=await resolveSqlModeInput(_0x1728fc);return{'sqlName':_0x407f67,'dbId':_0x541de4,'dbName':_0x194c18,'mode':_0x1cb6f4};}async function resolveSqlNameInput(_0x531c1b){const _0x26ce06=a175_0x5c7eb8,_0x168b1e=_0x531c1b[_0x26ce06(0x152)](_0x26ce06(0x115))[_0x26ce06(0x141)]();if(_0x168b1e)return _0x168b1e;if(_0x531c1b[_0x26ce06(0x11b)])throw CliErrors['flagMissing'](_0x26ce06(0x115),_0x26ce06(0x130));return(await input({'message':_0x26ce06(0x136),'validate':_0x156b88=>_0x156b88[_0x26ce06(0x141)]()?!![]:'SQL\x20名称不能为空'}))[_0x26ce06(0x141)]();}function a175_0x26fb(){const _0x251e82=['flag','sqlRootDir','请选择本地\x20SQL\x20模式:','File\x20already\x20exists:\x20','map','name','mybatisXml','4ITtLSB','Target\x20database\x20ID','适合带动态标签的\x20MyBatis\x20XML\x20SQL','4861YMkovB','nonInteractive','number','878487kAOeOK','db-id','4452987duMrGL','Invalid\x20database\x20selection\x20payload:\x20','catch','validation','请输入目标数据库\x20dbId:','Created\x20SQL\x20query\x20','21KjKqWQ','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','length','334936icdyLt','dbId\x20必须为正整数','dbId','lastSync','适合直接执行的普通\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20语句','sqlName','sqlRoot','普通\x20SQL(sql)','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','write','dbName','sqls','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','MyBatis\x20XML(mybatisXml)','请输入\x20SQL\x20名称:','POST','13ZWTfgh','string','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','6130wiAzzI','toISOString','stringify','isInteger','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','parse','trim','isFinite','55BXGemF','✎\x20手动输入\x20dbId','<server-generated-sqlCode>','/smartapi/custom/saveUserCustomSql','SQL\x20query\x20display\x20name','16CZgOVx','1665KNapej','sql','join','dbId\x20不能为空','\x20\x20SELECT\x201\x20AS\x20id','flagMissing','mode','appCode','58368mHeZUP','str','</select>','请选择目标数据库:','new','lockFilePath','13282428woZnfc','Local\x20SQL\x20file\x20mode','__manual__','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','sqlCode','description'];a175_0x26fb=function(){return _0x251e82;};return a175_0x26fb();}async function resolveDbSelection(_0x3a5656){const _0x5ef07f=a175_0x5c7eb8,_0x38c966=resolveProvidedDbId(_0x3a5656);if(typeof _0x38c966===_0x5ef07f(0x11c)&&Number[_0x5ef07f(0x142)](_0x38c966)&&_0x38c966>0x0)return{'dbId':_0x38c966,'dbName':await getDbName(_0x3a5656['appCode'],_0x38c966)[_0x5ef07f(0x121)](()=>undefined)};if(_0x3a5656[_0x5ef07f(0x11b)])throw CliErrors[_0x5ef07f(0x14e)](_0x5ef07f(0x11e),_0x5ef07f(0x13f));const _0x26f23a=await listDatabases(_0x3a5656[_0x5ef07f(0x150)])[_0x5ef07f(0x121)](()=>[]);if(_0x26f23a['length']===0x1)return{'dbId':_0x26f23a[0x0][_0x5ef07f(0x12a)],'dbName':_0x26f23a[0x0]['dbName']};if(_0x26f23a[_0x5ef07f(0x127)]>0x1){const _0x121a5d=await select({'message':_0x5ef07f(0x154),'choices':[..._0x26f23a[_0x5ef07f(0x161)](_0x3b45c2=>({'name':_0x3b45c2['dbName']+'\x20('+_0x3b45c2[_0x5ef07f(0x12a)]+')','value':serializeDbSelection(_0x3b45c2)})),{'name':_0x5ef07f(0x144),'value':'__manual__'}]});if(_0x121a5d!==_0x5ef07f(0x159))return deserializeDbSelection(_0x121a5d);}const _0x1f8f71=await input({'message':_0x5ef07f(0x123),'validate':_0x2fdd07=>{const _0x5b4c49=_0x5ef07f,_0x37c6ab=_0x2fdd07[_0x5b4c49(0x141)]();if(!_0x37c6ab)return _0x5b4c49(0x14c);const _0x4d6d4a=Number(_0x37c6ab);if(!Number[_0x5b4c49(0x13e)](_0x4d6d4a)||_0x4d6d4a<=0x0)return _0x5b4c49(0x129);return!![];}});return{'dbId':Number(_0x1f8f71[_0x5ef07f(0x141)]())};}async function resolveSqlModeInput(_0x4cb1c6){const _0x242d4e=a175_0x5c7eb8,_0x115de7=_0x4cb1c6[_0x242d4e(0x152)](_0x242d4e(0x14f))[_0x242d4e(0x141)]();if(_0x115de7===_0x242d4e(0x14a)||_0x115de7===_0x242d4e(0x116))return _0x115de7;if(_0x4cb1c6['nonInteractive'])throw CliErrors['flagMissing'](_0x242d4e(0x14f),_0x242d4e(0x15a));return await select({'message':_0x242d4e(0x15f),'choices':[{'name':_0x242d4e(0x12f),'value':'sql','description':_0x242d4e(0x12c)},{'name':_0x242d4e(0x135),'value':_0x242d4e(0x116),'description':_0x242d4e(0x119)}]});}function serializeDbSelection(_0x2fdf25){const _0x2a0514=a175_0x5c7eb8;return JSON[_0x2a0514(0x13d)]({'dbId':_0x2fdf25[_0x2a0514(0x12a)],'dbName':_0x2fdf25[_0x2a0514(0x132)]});}function deserializeDbSelection(_0x51bfd9){const _0x24590c=a175_0x5c7eb8;try{const _0x473075=JSON[_0x24590c(0x140)](_0x51bfd9);if(typeof _0x473075[_0x24590c(0x12a)]===_0x24590c(0x11c)&&Number[_0x24590c(0x142)](_0x473075[_0x24590c(0x12a)]))return{'dbId':_0x473075[_0x24590c(0x12a)],'dbName':_0x473075[_0x24590c(0x132)]};}catch{}throw CliErrors[_0x24590c(0x122)](_0x24590c(0x120)+_0x51bfd9);}function resolveProvidedDbId(_0x508fb1){const _0x3d618e=a175_0x5c7eb8,_0x41c7b2=_0x508fb1[_0x3d618e(0x15d)]('db-id');if(typeof _0x41c7b2===_0x3d618e(0x11c)&&Number['isFinite'](_0x41c7b2))return _0x41c7b2;return undefined;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a176_0x381324=a176_0x3f22;(function(_0x2b712d,_0x48fd33){const _0x41860c=a176_0x3f22,_0xfc333f=_0x2b712d();while(!![]){try{const _0x4c4108=parseInt(_0x41860c(0x1aa))/0x1*(parseInt(_0x41860c(0x195))/0x2)+parseInt(_0x41860c(0x1a0))/0x3*(-parseInt(_0x41860c(0x18f))/0x4)+-parseInt(_0x41860c(0x18a))/0x5+-parseInt(_0x41860c(0x194))/0x6*(parseInt(_0x41860c(0x1ab))/0x7)+parseInt(_0x41860c(0x1b0))/0x8*(-parseInt(_0x41860c(0x199))/0x9)+parseInt(_0x41860c(0x19f))/0xa+parseInt(_0x41860c(0x1a3))/0xb*(parseInt(_0x41860c(0x19e))/0xc);if(_0x4c4108===_0x48fd33)break;else _0xfc333f['push'](_0xfc333f['shift']());}catch(_0x5742a2){_0xfc333f['push'](_0xfc333f['shift']());}}}(a176_0x2daf,0xa4d1b));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';function a176_0x3f22(_0x5c6f39,_0x563b42){_0x5c6f39=_0x5c6f39-0x18a;const _0x2dafd2=a176_0x2daf();let _0x3f22c9=_0x2dafd2[_0x5c6f39];return _0x3f22c9;}import{deleteSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{fileExists}from'../../core/bff/file-system.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';function a176_0x2daf(){const _0x13953f=['\x20(local\x20file\x20moved\x20to\x20trash)','11xePAMG','remoteId','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','trashDir','sqlRoot','lastSync','1WIgJet','70SYVGHj','filter','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','POST','sqlcode','24GdEEnx','1449970cKnwkh','appCode','sqls','Deleted\x20','high-risk-write','460gUNNME','str','lockFilePath','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20','/smartapi/custom/deleteUserCustomSql','435486srvEBD','1793042gTsOtr','sql','toISOString','replace','1862919khLMwH','SQL\x20lock\x20file\x20not\x20found.','Would\x20delete\x20SQL\x20','validation','delete','20927652wzXdab','95990jlFCzU','8823NDhBUm','projectRoot'];a176_0x2daf=function(){return _0x13953f;};return a176_0x2daf();}import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDelete={'service':a176_0x381324(0x196),'command':'delete','description':a176_0x381324(0x1a5),'risk':a176_0x381324(0x18e),'flags':[SQLCODE_FLAG],async 'validate'(_0x112fbe){const _0x28f208=a176_0x381324,_0x3aea90=loadSqlProjectConfig(_0x112fbe[_0x28f208(0x18b)]),_0x3bfd29=await readSqlLockFile(_0x3aea90[_0x28f208(0x191)]);if(!_0x3bfd29)throw CliErrors[_0x28f208(0x19c)](_0x28f208(0x1a6));},async 'dryRun'(_0x12d71b){const _0x43f40a=a176_0x381324,_0x1e9c63=loadSqlProjectConfig(_0x12d71b['appCode']),_0x357600=await readSqlLockFile(_0x1e9c63[_0x43f40a(0x191)]);if(!_0x357600)throw CliErrors['validation'](_0x43f40a(0x1a6));const {appLock:_0x503ce9}=ensureSqlLockScope(_0x357600,_0x12d71b['appCode'],_0x1e9c63[_0x43f40a(0x1a8)],_0x43f40a(0x19d)),_0x18564d=_0x12d71b[_0x43f40a(0x190)]('sqlcode'),_0x449694=_0x503ce9[_0x43f40a(0x18c)][_0x18564d];if(!_0x449694)throw CliErrors['validation'](_0x43f40a(0x1ad)+_0x18564d+'\x22.');return{'method':_0x43f40a(0x1ae),'url':_0x43f40a(0x193),'body':{'sqlCode':_0x18564d,'id':_0x449694[_0x43f40a(0x1a4)],'localPath':resolveLocalSqlFilePath(_0x1e9c63,_0x18564d,_0x449694)},'description':_0x43f40a(0x19b)+_0x18564d+_0x43f40a(0x192)+_0x1e9c63['trashDir']};},async 'execute'(_0x412633){const _0x12c6e7=a176_0x381324,_0x5e0270=loadSqlProjectConfig(_0x412633[_0x12c6e7(0x18b)]),_0x15640a=await readSqlLockFile(_0x5e0270[_0x12c6e7(0x191)]);if(!_0x15640a)throw CliErrors[_0x12c6e7(0x19c)](_0x12c6e7(0x19a));const {lockData:_0x19326d,appLock:_0x492d0f}=ensureSqlLockScope(_0x15640a,_0x412633['appCode'],_0x5e0270[_0x12c6e7(0x1a8)],_0x12c6e7(0x19d)),_0x3b81f6=_0x412633[_0x12c6e7(0x190)](_0x12c6e7(0x1af)),_0x24baa9=_0x492d0f['sqls'][_0x3b81f6];if(!_0x24baa9)throw CliErrors['validation'](_0x12c6e7(0x1ad)+_0x3b81f6+'\x22.');await deleteSqlQuery({'id':_0x24baa9['remoteId'],'sqlCode':_0x3b81f6}),_0x492d0f[_0x12c6e7(0x18c)]=Object['fromEntries'](Object['entries'](_0x492d0f[_0x12c6e7(0x18c)])[_0x12c6e7(0x1ac)](([_0x218aba])=>_0x218aba!==_0x3b81f6)),_0x492d0f[_0x12c6e7(0x1a9)]=new Date()[_0x12c6e7(0x197)](),await writeSqlLockFile(_0x5e0270[_0x12c6e7(0x191)],_0x19326d);const _0x2cdc2a=resolveLocalSqlFilePath(_0x5e0270,_0x3b81f6,_0x24baa9);let _0x5a6ab5;await fileExists(_0x2cdc2a)&&(_0x5a6ab5=await moveToTrash(_0x5e0270[_0x12c6e7(0x1a1)],_0x5e0270[_0x12c6e7(0x1a7)],_0x2cdc2a),await cleanupEmptyDirectories(dirname(_0x2cdc2a),_0x5e0270['sqlRootDir']));const _0x572599={'deleted':_0x3b81f6,'remoteId':_0x24baa9[_0x12c6e7(0x1a4)]};if(_0x5a6ab5)_0x572599['trashedTo']=_0x5a6ab5;return{'ok':!![],'data':_0x572599,'message':_0x12c6e7(0x18d)+_0x3b81f6+(_0x5a6ab5?_0x12c6e7(0x1a2):'')};}};async function moveToTrash(_0x57437a,_0x488fef,_0x262aff){const _0x426b6f=a176_0x381324,_0xe1011e=new Date()[_0x426b6f(0x197)]()[_0x426b6f(0x198)](/[:.]/g,'-'),_0x38578d=relative(_0x57437a,_0x262aff),_0x2948e6=join(_0x488fef,_0xe1011e,_0x38578d);return await mkdir(dirname(_0x2948e6),{'recursive':!![]}),await rename(_0x262aff,_0x2948e6),_0x2948e6;}async function cleanupEmptyDirectories(_0x4c91d1,_0x5d06c6){let _0x391852=resolve(_0x4c91d1);const _0x9d579b=resolve(_0x5d06c6);while(_0x391852['startsWith'](''+_0x9d579b+sep)||_0x391852===_0x9d579b){if(_0x391852===_0x9d579b)return;try{const _0x85feda=await readdir(_0x391852);if(_0x85feda['length']>0x0)return;await rmdir(_0x391852);}catch{return;}_0x391852=dirname(_0x391852);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a177_0xaff853=a177_0x362f;(function(_0x1e6f2e,_0x452894){const _0x4abb2a=a177_0x362f,_0x30d463=_0x1e6f2e();while(!![]){try{const _0x1d22d1=-parseInt(_0x4abb2a(0x176))/0x1+-parseInt(_0x4abb2a(0x16d))/0x2+-parseInt(_0x4abb2a(0x17f))/0x3*(parseInt(_0x4abb2a(0x169))/0x4)+-parseInt(_0x4abb2a(0x17a))/0x5*(parseInt(_0x4abb2a(0x17d))/0x6)+parseInt(_0x4abb2a(0x16e))/0x7*(-parseInt(_0x4abb2a(0x178))/0x8)+-parseInt(_0x4abb2a(0x16b))/0x9+-parseInt(_0x4abb2a(0x179))/0xa*(-parseInt(_0x4abb2a(0x170))/0xb);if(_0x1d22d1===_0x452894)break;else _0x30d463['push'](_0x30d463['shift']());}catch(_0x43b151){_0x30d463['push'](_0x30d463['shift']());}}}(a177_0x574f,0xe4b1c));import{getSqlQueryInfo}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';function a177_0x362f(_0x1c8e54,_0x1833e4){_0x1c8e54=_0x1c8e54-0x168;const _0x574f29=a177_0x574f();let _0x362f5b=_0x574f29[_0x1c8e54];return _0x362f5b;}import{SQLCODE_FLAG}from'../../commands/common/flags.js';function a177_0x574f(){const _0xf6d827=['verbose','boolean','476QRdyHD','sqlCode','12169737dRhiXT','Return\x20full\x20raw\x20SQL\x20query\x20object','2009642PARZiQ','7qDMHZT','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','313742EOSxib','appCode','description','sql','sqlName','read','1526468hBhuDB','bool','7774600TLpwLA','2790HzVFOf','2545VwhvRi','sqlContent','sqlcode','10284oEkhHQ','dbId','32601NGUftC','detail'];a177_0x574f=function(){return _0xf6d827;};return a177_0x574f();}export const sqlDetail={'service':a177_0xaff853(0x173),'command':a177_0xaff853(0x180),'description':a177_0xaff853(0x16f),'risk':a177_0xaff853(0x175),'flags':[SQLCODE_FLAG,{'name':'verbose','type':a177_0xaff853(0x168),'description':a177_0xaff853(0x16c)}],async 'execute'(_0x2b04d9){const _0x254dfc=a177_0xaff853,_0x3458e2=await getSqlQueryInfo(_0x2b04d9['appCode'],_0x2b04d9['str'](_0x254dfc(0x17c))),_0xd78ece=_0x2b04d9[_0x254dfc(0x177)](_0x254dfc(0x181));if(_0xd78ece)return{'ok':!![],'data':_0x3458e2};const _0x3b377e=_0x3458e2['dbId']?await getDbName(_0x2b04d9[_0x254dfc(0x171)],_0x3458e2[_0x254dfc(0x17e)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x3458e2[_0x254dfc(0x16a)],'sqlName':_0x3458e2[_0x254dfc(0x174)],'db':_0x3b377e?_0x3b377e+'\x20('+_0x3458e2['dbId']+')':_0x3458e2[_0x254dfc(0x17e)]??'','description':_0x3458e2[_0x254dfc(0x172)]??'','sqlContent':_0x3458e2[_0x254dfc(0x17b)]??''}};}};
|
package/lib/commands/sql/exec.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a178_0x560fa3=a178_0x589d;(function(_0x444ade,_0x3864ff){const _0x1b70b2=a178_0x589d,_0x522a81=_0x444ade();while(!![]){try{const _0x12c9e5=parseInt(_0x1b70b2(0x92))/0x1*(parseInt(_0x1b70b2(0x98))/0x2)+-parseInt(_0x1b70b2(0x8d))/0x3+parseInt(_0x1b70b2(0x90))/0x4+-parseInt(_0x1b70b2(0x9d))/0x5*(-parseInt(_0x1b70b2(0x9c))/0x6)+-parseInt(_0x1b70b2(0x8f))/0x7+parseInt(_0x1b70b2(0x88))/0x8*(parseInt(_0x1b70b2(0x96))/0x9)+-parseInt(_0x1b70b2(0x9a))/0xa*(parseInt(_0x1b70b2(0x95))/0xb);if(_0x12c9e5===_0x3864ff)break;else _0x522a81['push'](_0x522a81['shift']());}catch(_0xc40a34){_0x522a81['push'](_0x522a81['shift']());}}}(a178_0x21a0,0xb6f58));function a178_0x21a0(){const _0x4af945=['execSuccess','2bvhoyN','execError','31154560PDrnDZ','appCode','6829122jODAUs','5QCIUNw','exec','str','329288hgWWMy','Returned\x20','now','sqlcode','length','264978AwFCbj','isArray','1373498XIVYge','1561524UVgrdN','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','1427159xBmfDM','params','SQL\x20execution\x20failed','11ArGtgi','261OhYOzS'];a178_0x21a0=function(){return _0x4af945;};return a178_0x21a0();}function a178_0x589d(_0x3f3aa1,_0x3dc228){_0x3f3aa1=_0x3f3aa1-0x88;const _0x21a0a6=a178_0x21a0();let _0x589d17=_0x21a0a6[_0x3f3aa1];return _0x589d17;}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':'sql','command':a178_0x560fa3(0x9e),'description':a178_0x560fa3(0x91),'risk':'read','flags':[SQLCODE_FLAG,{'name':a178_0x560fa3(0x93),'type':'string','description':'SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)'}],async 'execute'(_0x19a963){const _0x48bd31=a178_0x560fa3,_0x24aa88=parseJsonParams(_0x19a963[_0x48bd31(0x9f)](_0x48bd31(0x93))),_0x3f2c75=Date['now'](),_0x3b13c3=await executeSql(_0x19a963[_0x48bd31(0x9b)],_0x19a963[_0x48bd31(0x9f)](_0x48bd31(0x8b)),_0x24aa88),_0x2a8948=Date[_0x48bd31(0x8a)]()-_0x3f2c75,_0x51337b=_0x3b13c3?.['execResult']??_0x3b13c3,_0x54067e=_0x3b13c3?.[_0x48bd31(0x97)]??!![];if(!_0x54067e)return{'ok':![],'data':{'error':_0x3b13c3?.[_0x48bd31(0x99)]||_0x48bd31(0x94),'elapsed':_0x2a8948},'message':_0x48bd31(0x94)};const _0x4af888=Array[_0x48bd31(0x8e)](_0x51337b)?_0x51337b:[];return{'ok':!![],'data':{'rows':_0x4af888,'rowCount':_0x4af888['length'],'elapsed':_0x2a8948},'message':_0x48bd31(0x89)+_0x4af888[_0x48bd31(0x8c)]+'\x20row(s)\x20in\x20'+_0x2a8948+'ms'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x254c25,_0x41a938){const _0x332860=a179_0x42c2,_0x2da0d1=_0x254c25();while(!![]){try{const _0x442b3f=parseInt(_0x332860(0x14d))/0x1*(-parseInt(_0x332860(0x14b))/0x2)+parseInt(_0x332860(0x152))/0x3+-parseInt(_0x332860(0x153))/0x4+-parseInt(_0x332860(0x14e))/0x5+-parseInt(_0x332860(0x14c))/0x6*(parseInt(_0x332860(0x14f))/0x7)+-parseInt(_0x332860(0x150))/0x8+-parseInt(_0x332860(0x151))/0x9*(-parseInt(_0x332860(0x14a))/0xa);if(_0x442b3f===_0x41a938)break;else _0x2da0d1['push'](_0x2da0d1['shift']());}catch(_0x5584c0){_0x2da0d1['push'](_0x2da0d1['shift']());}}}(a179_0x1017,0x862bb));import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';import{sqlExec}from'../../commands/sql/exec.js';import{sqlPull}from'../../commands/sql/pull.js';import{sqlCreate}from'../../commands/sql/create.js';function a179_0x1017(){const _0x3ec800=['2735620isKvlM','14868390yLqMlq','1049714xvhZjA','102NLjEEX','2fEQxpL','2294335VbnHjr','135121RQnIuC','3576224xLjjGG','18IOKgjI','1630650vsglhK'];a179_0x1017=function(){return _0x3ec800;};return a179_0x1017();}import{sqlStatus}from'../../commands/sql/status.js';import{sqlPush}from'../../commands/sql/push.js';import{sqlDelete}from'../../commands/sql/delete.js';function a179_0x42c2(_0x44b4b2,_0x1972df){_0x44b4b2=_0x44b4b2-0x14a;const _0x101775=a179_0x1017();let _0x42c210=_0x101775[_0x44b4b2];return _0x42c210;}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 a180_0x27b692=a180_0x599d;(function(_0x40260c,_0x581bd5){const _0x8a8d61=a180_0x599d,_0x2353f5=_0x40260c();while(!![]){try{const _0x1f0d2e=-parseInt(_0x8a8d61(0xff))/0x1*(parseInt(_0x8a8d61(0x10c))/0x2)+parseInt(_0x8a8d61(0x109))/0x3*(parseInt(_0x8a8d61(0x117))/0x4)+-parseInt(_0x8a8d61(0x118))/0x5+-parseInt(_0x8a8d61(0x101))/0x6*(parseInt(_0x8a8d61(0x11e))/0x7)+-parseInt(_0x8a8d61(0x10d))/0x8+parseInt(_0x8a8d61(0x10a))/0x9+parseInt(_0x8a8d61(0x102))/0xa;if(_0x1f0d2e===_0x581bd5)break;else _0x2353f5['push'](_0x2353f5['shift']());}catch(_0x4535df){_0x2353f5['push'](_0x2353f5['shift']());}}}(a180_0x20cb,0xb9769));import{listSqlQueries}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';function a180_0x20cb(){const _0x304e4b=['totalCount','77042uXfbQy','name','11910JmQmJL','19954730sHohWb','map','length','Page\x20number','page','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','sqlName','1262295qWEqOk','1088442EVogDa','str','4rzEEKL','8167008rQRXbJ','sqlCode','tableData','sql','sqlcode','Page\x20size','string','Found\x20','read','all','4pMEjwU','739970hVfIzz','list','dbId','num','number','appCode','1603licgWD','No\x20custom\x20SQL\x20queries\x20found.','pagesize'];a180_0x20cb=function(){return _0x304e4b;};return a180_0x20cb();}import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a180_0x599d(_0x52fb78,_0x379ee5){_0x52fb78=_0x52fb78-0xfd;const _0x20cbf4=a180_0x20cb();let _0x599d14=_0x20cbf4[_0x52fb78];return _0x599d14;}export const sqlList={'service':a180_0x27b692(0x110),'command':a180_0x27b692(0x119),'description':'List\x20custom\x20SQL\x20queries','risk':a180_0x27b692(0x115),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a180_0x27b692(0x100),'type':a180_0x27b692(0x113),'description':'Filter\x20by\x20SQL\x20name'},{'name':a180_0x27b692(0x106),'type':a180_0x27b692(0x11c),'description':a180_0x27b692(0x105),'default':0x1},{'name':a180_0x27b692(0xfd),'type':a180_0x27b692(0x11c),'description':a180_0x27b692(0x112)},{'name':'verbose','type':'boolean','description':a180_0x27b692(0x107)}],async 'execute'(_0x57e5e1){const _0xb7ed34=a180_0x27b692,_0x5e98c3=await listSqlQueries(_0x57e5e1[_0xb7ed34(0x11d)],{'sqlCode':_0x57e5e1[_0xb7ed34(0x10b)](_0xb7ed34(0x111))||undefined,'sqlName':_0x57e5e1[_0xb7ed34(0x10b)](_0xb7ed34(0x100))||undefined,'currentPage':_0x57e5e1[_0xb7ed34(0x11b)](_0xb7ed34(0x106)),'pageSize':_0x57e5e1[_0xb7ed34(0x11b)](_0xb7ed34(0xfd),0x32)}),_0x39bfbc=_0x57e5e1['bool']('verbose'),_0x4110ab=_0x5e98c3[_0xb7ed34(0x10f)]??[],_0x35a514=_0x5e98c3['paging']?.[_0xb7ed34(0xfe)]??_0x4110ab[_0xb7ed34(0x104)];let _0x3fc87a;return _0x39bfbc?_0x3fc87a=_0x4110ab:_0x3fc87a=await Promise[_0xb7ed34(0x116)](_0x4110ab[_0xb7ed34(0x103)](async _0x154870=>{const _0x3c3279=_0xb7ed34;let _0x3f4606;try{_0x3f4606=_0x154870['dbId']?await getDbName(_0x57e5e1[_0x3c3279(0x11d)],_0x154870[_0x3c3279(0x11a)]):undefined;}catch{}return{'sqlCode':_0x154870[_0x3c3279(0x10e)],'sqlName':_0x154870[_0x3c3279(0x108)],'description':_0x154870['description']??'','db':_0x3f4606?_0x3f4606+'\x20('+_0x154870['dbId']+')':_0x154870[_0x3c3279(0x11a)]??''};})),{'ok':!![],'data':_0x3fc87a,'message':_0x4110ab[_0xb7ed34(0x104)]===0x0?_0xb7ed34(0x11f):_0xb7ed34(0x114)+_0x4110ab[_0xb7ed34(0x104)]+'\x20SQL\x20queries\x20(total:\x20'+_0x35a514+').'};}};
|
package/lib/commands/sql/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a181_0x1422ce=a181_0xf2bf;function a181_0x3c4a(){const _0x2a4308=['conflict','path','pull','appCode','sqls','push','description','748174tGTNDt','6140232YGgbOd','sqlContent','trimStart','skipped','mybatisXml','apps','309106BOMXmI','\x20written,\x20','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','str','\x20SQL\x20file(s)\x20into\x20','sql','bool','3215130KkMBCP','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','Force\x20pull\x20cancelled.','\x20skipped,\x20','test','sqlCode','filter','1NgWkwz','totalCount','local\x20differs\x20from\x20remote','1549015hhkqGr','read','replace','Filter\x20by\x20SQL\x20display\x20name','paging','sqlRootDir','string','tableData','3230744IEiBvX','force','sqlcode','would_pull','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','lockFilePath','\x20failed','utf8','unchanged','lastSync','3FAdcUE','message','toISOString','cancelled','length','catch','dbId','No\x20remote\x20SQL\x20queries\x20matched.','sqlRoot','Force\x20overwrite\x20local\x20unsynced\x20changes','sqlName','2355796IundIY','name','Would\x20pull\x20'];a181_0x3c4a=function(){return _0x2a4308;};return a181_0x3c4a();}(function(_0x4cbb37,_0x1e9d91){const _0x72aace=a181_0xf2bf,_0x26286f=_0x4cbb37();while(!![]){try{const _0x473810=-parseInt(_0x72aace(0x1fb))/0x1*(-parseInt(_0x72aace(0x225))/0x2)+parseInt(_0x72aace(0x210))/0x3*(-parseInt(_0x72aace(0x21b))/0x4)+parseInt(_0x72aace(0x1fe))/0x5+parseInt(_0x72aace(0x1f4))/0x6+parseInt(_0x72aace(0x22c))/0x7+parseInt(_0x72aace(0x206))/0x8+-parseInt(_0x72aace(0x226))/0x9;if(_0x473810===_0x1e9d91)break;else _0x26286f['push'](_0x26286f['shift']());}catch(_0x45b18a){_0x26286f['push'](_0x26286f['shift']());}}}(a181_0x3c4a,0x60d05));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a181_0xf2bf(_0x364a89,_0x4612ea){_0x364a89=_0x364a89-0x1ef;const _0x3c4ac8=a181_0x3c4a();let _0xf2bfd8=_0x3c4ac8[_0x364a89];return _0xf2bfd8;}import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x381fae,_0x3783b9){const _0x20fbc5=a181_0xf2bf,_0x22e9ea=[];let _0xce132a=0x1;while(!![]){const _0x19af89=await listSqlQueries(_0x381fae,{'currentPage':_0xce132a,'pageSize':PAGE_SIZE,'sqlCode':_0x3783b9[_0x20fbc5(0x1f9)],'sqlName':_0x3783b9[_0x20fbc5(0x21a)]}),_0x51f8f8=_0x19af89[_0x20fbc5(0x205)]??[];_0x22e9ea['push'](..._0x51f8f8);if(_0x51f8f8[_0x20fbc5(0x214)]===0x0)break;const _0x5ae3b1=_0x19af89[_0x20fbc5(0x202)]?.[_0x20fbc5(0x1fc)];if(_0x5ae3b1!=null?_0x22e9ea[_0x20fbc5(0x214)]>=_0x5ae3b1:_0x51f8f8['length']<PAGE_SIZE)break;_0xce132a++;}return _0x22e9ea;}async function ensureSqlContent(_0x25540b){const _0x573344=a181_0xf2bf;if(_0x25540b[_0x573344(0x227)]!=null&&String(_0x25540b[_0x573344(0x227)])['length']>0x0)return _0x25540b;return getSqlQueryDetail(_0x25540b['sqlCode']);}export const sqlPull={'service':a181_0x1422ce(0x1f2),'command':a181_0x1422ce(0x220),'description':a181_0x1422ce(0x20a),'risk':a181_0x1422ce(0x1ff),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a181_0x1422ce(0x21c),'type':a181_0x1422ce(0x204),'description':a181_0x1422ce(0x201)},{'name':a181_0x1422ce(0x207),'type':'boolean','description':a181_0x1422ce(0x219)}],async 'dryRun'(_0x15eafb){const _0x1af0cc=a181_0x1422ce,_0x49d2f1=loadSqlProjectConfig(_0x15eafb[_0x1af0cc(0x221)]),_0x5d170f=await readSqlLockFile(_0x49d2f1[_0x1af0cc(0x20b)]),{appLock:_0x205d13}=ensureSqlLockScope(_0x5d170f??createEmptySqlLock(),_0x49d2f1[_0x1af0cc(0x221)],_0x49d2f1[_0x1af0cc(0x218)],_0x1af0cc(0x220)),_0x174ca1=await fetchAllSqlQueries(_0x15eafb[_0x1af0cc(0x221)],{'sqlCode':_0x15eafb['str'](_0x1af0cc(0x208))||undefined,'sqlName':_0x15eafb['str'](_0x1af0cc(0x21c))||undefined}),_0x50ea26=[];for(const _0x43b81f of _0x174ca1){const _0x2f2312=await ensureSqlContent(_0x43b81f),_0x2ef448=ensureRemoteSqlContent(_0x2f2312),_0x4bf7ea=detectModeFromSql(_0x2f2312),_0x8e1b71=_0x2f2312['dbId']?await getDbName(_0x15eafb[_0x1af0cc(0x221)],Number(_0x2f2312[_0x1af0cc(0x216)]))['catch'](()=>undefined):undefined,_0x460cec=buildLocalSqlFileContent({'sqlCode':_0x2f2312['sqlCode'],'sqlName':_0x2f2312[_0x1af0cc(0x21a)],'dbId':_0x2f2312['dbId']},_0x2ef448,{'dbName':_0x8e1b71,'mode':_0x4bf7ea,'syncedAt':new Date()[_0x1af0cc(0x212)](),'description':_0x2f2312[_0x1af0cc(0x224)]}),_0x16c201=buildSqlLockEntry(_0x2f2312,_0x2ef448,'',{'dbName':_0x8e1b71}),_0x1a1dd3=resolveLocalSqlFilePath(_0x49d2f1,_0x2f2312['sqlCode'],_0x16c201);let _0x2cd716=_0x1af0cc(0x209),_0x56c5b8;if(await fileExists(_0x1a1dd3)){const _0x193702=await readFile(_0x1a1dd3,_0x1af0cc(0x20d));isEquivalentPulledSqlFile(_0x193702,_0x460cec,_0x4bf7ea)?(_0x2cd716=_0x1af0cc(0x229),_0x56c5b8=_0x1af0cc(0x20e)):(_0x2cd716=_0x1af0cc(0x21e),_0x56c5b8=_0x1af0cc(0x1f5));}_0x50ea26[_0x1af0cc(0x223)]({'sqlCode':_0x2f2312[_0x1af0cc(0x1f9)],'sqlName':_0x2f2312['sqlName'],'filePath':_0x1a1dd3,'status':_0x2cd716,'reason':_0x56c5b8});}return{'method':'POST','url':_0x1af0cc(0x1ef),'body':{'appCode':_0x15eafb[_0x1af0cc(0x221)],'sqlCode':_0x15eafb['str']('sqlcode')||null,'sqlName':_0x15eafb['str'](_0x1af0cc(0x21c))||null,'files':_0x50ea26},'description':_0x1af0cc(0x21d)+_0x50ea26[_0x1af0cc(0x214)]+_0x1af0cc(0x1f1)+_0x49d2f1[_0x1af0cc(0x203)]};},async 'execute'(_0x4775ab){const _0x5e8e06=a181_0x1422ce,_0x50e06e=loadSqlProjectConfig(_0x4775ab[_0x5e8e06(0x221)]),_0x1ea0c2=await readSqlLockFile(_0x50e06e[_0x5e8e06(0x20b)]),{lockData:_0x4ad731,appLock:_0x433940}=ensureSqlLockScope(_0x1ea0c2??createEmptySqlLock(),_0x50e06e['appCode'],_0x50e06e[_0x5e8e06(0x218)],_0x5e8e06(0x220)),_0x49731b=_0x4775ab[_0x5e8e06(0x1f3)]('force'),_0x1600e8=await fetchAllSqlQueries(_0x4775ab[_0x5e8e06(0x221)],{'sqlCode':_0x4775ab[_0x5e8e06(0x1f0)](_0x5e8e06(0x208))||undefined,'sqlName':_0x4775ab[_0x5e8e06(0x1f0)]('name')||undefined});if(_0x1600e8[_0x5e8e06(0x214)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x5e8e06(0x217)};const _0x29b1d8=[],_0x18385e=[];for(const _0xd3bd41 of _0x1600e8){try{_0x29b1d8[_0x5e8e06(0x223)](await ensureSqlContent(_0xd3bd41));}catch(_0x2b8592){_0x18385e['push']({'sqlCode':_0xd3bd41[_0x5e8e06(0x1f9)],'error':_0x2b8592 instanceof Error?_0x2b8592[_0x5e8e06(0x211)]:String(_0x2b8592)});}}if(_0x49731b&&!_0x4775ab['nonInteractive']){let _0x304aa8=![];for(const _0x498813 of _0x29b1d8){const _0x17f2d5=detectModeFromSql(_0x498813),_0x117747=_0x498813[_0x5e8e06(0x216)]?await getDbName(_0x4775ab['appCode'],Number(_0x498813[_0x5e8e06(0x216)]))[_0x5e8e06(0x215)](()=>undefined):undefined,_0x2764b9=buildLocalSqlFileContent({'sqlCode':_0x498813[_0x5e8e06(0x1f9)],'sqlName':_0x498813[_0x5e8e06(0x21a)],'dbId':_0x498813[_0x5e8e06(0x216)]},ensureRemoteSqlContent(_0x498813),{'dbName':_0x117747,'mode':_0x17f2d5,'syncedAt':new Date()[_0x5e8e06(0x212)](),'description':_0x498813[_0x5e8e06(0x224)]}),_0x5404df=resolveLocalSqlFilePath(_0x50e06e,_0x498813[_0x5e8e06(0x1f9)],buildSqlLockEntry(_0x498813,ensureRemoteSqlContent(_0x498813),'',{'dbName':_0x117747}));if(await fileExists(_0x5404df)){const _0xc8ad8f=await readFile(_0x5404df,'utf8');if(!isEquivalentPulledSqlFile(_0xc8ad8f,_0x2764b9,_0x17f2d5)){_0x304aa8=!![];break;}}}if(_0x304aa8){const _0x5d439e=await confirmForceOverwrite(_0x5e8e06(0x22e));if(!_0x5d439e)throw CliErrors[_0x5e8e06(0x213)](_0x5e8e06(0x1f6));}}const _0x1d88e8=cloneSqlLockData(_0x4ad731),_0x4b3e62=_0x1d88e8[_0x5e8e06(0x22b)][_0x50e06e['appCode']],_0x4730c3=[],_0x3d1f8e=[];for(const _0x4f8981 of _0x29b1d8){const _0x21f9a2=_0x4b3e62['sqls'][_0x4f8981[_0x5e8e06(0x1f9)]],_0x1481ef=ensureRemoteSqlContent(_0x4f8981),_0x37055e=detectModeFromSql(_0x4f8981),_0x516131=_0x4f8981[_0x5e8e06(0x216)]?await getDbName(_0x4775ab[_0x5e8e06(0x221)],Number(_0x4f8981[_0x5e8e06(0x216)]))['catch'](()=>undefined):undefined,_0x55c2e6=buildLocalSqlFileContent({'sqlCode':_0x4f8981['sqlCode'],'sqlName':_0x4f8981[_0x5e8e06(0x21a)],'dbId':_0x4f8981[_0x5e8e06(0x216)]},_0x1481ef,{'dbName':_0x516131,'mode':_0x37055e,'syncedAt':new Date()[_0x5e8e06(0x212)](),'description':_0x4f8981['description']}),_0x1a6f22=buildSqlLockEntry(_0x4f8981,_0x1481ef,computeSqlContentHash(_0x55c2e6),{'dbName':_0x516131}),_0x456010=_0x1a6f22['path'],_0x1002e8=join(_0x50e06e[_0x5e8e06(0x203)],_0x456010);try{if(await fileExists(_0x1002e8)){const _0x5e38fd=await readFile(_0x1002e8,_0x5e8e06(0x20d));if(isEquivalentPulledSqlFile(_0x5e38fd,_0x55c2e6,_0x37055e)){_0x3d1f8e[_0x5e8e06(0x223)]({'sqlCode':_0x4f8981[_0x5e8e06(0x1f9)],'reason':_0x5e8e06(0x20e)}),_0x4b3e62['sqls'][_0x4f8981['sqlCode']]={..._0x1a6f22,'hash':computeSqlContentHash(_0x5e38fd),'path':_0x456010};continue;}if(!_0x49731b){_0x3d1f8e[_0x5e8e06(0x223)]({'sqlCode':_0x4f8981[_0x5e8e06(0x1f9)],'reason':_0x5e8e06(0x1fd)});continue;}}const _0x3e6d13=_0x21f9a2?.[_0x5e8e06(0x21f)]?join(_0x50e06e[_0x5e8e06(0x203)],_0x21f9a2[_0x5e8e06(0x21f)]):undefined;_0x3e6d13&&_0x3e6d13!==_0x1002e8&&await fileExists(_0x3e6d13)&&await rm(_0x3e6d13,{'force':!![]}),await ensureParentDirectory(_0x1002e8),await writeFile(_0x1002e8,_0x55c2e6,_0x5e8e06(0x20d)),_0x4b3e62[_0x5e8e06(0x222)][_0x4f8981[_0x5e8e06(0x1f9)]]={..._0x1a6f22,'path':_0x456010},_0x4730c3['push']({'sqlCode':_0x4f8981[_0x5e8e06(0x1f9)],'filePath':_0x1002e8});}catch(_0x1cb89b){_0x18385e[_0x5e8e06(0x223)]({'sqlCode':_0x4f8981[_0x5e8e06(0x1f9)],'error':_0x1cb89b instanceof Error?_0x1cb89b[_0x5e8e06(0x211)]:String(_0x1cb89b)});}}return _0x4b3e62[_0x5e8e06(0x20f)]=new Date()[_0x5e8e06(0x212)](),await writeSqlLockFile(_0x50e06e[_0x5e8e06(0x20b)],_0x1d88e8),{'ok':_0x18385e['length']===0x0,'data':{'pulled':_0x4730c3,'skipped':_0x3d1f8e,'failed':_0x18385e},'message':'Pull\x20complete:\x20'+_0x4730c3[_0x5e8e06(0x214)]+_0x5e8e06(0x22d)+_0x3d1f8e[_0x5e8e06(0x214)]+_0x5e8e06(0x1f7)+_0x18385e[_0x5e8e06(0x214)]+_0x5e8e06(0x20c)};}};function detectModeFromSql(_0x13542a){const _0x51e428=a181_0x1422ce,_0x3b3739=ensureRemoteSqlContent(_0x13542a),_0x2ef659=stripLocalSqlMetadata(_0x3b3739,'mybatisXml')[_0x51e428(0x228)]();if(/^<(select|insert|update|delete)\b/i['test'](_0x2ef659))return _0x51e428(0x22a);return _0x51e428(0x1f2);}function isEquivalentPulledSqlFile(_0x1bd5b1,_0x2b7937,_0x12c1a1){return normalizePullComparableContent(_0x1bd5b1,_0x12c1a1)===normalizePullComparableContent(_0x2b7937,_0x12c1a1);}function normalizePullComparableContent(_0x5e4edb,_0x10f19d){const _0x58ffef=a181_0x1422ce,_0x2bac70=_0x5e4edb[_0x58ffef(0x200)](/\r\n/g,'\x0a')['split']('\x0a'),_0x5d407d=_0x2bac70[_0x58ffef(0x1fa)](_0x25a1af=>!isSyncedAtMetadataLine(_0x25a1af,_0x10f19d));return _0x5d407d['join']('\x0a');}function isSyncedAtMetadataLine(_0x6879f,_0x4596b5){const _0x313348=a181_0x1422ce;if(_0x4596b5===_0x313348(0x22a))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x313348(0x1f8)](_0x6879f);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x313348(0x1f8)](_0x6879f);}
|
|
1
|
+
const a181_0x2f79b8=a181_0x4f5b;function a181_0x1a50(){const _0x524d1a=['replace','sqlRootDir','boolean','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','toISOString','991620Ksvkcn','Force\x20pull\x20cancelled.','bool','310031hIifta','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','cancelled','195686wzZquT','catch','str','\x20SQL\x20file(s)\x20into\x20','sql','2007831FwmUlP','165niSrTk','sqlCode','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','Pull\x20complete:\x20','8104tUUuVF','paging','length','POST','trimStart','conflict','filter','7649140MuVyxF','join','No\x20remote\x20SQL\x20queries\x20matched.','mybatisXml','appCode','name','totalCount','apps','local\x20differs\x20from\x20remote','2409003PLOrpI','pull','lastSync','utf8','sqlcode','Filter\x20by\x20SQL\x20display\x20name','8GKbjIY','tableData','path','push','sqlName','lockFilePath','dbId','test','6bClrPD','sqlContent','read','description','unchanged','sqlRoot','Would\x20pull\x20','skipped'];a181_0x1a50=function(){return _0x524d1a;};return a181_0x1a50();}(function(_0x484bfa,_0x4d2d0c){const _0x427a07=a181_0x4f5b,_0x1501d2=_0x484bfa();while(!![]){try{const _0x2faea7=parseInt(_0x427a07(0x1f5))/0x1+parseInt(_0x427a07(0x1f9))/0x2*(parseInt(_0x427a07(0x1e5))/0x3)+-parseInt(_0x427a07(0x203))/0x4*(-parseInt(_0x427a07(0x1ff))/0x5)+-parseInt(_0x427a07(0x1f2))/0x6+parseInt(_0x427a07(0x1fe))/0x7+parseInt(_0x427a07(0x1dd))/0x8*(parseInt(_0x427a07(0x213))/0x9)+-parseInt(_0x427a07(0x20a))/0xa;if(_0x2faea7===_0x4d2d0c)break;else _0x1501d2['push'](_0x1501d2['shift']());}catch(_0xf0925d){_0x1501d2['push'](_0x1501d2['shift']());}}}(a181_0x1a50,0x3011b));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x595222,_0x5d0eb5){const _0x47195e=a181_0x4f5b,_0x254a45=[];let _0x2230ef=0x1;while(!![]){const _0x2e7e19=await listSqlQueries(_0x595222,{'currentPage':_0x2230ef,'pageSize':PAGE_SIZE,'sqlCode':_0x5d0eb5[_0x47195e(0x200)],'sqlName':_0x5d0eb5[_0x47195e(0x1e1)]}),_0x886cbd=_0x2e7e19[_0x47195e(0x1de)]??[];_0x254a45[_0x47195e(0x1e0)](..._0x886cbd);if(_0x886cbd['length']===0x0)break;const _0x1b31a6=_0x2e7e19[_0x47195e(0x204)]?.[_0x47195e(0x210)];if(_0x1b31a6!=null?_0x254a45['length']>=_0x1b31a6:_0x886cbd[_0x47195e(0x205)]<PAGE_SIZE)break;_0x2230ef++;}return _0x254a45;}function a181_0x4f5b(_0x2359b4,_0x3c54b8){_0x2359b4=_0x2359b4-0x1dd;const _0x1a5096=a181_0x1a50();let _0x4f5bc0=_0x1a5096[_0x2359b4];return _0x4f5bc0;}async function ensureSqlContent(_0x2f6390){const _0x199ff1=a181_0x4f5b;if(_0x2f6390[_0x199ff1(0x1e6)]!=null&&String(_0x2f6390[_0x199ff1(0x1e6)])[_0x199ff1(0x205)]>0x0)return _0x2f6390;return getSqlQueryDetail(_0x2f6390[_0x199ff1(0x200)]);}export const sqlPull={'service':a181_0x2f79b8(0x1fd),'command':a181_0x2f79b8(0x214),'description':a181_0x2f79b8(0x201),'risk':a181_0x2f79b8(0x1e7),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a181_0x2f79b8(0x20f),'type':'string','description':a181_0x2f79b8(0x218)},{'name':'force','type':a181_0x2f79b8(0x1ef),'description':'Force\x20overwrite\x20local\x20unsynced\x20changes'}],async 'dryRun'(_0x2d636b){const _0x3facd6=a181_0x2f79b8,_0x4ad909=loadSqlProjectConfig(_0x2d636b[_0x3facd6(0x20e)]),_0x286080=await readSqlLockFile(_0x4ad909[_0x3facd6(0x1e2)]),{appLock:_0x5464cd}=ensureSqlLockScope(_0x286080??createEmptySqlLock(),_0x4ad909[_0x3facd6(0x20e)],_0x4ad909[_0x3facd6(0x1ea)],_0x3facd6(0x214)),_0x5c23fb=await fetchAllSqlQueries(_0x2d636b['appCode'],{'sqlCode':_0x2d636b[_0x3facd6(0x1fb)](_0x3facd6(0x217))||undefined,'sqlName':_0x2d636b[_0x3facd6(0x1fb)]('name')||undefined}),_0x253852=[];for(const _0xacf946 of _0x5c23fb){const _0xdba66a=await ensureSqlContent(_0xacf946),_0x23f019=ensureRemoteSqlContent(_0xdba66a),_0x46ea25=detectModeFromSql(_0xdba66a),_0x502fc1=_0xdba66a['dbId']?await getDbName(_0x2d636b[_0x3facd6(0x20e)],Number(_0xdba66a[_0x3facd6(0x1e3)]))[_0x3facd6(0x1fa)](()=>undefined):undefined,_0x11f721=buildLocalSqlFileContent({'sqlCode':_0xdba66a['sqlCode'],'sqlName':_0xdba66a[_0x3facd6(0x1e1)],'dbId':_0xdba66a[_0x3facd6(0x1e3)]},_0x23f019,{'dbName':_0x502fc1,'mode':_0x46ea25,'syncedAt':new Date()[_0x3facd6(0x1f1)](),'description':_0xdba66a[_0x3facd6(0x1e8)]}),_0x10157e=buildSqlLockEntry(_0xdba66a,_0x23f019,'',{'dbName':_0x502fc1}),_0x266339=resolveLocalSqlFilePath(_0x4ad909,_0xdba66a[_0x3facd6(0x200)],_0x10157e);let _0x1500f4='would_pull',_0x3e7f1f;if(await fileExists(_0x266339)){const _0x1710ad=await readFile(_0x266339,'utf8');isEquivalentPulledSqlFile(_0x1710ad,_0x11f721,_0x46ea25)?(_0x1500f4=_0x3facd6(0x1ec),_0x3e7f1f=_0x3facd6(0x1e9)):(_0x1500f4=_0x3facd6(0x208),_0x3e7f1f=_0x3facd6(0x1f0));}_0x253852['push']({'sqlCode':_0xdba66a[_0x3facd6(0x200)],'sqlName':_0xdba66a[_0x3facd6(0x1e1)],'filePath':_0x266339,'status':_0x1500f4,'reason':_0x3e7f1f});}return{'method':_0x3facd6(0x206),'url':_0x3facd6(0x1f7),'body':{'appCode':_0x2d636b[_0x3facd6(0x20e)],'sqlCode':_0x2d636b[_0x3facd6(0x1fb)]('sqlcode')||null,'sqlName':_0x2d636b[_0x3facd6(0x1fb)]('name')||null,'files':_0x253852},'description':_0x3facd6(0x1eb)+_0x253852[_0x3facd6(0x205)]+_0x3facd6(0x1fc)+_0x4ad909['sqlRootDir']};},async 'execute'(_0x4306bf){const _0x11e8f8=a181_0x2f79b8,_0x389ad4=loadSqlProjectConfig(_0x4306bf[_0x11e8f8(0x20e)]),_0x4d9cf0=await readSqlLockFile(_0x389ad4[_0x11e8f8(0x1e2)]),{lockData:_0x52f3d3,appLock:_0x519fa8}=ensureSqlLockScope(_0x4d9cf0??createEmptySqlLock(),_0x389ad4['appCode'],_0x389ad4[_0x11e8f8(0x1ea)],_0x11e8f8(0x214)),_0x365187=_0x4306bf[_0x11e8f8(0x1f4)]('force'),_0x2ed122=await fetchAllSqlQueries(_0x4306bf[_0x11e8f8(0x20e)],{'sqlCode':_0x4306bf[_0x11e8f8(0x1fb)]('sqlcode')||undefined,'sqlName':_0x4306bf[_0x11e8f8(0x1fb)](_0x11e8f8(0x20f))||undefined});if(_0x2ed122['length']===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x11e8f8(0x20c)};const _0x71c0c9=[],_0x49b92d=[];for(const _0x217ac8 of _0x2ed122){try{_0x71c0c9['push'](await ensureSqlContent(_0x217ac8));}catch(_0x3e1c7e){_0x49b92d[_0x11e8f8(0x1e0)]({'sqlCode':_0x217ac8[_0x11e8f8(0x200)],'error':_0x3e1c7e instanceof Error?_0x3e1c7e['message']:String(_0x3e1c7e)});}}if(_0x365187&&!_0x4306bf['nonInteractive']){let _0x505cac=![];for(const _0x41db37 of _0x71c0c9){const _0x29788f=detectModeFromSql(_0x41db37),_0x1dad71=_0x41db37[_0x11e8f8(0x1e3)]?await getDbName(_0x4306bf[_0x11e8f8(0x20e)],Number(_0x41db37[_0x11e8f8(0x1e3)]))[_0x11e8f8(0x1fa)](()=>undefined):undefined,_0x284c05=buildLocalSqlFileContent({'sqlCode':_0x41db37[_0x11e8f8(0x200)],'sqlName':_0x41db37[_0x11e8f8(0x1e1)],'dbId':_0x41db37['dbId']},ensureRemoteSqlContent(_0x41db37),{'dbName':_0x1dad71,'mode':_0x29788f,'syncedAt':new Date()['toISOString'](),'description':_0x41db37[_0x11e8f8(0x1e8)]}),_0x1bcf3a=resolveLocalSqlFilePath(_0x389ad4,_0x41db37['sqlCode'],buildSqlLockEntry(_0x41db37,ensureRemoteSqlContent(_0x41db37),'',{'dbName':_0x1dad71}));if(await fileExists(_0x1bcf3a)){const _0x4d9cdd=await readFile(_0x1bcf3a,'utf8');if(!isEquivalentPulledSqlFile(_0x4d9cdd,_0x284c05,_0x29788f)){_0x505cac=!![];break;}}}if(_0x505cac){const _0x62fa89=await confirmForceOverwrite(_0x11e8f8(0x1f6));if(!_0x62fa89)throw CliErrors[_0x11e8f8(0x1f8)](_0x11e8f8(0x1f3));}}const _0x4ba05f=cloneSqlLockData(_0x52f3d3),_0x4d7fa2=_0x4ba05f[_0x11e8f8(0x211)][_0x389ad4[_0x11e8f8(0x20e)]],_0x5b4f22=[],_0x369000=[];for(const _0x1600bf of _0x71c0c9){const _0x221205=_0x4d7fa2['sqls'][_0x1600bf[_0x11e8f8(0x200)]],_0x4c8a23=ensureRemoteSqlContent(_0x1600bf),_0x3ed294=detectModeFromSql(_0x1600bf),_0x12696d=_0x1600bf[_0x11e8f8(0x1e3)]?await getDbName(_0x4306bf[_0x11e8f8(0x20e)],Number(_0x1600bf[_0x11e8f8(0x1e3)]))[_0x11e8f8(0x1fa)](()=>undefined):undefined,_0x3d07ab=buildLocalSqlFileContent({'sqlCode':_0x1600bf[_0x11e8f8(0x200)],'sqlName':_0x1600bf['sqlName'],'dbId':_0x1600bf[_0x11e8f8(0x1e3)]},_0x4c8a23,{'dbName':_0x12696d,'mode':_0x3ed294,'syncedAt':new Date()[_0x11e8f8(0x1f1)](),'description':_0x1600bf[_0x11e8f8(0x1e8)]}),_0x5887ce=buildSqlLockEntry(_0x1600bf,_0x4c8a23,computeSqlContentHash(_0x3d07ab),{'dbName':_0x12696d}),_0x3ba515=_0x5887ce[_0x11e8f8(0x1df)],_0x13abc2=join(_0x389ad4['sqlRootDir'],_0x3ba515);try{if(await fileExists(_0x13abc2)){const _0x2d04f5=await readFile(_0x13abc2,'utf8');if(isEquivalentPulledSqlFile(_0x2d04f5,_0x3d07ab,_0x3ed294)){_0x369000['push']({'sqlCode':_0x1600bf['sqlCode'],'reason':_0x11e8f8(0x1e9)}),_0x4d7fa2['sqls'][_0x1600bf[_0x11e8f8(0x200)]]={..._0x5887ce,'hash':computeSqlContentHash(_0x2d04f5),'path':_0x3ba515};continue;}if(!_0x365187){_0x369000['push']({'sqlCode':_0x1600bf[_0x11e8f8(0x200)],'reason':_0x11e8f8(0x212)});continue;}}const _0x6dcd05=_0x221205?.['path']?join(_0x389ad4[_0x11e8f8(0x1ee)],_0x221205['path']):undefined;_0x6dcd05&&_0x6dcd05!==_0x13abc2&&await fileExists(_0x6dcd05)&&await rm(_0x6dcd05,{'force':!![]}),await ensureParentDirectory(_0x13abc2),await writeFile(_0x13abc2,_0x3d07ab,_0x11e8f8(0x216)),_0x4d7fa2['sqls'][_0x1600bf[_0x11e8f8(0x200)]]={..._0x5887ce,'path':_0x3ba515},_0x5b4f22[_0x11e8f8(0x1e0)]({'sqlCode':_0x1600bf[_0x11e8f8(0x200)],'filePath':_0x13abc2});}catch(_0x466a10){_0x49b92d[_0x11e8f8(0x1e0)]({'sqlCode':_0x1600bf[_0x11e8f8(0x200)],'error':_0x466a10 instanceof Error?_0x466a10['message']:String(_0x466a10)});}}return _0x4d7fa2[_0x11e8f8(0x215)]=new Date()['toISOString'](),await writeSqlLockFile(_0x389ad4[_0x11e8f8(0x1e2)],_0x4ba05f),{'ok':_0x49b92d[_0x11e8f8(0x205)]===0x0,'data':{'pulled':_0x5b4f22,'skipped':_0x369000,'failed':_0x49b92d},'message':_0x11e8f8(0x202)+_0x5b4f22[_0x11e8f8(0x205)]+'\x20written,\x20'+_0x369000[_0x11e8f8(0x205)]+'\x20skipped,\x20'+_0x49b92d['length']+'\x20failed'};}};function detectModeFromSql(_0x5f485f){const _0x545206=a181_0x2f79b8,_0x273d97=ensureRemoteSqlContent(_0x5f485f),_0x207ec8=stripLocalSqlMetadata(_0x273d97,_0x545206(0x20d))[_0x545206(0x207)]();if(/^<(select|insert|update|delete)\b/i['test'](_0x207ec8))return'mybatisXml';return'sql';}function isEquivalentPulledSqlFile(_0x2b89a5,_0x4832f0,_0x3b7a68){return normalizePullComparableContent(_0x2b89a5,_0x3b7a68)===normalizePullComparableContent(_0x4832f0,_0x3b7a68);}function normalizePullComparableContent(_0x491045,_0x55ab0c){const _0x27bf28=a181_0x2f79b8,_0x39dfb0=_0x491045[_0x27bf28(0x1ed)](/\r\n/g,'\x0a')['split']('\x0a'),_0x206e0c=_0x39dfb0[_0x27bf28(0x209)](_0x22b72c=>!isSyncedAtMetadataLine(_0x22b72c,_0x55ab0c));return _0x206e0c[_0x27bf28(0x20b)]('\x0a');}function isSyncedAtMetadataLine(_0x49f614,_0x585c0e){const _0x429191=a181_0x2f79b8;if(_0x585c0e==='mybatisXml')return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x429191(0x1e4)](_0x49f614);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x429191(0x1e4)](_0x49f614);}
|