@lovrabet/rabetbase-cli 2.4.5 → 2.4.6-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -2
- package/lib/api/api-doc.js +1 -1
- package/lib/api/fetch-model-list.js +1 -1
- package/lib/api/generate-api-file.js +1 -1
- package/lib/auth/auth-server-ui.js +1 -1
- package/lib/auth/auth-server.js +1 -1
- package/lib/auth/constant.js +1 -1
- package/lib/auth/get-cookie.js +1 -1
- package/lib/auth/get-session-user.js +1 -1
- package/lib/auth/is-session-valid.js +1 -1
- package/lib/auth/login-success-html.js +1 -1
- package/lib/auth/logout.js +1 -1
- package/lib/cli-flags.js +1 -1
- package/lib/cli.js +1 -1
- package/lib/commands/api/generate.js +1 -1
- package/lib/commands/api/index.js +1 -1
- package/lib/commands/api/list.js +1 -1
- package/lib/commands/api/pull.js +1 -1
- package/lib/commands/api/shared.js +1 -1
- package/lib/commands/app/index.js +1 -1
- package/lib/commands/app/list.js +1 -1
- package/lib/commands/app/members-list.js +1 -1
- package/lib/commands/app/remote-directory.js +1 -1
- package/lib/commands/app/shared.js +1 -1
- package/lib/commands/app-config/delete.js +1 -1
- package/lib/commands/app-config/get.js +1 -1
- package/lib/commands/app-config/index.js +1 -1
- package/lib/commands/app-config/list.js +1 -1
- package/lib/commands/app-config/set.js +1 -1
- package/lib/commands/app-config/shared.js +1 -1
- package/lib/commands/auth/index.js +1 -1
- package/lib/commands/bff/create.js +1 -1
- package/lib/commands/bff/delete.js +1 -1
- package/lib/commands/bff/detail.js +1 -1
- package/lib/commands/bff/index.js +1 -1
- package/lib/commands/bff/list.js +1 -1
- package/lib/commands/bff/pull.js +1 -1
- package/lib/commands/bff/push.js +1 -1
- package/lib/commands/bff/status.js +1 -1
- package/lib/commands/cli-skill/index.js +1 -1
- package/lib/commands/cli-update.js +1 -1
- package/lib/commands/codegen/index.js +1 -1
- package/lib/commands/codegen/sdk.js +1 -1
- package/lib/commands/codegen/sql.js +1 -1
- package/lib/commands/common/app-registry.js +1 -1
- package/lib/commands/common/app-selector.js +1 -1
- package/lib/commands/common/async-task.js +1 -1
- package/lib/commands/common/dry-run.js +1 -1
- package/lib/commands/common/flags.js +1 -1
- package/lib/commands/common/local-file.js +1 -1
- package/lib/commands/common/validate.js +1 -1
- package/lib/commands/config/get.js +1 -1
- package/lib/commands/config/index.js +1 -1
- package/lib/commands/config/list.js +1 -1
- package/lib/commands/config/set.js +1 -1
- package/lib/commands/config/shared.js +1 -1
- package/lib/commands/data/filter.js +1 -1
- package/lib/commands/data/getOne.js +1 -1
- package/lib/commands/data/index.js +1 -1
- package/lib/commands/data/shared.js +1 -1
- package/lib/commands/dataset/business-group-update.js +1 -1
- package/lib/commands/dataset/business-groups.js +1 -1
- package/lib/commands/dataset/capability.js +1 -1
- package/lib/commands/dataset/delete.js +1 -1
- package/lib/commands/dataset/detail.js +1 -1
- package/lib/commands/dataset/extend-update.js +1 -1
- package/lib/commands/dataset/field-update.js +1 -1
- package/lib/commands/dataset/generate.js +1 -1
- package/lib/commands/dataset/index.js +1 -1
- package/lib/commands/dataset/list.js +1 -1
- package/lib/commands/dataset/operations.js +1 -1
- package/lib/commands/dataset/relation-audit.js +1 -1
- package/lib/commands/dataset/relation-create.js +1 -1
- package/lib/commands/dataset/relation-delete.js +1 -1
- package/lib/commands/dataset/relation-shared.js +1 -1
- package/lib/commands/dataset/relation-update.js +1 -1
- package/lib/commands/dataset/relations.js +1 -1
- package/lib/commands/dataset/rename.js +1 -1
- package/lib/commands/dataset/restore.js +1 -1
- package/lib/commands/db/analysis-batching.js +1 -1
- package/lib/commands/db/analyze-batch-plan.js +1 -1
- package/lib/commands/db/analyze-cancel.js +1 -1
- package/lib/commands/db/analyze-start.js +1 -1
- package/lib/commands/db/analyze-status.js +1 -1
- package/lib/commands/db/create.js +1 -1
- package/lib/commands/db/delete.js +1 -1
- package/lib/commands/db/detail.js +1 -1
- package/lib/commands/db/diff-refresh-start.js +1 -1
- package/lib/commands/db/diff-refresh-status.js +1 -1
- package/lib/commands/db/diff.js +1 -1
- package/lib/commands/db/index.js +1 -1
- package/lib/commands/db/list.js +1 -1
- package/lib/commands/db/shared.js +1 -1
- package/lib/commands/db/tables.js +1 -1
- package/lib/commands/db/test.js +1 -1
- package/lib/commands/db/update.js +1 -1
- package/lib/commands/doctor.js +1 -1
- package/lib/commands/file/index.js +1 -1
- package/lib/commands/init/index.js +1 -1
- package/lib/commands/issue/index.js +1 -1
- package/lib/commands/issue/nudge.js +1 -1
- package/lib/commands/issue/report.js +1 -1
- package/lib/commands/issue/shared.js +1 -1
- package/lib/commands/kb/create.js +1 -1
- package/lib/commands/kb/delete.js +1 -1
- package/lib/commands/kb/detail.js +1 -1
- package/lib/commands/kb/index.js +1 -1
- package/lib/commands/kb/list.js +1 -1
- package/lib/commands/kb/shared.js +1 -1
- package/lib/commands/kb/update.js +1 -1
- package/lib/commands/logs/index.js +1 -1
- package/lib/commands/menu/asset-update.js +1 -1
- package/lib/commands/menu/delete.js +1 -1
- package/lib/commands/menu/external-link-create.js +1 -1
- package/lib/commands/menu/external-link-update.js +1 -1
- package/lib/commands/menu/group-create.js +1 -1
- package/lib/commands/menu/group-update.js +1 -1
- package/lib/commands/menu/index.js +1 -1
- package/lib/commands/menu/list.js +1 -1
- package/lib/commands/menu/move.js +1 -1
- package/lib/commands/menu/regroup-start.js +1 -1
- package/lib/commands/menu/rename.js +1 -1
- package/lib/commands/menu/shared/compare-table.js +1 -1
- package/lib/commands/menu/shared/delete-plan.js +1 -1
- package/lib/commands/menu/shared/facts.js +1 -1
- package/lib/commands/menu/shared/index.js +1 -1
- package/lib/commands/menu/shared/inquirer.js +1 -1
- package/lib/commands/menu/shared/local-pages.js +1 -1
- package/lib/commands/menu/shared/logic.js +1 -1
- package/lib/commands/menu/shared/mutations.d.ts +8 -7
- 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/types.d.ts +17 -2
- 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/{page/standard-page-status.d.ts → menu/visibility-update.d.ts} +1 -1
- package/lib/commands/menu/visibility-update.js +1 -0
- 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.d.ts +2 -0
- package/lib/commands/page/create.js +1 -0
- package/lib/commands/page/{react → custom}/detail.d.ts +1 -1
- package/lib/commands/page/custom/detail.js +1 -0
- package/lib/commands/page/{react → custom}/list.d.ts +1 -1
- package/lib/commands/page/custom/list.js +1 -0
- package/lib/commands/page/{react → custom}/publish.d.ts +1 -1
- package/lib/commands/page/custom/publish.js +1 -0
- package/lib/commands/page/{react → custom}/shared.d.ts +15 -15
- package/lib/commands/page/custom/shared.js +1 -0
- package/lib/commands/page/{react → custom}/syntax.d.ts +2 -2
- package/lib/commands/page/custom/syntax.js +1 -0
- package/lib/commands/page/custom/template.js +1 -0
- package/lib/commands/page/{react → custom}/update.d.ts +1 -1
- package/lib/commands/page/custom/update.js +1 -0
- package/lib/commands/page/data-list-status.d.ts +2 -0
- package/lib/commands/page/data-list-status.js +1 -0
- 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.d.ts +18 -18
- package/lib/commands/page/shared.js +1 -1
- package/lib/commands/page/sync.js +1 -1
- package/lib/commands/project/create/enhanced-guided-create.js +1 -1
- package/lib/commands/project/create/format-elapsed.js +1 -1
- package/lib/commands/project/create/main.js +1 -1
- package/lib/commands/project/create/materialize-project-template.js +1 -1
- package/lib/commands/project/create/project-name.js +1 -1
- package/lib/commands/project/create/project-template-archive.js +1 -1
- package/lib/commands/project/create/project-template-path.js +1 -1
- package/lib/commands/project/create/use-copy-project-template.js +1 -1
- package/lib/commands/project/create/use-format-code.js +1 -1
- package/lib/commands/project/create/use-install-dependencies.js +1 -1
- package/lib/commands/project/index.js +1 -1
- package/lib/commands/project/upgrade.js +1 -1
- package/lib/commands/registry.js +1 -1
- package/lib/commands/role/delete.js +1 -1
- package/lib/commands/role/detail.js +1 -1
- package/lib/commands/role/index.js +1 -1
- package/lib/commands/role/list.js +1 -1
- package/lib/commands/role/shared.js +1 -1
- package/lib/commands/role/update.js +1 -1
- package/lib/commands/role/user-add.js +1 -1
- package/lib/commands/role/user-remove.js +1 -1
- package/lib/commands/role/user-resolve.js +1 -1
- package/lib/commands/run/index.js +1 -1
- package/lib/commands/schema.js +1 -1
- package/lib/commands/sql/create.js +1 -1
- package/lib/commands/sql/delete.js +1 -1
- package/lib/commands/sql/detail.js +1 -1
- package/lib/commands/sql/exec.js +1 -1
- package/lib/commands/sql/index.js +1 -1
- package/lib/commands/sql/list.js +1 -1
- package/lib/commands/sql/pull.js +1 -1
- package/lib/commands/sql/push.js +1 -1
- package/lib/commands/sql/shared.js +1 -1
- package/lib/commands/sql/status.js +1 -1
- package/lib/commands/sql/validate.js +1 -1
- package/lib/commands/task/index.js +1 -1
- package/lib/commands/task/status.js +1 -1
- package/lib/commands/tenant/index.js +1 -1
- package/lib/commands/tenant/members-list.js +1 -1
- package/lib/commands/tenant/shared.js +1 -1
- package/lib/commands/user-account/dingding-sandbox-bind.js +1 -1
- package/lib/commands/user-account/index.js +1 -1
- package/lib/commands/workspace/add.js +1 -1
- package/lib/commands/workspace/index.js +1 -1
- package/lib/commands/workspace/remove.js +1 -1
- package/lib/config/schema.js +1 -1
- package/lib/constant/cdn.js +1 -1
- package/lib/constant/cli.js +1 -1
- package/lib/constant/defaults.js +1 -1
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/constant/output.js +1 -1
- package/lib/constant/paths.js +1 -1
- package/lib/constant/risk.js +1 -1
- package/lib/context/app-resolver.js +1 -1
- package/lib/context/auth-resolver.js +1 -1
- package/lib/context/config-loader.js +1 -1
- package/lib/context.js +1 -1
- package/lib/core/alias-resolver.js +1 -1
- package/lib/core/api-client.d.ts +43 -43
- 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.d.ts +3 -1
- package/lib/core/bff/utils.js +1 -1
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/page/file-system.js +1 -1
- package/lib/core/page/hash.js +1 -1
- package/lib/core/page/lock.js +1 -1
- package/lib/core/sql-index-auditor.js +1 -1
- package/lib/core/sql-sync/config.js +1 -1
- package/lib/core/sql-sync/file-system.js +1 -1
- package/lib/core/sql-sync/hash.js +1 -1
- package/lib/core/sql-sync/lock.js +1 -1
- package/lib/core/sql-sync/utils.js +1 -1
- package/lib/core/sql-validator.js +1 -1
- package/lib/errors.js +1 -1
- package/lib/framework/build-all-flags.js +1 -1
- package/lib/framework/error-output.js +1 -1
- package/lib/framework/explicit-yes.js +1 -1
- package/lib/framework/flags.js +1 -1
- package/lib/framework/help.js +1 -1
- package/lib/framework/index.js +1 -1
- package/lib/framework/output.js +1 -1
- package/lib/framework/response.js +1 -1
- package/lib/framework/runner-alias.js +1 -1
- package/lib/framework/runner.js +1 -1
- package/lib/framework/schema-export.js +1 -1
- package/lib/framework/types.js +1 -1
- package/lib/generated/build-info.d.ts +4 -4
- package/lib/generated/build-info.js +1 -1
- package/lib/help.js +1 -1
- package/lib/postinstall.js +1 -1
- package/lib/runtime/confirmation.js +1 -1
- package/lib/runtime/event.js +1 -1
- package/lib/runtime/index.js +1 -1
- package/lib/runtime/queue.js +1 -1
- package/lib/runtime/resolve.js +1 -1
- package/lib/skills/builtin-skill.js +1 -1
- package/lib/skills/main.js +1 -1
- package/lib/skills/npx-skills-add.js +1 -1
- package/lib/skills/skill-presence.js +1 -1
- package/lib/telemetry/cli-command-trace.js +1 -1
- package/lib/telemetry/cli-help-trace.js +1 -1
- package/lib/telemetry/ensure-cli-otel-config.js +1 -1
- package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
- package/lib/telemetry/send-cli-trace-log.js +1 -1
- package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
- package/lib/utils/ai_config.js +1 -1
- package/lib/utils/apply-jq-filter.js +1 -1
- package/lib/utils/cdn-config.js +1 -1
- package/lib/utils/check-sdk-version.js +1 -1
- package/lib/utils/cli-version-check.js +1 -1
- package/lib/utils/cli-version-policy.js +1 -1
- package/lib/utils/config.js +1 -1
- package/lib/utils/entity-with-id.js +1 -1
- package/lib/utils/file-utils.js +1 -1
- package/lib/utils/guides-cdn.js +1 -1
- package/lib/utils/http-client.js +1 -1
- package/lib/utils/is-non-interactive.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/params.js +1 -1
- package/lib/utils/platform.js +1 -1
- package/lib/utils/rules-cdn.js +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.js +1 -1
- package/lib/utils/update-notice.js +1 -1
- package/lib/utils/version.js +1 -1
- package/lib/utils/with-active-cookie.js +1 -1
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +1 -1
- package/skills/rabetbase/SKILL.md +35 -34
- package/skills/rabetbase/guides/backend-function.md +63 -18
- package/skills/rabetbase/guides/bff-creation-workflow.md +2 -0
- package/skills/rabetbase/guides/{react-custom-page-workflow.md → custom-page-workflow.md} +45 -45
- package/skills/rabetbase/guides/page-development-workflow.md +22 -22
- package/skills/rabetbase/knowledge/{react-page → custom-page}/components.md +2 -2
- package/skills/rabetbase/knowledge/{react-page → custom-page}/generation-standards.md +6 -6
- package/skills/rabetbase/knowledge/page-schema/LrSmartTable.md +6 -6
- package/skills/rabetbase/knowledge/page-schema/external-resources-usage.md +1 -1
- package/skills/rabetbase/references/rabetbase-bff-create.md +2 -0
- package/skills/rabetbase/references/{rabetbase-standard-page-status.md → rabetbase-data-list-status.md} +6 -6
- package/skills/rabetbase/references/rabetbase-dataset-generate.md +1 -1
- package/skills/rabetbase/references/rabetbase-dataset-relation-mutations.md +1 -1
- package/skills/rabetbase/references/rabetbase-dataset-relations.md +1 -1
- package/skills/rabetbase/references/rabetbase-dataset-restore.md +1 -1
- package/skills/rabetbase/references/rabetbase-menu-list.md +4 -2
- package/skills/rabetbase/references/rabetbase-menu-visibility-update.md +59 -0
- package/skills/rabetbase/references/rabetbase-page-create.md +31 -0
- package/skills/rabetbase/references/{rabetbase-page-react-detail.md → rabetbase-page-custom-detail.md} +5 -5
- package/skills/rabetbase/references/{rabetbase-page-react-list.md → rabetbase-page-custom-list.md} +4 -4
- package/skills/rabetbase/references/{rabetbase-page-react-publish.md → rabetbase-page-custom-publish.md} +6 -6
- package/skills/rabetbase/references/{rabetbase-page-react-update.md → rabetbase-page-custom-update.md} +6 -6
- package/skills/rabetbase/references/rabetbase-page-generate-start.md +5 -4
- package/skills/rabetbase/references/rabetbase-page-generate-status.md +4 -4
- package/skills/rabetbase/references/rabetbase-page-pull.md +2 -2
- package/skills/rabetbase/references/rabetbase-page-relation-binding.md +1 -1
- package/skills/rabetbase/references/rabetbase-page-restore.md +7 -7
- package/skills/rabetbase/references/rabetbase-page-sync.md +3 -3
- package/skills/rabetbase.manifest.json +13 -12
- package/lib/commands/page/react/create.d.ts +0 -2
- package/lib/commands/page/react/create.js +0 -1
- package/lib/commands/page/react/detail.js +0 -1
- package/lib/commands/page/react/list.js +0 -1
- package/lib/commands/page/react/publish.js +0 -1
- package/lib/commands/page/react/shared.js +0 -1
- package/lib/commands/page/react/syntax.js +0 -1
- package/lib/commands/page/react/template.js +0 -1
- package/lib/commands/page/react/update.js +0 -1
- package/lib/commands/page/standard-page-status.js +0 -1
- package/skills/rabetbase/references/rabetbase-page-react-create.md +0 -29
- /package/lib/commands/page/{react → custom}/template.d.ts +0 -0
package/lib/commands/sql/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a190_0x1517f1=a190_0x5ee8;(function(_0x2022df,_0x47ff94){const _0x483573=a190_0x5ee8,_0x4bd4d6=_0x2022df();while(!![]){try{const _0x206761=parseInt(_0x483573(0x143))/0x1*(-parseInt(_0x483573(0x178))/0x2)+parseInt(_0x483573(0x141))/0x3*(parseInt(_0x483573(0x155))/0x4)+parseInt(_0x483573(0x176))/0x5+-parseInt(_0x483573(0x16e))/0x6*(parseInt(_0x483573(0x14f))/0x7)+-parseInt(_0x483573(0x16d))/0x8*(-parseInt(_0x483573(0x153))/0x9)+parseInt(_0x483573(0x150))/0xa*(-parseInt(_0x483573(0x165))/0xb)+parseInt(_0x483573(0x145))/0xc*(parseInt(_0x483573(0x164))/0xd);if(_0x206761===_0x47ff94)break;else _0x4bd4d6['push'](_0x4bd4d6['shift']());}catch(_0x196cc3){_0x4bd4d6['push'](_0x4bd4d6['shift']());}}}(a190_0x11d9,0x96b4c));function a190_0x5ee8(_0x5a63a6,_0x152a2d){_0x5a63a6=_0x5a63a6-0x13a;const _0x11d9ba=a190_0x11d9();let _0x5ee8b9=_0x11d9ba[_0x5a63a6];return _0x5ee8b9;}import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';function a190_0x11d9(){const _0x26be2a=['message','name','catch','sql','lastSync','Pull\x20complete:\x20','test','8ORxCqO','126gywxnT','cancelled','push','str','sqlRootDir','nonInteractive','read','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','4765790HxQpLN','toISOString','330CXeoDF','path','\x20SQL\x20file(s)\x20into\x20','utf8','tableData','filter','Force\x20overwrite\x20local\x20unsynced\x20changes','lockFilePath','force','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','No\x20remote\x20SQL\x20queries\x20matched.','Would\x20pull\x20','pull','1673553mIWFDl','appCode','2837GrDcCy','\x20failed','185112lcRZsW','skipped','sqlRoot','split','replace','conflict','Force\x20pull\x20cancelled.','would_pull','dbId','mybatisXml','372148iprpgC','10oShfuh','totalCount','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','9729873UhWqez','sqlCode','4MHatwR','sqls','\x20skipped,\x20','sqlcode','sqlContent','sqlName','boolean','\x20written,\x20','unchanged','apps','description','length','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','join','Filter\x20by\x20SQL\x20display\x20name','65CHXutY','5141345twfUtC'];a190_0x11d9=function(){return _0x26be2a;};return a190_0x11d9();}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(_0x1fba28,_0x41540e){const _0xa16099=a190_0x5ee8,_0x3b67ca=[];let _0x3efd0c=0x1;while(!![]){const _0x2fdea8=await listSqlQueries(_0x1fba28,{'currentPage':_0x3efd0c,'pageSize':PAGE_SIZE,'sqlCode':_0x41540e[_0xa16099(0x154)],'sqlName':_0x41540e[_0xa16099(0x15a)]}),_0x1021c7=_0x2fdea8[_0xa16099(0x17c)]??[];_0x3b67ca['push'](..._0x1021c7);if(_0x1021c7[_0xa16099(0x160)]===0x0)break;const _0x8c2c6a=_0x2fdea8['paging']?.[_0xa16099(0x151)];if(_0x8c2c6a!=null?_0x3b67ca[_0xa16099(0x160)]>=_0x8c2c6a:_0x1021c7[_0xa16099(0x160)]<PAGE_SIZE)break;_0x3efd0c++;}return _0x3b67ca;}async function ensureSqlContent(_0xc28cd2){const _0x2a6a10=a190_0x5ee8;if(_0xc28cd2[_0x2a6a10(0x159)]!=null&&String(_0xc28cd2[_0x2a6a10(0x159)])[_0x2a6a10(0x160)]>0x0)return _0xc28cd2;return getSqlQueryDetail(_0xc28cd2[_0x2a6a10(0x154)]);}export const sqlPull={'service':a190_0x1517f1(0x169),'command':'pull','description':a190_0x1517f1(0x152),'risk':a190_0x1517f1(0x174),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a190_0x1517f1(0x167),'type':'string','description':a190_0x1517f1(0x163)},{'name':a190_0x1517f1(0x13c),'type':a190_0x1517f1(0x15b),'description':a190_0x1517f1(0x13a)}],async 'dryRun'(_0x1fdd90){const _0x42b57b=a190_0x1517f1,_0x2013af=loadSqlProjectConfig(_0x1fdd90['appCode']),_0x4f4cd7=await readSqlLockFile(_0x2013af[_0x42b57b(0x13b)]),{appLock:_0x43c154}=ensureSqlLockScope(_0x4f4cd7??createEmptySqlLock(),_0x2013af[_0x42b57b(0x142)],_0x2013af['sqlRoot'],_0x42b57b(0x140)),_0x563a61=await fetchAllSqlQueries(_0x1fdd90[_0x42b57b(0x142)],{'sqlCode':_0x1fdd90[_0x42b57b(0x171)]('sqlcode')||undefined,'sqlName':_0x1fdd90[_0x42b57b(0x171)](_0x42b57b(0x167))||undefined}),_0x1f71a3=[];for(const _0x39cd3b of _0x563a61){const _0x4ab47f=await ensureSqlContent(_0x39cd3b),_0x29785e=ensureRemoteSqlContent(_0x4ab47f),_0x5aacb7=detectModeFromSql(_0x4ab47f),_0x1196c2=_0x4ab47f[_0x42b57b(0x14d)]?await getDbName(_0x1fdd90['appCode'],Number(_0x4ab47f[_0x42b57b(0x14d)]))[_0x42b57b(0x168)](()=>undefined):undefined,_0x4ca98c=buildLocalSqlFileContent({'sqlCode':_0x4ab47f[_0x42b57b(0x154)],'sqlName':_0x4ab47f[_0x42b57b(0x15a)],'dbId':_0x4ab47f[_0x42b57b(0x14d)]},_0x29785e,{'dbName':_0x1196c2,'mode':_0x5aacb7,'syncedAt':new Date()['toISOString'](),'description':_0x4ab47f[_0x42b57b(0x15f)]}),_0x4989a6=buildSqlLockEntry(_0x4ab47f,_0x29785e,'',{'dbName':_0x1196c2}),_0x46d334=resolveLocalSqlFilePath(_0x2013af,_0x4ab47f[_0x42b57b(0x154)],_0x4989a6);let _0x818465=_0x42b57b(0x14c),_0x3f7c69;if(await fileExists(_0x46d334)){const _0x391346=await readFile(_0x46d334,_0x42b57b(0x17b));isEquivalentPulledSqlFile(_0x391346,_0x4ca98c,_0x5aacb7)?(_0x818465=_0x42b57b(0x146),_0x3f7c69=_0x42b57b(0x15d)):(_0x818465=_0x42b57b(0x14a),_0x3f7c69=_0x42b57b(0x161));}_0x1f71a3[_0x42b57b(0x170)]({'sqlCode':_0x4ab47f[_0x42b57b(0x154)],'sqlName':_0x4ab47f[_0x42b57b(0x15a)],'filePath':_0x46d334,'status':_0x818465,'reason':_0x3f7c69});}return{'method':'POST','url':_0x42b57b(0x175),'body':{'appCode':_0x1fdd90[_0x42b57b(0x142)],'sqlCode':_0x1fdd90[_0x42b57b(0x171)](_0x42b57b(0x158))||null,'sqlName':_0x1fdd90['str'](_0x42b57b(0x167))||null,'files':_0x1f71a3},'description':_0x42b57b(0x13f)+_0x1f71a3[_0x42b57b(0x160)]+_0x42b57b(0x17a)+_0x2013af[_0x42b57b(0x172)]};},async 'execute'(_0x4842e7){const _0x759c48=a190_0x1517f1,_0x44a6ef=loadSqlProjectConfig(_0x4842e7['appCode']),_0xc16304=await readSqlLockFile(_0x44a6ef[_0x759c48(0x13b)]),{lockData:_0x34fc5a,appLock:_0x526c37}=ensureSqlLockScope(_0xc16304??createEmptySqlLock(),_0x44a6ef[_0x759c48(0x142)],_0x44a6ef[_0x759c48(0x147)],_0x759c48(0x140)),_0x10db40=_0x4842e7['bool'](_0x759c48(0x13c)),_0x5096d8=await fetchAllSqlQueries(_0x4842e7[_0x759c48(0x142)],{'sqlCode':_0x4842e7['str']('sqlcode')||undefined,'sqlName':_0x4842e7[_0x759c48(0x171)](_0x759c48(0x167))||undefined});if(_0x5096d8[_0x759c48(0x160)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x759c48(0x13e)};const _0x29401b=[],_0x5270e5=[];for(const _0x2e3e8d of _0x5096d8){try{_0x29401b[_0x759c48(0x170)](await ensureSqlContent(_0x2e3e8d));}catch(_0x595b6e){_0x5270e5[_0x759c48(0x170)]({'sqlCode':_0x2e3e8d['sqlCode'],'error':_0x595b6e instanceof Error?_0x595b6e['message']:String(_0x595b6e)});}}if(_0x10db40&&!_0x4842e7[_0x759c48(0x173)]){let _0x393dcf=![];for(const _0x5bcedd of _0x29401b){const _0x1b47f7=detectModeFromSql(_0x5bcedd),_0x5a7a83=_0x5bcedd[_0x759c48(0x14d)]?await getDbName(_0x4842e7[_0x759c48(0x142)],Number(_0x5bcedd[_0x759c48(0x14d)]))[_0x759c48(0x168)](()=>undefined):undefined,_0x83de27=buildLocalSqlFileContent({'sqlCode':_0x5bcedd[_0x759c48(0x154)],'sqlName':_0x5bcedd['sqlName'],'dbId':_0x5bcedd[_0x759c48(0x14d)]},ensureRemoteSqlContent(_0x5bcedd),{'dbName':_0x5a7a83,'mode':_0x1b47f7,'syncedAt':new Date()[_0x759c48(0x177)](),'description':_0x5bcedd['description']}),_0x54a7f3=resolveLocalSqlFilePath(_0x44a6ef,_0x5bcedd['sqlCode'],buildSqlLockEntry(_0x5bcedd,ensureRemoteSqlContent(_0x5bcedd),'',{'dbName':_0x5a7a83}));if(await fileExists(_0x54a7f3)){const _0x3976da=await readFile(_0x54a7f3,_0x759c48(0x17b));if(!isEquivalentPulledSqlFile(_0x3976da,_0x83de27,_0x1b47f7)){_0x393dcf=!![];break;}}}if(_0x393dcf){const _0x985304=await confirmForceOverwrite(_0x759c48(0x13d));if(!_0x985304)throw CliErrors[_0x759c48(0x16f)](_0x759c48(0x14b));}}const _0x2bf896=cloneSqlLockData(_0x34fc5a),_0x4a2410=_0x2bf896[_0x759c48(0x15e)][_0x44a6ef['appCode']],_0xfef51e=[],_0x5a0f6e=[];for(const _0x59b331 of _0x29401b){const _0xe2d161=_0x4a2410[_0x759c48(0x156)][_0x59b331[_0x759c48(0x154)]],_0x21a528=ensureRemoteSqlContent(_0x59b331),_0xa5021=detectModeFromSql(_0x59b331),_0x2cd143=_0x59b331[_0x759c48(0x14d)]?await getDbName(_0x4842e7['appCode'],Number(_0x59b331[_0x759c48(0x14d)]))[_0x759c48(0x168)](()=>undefined):undefined,_0x2bb2b8=buildLocalSqlFileContent({'sqlCode':_0x59b331['sqlCode'],'sqlName':_0x59b331[_0x759c48(0x15a)],'dbId':_0x59b331[_0x759c48(0x14d)]},_0x21a528,{'dbName':_0x2cd143,'mode':_0xa5021,'syncedAt':new Date()['toISOString'](),'description':_0x59b331[_0x759c48(0x15f)]}),_0x3316a2=buildSqlLockEntry(_0x59b331,_0x21a528,computeSqlContentHash(_0x2bb2b8),{'dbName':_0x2cd143}),_0x34ee07=_0x3316a2[_0x759c48(0x179)],_0x1d19f3=join(_0x44a6ef['sqlRootDir'],_0x34ee07);try{if(await fileExists(_0x1d19f3)){const _0x11e519=await readFile(_0x1d19f3,_0x759c48(0x17b));if(isEquivalentPulledSqlFile(_0x11e519,_0x2bb2b8,_0xa5021)){_0x5a0f6e[_0x759c48(0x170)]({'sqlCode':_0x59b331['sqlCode'],'reason':_0x759c48(0x15d)}),_0x4a2410[_0x759c48(0x156)][_0x59b331[_0x759c48(0x154)]]={..._0x3316a2,'hash':computeSqlContentHash(_0x11e519),'path':_0x34ee07};continue;}if(!_0x10db40){_0x5a0f6e[_0x759c48(0x170)]({'sqlCode':_0x59b331[_0x759c48(0x154)],'reason':'local\x20differs\x20from\x20remote'});continue;}}const _0x391655=_0xe2d161?.[_0x759c48(0x179)]?join(_0x44a6ef[_0x759c48(0x172)],_0xe2d161[_0x759c48(0x179)]):undefined;_0x391655&&_0x391655!==_0x1d19f3&&await fileExists(_0x391655)&&await rm(_0x391655,{'force':!![]}),await ensureParentDirectory(_0x1d19f3),await writeFile(_0x1d19f3,_0x2bb2b8,_0x759c48(0x17b)),_0x4a2410[_0x759c48(0x156)][_0x59b331['sqlCode']]={..._0x3316a2,'path':_0x34ee07},_0xfef51e[_0x759c48(0x170)]({'sqlCode':_0x59b331[_0x759c48(0x154)],'filePath':_0x1d19f3});}catch(_0x1dd8a){_0x5270e5[_0x759c48(0x170)]({'sqlCode':_0x59b331[_0x759c48(0x154)],'error':_0x1dd8a instanceof Error?_0x1dd8a[_0x759c48(0x166)]:String(_0x1dd8a)});}}return _0x4a2410[_0x759c48(0x16a)]=new Date()[_0x759c48(0x177)](),await writeSqlLockFile(_0x44a6ef[_0x759c48(0x13b)],_0x2bf896),{'ok':_0x5270e5['length']===0x0,'data':{'pulled':_0xfef51e,'skipped':_0x5a0f6e,'failed':_0x5270e5},'message':_0x759c48(0x16b)+_0xfef51e['length']+_0x759c48(0x15c)+_0x5a0f6e[_0x759c48(0x160)]+_0x759c48(0x157)+_0x5270e5[_0x759c48(0x160)]+_0x759c48(0x144)};}};function detectModeFromSql(_0x337524){const _0x46360d=a190_0x1517f1,_0x48eeba=ensureRemoteSqlContent(_0x337524),_0x3653d9=stripLocalSqlMetadata(_0x48eeba,'mybatisXml')['trimStart']();if(/^<(select|insert|update|delete)\b/i[_0x46360d(0x16c)](_0x3653d9))return _0x46360d(0x14e);return _0x46360d(0x169);}function isEquivalentPulledSqlFile(_0x221d3c,_0x287fd2,_0x2c9968){return normalizePullComparableContent(_0x221d3c,_0x2c9968)===normalizePullComparableContent(_0x287fd2,_0x2c9968);}function normalizePullComparableContent(_0xcbb2b3,_0x42b43e){const _0xc1e75d=a190_0x1517f1,_0x747177=_0xcbb2b3[_0xc1e75d(0x149)](/\r\n/g,'\x0a')[_0xc1e75d(0x148)]('\x0a'),_0x3dc403=_0x747177[_0xc1e75d(0x17d)](_0x4a4c1f=>!isSyncedAtMetadataLine(_0x4a4c1f,_0x42b43e));return _0x3dc403[_0xc1e75d(0x162)]('\x0a');}function isSyncedAtMetadataLine(_0x5eb8b6,_0x5758c9){const _0x5c1e0e=a190_0x1517f1;if(_0x5758c9===_0x5c1e0e(0x14e))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x5c1e0e(0x16c)](_0x5eb8b6);return/^\s*--\s*@lovrabet\.syncedAt:/['test'](_0x5eb8b6);}
|
|
1
|
+
const a191_0x149c13=a191_0x3b48;(function(_0x5f5993,_0x30eba3){const _0x466b9e=a191_0x3b48,_0x4a69b8=_0x5f5993();while(!![]){try{const _0x30affc=-parseInt(_0x466b9e(0xcf))/0x1+parseInt(_0x466b9e(0xee))/0x2*(-parseInt(_0x466b9e(0xcb))/0x3)+-parseInt(_0x466b9e(0xda))/0x4+-parseInt(_0x466b9e(0xd0))/0x5*(parseInt(_0x466b9e(0xfa))/0x6)+-parseInt(_0x466b9e(0xd2))/0x7*(parseInt(_0x466b9e(0xe1))/0x8)+-parseInt(_0x466b9e(0xe5))/0x9+parseInt(_0x466b9e(0xf2))/0xa;if(_0x30affc===_0x30eba3)break;else _0x4a69b8['push'](_0x4a69b8['shift']());}catch(_0x40ce3b){_0x4a69b8['push'](_0x4a69b8['shift']());}}}(a191_0x6475,0x82362));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';function a191_0x6475(){const _0x28103e=['sqlRootDir','lockFilePath','sqlCode','3373320zZvHrf','Would\x20pull\x20','string','\x20written,\x20','sqlName','split','paging','131976QFUpxL','\x20failed','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','boolean','9008658cGXmqq','sql','read','push','join','path','conflict','No\x20remote\x20SQL\x20queries\x20matched.','toISOString','178cArBbN','skipped','name','trimStart','41173030mmVYSI','sqls','message','apps','totalCount','sqlRoot','mybatisXml','nonInteractive','84LcmKvV','dbId','test','catch','filter','replace','POST','lastSync','utf8','length','\x20skipped,\x20','bool','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','local\x20differs\x20from\x20remote','pull','sqlcode','unchanged','force','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','cancelled','7836EBrciq','str','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','sqlContent','331258VPjDVk','260900QDlmEw','Force\x20pull\x20cancelled.','189TFQfty','description','Force\x20overwrite\x20local\x20unsynced\x20changes','Filter\x20by\x20SQL\x20display\x20name','appCode'];a191_0x6475=function(){return _0x28103e;};return a191_0x6475();}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(_0x79b2d8,_0x5a2288){const _0x505ff6=a191_0x3b48,_0x4bf279=[];let _0x14d5c2=0x1;while(!![]){const _0x48f5dc=await listSqlQueries(_0x79b2d8,{'currentPage':_0x14d5c2,'pageSize':PAGE_SIZE,'sqlCode':_0x5a2288[_0x505ff6(0xd9)],'sqlName':_0x5a2288[_0x505ff6(0xde)]}),_0x229a14=_0x48f5dc['tableData']??[];_0x4bf279[_0x505ff6(0xe8)](..._0x229a14);if(_0x229a14[_0x505ff6(0xc0)]===0x0)break;const _0x3971d8=_0x48f5dc[_0x505ff6(0xe0)]?.[_0x505ff6(0xf6)];if(_0x3971d8!=null?_0x4bf279[_0x505ff6(0xc0)]>=_0x3971d8:_0x229a14[_0x505ff6(0xc0)]<PAGE_SIZE)break;_0x14d5c2++;}return _0x4bf279;}async function ensureSqlContent(_0x27b225){const _0x5144a3=a191_0x3b48;if(_0x27b225[_0x5144a3(0xce)]!=null&&String(_0x27b225['sqlContent'])[_0x5144a3(0xc0)]>0x0)return _0x27b225;return getSqlQueryDetail(_0x27b225[_0x5144a3(0xd9)]);}export const sqlPull={'service':'sql','command':a191_0x149c13(0xc5),'description':a191_0x149c13(0xe3),'risk':a191_0x149c13(0xe7),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a191_0x149c13(0xf0),'type':a191_0x149c13(0xdc),'description':a191_0x149c13(0xd5)},{'name':a191_0x149c13(0xc8),'type':a191_0x149c13(0xe4),'description':a191_0x149c13(0xd4)}],async 'dryRun'(_0x2cc865){const _0x4bfe60=a191_0x149c13,_0x294b71=loadSqlProjectConfig(_0x2cc865[_0x4bfe60(0xd6)]),_0x1a7983=await readSqlLockFile(_0x294b71['lockFilePath']),{appLock:_0x17df4a}=ensureSqlLockScope(_0x1a7983??createEmptySqlLock(),_0x294b71[_0x4bfe60(0xd6)],_0x294b71[_0x4bfe60(0xf7)],_0x4bfe60(0xc5)),_0x378e46=await fetchAllSqlQueries(_0x2cc865[_0x4bfe60(0xd6)],{'sqlCode':_0x2cc865[_0x4bfe60(0xcc)](_0x4bfe60(0xc6))||undefined,'sqlName':_0x2cc865[_0x4bfe60(0xcc)](_0x4bfe60(0xf0))||undefined}),_0x4cae1b=[];for(const _0x3dfa35 of _0x378e46){const _0x2a6816=await ensureSqlContent(_0x3dfa35),_0x1f7fa3=ensureRemoteSqlContent(_0x2a6816),_0x109100=detectModeFromSql(_0x2a6816),_0x1fc111=_0x2a6816[_0x4bfe60(0xfb)]?await getDbName(_0x2cc865[_0x4bfe60(0xd6)],Number(_0x2a6816[_0x4bfe60(0xfb)]))[_0x4bfe60(0xfd)](()=>undefined):undefined,_0x5810d5=buildLocalSqlFileContent({'sqlCode':_0x2a6816[_0x4bfe60(0xd9)],'sqlName':_0x2a6816[_0x4bfe60(0xde)],'dbId':_0x2a6816[_0x4bfe60(0xfb)]},_0x1f7fa3,{'dbName':_0x1fc111,'mode':_0x109100,'syncedAt':new Date()[_0x4bfe60(0xed)](),'description':_0x2a6816[_0x4bfe60(0xd3)]}),_0x2e4fa6=buildSqlLockEntry(_0x2a6816,_0x1f7fa3,'',{'dbName':_0x1fc111}),_0x2194ba=resolveLocalSqlFilePath(_0x294b71,_0x2a6816['sqlCode'],_0x2e4fa6);let _0x2d817b='would_pull',_0x4ca4f3;if(await fileExists(_0x2194ba)){const _0x57576a=await readFile(_0x2194ba,_0x4bfe60(0xbf));isEquivalentPulledSqlFile(_0x57576a,_0x5810d5,_0x109100)?(_0x2d817b=_0x4bfe60(0xef),_0x4ca4f3=_0x4bfe60(0xc7)):(_0x2d817b=_0x4bfe60(0xeb),_0x4ca4f3=_0x4bfe60(0xcd));}_0x4cae1b['push']({'sqlCode':_0x2a6816[_0x4bfe60(0xd9)],'sqlName':_0x2a6816['sqlName'],'filePath':_0x2194ba,'status':_0x2d817b,'reason':_0x4ca4f3});}return{'method':_0x4bfe60(0x100),'url':_0x4bfe60(0xc9),'body':{'appCode':_0x2cc865[_0x4bfe60(0xd6)],'sqlCode':_0x2cc865[_0x4bfe60(0xcc)]('sqlcode')||null,'sqlName':_0x2cc865[_0x4bfe60(0xcc)](_0x4bfe60(0xf0))||null,'files':_0x4cae1b},'description':_0x4bfe60(0xdb)+_0x4cae1b[_0x4bfe60(0xc0)]+'\x20SQL\x20file(s)\x20into\x20'+_0x294b71['sqlRootDir']};},async 'execute'(_0x547548){const _0x397448=a191_0x149c13,_0x3e7589=loadSqlProjectConfig(_0x547548[_0x397448(0xd6)]),_0x5921c5=await readSqlLockFile(_0x3e7589['lockFilePath']),{lockData:_0x597ce0,appLock:_0x2406ed}=ensureSqlLockScope(_0x5921c5??createEmptySqlLock(),_0x3e7589[_0x397448(0xd6)],_0x3e7589[_0x397448(0xf7)],_0x397448(0xc5)),_0x4ab0df=_0x547548[_0x397448(0xc2)](_0x397448(0xc8)),_0xbdfb53=await fetchAllSqlQueries(_0x547548[_0x397448(0xd6)],{'sqlCode':_0x547548[_0x397448(0xcc)](_0x397448(0xc6))||undefined,'sqlName':_0x547548[_0x397448(0xcc)](_0x397448(0xf0))||undefined});if(_0xbdfb53[_0x397448(0xc0)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x397448(0xec)};const _0xea739f=[],_0x4152f9=[];for(const _0x3d63a7 of _0xbdfb53){try{_0xea739f[_0x397448(0xe8)](await ensureSqlContent(_0x3d63a7));}catch(_0x80c850){_0x4152f9[_0x397448(0xe8)]({'sqlCode':_0x3d63a7[_0x397448(0xd9)],'error':_0x80c850 instanceof Error?_0x80c850[_0x397448(0xf4)]:String(_0x80c850)});}}if(_0x4ab0df&&!_0x547548[_0x397448(0xf9)]){let _0x4e0e4f=![];for(const _0x5047b8 of _0xea739f){const _0x2a22e7=detectModeFromSql(_0x5047b8),_0x1ab5d0=_0x5047b8['dbId']?await getDbName(_0x547548[_0x397448(0xd6)],Number(_0x5047b8['dbId']))[_0x397448(0xfd)](()=>undefined):undefined,_0x513447=buildLocalSqlFileContent({'sqlCode':_0x5047b8[_0x397448(0xd9)],'sqlName':_0x5047b8[_0x397448(0xde)],'dbId':_0x5047b8[_0x397448(0xfb)]},ensureRemoteSqlContent(_0x5047b8),{'dbName':_0x1ab5d0,'mode':_0x2a22e7,'syncedAt':new Date()[_0x397448(0xed)](),'description':_0x5047b8[_0x397448(0xd3)]}),_0x415cb8=resolveLocalSqlFilePath(_0x3e7589,_0x5047b8['sqlCode'],buildSqlLockEntry(_0x5047b8,ensureRemoteSqlContent(_0x5047b8),'',{'dbName':_0x1ab5d0}));if(await fileExists(_0x415cb8)){const _0x55518f=await readFile(_0x415cb8,_0x397448(0xbf));if(!isEquivalentPulledSqlFile(_0x55518f,_0x513447,_0x2a22e7)){_0x4e0e4f=!![];break;}}}if(_0x4e0e4f){const _0x5ded31=await confirmForceOverwrite(_0x397448(0xc3));if(!_0x5ded31)throw CliErrors[_0x397448(0xca)](_0x397448(0xd1));}}const _0x39716b=cloneSqlLockData(_0x597ce0),_0x28b88e=_0x39716b[_0x397448(0xf5)][_0x3e7589[_0x397448(0xd6)]],_0xc6e1d5=[],_0xac8bc6=[];for(const _0x4662e3 of _0xea739f){const _0x567f79=_0x28b88e[_0x397448(0xf3)][_0x4662e3[_0x397448(0xd9)]],_0x15cb3a=ensureRemoteSqlContent(_0x4662e3),_0x1f817d=detectModeFromSql(_0x4662e3),_0x478431=_0x4662e3[_0x397448(0xfb)]?await getDbName(_0x547548['appCode'],Number(_0x4662e3['dbId']))['catch'](()=>undefined):undefined,_0x3e5703=buildLocalSqlFileContent({'sqlCode':_0x4662e3[_0x397448(0xd9)],'sqlName':_0x4662e3[_0x397448(0xde)],'dbId':_0x4662e3[_0x397448(0xfb)]},_0x15cb3a,{'dbName':_0x478431,'mode':_0x1f817d,'syncedAt':new Date()[_0x397448(0xed)](),'description':_0x4662e3[_0x397448(0xd3)]}),_0x5bf15d=buildSqlLockEntry(_0x4662e3,_0x15cb3a,computeSqlContentHash(_0x3e5703),{'dbName':_0x478431}),_0x4c7c9e=_0x5bf15d['path'],_0x3f0457=join(_0x3e7589['sqlRootDir'],_0x4c7c9e);try{if(await fileExists(_0x3f0457)){const _0x4b4579=await readFile(_0x3f0457,_0x397448(0xbf));if(isEquivalentPulledSqlFile(_0x4b4579,_0x3e5703,_0x1f817d)){_0xac8bc6['push']({'sqlCode':_0x4662e3[_0x397448(0xd9)],'reason':_0x397448(0xc7)}),_0x28b88e[_0x397448(0xf3)][_0x4662e3[_0x397448(0xd9)]]={..._0x5bf15d,'hash':computeSqlContentHash(_0x4b4579),'path':_0x4c7c9e};continue;}if(!_0x4ab0df){_0xac8bc6[_0x397448(0xe8)]({'sqlCode':_0x4662e3[_0x397448(0xd9)],'reason':_0x397448(0xc4)});continue;}}const _0x3edee9=_0x567f79?.[_0x397448(0xea)]?join(_0x3e7589[_0x397448(0xd7)],_0x567f79[_0x397448(0xea)]):undefined;_0x3edee9&&_0x3edee9!==_0x3f0457&&await fileExists(_0x3edee9)&&await rm(_0x3edee9,{'force':!![]}),await ensureParentDirectory(_0x3f0457),await writeFile(_0x3f0457,_0x3e5703,_0x397448(0xbf)),_0x28b88e[_0x397448(0xf3)][_0x4662e3[_0x397448(0xd9)]]={..._0x5bf15d,'path':_0x4c7c9e},_0xc6e1d5['push']({'sqlCode':_0x4662e3[_0x397448(0xd9)],'filePath':_0x3f0457});}catch(_0x86d948){_0x4152f9[_0x397448(0xe8)]({'sqlCode':_0x4662e3['sqlCode'],'error':_0x86d948 instanceof Error?_0x86d948[_0x397448(0xf4)]:String(_0x86d948)});}}return _0x28b88e[_0x397448(0x101)]=new Date()[_0x397448(0xed)](),await writeSqlLockFile(_0x3e7589[_0x397448(0xd8)],_0x39716b),{'ok':_0x4152f9['length']===0x0,'data':{'pulled':_0xc6e1d5,'skipped':_0xac8bc6,'failed':_0x4152f9},'message':'Pull\x20complete:\x20'+_0xc6e1d5['length']+_0x397448(0xdd)+_0xac8bc6[_0x397448(0xc0)]+_0x397448(0xc1)+_0x4152f9[_0x397448(0xc0)]+_0x397448(0xe2)};}};function detectModeFromSql(_0xe30de7){const _0x5b8261=a191_0x149c13,_0x46c86c=ensureRemoteSqlContent(_0xe30de7),_0x291e7d=stripLocalSqlMetadata(_0x46c86c,_0x5b8261(0xf8))[_0x5b8261(0xf1)]();if(/^<(select|insert|update|delete)\b/i['test'](_0x291e7d))return _0x5b8261(0xf8);return _0x5b8261(0xe6);}function a191_0x3b48(_0x890c8e,_0x1a6329){_0x890c8e=_0x890c8e-0xbf;const _0x64751f=a191_0x6475();let _0x3b48f1=_0x64751f[_0x890c8e];return _0x3b48f1;}function isEquivalentPulledSqlFile(_0x5a508c,_0x435e39,_0x2baff0){return normalizePullComparableContent(_0x5a508c,_0x2baff0)===normalizePullComparableContent(_0x435e39,_0x2baff0);}function normalizePullComparableContent(_0xf82a33,_0x5dbed1){const _0x52cac2=a191_0x149c13,_0x3f9991=_0xf82a33[_0x52cac2(0xff)](/\r\n/g,'\x0a')[_0x52cac2(0xdf)]('\x0a'),_0x26825f=_0x3f9991[_0x52cac2(0xfe)](_0xf3fe35=>!isSyncedAtMetadataLine(_0xf3fe35,_0x5dbed1));return _0x26825f[_0x52cac2(0xe9)]('\x0a');}function isSyncedAtMetadataLine(_0x51fed0,_0x491e7b){const _0x371111=a191_0x149c13;if(_0x491e7b===_0x371111(0xf8))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x371111(0xfc)](_0x51fed0);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x371111(0xfc)](_0x51fed0);}
|
package/lib/commands/sql/push.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a191_0x110479=a191_0x30d8;(function(_0x2bc606,_0x1f1f2d){const _0x4d5235=a191_0x30d8,_0x39ca42=_0x2bc606();while(!![]){try{const _0x2ea889=parseInt(_0x4d5235(0x10b))/0x1*(-parseInt(_0x4d5235(0x113))/0x2)+parseInt(_0x4d5235(0x127))/0x3*(parseInt(_0x4d5235(0x11b))/0x4)+parseInt(_0x4d5235(0x100))/0x5*(-parseInt(_0x4d5235(0xf6))/0x6)+parseInt(_0x4d5235(0x11f))/0x7*(-parseInt(_0x4d5235(0x101))/0x8)+parseInt(_0x4d5235(0x131))/0x9*(parseInt(_0x4d5235(0x134))/0xa)+-parseInt(_0x4d5235(0x104))/0xb+-parseInt(_0x4d5235(0x10a))/0xc*(-parseInt(_0x4d5235(0x11a))/0xd);if(_0x2ea889===_0x1f1f2d)break;else _0x39ca42['push'](_0x39ca42['shift']());}catch(_0x16658b){_0x39ca42['push'](_0x39ca42['shift']());}}}(a191_0x1c0a,0x88a9a));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';function a191_0x30d8(_0x16cbf5,_0x549243){_0x16cbf5=_0x16cbf5-0xf3;const _0x1c0a2f=a191_0x1c0a();let _0x30d869=_0x1c0a2f[_0x16cbf5];return _0x30d869;}import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';function a191_0x1c0a(){const _0x3d30c6=['No\x20database\x20matches\x20local\x20directory\x20\x22','push','str','appCode','set','dbId','sqlRootDir','/smartapi/custom/updateUserCustomSql','sql','9778599KyUCkq','sqlCode','\x20skipped,\x20','10XvFoIR','dbDirectory','\x22\x20for\x20sqlCode\x20','sqlName','force','validation','No\x20local\x20SQL\x20files\x20found.','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','6QwRFoK','lockFilePath','utf8','bool','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','has','trashDir','startsWith','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','\x20pushed,\x20','4328925gjAMwL','2927648fyaKnR','\x20failed','path','9369294KikBDQ','remoteId','relativePath','version','hash','message','12OCpgDD','2FOJwNo','get','exec','dbName','sqls','mode','POST','catch','379906Jpmcbu','projectRoot','sqlcode','Local\x20directory\x20\x22','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','sqlRoot','isFinite','14590550pdNobx','1628620mWbRnO','join','write','lastSync','7fOTdhY','filter','map','entries','length','unchanged','Local\x20SQL\x20not\x20found:\x20','Would\x20push\x20','6DyOboG'];a191_0x1c0a=function(){return _0x3d30c6;};return a191_0x1c0a();}import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';async function getTargetSqlQueries(_0x2fc2de,_0x429ea9,_0x2e2a95){const _0x1d276d=a191_0x30d8,_0x38c2db=await scanLocalSqlQueries(_0x2fc2de),_0x558ef=new Map();for(const _0x3a7f91 of _0x38c2db){if(_0x2e2a95&&_0x3a7f91['sqlCode']!==_0x2e2a95)continue;const _0x4ec7b7=_0x558ef[_0x1d276d(0x10c)](_0x3a7f91['sqlCode'])??[];_0x4ec7b7[_0x1d276d(0x129)](_0x3a7f91),_0x558ef[_0x1d276d(0x12c)](_0x3a7f91[_0x1d276d(0x132)],_0x4ec7b7);}if(_0x2e2a95&&!_0x558ef[_0x1d276d(0xfb)](_0x2e2a95))throw CliErrors[_0x1d276d(0xf3)](_0x1d276d(0x125)+_0x2e2a95);const _0xd5eb75=[];for(const [_0x5dff59,_0x1ecf9d]of _0x558ef[_0x1d276d(0x122)]()){if(_0x1ecf9d[_0x1d276d(0x123)]===0x1){_0xd5eb75[_0x1d276d(0x129)](_0x1ecf9d[0x0]);continue;}const _0x31f70f=_0x429ea9[_0x1d276d(0x10f)][_0x5dff59],_0x5a88a2=_0x31f70f?.[_0x1d276d(0x103)],_0x40d509=_0x5a88a2?_0x1ecf9d[_0x1d276d(0x120)](_0x197ec5=>_0x197ec5[_0x1d276d(0x106)]!==_0x5a88a2):_0x1ecf9d;if(_0x31f70f&&_0x40d509[_0x1d276d(0x123)]===0x1){_0xd5eb75[_0x1d276d(0x129)](_0x40d509[0x0]);continue;}throw CliErrors[_0x1d276d(0xf3)](_0x1d276d(0xf5)+_0x5dff59+'.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.');}return _0xd5eb75;}export const sqlPush={'service':a191_0x110479(0x130),'command':a191_0x110479(0x129),'description':'Push\x20local\x20SQL\x20files\x20to\x20remote','risk':a191_0x110479(0x11d),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'force','type':'boolean','description':a191_0x110479(0xfe)}],async 'dryRun'(_0x1f5fbb){const _0x5a2bff=a191_0x110479,_0x598c20=loadSqlProjectConfig(_0x1f5fbb[_0x5a2bff(0x12b)]),_0x5e4330=await readSqlLockFile(_0x598c20[_0x5a2bff(0xf7)]),{appLock:_0x1686b7}=ensureSqlLockScope(_0x5e4330??createEmptySqlLock(),_0x1f5fbb[_0x5a2bff(0x12b)],_0x598c20[_0x5a2bff(0x118)],_0x5a2bff(0x129)),_0x5635b9=await getTargetSqlQueries(_0x598c20,_0x1686b7,_0x1f5fbb[_0x5a2bff(0x12a)](_0x5a2bff(0x115))||undefined),_0x4b938c=[];for(const _0x297707 of _0x5635b9){const _0x5584a9=await computeSqlFileHash(_0x297707['filePath']),_0x430667=_0x1686b7[_0x5a2bff(0x10f)][_0x297707[_0x5a2bff(0x132)]],_0x14c4c1=!!_0x430667&&(_0x430667[_0x5a2bff(0x103)]!==_0x297707[_0x5a2bff(0x106)]||!!_0x297707[_0x5a2bff(0x137)]&&_0x430667['sqlName']!==_0x297707[_0x5a2bff(0x137)]);if(!_0x1f5fbb[_0x5a2bff(0xf9)](_0x5a2bff(0x138))&&_0x430667&&_0x430667[_0x5a2bff(0x108)]===_0x5584a9&&!_0x14c4c1)continue;_0x4b938c[_0x5a2bff(0x129)](_0x297707['sqlCode']);}return{'method':_0x5a2bff(0x111),'url':_0x5a2bff(0x12f),'body':{'sqlCodes':_0x4b938c,'appCode':_0x1f5fbb[_0x5a2bff(0x12b)]},'description':_0x5a2bff(0x126)+_0x4b938c[_0x5a2bff(0x123)]+'\x20SQL\x20file(s)'};},async 'execute'(_0x1dc9e9){const _0x5d84bd=a191_0x110479,_0x7aa3e7=loadSqlProjectConfig(_0x1dc9e9[_0x5d84bd(0x12b)]),_0x2750c5=await readSqlLockFile(_0x7aa3e7[_0x5d84bd(0xf7)]),{lockData:_0x3dd614,appLock:_0x460697}=ensureSqlLockScope(_0x2750c5??createEmptySqlLock(),_0x1dc9e9[_0x5d84bd(0x12b)],_0x7aa3e7[_0x5d84bd(0x118)],_0x5d84bd(0x129)),_0x391e66=await getTargetSqlQueries(_0x7aa3e7,_0x460697,_0x1dc9e9[_0x5d84bd(0x12a)]('sqlcode')||undefined);if(_0x391e66[_0x5d84bd(0x123)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x5d84bd(0xf4)};const _0x5a64b0=[],_0x288a32=[],_0x4e6477=[];for(const _0x57a846 of _0x391e66){const _0xec37b2=_0x460697[_0x5d84bd(0x10f)][_0x57a846['sqlCode']];if(!_0xec37b2){_0x4e6477[_0x5d84bd(0x129)]({'sqlCode':_0x57a846[_0x5d84bd(0x132)],'error':_0x5d84bd(0xfa)});continue;}try{const _0x3bacb9=await computeSqlFileHash(_0x57a846['filePath']),_0x163712=_0xec37b2[_0x5d84bd(0x103)]!==_0x57a846['relativePath']||!!_0x57a846['sqlName']&&_0xec37b2['sqlName']!==_0x57a846[_0x5d84bd(0x137)];if(!_0x1dc9e9['bool'](_0x5d84bd(0x138))&&_0xec37b2[_0x5d84bd(0x108)]===_0x3bacb9&&!_0x163712){_0x288a32[_0x5d84bd(0x129)]({'sqlCode':_0x57a846[_0x5d84bd(0x132)],'reason':_0x5d84bd(0x124)});continue;}if(_0xec37b2['version']==null){_0x4e6477[_0x5d84bd(0x129)]({'sqlCode':_0x57a846[_0x5d84bd(0x132)],'error':_0x5d84bd(0x117)});continue;}const _0x599607=await readFile(_0x57a846['filePath'],_0x5d84bd(0xf8)),_0x5c2486=stripLocalSqlMetadata(_0x599607,_0x57a846[_0x5d84bd(0x110)]),_0x271860=_0x57a846['sqlName']||_0xec37b2[_0x5d84bd(0x137)],_0x113504=await resolveTargetDbBinding(_0x1dc9e9[_0x5d84bd(0x12b)],_0x57a846,_0xec37b2),_0x4cc2a0=await updateSqlQuery({'id':_0xec37b2[_0x5d84bd(0x105)],'appCode':_0x1dc9e9['appCode'],'sqlCode':_0x57a846[_0x5d84bd(0x132)],'sqlName':_0x271860,'dbId':_0x113504[_0x5d84bd(0x12d)],'version':_0xec37b2[_0x5d84bd(0x107)],'sqlContent':_0x5c2486,'sqlConfig':_0xec37b2['sqlConfig']??undefined}),_0x271fd0=_0x4cc2a0[_0x5d84bd(0x12d)]?await getDbName(_0x1dc9e9['appCode'],Number(_0x4cc2a0['dbId']))[_0x5d84bd(0x112)](()=>_0x113504['dbName']):_0x113504['dbName'];_0x460697['sqls'][_0x57a846[_0x5d84bd(0x132)]]={...buildSqlLockEntry(_0x4cc2a0,_0x5c2486,_0x3bacb9,{'dbName':_0x271fd0}),'path':_0x57a846[_0x5d84bd(0x106)],'mode':_0xec37b2[_0x5d84bd(0x110)]},await archivePreviousSqlFileIfNeeded(_0x7aa3e7,_0xec37b2[_0x5d84bd(0x103)],_0x57a846['relativePath']),_0x5a64b0[_0x5d84bd(0x129)]({'sqlCode':_0x57a846[_0x5d84bd(0x132)],'remoteId':_0xec37b2[_0x5d84bd(0x105)]});}catch(_0x30af63){_0x4e6477[_0x5d84bd(0x129)]({'sqlCode':_0x57a846['sqlCode'],'error':_0x30af63 instanceof Error?_0x30af63[_0x5d84bd(0x109)]:String(_0x30af63)});}}return _0x460697[_0x5d84bd(0x11e)]=new Date()['toISOString'](),await writeSqlLockFile(_0x7aa3e7[_0x5d84bd(0xf7)],_0x3dd614),{'ok':_0x4e6477[_0x5d84bd(0x123)]===0x0,'data':{'pushed':_0x5a64b0,'skipped':_0x288a32,'failed':_0x4e6477},'message':'Push\x20complete:\x20'+_0x5a64b0[_0x5d84bd(0x123)]+_0x5d84bd(0xff)+_0x288a32[_0x5d84bd(0x123)]+_0x5d84bd(0x133)+_0x4e6477['length']+_0x5d84bd(0x102)};}};async function archivePreviousSqlFileIfNeeded(_0x241cfc,_0x1bf5e5,_0x2a9d2d){const _0xdca36a=a191_0x110479;if(!_0x1bf5e5||_0x1bf5e5===_0x2a9d2d)return;const _0x5e6e62=join(_0x241cfc[_0xdca36a(0x12e)],_0x1bf5e5);if(!await fileExists(_0x5e6e62))return;const _0x378764=await moveToTrash(_0x241cfc[_0xdca36a(0x114)],_0x241cfc[_0xdca36a(0xfc)],_0x5e6e62);await cleanupEmptyDirectories(dirname(_0x5e6e62),_0x241cfc['sqlRootDir']),void _0x378764;}async function moveToTrash(_0x586086,_0x48e81c,_0x4b2953){const _0x92143a=new Date()['toISOString']()['replace'](/[:.]/g,'-'),_0x1c4c0c=relative(_0x586086,_0x4b2953),_0x36f50c=join(_0x48e81c,_0x92143a,_0x1c4c0c);return await mkdir(dirname(_0x36f50c),{'recursive':!![]}),await rename(_0x4b2953,_0x36f50c),_0x36f50c;}async function cleanupEmptyDirectories(_0x2d4072,_0x285bfc){const _0x3e3a25=a191_0x110479;let _0x3f8a10=resolve(_0x2d4072);const _0x1e5c32=resolve(_0x285bfc);while(_0x3f8a10[_0x3e3a25(0xfd)](''+_0x1e5c32+sep)||_0x3f8a10===_0x1e5c32){if(_0x3f8a10===_0x1e5c32)return;try{const _0x455250=await readdir(_0x3f8a10);if(_0x455250[_0x3e3a25(0x123)]>0x0)return;await rmdir(_0x3f8a10);}catch{return;}_0x3f8a10=dirname(_0x3f8a10);}}async function resolveTargetDbBinding(_0x12771b,_0x1c4b7d,_0x260cf8){const _0x1267cb=a191_0x110479,_0xd4477c=_0x1c4b7d[_0x1267cb(0x135)];if(!_0xd4477c)return{'dbId':_0x260cf8['dbId'],'dbName':_0x260cf8[_0x1267cb(0x10e)]};const _0x3e195d=buildDbDirectoryName(_0x260cf8[_0x1267cb(0x10e)],_0x260cf8[_0x1267cb(0x12d)]);if(_0xd4477c===_0x3e195d)return{'dbId':_0x260cf8['dbId'],'dbName':_0x260cf8['dbName']};const _0x3815f7=parseExplicitDbDirectory(_0xd4477c);if(_0x3815f7!=null)return{'dbId':_0x3815f7,'dbName':await getDbName(_0x12771b,_0x3815f7)[_0x1267cb(0x112)](()=>undefined)};const _0x47bfb7=await listDatabases(_0x12771b),_0x36ffde=_0x47bfb7['filter'](_0x492c50=>buildDbDirectoryName(_0x492c50[_0x1267cb(0x10e)],_0x492c50['dbId'])===_0xd4477c);if(_0x36ffde[_0x1267cb(0x123)]===0x1)return{'dbId':_0x36ffde[0x0]['dbId'],'dbName':_0x36ffde[0x0][_0x1267cb(0x10e)]};if(_0x36ffde['length']===0x0)throw CliErrors[_0x1267cb(0xf3)](_0x1267cb(0x128)+_0xd4477c+_0x1267cb(0x136)+_0x1c4b7d['sqlCode']+'.');const _0x47dc51=_0x36ffde[_0x1267cb(0x121)](_0x5cc6e0=>_0x5cc6e0['dbName']+'\x20('+_0x5cc6e0['dbId']+')')[_0x1267cb(0x11c)](',\x20');throw CliErrors[_0x1267cb(0xf3)](_0x1267cb(0x116)+_0xd4477c+'\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20'+_0x1c4b7d[_0x1267cb(0x132)]+':\x20'+_0x47dc51);}function parseExplicitDbDirectory(_0x38af16){const _0x5ba65c=a191_0x110479,_0x135d36=/^db-(\d+)$/[_0x5ba65c(0x10d)](_0x38af16);if(!_0x135d36)return null;const _0x1a254b=Number(_0x135d36[0x1]);return Number[_0x5ba65c(0x119)](_0x1a254b)&&_0x1a254b>0x0?_0x1a254b:null;}
|
|
1
|
+
const a192_0x501d36=a192_0x1e6b;(function(_0x179296,_0x2ef53e){const _0xb28350=a192_0x1e6b,_0x40640=_0x179296();while(!![]){try{const _0x2394af=parseInt(_0xb28350(0xb3))/0x1*(parseInt(_0xb28350(0xcb))/0x2)+parseInt(_0xb28350(0xa7))/0x3+parseInt(_0xb28350(0xa8))/0x4*(-parseInt(_0xb28350(0xe7))/0x5)+-parseInt(_0xb28350(0xb2))/0x6+parseInt(_0xb28350(0xbf))/0x7*(parseInt(_0xb28350(0xb1))/0x8)+-parseInt(_0xb28350(0xbe))/0x9*(parseInt(_0xb28350(0xd6))/0xa)+parseInt(_0xb28350(0xb6))/0xb;if(_0x2394af===_0x2ef53e)break;else _0x40640['push'](_0x40640['shift']());}catch(_0x331d1e){_0x40640['push'](_0x40640['shift']());}}}(a192_0x50f2,0xaa271));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';function a192_0x1e6b(_0x32cad4,_0x661931){_0x32cad4=_0x32cad4-0xa7;const _0x50f2d3=a192_0x50f2();let _0x1e6b64=_0x50f2d3[_0x32cad4];return _0x1e6b64;}async function getTargetSqlQueries(_0x3e681a,_0x5a3cb8,_0x2fd942){const _0x47e830=a192_0x1e6b,_0x583e27=await scanLocalSqlQueries(_0x3e681a),_0x83fda4=new Map();for(const _0xc5bf30 of _0x583e27){if(_0x2fd942&&_0xc5bf30[_0x47e830(0xb5)]!==_0x2fd942)continue;const _0x2bc4a0=_0x83fda4[_0x47e830(0xb8)](_0xc5bf30[_0x47e830(0xb5)])??[];_0x2bc4a0[_0x47e830(0xc3)](_0xc5bf30),_0x83fda4[_0x47e830(0xdc)](_0xc5bf30[_0x47e830(0xb5)],_0x2bc4a0);}if(_0x2fd942&&!_0x83fda4[_0x47e830(0xc1)](_0x2fd942))throw CliErrors['validation'](_0x47e830(0xc9)+_0x2fd942);const _0x3866e4=[];for(const [_0x567c6a,_0x288b53]of _0x83fda4[_0x47e830(0xcd)]()){if(_0x288b53[_0x47e830(0xe5)]===0x1){_0x3866e4['push'](_0x288b53[0x0]);continue;}const _0x164eeb=_0x5a3cb8['sqls'][_0x567c6a],_0x3b4e5f=_0x164eeb?.['path'],_0x4c9ce7=_0x3b4e5f?_0x288b53['filter'](_0x64aeda=>_0x64aeda[_0x47e830(0xe4)]!==_0x3b4e5f):_0x288b53;if(_0x164eeb&&_0x4c9ce7[_0x47e830(0xe5)]===0x1){_0x3866e4[_0x47e830(0xc3)](_0x4c9ce7[0x0]);continue;}throw CliErrors[_0x47e830(0xc4)]('Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20'+_0x567c6a+_0x47e830(0xdf));}return _0x3866e4;}function a192_0x50f2(){const _0x490d62=['write','sqlcode','\x20pushed,\x20','\x20skipped,\x20','toISOString','10CQcsSp','bool','Local\x20directory\x20\x22','catch','sqlName','sqlRootDir','set','force','str','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','\x20SQL\x20file(s)','dbName','sqlRoot','join','relativePath','length','trashDir','6700535yWzqcL','40389PDBsaC','4LHKtYt','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','Would\x20push\x20','sqls','Push\x20complete:\x20','filePath','/smartapi/custom/updateUserCustomSql','unchanged','utf8','8lfJPbu','2995386WHAoFo','12229SCTUpw','sqlConfig','sqlCode','29949480WSpyEG','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','get','appCode','lockFilePath','remoteId','startsWith','filter','3347559OcFSMA','6195ZsWNqE','sql','has','boolean','push','validation','hash','dbDirectory','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','Push\x20local\x20SQL\x20files\x20to\x20remote','Local\x20SQL\x20not\x20found:\x20','exec','28BuhGgJ','path','entries','map','lastSync','dbId'];a192_0x50f2=function(){return _0x490d62;};return a192_0x50f2();}export const sqlPush={'service':a192_0x501d36(0xc0),'command':a192_0x501d36(0xc3),'description':a192_0x501d36(0xc8),'risk':a192_0x501d36(0xd1),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'force','type':a192_0x501d36(0xc2),'description':'Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock'}],async 'dryRun'(_0x533d18){const _0x1a692d=a192_0x501d36,_0x4aad4a=loadSqlProjectConfig(_0x533d18[_0x1a692d(0xb9)]),_0x4eb888=await readSqlLockFile(_0x4aad4a[_0x1a692d(0xba)]),{appLock:_0xda6e81}=ensureSqlLockScope(_0x4eb888??createEmptySqlLock(),_0x533d18[_0x1a692d(0xb9)],_0x4aad4a[_0x1a692d(0xe2)],_0x1a692d(0xc3)),_0x3680ca=await getTargetSqlQueries(_0x4aad4a,_0xda6e81,_0x533d18[_0x1a692d(0xde)](_0x1a692d(0xd2))||undefined),_0x59c6ac=[];for(const _0x1c8f84 of _0x3680ca){const _0x206598=await computeSqlFileHash(_0x1c8f84[_0x1a692d(0xad)]),_0x46bd0f=_0xda6e81[_0x1a692d(0xab)][_0x1c8f84[_0x1a692d(0xb5)]],_0x479b8a=!!_0x46bd0f&&(_0x46bd0f[_0x1a692d(0xcc)]!==_0x1c8f84[_0x1a692d(0xe4)]||!!_0x1c8f84[_0x1a692d(0xda)]&&_0x46bd0f[_0x1a692d(0xda)]!==_0x1c8f84[_0x1a692d(0xda)]);if(!_0x533d18[_0x1a692d(0xd7)](_0x1a692d(0xdd))&&_0x46bd0f&&_0x46bd0f[_0x1a692d(0xc5)]===_0x206598&&!_0x479b8a)continue;_0x59c6ac[_0x1a692d(0xc3)](_0x1c8f84[_0x1a692d(0xb5)]);}return{'method':'POST','url':_0x1a692d(0xae),'body':{'sqlCodes':_0x59c6ac,'appCode':_0x533d18[_0x1a692d(0xb9)]},'description':_0x1a692d(0xaa)+_0x59c6ac[_0x1a692d(0xe5)]+_0x1a692d(0xe0)};},async 'execute'(_0x44407a){const _0x2e1250=a192_0x501d36,_0x582991=loadSqlProjectConfig(_0x44407a['appCode']),_0x1e28e6=await readSqlLockFile(_0x582991['lockFilePath']),{lockData:_0x37e9a5,appLock:_0x382d44}=ensureSqlLockScope(_0x1e28e6??createEmptySqlLock(),_0x44407a[_0x2e1250(0xb9)],_0x582991[_0x2e1250(0xe2)],_0x2e1250(0xc3)),_0x226331=await getTargetSqlQueries(_0x582991,_0x382d44,_0x44407a[_0x2e1250(0xde)](_0x2e1250(0xd2))||undefined);if(_0x226331['length']===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':'No\x20local\x20SQL\x20files\x20found.'};const _0x40e5d9=[],_0x26ea1b=[],_0x2d53a6=[];for(const _0x435678 of _0x226331){const _0x3dba4b=_0x382d44[_0x2e1250(0xab)][_0x435678[_0x2e1250(0xb5)]];if(!_0x3dba4b){_0x2d53a6[_0x2e1250(0xc3)]({'sqlCode':_0x435678[_0x2e1250(0xb5)],'error':_0x2e1250(0xc7)});continue;}try{const _0x2fc3e9=await computeSqlFileHash(_0x435678[_0x2e1250(0xad)]),_0x4fce33=_0x3dba4b[_0x2e1250(0xcc)]!==_0x435678[_0x2e1250(0xe4)]||!!_0x435678[_0x2e1250(0xda)]&&_0x3dba4b[_0x2e1250(0xda)]!==_0x435678[_0x2e1250(0xda)];if(!_0x44407a[_0x2e1250(0xd7)](_0x2e1250(0xdd))&&_0x3dba4b[_0x2e1250(0xc5)]===_0x2fc3e9&&!_0x4fce33){_0x26ea1b[_0x2e1250(0xc3)]({'sqlCode':_0x435678[_0x2e1250(0xb5)],'reason':_0x2e1250(0xaf)});continue;}if(_0x3dba4b['version']==null){_0x2d53a6[_0x2e1250(0xc3)]({'sqlCode':_0x435678['sqlCode'],'error':_0x2e1250(0xa9)});continue;}const _0x55357d=await readFile(_0x435678[_0x2e1250(0xad)],_0x2e1250(0xb0)),_0x3373c0=stripLocalSqlMetadata(_0x55357d,_0x435678['mode']),_0x58ecfa=_0x435678['sqlName']||_0x3dba4b[_0x2e1250(0xda)],_0x39fc12=await resolveTargetDbBinding(_0x44407a['appCode'],_0x435678,_0x3dba4b),_0x233054=await updateSqlQuery({'id':_0x3dba4b[_0x2e1250(0xbb)],'appCode':_0x44407a[_0x2e1250(0xb9)],'sqlCode':_0x435678[_0x2e1250(0xb5)],'sqlName':_0x58ecfa,'dbId':_0x39fc12[_0x2e1250(0xd0)],'version':_0x3dba4b['version'],'sqlContent':_0x3373c0,'sqlConfig':_0x3dba4b[_0x2e1250(0xb4)]??undefined}),_0x26752a=_0x233054[_0x2e1250(0xd0)]?await getDbName(_0x44407a[_0x2e1250(0xb9)],Number(_0x233054['dbId']))['catch'](()=>_0x39fc12['dbName']):_0x39fc12['dbName'];_0x382d44['sqls'][_0x435678[_0x2e1250(0xb5)]]={...buildSqlLockEntry(_0x233054,_0x3373c0,_0x2fc3e9,{'dbName':_0x26752a}),'path':_0x435678[_0x2e1250(0xe4)],'mode':_0x3dba4b['mode']},await archivePreviousSqlFileIfNeeded(_0x582991,_0x3dba4b['path'],_0x435678['relativePath']),_0x40e5d9[_0x2e1250(0xc3)]({'sqlCode':_0x435678[_0x2e1250(0xb5)],'remoteId':_0x3dba4b[_0x2e1250(0xbb)]});}catch(_0x177b6b){_0x2d53a6[_0x2e1250(0xc3)]({'sqlCode':_0x435678['sqlCode'],'error':_0x177b6b instanceof Error?_0x177b6b['message']:String(_0x177b6b)});}}return _0x382d44[_0x2e1250(0xcf)]=new Date()[_0x2e1250(0xd5)](),await writeSqlLockFile(_0x582991[_0x2e1250(0xba)],_0x37e9a5),{'ok':_0x2d53a6[_0x2e1250(0xe5)]===0x0,'data':{'pushed':_0x40e5d9,'skipped':_0x26ea1b,'failed':_0x2d53a6},'message':_0x2e1250(0xac)+_0x40e5d9['length']+_0x2e1250(0xd3)+_0x26ea1b[_0x2e1250(0xe5)]+_0x2e1250(0xd4)+_0x2d53a6[_0x2e1250(0xe5)]+'\x20failed'};}};async function archivePreviousSqlFileIfNeeded(_0x410866,_0x127bcd,_0x40b137){const _0x48daec=a192_0x501d36;if(!_0x127bcd||_0x127bcd===_0x40b137)return;const _0x29d25c=join(_0x410866[_0x48daec(0xdb)],_0x127bcd);if(!await fileExists(_0x29d25c))return;const _0xccc711=await moveToTrash(_0x410866['projectRoot'],_0x410866[_0x48daec(0xe6)],_0x29d25c);await cleanupEmptyDirectories(dirname(_0x29d25c),_0x410866[_0x48daec(0xdb)]),void _0xccc711;}async function moveToTrash(_0x325356,_0x91ee55,_0x5d8509){const _0x340e19=a192_0x501d36,_0x361431=new Date()[_0x340e19(0xd5)]()['replace'](/[:.]/g,'-'),_0x2ed06e=relative(_0x325356,_0x5d8509),_0x2661d6=join(_0x91ee55,_0x361431,_0x2ed06e);return await mkdir(dirname(_0x2661d6),{'recursive':!![]}),await rename(_0x5d8509,_0x2661d6),_0x2661d6;}async function cleanupEmptyDirectories(_0x514122,_0x33c6b7){const _0x16f139=a192_0x501d36;let _0x114123=resolve(_0x514122);const _0x492b82=resolve(_0x33c6b7);while(_0x114123[_0x16f139(0xbc)](''+_0x492b82+sep)||_0x114123===_0x492b82){if(_0x114123===_0x492b82)return;try{const _0x3af981=await readdir(_0x114123);if(_0x3af981[_0x16f139(0xe5)]>0x0)return;await rmdir(_0x114123);}catch{return;}_0x114123=dirname(_0x114123);}}async function resolveTargetDbBinding(_0x33328a,_0x3055ea,_0x1f79db){const _0x588168=a192_0x501d36,_0x249d8d=_0x3055ea[_0x588168(0xc6)];if(!_0x249d8d)return{'dbId':_0x1f79db['dbId'],'dbName':_0x1f79db[_0x588168(0xe1)]};const _0x626a9d=buildDbDirectoryName(_0x1f79db[_0x588168(0xe1)],_0x1f79db[_0x588168(0xd0)]);if(_0x249d8d===_0x626a9d)return{'dbId':_0x1f79db[_0x588168(0xd0)],'dbName':_0x1f79db[_0x588168(0xe1)]};const _0x3d0fb4=parseExplicitDbDirectory(_0x249d8d);if(_0x3d0fb4!=null)return{'dbId':_0x3d0fb4,'dbName':await getDbName(_0x33328a,_0x3d0fb4)[_0x588168(0xd9)](()=>undefined)};const _0x5104fb=await listDatabases(_0x33328a),_0x1862d2=_0x5104fb[_0x588168(0xbd)](_0xfd2f8a=>buildDbDirectoryName(_0xfd2f8a['dbName'],_0xfd2f8a[_0x588168(0xd0)])===_0x249d8d);if(_0x1862d2[_0x588168(0xe5)]===0x1)return{'dbId':_0x1862d2[0x0][_0x588168(0xd0)],'dbName':_0x1862d2[0x0][_0x588168(0xe1)]};if(_0x1862d2[_0x588168(0xe5)]===0x0)throw CliErrors['validation']('No\x20database\x20matches\x20local\x20directory\x20\x22'+_0x249d8d+'\x22\x20for\x20sqlCode\x20'+_0x3055ea['sqlCode']+'.');const _0x2aae0a=_0x1862d2[_0x588168(0xce)](_0x46e865=>_0x46e865[_0x588168(0xe1)]+'\x20('+_0x46e865[_0x588168(0xd0)]+')')[_0x588168(0xe3)](',\x20');throw CliErrors[_0x588168(0xc4)](_0x588168(0xd8)+_0x249d8d+_0x588168(0xb7)+_0x3055ea[_0x588168(0xb5)]+':\x20'+_0x2aae0a);}function parseExplicitDbDirectory(_0x4f11bb){const _0x101b0e=a192_0x501d36,_0x543d07=/^db-(\d+)$/[_0x101b0e(0xca)](_0x4f11bb);if(!_0x543d07)return null;const _0x3d575b=Number(_0x543d07[0x1]);return Number['isFinite'](_0x3d575b)&&_0x3d575b>0x0?_0x3d575b:null;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x12d0a0,_0x3595c6){const _0x307f84=a193_0x24b6,_0x275789=_0x12d0a0();while(!![]){try{const _0x34c731=-parseInt(_0x307f84(0x194))/0x1+-parseInt(_0x307f84(0x17b))/0x2*(-parseInt(_0x307f84(0x18a))/0x3)+parseInt(_0x307f84(0x198))/0x4+-parseInt(_0x307f84(0x184))/0x5*(parseInt(_0x307f84(0x19b))/0x6)+-parseInt(_0x307f84(0x18f))/0x7+parseInt(_0x307f84(0x19a))/0x8+parseInt(_0x307f84(0x17e))/0x9;if(_0x34c731===_0x3595c6)break;else _0x275789['push'](_0x275789['shift']());}catch(_0x114539){_0x275789['push'](_0x275789['shift']());}}}(a193_0x8e58,0xa3315));import{createInterface}from'node:readline';import{join}from'node:path';import{buildDefaultSqlFileName,buildSqlRelativePath,detectSqlMode}from'../../core/sql-sync/utils.js';export const SQL_LOCAL_REL_DIR='.rabetbase/sql';export function buildSqlLockEntry(_0x375869,_0x1e08eb,_0x4f21b9,_0x53492c){const _0x100449=a193_0x24b6,_0x39ddce=detectSqlMode(_0x1e08eb);return{'path':buildSqlRelativePath(_0x375869[_0x100449(0x18e)],_0x375869['sqlName'],_0x53492c?.['dbName'],_0x39ddce,_0x375869[_0x100449(0x190)]),'hash':_0x4f21b9,'remoteId':_0x375869['id'],'version':_0x375869[_0x100449(0x189)],'dbId':Number(_0x375869[_0x100449(0x190)]),'dbName':_0x53492c?.[_0x100449(0x196)],'sqlName':_0x375869[_0x100449(0x195)],'sqlConfig':_0x375869['sqlConfig']??undefined,'mode':_0x39ddce};}export function cloneSqlLockData(_0x27bce7){const _0x32b77b=a193_0x24b6;return{'apps':Object[_0x32b77b(0x19e)](Object[_0x32b77b(0x17a)](_0x27bce7['apps'])['map'](([_0x2b4bd2,_0x4f3586])=>[_0x2b4bd2,{'sqlRoot':_0x4f3586[_0x32b77b(0x18b)],'lastSync':_0x4f3586['lastSync'],'sqls':{..._0x4f3586['sqls']}}]))};}export function ensureRemoteSqlContent(_0xd127c6){const _0x13451a=a193_0x24b6;return _0xd127c6[_0x13451a(0x186)]??'';}export function buildLocalSqlFileContent(_0x51d679,_0x2b7c3c,_0x45d3dd){const _0x33ac32=a193_0x24b6,_0x2d202a=_0x45d3dd?.[_0x33ac32(0x197)]??detectSqlMode(_0x2b7c3c),_0x11d026=stripLocalSqlMetadata(_0x2b7c3c,_0x2d202a)[_0x33ac32(0x199)](),_0x374b23=[...buildMetadataHeaderLines({'sqlCode':_0x51d679[_0x33ac32(0x18e)],'sqlName':_0x51d679[_0x33ac32(0x195)],'dbId':_0x51d679[_0x33ac32(0x190)],'dbName':_0x45d3dd?.[_0x33ac32(0x196)],'mode':_0x2d202a,'syncedAt':_0x45d3dd?.['syncedAt'],'description':_0x45d3dd?.[_0x33ac32(0x18d)]},_0x2d202a),'',_0x11d026],_0x576f10=_0x374b23['join']('\x0a');return _0x576f10[_0x33ac32(0x188)]('\x0a')?_0x576f10:_0x576f10+'\x0a';}function a193_0x24b6(_0x4777c7,_0x4c8b20){_0x4777c7=_0x4777c7-0x178;const _0x8e5841=a193_0x8e58();let _0x24b6b6=_0x8e5841[_0x4777c7];return _0x24b6b6;}export function stripLocalSqlMetadata(_0x1833e7,_0x59cc1b){const _0x20cc9e=a193_0x24b6,_0x358950=_0x1833e7[_0x20cc9e(0x17f)](/\r\n/g,'\x0a')[_0x20cc9e(0x1a0)]('\x0a'),_0x2fa46f=[];let _0x1c1078=0x0;if(_0x59cc1b===_0x20cc9e(0x187))while(_0x1c1078<_0x358950[_0x20cc9e(0x179)]){const _0x44f74f=_0x358950[_0x1c1078]??'';if(/^\s*<!--\s*@lovrabet\./[_0x20cc9e(0x17d)](_0x44f74f)){_0x1c1078++;continue;}if(_0x44f74f[_0x20cc9e(0x199)]()===''&&_0x1c1078>0x0){_0x1c1078++;continue;}break;}else while(_0x1c1078<_0x358950['length']){const _0x5e0130=_0x358950[_0x1c1078]??'';if(/^\s*--\s*@lovrabet\./['test'](_0x5e0130)){_0x1c1078++;continue;}if(_0x5e0130[_0x20cc9e(0x199)]()===''&&_0x1c1078>0x0){_0x1c1078++;continue;}break;}for(;_0x1c1078<_0x358950[_0x20cc9e(0x179)];_0x1c1078++){_0x2fa46f['push'](_0x358950[_0x1c1078]);}return _0x2fa46f['join']('\x0a')[_0x20cc9e(0x185)]();}export function resolveSqlMode(_0x3c7706,_0x2f1224){const _0x5e1f63=a193_0x24b6;if(_0x2f1224?.[_0x5e1f63(0x197)])return _0x2f1224['mode'];return detectSqlMode(_0x3c7706);}function a193_0x8e58(){const _0x1017b4=['syncedAt','test','11648142UavAAc','replace','path','question','includes','filter','29885yclkoS','trimStart','sqlContent','mybatisXml','endsWith','version','483oXCuTt','sqlRoot','yes','description','sqlCode','2419585iLVgHA','dbId','map','\x20-->','\x20[y/N]\x20','714960lQNdhh','sqlName','dbName','mode','615428FZvsQc','trim','3907224tdtuBE','1086OThHOu','apps','<!--\x20@lovrabet.','fromEntries','stderr','split','--\x20@lovrabet.','stdin','length','entries','10862KRDSat'];a193_0x8e58=function(){return _0x1017b4;};return a193_0x8e58();}export function resolveSqlFileName(_0x59fe0e,_0x4f61b3,_0x8a7c7f){const _0x18d486=a193_0x24b6;if(_0x8a7c7f?.[_0x18d486(0x180)])return _0x8a7c7f[_0x18d486(0x180)];if(_0x8a7c7f?.[_0x18d486(0x195)]||_0x8a7c7f?.['dbName'])return buildSqlRelativePath(_0x59fe0e,_0x8a7c7f?.['sqlName'],_0x8a7c7f?.[_0x18d486(0x196)],resolveSqlMode(_0x4f61b3,_0x8a7c7f),_0x8a7c7f?.['dbId']);return buildDefaultSqlFileName(_0x59fe0e,resolveSqlMode(_0x4f61b3,_0x8a7c7f));}export function resolveSqlLocalDir(_0x49c128,_0x46dd15){return join(_0x49c128,SQL_LOCAL_REL_DIR,_0x46dd15);}export async function confirmForceOverwrite(_0x8a904e){const _0x9c1cfa=a193_0x24b6,_0x274c4e=createInterface({'input':process[_0x9c1cfa(0x178)],'output':process[_0x9c1cfa(0x19f)]}),_0x171872=await new Promise(_0xee182d=>{const _0x34ded1=_0x9c1cfa;_0x274c4e[_0x34ded1(0x181)](_0x8a904e+_0x34ded1(0x193),_0xee182d);});return _0x274c4e['close'](),['y',_0x9c1cfa(0x18c)][_0x9c1cfa(0x182)](_0x171872[_0x9c1cfa(0x199)]()['toLowerCase']());}export function findSqlLockScope(_0x537a7e,_0x24a564){const _0x1b5b4c=a193_0x24b6;return _0x537a7e[_0x1b5b4c(0x19c)][_0x24a564];}function buildMetadataHeaderLines(_0x2d8e9e,_0x5a37b3){const _0x4a8c53=a193_0x24b6,_0x4a564e=[[_0x4a8c53(0x18e),_0x2d8e9e['sqlCode']],[_0x4a8c53(0x195),_0x2d8e9e[_0x4a8c53(0x195)]],[_0x4a8c53(0x190),_0x2d8e9e[_0x4a8c53(0x190)]],[_0x4a8c53(0x196),_0x2d8e9e[_0x4a8c53(0x196)]],[_0x4a8c53(0x197),_0x2d8e9e[_0x4a8c53(0x197)]],['syncedAt',_0x2d8e9e[_0x4a8c53(0x17c)]],['description',_0x2d8e9e[_0x4a8c53(0x18d)]]];if(_0x5a37b3===_0x4a8c53(0x187))return _0x4a564e[_0x4a8c53(0x183)](([,_0x4d0ffa])=>_0x4d0ffa!==undefined&&_0x4d0ffa!==null&&String(_0x4d0ffa)[_0x4a8c53(0x199)]()!=='')[_0x4a8c53(0x191)](([_0x15f00e,_0x110245])=>_0x4a8c53(0x19d)+_0x15f00e+':\x20'+String(_0x110245)+_0x4a8c53(0x192));return _0x4a564e[_0x4a8c53(0x183)](([,_0x24e25b])=>_0x24e25b!==undefined&&_0x24e25b!==null&&String(_0x24e25b)['trim']()!=='')[_0x4a8c53(0x191)](([_0x262c23,_0x4c4d30])=>_0x4a8c53(0x1a1)+_0x262c23+':\x20'+String(_0x4c4d30));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a194_0x206600=a194_0x1c93;(function(_0x56c4e4,_0x45f89d){const _0x59dbe6=a194_0x1c93,_0x455a50=_0x56c4e4();while(!![]){try{const _0x291b1b=parseInt(_0x59dbe6(0x1ee))/0x1+-parseInt(_0x59dbe6(0x1f9))/0x2+-parseInt(_0x59dbe6(0x1f5))/0x3+-parseInt(_0x59dbe6(0x206))/0x4*(parseInt(_0x59dbe6(0x1ef))/0x5)+-parseInt(_0x59dbe6(0x208))/0x6*(-parseInt(_0x59dbe6(0x1f7))/0x7)+-parseInt(_0x59dbe6(0x200))/0x8+parseInt(_0x59dbe6(0x20c))/0x9*(parseInt(_0x59dbe6(0x1f4))/0xa);if(_0x291b1b===_0x45f89d)break;else _0x455a50['push'](_0x455a50['shift']());}catch(_0x4824b7){_0x455a50['push'](_0x455a50['shift']());}}}(a194_0x1176,0xe5434));import{listSqlQueries}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile}from'../../core/sql-sync/lock.js';const PAGE_SIZE=0x64;async function fetchAllSqlCodes(_0x14ea66){const _0x384f08=a194_0x1c93,_0x54e536=[];let _0x48e355=0x1;while(!![]){const _0x593e51=await listSqlQueries(_0x14ea66,{'currentPage':_0x48e355,'pageSize':PAGE_SIZE}),_0x18af83=_0x593e51[_0x384f08(0x1fa)]??[];_0x54e536[_0x384f08(0x203)](..._0x18af83[_0x384f08(0x1f3)](_0x167c4e=>_0x167c4e[_0x384f08(0x20a)]));if(_0x18af83['length']===0x0)break;const _0x5a61ca=_0x593e51['paging']?.['totalCount'];if(_0x5a61ca!=null?_0x54e536[_0x384f08(0x1fe)]>=_0x5a61ca:_0x18af83['length']<PAGE_SIZE)break;_0x48e355++;}return _0x54e536;}function a194_0x1c93(_0x4a1f0a,_0x25741b){_0x4a1f0a=_0x4a1f0a-0x1eb;const _0x11763d=a194_0x1176();let _0x1c93f4=_0x11763d[_0x4a1f0a];return _0x1c93f4;}export const sqlStatus={'service':'sql','command':a194_0x206600(0x1f6),'description':a194_0x206600(0x1ed),'risk':a194_0x206600(0x1f0),'flags':[{'name':a194_0x206600(0x209),'type':'boolean','description':a194_0x206600(0x202)}],async 'execute'(_0x4dc9d0){const _0x11fcbf=a194_0x206600,_0x2250f4=loadSqlProjectConfig(_0x4dc9d0[_0x11fcbf(0x205)]),_0x5419aa=await readSqlLockFile(_0x2250f4['lockFilePath']),{appLock:_0x735364}=ensureSqlLockScope(_0x5419aa??createEmptySqlLock(),_0x2250f4[_0x11fcbf(0x205)],_0x2250f4['sqlRoot'],_0x11fcbf(0x1f6)),_0x890e0=await scanLocalSqlQueries(_0x2250f4),_0x20d449=[],_0x3084ad=[],_0x2adcc0=[],_0x2fa444=[],_0x532b5b=new Set(_0x890e0[_0x11fcbf(0x1f3)](_0x56eb0c=>_0x56eb0c[_0x11fcbf(0x1ec)]));for(const _0x196007 of _0x890e0){const _0xa75ee8=await computeSqlFileHash(_0x196007[_0x11fcbf(0x1f2)]),_0x521673=_0x735364[_0x11fcbf(0x1f1)][_0x196007[_0x11fcbf(0x1ec)]],_0x12ac9a=!!_0x521673&&_0x521673[_0x11fcbf(0x1fc)]!==_0x196007[_0x11fcbf(0x1fb)],_0x290707=!!_0x521673&&!!_0x196007[_0x11fcbf(0x204)]&&_0x521673[_0x11fcbf(0x204)]!==_0x196007[_0x11fcbf(0x204)];if(!_0x521673)_0x20d449[_0x11fcbf(0x203)](_0x196007[_0x11fcbf(0x1ec)]);else _0x521673[_0x11fcbf(0x20b)]!==_0xa75ee8||_0x12ac9a||_0x290707?_0x3084ad['push'](_0x196007[_0x11fcbf(0x1ec)]):_0x2adcc0['push'](_0x196007[_0x11fcbf(0x1ec)]);}for(const _0x250b2e of Object['keys'](_0x735364['sqls'])){!_0x532b5b[_0x11fcbf(0x201)](_0x250b2e)&&_0x2fa444[_0x11fcbf(0x203)](_0x250b2e);}const _0x126596=[];if(_0x4dc9d0['bool']('remote')){const _0x5b1a24=await fetchAllSqlCodes(_0x4dc9d0[_0x11fcbf(0x205)]);for(const _0x425126 of _0x5b1a24){!_0x532b5b[_0x11fcbf(0x201)](_0x425126)&&!_0x735364['sqls'][_0x425126]&&_0x126596['push'](_0x425126);}}const _0x311781=_0x20d449[_0x11fcbf(0x1fe)]===0x0&&_0x3084ad[_0x11fcbf(0x1fe)]===0x0&&_0x2fa444[_0x11fcbf(0x1fe)]===0x0&&_0x126596[_0x11fcbf(0x1fe)]===0x0;return{'ok':!![],'data':{'added':_0x20d449,'modified':_0x3084ad,'missing':_0x2fa444,'unchanged':_0x2adcc0,'remoteOnly':_0x126596},'message':_0x311781?_0x11fcbf(0x1eb):_0x20d449[_0x11fcbf(0x1fe)]+_0x11fcbf(0x1ff)+_0x3084ad['length']+_0x11fcbf(0x1f8)+_0x2fa444[_0x11fcbf(0x1fe)]+_0x11fcbf(0x207)+_0x2adcc0[_0x11fcbf(0x1fe)]+'\x20unchanged'+(_0x126596[_0x11fcbf(0x1fe)]>0x0?',\x20'+_0x126596[_0x11fcbf(0x1fe)]+_0x11fcbf(0x1fd):'')};}};function a194_0x1176(){const _0x53f734=['6930162cVsMzH','All\x20SQL\x20queries\x20are\x20in\x20sync.','lockKey','Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','320121qhXdkP','885640VjJYWl','read','sqls','filePath','map','40dhXkzs','1299594CLTRFy','status','1778CZyrLi','\x20modified,\x20','749372fLNdRc','tableData','relativePath','path','\x20remote-only','length','\x20added,\x20','5886744XqmNJP','has','Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally','push','sqlName','appCode','32VIchXO','\x20missing,\x20','11802SOKGPS','remote','sqlCode','hash'];a194_0x1176=function(){return _0x53f734;};return a194_0x1176();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a195_0x1104b3=a195_0x27ff;(function(_0x2ad367,_0x4d87a0){const _0x487326=a195_0x27ff,_0x12312f=_0x2ad367();while(!![]){try{const _0x4a0dcb=-parseInt(_0x487326(0x1f2))/0x1+-parseInt(_0x487326(0x202))/0x2*(-parseInt(_0x487326(0x1ff))/0x3)+parseInt(_0x487326(0x1d8))/0x4+-parseInt(_0x487326(0x1e7))/0x5*(-parseInt(_0x487326(0x20a))/0x6)+parseInt(_0x487326(0x200))/0x7*(parseInt(_0x487326(0x207))/0x8)+parseInt(_0x487326(0x20d))/0x9+-parseInt(_0x487326(0x1f8))/0xa;if(_0x4a0dcb===_0x4d87a0)break;else _0x12312f['push'](_0x12312f['shift']());}catch(_0x3ae2f1){_0x12312f['push'](_0x12312f['shift']());}}}(a195_0x1a21,0xb54a7));import{readFileSync,existsSync}from'node:fs';import{resolve}from'node:path';import{validateSql}from'../../core/sql-validator.js';import{auditSqlJoinIndexes}from'../../core/sql-index-auditor.js';import{getDatasetDetail,listDatasets}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';function a195_0x27ff(_0x5b9510,_0x533df7){_0x5b9510=_0x5b9510-0x1d4;const _0x1a2115=a195_0x1a21();let _0x27ff65=_0x1a2115[_0x5b9510];return _0x27ff65;}import{assertDatasetIsDbTableBacked,filterDbTableBackedDatasets}from'../../commands/dataset/capability.js';export const sqlValidate={'service':a195_0x1104b3(0x1e6),'command':'validate','description':'Validate\x20SQL\x20content\x20without\x20saving\x20(type\x20detection,\x20parameter\x20extraction,\x20optional\x20schema\x20check)','risk':a195_0x1104b3(0x1dc),'flags':[{'name':'file','type':'string','description':'Path\x20to\x20the\x20SQL\x20file\x20to\x20validate'},{'name':a195_0x1104b3(0x1e6),'type':'string','description':a195_0x1104b3(0x1e3)},{'name':a195_0x1104b3(0x1ec),'type':a195_0x1104b3(0x1fe),'description':'Comma-separated\x20dataset\x20codes\x20to\x20cross-check\x20table/column\x20names\x20against'},{'name':a195_0x1104b3(0x210),'type':a195_0x1104b3(0x1d6),'description':a195_0x1104b3(0x1d4)}],async 'execute'(_0x5215af){const _0x2260d4=a195_0x1104b3,_0x5884f4=_0x5215af[_0x2260d4(0x1fc)](_0x2260d4(0x1e4)),_0x12bd46=_0x5215af[_0x2260d4(0x1fc)](_0x2260d4(0x1e6)),_0x581f38=_0x5215af['str']('schemas'),_0x470a5f=_0x5215af['bool']('check-indexes');if(!_0x5884f4&&!_0x12bd46)throw CliErrors[_0x2260d4(0x1fb)]('file','Provide\x20--file\x20or\x20--sql');if(_0x470a5f&&!_0x581f38)throw CliErrors[_0x2260d4(0x1e1)](_0x2260d4(0x1fd));let _0x4ee9e0;if(_0x5884f4){const _0x417e97=resolve(process['cwd'](),_0x5884f4);if(!existsSync(_0x417e97))throw CliErrors[_0x2260d4(0x1e1)](_0x2260d4(0x1ee)+_0x417e97);_0x4ee9e0=readFileSync(_0x417e97,_0x2260d4(0x1ed));}else _0x4ee9e0=_0x12bd46;const _0xdd96e2=validateSql(_0x4ee9e0),_0x208395={'valid':_0xdd96e2['valid'],'sqlType':_0xdd96e2[_0x2260d4(0x1e5)]['type'],'isSelectOnly':_0xdd96e2[_0x2260d4(0x1e5)][_0x2260d4(0x1d9)],'isDangerous':_0xdd96e2[_0x2260d4(0x1e5)][_0x2260d4(0x203)],'tables':_0xdd96e2[_0x2260d4(0x1f3)],'parameters':_0xdd96e2[_0x2260d4(0x1f9)],'message':_0xdd96e2[_0x2260d4(0x201)]};_0xdd96e2[_0x2260d4(0x1e5)][_0x2260d4(0x1d5)]&&(_0x208395['reason']=_0xdd96e2[_0x2260d4(0x1e5)]['reason']);if(_0x581f38&&_0xdd96e2[_0x2260d4(0x1da)]){const _0x248b7f=_0x581f38[_0x2260d4(0x1f6)](',')[_0x2260d4(0x208)](_0x45de09=>_0x45de09[_0x2260d4(0x1e9)]())[_0x2260d4(0x209)](Boolean),_0x3b3143=[],_0x3cf81e=[],_0x3ab28e=filterDbTableBackedDatasets(await listDatasets(_0x5215af[_0x2260d4(0x1e2)])),_0x28f0e6=new Map(_0x3ab28e[_0x2260d4(0x208)](_0x1cad53=>[_0x1cad53[_0x2260d4(0x1de)]?.[_0x2260d4(0x1f1)]?.['toLowerCase'](),_0x1cad53]));for(const _0x4ba061 of _0xdd96e2['tables']){const _0x79779a=_0x28f0e6['get'](_0x4ba061[_0x2260d4(0x1f7)]());!_0x79779a&&_0x3b3143[_0x2260d4(0x1df)](_0x2260d4(0x1fa)+_0x4ba061+'\x22\x20not\x20found\x20in\x20any\x20dataset');}for(const _0x494fa3 of _0x248b7f){let _0x348804;try{_0x348804=await getDatasetDetail(_0x494fa3);}catch{_0x3b3143['push'](_0x2260d4(0x20e)+_0x494fa3+_0x2260d4(0x1dd));continue;}assertDatasetIsDbTableBacked(_0x348804,'SQL\x20schema\x20validation');const _0x1fd26a=Array[_0x2260d4(0x20b)](_0x348804[_0x2260d4(0x1f5)])?_0x348804[_0x2260d4(0x1f5)]:[],_0x4682a5=new Set(_0x1fd26a['map'](_0x17e36e=>_0x17e36e['name']?.[_0x2260d4(0x1f7)]())),_0x2e92f7=_0x348804[_0x2260d4(0x1de)]?.[_0x2260d4(0x1f1)]||_0x348804[_0x2260d4(0x1f1)]||_0x494fa3;_0x208395[_0x2260d4(0x205)+_0x2e92f7]={'code':_0x494fa3,'tableName':_0x2e92f7,'fieldCount':_0x4682a5[_0x2260d4(0x1f4)],'fields':Array[_0x2260d4(0x20c)](_0x4682a5)};if(_0x470a5f){const _0x5358cb=normalizeDatasetIndexes(_0x348804);_0x3cf81e['push']({'tableName':_0x2e92f7,..._0x5358cb});}}_0x3b3143['length']>0x0&&(_0x208395['schemaWarnings']=_0x3b3143),_0x470a5f&&(_0x208395[_0x2260d4(0x206)]=auditSqlJoinIndexes(_0x4ee9e0,_0x3cf81e));}return{'ok':_0xdd96e2[_0x2260d4(0x1da)],'data':_0x208395,'message':_0xdd96e2[_0x2260d4(0x201)]};}};function a195_0x1a21(){const _0x2acf3e=['reason','boolean','index_columns','144780oGAUJs','isSelectOnly','valid','indexes','read','\x22\x20not\x20found\x20or\x20not\x20accessible','dbtableConfig','push','columnNames','validation','appCode','Inline\x20SQL\x20content\x20to\x20validate\x20(alternative\x20to\x20--file)','file','sqlType','sql','5OCnZWL','index_name','trim','flatMap','columns','schemas','utf-8','File\x20not\x20found:\x20','find','length','tableName','470813cQPBtb','tables','size','fields','split','toLowerCase','14147370SfTGak','parameters','Table\x20\x22','flagMissing','str','--check-indexes\x20requires\x20--schemas.','string','440328DyHAnh','119leJgTP','message','12LlwrAg','isDangerous','pkField','schema:','joinAudit','677296rOlrLF','map','filter','227778kqomds','isArray','from','2106441soKQcL','Dataset\x20\x22','index_type','check-indexes','name','Audit\x20top-level\x20JOIN\x20equality\x20predicates\x20against\x20dataset\x20index\x20metadata'];a195_0x1a21=function(){return _0x2acf3e;};return a195_0x1a21();}function normalizeDatasetIndexes(_0x39c850){const _0x15024d=a195_0x1104b3,_0x554262=Array[_0x15024d(0x20b)](_0x39c850?.['dataset']?.[_0x15024d(0x1db)])?_0x39c850['dataset'][_0x15024d(0x1db)]:Array['isArray'](_0x39c850?.[_0x15024d(0x1db)])?_0x39c850['indexes']:[],_0x21b0f6=_0x554262[_0x15024d(0x1ea)](_0x552c0e=>{const _0x5338eb=_0x15024d,_0x586013=Array[_0x5338eb(0x20b)](_0x552c0e?.[_0x5338eb(0x1d7)])?_0x552c0e[_0x5338eb(0x1d7)]:Array[_0x5338eb(0x20b)](_0x552c0e?.[_0x5338eb(0x1e0)])?_0x552c0e[_0x5338eb(0x1e0)]:Array[_0x5338eb(0x20b)](_0x552c0e?.['columns'])?_0x552c0e[_0x5338eb(0x1eb)]:[],_0x3c77aa=_0x586013[_0x5338eb(0x209)](_0x5f57d8=>typeof _0x5f57d8==='string')[_0x5338eb(0x208)](_0x59f208=>_0x59f208[_0x5338eb(0x1e9)]())['filter'](Boolean);if(_0x3c77aa['length']===0x0)return[];const _0x13be84=[_0x552c0e?.['indexName'],_0x552c0e?.[_0x5338eb(0x1e8)],_0x552c0e?.[_0x5338eb(0x211)]][_0x5338eb(0x1ef)](_0x1e0bb6=>typeof _0x1e0bb6==='string'&&_0x1e0bb6[_0x5338eb(0x1e9)]()),_0x524dce=[_0x552c0e?.[_0x5338eb(0x20f)],_0x552c0e?.['type']][_0x5338eb(0x1ef)](_0xff5b7=>typeof _0xff5b7===_0x5338eb(0x1fe)&&_0xff5b7[_0x5338eb(0x1e9)]());return[{..._0x13be84?{'name':_0x13be84[_0x5338eb(0x1e9)]()}:{},..._0x524dce?{'type':_0x524dce[_0x5338eb(0x1e9)]()}:{},'columns':_0x3c77aa}];}),_0x469fe5=[..._0x21b0f6],_0x52496e=typeof _0x39c850?.[_0x15024d(0x1de)]?.['pkField']===_0x15024d(0x1fe)?_0x39c850[_0x15024d(0x1de)][_0x15024d(0x204)][_0x15024d(0x1f6)](',')[_0x15024d(0x208)](_0x4883af=>_0x4883af[_0x15024d(0x1e9)]())[_0x15024d(0x209)](Boolean):[];return _0x52496e[_0x15024d(0x1f0)]>0x0&&_0x469fe5['unshift']({'type':'primary','columns':_0x52496e}),{'indexes':_0x469fe5,'metadataAvailable':_0x21b0f6[_0x15024d(0x1f0)]>0x0};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a196_0x240d(){const _0x5d6cfb=['85571DtOBUe','66ospGny','5wFkoDr','674920wZwMLN','655644QXbIjy','9xADXpk','558015XKThhw','6jLuJfK','128466nmGkDQ','1081048GaubDL','1349950Nwfsyp'];a196_0x240d=function(){return _0x5d6cfb;};return a196_0x240d();}(function(_0x35e7af,_0x1183fa){const _0x1a4116=a196_0x1931,_0x12981a=_0x35e7af();while(!![]){try{const _0x370b74=parseInt(_0x1a4116(0xe5))/0x1*(parseInt(_0x1a4116(0xe1))/0x2)+-parseInt(_0x1a4116(0xe0))/0x3+-parseInt(_0x1a4116(0xe9))/0x4*(-parseInt(_0x1a4116(0xe7))/0x5)+-parseInt(_0x1a4116(0xe2))/0x6+parseInt(_0x1a4116(0xe4))/0x7+-parseInt(_0x1a4116(0xe3))/0x8*(-parseInt(_0x1a4116(0xdf))/0x9)+-parseInt(_0x1a4116(0xe8))/0xa*(parseInt(_0x1a4116(0xe6))/0xb);if(_0x370b74===_0x1183fa)break;else _0x12981a['push'](_0x12981a['shift']());}catch(_0xc2231b){_0x12981a['push'](_0x12981a['shift']());}}}(a196_0x240d,0x2142d));function a196_0x1931(_0x74e111,_0xfb385b){_0x74e111=_0x74e111-0xdf;const _0x240d52=a196_0x240d();let _0x193150=_0x240d52[_0x74e111];return _0x193150;}import{taskStatus}from'../../commands/task/status.js';export const taskDefinitions=[taskStatus];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a197_0x32434d=a197_0xc85b;function a197_0x33ba(){const _0x2d385c=['10GduFDt','status','flagMissing','read','cookie','isTerminal','task','919110OeEWMu','2395515fSzKyL','5176432CmChWs',',\x20received\x20','apiError','Query\x20an\x20asynchronous\x20task;\x20repeat\x20for\x20PENDING\x20or\x20PROCESSING\x20until\x20SUCCESS\x20or\x20FAILED','9164WVuNVe','1574986zJZjSb','trim','802408TsRuAl','str','2817450YvDdzE','appCode','taskId','task-id','167AsmMwN','string'];a197_0x33ba=function(){return _0x2d385c;};return a197_0x33ba();}(function(_0x48ec1b,_0x282fe4){const _0x6e312=a197_0xc85b,_0xa40f8f=_0x48ec1b();while(!![]){try{const _0xd28194=parseInt(_0x6e312(0x84))/0x1*(-parseInt(_0x6e312(0x7b))/0x2)+-parseInt(_0x6e312(0x76))/0x3+parseInt(_0x6e312(0x77))/0x4+-parseInt(_0x6e312(0x86))/0x5*(-parseInt(_0x6e312(0x75))/0x6)+parseInt(_0x6e312(0x7c))/0x7+parseInt(_0x6e312(0x7e))/0x8+parseInt(_0x6e312(0x80))/0x9;if(_0xd28194===_0x282fe4)break;else _0xa40f8f['push'](_0xa40f8f['shift']());}catch(_0x39db77){_0xa40f8f['push'](_0xa40f8f['shift']());}}}(a197_0x33ba,0xa4d38));function a197_0xc85b(_0x5b6c9b,_0x1c8f6d){_0x5b6c9b=_0x5b6c9b-0x72;const _0x33bac6=a197_0x33ba();let _0xc85b1f=_0x33bac6[_0x5b6c9b];return _0xc85b1f;}import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asyncTaskMessage,buildAsyncTaskStatusCommand,normalizeAsyncTask}from'../../commands/common/async-task.js';import{getAsyncTaskStatus}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';export const taskStatus={'service':a197_0x32434d(0x74),'command':a197_0x32434d(0x87),'description':a197_0x32434d(0x7a),'risk':a197_0x32434d(0x89),'defaultOutputFormat':'compress','structuredErrors':!![],'flags':[{'name':a197_0x32434d(0x83),'type':a197_0x32434d(0x85),'required':!![],'description':'Task\x20id\x20returned\x20by\x20an\x20asynchronous\x20platform\x20command'},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x5115f3){const _0x55d6b0=a197_0x32434d;if(!_0x5115f3[_0x55d6b0(0x7f)](_0x55d6b0(0x83))['trim']())throw CliErrors[_0x55d6b0(0x88)]('task-id');},async 'execute'(_0x125f5b){const _0x10c37f=a197_0x32434d,_0xa43058=_0x125f5b['str']('task-id')[_0x10c37f(0x7d)](),_0x104613=normalizeAsyncTask(await getAsyncTaskStatus(_0xa43058,_0x125f5b[_0x10c37f(0x81)],_0x125f5b[_0x10c37f(0x72)]));if(_0x104613[_0x10c37f(0x82)]!==_0xa43058)throw CliErrors[_0x10c37f(0x79)]('Task\x20status\x20response\x20id\x20mismatch:\x20requested\x20'+_0xa43058+_0x10c37f(0x78)+_0x104613[_0x10c37f(0x82)]+'.');const _0x2a76c0=buildAsyncTaskStatusCommand(_0x104613[_0x10c37f(0x82)],_0x125f5b[_0x10c37f(0x81)]);return{'ok':!![],'message':asyncTaskMessage(_0x104613),'data':{'appCode':_0x125f5b[_0x10c37f(0x81)],..._0x104613,'query':_0x104613[_0x10c37f(0x73)]?null:{'command':_0x2a76c0}}};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x349682,_0x200c37){const _0x232d71=a198_0x29f4,_0x21de9d=_0x349682();while(!![]){try{const _0x6a2f4=-parseInt(_0x232d71(0xfb))/0x1*(-parseInt(_0x232d71(0x100))/0x2)+-parseInt(_0x232d71(0xff))/0x3*(parseInt(_0x232d71(0x101))/0x4)+parseInt(_0x232d71(0x102))/0x5*(parseInt(_0x232d71(0xfc))/0x6)+-parseInt(_0x232d71(0xfd))/0x7+-parseInt(_0x232d71(0xfa))/0x8+parseInt(_0x232d71(0xfe))/0x9+parseInt(_0x232d71(0xf9))/0xa;if(_0x6a2f4===_0x200c37)break;else _0x21de9d['push'](_0x21de9d['shift']());}catch(_0x1bd650){_0x21de9d['push'](_0x21de9d['shift']());}}}(a198_0x36bd,0xd7340));function a198_0x29f4(_0x3d3ab9,_0x2c01aa){_0x3d3ab9=_0x3d3ab9-0xf9;const _0x36bd47=a198_0x36bd();let _0x29f426=_0x36bd47[_0x3d3ab9];return _0x29f426;}function a198_0x36bd(){const _0x537f92=['9037210lSIJpD','12042126NPOQDp','573zuJnsb','2HXRLgZ','36276HgTHTi','40KHXohr','2800140IwiiVl','2066944jpAdPY','877997cEpBnw','1250268TiWNVE'];a198_0x36bd=function(){return _0x537f92;};return a198_0x36bd();}import{tenantMembersListDefinition}from'../../commands/tenant/members-list.js';export const tenantDefinitions=[tenantMembersListDefinition];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a199_0x2a3f(_0x5bf81f,_0x4b5035){_0x5bf81f=_0x5bf81f-0x10c;const _0x3fc375=a199_0x3fc3();let _0x2a3f16=_0x3fc375[_0x5bf81f];return _0x2a3f16;}const a199_0x483a7c=a199_0x2a3f;(function(_0x5981a7,_0x45860f){const _0x5a42a9=a199_0x2a3f,_0x127d85=_0x5981a7();while(!![]){try{const _0x567bd7=parseInt(_0x5a42a9(0x110))/0x1+-parseInt(_0x5a42a9(0x10f))/0x2+-parseInt(_0x5a42a9(0x115))/0x3*(parseInt(_0x5a42a9(0x11f))/0x4)+-parseInt(_0x5a42a9(0x117))/0x5*(-parseInt(_0x5a42a9(0x10e))/0x6)+-parseInt(_0x5a42a9(0x11e))/0x7+parseInt(_0x5a42a9(0x113))/0x8+parseInt(_0x5a42a9(0x120))/0x9;if(_0x567bd7===_0x45860f)break;else _0x127d85['push'](_0x127d85['shift']());}catch(_0x466d5d){_0x127d85['push'](_0x127d85['shift']());}}}(a199_0x3fc3,0xeb4d3));function a199_0x3fc3(){const _0x4fa599=['tenant-code','Pass\x20--tenant-code\x20<code>.','10594409rjPdpM','8KDlYWE','1816767eFrDtU','Found\x20','read','trim','string','9454548CVGRDo','1513460BDDqws','116498ZhNRDI','flagMissing','List\x20members\x20of\x20a\x20tenant\x20available\x20to\x20the\x20current\x20account','14653720FYytMX','members-list','737733FhSzIC','\x20tenant\x20member(s)','5BuRUxG','length','Exact\x20tenant\x20code','tenant','str'];a199_0x3fc3=function(){return _0x4fa599;};return a199_0x3fc3();}import{listCurrentUserTenantMemberships,listTenantDirectoryMembers}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{assertTenantAccessible,projectTenantMembers}from'../../commands/tenant/shared.js';export const tenantMembersListDefinition={'service':a199_0x483a7c(0x11a),'command':a199_0x483a7c(0x114),'description':a199_0x483a7c(0x112),'risk':a199_0x483a7c(0x122),'requiresAuth':!![],'requiresAppCode':![],'structuredErrors':!![],'flags':[{'name':a199_0x483a7c(0x11c),'type':a199_0x483a7c(0x10d),'required':!![],'description':a199_0x483a7c(0x119)}],async 'validate'(_0x28a374){const _0xc4ff87=a199_0x483a7c;if(!_0x28a374[_0xc4ff87(0x11b)](_0xc4ff87(0x11c))[_0xc4ff87(0x10c)]())throw CliErrors[_0xc4ff87(0x111)](_0xc4ff87(0x11c),_0xc4ff87(0x11d));},async 'execute'(_0x4999de){const _0x434c09=a199_0x483a7c,_0x266e36=_0x4999de['str'](_0x434c09(0x11c))[_0x434c09(0x10c)](),_0x57e106=await listCurrentUserTenantMemberships();assertTenantAccessible(_0x266e36,_0x57e106);const _0xb247b0=projectTenantMembers(await listTenantDirectoryMembers(_0x266e36));return{'ok':!![],'data':{'tenantCode':_0x266e36,'items':_0xb247b0,'totalCount':_0xb247b0[_0x434c09(0x118)]},'message':_0x434c09(0x121)+_0xb247b0['length']+_0x434c09(0x116)};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a200_0x454b(){const _0x525939=['2224485mSQwCZ','values','6370bfJjyE','Check\x20--tenant-code\x20or\x20login\x20with\x20an\x20account\x20that\x20belongs\x20to\x20this\x20tenant.','285485BeHQyY','userId','10ppqbCO','tenantCode','role','Tenant\x20\x22','350WOleqE','set','237699vsUZXX','1104272CdXpYt','get','25518jSmuun','nickname','ADMIN','status','sort','676ZyFrAy','validation','username','362uwoDif','trim','8538fzDwRE'];a200_0x454b=function(){return _0x525939;};return a200_0x454b();}(function(_0x321d8f,_0x29dd1e){const _0x2432ed=a200_0x4bea,_0x3bff35=_0x321d8f();while(!![]){try{const _0x13d88c=parseInt(_0x2432ed(0x189))/0x1+-parseInt(_0x2432ed(0x182))/0x2*(-parseInt(_0x2432ed(0x184))/0x3)+-parseInt(_0x2432ed(0x17f))/0x4*(parseInt(_0x2432ed(0x187))/0x5)+-parseInt(_0x2432ed(0x17a))/0x6*(parseInt(_0x2432ed(0x18f))/0x7)+parseInt(_0x2432ed(0x178))/0x8+-parseInt(_0x2432ed(0x185))/0x9+parseInt(_0x2432ed(0x18b))/0xa*(parseInt(_0x2432ed(0x191))/0xb);if(_0x13d88c===_0x29dd1e)break;else _0x3bff35['push'](_0x3bff35['shift']());}catch(_0x18729d){_0x3bff35['push'](_0x3bff35['shift']());}}}(a200_0x454b,0x459cd));import{CliErrors}from'../../errors.js';function textOrNull(_0xb3ca93){const _0x375b01=a200_0x4bea,_0x152656=_0xb3ca93?.[_0x375b01(0x183)]();return _0x152656?_0x152656:null;}function a200_0x4bea(_0x39bf38,_0x55c09b){_0x39bf38=_0x39bf38-0x178;const _0x454bbd=a200_0x454b();let _0x4bea0e=_0x454bbd[_0x39bf38];return _0x4bea0e;}export function projectTenantMembers(_0x5cda99){const _0x18367d=a200_0x4bea,_0x403834=new Map();for(const _0x4a8cb0 of _0x5cda99){const _0x4952e2=Number(_0x4a8cb0[_0x18367d(0x18a)]);if(!Number['isFinite'](_0x4952e2)||_0x4952e2<=0x0)continue;const _0x37aff9={'userId':_0x4952e2,'username':textOrNull(_0x4a8cb0[_0x18367d(0x181)]),'displayName':textOrNull(_0x4a8cb0[_0x18367d(0x17b)]),'role':_0x4a8cb0['adminFlag']===!![]?_0x18367d(0x17c):'MEMBER','status':textOrNull(_0x4a8cb0[_0x18367d(0x17d)])},_0x3d7edb=_0x403834[_0x18367d(0x179)](_0x4952e2);if(!_0x3d7edb){_0x403834[_0x18367d(0x190)](_0x4952e2,_0x37aff9);continue;}_0x3d7edb[_0x18367d(0x181)]??=_0x37aff9[_0x18367d(0x181)],_0x3d7edb['displayName']??=_0x37aff9['displayName'],_0x3d7edb[_0x18367d(0x17d)]??=_0x37aff9[_0x18367d(0x17d)];if(_0x37aff9[_0x18367d(0x18d)]==='ADMIN')_0x3d7edb[_0x18367d(0x18d)]='ADMIN';}return[..._0x403834[_0x18367d(0x186)]()][_0x18367d(0x17e)]((_0x237cd5,_0x6aa167)=>_0x237cd5[_0x18367d(0x18a)]-_0x6aa167[_0x18367d(0x18a)]);}export function assertTenantAccessible(_0x5c08df,_0x4c26b3){const _0x4929e5=a200_0x4bea;if(_0x4c26b3['some'](_0x2b84a6=>_0x2b84a6[_0x4929e5(0x18c)]===_0x5c08df))return;throw CliErrors[_0x4929e5(0x180)](_0x4929e5(0x18e)+_0x5c08df+'\x22\x20is\x20not\x20available\x20to\x20the\x20current\x20account.',_0x4929e5(0x188));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a201_0x5bf2c7=a201_0x237e;(function(_0x2e2304,_0x3999c5){const _0x217fbc=a201_0x237e,_0x549163=_0x2e2304();while(!![]){try{const _0x2c231e=-parseInt(_0x217fbc(0xcc))/0x1*(-parseInt(_0x217fbc(0xd6))/0x2)+-parseInt(_0x217fbc(0xd7))/0x3*(parseInt(_0x217fbc(0xdb))/0x4)+-parseInt(_0x217fbc(0xe7))/0x5+-parseInt(_0x217fbc(0xdd))/0x6*(parseInt(_0x217fbc(0xe0))/0x7)+-parseInt(_0x217fbc(0xdc))/0x8*(parseInt(_0x217fbc(0xe6))/0x9)+parseInt(_0x217fbc(0xda))/0xa*(-parseInt(_0x217fbc(0xce))/0xb)+-parseInt(_0x217fbc(0xe3))/0xc*(-parseInt(_0x217fbc(0xe5))/0xd);if(_0x2c231e===_0x3999c5)break;else _0x549163['push'](_0x549163['shift']());}catch(_0x83dd66){_0x549163['push'](_0x549163['shift']());}}}(a201_0x5e3e,0x410c7));import{asDryRunResult}from'../../commands/common/dry-run.js';import{bindDingTalkSandboxAccount,DING_TALK_SANDBOX_BIND_PATH}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';const PROVIDER_ID='dingding-sandbox',CURRENT_BINDING_WARNING='The\x20current\x20binding\x20is\x20not\x20exposed\x20by\x20the\x20server;\x20before\x20is\x20unavailable.';function a201_0x5e3e(){const _0x1423bf=['write','Bound\x20current\x20user\x20to\x20DingTalk\x20sandbox\x20account.','user-account','bind','trim','298ISxuXA','26103FlTqok','POST','dingding-sandbox-bind','10FoEtLM','44nasiyx','568ZmucRQ','982242vZoDXG','validation','DingTalk\x20sandbox\x20account\x20binding\x20was\x20not\x20confirmed.','7AFJUTn','Pass\x20the\x20DingTalk\x20user\x20id\x20returned\x20by\x20the\x20sandbox.','str','1644vTxGQJ','DingTalk\x20user\x20id\x20returned\x20by\x20the\x20sandbox','108797CmBApx','58095iZJTRE','771925dSZXAT','string','3203hArCdR','Retry\x20with\x20the\x20same\x20--ding-talk-user-id\x20only\x20after\x20checking\x20the\x20current\x20platform\x20session.','5337783xWXqKQ','apiError','ding-talk-user-id'];a201_0x5e3e=function(){return _0x1423bf;};return a201_0x5e3e();}function a201_0x237e(_0x17d237,_0x3882cf){_0x17d237=_0x17d237-0xcc;const _0x5e3e7b=a201_0x5e3e();let _0x237eee=_0x5e3e7b[_0x17d237];return _0x237eee;}function readDingTalkUserId(_0xaa988f){const _0x192e90=a201_0x237e,_0x2ddba6=_0xaa988f[_0x192e90(0xe2)](_0x192e90(0xd0))[_0x192e90(0xd5)]();if(!_0x2ddba6)throw CliErrors[_0x192e90(0xde)]('--ding-talk-user-id\x20cannot\x20be\x20empty.',_0x192e90(0xe1));return _0x2ddba6;}function buildBindingData(_0x4de40d,_0x5810b3){const _0x3fd42c=a201_0x237e;return{'operation':_0x3fd42c(0xd4),'selector':{'providerId':PROVIDER_ID,'dingTalkUserId':_0x4de40d},'before':null,'after':{'providerId':PROVIDER_ID,'dingTalkUserId':_0x4de40d,'bound':!![]},'dryRun':_0x5810b3,'backend':{'method':_0x3fd42c(0xd8),'path':DING_TALK_SANDBOX_BIND_PATH},'warnings':[CURRENT_BINDING_WARNING]};}export const dingTalkSandboxBind={'service':a201_0x5bf2c7(0xd3),'command':a201_0x5bf2c7(0xd9),'description':'Bind\x20the\x20current\x20platform\x20user\x20to\x20a\x20DingTalk\x20sandbox\x20account','risk':a201_0x5bf2c7(0xd1),'requiresAuth':!![],'requiresAppCode':![],'structuredErrors':!![],'flags':[{'name':'ding-talk-user-id','type':a201_0x5bf2c7(0xe8),'required':!![],'description':a201_0x5bf2c7(0xe4)}],async 'validate'(_0x2fdded){readDingTalkUserId(_0x2fdded);},async 'dryRun'(_0x2e81c1){const _0x40b603=a201_0x5bf2c7,_0x3690a9=readDingTalkUserId(_0x2e81c1);return asDryRunResult(buildBindingData(_0x3690a9,!![]),{'method':_0x40b603(0xd8),'url':DING_TALK_SANDBOX_BIND_PATH});},async 'execute'(_0x50e0e3){const _0xa43dbe=a201_0x5bf2c7,_0x2609be=readDingTalkUserId(_0x50e0e3),_0x4f05d9=await bindDingTalkSandboxAccount(_0x2609be);if(_0x4f05d9!==!![])throw CliErrors[_0xa43dbe(0xcf)](_0xa43dbe(0xdf),_0xa43dbe(0xcd));return{'ok':!![],'data':buildBindingData(_0x2609be,![]),'message':_0xa43dbe(0xd2)};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x583b58,_0x3bcfda){const _0xdfc1e2=a202_0x13a7,_0x158dab=_0x583b58();while(!![]){try{const _0x160c67=parseInt(_0xdfc1e2(0x146))/0x1+-parseInt(_0xdfc1e2(0x13d))/0x2+-parseInt(_0xdfc1e2(0x140))/0x3+-parseInt(_0xdfc1e2(0x147))/0x4*(-parseInt(_0xdfc1e2(0x142))/0x5)+-parseInt(_0xdfc1e2(0x143))/0x6*(parseInt(_0xdfc1e2(0x145))/0x7)+parseInt(_0xdfc1e2(0x141))/0x8*(-parseInt(_0xdfc1e2(0x144))/0x9)+parseInt(_0xdfc1e2(0x13f))/0xa*(-parseInt(_0xdfc1e2(0x13e))/0xb);if(_0x160c67===_0x3bcfda)break;else _0x158dab['push'](_0x158dab['shift']());}catch(_0x12e17a){_0x158dab['push'](_0x158dab['shift']());}}}(a202_0x2be6,0xd8c1f));import{dingTalkSandboxBind}from'../../commands/user-account/dingding-sandbox-bind.js';function a202_0x2be6(){const _0x5db023=['576443EbOOJW','1738442ERfrwc','2285636TISRPU','2282616VBsNUb','1133gIkBUX','14350dzifHd','1001445JLtsws','16zPUPKF','10RGdOjF','18DeBeos','555507HPEGTe'];a202_0x2be6=function(){return _0x5db023;};return a202_0x2be6();}function a202_0x13a7(_0x99e83c,_0x3f19a2){_0x99e83c=_0x99e83c-0x13d;const _0x2be614=a202_0x2be6();let _0x13a7b0=_0x2be614[_0x99e83c];return _0x13a7b0;}export const userAccountDefinitions=[dingTalkSandboxBind];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a203_0x3ed655=a203_0x383d;(function(_0x4b63f3,_0x28c76e){const _0x10c5d7=a203_0x383d,_0x5ca025=_0x4b63f3();while(!![]){try{const _0x4c9c55=-parseInt(_0x10c5d7(0xe1))/0x1*(parseInt(_0x10c5d7(0xd9))/0x2)+parseInt(_0x10c5d7(0xdc))/0x3+-parseInt(_0x10c5d7(0xe9))/0x4*(-parseInt(_0x10c5d7(0xdd))/0x5)+parseInt(_0x10c5d7(0xd8))/0x6+parseInt(_0x10c5d7(0xe0))/0x7+-parseInt(_0x10c5d7(0xe6))/0x8*(-parseInt(_0x10c5d7(0xe4))/0x9)+parseInt(_0x10c5d7(0xe8))/0xa*(-parseInt(_0x10c5d7(0xe2))/0xb);if(_0x4c9c55===_0x28c76e)break;else _0x5ca025['push'](_0x5ca025['shift']());}catch(_0x5a3f72){_0x5ca025['push'](_0x5ca025['shift']());}}}(a203_0x4cf9,0x8b4c1));import{buildAppAddFlags,runAppAdd,validateAppName}from'../../commands/common/app-registry.js';function a203_0x383d(_0x4ab8d2,_0x18d7d5){_0x4ab8d2=_0x4ab8d2-0xd8;const _0x4cf998=a203_0x4cf9();let _0x383d89=_0x4cf998[_0x4ab8d2];return _0x383d89;}export const workspaceAddDefinition={'service':a203_0x3ed655(0xdf),'command':a203_0x3ed655(0xe7),'description':a203_0x3ed655(0xe5),'risk':a203_0x3ed655(0xde),'requiresAuth':![],'requiresAppCode':![],'args':[{'name':a203_0x3ed655(0xda),'description':a203_0x3ed655(0xe3),'required':!![]}],'flags':buildAppAddFlags(),'validate':_0x300ebe=>validateAppName(_0x300ebe,a203_0x3ed655(0xdb)),'execute':_0x4c41e7=>runAppAdd(_0x4c41e7,'workspace\x20add')};function a203_0x4cf9(){const _0x24b02c=['name','workspace\x20add','2067837CqjWWx','1827905LfDqKi','write','workspace','4757403JyjMoT','4jBPJeF','473SrnCXW','App\x20profile\x20name','13419AXbDLS','Register\x20an\x20app\x20profile\x20in\x20the\x20current\x20workspace\x20(or\x20--global)','4072cylQTC','add','552490FmuQWL','4KFshlJ','6426024KgpGDV','309072vBFKEy'];a203_0x4cf9=function(){return _0x24b02c;};return a203_0x4cf9();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a204_0x353c(_0x24d1e7,_0x54fa20){_0x24d1e7=_0x24d1e7-0x135;const _0x129ab2=a204_0x129a();let _0x353c09=_0x129ab2[_0x24d1e7];return _0x353c09;}const a204_0x339cbd=a204_0x353c;(function(_0x16c300,_0x24d84d){const _0x5d2929=a204_0x353c,_0x48ff8c=_0x16c300();while(!![]){try{const _0x20db0f=-parseInt(_0x5d2929(0x161))/0x1*(-parseInt(_0x5d2929(0x163))/0x2)+parseInt(_0x5d2929(0x14d))/0x3+-parseInt(_0x5d2929(0x150))/0x4+-parseInt(_0x5d2929(0x141))/0x5+-parseInt(_0x5d2929(0x156))/0x6*(parseInt(_0x5d2929(0x169))/0x7)+parseInt(_0x5d2929(0x157))/0x8*(parseInt(_0x5d2929(0x152))/0x9)+parseInt(_0x5d2929(0x168))/0xa;if(_0x20db0f===_0x24d84d)break;else _0x48ff8c['push'](_0x48ff8c['shift']());}catch(_0x5aba41){_0x48ff8c['push'](_0x48ff8c['shift']());}}}(a204_0x129a,0xf41c8));import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';import{RABETBASE_ENV_VALUES}from'../../constant/env.js';import{RABETBASE_OUTPUT_FORMAT_VALUES}from'../../constant/output.js';import{RISK_LEVEL_VALUES}from'../../constant/risk.js';import{validateAppcode}from'../../commands/common/validate.js';function a204_0x129a(){const _0x4d23bb=['globalConfig','3717585xIvTRs','riskLevel','str','7700860CWeQWv','init','819fXmEng','validation','Use\x20`',').\x20Config:\x20','450174WQxPpI','69368zLGxVi','appcode','App\x20\x22','locale','.\x20Credentials:\x20not\x20written.','app','defaultFormat','\x20workspace\x20init\x20--appcode\x20<code>`\x20or\x20`','\x20workspace\x20<init|use>\x20--app\x20<name>\x20[--appcode\x20<code>]','Missing\x20workspace\x20app\x20selector.','1uVoSQm','Locale\x20for\x20this\x20workspace\x20app\x20profile','2397342yauXtR','format','isArray','Default\x20output\x20format\x20for\x20this\x20workspace\x20app\x20profile','\x20--appcode\x20<code>`.','8757310goMfUB','7dqKmDS','workspace','Target\x20environment','join','defaultApp','pageSize','\x20workspace\x20use\x20--app\x20<name>`.','Workspace\x20','apiDir','string','workspace.','Invalid\x20appcode:\x20','App\x20code\x20to\x20bind\x20to\x20this\x20workspace','Switch\x20the\x20current\x20workspace\x20app\x20binding','\x20workspace\x20','\x22\x20not\x20found.','5512670tyewDo','object','use','length','API\x20directory\x20path\x20for\x20this\x20workspace\x20app\x20profile','trim','Default\x20page\x20size\x20for\x20this\x20workspace\x20app\x20profile','number','apps','App\x20profile\x20name\x20to\x20use\x20in\x20this\x20workspace','env'];a204_0x129a=function(){return _0x4d23bb;};return a204_0x129a();}import{readConfigFile,readRawConfigWithLayers,resolveWriteConfigPath,writeConfigFile}from'../../context.js';import{workspaceAddDefinition}from'../../commands/workspace/add.js';import{workspaceRemoveDefinition}from'../../commands/workspace/remove.js';const WORKSPACE_USAGE=CLI_BIN_NAME+a204_0x339cbd(0x15f),SAFE_PROFILE_KEYS=[a204_0x339cbd(0x158),a204_0x339cbd(0x14b),a204_0x339cbd(0x139),a204_0x339cbd(0x164),'pageSize','riskLevel',a204_0x339cbd(0x15a)],workspaceFlags=[{'name':a204_0x339cbd(0x15c),'type':a204_0x339cbd(0x13a),'description':a204_0x339cbd(0x14a)},{'name':'appcode','type':a204_0x339cbd(0x13a),'description':a204_0x339cbd(0x13d)},{'name':'env','type':a204_0x339cbd(0x13a),'description':a204_0x339cbd(0x16b),'enum':[...RABETBASE_ENV_VALUES]},{'name':a204_0x339cbd(0x139),'type':a204_0x339cbd(0x13a),'description':a204_0x339cbd(0x145)},{'name':a204_0x339cbd(0x15d),'type':a204_0x339cbd(0x13a),'description':a204_0x339cbd(0x166),'enum':[...RABETBASE_OUTPUT_FORMAT_VALUES]},{'name':a204_0x339cbd(0x136),'type':a204_0x339cbd(0x148),'description':a204_0x339cbd(0x147)},{'name':a204_0x339cbd(0x14e),'type':a204_0x339cbd(0x13a),'description':'Risk\x20level\x20for\x20this\x20workspace\x20app\x20profile','enum':[...RISK_LEVEL_VALUES]},{'name':a204_0x339cbd(0x15a),'type':a204_0x339cbd(0x13a),'description':a204_0x339cbd(0x162)}];function isRecord(_0x16b50b){const _0x2f2296=a204_0x339cbd;return!!_0x16b50b&&typeof _0x16b50b===_0x2f2296(0x142)&&!Array[_0x2f2296(0x165)](_0x16b50b);}function assertValidAppcode(_0x29ccc5){const _0x5bebdb=a204_0x339cbd,{valid:_0x44b295,message:_0xbde360}=validateAppcode(_0x29ccc5);if(!_0x44b295)throw CliErrors[_0x5bebdb(0x153)](_0x5bebdb(0x13c)+_0x29ccc5,_0xbde360);}function sanitizeProfile(_0x5eb689){if(!isRecord(_0x5eb689))return{};const _0x59b752={};for(const _0x129bc2 of SAFE_PROFILE_KEYS){if(_0x5eb689[_0x129bc2]!==undefined)_0x59b752[_0x129bc2]=_0x5eb689[_0x129bc2];}return _0x59b752;}function cloneProfile(_0xbe8b0a){return isRecord(_0xbe8b0a)?{..._0xbe8b0a}:{};}function collectWorkspaceProfileOverrides(_0x5aa579){const _0x1dea92=a204_0x339cbd,_0x304b9c={},_0x34707c=_0x5aa579['str'](_0x1dea92(0x14b)),_0x2624c9=_0x5aa579['str']('apiDir'),_0xba9a23=_0x5aa579[_0x1dea92(0x14f)](_0x1dea92(0x15d)),_0x2294db=_0x5aa579['flag'](_0x1dea92(0x136)),_0x3d423f=_0x5aa579[_0x1dea92(0x14f)]('riskLevel'),_0x4c25db=_0x5aa579[_0x1dea92(0x14f)](_0x1dea92(0x15a));if(_0x34707c)_0x304b9c[_0x1dea92(0x14b)]=_0x34707c;if(_0x2624c9)_0x304b9c[_0x1dea92(0x139)]=_0x2624c9;if(_0xba9a23)_0x304b9c[_0x1dea92(0x164)]=_0xba9a23;if(_0x2294db!==undefined&&_0x2294db!=='')_0x304b9c[_0x1dea92(0x136)]=Number(_0x2294db);if(_0x3d423f)_0x304b9c[_0x1dea92(0x14e)]=_0x3d423f;if(_0x4c25db)_0x304b9c['locale']=_0x4c25db;return _0x304b9c;}async function validateWorkspaceArgs(_0x480d54){const _0x2df58f=a204_0x339cbd,_0x1acf85=_0x480d54['str'](_0x2df58f(0x15c))[_0x2df58f(0x146)](),_0x2982eb=_0x480d54[_0x2df58f(0x14f)](_0x2df58f(0x158))[_0x2df58f(0x146)]();if(!_0x1acf85&&!_0x2982eb)throw CliErrors[_0x2df58f(0x153)](_0x2df58f(0x160),'Use\x20`'+CLI_BIN_NAME+_0x2df58f(0x15e)+CLI_BIN_NAME+_0x2df58f(0x137));if(_0x2982eb)assertValidAppcode(_0x2982eb);}function resolveKnownApps(){const _0x48a991=a204_0x339cbd,{config:_0x4e9c57,layers:_0x1aeaa0}=readRawConfigWithLayers(),_0x16e55b=isRecord(_0x4e9c57[_0x48a991(0x149)])?_0x4e9c57[_0x48a991(0x149)]:{},_0x5eadd6=isRecord(_0x1aeaa0[_0x48a991(0x14c)][_0x48a991(0x149)])?_0x1aeaa0['globalConfig'][_0x48a991(0x149)]:{};return{..._0x5eadd6,..._0x16e55b};}async function configureWorkspace(_0x3a42dd,_0x183dac){const _0x253280=a204_0x339cbd,_0x417d51=_0x3a42dd[_0x253280(0x14f)](_0x253280(0x15c))[_0x253280(0x146)](),_0x4d4a9a=_0x3a42dd['str']('appcode')[_0x253280(0x146)](),_0x42a8c4=_0x417d51||_0x4d4a9a;if(!_0x42a8c4)throw CliErrors[_0x253280(0x153)](_0x253280(0x160),_0x253280(0x154)+CLI_BIN_NAME+_0x253280(0x15e)+CLI_BIN_NAME+_0x253280(0x137));if(_0x4d4a9a)assertValidAppcode(_0x4d4a9a);const _0x3259ca=resolveWriteConfigPath('project'),_0x428213=readConfigFile(_0x3259ca),_0x4a3744=resolveKnownApps(),_0x4259a8=isRecord(_0x428213['apps'])?{..._0x428213['apps']}:{},_0x3747ce=cloneProfile(_0x4259a8[_0x42a8c4]),_0x151312=sanitizeProfile(_0x4a3744[_0x42a8c4]),_0x34acc=_0x4d4a9a?{}:_0x151312,_0x42e525=_0x4d4a9a||_0x34acc['appcode'];if(!_0x42e525){const _0x9f0f2c=Object['keys'](_0x4a3744),_0x21eed0=_0x9f0f2c[_0x253280(0x144)]===0x0?_0x253280(0x154)+CLI_BIN_NAME+_0x253280(0x13f)+_0x183dac+'\x20--app\x20'+_0x42a8c4+_0x253280(0x167):'Pass\x20--appcode\x20<code>,\x20or\x20choose\x20one\x20of:\x20'+_0x9f0f2c[_0x253280(0x16c)](',\x20');throw CliErrors[_0x253280(0x153)](_0x253280(0x159)+_0x42a8c4+_0x253280(0x140),_0x21eed0);}assertValidAppcode(String(_0x42e525));const _0x4572d6={..._0x34acc,..._0x3747ce,'appcode':String(_0x42e525),...collectWorkspaceProfileOverrides(_0x3a42dd)};return _0x4259a8[_0x42a8c4]=_0x4572d6,_0x428213[_0x253280(0x149)]=_0x4259a8,_0x428213[_0x253280(0x135)]=_0x42a8c4,delete _0x428213[_0x253280(0x158)],delete _0x428213[_0x253280(0x15c)],_0x4572d6['env']&&(_0x428213['env']=_0x4572d6[_0x253280(0x14b)]),writeConfigFile(_0x3259ca,_0x428213),{'ok':!![],'message':_0x253280(0x138)+(_0x183dac===_0x253280(0x151)?'initialized':'updated')+':\x20'+_0x42a8c4+'\x20(appcode:\x20'+_0x4572d6[_0x253280(0x158)]+_0x253280(0x155)+_0x3259ca+_0x253280(0x15b),'data':{'operation':_0x253280(0x13b)+_0x183dac,'configPath':_0x3259ca,'app':_0x42a8c4,'appcode':_0x4572d6[_0x253280(0x158)],'env':_0x4572d6[_0x253280(0x14b)]??null,'credentialsWritten':![]}};}const workspaceInitDefinition={'service':a204_0x339cbd(0x16a),'command':a204_0x339cbd(0x151),'description':'Initialize\x20the\x20current\x20workspace\x20app\x20binding','risk':'write','requiresAuth':![],'requiresAppCode':![],'args':[],'flags':workspaceFlags,'validate':validateWorkspaceArgs,'execute':_0x471ff2=>configureWorkspace(_0x471ff2,a204_0x339cbd(0x151))},workspaceUseDefinition={'service':a204_0x339cbd(0x16a),'command':a204_0x339cbd(0x143),'description':a204_0x339cbd(0x13e),'risk':'write','requiresAuth':![],'requiresAppCode':![],'args':[],'flags':workspaceFlags,'validate':validateWorkspaceArgs,'execute':_0x5954f6=>configureWorkspace(_0x5954f6,a204_0x339cbd(0x143))};export const workspaceDefinitions=[workspaceInitDefinition,workspaceUseDefinition,workspaceAddDefinition,workspaceRemoveDefinition];export{WORKSPACE_USAGE};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a205_0x5113(_0x2df98c,_0x3955c7){_0x2df98c=_0x2df98c-0x102;const _0x5c515f=a205_0x5c51();let _0x5113c0=_0x5c515f[_0x2df98c];return _0x5113c0;}function a205_0x5c51(){const _0x3d33a4=['2714626uQJWRF','workspace','remove','App\x20profile\x20name\x20to\x20remove','127266dPLbwL','3FwgczT','name','9078902NiwdzO','1844912mOfphI','130igeDSA','10087584UtnXut','342819twPvYb','workspace\x20remove','write','Remove\x20an\x20app\x20profile\x20from\x20the\x20current\x20workspace\x20(or\x20--global)','12179331iQjQEO'];a205_0x5c51=function(){return _0x3d33a4;};return a205_0x5c51();}const a205_0x35707f=a205_0x5113;(function(_0x623f29,_0x45f4ea){const _0xce2e2c=a205_0x5113,_0x857a18=_0x623f29();while(!![]){try{const _0x889fe0=-parseInt(_0xce2e2c(0x10f))/0x1+-parseInt(_0xce2e2c(0x104))/0x2*(-parseInt(_0xce2e2c(0x109))/0x3)+parseInt(_0xce2e2c(0x10c))/0x4+parseInt(_0xce2e2c(0x10d))/0x5*(parseInt(_0xce2e2c(0x108))/0x6)+parseInt(_0xce2e2c(0x10b))/0x7+-parseInt(_0xce2e2c(0x10e))/0x8+-parseInt(_0xce2e2c(0x103))/0x9;if(_0x889fe0===_0x45f4ea)break;else _0x857a18['push'](_0x857a18['shift']());}catch(_0x5d4d9f){_0x857a18['push'](_0x857a18['shift']());}}}(a205_0x5c51,0xad563));import{buildAppRemoveFlags,runAppRemove,validateAppName}from'../../commands/common/app-registry.js';export const workspaceRemoveDefinition={'service':a205_0x35707f(0x105),'command':a205_0x35707f(0x106),'description':a205_0x35707f(0x102),'risk':a205_0x35707f(0x111),'requiresAuth':![],'requiresAppCode':![],'args':[{'name':a205_0x35707f(0x10a),'description':a205_0x35707f(0x107),'required':!![]}],'flags':buildAppRemoveFlags(),'validate':_0x1c8157=>validateAppName(_0x1c8157,'workspace\x20remove'),'execute':_0x571422=>runAppRemove(_0x571422,a205_0x35707f(0x110))};
|