@lovrabet/rabetbase-cli 2.4.7 → 2.5.0-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/lib/api/api-doc.js +1 -1
- package/lib/api/fetch-model-list.js +1 -1
- package/lib/api/generate-api-file.d.ts +13 -3
- package/lib/api/generate-api-file.js +1 -1
- package/lib/api/generate-sdk-config-file.d.ts +7 -0
- package/lib/api/generate-sdk-config-file.js +1 -0
- 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.d.ts +2 -5
- package/lib/commands/app/shared.js +1 -1
- package/lib/commands/app-config/delete.js +1 -1
- package/lib/commands/app-config/get.js +1 -1
- package/lib/commands/app-config/index.js +1 -1
- package/lib/commands/app-config/list.js +1 -1
- package/lib/commands/app-config/set.js +1 -1
- package/lib/commands/app-config/shared.js +1 -1
- package/lib/commands/auth/index.js +1 -1
- package/lib/commands/bff/create.js +1 -1
- package/lib/commands/bff/delete.js +1 -1
- package/lib/commands/bff/detail.js +1 -1
- package/lib/commands/bff/index.js +1 -1
- package/lib/commands/bff/list.js +1 -1
- package/lib/commands/bff/pull.js +1 -1
- package/lib/commands/bff/push.js +1 -1
- package/lib/commands/bff/status.js +1 -1
- package/lib/commands/cli-skill/index.js +1 -1
- package/lib/commands/cli-update.js +1 -1
- package/lib/commands/codegen/index.js +1 -1
- package/lib/commands/codegen/sdk.js +1 -1
- package/lib/commands/codegen/sql.js +1 -1
- package/lib/commands/common/app-registry.js +1 -1
- package/lib/commands/common/app-selector.js +1 -1
- package/lib/commands/common/async-task.js +1 -1
- package/lib/commands/common/dry-run.js +1 -1
- package/lib/commands/common/flags.js +1 -1
- package/lib/commands/common/local-file.js +1 -1
- package/lib/commands/common/validate.js +1 -1
- package/lib/commands/config/delete.d.ts +5 -0
- package/lib/commands/config/delete.js +1 -0
- package/lib/commands/config/get.js +1 -1
- package/lib/commands/config/index.js +1 -1
- package/lib/commands/config/init.d.ts +12 -0
- package/lib/commands/config/init.js +1 -0
- package/lib/commands/config/list.js +1 -1
- package/lib/commands/config/set.js +1 -1
- package/lib/commands/config/shared.js +1 -1
- package/lib/commands/dataset/business-group-update.js +1 -1
- package/lib/commands/dataset/business-groups.js +1 -1
- package/lib/commands/dataset/capability.js +1 -1
- package/lib/commands/dataset/delete.js +1 -1
- package/lib/commands/dataset/detail.js +1 -1
- package/lib/commands/dataset/extend-update.js +1 -1
- package/lib/commands/dataset/field-update.js +1 -1
- package/lib/commands/dataset/generate.js +1 -1
- package/lib/commands/dataset/index.js +1 -1
- package/lib/commands/dataset/list.js +1 -1
- package/lib/commands/dataset/operations.js +1 -1
- package/lib/commands/dataset/relation-audit.js +1 -1
- package/lib/commands/dataset/relation-create.js +1 -1
- package/lib/commands/dataset/relation-delete.js +1 -1
- package/lib/commands/dataset/relation-shared.js +1 -1
- package/lib/commands/dataset/relation-update.js +1 -1
- package/lib/commands/dataset/relations.js +1 -1
- package/lib/commands/dataset/rename.js +1 -1
- package/lib/commands/dataset/restore.js +1 -1
- package/lib/commands/db/analysis-batching.js +1 -1
- package/lib/commands/db/analyze-batch-plan.js +1 -1
- package/lib/commands/db/analyze-cancel.js +1 -1
- package/lib/commands/db/analyze-start.js +1 -1
- package/lib/commands/db/analyze-status.js +1 -1
- package/lib/commands/db/create.js +1 -1
- package/lib/commands/db/delete.js +1 -1
- package/lib/commands/db/detail.js +1 -1
- package/lib/commands/db/diff-refresh-start.js +1 -1
- package/lib/commands/db/diff-refresh-status.js +1 -1
- package/lib/commands/db/diff.js +1 -1
- package/lib/commands/db/index.js +1 -1
- package/lib/commands/db/list.js +1 -1
- package/lib/commands/db/shared.js +1 -1
- package/lib/commands/db/tables.js +1 -1
- package/lib/commands/db/test.js +1 -1
- package/lib/commands/db/update.js +1 -1
- package/lib/commands/doctor.js +1 -1
- package/lib/commands/file/index.js +1 -1
- package/lib/commands/issue/index.js +1 -1
- package/lib/commands/issue/nudge.js +1 -1
- package/lib/commands/issue/report.js +1 -1
- package/lib/commands/issue/shared.js +1 -1
- package/lib/commands/kb/create.js +1 -1
- package/lib/commands/kb/delete.js +1 -1
- package/lib/commands/kb/detail.js +1 -1
- package/lib/commands/kb/index.js +1 -1
- package/lib/commands/kb/list.js +1 -1
- package/lib/commands/kb/search.js +1 -1
- package/lib/commands/kb/shared.js +1 -1
- package/lib/commands/kb/update.js +1 -1
- package/lib/commands/logs/index.js +1 -1
- package/lib/commands/menu/asset-update.js +1 -1
- package/lib/commands/menu/delete.js +1 -1
- package/lib/commands/menu/external-link-create.js +1 -1
- package/lib/commands/menu/external-link-update.js +1 -1
- package/lib/commands/menu/group-create.js +1 -1
- package/lib/commands/menu/group-update.js +1 -1
- package/lib/commands/menu/index.js +1 -1
- package/lib/commands/menu/list.js +1 -1
- package/lib/commands/menu/move.js +1 -1
- package/lib/commands/menu/regroup-start.js +1 -1
- package/lib/commands/menu/rename.js +1 -1
- package/lib/commands/menu/shared/compare-table.js +1 -1
- package/lib/commands/menu/shared/delete-plan.js +1 -1
- package/lib/commands/menu/shared/facts.js +1 -1
- package/lib/commands/menu/shared/index.js +1 -1
- package/lib/commands/menu/shared/inquirer.js +1 -1
- package/lib/commands/menu/shared/local-pages.js +1 -1
- package/lib/commands/menu/shared/logic.js +1 -1
- package/lib/commands/menu/shared/mutations.js +1 -1
- package/lib/commands/menu/shared/service.js +1 -1
- package/lib/commands/menu/shared/sync-core.js +1 -1
- package/lib/commands/menu/shared/update-core.js +1 -1
- package/lib/commands/menu/shared/valid-url.js +1 -1
- package/lib/commands/menu/sync.js +1 -1
- package/lib/commands/menu/visibility-update.js +1 -1
- package/lib/commands/notification/config-create.js +1 -1
- package/lib/commands/notification/config-delete.js +1 -1
- package/lib/commands/notification/config-list.js +1 -1
- package/lib/commands/notification/config-update.js +1 -1
- package/lib/commands/notification/index.js +1 -1
- package/lib/commands/notification/shared.js +1 -1
- package/lib/commands/ocr/index.js +1 -1
- package/lib/commands/page/create.js +1 -1
- package/lib/commands/page/custom/detail.js +1 -1
- package/lib/commands/page/custom/list.js +1 -1
- package/lib/commands/page/custom/publish.js +1 -1
- package/lib/commands/page/custom/shared.js +1 -1
- package/lib/commands/page/custom/syntax.js +1 -1
- package/lib/commands/page/custom/template.js +1 -1
- package/lib/commands/page/custom/update.js +1 -1
- package/lib/commands/page/data-list-status.js +1 -1
- package/lib/commands/page/generate-start.js +1 -1
- package/lib/commands/page/generate-status.js +1 -1
- package/lib/commands/page/index.js +1 -1
- package/lib/commands/page/pull.js +1 -1
- package/lib/commands/page/push.js +1 -1
- package/lib/commands/page/relation-audit.js +1 -1
- package/lib/commands/page/restore.js +1 -1
- package/lib/commands/page/shared.js +1 -1
- package/lib/commands/page/sync.js +1 -1
- package/lib/commands/project/create/enhanced-guided-create.js +1 -1
- package/lib/commands/project/create/format-elapsed.js +1 -1
- package/lib/commands/project/create/main.d.ts +1 -0
- package/lib/commands/project/create/main.js +1 -1
- package/lib/commands/project/create/materialize-project-template.d.ts +6 -2
- 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.d.ts +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.d.ts +2 -2
- package/lib/commands/registry.js +1 -1
- package/lib/commands/role/delete.js +1 -1
- package/lib/commands/role/detail.js +1 -1
- package/lib/commands/role/index.js +1 -1
- package/lib/commands/role/list.js +1 -1
- package/lib/commands/role/shared.d.ts +1 -1
- package/lib/commands/role/shared.js +1 -1
- package/lib/commands/role/update.js +1 -1
- package/lib/commands/role/user-add.js +1 -1
- package/lib/commands/role/user-remove.js +1 -1
- package/lib/commands/role/user-resolve.js +1 -1
- package/lib/commands/run/index.js +1 -1
- package/lib/commands/schema.js +1 -1
- package/lib/commands/sql/create.js +1 -1
- package/lib/commands/sql/delete.js +1 -1
- package/lib/commands/sql/detail.js +1 -1
- package/lib/commands/sql/exec.js +1 -1
- package/lib/commands/sql/index.js +1 -1
- package/lib/commands/sql/list.js +1 -1
- package/lib/commands/sql/pull.js +1 -1
- package/lib/commands/sql/push.js +1 -1
- package/lib/commands/sql/shared.js +1 -1
- package/lib/commands/sql/status.js +1 -1
- package/lib/commands/sql/validate.js +1 -1
- package/lib/commands/task/index.js +1 -1
- package/lib/commands/task/status.js +1 -1
- package/lib/commands/tenant/index.js +1 -1
- package/lib/commands/tenant/members-list.js +1 -1
- package/lib/commands/tenant/shared.js +1 -1
- package/lib/commands/user-account/dingding-sandbox-bind.js +1 -1
- package/lib/commands/user-account/index.js +1 -1
- package/lib/commands/workspace/add.js +1 -1
- package/lib/commands/workspace/index.js +1 -1
- package/lib/commands/workspace/remove.js +1 -1
- package/lib/config/domain-config.d.ts +10 -0
- package/lib/config/domain-config.js +1 -0
- package/lib/config/schema.d.ts +3 -1
- package/lib/config/schema.js +1 -1
- package/lib/constant/cdn.js +1 -1
- package/lib/constant/cli.js +1 -1
- package/lib/constant/defaults.js +1 -1
- package/lib/constant/domain.d.ts +23 -1
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/constant/output.js +1 -1
- package/lib/constant/paths.js +1 -1
- package/lib/constant/region.d.ts +9 -0
- package/lib/constant/region.js +1 -0
- 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.d.ts +4 -6
- package/lib/context/config-loader.js +1 -1
- package/lib/context.d.ts +2 -2
- package/lib/context.js +1 -1
- package/lib/core/alias-resolver.js +1 -1
- package/lib/core/api-client.d.ts +2 -0
- package/lib/core/api-client.js +1 -1
- package/lib/core/bff/config.js +1 -1
- package/lib/core/bff/file-system.js +1 -1
- package/lib/core/bff/hash.js +1 -1
- package/lib/core/bff/lock.js +1 -1
- package/lib/core/bff/utils.js +1 -1
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/page/file-system.js +1 -1
- package/lib/core/page/hash.js +1 -1
- package/lib/core/page/lock.js +1 -1
- package/lib/core/sql-index-auditor.js +1 -1
- package/lib/core/sql-sync/config.js +1 -1
- package/lib/core/sql-sync/file-system.js +1 -1
- package/lib/core/sql-sync/hash.js +1 -1
- package/lib/core/sql-sync/lock.js +1 -1
- package/lib/core/sql-sync/utils.js +1 -1
- package/lib/core/sql-validator.js +1 -1
- package/lib/errors.d.ts +11 -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.d.ts +2 -2
- 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/types/index.d.ts +28 -0
- package/lib/utils/ai_config.d.ts +1 -2
- package/lib/utils/ai_config.js +1 -1
- package/lib/utils/apply-jq-filter.js +1 -1
- package/lib/utils/cdn-config.js +1 -1
- package/lib/utils/check-sdk-version.js +1 -1
- package/lib/utils/cli-version-check.js +1 -1
- package/lib/utils/cli-version-policy.js +1 -1
- package/lib/utils/config.js +1 -1
- package/lib/utils/entity-with-id.js +1 -1
- package/lib/utils/file-utils.js +1 -1
- package/lib/utils/guides-cdn.js +1 -1
- package/lib/utils/http-client.js +1 -1
- package/lib/utils/is-non-interactive.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/params.js +1 -1
- package/lib/utils/platform.js +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.js +1 -1
- package/lib/utils/update-notice.js +1 -1
- package/lib/utils/version.js +1 -1
- package/lib/utils/with-active-cookie.js +1 -1
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +1 -3
- package/skills/rabetbase/SKILL.md +33 -28
- package/skills/rabetbase/guides/backend-function.md +41 -12
- package/skills/rabetbase/guides/bff-creation-workflow.md +6 -4
- package/skills/rabetbase/guides/custom-page-workflow.md +1 -1
- package/skills/rabetbase/guides/data-api-guidelines.md +8 -8
- package/skills/rabetbase/guides/database-connection-workflow.md +8 -16
- package/skills/rabetbase/guides/menu-anomaly-manual-cleanup.md +1 -6
- package/skills/rabetbase/guides/sdk-client-generation.md +146 -0
- package/skills/rabetbase/guides/sql-creation-workflow.md +1 -1
- package/skills/rabetbase/guides/troubleshooting.md +1 -1
- package/skills/rabetbase/guides/typescript-sdk.md +46 -10
- package/skills/rabetbase/references/rabetbase-api-list.md +4 -4
- package/skills/rabetbase/references/rabetbase-api-pull.md +44 -29
- package/skills/rabetbase/references/rabetbase-app-list.md +2 -2
- package/skills/rabetbase/references/rabetbase-auth-login.md +4 -2
- package/skills/rabetbase/references/rabetbase-bff-push.md +3 -1
- package/skills/rabetbase/references/rabetbase-codegen-sql.md +3 -1
- package/skills/rabetbase/references/rabetbase-config.md +75 -30
- package/skills/rabetbase/references/rabetbase-dataset-business-group-update.md +17 -6
- package/skills/rabetbase/references/rabetbase-dataset-detail.md +1 -1
- package/skills/rabetbase/references/rabetbase-db-analyze.md +3 -3
- package/skills/rabetbase/references/rabetbase-db-detail.md +2 -2
- package/skills/rabetbase/references/rabetbase-db-diff-refresh.md +4 -4
- package/skills/rabetbase/references/rabetbase-db-diff.md +6 -9
- package/skills/rabetbase/references/rabetbase-doctor.md +1 -1
- package/skills/rabetbase/references/rabetbase-init.md +57 -51
- package/skills/rabetbase/references/rabetbase-kb.md +2 -0
- package/skills/rabetbase/references/rabetbase-page-create.md +1 -1
- package/skills/rabetbase/references/rabetbase-page-custom-detail.md +3 -3
- package/skills/rabetbase/references/rabetbase-page-custom-list.md +2 -2
- package/skills/rabetbase/references/rabetbase-project-create.md +12 -3
- package/skills/rabetbase/references/rabetbase-project-upgrade.md +2 -2
- package/skills/rabetbase/references/rabetbase-role-user-resolve.md +2 -2
- package/skills/rabetbase/references/rabetbase-user-account.md +1 -1
- package/skills/rabetbase/references/rabetbase-workspace.md +6 -6
- package/skills/rabetbase.manifest.json +4 -3
- package/templates/README.md +17 -28
- package/templates/generate-api/api.ts.tpl +3 -3
- package/templates/generate-api/client.ts.tpl +10 -37
- package/lib/commands/data/filter.d.ts +0 -7
- package/lib/commands/data/filter.js +0 -1
- package/lib/commands/data/getOne.d.ts +0 -7
- package/lib/commands/data/getOne.js +0 -1
- package/lib/commands/data/index.d.ts +0 -8
- package/lib/commands/data/index.js +0 -1
- package/lib/commands/data/shared.d.ts +0 -33
- package/lib/commands/data/shared.js +0 -1
- package/lib/commands/init/index.d.ts +0 -11
- package/lib/commands/init/index.js +0 -1
- package/lib/utils/rules-cdn.d.ts +0 -38
- package/lib/utils/rules-cdn.js +0 -1
- package/templates/rules/lovrabet_rules.mdc.tpl +0 -893
- package/templates/skill/SKILL.md.tpl +0 -120
package/lib/commands/sql/exec.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a187_0x2f4a(_0x587e1a,_0x40eed0){_0x587e1a=_0x587e1a-0xbf;const _0x5f0d47=a187_0x5f0d();let _0x2f4ab1=_0x5f0d47[_0x587e1a];return _0x2f4ab1;}const a187_0x5d37dd=a187_0x2f4a;(function(_0x34f477,_0x5e152c){const _0x280338=a187_0x2f4a,_0x2a154b=_0x34f477();while(!![]){try{const _0x303614=parseInt(_0x280338(0xcd))/0x1*(parseInt(_0x280338(0xbf))/0x2)+-parseInt(_0x280338(0xc8))/0x3*(parseInt(_0x280338(0xc4))/0x4)+parseInt(_0x280338(0xd2))/0x5+-parseInt(_0x280338(0xd6))/0x6+-parseInt(_0x280338(0xd7))/0x7*(-parseInt(_0x280338(0xc7))/0x8)+-parseInt(_0x280338(0xd4))/0x9+parseInt(_0x280338(0xc5))/0xa;if(_0x303614===_0x5e152c)break;else _0x2a154b['push'](_0x2a154b['shift']());}catch(_0x25da99){_0x2a154b['push'](_0x2a154b['shift']());}}}(a187_0x5f0d,0x8adbe));import{executeSql}from'../../core/api-client.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';import{parseJsonParams}from'../../utils/params.js';function a187_0x5f0d(){const _0x1a62b1=['69825PtdyxR','SQL\x20execution\x20failed','exec','301222QLhyJU','length','execError','now','isArray','4hZPlLJ','13919530oaPypc','str','320xOhEEm','652551YyNAxJ','\x20row(s)\x20in\x20','appCode','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','sqlcode','1uKbDdg','string','execResult','Returned\x20','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','710350Gdmirf','execSuccess','8133984VzXxQQ','params','2361450nsicMz'];a187_0x5f0d=function(){return _0x1a62b1;};return a187_0x5f0d();}export const sqlExec={'service':'sql','command':a187_0x5d37dd(0xd9),'description':a187_0x5d37dd(0xcb),'risk':'read','flags':[SQLCODE_FLAG,{'name':a187_0x5d37dd(0xd5),'type':a187_0x5d37dd(0xce),'description':a187_0x5d37dd(0xd1)}],async 'execute'(_0x52d17e){const _0x28038c=a187_0x5d37dd,_0x1e36f0=parseJsonParams(_0x52d17e[_0x28038c(0xc6)]('params')),_0x40bc9b=Date[_0x28038c(0xc2)](),_0x596444=await executeSql(_0x52d17e[_0x28038c(0xca)],_0x52d17e[_0x28038c(0xc6)](_0x28038c(0xcc)),_0x1e36f0),_0x6bcc91=Date['now']()-_0x40bc9b,_0xe743b=_0x596444?.[_0x28038c(0xcf)]??_0x596444,_0x6b8222=_0x596444?.[_0x28038c(0xd3)]??!![];if(!_0x6b8222)return{'ok':![],'data':{'error':_0x596444?.[_0x28038c(0xc1)]||_0x28038c(0xd8),'elapsed':_0x6bcc91},'message':_0x28038c(0xd8)};const _0x1736a7=Array[_0x28038c(0xc3)](_0xe743b)?_0xe743b:[];return{'ok':!![],'data':{'rows':_0x1736a7,'rowCount':_0x1736a7['length'],'elapsed':_0x6bcc91},'message':_0x28038c(0xd0)+_0x1736a7[_0x28038c(0xc0)]+_0x28038c(0xc9)+_0x6bcc91+'ms'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x285cd5,_0x41c087){const _0x1e7e31=a188_0x48bc,_0x1a3d88=_0x285cd5();while(!![]){try{const _0x4162f1=-parseInt(_0x1e7e31(0x18c))/0x1+parseInt(_0x1e7e31(0x187))/0x2+-parseInt(_0x1e7e31(0x189))/0x3*(parseInt(_0x1e7e31(0x183))/0x4)+parseInt(_0x1e7e31(0x18d))/0x5*(parseInt(_0x1e7e31(0x186))/0x6)+-parseInt(_0x1e7e31(0x185))/0x7+parseInt(_0x1e7e31(0x18b))/0x8*(-parseInt(_0x1e7e31(0x184))/0x9)+parseInt(_0x1e7e31(0x18a))/0xa*(parseInt(_0x1e7e31(0x188))/0xb);if(_0x4162f1===_0x41c087)break;else _0x1a3d88['push'](_0x1a3d88['shift']());}catch(_0x3f5600){_0x1a3d88['push'](_0x1a3d88['shift']());}}}(a188_0x225e,0xa6b18));import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';function a188_0x225e(){const _0x3956cf=['1638396kATDbW','7407603nRwEdZ','23778PKkdmY','622972yZqdAk','4235253QRPNxX','791676NbAVBD','100GlvaLV','56POpmzd','189910GbOYJg','125SJEgtF','16XwtxCB'];a188_0x225e=function(){return _0x3956cf;};return a188_0x225e();}function a188_0x48bc(_0x2324c7,_0x523dde){_0x2324c7=_0x2324c7-0x183;const _0x225e73=a188_0x225e();let _0x48bcad=_0x225e73[_0x2324c7];return _0x48bcad;}import{sqlExec}from'../../commands/sql/exec.js';import{sqlPull}from'../../commands/sql/pull.js';import{sqlCreate}from'../../commands/sql/create.js';import{sqlStatus}from'../../commands/sql/status.js';import{sqlPush}from'../../commands/sql/push.js';import{sqlDelete}from'../../commands/sql/delete.js';export const sqlDefinitions=[sqlList,sqlDetail,sqlStatus,sqlCreate,sqlPush,sqlValidate,sqlExec,sqlPull,sqlDelete];
|
package/lib/commands/sql/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a189_0x39cd9d=a189_0x39f7;function a189_0x4e10(){const _0x452e83=['length','2543814FaAKTQ','70969CNnRrT','sqlCode','Page\x20number','Page\x20size','4578080VaNxAJ','appCode','read','1296240SpGJzF','string','boolean','pagesize','1225049lijsgD','\x20SQL\x20queries\x20(total:\x20','sqlcode','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','dbId','verbose','number','19013013Jrijek','description','2356XXFGOj','name','list','num','5379stXpeY','map','Found\x20','22rFrcPb','all','bool','List\x20custom\x20SQL\x20queries'];a189_0x4e10=function(){return _0x452e83;};return a189_0x4e10();}(function(_0x52dfa8,_0x310651){const _0x5c2b23=a189_0x39f7,_0x542347=_0x52dfa8();while(!![]){try{const _0x2af983=-parseInt(_0x5c2b23(0x1ac))/0x1*(-parseInt(_0x5c2b23(0x1a6))/0x2)+-parseInt(_0x5c2b23(0x1a3))/0x3*(-parseInt(_0x5c2b23(0x19f))/0x4)+parseInt(_0x5c2b23(0x1b0))/0x5+-parseInt(_0x5c2b23(0x1ab))/0x6+parseInt(_0x5c2b23(0x1b7))/0x7+parseInt(_0x5c2b23(0x1b3))/0x8+-parseInt(_0x5c2b23(0x1be))/0x9;if(_0x2af983===_0x310651)break;else _0x542347['push'](_0x542347['shift']());}catch(_0xa10232){_0x542347['push'](_0x542347['shift']());}}}(a189_0x4e10,0x86f9f));import{listSqlQueries}from'../../core/api-client.js';function a189_0x39f7(_0x41da30,_0x3896d7){_0x41da30=_0x41da30-0x19e;const _0x4e106c=a189_0x4e10();let _0x39f7df=_0x4e106c[_0x41da30];return _0x39f7df;}import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':'sql','command':a189_0x39cd9d(0x1a1),'description':a189_0x39cd9d(0x1a9),'risk':a189_0x39cd9d(0x1b2),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a189_0x39cd9d(0x1a0),'type':a189_0x39cd9d(0x1b4),'description':'Filter\x20by\x20SQL\x20name'},{'name':'page','type':a189_0x39cd9d(0x1bd),'description':a189_0x39cd9d(0x1ae),'default':0x1},{'name':a189_0x39cd9d(0x1b6),'type':a189_0x39cd9d(0x1bd),'description':a189_0x39cd9d(0x1af)},{'name':a189_0x39cd9d(0x1bc),'type':a189_0x39cd9d(0x1b5),'description':a189_0x39cd9d(0x1ba)}],async 'execute'(_0x206011){const _0x50f5c2=a189_0x39cd9d,_0x4e1631=await listSqlQueries(_0x206011[_0x50f5c2(0x1b1)],{'sqlCode':_0x206011['str'](_0x50f5c2(0x1b9))||undefined,'sqlName':_0x206011['str'](_0x50f5c2(0x1a0))||undefined,'currentPage':_0x206011[_0x50f5c2(0x1a2)]('page'),'pageSize':_0x206011[_0x50f5c2(0x1a2)](_0x50f5c2(0x1b6),0x32)}),_0x4cfc7a=_0x206011[_0x50f5c2(0x1a8)](_0x50f5c2(0x1bc)),_0xfde8c3=_0x4e1631['tableData']??[],_0xcd0fb7=_0x4e1631['paging']?.['totalCount']??_0xfde8c3[_0x50f5c2(0x1aa)];let _0x346b56;return _0x4cfc7a?_0x346b56=_0xfde8c3:_0x346b56=await Promise[_0x50f5c2(0x1a7)](_0xfde8c3[_0x50f5c2(0x1a4)](async _0x42c044=>{const _0x30b69a=_0x50f5c2;let _0x1f759f;try{_0x1f759f=_0x42c044[_0x30b69a(0x1bb)]?await getDbName(_0x206011[_0x30b69a(0x1b1)],_0x42c044[_0x30b69a(0x1bb)]):undefined;}catch{}return{'sqlCode':_0x42c044[_0x30b69a(0x1ad)],'sqlName':_0x42c044['sqlName'],'description':_0x42c044[_0x30b69a(0x19e)]??'','db':_0x1f759f?_0x1f759f+'\x20('+_0x42c044[_0x30b69a(0x1bb)]+')':_0x42c044['dbId']??''};})),{'ok':!![],'data':_0x346b56,'message':_0xfde8c3[_0x50f5c2(0x1aa)]===0x0?'No\x20custom\x20SQL\x20queries\x20found.':_0x50f5c2(0x1a5)+_0xfde8c3[_0x50f5c2(0x1aa)]+_0x50f5c2(0x1b8)+_0xcd0fb7+').'};}};
|
package/lib/commands/sql/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a192_0xbf43bb=a192_0x1e27;(function(_0xd2033a,_0x1980eb){const _0x2caf1a=a192_0x1e27,_0x190d45=_0xd2033a();while(!![]){try{const _0x5a851c=parseInt(_0x2caf1a(0xdb))/0x1+parseInt(_0x2caf1a(0xd5))/0x2+-parseInt(_0x2caf1a(0xd3))/0x3+parseInt(_0x2caf1a(0xf4))/0x4+-parseInt(_0x2caf1a(0xe0))/0x5*(parseInt(_0x2caf1a(0xc6))/0x6)+-parseInt(_0x2caf1a(0xc7))/0x7*(parseInt(_0x2caf1a(0xe9))/0x8)+parseInt(_0x2caf1a(0xc8))/0x9*(parseInt(_0x2caf1a(0xd6))/0xa);if(_0x5a851c===_0x1980eb)break;else _0x190d45['push'](_0x190d45['shift']());}catch(_0x4b7827){_0x190d45['push'](_0x190d45['shift']());}}}(a192_0xfc93,0x4596d));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';function a192_0x1e27(_0x28bc5f,_0x121772){_0x28bc5f=_0x28bc5f-0xc6;const _0xfc930=a192_0xfc93();let _0x1e27f9=_0xfc930[_0x28bc5f];return _0x1e27f9;}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';function a192_0xfc93(){const _0xc68114=['1254717GeJBHz','dbId','Force\x20pull\x20cancelled.','push','bool','sqlName','length','catch','sqls','appCode','toISOString','1316022OSydXQ','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','86774tiNQWg','10SMrCIC','name','\x20skipped,\x20','Would\x20pull\x20','trimStart','498280EHOaiw','str','force','Pull\x20complete:\x20','mybatisXml','5UtTXuM','sqlCode','utf8','boolean','\x20failed','join','pull','read','No\x20remote\x20SQL\x20queries\x20matched.','664712eJSftf','totalCount','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','sqlContent','path','cancelled','sql','replace','apps','paging','would_pull','1690816mKDhWr','sqlRootDir','conflict','split','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','sqlRoot','message','lockFilePath','filter','local\x20differs\x20from\x20remote','tableData','string','sqlcode','description','test','286302SHUwUl','28tIREDK'];a192_0xfc93=function(){return _0xc68114;};return a192_0xfc93();}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(_0x2cb5e9,_0x351067){const _0x153705=a192_0x1e27,_0x56d9e1=[];let _0x520a05=0x1;while(!![]){const _0xfad0de=await listSqlQueries(_0x2cb5e9,{'currentPage':_0x520a05,'pageSize':PAGE_SIZE,'sqlCode':_0x351067[_0x153705(0xe1)],'sqlName':_0x351067[_0x153705(0xcd)]}),_0x5f1c10=_0xfad0de[_0x153705(0xfe)]??[];_0x56d9e1[_0x153705(0xcb)](..._0x5f1c10);if(_0x5f1c10['length']===0x0)break;const _0x562354=_0xfad0de[_0x153705(0xf2)]?.[_0x153705(0xea)];if(_0x562354!=null?_0x56d9e1['length']>=_0x562354:_0x5f1c10[_0x153705(0xce)]<PAGE_SIZE)break;_0x520a05++;}return _0x56d9e1;}async function ensureSqlContent(_0x1c9c16){const _0x60958d=a192_0x1e27;if(_0x1c9c16['sqlContent']!=null&&String(_0x1c9c16[_0x60958d(0xec)])[_0x60958d(0xce)]>0x0)return _0x1c9c16;return getSqlQueryDetail(_0x1c9c16[_0x60958d(0xe1)]);}export const sqlPull={'service':'sql','command':a192_0xbf43bb(0xe6),'description':'Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','risk':a192_0xbf43bb(0xe7),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a192_0xbf43bb(0xd7),'type':a192_0xbf43bb(0xff),'description':'Filter\x20by\x20SQL\x20display\x20name'},{'name':a192_0xbf43bb(0xdd),'type':a192_0xbf43bb(0xe3),'description':'Force\x20overwrite\x20local\x20unsynced\x20changes'}],async 'dryRun'(_0x5bc1f8){const _0x5d2253=a192_0xbf43bb,_0xed4496=loadSqlProjectConfig(_0x5bc1f8[_0x5d2253(0xd1)]),_0xae8e51=await readSqlLockFile(_0xed4496['lockFilePath']),{appLock:_0x20a185}=ensureSqlLockScope(_0xae8e51??createEmptySqlLock(),_0xed4496[_0x5d2253(0xd1)],_0xed4496[_0x5d2253(0xf9)],_0x5d2253(0xe6)),_0x11fc78=await fetchAllSqlQueries(_0x5bc1f8[_0x5d2253(0xd1)],{'sqlCode':_0x5bc1f8[_0x5d2253(0xdc)](_0x5d2253(0x100))||undefined,'sqlName':_0x5bc1f8[_0x5d2253(0xdc)](_0x5d2253(0xd7))||undefined}),_0x1560b8=[];for(const _0x4cf171 of _0x11fc78){const _0x574f3d=await ensureSqlContent(_0x4cf171),_0x562f65=ensureRemoteSqlContent(_0x574f3d),_0x48d12d=detectModeFromSql(_0x574f3d),_0x1340b2=_0x574f3d['dbId']?await getDbName(_0x5bc1f8[_0x5d2253(0xd1)],Number(_0x574f3d[_0x5d2253(0xc9)]))['catch'](()=>undefined):undefined,_0x5007b5=buildLocalSqlFileContent({'sqlCode':_0x574f3d[_0x5d2253(0xe1)],'sqlName':_0x574f3d['sqlName'],'dbId':_0x574f3d[_0x5d2253(0xc9)]},_0x562f65,{'dbName':_0x1340b2,'mode':_0x48d12d,'syncedAt':new Date()[_0x5d2253(0xd2)](),'description':_0x574f3d['description']}),_0x3a69a0=buildSqlLockEntry(_0x574f3d,_0x562f65,'',{'dbName':_0x1340b2}),_0x36e775=resolveLocalSqlFilePath(_0xed4496,_0x574f3d[_0x5d2253(0xe1)],_0x3a69a0);let _0x47dd82=_0x5d2253(0xf3),_0x236b16;if(await fileExists(_0x36e775)){const _0x1c3854=await readFile(_0x36e775,'utf8');isEquivalentPulledSqlFile(_0x1c3854,_0x5007b5,_0x48d12d)?(_0x47dd82='skipped',_0x236b16='unchanged'):(_0x47dd82=_0x5d2253(0xf6),_0x236b16=_0x5d2253(0xd4));}_0x1560b8[_0x5d2253(0xcb)]({'sqlCode':_0x574f3d[_0x5d2253(0xe1)],'sqlName':_0x574f3d[_0x5d2253(0xcd)],'filePath':_0x36e775,'status':_0x47dd82,'reason':_0x236b16});}return{'method':'POST','url':_0x5d2253(0xeb),'body':{'appCode':_0x5bc1f8[_0x5d2253(0xd1)],'sqlCode':_0x5bc1f8[_0x5d2253(0xdc)](_0x5d2253(0x100))||null,'sqlName':_0x5bc1f8[_0x5d2253(0xdc)](_0x5d2253(0xd7))||null,'files':_0x1560b8},'description':_0x5d2253(0xd9)+_0x1560b8[_0x5d2253(0xce)]+'\x20SQL\x20file(s)\x20into\x20'+_0xed4496['sqlRootDir']};},async 'execute'(_0x2d5c4f){const _0x12c457=a192_0xbf43bb,_0x3bd95a=loadSqlProjectConfig(_0x2d5c4f['appCode']),_0x21f6e1=await readSqlLockFile(_0x3bd95a[_0x12c457(0xfb)]),{lockData:_0x107e77,appLock:_0x21f37a}=ensureSqlLockScope(_0x21f6e1??createEmptySqlLock(),_0x3bd95a['appCode'],_0x3bd95a['sqlRoot'],'pull'),_0x4147b8=_0x2d5c4f[_0x12c457(0xcc)](_0x12c457(0xdd)),_0x550ac4=await fetchAllSqlQueries(_0x2d5c4f['appCode'],{'sqlCode':_0x2d5c4f[_0x12c457(0xdc)](_0x12c457(0x100))||undefined,'sqlName':_0x2d5c4f[_0x12c457(0xdc)](_0x12c457(0xd7))||undefined});if(_0x550ac4['length']===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x12c457(0xe8)};const _0x295f07=[],_0x29485d=[];for(const _0x44ca02 of _0x550ac4){try{_0x295f07[_0x12c457(0xcb)](await ensureSqlContent(_0x44ca02));}catch(_0x3f9003){_0x29485d[_0x12c457(0xcb)]({'sqlCode':_0x44ca02[_0x12c457(0xe1)],'error':_0x3f9003 instanceof Error?_0x3f9003[_0x12c457(0xfa)]:String(_0x3f9003)});}}if(_0x4147b8&&!_0x2d5c4f['nonInteractive']){let _0x1879f9=![];for(const _0x431102 of _0x295f07){const _0x478d46=detectModeFromSql(_0x431102),_0x5abaa3=_0x431102[_0x12c457(0xc9)]?await getDbName(_0x2d5c4f[_0x12c457(0xd1)],Number(_0x431102['dbId']))[_0x12c457(0xcf)](()=>undefined):undefined,_0x17d1fb=buildLocalSqlFileContent({'sqlCode':_0x431102['sqlCode'],'sqlName':_0x431102[_0x12c457(0xcd)],'dbId':_0x431102['dbId']},ensureRemoteSqlContent(_0x431102),{'dbName':_0x5abaa3,'mode':_0x478d46,'syncedAt':new Date()[_0x12c457(0xd2)](),'description':_0x431102[_0x12c457(0x101)]}),_0xbdc3ed=resolveLocalSqlFilePath(_0x3bd95a,_0x431102['sqlCode'],buildSqlLockEntry(_0x431102,ensureRemoteSqlContent(_0x431102),'',{'dbName':_0x5abaa3}));if(await fileExists(_0xbdc3ed)){const _0x4f0614=await readFile(_0xbdc3ed,_0x12c457(0xe2));if(!isEquivalentPulledSqlFile(_0x4f0614,_0x17d1fb,_0x478d46)){_0x1879f9=!![];break;}}}if(_0x1879f9){const _0x264ba4=await confirmForceOverwrite(_0x12c457(0xf8));if(!_0x264ba4)throw CliErrors[_0x12c457(0xee)](_0x12c457(0xca));}}const _0x24f311=cloneSqlLockData(_0x107e77),_0x321dcb=_0x24f311[_0x12c457(0xf1)][_0x3bd95a['appCode']],_0xd5dd3f=[],_0x5e213e=[];for(const _0x171ac9 of _0x295f07){const _0x16d4b3=_0x321dcb['sqls'][_0x171ac9['sqlCode']],_0xb15f86=ensureRemoteSqlContent(_0x171ac9),_0x517b21=detectModeFromSql(_0x171ac9),_0x3fb37d=_0x171ac9[_0x12c457(0xc9)]?await getDbName(_0x2d5c4f['appCode'],Number(_0x171ac9['dbId']))[_0x12c457(0xcf)](()=>undefined):undefined,_0x58a1d3=buildLocalSqlFileContent({'sqlCode':_0x171ac9[_0x12c457(0xe1)],'sqlName':_0x171ac9[_0x12c457(0xcd)],'dbId':_0x171ac9[_0x12c457(0xc9)]},_0xb15f86,{'dbName':_0x3fb37d,'mode':_0x517b21,'syncedAt':new Date()[_0x12c457(0xd2)](),'description':_0x171ac9[_0x12c457(0x101)]}),_0x37ab2b=buildSqlLockEntry(_0x171ac9,_0xb15f86,computeSqlContentHash(_0x58a1d3),{'dbName':_0x3fb37d}),_0x43853e=_0x37ab2b['path'],_0x5533f0=join(_0x3bd95a[_0x12c457(0xf5)],_0x43853e);try{if(await fileExists(_0x5533f0)){const _0x6d4a6d=await readFile(_0x5533f0,_0x12c457(0xe2));if(isEquivalentPulledSqlFile(_0x6d4a6d,_0x58a1d3,_0x517b21)){_0x5e213e[_0x12c457(0xcb)]({'sqlCode':_0x171ac9['sqlCode'],'reason':'unchanged'}),_0x321dcb['sqls'][_0x171ac9[_0x12c457(0xe1)]]={..._0x37ab2b,'hash':computeSqlContentHash(_0x6d4a6d),'path':_0x43853e};continue;}if(!_0x4147b8){_0x5e213e[_0x12c457(0xcb)]({'sqlCode':_0x171ac9['sqlCode'],'reason':_0x12c457(0xfd)});continue;}}const _0x2f76bb=_0x16d4b3?.[_0x12c457(0xed)]?join(_0x3bd95a['sqlRootDir'],_0x16d4b3['path']):undefined;_0x2f76bb&&_0x2f76bb!==_0x5533f0&&await fileExists(_0x2f76bb)&&await rm(_0x2f76bb,{'force':!![]}),await ensureParentDirectory(_0x5533f0),await writeFile(_0x5533f0,_0x58a1d3,_0x12c457(0xe2)),_0x321dcb[_0x12c457(0xd0)][_0x171ac9['sqlCode']]={..._0x37ab2b,'path':_0x43853e},_0xd5dd3f[_0x12c457(0xcb)]({'sqlCode':_0x171ac9[_0x12c457(0xe1)],'filePath':_0x5533f0});}catch(_0x1a634d){_0x29485d[_0x12c457(0xcb)]({'sqlCode':_0x171ac9['sqlCode'],'error':_0x1a634d instanceof Error?_0x1a634d[_0x12c457(0xfa)]:String(_0x1a634d)});}}return _0x321dcb['lastSync']=new Date()[_0x12c457(0xd2)](),await writeSqlLockFile(_0x3bd95a[_0x12c457(0xfb)],_0x24f311),{'ok':_0x29485d[_0x12c457(0xce)]===0x0,'data':{'pulled':_0xd5dd3f,'skipped':_0x5e213e,'failed':_0x29485d},'message':_0x12c457(0xde)+_0xd5dd3f['length']+'\x20written,\x20'+_0x5e213e[_0x12c457(0xce)]+_0x12c457(0xd8)+_0x29485d[_0x12c457(0xce)]+_0x12c457(0xe4)};}};function detectModeFromSql(_0xbf937e){const _0xfd8509=a192_0xbf43bb,_0x1c48b6=ensureRemoteSqlContent(_0xbf937e),_0x3bd863=stripLocalSqlMetadata(_0x1c48b6,'mybatisXml')[_0xfd8509(0xda)]();if(/^<(select|insert|update|delete)\b/i[_0xfd8509(0x102)](_0x3bd863))return _0xfd8509(0xdf);return _0xfd8509(0xef);}function isEquivalentPulledSqlFile(_0x2cca1f,_0x1cb368,_0x19ed2e){return normalizePullComparableContent(_0x2cca1f,_0x19ed2e)===normalizePullComparableContent(_0x1cb368,_0x19ed2e);}function normalizePullComparableContent(_0x577c5a,_0x757556){const _0x49defd=a192_0xbf43bb,_0x512a1a=_0x577c5a[_0x49defd(0xf0)](/\r\n/g,'\x0a')[_0x49defd(0xf7)]('\x0a'),_0x1f2b26=_0x512a1a[_0x49defd(0xfc)](_0x1496bd=>!isSyncedAtMetadataLine(_0x1496bd,_0x757556));return _0x1f2b26[_0x49defd(0xe5)]('\x0a');}function isSyncedAtMetadataLine(_0x3a8e3d,_0x5b5946){if(_0x5b5946==='mybatisXml')return/^\s*<!--\s*@lovrabet\.syncedAt:/['test'](_0x3a8e3d);return/^\s*--\s*@lovrabet\.syncedAt:/['test'](_0x3a8e3d);}
|
|
1
|
+
const a190_0x44a80a=a190_0x165c;function a190_0x165c(_0x13f4d7,_0xc3990d){_0x13f4d7=_0x13f4d7-0x1f1;const _0xdb39ae=a190_0xdb39();let _0x165c3c=_0xdb39ae[_0x13f4d7];return _0x165c3c;}(function(_0x223991,_0x33eae3){const _0x223140=a190_0x165c,_0x35fb55=_0x223991();while(!![]){try{const _0x4ef392=parseInt(_0x223140(0x1f6))/0x1*(parseInt(_0x223140(0x20f))/0x2)+parseInt(_0x223140(0x21d))/0x3*(parseInt(_0x223140(0x21b))/0x4)+-parseInt(_0x223140(0x1f5))/0x5+parseInt(_0x223140(0x211))/0x6*(parseInt(_0x223140(0x20d))/0x7)+parseInt(_0x223140(0x203))/0x8+parseInt(_0x223140(0x208))/0x9*(parseInt(_0x223140(0x204))/0xa)+parseInt(_0x223140(0x227))/0xb*(-parseInt(_0x223140(0x201))/0xc);if(_0x4ef392===_0x33eae3)break;else _0x35fb55['push'](_0x35fb55['shift']());}catch(_0x4a01ec){_0x35fb55['push'](_0x35fb55['shift']());}}}(a190_0xdb39,0xcd1ea));import{readFile,rm,writeFile}from'node:fs/promises';function a190_0xdb39(){const _0x2ea1ed=['length','sqlRoot','utf8','catch','4125nDfQHH','join','appCode','unchanged','dbId','\x20failed','str','bool','\x20written,\x20','7556860iFHJbx','2018goQNuN','force','sql','name','sqlCode','message','conflict','cancelled','lockFilePath','local\x20differs\x20from\x20remote','sqlName','59412PQjcaB','\x20SQL\x20file(s)\x20into\x20','2196152lVhVEG','40eGmdes','lastSync','string','sqlContent','817272zJsNnO','Would\x20pull\x20','Force\x20pull\x20cancelled.','pull','sqls','7iZXIhH','push','1622nyoTAl','sqlcode','7172148lnnPns','mybatisXml','No\x20remote\x20SQL\x20queries\x20matched.','nonInteractive','path','sqlRootDir','description','trimStart','paging','tableData','16HWVhAV','POST','553845yTzdlT','test','read','toISOString','apps','Filter\x20by\x20SQL\x20display\x20name'];a190_0xdb39=function(){return _0x2ea1ed;};return a190_0xdb39();}import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x2dd4f0,_0x59f951){const _0x51d90d=a190_0x165c,_0x374b03=[];let _0x37e297=0x1;while(!![]){const _0x301112=await listSqlQueries(_0x2dd4f0,{'currentPage':_0x37e297,'pageSize':PAGE_SIZE,'sqlCode':_0x59f951['sqlCode'],'sqlName':_0x59f951[_0x51d90d(0x200)]}),_0x260653=_0x301112[_0x51d90d(0x21a)]??[];_0x374b03[_0x51d90d(0x20e)](..._0x260653);if(_0x260653[_0x51d90d(0x223)]===0x0)break;const _0x2f1903=_0x301112[_0x51d90d(0x219)]?.['totalCount'];if(_0x2f1903!=null?_0x374b03['length']>=_0x2f1903:_0x260653[_0x51d90d(0x223)]<PAGE_SIZE)break;_0x37e297++;}return _0x374b03;}async function ensureSqlContent(_0x4f6930){const _0x146b27=a190_0x165c;if(_0x4f6930[_0x146b27(0x207)]!=null&&String(_0x4f6930[_0x146b27(0x207)])[_0x146b27(0x223)]>0x0)return _0x4f6930;return getSqlQueryDetail(_0x4f6930[_0x146b27(0x1fa)]);}export const sqlPull={'service':a190_0x44a80a(0x1f8),'command':a190_0x44a80a(0x20b),'description':'Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','risk':a190_0x44a80a(0x21f),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'name','type':a190_0x44a80a(0x206),'description':a190_0x44a80a(0x222)},{'name':a190_0x44a80a(0x1f7),'type':'boolean','description':'Force\x20overwrite\x20local\x20unsynced\x20changes'}],async 'dryRun'(_0x2d87dc){const _0x354c28=a190_0x44a80a,_0x27427e=loadSqlProjectConfig(_0x2d87dc[_0x354c28(0x229)]),_0x4628fa=await readSqlLockFile(_0x27427e[_0x354c28(0x1fe)]),{appLock:_0x103b8e}=ensureSqlLockScope(_0x4628fa??createEmptySqlLock(),_0x27427e[_0x354c28(0x229)],_0x27427e[_0x354c28(0x224)],'pull'),_0xe832a1=await fetchAllSqlQueries(_0x2d87dc[_0x354c28(0x229)],{'sqlCode':_0x2d87dc[_0x354c28(0x1f2)]('sqlcode')||undefined,'sqlName':_0x2d87dc[_0x354c28(0x1f2)]('name')||undefined}),_0x246f4d=[];for(const _0x21496c of _0xe832a1){const _0x41cf90=await ensureSqlContent(_0x21496c),_0x22c66e=ensureRemoteSqlContent(_0x41cf90),_0x1a0089=detectModeFromSql(_0x41cf90),_0x207131=_0x41cf90['dbId']?await getDbName(_0x2d87dc[_0x354c28(0x229)],Number(_0x41cf90[_0x354c28(0x22b)]))[_0x354c28(0x226)](()=>undefined):undefined,_0x697128=buildLocalSqlFileContent({'sqlCode':_0x41cf90[_0x354c28(0x1fa)],'sqlName':_0x41cf90[_0x354c28(0x200)],'dbId':_0x41cf90['dbId']},_0x22c66e,{'dbName':_0x207131,'mode':_0x1a0089,'syncedAt':new Date()[_0x354c28(0x220)](),'description':_0x41cf90[_0x354c28(0x217)]}),_0x2ee6f4=buildSqlLockEntry(_0x41cf90,_0x22c66e,'',{'dbName':_0x207131}),_0x5aff05=resolveLocalSqlFilePath(_0x27427e,_0x41cf90[_0x354c28(0x1fa)],_0x2ee6f4);let _0x3abb48='would_pull',_0x32b847;if(await fileExists(_0x5aff05)){const _0x17ae5c=await readFile(_0x5aff05,'utf8');isEquivalentPulledSqlFile(_0x17ae5c,_0x697128,_0x1a0089)?(_0x3abb48='skipped',_0x32b847=_0x354c28(0x22a)):(_0x3abb48=_0x354c28(0x1fc),_0x32b847='local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)');}_0x246f4d['push']({'sqlCode':_0x41cf90[_0x354c28(0x1fa)],'sqlName':_0x41cf90[_0x354c28(0x200)],'filePath':_0x5aff05,'status':_0x3abb48,'reason':_0x32b847});}return{'method':_0x354c28(0x21c),'url':'/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','body':{'appCode':_0x2d87dc[_0x354c28(0x229)],'sqlCode':_0x2d87dc['str'](_0x354c28(0x210))||null,'sqlName':_0x2d87dc[_0x354c28(0x1f2)]('name')||null,'files':_0x246f4d},'description':_0x354c28(0x209)+_0x246f4d[_0x354c28(0x223)]+_0x354c28(0x202)+_0x27427e[_0x354c28(0x216)]};},async 'execute'(_0x126aea){const _0x55443e=a190_0x44a80a,_0x509d96=loadSqlProjectConfig(_0x126aea[_0x55443e(0x229)]),_0x41cc8b=await readSqlLockFile(_0x509d96[_0x55443e(0x1fe)]),{lockData:_0x27650c,appLock:_0x22a761}=ensureSqlLockScope(_0x41cc8b??createEmptySqlLock(),_0x509d96[_0x55443e(0x229)],_0x509d96['sqlRoot'],_0x55443e(0x20b)),_0x1d13f4=_0x126aea[_0x55443e(0x1f3)](_0x55443e(0x1f7)),_0x56a040=await fetchAllSqlQueries(_0x126aea[_0x55443e(0x229)],{'sqlCode':_0x126aea[_0x55443e(0x1f2)](_0x55443e(0x210))||undefined,'sqlName':_0x126aea[_0x55443e(0x1f2)](_0x55443e(0x1f9))||undefined});if(_0x56a040[_0x55443e(0x223)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x55443e(0x213)};const _0x509db8=[],_0x621880=[];for(const _0x589d2a of _0x56a040){try{_0x509db8[_0x55443e(0x20e)](await ensureSqlContent(_0x589d2a));}catch(_0x45fa0c){_0x621880[_0x55443e(0x20e)]({'sqlCode':_0x589d2a[_0x55443e(0x1fa)],'error':_0x45fa0c instanceof Error?_0x45fa0c[_0x55443e(0x1fb)]:String(_0x45fa0c)});}}if(_0x1d13f4&&!_0x126aea[_0x55443e(0x214)]){let _0x37121a=![];for(const _0x2ba7b6 of _0x509db8){const _0x1b118a=detectModeFromSql(_0x2ba7b6),_0x2ec67b=_0x2ba7b6['dbId']?await getDbName(_0x126aea[_0x55443e(0x229)],Number(_0x2ba7b6['dbId']))[_0x55443e(0x226)](()=>undefined):undefined,_0x455967=buildLocalSqlFileContent({'sqlCode':_0x2ba7b6[_0x55443e(0x1fa)],'sqlName':_0x2ba7b6['sqlName'],'dbId':_0x2ba7b6[_0x55443e(0x22b)]},ensureRemoteSqlContent(_0x2ba7b6),{'dbName':_0x2ec67b,'mode':_0x1b118a,'syncedAt':new Date()['toISOString'](),'description':_0x2ba7b6[_0x55443e(0x217)]}),_0x184387=resolveLocalSqlFilePath(_0x509d96,_0x2ba7b6[_0x55443e(0x1fa)],buildSqlLockEntry(_0x2ba7b6,ensureRemoteSqlContent(_0x2ba7b6),'',{'dbName':_0x2ec67b}));if(await fileExists(_0x184387)){const _0x2ee274=await readFile(_0x184387,_0x55443e(0x225));if(!isEquivalentPulledSqlFile(_0x2ee274,_0x455967,_0x1b118a)){_0x37121a=!![];break;}}}if(_0x37121a){const _0x53eeb8=await confirmForceOverwrite('Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.');if(!_0x53eeb8)throw CliErrors[_0x55443e(0x1fd)](_0x55443e(0x20a));}}const _0x3ff678=cloneSqlLockData(_0x27650c),_0x2e25ec=_0x3ff678[_0x55443e(0x221)][_0x509d96[_0x55443e(0x229)]],_0x3df270=[],_0x1536af=[];for(const _0x50d3ea of _0x509db8){const _0x153897=_0x2e25ec[_0x55443e(0x20c)][_0x50d3ea['sqlCode']],_0x439b69=ensureRemoteSqlContent(_0x50d3ea),_0x2eb430=detectModeFromSql(_0x50d3ea),_0x445673=_0x50d3ea[_0x55443e(0x22b)]?await getDbName(_0x126aea['appCode'],Number(_0x50d3ea[_0x55443e(0x22b)]))[_0x55443e(0x226)](()=>undefined):undefined,_0x153f81=buildLocalSqlFileContent({'sqlCode':_0x50d3ea[_0x55443e(0x1fa)],'sqlName':_0x50d3ea[_0x55443e(0x200)],'dbId':_0x50d3ea['dbId']},_0x439b69,{'dbName':_0x445673,'mode':_0x2eb430,'syncedAt':new Date()['toISOString'](),'description':_0x50d3ea[_0x55443e(0x217)]}),_0x3e494d=buildSqlLockEntry(_0x50d3ea,_0x439b69,computeSqlContentHash(_0x153f81),{'dbName':_0x445673}),_0x36ba30=_0x3e494d[_0x55443e(0x215)],_0x3aee2b=join(_0x509d96['sqlRootDir'],_0x36ba30);try{if(await fileExists(_0x3aee2b)){const _0x3d1c37=await readFile(_0x3aee2b,'utf8');if(isEquivalentPulledSqlFile(_0x3d1c37,_0x153f81,_0x2eb430)){_0x1536af[_0x55443e(0x20e)]({'sqlCode':_0x50d3ea[_0x55443e(0x1fa)],'reason':'unchanged'}),_0x2e25ec[_0x55443e(0x20c)][_0x50d3ea['sqlCode']]={..._0x3e494d,'hash':computeSqlContentHash(_0x3d1c37),'path':_0x36ba30};continue;}if(!_0x1d13f4){_0x1536af[_0x55443e(0x20e)]({'sqlCode':_0x50d3ea[_0x55443e(0x1fa)],'reason':_0x55443e(0x1ff)});continue;}}const _0x3a6d42=_0x153897?.[_0x55443e(0x215)]?join(_0x509d96[_0x55443e(0x216)],_0x153897[_0x55443e(0x215)]):undefined;_0x3a6d42&&_0x3a6d42!==_0x3aee2b&&await fileExists(_0x3a6d42)&&await rm(_0x3a6d42,{'force':!![]}),await ensureParentDirectory(_0x3aee2b),await writeFile(_0x3aee2b,_0x153f81,_0x55443e(0x225)),_0x2e25ec[_0x55443e(0x20c)][_0x50d3ea[_0x55443e(0x1fa)]]={..._0x3e494d,'path':_0x36ba30},_0x3df270[_0x55443e(0x20e)]({'sqlCode':_0x50d3ea[_0x55443e(0x1fa)],'filePath':_0x3aee2b});}catch(_0x59b2f6){_0x621880[_0x55443e(0x20e)]({'sqlCode':_0x50d3ea[_0x55443e(0x1fa)],'error':_0x59b2f6 instanceof Error?_0x59b2f6['message']:String(_0x59b2f6)});}}return _0x2e25ec[_0x55443e(0x205)]=new Date()['toISOString'](),await writeSqlLockFile(_0x509d96[_0x55443e(0x1fe)],_0x3ff678),{'ok':_0x621880['length']===0x0,'data':{'pulled':_0x3df270,'skipped':_0x1536af,'failed':_0x621880},'message':'Pull\x20complete:\x20'+_0x3df270[_0x55443e(0x223)]+_0x55443e(0x1f4)+_0x1536af[_0x55443e(0x223)]+'\x20skipped,\x20'+_0x621880['length']+_0x55443e(0x1f1)};}};function detectModeFromSql(_0x4b3894){const _0x70ee4d=a190_0x44a80a,_0x2cb1de=ensureRemoteSqlContent(_0x4b3894),_0x3ffca0=stripLocalSqlMetadata(_0x2cb1de,'mybatisXml')[_0x70ee4d(0x218)]();if(/^<(select|insert|update|delete)\b/i[_0x70ee4d(0x21e)](_0x3ffca0))return'mybatisXml';return _0x70ee4d(0x1f8);}function isEquivalentPulledSqlFile(_0x2c9046,_0xd0a9da,_0x26b29b){return normalizePullComparableContent(_0x2c9046,_0x26b29b)===normalizePullComparableContent(_0xd0a9da,_0x26b29b);}function normalizePullComparableContent(_0x4f21b8,_0x2455de){const _0x2c6e10=a190_0x44a80a,_0x4a1654=_0x4f21b8['replace'](/\r\n/g,'\x0a')['split']('\x0a'),_0x358c71=_0x4a1654['filter'](_0x2e8410=>!isSyncedAtMetadataLine(_0x2e8410,_0x2455de));return _0x358c71[_0x2c6e10(0x228)]('\x0a');}function isSyncedAtMetadataLine(_0x233e87,_0x3971fa){const _0x5e2d49=a190_0x44a80a;if(_0x3971fa===_0x5e2d49(0x212))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x5e2d49(0x21e)](_0x233e87);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x5e2d49(0x21e)](_0x233e87);}
|
package/lib/commands/sql/push.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a193_0x5e27b5=a193_0x48d3;(function(_0xca9cb5,_0xa1c372){const _0x39f77c=a193_0x48d3,_0x2a963a=_0xca9cb5();while(!![]){try{const _0x5d4fe3=parseInt(_0x39f77c(0xf3))/0x1+parseInt(_0x39f77c(0xde))/0x2*(parseInt(_0x39f77c(0x110))/0x3)+-parseInt(_0x39f77c(0xd3))/0x4*(-parseInt(_0x39f77c(0x10f))/0x5)+parseInt(_0x39f77c(0xfb))/0x6+parseInt(_0x39f77c(0x10c))/0x7*(parseInt(_0x39f77c(0x10d))/0x8)+parseInt(_0x39f77c(0xe7))/0x9+-parseInt(_0x39f77c(0x104))/0xa;if(_0x5d4fe3===_0xa1c372)break;else _0x2a963a['push'](_0x2a963a['shift']());}catch(_0x55d071){_0x2a963a['push'](_0x2a963a['shift']());}}}(a193_0x48e8,0x79e81));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';function a193_0x48e8(){const _0x737e45=['sqlRoot','dbDirectory','entries','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','path','toISOString','1336626ZbSPfN','filePath','str','lockFilePath','unchanged','\x20pushed,\x20','remoteId','write','join','sqlRootDir','replace','has','63461FNyRSz','push','length','dbId','set','boolean','sqlName','POST','1095966XJffFI','appCode','\x20skipped,\x20','Local\x20directory\x20\x22','Local\x20SQL\x20not\x20found:\x20','relativePath','filter','sqlcode','mode','21728350YhRWUt','sqls','get','\x20failed','sqlCode','Would\x20push\x20','version','\x20SQL\x20file(s)','6587gpghVd','7768xNFnxt','force','5tAGyyK','6qKZgYP','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','sqlConfig','/smartapi/custom/updateUserCustomSql','validation','bool','isFinite','Push\x20local\x20SQL\x20files\x20to\x20remote','map','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','projectRoot','1465036PiXDhn','trashDir','sql','startsWith','No\x20database\x20matches\x20local\x20directory\x20\x22','exec','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','catch','lastSync','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','\x22\x20for\x20sqlCode\x20','997558UyvcFW','utf8','dbName'];a193_0x48e8=function(){return _0x737e45;};return a193_0x48e8();}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';function a193_0x48d3(_0x596f68,_0x299f86){_0x596f68=_0x596f68-0xcd;const _0x48e8c8=a193_0x48e8();let _0x48d363=_0x48e8c8[_0x596f68];return _0x48d363;}import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';async function getTargetSqlQueries(_0x48d447,_0xd56eb5,_0x17be02){const _0x4cb2a6=a193_0x48d3,_0x4a1946=await scanLocalSqlQueries(_0x48d447),_0x3ed23=new Map();for(const _0x588da0 of _0x4a1946){if(_0x17be02&&_0x588da0[_0x4cb2a6(0x108)]!==_0x17be02)continue;const _0x2207b3=_0x3ed23[_0x4cb2a6(0x106)](_0x588da0[_0x4cb2a6(0x108)])??[];_0x2207b3['push'](_0x588da0),_0x3ed23[_0x4cb2a6(0xf7)](_0x588da0[_0x4cb2a6(0x108)],_0x2207b3);}if(_0x17be02&&!_0x3ed23[_0x4cb2a6(0xf2)](_0x17be02))throw CliErrors['validation'](_0x4cb2a6(0xff)+_0x17be02);const _0x273146=[];for(const [_0x1bbf22,_0x3945e1]of _0x3ed23[_0x4cb2a6(0xe3)]()){if(_0x3945e1[_0x4cb2a6(0xf5)]===0x1){_0x273146['push'](_0x3945e1[0x0]);continue;}const _0x4d9cd8=_0xd56eb5[_0x4cb2a6(0x105)][_0x1bbf22],_0x532458=_0x4d9cd8?.[_0x4cb2a6(0xe5)],_0xe19b7=_0x532458?_0x3945e1[_0x4cb2a6(0x101)](_0x1f048c=>_0x1f048c[_0x4cb2a6(0x100)]!==_0x532458):_0x3945e1;if(_0x4d9cd8&&_0xe19b7[_0x4cb2a6(0xf5)]===0x1){_0x273146['push'](_0xe19b7[0x0]);continue;}throw CliErrors['validation'](_0x4cb2a6(0xdc)+_0x1bbf22+_0x4cb2a6(0x111));}return _0x273146;}export const sqlPush={'service':a193_0x5e27b5(0xd5),'command':a193_0x5e27b5(0xf4),'description':a193_0x5e27b5(0xcf),'risk':a193_0x5e27b5(0xee),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a193_0x5e27b5(0x10e),'type':a193_0x5e27b5(0xf8),'description':a193_0x5e27b5(0xd1)}],async 'dryRun'(_0xaa211d){const _0x2cb902=a193_0x5e27b5,_0x41a02a=loadSqlProjectConfig(_0xaa211d[_0x2cb902(0xfc)]),_0x91e697=await readSqlLockFile(_0x41a02a[_0x2cb902(0xea)]),{appLock:_0x3d6b8c}=ensureSqlLockScope(_0x91e697??createEmptySqlLock(),_0xaa211d[_0x2cb902(0xfc)],_0x41a02a[_0x2cb902(0xe1)],_0x2cb902(0xf4)),_0x556179=await getTargetSqlQueries(_0x41a02a,_0x3d6b8c,_0xaa211d[_0x2cb902(0xe9)](_0x2cb902(0x102))||undefined),_0x6c76c2=[];for(const _0x13b46e of _0x556179){const _0x5938f7=await computeSqlFileHash(_0x13b46e[_0x2cb902(0xe8)]),_0x28c9a6=_0x3d6b8c[_0x2cb902(0x105)][_0x13b46e[_0x2cb902(0x108)]],_0x254a94=!!_0x28c9a6&&(_0x28c9a6[_0x2cb902(0xe5)]!==_0x13b46e[_0x2cb902(0x100)]||!!_0x13b46e[_0x2cb902(0xf9)]&&_0x28c9a6[_0x2cb902(0xf9)]!==_0x13b46e[_0x2cb902(0xf9)]);if(!_0xaa211d[_0x2cb902(0xcd)](_0x2cb902(0x10e))&&_0x28c9a6&&_0x28c9a6['hash']===_0x5938f7&&!_0x254a94)continue;_0x6c76c2[_0x2cb902(0xf4)](_0x13b46e[_0x2cb902(0x108)]);}return{'method':_0x2cb902(0xfa),'url':_0x2cb902(0x113),'body':{'sqlCodes':_0x6c76c2,'appCode':_0xaa211d['appCode']},'description':_0x2cb902(0x109)+_0x6c76c2[_0x2cb902(0xf5)]+_0x2cb902(0x10b)};},async 'execute'(_0x28983c){const _0x24b2f9=a193_0x5e27b5,_0x3f0741=loadSqlProjectConfig(_0x28983c['appCode']),_0x27cad9=await readSqlLockFile(_0x3f0741[_0x24b2f9(0xea)]),{lockData:_0x142e7a,appLock:_0x454a7f}=ensureSqlLockScope(_0x27cad9??createEmptySqlLock(),_0x28983c[_0x24b2f9(0xfc)],_0x3f0741[_0x24b2f9(0xe1)],_0x24b2f9(0xf4)),_0x467402=await getTargetSqlQueries(_0x3f0741,_0x454a7f,_0x28983c[_0x24b2f9(0xe9)](_0x24b2f9(0x102))||undefined);if(_0x467402['length']===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':'No\x20local\x20SQL\x20files\x20found.'};const _0x4cd916=[],_0x5ef433=[],_0x2fe303=[];for(const _0x114010 of _0x467402){const _0x5abbc5=_0x454a7f[_0x24b2f9(0x105)][_0x114010[_0x24b2f9(0x108)]];if(!_0x5abbc5){_0x2fe303['push']({'sqlCode':_0x114010[_0x24b2f9(0x108)],'error':_0x24b2f9(0xd9)});continue;}try{const _0x3f908c=await computeSqlFileHash(_0x114010[_0x24b2f9(0xe8)]),_0x5e74be=_0x5abbc5[_0x24b2f9(0xe5)]!==_0x114010[_0x24b2f9(0x100)]||!!_0x114010[_0x24b2f9(0xf9)]&&_0x5abbc5['sqlName']!==_0x114010[_0x24b2f9(0xf9)];if(!_0x28983c[_0x24b2f9(0xcd)](_0x24b2f9(0x10e))&&_0x5abbc5['hash']===_0x3f908c&&!_0x5e74be){_0x5ef433[_0x24b2f9(0xf4)]({'sqlCode':_0x114010[_0x24b2f9(0x108)],'reason':_0x24b2f9(0xeb)});continue;}if(_0x5abbc5[_0x24b2f9(0x10a)]==null){_0x2fe303['push']({'sqlCode':_0x114010['sqlCode'],'error':_0x24b2f9(0xe4)});continue;}const _0x5df560=await readFile(_0x114010[_0x24b2f9(0xe8)],_0x24b2f9(0xdf)),_0x1220f5=stripLocalSqlMetadata(_0x5df560,_0x114010[_0x24b2f9(0x103)]),_0x2057d8=_0x114010[_0x24b2f9(0xf9)]||_0x5abbc5[_0x24b2f9(0xf9)],_0x890d89=await resolveTargetDbBinding(_0x28983c[_0x24b2f9(0xfc)],_0x114010,_0x5abbc5),_0x1ab299=await updateSqlQuery({'id':_0x5abbc5[_0x24b2f9(0xed)],'appCode':_0x28983c[_0x24b2f9(0xfc)],'sqlCode':_0x114010[_0x24b2f9(0x108)],'sqlName':_0x2057d8,'dbId':_0x890d89['dbId'],'version':_0x5abbc5[_0x24b2f9(0x10a)],'sqlContent':_0x1220f5,'sqlConfig':_0x5abbc5[_0x24b2f9(0x112)]??undefined}),_0xea21b9=_0x1ab299[_0x24b2f9(0xf6)]?await getDbName(_0x28983c[_0x24b2f9(0xfc)],Number(_0x1ab299[_0x24b2f9(0xf6)]))[_0x24b2f9(0xda)](()=>_0x890d89['dbName']):_0x890d89[_0x24b2f9(0xe0)];_0x454a7f[_0x24b2f9(0x105)][_0x114010['sqlCode']]={...buildSqlLockEntry(_0x1ab299,_0x1220f5,_0x3f908c,{'dbName':_0xea21b9}),'path':_0x114010[_0x24b2f9(0x100)],'mode':_0x5abbc5[_0x24b2f9(0x103)]},await archivePreviousSqlFileIfNeeded(_0x3f0741,_0x5abbc5[_0x24b2f9(0xe5)],_0x114010[_0x24b2f9(0x100)]),_0x4cd916[_0x24b2f9(0xf4)]({'sqlCode':_0x114010[_0x24b2f9(0x108)],'remoteId':_0x5abbc5['remoteId']});}catch(_0x512467){_0x2fe303[_0x24b2f9(0xf4)]({'sqlCode':_0x114010[_0x24b2f9(0x108)],'error':_0x512467 instanceof Error?_0x512467['message']:String(_0x512467)});}}return _0x454a7f[_0x24b2f9(0xdb)]=new Date()[_0x24b2f9(0xe6)](),await writeSqlLockFile(_0x3f0741[_0x24b2f9(0xea)],_0x142e7a),{'ok':_0x2fe303['length']===0x0,'data':{'pushed':_0x4cd916,'skipped':_0x5ef433,'failed':_0x2fe303},'message':'Push\x20complete:\x20'+_0x4cd916[_0x24b2f9(0xf5)]+_0x24b2f9(0xec)+_0x5ef433[_0x24b2f9(0xf5)]+_0x24b2f9(0xfd)+_0x2fe303[_0x24b2f9(0xf5)]+_0x24b2f9(0x107)};}};async function archivePreviousSqlFileIfNeeded(_0x13294d,_0x173554,_0x38f91c){const _0x472474=a193_0x5e27b5;if(!_0x173554||_0x173554===_0x38f91c)return;const _0x508f94=join(_0x13294d[_0x472474(0xf0)],_0x173554);if(!await fileExists(_0x508f94))return;const _0x3fa174=await moveToTrash(_0x13294d[_0x472474(0xd2)],_0x13294d[_0x472474(0xd4)],_0x508f94);await cleanupEmptyDirectories(dirname(_0x508f94),_0x13294d[_0x472474(0xf0)]),void _0x3fa174;}async function moveToTrash(_0x22c799,_0x39a0ba,_0x589fcf){const _0x35f591=a193_0x5e27b5,_0x1daeec=new Date()[_0x35f591(0xe6)]()[_0x35f591(0xf1)](/[:.]/g,'-'),_0x5c1ff0=relative(_0x22c799,_0x589fcf),_0x143f0b=join(_0x39a0ba,_0x1daeec,_0x5c1ff0);return await mkdir(dirname(_0x143f0b),{'recursive':!![]}),await rename(_0x589fcf,_0x143f0b),_0x143f0b;}async function cleanupEmptyDirectories(_0x568fa8,_0x22af6a){const _0x59d6e6=a193_0x5e27b5;let _0x3df0fc=resolve(_0x568fa8);const _0x220b76=resolve(_0x22af6a);while(_0x3df0fc[_0x59d6e6(0xd6)](''+_0x220b76+sep)||_0x3df0fc===_0x220b76){if(_0x3df0fc===_0x220b76)return;try{const _0x34a35a=await readdir(_0x3df0fc);if(_0x34a35a[_0x59d6e6(0xf5)]>0x0)return;await rmdir(_0x3df0fc);}catch{return;}_0x3df0fc=dirname(_0x3df0fc);}}async function resolveTargetDbBinding(_0x3e510e,_0x1b65c6,_0x1fdfc8){const _0x3edae2=a193_0x5e27b5,_0x10b23b=_0x1b65c6[_0x3edae2(0xe2)];if(!_0x10b23b)return{'dbId':_0x1fdfc8[_0x3edae2(0xf6)],'dbName':_0x1fdfc8[_0x3edae2(0xe0)]};const _0x3192b2=buildDbDirectoryName(_0x1fdfc8[_0x3edae2(0xe0)],_0x1fdfc8['dbId']);if(_0x10b23b===_0x3192b2)return{'dbId':_0x1fdfc8['dbId'],'dbName':_0x1fdfc8[_0x3edae2(0xe0)]};const _0x42431e=parseExplicitDbDirectory(_0x10b23b);if(_0x42431e!=null)return{'dbId':_0x42431e,'dbName':await getDbName(_0x3e510e,_0x42431e)[_0x3edae2(0xda)](()=>undefined)};const _0x20f145=await listDatabases(_0x3e510e),_0x140dc5=_0x20f145[_0x3edae2(0x101)](_0x50693b=>buildDbDirectoryName(_0x50693b['dbName'],_0x50693b[_0x3edae2(0xf6)])===_0x10b23b);if(_0x140dc5[_0x3edae2(0xf5)]===0x1)return{'dbId':_0x140dc5[0x0][_0x3edae2(0xf6)],'dbName':_0x140dc5[0x0]['dbName']};if(_0x140dc5['length']===0x0)throw CliErrors['validation'](_0x3edae2(0xd7)+_0x10b23b+_0x3edae2(0xdd)+_0x1b65c6[_0x3edae2(0x108)]+'.');const _0xa65b24=_0x140dc5[_0x3edae2(0xd0)](_0x594d0e=>_0x594d0e[_0x3edae2(0xe0)]+'\x20('+_0x594d0e[_0x3edae2(0xf6)]+')')[_0x3edae2(0xef)](',\x20');throw CliErrors[_0x3edae2(0x114)](_0x3edae2(0xfe)+_0x10b23b+'\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20'+_0x1b65c6[_0x3edae2(0x108)]+':\x20'+_0xa65b24);}function parseExplicitDbDirectory(_0x569bb1){const _0x1d023d=a193_0x5e27b5,_0x4e5b90=/^db-(\d+)$/[_0x1d023d(0xd8)](_0x569bb1);if(!_0x4e5b90)return null;const _0x5ba52a=Number(_0x4e5b90[0x1]);return Number[_0x1d023d(0xce)](_0x5ba52a)&&_0x5ba52a>0x0?_0x5ba52a:null;}
|
|
1
|
+
const a191_0x17b999=a191_0x51d8;function a191_0x51d8(_0x27fe08,_0x49f33d){_0x27fe08=_0x27fe08-0x149;const _0x5574f5=a191_0x5574();let _0x51d841=_0x5574f5[_0x27fe08];return _0x51d841;}(function(_0x1d4364,_0xfec6b0){const _0x421d6c=a191_0x51d8,_0x482a45=_0x1d4364();while(!![]){try{const _0x5b2e08=parseInt(_0x421d6c(0x16e))/0x1+parseInt(_0x421d6c(0x14c))/0x2*(-parseInt(_0x421d6c(0x163))/0x3)+parseInt(_0x421d6c(0x186))/0x4*(parseInt(_0x421d6c(0x14b))/0x5)+-parseInt(_0x421d6c(0x18a))/0x6+-parseInt(_0x421d6c(0x170))/0x7*(parseInt(_0x421d6c(0x156))/0x8)+-parseInt(_0x421d6c(0x182))/0x9+-parseInt(_0x421d6c(0x150))/0xa*(-parseInt(_0x421d6c(0x16c))/0xb);if(_0x5b2e08===_0xfec6b0)break;else _0x482a45['push'](_0x482a45['shift']());}catch(_0x53bfec){_0x482a45['push'](_0x482a45['shift']());}}}(a191_0x5574,0xc66cc));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_0x5574(){const _0x19c9a9=['relativePath','Push\x20local\x20SQL\x20files\x20to\x20remote','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','dbName','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','1152603eLkIFo','str','projectRoot','Local\x20SQL\x20not\x20found:\x20','4XFLGBU','path','hash','mode','8123514OrazQk','startsWith','sqls','trashDir','\x20pushed,\x20','4266855DKIsjh','1058584WpNaHz','bool','\x20skipped,\x20','catch','4561250pwZKIY','force','dbDirectory','replace','has','dbId','32TqwbIj','version','appCode','sqlName','sqlConfig','Would\x20push\x20','join','length','No\x20local\x20SQL\x20files\x20found.','filePath','validation','entries','\x22\x20for\x20sqlCode\x20','9SfFrdX','sqlRoot','unchanged','\x20failed','isFinite','message','get','lastSync','POST','77sSddaa','push','886740WYsaXo','sql','1838158vAUtkN','lockFilePath','sqlcode','Local\x20directory\x20\x22','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','filter','utf8','sqlRootDir','remoteId','sqlCode','toISOString','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock'];a191_0x5574=function(){return _0x19c9a9;};return a191_0x5574();}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';async function getTargetSqlQueries(_0x2848b9,_0x37482c,_0x141357){const _0x30c2d9=a191_0x51d8,_0x1d22c7=await scanLocalSqlQueries(_0x2848b9),_0x13773d=new Map();for(const _0x4ef966 of _0x1d22c7){if(_0x141357&&_0x4ef966['sqlCode']!==_0x141357)continue;const _0x7a46c3=_0x13773d[_0x30c2d9(0x169)](_0x4ef966[_0x30c2d9(0x17a)])??[];_0x7a46c3['push'](_0x4ef966),_0x13773d['set'](_0x4ef966['sqlCode'],_0x7a46c3);}if(_0x141357&&!_0x13773d[_0x30c2d9(0x154)](_0x141357))throw CliErrors[_0x30c2d9(0x160)](_0x30c2d9(0x185)+_0x141357);const _0x25adb5=[];for(const [_0x418e4f,_0x8ec646]of _0x13773d[_0x30c2d9(0x161)]()){if(_0x8ec646[_0x30c2d9(0x15d)]===0x1){_0x25adb5[_0x30c2d9(0x16d)](_0x8ec646[0x0]);continue;}const _0x309cd1=_0x37482c[_0x30c2d9(0x18c)][_0x418e4f],_0x34eb85=_0x309cd1?.[_0x30c2d9(0x187)],_0x35cf79=_0x34eb85?_0x8ec646[_0x30c2d9(0x176)](_0xbaac8a=>_0xbaac8a['relativePath']!==_0x34eb85):_0x8ec646;if(_0x309cd1&&_0x35cf79[_0x30c2d9(0x15d)]===0x1){_0x25adb5['push'](_0x35cf79[0x0]);continue;}throw CliErrors[_0x30c2d9(0x160)]('Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20'+_0x418e4f+_0x30c2d9(0x174));}return _0x25adb5;}export const sqlPush={'service':a191_0x17b999(0x16f),'command':'push','description':a191_0x17b999(0x17e),'risk':'write','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a191_0x17b999(0x151),'type':'boolean','description':a191_0x17b999(0x17c)}],async 'dryRun'(_0x5520af){const _0x3dcd3d=a191_0x17b999,_0x1be3d5=loadSqlProjectConfig(_0x5520af['appCode']),_0x313513=await readSqlLockFile(_0x1be3d5['lockFilePath']),{appLock:_0x58a42c}=ensureSqlLockScope(_0x313513??createEmptySqlLock(),_0x5520af[_0x3dcd3d(0x158)],_0x1be3d5[_0x3dcd3d(0x164)],_0x3dcd3d(0x16d)),_0x5d7c75=await getTargetSqlQueries(_0x1be3d5,_0x58a42c,_0x5520af['str'](_0x3dcd3d(0x172))||undefined),_0x3f8ccf=[];for(const _0x4c7f45 of _0x5d7c75){const _0x4ad9ad=await computeSqlFileHash(_0x4c7f45[_0x3dcd3d(0x15f)]),_0x510880=_0x58a42c[_0x3dcd3d(0x18c)][_0x4c7f45[_0x3dcd3d(0x17a)]],_0x173d06=!!_0x510880&&(_0x510880[_0x3dcd3d(0x187)]!==_0x4c7f45[_0x3dcd3d(0x17d)]||!!_0x4c7f45[_0x3dcd3d(0x159)]&&_0x510880[_0x3dcd3d(0x159)]!==_0x4c7f45['sqlName']);if(!_0x5520af[_0x3dcd3d(0x14d)](_0x3dcd3d(0x151))&&_0x510880&&_0x510880[_0x3dcd3d(0x188)]===_0x4ad9ad&&!_0x173d06)continue;_0x3f8ccf['push'](_0x4c7f45[_0x3dcd3d(0x17a)]);}return{'method':_0x3dcd3d(0x16b),'url':'/smartapi/custom/updateUserCustomSql','body':{'sqlCodes':_0x3f8ccf,'appCode':_0x5520af[_0x3dcd3d(0x158)]},'description':_0x3dcd3d(0x15b)+_0x3f8ccf[_0x3dcd3d(0x15d)]+'\x20SQL\x20file(s)'};},async 'execute'(_0x504cd4){const _0x5e834c=a191_0x17b999,_0x32920d=loadSqlProjectConfig(_0x504cd4[_0x5e834c(0x158)]),_0xeb5e24=await readSqlLockFile(_0x32920d[_0x5e834c(0x171)]),{lockData:_0x22b38e,appLock:_0x2b9a98}=ensureSqlLockScope(_0xeb5e24??createEmptySqlLock(),_0x504cd4[_0x5e834c(0x158)],_0x32920d[_0x5e834c(0x164)],_0x5e834c(0x16d)),_0x3fee78=await getTargetSqlQueries(_0x32920d,_0x2b9a98,_0x504cd4[_0x5e834c(0x183)](_0x5e834c(0x172))||undefined);if(_0x3fee78['length']===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x5e834c(0x15e)};const _0x45e6aa=[],_0x395e62=[],_0x4e9792=[];for(const _0x3a1fd3 of _0x3fee78){const _0x3fc554=_0x2b9a98[_0x5e834c(0x18c)][_0x3a1fd3[_0x5e834c(0x17a)]];if(!_0x3fc554){_0x4e9792[_0x5e834c(0x16d)]({'sqlCode':_0x3a1fd3[_0x5e834c(0x17a)],'error':_0x5e834c(0x17f)});continue;}try{const _0x2f0fe8=await computeSqlFileHash(_0x3a1fd3['filePath']),_0x2b7819=_0x3fc554[_0x5e834c(0x187)]!==_0x3a1fd3[_0x5e834c(0x17d)]||!!_0x3a1fd3['sqlName']&&_0x3fc554[_0x5e834c(0x159)]!==_0x3a1fd3[_0x5e834c(0x159)];if(!_0x504cd4[_0x5e834c(0x14d)](_0x5e834c(0x151))&&_0x3fc554['hash']===_0x2f0fe8&&!_0x2b7819){_0x395e62['push']({'sqlCode':_0x3a1fd3[_0x5e834c(0x17a)],'reason':_0x5e834c(0x165)});continue;}if(_0x3fc554[_0x5e834c(0x157)]==null){_0x4e9792[_0x5e834c(0x16d)]({'sqlCode':_0x3a1fd3['sqlCode'],'error':_0x5e834c(0x181)});continue;}const _0x9ce48e=await readFile(_0x3a1fd3[_0x5e834c(0x15f)],_0x5e834c(0x177)),_0x35f526=stripLocalSqlMetadata(_0x9ce48e,_0x3a1fd3[_0x5e834c(0x189)]),_0x11942d=_0x3a1fd3[_0x5e834c(0x159)]||_0x3fc554['sqlName'],_0x96b4ec=await resolveTargetDbBinding(_0x504cd4[_0x5e834c(0x158)],_0x3a1fd3,_0x3fc554),_0x526fef=await updateSqlQuery({'id':_0x3fc554[_0x5e834c(0x179)],'appCode':_0x504cd4[_0x5e834c(0x158)],'sqlCode':_0x3a1fd3[_0x5e834c(0x17a)],'sqlName':_0x11942d,'dbId':_0x96b4ec[_0x5e834c(0x155)],'version':_0x3fc554[_0x5e834c(0x157)],'sqlContent':_0x35f526,'sqlConfig':_0x3fc554[_0x5e834c(0x15a)]??undefined}),_0x1dd49f=_0x526fef[_0x5e834c(0x155)]?await getDbName(_0x504cd4[_0x5e834c(0x158)],Number(_0x526fef[_0x5e834c(0x155)]))[_0x5e834c(0x14f)](()=>_0x96b4ec[_0x5e834c(0x180)]):_0x96b4ec[_0x5e834c(0x180)];_0x2b9a98[_0x5e834c(0x18c)][_0x3a1fd3[_0x5e834c(0x17a)]]={...buildSqlLockEntry(_0x526fef,_0x35f526,_0x2f0fe8,{'dbName':_0x1dd49f}),'path':_0x3a1fd3[_0x5e834c(0x17d)],'mode':_0x3fc554[_0x5e834c(0x189)]},await archivePreviousSqlFileIfNeeded(_0x32920d,_0x3fc554[_0x5e834c(0x187)],_0x3a1fd3[_0x5e834c(0x17d)]),_0x45e6aa[_0x5e834c(0x16d)]({'sqlCode':_0x3a1fd3['sqlCode'],'remoteId':_0x3fc554[_0x5e834c(0x179)]});}catch(_0x5f377d){_0x4e9792['push']({'sqlCode':_0x3a1fd3['sqlCode'],'error':_0x5f377d instanceof Error?_0x5f377d[_0x5e834c(0x168)]:String(_0x5f377d)});}}return _0x2b9a98[_0x5e834c(0x16a)]=new Date()[_0x5e834c(0x17b)](),await writeSqlLockFile(_0x32920d[_0x5e834c(0x171)],_0x22b38e),{'ok':_0x4e9792[_0x5e834c(0x15d)]===0x0,'data':{'pushed':_0x45e6aa,'skipped':_0x395e62,'failed':_0x4e9792},'message':'Push\x20complete:\x20'+_0x45e6aa[_0x5e834c(0x15d)]+_0x5e834c(0x14a)+_0x395e62['length']+_0x5e834c(0x14e)+_0x4e9792[_0x5e834c(0x15d)]+_0x5e834c(0x166)};}};async function archivePreviousSqlFileIfNeeded(_0x4bdc02,_0x4a4cf1,_0x41daad){const _0x56f391=a191_0x17b999;if(!_0x4a4cf1||_0x4a4cf1===_0x41daad)return;const _0x1ccd78=join(_0x4bdc02[_0x56f391(0x178)],_0x4a4cf1);if(!await fileExists(_0x1ccd78))return;const _0x761dc3=await moveToTrash(_0x4bdc02[_0x56f391(0x184)],_0x4bdc02[_0x56f391(0x149)],_0x1ccd78);await cleanupEmptyDirectories(dirname(_0x1ccd78),_0x4bdc02[_0x56f391(0x178)]),void _0x761dc3;}async function moveToTrash(_0x19c825,_0x5c07ab,_0x40d6b6){const _0x3cdeb6=a191_0x17b999,_0x5f278e=new Date()[_0x3cdeb6(0x17b)]()[_0x3cdeb6(0x153)](/[:.]/g,'-'),_0x294f54=relative(_0x19c825,_0x40d6b6),_0x199f26=join(_0x5c07ab,_0x5f278e,_0x294f54);return await mkdir(dirname(_0x199f26),{'recursive':!![]}),await rename(_0x40d6b6,_0x199f26),_0x199f26;}async function cleanupEmptyDirectories(_0x38d561,_0xad2097){const _0x55bb3e=a191_0x17b999;let _0xf3026c=resolve(_0x38d561);const _0x2dbdd6=resolve(_0xad2097);while(_0xf3026c[_0x55bb3e(0x18b)](''+_0x2dbdd6+sep)||_0xf3026c===_0x2dbdd6){if(_0xf3026c===_0x2dbdd6)return;try{const _0x8b2852=await readdir(_0xf3026c);if(_0x8b2852[_0x55bb3e(0x15d)]>0x0)return;await rmdir(_0xf3026c);}catch{return;}_0xf3026c=dirname(_0xf3026c);}}async function resolveTargetDbBinding(_0x65488c,_0x3a0893,_0x4877a1){const _0x3c4105=a191_0x17b999,_0x3c58c3=_0x3a0893[_0x3c4105(0x152)];if(!_0x3c58c3)return{'dbId':_0x4877a1[_0x3c4105(0x155)],'dbName':_0x4877a1['dbName']};const _0x42de67=buildDbDirectoryName(_0x4877a1[_0x3c4105(0x180)],_0x4877a1['dbId']);if(_0x3c58c3===_0x42de67)return{'dbId':_0x4877a1[_0x3c4105(0x155)],'dbName':_0x4877a1[_0x3c4105(0x180)]};const _0x1a12d1=parseExplicitDbDirectory(_0x3c58c3);if(_0x1a12d1!=null)return{'dbId':_0x1a12d1,'dbName':await getDbName(_0x65488c,_0x1a12d1)[_0x3c4105(0x14f)](()=>undefined)};const _0x59b4dd=await listDatabases(_0x65488c),_0x21b7a8=_0x59b4dd[_0x3c4105(0x176)](_0x19c86d=>buildDbDirectoryName(_0x19c86d[_0x3c4105(0x180)],_0x19c86d[_0x3c4105(0x155)])===_0x3c58c3);if(_0x21b7a8[_0x3c4105(0x15d)]===0x1)return{'dbId':_0x21b7a8[0x0]['dbId'],'dbName':_0x21b7a8[0x0][_0x3c4105(0x180)]};if(_0x21b7a8[_0x3c4105(0x15d)]===0x0)throw CliErrors[_0x3c4105(0x160)]('No\x20database\x20matches\x20local\x20directory\x20\x22'+_0x3c58c3+_0x3c4105(0x162)+_0x3a0893[_0x3c4105(0x17a)]+'.');const _0x62254b=_0x21b7a8['map'](_0x255a3e=>_0x255a3e[_0x3c4105(0x180)]+'\x20('+_0x255a3e[_0x3c4105(0x155)]+')')[_0x3c4105(0x15c)](',\x20');throw CliErrors[_0x3c4105(0x160)](_0x3c4105(0x173)+_0x3c58c3+_0x3c4105(0x175)+_0x3a0893[_0x3c4105(0x17a)]+':\x20'+_0x62254b);}function parseExplicitDbDirectory(_0x1bb06b){const _0x4a616a=a191_0x17b999,_0x591920=/^db-(\d+)$/['exec'](_0x1bb06b);if(!_0x591920)return null;const _0x4d62f4=Number(_0x591920[0x1]);return Number[_0x4a616a(0x167)](_0x4d62f4)&&_0x4d62f4>0x0?_0x4d62f4:null;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a192_0x1bd8a5=a192_0x21ee;(function(_0x420bd3,_0x1197a8){const _0x41a482=a192_0x21ee,_0x4aa213=_0x420bd3();while(!![]){try{const _0x57cfcb=parseInt(_0x41a482(0x1ad))/0x1+-parseInt(_0x41a482(0x1c8))/0x2*(parseInt(_0x41a482(0x1b9))/0x3)+-parseInt(_0x41a482(0x1af))/0x4*(-parseInt(_0x41a482(0x1d0))/0x5)+parseInt(_0x41a482(0x1d5))/0x6*(-parseInt(_0x41a482(0x1d7))/0x7)+-parseInt(_0x41a482(0x1c1))/0x8*(-parseInt(_0x41a482(0x1ac))/0x9)+parseInt(_0x41a482(0x1cd))/0xa+-parseInt(_0x41a482(0x1bb))/0xb*(parseInt(_0x41a482(0x1cf))/0xc);if(_0x57cfcb===_0x1197a8)break;else _0x4aa213['push'](_0x4aa213['shift']());}catch(_0x37f9f3){_0x4aa213['push'](_0x4aa213['shift']());}}}(a192_0x52e7,0x1d23e));function a192_0x21ee(_0x1d5445,_0x487819){_0x1d5445=_0x1d5445-0x1ab;const _0x52e72d=a192_0x52e7();let _0x21ee89=_0x52e72d[_0x1d5445];return _0x21ee89;}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=a192_0x1bd8a5(0x1c4);export function buildSqlLockEntry(_0x386d8e,_0x3bb643,_0x47e1f0,_0x6b800f){const _0x17115b=a192_0x1bd8a5,_0x4456ff=detectSqlMode(_0x3bb643);return{'path':buildSqlRelativePath(_0x386d8e[_0x17115b(0x1d1)],_0x386d8e[_0x17115b(0x1c0)],_0x6b800f?.[_0x17115b(0x1cb)],_0x4456ff,_0x386d8e[_0x17115b(0x1b1)]),'hash':_0x47e1f0,'remoteId':_0x386d8e['id'],'version':_0x386d8e[_0x17115b(0x1bc)],'dbId':Number(_0x386d8e['dbId']),'dbName':_0x6b800f?.['dbName'],'sqlName':_0x386d8e[_0x17115b(0x1c0)],'sqlConfig':_0x386d8e[_0x17115b(0x1c7)]??undefined,'mode':_0x4456ff};}export function cloneSqlLockData(_0x899507){const _0x4767c2=a192_0x1bd8a5;return{'apps':Object['fromEntries'](Object[_0x4767c2(0x1ab)](_0x899507[_0x4767c2(0x1c6)])[_0x4767c2(0x1da)](([_0x256b15,_0x43f432])=>[_0x256b15,{'sqlRoot':_0x43f432[_0x4767c2(0x1ca)],'lastSync':_0x43f432[_0x4767c2(0x1b8)],'sqls':{..._0x43f432[_0x4767c2(0x1c9)]}}]))};}export function ensureRemoteSqlContent(_0x2dd5cb){const _0x49c083=a192_0x1bd8a5;return _0x2dd5cb[_0x49c083(0x1ce)]??'';}export function buildLocalSqlFileContent(_0x189619,_0x5cba12,_0x1a3950){const _0x3722da=a192_0x1bd8a5,_0x5df214=_0x1a3950?.[_0x3722da(0x1b7)]??detectSqlMode(_0x5cba12),_0x33c546=stripLocalSqlMetadata(_0x5cba12,_0x5df214)['trim'](),_0x47719e=[...buildMetadataHeaderLines({'sqlCode':_0x189619[_0x3722da(0x1d1)],'sqlName':_0x189619[_0x3722da(0x1c0)],'dbId':_0x189619[_0x3722da(0x1b1)],'dbName':_0x1a3950?.[_0x3722da(0x1cb)],'mode':_0x5df214,'syncedAt':_0x1a3950?.[_0x3722da(0x1c2)],'description':_0x1a3950?.[_0x3722da(0x1b2)]},_0x5df214),'',_0x33c546],_0x5396a2=_0x47719e[_0x3722da(0x1d9)]('\x0a');return _0x5396a2['endsWith']('\x0a')?_0x5396a2:_0x5396a2+'\x0a';}export function stripLocalSqlMetadata(_0x194365,_0x17b607){const _0x3db9fc=a192_0x1bd8a5,_0x5a3502=_0x194365[_0x3db9fc(0x1c5)](/\r\n/g,'\x0a')[_0x3db9fc(0x1d4)]('\x0a'),_0x1fab36=[];let _0x5bb286=0x0;if(_0x17b607===_0x3db9fc(0x1b5))while(_0x5bb286<_0x5a3502['length']){const _0x130653=_0x5a3502[_0x5bb286]??'';if(/^\s*<!--\s*@lovrabet\./['test'](_0x130653)){_0x5bb286++;continue;}if(_0x130653[_0x3db9fc(0x1d6)]()===''&&_0x5bb286>0x0){_0x5bb286++;continue;}break;}else while(_0x5bb286<_0x5a3502[_0x3db9fc(0x1ba)]){const _0x2f3d0a=_0x5a3502[_0x5bb286]??'';if(/^\s*--\s*@lovrabet\./['test'](_0x2f3d0a)){_0x5bb286++;continue;}if(_0x2f3d0a['trim']()===''&&_0x5bb286>0x0){_0x5bb286++;continue;}break;}for(;_0x5bb286<_0x5a3502[_0x3db9fc(0x1ba)];_0x5bb286++){_0x1fab36[_0x3db9fc(0x1d2)](_0x5a3502[_0x5bb286]);}return _0x1fab36[_0x3db9fc(0x1d9)]('\x0a')[_0x3db9fc(0x1be)]();}export function resolveSqlMode(_0x7dbae1,_0x3546cd){if(_0x3546cd?.['mode'])return _0x3546cd['mode'];return detectSqlMode(_0x7dbae1);}function a192_0x52e7(){const _0x475198=['132pGQVKN','version','\x20-->','trimStart','path','sqlName','8gSOdEp','syncedAt','<!--\x20@lovrabet.','.rabetbase/sql','replace','apps','sqlConfig','20926lOnYPF','sqls','sqlRoot','dbName','--\x20@lovrabet.','1547440OjqXtP','sqlContent','36444xcmwOG','2550eotwjK','sqlCode','push','filter','split','159702ktfMcV','trim','35TkpXbl','close','join','map','entries','46242ilsbYm','135468YvtGun','toLowerCase','852eHRgpC','includes','dbId','description','yes','\x20[y/N]\x20','mybatisXml','stdin','mode','lastSync','33mjkzXZ','length'];a192_0x52e7=function(){return _0x475198;};return a192_0x52e7();}export function resolveSqlFileName(_0x1d3850,_0x1af753,_0x3d132a){const _0x2bfcc6=a192_0x1bd8a5;if(_0x3d132a?.['path'])return _0x3d132a[_0x2bfcc6(0x1bf)];if(_0x3d132a?.[_0x2bfcc6(0x1c0)]||_0x3d132a?.['dbName'])return buildSqlRelativePath(_0x1d3850,_0x3d132a?.[_0x2bfcc6(0x1c0)],_0x3d132a?.[_0x2bfcc6(0x1cb)],resolveSqlMode(_0x1af753,_0x3d132a),_0x3d132a?.[_0x2bfcc6(0x1b1)]);return buildDefaultSqlFileName(_0x1d3850,resolveSqlMode(_0x1af753,_0x3d132a));}export function resolveSqlLocalDir(_0x59779f,_0x2a5742){return join(_0x59779f,SQL_LOCAL_REL_DIR,_0x2a5742);}export async function confirmForceOverwrite(_0x18c8d){const _0x43baa8=a192_0x1bd8a5,_0x4fd989=createInterface({'input':process[_0x43baa8(0x1b6)],'output':process['stderr']}),_0x270040=await new Promise(_0x375910=>{const _0xe045a8=_0x43baa8;_0x4fd989['question'](_0x18c8d+_0xe045a8(0x1b4),_0x375910);});return _0x4fd989[_0x43baa8(0x1d8)](),['y',_0x43baa8(0x1b3)][_0x43baa8(0x1b0)](_0x270040['trim']()[_0x43baa8(0x1ae)]());}export function findSqlLockScope(_0x24526a,_0x189e39){const _0x6a4cd2=a192_0x1bd8a5;return _0x24526a[_0x6a4cd2(0x1c6)][_0x189e39];}function buildMetadataHeaderLines(_0xb017d4,_0x307d11){const _0x5bef63=a192_0x1bd8a5,_0x56239c=[[_0x5bef63(0x1d1),_0xb017d4[_0x5bef63(0x1d1)]],[_0x5bef63(0x1c0),_0xb017d4[_0x5bef63(0x1c0)]],['dbId',_0xb017d4[_0x5bef63(0x1b1)]],['dbName',_0xb017d4[_0x5bef63(0x1cb)]],['mode',_0xb017d4[_0x5bef63(0x1b7)]],[_0x5bef63(0x1c2),_0xb017d4[_0x5bef63(0x1c2)]],[_0x5bef63(0x1b2),_0xb017d4[_0x5bef63(0x1b2)]]];if(_0x307d11===_0x5bef63(0x1b5))return _0x56239c[_0x5bef63(0x1d3)](([,_0x27f6a3])=>_0x27f6a3!==undefined&&_0x27f6a3!==null&&String(_0x27f6a3)['trim']()!=='')[_0x5bef63(0x1da)](([_0x5163e1,_0x1e0270])=>_0x5bef63(0x1c3)+_0x5163e1+':\x20'+String(_0x1e0270)+_0x5bef63(0x1bd));return _0x56239c[_0x5bef63(0x1d3)](([,_0x580588])=>_0x580588!==undefined&&_0x580588!==null&&String(_0x580588)[_0x5bef63(0x1d6)]()!=='')[_0x5bef63(0x1da)](([_0x2a56cf,_0xf4ae37])=>_0x5bef63(0x1cc)+_0x2a56cf+':\x20'+String(_0xf4ae37));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a193_0x493ddd=a193_0x33f4;(function(_0x13dca2,_0x31ee17){const _0x2cb2fe=a193_0x33f4,_0x283f46=_0x13dca2();while(!![]){try{const _0x467863=parseInt(_0x2cb2fe(0x16c))/0x1+-parseInt(_0x2cb2fe(0x17e))/0x2*(parseInt(_0x2cb2fe(0x174))/0x3)+parseInt(_0x2cb2fe(0x16e))/0x4*(-parseInt(_0x2cb2fe(0x176))/0x5)+-parseInt(_0x2cb2fe(0x185))/0x6+-parseInt(_0x2cb2fe(0x173))/0x7*(-parseInt(_0x2cb2fe(0x18a))/0x8)+parseInt(_0x2cb2fe(0x168))/0x9*(parseInt(_0x2cb2fe(0x18e))/0xa)+-parseInt(_0x2cb2fe(0x183))/0xb*(parseInt(_0x2cb2fe(0x16b))/0xc);if(_0x467863===_0x31ee17)break;else _0x283f46['push'](_0x283f46['shift']());}catch(_0x5e0f30){_0x283f46['push'](_0x283f46['shift']());}}}(a193_0x1078,0xea2b7));import{listSqlQueries}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';function a193_0x33f4(_0xcf5d62,_0x1040eb){_0xcf5d62=_0xcf5d62-0x168;const _0x1078f5=a193_0x1078();let _0x33f459=_0x1078f5[_0xcf5d62];return _0x33f459;}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(_0x6f4118){const _0x4ac58d=a193_0x33f4,_0x3bcbea=[];let _0x4d7adc=0x1;while(!![]){const _0x16f488=await listSqlQueries(_0x6f4118,{'currentPage':_0x4d7adc,'pageSize':PAGE_SIZE}),_0x5dc886=_0x16f488['tableData']??[];_0x3bcbea[_0x4ac58d(0x179)](..._0x5dc886[_0x4ac58d(0x178)](_0x1cb342=>_0x1cb342[_0x4ac58d(0x17c)]));if(_0x5dc886[_0x4ac58d(0x171)]===0x0)break;const _0x152086=_0x16f488[_0x4ac58d(0x188)]?.[_0x4ac58d(0x169)];if(_0x152086!=null?_0x3bcbea[_0x4ac58d(0x171)]>=_0x152086:_0x5dc886['length']<PAGE_SIZE)break;_0x4d7adc++;}return _0x3bcbea;}function a193_0x1078(){const _0x553d4a=['10hQWiug','17251497gIWuaR','totalCount','boolean','2943036hRhdgh','896815TXaDVl','sqlName','24zpYXns','\x20added,\x20','status','length','\x20remote-only','280322IVvZsf','465LdgwNV','hash','1390215dXzhuL','sqlRoot','map','push','sqls','lockKey','sqlCode','lockFilePath','134Wrmdga','relativePath','filePath','remote','Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally','11NzBztJ','bool','1746042pRIkwz','\x20missing,\x20','sql','paging','path','72WcVDSZ','appCode','\x20modified,\x20','All\x20SQL\x20queries\x20are\x20in\x20sync.'];a193_0x1078=function(){return _0x553d4a;};return a193_0x1078();}export const sqlStatus={'service':a193_0x493ddd(0x187),'command':a193_0x493ddd(0x170),'description':'Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','risk':'read','flags':[{'name':a193_0x493ddd(0x181),'type':a193_0x493ddd(0x16a),'description':a193_0x493ddd(0x182)}],async 'execute'(_0x4dfd78){const _0x485150=a193_0x493ddd,_0x145f24=loadSqlProjectConfig(_0x4dfd78[_0x485150(0x18b)]),_0xfe17ef=await readSqlLockFile(_0x145f24[_0x485150(0x17d)]),{appLock:_0xd74bdc}=ensureSqlLockScope(_0xfe17ef??createEmptySqlLock(),_0x145f24[_0x485150(0x18b)],_0x145f24[_0x485150(0x177)],'status'),_0x224ae5=await scanLocalSqlQueries(_0x145f24),_0x1e0351=[],_0x2d3d59=[],_0x10f183=[],_0x358f11=[],_0x23421b=new Set(_0x224ae5[_0x485150(0x178)](_0x5997a2=>_0x5997a2[_0x485150(0x17b)]));for(const _0x4596ed of _0x224ae5){const _0x3cac8a=await computeSqlFileHash(_0x4596ed[_0x485150(0x180)]),_0x52a29e=_0xd74bdc['sqls'][_0x4596ed['lockKey']],_0x334760=!!_0x52a29e&&_0x52a29e[_0x485150(0x189)]!==_0x4596ed[_0x485150(0x17f)],_0x4b1a5a=!!_0x52a29e&&!!_0x4596ed[_0x485150(0x16d)]&&_0x52a29e['sqlName']!==_0x4596ed[_0x485150(0x16d)];if(!_0x52a29e)_0x1e0351[_0x485150(0x179)](_0x4596ed[_0x485150(0x17b)]);else _0x52a29e[_0x485150(0x175)]!==_0x3cac8a||_0x334760||_0x4b1a5a?_0x2d3d59[_0x485150(0x179)](_0x4596ed[_0x485150(0x17b)]):_0x10f183[_0x485150(0x179)](_0x4596ed[_0x485150(0x17b)]);}for(const _0x30838a of Object['keys'](_0xd74bdc['sqls'])){!_0x23421b['has'](_0x30838a)&&_0x358f11[_0x485150(0x179)](_0x30838a);}const _0x2c99bf=[];if(_0x4dfd78[_0x485150(0x184)](_0x485150(0x181))){const _0x142d67=await fetchAllSqlCodes(_0x4dfd78[_0x485150(0x18b)]);for(const _0x469679 of _0x142d67){!_0x23421b['has'](_0x469679)&&!_0xd74bdc[_0x485150(0x17a)][_0x469679]&&_0x2c99bf['push'](_0x469679);}}const _0x339fa4=_0x1e0351[_0x485150(0x171)]===0x0&&_0x2d3d59[_0x485150(0x171)]===0x0&&_0x358f11[_0x485150(0x171)]===0x0&&_0x2c99bf[_0x485150(0x171)]===0x0;return{'ok':!![],'data':{'added':_0x1e0351,'modified':_0x2d3d59,'missing':_0x358f11,'unchanged':_0x10f183,'remoteOnly':_0x2c99bf},'message':_0x339fa4?_0x485150(0x18d):_0x1e0351[_0x485150(0x171)]+_0x485150(0x16f)+_0x2d3d59[_0x485150(0x171)]+_0x485150(0x18c)+_0x358f11['length']+_0x485150(0x186)+_0x10f183[_0x485150(0x171)]+'\x20unchanged'+(_0x2c99bf[_0x485150(0x171)]>0x0?',\x20'+_0x2c99bf['length']+_0x485150(0x172):'')};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a194_0x3ba603=a194_0x127d;(function(_0xef509c,_0x51cb0b){const _0x3d2c1d=a194_0x127d,_0x518af4=_0xef509c();while(!![]){try{const _0x51c563=-parseInt(_0x3d2c1d(0x150))/0x1*(parseInt(_0x3d2c1d(0x135))/0x2)+parseInt(_0x3d2c1d(0x11d))/0x3+-parseInt(_0x3d2c1d(0x13b))/0x4+parseInt(_0x3d2c1d(0x129))/0x5*(-parseInt(_0x3d2c1d(0x152))/0x6)+-parseInt(_0x3d2c1d(0x159))/0x7*(-parseInt(_0x3d2c1d(0x153))/0x8)+-parseInt(_0x3d2c1d(0x12f))/0x9*(parseInt(_0x3d2c1d(0x13a))/0xa)+parseInt(_0x3d2c1d(0x11b))/0xb;if(_0x51c563===_0x51cb0b)break;else _0x518af4['push'](_0x518af4['shift']());}catch(_0x13b2a4){_0x518af4['push'](_0x518af4['shift']());}}}(a194_0x44a3,0xb8648));import{readFileSync,existsSync}from'node:fs';function a194_0x44a3(){const _0x493997=['Comma-separated\x20dataset\x20codes\x20to\x20cross-check\x20table/column\x20names\x20against','reason','message','index_columns','40WoSwFI','columnNames','str','filter','flatMap','trim','27eeuISq','schema:','dbtableConfig','index_name','boolean','type','2131282jAKKaG','split','isDangerous','sqlType','length','1679970KzFhws','2382736aZpmEt','file','tables','dataset','--check-indexes\x20requires\x20--schemas.','bool','flagMissing','indexes','size','schemas','unshift','File\x20not\x20found:\x20','tableName','find','isSelectOnly','columns','valid','get','Validate\x20SQL\x20content\x20without\x20saving\x20(type\x20detection,\x20parameter\x20extraction,\x20optional\x20schema\x20check)','toLowerCase','parameters','1YRovXt','\x22\x20not\x20found\x20in\x20any\x20dataset','140478TRpOWl','8vaNQLN','cwd','isArray','Audit\x20top-level\x20JOIN\x20equality\x20predicates\x20against\x20dataset\x20index\x20metadata','check-indexes','name','2407034cUqvdH','14303432DyiwLn','map','4391154Lzykxu','sql','validation','validate','fields','primary','push','string'];a194_0x44a3=function(){return _0x493997;};return a194_0x44a3();}import{resolve}from'node:path';import{validateSql}from'../../core/sql-validator.js';function a194_0x127d(_0x1fb112,_0x2f7865){_0x1fb112=_0x1fb112-0x11b;const _0x44a327=a194_0x44a3();let _0x127da9=_0x44a327[_0x1fb112];return _0x127da9;}import{auditSqlJoinIndexes}from'../../core/sql-index-auditor.js';import{getDatasetDetail,listDatasets}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{assertDatasetIsDbTableBacked,filterDbTableBackedDatasets}from'../../commands/dataset/capability.js';export const sqlValidate={'service':a194_0x3ba603(0x11e),'command':a194_0x3ba603(0x120),'description':a194_0x3ba603(0x14d),'risk':'read','flags':[{'name':'file','type':a194_0x3ba603(0x124),'description':'Path\x20to\x20the\x20SQL\x20file\x20to\x20validate'},{'name':'sql','type':'string','description':'Inline\x20SQL\x20content\x20to\x20validate\x20(alternative\x20to\x20--file)'},{'name':a194_0x3ba603(0x144),'type':a194_0x3ba603(0x124),'description':a194_0x3ba603(0x125)},{'name':a194_0x3ba603(0x157),'type':a194_0x3ba603(0x133),'description':a194_0x3ba603(0x156)}],async 'execute'(_0x470783){const _0xfe6815=a194_0x3ba603,_0x43640c=_0x470783[_0xfe6815(0x12b)]('file'),_0x11d226=_0x470783[_0xfe6815(0x12b)]('sql'),_0x2510db=_0x470783[_0xfe6815(0x12b)](_0xfe6815(0x144)),_0x45e852=_0x470783[_0xfe6815(0x140)](_0xfe6815(0x157));if(!_0x43640c&&!_0x11d226)throw CliErrors[_0xfe6815(0x141)](_0xfe6815(0x13c),'Provide\x20--file\x20or\x20--sql');if(_0x45e852&&!_0x2510db)throw CliErrors[_0xfe6815(0x11f)](_0xfe6815(0x13f));let _0x139e4d;if(_0x43640c){const _0x15b05d=resolve(process[_0xfe6815(0x154)](),_0x43640c);if(!existsSync(_0x15b05d))throw CliErrors['validation'](_0xfe6815(0x146)+_0x15b05d);_0x139e4d=readFileSync(_0x15b05d,'utf-8');}else _0x139e4d=_0x11d226;const _0x491b1e=validateSql(_0x139e4d),_0x40a806={'valid':_0x491b1e[_0xfe6815(0x14b)],'sqlType':_0x491b1e['sqlType']['type'],'isSelectOnly':_0x491b1e[_0xfe6815(0x138)][_0xfe6815(0x149)],'isDangerous':_0x491b1e[_0xfe6815(0x138)][_0xfe6815(0x137)],'tables':_0x491b1e['tables'],'parameters':_0x491b1e[_0xfe6815(0x14f)],'message':_0x491b1e['message']};_0x491b1e['sqlType'][_0xfe6815(0x126)]&&(_0x40a806[_0xfe6815(0x126)]=_0x491b1e[_0xfe6815(0x138)]['reason']);if(_0x2510db&&_0x491b1e[_0xfe6815(0x14b)]){const _0x20403b=_0x2510db[_0xfe6815(0x136)](',')[_0xfe6815(0x11c)](_0xaf2c3b=>_0xaf2c3b[_0xfe6815(0x12e)]())['filter'](Boolean),_0x3a216f=[],_0x10be2f=[],_0x3be73e=filterDbTableBackedDatasets(await listDatasets(_0x470783['appCode'])),_0x5e78da=new Map(_0x3be73e[_0xfe6815(0x11c)](_0x1cd4eb=>[_0x1cd4eb[_0xfe6815(0x131)]?.[_0xfe6815(0x147)]?.['toLowerCase'](),_0x1cd4eb]));for(const _0x4b84bf of _0x491b1e[_0xfe6815(0x13d)]){const _0x3b48cb=_0x5e78da[_0xfe6815(0x14c)](_0x4b84bf[_0xfe6815(0x14e)]());!_0x3b48cb&&_0x3a216f[_0xfe6815(0x123)]('Table\x20\x22'+_0x4b84bf+_0xfe6815(0x151));}for(const _0x3fcfc9 of _0x20403b){let _0x208def;try{_0x208def=await getDatasetDetail(_0x3fcfc9);}catch{_0x3a216f['push']('Dataset\x20\x22'+_0x3fcfc9+'\x22\x20not\x20found\x20or\x20not\x20accessible');continue;}assertDatasetIsDbTableBacked(_0x208def,'SQL\x20schema\x20validation');const _0x303bca=Array[_0xfe6815(0x155)](_0x208def['fields'])?_0x208def[_0xfe6815(0x121)]:[],_0x56dc7d=new Set(_0x303bca[_0xfe6815(0x11c)](_0x3d3c32=>_0x3d3c32['name']?.[_0xfe6815(0x14e)]())),_0x350a9c=_0x208def['dbtableConfig']?.[_0xfe6815(0x147)]||_0x208def['tableName']||_0x3fcfc9;_0x40a806[_0xfe6815(0x130)+_0x350a9c]={'code':_0x3fcfc9,'tableName':_0x350a9c,'fieldCount':_0x56dc7d[_0xfe6815(0x143)],'fields':Array['from'](_0x56dc7d)};if(_0x45e852){const _0x2c24d5=normalizeDatasetIndexes(_0x208def);_0x10be2f[_0xfe6815(0x123)]({'tableName':_0x350a9c,..._0x2c24d5});}}_0x3a216f[_0xfe6815(0x139)]>0x0&&(_0x40a806['schemaWarnings']=_0x3a216f),_0x45e852&&(_0x40a806['joinAudit']=auditSqlJoinIndexes(_0x139e4d,_0x10be2f));}return{'ok':_0x491b1e[_0xfe6815(0x14b)],'data':_0x40a806,'message':_0x491b1e[_0xfe6815(0x127)]};}};function normalizeDatasetIndexes(_0x33a2c9){const _0x49771f=a194_0x3ba603,_0x4ac96e=Array[_0x49771f(0x155)](_0x33a2c9?.[_0x49771f(0x13e)]?.[_0x49771f(0x142)])?_0x33a2c9[_0x49771f(0x13e)][_0x49771f(0x142)]:Array[_0x49771f(0x155)](_0x33a2c9?.[_0x49771f(0x142)])?_0x33a2c9[_0x49771f(0x142)]:[],_0x3dc3a3=_0x4ac96e[_0x49771f(0x12d)](_0x4252cc=>{const _0xc12cff=_0x49771f,_0x553899=Array[_0xc12cff(0x155)](_0x4252cc?.['index_columns'])?_0x4252cc[_0xc12cff(0x128)]:Array[_0xc12cff(0x155)](_0x4252cc?.[_0xc12cff(0x12a)])?_0x4252cc[_0xc12cff(0x12a)]:Array[_0xc12cff(0x155)](_0x4252cc?.[_0xc12cff(0x14a)])?_0x4252cc['columns']:[],_0x329a16=_0x553899[_0xc12cff(0x12c)](_0x1a9acd=>typeof _0x1a9acd===_0xc12cff(0x124))[_0xc12cff(0x11c)](_0x40bc00=>_0x40bc00['trim']())[_0xc12cff(0x12c)](Boolean);if(_0x329a16['length']===0x0)return[];const _0x53dd98=[_0x4252cc?.['indexName'],_0x4252cc?.[_0xc12cff(0x132)],_0x4252cc?.[_0xc12cff(0x158)]][_0xc12cff(0x148)](_0x49b871=>typeof _0x49b871===_0xc12cff(0x124)&&_0x49b871['trim']()),_0x781552=[_0x4252cc?.['index_type'],_0x4252cc?.[_0xc12cff(0x134)]][_0xc12cff(0x148)](_0x2dbe69=>typeof _0x2dbe69===_0xc12cff(0x124)&&_0x2dbe69[_0xc12cff(0x12e)]());return[{..._0x53dd98?{'name':_0x53dd98[_0xc12cff(0x12e)]()}:{},..._0x781552?{'type':_0x781552[_0xc12cff(0x12e)]()}:{},'columns':_0x329a16}];}),_0x511d84=[..._0x3dc3a3],_0x4214ac=typeof _0x33a2c9?.['dbtableConfig']?.['pkField']==='string'?_0x33a2c9[_0x49771f(0x131)]['pkField'][_0x49771f(0x136)](',')[_0x49771f(0x11c)](_0x3c9410=>_0x3c9410[_0x49771f(0x12e)]())['filter'](Boolean):[];return _0x4214ac[_0x49771f(0x139)]>0x0&&_0x511d84[_0x49771f(0x145)]({'type':_0x49771f(0x122),'columns':_0x4214ac}),{'indexes':_0x511d84,'metadataAvailable':_0x3dc3a3['length']>0x0};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x56fc69,_0x39c2e2){const _0x3e1217=a195_0x2531,_0x3aabf1=_0x56fc69();while(!![]){try{const _0x6064d7=parseInt(_0x3e1217(0xff))/0x1*(-parseInt(_0x3e1217(0x102))/0x2)+-parseInt(_0x3e1217(0xfb))/0x3*(-parseInt(_0x3e1217(0x103))/0x4)+parseInt(_0x3e1217(0x106))/0x5*(parseInt(_0x3e1217(0xfc))/0x6)+-parseInt(_0x3e1217(0x100))/0x7*(-parseInt(_0x3e1217(0x104))/0x8)+parseInt(_0x3e1217(0xfd))/0x9*(-parseInt(_0x3e1217(0x105))/0xa)+-parseInt(_0x3e1217(0xfa))/0xb*(parseInt(_0x3e1217(0x101))/0xc)+parseInt(_0x3e1217(0xfe))/0xd*(parseInt(_0x3e1217(0x107))/0xe);if(_0x6064d7===_0x39c2e2)break;else _0x3aabf1['push'](_0x3aabf1['shift']());}catch(_0xf10259){_0x3aabf1['push'](_0x3aabf1['shift']());}}}(a195_0x3cb1,0x584cb));function a195_0x3cb1(){const _0x29bf73=['30EMqkhD','5834682PUbvUz','11sxUILn','198813Bxtsfa','276024krQhCO','9EZBHhZ','39DzqSbF','718987XMewxl','7brssht','1135620APVFcu','2puLezD','8MwAvqG','162872hXgBtQ','5039170JKMiNy'];a195_0x3cb1=function(){return _0x29bf73;};return a195_0x3cb1();}import{taskStatus}from'../../commands/task/status.js';function a195_0x2531(_0x535077,_0x451ad4){_0x535077=_0x535077-0xfa;const _0x3cb1b8=a195_0x3cb1();let _0x2531f6=_0x3cb1b8[_0x535077];return _0x2531f6;}export const taskDefinitions=[taskStatus];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a196_0x2e298c=a196_0x8cf8;(function(_0x1cbb07,_0x4cb332){const _0x3f29e1=a196_0x8cf8,_0x44d023=_0x1cbb07();while(!![]){try{const _0x26e4c5=parseInt(_0x3f29e1(0xc7))/0x1+parseInt(_0x3f29e1(0xb9))/0x2+parseInt(_0x3f29e1(0xbd))/0x3+-parseInt(_0x3f29e1(0xbc))/0x4*(parseInt(_0x3f29e1(0xc1))/0x5)+-parseInt(_0x3f29e1(0xc5))/0x6*(parseInt(_0x3f29e1(0xc0))/0x7)+parseInt(_0x3f29e1(0xbf))/0x8*(-parseInt(_0x3f29e1(0xbb))/0x9)+parseInt(_0x3f29e1(0xcb))/0xa;if(_0x26e4c5===_0x4cb332)break;else _0x44d023['push'](_0x44d023['shift']());}catch(_0x34f183){_0x44d023['push'](_0x44d023['shift']());}}}(a196_0x77ac,0xa14ff));import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a196_0x8cf8(_0x4f6562,_0x59bc3c){_0x4f6562=_0x4f6562-0xb8;const _0x77ac78=a196_0x77ac();let _0x8cf8e9=_0x77ac78[_0x4f6562];return _0x8cf8e9;}import{asyncTaskMessage,buildAsyncTaskStatusCommand,normalizeAsyncTask}from'../../commands/common/async-task.js';import{getAsyncTaskStatus}from'../../core/api-client.js';function a196_0x77ac(){const _0x9afad2=['912722aTTQpt','compress','539271iiWSBw','63500wfpEPd','750411jhLmbf','appCode','104gLWQtm','399kRYCZi','285zRDnlB','cookie','taskId','apiError','30006tRAslK','flagMissing','1110607SMgacD','read','str','Task\x20status\x20response\x20id\x20mismatch:\x20requested\x20','8125090DGgNzb','Query\x20an\x20asynchronous\x20task;\x20repeat\x20for\x20PENDING\x20or\x20PROCESSING\x20until\x20SUCCESS\x20or\x20FAILED','isTerminal','task-id'];a196_0x77ac=function(){return _0x9afad2;};return a196_0x77ac();}import{CliErrors}from'../../errors.js';export const taskStatus={'service':'task','command':'status','description':a196_0x2e298c(0xcc),'risk':a196_0x2e298c(0xc8),'defaultOutputFormat':a196_0x2e298c(0xba),'structuredErrors':!![],'flags':[{'name':a196_0x2e298c(0xb8),'type':'string','required':!![],'description':'Task\x20id\x20returned\x20by\x20an\x20asynchronous\x20platform\x20command'},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x29ae80){const _0x3e7754=a196_0x2e298c;if(!_0x29ae80['str'](_0x3e7754(0xb8))['trim']())throw CliErrors[_0x3e7754(0xc6)]('task-id');},async 'execute'(_0x2784c1){const _0x14b97f=a196_0x2e298c,_0x19677b=_0x2784c1[_0x14b97f(0xc9)]('task-id')['trim'](),_0x263b75=normalizeAsyncTask(await getAsyncTaskStatus(_0x19677b,_0x2784c1['appCode'],_0x2784c1[_0x14b97f(0xc2)]));if(_0x263b75[_0x14b97f(0xc3)]!==_0x19677b)throw CliErrors[_0x14b97f(0xc4)](_0x14b97f(0xca)+_0x19677b+',\x20received\x20'+_0x263b75[_0x14b97f(0xc3)]+'.');const _0x33be68=buildAsyncTaskStatusCommand(_0x263b75[_0x14b97f(0xc3)],_0x2784c1[_0x14b97f(0xbe)]);return{'ok':!![],'message':asyncTaskMessage(_0x263b75),'data':{'appCode':_0x2784c1[_0x14b97f(0xbe)],..._0x263b75,'query':_0x263b75[_0x14b97f(0xcd)]?null:{'command':_0x33be68}}};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a197_0x520d(_0x457252,_0x4b6c56){_0x457252=_0x457252-0x139;const _0x52ae69=a197_0x52ae();let _0x520dd4=_0x52ae69[_0x457252];return _0x520dd4;}(function(_0x550308,_0x21c474){const _0x1874da=a197_0x520d,_0x2ffdcf=_0x550308();while(!![]){try{const _0x3f3e2f=parseInt(_0x1874da(0x140))/0x1+-parseInt(_0x1874da(0x139))/0x2+-parseInt(_0x1874da(0x13a))/0x3*(parseInt(_0x1874da(0x13c))/0x4)+-parseInt(_0x1874da(0x13b))/0x5+parseInt(_0x1874da(0x13d))/0x6+parseInt(_0x1874da(0x141))/0x7+-parseInt(_0x1874da(0x13e))/0x8*(-parseInt(_0x1874da(0x13f))/0x9);if(_0x3f3e2f===_0x21c474)break;else _0x2ffdcf['push'](_0x2ffdcf['shift']());}catch(_0x42fa9f){_0x2ffdcf['push'](_0x2ffdcf['shift']());}}}(a197_0x52ae,0x9afb1));function a197_0x52ae(){const _0x15ae21=['477987PClfNt','5228555jCcedJ','4ceaqMM','6799650rawDZW','8TrEIJj','3461949HpNEBw','320676BniADt','7701519xOmjht','2197976fFISRj'];a197_0x52ae=function(){return _0x15ae21;};return a197_0x52ae();}import{tenantMembersListDefinition}from'../../commands/tenant/members-list.js';export const tenantDefinitions=[tenantMembersListDefinition];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a198_0x1185b5=a198_0x5a2e;(function(_0x3c6123,_0x15334c){const _0x3cd54c=a198_0x5a2e,_0x13ab48=_0x3c6123();while(!![]){try{const _0x216a6c=parseInt(_0x3cd54c(0x99))/0x1+-parseInt(_0x3cd54c(0x93))/0x2+parseInt(_0x3cd54c(0x94))/0x3+parseInt(_0x3cd54c(0x9f))/0x4*(parseInt(_0x3cd54c(0xa2))/0x5)+-parseInt(_0x3cd54c(0xa4))/0x6+-parseInt(_0x3cd54c(0x95))/0x7+parseInt(_0x3cd54c(0x9c))/0x8;if(_0x216a6c===_0x15334c)break;else _0x13ab48['push'](_0x13ab48['shift']());}catch(_0x1d63c4){_0x13ab48['push'](_0x13ab48['shift']());}}}(a198_0x18bd,0xa1bb5));import{listCurrentUserTenantMemberships,listTenantDirectoryMembers}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';function a198_0x18bd(){const _0x388c3b=['1828698CmyNXa','2518453kedVYA','tenant-code','flagMissing','List\x20members\x20of\x20a\x20tenant\x20available\x20to\x20the\x20current\x20account','20777oBHRdg','Pass\x20--tenant-code\x20<code>.','read','14465224nReMZl','string','\x20tenant\x20member(s)','859708VIHvms','length','members-list','5Bvpmrd','trim','5448666kbuNti','tenant','str','1446160nMRBSr'];a198_0x18bd=function(){return _0x388c3b;};return a198_0x18bd();}import{assertTenantAccessible,projectTenantMembers}from'../../commands/tenant/shared.js';function a198_0x5a2e(_0x1f9d5e,_0x4191ae){_0x1f9d5e=_0x1f9d5e-0x91;const _0x18bd41=a198_0x18bd();let _0x5a2e25=_0x18bd41[_0x1f9d5e];return _0x5a2e25;}export const tenantMembersListDefinition={'service':a198_0x1185b5(0x91),'command':a198_0x1185b5(0xa1),'description':a198_0x1185b5(0x98),'risk':a198_0x1185b5(0x9b),'requiresAuth':!![],'requiresAppCode':![],'structuredErrors':!![],'flags':[{'name':a198_0x1185b5(0x96),'type':a198_0x1185b5(0x9d),'required':!![],'description':'Exact\x20tenant\x20code'}],async 'validate'(_0x8e2457){const _0x2c321e=a198_0x1185b5;if(!_0x8e2457[_0x2c321e(0x92)](_0x2c321e(0x96))[_0x2c321e(0xa3)]())throw CliErrors[_0x2c321e(0x97)](_0x2c321e(0x96),_0x2c321e(0x9a));},async 'execute'(_0x10ab50){const _0x472c7c=a198_0x1185b5,_0xaa6613=_0x10ab50[_0x472c7c(0x92)]('tenant-code')[_0x472c7c(0xa3)](),_0x1b3cf9=await listCurrentUserTenantMemberships();assertTenantAccessible(_0xaa6613,_0x1b3cf9);const _0x30bf58=projectTenantMembers(await listTenantDirectoryMembers(_0xaa6613));return{'ok':!![],'data':{'tenantCode':_0xaa6613,'items':_0x30bf58,'totalCount':_0x30bf58[_0x472c7c(0xa0)]},'message':'Found\x20'+_0x30bf58['length']+_0x472c7c(0x9e)};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x207630,_0x52329c){const _0x5e28b7=a199_0x4d6c,_0x10c706=_0x207630();while(!![]){try{const _0x4d6643=-parseInt(_0x5e28b7(0xd8))/0x1+-parseInt(_0x5e28b7(0xdc))/0x2*(parseInt(_0x5e28b7(0xca))/0x3)+-parseInt(_0x5e28b7(0xd5))/0x4+parseInt(_0x5e28b7(0xd3))/0x5*(-parseInt(_0x5e28b7(0xda))/0x6)+-parseInt(_0x5e28b7(0xd6))/0x7*(-parseInt(_0x5e28b7(0xce))/0x8)+parseInt(_0x5e28b7(0xdf))/0x9*(-parseInt(_0x5e28b7(0xde))/0xa)+parseInt(_0x5e28b7(0xe0))/0xb;if(_0x4d6643===_0x52329c)break;else _0x10c706['push'](_0x10c706['shift']());}catch(_0x5d8593){_0x10c706['push'](_0x10c706['shift']());}}}(a199_0x2178,0x93cdc));function a199_0x4d6c(_0x47b4e8,_0xdf5edd){_0x47b4e8=_0x47b4e8-0xc6;const _0x2178f8=a199_0x2178();let _0x4d6ccd=_0x2178f8[_0x47b4e8];return _0x4d6ccd;}import{CliErrors}from'../../errors.js';function textOrNull(_0x1150ad){const _0x6a67bf=a199_0x4d6c,_0x3a4702=_0x1150ad?.[_0x6a67bf(0xc6)]();return _0x3a4702?_0x3a4702:null;}export function projectTenantMembers(_0x4e8677){const _0x42960b=a199_0x4d6c,_0x2cd37f=new Map();for(const _0x556fef of _0x4e8677){const _0x1edc0a=Number(_0x556fef[_0x42960b(0xe2)]);if(!Number[_0x42960b(0xcd)](_0x1edc0a)||_0x1edc0a<=0x0)continue;const _0xc29cc={'userId':_0x1edc0a,'username':textOrNull(_0x556fef[_0x42960b(0xc7)]),'displayName':textOrNull(_0x556fef[_0x42960b(0xcc)]),'role':_0x556fef[_0x42960b(0xc9)]===!![]?_0x42960b(0xd7):'MEMBER','status':textOrNull(_0x556fef[_0x42960b(0xcf)])},_0x530d12=_0x2cd37f[_0x42960b(0xd1)](_0x1edc0a);if(!_0x530d12){_0x2cd37f[_0x42960b(0xd9)](_0x1edc0a,_0xc29cc);continue;}_0x530d12['username']??=_0xc29cc[_0x42960b(0xc7)],_0x530d12['displayName']??=_0xc29cc[_0x42960b(0xd4)],_0x530d12[_0x42960b(0xcf)]??=_0xc29cc[_0x42960b(0xcf)];if(_0xc29cc[_0x42960b(0xcb)]==='ADMIN')_0x530d12[_0x42960b(0xcb)]='ADMIN';}return[..._0x2cd37f[_0x42960b(0xc8)]()]['sort']((_0x273c10,_0xb305ac)=>_0x273c10[_0x42960b(0xe2)]-_0xb305ac[_0x42960b(0xe2)]);}export function assertTenantAccessible(_0x45d16c,_0x4e8079){const _0x34ebf9=a199_0x4d6c;if(_0x4e8079[_0x34ebf9(0xd2)](_0x30f617=>_0x30f617[_0x34ebf9(0xd0)]===_0x45d16c))return;throw CliErrors[_0x34ebf9(0xdd)]('Tenant\x20\x22'+_0x45d16c+_0x34ebf9(0xdb),_0x34ebf9(0xe1));}function a199_0x2178(){const _0x12f25d=['10SafGsQ','3918735WfzMWM','12885334ZZtfTh','Check\x20--tenant-code\x20or\x20login\x20with\x20an\x20account\x20that\x20belongs\x20to\x20this\x20tenant.','userId','trim','username','values','adminFlag','3OySXTP','role','nickname','isFinite','9234384rtNsCh','status','tenantCode','get','some','1141295HoxyPF','displayName','890660MTzViq','7StqCzb','ADMIN','413152DitEAl','set','12aDbCmG','\x22\x20is\x20not\x20available\x20to\x20the\x20current\x20account.','385076sPYDiL','validation'];a199_0x2178=function(){return _0x12f25d;};return a199_0x2178();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a200_0x345067=a200_0x13be;(function(_0x15607c,_0x50b36f){const _0x22c994=a200_0x13be,_0x414921=_0x15607c();while(!![]){try{const _0x130f23=parseInt(_0x22c994(0x104))/0x1+parseInt(_0x22c994(0x107))/0x2*(parseInt(_0x22c994(0x117))/0x3)+-parseInt(_0x22c994(0xff))/0x4*(parseInt(_0x22c994(0x108))/0x5)+parseInt(_0x22c994(0x100))/0x6+-parseInt(_0x22c994(0x103))/0x7+-parseInt(_0x22c994(0x109))/0x8+-parseInt(_0x22c994(0x10c))/0x9*(parseInt(_0x22c994(0x116))/0xa);if(_0x130f23===_0x50b36f)break;else _0x414921['push'](_0x414921['shift']());}catch(_0x3f7b26){_0x414921['push'](_0x414921['shift']());}}}(a200_0x9c88,0xa86a3));function a200_0x13be(_0xa4c268,_0x4d8639){_0xa4c268=_0xa4c268-0xfe;const _0x9c888c=a200_0x9c88();let _0x13befe=_0x9c888c[_0xa4c268];return _0x13befe;}import{asDryRunResult}from'../../commands/common/dry-run.js';import{bindDingTalkSandboxAccount,DING_TALK_SANDBOX_BIND_PATH}from'../../core/api-client.js';function a200_0x9c88(){const _0x3d93e2=['4396MfnHKI','929586xABAwa','dingding-sandbox-bind','string','972531ZuMHQq','1348004NHWxLW','POST','Bound\x20current\x20user\x20to\x20DingTalk\x20sandbox\x20account.','40kPaLAv','670HnQXSE','3340080pHEHoW','Bind\x20the\x20current\x20platform\x20user\x20to\x20a\x20DingTalk\x20sandbox\x20account','DingTalk\x20user\x20id\x20returned\x20by\x20the\x20sandbox','9GPFyin','dingtalk','validation','--ding-talk-user-id\x20cannot\x20be\x20empty.','The\x20current\x20binding\x20is\x20not\x20exposed\x20by\x20the\x20server;\x20before\x20is\x20unavailable.','apiError','ding-talk-user-id','user-account','write','bind','13096990dSgnFe','180045KveLEH','trim'];a200_0x9c88=function(){return _0x3d93e2;};return a200_0x9c88();}import{CliErrors}from'../../errors.js';const PROVIDER_ID=a200_0x345067(0x10d),CURRENT_BINDING_WARNING=a200_0x345067(0x110);function readDingTalkUserId(_0x1f9282){const _0x750985=a200_0x345067,_0x289138=_0x1f9282['str'](_0x750985(0x112))[_0x750985(0xfe)]();if(!_0x289138)throw CliErrors[_0x750985(0x10e)](_0x750985(0x10f),'Pass\x20the\x20DingTalk\x20user\x20id\x20returned\x20by\x20the\x20sandbox.');return _0x289138;}function buildBindingData(_0xf5e8cd,_0x2ff7e7){const _0x3d67eb=a200_0x345067;return{'operation':_0x3d67eb(0x115),'selector':{'providerId':PROVIDER_ID,'dingTalkUserId':_0xf5e8cd},'before':null,'after':{'providerId':PROVIDER_ID,'dingTalkUserId':_0xf5e8cd,'bound':!![]},'dryRun':_0x2ff7e7,'backend':{'method':'POST','path':DING_TALK_SANDBOX_BIND_PATH},'warnings':[CURRENT_BINDING_WARNING]};}export const dingTalkSandboxBind={'service':a200_0x345067(0x113),'command':a200_0x345067(0x101),'description':a200_0x345067(0x10a),'risk':a200_0x345067(0x114),'requiresAuth':!![],'requiresAppCode':![],'structuredErrors':!![],'flags':[{'name':a200_0x345067(0x112),'type':a200_0x345067(0x102),'required':!![],'description':a200_0x345067(0x10b)}],async 'validate'(_0x46392b){readDingTalkUserId(_0x46392b);},async 'dryRun'(_0x3f1070){const _0x2d3573=a200_0x345067,_0x5f49ec=readDingTalkUserId(_0x3f1070);return asDryRunResult(buildBindingData(_0x5f49ec,!![]),{'method':_0x2d3573(0x105),'url':DING_TALK_SANDBOX_BIND_PATH});},async 'execute'(_0x1636b5){const _0x35593a=a200_0x345067,_0x82aec=readDingTalkUserId(_0x1636b5),_0x33b510=await bindDingTalkSandboxAccount(_0x82aec);if(_0x33b510!==!![])throw CliErrors[_0x35593a(0x111)]('DingTalk\x20sandbox\x20account\x20binding\x20was\x20not\x20confirmed.','Retry\x20with\x20the\x20same\x20--ding-talk-user-id\x20only\x20after\x20checking\x20the\x20current\x20platform\x20session.');return{'ok':!![],'data':buildBindingData(_0x82aec,![]),'message':_0x35593a(0x106)};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x212259,_0x20c271){const _0x3b9946=a201_0x3909,_0x10b651=_0x212259();while(!![]){try{const _0x305b67=-parseInt(_0x3b9946(0x10a))/0x1*(parseInt(_0x3b9946(0x111))/0x2)+parseInt(_0x3b9946(0x110))/0x3+-parseInt(_0x3b9946(0x10e))/0x4*(parseInt(_0x3b9946(0x10b))/0x5)+parseInt(_0x3b9946(0x112))/0x6+-parseInt(_0x3b9946(0x10c))/0x7+-parseInt(_0x3b9946(0x10d))/0x8+parseInt(_0x3b9946(0x10f))/0x9;if(_0x305b67===_0x20c271)break;else _0x10b651['push'](_0x10b651['shift']());}catch(_0x1c7084){_0x10b651['push'](_0x10b651['shift']());}}}(a201_0x39dc,0x6ed35));function a201_0x3909(_0x2792ec,_0x1494fc){_0x2792ec=_0x2792ec-0x10a;const _0x39dcdf=a201_0x39dc();let _0x390973=_0x39dcdf[_0x2792ec];return _0x390973;}import{dingTalkSandboxBind}from'../../commands/user-account/dingding-sandbox-bind.js';export const userAccountDefinitions=[dingTalkSandboxBind];function a201_0x39dc(){const _0x665462=['3470915fiULma','3589856QNWmMg','3068vyKocv','11861766pwhWVQ','2132136nTdOiS','295766JlSOoP','479556LfidvK','1eVxjEH','3665qnsQDr'];a201_0x39dc=function(){return _0x665462;};return a201_0x39dc();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a202_0x4a4e(_0x5ec01f,_0x5adecd){_0x5ec01f=_0x5ec01f-0x101;const _0x36f541=a202_0x36f5();let _0x4a4e96=_0x36f541[_0x5ec01f];return _0x4a4e96;}function a202_0x36f5(){const _0x2621f1=['App\x20profile\x20name','10366086TrEfUq','3251314QkZnDX','workspace','102822CPUgwx','8941112RScxGg','16ScklBr','6476WWihOt','7EFtYjb','Register\x20an\x20app\x20profile\x20in\x20the\x20current\x20workspace\x20(or\x20--global)','878112EKOjdg','18181690jRHTNE','3590xLilJV','write','workspace\x20add','9fftSwZ'];a202_0x36f5=function(){return _0x2621f1;};return a202_0x36f5();}const a202_0x695af4=a202_0x4a4e;(function(_0x20c405,_0x3fb795){const _0x4b72ce=a202_0x4a4e,_0x14e5ba=_0x20c405();while(!![]){try{const _0x21780=-parseInt(_0x4b72ce(0x105))/0x1+-parseInt(_0x4b72ce(0x101))/0x2*(parseInt(_0x4b72ce(0x10f))/0x3)+parseInt(_0x4b72ce(0x102))/0x4*(parseInt(_0x4b72ce(0x107))/0x5)+-parseInt(_0x4b72ce(0x10c))/0x6*(parseInt(_0x4b72ce(0x103))/0x7)+parseInt(_0x4b72ce(0x110))/0x8*(parseInt(_0x4b72ce(0x10a))/0x9)+parseInt(_0x4b72ce(0x106))/0xa+-parseInt(_0x4b72ce(0x10d))/0xb;if(_0x21780===_0x3fb795)break;else _0x14e5ba['push'](_0x14e5ba['shift']());}catch(_0x344b81){_0x14e5ba['push'](_0x14e5ba['shift']());}}}(a202_0x36f5,0xe1443));import{buildAppAddFlags,runAppAdd,validateAppName}from'../../commands/common/app-registry.js';export const workspaceAddDefinition={'service':a202_0x695af4(0x10e),'command':'add','description':a202_0x695af4(0x104),'risk':a202_0x695af4(0x108),'requiresAuth':![],'requiresAppCode':![],'args':[{'name':'name','description':a202_0x695af4(0x10b),'required':!![]}],'flags':buildAppAddFlags(),'validate':_0x261741=>validateAppName(_0x261741,a202_0x695af4(0x109)),'execute':_0x37b42a=>runAppAdd(_0x37b42a,a202_0x695af4(0x109))};
|