@lovrabet/rabetbase-cli 2.5.0-beta.4 → 2.5.0-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -0
- 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.js +1 -1
- package/lib/commands/db/tables.js +1 -1
- package/lib/commands/db/test.js +1 -1
- package/lib/commands/db/update.js +1 -1
- package/lib/commands/doctor.js +1 -1
- package/lib/commands/file/index.js +1 -1
- package/lib/commands/issue/index.js +1 -1
- package/lib/commands/issue/nudge.js +1 -1
- package/lib/commands/issue/report.js +1 -1
- package/lib/commands/issue/shared.js +1 -1
- package/lib/commands/kb/create.js +1 -1
- package/lib/commands/kb/delete.js +1 -1
- package/lib/commands/kb/detail.js +1 -1
- package/lib/commands/kb/index.js +1 -1
- package/lib/commands/kb/list.js +1 -1
- package/lib/commands/kb/search.js +1 -1
- package/lib/commands/kb/shared.js +1 -1
- package/lib/commands/kb/update.js +1 -1
- package/lib/commands/logs/index.js +1 -1
- package/lib/commands/menu/asset-update.js +1 -1
- package/lib/commands/menu/delete.js +1 -1
- package/lib/commands/menu/external-link-create.js +1 -1
- package/lib/commands/menu/external-link-update.js +1 -1
- package/lib/commands/menu/group-create.js +1 -1
- package/lib/commands/menu/group-update.js +1 -1
- package/lib/commands/menu/index.js +1 -1
- package/lib/commands/menu/list.js +1 -1
- package/lib/commands/menu/move.js +1 -1
- package/lib/commands/menu/regroup-start.js +1 -1
- package/lib/commands/menu/rename.js +1 -1
- package/lib/commands/menu/shared/compare-table.js +1 -1
- package/lib/commands/menu/shared/delete-plan.js +1 -1
- package/lib/commands/menu/shared/facts.js +1 -1
- package/lib/commands/menu/shared/index.js +1 -1
- package/lib/commands/menu/shared/inquirer.js +1 -1
- package/lib/commands/menu/shared/local-pages.js +1 -1
- package/lib/commands/menu/shared/logic.js +1 -1
- package/lib/commands/menu/shared/mutations.js +1 -1
- package/lib/commands/menu/shared/service.js +1 -1
- package/lib/commands/menu/shared/sync-core.js +1 -1
- package/lib/commands/menu/shared/update-core.js +1 -1
- package/lib/commands/menu/shared/valid-url.js +1 -1
- package/lib/commands/menu/sync.js +1 -1
- package/lib/commands/menu/visibility-update.js +1 -1
- package/lib/commands/notification/config-create.js +1 -1
- package/lib/commands/notification/config-delete.js +1 -1
- package/lib/commands/notification/config-list.js +1 -1
- package/lib/commands/notification/config-update.js +1 -1
- package/lib/commands/notification/index.js +1 -1
- package/lib/commands/notification/shared.js +1 -1
- package/lib/commands/ocr/index.js +1 -1
- package/lib/commands/page/create.js +1 -1
- package/lib/commands/page/custom/detail.js +1 -1
- package/lib/commands/page/custom/list.js +1 -1
- package/lib/commands/page/custom/publish.js +1 -1
- package/lib/commands/page/custom/shared.js +1 -1
- package/lib/commands/page/custom/syntax.js +1 -1
- package/lib/commands/page/custom/template.js +1 -1
- package/lib/commands/page/custom/update.js +1 -1
- package/lib/commands/page/data-list-status.js +1 -1
- package/lib/commands/page/generate-start.js +1 -1
- package/lib/commands/page/generate-status.js +1 -1
- package/lib/commands/page/index.js +1 -1
- package/lib/commands/page/pull.js +1 -1
- package/lib/commands/page/push.js +1 -1
- package/lib/commands/page/relation-audit.js +1 -1
- package/lib/commands/page/restore.js +1 -1
- package/lib/commands/page/shared.js +1 -1
- package/lib/commands/page/sync.js +1 -1
- package/lib/commands/project/create/enhanced-guided-create.js +1 -1
- package/lib/commands/project/create/format-elapsed.js +1 -1
- package/lib/commands/project/create/main.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.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 +2 -2
- package/skills/rabetbase.manifest.json +3 -3
package/lib/commands/sql/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
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);}
|
|
1
|
+
const a191_0x4e9ab4=a191_0x21db;(function(_0x45b9fa,_0xef9887){const _0x28e95c=a191_0x21db,_0xbf77f=_0x45b9fa();while(!![]){try{const _0x56851c=parseInt(_0x28e95c(0x14d))/0x1*(-parseInt(_0x28e95c(0x130))/0x2)+parseInt(_0x28e95c(0x11b))/0x3*(-parseInt(_0x28e95c(0x14c))/0x4)+parseInt(_0x28e95c(0x121))/0x5+parseInt(_0x28e95c(0x142))/0x6*(parseInt(_0x28e95c(0x145))/0x7)+-parseInt(_0x28e95c(0x13c))/0x8+-parseInt(_0x28e95c(0x139))/0x9*(parseInt(_0x28e95c(0x114))/0xa)+parseInt(_0x28e95c(0x140))/0xb*(parseInt(_0x28e95c(0x122))/0xc);if(_0x56851c===_0xef9887)break;else _0xbf77f['push'](_0xbf77f['shift']());}catch(_0x394b4a){_0xbf77f['push'](_0xbf77f['shift']());}}}(a191_0x5276,0xc5d2a));function a191_0x5276(){const _0x4d6b02=['local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','local\x20differs\x20from\x20remote','sqlRootDir','Pull\x20complete:\x20','toISOString','891486osSYJN','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','length','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','paging','\x20failed','4032010MLzfuu','12ZdQbRd','\x20skipped,\x20','apps','utf8','pull','push','str','sqlcode','mybatisXml','totalCount','Force\x20pull\x20cancelled.','sqlCode','sql','catch','5008iYgFXG','\x20written,\x20','Force\x20overwrite\x20local\x20unsynced\x20changes','appCode','join','Filter\x20by\x20SQL\x20display\x20name','name','replace','description','8777943bPOQcq','sqlRoot','conflict','4582432UJKPHM','string','lastSync','read','29899859palIFF','would_pull','9600GLHIqX','test','dbId','91dlbbvC','filter','unchanged','nonInteractive','sqlContent','Would\x20pull\x20','sqls','12KtRGhJ','118FSMqiU','force','sqlName','10nWlwLu','message'];a191_0x5276=function(){return _0x4d6b02;};return a191_0x5276();}import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';const PAGE_SIZE=0x64;function a191_0x21db(_0x1224fe,_0x4bc4d3){_0x1224fe=_0x1224fe-0x112;const _0x5276b1=a191_0x5276();let _0x21dbe9=_0x5276b1[_0x1224fe];return _0x21dbe9;}async function fetchAllSqlQueries(_0x3f95c8,_0x1534c4){const _0x411c63=a191_0x21db,_0x132bc7=[];let _0x31157d=0x1;while(!![]){const _0x2a7d7d=await listSqlQueries(_0x3f95c8,{'currentPage':_0x31157d,'pageSize':PAGE_SIZE,'sqlCode':_0x1534c4['sqlCode'],'sqlName':_0x1534c4['sqlName']}),_0x4c54a8=_0x2a7d7d['tableData']??[];_0x132bc7[_0x411c63(0x127)](..._0x4c54a8);if(_0x4c54a8[_0x411c63(0x11d)]===0x0)break;const _0x2db558=_0x2a7d7d[_0x411c63(0x11f)]?.[_0x411c63(0x12b)];if(_0x2db558!=null?_0x132bc7[_0x411c63(0x11d)]>=_0x2db558:_0x4c54a8[_0x411c63(0x11d)]<PAGE_SIZE)break;_0x31157d++;}return _0x132bc7;}async function ensureSqlContent(_0xac8f84){const _0x274ba3=a191_0x21db;if(_0xac8f84[_0x274ba3(0x149)]!=null&&String(_0xac8f84['sqlContent'])[_0x274ba3(0x11d)]>0x0)return _0xac8f84;return getSqlQueryDetail(_0xac8f84[_0x274ba3(0x12d)]);}export const sqlPull={'service':'sql','command':a191_0x4e9ab4(0x126),'description':a191_0x4e9ab4(0x11e),'risk':a191_0x4e9ab4(0x13f),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a191_0x4e9ab4(0x136),'type':a191_0x4e9ab4(0x13d),'description':a191_0x4e9ab4(0x135)},{'name':a191_0x4e9ab4(0x112),'type':'boolean','description':a191_0x4e9ab4(0x132)}],async 'dryRun'(_0x53b631){const _0x24091=a191_0x4e9ab4,_0x2a3512=loadSqlProjectConfig(_0x53b631['appCode']),_0x470221=await readSqlLockFile(_0x2a3512['lockFilePath']),{appLock:_0x49b649}=ensureSqlLockScope(_0x470221??createEmptySqlLock(),_0x2a3512['appCode'],_0x2a3512[_0x24091(0x13a)],_0x24091(0x126)),_0x3bb9d9=await fetchAllSqlQueries(_0x53b631[_0x24091(0x133)],{'sqlCode':_0x53b631[_0x24091(0x128)](_0x24091(0x129))||undefined,'sqlName':_0x53b631['str'](_0x24091(0x136))||undefined}),_0x122608=[];for(const _0x4e27bc of _0x3bb9d9){const _0x132444=await ensureSqlContent(_0x4e27bc),_0x1ba8f0=ensureRemoteSqlContent(_0x132444),_0x3117b4=detectModeFromSql(_0x132444),_0x312824=_0x132444[_0x24091(0x144)]?await getDbName(_0x53b631[_0x24091(0x133)],Number(_0x132444[_0x24091(0x144)]))[_0x24091(0x12f)](()=>undefined):undefined,_0x526158=buildLocalSqlFileContent({'sqlCode':_0x132444[_0x24091(0x12d)],'sqlName':_0x132444[_0x24091(0x113)],'dbId':_0x132444[_0x24091(0x144)]},_0x1ba8f0,{'dbName':_0x312824,'mode':_0x3117b4,'syncedAt':new Date()[_0x24091(0x11a)](),'description':_0x132444[_0x24091(0x138)]}),_0x4c6389=buildSqlLockEntry(_0x132444,_0x1ba8f0,'',{'dbName':_0x312824}),_0x555b90=resolveLocalSqlFilePath(_0x2a3512,_0x132444[_0x24091(0x12d)],_0x4c6389);let _0x81d047=_0x24091(0x141),_0xcc857d;if(await fileExists(_0x555b90)){const _0x1b8129=await readFile(_0x555b90,_0x24091(0x125));isEquivalentPulledSqlFile(_0x1b8129,_0x526158,_0x3117b4)?(_0x81d047='skipped',_0xcc857d=_0x24091(0x147)):(_0x81d047=_0x24091(0x13b),_0xcc857d=_0x24091(0x116));}_0x122608[_0x24091(0x127)]({'sqlCode':_0x132444['sqlCode'],'sqlName':_0x132444[_0x24091(0x113)],'filePath':_0x555b90,'status':_0x81d047,'reason':_0xcc857d});}return{'method':'POST','url':'/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','body':{'appCode':_0x53b631[_0x24091(0x133)],'sqlCode':_0x53b631['str'](_0x24091(0x129))||null,'sqlName':_0x53b631[_0x24091(0x128)]('name')||null,'files':_0x122608},'description':_0x24091(0x14a)+_0x122608[_0x24091(0x11d)]+'\x20SQL\x20file(s)\x20into\x20'+_0x2a3512['sqlRootDir']};},async 'execute'(_0x44fd8b){const _0x5a4b67=a191_0x4e9ab4,_0x393d28=loadSqlProjectConfig(_0x44fd8b['appCode']),_0x23c551=await readSqlLockFile(_0x393d28['lockFilePath']),{lockData:_0x2ce886,appLock:_0x1bec47}=ensureSqlLockScope(_0x23c551??createEmptySqlLock(),_0x393d28[_0x5a4b67(0x133)],_0x393d28[_0x5a4b67(0x13a)],_0x5a4b67(0x126)),_0x5846a9=_0x44fd8b['bool'](_0x5a4b67(0x112)),_0x5d5756=await fetchAllSqlQueries(_0x44fd8b['appCode'],{'sqlCode':_0x44fd8b[_0x5a4b67(0x128)](_0x5a4b67(0x129))||undefined,'sqlName':_0x44fd8b[_0x5a4b67(0x128)]('name')||undefined});if(_0x5d5756['length']===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':'No\x20remote\x20SQL\x20queries\x20matched.'};const _0x22994a=[],_0x371a00=[];for(const _0x1a0606 of _0x5d5756){try{_0x22994a[_0x5a4b67(0x127)](await ensureSqlContent(_0x1a0606));}catch(_0x4258da){_0x371a00[_0x5a4b67(0x127)]({'sqlCode':_0x1a0606[_0x5a4b67(0x12d)],'error':_0x4258da instanceof Error?_0x4258da['message']:String(_0x4258da)});}}if(_0x5846a9&&!_0x44fd8b[_0x5a4b67(0x148)]){let _0x4288eb=![];for(const _0x537f6e of _0x22994a){const _0x48cece=detectModeFromSql(_0x537f6e),_0x1235e8=_0x537f6e[_0x5a4b67(0x144)]?await getDbName(_0x44fd8b[_0x5a4b67(0x133)],Number(_0x537f6e[_0x5a4b67(0x144)]))['catch'](()=>undefined):undefined,_0x54c9de=buildLocalSqlFileContent({'sqlCode':_0x537f6e[_0x5a4b67(0x12d)],'sqlName':_0x537f6e['sqlName'],'dbId':_0x537f6e['dbId']},ensureRemoteSqlContent(_0x537f6e),{'dbName':_0x1235e8,'mode':_0x48cece,'syncedAt':new Date()['toISOString'](),'description':_0x537f6e[_0x5a4b67(0x138)]}),_0x28e287=resolveLocalSqlFilePath(_0x393d28,_0x537f6e['sqlCode'],buildSqlLockEntry(_0x537f6e,ensureRemoteSqlContent(_0x537f6e),'',{'dbName':_0x1235e8}));if(await fileExists(_0x28e287)){const _0xf974f7=await readFile(_0x28e287,_0x5a4b67(0x125));if(!isEquivalentPulledSqlFile(_0xf974f7,_0x54c9de,_0x48cece)){_0x4288eb=!![];break;}}}if(_0x4288eb){const _0x3b4d01=await confirmForceOverwrite(_0x5a4b67(0x11c));if(!_0x3b4d01)throw CliErrors['cancelled'](_0x5a4b67(0x12c));}}const _0xc7c497=cloneSqlLockData(_0x2ce886),_0x21a2ac=_0xc7c497[_0x5a4b67(0x124)][_0x393d28[_0x5a4b67(0x133)]],_0x57bfce=[],_0xe63ef9=[];for(const _0x44da51 of _0x22994a){const _0x3dbe5f=_0x21a2ac['sqls'][_0x44da51[_0x5a4b67(0x12d)]],_0x51f9d0=ensureRemoteSqlContent(_0x44da51),_0x4de15f=detectModeFromSql(_0x44da51),_0x381581=_0x44da51['dbId']?await getDbName(_0x44fd8b[_0x5a4b67(0x133)],Number(_0x44da51[_0x5a4b67(0x144)]))[_0x5a4b67(0x12f)](()=>undefined):undefined,_0x4ba3bb=buildLocalSqlFileContent({'sqlCode':_0x44da51[_0x5a4b67(0x12d)],'sqlName':_0x44da51[_0x5a4b67(0x113)],'dbId':_0x44da51[_0x5a4b67(0x144)]},_0x51f9d0,{'dbName':_0x381581,'mode':_0x4de15f,'syncedAt':new Date()[_0x5a4b67(0x11a)](),'description':_0x44da51['description']}),_0x5106c7=buildSqlLockEntry(_0x44da51,_0x51f9d0,computeSqlContentHash(_0x4ba3bb),{'dbName':_0x381581}),_0x2306ae=_0x5106c7['path'],_0x71f56a=join(_0x393d28[_0x5a4b67(0x118)],_0x2306ae);try{if(await fileExists(_0x71f56a)){const _0x4138aa=await readFile(_0x71f56a,_0x5a4b67(0x125));if(isEquivalentPulledSqlFile(_0x4138aa,_0x4ba3bb,_0x4de15f)){_0xe63ef9[_0x5a4b67(0x127)]({'sqlCode':_0x44da51[_0x5a4b67(0x12d)],'reason':'unchanged'}),_0x21a2ac['sqls'][_0x44da51[_0x5a4b67(0x12d)]]={..._0x5106c7,'hash':computeSqlContentHash(_0x4138aa),'path':_0x2306ae};continue;}if(!_0x5846a9){_0xe63ef9[_0x5a4b67(0x127)]({'sqlCode':_0x44da51['sqlCode'],'reason':_0x5a4b67(0x117)});continue;}}const _0x3d71e5=_0x3dbe5f?.['path']?join(_0x393d28[_0x5a4b67(0x118)],_0x3dbe5f['path']):undefined;_0x3d71e5&&_0x3d71e5!==_0x71f56a&&await fileExists(_0x3d71e5)&&await rm(_0x3d71e5,{'force':!![]}),await ensureParentDirectory(_0x71f56a),await writeFile(_0x71f56a,_0x4ba3bb,_0x5a4b67(0x125)),_0x21a2ac[_0x5a4b67(0x14b)][_0x44da51[_0x5a4b67(0x12d)]]={..._0x5106c7,'path':_0x2306ae},_0x57bfce[_0x5a4b67(0x127)]({'sqlCode':_0x44da51[_0x5a4b67(0x12d)],'filePath':_0x71f56a});}catch(_0x4e2166){_0x371a00['push']({'sqlCode':_0x44da51[_0x5a4b67(0x12d)],'error':_0x4e2166 instanceof Error?_0x4e2166[_0x5a4b67(0x115)]:String(_0x4e2166)});}}return _0x21a2ac[_0x5a4b67(0x13e)]=new Date()[_0x5a4b67(0x11a)](),await writeSqlLockFile(_0x393d28['lockFilePath'],_0xc7c497),{'ok':_0x371a00[_0x5a4b67(0x11d)]===0x0,'data':{'pulled':_0x57bfce,'skipped':_0xe63ef9,'failed':_0x371a00},'message':_0x5a4b67(0x119)+_0x57bfce['length']+_0x5a4b67(0x131)+_0xe63ef9[_0x5a4b67(0x11d)]+_0x5a4b67(0x123)+_0x371a00[_0x5a4b67(0x11d)]+_0x5a4b67(0x120)};}};function detectModeFromSql(_0x4a21c7){const _0x25ba88=a191_0x4e9ab4,_0x88274a=ensureRemoteSqlContent(_0x4a21c7),_0x197ef9=stripLocalSqlMetadata(_0x88274a,_0x25ba88(0x12a))['trimStart']();if(/^<(select|insert|update|delete)\b/i[_0x25ba88(0x143)](_0x197ef9))return _0x25ba88(0x12a);return _0x25ba88(0x12e);}function isEquivalentPulledSqlFile(_0x2602aa,_0x432d75,_0x47066f){return normalizePullComparableContent(_0x2602aa,_0x47066f)===normalizePullComparableContent(_0x432d75,_0x47066f);}function normalizePullComparableContent(_0x143470,_0x48f349){const _0x3c479a=a191_0x4e9ab4,_0x379aba=_0x143470[_0x3c479a(0x137)](/\r\n/g,'\x0a')['split']('\x0a'),_0x554119=_0x379aba[_0x3c479a(0x146)](_0xe1e818=>!isSyncedAtMetadataLine(_0xe1e818,_0x48f349));return _0x554119[_0x3c479a(0x134)]('\x0a');}function isSyncedAtMetadataLine(_0xef0265,_0x3f0010){const _0x41086c=a191_0x4e9ab4;if(_0x3f0010===_0x41086c(0x12a))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x41086c(0x143)](_0xef0265);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x41086c(0x143)](_0xef0265);}
|
package/lib/commands/sql/push.js
CHANGED
|
@@ -1 +1 @@
|
|
|
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
|
+
const a192_0x138d30=a192_0x4daf;(function(_0x1b5c47,_0x7d1d62){const _0x475969=a192_0x4daf,_0x6945c3=_0x1b5c47();while(!![]){try{const _0x1eb3b7=-parseInt(_0x475969(0xc3))/0x1+parseInt(_0x475969(0xce))/0x2+-parseInt(_0x475969(0xed))/0x3*(parseInt(_0x475969(0xd2))/0x4)+parseInt(_0x475969(0xca))/0x5+-parseInt(_0x475969(0xf7))/0x6+parseInt(_0x475969(0xe4))/0x7*(parseInt(_0x475969(0xc6))/0x8)+parseInt(_0x475969(0xf0))/0x9;if(_0x1eb3b7===_0x7d1d62)break;else _0x6945c3['push'](_0x6945c3['shift']());}catch(_0x31d41e){_0x6945c3['push'](_0x6945c3['shift']());}}}(a192_0x2983,0xb4d0e));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';function a192_0x2983(){const _0x162ddd=['version','set','POST','1759990zgRkxE','filter','utf8','path','16OlmLHD','sqls','push','get','exec','No\x20database\x20matches\x20local\x20directory\x20\x22','\x22\x20for\x20sqlCode\x20','sqlCode','startsWith','catch','unchanged','join','force','lastSync','Push\x20local\x20SQL\x20files\x20to\x20remote','relativePath','toISOString','write','21Svhfbq','sqlRootDir','Local\x20directory\x20\x22','length','\x20failed','boolean','Would\x20push\x20','hash','entries','967068LVXzlz','Push\x20complete:\x20','dbName','7873380SlvOwO','projectRoot','sqlcode','filePath','\x20skipped,\x20','sqlRoot','dbDirectory','478236MghIux','validation','message','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','remoteId','trashDir','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','bool','has','isFinite','sql','appCode','\x20pushed,\x20','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','1320730HFgzif','sqlName','replace','1580584ZpLyOY','sqlConfig','dbId','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','5414740ZqaYlV'];a192_0x2983=function(){return _0x162ddd;};return a192_0x2983();}import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';async function getTargetSqlQueries(_0x188ba2,_0x5b37a8,_0x432406){const _0xf17ed9=a192_0x4daf,_0x558b84=await scanLocalSqlQueries(_0x188ba2),_0x449f06=new Map();for(const _0x5f50f6 of _0x558b84){if(_0x432406&&_0x5f50f6[_0xf17ed9(0xd9)]!==_0x432406)continue;const _0x1a3554=_0x449f06[_0xf17ed9(0xd5)](_0x5f50f6['sqlCode'])??[];_0x1a3554['push'](_0x5f50f6),_0x449f06[_0xf17ed9(0xcc)](_0x5f50f6[_0xf17ed9(0xd9)],_0x1a3554);}if(_0x432406&&!_0x449f06[_0xf17ed9(0xbd)](_0x432406))throw CliErrors[_0xf17ed9(0xf8)]('Local\x20SQL\x20not\x20found:\x20'+_0x432406);const _0x4edac5=[];for(const [_0x4244be,_0x2b7923]of _0x449f06[_0xf17ed9(0xec)]()){if(_0x2b7923[_0xf17ed9(0xe7)]===0x1){_0x4edac5['push'](_0x2b7923[0x0]);continue;}const _0x384a4a=_0x5b37a8[_0xf17ed9(0xd3)][_0x4244be],_0x2d0940=_0x384a4a?.[_0xf17ed9(0xd1)],_0x5c3976=_0x2d0940?_0x2b7923[_0xf17ed9(0xcf)](_0x3c4651=>_0x3c4651['relativePath']!==_0x2d0940):_0x2b7923;if(_0x384a4a&&_0x5c3976[_0xf17ed9(0xe7)]===0x1){_0x4edac5[_0xf17ed9(0xd4)](_0x5c3976[0x0]);continue;}throw CliErrors[_0xf17ed9(0xf8)](_0xf17ed9(0xbb)+_0x4244be+_0xf17ed9(0xba));}return _0x4edac5;}export const sqlPush={'service':a192_0x138d30(0xbf),'command':a192_0x138d30(0xd4),'description':a192_0x138d30(0xe0),'risk':a192_0x138d30(0xe3),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a192_0x138d30(0xde),'type':a192_0x138d30(0xe9),'description':a192_0x138d30(0xfa)}],async 'dryRun'(_0x16aa86){const _0x4a456e=a192_0x138d30,_0x3fcc10=loadSqlProjectConfig(_0x16aa86['appCode']),_0x47d076=await readSqlLockFile(_0x3fcc10['lockFilePath']),{appLock:_0x512bd8}=ensureSqlLockScope(_0x47d076??createEmptySqlLock(),_0x16aa86[_0x4a456e(0xc0)],_0x3fcc10[_0x4a456e(0xf5)],_0x4a456e(0xd4)),_0x4ff2c8=await getTargetSqlQueries(_0x3fcc10,_0x512bd8,_0x16aa86['str']('sqlcode')||undefined),_0x360756=[];for(const _0x5d48ad of _0x4ff2c8){const _0x26a425=await computeSqlFileHash(_0x5d48ad[_0x4a456e(0xf3)]),_0x4781d2=_0x512bd8[_0x4a456e(0xd3)][_0x5d48ad['sqlCode']],_0x37d3ad=!!_0x4781d2&&(_0x4781d2[_0x4a456e(0xd1)]!==_0x5d48ad[_0x4a456e(0xe1)]||!!_0x5d48ad[_0x4a456e(0xc4)]&&_0x4781d2[_0x4a456e(0xc4)]!==_0x5d48ad[_0x4a456e(0xc4)]);if(!_0x16aa86[_0x4a456e(0xbc)](_0x4a456e(0xde))&&_0x4781d2&&_0x4781d2[_0x4a456e(0xeb)]===_0x26a425&&!_0x37d3ad)continue;_0x360756[_0x4a456e(0xd4)](_0x5d48ad[_0x4a456e(0xd9)]);}return{'method':_0x4a456e(0xcd),'url':'/smartapi/custom/updateUserCustomSql','body':{'sqlCodes':_0x360756,'appCode':_0x16aa86[_0x4a456e(0xc0)]},'description':_0x4a456e(0xea)+_0x360756[_0x4a456e(0xe7)]+'\x20SQL\x20file(s)'};},async 'execute'(_0x51d657){const _0x4bb01d=a192_0x138d30,_0x24d874=loadSqlProjectConfig(_0x51d657[_0x4bb01d(0xc0)]),_0x505554=await readSqlLockFile(_0x24d874['lockFilePath']),{lockData:_0x12e648,appLock:_0x4a4bd8}=ensureSqlLockScope(_0x505554??createEmptySqlLock(),_0x51d657[_0x4bb01d(0xc0)],_0x24d874['sqlRoot'],'push'),_0x20d042=await getTargetSqlQueries(_0x24d874,_0x4a4bd8,_0x51d657['str'](_0x4bb01d(0xf2))||undefined);if(_0x20d042[_0x4bb01d(0xe7)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':'No\x20local\x20SQL\x20files\x20found.'};const _0x42701b=[],_0x564737=[],_0x42c356=[];for(const _0x4002dc of _0x20d042){const _0x3e87f1=_0x4a4bd8[_0x4bb01d(0xd3)][_0x4002dc['sqlCode']];if(!_0x3e87f1){_0x42c356['push']({'sqlCode':_0x4002dc[_0x4bb01d(0xd9)],'error':_0x4bb01d(0xc2)});continue;}try{const _0x318271=await computeSqlFileHash(_0x4002dc[_0x4bb01d(0xf3)]),_0x5bd980=_0x3e87f1[_0x4bb01d(0xd1)]!==_0x4002dc[_0x4bb01d(0xe1)]||!!_0x4002dc[_0x4bb01d(0xc4)]&&_0x3e87f1['sqlName']!==_0x4002dc[_0x4bb01d(0xc4)];if(!_0x51d657['bool'](_0x4bb01d(0xde))&&_0x3e87f1[_0x4bb01d(0xeb)]===_0x318271&&!_0x5bd980){_0x564737['push']({'sqlCode':_0x4002dc[_0x4bb01d(0xd9)],'reason':_0x4bb01d(0xdc)});continue;}if(_0x3e87f1[_0x4bb01d(0xcb)]==null){_0x42c356['push']({'sqlCode':_0x4002dc[_0x4bb01d(0xd9)],'error':'missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first'});continue;}const _0x4653aa=await readFile(_0x4002dc[_0x4bb01d(0xf3)],_0x4bb01d(0xd0)),_0x3a1eca=stripLocalSqlMetadata(_0x4653aa,_0x4002dc['mode']),_0x5e2a68=_0x4002dc['sqlName']||_0x3e87f1[_0x4bb01d(0xc4)],_0x106271=await resolveTargetDbBinding(_0x51d657[_0x4bb01d(0xc0)],_0x4002dc,_0x3e87f1),_0x148c4b=await updateSqlQuery({'id':_0x3e87f1['remoteId'],'appCode':_0x51d657[_0x4bb01d(0xc0)],'sqlCode':_0x4002dc[_0x4bb01d(0xd9)],'sqlName':_0x5e2a68,'dbId':_0x106271['dbId'],'version':_0x3e87f1[_0x4bb01d(0xcb)],'sqlContent':_0x3a1eca,'sqlConfig':_0x3e87f1[_0x4bb01d(0xc7)]??undefined}),_0x31d153=_0x148c4b[_0x4bb01d(0xc8)]?await getDbName(_0x51d657['appCode'],Number(_0x148c4b['dbId']))[_0x4bb01d(0xdb)](()=>_0x106271[_0x4bb01d(0xef)]):_0x106271[_0x4bb01d(0xef)];_0x4a4bd8[_0x4bb01d(0xd3)][_0x4002dc['sqlCode']]={...buildSqlLockEntry(_0x148c4b,_0x3a1eca,_0x318271,{'dbName':_0x31d153}),'path':_0x4002dc[_0x4bb01d(0xe1)],'mode':_0x3e87f1['mode']},await archivePreviousSqlFileIfNeeded(_0x24d874,_0x3e87f1[_0x4bb01d(0xd1)],_0x4002dc[_0x4bb01d(0xe1)]),_0x42701b[_0x4bb01d(0xd4)]({'sqlCode':_0x4002dc[_0x4bb01d(0xd9)],'remoteId':_0x3e87f1[_0x4bb01d(0xfb)]});}catch(_0x23a801){_0x42c356[_0x4bb01d(0xd4)]({'sqlCode':_0x4002dc[_0x4bb01d(0xd9)],'error':_0x23a801 instanceof Error?_0x23a801[_0x4bb01d(0xf9)]:String(_0x23a801)});}}return _0x4a4bd8[_0x4bb01d(0xdf)]=new Date()['toISOString'](),await writeSqlLockFile(_0x24d874['lockFilePath'],_0x12e648),{'ok':_0x42c356['length']===0x0,'data':{'pushed':_0x42701b,'skipped':_0x564737,'failed':_0x42c356},'message':_0x4bb01d(0xee)+_0x42701b[_0x4bb01d(0xe7)]+_0x4bb01d(0xc1)+_0x564737[_0x4bb01d(0xe7)]+_0x4bb01d(0xf4)+_0x42c356['length']+_0x4bb01d(0xe8)};}};async function archivePreviousSqlFileIfNeeded(_0xa47179,_0x319b44,_0x16ce84){const _0x33656d=a192_0x138d30;if(!_0x319b44||_0x319b44===_0x16ce84)return;const _0x4b923b=join(_0xa47179[_0x33656d(0xe5)],_0x319b44);if(!await fileExists(_0x4b923b))return;const _0x29b67e=await moveToTrash(_0xa47179[_0x33656d(0xf1)],_0xa47179[_0x33656d(0xfc)],_0x4b923b);await cleanupEmptyDirectories(dirname(_0x4b923b),_0xa47179[_0x33656d(0xe5)]),void _0x29b67e;}async function moveToTrash(_0x598e07,_0x120224,_0x199d19){const _0x35afc9=a192_0x138d30,_0x5b17e1=new Date()[_0x35afc9(0xe2)]()[_0x35afc9(0xc5)](/[:.]/g,'-'),_0x399107=relative(_0x598e07,_0x199d19),_0x505c84=join(_0x120224,_0x5b17e1,_0x399107);return await mkdir(dirname(_0x505c84),{'recursive':!![]}),await rename(_0x199d19,_0x505c84),_0x505c84;}async function cleanupEmptyDirectories(_0xe817f0,_0x367943){const _0x83fa03=a192_0x138d30;let _0x2edf60=resolve(_0xe817f0);const _0x2f027d=resolve(_0x367943);while(_0x2edf60[_0x83fa03(0xda)](''+_0x2f027d+sep)||_0x2edf60===_0x2f027d){if(_0x2edf60===_0x2f027d)return;try{const _0x1bce6e=await readdir(_0x2edf60);if(_0x1bce6e[_0x83fa03(0xe7)]>0x0)return;await rmdir(_0x2edf60);}catch{return;}_0x2edf60=dirname(_0x2edf60);}}async function resolveTargetDbBinding(_0x9f9ac,_0x18629d,_0x354610){const _0x9a5c5a=a192_0x138d30,_0x4b4e6b=_0x18629d[_0x9a5c5a(0xf6)];if(!_0x4b4e6b)return{'dbId':_0x354610['dbId'],'dbName':_0x354610[_0x9a5c5a(0xef)]};const _0x2add63=buildDbDirectoryName(_0x354610['dbName'],_0x354610[_0x9a5c5a(0xc8)]);if(_0x4b4e6b===_0x2add63)return{'dbId':_0x354610[_0x9a5c5a(0xc8)],'dbName':_0x354610[_0x9a5c5a(0xef)]};const _0x8852d8=parseExplicitDbDirectory(_0x4b4e6b);if(_0x8852d8!=null)return{'dbId':_0x8852d8,'dbName':await getDbName(_0x9f9ac,_0x8852d8)[_0x9a5c5a(0xdb)](()=>undefined)};const _0x5af375=await listDatabases(_0x9f9ac),_0x1c530a=_0x5af375[_0x9a5c5a(0xcf)](_0x453d05=>buildDbDirectoryName(_0x453d05[_0x9a5c5a(0xef)],_0x453d05[_0x9a5c5a(0xc8)])===_0x4b4e6b);if(_0x1c530a[_0x9a5c5a(0xe7)]===0x1)return{'dbId':_0x1c530a[0x0][_0x9a5c5a(0xc8)],'dbName':_0x1c530a[0x0][_0x9a5c5a(0xef)]};if(_0x1c530a['length']===0x0)throw CliErrors['validation'](_0x9a5c5a(0xd7)+_0x4b4e6b+_0x9a5c5a(0xd8)+_0x18629d[_0x9a5c5a(0xd9)]+'.');const _0x86938b=_0x1c530a['map'](_0x161577=>_0x161577[_0x9a5c5a(0xef)]+'\x20('+_0x161577[_0x9a5c5a(0xc8)]+')')[_0x9a5c5a(0xdd)](',\x20');throw CliErrors[_0x9a5c5a(0xf8)](_0x9a5c5a(0xe6)+_0x4b4e6b+_0x9a5c5a(0xc9)+_0x18629d[_0x9a5c5a(0xd9)]+':\x20'+_0x86938b);}function a192_0x4daf(_0x601ee1,_0x1d2cf6){_0x601ee1=_0x601ee1-0xba;const _0x298325=a192_0x2983();let _0x4daf07=_0x298325[_0x601ee1];return _0x4daf07;}function parseExplicitDbDirectory(_0x2a66bc){const _0x325468=a192_0x138d30,_0x2d36a7=/^db-(\d+)$/[_0x325468(0xd6)](_0x2a66bc);if(!_0x2d36a7)return null;const _0x139537=Number(_0x2d36a7[0x1]);return Number[_0x325468(0xbe)](_0x139537)&&_0x139537>0x0?_0x139537:null;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x2ccc04,_0x1b34aa){const _0x4902d3=a193_0x3848,_0x5165af=_0x2ccc04();while(!![]){try{const _0x34776f=parseInt(_0x4902d3(0x1fa))/0x1+parseInt(_0x4902d3(0x201))/0x2+parseInt(_0x4902d3(0x1e7))/0x3+parseInt(_0x4902d3(0x1e5))/0x4*(-parseInt(_0x4902d3(0x206))/0x5)+parseInt(_0x4902d3(0x1ed))/0x6*(-parseInt(_0x4902d3(0x1ef))/0x7)+parseInt(_0x4902d3(0x205))/0x8*(parseInt(_0x4902d3(0x1ec))/0x9)+-parseInt(_0x4902d3(0x202))/0xa;if(_0x34776f===_0x1b34aa)break;else _0x5165af['push'](_0x5165af['shift']());}catch(_0x30466b){_0x5165af['push'](_0x5165af['shift']());}}}(a193_0x3f3a,0xa3f27));import{createInterface}from'node:readline';import{join}from'node:path';import{buildDefaultSqlFileName,buildSqlRelativePath,detectSqlMode}from'../../core/sql-sync/utils.js';function a193_0x3f3a(){const _0x26f76d=['toLowerCase','4xgsaKG','lastSync','3027567HlHfDa','\x20[y/N]\x20','--\x20@lovrabet.','trimStart','syncedAt','918045AnxKus','12pNKSXq','length','973210sDktSf','sqlName','sqls','sqlConfig','sqlCode','dbId','sqlContent','mode','dbName','test','version','526146XXHegy','split','close','fromEntries','trim','stdin','apps','1834802NunTjB','5751550VTiJQj','description','yes','8Tuntpm','5149995FotKfN','entries','path','question','replace','includes','filter','push','join','map'];a193_0x3f3a=function(){return _0x26f76d;};return a193_0x3f3a();}export const SQL_LOCAL_REL_DIR='.rabetbase/sql';export function buildSqlLockEntry(_0x5c9d01,_0x22bc94,_0x12b8f2,_0x495fc3){const _0x2b6fb9=a193_0x3848,_0x499a43=detectSqlMode(_0x22bc94);return{'path':buildSqlRelativePath(_0x5c9d01[_0x2b6fb9(0x1f3)],_0x5c9d01[_0x2b6fb9(0x1f0)],_0x495fc3?.['dbName'],_0x499a43,_0x5c9d01[_0x2b6fb9(0x1f4)]),'hash':_0x12b8f2,'remoteId':_0x5c9d01['id'],'version':_0x5c9d01[_0x2b6fb9(0x1f9)],'dbId':Number(_0x5c9d01['dbId']),'dbName':_0x495fc3?.[_0x2b6fb9(0x1f7)],'sqlName':_0x5c9d01[_0x2b6fb9(0x1f0)],'sqlConfig':_0x5c9d01[_0x2b6fb9(0x1f2)]??undefined,'mode':_0x499a43};}export function cloneSqlLockData(_0x513d7d){const _0x1d882e=a193_0x3848;return{'apps':Object[_0x1d882e(0x1fd)](Object[_0x1d882e(0x207)](_0x513d7d[_0x1d882e(0x200)])['map'](([_0x3e78f2,_0xd0656a])=>[_0x3e78f2,{'sqlRoot':_0xd0656a['sqlRoot'],'lastSync':_0xd0656a[_0x1d882e(0x1e6)],'sqls':{..._0xd0656a[_0x1d882e(0x1f1)]}}]))};}export function ensureRemoteSqlContent(_0xc8720d){const _0x4a59d9=a193_0x3848;return _0xc8720d[_0x4a59d9(0x1f5)]??'';}export function buildLocalSqlFileContent(_0x2e227d,_0x1104ce,_0x54d5f5){const _0x312ed2=a193_0x3848,_0x55ac23=_0x54d5f5?.[_0x312ed2(0x1f6)]??detectSqlMode(_0x1104ce),_0x32b69d=stripLocalSqlMetadata(_0x1104ce,_0x55ac23)[_0x312ed2(0x1fe)](),_0x1b0844=[...buildMetadataHeaderLines({'sqlCode':_0x2e227d[_0x312ed2(0x1f3)],'sqlName':_0x2e227d['sqlName'],'dbId':_0x2e227d['dbId'],'dbName':_0x54d5f5?.[_0x312ed2(0x1f7)],'mode':_0x55ac23,'syncedAt':_0x54d5f5?.[_0x312ed2(0x1eb)],'description':_0x54d5f5?.[_0x312ed2(0x203)]},_0x55ac23),'',_0x32b69d],_0x2cae85=_0x1b0844[_0x312ed2(0x1e2)]('\x0a');return _0x2cae85['endsWith']('\x0a')?_0x2cae85:_0x2cae85+'\x0a';}function a193_0x3848(_0x1b8382,_0x5b0b94){_0x1b8382=_0x1b8382-0x1de;const _0x3f3ae5=a193_0x3f3a();let _0x384852=_0x3f3ae5[_0x1b8382];return _0x384852;}export function stripLocalSqlMetadata(_0x1e5d15,_0x51a5ff){const _0x328374=a193_0x3848,_0x4a99d4=_0x1e5d15[_0x328374(0x1de)](/\r\n/g,'\x0a')[_0x328374(0x1fb)]('\x0a'),_0x10d65f=[];let _0x1b3d28=0x0;if(_0x51a5ff==='mybatisXml')while(_0x1b3d28<_0x4a99d4[_0x328374(0x1ee)]){const _0x1911f6=_0x4a99d4[_0x1b3d28]??'';if(/^\s*<!--\s*@lovrabet\./[_0x328374(0x1f8)](_0x1911f6)){_0x1b3d28++;continue;}if(_0x1911f6[_0x328374(0x1fe)]()===''&&_0x1b3d28>0x0){_0x1b3d28++;continue;}break;}else while(_0x1b3d28<_0x4a99d4['length']){const _0x365702=_0x4a99d4[_0x1b3d28]??'';if(/^\s*--\s*@lovrabet\./[_0x328374(0x1f8)](_0x365702)){_0x1b3d28++;continue;}if(_0x365702[_0x328374(0x1fe)]()===''&&_0x1b3d28>0x0){_0x1b3d28++;continue;}break;}for(;_0x1b3d28<_0x4a99d4[_0x328374(0x1ee)];_0x1b3d28++){_0x10d65f[_0x328374(0x1e1)](_0x4a99d4[_0x1b3d28]);}return _0x10d65f[_0x328374(0x1e2)]('\x0a')[_0x328374(0x1ea)]();}export function resolveSqlMode(_0xdecb1e,_0x55877e){const _0x5f2330=a193_0x3848;if(_0x55877e?.[_0x5f2330(0x1f6)])return _0x55877e[_0x5f2330(0x1f6)];return detectSqlMode(_0xdecb1e);}export function resolveSqlFileName(_0x3fa19e,_0x2cdeeb,_0x4c772a){const _0x1fafca=a193_0x3848;if(_0x4c772a?.['path'])return _0x4c772a[_0x1fafca(0x208)];if(_0x4c772a?.['sqlName']||_0x4c772a?.[_0x1fafca(0x1f7)])return buildSqlRelativePath(_0x3fa19e,_0x4c772a?.[_0x1fafca(0x1f0)],_0x4c772a?.[_0x1fafca(0x1f7)],resolveSqlMode(_0x2cdeeb,_0x4c772a),_0x4c772a?.['dbId']);return buildDefaultSqlFileName(_0x3fa19e,resolveSqlMode(_0x2cdeeb,_0x4c772a));}export function resolveSqlLocalDir(_0x4e063b,_0x42655c){return join(_0x4e063b,SQL_LOCAL_REL_DIR,_0x42655c);}export async function confirmForceOverwrite(_0xc2394f){const _0x2730ad=a193_0x3848,_0x3bcd34=createInterface({'input':process[_0x2730ad(0x1ff)],'output':process['stderr']}),_0x2a176b=await new Promise(_0x5221f2=>{const _0x555673=_0x2730ad;_0x3bcd34[_0x555673(0x209)](_0xc2394f+_0x555673(0x1e8),_0x5221f2);});return _0x3bcd34[_0x2730ad(0x1fc)](),['y',_0x2730ad(0x204)][_0x2730ad(0x1df)](_0x2a176b['trim']()[_0x2730ad(0x1e4)]());}export function findSqlLockScope(_0x3c9e36,_0x30155a){return _0x3c9e36['apps'][_0x30155a];}function buildMetadataHeaderLines(_0x3b5fcb,_0x5516f5){const _0x1be853=a193_0x3848,_0x33020f=[[_0x1be853(0x1f3),_0x3b5fcb[_0x1be853(0x1f3)]],['sqlName',_0x3b5fcb[_0x1be853(0x1f0)]],[_0x1be853(0x1f4),_0x3b5fcb[_0x1be853(0x1f4)]],[_0x1be853(0x1f7),_0x3b5fcb[_0x1be853(0x1f7)]],[_0x1be853(0x1f6),_0x3b5fcb[_0x1be853(0x1f6)]],[_0x1be853(0x1eb),_0x3b5fcb['syncedAt']],[_0x1be853(0x203),_0x3b5fcb['description']]];if(_0x5516f5==='mybatisXml')return _0x33020f[_0x1be853(0x1e0)](([,_0x5212ae])=>_0x5212ae!==undefined&&_0x5212ae!==null&&String(_0x5212ae)[_0x1be853(0x1fe)]()!=='')['map'](([_0x350450,_0x20cfd6])=>'<!--\x20@lovrabet.'+_0x350450+':\x20'+String(_0x20cfd6)+'\x20-->');return _0x33020f[_0x1be853(0x1e0)](([,_0x2d52c4])=>_0x2d52c4!==undefined&&_0x2d52c4!==null&&String(_0x2d52c4)[_0x1be853(0x1fe)]()!=='')[_0x1be853(0x1e3)](([_0xfed56b,_0xd428a8])=>_0x1be853(0x1e9)+_0xfed56b+':\x20'+String(_0xd428a8));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a194_0x33bb81=a194_0xa6ea;function a194_0xa6ea(_0x57be2e,_0xf5f74a){_0x57be2e=_0x57be2e-0x14f;const _0x37bb09=a194_0x37bb();let _0xa6ea8f=_0x37bb09[_0x57be2e];return _0xa6ea8f;}(function(_0x592ee8,_0xbda586){const _0x18e4bf=a194_0xa6ea,_0x10bc23=_0x592ee8();while(!![]){try{const _0x5b3fac=parseInt(_0x18e4bf(0x15b))/0x1+parseInt(_0x18e4bf(0x155))/0x2+parseInt(_0x18e4bf(0x15e))/0x3*(-parseInt(_0x18e4bf(0x157))/0x4)+-parseInt(_0x18e4bf(0x15f))/0x5*(-parseInt(_0x18e4bf(0x15c))/0x6)+parseInt(_0x18e4bf(0x150))/0x7*(-parseInt(_0x18e4bf(0x14f))/0x8)+-parseInt(_0x18e4bf(0x16f))/0x9+parseInt(_0x18e4bf(0x164))/0xa;if(_0x5b3fac===_0xbda586)break;else _0x10bc23['push'](_0x10bc23['shift']());}catch(_0x1b0938){_0x10bc23['push'](_0x10bc23['shift']());}}}(a194_0x37bb,0xd729c));import{listSqlQueries}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';function a194_0x37bb(){const _0x1f0721=['sqlRoot','has','path','filePath','push','lockKey','tableData','11993211VrqjHv','sqlCode','Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally','856712FaDqdt','49MHGBrH','bool','\x20missing,\x20','length','\x20modified,\x20','3020112WOCBUQ','sqlName','53008CmlKfu','\x20added,\x20','paging','boolean','1039129qmRKfI','456dUMNvd','status','93bsPSSq','5205YwiWOR','appCode','All\x20SQL\x20queries\x20are\x20in\x20sync.','relativePath','\x20unchanged','7460210mxSMOA','remote','Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','totalCount'];a194_0x37bb=function(){return _0x1f0721;};return a194_0x37bb();}import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile}from'../../core/sql-sync/lock.js';const PAGE_SIZE=0x64;async function fetchAllSqlCodes(_0x1efdf0){const _0x5076de=a194_0xa6ea,_0x1ca39c=[];let _0x15fe56=0x1;while(!![]){const _0x229834=await listSqlQueries(_0x1efdf0,{'currentPage':_0x15fe56,'pageSize':PAGE_SIZE}),_0xa8ae5=_0x229834[_0x5076de(0x16e)]??[];_0x1ca39c[_0x5076de(0x16c)](..._0xa8ae5['map'](_0x183c0a=>_0x183c0a[_0x5076de(0x170)]));if(_0xa8ae5[_0x5076de(0x153)]===0x0)break;const _0x4192e7=_0x229834[_0x5076de(0x159)]?.[_0x5076de(0x167)];if(_0x4192e7!=null?_0x1ca39c[_0x5076de(0x153)]>=_0x4192e7:_0xa8ae5[_0x5076de(0x153)]<PAGE_SIZE)break;_0x15fe56++;}return _0x1ca39c;}export const sqlStatus={'service':'sql','command':a194_0x33bb81(0x15d),'description':a194_0x33bb81(0x166),'risk':'read','flags':[{'name':a194_0x33bb81(0x165),'type':a194_0x33bb81(0x15a),'description':a194_0x33bb81(0x171)}],async 'execute'(_0x3f8a82){const _0x2c41bb=a194_0x33bb81,_0xf68b5d=loadSqlProjectConfig(_0x3f8a82[_0x2c41bb(0x160)]),_0x37ad05=await readSqlLockFile(_0xf68b5d['lockFilePath']),{appLock:_0x374dee}=ensureSqlLockScope(_0x37ad05??createEmptySqlLock(),_0xf68b5d[_0x2c41bb(0x160)],_0xf68b5d[_0x2c41bb(0x168)],_0x2c41bb(0x15d)),_0x4ad879=await scanLocalSqlQueries(_0xf68b5d),_0x2cbf39=[],_0x41cd21=[],_0x7c0598=[],_0x8c3f61=[],_0x186298=new Set(_0x4ad879['map'](_0x2077ae=>_0x2077ae['lockKey']));for(const _0x12e9e2 of _0x4ad879){const _0x30ed46=await computeSqlFileHash(_0x12e9e2[_0x2c41bb(0x16b)]),_0x267b58=_0x374dee['sqls'][_0x12e9e2[_0x2c41bb(0x16d)]],_0x4eee2a=!!_0x267b58&&_0x267b58[_0x2c41bb(0x16a)]!==_0x12e9e2[_0x2c41bb(0x162)],_0x1de5b3=!!_0x267b58&&!!_0x12e9e2['sqlName']&&_0x267b58[_0x2c41bb(0x156)]!==_0x12e9e2[_0x2c41bb(0x156)];if(!_0x267b58)_0x2cbf39['push'](_0x12e9e2[_0x2c41bb(0x16d)]);else _0x267b58['hash']!==_0x30ed46||_0x4eee2a||_0x1de5b3?_0x41cd21[_0x2c41bb(0x16c)](_0x12e9e2[_0x2c41bb(0x16d)]):_0x7c0598[_0x2c41bb(0x16c)](_0x12e9e2['lockKey']);}for(const _0x429c15 of Object['keys'](_0x374dee['sqls'])){!_0x186298[_0x2c41bb(0x169)](_0x429c15)&&_0x8c3f61['push'](_0x429c15);}const _0x8ce15b=[];if(_0x3f8a82[_0x2c41bb(0x151)]('remote')){const _0x2f14ef=await fetchAllSqlCodes(_0x3f8a82[_0x2c41bb(0x160)]);for(const _0x39dc5e of _0x2f14ef){!_0x186298[_0x2c41bb(0x169)](_0x39dc5e)&&!_0x374dee['sqls'][_0x39dc5e]&&_0x8ce15b[_0x2c41bb(0x16c)](_0x39dc5e);}}const _0xe5162d=_0x2cbf39['length']===0x0&&_0x41cd21[_0x2c41bb(0x153)]===0x0&&_0x8c3f61['length']===0x0&&_0x8ce15b[_0x2c41bb(0x153)]===0x0;return{'ok':!![],'data':{'added':_0x2cbf39,'modified':_0x41cd21,'missing':_0x8c3f61,'unchanged':_0x7c0598,'remoteOnly':_0x8ce15b},'message':_0xe5162d?_0x2c41bb(0x161):_0x2cbf39[_0x2c41bb(0x153)]+_0x2c41bb(0x158)+_0x41cd21[_0x2c41bb(0x153)]+_0x2c41bb(0x154)+_0x8c3f61[_0x2c41bb(0x153)]+_0x2c41bb(0x152)+_0x7c0598['length']+_0x2c41bb(0x163)+(_0x8ce15b['length']>0x0?',\x20'+_0x8ce15b['length']+'\x20remote-only':'')};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a195_0x1c29(){const _0x4771b6=['flagMissing','file','find','fields','9MeCpil','4199352qGhzKx','indexName','Audit\x20top-level\x20JOIN\x20equality\x20predicates\x20against\x20dataset\x20index\x20metadata','check-indexes','isArray','schema:','\x22\x20not\x20found\x20in\x20any\x20dataset','cwd','from','Comma-separated\x20dataset\x20codes\x20to\x20cross-check\x20table/column\x20names\x20against','File\x20not\x20found:\x20','parameters','Provide\x20--file\x20or\x20--sql','dbtableConfig','sqlType','tableName','columnNames','Validate\x20SQL\x20content\x20without\x20saving\x20(type\x20detection,\x20parameter\x20extraction,\x20optional\x20schema\x20check)','1404854DFyxjb','1993324ZnbfQo','validate','4389904RqQiiZ','Dataset\x20\x22','index_columns','17yOuRIr','Table\x20\x22','utf-8','3QfuaLE','length','str','size','isDangerous','get','370468zrssGg','tables','string','map','isSelectOnly','unshift','57284yNIOVi','reason','\x22\x20not\x20found\x20or\x20not\x20accessible','valid','flatMap','sql','index_type','type','toLowerCase','filter','indexes','schemaWarnings','48IDSQav','schemas','validation','name','Path\x20to\x20the\x20SQL\x20file\x20to\x20validate','message','trim','columns','split','30MTDfSd','push','dataset','2676880ldFHhQ'];a195_0x1c29=function(){return _0x4771b6;};return a195_0x1c29();}function a195_0x3893(_0x57fd2d,_0x4d6bdd){_0x57fd2d=_0x57fd2d-0x90;const _0x1c291c=a195_0x1c29();let _0x3893ed=_0x1c291c[_0x57fd2d];return _0x3893ed;}const a195_0x1511b4=a195_0x3893;(function(_0x1fcd9a,_0x1bd691){const _0x2e7ec4=a195_0x3893,_0x181c22=_0x1fcd9a();while(!![]){try{const _0x136327=-parseInt(_0x2e7ec4(0x95))/0x1*(-parseInt(_0x2e7ec4(0xa4))/0x2)+parseInt(_0x2e7ec4(0x98))/0x3*(-parseInt(_0x2e7ec4(0x90))/0x4)+parseInt(_0x2e7ec4(0xbc))/0x5+parseInt(_0x2e7ec4(0xb0))/0x6*(-parseInt(_0x2e7ec4(0x9e))/0x7)+parseInt(_0x2e7ec4(0x92))/0x8*(-parseInt(_0x2e7ec4(0xc1))/0x9)+-parseInt(_0x2e7ec4(0xb9))/0xa*(-parseInt(_0x2e7ec4(0xd4))/0xb)+parseInt(_0x2e7ec4(0xc2))/0xc;if(_0x136327===_0x1bd691)break;else _0x181c22['push'](_0x181c22['shift']());}catch(_0x4eb4ce){_0x181c22['push'](_0x181c22['shift']());}}}(a195_0x1c29,0x458f5));import{readFileSync,existsSync}from'node:fs';import{resolve}from'node:path';import{validateSql}from'../../core/sql-validator.js';import{auditSqlJoinIndexes}from'../../core/sql-index-auditor.js';import{getDatasetDetail,listDatasets}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{assertDatasetIsDbTableBacked,filterDbTableBackedDatasets}from'../../commands/dataset/capability.js';export const sqlValidate={'service':a195_0x1511b4(0xa9),'command':a195_0x1511b4(0x91),'description':a195_0x1511b4(0xd3),'risk':'read','flags':[{'name':a195_0x1511b4(0xbe),'type':a195_0x1511b4(0xa0),'description':a195_0x1511b4(0xb4)},{'name':a195_0x1511b4(0xa9),'type':a195_0x1511b4(0xa0),'description':'Inline\x20SQL\x20content\x20to\x20validate\x20(alternative\x20to\x20--file)'},{'name':a195_0x1511b4(0xb1),'type':a195_0x1511b4(0xa0),'description':a195_0x1511b4(0xcb)},{'name':a195_0x1511b4(0xc5),'type':'boolean','description':a195_0x1511b4(0xc4)}],async 'execute'(_0x50c232){const _0x9eedf2=a195_0x1511b4,_0x112619=_0x50c232[_0x9eedf2(0x9a)](_0x9eedf2(0xbe)),_0x480745=_0x50c232['str'](_0x9eedf2(0xa9)),_0x1fd267=_0x50c232[_0x9eedf2(0x9a)](_0x9eedf2(0xb1)),_0x5182d1=_0x50c232['bool'](_0x9eedf2(0xc5));if(!_0x112619&&!_0x480745)throw CliErrors[_0x9eedf2(0xbd)](_0x9eedf2(0xbe),_0x9eedf2(0xce));if(_0x5182d1&&!_0x1fd267)throw CliErrors[_0x9eedf2(0xb2)]('--check-indexes\x20requires\x20--schemas.');let _0x539c09;if(_0x112619){const _0xe61f25=resolve(process[_0x9eedf2(0xc9)](),_0x112619);if(!existsSync(_0xe61f25))throw CliErrors['validation'](_0x9eedf2(0xcc)+_0xe61f25);_0x539c09=readFileSync(_0xe61f25,_0x9eedf2(0x97));}else _0x539c09=_0x480745;const _0x5cb5c9=validateSql(_0x539c09),_0x1388f0={'valid':_0x5cb5c9['valid'],'sqlType':_0x5cb5c9[_0x9eedf2(0xd0)][_0x9eedf2(0xab)],'isSelectOnly':_0x5cb5c9[_0x9eedf2(0xd0)][_0x9eedf2(0xa2)],'isDangerous':_0x5cb5c9[_0x9eedf2(0xd0)][_0x9eedf2(0x9c)],'tables':_0x5cb5c9['tables'],'parameters':_0x5cb5c9[_0x9eedf2(0xcd)],'message':_0x5cb5c9[_0x9eedf2(0xb5)]};_0x5cb5c9[_0x9eedf2(0xd0)][_0x9eedf2(0xa5)]&&(_0x1388f0[_0x9eedf2(0xa5)]=_0x5cb5c9[_0x9eedf2(0xd0)][_0x9eedf2(0xa5)]);if(_0x1fd267&&_0x5cb5c9['valid']){const _0x2f7a67=_0x1fd267['split'](',')['map'](_0x27c3f5=>_0x27c3f5[_0x9eedf2(0xb6)]())[_0x9eedf2(0xad)](Boolean),_0x1c7b75=[],_0xc66643=[],_0x51b10a=filterDbTableBackedDatasets(await listDatasets(_0x50c232['appCode'])),_0x57ff77=new Map(_0x51b10a[_0x9eedf2(0xa1)](_0x4513b4=>[_0x4513b4[_0x9eedf2(0xcf)]?.[_0x9eedf2(0xd1)]?.[_0x9eedf2(0xac)](),_0x4513b4]));for(const _0x489b27 of _0x5cb5c9[_0x9eedf2(0x9f)]){const _0x259538=_0x57ff77[_0x9eedf2(0x9d)](_0x489b27[_0x9eedf2(0xac)]());!_0x259538&&_0x1c7b75[_0x9eedf2(0xba)](_0x9eedf2(0x96)+_0x489b27+_0x9eedf2(0xc8));}for(const _0xd7b4b0 of _0x2f7a67){let _0x686d8a;try{_0x686d8a=await getDatasetDetail(_0xd7b4b0);}catch{_0x1c7b75['push'](_0x9eedf2(0x93)+_0xd7b4b0+_0x9eedf2(0xa6));continue;}assertDatasetIsDbTableBacked(_0x686d8a,'SQL\x20schema\x20validation');const _0x530666=Array[_0x9eedf2(0xc6)](_0x686d8a[_0x9eedf2(0xc0)])?_0x686d8a['fields']:[],_0x1fe0cc=new Set(_0x530666['map'](_0x1c37fe=>_0x1c37fe[_0x9eedf2(0xb3)]?.[_0x9eedf2(0xac)]())),_0x2bac4d=_0x686d8a[_0x9eedf2(0xcf)]?.[_0x9eedf2(0xd1)]||_0x686d8a[_0x9eedf2(0xd1)]||_0xd7b4b0;_0x1388f0[_0x9eedf2(0xc7)+_0x2bac4d]={'code':_0xd7b4b0,'tableName':_0x2bac4d,'fieldCount':_0x1fe0cc[_0x9eedf2(0x9b)],'fields':Array[_0x9eedf2(0xca)](_0x1fe0cc)};if(_0x5182d1){const _0x47ceb6=normalizeDatasetIndexes(_0x686d8a);_0xc66643[_0x9eedf2(0xba)]({'tableName':_0x2bac4d,..._0x47ceb6});}}_0x1c7b75['length']>0x0&&(_0x1388f0[_0x9eedf2(0xaf)]=_0x1c7b75),_0x5182d1&&(_0x1388f0['joinAudit']=auditSqlJoinIndexes(_0x539c09,_0xc66643));}return{'ok':_0x5cb5c9[_0x9eedf2(0xa7)],'data':_0x1388f0,'message':_0x5cb5c9[_0x9eedf2(0xb5)]};}};function normalizeDatasetIndexes(_0x50307f){const _0x138292=a195_0x1511b4,_0x13d3b3=Array[_0x138292(0xc6)](_0x50307f?.[_0x138292(0xbb)]?.['indexes'])?_0x50307f[_0x138292(0xbb)][_0x138292(0xae)]:Array['isArray'](_0x50307f?.[_0x138292(0xae)])?_0x50307f[_0x138292(0xae)]:[],_0x3cd5f7=_0x13d3b3[_0x138292(0xa8)](_0x4f0efc=>{const _0x15926f=_0x138292,_0x2f3249=Array['isArray'](_0x4f0efc?.[_0x15926f(0x94)])?_0x4f0efc['index_columns']:Array[_0x15926f(0xc6)](_0x4f0efc?.[_0x15926f(0xd2)])?_0x4f0efc[_0x15926f(0xd2)]:Array[_0x15926f(0xc6)](_0x4f0efc?.[_0x15926f(0xb7)])?_0x4f0efc[_0x15926f(0xb7)]:[],_0x3c2da3=_0x2f3249[_0x15926f(0xad)](_0x5ca7c5=>typeof _0x5ca7c5==='string')['map'](_0x1a0be2=>_0x1a0be2[_0x15926f(0xb6)]())[_0x15926f(0xad)](Boolean);if(_0x3c2da3['length']===0x0)return[];const _0x2fa4f4=[_0x4f0efc?.[_0x15926f(0xc3)],_0x4f0efc?.['index_name'],_0x4f0efc?.[_0x15926f(0xb3)]][_0x15926f(0xbf)](_0x2203e7=>typeof _0x2203e7===_0x15926f(0xa0)&&_0x2203e7[_0x15926f(0xb6)]()),_0xc17d32=[_0x4f0efc?.[_0x15926f(0xaa)],_0x4f0efc?.['type']]['find'](_0x21636e=>typeof _0x21636e===_0x15926f(0xa0)&&_0x21636e[_0x15926f(0xb6)]());return[{..._0x2fa4f4?{'name':_0x2fa4f4[_0x15926f(0xb6)]()}:{},..._0xc17d32?{'type':_0xc17d32[_0x15926f(0xb6)]()}:{},'columns':_0x3c2da3}];}),_0x3ef243=[..._0x3cd5f7],_0x208430=typeof _0x50307f?.[_0x138292(0xcf)]?.['pkField']===_0x138292(0xa0)?_0x50307f[_0x138292(0xcf)]['pkField'][_0x138292(0xb8)](',')['map'](_0x5cee3a=>_0x5cee3a[_0x138292(0xb6)]())[_0x138292(0xad)](Boolean):[];return _0x208430[_0x138292(0x99)]>0x0&&_0x3ef243[_0x138292(0xa3)]({'type':'primary','columns':_0x208430}),{'indexes':_0x3ef243,'metadataAvailable':_0x3cd5f7[_0x138292(0x99)]>0x0};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x316f04,_0x536ab9){const _0x1dc239=a196_0x3c04,_0x414497=_0x316f04();while(!![]){try{const _0xb89e26=parseInt(_0x1dc239(0xf3))/0x1*(-parseInt(_0x1dc239(0xf4))/0x2)+-parseInt(_0x1dc239(0xf7))/0x3*(-parseInt(_0x1dc239(0xf1))/0x4)+parseInt(_0x1dc239(0xf9))/0x5*(-parseInt(_0x1dc239(0xee))/0x6)+-parseInt(_0x1dc239(0xef))/0x7*(-parseInt(_0x1dc239(0xf2))/0x8)+parseInt(_0x1dc239(0xf0))/0x9+parseInt(_0x1dc239(0xf8))/0xa+parseInt(_0x1dc239(0xf5))/0xb*(-parseInt(_0x1dc239(0xf6))/0xc);if(_0xb89e26===_0x536ab9)break;else _0x414497['push'](_0x414497['shift']());}catch(_0x4f788f){_0x414497['push'](_0x414497['shift']());}}}(a196_0x2b91,0xe0ac6));function a196_0x2b91(){const _0xdb3a2e=['4QkxHoD','24pudaEo','31ujIWLG','95492ZAULnr','113465EHrAzu','3180SUjuSa','3871572WPsxNg','13313700sxMmRy','11285leXXpc','2532QGuBGn','4110911uWWwad','15323436hSmqZS'];a196_0x2b91=function(){return _0xdb3a2e;};return a196_0x2b91();}function a196_0x3c04(_0x450cf8,_0x25e5a1){_0x450cf8=_0x450cf8-0xee;const _0x2b916e=a196_0x2b91();let _0x3c0447=_0x2b916e[_0x450cf8];return _0x3c0447;}import{taskStatus}from'../../commands/task/status.js';export const taskDefinitions=[taskStatus];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a197_0x42f626=a197_0xf788;function a197_0xf788(_0x49923b,_0x4dc325){_0x49923b=_0x49923b-0x86;const _0x442dda=a197_0x442d();let _0xf788cd=_0x442dda[_0x49923b];return _0xf788cd;}(function(_0x59b73d,_0x3e3e66){const _0x2bc8ce=a197_0xf788,_0x1a704d=_0x59b73d();while(!![]){try{const _0x3f413f=parseInt(_0x2bc8ce(0x86))/0x1+parseInt(_0x2bc8ce(0x94))/0x2*(-parseInt(_0x2bc8ce(0x9b))/0x3)+-parseInt(_0x2bc8ce(0x9d))/0x4*(-parseInt(_0x2bc8ce(0x96))/0x5)+parseInt(_0x2bc8ce(0x8d))/0x6+-parseInt(_0x2bc8ce(0x87))/0x7*(parseInt(_0x2bc8ce(0x8e))/0x8)+-parseInt(_0x2bc8ce(0x8f))/0x9*(-parseInt(_0x2bc8ce(0x9a))/0xa)+-parseInt(_0x2bc8ce(0x93))/0xb;if(_0x3f413f===_0x3e3e66)break;else _0x1a704d['push'](_0x1a704d['shift']());}catch(_0x4c61f0){_0x1a704d['push'](_0x1a704d['shift']());}}}(a197_0x442d,0x34823));import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asyncTaskMessage,buildAsyncTaskStatusCommand,normalizeAsyncTask}from'../../commands/common/async-task.js';import{getAsyncTaskStatus}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';export const taskStatus={'service':'task','command':a197_0x42f626(0x9e),'description':a197_0x42f626(0x92),'risk':a197_0x42f626(0x88),'defaultOutputFormat':a197_0x42f626(0x99),'structuredErrors':!![],'flags':[{'name':a197_0x42f626(0x8c),'type':'string','required':!![],'description':a197_0x42f626(0x89)},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x5ad989){const _0x470b92=a197_0x42f626;if(!_0x5ad989[_0x470b92(0x91)](_0x470b92(0x8c))[_0x470b92(0x98)]())throw CliErrors[_0x470b92(0x8b)](_0x470b92(0x8c));},async 'execute'(_0x28ee42){const _0x548713=a197_0x42f626,_0x126a2f=_0x28ee42[_0x548713(0x91)](_0x548713(0x8c))[_0x548713(0x98)](),_0x3a6439=normalizeAsyncTask(await getAsyncTaskStatus(_0x126a2f,_0x28ee42[_0x548713(0x9c)],_0x28ee42['cookie']));if(_0x3a6439[_0x548713(0x97)]!==_0x126a2f)throw CliErrors[_0x548713(0x90)](_0x548713(0x95)+_0x126a2f+',\x20received\x20'+_0x3a6439[_0x548713(0x97)]+'.');const _0x338906=buildAsyncTaskStatusCommand(_0x3a6439[_0x548713(0x97)],_0x28ee42['appCode']);return{'ok':!![],'message':asyncTaskMessage(_0x3a6439),'data':{'appCode':_0x28ee42[_0x548713(0x9c)],..._0x3a6439,'query':_0x3a6439[_0x548713(0x8a)]?null:{'command':_0x338906}}};}};function a197_0x442d(){const _0x5612bd=['15996desJJh','Task\x20status\x20response\x20id\x20mismatch:\x20requested\x20','181330VGiNTq','taskId','trim','compress','30BxTWqR','66NcKWQg','appCode','4LoDDwt','status','311527qsnhqV','141113YuAkAY','read','Task\x20id\x20returned\x20by\x20an\x20asynchronous\x20platform\x20command','isTerminal','flagMissing','task-id','2054466GVpgRC','32flbRtQ','29223AnzNxr','apiError','str','Query\x20an\x20asynchronous\x20task;\x20repeat\x20for\x20PENDING\x20or\x20PROCESSING\x20until\x20SUCCESS\x20or\x20FAILED','2511058UEzdhM'];a197_0x442d=function(){return _0x5612bd;};return a197_0x442d();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a198_0x143d(){const _0x382070=['72UXQqVE','23891XAEpRg','2298241TUpoIu','20917195kehSlD','3gNDNZR','3976636khFIYy','30VhLjCX','13217TyGDOd','999445munrdq','344ZdAjEc','1423863QBasNf','50XgzLAt','28XAHxnq','12LfWsGd'];a198_0x143d=function(){return _0x382070;};return a198_0x143d();}(function(_0x18233f,_0x35697a){const _0x274e27=a198_0x2972,_0x21b35a=_0x18233f();while(!![]){try{const _0x32ac02=parseInt(_0x274e27(0x134))/0x1*(parseInt(_0x274e27(0x13a))/0x2)+parseInt(_0x274e27(0x13f))/0x3*(parseInt(_0x274e27(0x140))/0x4)+parseInt(_0x274e27(0x135))/0x5*(parseInt(_0x274e27(0x141))/0x6)+-parseInt(_0x274e27(0x13c))/0x7*(parseInt(_0x274e27(0x136))/0x8)+parseInt(_0x274e27(0x137))/0x9*(parseInt(_0x274e27(0x138))/0xa)+-parseInt(_0x274e27(0x13d))/0xb*(-parseInt(_0x274e27(0x13b))/0xc)+parseInt(_0x274e27(0x13e))/0xd*(-parseInt(_0x274e27(0x139))/0xe);if(_0x32ac02===_0x35697a)break;else _0x21b35a['push'](_0x21b35a['shift']());}catch(_0x5bfb12){_0x21b35a['push'](_0x21b35a['shift']());}}}(a198_0x143d,0xb7c62));import{tenantMembersListDefinition}from'../../commands/tenant/members-list.js';function a198_0x2972(_0x4c9797,_0x3f6cdf){_0x4c9797=_0x4c9797-0x134;const _0x143da9=a198_0x143d();let _0x2972da=_0x143da9[_0x4c9797];return _0x2972da;}export const tenantDefinitions=[tenantMembersListDefinition];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a199_0x37cfe5=a199_0x50e2;function a199_0x50e2(_0x4b185e,_0xc8b7cc){_0x4b185e=_0x4b185e-0x8a;const _0x2e69d6=a199_0x2e69();let _0x50e233=_0x2e69d6[_0x4b185e];return _0x50e233;}(function(_0x540f0a,_0x2f702f){const _0x1ef714=a199_0x50e2,_0x445e6f=_0x540f0a();while(!![]){try{const _0x162695=parseInt(_0x1ef714(0x9e))/0x1+parseInt(_0x1ef714(0x8d))/0x2+parseInt(_0x1ef714(0x9a))/0x3*(parseInt(_0x1ef714(0x8b))/0x4)+parseInt(_0x1ef714(0x9f))/0x5+-parseInt(_0x1ef714(0x8c))/0x6*(parseInt(_0x1ef714(0x90))/0x7)+-parseInt(_0x1ef714(0x8a))/0x8+-parseInt(_0x1ef714(0x91))/0x9*(-parseInt(_0x1ef714(0x8e))/0xa);if(_0x162695===_0x2f702f)break;else _0x445e6f['push'](_0x445e6f['shift']());}catch(_0x2700cd){_0x445e6f['push'](_0x445e6f['shift']());}}}(a199_0x2e69,0xbcb05));import{listCurrentUserTenantMemberships,listTenantDirectoryMembers}from'../../core/api-client.js';function a199_0x2e69(){const _0x3da4f9=['Exact\x20tenant\x20code','\x20tenant\x20member(s)','members-list','flagMissing','1214103JmamWd','tenant-code','trim','str','98083LOMiMP','614665olrzzb','1644208uRasux','4FiBnyj','30KotpKe','1153202zPkkBB','1914170SgRYHk','tenant','581476PnJUqg','9zygaPJ','string','length','Found\x20','Pass\x20--tenant-code\x20<code>.'];a199_0x2e69=function(){return _0x3da4f9;};return a199_0x2e69();}import{CliErrors}from'../../errors.js';import{assertTenantAccessible,projectTenantMembers}from'../../commands/tenant/shared.js';export const tenantMembersListDefinition={'service':a199_0x37cfe5(0x8f),'command':a199_0x37cfe5(0x98),'description':'List\x20members\x20of\x20a\x20tenant\x20available\x20to\x20the\x20current\x20account','risk':'read','requiresAuth':!![],'requiresAppCode':![],'structuredErrors':!![],'flags':[{'name':a199_0x37cfe5(0x9b),'type':a199_0x37cfe5(0x92),'required':!![],'description':a199_0x37cfe5(0x96)}],async 'validate'(_0x531032){const _0x41c733=a199_0x37cfe5;if(!_0x531032[_0x41c733(0x9d)](_0x41c733(0x9b))[_0x41c733(0x9c)]())throw CliErrors[_0x41c733(0x99)](_0x41c733(0x9b),_0x41c733(0x95));},async 'execute'(_0x94a34b){const _0x336f4d=a199_0x37cfe5,_0x2fbc34=_0x94a34b[_0x336f4d(0x9d)](_0x336f4d(0x9b))['trim'](),_0x43f4c0=await listCurrentUserTenantMemberships();assertTenantAccessible(_0x2fbc34,_0x43f4c0);const _0x22796a=projectTenantMembers(await listTenantDirectoryMembers(_0x2fbc34));return{'ok':!![],'data':{'tenantCode':_0x2fbc34,'items':_0x22796a,'totalCount':_0x22796a[_0x336f4d(0x93)]},'message':_0x336f4d(0x94)+_0x22796a['length']+_0x336f4d(0x97)};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x3929d1,_0x4c040f){const _0x3aa5f1=a200_0x2d43,_0x1e1acc=_0x3929d1();while(!![]){try{const _0x146c23=-parseInt(_0x3aa5f1(0x1c2))/0x1+-parseInt(_0x3aa5f1(0x1bb))/0x2*(parseInt(_0x3aa5f1(0x1c0))/0x3)+-parseInt(_0x3aa5f1(0x1ba))/0x4*(-parseInt(_0x3aa5f1(0x1c7))/0x5)+-parseInt(_0x3aa5f1(0x1b4))/0x6*(parseInt(_0x3aa5f1(0x1cc))/0x7)+-parseInt(_0x3aa5f1(0x1bf))/0x8+parseInt(_0x3aa5f1(0x1b5))/0x9*(-parseInt(_0x3aa5f1(0x1c9))/0xa)+-parseInt(_0x3aa5f1(0x1ca))/0xb*(-parseInt(_0x3aa5f1(0x1b8))/0xc);if(_0x146c23===_0x4c040f)break;else _0x1e1acc['push'](_0x1e1acc['shift']());}catch(_0x2a2048){_0x1e1acc['push'](_0x1e1acc['shift']());}}}(a200_0x4aef,0xaef64));import{CliErrors}from'../../errors.js';function textOrNull(_0x1d70c6){const _0x865a66=_0x1d70c6?.['trim']();return _0x865a66?_0x865a66:null;}function a200_0x4aef(){const _0x50f478=['238992XgneaL','displayName','15052FiQUmz','694ppMVvO','sort','nickname','username','8754080FSmNVh','1380XMfGey','role','619723LSqGAP','validation','ADMIN','userId','get','865jHHlTF','isFinite','285320JJNiNG','2486KOvkbi','status','41566OTEMVx','values','\x22\x20is\x20not\x20available\x20to\x20the\x20current\x20account.','1320jesOUd','396wUCOmj','set','tenantCode'];a200_0x4aef=function(){return _0x50f478;};return a200_0x4aef();}export function projectTenantMembers(_0x200b6e){const _0x533df7=a200_0x2d43,_0x22c86b=new Map();for(const _0x492f17 of _0x200b6e){const _0xf9e2fd=Number(_0x492f17[_0x533df7(0x1c5)]);if(!Number[_0x533df7(0x1c8)](_0xf9e2fd)||_0xf9e2fd<=0x0)continue;const _0x1733e0={'userId':_0xf9e2fd,'username':textOrNull(_0x492f17[_0x533df7(0x1be)]),'displayName':textOrNull(_0x492f17[_0x533df7(0x1bd)]),'role':_0x492f17['adminFlag']===!![]?_0x533df7(0x1c4):'MEMBER','status':textOrNull(_0x492f17['status'])},_0x4c7fad=_0x22c86b[_0x533df7(0x1c6)](_0xf9e2fd);if(!_0x4c7fad){_0x22c86b[_0x533df7(0x1b6)](_0xf9e2fd,_0x1733e0);continue;}_0x4c7fad[_0x533df7(0x1be)]??=_0x1733e0[_0x533df7(0x1be)],_0x4c7fad['displayName']??=_0x1733e0[_0x533df7(0x1b9)],_0x4c7fad[_0x533df7(0x1cb)]??=_0x1733e0['status'];if(_0x1733e0[_0x533df7(0x1c1)]==='ADMIN')_0x4c7fad[_0x533df7(0x1c1)]=_0x533df7(0x1c4);}return[..._0x22c86b[_0x533df7(0x1cd)]()][_0x533df7(0x1bc)]((_0x1b8e2d,_0x56aa21)=>_0x1b8e2d[_0x533df7(0x1c5)]-_0x56aa21[_0x533df7(0x1c5)]);}function a200_0x2d43(_0x5d3d78,_0x5c8818){_0x5d3d78=_0x5d3d78-0x1b3;const _0x4aef6=a200_0x4aef();let _0x2d4374=_0x4aef6[_0x5d3d78];return _0x2d4374;}export function assertTenantAccessible(_0x29d8f4,_0x3338f8){const _0x146a36=a200_0x2d43;if(_0x3338f8['some'](_0x57042b=>_0x57042b[_0x146a36(0x1b7)]===_0x29d8f4))return;throw CliErrors[_0x146a36(0x1c3)]('Tenant\x20\x22'+_0x29d8f4+_0x146a36(0x1b3),'Check\x20--tenant-code\x20or\x20login\x20with\x20an\x20account\x20that\x20belongs\x20to\x20this\x20tenant.');}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a201_0x34a4a9=a201_0x2fae;(function(_0x33bad4,_0x4a0a99){const _0x462544=a201_0x2fae,_0x17cc02=_0x33bad4();while(!![]){try{const _0x46bce5=parseInt(_0x462544(0xc6))/0x1*(parseInt(_0x462544(0xc5))/0x2)+-parseInt(_0x462544(0xd0))/0x3*(-parseInt(_0x462544(0xcc))/0x4)+-parseInt(_0x462544(0xcf))/0x5+parseInt(_0x462544(0xcb))/0x6+parseInt(_0x462544(0xdc))/0x7+parseInt(_0x462544(0xd6))/0x8+-parseInt(_0x462544(0xd1))/0x9;if(_0x46bce5===_0x4a0a99)break;else _0x17cc02['push'](_0x17cc02['shift']());}catch(_0x1a061c){_0x17cc02['push'](_0x17cc02['shift']());}}}(a201_0x179c,0x889ab));import{asDryRunResult}from'../../commands/common/dry-run.js';import{bindDingTalkSandboxAccount,DING_TALK_SANDBOX_BIND_PATH}from'../../core/api-client.js';function a201_0x2fae(_0x425c61,_0x4df2ce){_0x425c61=_0x425c61-0xc4;const _0x179c9a=a201_0x179c();let _0x2fae24=_0x179c9a[_0x425c61];return _0x2fae24;}import{CliErrors}from'../../errors.js';const PROVIDER_ID=a201_0x34a4a9(0xd3),CURRENT_BINDING_WARNING=a201_0x34a4a9(0xd5);function readDingTalkUserId(_0x5eab67){const _0x55451d=a201_0x34a4a9,_0x1eda20=_0x5eab67[_0x55451d(0xdd)](_0x55451d(0xda))['trim']();if(!_0x1eda20)throw CliErrors[_0x55451d(0xd8)](_0x55451d(0xc8),'Pass\x20the\x20DingTalk\x20user\x20id\x20returned\x20by\x20the\x20sandbox.');return _0x1eda20;}function a201_0x179c(){const _0x494605=['533430SMsqSa','123933hNAqHB','17707203hajAXD','write','dingtalk','Bind\x20the\x20current\x20platform\x20user\x20to\x20a\x20DingTalk\x20sandbox\x20account','The\x20current\x20binding\x20is\x20not\x20exposed\x20by\x20the\x20server;\x20before\x20is\x20unavailable.','5105912CzOtok','string','validation','user-account','ding-talk-user-id','DingTalk\x20sandbox\x20account\x20binding\x20was\x20not\x20confirmed.','5887616tDZznK','str','dingding-sandbox-bind','Retry\x20with\x20the\x20same\x20--ding-talk-user-id\x20only\x20after\x20checking\x20the\x20current\x20platform\x20session.','170SpKDPb','8382GhwObF','bind','--ding-talk-user-id\x20cannot\x20be\x20empty.','apiError','Bound\x20current\x20user\x20to\x20DingTalk\x20sandbox\x20account.','1164126FvHztL','24GocVZL','POST','DingTalk\x20user\x20id\x20returned\x20by\x20the\x20sandbox'];a201_0x179c=function(){return _0x494605;};return a201_0x179c();}function buildBindingData(_0x299232,_0x31e15f){const _0x2930ef=a201_0x34a4a9;return{'operation':_0x2930ef(0xc7),'selector':{'providerId':PROVIDER_ID,'dingTalkUserId':_0x299232},'before':null,'after':{'providerId':PROVIDER_ID,'dingTalkUserId':_0x299232,'bound':!![]},'dryRun':_0x31e15f,'backend':{'method':'POST','path':DING_TALK_SANDBOX_BIND_PATH},'warnings':[CURRENT_BINDING_WARNING]};}export const dingTalkSandboxBind={'service':a201_0x34a4a9(0xd9),'command':a201_0x34a4a9(0xde),'description':a201_0x34a4a9(0xd4),'risk':a201_0x34a4a9(0xd2),'requiresAuth':!![],'requiresAppCode':![],'structuredErrors':!![],'flags':[{'name':a201_0x34a4a9(0xda),'type':a201_0x34a4a9(0xd7),'required':!![],'description':a201_0x34a4a9(0xce)}],async 'validate'(_0x5e03f8){readDingTalkUserId(_0x5e03f8);},async 'dryRun'(_0x1263c7){const _0x3e0e74=a201_0x34a4a9,_0x58cf89=readDingTalkUserId(_0x1263c7);return asDryRunResult(buildBindingData(_0x58cf89,!![]),{'method':_0x3e0e74(0xcd),'url':DING_TALK_SANDBOX_BIND_PATH});},async 'execute'(_0xfe333a){const _0x5c3fe2=a201_0x34a4a9,_0x24a790=readDingTalkUserId(_0xfe333a),_0x21b6dd=await bindDingTalkSandboxAccount(_0x24a790);if(_0x21b6dd!==!![])throw CliErrors[_0x5c3fe2(0xc9)](_0x5c3fe2(0xdb),_0x5c3fe2(0xc4));return{'ok':!![],'data':buildBindingData(_0x24a790,![]),'message':_0x5c3fe2(0xca)};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a202_0x294a(_0x25e134,_0x376608){_0x25e134=_0x25e134-0x135;const _0x31ee50=a202_0x31ee();let _0x294a3f=_0x31ee50[_0x25e134];return _0x294a3f;}(function(_0x13975f,_0x50f5b8){const _0x53bcb7=a202_0x294a,_0x1f8bde=_0x13975f();while(!![]){try{const _0x29d8e9=-parseInt(_0x53bcb7(0x13e))/0x1*(-parseInt(_0x53bcb7(0x13b))/0x2)+-parseInt(_0x53bcb7(0x138))/0x3+parseInt(_0x53bcb7(0x136))/0x4+-parseInt(_0x53bcb7(0x139))/0x5+-parseInt(_0x53bcb7(0x13d))/0x6+-parseInt(_0x53bcb7(0x135))/0x7*(parseInt(_0x53bcb7(0x13c))/0x8)+parseInt(_0x53bcb7(0x13a))/0x9*(parseInt(_0x53bcb7(0x137))/0xa);if(_0x29d8e9===_0x50f5b8)break;else _0x1f8bde['push'](_0x1f8bde['shift']());}catch(_0x119e46){_0x1f8bde['push'](_0x1f8bde['shift']());}}}(a202_0x31ee,0x3daf3));import{dingTalkSandboxBind}from'../../commands/user-account/dingding-sandbox-bind.js';export const userAccountDefinitions=[dingTalkSandboxBind];function a202_0x31ee(){const _0x38669b=['1687808fgqGyH','2102814ZuBpFM','3CQymKz','14uPEPai','647864YTCLZZ','3200EWcAQt','812856iKXQEr','489805cxmSbM','30492nEjqTi','98578hIccLW'];a202_0x31ee=function(){return _0x38669b;};return a202_0x31ee();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a203_0x993b7d=a203_0x1d2e;(function(_0x5d42db,_0x5859ba){const _0x4b7c80=a203_0x1d2e,_0xae6449=_0x5d42db();while(!![]){try{const _0x21878c=-parseInt(_0x4b7c80(0x118))/0x1*(parseInt(_0x4b7c80(0x11a))/0x2)+-parseInt(_0x4b7c80(0x124))/0x3+parseInt(_0x4b7c80(0x122))/0x4*(parseInt(_0x4b7c80(0x121))/0x5)+-parseInt(_0x4b7c80(0x119))/0x6*(parseInt(_0x4b7c80(0x11e))/0x7)+-parseInt(_0x4b7c80(0x123))/0x8+-parseInt(_0x4b7c80(0x11b))/0x9+-parseInt(_0x4b7c80(0x11d))/0xa*(-parseInt(_0x4b7c80(0x11c))/0xb);if(_0x21878c===_0x5859ba)break;else _0xae6449['push'](_0xae6449['shift']());}catch(_0x302896){_0xae6449['push'](_0xae6449['shift']());}}}(a203_0x217b,0x1adcf));import{buildAppAddFlags,runAppAdd,validateAppName}from'../../commands/common/app-registry.js';function a203_0x1d2e(_0x50fb3f,_0x578725){_0x50fb3f=_0x50fb3f-0x117;const _0x217bb3=a203_0x217b();let _0x1d2e36=_0x217bb3[_0x50fb3f];return _0x1d2e36;}function a203_0x217b(){const _0x6225a0=['80674bpZJTx','839547upciSg','418WRuzMu','159370pVUABT','470932AccGyb','workspace','write','290BjWZfy','4736AAEjdq','1395544mKZVHL','203691NTTYyl','workspace\x20add','name','4jyrEzz','6AKqiqI'];a203_0x217b=function(){return _0x6225a0;};return a203_0x217b();}export const workspaceAddDefinition={'service':a203_0x993b7d(0x11f),'command':'add','description':'Register\x20an\x20app\x20profile\x20in\x20the\x20current\x20workspace\x20(or\x20--global)','risk':a203_0x993b7d(0x120),'requiresAuth':![],'requiresAppCode':![],'args':[{'name':a203_0x993b7d(0x117),'description':'App\x20profile\x20name','required':!![]}],'flags':buildAppAddFlags(),'validate':_0x1374b7=>validateAppName(_0x1374b7,'workspace\x20add'),'execute':_0x40a46e=>runAppAdd(_0x40a46e,a203_0x993b7d(0x125))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a204_0x1ea037=a204_0x5576;(function(_0x13f328,_0x3c52a2){const _0x219f0a=a204_0x5576,_0x23a685=_0x13f328();while(!![]){try{const _0xb5e486=-parseInt(_0x219f0a(0x1a0))/0x1*(parseInt(_0x219f0a(0x19f))/0x2)+parseInt(_0x219f0a(0x1bb))/0x3+parseInt(_0x219f0a(0x1af))/0x4*(-parseInt(_0x219f0a(0x19b))/0x5)+-parseInt(_0x219f0a(0x1b8))/0x6+-parseInt(_0x219f0a(0x19d))/0x7*(parseInt(_0x219f0a(0x1ca))/0x8)+-parseInt(_0x219f0a(0x1b4))/0x9+parseInt(_0x219f0a(0x1bf))/0xa;if(_0xb5e486===_0x3c52a2)break;else _0x23a685['push'](_0x23a685['shift']());}catch(_0x50070d){_0x23a685['push'](_0x23a685['shift']());}}}(a204_0x4826,0x63fb5));import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';import{RABETBASE_ENV_VALUES}from'../../constant/env.js';import{RABETBASE_OUTPUT_FORMAT_VALUES}from'../../constant/output.js';import{RISK_LEVEL_VALUES}from'../../constant/risk.js';import{validateAppcode}from'../../commands/common/validate.js';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_0x1ea037(0x1c2),SAFE_PROFILE_KEYS=[a204_0x1ea037(0x1aa),a204_0x1ea037(0x19a),a204_0x1ea037(0x1bd),a204_0x1ea037(0x1ae),'pageSize','riskLevel',a204_0x1ea037(0x1b2)],workspaceFlags=[{'name':a204_0x1ea037(0x1ce),'type':'string','description':a204_0x1ea037(0x1cc)},{'name':a204_0x1ea037(0x1aa),'type':'string','description':'App\x20code\x20to\x20bind\x20to\x20this\x20workspace'},{'name':a204_0x1ea037(0x19a),'type':a204_0x1ea037(0x1b1),'description':a204_0x1ea037(0x196),'enum':[...RABETBASE_ENV_VALUES]},{'name':a204_0x1ea037(0x1bd),'type':a204_0x1ea037(0x1b1),'description':a204_0x1ea037(0x1c9)},{'name':a204_0x1ea037(0x19e),'type':'string','description':a204_0x1ea037(0x1b6),'enum':[...RABETBASE_OUTPUT_FORMAT_VALUES]},{'name':a204_0x1ea037(0x1b5),'type':a204_0x1ea037(0x19c),'description':a204_0x1ea037(0x1c7)},{'name':a204_0x1ea037(0x1a7),'type':'string','description':a204_0x1ea037(0x1bc),'enum':[...RISK_LEVEL_VALUES]},{'name':'locale','type':a204_0x1ea037(0x1b1),'description':a204_0x1ea037(0x1b0)}];function a204_0x4826(){const _0x546a9e=['Use\x20`','Target\x20environment','use','apps','globalConfig','env','5JcSDuM','number','1099609fGsOZF','defaultFormat','733370HeOiPI','2xfNMXZ','isArray','Switch\x20the\x20current\x20workspace\x20app\x20binding','\x20--app\x20','workspace','App\x20\x22','flag','riskLevel','\x20workspace\x20use\x20--app\x20<name>`.','write','appcode','\x20(appcode:\x20','str','Invalid\x20appcode:\x20','format','3179684PudZCw','App\x20locale\x20for\x20this\x20workspace\x20app\x20profile\x20(not\x20CLI\x20language;\x20reserved\x20for\x20later\x20app\x20use)','string','locale','initialized','1074258MLExQS','pageSize','Default\x20output\x20format\x20for\x20this\x20workspace\x20app\x20profile','object','874710vtVRwx','length',').\x20Config:\x20','836316NGLolC','Risk\x20level\x20for\x20this\x20workspace\x20app\x20profile','apiDir','validation','25525390YBelND','Workspace\x20','\x20workspace\x20init\x20--appcode\x20<code>`\x20or\x20`','\x20workspace\x20<init|use>\x20--app\x20<name>\x20[--appcode\x20<code>]','trim','workspace.','Initialize\x20the\x20current\x20workspace\x20app\x20binding','\x22\x20not\x20found.','Default\x20page\x20size\x20for\x20this\x20workspace\x20app\x20profile','project','API\x20directory\x20path\x20for\x20this\x20workspace\x20app\x20profile','32cvUicV','Missing\x20workspace\x20app\x20selector.','App\x20profile\x20name\x20to\x20use\x20in\x20this\x20workspace','Pass\x20--appcode\x20<code>,\x20or\x20choose\x20one\x20of:\x20','app'];a204_0x4826=function(){return _0x546a9e;};return a204_0x4826();}function isRecord(_0x334051){const _0x381cc3=a204_0x1ea037;return!!_0x334051&&typeof _0x334051===_0x381cc3(0x1b7)&&!Array[_0x381cc3(0x1a1)](_0x334051);}function assertValidAppcode(_0x24b71f){const _0x25918d=a204_0x1ea037,{valid:_0x4e2eed,message:_0x49a21e}=validateAppcode(_0x24b71f);if(!_0x4e2eed)throw CliErrors['validation'](_0x25918d(0x1ad)+_0x24b71f,_0x49a21e);}function sanitizeProfile(_0x25477a){if(!isRecord(_0x25477a))return{};const _0x4d89f7={};for(const _0x4fefb0 of SAFE_PROFILE_KEYS){if(_0x25477a[_0x4fefb0]!==undefined)_0x4d89f7[_0x4fefb0]=_0x25477a[_0x4fefb0];}return _0x4d89f7;}function cloneProfile(_0x53704f){return isRecord(_0x53704f)?{..._0x53704f}:{};}function collectWorkspaceProfileOverrides(_0x3824cd){const _0x4ba551=a204_0x1ea037,_0x3e0d31={},_0xbb36e1=_0x3824cd[_0x4ba551(0x1ac)]('env'),_0x215104=_0x3824cd[_0x4ba551(0x1ac)](_0x4ba551(0x1bd)),_0x201353=_0x3824cd['str']('defaultFormat'),_0x371ef2=_0x3824cd[_0x4ba551(0x1a6)](_0x4ba551(0x1b5)),_0x7b3fe1=_0x3824cd[_0x4ba551(0x1ac)]('riskLevel'),_0x4d3ab7=_0x3824cd[_0x4ba551(0x1ac)](_0x4ba551(0x1b2));if(_0xbb36e1)_0x3e0d31[_0x4ba551(0x19a)]=_0xbb36e1;if(_0x215104)_0x3e0d31['apiDir']=_0x215104;if(_0x201353)_0x3e0d31[_0x4ba551(0x1ae)]=_0x201353;if(_0x371ef2!==undefined&&_0x371ef2!=='')_0x3e0d31[_0x4ba551(0x1b5)]=Number(_0x371ef2);if(_0x7b3fe1)_0x3e0d31['riskLevel']=_0x7b3fe1;if(_0x4d3ab7)_0x3e0d31[_0x4ba551(0x1b2)]=_0x4d3ab7;return _0x3e0d31;}async function validateWorkspaceArgs(_0x5154e1){const _0x22dc65=a204_0x1ea037,_0x12979b=_0x5154e1[_0x22dc65(0x1ac)](_0x22dc65(0x1ce))[_0x22dc65(0x1c3)](),_0x16dbae=_0x5154e1[_0x22dc65(0x1ac)](_0x22dc65(0x1aa))[_0x22dc65(0x1c3)]();if(!_0x12979b&&!_0x16dbae)throw CliErrors['validation'](_0x22dc65(0x1cb),_0x22dc65(0x1cf)+CLI_BIN_NAME+_0x22dc65(0x1c1)+CLI_BIN_NAME+_0x22dc65(0x1a8));if(_0x16dbae)assertValidAppcode(_0x16dbae);}function resolveKnownApps(){const _0xe4d4aa=a204_0x1ea037,{config:_0x56f636,layers:_0x140c70}=readRawConfigWithLayers(),_0x36c62b=isRecord(_0x56f636[_0xe4d4aa(0x198)])?_0x56f636[_0xe4d4aa(0x198)]:{},_0x412046=isRecord(_0x140c70['globalConfig'][_0xe4d4aa(0x198)])?_0x140c70[_0xe4d4aa(0x199)][_0xe4d4aa(0x198)]:{};return{..._0x412046,..._0x36c62b};}async function configureWorkspace(_0x18d22a,_0x31a277){const _0x3f8f5c=a204_0x1ea037,_0x489be7=_0x18d22a[_0x3f8f5c(0x1ac)](_0x3f8f5c(0x1ce))[_0x3f8f5c(0x1c3)](),_0xc6a03a=_0x18d22a['str'](_0x3f8f5c(0x1aa))[_0x3f8f5c(0x1c3)](),_0x28cb45=_0x489be7||_0xc6a03a;if(!_0x28cb45)throw CliErrors[_0x3f8f5c(0x1be)]('Missing\x20workspace\x20app\x20selector.',_0x3f8f5c(0x1cf)+CLI_BIN_NAME+_0x3f8f5c(0x1c1)+CLI_BIN_NAME+'\x20workspace\x20use\x20--app\x20<name>`.');if(_0xc6a03a)assertValidAppcode(_0xc6a03a);const _0x4c5d6f=resolveWriteConfigPath(_0x3f8f5c(0x1c8)),_0x395216=readConfigFile(_0x4c5d6f),_0x127007=resolveKnownApps(),_0x32747d=isRecord(_0x395216[_0x3f8f5c(0x198)])?{..._0x395216[_0x3f8f5c(0x198)]}:{},_0x2e482c=cloneProfile(_0x32747d[_0x28cb45]),_0x32ed87=sanitizeProfile(_0x127007[_0x28cb45]),_0x5ab500=_0xc6a03a?{}:_0x32ed87,_0x55c910=_0xc6a03a||_0x5ab500[_0x3f8f5c(0x1aa)];if(!_0x55c910){const _0x220d93=Object['keys'](_0x127007),_0x4a7b36=_0x220d93[_0x3f8f5c(0x1b9)]===0x0?_0x3f8f5c(0x1cf)+CLI_BIN_NAME+'\x20workspace\x20'+_0x31a277+_0x3f8f5c(0x1a3)+_0x28cb45+'\x20--appcode\x20<code>`.':_0x3f8f5c(0x1cd)+_0x220d93['join'](',\x20');throw CliErrors['validation'](_0x3f8f5c(0x1a5)+_0x28cb45+_0x3f8f5c(0x1c6),_0x4a7b36);}assertValidAppcode(String(_0x55c910));const _0x2486d6={..._0x5ab500,..._0x2e482c,'appcode':String(_0x55c910),...collectWorkspaceProfileOverrides(_0x18d22a)};return _0x32747d[_0x28cb45]=_0x2486d6,_0x395216['apps']=_0x32747d,normalizeStoredDefaultApp(_0x395216,_0x28cb45),delete _0x395216[_0x3f8f5c(0x1aa)],delete _0x395216[_0x3f8f5c(0x1ce)],_0x2486d6[_0x3f8f5c(0x19a)]&&(_0x395216[_0x3f8f5c(0x19a)]=_0x2486d6['env']),writeConfigFile(_0x4c5d6f,_0x395216),{'ok':!![],'message':_0x3f8f5c(0x1c0)+(_0x31a277==='init'?_0x3f8f5c(0x1b3):'updated')+':\x20'+_0x28cb45+_0x3f8f5c(0x1ab)+_0x2486d6[_0x3f8f5c(0x1aa)]+_0x3f8f5c(0x1ba)+_0x4c5d6f+'.\x20Credentials:\x20not\x20written.','data':{'operation':_0x3f8f5c(0x1c4)+_0x31a277,'configPath':_0x4c5d6f,'app':_0x28cb45,'appcode':_0x2486d6[_0x3f8f5c(0x1aa)],'env':_0x2486d6[_0x3f8f5c(0x19a)]??null,'credentialsWritten':![]}};}const workspaceInitDefinition={'service':a204_0x1ea037(0x1a4),'command':'init','description':a204_0x1ea037(0x1c5),'risk':a204_0x1ea037(0x1a9),'requiresAuth':![],'requiresAppCode':![],'args':[],'flags':workspaceFlags,'validate':validateWorkspaceArgs,'execute':_0x4bc11f=>configureWorkspace(_0x4bc11f,'init')},workspaceUseDefinition={'service':a204_0x1ea037(0x1a4),'command':a204_0x1ea037(0x197),'description':a204_0x1ea037(0x1a2),'risk':a204_0x1ea037(0x1a9),'requiresAuth':![],'requiresAppCode':![],'args':[],'flags':workspaceFlags,'validate':validateWorkspaceArgs,'execute':_0x256ad0=>configureWorkspace(_0x256ad0,a204_0x1ea037(0x197))};export const workspaceDefinitions=[workspaceInitDefinition,workspaceUseDefinition,workspaceAddDefinition,workspaceRemoveDefinition];function a204_0x5576(_0x33edc5,_0x487abe){_0x33edc5=_0x33edc5-0x196;const _0x4826c5=a204_0x4826();let _0x557671=_0x4826c5[_0x33edc5];return _0x557671;}export{WORKSPACE_USAGE};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a205_0x56e3f1=a205_0x2ed3;(function(_0x4772b3,_0x198be9){const _0x1db4f4=a205_0x2ed3,_0x328ba5=_0x4772b3();while(!![]){try{const _0x3c6722=parseInt(_0x1db4f4(0x17c))/0x1+parseInt(_0x1db4f4(0x178))/0x2+parseInt(_0x1db4f4(0x17d))/0x3*(parseInt(_0x1db4f4(0x17b))/0x4)+parseInt(_0x1db4f4(0x177))/0x5+parseInt(_0x1db4f4(0x186))/0x6*(-parseInt(_0x1db4f4(0x180))/0x7)+-parseInt(_0x1db4f4(0x181))/0x8*(parseInt(_0x1db4f4(0x182))/0x9)+-parseInt(_0x1db4f4(0x17a))/0xa*(parseInt(_0x1db4f4(0x17f))/0xb);if(_0x3c6722===_0x198be9)break;else _0x328ba5['push'](_0x328ba5['shift']());}catch(_0xcfea56){_0x328ba5['push'](_0x328ba5['shift']());}}}(a205_0xd889,0x5a3cd));import{buildAppRemoveFlags,runAppRemove,validateAppName}from'../../commands/common/app-registry.js';export const workspaceRemoveDefinition={'service':a205_0x56e3f1(0x184),'command':'remove','description':a205_0x56e3f1(0x179),'risk':a205_0x56e3f1(0x185),'requiresAuth':![],'requiresAppCode':![],'args':[{'name':a205_0x56e3f1(0x187),'description':a205_0x56e3f1(0x183),'required':!![]}],'flags':buildAppRemoveFlags(),'validate':_0x16b8ee=>validateAppName(_0x16b8ee,a205_0x56e3f1(0x17e)),'execute':_0x45b7c9=>runAppRemove(_0x45b7c9,a205_0x56e3f1(0x17e))};function a205_0x2ed3(_0x5b995d,_0x8d64df){_0x5b995d=_0x5b995d-0x177;const _0xd88974=a205_0xd889();let _0x2ed33b=_0xd88974[_0x5b995d];return _0x2ed33b;}function a205_0xd889(){const _0x27e658=['workspace','write','18780ERiqQQ','name','1343075BjylYN','1062270VqhwOG','Remove\x20an\x20app\x20profile\x20from\x20the\x20current\x20workspace\x20(or\x20--global)','2661290YqlxcA','7724Lfcmmj','466831OVmKKm','282QuokVG','workspace\x20remove','11yGBOYV','1603skEKav','5064ZDXkhm','1359WHaWca','App\x20profile\x20name\x20to\x20remove'];a205_0xd889=function(){return _0x27e658;};return a205_0xd889();}
|