@lovrabet/rabetbase-cli 2.5.1-beta.3 → 2.5.1-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +75 -1
- package/lib/api/api-doc.js +1 -1
- package/lib/api/fetch-model-list.js +1 -1
- package/lib/api/generate-api-file.js +1 -1
- package/lib/api/generate-sdk-config-file.d.ts +0 -1
- package/lib/api/generate-sdk-config-file.js +1 -1
- package/lib/auth/auth-server-ui.js +1 -1
- package/lib/auth/auth-server.js +1 -1
- package/lib/auth/constant.js +1 -1
- package/lib/auth/get-cookie.js +1 -1
- package/lib/auth/get-session-user.js +1 -1
- package/lib/auth/is-session-valid.js +1 -1
- package/lib/auth/login-success-html.js +1 -1
- package/lib/auth/logout.js +1 -1
- package/lib/cli-flags.js +1 -1
- package/lib/cli.js +1 -1
- package/lib/commands/api/generate.js +1 -1
- package/lib/commands/api/index.js +1 -1
- package/lib/commands/api/list.js +1 -1
- package/lib/commands/api/pull.js +1 -1
- package/lib/commands/api/shared.js +1 -1
- package/lib/commands/app/index.js +1 -1
- package/lib/commands/app/list.js +1 -1
- package/lib/commands/app/members-list.js +1 -1
- package/lib/commands/app/remote-directory.js +1 -1
- package/lib/commands/app/shared.js +1 -1
- package/lib/commands/app-config/delete.js +1 -1
- package/lib/commands/app-config/get.js +1 -1
- package/lib/commands/app-config/index.js +1 -1
- package/lib/commands/app-config/list.js +1 -1
- package/lib/commands/app-config/set.js +1 -1
- package/lib/commands/app-config/shared.js +1 -1
- package/lib/commands/auth/index.js +1 -1
- package/lib/commands/bff/create.js +1 -1
- package/lib/commands/bff/delete.js +1 -1
- package/lib/commands/bff/detail.js +1 -1
- package/lib/commands/bff/index.js +1 -1
- package/lib/commands/bff/list.js +1 -1
- package/lib/commands/bff/pull.js +1 -1
- package/lib/commands/bff/push.js +1 -1
- package/lib/commands/bff/status.js +1 -1
- package/lib/commands/cli-skill/index.js +1 -1
- package/lib/commands/cli-update.js +1 -1
- package/lib/commands/codegen/index.js +1 -1
- package/lib/commands/codegen/sdk.js +1 -1
- package/lib/commands/codegen/sql.js +1 -1
- package/lib/commands/common/app-registry.js +1 -1
- package/lib/commands/common/app-selector.js +1 -1
- package/lib/commands/common/async-task.js +1 -1
- package/lib/commands/common/dry-run.js +1 -1
- package/lib/commands/common/flags.d.ts +2 -0
- package/lib/commands/common/flags.js +1 -1
- package/lib/commands/common/local-file.js +1 -1
- package/lib/commands/common/validate.js +1 -1
- package/lib/commands/config/delete.js +1 -1
- package/lib/commands/config/get.js +1 -1
- package/lib/commands/config/index.js +1 -1
- package/lib/commands/config/init.d.ts +3 -1
- package/lib/commands/config/init.js +1 -1
- package/lib/commands/config/list.js +1 -1
- package/lib/commands/config/set.js +1 -1
- package/lib/commands/config/shared.js +1 -1
- package/lib/commands/dataset/business-group-update.js +1 -1
- package/lib/commands/dataset/business-groups.js +1 -1
- package/lib/commands/dataset/capability.js +1 -1
- package/lib/commands/dataset/delete.js +1 -1
- package/lib/commands/dataset/detail.js +1 -1
- package/lib/commands/dataset/extend-update.js +1 -1
- package/lib/commands/dataset/field-restore.js +1 -1
- package/lib/commands/dataset/field-update.js +1 -1
- package/lib/commands/dataset/generate.js +1 -1
- package/lib/commands/dataset/index.js +1 -1
- package/lib/commands/dataset/list.js +1 -1
- package/lib/commands/dataset/operations.js +1 -1
- package/lib/commands/dataset/relation-audit.js +1 -1
- package/lib/commands/dataset/relation-create.js +1 -1
- package/lib/commands/dataset/relation-delete.js +1 -1
- package/lib/commands/dataset/relation-shared.js +1 -1
- package/lib/commands/dataset/relation-update.js +1 -1
- package/lib/commands/dataset/relations.js +1 -1
- package/lib/commands/dataset/rename.js +1 -1
- package/lib/commands/dataset/restore.js +1 -1
- package/lib/commands/dataset/user-deleted-field-list.js +1 -1
- package/lib/commands/db/analysis-batching.js +1 -1
- package/lib/commands/db/analyze-batch-plan.js +1 -1
- package/lib/commands/db/analyze-cancel.js +1 -1
- package/lib/commands/db/analyze-start.js +1 -1
- package/lib/commands/db/analyze-status.js +1 -1
- package/lib/commands/db/create.js +1 -1
- package/lib/commands/db/delete.js +1 -1
- package/lib/commands/db/detail.js +1 -1
- package/lib/commands/db/diff-refresh-start.js +1 -1
- package/lib/commands/db/diff-refresh-status.js +1 -1
- package/lib/commands/db/diff.js +1 -1
- package/lib/commands/db/index.js +1 -1
- package/lib/commands/db/list.js +1 -1
- package/lib/commands/db/shared.js +1 -1
- package/lib/commands/db/table-diff-shared.js +1 -1
- package/lib/commands/db/tables.js +1 -1
- package/lib/commands/db/test.js +1 -1
- package/lib/commands/db/update.js +1 -1
- package/lib/commands/deployment/auto-sync.js +1 -1
- package/lib/commands/deployment/index.js +1 -1
- package/lib/commands/deployment/sync.js +1 -1
- package/lib/commands/doctor.js +1 -1
- package/lib/commands/file/index.js +1 -1
- package/lib/commands/issue/index.js +1 -1
- package/lib/commands/issue/nudge.js +1 -1
- package/lib/commands/issue/report.js +1 -1
- package/lib/commands/issue/shared.js +1 -1
- package/lib/commands/kb/create.js +1 -1
- package/lib/commands/kb/delete.js +1 -1
- package/lib/commands/kb/detail.js +1 -1
- package/lib/commands/kb/index.js +1 -1
- package/lib/commands/kb/list.js +1 -1
- package/lib/commands/kb/search.js +1 -1
- package/lib/commands/kb/shared.js +1 -1
- package/lib/commands/kb/update.js +1 -1
- package/lib/commands/logs/index.js +1 -1
- package/lib/commands/menu/asset-update.js +1 -1
- package/lib/commands/menu/delete.js +1 -1
- package/lib/commands/menu/external-link-create.js +1 -1
- package/lib/commands/menu/external-link-update.js +1 -1
- package/lib/commands/menu/group-create.js +1 -1
- package/lib/commands/menu/group-update.js +1 -1
- package/lib/commands/menu/index.js +1 -1
- package/lib/commands/menu/list.js +1 -1
- package/lib/commands/menu/move.js +1 -1
- package/lib/commands/menu/regroup-start.js +1 -1
- package/lib/commands/menu/rename.js +1 -1
- package/lib/commands/menu/shared/compare-table.js +1 -1
- package/lib/commands/menu/shared/delete-plan.js +1 -1
- package/lib/commands/menu/shared/facts.js +1 -1
- package/lib/commands/menu/shared/index.js +1 -1
- package/lib/commands/menu/shared/inquirer.js +1 -1
- package/lib/commands/menu/shared/local-pages.js +1 -1
- package/lib/commands/menu/shared/logic.js +1 -1
- package/lib/commands/menu/shared/mutations.js +1 -1
- package/lib/commands/menu/shared/service.js +1 -1
- package/lib/commands/menu/shared/sync-core.js +1 -1
- package/lib/commands/menu/shared/update-core.js +1 -1
- package/lib/commands/menu/shared/valid-url.js +1 -1
- package/lib/commands/menu/sync.js +1 -1
- package/lib/commands/menu/visibility-update.js +1 -1
- package/lib/commands/notification/config-create.js +1 -1
- package/lib/commands/notification/config-delete.js +1 -1
- package/lib/commands/notification/config-list.js +1 -1
- package/lib/commands/notification/config-update.js +1 -1
- package/lib/commands/notification/index.js +1 -1
- package/lib/commands/notification/shared.js +1 -1
- package/lib/commands/ocr/index.js +1 -1
- package/lib/commands/page/create.js +1 -1
- package/lib/commands/page/custom/detail.js +1 -1
- package/lib/commands/page/custom/list.js +1 -1
- package/lib/commands/page/custom/publish.js +1 -1
- package/lib/commands/page/custom/shared.js +1 -1
- package/lib/commands/page/custom/syntax.js +1 -1
- package/lib/commands/page/custom/template.js +1 -1
- package/lib/commands/page/custom/update.js +1 -1
- package/lib/commands/page/data-list-status.js +1 -1
- package/lib/commands/page/generate-start.js +1 -1
- package/lib/commands/page/generate-status.js +1 -1
- package/lib/commands/page/index.js +1 -1
- package/lib/commands/page/pull.js +1 -1
- package/lib/commands/page/push.js +1 -1
- package/lib/commands/page/relation-audit.js +1 -1
- package/lib/commands/page/restore.js +1 -1
- package/lib/commands/page/shared.js +1 -1
- package/lib/commands/page/sync.js +1 -1
- package/lib/commands/project/create/enhanced-guided-create.js +1 -1
- package/lib/commands/project/create/format-elapsed.js +1 -1
- package/lib/commands/project/create/main.d.ts +1 -0
- package/lib/commands/project/create/main.js +1 -1
- package/lib/commands/project/create/materialize-project-template.js +1 -1
- package/lib/commands/project/create/project-name.js +1 -1
- package/lib/commands/project/create/project-template-archive.js +1 -1
- package/lib/commands/project/create/project-template-path.js +1 -1
- package/lib/commands/project/create/use-copy-project-template.js +1 -1
- package/lib/commands/project/create/use-format-code.js +1 -1
- package/lib/commands/project/create/use-install-dependencies.js +1 -1
- package/lib/commands/project/domain-routing-sync.d.ts +2 -0
- package/lib/commands/project/domain-routing-sync.js +1 -0
- package/lib/commands/project/index.js +1 -1
- package/lib/commands/project/upgrade.js +1 -1
- package/lib/commands/registry.js +1 -1
- package/lib/commands/role/delete.js +1 -1
- package/lib/commands/role/detail.js +1 -1
- package/lib/commands/role/index.js +1 -1
- package/lib/commands/role/list.js +1 -1
- package/lib/commands/role/shared.js +1 -1
- package/lib/commands/role/update.js +1 -1
- package/lib/commands/role/user-add.js +1 -1
- package/lib/commands/role/user-remove.js +1 -1
- package/lib/commands/role/user-resolve.js +1 -1
- package/lib/commands/rule/get.d.ts +2 -0
- package/lib/commands/rule/get.js +1 -0
- package/lib/commands/rule/index.d.ts +2 -0
- package/lib/commands/rule/index.js +1 -0
- package/lib/commands/rule/list.d.ts +2 -0
- package/lib/commands/rule/list.js +1 -0
- package/lib/commands/rule/set.d.ts +2 -0
- package/lib/commands/rule/set.js +1 -0
- package/lib/commands/rule/shared.d.ts +43 -0
- package/lib/commands/rule/shared.js +1 -0
- package/lib/commands/run/index.js +1 -1
- package/lib/commands/schema.js +1 -1
- package/lib/commands/sql/create.js +1 -1
- package/lib/commands/sql/delete.js +1 -1
- package/lib/commands/sql/detail.js +1 -1
- package/lib/commands/sql/exec.js +1 -1
- package/lib/commands/sql/index.js +1 -1
- package/lib/commands/sql/list.js +1 -1
- package/lib/commands/sql/pull.js +1 -1
- package/lib/commands/sql/push.js +1 -1
- package/lib/commands/sql/shared.js +1 -1
- package/lib/commands/sql/status.js +1 -1
- package/lib/commands/sql/validate.js +1 -1
- package/lib/commands/task/index.js +1 -1
- package/lib/commands/task/status.js +1 -1
- package/lib/commands/tenant/index.js +1 -1
- package/lib/commands/tenant/members-list.js +1 -1
- package/lib/commands/tenant/shared.js +1 -1
- package/lib/commands/user-account/dingding-sandbox-bind.js +1 -1
- package/lib/commands/user-account/index.js +1 -1
- package/lib/commands/workspace/add.js +1 -1
- package/lib/commands/workspace/index.js +1 -1
- package/lib/commands/workspace/remove.js +1 -1
- package/lib/config/deployment-sync.js +1 -1
- package/lib/config/domain-config.d.ts +38 -2
- package/lib/config/domain-config.js +1 -1
- package/lib/config/project-domain-routing.d.ts +27 -0
- package/lib/config/project-domain-routing.js +1 -0
- package/lib/config/schema.d.ts +1 -1
- package/lib/config/schema.js +1 -1
- package/lib/constant/cdn.js +1 -1
- package/lib/constant/cli.js +1 -1
- package/lib/constant/defaults.js +1 -1
- package/lib/constant/domain.d.ts +10 -6
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/constant/output.js +1 -1
- package/lib/constant/paths.js +1 -1
- package/lib/constant/region.d.ts +4 -1
- package/lib/constant/region.js +1 -1
- package/lib/constant/risk.js +1 -1
- package/lib/constant/routing-profile.d.ts +43 -49
- package/lib/constant/routing-profile.js +1 -1
- package/lib/context/app-resolver.js +1 -1
- package/lib/context/auth-resolver.js +1 -1
- package/lib/context/config-loader.js +1 -1
- package/lib/context.d.ts +2 -0
- package/lib/context.js +1 -1
- package/lib/core/alias-resolver.js +1 -1
- package/lib/core/api-client.d.ts +37 -0
- package/lib/core/api-client.js +1 -1
- package/lib/core/bff/config.js +1 -1
- package/lib/core/bff/file-system.js +1 -1
- package/lib/core/bff/hash.js +1 -1
- package/lib/core/bff/lock.js +1 -1
- package/lib/core/bff/utils.js +1 -1
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/page/file-system.js +1 -1
- package/lib/core/page/hash.js +1 -1
- package/lib/core/page/lock.js +1 -1
- package/lib/core/sql-index-auditor.js +1 -1
- package/lib/core/sql-sync/config.js +1 -1
- package/lib/core/sql-sync/file-system.js +1 -1
- package/lib/core/sql-sync/hash.js +1 -1
- package/lib/core/sql-sync/lock.js +1 -1
- package/lib/core/sql-sync/utils.js +1 -1
- package/lib/core/sql-validator.js +1 -1
- package/lib/errors.js +1 -1
- package/lib/framework/build-all-flags.js +1 -1
- package/lib/framework/error-output.js +1 -1
- package/lib/framework/explicit-yes.js +1 -1
- package/lib/framework/flags.js +1 -1
- package/lib/framework/help.js +1 -1
- package/lib/framework/index.js +1 -1
- package/lib/framework/output.js +1 -1
- package/lib/framework/response.js +1 -1
- package/lib/framework/runner-alias.js +1 -1
- package/lib/framework/runner.js +1 -1
- package/lib/framework/schema-export.js +1 -1
- package/lib/framework/types.d.ts +0 -1
- package/lib/framework/types.js +1 -1
- package/lib/generated/build-info.d.ts +4 -4
- package/lib/generated/build-info.js +1 -1
- package/lib/generated/official-routing.d.ts +83 -0
- package/lib/generated/official-routing.js +1 -0
- package/lib/generated/routing-contract.d.ts +9 -0
- package/lib/generated/routing-contract.js +1 -0
- package/lib/help.js +1 -1
- package/lib/postinstall.js +1 -1
- package/lib/runtime/confirmation.js +1 -1
- package/lib/runtime/event.js +1 -1
- package/lib/runtime/index.js +1 -1
- package/lib/runtime/queue.js +1 -1
- package/lib/runtime/resolve.js +1 -1
- package/lib/skills/builtin-skill.js +1 -1
- package/lib/skills/main.js +1 -1
- package/lib/skills/npx-skills-add.js +1 -1
- package/lib/skills/skill-presence.js +1 -1
- package/lib/telemetry/cli-command-trace.js +1 -1
- package/lib/telemetry/cli-help-trace.js +1 -1
- package/lib/telemetry/ensure-cli-otel-config.js +1 -1
- package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
- package/lib/telemetry/send-cli-trace-log.js +1 -1
- package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
- package/lib/types/index.d.ts +0 -1
- package/lib/utils/ai_config.js +1 -1
- package/lib/utils/apply-jq-filter.js +1 -1
- package/lib/utils/cdn-config.js +1 -1
- package/lib/utils/check-sdk-version.js +1 -1
- package/lib/utils/cli-version-check.js +1 -1
- package/lib/utils/cli-version-policy.js +1 -1
- package/lib/utils/config.js +1 -1
- package/lib/utils/entity-with-id.js +1 -1
- package/lib/utils/file-utils.js +1 -1
- package/lib/utils/guides-cdn.js +1 -1
- package/lib/utils/http-client.js +1 -1
- package/lib/utils/is-non-interactive.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/params.js +1 -1
- package/lib/utils/platform.js +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.js +1 -1
- package/lib/utils/update-notice.js +1 -1
- package/lib/utils/version.js +1 -1
- package/lib/utils/with-active-cookie.js +1 -1
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +2 -1
- package/skills/rabetbase/SKILL.md +16 -13
- package/skills/rabetbase/guides/sdk-client-generation.md +10 -8
- package/skills/rabetbase/references/rabetbase-api-pull.md +16 -11
- package/skills/rabetbase/references/rabetbase-config.md +3 -6
- package/skills/rabetbase/references/rabetbase-doctor.md +2 -1
- package/skills/rabetbase/references/rabetbase-init.md +32 -10
- package/skills/rabetbase/references/rabetbase-kb.md +7 -7
- package/skills/rabetbase/references/rabetbase-project-create.md +33 -8
- package/skills/rabetbase/references/rabetbase-project-domain-routing-sync.md +28 -0
- package/skills/rabetbase/references/rabetbase-rule.md +49 -0
- package/skills/rabetbase.manifest.json +5 -3
- package/lib/config/project-routing.d.ts +0 -30
- package/lib/config/project-routing.js +0 -1
- package/lib/core/kb-search-client.d.ts +0 -30
- package/lib/core/kb-search-client.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a186_0x59dfd3=a186_0x3efc;(function(_0x51ced7,_0x44d86d){const _0x16b7b7=a186_0x3efc,_0x16567c=_0x51ced7();while(!![]){try{const _0x43c7f8=parseInt(_0x16b7b7(0x148))/0x1*(parseInt(_0x16b7b7(0x13c))/0x2)+-parseInt(_0x16b7b7(0x137))/0x3+-parseInt(_0x16b7b7(0x143))/0x4*(-parseInt(_0x16b7b7(0x141))/0x5)+-parseInt(_0x16b7b7(0x14c))/0x6*(parseInt(_0x16b7b7(0x138))/0x7)+parseInt(_0x16b7b7(0x13f))/0x8*(parseInt(_0x16b7b7(0x14e))/0x9)+-parseInt(_0x16b7b7(0x14d))/0xa+-parseInt(_0x16b7b7(0x139))/0xb*(parseInt(_0x16b7b7(0x13b))/0xc);if(_0x43c7f8===_0x44d86d)break;else _0x16567c['push'](_0x16567c['shift']());}catch(_0xd8aabc){_0x16567c['push'](_0x16567c['shift']());}}}(a186_0x9a90,0xe13ce));import{createDevUserRole}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,CREATE_USER_ROLE_PATH,prepareUserMutation,ROLE_REF_FLAG,USER_REF_FLAG}from'../../commands/role/shared.js';export const roleUserAdd={'service':a186_0x59dfd3(0x136),'command':a186_0x59dfd3(0x140),'description':'Add\x20a\x20user\x20to\x20a\x20role\x20(OWNER\x20rejected);\x20requires\x20--yes','risk':'high-risk-write','flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x45d631){const _0xa2a0b5=a186_0x59dfd3,{mutation:_0x25d4d6}=await prepareUserMutation(_0x45d631,_0xa2a0b5(0x140),!![]);return asDryRunResult(_0x25d4d6,{'method':_0xa2a0b5(0x142),'url':CREATE_USER_ROLE_PATH});},async 'execute'(_0xde3d9a){const _0x500eb6=a186_0x59dfd3,{mutation:_0xb84446,changed:_0x5cd211,role:_0x270277,user:_0x5518f7}=await prepareUserMutation(_0xde3d9a,'user-add',![]);return _0x5cd211&&await createDevUserRole({'appCode':_0xde3d9a[_0x500eb6(0x13a)],'userId':_0x5518f7['userId'],'username':_0x5518f7[_0x500eb6(0x144)],'roleType':_0x270277[_0x500eb6(0x145)],'roleId':_0xb84446[_0x500eb6(0x13e)][_0x500eb6(0x14a)]}),{'ok':!![],'data':_0xb84446,'message':_0x5cd211?'Added\x20user\x20'+_0xb84446['selector'][_0x500eb6(0x14b)]+_0x500eb6(0x147)+_0xb84446[_0x500eb6(0x13e)][_0x500eb6(0x146)]:_0x500eb6(0x13d)+_0xb84446[_0x500eb6(0x13e)]['userId']+_0x500eb6(0x149)+_0xb84446[_0x500eb6(0x13e)][_0x500eb6(0x146)]};}};function a186_0x3efc(_0x526e15,_0x2f9416){_0x526e15=_0x526e15-0x136;const _0x9a9022=a186_0x9a90();let _0x3efc22=_0x9a9022[_0x526e15];return _0x3efc22;}function a186_0x9a90(){const _0x344983=['username','roleType','roleName','\x20to\x20role\x20','1awPpvy','\x20already\x20in\x20role\x20','roleId','userId','1236xBPAjx','139560pOwpAR','3735qpWKQe','role','686601CrCCDj','3143KEjsxh','583xqtPlz','appCode','622056knMKMl','2357774DRMxDe','No\x20change:\x20user\x20','selector','29112KKxAyu','user-add','6581165mtIyxi','POST','4DJbjwd'];a186_0x9a90=function(){return _0x344983;};return a186_0x9a90();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a187_0x1c96(){const _0x588481=['253756bXPeTG','user-remove','149961TOaBnC','high-risk-write','6tTXgzD','\x20from\x20role\x20','4888785kABwXM','userId','24GuGVIt','No\x20change:\x20user\x20','959855doAhHR','Remove\x20a\x20user\x20from\x20a\x20role\x20(OWNER\x20rejected);\x20requires\x20--yes','27qjkawl','Removed\x20user\x20','POST','roleName','\x20not\x20in\x20role\x20','231BrVJZK','28828KTZUpZ','1274016VbHHXC','4117450MNyAUy','2BLXndP','selector'];a187_0x1c96=function(){return _0x588481;};return a187_0x1c96();}function a187_0x450b(_0x3640e9,_0x4e8086){_0x3640e9=_0x3640e9-0x10d;const _0x1c96f9=a187_0x1c96();let _0x450b5c=_0x1c96f9[_0x3640e9];return _0x450b5c;}const a187_0x10802c=a187_0x450b;(function(_0x2d4ba2,_0x4bc1cb){const _0x139edc=a187_0x450b,_0x47cf2a=_0x2d4ba2();while(!![]){try{const _0x5e21e4=-parseInt(_0x139edc(0x11c))/0x1*(parseInt(_0x139edc(0x11a))/0x2)+parseInt(_0x139edc(0x116))/0x3*(-parseInt(_0x139edc(0x117))/0x4)+parseInt(_0x139edc(0x10f))/0x5*(parseInt(_0x139edc(0x120))/0x6)+parseInt(_0x139edc(0x11e))/0x7+parseInt(_0x139edc(0x118))/0x8*(parseInt(_0x139edc(0x111))/0x9)+-parseInt(_0x139edc(0x119))/0xa+parseInt(_0x139edc(0x122))/0xb*(parseInt(_0x139edc(0x10d))/0xc);if(_0x5e21e4===_0x4bc1cb)break;else _0x47cf2a['push'](_0x47cf2a['shift']());}catch(_0x3e3e99){_0x47cf2a['push'](_0x47cf2a['shift']());}}}(a187_0x1c96,0x57c9c));import{deleteDevUserRole}from'../../core/api-client.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{EXPECT_USER_COUNT_FLAG,DELETE_USER_ROLE_PATH,prepareUserMutation,ROLE_REF_FLAG,USER_REF_FLAG}from'../../commands/role/shared.js';export const roleUserRemove={'service':'role','command':'user-remove','description':a187_0x10802c(0x110),'risk':a187_0x10802c(0x11f),'flags':[ROLE_REF_FLAG,USER_REF_FLAG,EXPECT_USER_COUNT_FLAG,APPCODE_FLAG_OPTIONAL],async 'dryRun'(_0x38cefb){const _0x95aff9=a187_0x10802c,{mutation:_0x4baa0e}=await prepareUserMutation(_0x38cefb,_0x95aff9(0x11d),!![]);return asDryRunResult(_0x4baa0e,{'method':_0x95aff9(0x113),'url':DELETE_USER_ROLE_PATH});},async 'execute'(_0x1e95d5){const _0x40b1bd=a187_0x10802c,{matchingRelationIds:_0x5b4312,mutation:_0x12b7b8,changed:_0x77b06c}=await prepareUserMutation(_0x1e95d5,_0x40b1bd(0x11d),![]);if(_0x77b06c)for(const _0x362737 of _0x5b4312){await deleteDevUserRole(_0x362737);}return{'ok':!![],'data':_0x12b7b8,'message':_0x77b06c?_0x40b1bd(0x112)+_0x12b7b8[_0x40b1bd(0x11b)][_0x40b1bd(0x123)]+_0x40b1bd(0x121)+_0x12b7b8[_0x40b1bd(0x11b)][_0x40b1bd(0x114)]:_0x40b1bd(0x10e)+_0x12b7b8['selector'][_0x40b1bd(0x123)]+_0x40b1bd(0x115)+_0x12b7b8['selector'][_0x40b1bd(0x114)]};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a188_0x382d(){const _0x3bbe1d=['50CyWTEc','read','1710TUbFGZ','\x22\x20→\x20userId\x20','8rGyqJH','4vRjVHY','str','role','name','31133443qvcxVA','nickname','trim','1420191gWmpbC','6348167vdaJbT','user-resolve','2133387FTBKWX','2189234yAcsCd','Pass\x20--name\x20<nickname|username>.','3875883PSGPDp','15035wMAEoP','userId','Resolve\x20a\x20nickname/username\x20to\x20a\x20userId\x20(tenant\x20member\x20directory)'];a188_0x382d=function(){return _0x3bbe1d;};return a188_0x382d();}const a188_0x241eec=a188_0x57f9;(function(_0x2a5353,_0x1ea68f){const _0x1d89fa=a188_0x57f9,_0x4794f1=_0x2a5353();while(!![]){try{const _0x4498b9=-parseInt(_0x1d89fa(0x7b))/0x1+parseInt(_0x1d89fa(0x7f))/0x2+parseInt(_0x1d89fa(0x6b))/0x3*(parseInt(_0x1d89fa(0x74))/0x4)+parseInt(_0x1d89fa(0x6c))/0x5*(-parseInt(_0x1d89fa(0x71))/0x6)+-parseInt(_0x1d89fa(0x7c))/0x7*(parseInt(_0x1d89fa(0x73))/0x8)+parseInt(_0x1d89fa(0x7e))/0x9*(-parseInt(_0x1d89fa(0x6f))/0xa)+parseInt(_0x1d89fa(0x78))/0xb;if(_0x4498b9===_0x1ea68f)break;else _0x4794f1['push'](_0x4794f1['shift']());}catch(_0x466613){_0x4794f1['push'](_0x4794f1['shift']());}}}(a188_0x382d,0xceef9));function a188_0x57f9(_0x2d437d,_0x5f2b59){_0x2d437d=_0x2d437d-0x6a;const _0x382d11=a188_0x382d();let _0x57f942=_0x382d11[_0x2d437d];return _0x57f942;}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':a188_0x241eec(0x76),'command':a188_0x241eec(0x7d),'description':a188_0x241eec(0x6e),'risk':a188_0x241eec(0x70),'flags':[USER_NAME_FLAG,APPCODE_FLAG_OPTIONAL],async 'validate'(_0x31adbd){const _0x27db9b=a188_0x241eec;if(!_0x31adbd[_0x27db9b(0x75)](_0x27db9b(0x77))[_0x27db9b(0x7a)]())throw CliErrors['flagMissing'](_0x27db9b(0x77),_0x27db9b(0x6a));},async 'execute'(_0x26270d){const _0x438f24=a188_0x241eec,_0x5ce415=_0x26270d[_0x438f24(0x75)](_0x438f24(0x77))[_0x438f24(0x7a)](),_0x19239a=await resolveUserRef(_0x5ce415,'Select\x20a\x20listed\x20userId,\x20then\x20pass\x20it\x20to\x20`role\x20user-add`\x20or\x20`role\x20user-remove`\x20with\x20--user\x20<id>.');return{'ok':!![],'data':{'user':{'userId':_0x19239a[_0x438f24(0x6d)],'username':_0x19239a['username'],'nickname':_0x19239a[_0x438f24(0x79)],'matchedBy':_0x19239a['matchedBy']}},'message':'Resolved\x20\x22'+_0x5ce415+_0x438f24(0x72)+_0x19239a[_0x438f24(0x6d)]};}};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const a189_0x580624=a189_0x2817;(function(_0x3b0869,_0x4da535){const _0x13f513=a189_0x2817,_0x1bf863=_0x3b0869();while(!![]){try{const _0x240169=-parseInt(_0x13f513(0x80))/0x1*(-parseInt(_0x13f513(0x8a))/0x2)+parseInt(_0x13f513(0x7d))/0x3+parseInt(_0x13f513(0x89))/0x4*(parseInt(_0x13f513(0x79))/0x5)+parseInt(_0x13f513(0x86))/0x6+-parseInt(_0x13f513(0x84))/0x7+parseInt(_0x13f513(0x81))/0x8*(-parseInt(_0x13f513(0x7a))/0x9)+-parseInt(_0x13f513(0x7c))/0xa*(-parseInt(_0x13f513(0x7b))/0xb);if(_0x240169===_0x4da535)break;else _0x1bf863['push'](_0x1bf863['shift']());}catch(_0x5a0259){_0x1bf863['push'](_0x1bf863['shift']());}}}(a189_0x502d,0xecc7d));function a189_0x502d(){const _0x551bbc=['Get\x20one\x20agent\x20context\x20rule\x20for\x20the\x20resolved\x20app','326cOvYia','7511576xmPqfD','\x20--file\x20<path>\x20--dry-run`.','content','10734017sPwJPK','\x20for\x20','1216104wJnZPd','cookie','rule','9060orVHcp','2948nmvnFJ','Loaded\x20','appCode','1745XNLwvw','9iOyisd','20594618fHHtUr','10EhxZlV','288900cCjcjR','read'];a189_0x502d=function(){return _0x551bbc;};return a189_0x502d();}function a189_0x2817(_0x563cad,_0x465c97){_0x563cad=_0x563cad-0x78;const _0x502daa=a189_0x502d();let _0x2817c3=_0x502daa[_0x563cad];return _0x2817c3;}import{getAppRule}from'../../core/api-client.js';import{APP_RULE_TYPE_FLAG,appRuleError,appRuleFileName,projectAppRule,readAppRuleType}from'../../commands/rule/shared.js';export const ruleGet={'service':a189_0x580624(0x88),'command':'get','description':a189_0x580624(0x7f),'risk':a189_0x580624(0x7e),'requiresAppCode':!![],'structuredErrors':!![],'flags':[APP_RULE_TYPE_FLAG],async 'validate'(_0x44b946){readAppRuleType(_0x44b946);},async 'execute'(_0x3f69cc){const _0x55df68=a189_0x580624,_0x4f05e4=readAppRuleType(_0x3f69cc),_0x2ae95c=await getAppRule(_0x3f69cc[_0x55df68(0x87)],{'appCode':_0x3f69cc['appCode'],'type':_0x4f05e4});if(!_0x2ae95c)throw appRuleError('app_rule_not_found',appRuleFileName(_0x4f05e4)+'\x20is\x20not\x20configured\x20for\x20app\x20'+_0x3f69cc['appCode']+'.','Create\x20it\x20with\x20`rabetbase\x20rule\x20set\x20--type\x20'+_0x4f05e4+_0x55df68(0x82));return{'ok':!![],'data':{'rule':{...projectAppRule(_0x4f05e4,_0x2ae95c),'content':_0x2ae95c[_0x55df68(0x83)]}},'message':_0x55df68(0x8b)+appRuleFileName(_0x4f05e4)+_0x55df68(0x85)+_0x3f69cc[_0x55df68(0x78)]};}};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(_0x594da5,_0x46fe1b){const _0x45880d=a190_0x2554,_0x1d7111=_0x594da5();while(!![]){try{const _0x138a56=parseInt(_0x45880d(0x155))/0x1+-parseInt(_0x45880d(0x15b))/0x2*(-parseInt(_0x45880d(0x159))/0x3)+parseInt(_0x45880d(0x156))/0x4*(-parseInt(_0x45880d(0x158))/0x5)+parseInt(_0x45880d(0x15c))/0x6+parseInt(_0x45880d(0x15a))/0x7+-parseInt(_0x45880d(0x154))/0x8*(-parseInt(_0x45880d(0x157))/0x9)+-parseInt(_0x45880d(0x153))/0xa;if(_0x138a56===_0x46fe1b)break;else _0x1d7111['push'](_0x1d7111['shift']());}catch(_0x161210){_0x1d7111['push'](_0x1d7111['shift']());}}}(a190_0x468f,0x6d963));import{ruleGet}from'../../commands/rule/get.js';import{ruleList}from'../../commands/rule/list.js';function a190_0x2554(_0x1afbc5,_0x153930){_0x1afbc5=_0x1afbc5-0x153;const _0x468f84=a190_0x468f();let _0x25547c=_0x468f84[_0x1afbc5];return _0x25547c;}import{ruleSet}from'../../commands/rule/set.js';export const ruleDefinitions=[ruleList,ruleGet,ruleSet];function a190_0x468f(){const _0x1151ab=['454204fqlmMS','9nRMpqd','5pnoTAg','84837DecXQj','3560130tkFfgh','20DeXQgD','659046TSYHST','16360450RWPYny','4647896nFcGgJ','716255FIYbjs'];a190_0x468f=function(){return _0x1151ab;};return a190_0x468f();}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const a191_0x230e70=a191_0x1f24;(function(_0x45a60f,_0x3cc796){const _0x4dc402=a191_0x1f24,_0x4c1f3f=_0x45a60f();while(!![]){try{const _0xdb86e6=parseInt(_0x4dc402(0x12f))/0x1+-parseInt(_0x4dc402(0x136))/0x2*(-parseInt(_0x4dc402(0x131))/0x3)+-parseInt(_0x4dc402(0x135))/0x4+parseInt(_0x4dc402(0x12b))/0x5*(parseInt(_0x4dc402(0x13b))/0x6)+-parseInt(_0x4dc402(0x12d))/0x7*(parseInt(_0x4dc402(0x130))/0x8)+-parseInt(_0x4dc402(0x129))/0x9*(-parseInt(_0x4dc402(0x13c))/0xa)+-parseInt(_0x4dc402(0x12e))/0xb;if(_0xdb86e6===_0x3cc796)break;else _0x4c1f3f['push'](_0x4c1f3f['shift']());}catch(_0x4d645c){_0x4c1f3f['push'](_0x4c1f3f['shift']());}}}(a191_0x1ee3,0x4d0f3));import{getAppRule}from'../../core/api-client.js';function a191_0x1ee3(){const _0x5c93c4=['read','length','30LyBybK','6510yNRhJF','list','2457PWGzWr','rule','97465gxOuwi','List\x20agent\x20context\x20rules\x20for\x20the\x20resolved\x20app','14ouLwNi','1976315GANFcm','543908LtKNOI','1862904efioPq','267XbaqdM','appCode','cookie','map','971980ZgEJZE','8650TNNZcd','Loaded\x20app\x20rule\x20configuration\x20for\x20','all'];a191_0x1ee3=function(){return _0x5c93c4;};return a191_0x1ee3();}function a191_0x1f24(_0x4aa4a7,_0x483fcb){_0x4aa4a7=_0x4aa4a7-0x129;const _0x1ee3e6=a191_0x1ee3();let _0x1f2455=_0x1ee3e6[_0x4aa4a7];return _0x1f2455;}import{APP_RULE_TYPES,projectAppRule}from'../../commands/rule/shared.js';export const ruleList={'service':a191_0x230e70(0x12a),'command':a191_0x230e70(0x13d),'description':a191_0x230e70(0x12c),'risk':a191_0x230e70(0x139),'requiresAppCode':!![],'structuredErrors':!![],'flags':[],async 'execute'(_0xa4a0e3){const _0x25cafc=a191_0x230e70,_0x4f91fd=await Promise[_0x25cafc(0x138)](APP_RULE_TYPES[_0x25cafc(0x134)](_0x2caa1f=>getAppRule(_0xa4a0e3[_0x25cafc(0x133)],{'appCode':_0xa4a0e3[_0x25cafc(0x132)],'type':_0x2caa1f}))),_0x21b3f9=APP_RULE_TYPES[_0x25cafc(0x134)]((_0x2c95b9,_0x4e9f3f)=>projectAppRule(_0x2c95b9,_0x4f91fd[_0x4e9f3f]??null));return{'ok':!![],'data':{'total':_0x21b3f9[_0x25cafc(0x13a)],'rules':_0x21b3f9},'message':_0x25cafc(0x137)+_0xa4a0e3[_0x25cafc(0x132)]};}};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const a192_0x2573c5=a192_0xeb35;(function(_0x45935f,_0x1cbfb8){const _0x1c96af=a192_0xeb35,_0x545953=_0x45935f();while(!![]){try{const _0x3e4e03=parseInt(_0x1c96af(0x119))/0x1*(parseInt(_0x1c96af(0x11e))/0x2)+-parseInt(_0x1c96af(0x11d))/0x3*(-parseInt(_0x1c96af(0x115))/0x4)+-parseInt(_0x1c96af(0x108))/0x5+parseInt(_0x1c96af(0xfb))/0x6+-parseInt(_0x1c96af(0x112))/0x7+-parseInt(_0x1c96af(0x12d))/0x8*(parseInt(_0x1c96af(0xfd))/0x9)+parseInt(_0x1c96af(0x117))/0xa*(parseInt(_0x1c96af(0x130))/0xb);if(_0x3e4e03===_0x1cbfb8)break;else _0x545953['push'](_0x545953['shift']());}catch(_0x2e6c07){_0x545953['push'](_0x545953['shift']());}}}(a192_0x58a8,0xd6548));import{getAppRule,isPlatformTransportFailure,saveAppRule}from'../../core/api-client.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{APP_RULE_TYPE_FLAG,appRuleContextScope,appRuleError,appRuleFileName,inspectAppRuleContent,projectAppRule,readAppRuleFile,readAppRuleType}from'../../commands/rule/shared.js';const SAVE_PATH=a192_0x2573c5(0x122),NON_ATOMIC_WARNING=a192_0x2573c5(0x11a);function a192_0xeb35(_0x3626e1,_0x3075a4){_0x3626e1=_0x3626e1-0xf5;const _0x58a875=a192_0x58a8();let _0xeb3531=_0x58a875[_0x3626e1];return _0xeb3531;}function readSetInput(_0x17b1ac){const _0x16956f=a192_0x2573c5,_0x3a6df0=readAppRuleType(_0x17b1ac),_0x5b9398=_0x17b1ac['str'](_0x16956f(0x104))['trim']();if(!_0x5b9398)throw appRuleError('app_rule_file_required',_0x16956f(0x109),_0x16956f(0x10d));const _0x135dd3=_0x17b1ac[_0x16956f(0x129)](_0x16956f(0xfe));let _0x33b11f;if(_0x135dd3!==undefined){_0x33b11f=Number(_0x135dd3);if(!Number[_0x16956f(0x10e)](_0x33b11f)||_0x33b11f<0x0)throw appRuleError(_0x16956f(0xf8),_0x16956f(0xf6));}return{'type':_0x3a6df0,'file':_0x5b9398,'expectedVersion':_0x33b11f};}async function prepareSet(_0xda97b3){const _0x33a6b7=a192_0x2573c5,_0x413dd8=readSetInput(_0xda97b3),_0x3cd76e=await readAppRuleFile(_0x413dd8[_0x33a6b7(0x104)]),_0x19ce11=await getAppRule(_0xda97b3[_0x33a6b7(0x11b)],{'appCode':_0xda97b3[_0x33a6b7(0x113)],'type':_0x413dd8[_0x33a6b7(0x107)]});if(_0x413dd8[_0x33a6b7(0xf9)]!==undefined&&_0x19ce11?.[_0x33a6b7(0xf7)]!==_0x413dd8[_0x33a6b7(0xf9)])throw appRuleError(_0x33a6b7(0x118),appRuleFileName(_0x413dd8[_0x33a6b7(0x107)])+_0x33a6b7(0x12e),_0x33a6b7(0x12c)+_0x413dd8[_0x33a6b7(0xf9)]+_0x33a6b7(0x131)+(_0x19ce11?.[_0x33a6b7(0xf7)]??'unconfigured')+_0x33a6b7(0x125));return{'input':_0x413dd8,'replacement':_0x3cd76e,'beforeRecord':_0x19ce11,'before':projectAppRule(_0x413dd8[_0x33a6b7(0x107)],_0x19ce11),'planned':{'type':_0x413dd8['type'],'fileName':appRuleFileName(_0x413dd8[_0x33a6b7(0x107)]),'contextScope':appRuleContextScope(_0x413dd8[_0x33a6b7(0x107)]),'enabled':!![],'appCode':_0xda97b3[_0x33a6b7(0x113)],'scope':_0x33a6b7(0x11c),'contentByteSize':_0x3cd76e[_0x33a6b7(0x11f)],'contentHash':_0x3cd76e[_0x33a6b7(0x101)]}};}function warningsFor(_0x37a7d6){return _0x37a7d6===undefined?[]:[NON_ATOMIC_WARNING];}export const ruleSet={'service':'rule','command':a192_0x2573c5(0x114),'description':a192_0x2573c5(0x110),'risk':a192_0x2573c5(0xff),'requiresAppCode':!![],'structuredErrors':!![],'flags':[APP_RULE_TYPE_FLAG,{'name':a192_0x2573c5(0x104),'type':a192_0x2573c5(0xfa),'required':!![],'description':'UTF-8\x20Markdown\x20file\x20(maximum\x205\x20MiB)'},{'name':a192_0x2573c5(0xfe),'type':'number','required':![],'description':a192_0x2573c5(0xfc)}],async 'validate'(_0x1cc97c){readSetInput(_0x1cc97c);},async 'dryRun'(_0x442880){const _0x16be11=a192_0x2573c5,_0x494e08=await prepareSet(_0x442880);return asDryRunResult({'operation':_0x16be11(0x114),'selector':{'appCode':_0x442880[_0x16be11(0x113)],'scope':'rules','type':_0x494e08['input']['type']},'before':_0x494e08[_0x16be11(0x123)],'after':_0x494e08[_0x16be11(0x105)],'dryRun':!![],'backend':{'method':_0x16be11(0xf5),'path':SAVE_PATH},'warnings':warningsFor(_0x494e08[_0x16be11(0x124)][_0x16be11(0xf9)]),'verification':{'expectedVersion':_0x494e08['input'][_0x16be11(0xf9)]??null,'atomicCompareAndSet':![],'lookupCommand':_0x16be11(0x12f)+_0x494e08[_0x16be11(0x124)][_0x16be11(0x107)]+_0x16be11(0x116)}},{'method':_0x16be11(0xf5),'url':SAVE_PATH});},async 'execute'(_0x232caf){const _0xca4465=a192_0x2573c5,_0x1154f2=await prepareSet(_0x232caf);let _0x304c62=![];try{await saveAppRule(_0x232caf[_0xca4465(0x11b)],{'appCode':_0x232caf['appCode'],'type':_0x1154f2[_0xca4465(0x124)]['type'],'content':_0x1154f2[_0xca4465(0x126)][_0xca4465(0x12a)]});}catch(_0x5712e1){if(!isPlatformTransportFailure(_0x5712e1))throw _0x5712e1;_0x304c62=!![];}let _0x1d80d2;try{_0x1d80d2=await getAppRule(_0x232caf[_0xca4465(0x11b)],{'appCode':_0x232caf[_0xca4465(0x113)],'type':_0x1154f2[_0xca4465(0x124)][_0xca4465(0x107)]});}catch(_0x1a5d44){const _0x210a2b=appRuleError(_0x304c62?_0xca4465(0x10a):'app_rule_verification_unavailable',_0xca4465(0x127)+appRuleFileName(_0x1154f2[_0xca4465(0x124)][_0xca4465(0x107)])+_0xca4465(0x12b),_0xca4465(0x10b));Object['defineProperty'](_0x210a2b,_0xca4465(0x10c),{'value':_0x1a5d44,'enumerable':![]});throw _0x210a2b;}const _0x244132=_0x1d80d2&&inspectAppRuleContent(_0x1d80d2[_0xca4465(0x12a)])[_0xca4465(0x101)]===_0x1154f2[_0xca4465(0x126)][_0xca4465(0x101)],_0x3e9d53=_0x1d80d2&&(_0x1154f2[_0xca4465(0x121)]===null||_0x1d80d2['version']>_0x1154f2['beforeRecord'][_0xca4465(0xf7)]);if(!_0x1d80d2||!_0x244132||!_0x3e9d53)throw appRuleError(_0x304c62?_0xca4465(0x10a):_0xca4465(0x106),appRuleFileName(_0x1154f2[_0xca4465(0x124)]['type'])+'\x20does\x20not\x20prove\x20the\x20requested\x20set\x20state.',_0xca4465(0x120)+_0x1154f2['input'][_0xca4465(0x107)]+_0xca4465(0x128));const _0x334d62=warningsFor(_0x1154f2[_0xca4465(0x124)][_0xca4465(0xf9)]);_0x304c62&&_0x334d62[_0xca4465(0x102)](_0xca4465(0x111));const _0x2a4b1c=projectAppRule(_0x1154f2[_0xca4465(0x124)]['type'],_0x1d80d2);return{'ok':!![],'data':{'operation':_0xca4465(0x114),'selector':{'appCode':_0x232caf[_0xca4465(0x113)],'scope':_0xca4465(0x11c),'type':_0x1154f2['input'][_0xca4465(0x107)]},'before':_0x1154f2[_0xca4465(0x123)],'after':_0x2a4b1c,'dryRun':![],'backend':{'method':_0xca4465(0xf5),'path':SAVE_PATH},'warnings':_0x334d62,'verification':{'status':_0xca4465(0x103),'recoveredAfterUnknownResponse':_0x304c62,'expectedVersion':_0x1154f2[_0xca4465(0x124)][_0xca4465(0xf9)]??null,'atomicCompareAndSet':![],'lookupCommand':'rabetbase\x20rule\x20get\x20--type\x20'+_0x1154f2['input'][_0xca4465(0x107)]+_0xca4465(0x116)}},'message':_0xca4465(0x100)+appRuleFileName(_0x1154f2[_0xca4465(0x124)][_0xca4465(0x107)])+_0xca4465(0x10f)+_0x232caf[_0xca4465(0x113)]};}};function a192_0x58a8(){const _0x20a2b7=['7234260sAQXgr','Non-atomic\x20preflight\x20assertion\x20for\x20the\x20current\x20version','8718615ZHSsjk','expected-version','write','Set\x20','contentHash','push','verified','file','planned','app_rule_verification_failed','type','3637820CeqWTn','--file\x20is\x20required.','app_rule_set_outcome_unknown','Do\x20not\x20resubmit\x20automatically.\x20Inspect\x20the\x20exact\x20rule\x20state\x20before\x20retrying.','cause','Pass\x20a\x20UTF-8\x20Markdown\x20file.','isSafeInteger','\x20for\x20','Set\x20an\x20agent\x20context\x20rule\x20from\x20a\x20UTF-8\x20Markdown\x20file','Set\x20response\x20was\x20unavailable;\x20verified\x20the\x20exact\x20content\x20readback\x20without\x20resubmitting.','2106587GCFVbX','appCode','set','2205472kBDHgY','\x20--format\x20compress','50SSVmEg','app_rule_version_mismatch','265324ekhowb','--expected-version\x20is\x20a\x20non-atomic\x20read-before-write\x20assertion;\x20the\x20server\x20save\x20contract\x20has\x20no\x20version\x20predicate.','cookie','rules','3iNRmfy','4VRERtD','byteSize','Inspect\x20it\x20with\x20`rabetbase\x20rule\x20get\x20--type\x20','beforeRecord','/smartapi/knowledge-base/save','before','input','.\x20Run\x20rule\x20get\x20and\x20review\x20before\x20retrying.','replacement','The\x20set\x20request\x20was\x20sent,\x20but\x20','\x20--format\x20compress`;\x20do\x20not\x20resubmit\x20automatically.','flag','content','\x20could\x20not\x20be\x20verified.','Expected\x20','8rgggpk','\x20version\x20changed\x20before\x20write.','rabetbase\x20rule\x20get\x20--type\x20','1292302kvkEUq',';\x20current\x20version\x20is\x20','POST','--expected-version\x20must\x20be\x20a\x20non-negative\x20safe\x20integer.','version','app_rule_expected_version_invalid','expectedVersion','string'];a192_0x58a8=function(){return _0x20a2b7;};return a192_0x58a8();}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { AppRuleRecord, AppRuleType } from "../../core/api-client.js";
|
|
2
|
+
import { CliError } from "../../errors.js";
|
|
3
|
+
import type { RuntimeContext } from "../../framework/types.js";
|
|
4
|
+
export declare const APP_RULE_TYPES: readonly AppRuleType[];
|
|
5
|
+
export declare const MAX_APP_RULE_BYTES: number;
|
|
6
|
+
export type AppRuleContextScope = "page-api-development" | "database-analysis";
|
|
7
|
+
export declare function appRuleError(code: string, message: string, hint?: string): CliError;
|
|
8
|
+
export declare function readAppRuleType(ctx: RuntimeContext): AppRuleType;
|
|
9
|
+
export declare function appRuleFileName(type: AppRuleType): "RULES.md" | "DATABASE.md";
|
|
10
|
+
export declare function appRuleContextScope(type: AppRuleType): AppRuleContextScope;
|
|
11
|
+
export interface AppRuleContent {
|
|
12
|
+
content: string;
|
|
13
|
+
byteSize: number;
|
|
14
|
+
contentHash: string;
|
|
15
|
+
}
|
|
16
|
+
export declare function inspectAppRuleContent(content: string): AppRuleContent;
|
|
17
|
+
export declare function readAppRuleFile(filePath: string): Promise<AppRuleContent>;
|
|
18
|
+
export declare function projectAppRule(type: AppRuleType, record: AppRuleRecord | null): {
|
|
19
|
+
type: AppRuleType;
|
|
20
|
+
fileName: "RULES.md" | "DATABASE.md";
|
|
21
|
+
contextScope: AppRuleContextScope;
|
|
22
|
+
enabled: boolean;
|
|
23
|
+
} | {
|
|
24
|
+
updateTime?: string | number | undefined;
|
|
25
|
+
createTime?: string | number | undefined;
|
|
26
|
+
type: AppRuleType;
|
|
27
|
+
fileName: "RULES.md" | "DATABASE.md";
|
|
28
|
+
contextScope: AppRuleContextScope;
|
|
29
|
+
enabled: boolean;
|
|
30
|
+
id: number;
|
|
31
|
+
scope: "rules";
|
|
32
|
+
appCode: string;
|
|
33
|
+
version: number;
|
|
34
|
+
contentByteSize: number;
|
|
35
|
+
contentHash: string;
|
|
36
|
+
};
|
|
37
|
+
export declare const APP_RULE_TYPE_FLAG: {
|
|
38
|
+
name: string;
|
|
39
|
+
type: "string";
|
|
40
|
+
required: boolean;
|
|
41
|
+
description: string;
|
|
42
|
+
enum: AppRuleType[];
|
|
43
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const a193_0x13ccbb=a193_0x5ac9;(function(_0x2e5bcc,_0x59c149){const _0x20ec9c=a193_0x5ac9,_0x2b9c6f=_0x2e5bcc();while(!![]){try{const _0x57581d=parseInt(_0x20ec9c(0x15b))/0x1*(parseInt(_0x20ec9c(0x160))/0x2)+parseInt(_0x20ec9c(0x15d))/0x3+parseInt(_0x20ec9c(0x141))/0x4*(-parseInt(_0x20ec9c(0x145))/0x5)+-parseInt(_0x20ec9c(0x149))/0x6+parseInt(_0x20ec9c(0x14e))/0x7*(-parseInt(_0x20ec9c(0x154))/0x8)+-parseInt(_0x20ec9c(0x15a))/0x9+parseInt(_0x20ec9c(0x14a))/0xa;if(_0x57581d===_0x59c149)break;else _0x2b9c6f['push'](_0x2b9c6f['shift']());}catch(_0x40d42e){_0x2b9c6f['push'](_0x2b9c6f['shift']());}}}(a193_0x2d3e,0x6fe03));import{createHash}from'node:crypto';function a193_0x2d3e(){const _0x3b46d2=['rules','Pass\x20a\x20UTF-8\x20Markdown\x20file.','1472715lbfbzh','112251WvDyWC','str','1350726ZAYanF','update','RULES.md','4hSxvyC','hex','app_rule_content_too_large','trim','--type\x20must\x20be\x20either\x20rules\x20or\x20database.','isFile','Cannot\x20access\x20app\x20rule\x20file:\x20','decode','byteSize','Context\x20rule\x20type:\x20rules\x20for\x20page/API\x20development\x20agents\x20(DB\x20Agent\x20excluded),\x20database\x20for\x20DB\x20Agent\x20database\x20analysis','digest','app_rule_type_invalid','version','contentHash','createTime','byteLength','43124JxLHXR','App\x20rule\x20content\x20exceeds\x20the\x205\x20MiB\x20server\x20limit.','App\x20rule\x20path\x20is\x20not\x20a\x20regular\x20file:\x20','utf8','255JJLsyZ','from','app_rule_file_unreadable','database-analysis','1548822ZUdWWm','8496610iipfdz','app_rule_file_required','utf-8','message','661913BEIiUu','App\x20rule\x20file\x20is\x20not\x20valid\x20UTF-8:\x20','string','toLowerCase','app_rule_file_invalid','updateTime','8utwUYe','type','app_rule_content_invalid','--file\x20is\x20required.'];a193_0x2d3e=function(){return _0x3b46d2;};return a193_0x2d3e();}import{readFile,stat}from'node:fs/promises';import{resolve}from'node:path';import{TextDecoder}from'node:util';import{CliError}from'../../errors.js';export const APP_RULE_TYPES=[a193_0x13ccbb(0x158),'database'];export const MAX_APP_RULE_BYTES=0x5*0x400*0x400;const APP_RULE_FILES={'rules':a193_0x13ccbb(0x15f),'database':'DATABASE.md'},APP_RULE_CONTEXT_SCOPES={'rules':'page-api-development','database':a193_0x13ccbb(0x148)};function a193_0x5ac9(_0x88e666,_0x34ded8){_0x88e666=_0x88e666-0x13e;const _0x2d3edc=a193_0x2d3e();let _0x5ac928=_0x2d3edc[_0x88e666];return _0x5ac928;}export function appRuleError(_0x457833,_0x16cf7c,_0x385c26){return new CliError(_0x457833,0x1,_0x16cf7c,_0x385c26);}export function readAppRuleType(_0x2ccc16){const _0x184655=a193_0x13ccbb,_0x4abd84=_0x2ccc16[_0x184655(0x15c)](_0x184655(0x155))[_0x184655(0x163)]()[_0x184655(0x151)]();if(_0x4abd84!==_0x184655(0x158)&&_0x4abd84!=='database')throw appRuleError(_0x184655(0x16b),_0x184655(0x164));return _0x4abd84;}export function appRuleFileName(_0x53cd61){return APP_RULE_FILES[_0x53cd61];}export function appRuleContextScope(_0x2c90a6){return APP_RULE_CONTEXT_SCOPES[_0x2c90a6];}export function inspectAppRuleContent(_0x59b325){const _0x4f3e79=a193_0x13ccbb,_0x1b3347=Buffer[_0x4f3e79(0x146)](_0x59b325,_0x4f3e79(0x144));return{'content':_0x59b325,'byteSize':_0x1b3347[_0x4f3e79(0x140)],'contentHash':'sha256:'+createHash('sha256')[_0x4f3e79(0x15e)](_0x1b3347)[_0x4f3e79(0x16a)](_0x4f3e79(0x161))};}export async function readAppRuleFile(_0x24b29a){const _0x279963=a193_0x13ccbb,_0x50467d=_0x24b29a[_0x279963(0x163)]();if(!_0x50467d)throw appRuleError(_0x279963(0x14b),_0x279963(0x157),_0x279963(0x159));const _0x413b06=resolve(_0x50467d);let _0x3643a1;try{_0x3643a1=await stat(_0x413b06);}catch(_0x2c63a5){throw appRuleError(_0x279963(0x147),_0x279963(0x166)+_0x50467d,_0x2c63a5 instanceof Error?_0x2c63a5[_0x279963(0x14d)]:String(_0x2c63a5));}if(!_0x3643a1[_0x279963(0x165)]())throw appRuleError(_0x279963(0x152),_0x279963(0x143)+_0x50467d);if(_0x3643a1['size']>MAX_APP_RULE_BYTES)throw appRuleError('app_rule_content_too_large',_0x279963(0x142));let _0x26ce78;try{_0x26ce78=await readFile(_0x413b06);}catch(_0x21eadf){throw appRuleError('app_rule_file_unreadable','Cannot\x20read\x20app\x20rule\x20file:\x20'+_0x50467d,_0x21eadf instanceof Error?_0x21eadf[_0x279963(0x14d)]:String(_0x21eadf));}if(_0x26ce78[_0x279963(0x140)]>MAX_APP_RULE_BYTES)throw appRuleError(_0x279963(0x162),'App\x20rule\x20content\x20exceeds\x20the\x205\x20MiB\x20server\x20limit.');let _0x264bdb;try{_0x264bdb=new TextDecoder(_0x279963(0x14c),{'fatal':!![],'ignoreBOM':!![]})[_0x279963(0x167)](_0x26ce78);}catch{throw appRuleError(_0x279963(0x156),_0x279963(0x14f)+_0x50467d);}if(!_0x264bdb[_0x279963(0x163)]())throw appRuleError('app_rule_content_invalid','App\x20rule\x20file\x20is\x20blank:\x20'+_0x50467d);return inspectAppRuleContent(_0x264bdb);}export function projectAppRule(_0x409d43,_0x1b6a6e){const _0x5705f=a193_0x13ccbb;if(!_0x1b6a6e)return{'type':_0x409d43,'fileName':appRuleFileName(_0x409d43),'contextScope':appRuleContextScope(_0x409d43),'enabled':![]};const _0x8633ce=inspectAppRuleContent(_0x1b6a6e['content']);return{'type':_0x409d43,'fileName':appRuleFileName(_0x409d43),'contextScope':appRuleContextScope(_0x409d43),'enabled':!![],'id':_0x1b6a6e['id'],'scope':_0x1b6a6e['scope'],'appCode':_0x1b6a6e['appCode'],'version':_0x1b6a6e[_0x5705f(0x16c)],'contentByteSize':_0x8633ce[_0x5705f(0x168)],'contentHash':_0x8633ce[_0x5705f(0x13e)],..._0x1b6a6e['createTime']!==undefined&&_0x1b6a6e[_0x5705f(0x13f)]!==null?{'createTime':_0x1b6a6e['createTime']}:{},..._0x1b6a6e[_0x5705f(0x153)]!==undefined&&_0x1b6a6e[_0x5705f(0x153)]!==null?{'updateTime':_0x1b6a6e['updateTime']}:{}};}export const APP_RULE_TYPE_FLAG={'name':a193_0x13ccbb(0x155),'type':a193_0x13ccbb(0x150),'required':!![],'description':a193_0x13ccbb(0x169),'enum':[...APP_RULE_TYPES]};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a194_0x9dd38b=a194_0x5ea2;(function(_0x10a797,_0x30b805){const _0x238fd7=a194_0x5ea2,_0x29ce03=_0x10a797();while(!![]){try{const _0xd21f7a=parseInt(_0x238fd7(0x181))/0x1+parseInt(_0x238fd7(0x18b))/0x2+-parseInt(_0x238fd7(0x186))/0x3*(parseInt(_0x238fd7(0x18a))/0x4)+parseInt(_0x238fd7(0x174))/0x5+parseInt(_0x238fd7(0x1a3))/0x6+-parseInt(_0x238fd7(0x18e))/0x7+parseInt(_0x238fd7(0x177))/0x8*(-parseInt(_0x238fd7(0x170))/0x9);if(_0xd21f7a===_0x30b805)break;else _0x29ce03['push'](_0x29ce03['shift']());}catch(_0x401902){_0x29ce03['push'](_0x29ce03['shift']());}}}(a194_0x3193,0x39201));import{readFileSync,existsSync}from'node:fs';import{CLI_BIN_NAME}from'../../constant/cli.js';function a194_0x3193(){const _0x2ee1c1=['inherit','bun.lock','\x20\x20EXAMPLES','length','Script\x20\x22','error','\x20run\x20<script>\x0a','vite\x20build\x20--watch\x20exited\x20with\x20code\x20','\x20run\x20preview\x20--watch','pnpm-lock.yaml','dev','1714134lolZyj','No\x20package.json\x20found\x20in\x20current\x20directory.','start','cwd','push','bun.lockb','args','(none)','27NNDKRs','run','No\x20scripts\x20defined\x20in\x20package.json.','\x0a\x20\x20Available\x20scripts:\x0a','90640RuPUFZ','build','pnpm','505320oXnDOx','Enable\x20watch\x20mode\x20for\x20preview','\x20run\x20start','validation','Script\x20name\x20defined\x20in\x20package.json','npm','close','utf-8','keys','vite','446874oJvbQw','preview','Available:\x20','\x22\x20not\x20found\x20in\x20package.json.','vite\x20preview\x20exited\x20with\x20code\x20','6207WTzJGE','\x20run\x20build','\x20\x20\x20\x20','belowMinimum','712tsfQCd','570514WhLUQN','scripts','needsUpgrade','1709302YHJoEC','yarn','script','bun','log','node_modules','\x20exited\x20with\x20code\x20','has','package.json','.bin'];a194_0x3193=function(){return _0x2ee1c1;};return a194_0x3193();}import{resolve,delimiter,join}from'node:path';import{spawn}from'node:child_process';import{CliErrors}from'../../errors.js';function a194_0x5ea2(_0x58644c,_0x30723c){_0x58644c=_0x58644c-0x16a;const _0x3193a9=a194_0x3193();let _0x5ea297=_0x3193a9[_0x58644c];return _0x5ea297;}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([a194_0x9dd38b(0x16a),a194_0x9dd38b(0x1a2)]);function readPackageScripts(_0x1113fc){const _0x2f9fb3=a194_0x9dd38b,_0x28e9bd=resolve(_0x1113fc,_0x2f9fb3(0x196));if(!existsSync(_0x28e9bd))return null;try{const _0x3708ca=JSON['parse'](readFileSync(_0x28e9bd,_0x2f9fb3(0x17e)));return _0x3708ca[_0x2f9fb3(0x18c)]??{};}catch{return null;}}function detectPackageManager(_0x2275f2){const _0x378bdf=a194_0x9dd38b;if(existsSync(resolve(_0x2275f2,_0x378bdf(0x16d)))||existsSync(resolve(_0x2275f2,_0x378bdf(0x199))))return _0x378bdf(0x191);if(existsSync(resolve(_0x2275f2,_0x378bdf(0x1a1))))return _0x378bdf(0x176);if(existsSync(resolve(_0x2275f2,'yarn.lock')))return _0x378bdf(0x18f);return _0x378bdf(0x17c);}async function versionCheck(_0x5b5a15){const _0x1efdd1=a194_0x9dd38b,_0x324c4e=await checkCliVersion();(_0x324c4e[_0x1efdd1(0x18d)]||_0x324c4e[_0x1efdd1(0x189)])&&(printCliUpgradeWarning(_0x324c4e),assertCliVersionSupported(_0x324c4e));const _0x5e1ea1=await checkSdkVersion(_0x5b5a15);if(_0x5e1ea1['needsUpgrade'])printSdkUpgradeWarning(_0x5e1ea1);}function spawnScript(_0x2e618f,_0x372060,_0x3d2c5d,_0x38a995){return new Promise((_0xf8890b,_0x5536ef)=>{const _0xef8549=a194_0x5ea2,_0x2dc60e=[_0xef8549(0x171),_0x372060,..._0x3d2c5d],_0x5ceb47=spawn(_0x2e618f,_0x2dc60e,{'cwd':_0x38a995,'stdio':_0xef8549(0x198),'shell':!![],'env':{...process.env,'PATH':''+join(_0x38a995,'node_modules',_0xef8549(0x197))+delimiter+process.env.PATH}});_0x5ceb47['on']('close',_0x4dd519=>{const _0x56ce53=_0xef8549;if(_0x4dd519===0x0||_0x4dd519===null)_0xf8890b();else _0x5536ef(new Error(_0x2e618f+'\x20run\x20'+_0x372060+_0x56ce53(0x194)+_0x4dd519));}),_0x5ceb47['on']('error',_0x5536ef);});}function spawnViteBuildWatch(_0x349d5a){return new Promise((_0x5646c6,_0x35c80b)=>{const _0x1e7413=a194_0x5ea2,_0x509e0e=spawn(_0x1e7413(0x180),[_0x1e7413(0x175),'--watch'],{'cwd':_0x349d5a,'stdio':_0x1e7413(0x198),'shell':!![],'env':{...process.env,'PATH':''+join(_0x349d5a,_0x1e7413(0x193),_0x1e7413(0x197))+delimiter+process.env.PATH}});_0x509e0e['on'](_0x1e7413(0x17d),_0x168ec5=>{const _0x3b5d7c=_0x1e7413;if(_0x168ec5===0x0||_0x168ec5===null)_0x5646c6();else _0x35c80b(new Error(_0x3b5d7c(0x19f)+_0x168ec5));}),_0x509e0e['on'](_0x1e7413(0x19d),_0x35c80b);});}function spawnVitePreview(_0x531fb1){return new Promise((_0x368010,_0x5524fc)=>{const _0x5db71d=a194_0x5ea2,_0x5c5036=spawn(_0x5db71d(0x180),['preview'],{'cwd':_0x531fb1,'stdio':_0x5db71d(0x198),'shell':!![],'env':{...process.env,'PATH':''+join(_0x531fb1,'node_modules',_0x5db71d(0x197))+delimiter+process.env.PATH}});_0x5c5036['on'](_0x5db71d(0x17d),_0x1fc45e=>{const _0x3aee61=_0x5db71d;if(_0x1fc45e===0x0||_0x1fc45e===null)_0x368010();else _0x5524fc(new Error(_0x3aee61(0x185)+_0x1fc45e));}),_0x5c5036['on'](_0x5db71d(0x19d),_0x5524fc);});}const runFlags=[{'name':'watch','type':'boolean','description':a194_0x9dd38b(0x178),'default':![]}];export const runDefinition={'service':'run','command':'run','description':'Run\x20a\x20package.json\x20script','risk':'write','requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':a194_0x9dd38b(0x190),'description':a194_0x9dd38b(0x17b),'required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x24b387=a194_0x9dd38b,_0x301093=[];return _0x301093[_0x24b387(0x16c)](_0x24b387(0x19a)),_0x301093['push']('\x20\x20\x20\x20'+CLI_BIN_NAME+_0x24b387(0x179)),_0x301093[_0x24b387(0x16c)](_0x24b387(0x188)+CLI_BIN_NAME+_0x24b387(0x187)),_0x301093[_0x24b387(0x16c)](_0x24b387(0x188)+CLI_BIN_NAME+'\x20run\x20preview'),_0x301093['push'](_0x24b387(0x188)+CLI_BIN_NAME+_0x24b387(0x1a0)),_0x301093['join']('\x0a');},async 'execute'(_0x2888c1){const _0x546bb7=a194_0x9dd38b,_0x2cba8a=process[_0x546bb7(0x16b)](),_0x5c5303=_0x2888c1[_0x546bb7(0x16e)][0x0],_0xfaff52=_0x2888c1[_0x546bb7(0x16e)]['slice'](0x1),_0x266492=readPackageScripts(_0x2cba8a);if(!_0x266492)throw CliErrors[_0x546bb7(0x17a)](_0x546bb7(0x1a4));if(!_0x5c5303){const _0x44ca88=Object[_0x546bb7(0x17f)](_0x266492);if(_0x44ca88[_0x546bb7(0x19b)]===0x0)console[_0x546bb7(0x192)](_0x546bb7(0x172));else{console['log'](_0x546bb7(0x173));for(const _0x270bc6 of _0x44ca88){console['log'](_0x546bb7(0x188)+_0x270bc6);}console[_0x546bb7(0x192)]('\x0a\x20\x20Usage:\x20'+CLI_BIN_NAME+_0x546bb7(0x19e));}return{'ok':!![]};}if(!_0x266492[_0x5c5303])throw CliErrors[_0x546bb7(0x17a)](_0x546bb7(0x19c)+_0x5c5303+_0x546bb7(0x184),_0x546bb7(0x183)+(Object['keys'](_0x266492)['join'](',\x20')||_0x546bb7(0x16f)));const _0xf39d45=detectPackageManager(_0x2cba8a);VERSION_CHECK_SCRIPTS[_0x546bb7(0x195)](_0x5c5303)&&await versionCheck(_0x2cba8a);if(_0x5c5303===_0x546bb7(0x182)&&_0x2888c1['bool']('watch'))return await Promise['all']([spawnViteBuildWatch(_0x2cba8a),spawnVitePreview(_0x2cba8a)]),{'ok':!![]};return await spawnScript(_0xf39d45,_0x5c5303,_0xfaff52,_0x2cba8a),{'ok':!![]};}};
|
package/lib/commands/schema.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a195_0x480b1f=a195_0x1061;(function(_0x5c9c1a,_0x1f3945){const _0xbe4e64=a195_0x1061,_0x2d08ed=_0x5c9c1a();while(!![]){try{const _0x37b586=-parseInt(_0xbe4e64(0x177))/0x1*(-parseInt(_0xbe4e64(0x180))/0x2)+-parseInt(_0xbe4e64(0x178))/0x3+parseInt(_0xbe4e64(0x17a))/0x4*(parseInt(_0xbe4e64(0x17d))/0x5)+-parseInt(_0xbe4e64(0x17c))/0x6*(parseInt(_0xbe4e64(0x175))/0x7)+-parseInt(_0xbe4e64(0x179))/0x8+parseInt(_0xbe4e64(0x17b))/0x9+parseInt(_0xbe4e64(0x176))/0xa;if(_0x37b586===_0x1f3945)break;else _0x2d08ed['push'](_0x2d08ed['shift']());}catch(_0x5abbed){_0x2d08ed['push'](_0x2d08ed['shift']());}}}(a195_0x2ab8,0xc3bad));import{buildSchemaPayload}from'../framework/schema-export.js';async function execute(_0x115a21){const _0x5b73f2=await buildSchemaPayload();return{'ok':!![],'data':_0x5b73f2};}function a195_0x1061(_0x3e4cc2,_0x466703){_0x3e4cc2=_0x3e4cc2-0x175;const _0x2ab875=a195_0x2ab8();let _0x1061cc=_0x2ab875[_0x3e4cc2];return _0x1061cc;}export const schemaDefinition={'service':'schema','command':a195_0x480b1f(0x181),'description':'Export\x20machine-readable\x20command\x20schema\x20(JSON)','risk':a195_0x480b1f(0x17f),'requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':a195_0x480b1f(0x17e),'flags':[],'execute':execute};function a195_0x2ab8(){const _0x44c97e=['376NgiWNp','export','28veitOH','9867560ViEJsk','865OeKMed','4246017CDqMXY','3040608uOvwgq','3286076BPPOAb','12724677nqpNpG','1181436kPtCmG','5HBExvG','json','read'];a195_0x2ab8=function(){return _0x44c97e;};return a195_0x2ab8();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a190_0x307e30=a190_0x2adc;(function(_0xbcf2e4,_0x5cc02e){const _0xc370ec=a190_0x2adc,_0x3f61e3=_0xbcf2e4();while(!![]){try{const _0x186eb5=-parseInt(_0xc370ec(0x14d))/0x1*(parseInt(_0xc370ec(0x15a))/0x2)+parseInt(_0xc370ec(0x183))/0x3*(-parseInt(_0xc370ec(0x14e))/0x4)+-parseInt(_0xc370ec(0x16d))/0x5*(-parseInt(_0xc370ec(0x16a))/0x6)+-parseInt(_0xc370ec(0x166))/0x7+-parseInt(_0xc370ec(0x165))/0x8*(parseInt(_0xc370ec(0x179))/0x9)+-parseInt(_0xc370ec(0x177))/0xa+parseInt(_0xc370ec(0x175))/0xb;if(_0x186eb5===_0x5cc02e)break;else _0x3f61e3['push'](_0x3f61e3['shift']());}catch(_0x3fc4c8){_0x3f61e3['push'](_0x3f61e3['shift']());}}}(a190_0xd9c0,0x55836));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(_0x2f120f){const _0x202ad4=a190_0x2adc;if(_0x2f120f===_0x202ad4(0x17e))return[_0x202ad4(0x184),_0x202ad4(0x17a),_0x202ad4(0x171),'']['join']('\x0a');return[_0x202ad4(0x157),''][_0x202ad4(0x148)]('\x0a');}export const sqlCreate={'service':a190_0x307e30(0x189),'command':a190_0x307e30(0x180),'description':'Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','risk':a190_0x307e30(0x16b),'flags':[{'name':a190_0x307e30(0x151),'type':a190_0x307e30(0x17f),'description':a190_0x307e30(0x16e)},{'name':'db-id','type':'number','description':'Target\x20database\x20ID'},{'name':a190_0x307e30(0x160),'type':a190_0x307e30(0x17f),'enum':[a190_0x307e30(0x189),'mybatisXml'],'description':'Local\x20SQL\x20file\x20mode'}],async 'validate'(_0x5d1b8f){const _0x51f30e=a190_0x307e30;if(!_0x5d1b8f[_0x51f30e(0x178)])return;if(!_0x5d1b8f[_0x51f30e(0x164)](_0x51f30e(0x151))[_0x51f30e(0x18c)]())throw CliErrors['flagMissing'](_0x51f30e(0x151),_0x51f30e(0x188));const _0x4a98ef=resolveProvidedDbId(_0x5d1b8f);if(typeof _0x4a98ef!==_0x51f30e(0x18b)||!Number[_0x51f30e(0x167)](_0x4a98ef)||_0x4a98ef<=0x0)throw CliErrors[_0x51f30e(0x18a)]('db-id',_0x51f30e(0x17d));if(!_0x5d1b8f[_0x51f30e(0x164)]('mode')[_0x51f30e(0x18c)]())throw CliErrors[_0x51f30e(0x18a)](_0x51f30e(0x160),_0x51f30e(0x15e));},async 'dryRun'(_0x1c6493){const _0x4ed937=a190_0x307e30,_0x2140a1=loadSqlProjectConfig(_0x1c6493[_0x4ed937(0x168)]),{sqlName:_0x2f1d09,dbId:_0x5b5db1,dbName:_0x3e97dd,mode:_0x4abdf8}=await resolveSqlNewInputs(_0x1c6493),_0x309e8b=buildSqlRelativePath(_0x4ed937(0x187),_0x2f1d09,_0x3e97dd,_0x4abdf8,_0x5b5db1),_0x4a8e55=_0x2140a1[_0x4ed937(0x17c)]+'/'+_0x309e8b;return{'method':'POST','url':_0x4ed937(0x15c),'body':{'appCode':_0x1c6493[_0x4ed937(0x168)],'sqlName':_0x2f1d09,'dbId':_0x5b5db1,'mode':_0x4abdf8,'localPath':_0x4a8e55},'description':_0x4ed937(0x172)+_0x2140a1[_0x4ed937(0x17c)]};},async 'execute'(_0x3d800c){const _0x4b178d=a190_0x307e30,_0x216de3=loadSqlProjectConfig(_0x3d800c[_0x4b178d(0x168)]),{sqlName:_0x18b3d3,dbId:_0x5a8d13,dbName:_0x231fba,mode:_0x7d773b}=await resolveSqlNewInputs(_0x3d800c),_0x1a05ae=generateSqlTemplate(_0x7d773b),_0x3b2f89=await createSqlQuery({'appCode':_0x3d800c[_0x4b178d(0x168)],'sqlName':_0x18b3d3,'dbId':_0x5a8d13,'sqlContent':_0x1a05ae}),_0x8d2d45=ensureRemoteSqlContent(_0x3b2f89),_0x2741f1=_0x231fba||await getDbName(_0x3d800c[_0x4b178d(0x168)],_0x5a8d13)[_0x4b178d(0x15b)](()=>undefined),_0xac7092=buildSqlRelativePath(_0x3b2f89[_0x4b178d(0x182)],_0x3b2f89[_0x4b178d(0x162)],_0x2741f1,_0x7d773b,_0x5a8d13),_0xfcc803=_0x216de3[_0x4b178d(0x17c)]+'/'+_0xac7092,_0xa37f72=buildLocalSqlFileContent({'sqlCode':_0x3b2f89[_0x4b178d(0x182)],'sqlName':_0x3b2f89[_0x4b178d(0x162)],'dbId':_0x3b2f89[_0x4b178d(0x163)]},_0x8d2d45,{'dbName':_0x2741f1,'mode':_0x7d773b,'syncedAt':new Date()[_0x4b178d(0x176)](),'description':_0x3b2f89[_0x4b178d(0x154)]});if(await fileExists(_0xfcc803))throw CliErrors[_0x4b178d(0x186)](_0x4b178d(0x173)+_0xfcc803);await ensureParentDirectory(_0xfcc803),await writeFile(_0xfcc803,_0xa37f72,_0x4b178d(0x15d));const _0x4a096c=await readSqlLockFile(_0x216de3['lockFilePath']),{lockData:_0x21a822,appLock:_0x4711ab}=ensureSqlLockScope(_0x4a096c??createEmptySqlLock(),_0x216de3[_0x4b178d(0x168)],_0x216de3[_0x4b178d(0x16f)],_0x4b178d(0x14a));return _0x4711ab[_0x4b178d(0x181)][_0x3b2f89[_0x4b178d(0x182)]]={...buildSqlLockEntry(_0x3b2f89,_0x8d2d45,computeSqlContentHash(_0xa37f72),{'dbName':_0x2741f1}),'path':_0xac7092,'mode':_0x7d773b},_0x4711ab[_0x4b178d(0x156)]=new Date()[_0x4b178d(0x176)](),await writeSqlLockFile(_0x216de3[_0x4b178d(0x159)],_0x21a822),{'ok':!![],'data':{'id':_0x3b2f89['id'],'sqlCode':_0x3b2f89['sqlCode'],'sqlName':_0x3b2f89[_0x4b178d(0x162)],'dbId':_0x3b2f89[_0x4b178d(0x163)],'path':_0xfcc803,'mode':_0x7d773b},'message':'Created\x20SQL\x20query\x20'+_0x3b2f89[_0x4b178d(0x182)]};}};async function resolveSqlNewInputs(_0x48422b){const _0x5c99a5=await resolveSqlNameInput(_0x48422b),{dbId:_0x921908,dbName:_0x1f0858}=await resolveDbSelection(_0x48422b),_0x2dae6a=await resolveSqlModeInput(_0x48422b);return{'sqlName':_0x5c99a5,'dbId':_0x921908,'dbName':_0x1f0858,'mode':_0x2dae6a};}async function resolveSqlNameInput(_0x29d96f){const _0x3acc13=a190_0x307e30,_0x3a8c85=_0x29d96f[_0x3acc13(0x164)](_0x3acc13(0x151))[_0x3acc13(0x18c)]();if(_0x3a8c85)return _0x3a8c85;if(_0x29d96f[_0x3acc13(0x178)])throw CliErrors['flagMissing'](_0x3acc13(0x151),_0x3acc13(0x188));return(await input({'message':'SQL\x20name:','validate':_0x2a4bb4=>_0x2a4bb4[_0x3acc13(0x18c)]()?!![]:_0x3acc13(0x146)}))[_0x3acc13(0x18c)]();}async function resolveDbSelection(_0x2ba742){const _0xc74543=a190_0x307e30,_0x452f37=resolveProvidedDbId(_0x2ba742);if(typeof _0x452f37===_0xc74543(0x18b)&&Number[_0xc74543(0x167)](_0x452f37)&&_0x452f37>0x0)return{'dbId':_0x452f37,'dbName':await getDbName(_0x2ba742[_0xc74543(0x168)],_0x452f37)[_0xc74543(0x15b)](()=>undefined)};if(_0x2ba742[_0xc74543(0x178)])throw CliErrors[_0xc74543(0x18a)](_0xc74543(0x14f),_0xc74543(0x17d));const _0x4f2674=await listDatabases(_0x2ba742[_0xc74543(0x168)])[_0xc74543(0x15b)](()=>[]);if(_0x4f2674['length']===0x1)return{'dbId':_0x4f2674[0x0][_0xc74543(0x163)],'dbName':_0x4f2674[0x0]['dbName']};if(_0x4f2674['length']>0x1){const _0x5a7d70=await select({'message':_0xc74543(0x161),'choices':[..._0x4f2674[_0xc74543(0x152)](_0x71d7a1=>({'name':_0x71d7a1[_0xc74543(0x150)]+'\x20('+_0x71d7a1[_0xc74543(0x163)]+')','value':serializeDbSelection(_0x71d7a1)})),{'name':_0xc74543(0x170),'value':_0xc74543(0x169)}]});if(_0x5a7d70!==_0xc74543(0x169))return deserializeDbSelection(_0x5a7d70);}const _0x1fd18b=await input({'message':_0xc74543(0x158),'validate':_0x1619c9=>{const _0x23b8df=_0xc74543,_0x38796f=_0x1619c9[_0x23b8df(0x18c)]();if(!_0x38796f)return _0x23b8df(0x149);const _0x575225=Number(_0x38796f);if(!Number[_0x23b8df(0x153)](_0x575225)||_0x575225<=0x0)return _0x23b8df(0x16c);return!![];}});return{'dbId':Number(_0x1fd18b[_0xc74543(0x18c)]())};}function a190_0xd9c0(){const _0x578b24=['SQL\x20query\x20display\x20name','sqlRoot','✎\x20Enter\x20dbId\x20manually','</select>','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','File\x20already\x20exists:\x20','parse','15656289pHvXly','toISOString','5817300arqzXg','nonInteractive','106065qqTnhj','\x20\x20SELECT\x201\x20AS\x20id','For\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20statements\x20that\x20run\x20directly','sqlRootDir','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','mybatisXml','string','create','sqls','sqlCode','3nwUKFU','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','For\x20MyBatis\x20XML\x20SQL\x20with\x20dynamic\x20tags','validation','<server-generated-sqlCode>','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','sql','flagMissing','number','trim','SQL\x20name\x20cannot\x20be\x20empty','Plain\x20SQL\x20(sql)','join','dbId\x20cannot\x20be\x20empty','new','MyBatis\x20XML\x20(mybatisXml)','Invalid\x20database\x20selection\x20payload:\x20','499359iMynjy','212720eoJirv','db-id','dbName','name','map','isInteger','description','stringify','lastSync','SELECT\x201\x20AS\x20id;','Target\x20database\x20dbId:','lockFilePath','2QprwGt','catch','/smartapi/custom/saveUserCustomSql','utf8','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','Select\x20the\x20local\x20SQL\x20mode:','mode','Select\x20the\x20target\x20database:','sqlName','dbId','str','8xPKvFf','4201414ZIHRpH','isFinite','appCode','__manual__','22566rqRBeq','write','dbId\x20must\x20be\x20a\x20positive\x20integer','895qaCBdc'];a190_0xd9c0=function(){return _0x578b24;};return a190_0xd9c0();}async function resolveSqlModeInput(_0x593884){const _0x4db02c=a190_0x307e30,_0x367b81=_0x593884[_0x4db02c(0x164)](_0x4db02c(0x160))[_0x4db02c(0x18c)]();if(_0x367b81===_0x4db02c(0x189)||_0x367b81==='mybatisXml')return _0x367b81;if(_0x593884['nonInteractive'])throw CliErrors[_0x4db02c(0x18a)](_0x4db02c(0x160),'--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');return await select({'message':_0x4db02c(0x15f),'choices':[{'name':_0x4db02c(0x147),'value':_0x4db02c(0x189),'description':_0x4db02c(0x17b)},{'name':_0x4db02c(0x14b),'value':_0x4db02c(0x17e),'description':_0x4db02c(0x185)}]});}function serializeDbSelection(_0x2156a1){const _0x410b3e=a190_0x307e30;return JSON[_0x410b3e(0x155)]({'dbId':_0x2156a1[_0x410b3e(0x163)],'dbName':_0x2156a1[_0x410b3e(0x150)]});}function a190_0x2adc(_0x57d11d,_0x1885d1){_0x57d11d=_0x57d11d-0x146;const _0xd9c0f4=a190_0xd9c0();let _0x2adc51=_0xd9c0f4[_0x57d11d];return _0x2adc51;}function deserializeDbSelection(_0x234526){const _0x4484c6=a190_0x307e30;try{const _0x5c3ee6=JSON[_0x4484c6(0x174)](_0x234526);if(typeof _0x5c3ee6[_0x4484c6(0x163)]===_0x4484c6(0x18b)&&Number[_0x4484c6(0x167)](_0x5c3ee6[_0x4484c6(0x163)]))return{'dbId':_0x5c3ee6[_0x4484c6(0x163)],'dbName':_0x5c3ee6['dbName']};}catch{}throw CliErrors['validation'](_0x4484c6(0x14c)+_0x234526);}function resolveProvidedDbId(_0x2d17fc){const _0x55640c=a190_0x307e30,_0x1a3f35=_0x2d17fc['flag'](_0x55640c(0x14f));if(typeof _0x1a3f35===_0x55640c(0x18b)&&Number[_0x55640c(0x167)](_0x1a3f35))return _0x1a3f35;return undefined;}
|
|
1
|
+
const a196_0x244776=a196_0xd99b;(function(_0x4a2f56,_0x3accd0){const _0x59fec1=a196_0xd99b,_0x3990aa=_0x4a2f56();while(!![]){try{const _0x2ac65d=parseInt(_0x59fec1(0x207))/0x1+-parseInt(_0x59fec1(0x1f5))/0x2+-parseInt(_0x59fec1(0x1f2))/0x3+-parseInt(_0x59fec1(0x20a))/0x4+-parseInt(_0x59fec1(0x200))/0x5+parseInt(_0x59fec1(0x21d))/0x6*(parseInt(_0x59fec1(0x1fb))/0x7)+parseInt(_0x59fec1(0x1e8))/0x8*(parseInt(_0x59fec1(0x21c))/0x9);if(_0x2ac65d===_0x3accd0)break;else _0x3990aa['push'](_0x3990aa['shift']());}catch(_0x119a2e){_0x3990aa['push'](_0x3990aa['shift']());}}}(a196_0x346d,0x40e3f));function a196_0xd99b(_0x5e8457,_0x1b3171){_0x5e8457=_0x5e8457-0x1e7;const _0x346dae=a196_0x346d();let _0xd99b20=_0x346dae[_0x5e8457];return _0xd99b20;}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';function a196_0x346d(){const _0xfd6764=['Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','8NhLcWa','For\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20statements\x20that\x20run\x20directly','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','parse','Local\x20SQL\x20file\x20mode','number','lockFilePath','appCode','sqlRoot','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','121125mCrjwC','sqlName','str','265850yxYNeQ','isFinite','join','stringify','utf8','flagMissing','1739612ewXero','sqlCode','name','POST','length','593160pXvSgp','Plain\x20SQL\x20(sql)','Created\x20SQL\x20query\x20','SQL\x20name\x20cannot\x20be\x20empty','SQL\x20name:','Target\x20database\x20ID','SQL\x20query\x20display\x20name','86922kbVkYk','catch','dbId\x20cannot\x20be\x20empty','245908TbiFyr','new','File\x20already\x20exists:\x20','map','dbId\x20must\x20be\x20a\x20positive\x20integer','nonInteractive','validation','__manual__','write','dbId','sqlRootDir','toISOString','description','db-id','MyBatis\x20XML\x20(mybatisXml)','Select\x20the\x20target\x20database:','trim','mode','2553858jrvYhB','6ihJggW','sql','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','</select>','Select\x20the\x20local\x20SQL\x20mode:','SELECT\x201\x20AS\x20id;','create','mybatisXml','string','dbName','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20'];a196_0x346d=function(){return _0xfd6764;};return a196_0x346d();}import{buildSqlRelativePath}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function generateSqlTemplate(_0x26600d){const _0x44502a=a196_0xd99b;if(_0x26600d===_0x44502a(0x224))return['<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','\x20\x20SELECT\x201\x20AS\x20id',_0x44502a(0x220),''][_0x44502a(0x1f7)]('\x0a');return[_0x44502a(0x222),''][_0x44502a(0x1f7)]('\x0a');}export const sqlCreate={'service':a196_0x244776(0x21e),'command':a196_0x244776(0x223),'description':a196_0x244776(0x1e7),'risk':a196_0x244776(0x212),'flags':[{'name':a196_0x244776(0x1fd),'type':a196_0x244776(0x225),'description':a196_0x244776(0x206)},{'name':a196_0x244776(0x217),'type':a196_0x244776(0x1ed),'description':a196_0x244776(0x205)},{'name':a196_0x244776(0x21b),'type':'string','enum':[a196_0x244776(0x21e),a196_0x244776(0x224)],'description':a196_0x244776(0x1ec)}],async 'validate'(_0x1ad0f8){const _0x5a5980=a196_0x244776;if(!_0x1ad0f8[_0x5a5980(0x20f)])return;if(!_0x1ad0f8[_0x5a5980(0x1f4)](_0x5a5980(0x1fd))['trim']())throw CliErrors[_0x5a5980(0x1fa)](_0x5a5980(0x1fd),_0x5a5980(0x1ea));const _0x2f70d2=resolveProvidedDbId(_0x1ad0f8);if(typeof _0x2f70d2!==_0x5a5980(0x1ed)||!Number['isFinite'](_0x2f70d2)||_0x2f70d2<=0x0)throw CliErrors[_0x5a5980(0x1fa)](_0x5a5980(0x217),'--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.');if(!_0x1ad0f8[_0x5a5980(0x1f4)](_0x5a5980(0x21b))[_0x5a5980(0x21a)]())throw CliErrors['flagMissing'](_0x5a5980(0x21b),_0x5a5980(0x21f));},async 'dryRun'(_0x4373c8){const _0x3dc7cd=a196_0x244776,_0x260716=loadSqlProjectConfig(_0x4373c8[_0x3dc7cd(0x1ef)]),{sqlName:_0x45a015,dbId:_0x35d0ef,dbName:_0x6166f5,mode:_0x20058b}=await resolveSqlNewInputs(_0x4373c8),_0x576fcf=buildSqlRelativePath('<server-generated-sqlCode>',_0x45a015,_0x6166f5,_0x20058b,_0x35d0ef),_0x56fd40=_0x260716['sqlRootDir']+'/'+_0x576fcf;return{'method':_0x3dc7cd(0x1fe),'url':'/smartapi/custom/saveUserCustomSql','body':{'appCode':_0x4373c8[_0x3dc7cd(0x1ef)],'sqlName':_0x45a015,'dbId':_0x35d0ef,'mode':_0x20058b,'localPath':_0x56fd40},'description':_0x3dc7cd(0x227)+_0x260716[_0x3dc7cd(0x214)]};},async 'execute'(_0x5646d2){const _0x43d4bd=a196_0x244776,_0x5edebd=loadSqlProjectConfig(_0x5646d2[_0x43d4bd(0x1ef)]),{sqlName:_0x401152,dbId:_0x4c5721,dbName:_0x5ae6d3,mode:_0x3fa456}=await resolveSqlNewInputs(_0x5646d2),_0x1fe9b8=generateSqlTemplate(_0x3fa456),_0x1ea5e2=await createSqlQuery({'appCode':_0x5646d2[_0x43d4bd(0x1ef)],'sqlName':_0x401152,'dbId':_0x4c5721,'sqlContent':_0x1fe9b8}),_0xefaab2=ensureRemoteSqlContent(_0x1ea5e2),_0x4da70d=_0x5ae6d3||await getDbName(_0x5646d2['appCode'],_0x4c5721)[_0x43d4bd(0x208)](()=>undefined),_0x191438=buildSqlRelativePath(_0x1ea5e2['sqlCode'],_0x1ea5e2[_0x43d4bd(0x1f3)],_0x4da70d,_0x3fa456,_0x4c5721),_0x5c0caf=_0x5edebd[_0x43d4bd(0x214)]+'/'+_0x191438,_0x350bd1=buildLocalSqlFileContent({'sqlCode':_0x1ea5e2[_0x43d4bd(0x1fc)],'sqlName':_0x1ea5e2[_0x43d4bd(0x1f3)],'dbId':_0x1ea5e2['dbId']},_0xefaab2,{'dbName':_0x4da70d,'mode':_0x3fa456,'syncedAt':new Date()[_0x43d4bd(0x215)](),'description':_0x1ea5e2[_0x43d4bd(0x216)]});if(await fileExists(_0x5c0caf))throw CliErrors[_0x43d4bd(0x210)](_0x43d4bd(0x20c)+_0x5c0caf);await ensureParentDirectory(_0x5c0caf),await writeFile(_0x5c0caf,_0x350bd1,_0x43d4bd(0x1f9));const _0x111aa3=await readSqlLockFile(_0x5edebd[_0x43d4bd(0x1ee)]),{lockData:_0x14137b,appLock:_0x1662e2}=ensureSqlLockScope(_0x111aa3??createEmptySqlLock(),_0x5edebd[_0x43d4bd(0x1ef)],_0x5edebd[_0x43d4bd(0x1f0)],_0x43d4bd(0x20b));return _0x1662e2['sqls'][_0x1ea5e2['sqlCode']]={...buildSqlLockEntry(_0x1ea5e2,_0xefaab2,computeSqlContentHash(_0x350bd1),{'dbName':_0x4da70d}),'path':_0x191438,'mode':_0x3fa456},_0x1662e2['lastSync']=new Date()[_0x43d4bd(0x215)](),await writeSqlLockFile(_0x5edebd[_0x43d4bd(0x1ee)],_0x14137b),{'ok':!![],'data':{'id':_0x1ea5e2['id'],'sqlCode':_0x1ea5e2[_0x43d4bd(0x1fc)],'sqlName':_0x1ea5e2[_0x43d4bd(0x1f3)],'dbId':_0x1ea5e2[_0x43d4bd(0x213)],'path':_0x5c0caf,'mode':_0x3fa456},'message':_0x43d4bd(0x202)+_0x1ea5e2[_0x43d4bd(0x1fc)]};}};async function resolveSqlNewInputs(_0x5f0b2b){const _0x45d829=await resolveSqlNameInput(_0x5f0b2b),{dbId:_0x578e15,dbName:_0x127e96}=await resolveDbSelection(_0x5f0b2b),_0x58ac36=await resolveSqlModeInput(_0x5f0b2b);return{'sqlName':_0x45d829,'dbId':_0x578e15,'dbName':_0x127e96,'mode':_0x58ac36};}async function resolveSqlNameInput(_0x5b59b2){const _0x5a3aba=a196_0x244776,_0x27bfe6=_0x5b59b2['str'](_0x5a3aba(0x1fd))['trim']();if(_0x27bfe6)return _0x27bfe6;if(_0x5b59b2[_0x5a3aba(0x20f)])throw CliErrors[_0x5a3aba(0x1fa)]('name',_0x5a3aba(0x1ea));return(await input({'message':_0x5a3aba(0x204),'validate':_0x54d1c7=>_0x54d1c7[_0x5a3aba(0x21a)]()?!![]:_0x5a3aba(0x203)}))[_0x5a3aba(0x21a)]();}async function resolveDbSelection(_0x57e6c0){const _0x1a4e8d=a196_0x244776,_0x5eb8b5=resolveProvidedDbId(_0x57e6c0);if(typeof _0x5eb8b5===_0x1a4e8d(0x1ed)&&Number[_0x1a4e8d(0x1f6)](_0x5eb8b5)&&_0x5eb8b5>0x0)return{'dbId':_0x5eb8b5,'dbName':await getDbName(_0x57e6c0[_0x1a4e8d(0x1ef)],_0x5eb8b5)[_0x1a4e8d(0x208)](()=>undefined)};if(_0x57e6c0[_0x1a4e8d(0x20f)])throw CliErrors[_0x1a4e8d(0x1fa)](_0x1a4e8d(0x217),_0x1a4e8d(0x1f1));const _0x29873b=await listDatabases(_0x57e6c0[_0x1a4e8d(0x1ef)])['catch'](()=>[]);if(_0x29873b[_0x1a4e8d(0x1ff)]===0x1)return{'dbId':_0x29873b[0x0]['dbId'],'dbName':_0x29873b[0x0][_0x1a4e8d(0x226)]};if(_0x29873b[_0x1a4e8d(0x1ff)]>0x1){const _0x5c97d6=await select({'message':_0x1a4e8d(0x219),'choices':[..._0x29873b[_0x1a4e8d(0x20d)](_0x3bdf48=>({'name':_0x3bdf48['dbName']+'\x20('+_0x3bdf48['dbId']+')','value':serializeDbSelection(_0x3bdf48)})),{'name':'✎\x20Enter\x20dbId\x20manually','value':_0x1a4e8d(0x211)}]});if(_0x5c97d6!==_0x1a4e8d(0x211))return deserializeDbSelection(_0x5c97d6);}const _0x42744a=await input({'message':'Target\x20database\x20dbId:','validate':_0x4cc554=>{const _0x3c4cb8=_0x1a4e8d,_0x4105fc=_0x4cc554['trim']();if(!_0x4105fc)return _0x3c4cb8(0x209);const _0x49444a=Number(_0x4105fc);if(!Number['isInteger'](_0x49444a)||_0x49444a<=0x0)return _0x3c4cb8(0x20e);return!![];}});return{'dbId':Number(_0x42744a[_0x1a4e8d(0x21a)]())};}async function resolveSqlModeInput(_0x151f50){const _0x50eff9=a196_0x244776,_0x42f37c=_0x151f50[_0x50eff9(0x1f4)](_0x50eff9(0x21b))[_0x50eff9(0x21a)]();if(_0x42f37c==='sql'||_0x42f37c===_0x50eff9(0x224))return _0x42f37c;if(_0x151f50[_0x50eff9(0x20f)])throw CliErrors[_0x50eff9(0x1fa)](_0x50eff9(0x21b),'--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');return await select({'message':_0x50eff9(0x221),'choices':[{'name':_0x50eff9(0x201),'value':_0x50eff9(0x21e),'description':_0x50eff9(0x1e9)},{'name':_0x50eff9(0x218),'value':_0x50eff9(0x224),'description':'For\x20MyBatis\x20XML\x20SQL\x20with\x20dynamic\x20tags'}]});}function serializeDbSelection(_0x25be48){const _0x529588=a196_0x244776;return JSON[_0x529588(0x1f8)]({'dbId':_0x25be48['dbId'],'dbName':_0x25be48[_0x529588(0x226)]});}function deserializeDbSelection(_0x47eb5e){const _0x34d849=a196_0x244776;try{const _0x34e430=JSON[_0x34d849(0x1eb)](_0x47eb5e);if(typeof _0x34e430[_0x34d849(0x213)]==='number'&&Number[_0x34d849(0x1f6)](_0x34e430[_0x34d849(0x213)]))return{'dbId':_0x34e430[_0x34d849(0x213)],'dbName':_0x34e430[_0x34d849(0x226)]};}catch{}throw CliErrors['validation']('Invalid\x20database\x20selection\x20payload:\x20'+_0x47eb5e);}function resolveProvidedDbId(_0xf202fb){const _0x31717b=a196_0x244776,_0x44560a=_0xf202fb['flag'](_0x31717b(0x217));if(typeof _0x44560a===_0x31717b(0x1ed)&&Number[_0x31717b(0x1f6)](_0x44560a))return _0x44560a;return undefined;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a197_0x5544a1=a197_0x4350;(function(_0x5d1701,_0xe9512d){const _0x577ae8=a197_0x4350,_0x27ae66=_0x5d1701();while(!![]){try{const _0x14c652=parseInt(_0x577ae8(0x148))/0x1+parseInt(_0x577ae8(0x152))/0x2*(-parseInt(_0x577ae8(0x13f))/0x3)+-parseInt(_0x577ae8(0x145))/0x4+parseInt(_0x577ae8(0x141))/0x5+-parseInt(_0x577ae8(0x13a))/0x6*(-parseInt(_0x577ae8(0x13c))/0x7)+parseInt(_0x577ae8(0x15a))/0x8*(parseInt(_0x577ae8(0x13d))/0x9)+parseInt(_0x577ae8(0x142))/0xa*(-parseInt(_0x577ae8(0x15b))/0xb);if(_0x14c652===_0xe9512d)break;else _0x27ae66['push'](_0x27ae66['shift']());}catch(_0x34a273){_0x27ae66['push'](_0x27ae66['shift']());}}}(a197_0x2212,0xe3c0f));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';function a197_0x4350(_0xc66abe,_0x1f414c){_0xc66abe=_0xc66abe-0x135;const _0x22124d=a197_0x2212();let _0x4350bd=_0x22124d[_0xc66abe];return _0x4350bd;}import{deleteSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{fileExists}from'../../core/bff/file-system.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{CliErrors}from'../../errors.js';function a197_0x2212(){const _0x1b6ad5=['70Ogzwcy','15752601tjdEMc','lastSync','110943mSrblm','trashedTo','2432865ivRmXL','2075630SwtUEU','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20','validation','2258056dCUXqw','Deleted\x20','sqlcode','1098154VORBxl','delete','length','sqlRootDir','lockFilePath','/smartapi/custom/deleteUserCustomSql','\x20(local\x20file\x20moved\x20to\x20trash)','entries','POST','appCode','22FDAXOX','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','sqls','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','remoteId','Would\x20delete\x20SQL\x20','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','toISOString','8DrZDuq','154XWoDxk','projectRoot','SQL\x20lock\x20file\x20not\x20found.','high-risk-write','sql','filter','replace','str','startsWith','885030sfrABk','trashDir'];a197_0x2212=function(){return _0x1b6ad5;};return a197_0x2212();}import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDelete={'service':a197_0x5544a1(0x135),'command':a197_0x5544a1(0x149),'description':a197_0x5544a1(0x155),'risk':a197_0x5544a1(0x15e),'flags':[SQLCODE_FLAG],async 'validate'(_0x379102){const _0xbfd4f8=a197_0x5544a1,_0x4da613=loadSqlProjectConfig(_0x379102[_0xbfd4f8(0x151)]),_0x22743c=await readSqlLockFile(_0x4da613[_0xbfd4f8(0x14c)]);if(!_0x22743c)throw CliErrors[_0xbfd4f8(0x144)](_0xbfd4f8(0x153));},async 'dryRun'(_0x3c130d){const _0x195a07=a197_0x5544a1,_0x23e0d6=loadSqlProjectConfig(_0x3c130d[_0x195a07(0x151)]),_0x19dc3f=await readSqlLockFile(_0x23e0d6[_0x195a07(0x14c)]);if(!_0x19dc3f)throw CliErrors['validation'](_0x195a07(0x153));const {appLock:_0x1524f4}=ensureSqlLockScope(_0x19dc3f,_0x3c130d[_0x195a07(0x151)],_0x23e0d6['sqlRoot'],_0x195a07(0x149)),_0xca07bc=_0x3c130d[_0x195a07(0x138)](_0x195a07(0x147)),_0x5f0aae=_0x1524f4['sqls'][_0xca07bc];if(!_0x5f0aae)throw CliErrors[_0x195a07(0x144)](_0x195a07(0x158)+_0xca07bc+'\x22.');return{'method':_0x195a07(0x150),'url':_0x195a07(0x14d),'body':{'sqlCode':_0xca07bc,'id':_0x5f0aae[_0x195a07(0x156)],'localPath':resolveLocalSqlFilePath(_0x23e0d6,_0xca07bc,_0x5f0aae)},'description':_0x195a07(0x157)+_0xca07bc+_0x195a07(0x143)+_0x23e0d6[_0x195a07(0x13b)]};},async 'execute'(_0x2df42c){const _0x3311ab=a197_0x5544a1,_0x2d29f9=loadSqlProjectConfig(_0x2df42c[_0x3311ab(0x151)]),_0x49235c=await readSqlLockFile(_0x2d29f9[_0x3311ab(0x14c)]);if(!_0x49235c)throw CliErrors['validation'](_0x3311ab(0x15d));const {lockData:_0x28d1f9,appLock:_0x2849e4}=ensureSqlLockScope(_0x49235c,_0x2df42c['appCode'],_0x2d29f9['sqlRoot'],_0x3311ab(0x149)),_0x5c6ef7=_0x2df42c[_0x3311ab(0x138)](_0x3311ab(0x147)),_0xada61=_0x2849e4[_0x3311ab(0x154)][_0x5c6ef7];if(!_0xada61)throw CliErrors[_0x3311ab(0x144)](_0x3311ab(0x158)+_0x5c6ef7+'\x22.');await deleteSqlQuery({'id':_0xada61[_0x3311ab(0x156)],'sqlCode':_0x5c6ef7}),_0x2849e4[_0x3311ab(0x154)]=Object['fromEntries'](Object[_0x3311ab(0x14f)](_0x2849e4['sqls'])[_0x3311ab(0x136)](([_0xb32f7e])=>_0xb32f7e!==_0x5c6ef7)),_0x2849e4[_0x3311ab(0x13e)]=new Date()[_0x3311ab(0x159)](),await writeSqlLockFile(_0x2d29f9[_0x3311ab(0x14c)],_0x28d1f9);const _0x212734=resolveLocalSqlFilePath(_0x2d29f9,_0x5c6ef7,_0xada61);let _0x4dc10d;await fileExists(_0x212734)&&(_0x4dc10d=await moveToTrash(_0x2d29f9[_0x3311ab(0x15c)],_0x2d29f9[_0x3311ab(0x13b)],_0x212734),await cleanupEmptyDirectories(dirname(_0x212734),_0x2d29f9[_0x3311ab(0x14b)]));const _0x522ba9={'deleted':_0x5c6ef7,'remoteId':_0xada61[_0x3311ab(0x156)]};if(_0x4dc10d)_0x522ba9[_0x3311ab(0x140)]=_0x4dc10d;return{'ok':!![],'data':_0x522ba9,'message':_0x3311ab(0x146)+_0x5c6ef7+(_0x4dc10d?_0x3311ab(0x14e):'')};}};async function moveToTrash(_0x2deba8,_0x18d0e7,_0x1130e4){const _0x3a9d6f=a197_0x5544a1,_0x2fd99e=new Date()[_0x3a9d6f(0x159)]()[_0x3a9d6f(0x137)](/[:.]/g,'-'),_0xae658=relative(_0x2deba8,_0x1130e4),_0x48e377=join(_0x18d0e7,_0x2fd99e,_0xae658);return await mkdir(dirname(_0x48e377),{'recursive':!![]}),await rename(_0x1130e4,_0x48e377),_0x48e377;}async function cleanupEmptyDirectories(_0x449ef1,_0x2717c3){const _0x35d7e4=a197_0x5544a1;let _0x8aacb9=resolve(_0x449ef1);const _0x22f509=resolve(_0x2717c3);while(_0x8aacb9[_0x35d7e4(0x139)](''+_0x22f509+sep)||_0x8aacb9===_0x22f509){if(_0x8aacb9===_0x22f509)return;try{const _0x2b817d=await readdir(_0x8aacb9);if(_0x2b817d[_0x35d7e4(0x14a)]>0x0)return;await rmdir(_0x8aacb9);}catch{return;}_0x8aacb9=dirname(_0x8aacb9);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a198_0xbead87=a198_0x7e71;function a198_0x2fa2(){const _0x9ae9ba=['47650wRnsmt','8rnHJAy','sqlcode','sqlCode','boolean','detail','str','140mPNolM','dbId','6806840cXUtPl','652596bmNrBD','bool','description','verbose','461084vfOLii','1128162aMsnYI','appCode','1275050nPwYzu','read','Return\x20full\x20raw\x20SQL\x20query\x20object','1dxQbOZ','sqlContent','2947095WjimEq'];a198_0x2fa2=function(){return _0x9ae9ba;};return a198_0x2fa2();}function a198_0x7e71(_0xe46ee3,_0x3b7fac){_0xe46ee3=_0xe46ee3-0xe7;const _0x2fa277=a198_0x2fa2();let _0x7e7188=_0x2fa277[_0xe46ee3];return _0x7e7188;}(function(_0x26fadc,_0x5651f1){const _0x237fcb=a198_0x7e71,_0x38e361=_0x26fadc();while(!![]){try{const _0x83e140=-parseInt(_0x237fcb(0xf0))/0x1*(parseInt(_0x237fcb(0xea))/0x2)+parseInt(_0x237fcb(0xeb))/0x3+parseInt(_0x237fcb(0xfa))/0x4*(parseInt(_0x237fcb(0xf3))/0x5)+-parseInt(_0x237fcb(0xfd))/0x6+parseInt(_0x237fcb(0xed))/0x7*(parseInt(_0x237fcb(0xf4))/0x8)+parseInt(_0x237fcb(0xf2))/0x9+-parseInt(_0x237fcb(0xfc))/0xa;if(_0x83e140===_0x5651f1)break;else _0x38e361['push'](_0x38e361['shift']());}catch(_0x5cc3e3){_0x38e361['push'](_0x38e361['shift']());}}}(a198_0x2fa2,0x30a31));import{getSqlQueryInfo}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':'sql','command':a198_0xbead87(0xf8),'description':'Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','risk':a198_0xbead87(0xee),'flags':[SQLCODE_FLAG,{'name':a198_0xbead87(0xe9),'type':a198_0xbead87(0xf7),'description':a198_0xbead87(0xef)}],async 'execute'(_0x4e8b28){const _0x3d1985=a198_0xbead87,_0x587b71=await getSqlQueryInfo(_0x4e8b28[_0x3d1985(0xec)],_0x4e8b28[_0x3d1985(0xf9)](_0x3d1985(0xf5))),_0x52ac51=_0x4e8b28[_0x3d1985(0xe7)](_0x3d1985(0xe9));if(_0x52ac51)return{'ok':!![],'data':_0x587b71};const _0x5753b1=_0x587b71['dbId']?await getDbName(_0x4e8b28[_0x3d1985(0xec)],_0x587b71[_0x3d1985(0xfb)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x587b71[_0x3d1985(0xf6)],'sqlName':_0x587b71['sqlName'],'db':_0x5753b1?_0x5753b1+'\x20('+_0x587b71['dbId']+')':_0x587b71[_0x3d1985(0xfb)]??'','description':_0x587b71[_0x3d1985(0xe8)]??'','sqlContent':_0x587b71[_0x3d1985(0xf1)]??''}};}};
|
package/lib/commands/sql/exec.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a199_0x437d3b=a199_0x47fc;function a199_0x4ee3(){const _0x5d831d=['7661079jeuyTa','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','SQL\x20execution\x20failed','6089825YHGAaV','Returned\x20','1106ilCOPQ','length','7671EnoMGy','str','params','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','1067119ZeaTUH','execSuccess','string','4304884usTCqC','210GxHQHF','now','\x20row(s)\x20in\x20','read','sqlcode','11138120cloPyS','10QWQBDx','108870WOarmM','execError','isArray','exec','appCode'];a199_0x4ee3=function(){return _0x5d831d;};return a199_0x4ee3();}(function(_0x2dd024,_0x208581){const _0x49db94=a199_0x47fc,_0x3c359c=_0x2dd024();while(!![]){try{const _0xa1013e=-parseInt(_0x49db94(0x17d))/0x1+parseInt(_0x49db94(0x177))/0x2*(parseInt(_0x49db94(0x179))/0x3)+parseInt(_0x49db94(0x180))/0x4+parseInt(_0x49db94(0x166))/0x5*(parseInt(_0x49db94(0x16d))/0x6)+-parseInt(_0x49db94(0x175))/0x7+-parseInt(_0x49db94(0x16b))/0x8+-parseInt(_0x49db94(0x172))/0x9*(-parseInt(_0x49db94(0x16c))/0xa);if(_0xa1013e===_0x208581)break;else _0x3c359c['push'](_0x3c359c['shift']());}catch(_0x194454){_0x3c359c['push'](_0x3c359c['shift']());}}}(a199_0x4ee3,0xbd03c));import{executeSql}from'../../core/api-client.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';function a199_0x47fc(_0x58924a,_0x1ba0a5){_0x58924a=_0x58924a-0x166;const _0x4ee375=a199_0x4ee3();let _0x47fced=_0x4ee375[_0x58924a];return _0x47fced;}import{parseJsonParams}from'../../utils/params.js';export const sqlExec={'service':'sql','command':a199_0x437d3b(0x170),'description':a199_0x437d3b(0x17c),'risk':a199_0x437d3b(0x169),'flags':[SQLCODE_FLAG,{'name':a199_0x437d3b(0x17b),'type':a199_0x437d3b(0x17f),'description':a199_0x437d3b(0x173)}],async 'execute'(_0xa4a6dd){const _0xc3e815=a199_0x437d3b,_0x3af79f=parseJsonParams(_0xa4a6dd['str']('params')),_0x5ad0c2=Date[_0xc3e815(0x167)](),_0x10af20=await executeSql(_0xa4a6dd[_0xc3e815(0x171)],_0xa4a6dd[_0xc3e815(0x17a)](_0xc3e815(0x16a)),_0x3af79f),_0x44dd80=Date['now']()-_0x5ad0c2,_0x18702c=_0x10af20?.['execResult']??_0x10af20,_0x3e396c=_0x10af20?.[_0xc3e815(0x17e)]??!![];if(!_0x3e396c)return{'ok':![],'data':{'error':_0x10af20?.[_0xc3e815(0x16e)]||_0xc3e815(0x174),'elapsed':_0x44dd80},'message':_0xc3e815(0x174)};const _0x1b0889=Array[_0xc3e815(0x16f)](_0x18702c)?_0x18702c:[];return{'ok':!![],'data':{'rows':_0x1b0889,'rowCount':_0x1b0889[_0xc3e815(0x178)],'elapsed':_0x44dd80},'message':_0xc3e815(0x176)+_0x1b0889['length']+_0xc3e815(0x168)+_0x44dd80+'ms'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x2fa013,_0x4c7270){const _0x1be528=a200_0x10e3,_0x4e6db5=_0x2fa013();while(!![]){try{const _0x1496a2=-parseInt(_0x1be528(0x165))/0x1*(parseInt(_0x1be528(0x15f))/0x2)+parseInt(_0x1be528(0x163))/0x3*(-parseInt(_0x1be528(0x15c))/0x4)+parseInt(_0x1be528(0x162))/0x5*(parseInt(_0x1be528(0x161))/0x6)+-parseInt(_0x1be528(0x15b))/0x7+parseInt(_0x1be528(0x15d))/0x8+-parseInt(_0x1be528(0x160))/0x9*(parseInt(_0x1be528(0x164))/0xa)+parseInt(_0x1be528(0x15e))/0xb;if(_0x1496a2===_0x4c7270)break;else _0x4e6db5['push'](_0x4e6db5['shift']());}catch(_0x56736f){_0x4e6db5['push'](_0x4e6db5['shift']());}}}(a200_0x7f86,0x3ac13));function a200_0x7f86(){const _0x45e05a=['3cYdHMa','3752050GKXuEe','1LSYEUI','337946dtILhC','259580OWnlVg','1965480SIkXwZ','3105982beGHJW','507406rvHjxm','9lnLOAD','2728158DDbeJk','5UtpuHc'];a200_0x7f86=function(){return _0x45e05a;};return a200_0x7f86();}import{sqlList}from'../../commands/sql/list.js';function a200_0x10e3(_0x162ec0,_0x141658){_0x162ec0=_0x162ec0-0x15b;const _0x7f86f4=a200_0x7f86();let _0x10e3a6=_0x7f86f4[_0x162ec0];return _0x10e3a6;}import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';import{sqlExec}from'../../commands/sql/exec.js';import{sqlPull}from'../../commands/sql/pull.js';import{sqlCreate}from'../../commands/sql/create.js';import{sqlStatus}from'../../commands/sql/status.js';import{sqlPush}from'../../commands/sql/push.js';import{sqlDelete}from'../../commands/sql/delete.js';export const sqlDefinitions=[sqlList,sqlDetail,sqlStatus,sqlCreate,sqlPush,sqlValidate,sqlExec,sqlPull,sqlDelete];
|
package/lib/commands/sql/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a201_0x537520=a201_0x2bac;(function(_0x5df9a6,_0x31cf93){const _0x2c1032=a201_0x2bac,_0x147ca6=_0x5df9a6();while(!![]){try{const _0x4f0e52=-parseInt(_0x2c1032(0xe6))/0x1+parseInt(_0x2c1032(0xf7))/0x2*(parseInt(_0x2c1032(0xe8))/0x3)+-parseInt(_0x2c1032(0xf2))/0x4+-parseInt(_0x2c1032(0xf9))/0x5+-parseInt(_0x2c1032(0xef))/0x6+-parseInt(_0x2c1032(0xe7))/0x7*(parseInt(_0x2c1032(0xf4))/0x8)+parseInt(_0x2c1032(0xea))/0x9;if(_0x4f0e52===_0x31cf93)break;else _0x147ca6['push'](_0x147ca6['shift']());}catch(_0x1a4799){_0x147ca6['push'](_0x147ca6['shift']());}}}(a201_0x2f65,0xd7312));function a201_0x2bac(_0x3e91f5,_0x27c444){_0x3e91f5=_0x3e91f5-0xdf;const _0x2f65fe=a201_0x2f65();let _0x2baccd=_0x2f65fe[_0x3e91f5];return _0x2baccd;}import{listSqlQueries}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':'sql','command':a201_0x537520(0xe5),'description':'List\x20custom\x20SQL\x20queries','risk':'read','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a201_0x537520(0xfd),'type':a201_0x537520(0xf6),'description':a201_0x537520(0xf1)},{'name':a201_0x537520(0xe4),'type':a201_0x537520(0xe9),'description':a201_0x537520(0xfc),'default':0x1},{'name':a201_0x537520(0xf8),'type':'number','description':'Page\x20size'},{'name':a201_0x537520(0xe3),'type':a201_0x537520(0xfa),'description':a201_0x537520(0xfe)}],async 'execute'(_0x3708a5){const _0x5f1c09=a201_0x537520,_0x21389f=await listSqlQueries(_0x3708a5[_0x5f1c09(0xec)],{'sqlCode':_0x3708a5[_0x5f1c09(0xe1)]('sqlcode')||undefined,'sqlName':_0x3708a5[_0x5f1c09(0xe1)](_0x5f1c09(0xfd))||undefined,'currentPage':_0x3708a5[_0x5f1c09(0xed)]('page'),'pageSize':_0x3708a5[_0x5f1c09(0xed)]('pagesize',0x32)}),_0x98cdff=_0x3708a5['bool'](_0x5f1c09(0xe3)),_0x5a8786=_0x21389f['tableData']??[],_0x53933e=_0x21389f[_0x5f1c09(0xeb)]?.['totalCount']??_0x5a8786[_0x5f1c09(0xdf)];let _0x585a36;return _0x98cdff?_0x585a36=_0x5a8786:_0x585a36=await Promise[_0x5f1c09(0xf3)](_0x5a8786[_0x5f1c09(0xff)](async _0xfa737b=>{const _0x5f2ced=_0x5f1c09;let _0x123775;try{_0x123775=_0xfa737b[_0x5f2ced(0xfb)]?await getDbName(_0x3708a5['appCode'],_0xfa737b['dbId']):undefined;}catch{}return{'sqlCode':_0xfa737b[_0x5f2ced(0xf0)],'sqlName':_0xfa737b[_0x5f2ced(0xf5)],'description':_0xfa737b[_0x5f2ced(0x100)]??'','db':_0x123775?_0x123775+'\x20('+_0xfa737b[_0x5f2ced(0xfb)]+')':_0xfa737b['dbId']??''};})),{'ok':!![],'data':_0x585a36,'message':_0x5a8786[_0x5f1c09(0xdf)]===0x0?_0x5f1c09(0xee):_0x5f1c09(0xe2)+_0x5a8786[_0x5f1c09(0xdf)]+_0x5f1c09(0xe0)+_0x53933e+').'};}};function a201_0x2f65(){const _0x1fe02d=['sqlName','string','2GVzpjf','pagesize','4903315hIJTCn','boolean','dbId','Page\x20number','name','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','map','description','length','\x20SQL\x20queries\x20(total:\x20','str','Found\x20','verbose','page','list','102299YSsscV','3738VLmdiK','452964sNxIfg','number','43621614oCvQQZ','paging','appCode','num','No\x20custom\x20SQL\x20queries\x20found.','3234738rGaXUC','sqlCode','Filter\x20by\x20SQL\x20name','4947012KcXHjV','all','18840kGztvG'];a201_0x2f65=function(){return _0x1fe02d;};return a201_0x2f65();}
|
package/lib/commands/sql/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a196_0x3a47db=a196_0x55bc;(function(_0x4ab613,_0x30f8a5){const _0x5f238a=a196_0x55bc,_0x634f4f=_0x4ab613();while(!![]){try{const _0x453133=-parseInt(_0x5f238a(0x212))/0x1*(parseInt(_0x5f238a(0x206))/0x2)+-parseInt(_0x5f238a(0x228))/0x3*(parseInt(_0x5f238a(0x216))/0x4)+-parseInt(_0x5f238a(0x1fa))/0x5*(parseInt(_0x5f238a(0x20b))/0x6)+-parseInt(_0x5f238a(0x20d))/0x7*(parseInt(_0x5f238a(0x1f9))/0x8)+-parseInt(_0x5f238a(0x21d))/0x9+-parseInt(_0x5f238a(0x20f))/0xa+parseInt(_0x5f238a(0x1f0))/0xb;if(_0x453133===_0x30f8a5)break;else _0x634f4f['push'](_0x634f4f['shift']());}catch(_0x52aa08){_0x634f4f['push'](_0x634f4f['shift']());}}}(a196_0x1391,0xe75e9));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(_0x4a9509,_0x52d693){const _0x446e5a=a196_0x55bc,_0x39cebb=[];let _0x24fabd=0x1;while(!![]){const _0xfbe0ef=await listSqlQueries(_0x4a9509,{'currentPage':_0x24fabd,'pageSize':PAGE_SIZE,'sqlCode':_0x52d693[_0x446e5a(0x1f1)],'sqlName':_0x52d693[_0x446e5a(0x229)]}),_0x3e4cb9=_0xfbe0ef[_0x446e5a(0x1f6)]??[];_0x39cebb['push'](..._0x3e4cb9);if(_0x3e4cb9[_0x446e5a(0x1fe)]===0x0)break;const _0x10ec98=_0xfbe0ef[_0x446e5a(0x1fc)]?.[_0x446e5a(0x210)];if(_0x10ec98!=null?_0x39cebb[_0x446e5a(0x1fe)]>=_0x10ec98:_0x3e4cb9[_0x446e5a(0x1fe)]<PAGE_SIZE)break;_0x24fabd++;}return _0x39cebb;}async function ensureSqlContent(_0x2edb1c){const _0xe5fb9f=a196_0x55bc;if(_0x2edb1c[_0xe5fb9f(0x1ef)]!=null&&String(_0x2edb1c[_0xe5fb9f(0x1ef)])[_0xe5fb9f(0x1fe)]>0x0)return _0x2edb1c;return getSqlQueryDetail(_0x2edb1c[_0xe5fb9f(0x1f1)]);}function a196_0x1391(){const _0x2c6e18=['apps','boolean','sqlcode','\x20SQL\x20file(s)\x20into\x20','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','339654cDJRpt','sqlName','str','trimStart','force','message','pull','sqlRootDir','bool','Pull\x20complete:\x20','conflict','sqlContent','65054000fRlJAt','sqlCode','replace','\x20skipped,\x20','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','mybatisXml','tableData','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','name','8dFquyl','47860MnOeXN','skipped','paging','filter','length','lastSync','\x20failed','path','utf8','Force\x20pull\x20cancelled.','No\x20remote\x20SQL\x20queries\x20matched.','join','140438uynzbW','cancelled','POST','toISOString','test','216UeTjtr','catch','8179255WeiBXR','sql','7112090BscAif','totalCount','Force\x20overwrite\x20local\x20unsynced\x20changes','22RGOZsK','dbId','description','unchanged','16piSoeZ','string','Filter\x20by\x20SQL\x20display\x20name','lockFilePath','push','sqlRoot','split','6699195cYjldW','appCode','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','sqls','local\x20differs\x20from\x20remote','nonInteractive'];a196_0x1391=function(){return _0x2c6e18;};return a196_0x1391();}export const sqlPull={'service':a196_0x3a47db(0x20e),'command':a196_0x3a47db(0x22e),'description':a196_0x3a47db(0x1f4),'risk':'read','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a196_0x3a47db(0x1f8),'type':a196_0x3a47db(0x217),'description':a196_0x3a47db(0x218)},{'name':a196_0x3a47db(0x22c),'type':a196_0x3a47db(0x224),'description':a196_0x3a47db(0x211)}],async 'dryRun'(_0x25c4f5){const _0x5d416a=a196_0x3a47db,_0x4050e3=loadSqlProjectConfig(_0x25c4f5[_0x5d416a(0x21e)]),_0x5a3dcd=await readSqlLockFile(_0x4050e3[_0x5d416a(0x219)]),{appLock:_0x2b4ee9}=ensureSqlLockScope(_0x5a3dcd??createEmptySqlLock(),_0x4050e3['appCode'],_0x4050e3[_0x5d416a(0x21b)],_0x5d416a(0x22e)),_0x46c0cd=await fetchAllSqlQueries(_0x25c4f5['appCode'],{'sqlCode':_0x25c4f5[_0x5d416a(0x22a)](_0x5d416a(0x225))||undefined,'sqlName':_0x25c4f5['str'](_0x5d416a(0x1f8))||undefined}),_0x56e506=[];for(const _0x3f1688 of _0x46c0cd){const _0x231072=await ensureSqlContent(_0x3f1688),_0x3dde1d=ensureRemoteSqlContent(_0x231072),_0x55f8ba=detectModeFromSql(_0x231072),_0x22ddf2=_0x231072[_0x5d416a(0x213)]?await getDbName(_0x25c4f5[_0x5d416a(0x21e)],Number(_0x231072['dbId']))['catch'](()=>undefined):undefined,_0xc9d140=buildLocalSqlFileContent({'sqlCode':_0x231072['sqlCode'],'sqlName':_0x231072['sqlName'],'dbId':_0x231072[_0x5d416a(0x213)]},_0x3dde1d,{'dbName':_0x22ddf2,'mode':_0x55f8ba,'syncedAt':new Date()[_0x5d416a(0x209)](),'description':_0x231072[_0x5d416a(0x214)]}),_0x489b9a=buildSqlLockEntry(_0x231072,_0x3dde1d,'',{'dbName':_0x22ddf2}),_0x3b7fde=resolveLocalSqlFilePath(_0x4050e3,_0x231072['sqlCode'],_0x489b9a);let _0x2eb07a='would_pull',_0x136020;if(await fileExists(_0x3b7fde)){const _0x3cef52=await readFile(_0x3b7fde,_0x5d416a(0x202));isEquivalentPulledSqlFile(_0x3cef52,_0xc9d140,_0x55f8ba)?(_0x2eb07a=_0x5d416a(0x1fb),_0x136020=_0x5d416a(0x215)):(_0x2eb07a=_0x5d416a(0x1ee),_0x136020=_0x5d416a(0x227));}_0x56e506[_0x5d416a(0x21a)]({'sqlCode':_0x231072[_0x5d416a(0x1f1)],'sqlName':_0x231072[_0x5d416a(0x229)],'filePath':_0x3b7fde,'status':_0x2eb07a,'reason':_0x136020});}return{'method':_0x5d416a(0x208),'url':_0x5d416a(0x1f7),'body':{'appCode':_0x25c4f5[_0x5d416a(0x21e)],'sqlCode':_0x25c4f5[_0x5d416a(0x22a)]('sqlcode')||null,'sqlName':_0x25c4f5[_0x5d416a(0x22a)](_0x5d416a(0x1f8))||null,'files':_0x56e506},'description':'Would\x20pull\x20'+_0x56e506['length']+_0x5d416a(0x226)+_0x4050e3[_0x5d416a(0x22f)]};},async 'execute'(_0x404714){const _0x433ace=a196_0x3a47db,_0x5a30d6=loadSqlProjectConfig(_0x404714['appCode']),_0x47efcf=await readSqlLockFile(_0x5a30d6[_0x433ace(0x219)]),{lockData:_0x26cfd8,appLock:_0x4940ce}=ensureSqlLockScope(_0x47efcf??createEmptySqlLock(),_0x5a30d6[_0x433ace(0x21e)],_0x5a30d6[_0x433ace(0x21b)],_0x433ace(0x22e)),_0x22d7c0=_0x404714[_0x433ace(0x230)](_0x433ace(0x22c)),_0x56f11a=await fetchAllSqlQueries(_0x404714['appCode'],{'sqlCode':_0x404714[_0x433ace(0x22a)](_0x433ace(0x225))||undefined,'sqlName':_0x404714[_0x433ace(0x22a)](_0x433ace(0x1f8))||undefined});if(_0x56f11a[_0x433ace(0x1fe)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x433ace(0x204)};const _0x34dc55=[],_0xf59fdc=[];for(const _0x233bbf of _0x56f11a){try{_0x34dc55[_0x433ace(0x21a)](await ensureSqlContent(_0x233bbf));}catch(_0x500a56){_0xf59fdc['push']({'sqlCode':_0x233bbf[_0x433ace(0x1f1)],'error':_0x500a56 instanceof Error?_0x500a56[_0x433ace(0x22d)]:String(_0x500a56)});}}if(_0x22d7c0&&!_0x404714[_0x433ace(0x222)]){let _0x456339=![];for(const _0x11ce90 of _0x34dc55){const _0x367009=detectModeFromSql(_0x11ce90),_0x74d52c=_0x11ce90[_0x433ace(0x213)]?await getDbName(_0x404714['appCode'],Number(_0x11ce90[_0x433ace(0x213)]))['catch'](()=>undefined):undefined,_0x5eee25=buildLocalSqlFileContent({'sqlCode':_0x11ce90[_0x433ace(0x1f1)],'sqlName':_0x11ce90[_0x433ace(0x229)],'dbId':_0x11ce90[_0x433ace(0x213)]},ensureRemoteSqlContent(_0x11ce90),{'dbName':_0x74d52c,'mode':_0x367009,'syncedAt':new Date()[_0x433ace(0x209)](),'description':_0x11ce90[_0x433ace(0x214)]}),_0x477779=resolveLocalSqlFilePath(_0x5a30d6,_0x11ce90[_0x433ace(0x1f1)],buildSqlLockEntry(_0x11ce90,ensureRemoteSqlContent(_0x11ce90),'',{'dbName':_0x74d52c}));if(await fileExists(_0x477779)){const _0x4ac02f=await readFile(_0x477779,_0x433ace(0x202));if(!isEquivalentPulledSqlFile(_0x4ac02f,_0x5eee25,_0x367009)){_0x456339=!![];break;}}}if(_0x456339){const _0x4d483e=await confirmForceOverwrite(_0x433ace(0x21f));if(!_0x4d483e)throw CliErrors[_0x433ace(0x207)](_0x433ace(0x203));}}const _0x20d4ff=cloneSqlLockData(_0x26cfd8),_0x562252=_0x20d4ff[_0x433ace(0x223)][_0x5a30d6['appCode']],_0x12d1fa=[],_0x1eac88=[];for(const _0x1536ef of _0x34dc55){const _0x482b4b=_0x562252['sqls'][_0x1536ef[_0x433ace(0x1f1)]],_0x80a5cf=ensureRemoteSqlContent(_0x1536ef),_0x23756c=detectModeFromSql(_0x1536ef),_0x3de123=_0x1536ef['dbId']?await getDbName(_0x404714['appCode'],Number(_0x1536ef[_0x433ace(0x213)]))[_0x433ace(0x20c)](()=>undefined):undefined,_0x2555af=buildLocalSqlFileContent({'sqlCode':_0x1536ef[_0x433ace(0x1f1)],'sqlName':_0x1536ef['sqlName'],'dbId':_0x1536ef[_0x433ace(0x213)]},_0x80a5cf,{'dbName':_0x3de123,'mode':_0x23756c,'syncedAt':new Date()[_0x433ace(0x209)](),'description':_0x1536ef[_0x433ace(0x214)]}),_0x31d364=buildSqlLockEntry(_0x1536ef,_0x80a5cf,computeSqlContentHash(_0x2555af),{'dbName':_0x3de123}),_0x32be21=_0x31d364[_0x433ace(0x201)],_0x2a30ca=join(_0x5a30d6[_0x433ace(0x22f)],_0x32be21);try{if(await fileExists(_0x2a30ca)){const _0x56ca79=await readFile(_0x2a30ca,_0x433ace(0x202));if(isEquivalentPulledSqlFile(_0x56ca79,_0x2555af,_0x23756c)){_0x1eac88[_0x433ace(0x21a)]({'sqlCode':_0x1536ef['sqlCode'],'reason':_0x433ace(0x215)}),_0x562252[_0x433ace(0x220)][_0x1536ef[_0x433ace(0x1f1)]]={..._0x31d364,'hash':computeSqlContentHash(_0x56ca79),'path':_0x32be21};continue;}if(!_0x22d7c0){_0x1eac88['push']({'sqlCode':_0x1536ef[_0x433ace(0x1f1)],'reason':_0x433ace(0x221)});continue;}}const _0x4c44b5=_0x482b4b?.[_0x433ace(0x201)]?join(_0x5a30d6[_0x433ace(0x22f)],_0x482b4b['path']):undefined;_0x4c44b5&&_0x4c44b5!==_0x2a30ca&&await fileExists(_0x4c44b5)&&await rm(_0x4c44b5,{'force':!![]}),await ensureParentDirectory(_0x2a30ca),await writeFile(_0x2a30ca,_0x2555af,_0x433ace(0x202)),_0x562252[_0x433ace(0x220)][_0x1536ef[_0x433ace(0x1f1)]]={..._0x31d364,'path':_0x32be21},_0x12d1fa['push']({'sqlCode':_0x1536ef['sqlCode'],'filePath':_0x2a30ca});}catch(_0x32786b){_0xf59fdc[_0x433ace(0x21a)]({'sqlCode':_0x1536ef['sqlCode'],'error':_0x32786b instanceof Error?_0x32786b[_0x433ace(0x22d)]:String(_0x32786b)});}}return _0x562252[_0x433ace(0x1ff)]=new Date()[_0x433ace(0x209)](),await writeSqlLockFile(_0x5a30d6[_0x433ace(0x219)],_0x20d4ff),{'ok':_0xf59fdc[_0x433ace(0x1fe)]===0x0,'data':{'pulled':_0x12d1fa,'skipped':_0x1eac88,'failed':_0xf59fdc},'message':_0x433ace(0x1ed)+_0x12d1fa[_0x433ace(0x1fe)]+'\x20written,\x20'+_0x1eac88['length']+_0x433ace(0x1f3)+_0xf59fdc[_0x433ace(0x1fe)]+_0x433ace(0x200)};}};function detectModeFromSql(_0x581108){const _0x2ebc36=a196_0x3a47db,_0x4f5080=ensureRemoteSqlContent(_0x581108),_0x3668e3=stripLocalSqlMetadata(_0x4f5080,_0x2ebc36(0x1f5))[_0x2ebc36(0x22b)]();if(/^<(select|insert|update|delete)\b/i[_0x2ebc36(0x20a)](_0x3668e3))return _0x2ebc36(0x1f5);return _0x2ebc36(0x20e);}function isEquivalentPulledSqlFile(_0x562bba,_0x4f5716,_0x2aeae1){return normalizePullComparableContent(_0x562bba,_0x2aeae1)===normalizePullComparableContent(_0x4f5716,_0x2aeae1);}function normalizePullComparableContent(_0x1d8447,_0x3efd3f){const _0x489e0d=a196_0x3a47db,_0x3af3c0=_0x1d8447[_0x489e0d(0x1f2)](/\r\n/g,'\x0a')[_0x489e0d(0x21c)]('\x0a'),_0x45c6bf=_0x3af3c0[_0x489e0d(0x1fd)](_0x34f2ac=>!isSyncedAtMetadataLine(_0x34f2ac,_0x3efd3f));return _0x45c6bf[_0x489e0d(0x205)]('\x0a');}function a196_0x55bc(_0x4612b6,_0x21c19d){_0x4612b6=_0x4612b6-0x1ed;const _0x13910f=a196_0x1391();let _0x55bc9a=_0x13910f[_0x4612b6];return _0x55bc9a;}function isSyncedAtMetadataLine(_0x1a5e49,_0x12589b){const _0x3081e1=a196_0x3a47db;if(_0x12589b===_0x3081e1(0x1f5))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x3081e1(0x20a)](_0x1a5e49);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x3081e1(0x20a)](_0x1a5e49);}
|
|
1
|
+
const a202_0x4333b4=a202_0x3599;(function(_0x193ac0,_0xf55b2c){const _0x83796=a202_0x3599,_0x490bc3=_0x193ac0();while(!![]){try{const _0x5efea5=parseInt(_0x83796(0x80))/0x1+parseInt(_0x83796(0xa4))/0x2*(-parseInt(_0x83796(0xa8))/0x3)+-parseInt(_0x83796(0x99))/0x4+-parseInt(_0x83796(0x9b))/0x5*(-parseInt(_0x83796(0xa2))/0x6)+parseInt(_0x83796(0xa6))/0x7+parseInt(_0x83796(0x92))/0x8+-parseInt(_0x83796(0x96))/0x9;if(_0x5efea5===_0xf55b2c)break;else _0x490bc3['push'](_0x490bc3['shift']());}catch(_0x28c270){_0x490bc3['push'](_0x490bc3['shift']());}}}(a202_0x4988,0x571af));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';function a202_0x4988(){const _0x1121fa=['lastSync','length','27466vzfsgz','local\x20differs\x20from\x20remote','appCode','replace','POST','trimStart','description','message','totalCount','join','tableData','cancelled','lockFilePath','read','sqlName','skipped','No\x20remote\x20SQL\x20queries\x20matched.','sqlRoot','5125392wgDPoZ','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','dbId','path','5687415pabygN','paging','filter','670516VlTadX','name','30vvsJRD','sqlcode','toISOString','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','apps','Force\x20pull\x20cancelled.','utf8','412638xfFPxH','\x20written,\x20','360644xcMzfW','mybatisXml','1791237eEhcZX','sqlContent','3ZNejlx','Force\x20overwrite\x20local\x20unsynced\x20changes','string','\x20failed','force','sqlCode','unchanged','push','boolean','Filter\x20by\x20SQL\x20display\x20name','Pull\x20complete:\x20','sql','split','sqls','pull','would_pull','test','bool','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','sqlRootDir','str','catch','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql'];a202_0x4988=function(){return _0x1121fa;};return a202_0x4988();}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(_0x365407,_0x4c30b4){const _0x2d8f4f=a202_0x3599,_0x4e733c=[];let _0xf7d569=0x1;while(!![]){const _0x23201e=await listSqlQueries(_0x365407,{'currentPage':_0xf7d569,'pageSize':PAGE_SIZE,'sqlCode':_0x4c30b4[_0x2d8f4f(0xad)],'sqlName':_0x4c30b4['sqlName']}),_0x46c3f4=_0x23201e[_0x2d8f4f(0x8a)]??[];_0x4e733c[_0x2d8f4f(0xaf)](..._0x46c3f4);if(_0x46c3f4[_0x2d8f4f(0x7f)]===0x0)break;const _0x7386b4=_0x23201e[_0x2d8f4f(0x97)]?.[_0x2d8f4f(0x88)];if(_0x7386b4!=null?_0x4e733c[_0x2d8f4f(0x7f)]>=_0x7386b4:_0x46c3f4[_0x2d8f4f(0x7f)]<PAGE_SIZE)break;_0xf7d569++;}return _0x4e733c;}async function ensureSqlContent(_0x3a8f47){const _0x4bd4d2=a202_0x3599;if(_0x3a8f47[_0x4bd4d2(0xa7)]!=null&&String(_0x3a8f47[_0x4bd4d2(0xa7)])[_0x4bd4d2(0x7f)]>0x0)return _0x3a8f47;return getSqlQueryDetail(_0x3a8f47[_0x4bd4d2(0xad)]);}export const sqlPull={'service':a202_0x4333b4(0xb3),'command':a202_0x4333b4(0xb6),'description':a202_0x4333b4(0x9e),'risk':a202_0x4333b4(0x8d),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a202_0x4333b4(0x9a),'type':a202_0x4333b4(0xaa),'description':a202_0x4333b4(0xb1)},{'name':'force','type':a202_0x4333b4(0xb0),'description':a202_0x4333b4(0xa9)}],async 'dryRun'(_0x4143a7){const _0x310d8b=a202_0x4333b4,_0x2e2ff4=loadSqlProjectConfig(_0x4143a7[_0x310d8b(0x82)]),_0x2857c5=await readSqlLockFile(_0x2e2ff4[_0x310d8b(0x8c)]),{appLock:_0x1e2395}=ensureSqlLockScope(_0x2857c5??createEmptySqlLock(),_0x2e2ff4[_0x310d8b(0x82)],_0x2e2ff4[_0x310d8b(0x91)],_0x310d8b(0xb6)),_0x42c463=await fetchAllSqlQueries(_0x4143a7['appCode'],{'sqlCode':_0x4143a7['str']('sqlcode')||undefined,'sqlName':_0x4143a7['str'](_0x310d8b(0x9a))||undefined}),_0x42e850=[];for(const _0x3cfcfa of _0x42c463){const _0x1cde41=await ensureSqlContent(_0x3cfcfa),_0x247962=ensureRemoteSqlContent(_0x1cde41),_0xc0e5c1=detectModeFromSql(_0x1cde41),_0xc7204=_0x1cde41[_0x310d8b(0x94)]?await getDbName(_0x4143a7['appCode'],Number(_0x1cde41[_0x310d8b(0x94)]))['catch'](()=>undefined):undefined,_0xa334ff=buildLocalSqlFileContent({'sqlCode':_0x1cde41[_0x310d8b(0xad)],'sqlName':_0x1cde41[_0x310d8b(0x8e)],'dbId':_0x1cde41['dbId']},_0x247962,{'dbName':_0xc7204,'mode':_0xc0e5c1,'syncedAt':new Date()[_0x310d8b(0x9d)](),'description':_0x1cde41[_0x310d8b(0x86)]}),_0x197e1b=buildSqlLockEntry(_0x1cde41,_0x247962,'',{'dbName':_0xc7204}),_0x1c667e=resolveLocalSqlFilePath(_0x2e2ff4,_0x1cde41[_0x310d8b(0xad)],_0x197e1b);let _0x13afdb=_0x310d8b(0xb7),_0x39edd5;if(await fileExists(_0x1c667e)){const _0x164e47=await readFile(_0x1c667e,_0x310d8b(0xa1));isEquivalentPulledSqlFile(_0x164e47,_0xa334ff,_0xc0e5c1)?(_0x13afdb=_0x310d8b(0x8f),_0x39edd5=_0x310d8b(0xae)):(_0x13afdb='conflict',_0x39edd5=_0x310d8b(0xba));}_0x42e850['push']({'sqlCode':_0x1cde41[_0x310d8b(0xad)],'sqlName':_0x1cde41[_0x310d8b(0x8e)],'filePath':_0x1c667e,'status':_0x13afdb,'reason':_0x39edd5});}return{'method':_0x310d8b(0x84),'url':_0x310d8b(0xbe),'body':{'appCode':_0x4143a7[_0x310d8b(0x82)],'sqlCode':_0x4143a7[_0x310d8b(0xbc)](_0x310d8b(0x9c))||null,'sqlName':_0x4143a7[_0x310d8b(0xbc)]('name')||null,'files':_0x42e850},'description':'Would\x20pull\x20'+_0x42e850[_0x310d8b(0x7f)]+'\x20SQL\x20file(s)\x20into\x20'+_0x2e2ff4[_0x310d8b(0xbb)]};},async 'execute'(_0x7be117){const _0x23149b=a202_0x4333b4,_0x3e3620=loadSqlProjectConfig(_0x7be117[_0x23149b(0x82)]),_0x4331de=await readSqlLockFile(_0x3e3620['lockFilePath']),{lockData:_0x418730,appLock:_0xfdc86e}=ensureSqlLockScope(_0x4331de??createEmptySqlLock(),_0x3e3620[_0x23149b(0x82)],_0x3e3620['sqlRoot'],'pull'),_0x40b274=_0x7be117[_0x23149b(0xb9)](_0x23149b(0xac)),_0x2dd93b=await fetchAllSqlQueries(_0x7be117[_0x23149b(0x82)],{'sqlCode':_0x7be117['str'](_0x23149b(0x9c))||undefined,'sqlName':_0x7be117[_0x23149b(0xbc)](_0x23149b(0x9a))||undefined});if(_0x2dd93b[_0x23149b(0x7f)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x23149b(0x90)};const _0x865d34=[],_0x34e9bb=[];for(const _0x596bb2 of _0x2dd93b){try{_0x865d34[_0x23149b(0xaf)](await ensureSqlContent(_0x596bb2));}catch(_0x2f3f23){_0x34e9bb[_0x23149b(0xaf)]({'sqlCode':_0x596bb2['sqlCode'],'error':_0x2f3f23 instanceof Error?_0x2f3f23[_0x23149b(0x87)]:String(_0x2f3f23)});}}if(_0x40b274&&!_0x7be117['nonInteractive']){let _0x587e71=![];for(const _0x4eff81 of _0x865d34){const _0x597bd2=detectModeFromSql(_0x4eff81),_0x263912=_0x4eff81[_0x23149b(0x94)]?await getDbName(_0x7be117[_0x23149b(0x82)],Number(_0x4eff81['dbId']))['catch'](()=>undefined):undefined,_0x35a82a=buildLocalSqlFileContent({'sqlCode':_0x4eff81[_0x23149b(0xad)],'sqlName':_0x4eff81[_0x23149b(0x8e)],'dbId':_0x4eff81[_0x23149b(0x94)]},ensureRemoteSqlContent(_0x4eff81),{'dbName':_0x263912,'mode':_0x597bd2,'syncedAt':new Date()[_0x23149b(0x9d)](),'description':_0x4eff81[_0x23149b(0x86)]}),_0x1fabda=resolveLocalSqlFilePath(_0x3e3620,_0x4eff81[_0x23149b(0xad)],buildSqlLockEntry(_0x4eff81,ensureRemoteSqlContent(_0x4eff81),'',{'dbName':_0x263912}));if(await fileExists(_0x1fabda)){const _0x350a65=await readFile(_0x1fabda,_0x23149b(0xa1));if(!isEquivalentPulledSqlFile(_0x350a65,_0x35a82a,_0x597bd2)){_0x587e71=!![];break;}}}if(_0x587e71){const _0x3fd3cf=await confirmForceOverwrite(_0x23149b(0x93));if(!_0x3fd3cf)throw CliErrors[_0x23149b(0x8b)](_0x23149b(0xa0));}}const _0x2a4525=cloneSqlLockData(_0x418730),_0x269208=_0x2a4525[_0x23149b(0x9f)][_0x3e3620['appCode']],_0x3ba361=[],_0x2fef96=[];for(const _0xd0ccd7 of _0x865d34){const _0xc3a44=_0x269208['sqls'][_0xd0ccd7[_0x23149b(0xad)]],_0x36c79e=ensureRemoteSqlContent(_0xd0ccd7),_0x4b7427=detectModeFromSql(_0xd0ccd7),_0x61e16a=_0xd0ccd7['dbId']?await getDbName(_0x7be117[_0x23149b(0x82)],Number(_0xd0ccd7['dbId']))[_0x23149b(0xbd)](()=>undefined):undefined,_0x5e6c78=buildLocalSqlFileContent({'sqlCode':_0xd0ccd7[_0x23149b(0xad)],'sqlName':_0xd0ccd7[_0x23149b(0x8e)],'dbId':_0xd0ccd7[_0x23149b(0x94)]},_0x36c79e,{'dbName':_0x61e16a,'mode':_0x4b7427,'syncedAt':new Date()['toISOString'](),'description':_0xd0ccd7[_0x23149b(0x86)]}),_0x597b11=buildSqlLockEntry(_0xd0ccd7,_0x36c79e,computeSqlContentHash(_0x5e6c78),{'dbName':_0x61e16a}),_0x431fce=_0x597b11[_0x23149b(0x95)],_0x3518cf=join(_0x3e3620['sqlRootDir'],_0x431fce);try{if(await fileExists(_0x3518cf)){const _0x2acdde=await readFile(_0x3518cf,_0x23149b(0xa1));if(isEquivalentPulledSqlFile(_0x2acdde,_0x5e6c78,_0x4b7427)){_0x2fef96['push']({'sqlCode':_0xd0ccd7['sqlCode'],'reason':_0x23149b(0xae)}),_0x269208[_0x23149b(0xb5)][_0xd0ccd7[_0x23149b(0xad)]]={..._0x597b11,'hash':computeSqlContentHash(_0x2acdde),'path':_0x431fce};continue;}if(!_0x40b274){_0x2fef96['push']({'sqlCode':_0xd0ccd7[_0x23149b(0xad)],'reason':_0x23149b(0x81)});continue;}}const _0x27e5ca=_0xc3a44?.[_0x23149b(0x95)]?join(_0x3e3620[_0x23149b(0xbb)],_0xc3a44[_0x23149b(0x95)]):undefined;_0x27e5ca&&_0x27e5ca!==_0x3518cf&&await fileExists(_0x27e5ca)&&await rm(_0x27e5ca,{'force':!![]}),await ensureParentDirectory(_0x3518cf),await writeFile(_0x3518cf,_0x5e6c78,_0x23149b(0xa1)),_0x269208['sqls'][_0xd0ccd7[_0x23149b(0xad)]]={..._0x597b11,'path':_0x431fce},_0x3ba361[_0x23149b(0xaf)]({'sqlCode':_0xd0ccd7[_0x23149b(0xad)],'filePath':_0x3518cf});}catch(_0x5e126b){_0x34e9bb['push']({'sqlCode':_0xd0ccd7['sqlCode'],'error':_0x5e126b instanceof Error?_0x5e126b[_0x23149b(0x87)]:String(_0x5e126b)});}}return _0x269208[_0x23149b(0xbf)]=new Date()[_0x23149b(0x9d)](),await writeSqlLockFile(_0x3e3620['lockFilePath'],_0x2a4525),{'ok':_0x34e9bb[_0x23149b(0x7f)]===0x0,'data':{'pulled':_0x3ba361,'skipped':_0x2fef96,'failed':_0x34e9bb},'message':_0x23149b(0xb2)+_0x3ba361[_0x23149b(0x7f)]+_0x23149b(0xa3)+_0x2fef96[_0x23149b(0x7f)]+'\x20skipped,\x20'+_0x34e9bb[_0x23149b(0x7f)]+_0x23149b(0xab)};}};function detectModeFromSql(_0x37602b){const _0x3e69d9=a202_0x4333b4,_0xc5f228=ensureRemoteSqlContent(_0x37602b),_0x58ceee=stripLocalSqlMetadata(_0xc5f228,'mybatisXml')[_0x3e69d9(0x85)]();if(/^<(select|insert|update|delete)\b/i[_0x3e69d9(0xb8)](_0x58ceee))return _0x3e69d9(0xa5);return _0x3e69d9(0xb3);}function isEquivalentPulledSqlFile(_0xe83dcc,_0x4d1961,_0x155a6c){return normalizePullComparableContent(_0xe83dcc,_0x155a6c)===normalizePullComparableContent(_0x4d1961,_0x155a6c);}function normalizePullComparableContent(_0xcc99,_0x4b9242){const _0x2645bc=a202_0x4333b4,_0x395639=_0xcc99[_0x2645bc(0x83)](/\r\n/g,'\x0a')[_0x2645bc(0xb4)]('\x0a'),_0x1c4e06=_0x395639[_0x2645bc(0x98)](_0x193011=>!isSyncedAtMetadataLine(_0x193011,_0x4b9242));return _0x1c4e06[_0x2645bc(0x89)]('\x0a');}function a202_0x3599(_0x1be343,_0x15cbf1){_0x1be343=_0x1be343-0x7f;const _0x49885d=a202_0x4988();let _0x3599ec=_0x49885d[_0x1be343];return _0x3599ec;}function isSyncedAtMetadataLine(_0x5a2002,_0x59cc8a){const _0x41094e=a202_0x4333b4;if(_0x59cc8a==='mybatisXml')return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x41094e(0xb8)](_0x5a2002);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x41094e(0xb8)](_0x5a2002);}
|