@lovrabet/rabetbase-cli 2.3.11 → 2.3.12-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/api-doc.js +1 -1
- package/lib/api/fetch-model-list.js +1 -1
- package/lib/api/generate-api-file.js +1 -1
- package/lib/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/add.js +1 -1
- package/lib/commands/app/index.js +1 -1
- package/lib/commands/app/list.js +1 -1
- package/lib/commands/app/remote-directory.js +1 -1
- package/lib/commands/app/remove.js +1 -1
- package/lib/commands/app/shared.js +1 -1
- package/lib/commands/app-config/delete.js +1 -1
- package/lib/commands/app-config/get.js +1 -1
- package/lib/commands/app-config/index.js +1 -1
- package/lib/commands/app-config/list.js +1 -1
- package/lib/commands/app-config/set.js +1 -1
- package/lib/commands/app-config/shared.js +1 -1
- package/lib/commands/auth/index.js +1 -1
- package/lib/commands/bff/create.js +1 -1
- package/lib/commands/bff/delete.js +1 -1
- package/lib/commands/bff/detail.js +1 -1
- package/lib/commands/bff/index.js +1 -1
- package/lib/commands/bff/list.js +1 -1
- package/lib/commands/bff/pull.js +1 -1
- package/lib/commands/bff/push.js +1 -1
- package/lib/commands/bff/status.js +1 -1
- package/lib/commands/cli-skill/index.js +1 -1
- package/lib/commands/cli-update.js +1 -1
- package/lib/commands/codegen/index.js +1 -1
- package/lib/commands/codegen/sdk.js +1 -1
- package/lib/commands/codegen/sql.js +1 -1
- package/lib/commands/common/app-registry.js +1 -1
- package/lib/commands/common/app-selector.js +1 -1
- package/lib/commands/common/async-task.js +1 -1
- package/lib/commands/common/dry-run.js +1 -1
- package/lib/commands/common/flags.js +1 -1
- package/lib/commands/common/local-file.js +1 -1
- package/lib/commands/common/validate.js +1 -1
- package/lib/commands/config/get.js +1 -1
- package/lib/commands/config/index.js +1 -1
- package/lib/commands/config/list.js +1 -1
- package/lib/commands/config/set.js +1 -1
- package/lib/commands/config/shared.js +1 -1
- package/lib/commands/data/filter.js +1 -1
- package/lib/commands/data/getOne.js +1 -1
- package/lib/commands/data/index.js +1 -1
- package/lib/commands/data/shared.js +1 -1
- package/lib/commands/dataset/business-group-update.js +1 -1
- package/lib/commands/dataset/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.js +1 -1
- package/lib/commands/db/index.js +1 -1
- package/lib/commands/db/list.js +1 -1
- package/lib/commands/db/shared.js +1 -1
- package/lib/commands/db/tables.js +1 -1
- package/lib/commands/db/test.js +1 -1
- package/lib/commands/db/update.js +1 -1
- package/lib/commands/doctor.js +1 -1
- package/lib/commands/file/index.js +1 -1
- package/lib/commands/init/index.js +1 -1
- package/lib/commands/issue/index.js +1 -1
- package/lib/commands/issue/nudge.js +1 -1
- package/lib/commands/issue/report.js +1 -1
- package/lib/commands/issue/shared.js +1 -1
- package/lib/commands/logs/index.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/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/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/update.js +1 -1
- package/lib/commands/notification/config-list.js +1 -1
- package/lib/commands/notification/index.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/shared.js +1 -1
- package/lib/commands/page/standard-page-status.js +1 -1
- package/lib/commands/page/sync.js +1 -1
- package/lib/commands/permit/index.js +1 -1
- package/lib/commands/permit/page-get.js +1 -1
- package/lib/commands/permit/page-set.js +1 -1
- package/lib/commands/permit/role-apis-set.js +1 -1
- package/lib/commands/permit/role-menus-set.js +1 -1
- package/lib/commands/permit/role-menus.js +1 -1
- package/lib/commands/permit/shared.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/non-interactive.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/init.js +1 -1
- package/lib/commands/project/upgrade.js +1 -1
- package/lib/commands/registry.js +1 -1
- package/lib/commands/role/create.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/save.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/workspace/add.js +1 -1
- package/lib/commands/workspace/index.js +1 -1
- package/lib/commands/workspace/remove.js +1 -1
- package/lib/config/schema.js +1 -1
- package/lib/constant/cdn.js +1 -1
- package/lib/constant/cli.js +1 -1
- package/lib/constant/defaults.js +1 -1
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/constant/output.js +1 -1
- package/lib/constant/paths.js +1 -1
- package/lib/constant/risk.js +1 -1
- package/lib/context/app-resolver.js +1 -1
- package/lib/context/auth-resolver.js +1 -1
- package/lib/context/config-loader.js +1 -1
- package/lib/context.js +1 -1
- package/lib/core/alias-resolver.js +1 -1
- package/lib/core/api-client.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.js +1 -1
- package/lib/help.js +1 -1
- package/lib/skills/main.js +1 -1
- package/lib/skills/npx-skills-add.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/copy-directory.js +1 -1
- package/lib/utils/entity-with-id.js +1 -1
- package/lib/utils/file-utils.js +1 -1
- package/lib/utils/guides-cdn.js +1 -1
- package/lib/utils/http-client.js +1 -1
- package/lib/utils/is-non-interactive.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/params.js +1 -1
- package/lib/utils/platform.js +1 -1
- package/lib/utils/rules-cdn.js +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.js +1 -1
- package/lib/utils/update-notice.js +1 -1
- package/lib/utils/version.js +1 -1
- package/lib/utils/with-active-cookie.js +1 -1
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +1 -1
package/lib/commands/sql/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a172_0x491d84=a172_0x51f2;(function(_0x396239,_0x2beebe){const _0x88f509=a172_0x51f2,_0x345ff4=_0x396239();while(!![]){try{const _0x51c227=parseInt(_0x88f509(0x170))/0x1+-parseInt(_0x88f509(0x15f))/0x2*(parseInt(_0x88f509(0x182))/0x3)+parseInt(_0x88f509(0x180))/0x4*(-parseInt(_0x88f509(0x16b))/0x5)+-parseInt(_0x88f509(0x162))/0x6*(parseInt(_0x88f509(0x15e))/0x7)+parseInt(_0x88f509(0x17b))/0x8+-parseInt(_0x88f509(0x148))/0x9*(parseInt(_0x88f509(0x14a))/0xa)+parseInt(_0x88f509(0x149))/0xb;if(_0x51c227===_0x2beebe)break;else _0x345ff4['push'](_0x345ff4['shift']());}catch(_0x1fa40b){_0x345ff4['push'](_0x345ff4['shift']());}}}(a172_0x402b,0xe8e7b));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';function a172_0x402b(){const _0x3c5fa6=['40DLgZRH','description','length','sqlcode','name','1713672OJSbOD','catch','Force\x20overwrite\x20local\x20unsynced\x20changes','dbId','unchanged','skipped','paging','\x20skipped,\x20','conflict','replace','path','8938320GOlwSW','sql','force','Pull\x20complete:\x20','nonInteractive','592548gupYMZ','Would\x20pull\x20','2736651LcVmVw','377802FOmYES','18121026TwigFf','290YRhcom','sqlCode','tableData','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','filter','mybatisXml','pull','sqlRoot','totalCount','cancelled','No\x20remote\x20SQL\x20queries\x20matched.','boolean','appCode','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','trimStart','lockFilePath','sqlName','sqlRootDir','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','message','14wxUEnD','2KBmmmp','str','lastSync','629022tZVUCV','utf8','sqlContent','toISOString','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','push','string','Filter\x20by\x20SQL\x20display\x20name','sqls'];a172_0x402b=function(){return _0x3c5fa6;};return a172_0x402b();}import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';function a172_0x51f2(_0x175468,_0x346226){_0x175468=_0x175468-0x148;const _0x402bc2=a172_0x402b();let _0x51f20c=_0x402bc2[_0x175468];return _0x51f20c;}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(_0x385ff1,_0x23582e){const _0x39d846=a172_0x51f2,_0x236f60=[];let _0x5888fd=0x1;while(!![]){const _0x565401=await listSqlQueries(_0x385ff1,{'currentPage':_0x5888fd,'pageSize':PAGE_SIZE,'sqlCode':_0x23582e[_0x39d846(0x14b)],'sqlName':_0x23582e['sqlName']}),_0x54d493=_0x565401[_0x39d846(0x14c)]??[];_0x236f60[_0x39d846(0x167)](..._0x54d493);if(_0x54d493[_0x39d846(0x16d)]===0x0)break;const _0x1cb6b5=_0x565401[_0x39d846(0x176)]?.[_0x39d846(0x152)];if(_0x1cb6b5!=null?_0x236f60['length']>=_0x1cb6b5:_0x54d493[_0x39d846(0x16d)]<PAGE_SIZE)break;_0x5888fd++;}return _0x236f60;}async function ensureSqlContent(_0x40b419){const _0x907d47=a172_0x51f2;if(_0x40b419[_0x907d47(0x164)]!=null&&String(_0x40b419[_0x907d47(0x164)])[_0x907d47(0x16d)]>0x0)return _0x40b419;return getSqlQueryDetail(_0x40b419[_0x907d47(0x14b)]);}export const sqlPull={'service':a172_0x491d84(0x17c),'command':a172_0x491d84(0x150),'description':a172_0x491d84(0x157),'risk':'write','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a172_0x491d84(0x16f),'type':a172_0x491d84(0x168),'description':a172_0x491d84(0x169)},{'name':a172_0x491d84(0x17d),'type':a172_0x491d84(0x155),'description':a172_0x491d84(0x172)}],async 'dryRun'(_0x1ed1de){const _0x107bbd=a172_0x491d84,_0xd0a08=loadSqlProjectConfig(_0x1ed1de[_0x107bbd(0x156)]),_0x362be3=await readSqlLockFile(_0xd0a08['lockFilePath']),{appLock:_0x54fa9f}=ensureSqlLockScope(_0x362be3??createEmptySqlLock(),_0xd0a08[_0x107bbd(0x156)],_0xd0a08[_0x107bbd(0x151)],_0x107bbd(0x150)),_0x574845=await fetchAllSqlQueries(_0x1ed1de[_0x107bbd(0x156)],{'sqlCode':_0x1ed1de[_0x107bbd(0x160)]('sqlcode')||undefined,'sqlName':_0x1ed1de[_0x107bbd(0x160)]('name')||undefined}),_0x312667=[];for(const _0x500d38 of _0x574845){const _0xba6c89=await ensureSqlContent(_0x500d38),_0x19428c=ensureRemoteSqlContent(_0xba6c89),_0x43915e=detectModeFromSql(_0xba6c89),_0xafae28=_0xba6c89[_0x107bbd(0x173)]?await getDbName(_0x1ed1de['appCode'],Number(_0xba6c89[_0x107bbd(0x173)]))[_0x107bbd(0x171)](()=>undefined):undefined,_0xdaed8b=buildLocalSqlFileContent({'sqlCode':_0xba6c89[_0x107bbd(0x14b)],'sqlName':_0xba6c89[_0x107bbd(0x15a)],'dbId':_0xba6c89[_0x107bbd(0x173)]},_0x19428c,{'dbName':_0xafae28,'mode':_0x43915e,'syncedAt':new Date()[_0x107bbd(0x165)](),'description':_0xba6c89['description']}),_0x1f72aa=buildSqlLockEntry(_0xba6c89,_0x19428c,'',{'dbName':_0xafae28}),_0x49f292=resolveLocalSqlFilePath(_0xd0a08,_0xba6c89[_0x107bbd(0x14b)],_0x1f72aa);let _0x175733='would_pull',_0x35e404;if(await fileExists(_0x49f292)){const _0x606e78=await readFile(_0x49f292,_0x107bbd(0x163));isEquivalentPulledSqlFile(_0x606e78,_0xdaed8b,_0x43915e)?(_0x175733=_0x107bbd(0x175),_0x35e404=_0x107bbd(0x174)):(_0x175733=_0x107bbd(0x178),_0x35e404=_0x107bbd(0x15c));}_0x312667[_0x107bbd(0x167)]({'sqlCode':_0xba6c89[_0x107bbd(0x14b)],'sqlName':_0xba6c89[_0x107bbd(0x15a)],'filePath':_0x49f292,'status':_0x175733,'reason':_0x35e404});}return{'method':'POST','url':_0x107bbd(0x166),'body':{'appCode':_0x1ed1de[_0x107bbd(0x156)],'sqlCode':_0x1ed1de[_0x107bbd(0x160)](_0x107bbd(0x16e))||null,'sqlName':_0x1ed1de[_0x107bbd(0x160)](_0x107bbd(0x16f))||null,'files':_0x312667},'description':_0x107bbd(0x181)+_0x312667[_0x107bbd(0x16d)]+'\x20SQL\x20file(s)\x20into\x20'+_0xd0a08[_0x107bbd(0x15b)]};},async 'execute'(_0x14b08e){const _0x4dc777=a172_0x491d84,_0x1ed3e8=loadSqlProjectConfig(_0x14b08e[_0x4dc777(0x156)]),_0x38aea6=await readSqlLockFile(_0x1ed3e8[_0x4dc777(0x159)]),{lockData:_0x3b6229,appLock:_0x116637}=ensureSqlLockScope(_0x38aea6??createEmptySqlLock(),_0x1ed3e8[_0x4dc777(0x156)],_0x1ed3e8['sqlRoot'],_0x4dc777(0x150)),_0x4759ce=_0x14b08e['bool']('force'),_0x1b76a1=await fetchAllSqlQueries(_0x14b08e[_0x4dc777(0x156)],{'sqlCode':_0x14b08e[_0x4dc777(0x160)](_0x4dc777(0x16e))||undefined,'sqlName':_0x14b08e[_0x4dc777(0x160)](_0x4dc777(0x16f))||undefined});if(_0x1b76a1['length']===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x4dc777(0x154)};const _0x47f847=[],_0x3a8b0e=[];for(const _0x5f11cf of _0x1b76a1){try{_0x47f847[_0x4dc777(0x167)](await ensureSqlContent(_0x5f11cf));}catch(_0x2a0968){_0x3a8b0e[_0x4dc777(0x167)]({'sqlCode':_0x5f11cf[_0x4dc777(0x14b)],'error':_0x2a0968 instanceof Error?_0x2a0968[_0x4dc777(0x15d)]:String(_0x2a0968)});}}if(_0x4759ce&&!_0x14b08e[_0x4dc777(0x17f)]){let _0x4b4982=![];for(const _0x33fedf of _0x47f847){const _0xe29d53=detectModeFromSql(_0x33fedf),_0x48d5e7=_0x33fedf[_0x4dc777(0x173)]?await getDbName(_0x14b08e['appCode'],Number(_0x33fedf[_0x4dc777(0x173)]))[_0x4dc777(0x171)](()=>undefined):undefined,_0x457190=buildLocalSqlFileContent({'sqlCode':_0x33fedf['sqlCode'],'sqlName':_0x33fedf['sqlName'],'dbId':_0x33fedf[_0x4dc777(0x173)]},ensureRemoteSqlContent(_0x33fedf),{'dbName':_0x48d5e7,'mode':_0xe29d53,'syncedAt':new Date()[_0x4dc777(0x165)](),'description':_0x33fedf[_0x4dc777(0x16c)]}),_0x55e319=resolveLocalSqlFilePath(_0x1ed3e8,_0x33fedf[_0x4dc777(0x14b)],buildSqlLockEntry(_0x33fedf,ensureRemoteSqlContent(_0x33fedf),'',{'dbName':_0x48d5e7}));if(await fileExists(_0x55e319)){const _0x20eef7=await readFile(_0x55e319,_0x4dc777(0x163));if(!isEquivalentPulledSqlFile(_0x20eef7,_0x457190,_0xe29d53)){_0x4b4982=!![];break;}}}if(_0x4b4982){const _0x1d73b6=await confirmForceOverwrite(_0x4dc777(0x14d));if(!_0x1d73b6)throw CliErrors[_0x4dc777(0x153)]('Force\x20pull\x20cancelled.');}}const _0x379931=cloneSqlLockData(_0x3b6229),_0xb0b34d=_0x379931['apps'][_0x1ed3e8['appCode']],_0x1c6ccb=[],_0x5b5339=[];for(const _0x14357d of _0x47f847){const _0x511ad5=_0xb0b34d[_0x4dc777(0x16a)][_0x14357d[_0x4dc777(0x14b)]],_0x13547d=ensureRemoteSqlContent(_0x14357d),_0x1ba919=detectModeFromSql(_0x14357d),_0x3e2e17=_0x14357d[_0x4dc777(0x173)]?await getDbName(_0x14b08e['appCode'],Number(_0x14357d[_0x4dc777(0x173)]))[_0x4dc777(0x171)](()=>undefined):undefined,_0x5bbab6=buildLocalSqlFileContent({'sqlCode':_0x14357d[_0x4dc777(0x14b)],'sqlName':_0x14357d['sqlName'],'dbId':_0x14357d['dbId']},_0x13547d,{'dbName':_0x3e2e17,'mode':_0x1ba919,'syncedAt':new Date()[_0x4dc777(0x165)](),'description':_0x14357d['description']}),_0x43bbfb=buildSqlLockEntry(_0x14357d,_0x13547d,computeSqlContentHash(_0x5bbab6),{'dbName':_0x3e2e17}),_0x317623=_0x43bbfb[_0x4dc777(0x17a)],_0x4f4d69=join(_0x1ed3e8[_0x4dc777(0x15b)],_0x317623);try{if(await fileExists(_0x4f4d69)){const _0x51abae=await readFile(_0x4f4d69,_0x4dc777(0x163));if(isEquivalentPulledSqlFile(_0x51abae,_0x5bbab6,_0x1ba919)){_0x5b5339[_0x4dc777(0x167)]({'sqlCode':_0x14357d[_0x4dc777(0x14b)],'reason':'unchanged'}),_0xb0b34d[_0x4dc777(0x16a)][_0x14357d['sqlCode']]={..._0x43bbfb,'hash':computeSqlContentHash(_0x51abae),'path':_0x317623};continue;}if(!_0x4759ce){_0x5b5339['push']({'sqlCode':_0x14357d[_0x4dc777(0x14b)],'reason':'local\x20differs\x20from\x20remote'});continue;}}const _0xf6164b=_0x511ad5?.[_0x4dc777(0x17a)]?join(_0x1ed3e8['sqlRootDir'],_0x511ad5[_0x4dc777(0x17a)]):undefined;_0xf6164b&&_0xf6164b!==_0x4f4d69&&await fileExists(_0xf6164b)&&await rm(_0xf6164b,{'force':!![]}),await ensureParentDirectory(_0x4f4d69),await writeFile(_0x4f4d69,_0x5bbab6,_0x4dc777(0x163)),_0xb0b34d[_0x4dc777(0x16a)][_0x14357d[_0x4dc777(0x14b)]]={..._0x43bbfb,'path':_0x317623},_0x1c6ccb[_0x4dc777(0x167)]({'sqlCode':_0x14357d[_0x4dc777(0x14b)],'filePath':_0x4f4d69});}catch(_0x48d933){_0x3a8b0e[_0x4dc777(0x167)]({'sqlCode':_0x14357d[_0x4dc777(0x14b)],'error':_0x48d933 instanceof Error?_0x48d933[_0x4dc777(0x15d)]:String(_0x48d933)});}}return _0xb0b34d[_0x4dc777(0x161)]=new Date()['toISOString'](),await writeSqlLockFile(_0x1ed3e8[_0x4dc777(0x159)],_0x379931),{'ok':_0x3a8b0e[_0x4dc777(0x16d)]===0x0,'data':{'pulled':_0x1c6ccb,'skipped':_0x5b5339,'failed':_0x3a8b0e},'message':_0x4dc777(0x17e)+_0x1c6ccb[_0x4dc777(0x16d)]+'\x20written,\x20'+_0x5b5339[_0x4dc777(0x16d)]+_0x4dc777(0x177)+_0x3a8b0e['length']+'\x20failed'};}};function detectModeFromSql(_0x31558f){const _0x3fc9d6=a172_0x491d84,_0xb61b28=ensureRemoteSqlContent(_0x31558f),_0x20865d=stripLocalSqlMetadata(_0xb61b28,_0x3fc9d6(0x14f))[_0x3fc9d6(0x158)]();if(/^<(select|insert|update|delete)\b/i['test'](_0x20865d))return _0x3fc9d6(0x14f);return _0x3fc9d6(0x17c);}function isEquivalentPulledSqlFile(_0x5b9eff,_0x301e18,_0x9a023){return normalizePullComparableContent(_0x5b9eff,_0x9a023)===normalizePullComparableContent(_0x301e18,_0x9a023);}function normalizePullComparableContent(_0x1de437,_0x4d3911){const _0x138c98=a172_0x491d84,_0x344577=_0x1de437[_0x138c98(0x179)](/\r\n/g,'\x0a')['split']('\x0a'),_0x1b5cb9=_0x344577[_0x138c98(0x14e)](_0x666feb=>!isSyncedAtMetadataLine(_0x666feb,_0x4d3911));return _0x1b5cb9['join']('\x0a');}function isSyncedAtMetadataLine(_0x7985b4,_0x52bd00){const _0x262b86=a172_0x491d84;if(_0x52bd00===_0x262b86(0x14f))return/^\s*<!--\s*@lovrabet\.syncedAt:/['test'](_0x7985b4);return/^\s*--\s*@lovrabet\.syncedAt:/['test'](_0x7985b4);}
|
|
1
|
+
const a172_0x5be294=a172_0x7049;(function(_0x4acaff,_0x5eedd4){const _0x4836fb=a172_0x7049,_0x5c63e3=_0x4acaff();while(!![]){try{const _0x429018=parseInt(_0x4836fb(0x1f4))/0x1+parseInt(_0x4836fb(0x1d5))/0x2+parseInt(_0x4836fb(0x1e3))/0x3*(-parseInt(_0x4836fb(0x207))/0x4)+-parseInt(_0x4836fb(0x1fe))/0x5*(parseInt(_0x4836fb(0x1fa))/0x6)+-parseInt(_0x4836fb(0x202))/0x7*(parseInt(_0x4836fb(0x1e5))/0x8)+-parseInt(_0x4836fb(0x1db))/0x9+-parseInt(_0x4836fb(0x1d3))/0xa*(-parseInt(_0x4836fb(0x206))/0xb);if(_0x429018===_0x5eedd4)break;else _0x5c63e3['push'](_0x5c63e3['shift']());}catch(_0x473356){_0x5c63e3['push'](_0x5c63e3['shift']());}}}(a172_0x59d1,0x5d85b));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';function a172_0x7049(_0x740445,_0x50f38e){_0x740445=_0x740445-0x1ce;const _0x59d10f=a172_0x59d1();let _0x7049bd=_0x59d10f[_0x740445];return _0x7049bd;}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';function a172_0x59d1(){const _0x382da8=['Force\x20pull\x20cancelled.','apps','59838ClOnbO','appCode','length','toISOString','265BGeKdb','pull','Pull\x20complete:\x20','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','419223WFXGut','Would\x20pull\x20','filter','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','22EtbadP','1222472XukNVk','POST','name','write','unchanged','path','push','sqlRoot','8019590BxGwbO','tableData','1004528JVhdrt','utf8','sqls','mybatisXml','dbId','test','4973760qXORnI','sql','sqlRootDir','cancelled','sqlcode','sqlContent','lockFilePath','trimStart','6ywVvHH','Force\x20overwrite\x20local\x20unsynced\x20changes','88uELttE','No\x20remote\x20SQL\x20queries\x20matched.','split','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','sqlName','force','string','nonInteractive','lastSync','paging','boolean','catch','\x20SQL\x20file(s)\x20into\x20','str','sqlCode','628109DuXuGg','\x20failed','message','replace'];a172_0x59d1=function(){return _0x382da8;};return a172_0x59d1();}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(_0x1a41a2,_0x3025a2){const _0x990949=a172_0x7049,_0x4c24dd=[];let _0x119c28=0x1;while(!![]){const _0x42c274=await listSqlQueries(_0x1a41a2,{'currentPage':_0x119c28,'pageSize':PAGE_SIZE,'sqlCode':_0x3025a2['sqlCode'],'sqlName':_0x3025a2['sqlName']}),_0x18c0ad=_0x42c274[_0x990949(0x1d4)]??[];_0x4c24dd['push'](..._0x18c0ad);if(_0x18c0ad[_0x990949(0x1fc)]===0x0)break;const _0x4adffa=_0x42c274[_0x990949(0x1ee)]?.['totalCount'];if(_0x4adffa!=null?_0x4c24dd[_0x990949(0x1fc)]>=_0x4adffa:_0x18c0ad[_0x990949(0x1fc)]<PAGE_SIZE)break;_0x119c28++;}return _0x4c24dd;}async function ensureSqlContent(_0x1270ea){const _0x46d2ec=a172_0x7049;if(_0x1270ea[_0x46d2ec(0x1e0)]!=null&&String(_0x1270ea[_0x46d2ec(0x1e0)])['length']>0x0)return _0x1270ea;return getSqlQueryDetail(_0x1270ea[_0x46d2ec(0x1f3)]);}export const sqlPull={'service':a172_0x5be294(0x1dc),'command':a172_0x5be294(0x1ff),'description':a172_0x5be294(0x1e8),'risk':a172_0x5be294(0x1ce),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a172_0x5be294(0x209),'type':a172_0x5be294(0x1eb),'description':'Filter\x20by\x20SQL\x20display\x20name'},{'name':a172_0x5be294(0x1ea),'type':a172_0x5be294(0x1ef),'description':a172_0x5be294(0x1e4)}],async 'dryRun'(_0x1a3fa6){const _0x1ed66e=a172_0x5be294,_0x599127=loadSqlProjectConfig(_0x1a3fa6[_0x1ed66e(0x1fb)]),_0x390b6f=await readSqlLockFile(_0x599127[_0x1ed66e(0x1e1)]),{appLock:_0x1e7fea}=ensureSqlLockScope(_0x390b6f??createEmptySqlLock(),_0x599127[_0x1ed66e(0x1fb)],_0x599127[_0x1ed66e(0x1d2)],_0x1ed66e(0x1ff)),_0x4fb3cf=await fetchAllSqlQueries(_0x1a3fa6[_0x1ed66e(0x1fb)],{'sqlCode':_0x1a3fa6[_0x1ed66e(0x1f2)]('sqlcode')||undefined,'sqlName':_0x1a3fa6['str'](_0x1ed66e(0x209))||undefined}),_0x24e14e=[];for(const _0xc1a635 of _0x4fb3cf){const _0x6cce35=await ensureSqlContent(_0xc1a635),_0x443399=ensureRemoteSqlContent(_0x6cce35),_0x18cafb=detectModeFromSql(_0x6cce35),_0x9de1c4=_0x6cce35[_0x1ed66e(0x1d9)]?await getDbName(_0x1a3fa6['appCode'],Number(_0x6cce35[_0x1ed66e(0x1d9)]))['catch'](()=>undefined):undefined,_0x35de20=buildLocalSqlFileContent({'sqlCode':_0x6cce35[_0x1ed66e(0x1f3)],'sqlName':_0x6cce35['sqlName'],'dbId':_0x6cce35['dbId']},_0x443399,{'dbName':_0x9de1c4,'mode':_0x18cafb,'syncedAt':new Date()[_0x1ed66e(0x1fd)](),'description':_0x6cce35['description']}),_0x1a4b3a=buildSqlLockEntry(_0x6cce35,_0x443399,'',{'dbName':_0x9de1c4}),_0x32b7a3=resolveLocalSqlFilePath(_0x599127,_0x6cce35[_0x1ed66e(0x1f3)],_0x1a4b3a);let _0x4f561d='would_pull',_0x241f3c;if(await fileExists(_0x32b7a3)){const _0x8afb1c=await readFile(_0x32b7a3,_0x1ed66e(0x1d6));isEquivalentPulledSqlFile(_0x8afb1c,_0x35de20,_0x18cafb)?(_0x4f561d='skipped',_0x241f3c='unchanged'):(_0x4f561d='conflict',_0x241f3c=_0x1ed66e(0x205));}_0x24e14e[_0x1ed66e(0x1d1)]({'sqlCode':_0x6cce35['sqlCode'],'sqlName':_0x6cce35[_0x1ed66e(0x1e9)],'filePath':_0x32b7a3,'status':_0x4f561d,'reason':_0x241f3c});}return{'method':_0x1ed66e(0x208),'url':_0x1ed66e(0x201),'body':{'appCode':_0x1a3fa6['appCode'],'sqlCode':_0x1a3fa6[_0x1ed66e(0x1f2)](_0x1ed66e(0x1df))||null,'sqlName':_0x1a3fa6['str']('name')||null,'files':_0x24e14e},'description':_0x1ed66e(0x203)+_0x24e14e[_0x1ed66e(0x1fc)]+_0x1ed66e(0x1f1)+_0x599127['sqlRootDir']};},async 'execute'(_0x5a8d20){const _0x32103d=a172_0x5be294,_0x2628ab=loadSqlProjectConfig(_0x5a8d20[_0x32103d(0x1fb)]),_0x275910=await readSqlLockFile(_0x2628ab[_0x32103d(0x1e1)]),{lockData:_0xb1cd73,appLock:_0x10f00a}=ensureSqlLockScope(_0x275910??createEmptySqlLock(),_0x2628ab[_0x32103d(0x1fb)],_0x2628ab[_0x32103d(0x1d2)],_0x32103d(0x1ff)),_0x368f11=_0x5a8d20['bool']('force'),_0x5abc02=await fetchAllSqlQueries(_0x5a8d20[_0x32103d(0x1fb)],{'sqlCode':_0x5a8d20[_0x32103d(0x1f2)](_0x32103d(0x1df))||undefined,'sqlName':_0x5a8d20[_0x32103d(0x1f2)](_0x32103d(0x209))||undefined});if(_0x5abc02['length']===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x32103d(0x1e6)};const _0x4f0604=[],_0x3215db=[];for(const _0x51bd36 of _0x5abc02){try{_0x4f0604[_0x32103d(0x1d1)](await ensureSqlContent(_0x51bd36));}catch(_0x5b1a2e){_0x3215db[_0x32103d(0x1d1)]({'sqlCode':_0x51bd36[_0x32103d(0x1f3)],'error':_0x5b1a2e instanceof Error?_0x5b1a2e[_0x32103d(0x1f6)]:String(_0x5b1a2e)});}}if(_0x368f11&&!_0x5a8d20[_0x32103d(0x1ec)]){let _0x297d54=![];for(const _0x50f1d3 of _0x4f0604){const _0x157255=detectModeFromSql(_0x50f1d3),_0x464627=_0x50f1d3['dbId']?await getDbName(_0x5a8d20['appCode'],Number(_0x50f1d3['dbId']))[_0x32103d(0x1f0)](()=>undefined):undefined,_0x180b52=buildLocalSqlFileContent({'sqlCode':_0x50f1d3[_0x32103d(0x1f3)],'sqlName':_0x50f1d3['sqlName'],'dbId':_0x50f1d3[_0x32103d(0x1d9)]},ensureRemoteSqlContent(_0x50f1d3),{'dbName':_0x464627,'mode':_0x157255,'syncedAt':new Date()['toISOString'](),'description':_0x50f1d3['description']}),_0x280e45=resolveLocalSqlFilePath(_0x2628ab,_0x50f1d3['sqlCode'],buildSqlLockEntry(_0x50f1d3,ensureRemoteSqlContent(_0x50f1d3),'',{'dbName':_0x464627}));if(await fileExists(_0x280e45)){const _0x1f30b2=await readFile(_0x280e45,_0x32103d(0x1d6));if(!isEquivalentPulledSqlFile(_0x1f30b2,_0x180b52,_0x157255)){_0x297d54=!![];break;}}}if(_0x297d54){const _0x113b00=await confirmForceOverwrite('Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.');if(!_0x113b00)throw CliErrors[_0x32103d(0x1de)](_0x32103d(0x1f8));}}const _0x15cd7f=cloneSqlLockData(_0xb1cd73),_0x2444da=_0x15cd7f[_0x32103d(0x1f9)][_0x2628ab[_0x32103d(0x1fb)]],_0x120401=[],_0x15cf41=[];for(const _0x2bd5e5 of _0x4f0604){const _0x585da8=_0x2444da['sqls'][_0x2bd5e5[_0x32103d(0x1f3)]],_0x29057c=ensureRemoteSqlContent(_0x2bd5e5),_0x3f150c=detectModeFromSql(_0x2bd5e5),_0x25735a=_0x2bd5e5['dbId']?await getDbName(_0x5a8d20[_0x32103d(0x1fb)],Number(_0x2bd5e5[_0x32103d(0x1d9)]))[_0x32103d(0x1f0)](()=>undefined):undefined,_0x171286=buildLocalSqlFileContent({'sqlCode':_0x2bd5e5[_0x32103d(0x1f3)],'sqlName':_0x2bd5e5[_0x32103d(0x1e9)],'dbId':_0x2bd5e5['dbId']},_0x29057c,{'dbName':_0x25735a,'mode':_0x3f150c,'syncedAt':new Date()['toISOString'](),'description':_0x2bd5e5['description']}),_0x4d4ad4=buildSqlLockEntry(_0x2bd5e5,_0x29057c,computeSqlContentHash(_0x171286),{'dbName':_0x25735a}),_0x41bf29=_0x4d4ad4['path'],_0x135aca=join(_0x2628ab['sqlRootDir'],_0x41bf29);try{if(await fileExists(_0x135aca)){const _0x389bdb=await readFile(_0x135aca,_0x32103d(0x1d6));if(isEquivalentPulledSqlFile(_0x389bdb,_0x171286,_0x3f150c)){_0x15cf41[_0x32103d(0x1d1)]({'sqlCode':_0x2bd5e5[_0x32103d(0x1f3)],'reason':_0x32103d(0x1cf)}),_0x2444da[_0x32103d(0x1d7)][_0x2bd5e5[_0x32103d(0x1f3)]]={..._0x4d4ad4,'hash':computeSqlContentHash(_0x389bdb),'path':_0x41bf29};continue;}if(!_0x368f11){_0x15cf41[_0x32103d(0x1d1)]({'sqlCode':_0x2bd5e5[_0x32103d(0x1f3)],'reason':'local\x20differs\x20from\x20remote'});continue;}}const _0x36f2c4=_0x585da8?.[_0x32103d(0x1d0)]?join(_0x2628ab[_0x32103d(0x1dd)],_0x585da8[_0x32103d(0x1d0)]):undefined;_0x36f2c4&&_0x36f2c4!==_0x135aca&&await fileExists(_0x36f2c4)&&await rm(_0x36f2c4,{'force':!![]}),await ensureParentDirectory(_0x135aca),await writeFile(_0x135aca,_0x171286,_0x32103d(0x1d6)),_0x2444da['sqls'][_0x2bd5e5['sqlCode']]={..._0x4d4ad4,'path':_0x41bf29},_0x120401[_0x32103d(0x1d1)]({'sqlCode':_0x2bd5e5[_0x32103d(0x1f3)],'filePath':_0x135aca});}catch(_0x359f14){_0x3215db['push']({'sqlCode':_0x2bd5e5[_0x32103d(0x1f3)],'error':_0x359f14 instanceof Error?_0x359f14[_0x32103d(0x1f6)]:String(_0x359f14)});}}return _0x2444da[_0x32103d(0x1ed)]=new Date()['toISOString'](),await writeSqlLockFile(_0x2628ab[_0x32103d(0x1e1)],_0x15cd7f),{'ok':_0x3215db[_0x32103d(0x1fc)]===0x0,'data':{'pulled':_0x120401,'skipped':_0x15cf41,'failed':_0x3215db},'message':_0x32103d(0x200)+_0x120401[_0x32103d(0x1fc)]+'\x20written,\x20'+_0x15cf41['length']+'\x20skipped,\x20'+_0x3215db[_0x32103d(0x1fc)]+_0x32103d(0x1f5)};}};function detectModeFromSql(_0x288a71){const _0x4dbccb=a172_0x5be294,_0x271b9f=ensureRemoteSqlContent(_0x288a71),_0x1a3d01=stripLocalSqlMetadata(_0x271b9f,_0x4dbccb(0x1d8))[_0x4dbccb(0x1e2)]();if(/^<(select|insert|update|delete)\b/i[_0x4dbccb(0x1da)](_0x1a3d01))return _0x4dbccb(0x1d8);return'sql';}function isEquivalentPulledSqlFile(_0x44f7cc,_0x48afea,_0x17f323){return normalizePullComparableContent(_0x44f7cc,_0x17f323)===normalizePullComparableContent(_0x48afea,_0x17f323);}function normalizePullComparableContent(_0xb66c69,_0x54948a){const _0x497ca1=a172_0x5be294,_0x4d1c44=_0xb66c69[_0x497ca1(0x1f7)](/\r\n/g,'\x0a')[_0x497ca1(0x1e7)]('\x0a'),_0x5dbdcd=_0x4d1c44[_0x497ca1(0x204)](_0x208daa=>!isSyncedAtMetadataLine(_0x208daa,_0x54948a));return _0x5dbdcd['join']('\x0a');}function isSyncedAtMetadataLine(_0x227fd5,_0x2b14aa){const _0x3f9024=a172_0x5be294;if(_0x2b14aa==='mybatisXml')return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x3f9024(0x1da)](_0x227fd5);return/^\s*--\s*@lovrabet\.syncedAt:/['test'](_0x227fd5);}
|
package/lib/commands/sql/push.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function a173_0x49e7(_0x46eefb,_0x1ec85f){_0x46eefb=_0x46eefb-0x1a8;const _0x514c2f=a173_0x514c();let _0x49e745=_0x514c2f[_0x46eefb];return _0x49e745;}const a173_0x3a5554=a173_0x49e7;(function(_0x3e926c,_0x229699){const _0x41dd26=a173_0x49e7,_0x3352f2=_0x3e926c();while(!![]){try{const _0x55535c=-parseInt(_0x41dd26(0x1e0))/0x1*(parseInt(_0x41dd26(0x1e4))/0x2)+-parseInt(_0x41dd26(0x1ae))/0x3+-parseInt(_0x41dd26(0x1af))/0x4+-parseInt(_0x41dd26(0x1de))/0x5*(-parseInt(_0x41dd26(0x1b4))/0x6)+parseInt(_0x41dd26(0x1c0))/0x7+parseInt(_0x41dd26(0x1d8))/0x8*(parseInt(_0x41dd26(0x1b7))/0x9)+-parseInt(_0x41dd26(0x1cb))/0xa*(parseInt(_0x41dd26(0x1aa))/0xb);if(_0x55535c===_0x229699)break;else _0x3352f2['push'](_0x3352f2['shift']());}catch(_0x375ff3){_0x3352f2['push'](_0x3352f2['shift']());}}}(a173_0x514c,0x7a583));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';async function getTargetSqlQueries(_0x5dced7,_0x31240c,_0x2f1da6){const _0x40a156=a173_0x49e7,_0x5169f2=await scanLocalSqlQueries(_0x5dced7),_0xd5a0d5=new Map();for(const _0x5bb304 of _0x5169f2){if(_0x2f1da6&&_0x5bb304[_0x40a156(0x1ca)]!==_0x2f1da6)continue;const _0x21f2c4=_0xd5a0d5[_0x40a156(0x1df)](_0x5bb304[_0x40a156(0x1ca)])??[];_0x21f2c4['push'](_0x5bb304),_0xd5a0d5['set'](_0x5bb304['sqlCode'],_0x21f2c4);}if(_0x2f1da6&&!_0xd5a0d5[_0x40a156(0x1b3)](_0x2f1da6))throw CliErrors['validation'](_0x40a156(0x1dd)+_0x2f1da6);const _0x481c4d=[];for(const [_0x52a391,_0x33ce6d]of _0xd5a0d5[_0x40a156(0x1ed)]()){if(_0x33ce6d['length']===0x1){_0x481c4d[_0x40a156(0x1b8)](_0x33ce6d[0x0]);continue;}const _0x2d9062=_0x31240c[_0x40a156(0x1d4)][_0x52a391],_0x6650f1=_0x2d9062?.[_0x40a156(0x1d5)],_0x3840c8=_0x6650f1?_0x33ce6d[_0x40a156(0x1c4)](_0x3c1482=>_0x3c1482['relativePath']!==_0x6650f1):_0x33ce6d;if(_0x2d9062&&_0x3840c8[_0x40a156(0x1c2)]===0x1){_0x481c4d[_0x40a156(0x1b8)](_0x3840c8[0x0]);continue;}throw CliErrors[_0x40a156(0x1d1)](_0x40a156(0x1d9)+_0x52a391+_0x40a156(0x1db));}return _0x481c4d;}export const sqlPush={'service':a173_0x3a5554(0x1be),'command':a173_0x3a5554(0x1b8),'description':'Push\x20local\x20SQL\x20files\x20to\x20remote','risk':a173_0x3a5554(0x1b6),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a173_0x3a5554(0x1b0),'type':a173_0x3a5554(0x1e2),'description':a173_0x3a5554(0x1bd)}],async 'dryRun'(_0x4d9a51){const _0x2ac10f=a173_0x3a5554,_0x355ff7=loadSqlProjectConfig(_0x4d9a51[_0x2ac10f(0x1ab)]),_0x534962=await readSqlLockFile(_0x355ff7[_0x2ac10f(0x1c3)]),{appLock:_0x5cd4d4}=ensureSqlLockScope(_0x534962??createEmptySqlLock(),_0x4d9a51[_0x2ac10f(0x1ab)],_0x355ff7[_0x2ac10f(0x1c8)],_0x2ac10f(0x1b8)),_0x41eb1f=await getTargetSqlQueries(_0x355ff7,_0x5cd4d4,_0x4d9a51[_0x2ac10f(0x1cd)](_0x2ac10f(0x1ee))||undefined),_0x5ede22=[];for(const _0x1dabf5 of _0x41eb1f){const _0xafd3f6=await computeSqlFileHash(_0x1dabf5[_0x2ac10f(0x1b9)]),_0x337c56=_0x5cd4d4[_0x2ac10f(0x1d4)][_0x1dabf5[_0x2ac10f(0x1ca)]],_0x2a92c4=!!_0x337c56&&(_0x337c56[_0x2ac10f(0x1d5)]!==_0x1dabf5[_0x2ac10f(0x1e6)]||!!_0x1dabf5['sqlName']&&_0x337c56['sqlName']!==_0x1dabf5[_0x2ac10f(0x1c5)]);if(!_0x4d9a51['bool'](_0x2ac10f(0x1b0))&&_0x337c56&&_0x337c56[_0x2ac10f(0x1e5)]===_0xafd3f6&&!_0x2a92c4)continue;_0x5ede22[_0x2ac10f(0x1b8)](_0x1dabf5[_0x2ac10f(0x1ca)]);}return{'method':'POST','url':'/smartapi/custom/updateUserCustomSql','body':{'sqlCodes':_0x5ede22,'appCode':_0x4d9a51['appCode']},'description':_0x2ac10f(0x1c9)+_0x5ede22['length']+_0x2ac10f(0x1b1)};},async 'execute'(_0x513fa5){const _0x52608b=a173_0x3a5554,_0x28d014=loadSqlProjectConfig(_0x513fa5[_0x52608b(0x1ab)]),_0x4e1c56=await readSqlLockFile(_0x28d014[_0x52608b(0x1c3)]),{lockData:_0x56a7ee,appLock:_0x726994}=ensureSqlLockScope(_0x4e1c56??createEmptySqlLock(),_0x513fa5[_0x52608b(0x1ab)],_0x28d014[_0x52608b(0x1c8)],_0x52608b(0x1b8)),_0x623f09=await getTargetSqlQueries(_0x28d014,_0x726994,_0x513fa5[_0x52608b(0x1cd)]('sqlcode')||undefined);if(_0x623f09['length']===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x52608b(0x1e7)};const _0x338f14=[],_0xce6020=[],_0x58f05b=[];for(const _0x1740a3 of _0x623f09){const _0x109360=_0x726994[_0x52608b(0x1d4)][_0x1740a3['sqlCode']];if(!_0x109360){_0x58f05b[_0x52608b(0x1b8)]({'sqlCode':_0x1740a3['sqlCode'],'error':_0x52608b(0x1bb)});continue;}try{const _0x562c42=await computeSqlFileHash(_0x1740a3[_0x52608b(0x1b9)]),_0x469979=_0x109360['path']!==_0x1740a3[_0x52608b(0x1e6)]||!!_0x1740a3[_0x52608b(0x1c5)]&&_0x109360[_0x52608b(0x1c5)]!==_0x1740a3[_0x52608b(0x1c5)];if(!_0x513fa5[_0x52608b(0x1ce)]('force')&&_0x109360[_0x52608b(0x1e5)]===_0x562c42&&!_0x469979){_0xce6020[_0x52608b(0x1b8)]({'sqlCode':_0x1740a3[_0x52608b(0x1ca)],'reason':'unchanged'});continue;}if(_0x109360[_0x52608b(0x1ea)]==null){_0x58f05b[_0x52608b(0x1b8)]({'sqlCode':_0x1740a3[_0x52608b(0x1ca)],'error':_0x52608b(0x1e9)});continue;}const _0x1b6255=await readFile(_0x1740a3[_0x52608b(0x1b9)],_0x52608b(0x1cc)),_0x7f3f70=stripLocalSqlMetadata(_0x1b6255,_0x1740a3[_0x52608b(0x1da)]),_0x449e80=_0x1740a3[_0x52608b(0x1c5)]||_0x109360['sqlName'],_0x4a1391=await resolveTargetDbBinding(_0x513fa5[_0x52608b(0x1ab)],_0x1740a3,_0x109360),_0x20df15=await updateSqlQuery({'id':_0x109360[_0x52608b(0x1d7)],'appCode':_0x513fa5[_0x52608b(0x1ab)],'sqlCode':_0x1740a3[_0x52608b(0x1ca)],'sqlName':_0x449e80,'dbId':_0x4a1391[_0x52608b(0x1d3)],'version':_0x109360[_0x52608b(0x1ea)],'sqlContent':_0x7f3f70,'sqlConfig':_0x109360[_0x52608b(0x1c7)]??undefined}),_0x2ba3bd=_0x20df15[_0x52608b(0x1d3)]?await getDbName(_0x513fa5['appCode'],Number(_0x20df15[_0x52608b(0x1d3)]))[_0x52608b(0x1e1)](()=>_0x4a1391[_0x52608b(0x1a9)]):_0x4a1391[_0x52608b(0x1a9)];_0x726994['sqls'][_0x1740a3['sqlCode']]={...buildSqlLockEntry(_0x20df15,_0x7f3f70,_0x562c42,{'dbName':_0x2ba3bd}),'path':_0x1740a3[_0x52608b(0x1e6)],'mode':_0x109360[_0x52608b(0x1da)]},await archivePreviousSqlFileIfNeeded(_0x28d014,_0x109360[_0x52608b(0x1d5)],_0x1740a3['relativePath']),_0x338f14[_0x52608b(0x1b8)]({'sqlCode':_0x1740a3[_0x52608b(0x1ca)],'remoteId':_0x109360[_0x52608b(0x1d7)]});}catch(_0x55f4c8){_0x58f05b['push']({'sqlCode':_0x1740a3[_0x52608b(0x1ca)],'error':_0x55f4c8 instanceof Error?_0x55f4c8[_0x52608b(0x1c1)]:String(_0x55f4c8)});}}return _0x726994[_0x52608b(0x1b2)]=new Date()[_0x52608b(0x1bf)](),await writeSqlLockFile(_0x28d014[_0x52608b(0x1c3)],_0x56a7ee),{'ok':_0x58f05b[_0x52608b(0x1c2)]===0x0,'data':{'pushed':_0x338f14,'skipped':_0xce6020,'failed':_0x58f05b},'message':_0x52608b(0x1b5)+_0x338f14[_0x52608b(0x1c2)]+_0x52608b(0x1ac)+_0xce6020[_0x52608b(0x1c2)]+'\x20skipped,\x20'+_0x58f05b[_0x52608b(0x1c2)]+_0x52608b(0x1bc)};}};function a173_0x514c(){const _0x38eefd=['sqlCode','321130HsUMTm','utf8','str','bool','projectRoot','No\x20database\x20matches\x20local\x20directory\x20\x22','validation','join','dbId','sqls','path','startsWith','remoteId','32CdXaRS','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','mode','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','map','Local\x20SQL\x20not\x20found:\x20','5nCzxLQ','get','5253HReqat','catch','boolean','sqlRootDir','2ZgOvsW','hash','relativePath','No\x20local\x20SQL\x20files\x20found.','replace','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','version','isFinite','dbDirectory','entries','sqlcode','exec','dbName','429inKoay','appCode','\x20pushed,\x20','trashDir','1012758CdIYtx','991724vHMmVm','force','\x20SQL\x20file(s)','lastSync','has','4491222WkvTBH','Push\x20complete:\x20','high-risk-write','2078181IIoIvb','push','filePath','\x22\x20for\x20sqlCode\x20','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','\x20failed','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','sql','toISOString','4704889YlpyKm','message','length','lockFilePath','filter','sqlName','Local\x20directory\x20\x22','sqlConfig','sqlRoot','Would\x20push\x20'];a173_0x514c=function(){return _0x38eefd;};return a173_0x514c();}async function archivePreviousSqlFileIfNeeded(_0x2c13a7,_0x1b6def,_0x367159){const _0x73eb05=a173_0x3a5554;if(!_0x1b6def||_0x1b6def===_0x367159)return;const _0x708189=join(_0x2c13a7[_0x73eb05(0x1e3)],_0x1b6def);if(!await fileExists(_0x708189))return;const _0x2e97f6=await moveToTrash(_0x2c13a7[_0x73eb05(0x1cf)],_0x2c13a7[_0x73eb05(0x1ad)],_0x708189);await cleanupEmptyDirectories(dirname(_0x708189),_0x2c13a7[_0x73eb05(0x1e3)]),void _0x2e97f6;}async function moveToTrash(_0x1f8d06,_0x2b082c,_0x2940e4){const _0x31983a=a173_0x3a5554,_0x481797=new Date()[_0x31983a(0x1bf)]()[_0x31983a(0x1e8)](/[:.]/g,'-'),_0x5560da=relative(_0x1f8d06,_0x2940e4),_0x4b44e4=join(_0x2b082c,_0x481797,_0x5560da);return await mkdir(dirname(_0x4b44e4),{'recursive':!![]}),await rename(_0x2940e4,_0x4b44e4),_0x4b44e4;}async function cleanupEmptyDirectories(_0x58fd8b,_0x4f0d6e){const _0x1f93f6=a173_0x3a5554;let _0x286be4=resolve(_0x58fd8b);const _0x2130ae=resolve(_0x4f0d6e);while(_0x286be4[_0x1f93f6(0x1d6)](''+_0x2130ae+sep)||_0x286be4===_0x2130ae){if(_0x286be4===_0x2130ae)return;try{const _0x1c33bf=await readdir(_0x286be4);if(_0x1c33bf[_0x1f93f6(0x1c2)]>0x0)return;await rmdir(_0x286be4);}catch{return;}_0x286be4=dirname(_0x286be4);}}async function resolveTargetDbBinding(_0x13ee88,_0x540016,_0x2969c4){const _0x3bbcda=a173_0x3a5554,_0x20c5ab=_0x540016[_0x3bbcda(0x1ec)];if(!_0x20c5ab)return{'dbId':_0x2969c4[_0x3bbcda(0x1d3)],'dbName':_0x2969c4['dbName']};const _0x3c1423=buildDbDirectoryName(_0x2969c4[_0x3bbcda(0x1a9)],_0x2969c4[_0x3bbcda(0x1d3)]);if(_0x20c5ab===_0x3c1423)return{'dbId':_0x2969c4[_0x3bbcda(0x1d3)],'dbName':_0x2969c4['dbName']};const _0x68cef=parseExplicitDbDirectory(_0x20c5ab);if(_0x68cef!=null)return{'dbId':_0x68cef,'dbName':await getDbName(_0x13ee88,_0x68cef)[_0x3bbcda(0x1e1)](()=>undefined)};const _0x30d5df=await listDatabases(_0x13ee88),_0x529b02=_0x30d5df['filter'](_0x76b1e7=>buildDbDirectoryName(_0x76b1e7[_0x3bbcda(0x1a9)],_0x76b1e7['dbId'])===_0x20c5ab);if(_0x529b02[_0x3bbcda(0x1c2)]===0x1)return{'dbId':_0x529b02[0x0][_0x3bbcda(0x1d3)],'dbName':_0x529b02[0x0]['dbName']};if(_0x529b02['length']===0x0)throw CliErrors[_0x3bbcda(0x1d1)](_0x3bbcda(0x1d0)+_0x20c5ab+_0x3bbcda(0x1ba)+_0x540016[_0x3bbcda(0x1ca)]+'.');const _0xce3768=_0x529b02[_0x3bbcda(0x1dc)](_0xf95f7f=>_0xf95f7f['dbName']+'\x20('+_0xf95f7f[_0x3bbcda(0x1d3)]+')')[_0x3bbcda(0x1d2)](',\x20');throw CliErrors[_0x3bbcda(0x1d1)](_0x3bbcda(0x1c6)+_0x20c5ab+'\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20'+_0x540016['sqlCode']+':\x20'+_0xce3768);}function parseExplicitDbDirectory(_0x3eae12){const _0x296d64=a173_0x3a5554,_0xb5bc64=/^db-(\d+)$/[_0x296d64(0x1a8)](_0x3eae12);if(!_0xb5bc64)return null;const _0x585186=Number(_0xb5bc64[0x1]);return Number[_0x296d64(0x1eb)](_0x585186)&&_0x585186>0x0?_0x585186:null;}
|
|
1
|
+
const a173_0x1839b9=a173_0x4ab2;(function(_0x4e4a00,_0x176912){const _0x54eb03=a173_0x4ab2,_0x2f2e2a=_0x4e4a00();while(!![]){try{const _0x20de16=-parseInt(_0x54eb03(0x1b5))/0x1+-parseInt(_0x54eb03(0x1b6))/0x2*(-parseInt(_0x54eb03(0x1a8))/0x3)+-parseInt(_0x54eb03(0x1a9))/0x4+parseInt(_0x54eb03(0x1c5))/0x5+parseInt(_0x54eb03(0x1b9))/0x6+parseInt(_0x54eb03(0x1ae))/0x7+parseInt(_0x54eb03(0x1ba))/0x8;if(_0x20de16===_0x176912)break;else _0x2f2e2a['push'](_0x2f2e2a['shift']());}catch(_0x500938){_0x2f2e2a['push'](_0x2f2e2a['shift']());}}}(a173_0x4d07,0xb11ba));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';async function getTargetSqlQueries(_0x49c6a0,_0x49c781,_0x16ed82){const _0x402b79=a173_0x4ab2,_0xc1d513=await scanLocalSqlQueries(_0x49c6a0),_0x2ed495=new Map();for(const _0x1844bc of _0xc1d513){if(_0x16ed82&&_0x1844bc[_0x402b79(0x1d2)]!==_0x16ed82)continue;const _0x1b0e3f=_0x2ed495['get'](_0x1844bc['sqlCode'])??[];_0x1b0e3f[_0x402b79(0x1c7)](_0x1844bc),_0x2ed495[_0x402b79(0x1b1)](_0x1844bc[_0x402b79(0x1d2)],_0x1b0e3f);}if(_0x16ed82&&!_0x2ed495[_0x402b79(0x1bd)](_0x16ed82))throw CliErrors[_0x402b79(0x1df)](_0x402b79(0x1b8)+_0x16ed82);const _0x13ed8a=[];for(const [_0x16c361,_0x154b48]of _0x2ed495[_0x402b79(0x1de)]()){if(_0x154b48['length']===0x1){_0x13ed8a[_0x402b79(0x1c7)](_0x154b48[0x0]);continue;}const _0x46dbaf=_0x49c781['sqls'][_0x16c361],_0x3d2f13=_0x46dbaf?.[_0x402b79(0x1cf)],_0x34beb9=_0x3d2f13?_0x154b48[_0x402b79(0x1d5)](_0x4828c2=>_0x4828c2[_0x402b79(0x1dc)]!==_0x3d2f13):_0x154b48;if(_0x46dbaf&&_0x34beb9['length']===0x1){_0x13ed8a['push'](_0x34beb9[0x0]);continue;}throw CliErrors['validation'](_0x402b79(0x1bf)+_0x16c361+'.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.');}return _0x13ed8a;}export const sqlPush={'service':a173_0x1839b9(0x1dd),'command':a173_0x1839b9(0x1c7),'description':a173_0x1839b9(0x1d6),'risk':a173_0x1839b9(0x1c4),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a173_0x1839b9(0x1c6),'type':a173_0x1839b9(0x1cb),'description':a173_0x1839b9(0x1ab)}],async 'dryRun'(_0x51006e){const _0x579cfd=a173_0x1839b9,_0x4242c0=loadSqlProjectConfig(_0x51006e[_0x579cfd(0x1e5)]),_0x9bf743=await readSqlLockFile(_0x4242c0[_0x579cfd(0x1da)]),{appLock:_0x546f71}=ensureSqlLockScope(_0x9bf743??createEmptySqlLock(),_0x51006e[_0x579cfd(0x1e5)],_0x4242c0[_0x579cfd(0x1c9)],_0x579cfd(0x1c7)),_0x16c233=await getTargetSqlQueries(_0x4242c0,_0x546f71,_0x51006e['str'](_0x579cfd(0x1c1))||undefined),_0x51851c=[];for(const _0x32dc7a of _0x16c233){const _0x41e885=await computeSqlFileHash(_0x32dc7a['filePath']),_0x3bae87=_0x546f71[_0x579cfd(0x1ce)][_0x32dc7a[_0x579cfd(0x1d2)]],_0x19405c=!!_0x3bae87&&(_0x3bae87[_0x579cfd(0x1cf)]!==_0x32dc7a[_0x579cfd(0x1dc)]||!!_0x32dc7a[_0x579cfd(0x1d9)]&&_0x3bae87['sqlName']!==_0x32dc7a[_0x579cfd(0x1d9)]);if(!_0x51006e[_0x579cfd(0x1db)]('force')&&_0x3bae87&&_0x3bae87['hash']===_0x41e885&&!_0x19405c)continue;_0x51851c[_0x579cfd(0x1c7)](_0x32dc7a[_0x579cfd(0x1d2)]);}return{'method':_0x579cfd(0x1af),'url':_0x579cfd(0x1ca),'body':{'sqlCodes':_0x51851c,'appCode':_0x51006e[_0x579cfd(0x1e5)]},'description':_0x579cfd(0x1e8)+_0x51851c[_0x579cfd(0x1e9)]+_0x579cfd(0x1d1)};},async 'execute'(_0x5ad2e3){const _0x5be17a=a173_0x1839b9,_0x15efec=loadSqlProjectConfig(_0x5ad2e3[_0x5be17a(0x1e5)]),_0x1c6de3=await readSqlLockFile(_0x15efec['lockFilePath']),{lockData:_0x203a26,appLock:_0x751eb9}=ensureSqlLockScope(_0x1c6de3??createEmptySqlLock(),_0x5ad2e3[_0x5be17a(0x1e5)],_0x15efec['sqlRoot'],_0x5be17a(0x1c7)),_0x357842=await getTargetSqlQueries(_0x15efec,_0x751eb9,_0x5ad2e3[_0x5be17a(0x1ac)](_0x5be17a(0x1c1))||undefined);if(_0x357842[_0x5be17a(0x1e9)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x5be17a(0x1d7)};const _0x1f2c08=[],_0x21aa2e=[],_0x4074b7=[];for(const _0x4df687 of _0x357842){const _0x13e3cc=_0x751eb9[_0x5be17a(0x1ce)][_0x4df687[_0x5be17a(0x1d2)]];if(!_0x13e3cc){_0x4074b7[_0x5be17a(0x1c7)]({'sqlCode':_0x4df687[_0x5be17a(0x1d2)],'error':'local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first'});continue;}try{const _0x231d9d=await computeSqlFileHash(_0x4df687[_0x5be17a(0x1e6)]),_0x396737=_0x13e3cc[_0x5be17a(0x1cf)]!==_0x4df687['relativePath']||!!_0x4df687[_0x5be17a(0x1d9)]&&_0x13e3cc[_0x5be17a(0x1d9)]!==_0x4df687[_0x5be17a(0x1d9)];if(!_0x5ad2e3[_0x5be17a(0x1db)](_0x5be17a(0x1c6))&&_0x13e3cc[_0x5be17a(0x1e0)]===_0x231d9d&&!_0x396737){_0x21aa2e['push']({'sqlCode':_0x4df687[_0x5be17a(0x1d2)],'reason':'unchanged'});continue;}if(_0x13e3cc[_0x5be17a(0x1e7)]==null){_0x4074b7[_0x5be17a(0x1c7)]({'sqlCode':_0x4df687[_0x5be17a(0x1d2)],'error':_0x5be17a(0x1b3)});continue;}const _0x4d9e38=await readFile(_0x4df687[_0x5be17a(0x1e6)],_0x5be17a(0x1d3)),_0x1d1f7e=stripLocalSqlMetadata(_0x4d9e38,_0x4df687[_0x5be17a(0x1c2)]),_0x549d61=_0x4df687['sqlName']||_0x13e3cc[_0x5be17a(0x1d9)],_0x4dc4bd=await resolveTargetDbBinding(_0x5ad2e3[_0x5be17a(0x1e5)],_0x4df687,_0x13e3cc),_0x332976=await updateSqlQuery({'id':_0x13e3cc['remoteId'],'appCode':_0x5ad2e3[_0x5be17a(0x1e5)],'sqlCode':_0x4df687['sqlCode'],'sqlName':_0x549d61,'dbId':_0x4dc4bd['dbId'],'version':_0x13e3cc[_0x5be17a(0x1e7)],'sqlContent':_0x1d1f7e,'sqlConfig':_0x13e3cc[_0x5be17a(0x1e4)]??undefined}),_0x1b439d=_0x332976[_0x5be17a(0x1c3)]?await getDbName(_0x5ad2e3[_0x5be17a(0x1e5)],Number(_0x332976[_0x5be17a(0x1c3)]))[_0x5be17a(0x1e2)](()=>_0x4dc4bd[_0x5be17a(0x1be)]):_0x4dc4bd[_0x5be17a(0x1be)];_0x751eb9[_0x5be17a(0x1ce)][_0x4df687['sqlCode']]={...buildSqlLockEntry(_0x332976,_0x1d1f7e,_0x231d9d,{'dbName':_0x1b439d}),'path':_0x4df687[_0x5be17a(0x1dc)],'mode':_0x13e3cc['mode']},await archivePreviousSqlFileIfNeeded(_0x15efec,_0x13e3cc['path'],_0x4df687[_0x5be17a(0x1dc)]),_0x1f2c08['push']({'sqlCode':_0x4df687[_0x5be17a(0x1d2)],'remoteId':_0x13e3cc['remoteId']});}catch(_0x7265e9){_0x4074b7[_0x5be17a(0x1c7)]({'sqlCode':_0x4df687[_0x5be17a(0x1d2)],'error':_0x7265e9 instanceof Error?_0x7265e9[_0x5be17a(0x1b2)]:String(_0x7265e9)});}}return _0x751eb9[_0x5be17a(0x1b0)]=new Date()['toISOString'](),await writeSqlLockFile(_0x15efec['lockFilePath'],_0x203a26),{'ok':_0x4074b7[_0x5be17a(0x1e9)]===0x0,'data':{'pushed':_0x1f2c08,'skipped':_0x21aa2e,'failed':_0x4074b7},'message':_0x5be17a(0x1cc)+_0x1f2c08[_0x5be17a(0x1e9)]+_0x5be17a(0x1d4)+_0x21aa2e[_0x5be17a(0x1e9)]+_0x5be17a(0x1b7)+_0x4074b7['length']+_0x5be17a(0x1c8)};}};function a173_0x4d07(){const _0x2354a8=['990026dmbdrj','\x20skipped,\x20','Local\x20SQL\x20not\x20found:\x20','2188098GkqNjS','9325880bqIbts','isFinite','join','has','dbName','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','\x22\x20for\x20sqlCode\x20','sqlcode','mode','dbId','high-risk-write','127310lHhrpM','force','push','\x20failed','sqlRoot','/smartapi/custom/updateUserCustomSql','boolean','Push\x20complete:\x20','toISOString','sqls','path','replace','\x20SQL\x20file(s)','sqlCode','utf8','\x20pushed,\x20','filter','Push\x20local\x20SQL\x20files\x20to\x20remote','No\x20local\x20SQL\x20files\x20found.','sqlRootDir','sqlName','lockFilePath','bool','relativePath','sql','entries','validation','hash','trashDir','catch','No\x20database\x20matches\x20local\x20directory\x20\x22','sqlConfig','appCode','filePath','version','Would\x20push\x20','length','exec','3zJdbxT','3139020vteTOG','startsWith','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','str','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','6095152CiEhxC','POST','lastSync','set','message','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','projectRoot','1411440VKboer'];a173_0x4d07=function(){return _0x2354a8;};return a173_0x4d07();}function a173_0x4ab2(_0x46573c,_0x5401ec){_0x46573c=_0x46573c-0x1a8;const _0x4d07a0=a173_0x4d07();let _0x4ab24b=_0x4d07a0[_0x46573c];return _0x4ab24b;}async function archivePreviousSqlFileIfNeeded(_0x1d9705,_0x17611c,_0x4c3bc1){const _0x59aa34=a173_0x1839b9;if(!_0x17611c||_0x17611c===_0x4c3bc1)return;const _0x585135=join(_0x1d9705['sqlRootDir'],_0x17611c);if(!await fileExists(_0x585135))return;const _0x191caa=await moveToTrash(_0x1d9705[_0x59aa34(0x1b4)],_0x1d9705[_0x59aa34(0x1e1)],_0x585135);await cleanupEmptyDirectories(dirname(_0x585135),_0x1d9705[_0x59aa34(0x1d8)]),void _0x191caa;}async function moveToTrash(_0x22710a,_0x3e81a4,_0x21176b){const _0x3ee9b8=a173_0x1839b9,_0x59b0c4=new Date()[_0x3ee9b8(0x1cd)]()[_0x3ee9b8(0x1d0)](/[:.]/g,'-'),_0xeb372d=relative(_0x22710a,_0x21176b),_0x9b88cc=join(_0x3e81a4,_0x59b0c4,_0xeb372d);return await mkdir(dirname(_0x9b88cc),{'recursive':!![]}),await rename(_0x21176b,_0x9b88cc),_0x9b88cc;}async function cleanupEmptyDirectories(_0x3eab05,_0x19adf1){const _0x109e45=a173_0x1839b9;let _0x2f1e4e=resolve(_0x3eab05);const _0x145892=resolve(_0x19adf1);while(_0x2f1e4e[_0x109e45(0x1aa)](''+_0x145892+sep)||_0x2f1e4e===_0x145892){if(_0x2f1e4e===_0x145892)return;try{const _0x53f95d=await readdir(_0x2f1e4e);if(_0x53f95d[_0x109e45(0x1e9)]>0x0)return;await rmdir(_0x2f1e4e);}catch{return;}_0x2f1e4e=dirname(_0x2f1e4e);}}async function resolveTargetDbBinding(_0x3188ef,_0x4ad894,_0x34202b){const _0x1de28c=a173_0x1839b9,_0x440ac4=_0x4ad894['dbDirectory'];if(!_0x440ac4)return{'dbId':_0x34202b[_0x1de28c(0x1c3)],'dbName':_0x34202b[_0x1de28c(0x1be)]};const _0x3b815c=buildDbDirectoryName(_0x34202b[_0x1de28c(0x1be)],_0x34202b['dbId']);if(_0x440ac4===_0x3b815c)return{'dbId':_0x34202b['dbId'],'dbName':_0x34202b[_0x1de28c(0x1be)]};const _0x52375d=parseExplicitDbDirectory(_0x440ac4);if(_0x52375d!=null)return{'dbId':_0x52375d,'dbName':await getDbName(_0x3188ef,_0x52375d)['catch'](()=>undefined)};const _0x48f845=await listDatabases(_0x3188ef),_0x4596f8=_0x48f845[_0x1de28c(0x1d5)](_0x1d6783=>buildDbDirectoryName(_0x1d6783['dbName'],_0x1d6783[_0x1de28c(0x1c3)])===_0x440ac4);if(_0x4596f8[_0x1de28c(0x1e9)]===0x1)return{'dbId':_0x4596f8[0x0][_0x1de28c(0x1c3)],'dbName':_0x4596f8[0x0][_0x1de28c(0x1be)]};if(_0x4596f8['length']===0x0)throw CliErrors['validation'](_0x1de28c(0x1e3)+_0x440ac4+_0x1de28c(0x1c0)+_0x4ad894[_0x1de28c(0x1d2)]+'.');const _0x5ebc6a=_0x4596f8['map'](_0xb53095=>_0xb53095[_0x1de28c(0x1be)]+'\x20('+_0xb53095['dbId']+')')[_0x1de28c(0x1bc)](',\x20');throw CliErrors[_0x1de28c(0x1df)]('Local\x20directory\x20\x22'+_0x440ac4+_0x1de28c(0x1ad)+_0x4ad894['sqlCode']+':\x20'+_0x5ebc6a);}function parseExplicitDbDirectory(_0x571bdd){const _0x58afc8=a173_0x1839b9,_0xe4a8b7=/^db-(\d+)$/[_0x58afc8(0x1ea)](_0x571bdd);if(!_0xe4a8b7)return null;const _0x153dca=Number(_0xe4a8b7[0x1]);return Number[_0x58afc8(0x1bb)](_0x153dca)&&_0x153dca>0x0?_0x153dca:null;}
|
package/lib/commands/sql/save.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a174_0x226cf1=a174_0x12b6;(function(_0x5a8760,_0x78c429){const _0x46da75=a174_0x12b6,_0x252600=_0x5a8760();while(!![]){try{const _0x19f2aa=-parseInt(_0x46da75(0x173))/0x1*(-parseInt(_0x46da75(0x183))/0x2)+parseInt(_0x46da75(0x17d))/0x3*(-parseInt(_0x46da75(0x180))/0x4)+-parseInt(_0x46da75(0x170))/0x5+parseInt(_0x46da75(0x176))/0x6*(parseInt(_0x46da75(0x184))/0x7)+parseInt(_0x46da75(0x182))/0x8+parseInt(_0x46da75(0x178))/0x9+-parseInt(_0x46da75(0x172))/0xa;if(_0x19f2aa===_0x78c429)break;else _0x252600['push'](_0x252600['shift']());}catch(_0x50c881){_0x252600['push'](_0x252600['shift']());}}}(a174_0x28ad,0x24826));function a174_0x28ad(){const _0x13c164=['write','string','786279CPodxr','Query\x20description','join','4BHaOkN','file','2325976YbMyVT','2yGZvit','22162EXDitL','sql','`rabetbase\x20sql\x20save`\x20has\x20been\x20deprecated.','737435giBhag','SQL\x20query\x20display\x20name','2197390CWtOrV','163019fsnUGf','sqlname','validation','396rhsxou','Create\x20new\x20SQL\x20with\x20`rabetbase\x20sql\x20create\x20--name\x20<name>\x20--db-id\x20<id>\x20--mode\x20sql|mybatisXml`.','1045251Mtvtbi','Update\x20existing\x20SQL\x20by\x20editing\x20the\x20synced\x20file\x20under\x20`.rabetbase/sql/<appCode>/<dbName|db-<id>>/`\x20and\x20then\x20running\x20`rabetbase\x20sql\x20push\x20--sqlcode\x20<code>\x20--yes`.','Path\x20to\x20the\x20SQL\x20file'];a174_0x28ad=function(){return _0x13c164;};return a174_0x28ad();}import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a174_0x12b6(_0x2bb56d,_0x66edcb){_0x2bb56d=_0x2bb56d-0x16f;const _0x28ad08=a174_0x28ad();let _0x12b6a2=_0x28ad08[_0x2bb56d];return _0x12b6a2;}const SQL_SAVE_DEPRECATED_HINT=[a174_0x226cf1(0x16f),a174_0x226cf1(0x177),a174_0x226cf1(0x179)][a174_0x226cf1(0x17f)]('\x0a');export const sqlSave={'service':a174_0x226cf1(0x185),'command':'save','description':'Deprecated:\x20use\x20sql\x20create\x20to\x20create\x20and\x20sql\x20push\x20to\x20update','risk':a174_0x226cf1(0x17b),'requiresAuth':![],'requiresAppCode':![],'flags':[{'name':a174_0x226cf1(0x181),'type':a174_0x226cf1(0x17c),'required':!![],'description':a174_0x226cf1(0x17a)},SQLCODE_FLAG_OPTIONAL,{'name':a174_0x226cf1(0x174),'type':'string','description':a174_0x226cf1(0x171)},{'name':'db','type':a174_0x226cf1(0x17c),'description':'Target\x20database\x20—\x20accepts\x20a\x20numeric\x20ID\x20or\x20database\x20name\x20(e.g.\x20ecommerce_db)'},{'name':'description','type':'string','description':a174_0x226cf1(0x17e)}],async 'validate'(){const _0x457aa4=a174_0x226cf1;throw CliErrors[_0x457aa4(0x175)](SQL_SAVE_DEPRECATED_HINT);},async 'execute'(){const _0x4f82e5=a174_0x226cf1;throw CliErrors[_0x4f82e5(0x175)](SQL_SAVE_DEPRECATED_HINT);}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a175_0x454287=a175_0x401d;(function(_0x4cfd46,_0x109656){const _0x147fa3=a175_0x401d,_0x1ec9c0=_0x4cfd46();while(!![]){try{const _0x1f6cf1=-parseInt(_0x147fa3(0x79))/0x1+-parseInt(_0x147fa3(0x66))/0x2*(parseInt(_0x147fa3(0x8f))/0x3)+-parseInt(_0x147fa3(0x80))/0x4*(parseInt(_0x147fa3(0x91))/0x5)+-parseInt(_0x147fa3(0x81))/0x6+parseInt(_0x147fa3(0x72))/0x7+parseInt(_0x147fa3(0x77))/0x8+parseInt(_0x147fa3(0x76))/0x9;if(_0x1f6cf1===_0x109656)break;else _0x1ec9c0['push'](_0x1ec9c0['shift']());}catch(_0x161f12){_0x1ec9c0['push'](_0x1ec9c0['shift']());}}}(a175_0x3001,0xc9918));function a175_0x401d(_0x21c90e,_0x574445){_0x21c90e=_0x21c90e-0x65;const _0x3001d7=a175_0x3001();let _0x401d4a=_0x3001d7[_0x21c90e];return _0x401d4a;}import{createInterface}from'node:readline';import{join}from'node:path';import{buildDefaultSqlFileName,buildSqlRelativePath,detectSqlMode}from'../../core/sql-sync/utils.js';export const SQL_LOCAL_REL_DIR=a175_0x454287(0x73);export function buildSqlLockEntry(_0x2d64f8,_0x3850b3,_0x2b22e8,_0x571fc7){const _0x4f9c51=a175_0x454287,_0xebf4d9=detectSqlMode(_0x3850b3);return{'path':buildSqlRelativePath(_0x2d64f8[_0x4f9c51(0x83)],_0x2d64f8['sqlName'],_0x571fc7?.[_0x4f9c51(0x69)],_0xebf4d9,_0x2d64f8[_0x4f9c51(0x6f)]),'hash':_0x2b22e8,'remoteId':_0x2d64f8['id'],'version':_0x2d64f8[_0x4f9c51(0x87)],'dbId':Number(_0x2d64f8[_0x4f9c51(0x6f)]),'dbName':_0x571fc7?.[_0x4f9c51(0x69)],'sqlName':_0x2d64f8['sqlName'],'sqlConfig':_0x2d64f8[_0x4f9c51(0x6c)]??undefined,'mode':_0xebf4d9};}export function cloneSqlLockData(_0x2a2845){const _0x434b19=a175_0x454287;return{'apps':Object[_0x434b19(0x75)](Object[_0x434b19(0x84)](_0x2a2845['apps'])[_0x434b19(0x74)](([_0x1506b9,_0x5d9a3c])=>[_0x1506b9,{'sqlRoot':_0x5d9a3c['sqlRoot'],'lastSync':_0x5d9a3c[_0x434b19(0x8b)],'sqls':{..._0x5d9a3c['sqls']}}]))};}export function ensureRemoteSqlContent(_0x3fe3cb){return _0x3fe3cb['sqlContent']??'';}export function buildLocalSqlFileContent(_0x410db5,_0x233d2c,_0x10ed9c){const _0x21f3ca=a175_0x454287,_0x46e706=_0x10ed9c?.['mode']??detectSqlMode(_0x233d2c),_0x2c8d09=stripLocalSqlMetadata(_0x233d2c,_0x46e706)[_0x21f3ca(0x85)](),_0x13a82a=[...buildMetadataHeaderLines({'sqlCode':_0x410db5['sqlCode'],'sqlName':_0x410db5[_0x21f3ca(0x67)],'dbId':_0x410db5[_0x21f3ca(0x6f)],'dbName':_0x10ed9c?.[_0x21f3ca(0x69)],'mode':_0x46e706,'syncedAt':_0x10ed9c?.[_0x21f3ca(0x7d)],'description':_0x10ed9c?.[_0x21f3ca(0x70)]},_0x46e706),'',_0x2c8d09],_0x5d1dd5=_0x13a82a[_0x21f3ca(0x65)]('\x0a');return _0x5d1dd5[_0x21f3ca(0x89)]('\x0a')?_0x5d1dd5:_0x5d1dd5+'\x0a';}export function stripLocalSqlMetadata(_0x29a4e8,_0xa2dc02){const _0x2ce52a=a175_0x454287,_0x566641=_0x29a4e8[_0x2ce52a(0x7c)](/\r\n/g,'\x0a')[_0x2ce52a(0x68)]('\x0a'),_0x356457=[];let _0x57bdf4=0x0;if(_0xa2dc02===_0x2ce52a(0x78))while(_0x57bdf4<_0x566641[_0x2ce52a(0x90)]){const _0x437625=_0x566641[_0x57bdf4]??'';if(/^\s*<!--\s*@lovrabet\./[_0x2ce52a(0x86)](_0x437625)){_0x57bdf4++;continue;}if(_0x437625['trim']()===''&&_0x57bdf4>0x0){_0x57bdf4++;continue;}break;}else while(_0x57bdf4<_0x566641[_0x2ce52a(0x90)]){const _0x3d2dc2=_0x566641[_0x57bdf4]??'';if(/^\s*--\s*@lovrabet\./[_0x2ce52a(0x86)](_0x3d2dc2)){_0x57bdf4++;continue;}if(_0x3d2dc2['trim']()===''&&_0x57bdf4>0x0){_0x57bdf4++;continue;}break;}for(;_0x57bdf4<_0x566641[_0x2ce52a(0x90)];_0x57bdf4++){_0x356457[_0x2ce52a(0x88)](_0x566641[_0x57bdf4]);}return _0x356457[_0x2ce52a(0x65)]('\x0a')[_0x2ce52a(0x6a)]();}export function resolveSqlMode(_0xb6724,_0x5a03b3){if(_0x5a03b3?.['mode'])return _0x5a03b3['mode'];return detectSqlMode(_0xb6724);}function a175_0x3001(){const _0x456edb=['sqlConfig','question','includes','dbId','description','path','2345560LEAEeC','.rabetbase/sql','map','fromEntries','17097867YdyOqd','11588920LigAhD','mybatisXml','395198zoBVpp','filter','mode','replace','syncedAt','\x20[y/N]\x20','close','4lwBeRc','4182528qLXOyc','toLowerCase','sqlCode','entries','trim','test','version','push','endsWith','\x20-->','lastSync','apps','yes','stdin','1576866mhPddX','length','6199630syhktI','join','2nKoGbl','sqlName','split','dbName','trimStart','--\x20@lovrabet.'];a175_0x3001=function(){return _0x456edb;};return a175_0x3001();}export function resolveSqlFileName(_0x4ea6de,_0x4bd37e,_0x4c579f){const _0x5823ec=a175_0x454287;if(_0x4c579f?.[_0x5823ec(0x71)])return _0x4c579f[_0x5823ec(0x71)];if(_0x4c579f?.[_0x5823ec(0x67)]||_0x4c579f?.[_0x5823ec(0x69)])return buildSqlRelativePath(_0x4ea6de,_0x4c579f?.[_0x5823ec(0x67)],_0x4c579f?.['dbName'],resolveSqlMode(_0x4bd37e,_0x4c579f),_0x4c579f?.['dbId']);return buildDefaultSqlFileName(_0x4ea6de,resolveSqlMode(_0x4bd37e,_0x4c579f));}export function resolveSqlLocalDir(_0x37357b,_0xb701d2){return join(_0x37357b,SQL_LOCAL_REL_DIR,_0xb701d2);}export async function confirmForceOverwrite(_0x2f11eb){const _0x35413d=a175_0x454287,_0x2a54cb=createInterface({'input':process[_0x35413d(0x8e)],'output':process['stderr']}),_0x5ad00f=await new Promise(_0x251d28=>{const _0x31d83b=_0x35413d;_0x2a54cb[_0x31d83b(0x6d)](_0x2f11eb+_0x31d83b(0x7e),_0x251d28);});return _0x2a54cb[_0x35413d(0x7f)](),['y',_0x35413d(0x8d)][_0x35413d(0x6e)](_0x5ad00f[_0x35413d(0x85)]()[_0x35413d(0x82)]());}export function findSqlLockScope(_0x1672b3,_0x54c717){const _0x5064ee=a175_0x454287;return _0x1672b3[_0x5064ee(0x8c)][_0x54c717];}function buildMetadataHeaderLines(_0x2ee808,_0x125a4d){const _0x2192ba=a175_0x454287,_0x41d8eb=[[_0x2192ba(0x83),_0x2ee808['sqlCode']],[_0x2192ba(0x67),_0x2ee808[_0x2192ba(0x67)]],[_0x2192ba(0x6f),_0x2ee808[_0x2192ba(0x6f)]],[_0x2192ba(0x69),_0x2ee808[_0x2192ba(0x69)]],[_0x2192ba(0x7b),_0x2ee808['mode']],[_0x2192ba(0x7d),_0x2ee808[_0x2192ba(0x7d)]],[_0x2192ba(0x70),_0x2ee808[_0x2192ba(0x70)]]];if(_0x125a4d==='mybatisXml')return _0x41d8eb[_0x2192ba(0x7a)](([,_0x39875c])=>_0x39875c!==undefined&&_0x39875c!==null&&String(_0x39875c)['trim']()!=='')[_0x2192ba(0x74)](([_0x467208,_0x5e8966])=>'<!--\x20@lovrabet.'+_0x467208+':\x20'+String(_0x5e8966)+_0x2192ba(0x8a));return _0x41d8eb[_0x2192ba(0x7a)](([,_0x226bdc])=>_0x226bdc!==undefined&&_0x226bdc!==null&&String(_0x226bdc)[_0x2192ba(0x85)]()!=='')[_0x2192ba(0x74)](([_0x3d992c,_0x18cc6e])=>_0x2192ba(0x6b)+_0x3d992c+':\x20'+String(_0x18cc6e));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a176_0x26594b=a176_0x5ee4;(function(_0x2006cb,_0x43993e){const _0x2c1c83=a176_0x5ee4,_0xd20ed6=_0x2006cb();while(!![]){try{const _0x15b802=parseInt(_0x2c1c83(0x199))/0x1+-parseInt(_0x2c1c83(0x189))/0x2*(parseInt(_0x2c1c83(0x184))/0x3)+parseInt(_0x2c1c83(0x190))/0x4*(-parseInt(_0x2c1c83(0x187))/0x5)+-parseInt(_0x2c1c83(0x188))/0x6+-parseInt(_0x2c1c83(0x1a4))/0x7+parseInt(_0x2c1c83(0x183))/0x8+-parseInt(_0x2c1c83(0x195))/0x9*(-parseInt(_0x2c1c83(0x1a3))/0xa);if(_0x15b802===_0x43993e)break;else _0xd20ed6['push'](_0xd20ed6['shift']());}catch(_0x32aff5){_0xd20ed6['push'](_0xd20ed6['shift']());}}}(a176_0x350d,0x3e69b));import{listSqlQueries}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';function a176_0x350d(){const _0x413d18=['\x20added,\x20','sqlCode','3062628OahtnP','sqlRoot','keys','has','84343aJMSkM','path','sqls','\x20unchanged','paging','read','relativePath','filePath','status','totalCount','20usskyj','1292130MYlxUJ','\x20modified,\x20','remote','appCode','3064272uQRheq','243sqZdvq','sqlName','Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','225dJdYgG','1700322xNXwsZ','5052EUJMcI','map','tableData','\x20missing,\x20','All\x20SQL\x20queries\x20are\x20in\x20sync.','lockKey','push','19532dYhKQy','sql','length'];a176_0x350d=function(){return _0x413d18;};return a176_0x350d();}import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile}from'../../core/sql-sync/lock.js';function a176_0x5ee4(_0x591b7a,_0x8697f2){_0x591b7a=_0x591b7a-0x183;const _0x350d1f=a176_0x350d();let _0x5ee4e3=_0x350d1f[_0x591b7a];return _0x5ee4e3;}const PAGE_SIZE=0x64;async function fetchAllSqlCodes(_0x5bdc32){const _0x130ef3=a176_0x5ee4,_0x3e8d35=[];let _0x109574=0x1;while(!![]){const _0x905b32=await listSqlQueries(_0x5bdc32,{'currentPage':_0x109574,'pageSize':PAGE_SIZE}),_0x21c5b7=_0x905b32[_0x130ef3(0x18b)]??[];_0x3e8d35[_0x130ef3(0x18f)](..._0x21c5b7[_0x130ef3(0x18a)](_0x4b0b9b=>_0x4b0b9b[_0x130ef3(0x194)]));if(_0x21c5b7['length']===0x0)break;const _0x437955=_0x905b32[_0x130ef3(0x19d)]?.[_0x130ef3(0x1a2)];if(_0x437955!=null?_0x3e8d35[_0x130ef3(0x192)]>=_0x437955:_0x21c5b7[_0x130ef3(0x192)]<PAGE_SIZE)break;_0x109574++;}return _0x3e8d35;}export const sqlStatus={'service':a176_0x26594b(0x191),'command':a176_0x26594b(0x1a1),'description':a176_0x26594b(0x186),'risk':a176_0x26594b(0x19e),'flags':[{'name':a176_0x26594b(0x1a6),'type':'boolean','description':'Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally'}],async 'execute'(_0x4349a6){const _0x488251=a176_0x26594b,_0x506100=loadSqlProjectConfig(_0x4349a6['appCode']),_0x20d54a=await readSqlLockFile(_0x506100['lockFilePath']),{appLock:_0x33b341}=ensureSqlLockScope(_0x20d54a??createEmptySqlLock(),_0x506100[_0x488251(0x1a7)],_0x506100[_0x488251(0x196)],_0x488251(0x1a1)),_0x313889=await scanLocalSqlQueries(_0x506100),_0x38f698=[],_0x3389c8=[],_0x20211f=[],_0x535649=[],_0x42bf83=new Set(_0x313889[_0x488251(0x18a)](_0x3eb024=>_0x3eb024[_0x488251(0x18e)]));for(const _0x58285d of _0x313889){const _0x1a37af=await computeSqlFileHash(_0x58285d[_0x488251(0x1a0)]),_0x10c223=_0x33b341['sqls'][_0x58285d[_0x488251(0x18e)]],_0x54442b=!!_0x10c223&&_0x10c223[_0x488251(0x19a)]!==_0x58285d[_0x488251(0x19f)],_0x1ae8a6=!!_0x10c223&&!!_0x58285d['sqlName']&&_0x10c223[_0x488251(0x185)]!==_0x58285d[_0x488251(0x185)];if(!_0x10c223)_0x38f698[_0x488251(0x18f)](_0x58285d[_0x488251(0x18e)]);else _0x10c223['hash']!==_0x1a37af||_0x54442b||_0x1ae8a6?_0x3389c8[_0x488251(0x18f)](_0x58285d[_0x488251(0x18e)]):_0x20211f[_0x488251(0x18f)](_0x58285d[_0x488251(0x18e)]);}for(const _0x37bb12 of Object[_0x488251(0x197)](_0x33b341[_0x488251(0x19b)])){!_0x42bf83[_0x488251(0x198)](_0x37bb12)&&_0x535649[_0x488251(0x18f)](_0x37bb12);}const _0x44e464=[];if(_0x4349a6['bool'](_0x488251(0x1a6))){const _0x1466d9=await fetchAllSqlCodes(_0x4349a6[_0x488251(0x1a7)]);for(const _0x202817 of _0x1466d9){!_0x42bf83['has'](_0x202817)&&!_0x33b341[_0x488251(0x19b)][_0x202817]&&_0x44e464[_0x488251(0x18f)](_0x202817);}}const _0x42ca94=_0x38f698[_0x488251(0x192)]===0x0&&_0x3389c8['length']===0x0&&_0x535649[_0x488251(0x192)]===0x0&&_0x44e464[_0x488251(0x192)]===0x0;return{'ok':!![],'data':{'added':_0x38f698,'modified':_0x3389c8,'missing':_0x535649,'unchanged':_0x20211f,'remoteOnly':_0x44e464},'message':_0x42ca94?_0x488251(0x18d):_0x38f698['length']+_0x488251(0x193)+_0x3389c8[_0x488251(0x192)]+_0x488251(0x1a5)+_0x535649[_0x488251(0x192)]+_0x488251(0x18c)+_0x20211f[_0x488251(0x192)]+_0x488251(0x19c)+(_0x44e464[_0x488251(0x192)]>0x0?',\x20'+_0x44e464[_0x488251(0x192)]+'\x20remote-only':'')};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a177_0x5ba0a6=a177_0x13ef;function a177_0x13ef(_0x423b05,_0x293b20){_0x423b05=_0x423b05-0x12d;const _0xc7fe9=a177_0xc7fe();let _0x13ef3c=_0xc7fe9[_0x423b05];return _0x13ef3c;}(function(_0xb0c1b2,_0x326ccb){const _0xe6b4d=a177_0x13ef,_0x598f8d=_0xb0c1b2();while(!![]){try{const _0x516652=parseInt(_0xe6b4d(0x144))/0x1+parseInt(_0xe6b4d(0x140))/0x2+parseInt(_0xe6b4d(0x154))/0x3+parseInt(_0xe6b4d(0x132))/0x4*(parseInt(_0xe6b4d(0x16b))/0x5)+parseInt(_0xe6b4d(0x142))/0x6+parseInt(_0xe6b4d(0x161))/0x7*(-parseInt(_0xe6b4d(0x148))/0x8)+-parseInt(_0xe6b4d(0x133))/0x9;if(_0x516652===_0x326ccb)break;else _0x598f8d['push'](_0x598f8d['shift']());}catch(_0x3a7f5b){_0x598f8d['push'](_0x598f8d['shift']());}}}(a177_0xc7fe,0x67fd2));import{readFileSync,existsSync}from'node:fs';function a177_0xc7fe(){const _0x5859c3=['1764183TyPUle','Table\x20\x22','string','Path\x20to\x20the\x20SQL\x20file\x20to\x20validate','Validate\x20SQL\x20content\x20without\x20saving\x20(type\x20detection,\x20parameter\x20extraction,\x20optional\x20schema\x20check)','unshift','cwd','tables','split','name','File\x20not\x20found:\x20','dbtableConfig','type','35XYNQLx','size','utf-8','sql','read','length','Dataset\x20\x22','index_name','reason','isArray','193405dEqnuQ','validate','primary','SQL\x20schema\x20validation','tableName','valid','fields','Inline\x20SQL\x20content\x20to\x20validate\x20(alternative\x20to\x20--file)','index_columns','indexName','isSelectOnly','16gFzHvr','13100013pYPwer','file','isDangerous','filter','map','pkField','flagMissing','\x22\x20not\x20found\x20in\x20any\x20dataset','str','push','Audit\x20top-level\x20JOIN\x20equality\x20predicates\x20against\x20dataset\x20index\x20metadata','trim','toLowerCase','1257148ShRVLD','\x22\x20not\x20found\x20or\x20not\x20accessible','3904296JQKWHc','validation','78410WiRCcB','Comma-separated\x20dataset\x20codes\x20to\x20cross-check\x20table/column\x20names\x20against','schemaWarnings','joinAudit','350384AnmjnY','columnNames','sqlType','message','--check-indexes\x20requires\x20--schemas.','columns','find','schema:','indexes','dataset','appCode','bool'];a177_0xc7fe=function(){return _0x5859c3;};return a177_0xc7fe();}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':'sql','command':a177_0x5ba0a6(0x16c),'description':a177_0x5ba0a6(0x158),'risk':a177_0x5ba0a6(0x165),'flags':[{'name':a177_0x5ba0a6(0x134),'type':'string','description':a177_0x5ba0a6(0x157)},{'name':a177_0x5ba0a6(0x164),'type':a177_0x5ba0a6(0x156),'description':a177_0x5ba0a6(0x12e)},{'name':'schemas','type':a177_0x5ba0a6(0x156),'description':a177_0x5ba0a6(0x145)},{'name':'check-indexes','type':'boolean','description':a177_0x5ba0a6(0x13d)}],async 'execute'(_0x2ef567){const _0x271630=a177_0x5ba0a6,_0x235eef=_0x2ef567[_0x271630(0x13b)]('file'),_0x39a8a0=_0x2ef567['str'](_0x271630(0x164)),_0x23c65f=_0x2ef567[_0x271630(0x13b)]('schemas'),_0x4d0a26=_0x2ef567[_0x271630(0x153)]('check-indexes');if(!_0x235eef&&!_0x39a8a0)throw CliErrors[_0x271630(0x139)]('file','Provide\x20--file\x20or\x20--sql');if(_0x4d0a26&&!_0x23c65f)throw CliErrors[_0x271630(0x143)](_0x271630(0x14c));let _0x225469;if(_0x235eef){const _0x22db05=resolve(process[_0x271630(0x15a)](),_0x235eef);if(!existsSync(_0x22db05))throw CliErrors[_0x271630(0x143)](_0x271630(0x15e)+_0x22db05);_0x225469=readFileSync(_0x22db05,_0x271630(0x163));}else _0x225469=_0x39a8a0;const _0x1f4f87=validateSql(_0x225469),_0x4825a4={'valid':_0x1f4f87[_0x271630(0x170)],'sqlType':_0x1f4f87[_0x271630(0x14a)][_0x271630(0x160)],'isSelectOnly':_0x1f4f87[_0x271630(0x14a)][_0x271630(0x131)],'isDangerous':_0x1f4f87[_0x271630(0x14a)][_0x271630(0x135)],'tables':_0x1f4f87[_0x271630(0x15b)],'parameters':_0x1f4f87['parameters'],'message':_0x1f4f87[_0x271630(0x14b)]};_0x1f4f87['sqlType']['reason']&&(_0x4825a4[_0x271630(0x169)]=_0x1f4f87[_0x271630(0x14a)][_0x271630(0x169)]);if(_0x23c65f&&_0x1f4f87[_0x271630(0x170)]){const _0x30bd02=_0x23c65f[_0x271630(0x15c)](',')[_0x271630(0x137)](_0x30830f=>_0x30830f['trim']())['filter'](Boolean),_0x2bfa36=[],_0x407120=[],_0x3b3f56=filterDbTableBackedDatasets(await listDatasets(_0x2ef567[_0x271630(0x152)])),_0x258477=new Map(_0x3b3f56['map'](_0x55ad43=>[_0x55ad43[_0x271630(0x15f)]?.[_0x271630(0x16f)]?.[_0x271630(0x13f)](),_0x55ad43]));for(const _0x246594 of _0x1f4f87[_0x271630(0x15b)]){const _0x47a230=_0x258477['get'](_0x246594['toLowerCase']());!_0x47a230&&_0x2bfa36[_0x271630(0x13c)](_0x271630(0x155)+_0x246594+_0x271630(0x13a));}for(const _0x27c46a of _0x30bd02){let _0x77201d;try{_0x77201d=await getDatasetDetail(_0x27c46a);}catch{_0x2bfa36['push'](_0x271630(0x167)+_0x27c46a+_0x271630(0x141));continue;}assertDatasetIsDbTableBacked(_0x77201d,_0x271630(0x16e));const _0x487d54=Array[_0x271630(0x16a)](_0x77201d[_0x271630(0x12d)])?_0x77201d['fields']:[],_0x2cecbb=new Set(_0x487d54[_0x271630(0x137)](_0x50f5c7=>_0x50f5c7['name']?.[_0x271630(0x13f)]())),_0x2b6f83=_0x77201d['dbtableConfig']?.['tableName']||_0x77201d[_0x271630(0x16f)]||_0x27c46a;_0x4825a4[_0x271630(0x14f)+_0x2b6f83]={'code':_0x27c46a,'tableName':_0x2b6f83,'fieldCount':_0x2cecbb[_0x271630(0x162)],'fields':Array['from'](_0x2cecbb)};if(_0x4d0a26){const _0xd0fdc6=normalizeDatasetIndexes(_0x77201d);_0x407120[_0x271630(0x13c)]({'tableName':_0x2b6f83,..._0xd0fdc6});}}_0x2bfa36[_0x271630(0x166)]>0x0&&(_0x4825a4[_0x271630(0x146)]=_0x2bfa36),_0x4d0a26&&(_0x4825a4[_0x271630(0x147)]=auditSqlJoinIndexes(_0x225469,_0x407120));}return{'ok':_0x1f4f87[_0x271630(0x170)],'data':_0x4825a4,'message':_0x1f4f87[_0x271630(0x14b)]};}};function normalizeDatasetIndexes(_0x311dbf){const _0x3432a7=a177_0x5ba0a6,_0x2b7a18=Array[_0x3432a7(0x16a)](_0x311dbf?.['dataset']?.[_0x3432a7(0x150)])?_0x311dbf[_0x3432a7(0x151)][_0x3432a7(0x150)]:Array['isArray'](_0x311dbf?.[_0x3432a7(0x150)])?_0x311dbf['indexes']:[],_0x46a843=_0x2b7a18['flatMap'](_0xb2c781=>{const _0x4dd727=_0x3432a7,_0x5a07b0=Array[_0x4dd727(0x16a)](_0xb2c781?.[_0x4dd727(0x12f)])?_0xb2c781[_0x4dd727(0x12f)]:Array['isArray'](_0xb2c781?.[_0x4dd727(0x149)])?_0xb2c781[_0x4dd727(0x149)]:Array[_0x4dd727(0x16a)](_0xb2c781?.[_0x4dd727(0x14d)])?_0xb2c781[_0x4dd727(0x14d)]:[],_0x1ad05b=_0x5a07b0[_0x4dd727(0x136)](_0x56d6ca=>typeof _0x56d6ca===_0x4dd727(0x156))[_0x4dd727(0x137)](_0x348d3a=>_0x348d3a[_0x4dd727(0x13e)]())[_0x4dd727(0x136)](Boolean);if(_0x1ad05b[_0x4dd727(0x166)]===0x0)return[];const _0x20c985=[_0xb2c781?.[_0x4dd727(0x130)],_0xb2c781?.[_0x4dd727(0x168)],_0xb2c781?.[_0x4dd727(0x15d)]][_0x4dd727(0x14e)](_0x55e7ee=>typeof _0x55e7ee==='string'&&_0x55e7ee[_0x4dd727(0x13e)]()),_0x3bfa04=[_0xb2c781?.['index_type'],_0xb2c781?.[_0x4dd727(0x160)]][_0x4dd727(0x14e)](_0x64c876=>typeof _0x64c876===_0x4dd727(0x156)&&_0x64c876[_0x4dd727(0x13e)]());return[{..._0x20c985?{'name':_0x20c985[_0x4dd727(0x13e)]()}:{},..._0x3bfa04?{'type':_0x3bfa04['trim']()}:{},'columns':_0x1ad05b}];}),_0x4be95b=[..._0x46a843],_0x35cd30=typeof _0x311dbf?.[_0x3432a7(0x15f)]?.[_0x3432a7(0x138)]===_0x3432a7(0x156)?_0x311dbf[_0x3432a7(0x15f)][_0x3432a7(0x138)][_0x3432a7(0x15c)](',')['map'](_0x2bc520=>_0x2bc520['trim']())[_0x3432a7(0x136)](Boolean):[];return _0x35cd30[_0x3432a7(0x166)]>0x0&&_0x4be95b[_0x3432a7(0x159)]({'type':_0x3432a7(0x16d),'columns':_0x35cd30}),{'indexes':_0x4be95b,'metadataAvailable':_0x46a843[_0x3432a7(0x166)]>0x0};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x3e4e70,_0xfc9252){const _0x9e7fe=a178_0x3db5,_0x45a4fc=_0x3e4e70();while(!![]){try{const _0x2f0457=parseInt(_0x9e7fe(0x8a))/0x1+parseInt(_0x9e7fe(0x8c))/0x2*(parseInt(_0x9e7fe(0x89))/0x3)+-parseInt(_0x9e7fe(0x88))/0x4*(parseInt(_0x9e7fe(0x94))/0x5)+parseInt(_0x9e7fe(0x8b))/0x6*(-parseInt(_0x9e7fe(0x90))/0x7)+-parseInt(_0x9e7fe(0x91))/0x8*(parseInt(_0x9e7fe(0x93))/0x9)+-parseInt(_0x9e7fe(0x92))/0xa*(parseInt(_0x9e7fe(0x8d))/0xb)+parseInt(_0x9e7fe(0x8f))/0xc*(parseInt(_0x9e7fe(0x8e))/0xd);if(_0x2f0457===_0xfc9252)break;else _0x45a4fc['push'](_0x45a4fc['shift']());}catch(_0x48db33){_0x45a4fc['push'](_0x45a4fc['shift']());}}}(a178_0x11c5,0xca657));function a178_0x3db5(_0x29c06d,_0x1c02f2){_0x29c06d=_0x29c06d-0x88;const _0x11c5e9=a178_0x11c5();let _0x3db5fe=_0x11c5e9[_0x29c06d];return _0x3db5fe;}function a178_0x11c5(){const _0x4f281b=['16gTIapn','6178670RuqJxa','5472783PtpcrP','80zMAqeC','164596zOINYO','10311SrORpY','312805KcRrRO','6WGoULh','470SFVFIT','11sXKIhy','468LsEhnM','960060umGsdr','4754680kfjZkH'];a178_0x11c5=function(){return _0x4f281b;};return a178_0x11c5();}import{taskStatus}from'../../commands/task/status.js';export const taskDefinitions=[taskStatus];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a179_0x3f1ecd=a179_0x496b;(function(_0x46805f,_0x11cbf1){const _0x563b79=a179_0x496b,_0x474e6b=_0x46805f();while(!![]){try{const _0x11c0ec=-parseInt(_0x563b79(0x1f5))/0x1+parseInt(_0x563b79(0x1f8))/0x2*(parseInt(_0x563b79(0x204))/0x3)+parseInt(_0x563b79(0x1fd))/0x4+-parseInt(_0x563b79(0x202))/0x5+-parseInt(_0x563b79(0x209))/0x6*(parseInt(_0x563b79(0x1fa))/0x7)+-parseInt(_0x563b79(0x207))/0x8+parseInt(_0x563b79(0x1f6))/0x9;if(_0x11c0ec===_0x11cbf1)break;else _0x474e6b['push'](_0x474e6b['shift']());}catch(_0x4d50a4){_0x474e6b['push'](_0x474e6b['shift']());}}}(a179_0x364e,0x48709));function a179_0x496b(_0x3640cb,_0x2c4bb9){_0x3640cb=_0x3640cb-0x1f1;const _0x364e3f=a179_0x364e();let _0x496bd5=_0x364e3f[_0x3640cb];return _0x496bd5;}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';function a179_0x364e(){const _0x3cf77b=['2877228daTJTw','task','346lilJaH',',\x20received\x20','77SZNljy','Task\x20id\x20returned\x20by\x20an\x20asynchronous\x20platform\x20command','apiError','999612DhEbOx','trim','string','cookie','read','1035130uXKqPn','isTerminal','8868VyVSnq','Query\x20an\x20asynchronous\x20task;\x20repeat\x20for\x20PENDING\x20or\x20PROCESSING\x20until\x20SUCCESS\x20or\x20FAILED','flagMissing','2622088HOhPvW','appCode','7206YJjJmg','taskId','status','str','task-id','236272mdbQVN'];a179_0x364e=function(){return _0x3cf77b;};return a179_0x364e();}export const taskStatus={'service':a179_0x3f1ecd(0x1f7),'command':a179_0x3f1ecd(0x1f2),'description':a179_0x3f1ecd(0x205),'risk':a179_0x3f1ecd(0x201),'defaultOutputFormat':'compress','structuredErrors':!![],'flags':[{'name':a179_0x3f1ecd(0x1f4),'type':a179_0x3f1ecd(0x1ff),'required':!![],'description':a179_0x3f1ecd(0x1fb)},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x32af57){const _0x486742=a179_0x3f1ecd;if(!_0x32af57[_0x486742(0x1f3)](_0x486742(0x1f4))[_0x486742(0x1fe)]())throw CliErrors[_0x486742(0x206)](_0x486742(0x1f4));},async 'execute'(_0x2b8fb6){const _0x271049=a179_0x3f1ecd,_0x3b4dd1=_0x2b8fb6[_0x271049(0x1f3)](_0x271049(0x1f4))[_0x271049(0x1fe)](),_0x5f4267=normalizeAsyncTask(await getAsyncTaskStatus(_0x3b4dd1,_0x2b8fb6[_0x271049(0x208)],_0x2b8fb6[_0x271049(0x200)]));if(_0x5f4267['taskId']!==_0x3b4dd1)throw CliErrors[_0x271049(0x1fc)]('Task\x20status\x20response\x20id\x20mismatch:\x20requested\x20'+_0x3b4dd1+_0x271049(0x1f9)+_0x5f4267[_0x271049(0x1f1)]+'.');const _0x2a4fd6=buildAsyncTaskStatusCommand(_0x5f4267[_0x271049(0x1f1)],_0x2b8fb6[_0x271049(0x208)]);return{'ok':!![],'message':asyncTaskMessage(_0x5f4267),'data':{'appCode':_0x2b8fb6[_0x271049(0x208)],..._0x5f4267,'query':_0x5f4267[_0x271049(0x203)]?null:{'command':_0x2a4fd6}}};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a180_0xe48f08=a180_0x3c04;(function(_0x196eb3,_0xef70a3){const _0x516d10=a180_0x3c04,_0x513cfa=_0x196eb3();while(!![]){try{const _0x535462=-parseInt(_0x516d10(0x94))/0x1+parseInt(_0x516d10(0x8e))/0x2+parseInt(_0x516d10(0x8f))/0x3+-parseInt(_0x516d10(0x91))/0x4*(parseInt(_0x516d10(0x96))/0x5)+parseInt(_0x516d10(0x93))/0x6+parseInt(_0x516d10(0x92))/0x7+-parseInt(_0x516d10(0x95))/0x8;if(_0x535462===_0xef70a3)break;else _0x513cfa['push'](_0x513cfa['shift']());}catch(_0x5a4bc6){_0x513cfa['push'](_0x513cfa['shift']());}}}(a180_0x1da1,0x704c0));function a180_0x3c04(_0x33a4b4,_0x2daec7){_0x33a4b4=_0x33a4b4-0x8a;const _0x1da15e=a180_0x1da1();let _0x3c0422=_0x1da15e[_0x33a4b4];return _0x3c0422;}import{buildAppAddFlags,runAppAdd,validateAppName}from'../../commands/common/app-registry.js';function a180_0x1da1(){const _0xcaf71d=['write','workspace\x20add','add','1127170ayCyLG','2108901WyvTCm','App\x20profile\x20name','289924ZXrrAK','4768456YKIVnr','2576634LADrIg','858979wYQFRS','7306320LmpDWi','10wjfOVV','Register\x20an\x20app\x20profile\x20in\x20the\x20current\x20workspace\x20(or\x20--global)'];a180_0x1da1=function(){return _0xcaf71d;};return a180_0x1da1();}export const workspaceAddDefinition={'service':'workspace','command':a180_0xe48f08(0x8d),'description':a180_0xe48f08(0x8a),'risk':a180_0xe48f08(0x8b),'requiresAuth':![],'requiresAppCode':![],'args':[{'name':'name','description':a180_0xe48f08(0x90),'required':!![]}],'flags':buildAppAddFlags(),'validate':_0x4d6184=>validateAppName(_0x4d6184,'workspace\x20add'),'execute':_0xc5918d=>runAppAdd(_0xc5918d,a180_0xe48f08(0x8c))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a181_0x5c4d(){const _0x22cc1a=['64YmIWYO','Risk\x20level\x20for\x20this\x20workspace\x20app\x20profile','str','19582qjmuMR','app','App\x20profile\x20name\x20to\x20use\x20in\x20this\x20workspace','295827YxCrBX','apiDir','\x20workspace\x20use\x20--app\x20<name>`.','trim','\x22\x20not\x20found.','use','join','16kbecXb','Missing\x20workspace\x20app\x20selector.','5Yxfhva','.\x20Credentials:\x20not\x20written.','project','format','App\x20\x22','number','17141399reYyco','Target\x20environment','validation','Use\x20`','1046715yWiKIG','workspace','string','appcode','Switch\x20the\x20current\x20workspace\x20app\x20binding','Invalid\x20appcode:\x20','Workspace\x20','pageSize','locale','App\x20code\x20to\x20bind\x20to\x20this\x20workspace','keys','Initialize\x20the\x20current\x20workspace\x20app\x20binding','\x20workspace\x20<init|use>\x20--app\x20<name>\x20[--appcode\x20<code>]','workspace.','object','write','defaultApp','env','init','\x20(appcode:\x20','3862470ppfyby','1130630GeXQsX','apps','81JpgJFE','riskLevel','442107kEhlTQ','\x20workspace\x20init\x20--appcode\x20<code>`\x20or\x20`','\x20--appcode\x20<code>`.','isArray','API\x20directory\x20path\x20for\x20this\x20workspace\x20app\x20profile','flag','globalConfig','\x20workspace\x20','Default\x20page\x20size\x20for\x20this\x20workspace\x20app\x20profile'];a181_0x5c4d=function(){return _0x22cc1a;};return a181_0x5c4d();}const a181_0x36751e=a181_0x7a0f;(function(_0x28aa23,_0x30f6b7){const _0x5185ac=a181_0x7a0f,_0x5c0feb=_0x28aa23();while(!![]){try{const _0x3344b7=parseInt(_0x5185ac(0x114))/0x1*(parseInt(_0x5185ac(0xe7))/0x2)+parseInt(_0x5185ac(0xfd))/0x3*(-parseInt(_0x5185ac(0xf1))/0x4)+parseInt(_0x5185ac(0xf3))/0x5*(-parseInt(_0x5185ac(0x111))/0x6)+parseInt(_0x5185ac(0xea))/0x7*(parseInt(_0x5185ac(0x11f))/0x8)+-parseInt(_0x5185ac(0x116))/0x9+parseInt(_0x5185ac(0x112))/0xa+parseInt(_0x5185ac(0xf9))/0xb;if(_0x3344b7===_0x30f6b7)break;else _0x5c0feb['push'](_0x5c0feb['shift']());}catch(_0x2486af){_0x5c0feb['push'](_0x5c0feb['shift']());}}}(a181_0x5c4d,0xae53b));function a181_0x7a0f(_0x38d276,_0x2f2db7){_0x38d276=_0x38d276-0xe6;const _0x5c4d48=a181_0x5c4d();let _0x7a0f5b=_0x5c4d48[_0x38d276];return _0x7a0f5b;}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';const WORKSPACE_USAGE=CLI_BIN_NAME+a181_0x36751e(0x109),SAFE_PROFILE_KEYS=[a181_0x36751e(0x100),a181_0x36751e(0x10e),a181_0x36751e(0xeb),a181_0x36751e(0xf6),'pageSize',a181_0x36751e(0x115),a181_0x36751e(0x105)],workspaceFlags=[{'name':a181_0x36751e(0xe8),'type':'string','description':a181_0x36751e(0xe9)},{'name':a181_0x36751e(0x100),'type':a181_0x36751e(0xff),'description':a181_0x36751e(0x106)},{'name':a181_0x36751e(0x10e),'type':'string','description':a181_0x36751e(0xfa),'enum':[...RABETBASE_ENV_VALUES]},{'name':a181_0x36751e(0xeb),'type':'string','description':a181_0x36751e(0x11a)},{'name':'defaultFormat','type':a181_0x36751e(0xff),'description':'Default\x20output\x20format\x20for\x20this\x20workspace\x20app\x20profile','enum':[...RABETBASE_OUTPUT_FORMAT_VALUES]},{'name':a181_0x36751e(0x104),'type':a181_0x36751e(0xf8),'description':a181_0x36751e(0x11e)},{'name':a181_0x36751e(0x115),'type':a181_0x36751e(0xff),'description':a181_0x36751e(0x120),'enum':[...RISK_LEVEL_VALUES]},{'name':a181_0x36751e(0x105),'type':a181_0x36751e(0xff),'description':'Locale\x20for\x20this\x20workspace\x20app\x20profile'}];function isRecord(_0x56a87e){const _0x16c4d7=a181_0x36751e;return!!_0x56a87e&&typeof _0x56a87e===_0x16c4d7(0x10b)&&!Array[_0x16c4d7(0x119)](_0x56a87e);}function assertValidAppcode(_0x5c3418){const _0x3334f9=a181_0x36751e,{valid:_0x8c9633,message:_0x25bb2e}=validateAppcode(_0x5c3418);if(!_0x8c9633)throw CliErrors[_0x3334f9(0xfb)](_0x3334f9(0x102)+_0x5c3418,_0x25bb2e);}function sanitizeProfile(_0x26dfaf){if(!isRecord(_0x26dfaf))return{};const _0x4efcf9={};for(const _0x54ecce of SAFE_PROFILE_KEYS){if(_0x26dfaf[_0x54ecce]!==undefined)_0x4efcf9[_0x54ecce]=_0x26dfaf[_0x54ecce];}return _0x4efcf9;}function cloneProfile(_0x11a57c){return isRecord(_0x11a57c)?{..._0x11a57c}:{};}function collectWorkspaceProfileOverrides(_0x59b1fb){const _0x2bd4aa=a181_0x36751e,_0x247a2e={},_0x3463c7=_0x59b1fb['str'](_0x2bd4aa(0x10e)),_0x50aeff=_0x59b1fb[_0x2bd4aa(0xe6)](_0x2bd4aa(0xeb)),_0x40719f=_0x59b1fb[_0x2bd4aa(0xe6)]('defaultFormat'),_0x28267f=_0x59b1fb[_0x2bd4aa(0x11b)](_0x2bd4aa(0x104)),_0x13446f=_0x59b1fb['str'](_0x2bd4aa(0x115)),_0x59cbf1=_0x59b1fb[_0x2bd4aa(0xe6)](_0x2bd4aa(0x105));if(_0x3463c7)_0x247a2e[_0x2bd4aa(0x10e)]=_0x3463c7;if(_0x50aeff)_0x247a2e[_0x2bd4aa(0xeb)]=_0x50aeff;if(_0x40719f)_0x247a2e['format']=_0x40719f;if(_0x28267f!==undefined&&_0x28267f!=='')_0x247a2e[_0x2bd4aa(0x104)]=Number(_0x28267f);if(_0x13446f)_0x247a2e[_0x2bd4aa(0x115)]=_0x13446f;if(_0x59cbf1)_0x247a2e[_0x2bd4aa(0x105)]=_0x59cbf1;return _0x247a2e;}async function validateWorkspaceArgs(_0x2a5057){const _0x326c0d=a181_0x36751e,_0x5c78b=_0x2a5057[_0x326c0d(0xe6)](_0x326c0d(0xe8))['trim'](),_0x3279f6=_0x2a5057[_0x326c0d(0xe6)](_0x326c0d(0x100))['trim']();if(!_0x5c78b&&!_0x3279f6)throw CliErrors['validation']('Missing\x20workspace\x20app\x20selector.',_0x326c0d(0xfc)+CLI_BIN_NAME+_0x326c0d(0x117)+CLI_BIN_NAME+_0x326c0d(0xec));if(_0x3279f6)assertValidAppcode(_0x3279f6);}function resolveKnownApps(){const _0x1fb8e0=a181_0x36751e,{config:_0x5c89f1,layers:_0x13a514}=readRawConfigWithLayers(),_0x157306=isRecord(_0x5c89f1['apps'])?_0x5c89f1[_0x1fb8e0(0x113)]:{},_0x2c072d=isRecord(_0x13a514[_0x1fb8e0(0x11c)][_0x1fb8e0(0x113)])?_0x13a514[_0x1fb8e0(0x11c)][_0x1fb8e0(0x113)]:{};return{..._0x2c072d,..._0x157306};}async function configureWorkspace(_0x52ecd3,_0x520cc7){const _0x5b170e=a181_0x36751e,_0x211840=_0x52ecd3['str'](_0x5b170e(0xe8))[_0x5b170e(0xed)](),_0x209f4c=_0x52ecd3[_0x5b170e(0xe6)](_0x5b170e(0x100))[_0x5b170e(0xed)](),_0x57929e=_0x211840||_0x209f4c;if(!_0x57929e)throw CliErrors['validation'](_0x5b170e(0xf2),_0x5b170e(0xfc)+CLI_BIN_NAME+_0x5b170e(0x117)+CLI_BIN_NAME+_0x5b170e(0xec));if(_0x209f4c)assertValidAppcode(_0x209f4c);const _0xbc4185=resolveWriteConfigPath(_0x5b170e(0xf5)),_0x397211=readConfigFile(_0xbc4185),_0x1db72a=resolveKnownApps(),_0x22766e=isRecord(_0x397211[_0x5b170e(0x113)])?{..._0x397211[_0x5b170e(0x113)]}:{},_0x221740=cloneProfile(_0x22766e[_0x57929e]),_0x25fa4a=sanitizeProfile(_0x1db72a[_0x57929e]),_0xcbc499=_0x209f4c?{}:_0x25fa4a,_0x2af131=_0x209f4c||_0xcbc499['appcode'];if(!_0x2af131){const _0x4337a4=Object[_0x5b170e(0x107)](_0x1db72a),_0x585af1=_0x4337a4['length']===0x0?_0x5b170e(0xfc)+CLI_BIN_NAME+_0x5b170e(0x11d)+_0x520cc7+'\x20--app\x20'+_0x57929e+_0x5b170e(0x118):'Pass\x20--appcode\x20<code>,\x20or\x20choose\x20one\x20of:\x20'+_0x4337a4[_0x5b170e(0xf0)](',\x20');throw CliErrors[_0x5b170e(0xfb)](_0x5b170e(0xf7)+_0x57929e+_0x5b170e(0xee),_0x585af1);}assertValidAppcode(String(_0x2af131));const _0x226347={..._0xcbc499,..._0x221740,'appcode':String(_0x2af131),...collectWorkspaceProfileOverrides(_0x52ecd3)};return _0x22766e[_0x57929e]=_0x226347,_0x397211[_0x5b170e(0x113)]=_0x22766e,_0x397211[_0x5b170e(0x10d)]=_0x57929e,delete _0x397211[_0x5b170e(0x100)],delete _0x397211[_0x5b170e(0xe8)],_0x226347[_0x5b170e(0x10e)]&&(_0x397211[_0x5b170e(0x10e)]=_0x226347[_0x5b170e(0x10e)]),writeConfigFile(_0xbc4185,_0x397211),{'ok':!![],'message':_0x5b170e(0x103)+(_0x520cc7==='init'?'initialized':'updated')+':\x20'+_0x57929e+_0x5b170e(0x110)+_0x226347[_0x5b170e(0x100)]+').\x20Config:\x20'+_0xbc4185+_0x5b170e(0xf4),'data':{'operation':_0x5b170e(0x10a)+_0x520cc7,'configPath':_0xbc4185,'app':_0x57929e,'appcode':_0x226347[_0x5b170e(0x100)],'env':_0x226347[_0x5b170e(0x10e)]??null,'credentialsWritten':![]}};}const workspaceInitDefinition={'service':'workspace','command':a181_0x36751e(0x10f),'description':a181_0x36751e(0x108),'risk':a181_0x36751e(0x10c),'requiresAuth':![],'requiresAppCode':![],'args':[],'flags':workspaceFlags,'validate':validateWorkspaceArgs,'execute':_0x555005=>configureWorkspace(_0x555005,a181_0x36751e(0x10f))},workspaceUseDefinition={'service':a181_0x36751e(0xfe),'command':a181_0x36751e(0xef),'description':a181_0x36751e(0x101),'risk':'write','requiresAuth':![],'requiresAppCode':![],'args':[],'flags':workspaceFlags,'validate':validateWorkspaceArgs,'execute':_0x8a20d8=>configureWorkspace(_0x8a20d8,a181_0x36751e(0xef))};export const workspaceDefinitions=[workspaceInitDefinition,workspaceUseDefinition,workspaceAddDefinition,workspaceRemoveDefinition];export{WORKSPACE_USAGE};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a182_0x5df3(){const _0x53d6f9=['Remove\x20an\x20app\x20profile\x20from\x20the\x20current\x20workspace\x20(or\x20--global)','workspace','3773862vcMWFT','4390992VeTjcZ','16PPFlFF','1201930epySbV','492264eGtXKr','34982PkiBRZ','2087085HNhKKI','431324YqxESy','high-risk-write','name','3AWnWQu','remove'];a182_0x5df3=function(){return _0x53d6f9;};return a182_0x5df3();}function a182_0x1f4d(_0x35890c,_0x439258){_0x35890c=_0x35890c-0xf8;const _0x5df3ca=a182_0x5df3();let _0x1f4d6e=_0x5df3ca[_0x35890c];return _0x1f4d6e;}const a182_0x3cc9e2=a182_0x1f4d;(function(_0x4e7d5b,_0x449c60){const _0x47721e=a182_0x1f4d,_0x12d79d=_0x4e7d5b();while(!![]){try{const _0x1dac1d=parseInt(_0x47721e(0xfc))/0x1+-parseInt(_0x47721e(0xfd))/0x2*(-parseInt(_0x47721e(0x102))/0x3)+parseInt(_0x47721e(0xff))/0x4+-parseInt(_0x47721e(0xfb))/0x5+parseInt(_0x47721e(0xf8))/0x6+parseInt(_0x47721e(0xfe))/0x7+-parseInt(_0x47721e(0xfa))/0x8*(parseInt(_0x47721e(0xf9))/0x9);if(_0x1dac1d===_0x449c60)break;else _0x12d79d['push'](_0x12d79d['shift']());}catch(_0xff35cf){_0x12d79d['push'](_0x12d79d['shift']());}}}(a182_0x5df3,0x5036c));import{buildAppRemoveFlags,runAppRemove,validateAppName}from'../../commands/common/app-registry.js';export const workspaceRemoveDefinition={'service':a182_0x3cc9e2(0x105),'command':a182_0x3cc9e2(0x103),'description':a182_0x3cc9e2(0x104),'risk':a182_0x3cc9e2(0x100),'requiresAuth':![],'requiresAppCode':![],'args':[{'name':a182_0x3cc9e2(0x101),'description':'App\x20profile\x20name\x20to\x20remove','required':!![]}],'flags':buildAppRemoveFlags(),'validate':_0x25beb9=>validateAppName(_0x25beb9,'workspace\x20remove'),'execute':_0x21aebd=>runAppRemove(_0x21aebd,'workspace\x20remove')};
|
package/lib/config/schema.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a183_0x1cbbb2=a183_0x1bb3;(function(_0x19f015,_0x4c9f2c){const _0x47049e=a183_0x1bb3,_0x470a98=_0x19f015();while(!![]){try{const _0x1c61c4=parseInt(_0x47049e(0x1f0))/0x1+parseInt(_0x47049e(0x1fc))/0x2*(-parseInt(_0x47049e(0x209))/0x3)+-parseInt(_0x47049e(0x1fb))/0x4+-parseInt(_0x47049e(0x207))/0x5+-parseInt(_0x47049e(0x204))/0x6+-parseInt(_0x47049e(0x213))/0x7*(-parseInt(_0x47049e(0x210))/0x8)+parseInt(_0x47049e(0x20a))/0x9*(parseInt(_0x47049e(0x1f9))/0xa);if(_0x1c61c4===_0x4c9f2c)break;else _0x470a98['push'](_0x470a98['shift']());}catch(_0x2a5efd){_0x470a98['push'](_0x470a98['shift']());}}}(a183_0x7eba,0xb4693));import{DEFAULT_CONFIG_VALUES}from'../constant/defaults.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';export{DEFAULT_CONFIG_VALUES}from'../constant/defaults.js';export const PROJECT_CREATE_INHERITABLE_KEYS=['cookie',a183_0x1cbbb2(0x214),a183_0x1cbbb2(0x1f8),a183_0x1cbbb2(0x1f3),a183_0x1cbbb2(0x201)];function a183_0x7eba(){const _0x1a7702=['5360892OkjPIF','148102WDGjAr','app','defaultFormat','trim','filter','riskLevel','appcode','pageSize','1737168dxdlbT','Config\x20key\x20(','entries','2981065ioWZQz','defaultApp','15yyCilN','10633203azPSGQ','number','zh-CN','cookie','Target\x20environment','env','152ONyCwp','apiDir','length','283024hzfcrs','accessKey','toLowerCase','Risk\x20level','apps','Locale','1385507jBfyOA','string','Auth\x20cookie','format','map','inherit','Access\x20key','has','locale','10kUozWe','en-US'];a183_0x7eba=function(){return _0x1a7702;};return a183_0x7eba();}export const TOP_LEVEL_CONFIG_KEYS=new Set([a183_0x1cbbb2(0x202),a183_0x1cbbb2(0x20f),a183_0x1cbbb2(0x1f8),a183_0x1cbbb2(0x1f3),a183_0x1cbbb2(0x20d),'accessKey',a183_0x1cbbb2(0x211)]);export const CONFIG_ENUM_VALUES={'env':[...RABETBASE_ENV_VALUES],'format':[...RABETBASE_OUTPUT_FORMAT_VALUES]};export function formatConfigKeyList(_0x287d1c){return[..._0x287d1c]['join'](',\x20');}export function getTopLevelConfigKeyList(){return[...TOP_LEVEL_CONFIG_KEYS];}export function isTopLevelConfigKey(_0x3bd955){const _0x557696=a183_0x1cbbb2;return TOP_LEVEL_CONFIG_KEYS[_0x557696(0x1f7)](_0x3bd955);}export function getTopLevelConfigKeySummary(){return formatConfigKeyList(getTopLevelConfigKeyList());}export function getConfigCommandKeyDescription(){const _0x23b0a6=a183_0x1cbbb2;return _0x23b0a6(0x205)+getTopLevelConfigKeySummary()+')';}export const APP_PROFILE_FLAG_KEY_MAP={'env':a183_0x1cbbb2(0x20f),'apiDir':a183_0x1cbbb2(0x211),'cookie':a183_0x1cbbb2(0x20d),'accessKey':a183_0x1cbbb2(0x214),'defaultFormat':a183_0x1cbbb2(0x1f3),'pageSize':a183_0x1cbbb2(0x203),'riskLevel':a183_0x1cbbb2(0x201),'locale':'locale'};export function getAppProfileFlagDefs(){const _0x18f492=a183_0x1cbbb2;return[{'name':_0x18f492(0x20f),'type':_0x18f492(0x1f1),'description':_0x18f492(0x20e),'enum':[...RABETBASE_ENV_VALUES]},{'name':_0x18f492(0x211),'type':'string','description':'API\x20directory\x20path'},{'name':_0x18f492(0x20d),'type':_0x18f492(0x1f1),'description':_0x18f492(0x1f2),'hidden':!![]},{'name':_0x18f492(0x214),'type':_0x18f492(0x1f1),'description':_0x18f492(0x1f6),'hidden':!![]},{'name':_0x18f492(0x1fe),'type':_0x18f492(0x1f1),'description':'Default\x20output\x20format\x20for\x20this\x20app\x20(profile)','enum':[...RABETBASE_OUTPUT_FORMAT_VALUES]},{'name':_0x18f492(0x203),'type':_0x18f492(0x20b),'description':'Default\x20page\x20size'},{'name':_0x18f492(0x201),'type':_0x18f492(0x1f1),'description':_0x18f492(0x216),'enum':[...RISK_LEVEL_VALUES]},{'name':_0x18f492(0x1f8),'type':'string','description':_0x18f492(0x218)}];}export function collectAppProfileOverrides(_0x48ce21){const _0x192992=a183_0x1cbbb2,_0x570852={};for(const [_0x448177,_0x1b52d5]of Object[_0x192992(0x206)](APP_PROFILE_FLAG_KEY_MAP)){const _0x71b332=_0x48ce21(_0x448177);if(!_0x71b332)continue;_0x570852[_0x1b52d5]=_0x1b52d5===_0x192992(0x203)?Number(_0x71b332):_0x71b332;}return _0x570852;}export function buildAppProfileListFields(_0x14b72e){const _0x5f2e3a=a183_0x1cbbb2;return{'env':_0x14b72e['env']??null,'apiDir':_0x14b72e['apiDir']??null,'hasCookie':!!_0x14b72e[_0x5f2e3a(0x20d)],'hasAccessKey':!!_0x14b72e[_0x5f2e3a(0x214)],'format':_0x14b72e[_0x5f2e3a(0x1f3)]??null,'pageSize':_0x14b72e[_0x5f2e3a(0x203)]??null,'riskLevel':_0x14b72e[_0x5f2e3a(0x201)]??null,'locale':_0x14b72e['locale']??null};}export function buildAppDoctorFields(_0x24ad27,_0x2c0a01){const _0x4d2317=a183_0x1cbbb2;return{'env':{'value':_0x24ad27['env']||_0x2c0a01[_0x4d2317(0x20f)],'source':_0x24ad27['env']?_0x4d2317(0x1fd):_0x4d2317(0x1f5)},'apiDir':{'value':_0x24ad27[_0x4d2317(0x211)]||_0x2c0a01[_0x4d2317(0x211)],'source':_0x24ad27['apiDir']?_0x4d2317(0x1fd):_0x4d2317(0x1f5)},'cookie':{'value':_0x24ad27[_0x4d2317(0x20d)]||_0x2c0a01[_0x4d2317(0x20d)],'source':_0x24ad27[_0x4d2317(0x20d)]?_0x4d2317(0x1fd):_0x4d2317(0x1f5)},'accessKey':{'value':_0x24ad27['accessKey']||_0x2c0a01[_0x4d2317(0x214)],'source':_0x24ad27[_0x4d2317(0x214)]?_0x4d2317(0x1fd):_0x4d2317(0x1f5)}};}export function buildCanonicalAppConfig(_0x17f2a8,_0x5776ef){const _0x5e327d=a183_0x1cbbb2,_0x1ae078=_0x17f2a8[_0x5e327d(0x1f4)](_0x143182=>String(_0x143182||'')[_0x5e327d(0x1ff)]())[_0x5e327d(0x200)](Boolean);if(_0x1ae078[_0x5e327d(0x212)]===0x0)return{};const _0x5e9260={};for(const _0x8fce83 of _0x1ae078){_0x5e9260[_0x8fce83]=_0x5776ef?{'appcode':_0x8fce83,'env':_0x5776ef}:{'appcode':_0x8fce83};}return{'apps':_0x5e9260,'defaultApp':_0x1ae078[0x0]};}export function buildCanonicalProjectConfig(_0x4f9fee,_0x3fbc1e){const _0x38082d=a183_0x1cbbb2,{appCodes:appCodes=[],env:_0x329f97,metadata:_0x97a313}=_0x3fbc1e,_0x4efe91={..._0x4f9fee,..._0x97a313||{}};delete _0x4efe91['appcode'],delete _0x4efe91[_0x38082d(0x1fd)];if(_0x329f97)_0x4efe91[_0x38082d(0x20f)]=_0x329f97;else!_0x4efe91[_0x38082d(0x20f)]&&(_0x4efe91[_0x38082d(0x20f)]=DEFAULT_CONFIG_VALUES[_0x38082d(0x20f)]);const _0xcc81c5=buildCanonicalAppConfig(appCodes,_0x4efe91[_0x38082d(0x20f)]);return Object['keys'](_0xcc81c5)['length']>0x0&&(_0x4efe91['apps']=_0xcc81c5[_0x38082d(0x217)],_0x4efe91[_0x38082d(0x208)]=_0xcc81c5[_0x38082d(0x208)]),_0x4efe91;}function a183_0x1bb3(_0x447a81,_0x41d2da){_0x447a81=_0x447a81-0x1f0;const _0x7ebad8=a183_0x7eba();let _0x1bb3ad=_0x7ebad8[_0x447a81];return _0x1bb3ad;}const LOCALE_MAP={'zh':'zh-CN','zh-cn':a183_0x1cbbb2(0x20c),'zh_cn':a183_0x1cbbb2(0x20c),'en':a183_0x1cbbb2(0x1fa),'en-us':a183_0x1cbbb2(0x1fa),'en_us':'en-US'};export function normalizeLocale(_0x28d329){const _0x538c05=a183_0x1cbbb2;if(!_0x28d329)return null;return LOCALE_MAP[_0x28d329[_0x538c05(0x215)]()]??null;}
|
package/lib/constant/cdn.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a184_0xeca7d2=a184_0x1e50;function a184_0x1e50(_0x2d8fb1,_0x1fe31b){_0x2d8fb1=_0x2d8fb1-0xc3;const _0x2cabe6=a184_0x2cab();let _0x1e5072=_0x2cabe6[_0x2d8fb1];return _0x1e5072;}(function(_0x3dd6cc,_0x6595fe){const _0xd4de7=a184_0x1e50,_0x290996=_0x3dd6cc();while(!![]){try{const _0x277662=parseInt(_0xd4de7(0xc7))/0x1+-parseInt(_0xd4de7(0xc3))/0x2+parseInt(_0xd4de7(0xcb))/0x3+-parseInt(_0xd4de7(0xc6))/0x4*(parseInt(_0xd4de7(0xc8))/0x5)+parseInt(_0xd4de7(0xc9))/0x6+parseInt(_0xd4de7(0xc4))/0x7+parseInt(_0xd4de7(0xc5))/0x8;if(_0x277662===_0x6595fe)break;else _0x290996['push'](_0x290996['shift']());}catch(_0x32d0aa){_0x290996['push'](_0x290996['shift']());}}}(a184_0x2cab,0x95126));export const CLI_VERSION_POLICY_URL=a184_0xeca7d2(0xca);function a184_0x2cab(){const _0x524cb1=['1495690xktpTd','2637460AFDfky','3134672CtOKGg','52oxXGHQ','593991wyeKYH','299900SIurob','3568428jMEsHf','https://g.lovrabet.com/dist/rabetbase-cli/config/index.json','542520BliwQq'];a184_0x2cab=function(){return _0x524cb1;};return a184_0x2cab();}
|