@lovrabet/rabetbase-cli 2.5.0-beta.2 → 2.5.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/api-doc.js +1 -1
- package/lib/api/fetch-model-list.js +1 -1
- package/lib/api/generate-api-file.js +1 -1
- package/lib/api/generate-sdk-config-file.js +1 -1
- package/lib/auth/auth-server-ui.js +1 -1
- package/lib/auth/auth-server.js +1 -1
- package/lib/auth/constant.js +1 -1
- package/lib/auth/get-cookie.js +1 -1
- package/lib/auth/get-session-user.js +1 -1
- package/lib/auth/is-session-valid.js +1 -1
- package/lib/auth/login-success-html.js +1 -1
- package/lib/auth/logout.js +1 -1
- package/lib/cli-flags.js +1 -1
- package/lib/cli.js +1 -1
- package/lib/commands/api/generate.js +1 -1
- package/lib/commands/api/index.js +1 -1
- package/lib/commands/api/list.js +1 -1
- package/lib/commands/api/pull.js +1 -1
- package/lib/commands/api/shared.js +1 -1
- package/lib/commands/app/index.js +1 -1
- package/lib/commands/app/list.js +1 -1
- package/lib/commands/app/members-list.js +1 -1
- package/lib/commands/app/remote-directory.js +1 -1
- package/lib/commands/app/shared.js +1 -1
- package/lib/commands/app-config/delete.js +1 -1
- package/lib/commands/app-config/get.js +1 -1
- package/lib/commands/app-config/index.js +1 -1
- package/lib/commands/app-config/list.js +1 -1
- package/lib/commands/app-config/set.js +1 -1
- package/lib/commands/app-config/shared.js +1 -1
- package/lib/commands/auth/index.js +1 -1
- package/lib/commands/bff/create.js +1 -1
- package/lib/commands/bff/delete.js +1 -1
- package/lib/commands/bff/detail.js +1 -1
- package/lib/commands/bff/index.js +1 -1
- package/lib/commands/bff/list.js +1 -1
- package/lib/commands/bff/pull.js +1 -1
- package/lib/commands/bff/push.js +1 -1
- package/lib/commands/bff/status.js +1 -1
- package/lib/commands/cli-skill/index.js +1 -1
- package/lib/commands/cli-update.js +1 -1
- package/lib/commands/codegen/index.js +1 -1
- package/lib/commands/codegen/sdk.js +1 -1
- package/lib/commands/codegen/sql.js +1 -1
- package/lib/commands/common/app-registry.js +1 -1
- package/lib/commands/common/app-selector.js +1 -1
- package/lib/commands/common/async-task.js +1 -1
- package/lib/commands/common/dry-run.js +1 -1
- package/lib/commands/common/flags.js +1 -1
- package/lib/commands/common/local-file.js +1 -1
- package/lib/commands/common/validate.js +1 -1
- package/lib/commands/config/delete.js +1 -1
- package/lib/commands/config/get.js +1 -1
- package/lib/commands/config/index.js +1 -1
- package/lib/commands/config/init.js +1 -1
- package/lib/commands/config/list.js +1 -1
- package/lib/commands/config/set.js +1 -1
- package/lib/commands/config/shared.js +1 -1
- package/lib/commands/dataset/business-group-update.js +1 -1
- package/lib/commands/dataset/business-groups.js +1 -1
- package/lib/commands/dataset/capability.js +1 -1
- package/lib/commands/dataset/delete.js +1 -1
- package/lib/commands/dataset/detail.js +1 -1
- package/lib/commands/dataset/extend-update.js +1 -1
- package/lib/commands/dataset/field-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/table-diff-shared.d.ts +13 -0
- package/lib/commands/db/table-diff-shared.js +1 -0
- 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.js +1 -1
- package/lib/commands/project/create/materialize-project-template.js +1 -1
- package/lib/commands/project/create/project-name.js +1 -1
- package/lib/commands/project/create/project-template-archive.js +1 -1
- package/lib/commands/project/create/project-template-path.js +1 -1
- package/lib/commands/project/create/use-copy-project-template.js +1 -1
- package/lib/commands/project/create/use-format-code.js +1 -1
- package/lib/commands/project/create/use-install-dependencies.js +1 -1
- package/lib/commands/project/index.js +1 -1
- package/lib/commands/project/upgrade.js +1 -1
- package/lib/commands/registry.js +1 -1
- package/lib/commands/role/delete.js +1 -1
- package/lib/commands/role/detail.js +1 -1
- package/lib/commands/role/index.js +1 -1
- package/lib/commands/role/list.js +1 -1
- package/lib/commands/role/shared.js +1 -1
- package/lib/commands/role/update.js +1 -1
- package/lib/commands/role/user-add.js +1 -1
- package/lib/commands/role/user-remove.js +1 -1
- package/lib/commands/role/user-resolve.js +1 -1
- package/lib/commands/run/index.js +1 -1
- package/lib/commands/schema.js +1 -1
- package/lib/commands/sql/create.js +1 -1
- package/lib/commands/sql/delete.js +1 -1
- package/lib/commands/sql/detail.js +1 -1
- package/lib/commands/sql/exec.js +1 -1
- package/lib/commands/sql/index.js +1 -1
- package/lib/commands/sql/list.js +1 -1
- package/lib/commands/sql/pull.js +1 -1
- package/lib/commands/sql/push.js +1 -1
- package/lib/commands/sql/shared.js +1 -1
- package/lib/commands/sql/status.js +1 -1
- package/lib/commands/sql/validate.js +1 -1
- package/lib/commands/task/index.js +1 -1
- package/lib/commands/task/status.js +1 -1
- package/lib/commands/tenant/index.js +1 -1
- package/lib/commands/tenant/members-list.js +1 -1
- package/lib/commands/tenant/shared.js +1 -1
- package/lib/commands/user-account/dingding-sandbox-bind.js +1 -1
- package/lib/commands/user-account/index.js +1 -1
- package/lib/commands/workspace/add.js +1 -1
- package/lib/commands/workspace/index.js +1 -1
- package/lib/commands/workspace/remove.js +1 -1
- package/lib/config/domain-config.js +1 -1
- package/lib/config/schema.js +1 -1
- package/lib/constant/cdn.js +1 -1
- package/lib/constant/cli.js +1 -1
- package/lib/constant/defaults.js +1 -1
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/constant/output.js +1 -1
- package/lib/constant/paths.js +1 -1
- package/lib/constant/region.js +1 -1
- package/lib/constant/risk.js +1 -1
- package/lib/context/app-resolver.js +1 -1
- package/lib/context/auth-resolver.js +1 -1
- package/lib/context/config-loader.js +1 -1
- package/lib/context.js +1 -1
- package/lib/core/alias-resolver.js +1 -1
- package/lib/core/api-client.d.ts +1 -7
- package/lib/core/api-client.js +1 -1
- package/lib/core/bff/config.js +1 -1
- package/lib/core/bff/file-system.js +1 -1
- package/lib/core/bff/hash.js +1 -1
- package/lib/core/bff/lock.js +1 -1
- package/lib/core/bff/utils.js +1 -1
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/page/file-system.js +1 -1
- package/lib/core/page/hash.js +1 -1
- package/lib/core/page/lock.js +1 -1
- package/lib/core/sql-index-auditor.js +1 -1
- package/lib/core/sql-sync/config.js +1 -1
- package/lib/core/sql-sync/file-system.js +1 -1
- package/lib/core/sql-sync/hash.js +1 -1
- package/lib/core/sql-sync/lock.js +1 -1
- package/lib/core/sql-sync/utils.js +1 -1
- package/lib/core/sql-validator.js +1 -1
- package/lib/errors.js +1 -1
- package/lib/framework/build-all-flags.js +1 -1
- package/lib/framework/error-output.js +1 -1
- package/lib/framework/explicit-yes.js +1 -1
- package/lib/framework/flags.js +1 -1
- package/lib/framework/help.js +1 -1
- package/lib/framework/index.js +1 -1
- package/lib/framework/output.js +1 -1
- package/lib/framework/response.js +1 -1
- package/lib/framework/runner-alias.js +1 -1
- package/lib/framework/runner.js +1 -1
- package/lib/framework/schema-export.js +1 -1
- package/lib/framework/types.js +1 -1
- package/lib/generated/build-info.d.ts +4 -4
- package/lib/generated/build-info.js +1 -1
- package/lib/help.js +1 -1
- package/lib/postinstall.js +1 -1
- package/lib/runtime/confirmation.js +1 -1
- package/lib/runtime/event.js +1 -1
- package/lib/runtime/index.js +1 -1
- package/lib/runtime/queue.js +1 -1
- package/lib/runtime/resolve.js +1 -1
- package/lib/skills/builtin-skill.js +1 -1
- package/lib/skills/main.js +1 -1
- package/lib/skills/npx-skills-add.js +1 -1
- package/lib/skills/skill-presence.js +1 -1
- package/lib/telemetry/cli-command-trace.js +1 -1
- package/lib/telemetry/cli-help-trace.js +1 -1
- package/lib/telemetry/ensure-cli-otel-config.js +1 -1
- package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
- package/lib/telemetry/send-cli-trace-log.js +1 -1
- package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
- package/lib/utils/ai_config.js +1 -1
- package/lib/utils/apply-jq-filter.js +1 -1
- package/lib/utils/cdn-config.js +1 -1
- package/lib/utils/check-sdk-version.js +1 -1
- package/lib/utils/cli-version-check.js +1 -1
- package/lib/utils/cli-version-policy.js +1 -1
- package/lib/utils/config.js +1 -1
- package/lib/utils/entity-with-id.js +1 -1
- package/lib/utils/file-utils.js +1 -1
- package/lib/utils/guides-cdn.js +1 -1
- package/lib/utils/http-client.js +1 -1
- package/lib/utils/is-non-interactive.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/params.js +1 -1
- package/lib/utils/platform.js +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.js +1 -1
- package/lib/utils/update-notice.js +1 -1
- package/lib/utils/version.js +1 -1
- package/lib/utils/with-active-cookie.js +1 -1
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +1 -1
- package/skills/rabetbase/SKILL.md +6 -6
- package/skills/rabetbase/guides/custom-page-workflow.md +1 -1
- package/skills/rabetbase/guides/database-connection-workflow.md +9 -9
- package/skills/rabetbase/references/rabetbase-config.md +2 -3
- package/skills/rabetbase/references/rabetbase-db-analyze.md +2 -2
- package/skills/rabetbase/references/rabetbase-db-diff-refresh.md +4 -3
- package/skills/rabetbase/references/rabetbase-db-diff.md +7 -22
- package/skills/rabetbase/references/rabetbase-db-tables.md +14 -2
- package/skills/rabetbase/references/rabetbase-page-custom-list.md +5 -2
- package/skills/rabetbase.manifest.json +3 -3
package/lib/commands/sql/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
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);}
|
|
1
|
+
const a191_0x58ac86=a191_0xdc89;(function(_0x3401d2,_0x1a07fb){const _0xc10ce=a191_0xdc89,_0x295fe7=_0x3401d2();while(!![]){try{const _0x45c7f0=-parseInt(_0xc10ce(0x217))/0x1+parseInt(_0xc10ce(0x209))/0x2*(-parseInt(_0xc10ce(0x205))/0x3)+parseInt(_0xc10ce(0x218))/0x4*(-parseInt(_0xc10ce(0x20d))/0x5)+parseInt(_0xc10ce(0x20c))/0x6+-parseInt(_0xc10ce(0x216))/0x7+-parseInt(_0xc10ce(0x220))/0x8+parseInt(_0xc10ce(0x201))/0x9;if(_0x45c7f0===_0x1a07fb)break;else _0x295fe7['push'](_0x295fe7['shift']());}catch(_0x2ab059){_0x295fe7['push'](_0x295fe7['shift']());}}}(a191_0x372b,0x20ab6));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';function a191_0x372b(){const _0x1f86e5=['filter','sqlRoot','unchanged','dbId','utf8','246360ceteDq','sql','read','apps','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','skipped','message','cancelled','sqlRootDir','pull','test','name','totalCount','lockFilePath','catch','sqlcode','lastSync','Would\x20pull\x20','Force\x20overwrite\x20local\x20unsynced\x20changes','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','split','force','description','appCode','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','push','sqls','No\x20remote\x20SQL\x20queries\x20matched.','conflict','toISOString','trimStart','3113091bEJIwE','POST','\x20skipped,\x20','length','12VUHDGo','boolean','string','Pull\x20complete:\x20','71408HLeCHL','mybatisXml','join','289404fmPNFt','120830nDlUGK','would_pull','str','path','sqlName','\x20failed','paging','Filter\x20by\x20SQL\x20display\x20name','sqlContent','38325MtGAYm','57067yNhkul','4vZSznt','local\x20differs\x20from\x20remote','sqlCode'];a191_0x372b=function(){return _0x1f86e5;};return a191_0x372b();}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(_0x1ed783,_0x48e827){const _0x3304c8=a191_0xdc89,_0x123f9d=[];let _0x2ded90=0x1;while(!![]){const _0x317f68=await listSqlQueries(_0x1ed783,{'currentPage':_0x2ded90,'pageSize':PAGE_SIZE,'sqlCode':_0x48e827[_0x3304c8(0x21a)],'sqlName':_0x48e827['sqlName']}),_0x5dd854=_0x317f68['tableData']??[];_0x123f9d['push'](..._0x5dd854);if(_0x5dd854[_0x3304c8(0x204)]===0x0)break;const _0x203863=_0x317f68[_0x3304c8(0x213)]?.[_0x3304c8(0x22c)];if(_0x203863!=null?_0x123f9d['length']>=_0x203863:_0x5dd854['length']<PAGE_SIZE)break;_0x2ded90++;}return _0x123f9d;}async function ensureSqlContent(_0xcb8933){const _0x58ec2a=a191_0xdc89;if(_0xcb8933[_0x58ec2a(0x215)]!=null&&String(_0xcb8933[_0x58ec2a(0x215)])[_0x58ec2a(0x204)]>0x0)return _0xcb8933;return getSqlQueryDetail(_0xcb8933[_0x58ec2a(0x21a)]);}export const sqlPull={'service':a191_0x58ac86(0x221),'command':'pull','description':a191_0x58ac86(0x1f5),'risk':a191_0x58ac86(0x222),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a191_0x58ac86(0x22b),'type':a191_0x58ac86(0x207),'description':a191_0x58ac86(0x214)},{'name':'force','type':a191_0x58ac86(0x206),'description':a191_0x58ac86(0x1f4)}],async 'dryRun'(_0x47e60a){const _0x379995=a191_0x58ac86,_0x110ae1=loadSqlProjectConfig(_0x47e60a[_0x379995(0x1f9)]),_0x1f3f7e=await readSqlLockFile(_0x110ae1[_0x379995(0x22d)]),{appLock:_0x40998a}=ensureSqlLockScope(_0x1f3f7e??createEmptySqlLock(),_0x110ae1['appCode'],_0x110ae1[_0x379995(0x21c)],_0x379995(0x229)),_0x421132=await fetchAllSqlQueries(_0x47e60a[_0x379995(0x1f9)],{'sqlCode':_0x47e60a['str'](_0x379995(0x22f))||undefined,'sqlName':_0x47e60a['str'](_0x379995(0x22b))||undefined}),_0x4e9238=[];for(const _0xe2085b of _0x421132){const _0x36d75c=await ensureSqlContent(_0xe2085b),_0x3dd2a4=ensureRemoteSqlContent(_0x36d75c),_0x6fe0c5=detectModeFromSql(_0x36d75c),_0x5ee1c3=_0x36d75c['dbId']?await getDbName(_0x47e60a[_0x379995(0x1f9)],Number(_0x36d75c[_0x379995(0x21e)]))[_0x379995(0x22e)](()=>undefined):undefined,_0x7dd499=buildLocalSqlFileContent({'sqlCode':_0x36d75c[_0x379995(0x21a)],'sqlName':_0x36d75c['sqlName'],'dbId':_0x36d75c[_0x379995(0x21e)]},_0x3dd2a4,{'dbName':_0x5ee1c3,'mode':_0x6fe0c5,'syncedAt':new Date()[_0x379995(0x1ff)](),'description':_0x36d75c[_0x379995(0x1f8)]}),_0x19491b=buildSqlLockEntry(_0x36d75c,_0x3dd2a4,'',{'dbName':_0x5ee1c3}),_0x1cd8d8=resolveLocalSqlFilePath(_0x110ae1,_0x36d75c[_0x379995(0x21a)],_0x19491b);let _0x5436a1=_0x379995(0x20e),_0x2da16c;if(await fileExists(_0x1cd8d8)){const _0x52a829=await readFile(_0x1cd8d8,_0x379995(0x21f));isEquivalentPulledSqlFile(_0x52a829,_0x7dd499,_0x6fe0c5)?(_0x5436a1=_0x379995(0x225),_0x2da16c=_0x379995(0x21d)):(_0x5436a1=_0x379995(0x1fe),_0x2da16c='local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)');}_0x4e9238[_0x379995(0x1fb)]({'sqlCode':_0x36d75c['sqlCode'],'sqlName':_0x36d75c[_0x379995(0x211)],'filePath':_0x1cd8d8,'status':_0x5436a1,'reason':_0x2da16c});}return{'method':_0x379995(0x202),'url':_0x379995(0x1fa),'body':{'appCode':_0x47e60a[_0x379995(0x1f9)],'sqlCode':_0x47e60a[_0x379995(0x20f)](_0x379995(0x22f))||null,'sqlName':_0x47e60a[_0x379995(0x20f)](_0x379995(0x22b))||null,'files':_0x4e9238},'description':_0x379995(0x231)+_0x4e9238[_0x379995(0x204)]+'\x20SQL\x20file(s)\x20into\x20'+_0x110ae1['sqlRootDir']};},async 'execute'(_0x933158){const _0x44ee46=a191_0x58ac86,_0x27ce08=loadSqlProjectConfig(_0x933158[_0x44ee46(0x1f9)]),_0x58e66b=await readSqlLockFile(_0x27ce08['lockFilePath']),{lockData:_0x1190f,appLock:_0x59a255}=ensureSqlLockScope(_0x58e66b??createEmptySqlLock(),_0x27ce08['appCode'],_0x27ce08['sqlRoot'],_0x44ee46(0x229)),_0x587338=_0x933158['bool'](_0x44ee46(0x1f7)),_0x41d935=await fetchAllSqlQueries(_0x933158[_0x44ee46(0x1f9)],{'sqlCode':_0x933158['str'](_0x44ee46(0x22f))||undefined,'sqlName':_0x933158[_0x44ee46(0x20f)](_0x44ee46(0x22b))||undefined});if(_0x41d935['length']===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x44ee46(0x1fd)};const _0x3e6a61=[],_0x1c3499=[];for(const _0xffa419 of _0x41d935){try{_0x3e6a61[_0x44ee46(0x1fb)](await ensureSqlContent(_0xffa419));}catch(_0x61dfd3){_0x1c3499[_0x44ee46(0x1fb)]({'sqlCode':_0xffa419['sqlCode'],'error':_0x61dfd3 instanceof Error?_0x61dfd3[_0x44ee46(0x226)]:String(_0x61dfd3)});}}if(_0x587338&&!_0x933158['nonInteractive']){let _0x59323a=![];for(const _0x4d591f of _0x3e6a61){const _0x4fa9f9=detectModeFromSql(_0x4d591f),_0x281ff5=_0x4d591f['dbId']?await getDbName(_0x933158[_0x44ee46(0x1f9)],Number(_0x4d591f[_0x44ee46(0x21e)]))['catch'](()=>undefined):undefined,_0x14fe43=buildLocalSqlFileContent({'sqlCode':_0x4d591f[_0x44ee46(0x21a)],'sqlName':_0x4d591f[_0x44ee46(0x211)],'dbId':_0x4d591f[_0x44ee46(0x21e)]},ensureRemoteSqlContent(_0x4d591f),{'dbName':_0x281ff5,'mode':_0x4fa9f9,'syncedAt':new Date()[_0x44ee46(0x1ff)](),'description':_0x4d591f[_0x44ee46(0x1f8)]}),_0x1f8a91=resolveLocalSqlFilePath(_0x27ce08,_0x4d591f['sqlCode'],buildSqlLockEntry(_0x4d591f,ensureRemoteSqlContent(_0x4d591f),'',{'dbName':_0x281ff5}));if(await fileExists(_0x1f8a91)){const _0x436166=await readFile(_0x1f8a91,'utf8');if(!isEquivalentPulledSqlFile(_0x436166,_0x14fe43,_0x4fa9f9)){_0x59323a=!![];break;}}}if(_0x59323a){const _0x3f8641=await confirmForceOverwrite(_0x44ee46(0x224));if(!_0x3f8641)throw CliErrors[_0x44ee46(0x227)]('Force\x20pull\x20cancelled.');}}const _0x2e7e66=cloneSqlLockData(_0x1190f),_0x383719=_0x2e7e66[_0x44ee46(0x223)][_0x27ce08['appCode']],_0x53358c=[],_0x5b4705=[];for(const _0x5efc95 of _0x3e6a61){const _0x5eab2a=_0x383719[_0x44ee46(0x1fc)][_0x5efc95['sqlCode']],_0x672aa6=ensureRemoteSqlContent(_0x5efc95),_0x1fd425=detectModeFromSql(_0x5efc95),_0x2a121e=_0x5efc95[_0x44ee46(0x21e)]?await getDbName(_0x933158[_0x44ee46(0x1f9)],Number(_0x5efc95[_0x44ee46(0x21e)]))[_0x44ee46(0x22e)](()=>undefined):undefined,_0x26f558=buildLocalSqlFileContent({'sqlCode':_0x5efc95['sqlCode'],'sqlName':_0x5efc95['sqlName'],'dbId':_0x5efc95['dbId']},_0x672aa6,{'dbName':_0x2a121e,'mode':_0x1fd425,'syncedAt':new Date()[_0x44ee46(0x1ff)](),'description':_0x5efc95['description']}),_0x183872=buildSqlLockEntry(_0x5efc95,_0x672aa6,computeSqlContentHash(_0x26f558),{'dbName':_0x2a121e}),_0x5ad7d6=_0x183872[_0x44ee46(0x210)],_0x3fbaa8=join(_0x27ce08['sqlRootDir'],_0x5ad7d6);try{if(await fileExists(_0x3fbaa8)){const _0x4d156c=await readFile(_0x3fbaa8,'utf8');if(isEquivalentPulledSqlFile(_0x4d156c,_0x26f558,_0x1fd425)){_0x5b4705['push']({'sqlCode':_0x5efc95[_0x44ee46(0x21a)],'reason':_0x44ee46(0x21d)}),_0x383719[_0x44ee46(0x1fc)][_0x5efc95[_0x44ee46(0x21a)]]={..._0x183872,'hash':computeSqlContentHash(_0x4d156c),'path':_0x5ad7d6};continue;}if(!_0x587338){_0x5b4705['push']({'sqlCode':_0x5efc95[_0x44ee46(0x21a)],'reason':_0x44ee46(0x219)});continue;}}const _0x493c6f=_0x5eab2a?.[_0x44ee46(0x210)]?join(_0x27ce08[_0x44ee46(0x228)],_0x5eab2a[_0x44ee46(0x210)]):undefined;_0x493c6f&&_0x493c6f!==_0x3fbaa8&&await fileExists(_0x493c6f)&&await rm(_0x493c6f,{'force':!![]}),await ensureParentDirectory(_0x3fbaa8),await writeFile(_0x3fbaa8,_0x26f558,_0x44ee46(0x21f)),_0x383719['sqls'][_0x5efc95[_0x44ee46(0x21a)]]={..._0x183872,'path':_0x5ad7d6},_0x53358c[_0x44ee46(0x1fb)]({'sqlCode':_0x5efc95[_0x44ee46(0x21a)],'filePath':_0x3fbaa8});}catch(_0x2ce197){_0x1c3499[_0x44ee46(0x1fb)]({'sqlCode':_0x5efc95[_0x44ee46(0x21a)],'error':_0x2ce197 instanceof Error?_0x2ce197[_0x44ee46(0x226)]:String(_0x2ce197)});}}return _0x383719[_0x44ee46(0x230)]=new Date()[_0x44ee46(0x1ff)](),await writeSqlLockFile(_0x27ce08[_0x44ee46(0x22d)],_0x2e7e66),{'ok':_0x1c3499[_0x44ee46(0x204)]===0x0,'data':{'pulled':_0x53358c,'skipped':_0x5b4705,'failed':_0x1c3499},'message':_0x44ee46(0x208)+_0x53358c[_0x44ee46(0x204)]+'\x20written,\x20'+_0x5b4705[_0x44ee46(0x204)]+_0x44ee46(0x203)+_0x1c3499[_0x44ee46(0x204)]+_0x44ee46(0x212)};}};function detectModeFromSql(_0x4fd451){const _0x5debf8=a191_0x58ac86,_0x4b1602=ensureRemoteSqlContent(_0x4fd451),_0x7c62bf=stripLocalSqlMetadata(_0x4b1602,_0x5debf8(0x20a))[_0x5debf8(0x200)]();if(/^<(select|insert|update|delete)\b/i[_0x5debf8(0x22a)](_0x7c62bf))return'mybatisXml';return _0x5debf8(0x221);}function isEquivalentPulledSqlFile(_0xe09d0e,_0x2a30e8,_0x208866){return normalizePullComparableContent(_0xe09d0e,_0x208866)===normalizePullComparableContent(_0x2a30e8,_0x208866);}function normalizePullComparableContent(_0x1f499d,_0x464e91){const _0x3f3bed=a191_0x58ac86,_0x5df6d4=_0x1f499d['replace'](/\r\n/g,'\x0a')[_0x3f3bed(0x1f6)]('\x0a'),_0x3e6b9c=_0x5df6d4[_0x3f3bed(0x21b)](_0x3040a3=>!isSyncedAtMetadataLine(_0x3040a3,_0x464e91));return _0x3e6b9c[_0x3f3bed(0x20b)]('\x0a');}function a191_0xdc89(_0x31d038,_0x4e8b89){_0x31d038=_0x31d038-0x1f4;const _0x372b04=a191_0x372b();let _0xdc89c3=_0x372b04[_0x31d038];return _0xdc89c3;}function isSyncedAtMetadataLine(_0x13ca8b,_0x4fccdb){const _0x53a982=a191_0x58ac86;if(_0x4fccdb==='mybatisXml')return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x53a982(0x22a)](_0x13ca8b);return/^\s*--\s*@lovrabet\.syncedAt:/['test'](_0x13ca8b);}
|
package/lib/commands/sql/push.js
CHANGED
|
@@ -1 +1 @@
|
|
|
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
|
+
function a192_0x5e09(_0x29efec,_0x4eb3e2){_0x29efec=_0x29efec-0x150;const _0x5a090b=a192_0x5a09();let _0x5e09c6=_0x5a090b[_0x29efec];return _0x5e09c6;}const a192_0x5339b1=a192_0x5e09;(function(_0x1bb465,_0x11db58){const _0x2a6664=a192_0x5e09,_0x3c8af6=_0x1bb465();while(!![]){try{const _0x3a9c8d=parseInt(_0x2a6664(0x162))/0x1+parseInt(_0x2a6664(0x176))/0x2*(parseInt(_0x2a6664(0x15d))/0x3)+parseInt(_0x2a6664(0x16d))/0x4*(-parseInt(_0x2a6664(0x184))/0x5)+-parseInt(_0x2a6664(0x157))/0x6+-parseInt(_0x2a6664(0x186))/0x7+-parseInt(_0x2a6664(0x182))/0x8*(parseInt(_0x2a6664(0x166))/0x9)+parseInt(_0x2a6664(0x164))/0xa;if(_0x3a9c8d===_0x11db58)break;else _0x3c8af6['push'](_0x3c8af6['shift']());}catch(_0x1e5c1b){_0x3c8af6['push'](_0x3c8af6['shift']());}}}(a192_0x5a09,0xe7db9));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 a192_0x5a09(){const _0x4de5cd=['has','force','\x20pushed,\x20','projectRoot','925656ScrhSV','validation','31154450YfXFSB','appCode','7039485LLKmze','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','sqlName','sqls','No\x20local\x20SQL\x20files\x20found.','\x22\x20for\x20sqlCode\x20','relativePath','3891004zyHlMb','mode','trashDir','exec','version','\x20failed','push','str','catch','2fDIVvq','hash','filter','sqlRootDir','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','Would\x20push\x20','sql','sqlConfig','toISOString','set','dbName','\x20skipped,\x20','8uiTFDH','map','5OydTiz','utf8','12605929XGaaXr','sqlRoot','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','replace','bool','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','path','sqlcode','boolean','Push\x20complete:\x20','isFinite','filePath','remoteId','write','length','Local\x20SQL\x20not\x20found:\x20','dbId','Local\x20directory\x20\x22','get','\x20SQL\x20file(s)','lastSync','sqlCode','lockFilePath','1327980MhKnbI','No\x20database\x20matches\x20local\x20directory\x20\x22','unchanged','startsWith','Push\x20local\x20SQL\x20files\x20to\x20remote','entries','2057043kuPBVr'];a192_0x5a09=function(){return _0x4de5cd;};return a192_0x5a09();}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(_0x1f3836,_0x2ccc36,_0x344745){const _0xf2d598=a192_0x5e09,_0x16c455=await scanLocalSqlQueries(_0x1f3836),_0x6062a9=new Map();for(const _0x313e18 of _0x16c455){if(_0x344745&&_0x313e18[_0xf2d598(0x155)]!==_0x344745)continue;const _0x32270b=_0x6062a9[_0xf2d598(0x152)](_0x313e18[_0xf2d598(0x155)])??[];_0x32270b[_0xf2d598(0x173)](_0x313e18),_0x6062a9[_0xf2d598(0x17f)](_0x313e18[_0xf2d598(0x155)],_0x32270b);}if(_0x344745&&!_0x6062a9[_0xf2d598(0x15e)](_0x344745))throw CliErrors['validation'](_0xf2d598(0x195)+_0x344745);const _0x5d16ce=[];for(const [_0x2f7f0e,_0x3f3d13]of _0x6062a9[_0xf2d598(0x15c)]()){if(_0x3f3d13['length']===0x1){_0x5d16ce[_0xf2d598(0x173)](_0x3f3d13[0x0]);continue;}const _0x4cada6=_0x2ccc36[_0xf2d598(0x169)][_0x2f7f0e],_0x4a6de3=_0x4cada6?.[_0xf2d598(0x18c)],_0x1de1a2=_0x4a6de3?_0x3f3d13[_0xf2d598(0x178)](_0x2533f5=>_0x2533f5[_0xf2d598(0x16c)]!==_0x4a6de3):_0x3f3d13;if(_0x4cada6&&_0x1de1a2[_0xf2d598(0x194)]===0x1){_0x5d16ce[_0xf2d598(0x173)](_0x1de1a2[0x0]);continue;}throw CliErrors[_0xf2d598(0x163)]('Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20'+_0x2f7f0e+_0xf2d598(0x17a));}return _0x5d16ce;}export const sqlPush={'service':a192_0x5339b1(0x17c),'command':a192_0x5339b1(0x173),'description':a192_0x5339b1(0x15b),'risk':a192_0x5339b1(0x193),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'force','type':a192_0x5339b1(0x18e),'description':a192_0x5339b1(0x167)}],async 'dryRun'(_0x30e038){const _0x4392d8=a192_0x5339b1,_0xc2afba=loadSqlProjectConfig(_0x30e038[_0x4392d8(0x165)]),_0x253018=await readSqlLockFile(_0xc2afba[_0x4392d8(0x156)]),{appLock:_0x5aeec8}=ensureSqlLockScope(_0x253018??createEmptySqlLock(),_0x30e038[_0x4392d8(0x165)],_0xc2afba['sqlRoot'],_0x4392d8(0x173)),_0x46ee67=await getTargetSqlQueries(_0xc2afba,_0x5aeec8,_0x30e038[_0x4392d8(0x174)](_0x4392d8(0x18d))||undefined),_0x4ee249=[];for(const _0xe81319 of _0x46ee67){const _0xd70bcc=await computeSqlFileHash(_0xe81319[_0x4392d8(0x191)]),_0xcd89b3=_0x5aeec8[_0x4392d8(0x169)][_0xe81319[_0x4392d8(0x155)]],_0x3168d3=!!_0xcd89b3&&(_0xcd89b3['path']!==_0xe81319[_0x4392d8(0x16c)]||!!_0xe81319['sqlName']&&_0xcd89b3['sqlName']!==_0xe81319['sqlName']);if(!_0x30e038[_0x4392d8(0x18a)](_0x4392d8(0x15f))&&_0xcd89b3&&_0xcd89b3[_0x4392d8(0x177)]===_0xd70bcc&&!_0x3168d3)continue;_0x4ee249['push'](_0xe81319[_0x4392d8(0x155)]);}return{'method':'POST','url':'/smartapi/custom/updateUserCustomSql','body':{'sqlCodes':_0x4ee249,'appCode':_0x30e038[_0x4392d8(0x165)]},'description':_0x4392d8(0x17b)+_0x4ee249[_0x4392d8(0x194)]+_0x4392d8(0x153)};},async 'execute'(_0x3292f2){const _0x54c2d4=a192_0x5339b1,_0x834558=loadSqlProjectConfig(_0x3292f2[_0x54c2d4(0x165)]),_0x26d278=await readSqlLockFile(_0x834558[_0x54c2d4(0x156)]),{lockData:_0x67d28e,appLock:_0x43a802}=ensureSqlLockScope(_0x26d278??createEmptySqlLock(),_0x3292f2['appCode'],_0x834558[_0x54c2d4(0x187)],_0x54c2d4(0x173)),_0xf2484a=await getTargetSqlQueries(_0x834558,_0x43a802,_0x3292f2['str'](_0x54c2d4(0x18d))||undefined);if(_0xf2484a[_0x54c2d4(0x194)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x54c2d4(0x16a)};const _0xf0b2b9=[],_0x343ca7=[],_0x4274e7=[];for(const _0x2557cc of _0xf2484a){const _0x3d5a18=_0x43a802['sqls'][_0x2557cc[_0x54c2d4(0x155)]];if(!_0x3d5a18){_0x4274e7[_0x54c2d4(0x173)]({'sqlCode':_0x2557cc['sqlCode'],'error':'local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first'});continue;}try{const _0x3f6d6c=await computeSqlFileHash(_0x2557cc[_0x54c2d4(0x191)]),_0xf6e455=_0x3d5a18[_0x54c2d4(0x18c)]!==_0x2557cc['relativePath']||!!_0x2557cc['sqlName']&&_0x3d5a18[_0x54c2d4(0x168)]!==_0x2557cc[_0x54c2d4(0x168)];if(!_0x3292f2['bool'](_0x54c2d4(0x15f))&&_0x3d5a18['hash']===_0x3f6d6c&&!_0xf6e455){_0x343ca7[_0x54c2d4(0x173)]({'sqlCode':_0x2557cc[_0x54c2d4(0x155)],'reason':_0x54c2d4(0x159)});continue;}if(_0x3d5a18[_0x54c2d4(0x171)]==null){_0x4274e7[_0x54c2d4(0x173)]({'sqlCode':_0x2557cc[_0x54c2d4(0x155)],'error':_0x54c2d4(0x18b)});continue;}const _0xa0789f=await readFile(_0x2557cc[_0x54c2d4(0x191)],_0x54c2d4(0x185)),_0x52296d=stripLocalSqlMetadata(_0xa0789f,_0x2557cc[_0x54c2d4(0x16e)]),_0x4f8a69=_0x2557cc[_0x54c2d4(0x168)]||_0x3d5a18[_0x54c2d4(0x168)],_0x4562de=await resolveTargetDbBinding(_0x3292f2['appCode'],_0x2557cc,_0x3d5a18),_0x3c459f=await updateSqlQuery({'id':_0x3d5a18[_0x54c2d4(0x192)],'appCode':_0x3292f2[_0x54c2d4(0x165)],'sqlCode':_0x2557cc[_0x54c2d4(0x155)],'sqlName':_0x4f8a69,'dbId':_0x4562de['dbId'],'version':_0x3d5a18[_0x54c2d4(0x171)],'sqlContent':_0x52296d,'sqlConfig':_0x3d5a18[_0x54c2d4(0x17d)]??undefined}),_0x85f621=_0x3c459f[_0x54c2d4(0x150)]?await getDbName(_0x3292f2[_0x54c2d4(0x165)],Number(_0x3c459f[_0x54c2d4(0x150)]))[_0x54c2d4(0x175)](()=>_0x4562de[_0x54c2d4(0x180)]):_0x4562de[_0x54c2d4(0x180)];_0x43a802[_0x54c2d4(0x169)][_0x2557cc[_0x54c2d4(0x155)]]={...buildSqlLockEntry(_0x3c459f,_0x52296d,_0x3f6d6c,{'dbName':_0x85f621}),'path':_0x2557cc[_0x54c2d4(0x16c)],'mode':_0x3d5a18[_0x54c2d4(0x16e)]},await archivePreviousSqlFileIfNeeded(_0x834558,_0x3d5a18[_0x54c2d4(0x18c)],_0x2557cc[_0x54c2d4(0x16c)]),_0xf0b2b9[_0x54c2d4(0x173)]({'sqlCode':_0x2557cc[_0x54c2d4(0x155)],'remoteId':_0x3d5a18[_0x54c2d4(0x192)]});}catch(_0x34c12e){_0x4274e7[_0x54c2d4(0x173)]({'sqlCode':_0x2557cc[_0x54c2d4(0x155)],'error':_0x34c12e instanceof Error?_0x34c12e['message']:String(_0x34c12e)});}}return _0x43a802[_0x54c2d4(0x154)]=new Date()[_0x54c2d4(0x17e)](),await writeSqlLockFile(_0x834558[_0x54c2d4(0x156)],_0x67d28e),{'ok':_0x4274e7[_0x54c2d4(0x194)]===0x0,'data':{'pushed':_0xf0b2b9,'skipped':_0x343ca7,'failed':_0x4274e7},'message':_0x54c2d4(0x18f)+_0xf0b2b9[_0x54c2d4(0x194)]+_0x54c2d4(0x160)+_0x343ca7[_0x54c2d4(0x194)]+_0x54c2d4(0x181)+_0x4274e7[_0x54c2d4(0x194)]+_0x54c2d4(0x172)};}};async function archivePreviousSqlFileIfNeeded(_0x5f1b05,_0x3ea8eb,_0x485779){const _0x4ab6a5=a192_0x5339b1;if(!_0x3ea8eb||_0x3ea8eb===_0x485779)return;const _0x2105cd=join(_0x5f1b05[_0x4ab6a5(0x179)],_0x3ea8eb);if(!await fileExists(_0x2105cd))return;const _0x2eff19=await moveToTrash(_0x5f1b05[_0x4ab6a5(0x161)],_0x5f1b05[_0x4ab6a5(0x16f)],_0x2105cd);await cleanupEmptyDirectories(dirname(_0x2105cd),_0x5f1b05['sqlRootDir']),void _0x2eff19;}async function moveToTrash(_0x18bfdd,_0x3dcc6c,_0x2b5812){const _0x54364b=a192_0x5339b1,_0x2e6f6a=new Date()[_0x54364b(0x17e)]()[_0x54364b(0x189)](/[:.]/g,'-'),_0x25182b=relative(_0x18bfdd,_0x2b5812),_0x13c745=join(_0x3dcc6c,_0x2e6f6a,_0x25182b);return await mkdir(dirname(_0x13c745),{'recursive':!![]}),await rename(_0x2b5812,_0x13c745),_0x13c745;}async function cleanupEmptyDirectories(_0xc0e1c2,_0x1337ef){const _0x3e8d62=a192_0x5339b1;let _0x36732f=resolve(_0xc0e1c2);const _0x1fa64f=resolve(_0x1337ef);while(_0x36732f[_0x3e8d62(0x15a)](''+_0x1fa64f+sep)||_0x36732f===_0x1fa64f){if(_0x36732f===_0x1fa64f)return;try{const _0xa31618=await readdir(_0x36732f);if(_0xa31618[_0x3e8d62(0x194)]>0x0)return;await rmdir(_0x36732f);}catch{return;}_0x36732f=dirname(_0x36732f);}}async function resolveTargetDbBinding(_0x477d34,_0x4ca252,_0x44deaf){const _0x210af5=a192_0x5339b1,_0x125b6c=_0x4ca252['dbDirectory'];if(!_0x125b6c)return{'dbId':_0x44deaf[_0x210af5(0x150)],'dbName':_0x44deaf[_0x210af5(0x180)]};const _0x5c4416=buildDbDirectoryName(_0x44deaf['dbName'],_0x44deaf[_0x210af5(0x150)]);if(_0x125b6c===_0x5c4416)return{'dbId':_0x44deaf[_0x210af5(0x150)],'dbName':_0x44deaf[_0x210af5(0x180)]};const _0x3f9668=parseExplicitDbDirectory(_0x125b6c);if(_0x3f9668!=null)return{'dbId':_0x3f9668,'dbName':await getDbName(_0x477d34,_0x3f9668)[_0x210af5(0x175)](()=>undefined)};const _0x29d22e=await listDatabases(_0x477d34),_0x4bd348=_0x29d22e[_0x210af5(0x178)](_0x36673a=>buildDbDirectoryName(_0x36673a['dbName'],_0x36673a['dbId'])===_0x125b6c);if(_0x4bd348[_0x210af5(0x194)]===0x1)return{'dbId':_0x4bd348[0x0][_0x210af5(0x150)],'dbName':_0x4bd348[0x0][_0x210af5(0x180)]};if(_0x4bd348[_0x210af5(0x194)]===0x0)throw CliErrors['validation'](_0x210af5(0x158)+_0x125b6c+_0x210af5(0x16b)+_0x4ca252[_0x210af5(0x155)]+'.');const _0x5c5626=_0x4bd348[_0x210af5(0x183)](_0x1f540a=>_0x1f540a[_0x210af5(0x180)]+'\x20('+_0x1f540a[_0x210af5(0x150)]+')')['join'](',\x20');throw CliErrors[_0x210af5(0x163)](_0x210af5(0x151)+_0x125b6c+_0x210af5(0x188)+_0x4ca252[_0x210af5(0x155)]+':\x20'+_0x5c5626);}function parseExplicitDbDirectory(_0x49db2d){const _0x239169=a192_0x5339b1,_0x55bc42=/^db-(\d+)$/[_0x239169(0x170)](_0x49db2d);if(!_0x55bc42)return null;const _0x4fb7ed=Number(_0x55bc42[0x1]);return Number[_0x239169(0x190)](_0x4fb7ed)&&_0x4fb7ed>0x0?_0x4fb7ed:null;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x542a4e,_0x408459){const _0x1c7714=a193_0x3847,_0x21263e=_0x542a4e();while(!![]){try{const _0x20fc41=-parseInt(_0x1c7714(0x13d))/0x1*(-parseInt(_0x1c7714(0x141))/0x2)+-parseInt(_0x1c7714(0x145))/0x3*(parseInt(_0x1c7714(0x147))/0x4)+-parseInt(_0x1c7714(0x13f))/0x5+parseInt(_0x1c7714(0x149))/0x6*(parseInt(_0x1c7714(0x152))/0x7)+parseInt(_0x1c7714(0x130))/0x8*(-parseInt(_0x1c7714(0x131))/0x9)+parseInt(_0x1c7714(0x151))/0xa*(-parseInt(_0x1c7714(0x143))/0xb)+parseInt(_0x1c7714(0x13c))/0xc;if(_0x20fc41===_0x408459)break;else _0x21263e['push'](_0x21263e['shift']());}catch(_0x1f2c64){_0x21263e['push'](_0x21263e['shift']());}}}(a193_0x4561,0x691dc));import{createInterface}from'node:readline';import{join}from'node:path';import{buildDefaultSqlFileName,buildSqlRelativePath,detectSqlMode}from'../../core/sql-sync/utils.js';export const SQL_LOCAL_REL_DIR='.rabetbase/sql';export function buildSqlLockEntry(_0xb47fb5,_0x55e796,_0x229cdc,_0x5b9ea6){const _0x32dfef=a193_0x3847,_0x346906=detectSqlMode(_0x55e796);return{'path':buildSqlRelativePath(_0xb47fb5[_0x32dfef(0x14b)],_0xb47fb5[_0x32dfef(0x14a)],_0x5b9ea6?.['dbName'],_0x346906,_0xb47fb5[_0x32dfef(0x13e)]),'hash':_0x229cdc,'remoteId':_0xb47fb5['id'],'version':_0xb47fb5[_0x32dfef(0x148)],'dbId':Number(_0xb47fb5[_0x32dfef(0x13e)]),'dbName':_0x5b9ea6?.[_0x32dfef(0x156)],'sqlName':_0xb47fb5[_0x32dfef(0x14a)],'sqlConfig':_0xb47fb5[_0x32dfef(0x13a)]??undefined,'mode':_0x346906};}export function cloneSqlLockData(_0x4f7185){const _0x6dacb0=a193_0x3847;return{'apps':Object[_0x6dacb0(0x14c)](Object['entries'](_0x4f7185[_0x6dacb0(0x135)])[_0x6dacb0(0x158)](([_0x157ea5,_0x50a474])=>[_0x157ea5,{'sqlRoot':_0x50a474['sqlRoot'],'lastSync':_0x50a474[_0x6dacb0(0x159)],'sqls':{..._0x50a474[_0x6dacb0(0x140)]}}]))};}function a193_0x4561(){const _0x5c9212=['mode','3423284goaZlD','version','84522sJSYIZ','sqlName','sqlCode','fromEntries','toLowerCase','description','mybatisXml','replace','150vgcoKm','406FBXLgv','includes','join','trimStart','dbName','sqlContent','map','lastSync','trim','stderr','104848dLgYYB','279GZPEIP','<!--\x20@lovrabet.','test','path','apps','syncedAt','close','split','\x20[y/N]\x20','sqlConfig','filter','15620364DZlGFD','267321NdaTWs','dbId','669880jLchJc','sqls','2gHnlFe','question','410245BXbmMt','length','3OMNBYG'];a193_0x4561=function(){return _0x5c9212;};return a193_0x4561();}function a193_0x3847(_0x4238f1,_0x3a9840){_0x4238f1=_0x4238f1-0x12f;const _0x45617b=a193_0x4561();let _0x38473e=_0x45617b[_0x4238f1];return _0x38473e;}export function ensureRemoteSqlContent(_0x35b54e){const _0x465a4a=a193_0x3847;return _0x35b54e[_0x465a4a(0x157)]??'';}export function buildLocalSqlFileContent(_0x124eb6,_0x18d4a3,_0x3279ee){const _0x2f391b=a193_0x3847,_0x3661c2=_0x3279ee?.[_0x2f391b(0x146)]??detectSqlMode(_0x18d4a3),_0x3a943a=stripLocalSqlMetadata(_0x18d4a3,_0x3661c2)['trim'](),_0x11a57d=[...buildMetadataHeaderLines({'sqlCode':_0x124eb6[_0x2f391b(0x14b)],'sqlName':_0x124eb6[_0x2f391b(0x14a)],'dbId':_0x124eb6[_0x2f391b(0x13e)],'dbName':_0x3279ee?.[_0x2f391b(0x156)],'mode':_0x3661c2,'syncedAt':_0x3279ee?.[_0x2f391b(0x136)],'description':_0x3279ee?.[_0x2f391b(0x14e)]},_0x3661c2),'',_0x3a943a],_0x5107ff=_0x11a57d['join']('\x0a');return _0x5107ff['endsWith']('\x0a')?_0x5107ff:_0x5107ff+'\x0a';}export function stripLocalSqlMetadata(_0x53cde3,_0x402dcb){const _0x527477=a193_0x3847,_0x59fcc9=_0x53cde3[_0x527477(0x150)](/\r\n/g,'\x0a')[_0x527477(0x138)]('\x0a'),_0x555843=[];let _0x93597d=0x0;if(_0x402dcb===_0x527477(0x14f))while(_0x93597d<_0x59fcc9[_0x527477(0x144)]){const _0x38c319=_0x59fcc9[_0x93597d]??'';if(/^\s*<!--\s*@lovrabet\./[_0x527477(0x133)](_0x38c319)){_0x93597d++;continue;}if(_0x38c319['trim']()===''&&_0x93597d>0x0){_0x93597d++;continue;}break;}else while(_0x93597d<_0x59fcc9[_0x527477(0x144)]){const _0xf9af08=_0x59fcc9[_0x93597d]??'';if(/^\s*--\s*@lovrabet\./['test'](_0xf9af08)){_0x93597d++;continue;}if(_0xf9af08['trim']()===''&&_0x93597d>0x0){_0x93597d++;continue;}break;}for(;_0x93597d<_0x59fcc9[_0x527477(0x144)];_0x93597d++){_0x555843['push'](_0x59fcc9[_0x93597d]);}return _0x555843[_0x527477(0x154)]('\x0a')[_0x527477(0x155)]();}export function resolveSqlMode(_0x107556,_0x192aa3){const _0x2f1549=a193_0x3847;if(_0x192aa3?.[_0x2f1549(0x146)])return _0x192aa3[_0x2f1549(0x146)];return detectSqlMode(_0x107556);}export function resolveSqlFileName(_0x1fb53d,_0x414756,_0x198203){const _0x334e81=a193_0x3847;if(_0x198203?.[_0x334e81(0x134)])return _0x198203[_0x334e81(0x134)];if(_0x198203?.[_0x334e81(0x14a)]||_0x198203?.['dbName'])return buildSqlRelativePath(_0x1fb53d,_0x198203?.['sqlName'],_0x198203?.[_0x334e81(0x156)],resolveSqlMode(_0x414756,_0x198203),_0x198203?.['dbId']);return buildDefaultSqlFileName(_0x1fb53d,resolveSqlMode(_0x414756,_0x198203));}export function resolveSqlLocalDir(_0x28fc9d,_0x5c2369){return join(_0x28fc9d,SQL_LOCAL_REL_DIR,_0x5c2369);}export async function confirmForceOverwrite(_0x3d5efd){const _0x19d776=a193_0x3847,_0x29942f=createInterface({'input':process['stdin'],'output':process[_0x19d776(0x12f)]}),_0x25d43a=await new Promise(_0x5dae53=>{const _0x4da37c=_0x19d776;_0x29942f[_0x4da37c(0x142)](_0x3d5efd+_0x4da37c(0x139),_0x5dae53);});return _0x29942f[_0x19d776(0x137)](),['y','yes'][_0x19d776(0x153)](_0x25d43a[_0x19d776(0x15a)]()[_0x19d776(0x14d)]());}export function findSqlLockScope(_0x1f76ab,_0x4246bb){return _0x1f76ab['apps'][_0x4246bb];}function buildMetadataHeaderLines(_0x54c241,_0x4d8cef){const _0x3aab7d=a193_0x3847,_0x554096=[[_0x3aab7d(0x14b),_0x54c241[_0x3aab7d(0x14b)]],[_0x3aab7d(0x14a),_0x54c241[_0x3aab7d(0x14a)]],[_0x3aab7d(0x13e),_0x54c241[_0x3aab7d(0x13e)]],[_0x3aab7d(0x156),_0x54c241['dbName']],[_0x3aab7d(0x146),_0x54c241['mode']],[_0x3aab7d(0x136),_0x54c241['syncedAt']],['description',_0x54c241[_0x3aab7d(0x14e)]]];if(_0x4d8cef===_0x3aab7d(0x14f))return _0x554096[_0x3aab7d(0x13b)](([,_0x183e1a])=>_0x183e1a!==undefined&&_0x183e1a!==null&&String(_0x183e1a)[_0x3aab7d(0x15a)]()!=='')[_0x3aab7d(0x158)](([_0x259983,_0x22c253])=>_0x3aab7d(0x132)+_0x259983+':\x20'+String(_0x22c253)+'\x20-->');return _0x554096[_0x3aab7d(0x13b)](([,_0x17b469])=>_0x17b469!==undefined&&_0x17b469!==null&&String(_0x17b469)[_0x3aab7d(0x15a)]()!=='')[_0x3aab7d(0x158)](([_0xac7bae,_0x372cac])=>'--\x20@lovrabet.'+_0xac7bae+':\x20'+String(_0x372cac));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a194_0x4e4b47=a194_0x2487;(function(_0x4d3d37,_0x1d6e3a){const _0x5cf1d3=a194_0x2487,_0x47d8fa=_0x4d3d37();while(!![]){try{const _0x1d814e=-parseInt(_0x5cf1d3(0xdf))/0x1+parseInt(_0x5cf1d3(0xeb))/0x2*(parseInt(_0x5cf1d3(0xe5))/0x3)+parseInt(_0x5cf1d3(0xd8))/0x4+-parseInt(_0x5cf1d3(0xf1))/0x5*(parseInt(_0x5cf1d3(0xe7))/0x6)+parseInt(_0x5cf1d3(0xdb))/0x7+parseInt(_0x5cf1d3(0xe2))/0x8*(parseInt(_0x5cf1d3(0xf6))/0x9)+-parseInt(_0x5cf1d3(0xe6))/0xa;if(_0x1d814e===_0x1d6e3a)break;else _0x47d8fa['push'](_0x47d8fa['shift']());}catch(_0x47ce65){_0x47d8fa['push'](_0x47d8fa['shift']());}}}(a194_0x58e8,0xc32a2));import{listSqlQueries}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile}from'../../core/sql-sync/lock.js';function a194_0x2487(_0x52dc1f,_0x88d462){_0x52dc1f=_0x52dc1f-0xd3;const _0x58e807=a194_0x58e8();let _0x248732=_0x58e807[_0x52dc1f];return _0x248732;}function a194_0x58e8(){const _0x132b24=['\x20remote-only','status','\x20modified,\x20','lockKey','4647796PnLqDa','filePath','length','7794969tjHvFz','push','remote','relativePath','166685XlJfJT','has','All\x20SQL\x20queries\x20are\x20in\x20sync.','195688FTYMmA','\x20added,\x20','keys','1457877HJOxCc','31968600TYvIAX','6ARsKLu','read','sqlName','appCode','6OxIJdD','hash','lockFilePath','tableData','map','sql','298370NAucxC','Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally','bool','sqlRoot','paging','180KQOnNd','sqls'];a194_0x58e8=function(){return _0x132b24;};return a194_0x58e8();}const PAGE_SIZE=0x64;async function fetchAllSqlCodes(_0x2d6208){const _0x10b6bf=a194_0x2487,_0x3c371b=[];let _0x2b470a=0x1;while(!![]){const _0x93bbac=await listSqlQueries(_0x2d6208,{'currentPage':_0x2b470a,'pageSize':PAGE_SIZE}),_0x4424d3=_0x93bbac[_0x10b6bf(0xee)]??[];_0x3c371b[_0x10b6bf(0xdc)](..._0x4424d3[_0x10b6bf(0xef)](_0x436ee5=>_0x436ee5['sqlCode']));if(_0x4424d3[_0x10b6bf(0xda)]===0x0)break;const _0x149abf=_0x93bbac[_0x10b6bf(0xf5)]?.['totalCount'];if(_0x149abf!=null?_0x3c371b[_0x10b6bf(0xda)]>=_0x149abf:_0x4424d3[_0x10b6bf(0xda)]<PAGE_SIZE)break;_0x2b470a++;}return _0x3c371b;}export const sqlStatus={'service':a194_0x4e4b47(0xf0),'command':'status','description':'Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','risk':a194_0x4e4b47(0xe8),'flags':[{'name':a194_0x4e4b47(0xdd),'type':'boolean','description':a194_0x4e4b47(0xf2)}],async 'execute'(_0x9d76b5){const _0x10a0b4=a194_0x4e4b47,_0x2c31a7=loadSqlProjectConfig(_0x9d76b5['appCode']),_0x4a580c=await readSqlLockFile(_0x2c31a7[_0x10a0b4(0xed)]),{appLock:_0x2c534b}=ensureSqlLockScope(_0x4a580c??createEmptySqlLock(),_0x2c31a7[_0x10a0b4(0xea)],_0x2c31a7[_0x10a0b4(0xf4)],_0x10a0b4(0xd5)),_0xd8bbd3=await scanLocalSqlQueries(_0x2c31a7),_0x13de93=[],_0x445051=[],_0x568206=[],_0x35cc8c=[],_0x1968d4=new Set(_0xd8bbd3[_0x10a0b4(0xef)](_0x24415a=>_0x24415a[_0x10a0b4(0xd7)]));for(const _0x30469f of _0xd8bbd3){const _0x3e796b=await computeSqlFileHash(_0x30469f[_0x10a0b4(0xd9)]),_0x5c52fe=_0x2c534b['sqls'][_0x30469f[_0x10a0b4(0xd7)]],_0x2638c8=!!_0x5c52fe&&_0x5c52fe['path']!==_0x30469f[_0x10a0b4(0xde)],_0x48710e=!!_0x5c52fe&&!!_0x30469f[_0x10a0b4(0xe9)]&&_0x5c52fe[_0x10a0b4(0xe9)]!==_0x30469f[_0x10a0b4(0xe9)];if(!_0x5c52fe)_0x13de93[_0x10a0b4(0xdc)](_0x30469f['lockKey']);else _0x5c52fe[_0x10a0b4(0xec)]!==_0x3e796b||_0x2638c8||_0x48710e?_0x445051[_0x10a0b4(0xdc)](_0x30469f[_0x10a0b4(0xd7)]):_0x568206[_0x10a0b4(0xdc)](_0x30469f[_0x10a0b4(0xd7)]);}for(const _0x1a2fd5 of Object[_0x10a0b4(0xe4)](_0x2c534b[_0x10a0b4(0xd3)])){!_0x1968d4['has'](_0x1a2fd5)&&_0x35cc8c[_0x10a0b4(0xdc)](_0x1a2fd5);}const _0x110f2b=[];if(_0x9d76b5[_0x10a0b4(0xf3)](_0x10a0b4(0xdd))){const _0x53ab89=await fetchAllSqlCodes(_0x9d76b5['appCode']);for(const _0x5ddecc of _0x53ab89){!_0x1968d4[_0x10a0b4(0xe0)](_0x5ddecc)&&!_0x2c534b[_0x10a0b4(0xd3)][_0x5ddecc]&&_0x110f2b[_0x10a0b4(0xdc)](_0x5ddecc);}}const _0x2bc865=_0x13de93[_0x10a0b4(0xda)]===0x0&&_0x445051[_0x10a0b4(0xda)]===0x0&&_0x35cc8c[_0x10a0b4(0xda)]===0x0&&_0x110f2b['length']===0x0;return{'ok':!![],'data':{'added':_0x13de93,'modified':_0x445051,'missing':_0x35cc8c,'unchanged':_0x568206,'remoteOnly':_0x110f2b},'message':_0x2bc865?_0x10a0b4(0xe1):_0x13de93[_0x10a0b4(0xda)]+_0x10a0b4(0xe3)+_0x445051[_0x10a0b4(0xda)]+_0x10a0b4(0xd6)+_0x35cc8c[_0x10a0b4(0xda)]+'\x20missing,\x20'+_0x568206[_0x10a0b4(0xda)]+'\x20unchanged'+(_0x110f2b[_0x10a0b4(0xda)]>0x0?',\x20'+_0x110f2b[_0x10a0b4(0xda)]+_0x10a0b4(0xd4):'')};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a195_0x281735=a195_0x1acb;function a195_0x1acb(_0x4d266a,_0x2047ce){_0x4d266a=_0x4d266a-0x156;const _0x549225=a195_0x5492();let _0x1acbe6=_0x549225[_0x4d266a];return _0x1acbe6;}(function(_0xc70b1e,_0x34c30c){const _0x238bfd=a195_0x1acb,_0xd37075=_0xc70b1e();while(!![]){try{const _0x38b44c=parseInt(_0x238bfd(0x195))/0x1+-parseInt(_0x238bfd(0x172))/0x2*(-parseInt(_0x238bfd(0x17a))/0x3)+parseInt(_0x238bfd(0x16c))/0x4*(-parseInt(_0x238bfd(0x18f))/0x5)+parseInt(_0x238bfd(0x190))/0x6+-parseInt(_0x238bfd(0x187))/0x7+-parseInt(_0x238bfd(0x167))/0x8*(parseInt(_0x238bfd(0x196))/0x9)+parseInt(_0x238bfd(0x175))/0xa;if(_0x38b44c===_0x34c30c)break;else _0xd37075['push'](_0xd37075['shift']());}catch(_0x504204){_0xd37075['push'](_0xd37075['shift']());}}}(a195_0x5492,0xaab31));import{readFileSync,existsSync}from'node:fs';import{resolve}from'node:path';function a195_0x5492(){const _0x3b5a6a=['joinAudit','File\x20not\x20found:\x20','boolean','isArray','bool','utf-8','dbtableConfig','filter','find','reason','8952615jMlCqp','size','\x22\x20not\x20found\x20or\x20not\x20accessible','check-indexes','Table\x20\x22','schema:','toLowerCase','Inline\x20SQL\x20content\x20to\x20validate\x20(alternative\x20to\x20--file)','186605JFodbs','6802740aUdABE','trim','name','schemaWarnings','sql','507286YlrZKV','2525058xGugRU','split','flatMap','type','str','isSelectOnly','Comma-separated\x20dataset\x20codes\x20to\x20cross-check\x20table/column\x20names\x20against','indexName','index_columns','schemas','index_type','Path\x20to\x20the\x20SQL\x20file\x20to\x20validate','string','from','pkField','columns','sqlType','read','tableName','16jaYHIE','isDangerous','SQL\x20schema\x20validation','validation','unshift','124UeMKPK','Dataset\x20\x22','primary','map','fields','valid','2MOZCwq','dataset','push','11870060NYGxco','Validate\x20SQL\x20content\x20without\x20saving\x20(type\x20detection,\x20parameter\x20extraction,\x20optional\x20schema\x20check)','indexes','length','index_name','2604369BzkhJX','tables','file'];a195_0x5492=function(){return _0x3b5a6a;};return a195_0x5492();}import{validateSql}from'../../core/sql-validator.js';import{auditSqlJoinIndexes}from'../../core/sql-index-auditor.js';import{getDatasetDetail,listDatasets}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{assertDatasetIsDbTableBacked,filterDbTableBackedDatasets}from'../../commands/dataset/capability.js';export const sqlValidate={'service':a195_0x281735(0x194),'command':'validate','description':a195_0x281735(0x176),'risk':a195_0x281735(0x165),'flags':[{'name':a195_0x281735(0x17c),'type':'string','description':a195_0x281735(0x15f)},{'name':a195_0x281735(0x194),'type':a195_0x281735(0x160),'description':a195_0x281735(0x18e)},{'name':a195_0x281735(0x15d),'type':'string','description':a195_0x281735(0x15a)},{'name':a195_0x281735(0x18a),'type':a195_0x281735(0x17f),'description':'Audit\x20top-level\x20JOIN\x20equality\x20predicates\x20against\x20dataset\x20index\x20metadata'}],async 'execute'(_0x21fc70){const _0x4d81d2=a195_0x281735,_0x180430=_0x21fc70[_0x4d81d2(0x158)]('file'),_0x4091f8=_0x21fc70[_0x4d81d2(0x158)](_0x4d81d2(0x194)),_0x181753=_0x21fc70[_0x4d81d2(0x158)]('schemas'),_0x17461e=_0x21fc70[_0x4d81d2(0x181)]('check-indexes');if(!_0x180430&&!_0x4091f8)throw CliErrors['flagMissing'](_0x4d81d2(0x17c),'Provide\x20--file\x20or\x20--sql');if(_0x17461e&&!_0x181753)throw CliErrors['validation']('--check-indexes\x20requires\x20--schemas.');let _0x7d8c2a;if(_0x180430){const _0x54d7b2=resolve(process['cwd'](),_0x180430);if(!existsSync(_0x54d7b2))throw CliErrors[_0x4d81d2(0x16a)](_0x4d81d2(0x17e)+_0x54d7b2);_0x7d8c2a=readFileSync(_0x54d7b2,_0x4d81d2(0x182));}else _0x7d8c2a=_0x4091f8;const _0x30ca6d=validateSql(_0x7d8c2a),_0x531f6a={'valid':_0x30ca6d[_0x4d81d2(0x171)],'sqlType':_0x30ca6d[_0x4d81d2(0x164)][_0x4d81d2(0x157)],'isSelectOnly':_0x30ca6d[_0x4d81d2(0x164)][_0x4d81d2(0x159)],'isDangerous':_0x30ca6d[_0x4d81d2(0x164)][_0x4d81d2(0x168)],'tables':_0x30ca6d[_0x4d81d2(0x17b)],'parameters':_0x30ca6d['parameters'],'message':_0x30ca6d['message']};_0x30ca6d[_0x4d81d2(0x164)][_0x4d81d2(0x186)]&&(_0x531f6a['reason']=_0x30ca6d[_0x4d81d2(0x164)][_0x4d81d2(0x186)]);if(_0x181753&&_0x30ca6d[_0x4d81d2(0x171)]){const _0x5e7bf6=_0x181753[_0x4d81d2(0x197)](',')['map'](_0x4f5470=>_0x4f5470[_0x4d81d2(0x191)]())[_0x4d81d2(0x184)](Boolean),_0x313d6a=[],_0x32a642=[],_0x51434c=filterDbTableBackedDatasets(await listDatasets(_0x21fc70['appCode'])),_0x369eb4=new Map(_0x51434c['map'](_0x34b67b=>[_0x34b67b[_0x4d81d2(0x183)]?.[_0x4d81d2(0x166)]?.[_0x4d81d2(0x18d)](),_0x34b67b]));for(const _0x273451 of _0x30ca6d[_0x4d81d2(0x17b)]){const _0xb971e0=_0x369eb4['get'](_0x273451['toLowerCase']());!_0xb971e0&&_0x313d6a[_0x4d81d2(0x174)](_0x4d81d2(0x18b)+_0x273451+'\x22\x20not\x20found\x20in\x20any\x20dataset');}for(const _0x54b874 of _0x5e7bf6){let _0x4288db;try{_0x4288db=await getDatasetDetail(_0x54b874);}catch{_0x313d6a['push'](_0x4d81d2(0x16d)+_0x54b874+_0x4d81d2(0x189));continue;}assertDatasetIsDbTableBacked(_0x4288db,_0x4d81d2(0x169));const _0x59421a=Array[_0x4d81d2(0x180)](_0x4288db[_0x4d81d2(0x170)])?_0x4288db[_0x4d81d2(0x170)]:[],_0x3e8a6b=new Set(_0x59421a[_0x4d81d2(0x16f)](_0x14b4ad=>_0x14b4ad[_0x4d81d2(0x192)]?.['toLowerCase']())),_0xbf20f1=_0x4288db[_0x4d81d2(0x183)]?.[_0x4d81d2(0x166)]||_0x4288db[_0x4d81d2(0x166)]||_0x54b874;_0x531f6a[_0x4d81d2(0x18c)+_0xbf20f1]={'code':_0x54b874,'tableName':_0xbf20f1,'fieldCount':_0x3e8a6b[_0x4d81d2(0x188)],'fields':Array[_0x4d81d2(0x161)](_0x3e8a6b)};if(_0x17461e){const _0x4bd31e=normalizeDatasetIndexes(_0x4288db);_0x32a642[_0x4d81d2(0x174)]({'tableName':_0xbf20f1,..._0x4bd31e});}}_0x313d6a[_0x4d81d2(0x178)]>0x0&&(_0x531f6a[_0x4d81d2(0x193)]=_0x313d6a),_0x17461e&&(_0x531f6a[_0x4d81d2(0x17d)]=auditSqlJoinIndexes(_0x7d8c2a,_0x32a642));}return{'ok':_0x30ca6d['valid'],'data':_0x531f6a,'message':_0x30ca6d['message']};}};function normalizeDatasetIndexes(_0xf5e446){const _0x28ba1e=a195_0x281735,_0x24066a=Array['isArray'](_0xf5e446?.[_0x28ba1e(0x173)]?.[_0x28ba1e(0x177)])?_0xf5e446[_0x28ba1e(0x173)][_0x28ba1e(0x177)]:Array[_0x28ba1e(0x180)](_0xf5e446?.[_0x28ba1e(0x177)])?_0xf5e446[_0x28ba1e(0x177)]:[],_0x444220=_0x24066a[_0x28ba1e(0x156)](_0x4545fe=>{const _0x3cb456=_0x28ba1e,_0x191eed=Array['isArray'](_0x4545fe?.[_0x3cb456(0x15c)])?_0x4545fe[_0x3cb456(0x15c)]:Array[_0x3cb456(0x180)](_0x4545fe?.['columnNames'])?_0x4545fe['columnNames']:Array[_0x3cb456(0x180)](_0x4545fe?.['columns'])?_0x4545fe[_0x3cb456(0x163)]:[],_0x40ab2b=_0x191eed[_0x3cb456(0x184)](_0x7373df=>typeof _0x7373df===_0x3cb456(0x160))['map'](_0x28f4a2=>_0x28f4a2[_0x3cb456(0x191)]())[_0x3cb456(0x184)](Boolean);if(_0x40ab2b['length']===0x0)return[];const _0x36b89e=[_0x4545fe?.[_0x3cb456(0x15b)],_0x4545fe?.[_0x3cb456(0x179)],_0x4545fe?.[_0x3cb456(0x192)]][_0x3cb456(0x185)](_0x38400c=>typeof _0x38400c===_0x3cb456(0x160)&&_0x38400c[_0x3cb456(0x191)]()),_0x61e873=[_0x4545fe?.[_0x3cb456(0x15e)],_0x4545fe?.[_0x3cb456(0x157)]][_0x3cb456(0x185)](_0x5a3367=>typeof _0x5a3367==='string'&&_0x5a3367[_0x3cb456(0x191)]());return[{..._0x36b89e?{'name':_0x36b89e[_0x3cb456(0x191)]()}:{},..._0x61e873?{'type':_0x61e873['trim']()}:{},'columns':_0x40ab2b}];}),_0x239114=[..._0x444220],_0x483ec2=typeof _0xf5e446?.[_0x28ba1e(0x183)]?.[_0x28ba1e(0x162)]===_0x28ba1e(0x160)?_0xf5e446[_0x28ba1e(0x183)][_0x28ba1e(0x162)]['split'](',')[_0x28ba1e(0x16f)](_0x92670e=>_0x92670e['trim']())[_0x28ba1e(0x184)](Boolean):[];return _0x483ec2['length']>0x0&&_0x239114[_0x28ba1e(0x16b)]({'type':_0x28ba1e(0x16e),'columns':_0x483ec2}),{'indexes':_0x239114,'metadataAvailable':_0x444220[_0x28ba1e(0x178)]>0x0};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x10a137,_0x2abc7e){const _0x177cdd=a196_0x2f53,_0x4658c4=_0x10a137();while(!![]){try{const _0x1813f2=-parseInt(_0x177cdd(0x124))/0x1+-parseInt(_0x177cdd(0x128))/0x2+parseInt(_0x177cdd(0x127))/0x3*(-parseInt(_0x177cdd(0x123))/0x4)+-parseInt(_0x177cdd(0x121))/0x5+parseInt(_0x177cdd(0x125))/0x6*(-parseInt(_0x177cdd(0x129))/0x7)+parseInt(_0x177cdd(0x122))/0x8+-parseInt(_0x177cdd(0x126))/0x9*(-parseInt(_0x177cdd(0x120))/0xa);if(_0x1813f2===_0x2abc7e)break;else _0x4658c4['push'](_0x4658c4['shift']());}catch(_0x5cb403){_0x4658c4['push'](_0x4658c4['shift']());}}}(a196_0x1d62,0xd1715));function a196_0x2f53(_0x19b4af,_0x2ccc2e){_0x19b4af=_0x19b4af-0x120;const _0x1d6225=a196_0x1d62();let _0x2f534a=_0x1d6225[_0x19b4af];return _0x2f534a;}import{taskStatus}from'../../commands/task/status.js';function a196_0x1d62(){const _0x537d9e=['486588cowvdh','49142601PJTDWJ','93gUwIJL','1464840ObUrqx','140TRxaUa','10cWTqYA','6948515TGRjZH','2086776GUBnMC','86644OBomYV','447685iIJqIL'];a196_0x1d62=function(){return _0x537d9e;};return a196_0x1d62();}export const taskDefinitions=[taskStatus];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a197_0x3321d3=a197_0x4f3d;(function(_0x10c664,_0x2bca97){const _0x308ea3=a197_0x4f3d,_0x3c6f73=_0x10c664();while(!![]){try{const _0x4b98cb=-parseInt(_0x308ea3(0x7a))/0x1*(parseInt(_0x308ea3(0x6d))/0x2)+-parseInt(_0x308ea3(0x6f))/0x3*(-parseInt(_0x308ea3(0x79))/0x4)+parseInt(_0x308ea3(0x7b))/0x5+-parseInt(_0x308ea3(0x6c))/0x6+parseInt(_0x308ea3(0x67))/0x7*(-parseInt(_0x308ea3(0x73))/0x8)+-parseInt(_0x308ea3(0x78))/0x9+parseInt(_0x308ea3(0x71))/0xa;if(_0x4b98cb===_0x2bca97)break;else _0x3c6f73['push'](_0x3c6f73['shift']());}catch(_0x9cfdfd){_0x3c6f73['push'](_0x3c6f73['shift']());}}}(a197_0x23a9,0x7d56e));import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asyncTaskMessage,buildAsyncTaskStatusCommand,normalizeAsyncTask}from'../../commands/common/async-task.js';import{getAsyncTaskStatus}from'../../core/api-client.js';function a197_0x4f3d(_0x1b2324,_0x5e2bd0){_0x1b2324=_0x1b2324-0x65;const _0x23a9e6=a197_0x23a9();let _0x4f3d63=_0x23a9e6[_0x1b2324];return _0x4f3d63;}import{CliErrors}from'../../errors.js';export const taskStatus={'service':a197_0x3321d3(0x65),'command':a197_0x3321d3(0x72),'description':a197_0x3321d3(0x66),'risk':'read','defaultOutputFormat':a197_0x3321d3(0x76),'structuredErrors':!![],'flags':[{'name':'task-id','type':'string','required':!![],'description':a197_0x3321d3(0x68)},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x105bb6){const _0x1b4893=a197_0x3321d3;if(!_0x105bb6['str']('task-id')[_0x1b4893(0x69)]())throw CliErrors['flagMissing'](_0x1b4893(0x70));},async 'execute'(_0x5114fb){const _0x33ea43=a197_0x3321d3,_0x3c20a7=_0x5114fb['str'](_0x33ea43(0x70))[_0x33ea43(0x69)](),_0x488556=normalizeAsyncTask(await getAsyncTaskStatus(_0x3c20a7,_0x5114fb[_0x33ea43(0x77)],_0x5114fb[_0x33ea43(0x75)]));if(_0x488556[_0x33ea43(0x6b)]!==_0x3c20a7)throw CliErrors[_0x33ea43(0x6a)]('Task\x20status\x20response\x20id\x20mismatch:\x20requested\x20'+_0x3c20a7+_0x33ea43(0x6e)+_0x488556[_0x33ea43(0x6b)]+'.');const _0x438bfa=buildAsyncTaskStatusCommand(_0x488556[_0x33ea43(0x6b)],_0x5114fb[_0x33ea43(0x77)]);return{'ok':!![],'message':asyncTaskMessage(_0x488556),'data':{'appCode':_0x5114fb['appCode'],..._0x488556,'query':_0x488556[_0x33ea43(0x74)]?null:{'command':_0x438bfa}}};}};function a197_0x23a9(){const _0x3c134d=['30247btnOmS','Task\x20id\x20returned\x20by\x20an\x20asynchronous\x20platform\x20command','trim','apiError','taskId','1078452YxjkSO','1282QwPtWJ',',\x20received\x20','472917jLSkaB','task-id','17283840zKDyRa','status','8YIBGSE','isTerminal','cookie','compress','appCode','2782287vlOAzP','4CdJNyl','1581nICdWf','669970buNvet','task','Query\x20an\x20asynchronous\x20task;\x20repeat\x20for\x20PENDING\x20or\x20PROCESSING\x20until\x20SUCCESS\x20or\x20FAILED'];a197_0x23a9=function(){return _0x3c134d;};return a197_0x23a9();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x4efc08,_0x4a731a){const _0x3da22c=a198_0x23cd,_0x25226e=_0x4efc08();while(!![]){try{const _0x5e9e1d=parseInt(_0x3da22c(0x1e7))/0x1+-parseInt(_0x3da22c(0x1e4))/0x2*(parseInt(_0x3da22c(0x1e9))/0x3)+-parseInt(_0x3da22c(0x1e6))/0x4+-parseInt(_0x3da22c(0x1e8))/0x5*(parseInt(_0x3da22c(0x1e5))/0x6)+-parseInt(_0x3da22c(0x1ea))/0x7+-parseInt(_0x3da22c(0x1e2))/0x8+parseInt(_0x3da22c(0x1e3))/0x9*(parseInt(_0x3da22c(0x1e1))/0xa);if(_0x5e9e1d===_0x4a731a)break;else _0x25226e['push'](_0x25226e['shift']());}catch(_0x5b8073){_0x25226e['push'](_0x25226e['shift']());}}}(a198_0x1b47,0x513be));import{tenantMembersListDefinition}from'../../commands/tenant/members-list.js';function a198_0x23cd(_0x48c0b8,_0x4e4ea3){_0x48c0b8=_0x48c0b8-0x1e1;const _0x1b470b=a198_0x1b47();let _0x23cd0f=_0x1b470b[_0x48c0b8];return _0x23cd0f;}function a198_0x1b47(){const _0x3e3745=['1508361qAsZYI','3912370HubLIQ','10cyDplJ','4874680CxuXFX','18306819EzjZdl','2fxqyFE','636OwXnuy','389524gAExAc','589424LUYnnI','24640KaAjmv'];a198_0x1b47=function(){return _0x3e3745;};return a198_0x1b47();}export const tenantDefinitions=[tenantMembersListDefinition];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a199_0x2598(){const _0x1ebc24=['tenant-code','members-list','9chamIY','List\x20members\x20of\x20a\x20tenant\x20available\x20to\x20the\x20current\x20account','1963871NdQGDI','337451vVOyGl','length','72YzFbCK','trim','5814790nWDcbm','tenant','Found\x20','flagMissing','str','2882456WxsXfT','\x20tenant\x20member(s)','Pass\x20--tenant-code\x20<code>.','166824nQNjHc','Exact\x20tenant\x20code','2NLmtqg','42210iFBlEZ','2418570QqeEul','string'];a199_0x2598=function(){return _0x1ebc24;};return a199_0x2598();}const a199_0x132f4e=a199_0x52b0;function a199_0x52b0(_0x1f635f,_0x2a9360){_0x1f635f=_0x1f635f-0xc3;const _0x25983e=a199_0x2598();let _0x52b0ad=_0x25983e[_0x1f635f];return _0x52b0ad;}(function(_0x417707,_0x80ee33){const _0xb073bb=a199_0x52b0,_0x1608f9=_0x417707();while(!![]){try{const _0x5ead2a=-parseInt(_0xb073bb(0xd0))/0x1*(parseInt(_0xb073bb(0xc7))/0x2)+-parseInt(_0xb073bb(0xc5))/0x3+parseInt(_0xb073bb(0xd2))/0x4*(-parseInt(_0xb073bb(0xc8))/0x5)+-parseInt(_0xb073bb(0xc9))/0x6+parseInt(_0xb073bb(0xcf))/0x7+parseInt(_0xb073bb(0xd9))/0x8*(parseInt(_0xb073bb(0xcd))/0x9)+parseInt(_0xb073bb(0xd4))/0xa;if(_0x5ead2a===_0x80ee33)break;else _0x1608f9['push'](_0x1608f9['shift']());}catch(_0x4c52d9){_0x1608f9['push'](_0x1608f9['shift']());}}}(a199_0x2598,0x42f35));import{listCurrentUserTenantMemberships,listTenantDirectoryMembers}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{assertTenantAccessible,projectTenantMembers}from'../../commands/tenant/shared.js';export const tenantMembersListDefinition={'service':a199_0x132f4e(0xd5),'command':a199_0x132f4e(0xcc),'description':a199_0x132f4e(0xce),'risk':'read','requiresAuth':!![],'requiresAppCode':![],'structuredErrors':!![],'flags':[{'name':a199_0x132f4e(0xcb),'type':a199_0x132f4e(0xca),'required':!![],'description':a199_0x132f4e(0xc6)}],async 'validate'(_0x289abd){const _0x57d12e=a199_0x132f4e;if(!_0x289abd[_0x57d12e(0xd8)](_0x57d12e(0xcb))[_0x57d12e(0xd3)]())throw CliErrors[_0x57d12e(0xd7)](_0x57d12e(0xcb),_0x57d12e(0xc4));},async 'execute'(_0x111427){const _0x2d5b76=a199_0x132f4e,_0x2a434b=_0x111427[_0x2d5b76(0xd8)](_0x2d5b76(0xcb))['trim'](),_0x221452=await listCurrentUserTenantMemberships();assertTenantAccessible(_0x2a434b,_0x221452);const _0x20479f=projectTenantMembers(await listTenantDirectoryMembers(_0x2a434b));return{'ok':!![],'data':{'tenantCode':_0x2a434b,'items':_0x20479f,'totalCount':_0x20479f[_0x2d5b76(0xd1)]},'message':_0x2d5b76(0xd6)+_0x20479f[_0x2d5b76(0xd1)]+_0x2d5b76(0xc3)};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x10e80c,_0x425105){const _0x296ee5=a200_0x3b9e,_0x2311a1=_0x10e80c();while(!![]){try{const _0x5b641d=-parseInt(_0x296ee5(0x69))/0x1*(parseInt(_0x296ee5(0x70))/0x2)+parseInt(_0x296ee5(0x72))/0x3*(parseInt(_0x296ee5(0x6f))/0x4)+parseInt(_0x296ee5(0x7c))/0x5+parseInt(_0x296ee5(0x78))/0x6*(parseInt(_0x296ee5(0x77))/0x7)+parseInt(_0x296ee5(0x74))/0x8+parseInt(_0x296ee5(0x6d))/0x9*(parseInt(_0x296ee5(0x71))/0xa)+-parseInt(_0x296ee5(0x76))/0xb;if(_0x5b641d===_0x425105)break;else _0x2311a1['push'](_0x2311a1['shift']());}catch(_0x8ab6fc){_0x2311a1['push'](_0x2311a1['shift']());}}}(a200_0x2edd,0x5e41c));import{CliErrors}from'../../errors.js';function textOrNull(_0x2e6f11){const _0x3e14a0=_0x2e6f11?.['trim']();return _0x3e14a0?_0x3e14a0:null;}function a200_0x2edd(){const _0x3cd885=['3473865fexWSr','Check\x20--tenant-code\x20or\x20login\x20with\x20an\x20account\x20that\x20belongs\x20to\x20this\x20tenant.','Tenant\x20\x22','status','MEMBER','tenantCode','displayName','6IXzmGK','role','validation','userId','9pUpMYs','ADMIN','1403208OrDjJf','53494WSKJki','3259540ULoMeW','3kDaseZ','some','4470952sfEqlP','values','23560504BloTYw','14xySbzV','2274072iawzQz','nickname','username','get'];a200_0x2edd=function(){return _0x3cd885;};return a200_0x2edd();}function a200_0x3b9e(_0x55e67e,_0x39632b){_0x55e67e=_0x55e67e-0x65;const _0x2edd53=a200_0x2edd();let _0x3b9e15=_0x2edd53[_0x55e67e];return _0x3b9e15;}export function projectTenantMembers(_0x27b78e){const _0x321d89=a200_0x3b9e,_0x4123f6=new Map();for(const _0x1d03ba of _0x27b78e){const _0x14b96e=Number(_0x1d03ba[_0x321d89(0x6c)]);if(!Number['isFinite'](_0x14b96e)||_0x14b96e<=0x0)continue;const _0x433a16={'userId':_0x14b96e,'username':textOrNull(_0x1d03ba['username']),'displayName':textOrNull(_0x1d03ba[_0x321d89(0x79)]),'role':_0x1d03ba['adminFlag']===!![]?_0x321d89(0x6e):_0x321d89(0x66),'status':textOrNull(_0x1d03ba['status'])},_0x375a52=_0x4123f6[_0x321d89(0x7b)](_0x14b96e);if(!_0x375a52){_0x4123f6['set'](_0x14b96e,_0x433a16);continue;}_0x375a52[_0x321d89(0x7a)]??=_0x433a16[_0x321d89(0x7a)],_0x375a52[_0x321d89(0x68)]??=_0x433a16[_0x321d89(0x68)],_0x375a52[_0x321d89(0x65)]??=_0x433a16[_0x321d89(0x65)];if(_0x433a16[_0x321d89(0x6a)]===_0x321d89(0x6e))_0x375a52[_0x321d89(0x6a)]=_0x321d89(0x6e);}return[..._0x4123f6[_0x321d89(0x75)]()]['sort']((_0x1c3641,_0x43038a)=>_0x1c3641[_0x321d89(0x6c)]-_0x43038a['userId']);}export function assertTenantAccessible(_0x3a2412,_0x4d714e){const _0x16bb0c=a200_0x3b9e;if(_0x4d714e[_0x16bb0c(0x73)](_0x252f31=>_0x252f31[_0x16bb0c(0x67)]===_0x3a2412))return;throw CliErrors[_0x16bb0c(0x6b)](_0x16bb0c(0x7e)+_0x3a2412+'\x22\x20is\x20not\x20available\x20to\x20the\x20current\x20account.',_0x16bb0c(0x7d));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a201_0x26639f=a201_0x52a8;(function(_0x4cc793,_0x522047){const _0x10d08a=a201_0x52a8,_0x3164c7=_0x4cc793();while(!![]){try{const _0x1f2af6=-parseInt(_0x10d08a(0x1e9))/0x1*(-parseInt(_0x10d08a(0x1e6))/0x2)+-parseInt(_0x10d08a(0x1e1))/0x3*(parseInt(_0x10d08a(0x1ee))/0x4)+-parseInt(_0x10d08a(0x1ef))/0x5*(-parseInt(_0x10d08a(0x1ec))/0x6)+-parseInt(_0x10d08a(0x1dc))/0x7+parseInt(_0x10d08a(0x1d7))/0x8+-parseInt(_0x10d08a(0x1f1))/0x9*(-parseInt(_0x10d08a(0x1eb))/0xa)+parseInt(_0x10d08a(0x1ea))/0xb;if(_0x1f2af6===_0x522047)break;else _0x3164c7['push'](_0x3164c7['shift']());}catch(_0x59e858){_0x3164c7['push'](_0x3164c7['shift']());}}}(a201_0x56cf,0x5058d));import{asDryRunResult}from'../../commands/common/dry-run.js';function a201_0x56cf(){const _0x703ceb=['dingding-sandbox-bind','DingTalk\x20user\x20id\x20returned\x20by\x20the\x20sandbox','786SdDnFO','Pass\x20the\x20DingTalk\x20user\x20id\x20returned\x20by\x20the\x20sandbox.','apiError','bind','--ding-talk-user-id\x20cannot\x20be\x20empty.','26SeoTdL','str','Retry\x20with\x20the\x20same\x20--ding-talk-user-id\x20only\x20after\x20checking\x20the\x20current\x20platform\x20session.','16787ADEsXD','1111671uBvVDq','4342930wXgfTa','179994SFVwOO','trim','10024VqPspU','10HJISOk','validation','9JoRYSe','dingtalk','write','Bind\x20the\x20current\x20platform\x20user\x20to\x20a\x20DingTalk\x20sandbox\x20account','4371760zbyyHa','ding-talk-user-id','The\x20current\x20binding\x20is\x20not\x20exposed\x20by\x20the\x20server;\x20before\x20is\x20unavailable.','DingTalk\x20sandbox\x20account\x20binding\x20was\x20not\x20confirmed.','string','2620660hgglss','user-account','POST'];a201_0x56cf=function(){return _0x703ceb;};return a201_0x56cf();}function a201_0x52a8(_0x262dc2,_0x50f05f){_0x262dc2=_0x262dc2-0x1d7;const _0x56cfca=a201_0x56cf();let _0x52a847=_0x56cfca[_0x262dc2];return _0x52a847;}import{bindDingTalkSandboxAccount,DING_TALK_SANDBOX_BIND_PATH}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';const PROVIDER_ID=a201_0x26639f(0x1f2),CURRENT_BINDING_WARNING=a201_0x26639f(0x1d9);function readDingTalkUserId(_0x2fd95a){const _0x1de8bf=a201_0x26639f,_0x204f51=_0x2fd95a[_0x1de8bf(0x1e7)](_0x1de8bf(0x1d8))[_0x1de8bf(0x1ed)]();if(!_0x204f51)throw CliErrors[_0x1de8bf(0x1f0)](_0x1de8bf(0x1e5),_0x1de8bf(0x1e2));return _0x204f51;}function buildBindingData(_0x540330,_0x359c95){const _0x43a21e=a201_0x26639f;return{'operation':_0x43a21e(0x1e4),'selector':{'providerId':PROVIDER_ID,'dingTalkUserId':_0x540330},'before':null,'after':{'providerId':PROVIDER_ID,'dingTalkUserId':_0x540330,'bound':!![]},'dryRun':_0x359c95,'backend':{'method':_0x43a21e(0x1de),'path':DING_TALK_SANDBOX_BIND_PATH},'warnings':[CURRENT_BINDING_WARNING]};}export const dingTalkSandboxBind={'service':a201_0x26639f(0x1dd),'command':a201_0x26639f(0x1df),'description':a201_0x26639f(0x1f4),'risk':a201_0x26639f(0x1f3),'requiresAuth':!![],'requiresAppCode':![],'structuredErrors':!![],'flags':[{'name':'ding-talk-user-id','type':a201_0x26639f(0x1db),'required':!![],'description':a201_0x26639f(0x1e0)}],async 'validate'(_0x2731fb){readDingTalkUserId(_0x2731fb);},async 'dryRun'(_0x358335){const _0x1a0577=a201_0x26639f,_0x2065c2=readDingTalkUserId(_0x358335);return asDryRunResult(buildBindingData(_0x2065c2,!![]),{'method':_0x1a0577(0x1de),'url':DING_TALK_SANDBOX_BIND_PATH});},async 'execute'(_0x232d9c){const _0x13e484=a201_0x26639f,_0x352d75=readDingTalkUserId(_0x232d9c),_0x4dc5ea=await bindDingTalkSandboxAccount(_0x352d75);if(_0x4dc5ea!==!![])throw CliErrors[_0x13e484(0x1e3)](_0x13e484(0x1da),_0x13e484(0x1e8));return{'ok':!![],'data':buildBindingData(_0x352d75,![]),'message':'Bound\x20current\x20user\x20to\x20DingTalk\x20sandbox\x20account.'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x229ed9,_0x1059d0){const _0x1bb71f=a202_0x5eb5,_0x5ddd64=_0x229ed9();while(!![]){try{const _0xeee7a7=-parseInt(_0x1bb71f(0x18a))/0x1+parseInt(_0x1bb71f(0x18c))/0x2+parseInt(_0x1bb71f(0x188))/0x3+-parseInt(_0x1bb71f(0x189))/0x4*(parseInt(_0x1bb71f(0x18d))/0x5)+parseInt(_0x1bb71f(0x18b))/0x6+-parseInt(_0x1bb71f(0x18e))/0x7+parseInt(_0x1bb71f(0x187))/0x8;if(_0xeee7a7===_0x1059d0)break;else _0x5ddd64['push'](_0x5ddd64['shift']());}catch(_0x240fa8){_0x5ddd64['push'](_0x5ddd64['shift']());}}}(a202_0x2056,0xad290));import{dingTalkSandboxBind}from'../../commands/user-account/dingding-sandbox-bind.js';export const userAccountDefinitions=[dingTalkSandboxBind];function a202_0x5eb5(_0x5b2df7,_0x221662){_0x5b2df7=_0x5b2df7-0x187;const _0x205621=a202_0x2056();let _0x5eb566=_0x205621[_0x5b2df7];return _0x5eb566;}function a202_0x2056(){const _0x3d8fc3=['136765fwGPdo','3700277LfGoEn','17990816owAfQl','2739354TjWYoW','196Coknnj','1416902nIQskx','229026LKrNkp','1589866CnzLHd'];a202_0x2056=function(){return _0x3d8fc3;};return a202_0x2056();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a203_0x21d38a=a203_0x483b;function a203_0x483b(_0x52186c,_0x1fe66e){_0x52186c=_0x52186c-0x1e1;const _0x3d6b15=a203_0x3d6b();let _0x483b2a=_0x3d6b15[_0x52186c];return _0x483b2a;}function a203_0x3d6b(){const _0x1d49c0=['99UowdhK','51ucqDip','name','1359xaJOwO','48MmUwBT','workspace','workspace\x20add','382935VUWUsG','write','26768OxJwXi','Register\x20an\x20app\x20profile\x20in\x20the\x20current\x20workspace\x20(or\x20--global)','App\x20profile\x20name','add','3081208PntYHR','301616LpbJPm','194840wwvBuc','33064dBaiMw','86402yRcJgJ'];a203_0x3d6b=function(){return _0x1d49c0;};return a203_0x3d6b();}(function(_0x2952fe,_0x1cb70e){const _0x56bbb2=a203_0x483b,_0x459a5d=_0x2952fe();while(!![]){try{const _0xb0d09b=-parseInt(_0x56bbb2(0x1ed))/0x1+parseInt(_0x56bbb2(0x1f0))/0x2*(parseInt(_0x56bbb2(0x1f2))/0x3)+parseInt(_0x56bbb2(0x1ec))/0x4+parseInt(_0x56bbb2(0x1e6))/0x5+-parseInt(_0x56bbb2(0x1e3))/0x6*(parseInt(_0x56bbb2(0x1e8))/0x7)+-parseInt(_0x56bbb2(0x1ef))/0x8*(parseInt(_0x56bbb2(0x1e2))/0x9)+parseInt(_0x56bbb2(0x1ee))/0xa*(-parseInt(_0x56bbb2(0x1f1))/0xb);if(_0xb0d09b===_0x1cb70e)break;else _0x459a5d['push'](_0x459a5d['shift']());}catch(_0x8f0a0f){_0x459a5d['push'](_0x459a5d['shift']());}}}(a203_0x3d6b,0x6dc7b));import{buildAppAddFlags,runAppAdd,validateAppName}from'../../commands/common/app-registry.js';export const workspaceAddDefinition={'service':a203_0x21d38a(0x1e4),'command':a203_0x21d38a(0x1eb),'description':a203_0x21d38a(0x1e9),'risk':a203_0x21d38a(0x1e7),'requiresAuth':![],'requiresAppCode':![],'args':[{'name':a203_0x21d38a(0x1e1),'description':a203_0x21d38a(0x1ea),'required':!![]}],'flags':buildAppAddFlags(),'validate':_0x434ddc=>validateAppName(_0x434ddc,a203_0x21d38a(0x1e5)),'execute':_0x5a6fb7=>runAppAdd(_0x5a6fb7,a203_0x21d38a(0x1e5))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a204_0xd19dd7=a204_0x3e1c;(function(_0x523acb,_0x153b11){const _0x5f36ce=a204_0x3e1c,_0x2df8ce=_0x523acb();while(!![]){try{const _0x5fe469=parseInt(_0x5f36ce(0x96))/0x1*(-parseInt(_0x5f36ce(0xae))/0x2)+-parseInt(_0x5f36ce(0x9c))/0x3+parseInt(_0x5f36ce(0x8b))/0x4+parseInt(_0x5f36ce(0xa4))/0x5*(-parseInt(_0x5f36ce(0xac))/0x6)+parseInt(_0x5f36ce(0xb3))/0x7+parseInt(_0x5f36ce(0x91))/0x8+parseInt(_0x5f36ce(0x9f))/0x9;if(_0x5fe469===_0x153b11)break;else _0x2df8ce['push'](_0x2df8ce['shift']());}catch(_0xd141f6){_0x2df8ce['push'](_0x2df8ce['shift']());}}}(a204_0x2ef5,0x8ac33));import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';import{RABETBASE_ENV_VALUES}from'../../constant/env.js';function a204_0x3e1c(_0x5aef13,_0x129c07){_0x5aef13=_0x5aef13-0x82;const _0x2ef5fe=a204_0x2ef5();let _0x3e1c9c=_0x2ef5fe[_0x5aef13];return _0x3e1c9c;}import{RABETBASE_OUTPUT_FORMAT_VALUES}from'../../constant/output.js';import{RISK_LEVEL_VALUES}from'../../constant/risk.js';import{validateAppcode}from'../../commands/common/validate.js';import{readConfigFile,readRawConfigWithLayers,resolveWriteConfigPath,writeConfigFile}from'../../context.js';import{workspaceAddDefinition}from'../../commands/workspace/add.js';import{workspaceRemoveDefinition}from'../../commands/workspace/remove.js';import{normalizeStoredDefaultApp}from'../../config/schema.js';const WORKSPACE_USAGE=CLI_BIN_NAME+a204_0xd19dd7(0xaa),SAFE_PROFILE_KEYS=['appcode',a204_0xd19dd7(0x9d),'apiDir',a204_0xd19dd7(0x8e),a204_0xd19dd7(0x87),a204_0xd19dd7(0x86),a204_0xd19dd7(0xa8)],workspaceFlags=[{'name':a204_0xd19dd7(0xb6),'type':a204_0xd19dd7(0xa0),'description':a204_0xd19dd7(0x8a)},{'name':a204_0xd19dd7(0x94),'type':a204_0xd19dd7(0xa0),'description':a204_0xd19dd7(0x84)},{'name':a204_0xd19dd7(0x9d),'type':a204_0xd19dd7(0xa0),'description':a204_0xd19dd7(0xb0),'enum':[...RABETBASE_ENV_VALUES]},{'name':'apiDir','type':'string','description':a204_0xd19dd7(0xa9)},{'name':'defaultFormat','type':'string','description':a204_0xd19dd7(0xab),'enum':[...RABETBASE_OUTPUT_FORMAT_VALUES]},{'name':'pageSize','type':'number','description':'Default\x20page\x20size\x20for\x20this\x20workspace\x20app\x20profile'},{'name':a204_0xd19dd7(0x86),'type':a204_0xd19dd7(0xa0),'description':'Risk\x20level\x20for\x20this\x20workspace\x20app\x20profile','enum':[...RISK_LEVEL_VALUES]},{'name':a204_0xd19dd7(0xa8),'type':a204_0xd19dd7(0xa0),'description':a204_0xd19dd7(0x9b)}];function isRecord(_0x52b2f9){const _0x17869b=a204_0xd19dd7;return!!_0x52b2f9&&typeof _0x52b2f9===_0x17869b(0x95)&&!Array[_0x17869b(0xaf)](_0x52b2f9);}function assertValidAppcode(_0x3888ce){const _0x5bfb79=a204_0xd19dd7,{valid:_0x100458,message:_0x37a32b}=validateAppcode(_0x3888ce);if(!_0x100458)throw CliErrors[_0x5bfb79(0x88)]('Invalid\x20appcode:\x20'+_0x3888ce,_0x37a32b);}function sanitizeProfile(_0x486360){if(!isRecord(_0x486360))return{};const _0x343ad9={};for(const _0x2d4cb5 of SAFE_PROFILE_KEYS){if(_0x486360[_0x2d4cb5]!==undefined)_0x343ad9[_0x2d4cb5]=_0x486360[_0x2d4cb5];}return _0x343ad9;}function cloneProfile(_0xc4c8b3){return isRecord(_0xc4c8b3)?{..._0xc4c8b3}:{};}function a204_0x2ef5(){const _0x52a0fa=['App\x20locale\x20for\x20this\x20workspace\x20app\x20profile\x20(not\x20CLI\x20language;\x20reserved\x20for\x20later\x20app\x20use)','2846031TQXWAx','env','App\x20\x22','9386883OxZswi','string','\x20--app\x20','Switch\x20the\x20current\x20workspace\x20app\x20binding','apps','90DLjgoU','.\x20Credentials:\x20not\x20written.','globalConfig','Missing\x20workspace\x20app\x20selector.','locale','API\x20directory\x20path\x20for\x20this\x20workspace\x20app\x20profile','\x20workspace\x20<init|use>\x20--app\x20<name>\x20[--appcode\x20<code>]','Default\x20output\x20format\x20for\x20this\x20workspace\x20app\x20profile','227382pyCOXv','Initialize\x20the\x20current\x20workspace\x20app\x20binding','194WOZHVH','isArray','Target\x20environment','flag','defaultFormat','6004740XZbLNv','join','\x20workspace\x20init\x20--appcode\x20<code>`\x20or\x20`','app','\x20(appcode:\x20','initialized','\x20workspace\x20use\x20--app\x20<name>`.','write','str','App\x20code\x20to\x20bind\x20to\x20this\x20workspace','Pass\x20--appcode\x20<code>,\x20or\x20choose\x20one\x20of:\x20','riskLevel','pageSize','validation','\x22\x20not\x20found.','App\x20profile\x20name\x20to\x20use\x20in\x20this\x20workspace','386704vAEaDU','init',').\x20Config:\x20','format','apiDir','trim','5277184mYZrNM','\x20--appcode\x20<code>`.','Use\x20`','appcode','object','4721qXdXJz','use','workspace','length','Workspace\x20'];a204_0x2ef5=function(){return _0x52a0fa;};return a204_0x2ef5();}function collectWorkspaceProfileOverrides(_0xe2ee28){const _0x30ad2d=a204_0xd19dd7,_0x1c7475={},_0x1fc2df=_0xe2ee28[_0x30ad2d(0x83)](_0x30ad2d(0x9d)),_0x5c7452=_0xe2ee28[_0x30ad2d(0x83)](_0x30ad2d(0x8f)),_0x11b944=_0xe2ee28['str'](_0x30ad2d(0xb2)),_0x5df05e=_0xe2ee28[_0x30ad2d(0xb1)]('pageSize'),_0xe8fe43=_0xe2ee28[_0x30ad2d(0x83)](_0x30ad2d(0x86)),_0x4831b3=_0xe2ee28['str']('locale');if(_0x1fc2df)_0x1c7475[_0x30ad2d(0x9d)]=_0x1fc2df;if(_0x5c7452)_0x1c7475[_0x30ad2d(0x8f)]=_0x5c7452;if(_0x11b944)_0x1c7475['format']=_0x11b944;if(_0x5df05e!==undefined&&_0x5df05e!=='')_0x1c7475[_0x30ad2d(0x87)]=Number(_0x5df05e);if(_0xe8fe43)_0x1c7475[_0x30ad2d(0x86)]=_0xe8fe43;if(_0x4831b3)_0x1c7475[_0x30ad2d(0xa8)]=_0x4831b3;return _0x1c7475;}async function validateWorkspaceArgs(_0x35adeb){const _0x5b2083=a204_0xd19dd7,_0x5b1259=_0x35adeb[_0x5b2083(0x83)](_0x5b2083(0xb6))['trim'](),_0x38f472=_0x35adeb[_0x5b2083(0x83)](_0x5b2083(0x94))[_0x5b2083(0x90)]();if(!_0x5b1259&&!_0x38f472)throw CliErrors['validation']('Missing\x20workspace\x20app\x20selector.','Use\x20`'+CLI_BIN_NAME+_0x5b2083(0xb5)+CLI_BIN_NAME+_0x5b2083(0xb9));if(_0x38f472)assertValidAppcode(_0x38f472);}function resolveKnownApps(){const _0x58529=a204_0xd19dd7,{config:_0x2a28bd,layers:_0x40bc04}=readRawConfigWithLayers(),_0x1b5a11=isRecord(_0x2a28bd[_0x58529(0xa3)])?_0x2a28bd[_0x58529(0xa3)]:{},_0x2629da=isRecord(_0x40bc04['globalConfig']['apps'])?_0x40bc04[_0x58529(0xa6)][_0x58529(0xa3)]:{};return{..._0x2629da,..._0x1b5a11};}async function configureWorkspace(_0x53a1c5,_0x1f0e6f){const _0x1f7c32=a204_0xd19dd7,_0x460651=_0x53a1c5[_0x1f7c32(0x83)](_0x1f7c32(0xb6))[_0x1f7c32(0x90)](),_0x331b37=_0x53a1c5[_0x1f7c32(0x83)](_0x1f7c32(0x94))['trim'](),_0x2c9071=_0x460651||_0x331b37;if(!_0x2c9071)throw CliErrors[_0x1f7c32(0x88)](_0x1f7c32(0xa7),'Use\x20`'+CLI_BIN_NAME+_0x1f7c32(0xb5)+CLI_BIN_NAME+_0x1f7c32(0xb9));if(_0x331b37)assertValidAppcode(_0x331b37);const _0x5a364e=resolveWriteConfigPath('project'),_0x4ce726=readConfigFile(_0x5a364e),_0x2f4085=resolveKnownApps(),_0x4f1831=isRecord(_0x4ce726[_0x1f7c32(0xa3)])?{..._0x4ce726[_0x1f7c32(0xa3)]}:{},_0x47bd62=cloneProfile(_0x4f1831[_0x2c9071]),_0x1a09f0=sanitizeProfile(_0x2f4085[_0x2c9071]),_0x53479e=_0x331b37?{}:_0x1a09f0,_0x499c56=_0x331b37||_0x53479e[_0x1f7c32(0x94)];if(!_0x499c56){const _0x26a77a=Object['keys'](_0x2f4085),_0x7f4477=_0x26a77a[_0x1f7c32(0x99)]===0x0?_0x1f7c32(0x93)+CLI_BIN_NAME+'\x20workspace\x20'+_0x1f0e6f+_0x1f7c32(0xa1)+_0x2c9071+_0x1f7c32(0x92):_0x1f7c32(0x85)+_0x26a77a[_0x1f7c32(0xb4)](',\x20');throw CliErrors[_0x1f7c32(0x88)](_0x1f7c32(0x9e)+_0x2c9071+_0x1f7c32(0x89),_0x7f4477);}assertValidAppcode(String(_0x499c56));const _0x5c6b9f={..._0x53479e,..._0x47bd62,'appcode':String(_0x499c56),...collectWorkspaceProfileOverrides(_0x53a1c5)};return _0x4f1831[_0x2c9071]=_0x5c6b9f,_0x4ce726['apps']=_0x4f1831,normalizeStoredDefaultApp(_0x4ce726,_0x2c9071),delete _0x4ce726[_0x1f7c32(0x94)],delete _0x4ce726[_0x1f7c32(0xb6)],_0x5c6b9f['env']&&(_0x4ce726[_0x1f7c32(0x9d)]=_0x5c6b9f['env']),writeConfigFile(_0x5a364e,_0x4ce726),{'ok':!![],'message':_0x1f7c32(0x9a)+(_0x1f0e6f===_0x1f7c32(0x8c)?_0x1f7c32(0xb8):'updated')+':\x20'+_0x2c9071+_0x1f7c32(0xb7)+_0x5c6b9f[_0x1f7c32(0x94)]+_0x1f7c32(0x8d)+_0x5a364e+_0x1f7c32(0xa5),'data':{'operation':'workspace.'+_0x1f0e6f,'configPath':_0x5a364e,'app':_0x2c9071,'appcode':_0x5c6b9f[_0x1f7c32(0x94)],'env':_0x5c6b9f[_0x1f7c32(0x9d)]??null,'credentialsWritten':![]}};}const workspaceInitDefinition={'service':a204_0xd19dd7(0x98),'command':a204_0xd19dd7(0x8c),'description':a204_0xd19dd7(0xad),'risk':a204_0xd19dd7(0x82),'requiresAuth':![],'requiresAppCode':![],'args':[],'flags':workspaceFlags,'validate':validateWorkspaceArgs,'execute':_0x56cabe=>configureWorkspace(_0x56cabe,'init')},workspaceUseDefinition={'service':'workspace','command':'use','description':a204_0xd19dd7(0xa2),'risk':a204_0xd19dd7(0x82),'requiresAuth':![],'requiresAppCode':![],'args':[],'flags':workspaceFlags,'validate':validateWorkspaceArgs,'execute':_0x3d27e0=>configureWorkspace(_0x3d27e0,a204_0xd19dd7(0x97))};export const workspaceDefinitions=[workspaceInitDefinition,workspaceUseDefinition,workspaceAddDefinition,workspaceRemoveDefinition];export{WORKSPACE_USAGE};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a205_0x34b4(){const _0x19e66e=['7jcEFUG','940385CgriUj','33768NnvHoi','name','workspace\x20remove','11887634ICaJCw','2338QfVCre','workspace','1302192Pifxzz','14892HhFQJH','103ERfUrC','2610328AgVBma','Remove\x20an\x20app\x20profile\x20from\x20the\x20current\x20workspace\x20(or\x20--global)','20TwyxcJ','App\x20profile\x20name\x20to\x20remove','remove','write','144LIqdcF'];a205_0x34b4=function(){return _0x19e66e;};return a205_0x34b4();}function a205_0x4c77(_0x58bf24,_0x3fe232){_0x58bf24=_0x58bf24-0xd0;const _0x34b482=a205_0x34b4();let _0x4c7762=_0x34b482[_0x58bf24];return _0x4c7762;}const a205_0x5e3baa=a205_0x4c77;(function(_0x39c889,_0x4a6a0c){const _0x2b85c7=a205_0x4c77,_0x1c108b=_0x39c889();while(!![]){try{const _0x178a74=-parseInt(_0x2b85c7(0xde))/0x1*(-parseInt(_0x2b85c7(0xda))/0x2)+parseInt(_0x2b85c7(0xd3))/0x3*(parseInt(_0x2b85c7(0xd6))/0x4)+parseInt(_0x2b85c7(0xd5))/0x5+-parseInt(_0x2b85c7(0xdd))/0x6+-parseInt(_0x2b85c7(0xd4))/0x7*(-parseInt(_0x2b85c7(0xdf))/0x8)+-parseInt(_0x2b85c7(0xdc))/0x9*(-parseInt(_0x2b85c7(0xe1))/0xa)+-parseInt(_0x2b85c7(0xd9))/0xb;if(_0x178a74===_0x4a6a0c)break;else _0x1c108b['push'](_0x1c108b['shift']());}catch(_0x4228bf){_0x1c108b['push'](_0x1c108b['shift']());}}}(a205_0x34b4,0x3c1af));import{buildAppRemoveFlags,runAppRemove,validateAppName}from'../../commands/common/app-registry.js';export const workspaceRemoveDefinition={'service':a205_0x5e3baa(0xdb),'command':a205_0x5e3baa(0xd1),'description':a205_0x5e3baa(0xe0),'risk':a205_0x5e3baa(0xd2),'requiresAuth':![],'requiresAppCode':![],'args':[{'name':a205_0x5e3baa(0xd7),'description':a205_0x5e3baa(0xd0),'required':!![]}],'flags':buildAppRemoveFlags(),'validate':_0xc83ee=>validateAppName(_0xc83ee,a205_0x5e3baa(0xd8)),'execute':_0x1384fe=>runAppRemove(_0x1384fe,'workspace\x20remove')};
|