@lovrabet/rabetbase-cli 2.3.12 → 2.3.13-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_0x980794=a172_0x1a6a;(function(_0x591d28,_0x1b2198){const _0x7947d7=a172_0x1a6a,_0x597092=_0x591d28();while(!![]){try{const _0x15adc0=parseInt(_0x7947d7(0xed))/0x1*(-parseInt(_0x7947d7(0xe8))/0x2)+parseInt(_0x7947d7(0xd2))/0x3*(parseInt(_0x7947d7(0xcb))/0x4)+-parseInt(_0x7947d7(0xf6))/0x5*(parseInt(_0x7947d7(0xcc))/0x6)+parseInt(_0x7947d7(0xe9))/0x7*(parseInt(_0x7947d7(0xf4))/0x8)+-parseInt(_0x7947d7(0xec))/0x9*(-parseInt(_0x7947d7(0xbb))/0xa)+parseInt(_0x7947d7(0xc7))/0xb*(-parseInt(_0x7947d7(0xd4))/0xc)+-parseInt(_0x7947d7(0xbe))/0xd;if(_0x15adc0===_0x1b2198)break;else _0x597092['push'](_0x597092['shift']());}catch(_0x2437b1){_0x597092['push'](_0x597092['shift']());}}}(a172_0x198a,0xf3d1d));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';function a172_0x198a(){const _0x5c2f47=['message','str','string','path','bool','sqls','force','skipped','trimStart','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','sqlcode','sqlRoot','sql','utf8','name','replace','127898KATkIh','665HTIaBT','paging','\x20written,\x20','8926974nvZldT','10tGtQsL','unchanged','toISOString','split','POST','Force\x20overwrite\x20local\x20unsynced\x20changes','test','145960svHJRz','appCode','317620sHJtdy','No\x20remote\x20SQL\x20queries\x20matched.','catch','20wSCErq','dbId','sqlRootDir','37360388qgTNvd','would_pull','length','pull','sqlName','lockFilePath','apps','push','lastSync','3837581skIFHS','Filter\x20by\x20SQL\x20display\x20name','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','Pull\x20complete:\x20','151132SFjvTj','24OmOqbS','tableData','nonInteractive','mybatisXml','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','sqlContent','111SllBlk','sqlCode','12ZPVQNt','\x20failed','conflict','description'];a172_0x198a=function(){return _0x5c2f47;};return a172_0x198a();}import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x505263,_0x4f70c9){const _0x5971ee=a172_0x1a6a,_0x4f6cfb=[];let _0x286e2c=0x1;while(!![]){const _0x234ead=await listSqlQueries(_0x505263,{'currentPage':_0x286e2c,'pageSize':PAGE_SIZE,'sqlCode':_0x4f70c9[_0x5971ee(0xd3)],'sqlName':_0x4f70c9['sqlName']}),_0x4aed92=_0x234ead[_0x5971ee(0xcd)]??[];_0x4f6cfb['push'](..._0x4aed92);if(_0x4aed92[_0x5971ee(0xc0)]===0x0)break;const _0xcc5616=_0x234ead[_0x5971ee(0xea)]?.['totalCount'];if(_0xcc5616!=null?_0x4f6cfb[_0x5971ee(0xc0)]>=_0xcc5616:_0x4aed92['length']<PAGE_SIZE)break;_0x286e2c++;}return _0x4f6cfb;}function a172_0x1a6a(_0x1d9116,_0x3e82eb){_0x1d9116=_0x1d9116-0xb9;const _0x198a4e=a172_0x198a();let _0x1a6a86=_0x198a4e[_0x1d9116];return _0x1a6a86;}async function ensureSqlContent(_0x4ef3a5){const _0xddad2c=a172_0x1a6a;if(_0x4ef3a5[_0xddad2c(0xd1)]!=null&&String(_0x4ef3a5[_0xddad2c(0xd1)])[_0xddad2c(0xc0)]>0x0)return _0x4ef3a5;return getSqlQueryDetail(_0x4ef3a5['sqlCode']);}export const sqlPull={'service':a172_0x980794(0xe4),'command':'pull','description':a172_0x980794(0xd0),'risk':'write','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a172_0x980794(0xe6),'type':a172_0x980794(0xda),'description':a172_0x980794(0xc8)},{'name':'force','type':'boolean','description':a172_0x980794(0xf2)}],async 'dryRun'(_0x32061e){const _0x3392d7=a172_0x980794,_0x3251d2=loadSqlProjectConfig(_0x32061e[_0x3392d7(0xf5)]),_0x49c3bb=await readSqlLockFile(_0x3251d2[_0x3392d7(0xc3)]),{appLock:_0x46c486}=ensureSqlLockScope(_0x49c3bb??createEmptySqlLock(),_0x3251d2[_0x3392d7(0xf5)],_0x3251d2[_0x3392d7(0xe3)],_0x3392d7(0xc1)),_0x3976f3=await fetchAllSqlQueries(_0x32061e['appCode'],{'sqlCode':_0x32061e['str']('sqlcode')||undefined,'sqlName':_0x32061e[_0x3392d7(0xd9)]('name')||undefined}),_0x49b5be=[];for(const _0xec37a3 of _0x3976f3){const _0x4d1a20=await ensureSqlContent(_0xec37a3),_0x5a938d=ensureRemoteSqlContent(_0x4d1a20),_0x5c30d4=detectModeFromSql(_0x4d1a20),_0x53163f=_0x4d1a20[_0x3392d7(0xbc)]?await getDbName(_0x32061e[_0x3392d7(0xf5)],Number(_0x4d1a20['dbId']))[_0x3392d7(0xba)](()=>undefined):undefined,_0x2525ca=buildLocalSqlFileContent({'sqlCode':_0x4d1a20[_0x3392d7(0xd3)],'sqlName':_0x4d1a20[_0x3392d7(0xc2)],'dbId':_0x4d1a20[_0x3392d7(0xbc)]},_0x5a938d,{'dbName':_0x53163f,'mode':_0x5c30d4,'syncedAt':new Date()[_0x3392d7(0xef)](),'description':_0x4d1a20[_0x3392d7(0xd7)]}),_0x101587=buildSqlLockEntry(_0x4d1a20,_0x5a938d,'',{'dbName':_0x53163f}),_0x2dc89b=resolveLocalSqlFilePath(_0x3251d2,_0x4d1a20[_0x3392d7(0xd3)],_0x101587);let _0x5e9e00=_0x3392d7(0xbf),_0x3b9d64;if(await fileExists(_0x2dc89b)){const _0x179697=await readFile(_0x2dc89b,_0x3392d7(0xe5));isEquivalentPulledSqlFile(_0x179697,_0x2525ca,_0x5c30d4)?(_0x5e9e00=_0x3392d7(0xdf),_0x3b9d64=_0x3392d7(0xee)):(_0x5e9e00=_0x3392d7(0xd6),_0x3b9d64=_0x3392d7(0xc9));}_0x49b5be[_0x3392d7(0xc5)]({'sqlCode':_0x4d1a20[_0x3392d7(0xd3)],'sqlName':_0x4d1a20[_0x3392d7(0xc2)],'filePath':_0x2dc89b,'status':_0x5e9e00,'reason':_0x3b9d64});}return{'method':_0x3392d7(0xf1),'url':_0x3392d7(0xe1),'body':{'appCode':_0x32061e[_0x3392d7(0xf5)],'sqlCode':_0x32061e['str'](_0x3392d7(0xe2))||null,'sqlName':_0x32061e['str'](_0x3392d7(0xe6))||null,'files':_0x49b5be},'description':'Would\x20pull\x20'+_0x49b5be['length']+'\x20SQL\x20file(s)\x20into\x20'+_0x3251d2[_0x3392d7(0xbd)]};},async 'execute'(_0x6e924f){const _0x4600c9=a172_0x980794,_0x246868=loadSqlProjectConfig(_0x6e924f[_0x4600c9(0xf5)]),_0x411869=await readSqlLockFile(_0x246868[_0x4600c9(0xc3)]),{lockData:_0x274edb,appLock:_0x1db03a}=ensureSqlLockScope(_0x411869??createEmptySqlLock(),_0x246868[_0x4600c9(0xf5)],_0x246868['sqlRoot'],'pull'),_0x1fc599=_0x6e924f[_0x4600c9(0xdc)](_0x4600c9(0xde)),_0x404232=await fetchAllSqlQueries(_0x6e924f[_0x4600c9(0xf5)],{'sqlCode':_0x6e924f[_0x4600c9(0xd9)]('sqlcode')||undefined,'sqlName':_0x6e924f['str'](_0x4600c9(0xe6))||undefined});if(_0x404232[_0x4600c9(0xc0)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x4600c9(0xb9)};const _0x4e6ca2=[],_0x4a8dc6=[];for(const _0x377d02 of _0x404232){try{_0x4e6ca2[_0x4600c9(0xc5)](await ensureSqlContent(_0x377d02));}catch(_0x3caed0){_0x4a8dc6[_0x4600c9(0xc5)]({'sqlCode':_0x377d02[_0x4600c9(0xd3)],'error':_0x3caed0 instanceof Error?_0x3caed0[_0x4600c9(0xd8)]:String(_0x3caed0)});}}if(_0x1fc599&&!_0x6e924f[_0x4600c9(0xce)]){let _0x390689=![];for(const _0x387db4 of _0x4e6ca2){const _0x4a1bea=detectModeFromSql(_0x387db4),_0x4b1911=_0x387db4[_0x4600c9(0xbc)]?await getDbName(_0x6e924f['appCode'],Number(_0x387db4[_0x4600c9(0xbc)]))[_0x4600c9(0xba)](()=>undefined):undefined,_0xe8ef11=buildLocalSqlFileContent({'sqlCode':_0x387db4[_0x4600c9(0xd3)],'sqlName':_0x387db4['sqlName'],'dbId':_0x387db4[_0x4600c9(0xbc)]},ensureRemoteSqlContent(_0x387db4),{'dbName':_0x4b1911,'mode':_0x4a1bea,'syncedAt':new Date()[_0x4600c9(0xef)](),'description':_0x387db4['description']}),_0x4a8918=resolveLocalSqlFilePath(_0x246868,_0x387db4[_0x4600c9(0xd3)],buildSqlLockEntry(_0x387db4,ensureRemoteSqlContent(_0x387db4),'',{'dbName':_0x4b1911}));if(await fileExists(_0x4a8918)){const _0x415785=await readFile(_0x4a8918,_0x4600c9(0xe5));if(!isEquivalentPulledSqlFile(_0x415785,_0xe8ef11,_0x4a1bea)){_0x390689=!![];break;}}}if(_0x390689){const _0x145953=await confirmForceOverwrite('Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.');if(!_0x145953)throw CliErrors['cancelled']('Force\x20pull\x20cancelled.');}}const _0x5795af=cloneSqlLockData(_0x274edb),_0x56b351=_0x5795af[_0x4600c9(0xc4)][_0x246868[_0x4600c9(0xf5)]],_0x49ee0b=[],_0x12fbba=[];for(const _0x1c744c of _0x4e6ca2){const _0x5ee369=_0x56b351[_0x4600c9(0xdd)][_0x1c744c['sqlCode']],_0x2273b1=ensureRemoteSqlContent(_0x1c744c),_0x597177=detectModeFromSql(_0x1c744c),_0x53f65a=_0x1c744c[_0x4600c9(0xbc)]?await getDbName(_0x6e924f['appCode'],Number(_0x1c744c[_0x4600c9(0xbc)]))[_0x4600c9(0xba)](()=>undefined):undefined,_0x194f69=buildLocalSqlFileContent({'sqlCode':_0x1c744c[_0x4600c9(0xd3)],'sqlName':_0x1c744c[_0x4600c9(0xc2)],'dbId':_0x1c744c[_0x4600c9(0xbc)]},_0x2273b1,{'dbName':_0x53f65a,'mode':_0x597177,'syncedAt':new Date()[_0x4600c9(0xef)](),'description':_0x1c744c[_0x4600c9(0xd7)]}),_0x4ebfd5=buildSqlLockEntry(_0x1c744c,_0x2273b1,computeSqlContentHash(_0x194f69),{'dbName':_0x53f65a}),_0x4881ed=_0x4ebfd5[_0x4600c9(0xdb)],_0x272529=join(_0x246868[_0x4600c9(0xbd)],_0x4881ed);try{if(await fileExists(_0x272529)){const _0x5a40e1=await readFile(_0x272529,_0x4600c9(0xe5));if(isEquivalentPulledSqlFile(_0x5a40e1,_0x194f69,_0x597177)){_0x12fbba[_0x4600c9(0xc5)]({'sqlCode':_0x1c744c[_0x4600c9(0xd3)],'reason':_0x4600c9(0xee)}),_0x56b351[_0x4600c9(0xdd)][_0x1c744c['sqlCode']]={..._0x4ebfd5,'hash':computeSqlContentHash(_0x5a40e1),'path':_0x4881ed};continue;}if(!_0x1fc599){_0x12fbba['push']({'sqlCode':_0x1c744c[_0x4600c9(0xd3)],'reason':'local\x20differs\x20from\x20remote'});continue;}}const _0x92402c=_0x5ee369?.[_0x4600c9(0xdb)]?join(_0x246868['sqlRootDir'],_0x5ee369[_0x4600c9(0xdb)]):undefined;_0x92402c&&_0x92402c!==_0x272529&&await fileExists(_0x92402c)&&await rm(_0x92402c,{'force':!![]}),await ensureParentDirectory(_0x272529),await writeFile(_0x272529,_0x194f69,_0x4600c9(0xe5)),_0x56b351[_0x4600c9(0xdd)][_0x1c744c['sqlCode']]={..._0x4ebfd5,'path':_0x4881ed},_0x49ee0b[_0x4600c9(0xc5)]({'sqlCode':_0x1c744c[_0x4600c9(0xd3)],'filePath':_0x272529});}catch(_0x3b9985){_0x4a8dc6[_0x4600c9(0xc5)]({'sqlCode':_0x1c744c[_0x4600c9(0xd3)],'error':_0x3b9985 instanceof Error?_0x3b9985[_0x4600c9(0xd8)]:String(_0x3b9985)});}}return _0x56b351[_0x4600c9(0xc6)]=new Date()['toISOString'](),await writeSqlLockFile(_0x246868[_0x4600c9(0xc3)],_0x5795af),{'ok':_0x4a8dc6[_0x4600c9(0xc0)]===0x0,'data':{'pulled':_0x49ee0b,'skipped':_0x12fbba,'failed':_0x4a8dc6},'message':_0x4600c9(0xca)+_0x49ee0b[_0x4600c9(0xc0)]+_0x4600c9(0xeb)+_0x12fbba[_0x4600c9(0xc0)]+'\x20skipped,\x20'+_0x4a8dc6[_0x4600c9(0xc0)]+_0x4600c9(0xd5)};}};function detectModeFromSql(_0x170694){const _0x50c71f=a172_0x980794,_0x2d012f=ensureRemoteSqlContent(_0x170694),_0x1a9db9=stripLocalSqlMetadata(_0x2d012f,_0x50c71f(0xcf))[_0x50c71f(0xe0)]();if(/^<(select|insert|update|delete)\b/i[_0x50c71f(0xf3)](_0x1a9db9))return _0x50c71f(0xcf);return _0x50c71f(0xe4);}function isEquivalentPulledSqlFile(_0xdf74e5,_0x46b75e,_0x3fc4f2){return normalizePullComparableContent(_0xdf74e5,_0x3fc4f2)===normalizePullComparableContent(_0x46b75e,_0x3fc4f2);}function normalizePullComparableContent(_0x552bc9,_0x2a431b){const _0x5b822d=a172_0x980794,_0x96783a=_0x552bc9[_0x5b822d(0xe7)](/\r\n/g,'\x0a')[_0x5b822d(0xf0)]('\x0a'),_0x1e5cf3=_0x96783a['filter'](_0x5a3ed7=>!isSyncedAtMetadataLine(_0x5a3ed7,_0x2a431b));return _0x1e5cf3['join']('\x0a');}function isSyncedAtMetadataLine(_0x2012d1,_0x36d0c1){const _0x5e804d=a172_0x980794;if(_0x36d0c1===_0x5e804d(0xcf))return/^\s*<!--\s*@lovrabet\.syncedAt:/['test'](_0x2012d1);return/^\s*--\s*@lovrabet\.syncedAt:/['test'](_0x2012d1);}
|
|
1
|
+
const a172_0x518cec=a172_0x73db;(function(_0x54795d,_0x1dbca9){const _0x242e13=a172_0x73db,_0x847ba4=_0x54795d();while(!![]){try{const _0x29a423=-parseInt(_0x242e13(0x18b))/0x1*(-parseInt(_0x242e13(0x1a0))/0x2)+-parseInt(_0x242e13(0x188))/0x3+-parseInt(_0x242e13(0x19e))/0x4*(-parseInt(_0x242e13(0x191))/0x5)+-parseInt(_0x242e13(0x1bc))/0x6+-parseInt(_0x242e13(0x1b7))/0x7+-parseInt(_0x242e13(0x1b3))/0x8+parseInt(_0x242e13(0x1ad))/0x9;if(_0x29a423===_0x1dbca9)break;else _0x847ba4['push'](_0x847ba4['shift']());}catch(_0x2ff41d){_0x847ba4['push'](_0x847ba4['shift']());}}}(a172_0x4107,0x57116));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';function a172_0x4107(){const _0xb29091=['pull','dbId','join','sqlContent','write','\x20SQL\x20file(s)\x20into\x20','sql','string','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','Force\x20pull\x20cancelled.','paging','16765335WTCbNi','boolean','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','sqlCode','local\x20differs\x20from\x20remote','sqls','4591776Xvnxpf','would_pull','tableData','push','4456956ZwLpSe','sqlcode','path','Filter\x20by\x20SQL\x20display\x20name','unchanged','4002510qKZoVH','force','catch','skipped','name','sqlName','utf8','cancelled','1319256hixzbV','lastSync','trimStart','53782OqQthf','No\x20remote\x20SQL\x20queries\x20matched.','totalCount','length','description','sqlRootDir','16495mQRiQz','apps','lockFilePath','\x20written,\x20','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','bool','mybatisXml','filter','test','appCode','split','POST','sqlRoot','136xHzKTh','Force\x20overwrite\x20local\x20unsynced\x20changes','26fIVcYb','str'];a172_0x4107=function(){return _0xb29091;};return a172_0x4107();}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(_0x2a8bcc,_0x28f66c){const _0x1286b1=a172_0x73db,_0x8a033b=[];let _0xcf9b72=0x1;while(!![]){const _0x2f55d9=await listSqlQueries(_0x2a8bcc,{'currentPage':_0xcf9b72,'pageSize':PAGE_SIZE,'sqlCode':_0x28f66c[_0x1286b1(0x1b0)],'sqlName':_0x28f66c[_0x1286b1(0x185)]}),_0x305d23=_0x2f55d9[_0x1286b1(0x1b5)]??[];_0x8a033b['push'](..._0x305d23);if(_0x305d23[_0x1286b1(0x18e)]===0x0)break;const _0x1a99ce=_0x2f55d9[_0x1286b1(0x1ac)]?.[_0x1286b1(0x18d)];if(_0x1a99ce!=null?_0x8a033b[_0x1286b1(0x18e)]>=_0x1a99ce:_0x305d23[_0x1286b1(0x18e)]<PAGE_SIZE)break;_0xcf9b72++;}return _0x8a033b;}async function ensureSqlContent(_0x3df757){const _0x43c603=a172_0x73db;if(_0x3df757[_0x43c603(0x1a5)]!=null&&String(_0x3df757[_0x43c603(0x1a5)])[_0x43c603(0x18e)]>0x0)return _0x3df757;return getSqlQueryDetail(_0x3df757[_0x43c603(0x1b0)]);}function a172_0x73db(_0x2bbb08,_0x23f962){_0x2bbb08=_0x2bbb08-0x182;const _0x410711=a172_0x4107();let _0x73db98=_0x410711[_0x2bbb08];return _0x73db98;}export const sqlPull={'service':a172_0x518cec(0x1a8),'command':a172_0x518cec(0x1a2),'description':'Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','risk':a172_0x518cec(0x1a6),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a172_0x518cec(0x184),'type':a172_0x518cec(0x1a9),'description':a172_0x518cec(0x1ba)},{'name':a172_0x518cec(0x1bd),'type':a172_0x518cec(0x1ae),'description':a172_0x518cec(0x19f)}],async 'dryRun'(_0xb456e5){const _0x444027=a172_0x518cec,_0x37fdd2=loadSqlProjectConfig(_0xb456e5[_0x444027(0x19a)]),_0x38eaec=await readSqlLockFile(_0x37fdd2[_0x444027(0x193)]),{appLock:_0x4984c8}=ensureSqlLockScope(_0x38eaec??createEmptySqlLock(),_0x37fdd2[_0x444027(0x19a)],_0x37fdd2[_0x444027(0x19d)],_0x444027(0x1a2)),_0x59503f=await fetchAllSqlQueries(_0xb456e5['appCode'],{'sqlCode':_0xb456e5[_0x444027(0x1a1)](_0x444027(0x1b8))||undefined,'sqlName':_0xb456e5[_0x444027(0x1a1)](_0x444027(0x184))||undefined}),_0x39924e=[];for(const _0x51df11 of _0x59503f){const _0x46f8e8=await ensureSqlContent(_0x51df11),_0x58e130=ensureRemoteSqlContent(_0x46f8e8),_0x30773d=detectModeFromSql(_0x46f8e8),_0x3e871f=_0x46f8e8[_0x444027(0x1a3)]?await getDbName(_0xb456e5[_0x444027(0x19a)],Number(_0x46f8e8['dbId']))[_0x444027(0x182)](()=>undefined):undefined,_0x3e908a=buildLocalSqlFileContent({'sqlCode':_0x46f8e8[_0x444027(0x1b0)],'sqlName':_0x46f8e8[_0x444027(0x185)],'dbId':_0x46f8e8[_0x444027(0x1a3)]},_0x58e130,{'dbName':_0x3e871f,'mode':_0x30773d,'syncedAt':new Date()['toISOString'](),'description':_0x46f8e8['description']}),_0x1d1ca2=buildSqlLockEntry(_0x46f8e8,_0x58e130,'',{'dbName':_0x3e871f}),_0x2c3633=resolveLocalSqlFilePath(_0x37fdd2,_0x46f8e8['sqlCode'],_0x1d1ca2);let _0x7a4cd8=_0x444027(0x1b4),_0x4fc09d;if(await fileExists(_0x2c3633)){const _0x2b86c4=await readFile(_0x2c3633,_0x444027(0x186));isEquivalentPulledSqlFile(_0x2b86c4,_0x3e908a,_0x30773d)?(_0x7a4cd8=_0x444027(0x183),_0x4fc09d=_0x444027(0x1bb)):(_0x7a4cd8='conflict',_0x4fc09d=_0x444027(0x1aa));}_0x39924e[_0x444027(0x1b6)]({'sqlCode':_0x46f8e8[_0x444027(0x1b0)],'sqlName':_0x46f8e8['sqlName'],'filePath':_0x2c3633,'status':_0x7a4cd8,'reason':_0x4fc09d});}return{'method':_0x444027(0x19c),'url':_0x444027(0x1af),'body':{'appCode':_0xb456e5[_0x444027(0x19a)],'sqlCode':_0xb456e5[_0x444027(0x1a1)](_0x444027(0x1b8))||null,'sqlName':_0xb456e5[_0x444027(0x1a1)](_0x444027(0x184))||null,'files':_0x39924e},'description':'Would\x20pull\x20'+_0x39924e[_0x444027(0x18e)]+_0x444027(0x1a7)+_0x37fdd2['sqlRootDir']};},async 'execute'(_0xddccb0){const _0x1e51b5=a172_0x518cec,_0x48bd17=loadSqlProjectConfig(_0xddccb0[_0x1e51b5(0x19a)]),_0x14f8ea=await readSqlLockFile(_0x48bd17[_0x1e51b5(0x193)]),{lockData:_0x145172,appLock:_0x36a21a}=ensureSqlLockScope(_0x14f8ea??createEmptySqlLock(),_0x48bd17[_0x1e51b5(0x19a)],_0x48bd17[_0x1e51b5(0x19d)],'pull'),_0x565b11=_0xddccb0[_0x1e51b5(0x196)]('force'),_0x312b95=await fetchAllSqlQueries(_0xddccb0[_0x1e51b5(0x19a)],{'sqlCode':_0xddccb0['str'](_0x1e51b5(0x1b8))||undefined,'sqlName':_0xddccb0[_0x1e51b5(0x1a1)](_0x1e51b5(0x184))||undefined});if(_0x312b95[_0x1e51b5(0x18e)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x1e51b5(0x18c)};const _0x444039=[],_0x3f82f6=[];for(const _0x53cc83 of _0x312b95){try{_0x444039[_0x1e51b5(0x1b6)](await ensureSqlContent(_0x53cc83));}catch(_0x51b773){_0x3f82f6[_0x1e51b5(0x1b6)]({'sqlCode':_0x53cc83[_0x1e51b5(0x1b0)],'error':_0x51b773 instanceof Error?_0x51b773['message']:String(_0x51b773)});}}if(_0x565b11&&!_0xddccb0['nonInteractive']){let _0x42137c=![];for(const _0x22bccc of _0x444039){const _0x4e563f=detectModeFromSql(_0x22bccc),_0x430140=_0x22bccc[_0x1e51b5(0x1a3)]?await getDbName(_0xddccb0['appCode'],Number(_0x22bccc['dbId']))[_0x1e51b5(0x182)](()=>undefined):undefined,_0x370d03=buildLocalSqlFileContent({'sqlCode':_0x22bccc[_0x1e51b5(0x1b0)],'sqlName':_0x22bccc[_0x1e51b5(0x185)],'dbId':_0x22bccc[_0x1e51b5(0x1a3)]},ensureRemoteSqlContent(_0x22bccc),{'dbName':_0x430140,'mode':_0x4e563f,'syncedAt':new Date()['toISOString'](),'description':_0x22bccc[_0x1e51b5(0x18f)]}),_0x1d331e=resolveLocalSqlFilePath(_0x48bd17,_0x22bccc[_0x1e51b5(0x1b0)],buildSqlLockEntry(_0x22bccc,ensureRemoteSqlContent(_0x22bccc),'',{'dbName':_0x430140}));if(await fileExists(_0x1d331e)){const _0x3aed33=await readFile(_0x1d331e,_0x1e51b5(0x186));if(!isEquivalentPulledSqlFile(_0x3aed33,_0x370d03,_0x4e563f)){_0x42137c=!![];break;}}}if(_0x42137c){const _0x4056b2=await confirmForceOverwrite(_0x1e51b5(0x195));if(!_0x4056b2)throw CliErrors[_0x1e51b5(0x187)](_0x1e51b5(0x1ab));}}const _0x1cefab=cloneSqlLockData(_0x145172),_0x3a699d=_0x1cefab[_0x1e51b5(0x192)][_0x48bd17[_0x1e51b5(0x19a)]],_0x181f62=[],_0xd61585=[];for(const _0x2c4e34 of _0x444039){const _0xccc11b=_0x3a699d[_0x1e51b5(0x1b2)][_0x2c4e34['sqlCode']],_0x32e1da=ensureRemoteSqlContent(_0x2c4e34),_0xa04e86=detectModeFromSql(_0x2c4e34),_0x2d1424=_0x2c4e34[_0x1e51b5(0x1a3)]?await getDbName(_0xddccb0[_0x1e51b5(0x19a)],Number(_0x2c4e34[_0x1e51b5(0x1a3)]))[_0x1e51b5(0x182)](()=>undefined):undefined,_0x4f0a90=buildLocalSqlFileContent({'sqlCode':_0x2c4e34[_0x1e51b5(0x1b0)],'sqlName':_0x2c4e34['sqlName'],'dbId':_0x2c4e34[_0x1e51b5(0x1a3)]},_0x32e1da,{'dbName':_0x2d1424,'mode':_0xa04e86,'syncedAt':new Date()['toISOString'](),'description':_0x2c4e34[_0x1e51b5(0x18f)]}),_0x44718a=buildSqlLockEntry(_0x2c4e34,_0x32e1da,computeSqlContentHash(_0x4f0a90),{'dbName':_0x2d1424}),_0x506a97=_0x44718a[_0x1e51b5(0x1b9)],_0x3c89ab=join(_0x48bd17[_0x1e51b5(0x190)],_0x506a97);try{if(await fileExists(_0x3c89ab)){const _0x5b6d9a=await readFile(_0x3c89ab,_0x1e51b5(0x186));if(isEquivalentPulledSqlFile(_0x5b6d9a,_0x4f0a90,_0xa04e86)){_0xd61585[_0x1e51b5(0x1b6)]({'sqlCode':_0x2c4e34[_0x1e51b5(0x1b0)],'reason':_0x1e51b5(0x1bb)}),_0x3a699d[_0x1e51b5(0x1b2)][_0x2c4e34[_0x1e51b5(0x1b0)]]={..._0x44718a,'hash':computeSqlContentHash(_0x5b6d9a),'path':_0x506a97};continue;}if(!_0x565b11){_0xd61585[_0x1e51b5(0x1b6)]({'sqlCode':_0x2c4e34[_0x1e51b5(0x1b0)],'reason':_0x1e51b5(0x1b1)});continue;}}const _0x27ac51=_0xccc11b?.[_0x1e51b5(0x1b9)]?join(_0x48bd17[_0x1e51b5(0x190)],_0xccc11b[_0x1e51b5(0x1b9)]):undefined;_0x27ac51&&_0x27ac51!==_0x3c89ab&&await fileExists(_0x27ac51)&&await rm(_0x27ac51,{'force':!![]}),await ensureParentDirectory(_0x3c89ab),await writeFile(_0x3c89ab,_0x4f0a90,_0x1e51b5(0x186)),_0x3a699d[_0x1e51b5(0x1b2)][_0x2c4e34[_0x1e51b5(0x1b0)]]={..._0x44718a,'path':_0x506a97},_0x181f62[_0x1e51b5(0x1b6)]({'sqlCode':_0x2c4e34[_0x1e51b5(0x1b0)],'filePath':_0x3c89ab});}catch(_0x94f76d){_0x3f82f6[_0x1e51b5(0x1b6)]({'sqlCode':_0x2c4e34[_0x1e51b5(0x1b0)],'error':_0x94f76d instanceof Error?_0x94f76d['message']:String(_0x94f76d)});}}return _0x3a699d[_0x1e51b5(0x189)]=new Date()['toISOString'](),await writeSqlLockFile(_0x48bd17[_0x1e51b5(0x193)],_0x1cefab),{'ok':_0x3f82f6[_0x1e51b5(0x18e)]===0x0,'data':{'pulled':_0x181f62,'skipped':_0xd61585,'failed':_0x3f82f6},'message':'Pull\x20complete:\x20'+_0x181f62[_0x1e51b5(0x18e)]+_0x1e51b5(0x194)+_0xd61585[_0x1e51b5(0x18e)]+'\x20skipped,\x20'+_0x3f82f6[_0x1e51b5(0x18e)]+'\x20failed'};}};function detectModeFromSql(_0x2002e4){const _0x4b787c=a172_0x518cec,_0x5943a0=ensureRemoteSqlContent(_0x2002e4),_0xd1ac67=stripLocalSqlMetadata(_0x5943a0,_0x4b787c(0x197))[_0x4b787c(0x18a)]();if(/^<(select|insert|update|delete)\b/i['test'](_0xd1ac67))return _0x4b787c(0x197);return _0x4b787c(0x1a8);}function isEquivalentPulledSqlFile(_0x3e8842,_0x4601e7,_0x4e684c){return normalizePullComparableContent(_0x3e8842,_0x4e684c)===normalizePullComparableContent(_0x4601e7,_0x4e684c);}function normalizePullComparableContent(_0x2ab356,_0x4af141){const _0x382628=a172_0x518cec,_0x206a5d=_0x2ab356['replace'](/\r\n/g,'\x0a')[_0x382628(0x19b)]('\x0a'),_0x6752e6=_0x206a5d[_0x382628(0x198)](_0x4039cd=>!isSyncedAtMetadataLine(_0x4039cd,_0x4af141));return _0x6752e6[_0x382628(0x1a4)]('\x0a');}function isSyncedAtMetadataLine(_0x6a9b82,_0x2d9041){const _0x481f3b=a172_0x518cec;if(_0x2d9041===_0x481f3b(0x197))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x481f3b(0x199)](_0x6a9b82);return/^\s*--\s*@lovrabet\.syncedAt:/['test'](_0x6a9b82);}
|
package/lib/commands/sql/push.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a173_0x2a0fde=a173_0x59b6;(function(_0x81925,_0x257cbe){const _0x3cac9f=a173_0x59b6,_0x3bd90d=_0x81925();while(!![]){try{const _0x1c1ad0=parseInt(_0x3cac9f(0xc5))/0x1*(parseInt(_0x3cac9f(0xc9))/0x2)+parseInt(_0x3cac9f(0x102))/0x3+-parseInt(_0x3cac9f(0xe2))/0x4+parseInt(_0x3cac9f(0xff))/0x5*(-parseInt(_0x3cac9f(0xc6))/0x6)+parseInt(_0x3cac9f(0xcf))/0x7*(parseInt(_0x3cac9f(0xda))/0x8)+parseInt(_0x3cac9f(0xde))/0x9+parseInt(_0x3cac9f(0xf0))/0xa;if(_0x1c1ad0===_0x257cbe)break;else _0x3bd90d['push'](_0x3bd90d['shift']());}catch(_0x5b97f5){_0x3bd90d['push'](_0x3bd90d['shift']());}}}(a173_0x1db8,0x9586c));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';function a173_0x1db8(){const _0x383d71=['projectRoot','lastSync','7211464dYJDZl','hash','sqlcode','POST','1754361uUJdGb','Push\x20complete:\x20','\x20SQL\x20file(s)','sqlRoot','4764856yowubo','unchanged','sqlName','dbName','join','force','Local\x20SQL\x20not\x20found:\x20','relativePath','exec','bool','length','sqlRootDir','utf8','\x20skipped,\x20','6963530kYKapx','filePath','entries','replace','sql','filter','/smartapi/custom/updateUserCustomSql','has','catch','remoteId','appCode','sqls','dbDirectory','\x20pushed,\x20','lockFilePath','334155xlUpsH','trashDir','toISOString','2475030uAXUig','str','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','validation','23oFaPNG','108Bsqpls','sqlConfig','sqlCode','33818rCBmwS','startsWith','\x20failed','version','Push\x20local\x20SQL\x20files\x20to\x20remote','boolean','7nSTQNA','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','push','\x22\x20for\x20sqlCode\x20','dbId','No\x20database\x20matches\x20local\x20directory\x20\x22','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','message','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20'];a173_0x1db8=function(){return _0x383d71;};return a173_0x1db8();}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(_0x540ecb,_0x581274,_0x423834){const _0x5f4752=a173_0x59b6,_0x2b4019=await scanLocalSqlQueries(_0x540ecb),_0x483c83=new Map();for(const _0x45224d of _0x2b4019){if(_0x423834&&_0x45224d[_0x5f4752(0xc8)]!==_0x423834)continue;const _0x3a1ac6=_0x483c83['get'](_0x45224d[_0x5f4752(0xc8)])??[];_0x3a1ac6[_0x5f4752(0xd1)](_0x45224d),_0x483c83['set'](_0x45224d['sqlCode'],_0x3a1ac6);}if(_0x423834&&!_0x483c83[_0x5f4752(0xf7)](_0x423834))throw CliErrors[_0x5f4752(0xc4)](_0x5f4752(0xe8)+_0x423834);const _0x4757f8=[];for(const [_0x2ba07e,_0x544418]of _0x483c83[_0x5f4752(0xf2)]()){if(_0x544418[_0x5f4752(0xec)]===0x1){_0x4757f8[_0x5f4752(0xd1)](_0x544418[0x0]);continue;}const _0x54c4ff=_0x581274[_0x5f4752(0xfb)][_0x2ba07e],_0x2494d5=_0x54c4ff?.['path'],_0x27b500=_0x2494d5?_0x544418[_0x5f4752(0xf5)](_0x2b54b8=>_0x2b54b8[_0x5f4752(0xe9)]!==_0x2494d5):_0x544418;if(_0x54c4ff&&_0x27b500[_0x5f4752(0xec)]===0x1){_0x4757f8[_0x5f4752(0xd1)](_0x27b500[0x0]);continue;}throw CliErrors[_0x5f4752(0xc4)](_0x5f4752(0xd7)+_0x2ba07e+_0x5f4752(0xd5));}return _0x4757f8;}export const sqlPush={'service':a173_0x2a0fde(0xf4),'command':'push','description':a173_0x2a0fde(0xcd),'risk':'high-risk-write','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a173_0x2a0fde(0xe7),'type':a173_0x2a0fde(0xce),'description':a173_0x2a0fde(0xd0)}],async 'dryRun'(_0x433de6){const _0x1d979a=a173_0x2a0fde,_0x5df3d4=loadSqlProjectConfig(_0x433de6[_0x1d979a(0xfa)]),_0xce60e0=await readSqlLockFile(_0x5df3d4[_0x1d979a(0xfe)]),{appLock:_0x2e1bd7}=ensureSqlLockScope(_0xce60e0??createEmptySqlLock(),_0x433de6[_0x1d979a(0xfa)],_0x5df3d4[_0x1d979a(0xe1)],_0x1d979a(0xd1)),_0x510102=await getTargetSqlQueries(_0x5df3d4,_0x2e1bd7,_0x433de6[_0x1d979a(0x103)](_0x1d979a(0xdc))||undefined),_0x97043d=[];for(const _0x1eee98 of _0x510102){const _0x3323f5=await computeSqlFileHash(_0x1eee98['filePath']),_0x28bce1=_0x2e1bd7['sqls'][_0x1eee98[_0x1d979a(0xc8)]],_0x3ac3fa=!!_0x28bce1&&(_0x28bce1['path']!==_0x1eee98['relativePath']||!!_0x1eee98['sqlName']&&_0x28bce1[_0x1d979a(0xe4)]!==_0x1eee98[_0x1d979a(0xe4)]);if(!_0x433de6[_0x1d979a(0xeb)]('force')&&_0x28bce1&&_0x28bce1[_0x1d979a(0xdb)]===_0x3323f5&&!_0x3ac3fa)continue;_0x97043d['push'](_0x1eee98[_0x1d979a(0xc8)]);}return{'method':_0x1d979a(0xdd),'url':_0x1d979a(0xf6),'body':{'sqlCodes':_0x97043d,'appCode':_0x433de6[_0x1d979a(0xfa)]},'description':'Would\x20push\x20'+_0x97043d[_0x1d979a(0xec)]+_0x1d979a(0xe0)};},async 'execute'(_0x15947b){const _0x1c4cbf=a173_0x2a0fde,_0x3f077e=loadSqlProjectConfig(_0x15947b[_0x1c4cbf(0xfa)]),_0x24fced=await readSqlLockFile(_0x3f077e[_0x1c4cbf(0xfe)]),{lockData:_0x3ac16a,appLock:_0x1ad803}=ensureSqlLockScope(_0x24fced??createEmptySqlLock(),_0x15947b[_0x1c4cbf(0xfa)],_0x3f077e[_0x1c4cbf(0xe1)],'push'),_0x3c4dea=await getTargetSqlQueries(_0x3f077e,_0x1ad803,_0x15947b[_0x1c4cbf(0x103)](_0x1c4cbf(0xdc))||undefined);if(_0x3c4dea['length']===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':'No\x20local\x20SQL\x20files\x20found.'};const _0x3d4ecc=[],_0x271128=[],_0xec7023=[];for(const _0x56e655 of _0x3c4dea){const _0x253ca6=_0x1ad803[_0x1c4cbf(0xfb)][_0x56e655[_0x1c4cbf(0xc8)]];if(!_0x253ca6){_0xec7023[_0x1c4cbf(0xd1)]({'sqlCode':_0x56e655[_0x1c4cbf(0xc8)],'error':_0x1c4cbf(0xc2)});continue;}try{const _0x4d5838=await computeSqlFileHash(_0x56e655[_0x1c4cbf(0xf1)]),_0x36ea9b=_0x253ca6['path']!==_0x56e655['relativePath']||!!_0x56e655[_0x1c4cbf(0xe4)]&&_0x253ca6[_0x1c4cbf(0xe4)]!==_0x56e655[_0x1c4cbf(0xe4)];if(!_0x15947b[_0x1c4cbf(0xeb)](_0x1c4cbf(0xe7))&&_0x253ca6['hash']===_0x4d5838&&!_0x36ea9b){_0x271128[_0x1c4cbf(0xd1)]({'sqlCode':_0x56e655[_0x1c4cbf(0xc8)],'reason':_0x1c4cbf(0xe3)});continue;}if(_0x253ca6[_0x1c4cbf(0xcc)]==null){_0xec7023[_0x1c4cbf(0xd1)]({'sqlCode':_0x56e655[_0x1c4cbf(0xc8)],'error':'missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first'});continue;}const _0x179315=await readFile(_0x56e655[_0x1c4cbf(0xf1)],_0x1c4cbf(0xee)),_0x267eae=stripLocalSqlMetadata(_0x179315,_0x56e655['mode']),_0x4d759a=_0x56e655[_0x1c4cbf(0xe4)]||_0x253ca6[_0x1c4cbf(0xe4)],_0x4f9f61=await resolveTargetDbBinding(_0x15947b[_0x1c4cbf(0xfa)],_0x56e655,_0x253ca6),_0x31e530=await updateSqlQuery({'id':_0x253ca6[_0x1c4cbf(0xf9)],'appCode':_0x15947b[_0x1c4cbf(0xfa)],'sqlCode':_0x56e655[_0x1c4cbf(0xc8)],'sqlName':_0x4d759a,'dbId':_0x4f9f61[_0x1c4cbf(0xd3)],'version':_0x253ca6[_0x1c4cbf(0xcc)],'sqlContent':_0x267eae,'sqlConfig':_0x253ca6[_0x1c4cbf(0xc7)]??undefined}),_0x1d9b0e=_0x31e530[_0x1c4cbf(0xd3)]?await getDbName(_0x15947b[_0x1c4cbf(0xfa)],Number(_0x31e530[_0x1c4cbf(0xd3)]))['catch'](()=>_0x4f9f61[_0x1c4cbf(0xe5)]):_0x4f9f61['dbName'];_0x1ad803[_0x1c4cbf(0xfb)][_0x56e655['sqlCode']]={...buildSqlLockEntry(_0x31e530,_0x267eae,_0x4d5838,{'dbName':_0x1d9b0e}),'path':_0x56e655[_0x1c4cbf(0xe9)],'mode':_0x253ca6['mode']},await archivePreviousSqlFileIfNeeded(_0x3f077e,_0x253ca6['path'],_0x56e655[_0x1c4cbf(0xe9)]),_0x3d4ecc['push']({'sqlCode':_0x56e655['sqlCode'],'remoteId':_0x253ca6[_0x1c4cbf(0xf9)]});}catch(_0x25f09a){_0xec7023[_0x1c4cbf(0xd1)]({'sqlCode':_0x56e655[_0x1c4cbf(0xc8)],'error':_0x25f09a instanceof Error?_0x25f09a[_0x1c4cbf(0xd6)]:String(_0x25f09a)});}}return _0x1ad803[_0x1c4cbf(0xd9)]=new Date()[_0x1c4cbf(0x101)](),await writeSqlLockFile(_0x3f077e[_0x1c4cbf(0xfe)],_0x3ac16a),{'ok':_0xec7023[_0x1c4cbf(0xec)]===0x0,'data':{'pushed':_0x3d4ecc,'skipped':_0x271128,'failed':_0xec7023},'message':_0x1c4cbf(0xdf)+_0x3d4ecc[_0x1c4cbf(0xec)]+_0x1c4cbf(0xfd)+_0x271128[_0x1c4cbf(0xec)]+_0x1c4cbf(0xef)+_0xec7023[_0x1c4cbf(0xec)]+_0x1c4cbf(0xcb)};}};function a173_0x59b6(_0x30778f,_0x2a78a9){_0x30778f=_0x30778f-0xc2;const _0x1db8d5=a173_0x1db8();let _0x59b6c4=_0x1db8d5[_0x30778f];return _0x59b6c4;}async function archivePreviousSqlFileIfNeeded(_0x3a0050,_0x240e43,_0x3d4b16){const _0x47c9b0=a173_0x2a0fde;if(!_0x240e43||_0x240e43===_0x3d4b16)return;const _0x17dbba=join(_0x3a0050[_0x47c9b0(0xed)],_0x240e43);if(!await fileExists(_0x17dbba))return;const _0x301f8c=await moveToTrash(_0x3a0050[_0x47c9b0(0xd8)],_0x3a0050[_0x47c9b0(0x100)],_0x17dbba);await cleanupEmptyDirectories(dirname(_0x17dbba),_0x3a0050[_0x47c9b0(0xed)]),void _0x301f8c;}async function moveToTrash(_0xa35868,_0x4af45b,_0xee9f2){const _0x16b7f6=a173_0x2a0fde,_0x1e07f6=new Date()['toISOString']()[_0x16b7f6(0xf3)](/[:.]/g,'-'),_0x312f35=relative(_0xa35868,_0xee9f2),_0x4cca72=join(_0x4af45b,_0x1e07f6,_0x312f35);return await mkdir(dirname(_0x4cca72),{'recursive':!![]}),await rename(_0xee9f2,_0x4cca72),_0x4cca72;}async function cleanupEmptyDirectories(_0x3ddefb,_0x2c21c7){const _0xdfbdf8=a173_0x2a0fde;let _0x5c8930=resolve(_0x3ddefb);const _0x364b54=resolve(_0x2c21c7);while(_0x5c8930[_0xdfbdf8(0xca)](''+_0x364b54+sep)||_0x5c8930===_0x364b54){if(_0x5c8930===_0x364b54)return;try{const _0x1f6a16=await readdir(_0x5c8930);if(_0x1f6a16[_0xdfbdf8(0xec)]>0x0)return;await rmdir(_0x5c8930);}catch{return;}_0x5c8930=dirname(_0x5c8930);}}async function resolveTargetDbBinding(_0x104b75,_0x555d65,_0x1496a5){const _0x36483b=a173_0x2a0fde,_0x1da0a9=_0x555d65[_0x36483b(0xfc)];if(!_0x1da0a9)return{'dbId':_0x1496a5['dbId'],'dbName':_0x1496a5[_0x36483b(0xe5)]};const _0x4de33d=buildDbDirectoryName(_0x1496a5[_0x36483b(0xe5)],_0x1496a5[_0x36483b(0xd3)]);if(_0x1da0a9===_0x4de33d)return{'dbId':_0x1496a5[_0x36483b(0xd3)],'dbName':_0x1496a5[_0x36483b(0xe5)]};const _0x28e1df=parseExplicitDbDirectory(_0x1da0a9);if(_0x28e1df!=null)return{'dbId':_0x28e1df,'dbName':await getDbName(_0x104b75,_0x28e1df)[_0x36483b(0xf8)](()=>undefined)};const _0x2894ae=await listDatabases(_0x104b75),_0x113c7a=_0x2894ae[_0x36483b(0xf5)](_0x14f93d=>buildDbDirectoryName(_0x14f93d[_0x36483b(0xe5)],_0x14f93d[_0x36483b(0xd3)])===_0x1da0a9);if(_0x113c7a['length']===0x1)return{'dbId':_0x113c7a[0x0]['dbId'],'dbName':_0x113c7a[0x0][_0x36483b(0xe5)]};if(_0x113c7a[_0x36483b(0xec)]===0x0)throw CliErrors[_0x36483b(0xc4)](_0x36483b(0xd4)+_0x1da0a9+_0x36483b(0xd2)+_0x555d65[_0x36483b(0xc8)]+'.');const _0x4dc499=_0x113c7a['map'](_0x131902=>_0x131902[_0x36483b(0xe5)]+'\x20('+_0x131902[_0x36483b(0xd3)]+')')[_0x36483b(0xe6)](',\x20');throw CliErrors[_0x36483b(0xc4)]('Local\x20directory\x20\x22'+_0x1da0a9+_0x36483b(0xc3)+_0x555d65[_0x36483b(0xc8)]+':\x20'+_0x4dc499);}function parseExplicitDbDirectory(_0x11fa81){const _0x22ee68=a173_0x2a0fde,_0x47cbb3=/^db-(\d+)$/[_0x22ee68(0xea)](_0x11fa81);if(!_0x47cbb3)return null;const _0x1648d0=Number(_0x47cbb3[0x1]);return Number['isFinite'](_0x1648d0)&&_0x1648d0>0x0?_0x1648d0:null;}
|
|
1
|
+
const a173_0x186e53=a173_0x1ff8;(function(_0x99c2ac,_0x3e980a){const _0x17c32c=a173_0x1ff8,_0x3235c7=_0x99c2ac();while(!![]){try{const _0x514a6a=-parseInt(_0x17c32c(0x188))/0x1+-parseInt(_0x17c32c(0x19c))/0x2+-parseInt(_0x17c32c(0x198))/0x3*(-parseInt(_0x17c32c(0x164))/0x4)+-parseInt(_0x17c32c(0x16a))/0x5*(parseInt(_0x17c32c(0x189))/0x6)+parseInt(_0x17c32c(0x19b))/0x7*(-parseInt(_0x17c32c(0x18d))/0x8)+-parseInt(_0x17c32c(0x162))/0x9+parseInt(_0x17c32c(0x199))/0xa;if(_0x514a6a===_0x3e980a)break;else _0x3235c7['push'](_0x3235c7['shift']());}catch(_0x42ca2c){_0x3235c7['push'](_0x3235c7['shift']());}}}(a173_0x5a52,0x9c5f9));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';function a173_0x5a52(){const _0x9218f5=['828748hCtEIJ','has','dbDirectory','Would\x20push\x20','trashDir','mode','3872570iPzHLP','\x20SQL\x20file(s)','version','dbName','sqlName','relativePath','catch','dbId','high-risk-write','remoteId','toISOString','Local\x20directory\x20\x22','lockFilePath','No\x20local\x20SQL\x20files\x20found.','sqls','set','filePath','push','appCode','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','sqlRoot','filter','validation','force','str','sqlcode','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','\x20pushed,\x20','\x20skipped,\x20','\x22\x20for\x20sqlCode\x20','288353HcVVRS','6gxmMBN','POST','map','join','4970744brgqkT','No\x20database\x20matches\x20local\x20directory\x20\x22','message','hash','sql','path','entries','isFinite','length','bool','Push\x20complete:\x20','3nQQHZo','40727160zwNGCM','sqlCode','14mSeAXO','1277854CKRIFD','Push\x20local\x20SQL\x20files\x20to\x20remote','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','6254262ABWGIp','boolean'];a173_0x5a52=function(){return _0x9218f5;};return a173_0x5a52();}import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';function a173_0x1ff8(_0x30b46c,_0x1517a1){_0x30b46c=_0x30b46c-0x160;const _0x5a52db=a173_0x5a52();let _0x1ff8c3=_0x5a52db[_0x30b46c];return _0x1ff8c3;}async function getTargetSqlQueries(_0x30310b,_0x1b4d71,_0x24b4ae){const _0x378916=a173_0x1ff8,_0x10f0c0=await scanLocalSqlQueries(_0x30310b),_0x253078=new Map();for(const _0x4cd2a6 of _0x10f0c0){if(_0x24b4ae&&_0x4cd2a6['sqlCode']!==_0x24b4ae)continue;const _0xcd7544=_0x253078['get'](_0x4cd2a6['sqlCode'])??[];_0xcd7544[_0x378916(0x17b)](_0x4cd2a6),_0x253078[_0x378916(0x179)](_0x4cd2a6['sqlCode'],_0xcd7544);}if(_0x24b4ae&&!_0x253078[_0x378916(0x165)](_0x24b4ae))throw CliErrors[_0x378916(0x180)]('Local\x20SQL\x20not\x20found:\x20'+_0x24b4ae);const _0xfe2d71=[];for(const [_0x45633a,_0x15bd23]of _0x253078[_0x378916(0x193)]()){if(_0x15bd23[_0x378916(0x195)]===0x1){_0xfe2d71[_0x378916(0x17b)](_0x15bd23[0x0]);continue;}const _0x5bb241=_0x1b4d71['sqls'][_0x45633a],_0x311a0b=_0x5bb241?.['path'],_0x5bc0d7=_0x311a0b?_0x15bd23['filter'](_0x393e57=>_0x393e57[_0x378916(0x16f)]!==_0x311a0b):_0x15bd23;if(_0x5bb241&&_0x5bc0d7[_0x378916(0x195)]===0x1){_0xfe2d71[_0x378916(0x17b)](_0x5bc0d7[0x0]);continue;}throw CliErrors[_0x378916(0x180)]('Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20'+_0x45633a+'.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.');}return _0xfe2d71;}export const sqlPush={'service':a173_0x186e53(0x191),'command':a173_0x186e53(0x17b),'description':a173_0x186e53(0x160),'risk':a173_0x186e53(0x172),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a173_0x186e53(0x181),'type':a173_0x186e53(0x163),'description':a173_0x186e53(0x184)}],async 'dryRun'(_0x1f5007){const _0x2fb114=a173_0x186e53,_0xf92402=loadSqlProjectConfig(_0x1f5007[_0x2fb114(0x17c)]),_0x1be2a0=await readSqlLockFile(_0xf92402[_0x2fb114(0x176)]),{appLock:_0x1b481c}=ensureSqlLockScope(_0x1be2a0??createEmptySqlLock(),_0x1f5007[_0x2fb114(0x17c)],_0xf92402[_0x2fb114(0x17e)],_0x2fb114(0x17b)),_0x3110cd=await getTargetSqlQueries(_0xf92402,_0x1b481c,_0x1f5007[_0x2fb114(0x182)](_0x2fb114(0x183))||undefined),_0x26dbae=[];for(const _0x34b3b1 of _0x3110cd){const _0x27ac61=await computeSqlFileHash(_0x34b3b1[_0x2fb114(0x17a)]),_0x29dc6f=_0x1b481c[_0x2fb114(0x178)][_0x34b3b1['sqlCode']],_0xbab337=!!_0x29dc6f&&(_0x29dc6f['path']!==_0x34b3b1[_0x2fb114(0x16f)]||!!_0x34b3b1[_0x2fb114(0x16e)]&&_0x29dc6f[_0x2fb114(0x16e)]!==_0x34b3b1[_0x2fb114(0x16e)]);if(!_0x1f5007[_0x2fb114(0x196)](_0x2fb114(0x181))&&_0x29dc6f&&_0x29dc6f[_0x2fb114(0x190)]===_0x27ac61&&!_0xbab337)continue;_0x26dbae[_0x2fb114(0x17b)](_0x34b3b1[_0x2fb114(0x19a)]);}return{'method':_0x2fb114(0x18a),'url':'/smartapi/custom/updateUserCustomSql','body':{'sqlCodes':_0x26dbae,'appCode':_0x1f5007[_0x2fb114(0x17c)]},'description':_0x2fb114(0x167)+_0x26dbae[_0x2fb114(0x195)]+_0x2fb114(0x16b)};},async 'execute'(_0x2ccbb7){const _0x4a63b1=a173_0x186e53,_0x2b632b=loadSqlProjectConfig(_0x2ccbb7['appCode']),_0x2c83ea=await readSqlLockFile(_0x2b632b[_0x4a63b1(0x176)]),{lockData:_0xd5023b,appLock:_0x2830c1}=ensureSqlLockScope(_0x2c83ea??createEmptySqlLock(),_0x2ccbb7[_0x4a63b1(0x17c)],_0x2b632b['sqlRoot'],_0x4a63b1(0x17b)),_0x10c2af=await getTargetSqlQueries(_0x2b632b,_0x2830c1,_0x2ccbb7[_0x4a63b1(0x182)](_0x4a63b1(0x183))||undefined);if(_0x10c2af[_0x4a63b1(0x195)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x4a63b1(0x177)};const _0x4daa37=[],_0x1bcd47=[],_0x301b70=[];for(const _0x11d819 of _0x10c2af){const _0x5ea23c=_0x2830c1[_0x4a63b1(0x178)][_0x11d819[_0x4a63b1(0x19a)]];if(!_0x5ea23c){_0x301b70[_0x4a63b1(0x17b)]({'sqlCode':_0x11d819[_0x4a63b1(0x19a)],'error':_0x4a63b1(0x161)});continue;}try{const _0x18afa4=await computeSqlFileHash(_0x11d819[_0x4a63b1(0x17a)]),_0x4574e3=_0x5ea23c[_0x4a63b1(0x192)]!==_0x11d819[_0x4a63b1(0x16f)]||!!_0x11d819[_0x4a63b1(0x16e)]&&_0x5ea23c[_0x4a63b1(0x16e)]!==_0x11d819['sqlName'];if(!_0x2ccbb7[_0x4a63b1(0x196)]('force')&&_0x5ea23c[_0x4a63b1(0x190)]===_0x18afa4&&!_0x4574e3){_0x1bcd47[_0x4a63b1(0x17b)]({'sqlCode':_0x11d819[_0x4a63b1(0x19a)],'reason':'unchanged'});continue;}if(_0x5ea23c[_0x4a63b1(0x16c)]==null){_0x301b70['push']({'sqlCode':_0x11d819[_0x4a63b1(0x19a)],'error':_0x4a63b1(0x17d)});continue;}const _0x2c1498=await readFile(_0x11d819['filePath'],'utf8'),_0x4ae0a2=stripLocalSqlMetadata(_0x2c1498,_0x11d819['mode']),_0xf7f079=_0x11d819[_0x4a63b1(0x16e)]||_0x5ea23c[_0x4a63b1(0x16e)],_0x5dbe37=await resolveTargetDbBinding(_0x2ccbb7[_0x4a63b1(0x17c)],_0x11d819,_0x5ea23c),_0x5b51ad=await updateSqlQuery({'id':_0x5ea23c[_0x4a63b1(0x173)],'appCode':_0x2ccbb7['appCode'],'sqlCode':_0x11d819[_0x4a63b1(0x19a)],'sqlName':_0xf7f079,'dbId':_0x5dbe37['dbId'],'version':_0x5ea23c[_0x4a63b1(0x16c)],'sqlContent':_0x4ae0a2,'sqlConfig':_0x5ea23c['sqlConfig']??undefined}),_0x404876=_0x5b51ad[_0x4a63b1(0x171)]?await getDbName(_0x2ccbb7[_0x4a63b1(0x17c)],Number(_0x5b51ad[_0x4a63b1(0x171)]))[_0x4a63b1(0x170)](()=>_0x5dbe37['dbName']):_0x5dbe37[_0x4a63b1(0x16d)];_0x2830c1['sqls'][_0x11d819[_0x4a63b1(0x19a)]]={...buildSqlLockEntry(_0x5b51ad,_0x4ae0a2,_0x18afa4,{'dbName':_0x404876}),'path':_0x11d819[_0x4a63b1(0x16f)],'mode':_0x5ea23c[_0x4a63b1(0x169)]},await archivePreviousSqlFileIfNeeded(_0x2b632b,_0x5ea23c[_0x4a63b1(0x192)],_0x11d819['relativePath']),_0x4daa37[_0x4a63b1(0x17b)]({'sqlCode':_0x11d819[_0x4a63b1(0x19a)],'remoteId':_0x5ea23c[_0x4a63b1(0x173)]});}catch(_0x2f04ce){_0x301b70[_0x4a63b1(0x17b)]({'sqlCode':_0x11d819[_0x4a63b1(0x19a)],'error':_0x2f04ce instanceof Error?_0x2f04ce[_0x4a63b1(0x18f)]:String(_0x2f04ce)});}}return _0x2830c1['lastSync']=new Date()[_0x4a63b1(0x174)](),await writeSqlLockFile(_0x2b632b['lockFilePath'],_0xd5023b),{'ok':_0x301b70[_0x4a63b1(0x195)]===0x0,'data':{'pushed':_0x4daa37,'skipped':_0x1bcd47,'failed':_0x301b70},'message':_0x4a63b1(0x197)+_0x4daa37['length']+_0x4a63b1(0x185)+_0x1bcd47[_0x4a63b1(0x195)]+_0x4a63b1(0x186)+_0x301b70[_0x4a63b1(0x195)]+'\x20failed'};}};async function archivePreviousSqlFileIfNeeded(_0x37614a,_0x5847dc,_0x3279a0){const _0x1934c0=a173_0x186e53;if(!_0x5847dc||_0x5847dc===_0x3279a0)return;const _0x1b5712=join(_0x37614a['sqlRootDir'],_0x5847dc);if(!await fileExists(_0x1b5712))return;const _0x4bdb52=await moveToTrash(_0x37614a['projectRoot'],_0x37614a[_0x1934c0(0x168)],_0x1b5712);await cleanupEmptyDirectories(dirname(_0x1b5712),_0x37614a['sqlRootDir']),void _0x4bdb52;}async function moveToTrash(_0x234428,_0x1580ea,_0x13ac7f){const _0x203a50=new Date()['toISOString']()['replace'](/[:.]/g,'-'),_0x5740a5=relative(_0x234428,_0x13ac7f),_0x3ed478=join(_0x1580ea,_0x203a50,_0x5740a5);return await mkdir(dirname(_0x3ed478),{'recursive':!![]}),await rename(_0x13ac7f,_0x3ed478),_0x3ed478;}async function cleanupEmptyDirectories(_0x250c9f,_0x3f3462){const _0x3d28fa=a173_0x186e53;let _0x490d97=resolve(_0x250c9f);const _0x13e60d=resolve(_0x3f3462);while(_0x490d97['startsWith'](''+_0x13e60d+sep)||_0x490d97===_0x13e60d){if(_0x490d97===_0x13e60d)return;try{const _0x536a60=await readdir(_0x490d97);if(_0x536a60[_0x3d28fa(0x195)]>0x0)return;await rmdir(_0x490d97);}catch{return;}_0x490d97=dirname(_0x490d97);}}async function resolveTargetDbBinding(_0x5bb2dc,_0x1caea1,_0x38c50c){const _0x3bc29a=a173_0x186e53,_0x1f0c81=_0x1caea1[_0x3bc29a(0x166)];if(!_0x1f0c81)return{'dbId':_0x38c50c[_0x3bc29a(0x171)],'dbName':_0x38c50c[_0x3bc29a(0x16d)]};const _0x5aed43=buildDbDirectoryName(_0x38c50c['dbName'],_0x38c50c[_0x3bc29a(0x171)]);if(_0x1f0c81===_0x5aed43)return{'dbId':_0x38c50c['dbId'],'dbName':_0x38c50c[_0x3bc29a(0x16d)]};const _0x41d25d=parseExplicitDbDirectory(_0x1f0c81);if(_0x41d25d!=null)return{'dbId':_0x41d25d,'dbName':await getDbName(_0x5bb2dc,_0x41d25d)[_0x3bc29a(0x170)](()=>undefined)};const _0x2c25c0=await listDatabases(_0x5bb2dc),_0x2da950=_0x2c25c0[_0x3bc29a(0x17f)](_0x5e0462=>buildDbDirectoryName(_0x5e0462['dbName'],_0x5e0462[_0x3bc29a(0x171)])===_0x1f0c81);if(_0x2da950['length']===0x1)return{'dbId':_0x2da950[0x0][_0x3bc29a(0x171)],'dbName':_0x2da950[0x0]['dbName']};if(_0x2da950[_0x3bc29a(0x195)]===0x0)throw CliErrors['validation'](_0x3bc29a(0x18e)+_0x1f0c81+_0x3bc29a(0x187)+_0x1caea1[_0x3bc29a(0x19a)]+'.');const _0x299684=_0x2da950[_0x3bc29a(0x18b)](_0x57d80f=>_0x57d80f[_0x3bc29a(0x16d)]+'\x20('+_0x57d80f[_0x3bc29a(0x171)]+')')[_0x3bc29a(0x18c)](',\x20');throw CliErrors[_0x3bc29a(0x180)](_0x3bc29a(0x175)+_0x1f0c81+'\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20'+_0x1caea1[_0x3bc29a(0x19a)]+':\x20'+_0x299684);}function parseExplicitDbDirectory(_0xad8a88){const _0x4bcd6a=a173_0x186e53,_0x47532b=/^db-(\d+)$/['exec'](_0xad8a88);if(!_0x47532b)return null;const _0x4dfda9=Number(_0x47532b[0x1]);return Number[_0x4bcd6a(0x194)](_0x4dfda9)&&_0x4dfda9>0x0?_0x4dfda9:null;}
|
package/lib/commands/sql/save.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a174_0x1d0864=a174_0x5cdd;function a174_0x5cdd(_0x523812,_0x404deb){_0x523812=_0x523812-0x1a9;const _0x7b083d=a174_0x7b08();let _0x5cdd11=_0x7b083d[_0x523812];return _0x5cdd11;}(function(_0x2a1244,_0x489c42){const _0x184037=a174_0x5cdd,_0x523041=_0x2a1244();while(!![]){try{const _0x36da95=parseInt(_0x184037(0x1b9))/0x1+parseInt(_0x184037(0x1b7))/0x2+-parseInt(_0x184037(0x1bc))/0x3*(-parseInt(_0x184037(0x1be))/0x4)+-parseInt(_0x184037(0x1b3))/0x5+parseInt(_0x184037(0x1b8))/0x6*(parseInt(_0x184037(0x1b4))/0x7)+parseInt(_0x184037(0x1a9))/0x8*(parseInt(_0x184037(0x1b6))/0x9)+parseInt(_0x184037(0x1b2))/0xa*(-parseInt(_0x184037(0x1ab))/0xb);if(_0x36da95===_0x489c42)break;else _0x523041['push'](_0x523041['shift']());}catch(_0x5e6f7d){_0x523041['push'](_0x523041['shift']());}}}(a174_0x7b08,0x45e80));import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';const SQL_SAVE_DEPRECATED_HINT=[a174_0x1d0864(0x1af),'Create\x20new\x20SQL\x20with\x20`rabetbase\x20sql\x20create\x20--name\x20<name>\x20--db-id\x20<id>\x20--mode\x20sql|mybatisXml`.',a174_0x1d0864(0x1aa)][a174_0x1d0864(0x1b0)]('\x0a');export const sqlSave={'service':a174_0x1d0864(0x1ad),'command':'save','description':a174_0x1d0864(0x1c1),'risk':a174_0x1d0864(0x1b5),'requiresAuth':![],'requiresAppCode':![],'flags':[{'name':a174_0x1d0864(0x1bd),'type':'string','required':!![],'description':a174_0x1d0864(0x1ac)},SQLCODE_FLAG_OPTIONAL,{'name':'sqlname','type':a174_0x1d0864(0x1ba),'description':a174_0x1d0864(0x1bf)},{'name':'db','type':a174_0x1d0864(0x1ba),'description':a174_0x1d0864(0x1bb)},{'name':a174_0x1d0864(0x1c0),'type':a174_0x1d0864(0x1ba),'description':a174_0x1d0864(0x1b1)}],async 'validate'(){const _0x4c36b8=a174_0x1d0864;throw CliErrors[_0x4c36b8(0x1ae)](SQL_SAVE_DEPRECATED_HINT);},async 'execute'(){const _0x41780b=a174_0x1d0864;throw CliErrors[_0x41780b(0x1ae)](SQL_SAVE_DEPRECATED_HINT);}};function a174_0x7b08(){const _0x311480=['576910daLOCc','2173710XSIZZo','345989fnsmZf','write','99wbKYwP','741894nxhSOK','42WJpSSA','180760Iohwrz','string','Target\x20database\x20—\x20accepts\x20a\x20numeric\x20ID\x20or\x20database\x20name\x20(e.g.\x20ecommerce_db)','102ymWYib','file','6020TgyWNu','SQL\x20query\x20display\x20name','description','Deprecated:\x20use\x20sql\x20create\x20to\x20create\x20and\x20sql\x20push\x20to\x20update','295864VPmDeN','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`.','121ytcFqT','Path\x20to\x20the\x20SQL\x20file','sql','validation','`rabetbase\x20sql\x20save`\x20has\x20been\x20deprecated.','join','Query\x20description'];a174_0x7b08=function(){return _0x311480;};return a174_0x7b08();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a175_0x4b01d5=a175_0x56d7;(function(_0x19f4dc,_0x443712){const _0x465d5a=a175_0x56d7,_0x12ec47=_0x19f4dc();while(!![]){try{const _0x58b35b=-parseInt(_0x465d5a(0xec))/0x1*(-parseInt(_0x465d5a(0xd0))/0x2)+parseInt(_0x465d5a(0xd6))/0x3+-parseInt(_0x465d5a(0xe6))/0x4+-parseInt(_0x465d5a(0xe7))/0x5*(-parseInt(_0x465d5a(0xd7))/0x6)+-parseInt(_0x465d5a(0xea))/0x7*(parseInt(_0x465d5a(0xdd))/0x8)+parseInt(_0x465d5a(0xc7))/0x9+-parseInt(_0x465d5a(0xe2))/0xa*(parseInt(_0x465d5a(0xc6))/0xb);if(_0x58b35b===_0x443712)break;else _0x12ec47['push'](_0x12ec47['shift']());}catch(_0x557e2f){_0x12ec47['push'](_0x12ec47['shift']());}}}(a175_0x3239,0xb0231));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_0x4b01d5(0xd8);export function buildSqlLockEntry(_0x3fb224,_0x3edc2c,_0x2c2e17,_0x1b8fa8){const _0x5f02ef=a175_0x4b01d5,_0x2fd43b=detectSqlMode(_0x3edc2c);return{'path':buildSqlRelativePath(_0x3fb224[_0x5f02ef(0xcc)],_0x3fb224[_0x5f02ef(0xeb)],_0x1b8fa8?.['dbName'],_0x2fd43b,_0x3fb224['dbId']),'hash':_0x2c2e17,'remoteId':_0x3fb224['id'],'version':_0x3fb224[_0x5f02ef(0xc8)],'dbId':Number(_0x3fb224[_0x5f02ef(0xbf)]),'dbName':_0x1b8fa8?.[_0x5f02ef(0xe4)],'sqlName':_0x3fb224[_0x5f02ef(0xeb)],'sqlConfig':_0x3fb224['sqlConfig']??undefined,'mode':_0x2fd43b};}export function cloneSqlLockData(_0xe08492){const _0x133bff=a175_0x4b01d5;return{'apps':Object['fromEntries'](Object[_0x133bff(0xe0)](_0xe08492[_0x133bff(0xcf)])[_0x133bff(0xe1)](([_0x16973c,_0x495cbb])=>[_0x16973c,{'sqlRoot':_0x495cbb[_0x133bff(0xe9)],'lastSync':_0x495cbb['lastSync'],'sqls':{..._0x495cbb[_0x133bff(0xc2)]}}]))};}export function ensureRemoteSqlContent(_0x3a99ce){const _0x379c5a=a175_0x4b01d5;return _0x3a99ce[_0x379c5a(0xce)]??'';}function a175_0x3239(){const _0x4c7353=['version','length','toLowerCase','yes','sqlCode','question','sqlContent','apps','2026QPKCHj','join','--\x20@lovrabet.','mode','trimStart','\x20-->','1397538dIRiQL','102xhSsEQ','.rabetbase/sql','mybatisXml','syncedAt','\x20[y/N]\x20','push','3246968YNZmvw','path','<!--\x20@lovrabet.','entries','map','2952850dvcFyi','close','dbName','trim','2287424rRjWnn','295755TYPLua','includes','sqlRoot','14hOhZDF','sqlName','1109NNPArL','dbId','stdin','description','sqls','replace','stderr','test','22QwLyvU','907155MGCCDt'];a175_0x3239=function(){return _0x4c7353;};return a175_0x3239();}export function buildLocalSqlFileContent(_0x26c18b,_0xa2f086,_0x1836f8){const _0x1eeeb1=a175_0x4b01d5,_0x196f4c=_0x1836f8?.[_0x1eeeb1(0xd3)]??detectSqlMode(_0xa2f086),_0xc40e23=stripLocalSqlMetadata(_0xa2f086,_0x196f4c)[_0x1eeeb1(0xe5)](),_0x54a605=[...buildMetadataHeaderLines({'sqlCode':_0x26c18b['sqlCode'],'sqlName':_0x26c18b[_0x1eeeb1(0xeb)],'dbId':_0x26c18b[_0x1eeeb1(0xbf)],'dbName':_0x1836f8?.[_0x1eeeb1(0xe4)],'mode':_0x196f4c,'syncedAt':_0x1836f8?.['syncedAt'],'description':_0x1836f8?.[_0x1eeeb1(0xc1)]},_0x196f4c),'',_0xc40e23],_0x3738a0=_0x54a605[_0x1eeeb1(0xd1)]('\x0a');return _0x3738a0['endsWith']('\x0a')?_0x3738a0:_0x3738a0+'\x0a';}export function stripLocalSqlMetadata(_0x53d536,_0xfef4ab){const _0x1c628d=a175_0x4b01d5,_0x30b014=_0x53d536[_0x1c628d(0xc3)](/\r\n/g,'\x0a')['split']('\x0a'),_0x37eab5=[];let _0x29ee10=0x0;if(_0xfef4ab===_0x1c628d(0xd9))while(_0x29ee10<_0x30b014[_0x1c628d(0xc9)]){const _0x34806d=_0x30b014[_0x29ee10]??'';if(/^\s*<!--\s*@lovrabet\./[_0x1c628d(0xc5)](_0x34806d)){_0x29ee10++;continue;}if(_0x34806d['trim']()===''&&_0x29ee10>0x0){_0x29ee10++;continue;}break;}else while(_0x29ee10<_0x30b014[_0x1c628d(0xc9)]){const _0x36f21d=_0x30b014[_0x29ee10]??'';if(/^\s*--\s*@lovrabet\./['test'](_0x36f21d)){_0x29ee10++;continue;}if(_0x36f21d[_0x1c628d(0xe5)]()===''&&_0x29ee10>0x0){_0x29ee10++;continue;}break;}for(;_0x29ee10<_0x30b014[_0x1c628d(0xc9)];_0x29ee10++){_0x37eab5[_0x1c628d(0xdc)](_0x30b014[_0x29ee10]);}return _0x37eab5[_0x1c628d(0xd1)]('\x0a')[_0x1c628d(0xd4)]();}function a175_0x56d7(_0x15aa56,_0x2eaf52){_0x15aa56=_0x15aa56-0xbf;const _0x32398b=a175_0x3239();let _0x56d7aa=_0x32398b[_0x15aa56];return _0x56d7aa;}export function resolveSqlMode(_0x5b90a4,_0x5b0344){const _0x564eb7=a175_0x4b01d5;if(_0x5b0344?.[_0x564eb7(0xd3)])return _0x5b0344[_0x564eb7(0xd3)];return detectSqlMode(_0x5b90a4);}export function resolveSqlFileName(_0x461abe,_0xf168f1,_0x32dc72){const _0x5a9dc1=a175_0x4b01d5;if(_0x32dc72?.[_0x5a9dc1(0xde)])return _0x32dc72[_0x5a9dc1(0xde)];if(_0x32dc72?.[_0x5a9dc1(0xeb)]||_0x32dc72?.['dbName'])return buildSqlRelativePath(_0x461abe,_0x32dc72?.[_0x5a9dc1(0xeb)],_0x32dc72?.['dbName'],resolveSqlMode(_0xf168f1,_0x32dc72),_0x32dc72?.['dbId']);return buildDefaultSqlFileName(_0x461abe,resolveSqlMode(_0xf168f1,_0x32dc72));}export function resolveSqlLocalDir(_0x416b12,_0x25a877){return join(_0x416b12,SQL_LOCAL_REL_DIR,_0x25a877);}export async function confirmForceOverwrite(_0x468b6d){const _0x271fef=a175_0x4b01d5,_0x1774b0=createInterface({'input':process[_0x271fef(0xc0)],'output':process[_0x271fef(0xc4)]}),_0x1b59d5=await new Promise(_0x510c01=>{const _0x18b279=_0x271fef;_0x1774b0[_0x18b279(0xcd)](_0x468b6d+_0x18b279(0xdb),_0x510c01);});return _0x1774b0[_0x271fef(0xe3)](),['y',_0x271fef(0xcb)][_0x271fef(0xe8)](_0x1b59d5[_0x271fef(0xe5)]()[_0x271fef(0xca)]());}export function findSqlLockScope(_0x3c888b,_0xe4c11c){return _0x3c888b['apps'][_0xe4c11c];}function buildMetadataHeaderLines(_0x4dc463,_0x38ad5c){const _0x14f5ad=a175_0x4b01d5,_0x2c8919=[['sqlCode',_0x4dc463['sqlCode']],['sqlName',_0x4dc463['sqlName']],['dbId',_0x4dc463[_0x14f5ad(0xbf)]],['dbName',_0x4dc463[_0x14f5ad(0xe4)]],['mode',_0x4dc463[_0x14f5ad(0xd3)]],['syncedAt',_0x4dc463[_0x14f5ad(0xda)]],[_0x14f5ad(0xc1),_0x4dc463[_0x14f5ad(0xc1)]]];if(_0x38ad5c==='mybatisXml')return _0x2c8919['filter'](([,_0xf10706])=>_0xf10706!==undefined&&_0xf10706!==null&&String(_0xf10706)[_0x14f5ad(0xe5)]()!=='')[_0x14f5ad(0xe1)](([_0x513524,_0xc1d628])=>_0x14f5ad(0xdf)+_0x513524+':\x20'+String(_0xc1d628)+_0x14f5ad(0xd5));return _0x2c8919['filter'](([,_0x55f476])=>_0x55f476!==undefined&&_0x55f476!==null&&String(_0x55f476)[_0x14f5ad(0xe5)]()!=='')[_0x14f5ad(0xe1)](([_0x4fcc65,_0x474335])=>_0x14f5ad(0xd2)+_0x4fcc65+':\x20'+String(_0x474335));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a176_0x3ff0(_0x1e11b1,_0x5357e4){_0x1e11b1=_0x1e11b1-0x1b7;const _0x3c3a1f=a176_0x3c3a();let _0x3ff012=_0x3c3a1f[_0x1e11b1];return _0x3ff012;}const a176_0x19fb26=a176_0x3ff0;(function(_0x499430,_0x177b7a){const _0x20f9bb=a176_0x3ff0,_0x5a22d9=_0x499430();while(!![]){try{const _0xff220f=parseInt(_0x20f9bb(0x1dd))/0x1*(-parseInt(_0x20f9bb(0x1bc))/0x2)+-parseInt(_0x20f9bb(0x1cc))/0x3+-parseInt(_0x20f9bb(0x1d3))/0x4*(parseInt(_0x20f9bb(0x1c3))/0x5)+parseInt(_0x20f9bb(0x1e0))/0x6+parseInt(_0x20f9bb(0x1cb))/0x7*(parseInt(_0x20f9bb(0x1d4))/0x8)+-parseInt(_0x20f9bb(0x1b8))/0x9*(parseInt(_0x20f9bb(0x1be))/0xa)+-parseInt(_0x20f9bb(0x1b7))/0xb*(-parseInt(_0x20f9bb(0x1c5))/0xc);if(_0xff220f===_0x177b7a)break;else _0x5a22d9['push'](_0x5a22d9['shift']());}catch(_0xe70836){_0x5a22d9['push'](_0x5a22d9['shift']());}}}(a176_0x3c3a,0xaaa2e));function a176_0x3c3a(){const _0x10de40=['27650BDKlvq','sql','read','tableData','hash','1905QmYtRO','\x20missing,\x20','290868BRCmjB','path','\x20remote-only','length','sqlName','Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally','54677WfXeZh','1920951OCyKNk','lockKey','\x20unchanged','sqlCode','totalCount','sqls','\x20added,\x20','1552vxgrxV','1304xEAKMh','filePath','paging','lockFilePath','relativePath','map','All\x20SQL\x20queries\x20are\x20in\x20sync.','\x20modified,\x20','bool','25hNdAUZ','status','keys','4416822Fhchmf','374VMhhBo','1746bCbkrJ','has','remote','push','64798KlFZwh','appCode'];a176_0x3c3a=function(){return _0x10de40;};return a176_0x3c3a();}import{listSqlQueries}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile}from'../../core/sql-sync/lock.js';const PAGE_SIZE=0x64;async function fetchAllSqlCodes(_0x3f1d75){const _0x1af6c4=a176_0x3ff0,_0x59a894=[];let _0x3b2711=0x1;while(!![]){const _0x8e1be1=await listSqlQueries(_0x3f1d75,{'currentPage':_0x3b2711,'pageSize':PAGE_SIZE}),_0x1d10f9=_0x8e1be1[_0x1af6c4(0x1c1)]??[];_0x59a894[_0x1af6c4(0x1bb)](..._0x1d10f9['map'](_0x53695a=>_0x53695a[_0x1af6c4(0x1cf)]));if(_0x1d10f9[_0x1af6c4(0x1c8)]===0x0)break;const _0x5e51c2=_0x8e1be1[_0x1af6c4(0x1d6)]?.[_0x1af6c4(0x1d0)];if(_0x5e51c2!=null?_0x59a894[_0x1af6c4(0x1c8)]>=_0x5e51c2:_0x1d10f9[_0x1af6c4(0x1c8)]<PAGE_SIZE)break;_0x3b2711++;}return _0x59a894;}export const sqlStatus={'service':a176_0x19fb26(0x1bf),'command':a176_0x19fb26(0x1de),'description':'Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','risk':a176_0x19fb26(0x1c0),'flags':[{'name':a176_0x19fb26(0x1ba),'type':'boolean','description':a176_0x19fb26(0x1ca)}],async 'execute'(_0xae86d){const _0x450dfe=a176_0x19fb26,_0x15633e=loadSqlProjectConfig(_0xae86d[_0x450dfe(0x1bd)]),_0x30e196=await readSqlLockFile(_0x15633e[_0x450dfe(0x1d7)]),{appLock:_0x28a12e}=ensureSqlLockScope(_0x30e196??createEmptySqlLock(),_0x15633e[_0x450dfe(0x1bd)],_0x15633e['sqlRoot'],_0x450dfe(0x1de)),_0x5804e8=await scanLocalSqlQueries(_0x15633e),_0x9479bb=[],_0x488fe7=[],_0x467ec2=[],_0xb5ceb3=[],_0x548651=new Set(_0x5804e8[_0x450dfe(0x1d9)](_0x3bd956=>_0x3bd956['lockKey']));for(const _0x36dbc5 of _0x5804e8){const _0x3c6be2=await computeSqlFileHash(_0x36dbc5[_0x450dfe(0x1d5)]),_0x2ac847=_0x28a12e[_0x450dfe(0x1d1)][_0x36dbc5[_0x450dfe(0x1cd)]],_0x10c706=!!_0x2ac847&&_0x2ac847[_0x450dfe(0x1c6)]!==_0x36dbc5[_0x450dfe(0x1d8)],_0x15304c=!!_0x2ac847&&!!_0x36dbc5[_0x450dfe(0x1c9)]&&_0x2ac847[_0x450dfe(0x1c9)]!==_0x36dbc5['sqlName'];if(!_0x2ac847)_0x9479bb[_0x450dfe(0x1bb)](_0x36dbc5[_0x450dfe(0x1cd)]);else _0x2ac847[_0x450dfe(0x1c2)]!==_0x3c6be2||_0x10c706||_0x15304c?_0x488fe7['push'](_0x36dbc5[_0x450dfe(0x1cd)]):_0x467ec2[_0x450dfe(0x1bb)](_0x36dbc5[_0x450dfe(0x1cd)]);}for(const _0x2dd990 of Object[_0x450dfe(0x1df)](_0x28a12e['sqls'])){!_0x548651['has'](_0x2dd990)&&_0xb5ceb3[_0x450dfe(0x1bb)](_0x2dd990);}const _0x84805=[];if(_0xae86d[_0x450dfe(0x1dc)](_0x450dfe(0x1ba))){const _0x2be4c4=await fetchAllSqlCodes(_0xae86d[_0x450dfe(0x1bd)]);for(const _0x138255 of _0x2be4c4){!_0x548651[_0x450dfe(0x1b9)](_0x138255)&&!_0x28a12e[_0x450dfe(0x1d1)][_0x138255]&&_0x84805[_0x450dfe(0x1bb)](_0x138255);}}const _0x2d8930=_0x9479bb[_0x450dfe(0x1c8)]===0x0&&_0x488fe7[_0x450dfe(0x1c8)]===0x0&&_0xb5ceb3['length']===0x0&&_0x84805[_0x450dfe(0x1c8)]===0x0;return{'ok':!![],'data':{'added':_0x9479bb,'modified':_0x488fe7,'missing':_0xb5ceb3,'unchanged':_0x467ec2,'remoteOnly':_0x84805},'message':_0x2d8930?_0x450dfe(0x1da):_0x9479bb[_0x450dfe(0x1c8)]+_0x450dfe(0x1d2)+_0x488fe7[_0x450dfe(0x1c8)]+_0x450dfe(0x1db)+_0xb5ceb3[_0x450dfe(0x1c8)]+_0x450dfe(0x1c4)+_0x467ec2['length']+_0x450dfe(0x1ce)+(_0x84805[_0x450dfe(0x1c8)]>0x0?',\x20'+_0x84805[_0x450dfe(0x1c8)]+_0x450dfe(0x1c7):'')};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a177_0x1a7f(){const _0x16a63e=['name','valid','630705ksFCly','32SWQBcC','appCode','451bqQbJC','16154256ASGwbg','212270dHZSCg','flagMissing','sql','indexName','bool','cwd','flatMap','utf-8','Path\x20to\x20the\x20SQL\x20file\x20to\x20validate','\x22\x20not\x20found\x20or\x20not\x20accessible','push','find','index_columns','Comma-separated\x20dataset\x20codes\x20to\x20cross-check\x20table/column\x20names\x20against','--check-indexes\x20requires\x20--schemas.','fields','File\x20not\x20found:\x20','map','split','Inline\x20SQL\x20content\x20to\x20validate\x20(alternative\x20to\x20--file)','length','isSelectOnly','parameters','from','schema:','unshift','schemas','toLowerCase','3844935uXWciw','str','6sfjeFz','check-indexes','SQL\x20schema\x20validation','file','dbtableConfig','size','Validate\x20SQL\x20content\x20without\x20saving\x20(type\x20detection,\x20parameter\x20extraction,\x20optional\x20schema\x20check)','message','trim','joinAudit','4vJAwKc','sqlType','Dataset\x20\x22','columnNames','pkField','2rUNRxR','index_type','indexes','get','primary','tables','4773045vDuuTx','Table\x20\x22','validation','tableName','type','filter','712054paMMfp','isArray','index_name','string','746761JXaHZf'];a177_0x1a7f=function(){return _0x16a63e;};return a177_0x1a7f();}const a177_0x1d47cb=a177_0x53f4;(function(_0x14c086,_0x297aec){const _0x50771a=a177_0x53f4,_0x576066=_0x14c086();while(!![]){try{const _0x102063=parseInt(_0x50771a(0x129))/0x1*(-parseInt(_0x50771a(0x119))/0x2)+-parseInt(_0x50771a(0x12c))/0x3*(parseInt(_0x50771a(0x114))/0x4)+parseInt(_0x50771a(0x11f))/0x5*(parseInt(_0x50771a(0x14f))/0x6)+-parseInt(_0x50771a(0x125))/0x7*(parseInt(_0x50771a(0x12d))/0x8)+parseInt(_0x50771a(0x14d))/0x9+-parseInt(_0x50771a(0x131))/0xa*(parseInt(_0x50771a(0x12f))/0xb)+parseInt(_0x50771a(0x130))/0xc;if(_0x102063===_0x297aec)break;else _0x576066['push'](_0x576066['shift']());}catch(_0x1bd3db){_0x576066['push'](_0x576066['shift']());}}}(a177_0x1a7f,0x788fd));import{readFileSync,existsSync}from'node:fs';import{resolve}from'node:path';import{validateSql}from'../../core/sql-validator.js';function a177_0x53f4(_0x18d49b,_0x59dbe5){_0x18d49b=_0x18d49b-0x10d;const _0x1a7f7d=a177_0x1a7f();let _0x53f464=_0x1a7f7d[_0x18d49b];return _0x53f464;}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':a177_0x1d47cb(0x133),'command':'validate','description':a177_0x1d47cb(0x110),'risk':'read','flags':[{'name':a177_0x1d47cb(0x10d),'type':'string','description':a177_0x1d47cb(0x139)},{'name':a177_0x1d47cb(0x133),'type':a177_0x1d47cb(0x128),'description':a177_0x1d47cb(0x144)},{'name':a177_0x1d47cb(0x14b),'type':'string','description':a177_0x1d47cb(0x13e)},{'name':a177_0x1d47cb(0x150),'type':'boolean','description':'Audit\x20top-level\x20JOIN\x20equality\x20predicates\x20against\x20dataset\x20index\x20metadata'}],async 'execute'(_0x11cdd0){const _0x498a82=a177_0x1d47cb,_0x1189cd=_0x11cdd0['str']('file'),_0x44eb46=_0x11cdd0[_0x498a82(0x14e)](_0x498a82(0x133)),_0x2dec0d=_0x11cdd0[_0x498a82(0x14e)](_0x498a82(0x14b)),_0x217ff3=_0x11cdd0[_0x498a82(0x135)]('check-indexes');if(!_0x1189cd&&!_0x44eb46)throw CliErrors[_0x498a82(0x132)](_0x498a82(0x10d),'Provide\x20--file\x20or\x20--sql');if(_0x217ff3&&!_0x2dec0d)throw CliErrors[_0x498a82(0x121)](_0x498a82(0x13f));let _0xb82870;if(_0x1189cd){const _0x1395d2=resolve(process[_0x498a82(0x136)](),_0x1189cd);if(!existsSync(_0x1395d2))throw CliErrors[_0x498a82(0x121)](_0x498a82(0x141)+_0x1395d2);_0xb82870=readFileSync(_0x1395d2,_0x498a82(0x138));}else _0xb82870=_0x44eb46;const _0x3e9de2=validateSql(_0xb82870),_0x2081e4={'valid':_0x3e9de2[_0x498a82(0x12b)],'sqlType':_0x3e9de2[_0x498a82(0x115)][_0x498a82(0x123)],'isSelectOnly':_0x3e9de2[_0x498a82(0x115)][_0x498a82(0x146)],'isDangerous':_0x3e9de2[_0x498a82(0x115)]['isDangerous'],'tables':_0x3e9de2[_0x498a82(0x11e)],'parameters':_0x3e9de2[_0x498a82(0x147)],'message':_0x3e9de2[_0x498a82(0x111)]};_0x3e9de2[_0x498a82(0x115)]['reason']&&(_0x2081e4['reason']=_0x3e9de2[_0x498a82(0x115)]['reason']);if(_0x2dec0d&&_0x3e9de2[_0x498a82(0x12b)]){const _0x488d06=_0x2dec0d[_0x498a82(0x143)](',')[_0x498a82(0x142)](_0x433db0=>_0x433db0[_0x498a82(0x112)]())[_0x498a82(0x124)](Boolean),_0xd88d29=[],_0x1a99bc=[],_0x33d9b9=filterDbTableBackedDatasets(await listDatasets(_0x11cdd0[_0x498a82(0x12e)])),_0x9b4a88=new Map(_0x33d9b9[_0x498a82(0x142)](_0x56866b=>[_0x56866b['dbtableConfig']?.[_0x498a82(0x122)]?.[_0x498a82(0x14c)](),_0x56866b]));for(const _0x596523 of _0x3e9de2[_0x498a82(0x11e)]){const _0x1ffd70=_0x9b4a88[_0x498a82(0x11c)](_0x596523[_0x498a82(0x14c)]());!_0x1ffd70&&_0xd88d29[_0x498a82(0x13b)](_0x498a82(0x120)+_0x596523+'\x22\x20not\x20found\x20in\x20any\x20dataset');}for(const _0x3cbb42 of _0x488d06){let _0x56daef;try{_0x56daef=await getDatasetDetail(_0x3cbb42);}catch{_0xd88d29[_0x498a82(0x13b)](_0x498a82(0x116)+_0x3cbb42+_0x498a82(0x13a));continue;}assertDatasetIsDbTableBacked(_0x56daef,_0x498a82(0x151));const _0x40918a=Array[_0x498a82(0x126)](_0x56daef[_0x498a82(0x140)])?_0x56daef[_0x498a82(0x140)]:[],_0x1d8e49=new Set(_0x40918a[_0x498a82(0x142)](_0x71143d=>_0x71143d['name']?.[_0x498a82(0x14c)]())),_0x31420a=_0x56daef[_0x498a82(0x10e)]?.[_0x498a82(0x122)]||_0x56daef[_0x498a82(0x122)]||_0x3cbb42;_0x2081e4[_0x498a82(0x149)+_0x31420a]={'code':_0x3cbb42,'tableName':_0x31420a,'fieldCount':_0x1d8e49[_0x498a82(0x10f)],'fields':Array[_0x498a82(0x148)](_0x1d8e49)};if(_0x217ff3){const _0x2cc961=normalizeDatasetIndexes(_0x56daef);_0x1a99bc[_0x498a82(0x13b)]({'tableName':_0x31420a,..._0x2cc961});}}_0xd88d29['length']>0x0&&(_0x2081e4['schemaWarnings']=_0xd88d29),_0x217ff3&&(_0x2081e4[_0x498a82(0x113)]=auditSqlJoinIndexes(_0xb82870,_0x1a99bc));}return{'ok':_0x3e9de2[_0x498a82(0x12b)],'data':_0x2081e4,'message':_0x3e9de2[_0x498a82(0x111)]};}};function normalizeDatasetIndexes(_0x46ca36){const _0x5b4d9c=a177_0x1d47cb,_0x702b90=Array[_0x5b4d9c(0x126)](_0x46ca36?.['dataset']?.[_0x5b4d9c(0x11b)])?_0x46ca36['dataset'][_0x5b4d9c(0x11b)]:Array[_0x5b4d9c(0x126)](_0x46ca36?.[_0x5b4d9c(0x11b)])?_0x46ca36[_0x5b4d9c(0x11b)]:[],_0x324f34=_0x702b90[_0x5b4d9c(0x137)](_0x54d0f0=>{const _0x53a054=_0x5b4d9c,_0x22ba36=Array[_0x53a054(0x126)](_0x54d0f0?.[_0x53a054(0x13d)])?_0x54d0f0[_0x53a054(0x13d)]:Array['isArray'](_0x54d0f0?.[_0x53a054(0x117)])?_0x54d0f0[_0x53a054(0x117)]:Array[_0x53a054(0x126)](_0x54d0f0?.['columns'])?_0x54d0f0['columns']:[],_0x96f591=_0x22ba36[_0x53a054(0x124)](_0x4e4f71=>typeof _0x4e4f71===_0x53a054(0x128))[_0x53a054(0x142)](_0x43e6d3=>_0x43e6d3[_0x53a054(0x112)]())[_0x53a054(0x124)](Boolean);if(_0x96f591['length']===0x0)return[];const _0x26fe9e=[_0x54d0f0?.[_0x53a054(0x134)],_0x54d0f0?.[_0x53a054(0x127)],_0x54d0f0?.[_0x53a054(0x12a)]][_0x53a054(0x13c)](_0x12b971=>typeof _0x12b971===_0x53a054(0x128)&&_0x12b971[_0x53a054(0x112)]()),_0x277e6a=[_0x54d0f0?.[_0x53a054(0x11a)],_0x54d0f0?.[_0x53a054(0x123)]][_0x53a054(0x13c)](_0x5ae9d8=>typeof _0x5ae9d8===_0x53a054(0x128)&&_0x5ae9d8[_0x53a054(0x112)]());return[{..._0x26fe9e?{'name':_0x26fe9e['trim']()}:{},..._0x277e6a?{'type':_0x277e6a[_0x53a054(0x112)]()}:{},'columns':_0x96f591}];}),_0x4ab0df=[..._0x324f34],_0x6a19ee=typeof _0x46ca36?.[_0x5b4d9c(0x10e)]?.[_0x5b4d9c(0x118)]===_0x5b4d9c(0x128)?_0x46ca36[_0x5b4d9c(0x10e)][_0x5b4d9c(0x118)][_0x5b4d9c(0x143)](',')[_0x5b4d9c(0x142)](_0x84f148=>_0x84f148[_0x5b4d9c(0x112)]())[_0x5b4d9c(0x124)](Boolean):[];return _0x6a19ee[_0x5b4d9c(0x145)]>0x0&&_0x4ab0df[_0x5b4d9c(0x14a)]({'type':_0x5b4d9c(0x11d),'columns':_0x6a19ee}),{'indexes':_0x4ab0df,'metadataAvailable':_0x324f34['length']>0x0};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a178_0x1b19(){const _0x1549d0=['101076WIrmAo','1421135VkDbTf','33suNrkj','9lrczAY','11728PRqqcF','8NqXcGt','1598024zwqXCe','1158iayhfr','5089zFFiNJ','333580nNPPZI','47kAkQYp','7794fZJGYK'];a178_0x1b19=function(){return _0x1549d0;};return a178_0x1b19();}(function(_0x38a17a,_0x500367){const _0x48345f=a178_0x4a92,_0x406aff=_0x38a17a();while(!![]){try{const _0x3a0519=parseInt(_0x48345f(0x1c0))/0x1*(parseInt(_0x48345f(0x1ba))/0x2)+-parseInt(_0x48345f(0x1c1))/0x3*(-parseInt(_0x48345f(0x1bb))/0x4)+parseInt(_0x48345f(0x1b7))/0x5+parseInt(_0x48345f(0x1bd))/0x6*(-parseInt(_0x48345f(0x1be))/0x7)+-parseInt(_0x48345f(0x1bc))/0x8*(parseInt(_0x48345f(0x1b9))/0x9)+-parseInt(_0x48345f(0x1bf))/0xa+parseInt(_0x48345f(0x1b8))/0xb*(-parseInt(_0x48345f(0x1b6))/0xc);if(_0x3a0519===_0x500367)break;else _0x406aff['push'](_0x406aff['shift']());}catch(_0x3655ab){_0x406aff['push'](_0x406aff['shift']());}}}(a178_0x1b19,0x289c4));import{taskStatus}from'../../commands/task/status.js';function a178_0x4a92(_0x1369e7,_0x57c88d){_0x1369e7=_0x1369e7-0x1b6;const _0x1b19be=a178_0x1b19();let _0x4a9218=_0x1b19be[_0x1369e7];return _0x4a9218;}export const taskDefinitions=[taskStatus];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a179_0x29f5ba=a179_0x1707;(function(_0x33a1ca,_0x1e91db){const _0x41b068=a179_0x1707,_0x462da2=_0x33a1ca();while(!![]){try{const _0x4a47f2=-parseInt(_0x41b068(0xbb))/0x1*(parseInt(_0x41b068(0xbf))/0x2)+-parseInt(_0x41b068(0xc2))/0x3*(parseInt(_0x41b068(0xbc))/0x4)+parseInt(_0x41b068(0xc4))/0x5+-parseInt(_0x41b068(0xc6))/0x6+-parseInt(_0x41b068(0xb9))/0x7+-parseInt(_0x41b068(0xc7))/0x8*(parseInt(_0x41b068(0xc3))/0x9)+-parseInt(_0x41b068(0xb2))/0xa*(-parseInt(_0x41b068(0xc1))/0xb);if(_0x4a47f2===_0x1e91db)break;else _0x462da2['push'](_0x462da2['shift']());}catch(_0x23c0ee){_0x462da2['push'](_0x462da2['shift']());}}}(a179_0x4f5e,0x4a035));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_0x4f5e(){const _0x5411a7=['string','23372gjmjcH','str','2519znOPQd','2421YDBZlP','18TgMYeF','2368225xHeJFw','task','2804112oqIxKd','1520472KIKXNn','Query\x20an\x20asynchronous\x20task;\x20repeat\x20for\x20PENDING\x20or\x20PROCESSING\x20until\x20SUCCESS\x20or\x20FAILED','compress','appCode','89590iveRqh','trim','cookie','taskId','read','task-id','Task\x20status\x20response\x20id\x20mismatch:\x20requested\x20','3859660UCWgCa','isTerminal','19ozAgLM','2980kNzTAm','flagMissing'];a179_0x4f5e=function(){return _0x5411a7;};return a179_0x4f5e();}function a179_0x1707(_0x395481,_0x59cdab){_0x395481=_0x395481-0xaf;const _0x4f5e6b=a179_0x4f5e();let _0x170771=_0x4f5e6b[_0x395481];return _0x170771;}export const taskStatus={'service':a179_0x29f5ba(0xc5),'command':'status','description':a179_0x29f5ba(0xaf),'risk':a179_0x29f5ba(0xb6),'defaultOutputFormat':a179_0x29f5ba(0xb0),'structuredErrors':!![],'flags':[{'name':a179_0x29f5ba(0xb7),'type':a179_0x29f5ba(0xbe),'required':!![],'description':'Task\x20id\x20returned\x20by\x20an\x20asynchronous\x20platform\x20command'},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x109032){const _0x133dfe=a179_0x29f5ba;if(!_0x109032[_0x133dfe(0xc0)](_0x133dfe(0xb7))[_0x133dfe(0xb3)]())throw CliErrors[_0x133dfe(0xbd)](_0x133dfe(0xb7));},async 'execute'(_0x15d5c8){const _0x310d88=a179_0x29f5ba,_0xf9df48=_0x15d5c8['str']('task-id')[_0x310d88(0xb3)](),_0x211a03=normalizeAsyncTask(await getAsyncTaskStatus(_0xf9df48,_0x15d5c8[_0x310d88(0xb1)],_0x15d5c8[_0x310d88(0xb4)]));if(_0x211a03[_0x310d88(0xb5)]!==_0xf9df48)throw CliErrors['apiError'](_0x310d88(0xb8)+_0xf9df48+',\x20received\x20'+_0x211a03[_0x310d88(0xb5)]+'.');const _0x5738ef=buildAsyncTaskStatusCommand(_0x211a03[_0x310d88(0xb5)],_0x15d5c8['appCode']);return{'ok':!![],'message':asyncTaskMessage(_0x211a03),'data':{'appCode':_0x15d5c8[_0x310d88(0xb1)],..._0x211a03,'query':_0x211a03[_0x310d88(0xba)]?null:{'command':_0x5738ef}}};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a180_0x770b7c=a180_0x3377;function a180_0x2e87(){const _0x5c1555=['workspace\x20add','3572346tBkhEg','153fZkEAg','5750efOPxV','add','248648ebvxHM','workspace','Register\x20an\x20app\x20profile\x20in\x20the\x20current\x20workspace\x20(or\x20--global)','6231281IteAdY','2017072PTWjrR','26895bKORla','2055630heptvv','name','301280KPgkUI','1nvGmZf','36FGCBly'];a180_0x2e87=function(){return _0x5c1555;};return a180_0x2e87();}(function(_0x13f47d,_0x2fa709){const _0x1ee270=a180_0x3377,_0x2fe230=_0x13f47d();while(!![]){try{const _0x118b9c=parseInt(_0x1ee270(0x1d0))/0x1*(parseInt(_0x1ee270(0x1cd))/0x2)+-parseInt(_0x1ee270(0x1c3))/0x3+-parseInt(_0x1ee270(0x1cb))/0x4+parseInt(_0x1ee270(0x1cf))/0x5*(-parseInt(_0x1ee270(0x1c1))/0x6)+parseInt(_0x1ee270(0x1ca))/0x7+parseInt(_0x1ee270(0x1c7))/0x8*(-parseInt(_0x1ee270(0x1c4))/0x9)+-parseInt(_0x1ee270(0x1c5))/0xa*(-parseInt(_0x1ee270(0x1cc))/0xb);if(_0x118b9c===_0x2fa709)break;else _0x2fe230['push'](_0x2fe230['shift']());}catch(_0x595f03){_0x2fe230['push'](_0x2fe230['shift']());}}}(a180_0x2e87,0xb465e));function a180_0x3377(_0x2e11b3,_0x431e1a){_0x2e11b3=_0x2e11b3-0x1c1;const _0x2e876e=a180_0x2e87();let _0x3377af=_0x2e876e[_0x2e11b3];return _0x3377af;}import{buildAppAddFlags,runAppAdd,validateAppName}from'../../commands/common/app-registry.js';export const workspaceAddDefinition={'service':a180_0x770b7c(0x1c8),'command':a180_0x770b7c(0x1c6),'description':a180_0x770b7c(0x1c9),'risk':'write','requiresAuth':![],'requiresAppCode':![],'args':[{'name':a180_0x770b7c(0x1ce),'description':'App\x20profile\x20name','required':!![]}],'flags':buildAppAddFlags(),'validate':_0x3d20f7=>validateAppName(_0x3d20f7,'workspace\x20add'),'execute':_0x21f522=>runAppAdd(_0x21f522,a180_0x770b7c(0x1c2))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a181_0x5dc782=a181_0x4119;(function(_0x1b08e1,_0x265eca){const _0x5048af=a181_0x4119,_0x21a833=_0x1b08e1();while(!![]){try{const _0x35f74a=-parseInt(_0x5048af(0x111))/0x1+parseInt(_0x5048af(0xfd))/0x2*(parseInt(_0x5048af(0x106))/0x3)+parseInt(_0x5048af(0x117))/0x4*(-parseInt(_0x5048af(0xf4))/0x5)+parseInt(_0x5048af(0x113))/0x6*(parseInt(_0x5048af(0x11c))/0x7)+-parseInt(_0x5048af(0x123))/0x8*(parseInt(_0x5048af(0x127))/0x9)+parseInt(_0x5048af(0xf6))/0xa*(parseInt(_0x5048af(0xf1))/0xb)+parseInt(_0x5048af(0x114))/0xc*(parseInt(_0x5048af(0xf5))/0xd);if(_0x35f74a===_0x265eca)break;else _0x21a833['push'](_0x21a833['shift']());}catch(_0x426a57){_0x21a833['push'](_0x21a833['shift']());}}}(a181_0x46f4,0x35547));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';function a181_0x4119(_0x5e03fe,_0x495943){_0x5e03fe=_0x5e03fe-0xec;const _0x46f46c=a181_0x46f4();let _0x41197e=_0x46f46c[_0x5e03fe];return _0x41197e;}import{workspaceAddDefinition}from'../../commands/workspace/add.js';import{workspaceRemoveDefinition}from'../../commands/workspace/remove.js';const WORKSPACE_USAGE=CLI_BIN_NAME+a181_0x5dc782(0x11e),SAFE_PROFILE_KEYS=[a181_0x5dc782(0x100),a181_0x5dc782(0x122),'apiDir','format','pageSize','riskLevel',a181_0x5dc782(0x116)],workspaceFlags=[{'name':'app','type':a181_0x5dc782(0x109),'description':a181_0x5dc782(0xee)},{'name':'appcode','type':'string','description':a181_0x5dc782(0xf0)},{'name':a181_0x5dc782(0x122),'type':a181_0x5dc782(0x109),'description':a181_0x5dc782(0x107),'enum':[...RABETBASE_ENV_VALUES]},{'name':a181_0x5dc782(0xfa),'type':a181_0x5dc782(0x109),'description':'API\x20directory\x20path\x20for\x20this\x20workspace\x20app\x20profile'},{'name':a181_0x5dc782(0x126),'type':'string','description':a181_0x5dc782(0x121),'enum':[...RABETBASE_OUTPUT_FORMAT_VALUES]},{'name':a181_0x5dc782(0x10e),'type':a181_0x5dc782(0xf2),'description':a181_0x5dc782(0x105)},{'name':'riskLevel','type':a181_0x5dc782(0x109),'description':a181_0x5dc782(0xef),'enum':[...RISK_LEVEL_VALUES]},{'name':a181_0x5dc782(0x116),'type':a181_0x5dc782(0x109),'description':'Locale\x20for\x20this\x20workspace\x20app\x20profile'}];function isRecord(_0x2f35bd){const _0x5754b6=a181_0x5dc782;return!!_0x2f35bd&&typeof _0x2f35bd===_0x5754b6(0x10d)&&!Array[_0x5754b6(0xed)](_0x2f35bd);}function assertValidAppcode(_0x3383ec){const _0x13db1e=a181_0x5dc782,{valid:_0x133e20,message:_0x57d54e}=validateAppcode(_0x3383ec);if(!_0x133e20)throw CliErrors[_0x13db1e(0xff)]('Invalid\x20appcode:\x20'+_0x3383ec,_0x57d54e);}function sanitizeProfile(_0x4b6f23){if(!isRecord(_0x4b6f23))return{};const _0x2a5ede={};for(const _0x4f679c of SAFE_PROFILE_KEYS){if(_0x4b6f23[_0x4f679c]!==undefined)_0x2a5ede[_0x4f679c]=_0x4b6f23[_0x4f679c];}return _0x2a5ede;}function cloneProfile(_0x2c3be7){return isRecord(_0x2c3be7)?{..._0x2c3be7}:{};}function collectWorkspaceProfileOverrides(_0x562b79){const _0x2730ed=a181_0x5dc782,_0x1f0dad={},_0x35575e=_0x562b79[_0x2730ed(0x115)]('env'),_0x19e310=_0x562b79[_0x2730ed(0x115)]('apiDir'),_0x5dfa90=_0x562b79[_0x2730ed(0x115)]('defaultFormat'),_0x5eb972=_0x562b79[_0x2730ed(0x11a)](_0x2730ed(0x10e)),_0x37b658=_0x562b79[_0x2730ed(0x115)](_0x2730ed(0x110)),_0xf61fa6=_0x562b79['str'](_0x2730ed(0x116));if(_0x35575e)_0x1f0dad[_0x2730ed(0x122)]=_0x35575e;if(_0x19e310)_0x1f0dad['apiDir']=_0x19e310;if(_0x5dfa90)_0x1f0dad['format']=_0x5dfa90;if(_0x5eb972!==undefined&&_0x5eb972!=='')_0x1f0dad[_0x2730ed(0x10e)]=Number(_0x5eb972);if(_0x37b658)_0x1f0dad[_0x2730ed(0x110)]=_0x37b658;if(_0xf61fa6)_0x1f0dad[_0x2730ed(0x116)]=_0xf61fa6;return _0x1f0dad;}async function validateWorkspaceArgs(_0x592ee9){const _0x59da4f=a181_0x5dc782,_0x4f9f73=_0x592ee9[_0x59da4f(0x115)]('app')['trim'](),_0x11cbf5=_0x592ee9[_0x59da4f(0x115)](_0x59da4f(0x100))[_0x59da4f(0xfe)]();if(!_0x4f9f73&&!_0x11cbf5)throw CliErrors[_0x59da4f(0xff)](_0x59da4f(0xf7),_0x59da4f(0xfc)+CLI_BIN_NAME+_0x59da4f(0x103)+CLI_BIN_NAME+_0x59da4f(0x10c));if(_0x11cbf5)assertValidAppcode(_0x11cbf5);}function resolveKnownApps(){const _0x50b8cb=a181_0x5dc782,{config:_0x510d45,layers:_0x181be8}=readRawConfigWithLayers(),_0x4eb49d=isRecord(_0x510d45[_0x50b8cb(0x10b)])?_0x510d45[_0x50b8cb(0x10b)]:{},_0x5af3d2=isRecord(_0x181be8[_0x50b8cb(0xec)][_0x50b8cb(0x10b)])?_0x181be8[_0x50b8cb(0xec)][_0x50b8cb(0x10b)]:{};return{..._0x5af3d2,..._0x4eb49d};}function a181_0x46f4(){const _0x3708c8=['env','3976eBbLgA','\x22\x20not\x20found.','keys','defaultFormat','5373IPCLWl','globalConfig','isArray','App\x20profile\x20name\x20to\x20use\x20in\x20this\x20workspace','Risk\x20level\x20for\x20this\x20workspace\x20app\x20profile','App\x20code\x20to\x20bind\x20to\x20this\x20workspace','11hrTEGV','number','length','512545gZzvzf','45396SalsOH','3651020OseBce','Missing\x20workspace\x20app\x20selector.','App\x20\x22','updated','apiDir','write','Use\x20`','253412QBOzHN','trim','validation','appcode','init','\x20workspace\x20','\x20workspace\x20init\x20--appcode\x20<code>`\x20or\x20`',').\x20Config:\x20','Default\x20page\x20size\x20for\x20this\x20workspace\x20app\x20profile','3AOosyx','Target\x20environment','project','string','use','apps','\x20workspace\x20use\x20--app\x20<name>`.','object','pageSize','\x20(appcode:\x20','riskLevel','40350SzPbHw','Pass\x20--appcode\x20<code>,\x20or\x20choose\x20one\x20of:\x20','6YvCiZZ','288aAUPyL','str','locale','4xAUJTa','join','workspace.','flag','.\x20Credentials:\x20not\x20written.','576737vmsVur','initialized','\x20workspace\x20<init|use>\x20--app\x20<name>\x20[--appcode\x20<code>]','app','workspace','Default\x20output\x20format\x20for\x20this\x20workspace\x20app\x20profile'];a181_0x46f4=function(){return _0x3708c8;};return a181_0x46f4();}async function configureWorkspace(_0x3b85af,_0x1fa232){const _0x5557af=a181_0x5dc782,_0xf4792f=_0x3b85af['str']('app')[_0x5557af(0xfe)](),_0x3e76e6=_0x3b85af[_0x5557af(0x115)](_0x5557af(0x100))[_0x5557af(0xfe)](),_0x2c9272=_0xf4792f||_0x3e76e6;if(!_0x2c9272)throw CliErrors[_0x5557af(0xff)](_0x5557af(0xf7),_0x5557af(0xfc)+CLI_BIN_NAME+'\x20workspace\x20init\x20--appcode\x20<code>`\x20or\x20`'+CLI_BIN_NAME+_0x5557af(0x10c));if(_0x3e76e6)assertValidAppcode(_0x3e76e6);const _0x145dc4=resolveWriteConfigPath(_0x5557af(0x108)),_0x5bb61c=readConfigFile(_0x145dc4),_0x5b30f7=resolveKnownApps(),_0x1f1a4c=isRecord(_0x5bb61c['apps'])?{..._0x5bb61c[_0x5557af(0x10b)]}:{},_0x2cd063=cloneProfile(_0x1f1a4c[_0x2c9272]),_0xd3aa8d=sanitizeProfile(_0x5b30f7[_0x2c9272]),_0x3b39f6=_0x3e76e6?{}:_0xd3aa8d,_0x3b906=_0x3e76e6||_0x3b39f6[_0x5557af(0x100)];if(!_0x3b906){const _0x585edd=Object[_0x5557af(0x125)](_0x5b30f7),_0x50f267=_0x585edd[_0x5557af(0xf3)]===0x0?_0x5557af(0xfc)+CLI_BIN_NAME+_0x5557af(0x102)+_0x1fa232+'\x20--app\x20'+_0x2c9272+'\x20--appcode\x20<code>`.':_0x5557af(0x112)+_0x585edd[_0x5557af(0x118)](',\x20');throw CliErrors[_0x5557af(0xff)](_0x5557af(0xf8)+_0x2c9272+_0x5557af(0x124),_0x50f267);}assertValidAppcode(String(_0x3b906));const _0x49fd6e={..._0x3b39f6,..._0x2cd063,'appcode':String(_0x3b906),...collectWorkspaceProfileOverrides(_0x3b85af)};return _0x1f1a4c[_0x2c9272]=_0x49fd6e,_0x5bb61c[_0x5557af(0x10b)]=_0x1f1a4c,_0x5bb61c['defaultApp']=_0x2c9272,delete _0x5bb61c[_0x5557af(0x100)],delete _0x5bb61c[_0x5557af(0x11f)],_0x49fd6e['env']&&(_0x5bb61c[_0x5557af(0x122)]=_0x49fd6e['env']),writeConfigFile(_0x145dc4,_0x5bb61c),{'ok':!![],'message':'Workspace\x20'+(_0x1fa232===_0x5557af(0x101)?_0x5557af(0x11d):_0x5557af(0xf9))+':\x20'+_0x2c9272+_0x5557af(0x10f)+_0x49fd6e['appcode']+_0x5557af(0x104)+_0x145dc4+_0x5557af(0x11b),'data':{'operation':_0x5557af(0x119)+_0x1fa232,'configPath':_0x145dc4,'app':_0x2c9272,'appcode':_0x49fd6e[_0x5557af(0x100)],'env':_0x49fd6e[_0x5557af(0x122)]??null,'credentialsWritten':![]}};}const workspaceInitDefinition={'service':a181_0x5dc782(0x120),'command':'init','description':'Initialize\x20the\x20current\x20workspace\x20app\x20binding','risk':a181_0x5dc782(0xfb),'requiresAuth':![],'requiresAppCode':![],'args':[],'flags':workspaceFlags,'validate':validateWorkspaceArgs,'execute':_0x4f8776=>configureWorkspace(_0x4f8776,a181_0x5dc782(0x101))},workspaceUseDefinition={'service':a181_0x5dc782(0x120),'command':a181_0x5dc782(0x10a),'description':'Switch\x20the\x20current\x20workspace\x20app\x20binding','risk':'write','requiresAuth':![],'requiresAppCode':![],'args':[],'flags':workspaceFlags,'validate':validateWorkspaceArgs,'execute':_0x1423bc=>configureWorkspace(_0x1423bc,a181_0x5dc782(0x10a))};export const workspaceDefinitions=[workspaceInitDefinition,workspaceUseDefinition,workspaceAddDefinition,workspaceRemoveDefinition];export{WORKSPACE_USAGE};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a182_0x75334a=a182_0x154f;(function(_0x255eab,_0x4e8719){const _0x45b9c2=a182_0x154f,_0x3752d3=_0x255eab();while(!![]){try{const _0x318d23=-parseInt(_0x45b9c2(0x10f))/0x1+parseInt(_0x45b9c2(0x10d))/0x2*(parseInt(_0x45b9c2(0x103))/0x3)+-parseInt(_0x45b9c2(0x10a))/0x4*(-parseInt(_0x45b9c2(0x10b))/0x5)+-parseInt(_0x45b9c2(0x102))/0x6+-parseInt(_0x45b9c2(0x10c))/0x7+parseInt(_0x45b9c2(0x110))/0x8+parseInt(_0x45b9c2(0x104))/0x9;if(_0x318d23===_0x4e8719)break;else _0x3752d3['push'](_0x3752d3['shift']());}catch(_0x285470){_0x3752d3['push'](_0x3752d3['shift']());}}}(a182_0x112b,0x9668a));import{buildAppRemoveFlags,runAppRemove,validateAppName}from'../../commands/common/app-registry.js';function a182_0x154f(_0x312695,_0x2fafa7){_0x312695=_0x312695-0x102;const _0x112b05=a182_0x112b();let _0x154fab=_0x112b05[_0x312695];return _0x154fab;}export const workspaceRemoveDefinition={'service':a182_0x75334a(0x105),'command':a182_0x75334a(0x109),'description':a182_0x75334a(0x108),'risk':'high-risk-write','requiresAuth':![],'requiresAppCode':![],'args':[{'name':a182_0x75334a(0x10e),'description':a182_0x75334a(0x106),'required':!![]}],'flags':buildAppRemoveFlags(),'validate':_0x30158b=>validateAppName(_0x30158b,a182_0x75334a(0x107)),'execute':_0x127fd7=>runAppRemove(_0x127fd7,'workspace\x20remove')};function a182_0x112b(){const _0x12d1b9=['Remove\x20an\x20app\x20profile\x20from\x20the\x20current\x20workspace\x20(or\x20--global)','remove','1166644iAaoko','5BXFamB','6145055YvNoHf','386330JnXEpC','name','615548thiXeL','7216528EXvEiR','1806582vpdjxI','9jxkjqp','5736258eYCdEw','workspace','App\x20profile\x20name\x20to\x20remove','workspace\x20remove'];a182_0x112b=function(){return _0x12d1b9;};return a182_0x112b();}
|
package/lib/config/schema.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a183_0x5afed9=a183_0x4b80;(function(_0x362cc2,_0x37cbfd){const _0x415b8e=a183_0x4b80,_0x458091=_0x362cc2();while(!![]){try{const _0x38ceb7=parseInt(_0x415b8e(0xa2))/0x1+parseInt(_0x415b8e(0xaf))/0x2+parseInt(_0x415b8e(0xb1))/0x3*(-parseInt(_0x415b8e(0xab))/0x4)+parseInt(_0x415b8e(0xac))/0x5*(parseInt(_0x415b8e(0xb7))/0x6)+-parseInt(_0x415b8e(0xa3))/0x7+parseInt(_0x415b8e(0xb9))/0x8*(parseInt(_0x415b8e(0xb5))/0x9)+-parseInt(_0x415b8e(0xbe))/0xa;if(_0x38ceb7===_0x37cbfd)break;else _0x458091['push'](_0x458091['shift']());}catch(_0x4d2c2a){_0x458091['push'](_0x458091['shift']());}}}(a183_0x3048,0xc91bc));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=[a183_0x5afed9(0xc1),a183_0x5afed9(0xbc),a183_0x5afed9(0xaa),a183_0x5afed9(0x9e),a183_0x5afed9(0xae)];export const TOP_LEVEL_CONFIG_KEYS=new Set(['appcode',a183_0x5afed9(0xad),a183_0x5afed9(0xaa),'format',a183_0x5afed9(0xc1),'accessKey','apiDir']);export const CONFIG_ENUM_VALUES={'env':[...RABETBASE_ENV_VALUES],'format':[...RABETBASE_OUTPUT_FORMAT_VALUES]};function a183_0x4b80(_0x537d70,_0x285104){_0x537d70=_0x537d70-0x98;const _0x3048f3=a183_0x3048();let _0x4b80ba=_0x3048f3[_0x537d70];return _0x4b80ba;}export function formatConfigKeyList(_0xd81866){const _0x5f257c=a183_0x5afed9;return[..._0xd81866][_0x5f257c(0x99)](',\x20');}export function getTopLevelConfigKeyList(){return[...TOP_LEVEL_CONFIG_KEYS];}export function isTopLevelConfigKey(_0xd63a84){return TOP_LEVEL_CONFIG_KEYS['has'](_0xd63a84);}export function getTopLevelConfigKeySummary(){return formatConfigKeyList(getTopLevelConfigKeyList());}export function getConfigCommandKeyDescription(){const _0x3464ce=a183_0x5afed9;return _0x3464ce(0xa8)+getTopLevelConfigKeySummary()+')';}export const APP_PROFILE_FLAG_KEY_MAP={'env':a183_0x5afed9(0xad),'apiDir':a183_0x5afed9(0x9c),'cookie':a183_0x5afed9(0xc1),'accessKey':a183_0x5afed9(0xbc),'defaultFormat':'format','pageSize':a183_0x5afed9(0xa1),'riskLevel':a183_0x5afed9(0xae),'locale':a183_0x5afed9(0xaa)};export function getAppProfileFlagDefs(){const _0x5b3ed3=a183_0x5afed9;return[{'name':_0x5b3ed3(0xad),'type':_0x5b3ed3(0xbf),'description':_0x5b3ed3(0x9d),'enum':[...RABETBASE_ENV_VALUES]},{'name':_0x5b3ed3(0x9c),'type':_0x5b3ed3(0xbf),'description':'API\x20directory\x20path'},{'name':_0x5b3ed3(0xc1),'type':'string','description':_0x5b3ed3(0xba),'hidden':!![]},{'name':_0x5b3ed3(0xbc),'type':_0x5b3ed3(0xbf),'description':'Access\x20key','hidden':!![]},{'name':_0x5b3ed3(0xb4),'type':_0x5b3ed3(0xbf),'description':_0x5b3ed3(0xa0),'enum':[...RABETBASE_OUTPUT_FORMAT_VALUES]},{'name':_0x5b3ed3(0xa1),'type':'number','description':_0x5b3ed3(0xa6)},{'name':'riskLevel','type':_0x5b3ed3(0xbf),'description':_0x5b3ed3(0xb2),'enum':[...RISK_LEVEL_VALUES]},{'name':'locale','type':_0x5b3ed3(0xbf),'description':_0x5b3ed3(0xa4)}];}export function collectAppProfileOverrides(_0x589b13){const _0x234f28=a183_0x5afed9,_0x472343={};for(const [_0x3e977c,_0x21a3b9]of Object[_0x234f28(0xb0)](APP_PROFILE_FLAG_KEY_MAP)){const _0x354e92=_0x589b13(_0x3e977c);if(!_0x354e92)continue;_0x472343[_0x21a3b9]=_0x21a3b9==='pageSize'?Number(_0x354e92):_0x354e92;}return _0x472343;}export function buildAppProfileListFields(_0x535095){const _0x1542d5=a183_0x5afed9;return{'env':_0x535095[_0x1542d5(0xad)]??null,'apiDir':_0x535095[_0x1542d5(0x9c)]??null,'hasCookie':!!_0x535095[_0x1542d5(0xc1)],'hasAccessKey':!!_0x535095[_0x1542d5(0xbc)],'format':_0x535095[_0x1542d5(0x9e)]??null,'pageSize':_0x535095['pageSize']??null,'riskLevel':_0x535095[_0x1542d5(0xae)]??null,'locale':_0x535095[_0x1542d5(0xaa)]??null};}export function buildAppDoctorFields(_0x13a729,_0x5b8bf2){const _0x3de744=a183_0x5afed9;return{'env':{'value':_0x13a729['env']||_0x5b8bf2[_0x3de744(0xad)],'source':_0x13a729['env']?_0x3de744(0xbb):'inherit'},'apiDir':{'value':_0x13a729[_0x3de744(0x9c)]||_0x5b8bf2[_0x3de744(0x9c)],'source':_0x13a729['apiDir']?_0x3de744(0xbb):_0x3de744(0xc0)},'cookie':{'value':_0x13a729['cookie']||_0x5b8bf2[_0x3de744(0xc1)],'source':_0x13a729['cookie']?'app':_0x3de744(0xc0)},'accessKey':{'value':_0x13a729[_0x3de744(0xbc)]||_0x5b8bf2[_0x3de744(0xbc)],'source':_0x13a729[_0x3de744(0xbc)]?_0x3de744(0xbb):_0x3de744(0xc0)}};}export function buildCanonicalAppConfig(_0x463b4d,_0x57db20){const _0xdca2fe=a183_0x5afed9,_0x5f59ee=_0x463b4d[_0xdca2fe(0x98)](_0x49a125=>String(_0x49a125||'')[_0xdca2fe(0xa9)]())[_0xdca2fe(0xb8)](Boolean);if(_0x5f59ee[_0xdca2fe(0xb3)]===0x0)return{};const _0x288778={};for(const _0x74a277 of _0x5f59ee){_0x288778[_0x74a277]=_0x57db20?{'appcode':_0x74a277,'env':_0x57db20}:{'appcode':_0x74a277};}return{'apps':_0x288778,'defaultApp':_0x5f59ee[0x0]};}export function buildCanonicalProjectConfig(_0x25cb8f,_0x49c742){const _0x1d4834=a183_0x5afed9,{appCodes:appCodes=[],env:_0x26749c,metadata:_0x297590}=_0x49c742,_0x30e7ed={..._0x25cb8f,..._0x297590||{}};delete _0x30e7ed[_0x1d4834(0x9a)],delete _0x30e7ed['app'];if(_0x26749c)_0x30e7ed[_0x1d4834(0xad)]=_0x26749c;else!_0x30e7ed[_0x1d4834(0xad)]&&(_0x30e7ed[_0x1d4834(0xad)]=DEFAULT_CONFIG_VALUES['env']);const _0x20fd72=buildCanonicalAppConfig(appCodes,_0x30e7ed[_0x1d4834(0xad)]);return Object[_0x1d4834(0xbd)](_0x20fd72)[_0x1d4834(0xb3)]>0x0&&(_0x30e7ed[_0x1d4834(0xa5)]=_0x20fd72['apps'],_0x30e7ed[_0x1d4834(0x9b)]=_0x20fd72['defaultApp']),_0x30e7ed;}function a183_0x3048(){const _0x2fe2e2=['length','defaultFormat','117UkgVwI','zh-CN','6YbNkZB','filter','648392OmfARg','Auth\x20cookie','app','accessKey','keys','15505700jHkUTM','string','inherit','cookie','map','join','appcode','defaultApp','apiDir','Target\x20environment','format','en-US','Default\x20output\x20format\x20for\x20this\x20app\x20(profile)','pageSize','1148134HWfkKa','208502NNZjsZ','Locale','apps','Default\x20page\x20size','toLowerCase','Config\x20key\x20(','trim','locale','8LFZvAW','3516085uzIHvS','env','riskLevel','1448468UOgBSw','entries','1837689CjhzAE','Risk\x20level'];a183_0x3048=function(){return _0x2fe2e2;};return a183_0x3048();}const LOCALE_MAP={'zh':'zh-CN','zh-cn':a183_0x5afed9(0xb6),'zh_cn':'zh-CN','en':a183_0x5afed9(0x9f),'en-us':'en-US','en_us':a183_0x5afed9(0x9f)};export function normalizeLocale(_0x2b7b57){const _0x114de2=a183_0x5afed9;if(!_0x2b7b57)return null;return LOCALE_MAP[_0x2b7b57[_0x114de2(0xa7)]()]??null;}
|
package/lib/constant/cdn.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a184_0x36954b=a184_0x14e8;function a184_0x25c1(){const _0x58b45d=['https://g.lovrabet.com/dist/rabetbase-cli/config/index.json','55170JQwRzM','472pIcUfc','1671816bHckRl','905FdNvnh','1169651qIhicx','4044260PEUltC','289866SpoYxL','306qMStgx','909GqcOfq','13362sRFxHA'];a184_0x25c1=function(){return _0x58b45d;};return a184_0x25c1();}function a184_0x14e8(_0x320869,_0xc8feef){_0x320869=_0x320869-0x1a2;const _0x25c1e1=a184_0x25c1();let _0x14e86f=_0x25c1e1[_0x320869];return _0x14e86f;}(function(_0x519f44,_0x87542f){const _0x21d06b=a184_0x14e8,_0x54eba2=_0x519f44();while(!![]){try{const _0x378658=parseInt(_0x21d06b(0x1aa))/0x1+parseInt(_0x21d06b(0x1ab))/0x2*(parseInt(_0x21d06b(0x1ac))/0x3)+parseInt(_0x21d06b(0x1a6))/0x4+-parseInt(_0x21d06b(0x1a7))/0x5*(-parseInt(_0x21d06b(0x1a2))/0x6)+-parseInt(_0x21d06b(0x1a8))/0x7+parseInt(_0x21d06b(0x1a5))/0x8*(-parseInt(_0x21d06b(0x1a4))/0x9)+-parseInt(_0x21d06b(0x1a9))/0xa;if(_0x378658===_0x87542f)break;else _0x54eba2['push'](_0x54eba2['shift']());}catch(_0x51fb1b){_0x54eba2['push'](_0x54eba2['shift']());}}}(a184_0x25c1,0x36b4d));export const CLI_VERSION_POLICY_URL=a184_0x36954b(0x1a3);
|