@lovrabet/rabetbase-cli 2.1.4 → 2.1.5
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/discover.js +1 -1
- package/lib/commands/app/index.js +1 -1
- package/lib/commands/app/list.js +1 -1
- package/lib/commands/app/remove.js +1 -1
- package/lib/commands/app/shared.js +1 -1
- package/lib/commands/app/use.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-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-selector.js +1 -1
- package/lib/commands/common/flags.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/dataset/detail.js +1 -1
- package/lib/commands/dataset/index.js +1 -1
- package/lib/commands/dataset/links.js +1 -1
- package/lib/commands/dataset/list.js +1 -1
- package/lib/commands/dataset/operations.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/init/index.js +1 -1
- package/lib/commands/logs/index.js +1 -1
- package/lib/commands/menu/index.js +1 -1
- package/lib/commands/menu/shared/compare-table.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/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/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/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/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/run/index.js +1 -1
- package/lib/commands/schema.js +1 -1
- package/lib/commands/skill/index.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/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.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-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/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/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/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/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/templates/skill/SKILL.md.tpl +1 -1
package/lib/commands/sql/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a109_0x5336ba=a109_0x4158;(function(_0x484228,_0x16d372){const _0x5a62b3=a109_0x4158,_0x155950=_0x484228();while(!![]){try{const _0x2e11e8=-parseInt(_0x5a62b3(0x1f5))/0x1*(parseInt(_0x5a62b3(0x1d2))/0x2)+-parseInt(_0x5a62b3(0x1e1))/0x3+parseInt(_0x5a62b3(0x1fa))/0x4+-parseInt(_0x5a62b3(0x1d9))/0x5*(-parseInt(_0x5a62b3(0x1d4))/0x6)+-parseInt(_0x5a62b3(0x1e6))/0x7+parseInt(_0x5a62b3(0x1e0))/0x8+parseInt(_0x5a62b3(0x1fc))/0x9;if(_0x2e11e8===_0x16d372)break;else _0x155950['push'](_0x155950['shift']());}catch(_0x5cbe96){_0x155950['push'](_0x155950['shift']());}}}(a109_0x3ecf,0x54360));function a109_0x4158(_0x135330,_0x21fb5b){_0x135330=_0x135330-0x1cc;const _0x3ecfc1=a109_0x3ecf();let _0x415853=_0x3ecfc1[_0x135330];return _0x415853;}import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';function a109_0x3ecf(){const _0x3d0bc8=['apps','sqls','sqlCode','test','sqlName','lockFilePath','length','would_pull','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','sqlcode','lastSync','2SjJsio','Filter\x20by\x20SQL\x20display\x20name','366FpglXm','POST','message','cancelled','sqlRoot','14435luaWBS','str','\x20SQL\x20file(s)\x20into\x20','\x20skipped,\x20','\x20failed','boolean','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','3110224bRxOvk','752526tuQwIJ','sqlContent','sqlRootDir','path','force','4735626DCMvCy','replace','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','nonInteractive','appCode','utf8','push','toISOString','Force\x20overwrite\x20local\x20unsynced\x20changes','conflict','Pull\x20complete:\x20','filter','paging','local\x20differs\x20from\x20remote','description','134659dpAJGX','No\x20remote\x20SQL\x20queries\x20matched.','catch','pull','Force\x20pull\x20cancelled.','230884hPJFGy','Would\x20pull\x20','7059069RWHqBs','mybatisXml','name','trimStart','dbId','split','tableData','unchanged'];a109_0x3ecf=function(){return _0x3d0bc8;};return a109_0x3ecf();}import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x40af3b,_0x3c7d67){const _0x175be8=a109_0x4158,_0x5af59c=[];let _0x2e9ad3=0x1;while(!![]){const _0xca8ab3=await listSqlQueries(_0x40af3b,{'currentPage':_0x2e9ad3,'pageSize':PAGE_SIZE,'sqlCode':_0x3c7d67['sqlCode'],'sqlName':_0x3c7d67[_0x175be8(0x208)]}),_0x573cbb=_0xca8ab3[_0x175be8(0x202)]??[];_0x5af59c['push'](..._0x573cbb);if(_0x573cbb[_0x175be8(0x1cd)]===0x0)break;const _0x15f8ae=_0xca8ab3[_0x175be8(0x1f2)]?.['totalCount'];if(_0x15f8ae!=null?_0x5af59c['length']>=_0x15f8ae:_0x573cbb[_0x175be8(0x1cd)]<PAGE_SIZE)break;_0x2e9ad3++;}return _0x5af59c;}async function ensureSqlContent(_0x4f1743){const _0x474db7=a109_0x4158;if(_0x4f1743['sqlContent']!=null&&String(_0x4f1743[_0x474db7(0x1e2)])[_0x474db7(0x1cd)]>0x0)return _0x4f1743;return getSqlQueryDetail(_0x4f1743['sqlCode']);}export const sqlPull={'service':'sql','command':'pull','description':a109_0x5336ba(0x1cf),'risk':'write','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a109_0x5336ba(0x1fe),'type':'string','description':a109_0x5336ba(0x1d3)},{'name':a109_0x5336ba(0x1e5),'type':a109_0x5336ba(0x1de),'description':a109_0x5336ba(0x1ee)}],async 'dryRun'(_0x1e937b){const _0x5299d7=a109_0x5336ba,_0xa04e25=loadSqlProjectConfig(_0x1e937b['appCode']),_0x56cabb=await readSqlLockFile(_0xa04e25[_0x5299d7(0x1cc)]),{appLock:_0x2ee1d6}=ensureSqlLockScope(_0x56cabb??createEmptySqlLock(),_0xa04e25[_0x5299d7(0x1ea)],_0xa04e25[_0x5299d7(0x1d8)],'pull'),_0x476b40=await fetchAllSqlQueries(_0x1e937b[_0x5299d7(0x1ea)],{'sqlCode':_0x1e937b['str'](_0x5299d7(0x1d0))||undefined,'sqlName':_0x1e937b[_0x5299d7(0x1da)](_0x5299d7(0x1fe))||undefined}),_0x5e97f6=[];for(const _0x2bb48f of _0x476b40){const _0x265d37=await ensureSqlContent(_0x2bb48f),_0x59a756=ensureRemoteSqlContent(_0x265d37),_0x1f3371=detectModeFromSql(_0x265d37),_0x51830b=_0x265d37[_0x5299d7(0x200)]?await getDbName(_0x1e937b['appCode'],Number(_0x265d37['dbId']))[_0x5299d7(0x1f7)](()=>undefined):undefined,_0x53d851=buildLocalSqlFileContent({'sqlCode':_0x265d37['sqlCode'],'sqlName':_0x265d37[_0x5299d7(0x208)],'dbId':_0x265d37[_0x5299d7(0x200)]},_0x59a756,{'dbName':_0x51830b,'mode':_0x1f3371,'syncedAt':new Date()[_0x5299d7(0x1ed)](),'description':_0x265d37['description']}),_0x120487=buildSqlLockEntry(_0x265d37,_0x59a756,'',{'dbName':_0x51830b}),_0x1d0d18=resolveLocalSqlFilePath(_0xa04e25,_0x265d37[_0x5299d7(0x206)],_0x120487);let _0x4017d9=_0x5299d7(0x1ce),_0x3ad6ac;if(await fileExists(_0x1d0d18)){const _0x217eef=await readFile(_0x1d0d18,_0x5299d7(0x1eb));isEquivalentPulledSqlFile(_0x217eef,_0x53d851,_0x1f3371)?(_0x4017d9='skipped',_0x3ad6ac=_0x5299d7(0x203)):(_0x4017d9=_0x5299d7(0x1ef),_0x3ad6ac=_0x5299d7(0x1df));}_0x5e97f6[_0x5299d7(0x1ec)]({'sqlCode':_0x265d37['sqlCode'],'sqlName':_0x265d37[_0x5299d7(0x208)],'filePath':_0x1d0d18,'status':_0x4017d9,'reason':_0x3ad6ac});}return{'method':_0x5299d7(0x1d5),'url':'/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','body':{'appCode':_0x1e937b[_0x5299d7(0x1ea)],'sqlCode':_0x1e937b[_0x5299d7(0x1da)](_0x5299d7(0x1d0))||null,'sqlName':_0x1e937b[_0x5299d7(0x1da)]('name')||null,'files':_0x5e97f6},'description':_0x5299d7(0x1fb)+_0x5e97f6[_0x5299d7(0x1cd)]+_0x5299d7(0x1db)+_0xa04e25['sqlRootDir']};},async 'execute'(_0x3d17e4){const _0x18693c=a109_0x5336ba,_0x15caf1=loadSqlProjectConfig(_0x3d17e4['appCode']),_0x251c04=await readSqlLockFile(_0x15caf1[_0x18693c(0x1cc)]),{lockData:_0x523e81,appLock:_0x4d478f}=ensureSqlLockScope(_0x251c04??createEmptySqlLock(),_0x15caf1[_0x18693c(0x1ea)],_0x15caf1[_0x18693c(0x1d8)],_0x18693c(0x1f8)),_0x41e9f6=_0x3d17e4['bool'](_0x18693c(0x1e5)),_0x1dfba0=await fetchAllSqlQueries(_0x3d17e4['appCode'],{'sqlCode':_0x3d17e4[_0x18693c(0x1da)](_0x18693c(0x1d0))||undefined,'sqlName':_0x3d17e4['str']('name')||undefined});if(_0x1dfba0[_0x18693c(0x1cd)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x18693c(0x1f6)};const _0x252f62=[],_0x569afb=[];for(const _0x30db65 of _0x1dfba0){try{_0x252f62[_0x18693c(0x1ec)](await ensureSqlContent(_0x30db65));}catch(_0x523a2f){_0x569afb[_0x18693c(0x1ec)]({'sqlCode':_0x30db65[_0x18693c(0x206)],'error':_0x523a2f instanceof Error?_0x523a2f['message']:String(_0x523a2f)});}}if(_0x41e9f6&&!_0x3d17e4[_0x18693c(0x1e9)]){let _0x1686c0=![];for(const _0x3219ff of _0x252f62){const _0x5aa7eb=detectModeFromSql(_0x3219ff),_0x2f367a=_0x3219ff['dbId']?await getDbName(_0x3d17e4[_0x18693c(0x1ea)],Number(_0x3219ff[_0x18693c(0x200)]))[_0x18693c(0x1f7)](()=>undefined):undefined,_0x29cb00=buildLocalSqlFileContent({'sqlCode':_0x3219ff['sqlCode'],'sqlName':_0x3219ff[_0x18693c(0x208)],'dbId':_0x3219ff['dbId']},ensureRemoteSqlContent(_0x3219ff),{'dbName':_0x2f367a,'mode':_0x5aa7eb,'syncedAt':new Date()[_0x18693c(0x1ed)](),'description':_0x3219ff[_0x18693c(0x1f4)]}),_0x5297fb=resolveLocalSqlFilePath(_0x15caf1,_0x3219ff[_0x18693c(0x206)],buildSqlLockEntry(_0x3219ff,ensureRemoteSqlContent(_0x3219ff),'',{'dbName':_0x2f367a}));if(await fileExists(_0x5297fb)){const _0x541b13=await readFile(_0x5297fb,_0x18693c(0x1eb));if(!isEquivalentPulledSqlFile(_0x541b13,_0x29cb00,_0x5aa7eb)){_0x1686c0=!![];break;}}}if(_0x1686c0){const _0x1ae506=await confirmForceOverwrite(_0x18693c(0x1e8));if(!_0x1ae506)throw CliErrors[_0x18693c(0x1d7)](_0x18693c(0x1f9));}}const _0x23b476=cloneSqlLockData(_0x523e81),_0x5a0e8c=_0x23b476[_0x18693c(0x204)][_0x15caf1[_0x18693c(0x1ea)]],_0x2f8450=[],_0x37c070=[];for(const _0x474b50 of _0x252f62){const _0x34050a=_0x5a0e8c[_0x18693c(0x205)][_0x474b50[_0x18693c(0x206)]],_0x27bf30=ensureRemoteSqlContent(_0x474b50),_0x40ae7b=detectModeFromSql(_0x474b50),_0x3b8f76=_0x474b50[_0x18693c(0x200)]?await getDbName(_0x3d17e4['appCode'],Number(_0x474b50[_0x18693c(0x200)]))['catch'](()=>undefined):undefined,_0x1bda48=buildLocalSqlFileContent({'sqlCode':_0x474b50[_0x18693c(0x206)],'sqlName':_0x474b50[_0x18693c(0x208)],'dbId':_0x474b50[_0x18693c(0x200)]},_0x27bf30,{'dbName':_0x3b8f76,'mode':_0x40ae7b,'syncedAt':new Date()[_0x18693c(0x1ed)](),'description':_0x474b50[_0x18693c(0x1f4)]}),_0x3b2b9e=buildSqlLockEntry(_0x474b50,_0x27bf30,computeSqlContentHash(_0x1bda48),{'dbName':_0x3b8f76}),_0x2fa2e0=_0x3b2b9e[_0x18693c(0x1e4)],_0x3b5394=join(_0x15caf1[_0x18693c(0x1e3)],_0x2fa2e0);try{if(await fileExists(_0x3b5394)){const _0x40b59f=await readFile(_0x3b5394,_0x18693c(0x1eb));if(isEquivalentPulledSqlFile(_0x40b59f,_0x1bda48,_0x40ae7b)){_0x37c070[_0x18693c(0x1ec)]({'sqlCode':_0x474b50[_0x18693c(0x206)],'reason':_0x18693c(0x203)}),_0x5a0e8c[_0x18693c(0x205)][_0x474b50[_0x18693c(0x206)]]={..._0x3b2b9e,'hash':computeSqlContentHash(_0x40b59f),'path':_0x2fa2e0};continue;}if(!_0x41e9f6){_0x37c070[_0x18693c(0x1ec)]({'sqlCode':_0x474b50[_0x18693c(0x206)],'reason':_0x18693c(0x1f3)});continue;}}const _0x3e9878=_0x34050a?.[_0x18693c(0x1e4)]?join(_0x15caf1[_0x18693c(0x1e3)],_0x34050a[_0x18693c(0x1e4)]):undefined;_0x3e9878&&_0x3e9878!==_0x3b5394&&await fileExists(_0x3e9878)&&await rm(_0x3e9878,{'force':!![]}),await ensureParentDirectory(_0x3b5394),await writeFile(_0x3b5394,_0x1bda48,'utf8'),_0x5a0e8c['sqls'][_0x474b50[_0x18693c(0x206)]]={..._0x3b2b9e,'path':_0x2fa2e0},_0x2f8450[_0x18693c(0x1ec)]({'sqlCode':_0x474b50[_0x18693c(0x206)],'filePath':_0x3b5394});}catch(_0x4db164){_0x569afb[_0x18693c(0x1ec)]({'sqlCode':_0x474b50[_0x18693c(0x206)],'error':_0x4db164 instanceof Error?_0x4db164[_0x18693c(0x1d6)]:String(_0x4db164)});}}return _0x5a0e8c[_0x18693c(0x1d1)]=new Date()[_0x18693c(0x1ed)](),await writeSqlLockFile(_0x15caf1[_0x18693c(0x1cc)],_0x23b476),{'ok':_0x569afb[_0x18693c(0x1cd)]===0x0,'data':{'pulled':_0x2f8450,'skipped':_0x37c070,'failed':_0x569afb},'message':_0x18693c(0x1f0)+_0x2f8450[_0x18693c(0x1cd)]+'\x20written,\x20'+_0x37c070['length']+_0x18693c(0x1dc)+_0x569afb[_0x18693c(0x1cd)]+_0x18693c(0x1dd)};}};function detectModeFromSql(_0x55fc7a){const _0x56bc38=a109_0x5336ba,_0x5c5865=ensureRemoteSqlContent(_0x55fc7a),_0x143a02=stripLocalSqlMetadata(_0x5c5865,_0x56bc38(0x1fd))[_0x56bc38(0x1ff)]();if(/^<(select|insert|update|delete)\b/i[_0x56bc38(0x207)](_0x143a02))return _0x56bc38(0x1fd);return'sql';}function isEquivalentPulledSqlFile(_0x2f0c64,_0x11b32c,_0xfe78e8){return normalizePullComparableContent(_0x2f0c64,_0xfe78e8)===normalizePullComparableContent(_0x11b32c,_0xfe78e8);}function normalizePullComparableContent(_0xfd56fd,_0x1dbb25){const _0xe3293f=a109_0x5336ba,_0x34171b=_0xfd56fd[_0xe3293f(0x1e7)](/\r\n/g,'\x0a')[_0xe3293f(0x201)]('\x0a'),_0x3a893b=_0x34171b[_0xe3293f(0x1f1)](_0xade286=>!isSyncedAtMetadataLine(_0xade286,_0x1dbb25));return _0x3a893b['join']('\x0a');}function isSyncedAtMetadataLine(_0xfc25aa,_0x21f76e){const _0x6c287b=a109_0x5336ba;if(_0x21f76e===_0x6c287b(0x1fd))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x6c287b(0x207)](_0xfc25aa);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x6c287b(0x207)](_0xfc25aa);}
|
|
1
|
+
const a109_0x355929=a109_0x150e;(function(_0x4b4379,_0x3cb76c){const _0x1abb9a=a109_0x150e,_0x2c3f7e=_0x4b4379();while(!![]){try{const _0x3c9a4a=parseInt(_0x1abb9a(0xdc))/0x1*(-parseInt(_0x1abb9a(0xf6))/0x2)+parseInt(_0x1abb9a(0xdf))/0x3*(-parseInt(_0x1abb9a(0xe2))/0x4)+-parseInt(_0x1abb9a(0xf2))/0x5+parseInt(_0x1abb9a(0xed))/0x6+-parseInt(_0x1abb9a(0xd4))/0x7*(parseInt(_0x1abb9a(0xfd))/0x8)+parseInt(_0x1abb9a(0x100))/0x9+-parseInt(_0x1abb9a(0xde))/0xa*(-parseInt(_0x1abb9a(0xf7))/0xb);if(_0x3c9a4a===_0x3cb76c)break;else _0x2c3f7e['push'](_0x2c3f7e['shift']());}catch(_0x3b2581){_0x2c3f7e['push'](_0x2c3f7e['shift']());}}}(a109_0x44dc,0x702fe));import{readFile,rm,writeFile}from'node:fs/promises';function a109_0x150e(_0x2a5d17,_0x31b8bf){_0x2a5d17=_0x2a5d17-0xc3;const _0x44dcb4=a109_0x44dc();let _0x150e23=_0x44dcb4[_0x2a5d17];return _0x150e23;}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';function a109_0x44dc(){const _0x1d93f2=['1648605yfUllW','pull','length','4fDUHZx','lockFilePath','string','replace','\x20SQL\x20file(s)\x20into\x20','filter','\x20written,\x20','split','boolean','sqlRoot','force','4494060uqHhqu','toISOString','sql','sqlcode','sqlCode','3259100WBblir','unchanged','local\x20differs\x20from\x20remote','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','138726TeXQHE','7282ktZZas','name','trimStart','join','Force\x20overwrite\x20local\x20unsynced\x20changes','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','16nTHQUW','appCode','dbId','2851254soogxV','\x20skipped,\x20','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','catch','would_pull','sqlContent','No\x20remote\x20SQL\x20queries\x20matched.','sqlName','sqls','message','conflict','Filter\x20by\x20SQL\x20display\x20name','bool','path','utf8','write','Would\x20pull\x20','push','description','str','sqlRootDir','Force\x20pull\x20cancelled.','1554217zMDDwW','skipped','tableData','test','mybatisXml','apps','Pull\x20complete:\x20','lastSync','3EofWkL','POST','18840dVDztC'];a109_0x44dc=function(){return _0x1d93f2;};return a109_0x44dc();}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(_0x4c7851,_0x3226b0){const _0x4317e6=a109_0x150e,_0x2a61b2=[];let _0x3c98a6=0x1;while(!![]){const _0x183c3a=await listSqlQueries(_0x4c7851,{'currentPage':_0x3c98a6,'pageSize':PAGE_SIZE,'sqlCode':_0x3226b0[_0x4317e6(0xf1)],'sqlName':_0x3226b0[_0x4317e6(0xc5)]}),_0x10b143=_0x183c3a[_0x4317e6(0xd6)]??[];_0x2a61b2[_0x4317e6(0xcf)](..._0x10b143);if(_0x10b143[_0x4317e6(0xe1)]===0x0)break;const _0x57d4e6=_0x183c3a['paging']?.['totalCount'];if(_0x57d4e6!=null?_0x2a61b2['length']>=_0x57d4e6:_0x10b143[_0x4317e6(0xe1)]<PAGE_SIZE)break;_0x3c98a6++;}return _0x2a61b2;}async function ensureSqlContent(_0x3ba856){const _0x106a15=a109_0x150e;if(_0x3ba856[_0x106a15(0xc3)]!=null&&String(_0x3ba856['sqlContent'])[_0x106a15(0xe1)]>0x0)return _0x3ba856;return getSqlQueryDetail(_0x3ba856['sqlCode']);}export const sqlPull={'service':'sql','command':'pull','description':a109_0x355929(0xf5),'risk':a109_0x355929(0xcd),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a109_0x355929(0xf8),'type':a109_0x355929(0xe4),'description':a109_0x355929(0xc9)},{'name':a109_0x355929(0xec),'type':a109_0x355929(0xea),'description':a109_0x355929(0xfb)}],async 'dryRun'(_0x1da6b3){const _0x5aa112=a109_0x355929,_0x54f619=loadSqlProjectConfig(_0x1da6b3[_0x5aa112(0xfe)]),_0x5378bb=await readSqlLockFile(_0x54f619[_0x5aa112(0xe3)]),{appLock:_0x38ee6c}=ensureSqlLockScope(_0x5378bb??createEmptySqlLock(),_0x54f619[_0x5aa112(0xfe)],_0x54f619[_0x5aa112(0xeb)],_0x5aa112(0xe0)),_0x5cc7ff=await fetchAllSqlQueries(_0x1da6b3[_0x5aa112(0xfe)],{'sqlCode':_0x1da6b3[_0x5aa112(0xd1)](_0x5aa112(0xf0))||undefined,'sqlName':_0x1da6b3[_0x5aa112(0xd1)](_0x5aa112(0xf8))||undefined}),_0x94c801=[];for(const _0x5b886f of _0x5cc7ff){const _0x6e69d5=await ensureSqlContent(_0x5b886f),_0x362854=ensureRemoteSqlContent(_0x6e69d5),_0x4cc623=detectModeFromSql(_0x6e69d5),_0x5d3206=_0x6e69d5[_0x5aa112(0xff)]?await getDbName(_0x1da6b3[_0x5aa112(0xfe)],Number(_0x6e69d5[_0x5aa112(0xff)]))[_0x5aa112(0x103)](()=>undefined):undefined,_0x153df0=buildLocalSqlFileContent({'sqlCode':_0x6e69d5['sqlCode'],'sqlName':_0x6e69d5[_0x5aa112(0xc5)],'dbId':_0x6e69d5[_0x5aa112(0xff)]},_0x362854,{'dbName':_0x5d3206,'mode':_0x4cc623,'syncedAt':new Date()[_0x5aa112(0xee)](),'description':_0x6e69d5[_0x5aa112(0xd0)]}),_0x43d79f=buildSqlLockEntry(_0x6e69d5,_0x362854,'',{'dbName':_0x5d3206}),_0x522219=resolveLocalSqlFilePath(_0x54f619,_0x6e69d5[_0x5aa112(0xf1)],_0x43d79f);let _0x414d3d=_0x5aa112(0x104),_0x20d896;if(await fileExists(_0x522219)){const _0x4862f1=await readFile(_0x522219,'utf8');isEquivalentPulledSqlFile(_0x4862f1,_0x153df0,_0x4cc623)?(_0x414d3d=_0x5aa112(0xd5),_0x20d896=_0x5aa112(0xf3)):(_0x414d3d=_0x5aa112(0xc8),_0x20d896=_0x5aa112(0xfc));}_0x94c801[_0x5aa112(0xcf)]({'sqlCode':_0x6e69d5[_0x5aa112(0xf1)],'sqlName':_0x6e69d5['sqlName'],'filePath':_0x522219,'status':_0x414d3d,'reason':_0x20d896});}return{'method':_0x5aa112(0xdd),'url':'/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','body':{'appCode':_0x1da6b3[_0x5aa112(0xfe)],'sqlCode':_0x1da6b3[_0x5aa112(0xd1)](_0x5aa112(0xf0))||null,'sqlName':_0x1da6b3[_0x5aa112(0xd1)](_0x5aa112(0xf8))||null,'files':_0x94c801},'description':_0x5aa112(0xce)+_0x94c801[_0x5aa112(0xe1)]+_0x5aa112(0xe6)+_0x54f619[_0x5aa112(0xd2)]};},async 'execute'(_0x56d797){const _0x4d7733=a109_0x355929,_0x454956=loadSqlProjectConfig(_0x56d797[_0x4d7733(0xfe)]),_0x203be6=await readSqlLockFile(_0x454956[_0x4d7733(0xe3)]),{lockData:_0x56d9dd,appLock:_0x5d0c98}=ensureSqlLockScope(_0x203be6??createEmptySqlLock(),_0x454956[_0x4d7733(0xfe)],_0x454956[_0x4d7733(0xeb)],'pull'),_0x351488=_0x56d797[_0x4d7733(0xca)]('force'),_0x1ce178=await fetchAllSqlQueries(_0x56d797[_0x4d7733(0xfe)],{'sqlCode':_0x56d797['str'](_0x4d7733(0xf0))||undefined,'sqlName':_0x56d797['str'](_0x4d7733(0xf8))||undefined});if(_0x1ce178[_0x4d7733(0xe1)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x4d7733(0xc4)};const _0x3d0f32=[],_0x2cde20=[];for(const _0x3b5cb0 of _0x1ce178){try{_0x3d0f32['push'](await ensureSqlContent(_0x3b5cb0));}catch(_0x2ba48e){_0x2cde20['push']({'sqlCode':_0x3b5cb0['sqlCode'],'error':_0x2ba48e instanceof Error?_0x2ba48e[_0x4d7733(0xc7)]:String(_0x2ba48e)});}}if(_0x351488&&!_0x56d797['nonInteractive']){let _0x3a23a1=![];for(const _0x2d943b of _0x3d0f32){const _0x485bc8=detectModeFromSql(_0x2d943b),_0x52896f=_0x2d943b[_0x4d7733(0xff)]?await getDbName(_0x56d797['appCode'],Number(_0x2d943b[_0x4d7733(0xff)]))['catch'](()=>undefined):undefined,_0x1c68ed=buildLocalSqlFileContent({'sqlCode':_0x2d943b['sqlCode'],'sqlName':_0x2d943b[_0x4d7733(0xc5)],'dbId':_0x2d943b['dbId']},ensureRemoteSqlContent(_0x2d943b),{'dbName':_0x52896f,'mode':_0x485bc8,'syncedAt':new Date()[_0x4d7733(0xee)](),'description':_0x2d943b[_0x4d7733(0xd0)]}),_0x1de8c0=resolveLocalSqlFilePath(_0x454956,_0x2d943b['sqlCode'],buildSqlLockEntry(_0x2d943b,ensureRemoteSqlContent(_0x2d943b),'',{'dbName':_0x52896f}));if(await fileExists(_0x1de8c0)){const _0x506b03=await readFile(_0x1de8c0,_0x4d7733(0xcc));if(!isEquivalentPulledSqlFile(_0x506b03,_0x1c68ed,_0x485bc8)){_0x3a23a1=!![];break;}}}if(_0x3a23a1){const _0xdc48c4=await confirmForceOverwrite(_0x4d7733(0x102));if(!_0xdc48c4)throw CliErrors['cancelled'](_0x4d7733(0xd3));}}const _0xcdfe68=cloneSqlLockData(_0x56d9dd),_0x424c86=_0xcdfe68[_0x4d7733(0xd9)][_0x454956[_0x4d7733(0xfe)]],_0x3fe2bb=[],_0x304cfc=[];for(const _0x114649 of _0x3d0f32){const _0x1a3dbb=_0x424c86['sqls'][_0x114649['sqlCode']],_0x4ed3d0=ensureRemoteSqlContent(_0x114649),_0x58200c=detectModeFromSql(_0x114649),_0x355d09=_0x114649[_0x4d7733(0xff)]?await getDbName(_0x56d797['appCode'],Number(_0x114649[_0x4d7733(0xff)]))[_0x4d7733(0x103)](()=>undefined):undefined,_0x2ae2af=buildLocalSqlFileContent({'sqlCode':_0x114649[_0x4d7733(0xf1)],'sqlName':_0x114649['sqlName'],'dbId':_0x114649[_0x4d7733(0xff)]},_0x4ed3d0,{'dbName':_0x355d09,'mode':_0x58200c,'syncedAt':new Date()[_0x4d7733(0xee)](),'description':_0x114649['description']}),_0x480215=buildSqlLockEntry(_0x114649,_0x4ed3d0,computeSqlContentHash(_0x2ae2af),{'dbName':_0x355d09}),_0x20db7b=_0x480215[_0x4d7733(0xcb)],_0x5cf319=join(_0x454956[_0x4d7733(0xd2)],_0x20db7b);try{if(await fileExists(_0x5cf319)){const _0x1e4f99=await readFile(_0x5cf319,_0x4d7733(0xcc));if(isEquivalentPulledSqlFile(_0x1e4f99,_0x2ae2af,_0x58200c)){_0x304cfc[_0x4d7733(0xcf)]({'sqlCode':_0x114649[_0x4d7733(0xf1)],'reason':_0x4d7733(0xf3)}),_0x424c86['sqls'][_0x114649[_0x4d7733(0xf1)]]={..._0x480215,'hash':computeSqlContentHash(_0x1e4f99),'path':_0x20db7b};continue;}if(!_0x351488){_0x304cfc[_0x4d7733(0xcf)]({'sqlCode':_0x114649[_0x4d7733(0xf1)],'reason':_0x4d7733(0xf4)});continue;}}const _0x5d3ae4=_0x1a3dbb?.[_0x4d7733(0xcb)]?join(_0x454956['sqlRootDir'],_0x1a3dbb[_0x4d7733(0xcb)]):undefined;_0x5d3ae4&&_0x5d3ae4!==_0x5cf319&&await fileExists(_0x5d3ae4)&&await rm(_0x5d3ae4,{'force':!![]}),await ensureParentDirectory(_0x5cf319),await writeFile(_0x5cf319,_0x2ae2af,'utf8'),_0x424c86[_0x4d7733(0xc6)][_0x114649[_0x4d7733(0xf1)]]={..._0x480215,'path':_0x20db7b},_0x3fe2bb[_0x4d7733(0xcf)]({'sqlCode':_0x114649[_0x4d7733(0xf1)],'filePath':_0x5cf319});}catch(_0x353844){_0x2cde20[_0x4d7733(0xcf)]({'sqlCode':_0x114649[_0x4d7733(0xf1)],'error':_0x353844 instanceof Error?_0x353844[_0x4d7733(0xc7)]:String(_0x353844)});}}return _0x424c86[_0x4d7733(0xdb)]=new Date()['toISOString'](),await writeSqlLockFile(_0x454956[_0x4d7733(0xe3)],_0xcdfe68),{'ok':_0x2cde20[_0x4d7733(0xe1)]===0x0,'data':{'pulled':_0x3fe2bb,'skipped':_0x304cfc,'failed':_0x2cde20},'message':_0x4d7733(0xda)+_0x3fe2bb['length']+_0x4d7733(0xe8)+_0x304cfc[_0x4d7733(0xe1)]+_0x4d7733(0x101)+_0x2cde20['length']+'\x20failed'};}};function detectModeFromSql(_0x458366){const _0x3e8a10=a109_0x355929,_0x1ff6e0=ensureRemoteSqlContent(_0x458366),_0x37987a=stripLocalSqlMetadata(_0x1ff6e0,_0x3e8a10(0xd8))[_0x3e8a10(0xf9)]();if(/^<(select|insert|update|delete)\b/i[_0x3e8a10(0xd7)](_0x37987a))return _0x3e8a10(0xd8);return _0x3e8a10(0xef);}function isEquivalentPulledSqlFile(_0x34d044,_0x4c9213,_0x51d16b){return normalizePullComparableContent(_0x34d044,_0x51d16b)===normalizePullComparableContent(_0x4c9213,_0x51d16b);}function normalizePullComparableContent(_0x45ad19,_0x11ab8b){const _0x6f336a=a109_0x355929,_0x436567=_0x45ad19[_0x6f336a(0xe5)](/\r\n/g,'\x0a')[_0x6f336a(0xe9)]('\x0a'),_0x52f670=_0x436567[_0x6f336a(0xe7)](_0x35a8d9=>!isSyncedAtMetadataLine(_0x35a8d9,_0x11ab8b));return _0x52f670[_0x6f336a(0xfa)]('\x0a');}function isSyncedAtMetadataLine(_0x25d10d,_0x31ff36){const _0x12cbbb=a109_0x355929;if(_0x31ff36==='mybatisXml')return/^\s*<!--\s*@lovrabet\.syncedAt:/['test'](_0x25d10d);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x12cbbb(0xd7)](_0x25d10d);}
|
package/lib/commands/sql/push.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a110_0x2401b4=a110_0x1a57;(function(_0x2114c7,_0x5ef0e4){const _0x44e718=a110_0x1a57,_0x3df06d=_0x2114c7();while(!![]){try{const _0x1bd1b6=parseInt(_0x44e718(0x14d))/0x1*(parseInt(_0x44e718(0x150))/0x2)+parseInt(_0x44e718(0x13a))/0x3*(-parseInt(_0x44e718(0x172))/0x4)+parseInt(_0x44e718(0x146))/0x5*(parseInt(_0x44e718(0x167))/0x6)+-parseInt(_0x44e718(0x153))/0x7+-parseInt(_0x44e718(0x161))/0x8*(-parseInt(_0x44e718(0x142))/0x9)+-parseInt(_0x44e718(0x163))/0xa*(-parseInt(_0x44e718(0x14e))/0xb)+-parseInt(_0x44e718(0x140))/0xc;if(_0x1bd1b6===_0x5ef0e4)break;else _0x3df06d['push'](_0x3df06d['shift']());}catch(_0x312ae7){_0x3df06d['push'](_0x3df06d['shift']());}}}(a110_0x3920,0x3f3f4));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 a110_0x3920(){const _0x333151=['No\x20local\x20SQL\x20files\x20found.','validation','push','6973356biqqjk','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','180AWysvd','join','dbName','sqlRoot','5zdbyEi','exec','Would\x20push\x20','toISOString','get','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','catch','59zTQWBe','1786147qPjBDb','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','548TaSRex','str','/smartapi/custom/updateUserCustomSql','888048AGTPtT','startsWith','boolean','POST','path','filter','has','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','hash','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','filePath','projectRoot','remoteId','sqlName','92632lgUJkA','appCode','30AMisdW','sqlCode','Local\x20directory\x20\x22','Local\x20SQL\x20not\x20found:\x20','2246274QJmLeV','Push\x20complete:\x20','set','bool','relativePath','map','length','lockFilePath','force','sqlcode','sqlConfig','4gXXiEM','trashDir','dbId','sqlRootDir','\x20failed','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','\x20pushed,\x20','sql','isFinite','high-risk-write','426657fGQUNm','replace','sqls'];a110_0x3920=function(){return _0x333151;};return a110_0x3920();}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(_0x372616,_0x27c514,_0x11ee81){const _0x39622b=a110_0x1a57,_0x393bec=await scanLocalSqlQueries(_0x372616),_0x1e9e90=new Map();for(const _0x15c9a0 of _0x393bec){if(_0x11ee81&&_0x15c9a0[_0x39622b(0x164)]!==_0x11ee81)continue;const _0x1f64b5=_0x1e9e90[_0x39622b(0x14a)](_0x15c9a0[_0x39622b(0x164)])??[];_0x1f64b5[_0x39622b(0x13f)](_0x15c9a0),_0x1e9e90[_0x39622b(0x169)](_0x15c9a0[_0x39622b(0x164)],_0x1f64b5);}if(_0x11ee81&&!_0x1e9e90[_0x39622b(0x159)](_0x11ee81))throw CliErrors[_0x39622b(0x13e)](_0x39622b(0x166)+_0x11ee81);const _0x58f619=[];for(const [_0x216374,_0x28ca32]of _0x1e9e90['entries']()){if(_0x28ca32[_0x39622b(0x16d)]===0x1){_0x58f619['push'](_0x28ca32[0x0]);continue;}const _0xb78b80=_0x27c514[_0x39622b(0x13c)][_0x216374],_0x4dde5c=_0xb78b80?.['path'],_0x19b1be=_0x4dde5c?_0x28ca32['filter'](_0x4c0c49=>_0x4c0c49[_0x39622b(0x16b)]!==_0x4dde5c):_0x28ca32;if(_0xb78b80&&_0x19b1be[_0x39622b(0x16d)]===0x1){_0x58f619[_0x39622b(0x13f)](_0x19b1be[0x0]);continue;}throw CliErrors[_0x39622b(0x13e)](_0x39622b(0x14b)+_0x216374+_0x39622b(0x141));}return _0x58f619;}export const sqlPush={'service':a110_0x2401b4(0x137),'command':'push','description':'Push\x20local\x20SQL\x20files\x20to\x20remote','risk':a110_0x2401b4(0x139),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a110_0x2401b4(0x16f),'type':a110_0x2401b4(0x155),'description':a110_0x2401b4(0x15c)}],async 'dryRun'(_0x1f6ec0){const _0x344d1d=a110_0x2401b4,_0x4910e3=loadSqlProjectConfig(_0x1f6ec0[_0x344d1d(0x162)]),_0x42b486=await readSqlLockFile(_0x4910e3[_0x344d1d(0x16e)]),{appLock:_0x4d83d4}=ensureSqlLockScope(_0x42b486??createEmptySqlLock(),_0x1f6ec0[_0x344d1d(0x162)],_0x4910e3[_0x344d1d(0x145)],_0x344d1d(0x13f)),_0x4046c2=await getTargetSqlQueries(_0x4910e3,_0x4d83d4,_0x1f6ec0[_0x344d1d(0x151)](_0x344d1d(0x170))||undefined),_0x4c31bf=[];for(const _0x364c24 of _0x4046c2){const _0x1c7bb3=await computeSqlFileHash(_0x364c24['filePath']),_0x495b55=_0x4d83d4[_0x344d1d(0x13c)][_0x364c24[_0x344d1d(0x164)]],_0x5eada9=!!_0x495b55&&(_0x495b55[_0x344d1d(0x157)]!==_0x364c24[_0x344d1d(0x16b)]||!!_0x364c24[_0x344d1d(0x160)]&&_0x495b55[_0x344d1d(0x160)]!==_0x364c24[_0x344d1d(0x160)]);if(!_0x1f6ec0['bool'](_0x344d1d(0x16f))&&_0x495b55&&_0x495b55[_0x344d1d(0x15b)]===_0x1c7bb3&&!_0x5eada9)continue;_0x4c31bf[_0x344d1d(0x13f)](_0x364c24[_0x344d1d(0x164)]);}return{'method':_0x344d1d(0x156),'url':_0x344d1d(0x152),'body':{'sqlCodes':_0x4c31bf,'appCode':_0x1f6ec0[_0x344d1d(0x162)]},'description':_0x344d1d(0x148)+_0x4c31bf[_0x344d1d(0x16d)]+'\x20SQL\x20file(s)'};},async 'execute'(_0x2d8950){const _0xcb49b2=a110_0x2401b4,_0x391711=loadSqlProjectConfig(_0x2d8950[_0xcb49b2(0x162)]),_0x3e1319=await readSqlLockFile(_0x391711['lockFilePath']),{lockData:_0x58e776,appLock:_0x347a06}=ensureSqlLockScope(_0x3e1319??createEmptySqlLock(),_0x2d8950[_0xcb49b2(0x162)],_0x391711[_0xcb49b2(0x145)],_0xcb49b2(0x13f)),_0x188c62=await getTargetSqlQueries(_0x391711,_0x347a06,_0x2d8950[_0xcb49b2(0x151)]('sqlcode')||undefined);if(_0x188c62[_0xcb49b2(0x16d)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0xcb49b2(0x13d)};const _0x3556ac=[],_0x52123f=[],_0x3d34a9=[];for(const _0x3fa9d4 of _0x188c62){const _0x2b20ed=_0x347a06[_0xcb49b2(0x13c)][_0x3fa9d4['sqlCode']];if(!_0x2b20ed){_0x3d34a9['push']({'sqlCode':_0x3fa9d4[_0xcb49b2(0x164)],'error':_0xcb49b2(0x14f)});continue;}try{const _0x3cc619=await computeSqlFileHash(_0x3fa9d4[_0xcb49b2(0x15d)]),_0x4a7ef3=_0x2b20ed[_0xcb49b2(0x157)]!==_0x3fa9d4[_0xcb49b2(0x16b)]||!!_0x3fa9d4[_0xcb49b2(0x160)]&&_0x2b20ed['sqlName']!==_0x3fa9d4['sqlName'];if(!_0x2d8950[_0xcb49b2(0x16a)]('force')&&_0x2b20ed[_0xcb49b2(0x15b)]===_0x3cc619&&!_0x4a7ef3){_0x52123f[_0xcb49b2(0x13f)]({'sqlCode':_0x3fa9d4[_0xcb49b2(0x164)],'reason':'unchanged'});continue;}if(_0x2b20ed['version']==null){_0x3d34a9[_0xcb49b2(0x13f)]({'sqlCode':_0x3fa9d4[_0xcb49b2(0x164)],'error':_0xcb49b2(0x15a)});continue;}const _0x155144=await readFile(_0x3fa9d4[_0xcb49b2(0x15d)],'utf8'),_0x5f4c7c=stripLocalSqlMetadata(_0x155144,_0x3fa9d4['mode']),_0x255b85=_0x3fa9d4[_0xcb49b2(0x160)]||_0x2b20ed[_0xcb49b2(0x160)],_0x422758=await resolveTargetDbBinding(_0x2d8950[_0xcb49b2(0x162)],_0x3fa9d4,_0x2b20ed),_0x7ac178=await updateSqlQuery({'id':_0x2b20ed[_0xcb49b2(0x15f)],'appCode':_0x2d8950[_0xcb49b2(0x162)],'sqlCode':_0x3fa9d4[_0xcb49b2(0x164)],'sqlName':_0x255b85,'dbId':_0x422758[_0xcb49b2(0x174)],'version':_0x2b20ed['version'],'sqlContent':_0x5f4c7c,'sqlConfig':_0x2b20ed[_0xcb49b2(0x171)]??undefined}),_0x3fd82e=_0x7ac178[_0xcb49b2(0x174)]?await getDbName(_0x2d8950[_0xcb49b2(0x162)],Number(_0x7ac178['dbId']))[_0xcb49b2(0x14c)](()=>_0x422758[_0xcb49b2(0x144)]):_0x422758[_0xcb49b2(0x144)];_0x347a06[_0xcb49b2(0x13c)][_0x3fa9d4[_0xcb49b2(0x164)]]={...buildSqlLockEntry(_0x7ac178,_0x5f4c7c,_0x3cc619,{'dbName':_0x3fd82e}),'path':_0x3fa9d4[_0xcb49b2(0x16b)],'mode':_0x2b20ed['mode']},await archivePreviousSqlFileIfNeeded(_0x391711,_0x2b20ed[_0xcb49b2(0x157)],_0x3fa9d4[_0xcb49b2(0x16b)]),_0x3556ac['push']({'sqlCode':_0x3fa9d4[_0xcb49b2(0x164)],'remoteId':_0x2b20ed[_0xcb49b2(0x15f)]});}catch(_0x39149a){_0x3d34a9[_0xcb49b2(0x13f)]({'sqlCode':_0x3fa9d4['sqlCode'],'error':_0x39149a instanceof Error?_0x39149a['message']:String(_0x39149a)});}}return _0x347a06['lastSync']=new Date()[_0xcb49b2(0x149)](),await writeSqlLockFile(_0x391711[_0xcb49b2(0x16e)],_0x58e776),{'ok':_0x3d34a9['length']===0x0,'data':{'pushed':_0x3556ac,'skipped':_0x52123f,'failed':_0x3d34a9},'message':_0xcb49b2(0x168)+_0x3556ac[_0xcb49b2(0x16d)]+_0xcb49b2(0x136)+_0x52123f['length']+'\x20skipped,\x20'+_0x3d34a9[_0xcb49b2(0x16d)]+_0xcb49b2(0x176)};}};async function archivePreviousSqlFileIfNeeded(_0x1f2d59,_0x35ca3c,_0x45cc9d){const _0x15d57c=a110_0x2401b4;if(!_0x35ca3c||_0x35ca3c===_0x45cc9d)return;const _0x27cbcb=join(_0x1f2d59[_0x15d57c(0x175)],_0x35ca3c);if(!await fileExists(_0x27cbcb))return;const _0x42d422=await moveToTrash(_0x1f2d59[_0x15d57c(0x15e)],_0x1f2d59[_0x15d57c(0x173)],_0x27cbcb);await cleanupEmptyDirectories(dirname(_0x27cbcb),_0x1f2d59[_0x15d57c(0x175)]),void _0x42d422;}async function moveToTrash(_0x474459,_0x3ecc40,_0x186118){const _0x3c0f56=a110_0x2401b4,_0x1c0e98=new Date()[_0x3c0f56(0x149)]()[_0x3c0f56(0x13b)](/[:.]/g,'-'),_0x50f561=relative(_0x474459,_0x186118),_0x8603a6=join(_0x3ecc40,_0x1c0e98,_0x50f561);return await mkdir(dirname(_0x8603a6),{'recursive':!![]}),await rename(_0x186118,_0x8603a6),_0x8603a6;}async function cleanupEmptyDirectories(_0x53a373,_0x21a6b6){const _0x181516=a110_0x2401b4;let _0x1b7c88=resolve(_0x53a373);const _0x41d6db=resolve(_0x21a6b6);while(_0x1b7c88[_0x181516(0x154)](''+_0x41d6db+sep)||_0x1b7c88===_0x41d6db){if(_0x1b7c88===_0x41d6db)return;try{const _0x30dacb=await readdir(_0x1b7c88);if(_0x30dacb[_0x181516(0x16d)]>0x0)return;await rmdir(_0x1b7c88);}catch{return;}_0x1b7c88=dirname(_0x1b7c88);}}function a110_0x1a57(_0x3222a7,_0x49e2c3){_0x3222a7=_0x3222a7-0x135;const _0x39203a=a110_0x3920();let _0x1a573e=_0x39203a[_0x3222a7];return _0x1a573e;}async function resolveTargetDbBinding(_0x3671ff,_0x40d837,_0x13e4a1){const _0x38558a=a110_0x2401b4,_0x7fc01c=_0x40d837['dbDirectory'];if(!_0x7fc01c)return{'dbId':_0x13e4a1[_0x38558a(0x174)],'dbName':_0x13e4a1[_0x38558a(0x144)]};const _0x468c0e=buildDbDirectoryName(_0x13e4a1[_0x38558a(0x144)],_0x13e4a1[_0x38558a(0x174)]);if(_0x7fc01c===_0x468c0e)return{'dbId':_0x13e4a1[_0x38558a(0x174)],'dbName':_0x13e4a1[_0x38558a(0x144)]};const _0x277f1a=parseExplicitDbDirectory(_0x7fc01c);if(_0x277f1a!=null)return{'dbId':_0x277f1a,'dbName':await getDbName(_0x3671ff,_0x277f1a)[_0x38558a(0x14c)](()=>undefined)};const _0x9411d4=await listDatabases(_0x3671ff),_0x347b8b=_0x9411d4[_0x38558a(0x158)](_0x11747c=>buildDbDirectoryName(_0x11747c[_0x38558a(0x144)],_0x11747c[_0x38558a(0x174)])===_0x7fc01c);if(_0x347b8b[_0x38558a(0x16d)]===0x1)return{'dbId':_0x347b8b[0x0][_0x38558a(0x174)],'dbName':_0x347b8b[0x0]['dbName']};if(_0x347b8b[_0x38558a(0x16d)]===0x0)throw CliErrors[_0x38558a(0x13e)]('No\x20database\x20matches\x20local\x20directory\x20\x22'+_0x7fc01c+'\x22\x20for\x20sqlCode\x20'+_0x40d837[_0x38558a(0x164)]+'.');const _0x4bdaa5=_0x347b8b[_0x38558a(0x16c)](_0x16e69c=>_0x16e69c[_0x38558a(0x144)]+'\x20('+_0x16e69c[_0x38558a(0x174)]+')')[_0x38558a(0x143)](',\x20');throw CliErrors[_0x38558a(0x13e)](_0x38558a(0x165)+_0x7fc01c+_0x38558a(0x135)+_0x40d837['sqlCode']+':\x20'+_0x4bdaa5);}function parseExplicitDbDirectory(_0x1553ed){const _0x2bede1=a110_0x2401b4,_0x34566c=/^db-(\d+)$/[_0x2bede1(0x147)](_0x1553ed);if(!_0x34566c)return null;const _0x5ed136=Number(_0x34566c[0x1]);return Number[_0x2bede1(0x138)](_0x5ed136)&&_0x5ed136>0x0?_0x5ed136:null;}
|
|
1
|
+
const a110_0x1ce978=a110_0x2efe;(function(_0x19ac17,_0x5c206b){const _0x1b817a=a110_0x2efe,_0x2c907a=_0x19ac17();while(!![]){try{const _0x30289a=parseInt(_0x1b817a(0x1fd))/0x1*(parseInt(_0x1b817a(0x1c6))/0x2)+-parseInt(_0x1b817a(0x1ca))/0x3+-parseInt(_0x1b817a(0x1f5))/0x4*(-parseInt(_0x1b817a(0x1d1))/0x5)+parseInt(_0x1b817a(0x1fa))/0x6*(-parseInt(_0x1b817a(0x1f6))/0x7)+parseInt(_0x1b817a(0x207))/0x8+-parseInt(_0x1b817a(0x1ee))/0x9*(parseInt(_0x1b817a(0x1df))/0xa)+parseInt(_0x1b817a(0x1d6))/0xb*(parseInt(_0x1b817a(0x1e7))/0xc);if(_0x30289a===_0x5c206b)break;else _0x2c907a['push'](_0x2c907a['shift']());}catch(_0x45d57d){_0x2c907a['push'](_0x2c907a['shift']());}}}(a110_0x43fd,0xa4eae));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 a110_0x2efe(_0x1ad8fa,_0x3eb04f){_0x1ad8fa=_0x1ad8fa-0x1c6;const _0x43fd41=a110_0x43fd();let _0x2efe58=_0x43fd41[_0x1ad8fa];return _0x2efe58;}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';function a110_0x43fd(){const _0x401f61=['version','3731312KGipYE','\x22\x20for\x20sqlCode\x20','584074blMVoY','sqlCode','/smartapi/custom/updateUserCustomSql','sqls','3719328SWkDkU','message','str','set','get','dbDirectory','bool','6737015xoiNmY','POST','sqlName','Would\x20push\x20','has','1940114RKbwOr','\x20failed','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','high-risk-write','path','Push\x20local\x20SQL\x20files\x20to\x20remote','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','exec','filePath','53640VBrZMf','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','dbId','hash','join','force','unchanged','sqlRoot','60cKoMwG','toISOString','sqlcode','dbName','remoteId','validation','map','1809icwZsW','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','trashDir','catch','length','push','4HiFVRr','2030917evDdJz','Local\x20directory\x20\x22','appCode','boolean','18lAxiQy','lockFilePath','No\x20database\x20matches\x20local\x20directory\x20\x22','4iagNGL','sqlRootDir','sql','lastSync','replace','No\x20local\x20SQL\x20files\x20found.','relativePath','startsWith','filter'];a110_0x43fd=function(){return _0x401f61;};return a110_0x43fd();}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(_0x3d5c4c,_0x24eb86,_0x3b7376){const _0x58f1a3=a110_0x2efe,_0x276904=await scanLocalSqlQueries(_0x3d5c4c),_0x257617=new Map();for(const _0xf4c9bf of _0x276904){if(_0x3b7376&&_0xf4c9bf[_0x58f1a3(0x1c7)]!==_0x3b7376)continue;const _0x2a1133=_0x257617[_0x58f1a3(0x1ce)](_0xf4c9bf[_0x58f1a3(0x1c7)])??[];_0x2a1133['push'](_0xf4c9bf),_0x257617[_0x58f1a3(0x1cd)](_0xf4c9bf[_0x58f1a3(0x1c7)],_0x2a1133);}if(_0x3b7376&&!_0x257617[_0x58f1a3(0x1d5)](_0x3b7376))throw CliErrors[_0x58f1a3(0x1ec)]('Local\x20SQL\x20not\x20found:\x20'+_0x3b7376);const _0x23b929=[];for(const [_0x238738,_0x3e7deb]of _0x257617['entries']()){if(_0x3e7deb['length']===0x1){_0x23b929[_0x58f1a3(0x1f4)](_0x3e7deb[0x0]);continue;}const _0x2ccdf1=_0x24eb86[_0x58f1a3(0x1c9)][_0x238738],_0x4e4502=_0x2ccdf1?.[_0x58f1a3(0x1da)],_0x240710=_0x4e4502?_0x3e7deb[_0x58f1a3(0x205)](_0x5d116a=>_0x5d116a[_0x58f1a3(0x203)]!==_0x4e4502):_0x3e7deb;if(_0x2ccdf1&&_0x240710['length']===0x1){_0x23b929[_0x58f1a3(0x1f4)](_0x240710[0x0]);continue;}throw CliErrors[_0x58f1a3(0x1ec)]('Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20'+_0x238738+_0x58f1a3(0x1dc));}return _0x23b929;}export const sqlPush={'service':a110_0x1ce978(0x1ff),'command':a110_0x1ce978(0x1f4),'description':a110_0x1ce978(0x1db),'risk':a110_0x1ce978(0x1d9),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a110_0x1ce978(0x1e4),'type':a110_0x1ce978(0x1f9),'description':a110_0x1ce978(0x1ef)}],async 'dryRun'(_0x941c78){const _0x358853=a110_0x1ce978,_0x2d7414=loadSqlProjectConfig(_0x941c78[_0x358853(0x1f8)]),_0x1d09b6=await readSqlLockFile(_0x2d7414[_0x358853(0x1fb)]),{appLock:_0x58b81a}=ensureSqlLockScope(_0x1d09b6??createEmptySqlLock(),_0x941c78[_0x358853(0x1f8)],_0x2d7414['sqlRoot'],_0x358853(0x1f4)),_0xe6311a=await getTargetSqlQueries(_0x2d7414,_0x58b81a,_0x941c78[_0x358853(0x1cc)](_0x358853(0x1e9))||undefined),_0x2875ac=[];for(const _0x586855 of _0xe6311a){const _0x50542f=await computeSqlFileHash(_0x586855[_0x358853(0x1de)]),_0x38dac1=_0x58b81a[_0x358853(0x1c9)][_0x586855[_0x358853(0x1c7)]],_0x398238=!!_0x38dac1&&(_0x38dac1[_0x358853(0x1da)]!==_0x586855[_0x358853(0x203)]||!!_0x586855['sqlName']&&_0x38dac1[_0x358853(0x1d3)]!==_0x586855[_0x358853(0x1d3)]);if(!_0x941c78[_0x358853(0x1d0)](_0x358853(0x1e4))&&_0x38dac1&&_0x38dac1['hash']===_0x50542f&&!_0x398238)continue;_0x2875ac['push'](_0x586855['sqlCode']);}return{'method':_0x358853(0x1d2),'url':_0x358853(0x1c8),'body':{'sqlCodes':_0x2875ac,'appCode':_0x941c78[_0x358853(0x1f8)]},'description':_0x358853(0x1d4)+_0x2875ac[_0x358853(0x1f3)]+'\x20SQL\x20file(s)'};},async 'execute'(_0x9e9ba){const _0x55aa55=a110_0x1ce978,_0x1c4490=loadSqlProjectConfig(_0x9e9ba[_0x55aa55(0x1f8)]),_0x581d84=await readSqlLockFile(_0x1c4490[_0x55aa55(0x1fb)]),{lockData:_0x27f44a,appLock:_0xee3289}=ensureSqlLockScope(_0x581d84??createEmptySqlLock(),_0x9e9ba['appCode'],_0x1c4490[_0x55aa55(0x1e6)],'push'),_0x2766a9=await getTargetSqlQueries(_0x1c4490,_0xee3289,_0x9e9ba[_0x55aa55(0x1cc)](_0x55aa55(0x1e9))||undefined);if(_0x2766a9[_0x55aa55(0x1f3)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x55aa55(0x202)};const _0xacf9f6=[],_0xc17bc0=[],_0x3ce575=[];for(const _0x565947 of _0x2766a9){const _0x5a7e57=_0xee3289[_0x55aa55(0x1c9)][_0x565947[_0x55aa55(0x1c7)]];if(!_0x5a7e57){_0x3ce575[_0x55aa55(0x1f4)]({'sqlCode':_0x565947['sqlCode'],'error':_0x55aa55(0x1e0)});continue;}try{const _0x7a7857=await computeSqlFileHash(_0x565947[_0x55aa55(0x1de)]),_0x5eb11e=_0x5a7e57[_0x55aa55(0x1da)]!==_0x565947[_0x55aa55(0x203)]||!!_0x565947[_0x55aa55(0x1d3)]&&_0x5a7e57[_0x55aa55(0x1d3)]!==_0x565947['sqlName'];if(!_0x9e9ba[_0x55aa55(0x1d0)](_0x55aa55(0x1e4))&&_0x5a7e57[_0x55aa55(0x1e2)]===_0x7a7857&&!_0x5eb11e){_0xc17bc0[_0x55aa55(0x1f4)]({'sqlCode':_0x565947[_0x55aa55(0x1c7)],'reason':_0x55aa55(0x1e5)});continue;}if(_0x5a7e57[_0x55aa55(0x206)]==null){_0x3ce575['push']({'sqlCode':_0x565947['sqlCode'],'error':_0x55aa55(0x1d8)});continue;}const _0x14d48c=await readFile(_0x565947[_0x55aa55(0x1de)],'utf8'),_0x3d9cfa=stripLocalSqlMetadata(_0x14d48c,_0x565947['mode']),_0x37feda=_0x565947[_0x55aa55(0x1d3)]||_0x5a7e57[_0x55aa55(0x1d3)],_0xf12319=await resolveTargetDbBinding(_0x9e9ba[_0x55aa55(0x1f8)],_0x565947,_0x5a7e57),_0x21a18b=await updateSqlQuery({'id':_0x5a7e57[_0x55aa55(0x1eb)],'appCode':_0x9e9ba[_0x55aa55(0x1f8)],'sqlCode':_0x565947[_0x55aa55(0x1c7)],'sqlName':_0x37feda,'dbId':_0xf12319['dbId'],'version':_0x5a7e57[_0x55aa55(0x206)],'sqlContent':_0x3d9cfa,'sqlConfig':_0x5a7e57['sqlConfig']??undefined}),_0x3ca16e=_0x21a18b[_0x55aa55(0x1e1)]?await getDbName(_0x9e9ba[_0x55aa55(0x1f8)],Number(_0x21a18b[_0x55aa55(0x1e1)]))[_0x55aa55(0x1f2)](()=>_0xf12319['dbName']):_0xf12319['dbName'];_0xee3289[_0x55aa55(0x1c9)][_0x565947[_0x55aa55(0x1c7)]]={...buildSqlLockEntry(_0x21a18b,_0x3d9cfa,_0x7a7857,{'dbName':_0x3ca16e}),'path':_0x565947[_0x55aa55(0x203)],'mode':_0x5a7e57['mode']},await archivePreviousSqlFileIfNeeded(_0x1c4490,_0x5a7e57[_0x55aa55(0x1da)],_0x565947['relativePath']),_0xacf9f6[_0x55aa55(0x1f4)]({'sqlCode':_0x565947[_0x55aa55(0x1c7)],'remoteId':_0x5a7e57[_0x55aa55(0x1eb)]});}catch(_0x2606a1){_0x3ce575[_0x55aa55(0x1f4)]({'sqlCode':_0x565947[_0x55aa55(0x1c7)],'error':_0x2606a1 instanceof Error?_0x2606a1[_0x55aa55(0x1cb)]:String(_0x2606a1)});}}return _0xee3289[_0x55aa55(0x200)]=new Date()[_0x55aa55(0x1e8)](),await writeSqlLockFile(_0x1c4490[_0x55aa55(0x1fb)],_0x27f44a),{'ok':_0x3ce575[_0x55aa55(0x1f3)]===0x0,'data':{'pushed':_0xacf9f6,'skipped':_0xc17bc0,'failed':_0x3ce575},'message':'Push\x20complete:\x20'+_0xacf9f6['length']+'\x20pushed,\x20'+_0xc17bc0[_0x55aa55(0x1f3)]+'\x20skipped,\x20'+_0x3ce575[_0x55aa55(0x1f3)]+_0x55aa55(0x1d7)};}};async function archivePreviousSqlFileIfNeeded(_0x11a11d,_0x46ff2a,_0x1b0008){const _0x2e1edc=a110_0x1ce978;if(!_0x46ff2a||_0x46ff2a===_0x1b0008)return;const _0x30fff4=join(_0x11a11d[_0x2e1edc(0x1fe)],_0x46ff2a);if(!await fileExists(_0x30fff4))return;const _0x49ab9b=await moveToTrash(_0x11a11d['projectRoot'],_0x11a11d[_0x2e1edc(0x1f1)],_0x30fff4);await cleanupEmptyDirectories(dirname(_0x30fff4),_0x11a11d['sqlRootDir']),void _0x49ab9b;}async function moveToTrash(_0x314fd0,_0x4548e0,_0x41b82b){const _0x532290=a110_0x1ce978,_0x5cd619=new Date()['toISOString']()[_0x532290(0x201)](/[:.]/g,'-'),_0x16177b=relative(_0x314fd0,_0x41b82b),_0x3eb906=join(_0x4548e0,_0x5cd619,_0x16177b);return await mkdir(dirname(_0x3eb906),{'recursive':!![]}),await rename(_0x41b82b,_0x3eb906),_0x3eb906;}async function cleanupEmptyDirectories(_0x591b69,_0x1ed9fd){const _0xadba3b=a110_0x1ce978;let _0x128fd3=resolve(_0x591b69);const _0x519e5e=resolve(_0x1ed9fd);while(_0x128fd3[_0xadba3b(0x204)](''+_0x519e5e+sep)||_0x128fd3===_0x519e5e){if(_0x128fd3===_0x519e5e)return;try{const _0x1abf5f=await readdir(_0x128fd3);if(_0x1abf5f[_0xadba3b(0x1f3)]>0x0)return;await rmdir(_0x128fd3);}catch{return;}_0x128fd3=dirname(_0x128fd3);}}async function resolveTargetDbBinding(_0x326ca7,_0x1eec73,_0x53cc6a){const _0x2a668c=a110_0x1ce978,_0x59940a=_0x1eec73[_0x2a668c(0x1cf)];if(!_0x59940a)return{'dbId':_0x53cc6a[_0x2a668c(0x1e1)],'dbName':_0x53cc6a[_0x2a668c(0x1ea)]};const _0x21dd98=buildDbDirectoryName(_0x53cc6a[_0x2a668c(0x1ea)],_0x53cc6a[_0x2a668c(0x1e1)]);if(_0x59940a===_0x21dd98)return{'dbId':_0x53cc6a[_0x2a668c(0x1e1)],'dbName':_0x53cc6a['dbName']};const _0x4793e1=parseExplicitDbDirectory(_0x59940a);if(_0x4793e1!=null)return{'dbId':_0x4793e1,'dbName':await getDbName(_0x326ca7,_0x4793e1)['catch'](()=>undefined)};const _0x38287f=await listDatabases(_0x326ca7),_0x501734=_0x38287f[_0x2a668c(0x205)](_0xe864b3=>buildDbDirectoryName(_0xe864b3['dbName'],_0xe864b3[_0x2a668c(0x1e1)])===_0x59940a);if(_0x501734[_0x2a668c(0x1f3)]===0x1)return{'dbId':_0x501734[0x0][_0x2a668c(0x1e1)],'dbName':_0x501734[0x0][_0x2a668c(0x1ea)]};if(_0x501734[_0x2a668c(0x1f3)]===0x0)throw CliErrors['validation'](_0x2a668c(0x1fc)+_0x59940a+_0x2a668c(0x208)+_0x1eec73[_0x2a668c(0x1c7)]+'.');const _0x33ae12=_0x501734[_0x2a668c(0x1ed)](_0x42f358=>_0x42f358[_0x2a668c(0x1ea)]+'\x20('+_0x42f358[_0x2a668c(0x1e1)]+')')[_0x2a668c(0x1e3)](',\x20');throw CliErrors[_0x2a668c(0x1ec)](_0x2a668c(0x1f7)+_0x59940a+_0x2a668c(0x1f0)+_0x1eec73['sqlCode']+':\x20'+_0x33ae12);}function parseExplicitDbDirectory(_0x18e961){const _0x244808=a110_0x1ce978,_0xaf35d7=/^db-(\d+)$/[_0x244808(0x1dd)](_0x18e961);if(!_0xaf35d7)return null;const _0xc11e77=Number(_0xaf35d7[0x1]);return Number['isFinite'](_0xc11e77)&&_0xc11e77>0x0?_0xc11e77:null;}
|
package/lib/commands/sql/save.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a111_0x25df48=a111_0x1033;(function(_0x163fdc,_0x3f1a2e){const _0x3d0787=a111_0x1033,_0xbe3681=_0x163fdc();while(!![]){try{const _0x134447=-parseInt(_0x3d0787(0xd0))/0x1*(-parseInt(_0x3d0787(0xcc))/0x2)+-parseInt(_0x3d0787(0xc6))/0x3+parseInt(_0x3d0787(0xca))/0x4*(parseInt(_0x3d0787(0xd3))/0x5)+parseInt(_0x3d0787(0xbd))/0x6+-parseInt(_0x3d0787(0xc7))/0x7+-parseInt(_0x3d0787(0xcd))/0x8+-parseInt(_0x3d0787(0xc2))/0x9;if(_0x134447===_0x3f1a2e)break;else _0xbe3681['push'](_0xbe3681['shift']());}catch(_0x3f0cb9){_0xbe3681['push'](_0xbe3681['shift']());}}}(a111_0x1fee,0xeec33));import{CliErrors}from'../../errors.js';function a111_0x1fee(){const _0x28d2e2=['948274eZHDpW','description','Query\x20description','5haUkeN','10800816bEgyfN','validation','SQL\x20query\x20display\x20name','Target\x20database\x20—\x20accepts\x20a\x20numeric\x20ID\x20or\x20database\x20name\x20(e.g.\x20ecommerce_db)','Create\x20new\x20SQL\x20with\x20`rabetbase\x20sql\x20create\x20--name\x20<name>\x20--db-id\x20<id>\x20--mode\x20sql|mybatisXml`.','4705326BKWUDJ','sqlname','`rabetbase\x20sql\x20save`\x20has\x20been\x20deprecated.','string','2053179MTnWkl','13256152BkcIvT','sql','Path\x20to\x20the\x20SQL\x20file','6327168crrMiF','save','2dRoCNK','2010304GtUvrh','file','join'];a111_0x1fee=function(){return _0x28d2e2;};return a111_0x1fee();}function a111_0x1033(_0x583e63,_0x1f9cb2){_0x583e63=_0x583e63-0xbd;const _0x1fee22=a111_0x1fee();let _0x1033da=_0x1fee22[_0x583e63];return _0x1033da;}import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';const SQL_SAVE_DEPRECATED_HINT=[a111_0x25df48(0xc4),a111_0x25df48(0xc1),'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`.'][a111_0x25df48(0xcf)]('\x0a');export const sqlSave={'service':a111_0x25df48(0xc8),'command':a111_0x25df48(0xcb),'description':'Deprecated:\x20use\x20sql\x20create\x20to\x20create\x20and\x20sql\x20push\x20to\x20update','risk':'write','requiresAuth':![],'requiresAppCode':![],'flags':[{'name':a111_0x25df48(0xce),'type':a111_0x25df48(0xc5),'required':!![],'description':a111_0x25df48(0xc9)},SQLCODE_FLAG_OPTIONAL,{'name':a111_0x25df48(0xc3),'type':a111_0x25df48(0xc5),'description':a111_0x25df48(0xbf)},{'name':'db','type':a111_0x25df48(0xc5),'description':a111_0x25df48(0xc0)},{'name':a111_0x25df48(0xd1),'type':'string','description':a111_0x25df48(0xd2)}],async 'validate'(){const _0x417207=a111_0x25df48;throw CliErrors[_0x417207(0xbe)](SQL_SAVE_DEPRECATED_HINT);},async 'execute'(){throw CliErrors['validation'](SQL_SAVE_DEPRECATED_HINT);}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a112_0x43e76a=a112_0x2d23;(function(_0x4a7ca2,_0x1ad343){const _0x2443a0=a112_0x2d23,_0x3f0c09=_0x4a7ca2();while(!![]){try{const _0x165e2f=-parseInt(_0x2443a0(0xde))/0x1*(-parseInt(_0x2443a0(0xee))/0x2)+-parseInt(_0x2443a0(0xdf))/0x3*(-parseInt(_0x2443a0(0x106))/0x4)+parseInt(_0x2443a0(0x101))/0x5+-parseInt(_0x2443a0(0xec))/0x6*(parseInt(_0x2443a0(0xfc))/0x7)+parseInt(_0x2443a0(0xf7))/0x8+-parseInt(_0x2443a0(0xe2))/0x9+parseInt(_0x2443a0(0xf0))/0xa;if(_0x165e2f===_0x1ad343)break;else _0x3f0c09['push'](_0x3f0c09['shift']());}catch(_0x37ca5c){_0x3f0c09['push'](_0x3f0c09['shift']());}}}(a112_0xdfbd,0x231af));import{createInterface}from'node:readline';function a112_0x2d23(_0x56d4fb,_0x1098da){_0x56d4fb=_0x56d4fb-0xde;const _0xdfbd44=a112_0xdfbd();let _0x2d238f=_0xdfbd44[_0x56d4fb];return _0x2d238f;}import{join}from'node:path';import{buildDefaultSqlFileName,buildSqlRelativePath,detectSqlMode}from'../../core/sql-sync/utils.js';export const SQL_LOCAL_REL_DIR=a112_0x43e76a(0xf2);export function buildSqlLockEntry(_0x181d43,_0x59356d,_0x1ca3ce,_0x4f7d08){const _0x4ad596=a112_0x43e76a,_0x3cf5f0=detectSqlMode(_0x59356d);return{'path':buildSqlRelativePath(_0x181d43['sqlCode'],_0x181d43[_0x4ad596(0xfe)],_0x4f7d08?.[_0x4ad596(0x107)],_0x3cf5f0,_0x181d43[_0x4ad596(0xe1)]),'hash':_0x1ca3ce,'remoteId':_0x181d43['id'],'version':_0x181d43[_0x4ad596(0xf8)],'dbId':Number(_0x181d43[_0x4ad596(0xe1)]),'dbName':_0x4f7d08?.[_0x4ad596(0x107)],'sqlName':_0x181d43[_0x4ad596(0xfe)],'sqlConfig':_0x181d43['sqlConfig']??undefined,'mode':_0x3cf5f0};}function a112_0xdfbd(){const _0x4a101f=['description','sqlName','lastSync','mode','234675fncGie','replace','close','sqlCode','fromEntries','14952MsGoah','dbName','178795uhOXUa','48qMRPGZ','trim','dbId','229518Leqfuh','sqlRoot','sqls','--\x20@lovrabet.','stderr','stdin','syncedAt','length','map','join','42KiuxQu','<!--\x20@lovrabet.','2cFgzYg','question','417210QkXGvM','includes','.rabetbase/sql','sqlContent','entries','path','mybatisXml','279464onjZDN','version','test','filter','apps','192899kRntPX'];a112_0xdfbd=function(){return _0x4a101f;};return a112_0xdfbd();}export function cloneSqlLockData(_0x45226f){const _0x5683a5=a112_0x43e76a;return{'apps':Object[_0x5683a5(0x105)](Object[_0x5683a5(0xf4)](_0x45226f[_0x5683a5(0xfb)])[_0x5683a5(0xea)](([_0x2c6f4c,_0x545175])=>[_0x2c6f4c,{'sqlRoot':_0x545175[_0x5683a5(0xe3)],'lastSync':_0x545175[_0x5683a5(0xff)],'sqls':{..._0x545175[_0x5683a5(0xe4)]}}]))};}export function ensureRemoteSqlContent(_0x1bf0fa){const _0x3cf960=a112_0x43e76a;return _0x1bf0fa[_0x3cf960(0xf3)]??'';}export function buildLocalSqlFileContent(_0x2b6d5e,_0x51137b,_0x155b15){const _0x477b3f=a112_0x43e76a,_0x19ff1c=_0x155b15?.['mode']??detectSqlMode(_0x51137b),_0x2fbaae=stripLocalSqlMetadata(_0x51137b,_0x19ff1c)[_0x477b3f(0xe0)](),_0x1a0390=[...buildMetadataHeaderLines({'sqlCode':_0x2b6d5e['sqlCode'],'sqlName':_0x2b6d5e['sqlName'],'dbId':_0x2b6d5e[_0x477b3f(0xe1)],'dbName':_0x155b15?.[_0x477b3f(0x107)],'mode':_0x19ff1c,'syncedAt':_0x155b15?.['syncedAt'],'description':_0x155b15?.[_0x477b3f(0xfd)]},_0x19ff1c),'',_0x2fbaae],_0xe5e5d=_0x1a0390['join']('\x0a');return _0xe5e5d['endsWith']('\x0a')?_0xe5e5d:_0xe5e5d+'\x0a';}export function stripLocalSqlMetadata(_0x1c2ea0,_0x3080b4){const _0xaa5724=a112_0x43e76a,_0x51ab58=_0x1c2ea0[_0xaa5724(0x102)](/\r\n/g,'\x0a')['split']('\x0a'),_0x4de24f=[];let _0x2f8b67=0x0;if(_0x3080b4===_0xaa5724(0xf6))while(_0x2f8b67<_0x51ab58[_0xaa5724(0xe9)]){const _0x1994d6=_0x51ab58[_0x2f8b67]??'';if(/^\s*<!--\s*@lovrabet\./[_0xaa5724(0xf9)](_0x1994d6)){_0x2f8b67++;continue;}if(_0x1994d6[_0xaa5724(0xe0)]()===''&&_0x2f8b67>0x0){_0x2f8b67++;continue;}break;}else while(_0x2f8b67<_0x51ab58[_0xaa5724(0xe9)]){const _0xbb9bfb=_0x51ab58[_0x2f8b67]??'';if(/^\s*--\s*@lovrabet\./['test'](_0xbb9bfb)){_0x2f8b67++;continue;}if(_0xbb9bfb[_0xaa5724(0xe0)]()===''&&_0x2f8b67>0x0){_0x2f8b67++;continue;}break;}for(;_0x2f8b67<_0x51ab58[_0xaa5724(0xe9)];_0x2f8b67++){_0x4de24f['push'](_0x51ab58[_0x2f8b67]);}return _0x4de24f[_0xaa5724(0xeb)]('\x0a')['trimStart']();}export function resolveSqlMode(_0x450159,_0x4f568f){const _0x118a31=a112_0x43e76a;if(_0x4f568f?.[_0x118a31(0x100)])return _0x4f568f[_0x118a31(0x100)];return detectSqlMode(_0x450159);}export function resolveSqlFileName(_0xa9ca68,_0x594288,_0x236871){const _0x33684e=a112_0x43e76a;if(_0x236871?.[_0x33684e(0xf5)])return _0x236871[_0x33684e(0xf5)];if(_0x236871?.[_0x33684e(0xfe)]||_0x236871?.[_0x33684e(0x107)])return buildSqlRelativePath(_0xa9ca68,_0x236871?.[_0x33684e(0xfe)],_0x236871?.[_0x33684e(0x107)],resolveSqlMode(_0x594288,_0x236871),_0x236871?.['dbId']);return buildDefaultSqlFileName(_0xa9ca68,resolveSqlMode(_0x594288,_0x236871));}export function resolveSqlLocalDir(_0x339893,_0x1afeeb){return join(_0x339893,SQL_LOCAL_REL_DIR,_0x1afeeb);}export async function confirmForceOverwrite(_0x3a119a){const _0x27aaac=a112_0x43e76a,_0x21d039=createInterface({'input':process[_0x27aaac(0xe7)],'output':process[_0x27aaac(0xe6)]}),_0x5ae5c9=await new Promise(_0x1aec7e=>{const _0x4c4a01=_0x27aaac;_0x21d039[_0x4c4a01(0xef)](_0x3a119a+'\x20[y/N]\x20',_0x1aec7e);});return _0x21d039[_0x27aaac(0x103)](),['y','yes'][_0x27aaac(0xf1)](_0x5ae5c9['trim']()['toLowerCase']());}export function findSqlLockScope(_0x34a5f1,_0x4b8d23){const _0x3867f1=a112_0x43e76a;return _0x34a5f1[_0x3867f1(0xfb)][_0x4b8d23];}function buildMetadataHeaderLines(_0x103d24,_0x174aef){const _0x2a38c8=a112_0x43e76a,_0x4930fd=[[_0x2a38c8(0x104),_0x103d24[_0x2a38c8(0x104)]],[_0x2a38c8(0xfe),_0x103d24['sqlName']],[_0x2a38c8(0xe1),_0x103d24['dbId']],[_0x2a38c8(0x107),_0x103d24['dbName']],['mode',_0x103d24['mode']],[_0x2a38c8(0xe8),_0x103d24['syncedAt']],['description',_0x103d24[_0x2a38c8(0xfd)]]];if(_0x174aef==='mybatisXml')return _0x4930fd[_0x2a38c8(0xfa)](([,_0x4c0576])=>_0x4c0576!==undefined&&_0x4c0576!==null&&String(_0x4c0576)[_0x2a38c8(0xe0)]()!=='')['map'](([_0xeec838,_0x26e553])=>_0x2a38c8(0xed)+_0xeec838+':\x20'+String(_0x26e553)+'\x20-->');return _0x4930fd['filter'](([,_0x386016])=>_0x386016!==undefined&&_0x386016!==null&&String(_0x386016)[_0x2a38c8(0xe0)]()!=='')[_0x2a38c8(0xea)](([_0x37a4d9,_0x514db8])=>_0x2a38c8(0xe5)+_0x37a4d9+':\x20'+String(_0x514db8));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a113_0x505e57=a113_0x5a85;(function(_0x51e696,_0x3b1731){const _0x39a316=a113_0x5a85,_0x4a9308=_0x51e696();while(!![]){try{const _0x1b0c49=-parseInt(_0x39a316(0x10c))/0x1+-parseInt(_0x39a316(0x121))/0x2*(-parseInt(_0x39a316(0x125))/0x3)+parseInt(_0x39a316(0x11d))/0x4*(-parseInt(_0x39a316(0x111))/0x5)+parseInt(_0x39a316(0x106))/0x6+-parseInt(_0x39a316(0x113))/0x7*(parseInt(_0x39a316(0x11e))/0x8)+parseInt(_0x39a316(0x10a))/0x9+-parseInt(_0x39a316(0x123))/0xa;if(_0x1b0c49===_0x3b1731)break;else _0x4a9308['push'](_0x4a9308['shift']());}catch(_0x3cdb39){_0x4a9308['push'](_0x4a9308['shift']());}}}(a113_0x14a9,0x8876b));import{listSqlQueries}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';function a113_0x5a85(_0x262495,_0x618942){_0x262495=_0x262495-0x106;const _0x14a9b1=a113_0x14a9();let _0x5a859d=_0x14a9b1[_0x262495];return _0x5a859d;}import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile}from'../../core/sql-sync/lock.js';function a113_0x14a9(){const _0xefea97=['read','2122884GtlStk','path','106410PaQnew','Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','remote','lockKey','sql','475aAgqJy','paging','7KBqLqe','appCode','tableData','totalCount','sqlCode','boolean','Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally','has','push','All\x20SQL\x20queries\x20are\x20in\x20sync.','21196NJLmZb','508472paSspW','\x20remote-only','bool','16lNQATF','keys','2979710ulTbJx','map','237102LrVCBQ','filePath','\x20unchanged','sqls','status','3972912TrHeMH','length','lockFilePath'];a113_0x14a9=function(){return _0xefea97;};return a113_0x14a9();}const PAGE_SIZE=0x64;async function fetchAllSqlCodes(_0x35014e){const _0x47698c=a113_0x5a85,_0x448fcf=[];let _0x5ad72f=0x1;while(!![]){const _0x55e425=await listSqlQueries(_0x35014e,{'currentPage':_0x5ad72f,'pageSize':PAGE_SIZE}),_0xb0208d=_0x55e425[_0x47698c(0x115)]??[];_0x448fcf[_0x47698c(0x11b)](..._0xb0208d[_0x47698c(0x124)](_0x1ba250=>_0x1ba250[_0x47698c(0x117)]));if(_0xb0208d['length']===0x0)break;const _0x2a6040=_0x55e425[_0x47698c(0x112)]?.[_0x47698c(0x116)];if(_0x2a6040!=null?_0x448fcf['length']>=_0x2a6040:_0xb0208d[_0x47698c(0x107)]<PAGE_SIZE)break;_0x5ad72f++;}return _0x448fcf;}export const sqlStatus={'service':a113_0x505e57(0x110),'command':a113_0x505e57(0x129),'description':a113_0x505e57(0x10d),'risk':a113_0x505e57(0x109),'flags':[{'name':a113_0x505e57(0x10e),'type':a113_0x505e57(0x118),'description':a113_0x505e57(0x119)}],async 'execute'(_0x1041d3){const _0x20d3bd=a113_0x505e57,_0x166ccb=loadSqlProjectConfig(_0x1041d3[_0x20d3bd(0x114)]),_0xf87351=await readSqlLockFile(_0x166ccb[_0x20d3bd(0x108)]),{appLock:_0x264185}=ensureSqlLockScope(_0xf87351??createEmptySqlLock(),_0x166ccb[_0x20d3bd(0x114)],_0x166ccb['sqlRoot'],_0x20d3bd(0x129)),_0xeaf13e=await scanLocalSqlQueries(_0x166ccb),_0x12d52b=[],_0x588188=[],_0x16124b=[],_0x47ac6b=[],_0x57cc4d=new Set(_0xeaf13e[_0x20d3bd(0x124)](_0x3c9ed9=>_0x3c9ed9['lockKey']));for(const _0x53758e of _0xeaf13e){const _0x14a0f2=await computeSqlFileHash(_0x53758e[_0x20d3bd(0x126)]),_0x33d260=_0x264185[_0x20d3bd(0x128)][_0x53758e[_0x20d3bd(0x10f)]],_0x3ac0a3=!!_0x33d260&&_0x33d260[_0x20d3bd(0x10b)]!==_0x53758e['relativePath'],_0x7cbd32=!!_0x33d260&&!!_0x53758e['sqlName']&&_0x33d260['sqlName']!==_0x53758e['sqlName'];if(!_0x33d260)_0x12d52b['push'](_0x53758e[_0x20d3bd(0x10f)]);else _0x33d260['hash']!==_0x14a0f2||_0x3ac0a3||_0x7cbd32?_0x588188[_0x20d3bd(0x11b)](_0x53758e['lockKey']):_0x16124b[_0x20d3bd(0x11b)](_0x53758e[_0x20d3bd(0x10f)]);}for(const _0x340cc4 of Object[_0x20d3bd(0x122)](_0x264185[_0x20d3bd(0x128)])){!_0x57cc4d['has'](_0x340cc4)&&_0x47ac6b[_0x20d3bd(0x11b)](_0x340cc4);}const _0x3a3884=[];if(_0x1041d3[_0x20d3bd(0x120)](_0x20d3bd(0x10e))){const _0x47861c=await fetchAllSqlCodes(_0x1041d3['appCode']);for(const _0x53c5ec of _0x47861c){!_0x57cc4d[_0x20d3bd(0x11a)](_0x53c5ec)&&!_0x264185['sqls'][_0x53c5ec]&&_0x3a3884[_0x20d3bd(0x11b)](_0x53c5ec);}}const _0x306439=_0x12d52b[_0x20d3bd(0x107)]===0x0&&_0x588188[_0x20d3bd(0x107)]===0x0&&_0x47ac6b[_0x20d3bd(0x107)]===0x0&&_0x3a3884[_0x20d3bd(0x107)]===0x0;return{'ok':!![],'data':{'added':_0x12d52b,'modified':_0x588188,'missing':_0x47ac6b,'unchanged':_0x16124b,'remoteOnly':_0x3a3884},'message':_0x306439?_0x20d3bd(0x11c):_0x12d52b[_0x20d3bd(0x107)]+'\x20added,\x20'+_0x588188[_0x20d3bd(0x107)]+'\x20modified,\x20'+_0x47ac6b[_0x20d3bd(0x107)]+'\x20missing,\x20'+_0x16124b[_0x20d3bd(0x107)]+_0x20d3bd(0x127)+(_0x3a3884[_0x20d3bd(0x107)]>0x0?',\x20'+_0x3a3884[_0x20d3bd(0x107)]+_0x20d3bd(0x11f):'')};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a114_0x41dfc=a114_0x30a3;(function(_0x37fdc5,_0x410056){const _0x14d97d=a114_0x30a3,_0x517fdc=_0x37fdc5();while(!![]){try{const _0x24c3ab=-parseInt(_0x14d97d(0x1e2))/0x1*(parseInt(_0x14d97d(0x1d4))/0x2)+-parseInt(_0x14d97d(0x1cc))/0x3*(-parseInt(_0x14d97d(0x1d2))/0x4)+-parseInt(_0x14d97d(0x1d0))/0x5+parseInt(_0x14d97d(0x1d1))/0x6+parseInt(_0x14d97d(0x1c3))/0x7+-parseInt(_0x14d97d(0x1e6))/0x8+parseInt(_0x14d97d(0x1ed))/0x9;if(_0x24c3ab===_0x410056)break;else _0x517fdc['push'](_0x517fdc['shift']());}catch(_0xcecabc){_0x517fdc['push'](_0x517fdc['shift']());}}}(a114_0x39ae,0xbfd7b));import{readFileSync,existsSync}from'node:fs';import{resolve}from'node:path';function a114_0x39ae(){const _0x12fee6=['map','string','sql','1450671sJdpfn','schemas','from','size','4969220YVklFm','1511892SPYXTg','4uWxvKp','toLowerCase','1210RPVqEd','schemaWarnings','Provide\x20--file\x20or\x20--sql','\x22\x20not\x20found\x20or\x20not\x20accessible','type','str','tables','get','Path\x20to\x20the\x20SQL\x20file\x20to\x20validate','\x22\x20not\x20found\x20in\x20any\x20dataset','Inline\x20SQL\x20content\x20to\x20validate\x20(alternative\x20to\x20--file)','sqlType','message','read','1867sijROe','Dataset\x20\x22','cwd','filter','584352WYnxkY','push','reason','schema:','valid','parameters','isSelectOnly','19143468Vivmar','utf-8','fields','tableName','file','837333lESmNg','trim','dbtableConfig','flagMissing','Comma-separated\x20dataset\x20codes\x20to\x20cross-check\x20table/column\x20names\x20against','isArray'];a114_0x39ae=function(){return _0x12fee6;};return a114_0x39ae();}import{validateSql}from'../../core/sql-validator.js';function a114_0x30a3(_0x1595e6,_0x2a3eab){_0x1595e6=_0x1595e6-0x1c1;const _0x39aedc=a114_0x39ae();let _0x30a328=_0x39aedc[_0x1595e6];return _0x30a328;}import{getDatasetDetail,listDatasets}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';export const sqlValidate={'service':a114_0x41dfc(0x1cb),'command':'validate','description':'Validate\x20SQL\x20content\x20without\x20saving\x20(type\x20detection,\x20parameter\x20extraction,\x20optional\x20schema\x20check)','risk':a114_0x41dfc(0x1e1),'flags':[{'name':a114_0x41dfc(0x1c2),'type':a114_0x41dfc(0x1ca),'description':a114_0x41dfc(0x1dc)},{'name':a114_0x41dfc(0x1cb),'type':'string','description':a114_0x41dfc(0x1de)},{'name':a114_0x41dfc(0x1cd),'type':a114_0x41dfc(0x1ca),'description':a114_0x41dfc(0x1c7)}],async 'execute'(_0x2a09c8){const _0x3221a2=a114_0x41dfc,_0x29b1e5=_0x2a09c8[_0x3221a2(0x1d9)](_0x3221a2(0x1c2)),_0x39f21e=_0x2a09c8[_0x3221a2(0x1d9)](_0x3221a2(0x1cb));if(!_0x29b1e5&&!_0x39f21e)throw CliErrors[_0x3221a2(0x1c6)](_0x3221a2(0x1c2),_0x3221a2(0x1d6));let _0x333063;if(_0x29b1e5){const _0xcb684d=resolve(process[_0x3221a2(0x1e4)](),_0x29b1e5);if(!existsSync(_0xcb684d))throw CliErrors['validation']('File\x20not\x20found:\x20'+_0xcb684d);_0x333063=readFileSync(_0xcb684d,_0x3221a2(0x1ee));}else _0x333063=_0x39f21e;const _0x290735=validateSql(_0x333063),_0xa21346={'valid':_0x290735[_0x3221a2(0x1ea)],'sqlType':_0x290735[_0x3221a2(0x1df)][_0x3221a2(0x1d8)],'isSelectOnly':_0x290735[_0x3221a2(0x1df)][_0x3221a2(0x1ec)],'isDangerous':_0x290735[_0x3221a2(0x1df)]['isDangerous'],'tables':_0x290735[_0x3221a2(0x1da)],'parameters':_0x290735[_0x3221a2(0x1eb)],'message':_0x290735['message']};_0x290735[_0x3221a2(0x1df)][_0x3221a2(0x1e8)]&&(_0xa21346[_0x3221a2(0x1e8)]=_0x290735[_0x3221a2(0x1df)][_0x3221a2(0x1e8)]);const _0x4041ff=_0x2a09c8[_0x3221a2(0x1d9)](_0x3221a2(0x1cd));if(_0x4041ff&&_0x290735['valid']){const _0x51ce1d=_0x4041ff['split'](',')[_0x3221a2(0x1c9)](_0x48f8cf=>_0x48f8cf[_0x3221a2(0x1c4)]())[_0x3221a2(0x1e5)](Boolean),_0x45f951=[],_0x43b447=await listDatasets(_0x2a09c8['appCode']),_0x2d70f3=new Map(_0x43b447[_0x3221a2(0x1c9)](_0x5a3d0e=>[_0x5a3d0e[_0x3221a2(0x1c5)]?.[_0x3221a2(0x1c1)]?.['toLowerCase'](),_0x5a3d0e]));for(const _0x27bfad of _0x290735[_0x3221a2(0x1da)]){const _0x58c21e=_0x2d70f3[_0x3221a2(0x1db)](_0x27bfad[_0x3221a2(0x1d3)]());!_0x58c21e&&_0x45f951[_0x3221a2(0x1e7)]('Table\x20\x22'+_0x27bfad+_0x3221a2(0x1dd));}for(const _0x237012 of _0x51ce1d){try{const _0x55eb67=await getDatasetDetail(_0x237012),_0x5f0f39=Array[_0x3221a2(0x1c8)](_0x55eb67[_0x3221a2(0x1ef)])?_0x55eb67[_0x3221a2(0x1ef)]:[],_0x189619=new Set(_0x5f0f39['map'](_0x3315b4=>_0x3315b4['name']?.[_0x3221a2(0x1d3)]())),_0x3cc146=_0x55eb67[_0x3221a2(0x1c5)]?.['tableName']||_0x55eb67[_0x3221a2(0x1c1)]||_0x237012;_0xa21346[_0x3221a2(0x1e9)+_0x3cc146]={'code':_0x237012,'tableName':_0x3cc146,'fieldCount':_0x189619[_0x3221a2(0x1cf)],'fields':Array[_0x3221a2(0x1ce)](_0x189619)};}catch{_0x45f951[_0x3221a2(0x1e7)](_0x3221a2(0x1e3)+_0x237012+_0x3221a2(0x1d7));}}_0x45f951['length']>0x0&&(_0xa21346[_0x3221a2(0x1d5)]=_0x45f951);}return{'ok':_0x290735[_0x3221a2(0x1ea)],'data':_0xa21346,'message':_0x290735[_0x3221a2(0x1e0)]};}};
|
package/lib/config/schema.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a115_0x16683e=a115_0x2c79;(function(_0x110ab5,_0x4ec5e2){const _0x2018d6=a115_0x2c79,_0xc6a02d=_0x110ab5();while(!![]){try{const _0x2a6512=parseInt(_0x2018d6(0x1ea))/0x1*(parseInt(_0x2018d6(0x206))/0x2)+-parseInt(_0x2018d6(0x1fc))/0x3+parseInt(_0x2018d6(0x1f4))/0x4+-parseInt(_0x2018d6(0x1fd))/0x5+-parseInt(_0x2018d6(0x201))/0x6*(parseInt(_0x2018d6(0x200))/0x7)+parseInt(_0x2018d6(0x202))/0x8+-parseInt(_0x2018d6(0x1ed))/0x9;if(_0x2a6512===_0x4ec5e2)break;else _0xc6a02d['push'](_0xc6a02d['shift']());}catch(_0x4103a4){_0xc6a02d['push'](_0xc6a02d['shift']());}}}(a115_0x478e,0x44934));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=[a115_0x16683e(0x1f8),a115_0x16683e(0x1f2),a115_0x16683e(0x1e6),a115_0x16683e(0x1ff),a115_0x16683e(0x1fa)];export const TOP_LEVEL_CONFIG_KEYS=new Set([a115_0x16683e(0x1e7),a115_0x16683e(0x1f1),'locale',a115_0x16683e(0x1ff),a115_0x16683e(0x1f8),a115_0x16683e(0x1f2),a115_0x16683e(0x1f7)]);export const CONFIG_ENUM_VALUES={'env':[...RABETBASE_ENV_VALUES],'format':[...RABETBASE_OUTPUT_FORMAT_VALUES]};export function formatConfigKeyList(_0x2a6b31){const _0x3a5673=a115_0x16683e;return[..._0x2a6b31][_0x3a5673(0x1f3)](',\x20');}export function getTopLevelConfigKeyList(){return[...TOP_LEVEL_CONFIG_KEYS];}export function isTopLevelConfigKey(_0x56f5ee){const _0x3f61e8=a115_0x16683e;return TOP_LEVEL_CONFIG_KEYS[_0x3f61e8(0x1eb)](_0x56f5ee);}export function getTopLevelConfigKeySummary(){return formatConfigKeyList(getTopLevelConfigKeyList());}export function getConfigCommandKeyDescription(){const _0x37a677=a115_0x16683e;return _0x37a677(0x1fb)+getTopLevelConfigKeySummary()+')';}export const APP_PROFILE_FLAG_KEY_MAP={'env':'env','apiDir':a115_0x16683e(0x1f7),'cookie':a115_0x16683e(0x1f8),'accessKey':'accessKey','defaultFormat':a115_0x16683e(0x1ff),'pageSize':a115_0x16683e(0x1f6),'riskLevel':'riskLevel','locale':a115_0x16683e(0x1e6)};export function getAppProfileFlagDefs(){const _0x316511=a115_0x16683e;return[{'name':_0x316511(0x1f1),'type':_0x316511(0x1ef),'description':_0x316511(0x1e1),'enum':[...RABETBASE_ENV_VALUES]},{'name':_0x316511(0x1f7),'type':_0x316511(0x1ef),'description':_0x316511(0x204)},{'name':'cookie','type':'string','description':_0x316511(0x1e2),'hidden':!![]},{'name':_0x316511(0x1f2),'type':_0x316511(0x1ef),'description':_0x316511(0x1ec),'hidden':!![]},{'name':'defaultFormat','type':_0x316511(0x1ef),'description':_0x316511(0x1ee),'enum':[...RABETBASE_OUTPUT_FORMAT_VALUES]},{'name':'pageSize','type':_0x316511(0x1e8),'description':_0x316511(0x1f0)},{'name':_0x316511(0x1fa),'type':_0x316511(0x1ef),'description':'Risk\x20level','enum':[...RISK_LEVEL_VALUES]},{'name':'locale','type':_0x316511(0x1ef),'description':_0x316511(0x1f9)}];}export function collectAppProfileOverrides(_0x4e06ba){const _0x1897ab={};for(const [_0xb0373b,_0x48fcef]of Object['entries'](APP_PROFILE_FLAG_KEY_MAP)){const _0x11e087=_0x4e06ba(_0xb0373b);if(!_0x11e087)continue;_0x1897ab[_0x48fcef]=_0x48fcef==='pageSize'?Number(_0x11e087):_0x11e087;}return _0x1897ab;}export function buildAppProfileListFields(_0x9f180d){const _0x389b72=a115_0x16683e;return{'env':_0x9f180d[_0x389b72(0x1f1)]??null,'apiDir':_0x9f180d[_0x389b72(0x1f7)]??null,'hasCookie':!!_0x9f180d[_0x389b72(0x1f8)],'hasAccessKey':!!_0x9f180d[_0x389b72(0x1f2)],'format':_0x9f180d[_0x389b72(0x1ff)]??null,'pageSize':_0x9f180d[_0x389b72(0x1f6)]??null,'riskLevel':_0x9f180d['riskLevel']??null,'locale':_0x9f180d[_0x389b72(0x1e6)]??null};}export function buildAppDoctorFields(_0x58868e,_0x538169){const _0x57d5f0=a115_0x16683e;return{'env':{'value':_0x58868e['env']||_0x538169[_0x57d5f0(0x1f1)],'source':_0x58868e[_0x57d5f0(0x1f1)]?_0x57d5f0(0x1f5):_0x57d5f0(0x1e9)},'apiDir':{'value':_0x58868e[_0x57d5f0(0x1f7)]||_0x538169[_0x57d5f0(0x1f7)],'source':_0x58868e[_0x57d5f0(0x1f7)]?_0x57d5f0(0x1f5):'inherit'},'cookie':{'value':_0x58868e[_0x57d5f0(0x1f8)]||_0x538169[_0x57d5f0(0x1f8)],'source':_0x58868e[_0x57d5f0(0x1f8)]?_0x57d5f0(0x1f5):_0x57d5f0(0x1e9)},'accessKey':{'value':_0x58868e[_0x57d5f0(0x1f2)]||_0x538169['accessKey'],'source':_0x58868e['accessKey']?'app':_0x57d5f0(0x1e9)}};}function a115_0x2c79(_0x413a56,_0x3a9b07){_0x413a56=_0x413a56-0x1df;const _0x478ee1=a115_0x478e();let _0x2c79da=_0x478ee1[_0x413a56];return _0x2c79da;}function a115_0x478e(){const _0x5ce3ee=['3247983aSeKVK','Default\x20output\x20format\x20for\x20this\x20app\x20(profile)','string','Default\x20page\x20size','env','accessKey','join','1805888UkJvdW','app','pageSize','apiDir','cookie','Locale','riskLevel','Config\x20key\x20(','246825XVvcOO','907455Byisvl','en-US','format','560KFijWI','29772VJoulu','2717928hTxTRR','toLowerCase','API\x20directory\x20path','defaultApp','2488eoJAtt','zh-CN','apps','Target\x20environment','Auth\x20cookie','filter','map','length','locale','appcode','number','inherit','411XZgGzG','has','Access\x20key'];a115_0x478e=function(){return _0x5ce3ee;};return a115_0x478e();}export function buildCanonicalAppConfig(_0x2833cc,_0xf3b3e7){const _0x2facf3=a115_0x16683e,_0x14c126=_0x2833cc[_0x2facf3(0x1e4)](_0x579731=>String(_0x579731||'')['trim']())[_0x2facf3(0x1e3)](Boolean);if(_0x14c126[_0x2facf3(0x1e5)]===0x0)return{};const _0x1c8ecb={};for(const _0x99d138 of _0x14c126){_0x1c8ecb[_0x99d138]=_0xf3b3e7?{'appcode':_0x99d138,'env':_0xf3b3e7}:{'appcode':_0x99d138};}return{'apps':_0x1c8ecb,'defaultApp':_0x14c126[0x0]};}export function buildCanonicalProjectConfig(_0x5e0145,_0x11ce69){const _0x58f6d7=a115_0x16683e,{appCodes:appCodes=[],env:_0x4c38f8,metadata:_0x4256bd}=_0x11ce69,_0x560eac={..._0x5e0145,..._0x4256bd||{}};delete _0x560eac[_0x58f6d7(0x1e7)],delete _0x560eac['app'];if(_0x4c38f8)_0x560eac['env']=_0x4c38f8;else!_0x560eac[_0x58f6d7(0x1f1)]&&(_0x560eac[_0x58f6d7(0x1f1)]=DEFAULT_CONFIG_VALUES[_0x58f6d7(0x1f1)]);const _0x1d79d5=buildCanonicalAppConfig(appCodes,_0x560eac[_0x58f6d7(0x1f1)]);return Object['keys'](_0x1d79d5)[_0x58f6d7(0x1e5)]>0x0&&(_0x560eac[_0x58f6d7(0x1e0)]=_0x1d79d5[_0x58f6d7(0x1e0)],_0x560eac[_0x58f6d7(0x205)]=_0x1d79d5[_0x58f6d7(0x205)]),_0x560eac;}const LOCALE_MAP={'zh':a115_0x16683e(0x1df),'zh-cn':a115_0x16683e(0x1df),'zh_cn':'zh-CN','en':a115_0x16683e(0x1fe),'en-us':a115_0x16683e(0x1fe),'en_us':a115_0x16683e(0x1fe)};export function normalizeLocale(_0x2d7548){const _0x3cfb2b=a115_0x16683e;if(!_0x2d7548)return null;return LOCALE_MAP[_0x2d7548[_0x3cfb2b(0x203)]()]??null;}
|
package/lib/constant/cdn.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a116_0x507600=a116_0x5e43;function a116_0x1001(){const _0x5f1bee=['3918rGGRUQ','3321882nFvSYr','17435480jrYkOc','3964ZBhGwM','836485FCnums','2457973LaOSfw','3445JXhZAm','45614VAAYNc','591gYtkCV','8nJGzRc','https://g.lovrabet.com/dist/rabetbase-cli/config/index.json'];a116_0x1001=function(){return _0x5f1bee;};return a116_0x1001();}function a116_0x5e43(_0x193990,_0x2631c1){_0x193990=_0x193990-0x174;const _0x1001f3=a116_0x1001();let _0x5e4377=_0x1001f3[_0x193990];return _0x5e4377;}(function(_0x234577,_0x1d4c2e){const _0x3addf6=a116_0x5e43,_0x4ca68d=_0x234577();while(!![]){try{const _0x49be67=-parseInt(_0x3addf6(0x179))/0x1+-parseInt(_0x3addf6(0x17c))/0x2+-parseInt(_0x3addf6(0x17d))/0x3*(parseInt(_0x3addf6(0x178))/0x4)+parseInt(_0x3addf6(0x17b))/0x5*(parseInt(_0x3addf6(0x175))/0x6)+-parseInt(_0x3addf6(0x17a))/0x7+parseInt(_0x3addf6(0x17e))/0x8*(-parseInt(_0x3addf6(0x176))/0x9)+parseInt(_0x3addf6(0x177))/0xa;if(_0x49be67===_0x1d4c2e)break;else _0x4ca68d['push'](_0x4ca68d['shift']());}catch(_0xfadb78){_0x4ca68d['push'](_0x4ca68d['shift']());}}}(a116_0x1001,0x66395));export const CLI_VERSION_POLICY_URL=a116_0x507600(0x174);
|
package/lib/constant/cli.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a117_0x9ee5bd=a117_0x1ba5;(function(_0x32764f,_0x556444){const _0x3db71c=a117_0x1ba5,_0x3641c5=_0x32764f();while(!![]){try{const _0xd9ff22=parseInt(_0x3db71c(0x14f))/0x1+parseInt(_0x3db71c(0x168))/0x2+parseInt(_0x3db71c(0x180))/0x3*(parseInt(_0x3db71c(0x17b))/0x4)+-parseInt(_0x3db71c(0x190))/0x5*(parseInt(_0x3db71c(0x1a7))/0x6)+parseInt(_0x3db71c(0x15c))/0x7*(parseInt(_0x3db71c(0x188))/0x8)+parseInt(_0x3db71c(0x171))/0x9*(-parseInt(_0x3db71c(0x16a))/0xa)+-parseInt(_0x3db71c(0x152))/0xb;if(_0xd9ff22===_0x556444)break;else _0x3641c5['push'](_0x3641c5['shift']());}catch(_0x407ad9){_0x3641c5['push'](_0x3641c5['shift']());}}}(a117_0xce85,0x7e344));export const CLI_BIN_NAME=a117_0x9ee5bd(0x15d);export const CLI_DISPLAY_NAME='Rabetbase\x20CLI';export const NPM_PACKAGE_NAME=a117_0x9ee5bd(0x184);export const GLOBAL_FLAGS=[{'name':'appcode','meowKey':'appcode','type':'string','description':a117_0x9ee5bd(0x1a6),'hint':a117_0x9ee5bd(0x17d)},{'name':a117_0x9ee5bd(0x155),'meowKey':a117_0x9ee5bd(0x155),'type':a117_0x9ee5bd(0x18b),'description':a117_0x9ee5bd(0x185),'hint':a117_0x9ee5bd(0x150)},{'name':'env','meowKey':a117_0x9ee5bd(0x158),'type':a117_0x9ee5bd(0x18b),'description':'Environment','hint':'production\x20|\x20daily'},{'name':a117_0x9ee5bd(0x187),'meowKey':a117_0x9ee5bd(0x187),'type':a117_0x9ee5bd(0x18b),'description':'Output\x20format','hint':a117_0x9ee5bd(0x198)},{'name':'jq','meowKey':'jq','type':a117_0x9ee5bd(0x18b),'description':a117_0x9ee5bd(0x179),'hint':'<expr>'},{'name':'dry-run','meowKey':a117_0x9ee5bd(0x151),'type':a117_0x9ee5bd(0x178),'description':a117_0x9ee5bd(0x15e)},{'name':a117_0x9ee5bd(0x18e),'meowKey':a117_0x9ee5bd(0x18e),'type':'boolean','description':a117_0x9ee5bd(0x183)},{'name':'non-interactive','meowKey':a117_0x9ee5bd(0x177),'type':a117_0x9ee5bd(0x178),'description':a117_0x9ee5bd(0x1a9)},{'name':a117_0x9ee5bd(0x175),'meowKey':'global','type':a117_0x9ee5bd(0x178),'description':a117_0x9ee5bd(0x169)},{'name':a117_0x9ee5bd(0x1a3),'meowKey':a117_0x9ee5bd(0x1a3),'type':a117_0x9ee5bd(0x178),'description':a117_0x9ee5bd(0x176)},{'name':'ci','meowKey':'ci','type':a117_0x9ee5bd(0x178),'description':a117_0x9ee5bd(0x164),'hidden':!![]},{'name':'help','meowKey':'help','type':a117_0x9ee5bd(0x178),'description':a117_0x9ee5bd(0x163)},{'name':a117_0x9ee5bd(0x167),'meowKey':a117_0x9ee5bd(0x167),'type':a117_0x9ee5bd(0x18b),'description':a117_0x9ee5bd(0x170),'hidden':!![]},{'name':'clear','meowKey':'clear','type':a117_0x9ee5bd(0x178),'description':'Clear','hidden':!![]},{'name':a117_0x9ee5bd(0x18c),'meowKey':'watch','type':a117_0x9ee5bd(0x178),'description':a117_0x9ee5bd(0x19e),'hidden':!![]},{'name':a117_0x9ee5bd(0x172),'meowKey':a117_0x9ee5bd(0x172),'type':'string','description':'Output\x20path','hidden':!![]},{'name':a117_0x9ee5bd(0x192),'meowKey':'params','type':'string','description':a117_0x9ee5bd(0x1a1),'hidden':!![]},{'name':a117_0x9ee5bd(0x17f),'meowKey':'datasetcode','type':a117_0x9ee5bd(0x18b),'description':'Dataset\x20code','hidden':!![]},{'name':a117_0x9ee5bd(0x19c),'meowKey':a117_0x9ee5bd(0x19c),'type':'boolean','description':a117_0x9ee5bd(0x160),'hidden':!![]},{'name':'enable-bff-save','meowKey':a117_0x9ee5bd(0x197),'type':a117_0x9ee5bd(0x178),'description':'Enable\x20BFF\x20save','hidden':!![]},{'name':'id','meowKey':'id','type':a117_0x9ee5bd(0x18b),'description':'Record\x20ID','hidden':!![]},{'name':a117_0x9ee5bd(0x199),'meowKey':a117_0x9ee5bd(0x199),'type':a117_0x9ee5bd(0x18b),'description':a117_0x9ee5bd(0x162),'hidden':!![]},{'name':'file','meowKey':a117_0x9ee5bd(0x17a),'type':a117_0x9ee5bd(0x18b),'description':a117_0x9ee5bd(0x15f),'hidden':!![]},{'name':'sqlcode','meowKey':'sqlcode','type':a117_0x9ee5bd(0x18b),'description':a117_0x9ee5bd(0x19d),'hidden':!![]},{'name':'sql-name','meowKey':'sqlName','type':a117_0x9ee5bd(0x18b),'description':'SQL\x20name','hidden':!![]},{'name':'sqlname','meowKey':'sqlname','type':a117_0x9ee5bd(0x18b),'description':a117_0x9ee5bd(0x195),'hidden':!![]},{'name':a117_0x9ee5bd(0x18a),'meowKey':a117_0x9ee5bd(0x161),'type':a117_0x9ee5bd(0x18b),'description':a117_0x9ee5bd(0x16f),'hidden':!![]},{'name':a117_0x9ee5bd(0x16e),'meowKey':a117_0x9ee5bd(0x16e),'type':a117_0x9ee5bd(0x18b),'description':a117_0x9ee5bd(0x16f),'hidden':!![]},{'name':a117_0x9ee5bd(0x1a0),'meowKey':a117_0x9ee5bd(0x1a0),'type':a117_0x9ee5bd(0x18b),'description':a117_0x9ee5bd(0x1a2),'hidden':!![]},{'name':'page','meowKey':a117_0x9ee5bd(0x19a),'type':a117_0x9ee5bd(0x18b),'description':a117_0x9ee5bd(0x154),'hidden':!![]},{'name':a117_0x9ee5bd(0x196),'meowKey':'pagesize','type':a117_0x9ee5bd(0x18b),'description':'Page\x20size','hidden':!![]},{'name':'keyword','meowKey':a117_0x9ee5bd(0x15b),'type':'string','description':a117_0x9ee5bd(0x189),'hidden':!![]},{'name':a117_0x9ee5bd(0x17e),'meowKey':a117_0x9ee5bd(0x17e),'type':'string','description':'Code\x20filter','hidden':!![]},{'name':a117_0x9ee5bd(0x1a5),'meowKey':'sql','type':a117_0x9ee5bd(0x18b),'description':'SQL\x20string','hidden':!![]},{'name':a117_0x9ee5bd(0x194),'meowKey':a117_0x9ee5bd(0x194),'type':a117_0x9ee5bd(0x18b),'description':a117_0x9ee5bd(0x157),'hidden':!![]},{'name':'operation','meowKey':a117_0x9ee5bd(0x16d),'type':a117_0x9ee5bd(0x18b),'description':'Operation\x20type','hidden':!![]},{'name':a117_0x9ee5bd(0x165),'meowKey':'target','type':a117_0x9ee5bd(0x18b),'description':'Target\x20path','hidden':!![]},{'name':a117_0x9ee5bd(0x173),'meowKey':a117_0x9ee5bd(0x156),'type':'boolean','description':a117_0x9ee5bd(0x159),'hidden':!![]},{'name':a117_0x9ee5bd(0x19f),'meowKey':'key','type':a117_0x9ee5bd(0x18b),'description':a117_0x9ee5bd(0x15a),'hidden':!![]},{'name':'value','meowKey':a117_0x9ee5bd(0x16c),'type':a117_0x9ee5bd(0x18b),'description':a117_0x9ee5bd(0x193),'hidden':!![]},{'name':a117_0x9ee5bd(0x1a8),'meowKey':a117_0x9ee5bd(0x1a8),'type':a117_0x9ee5bd(0x178),'description':'Force\x20overwrite','hidden':!![]},{'name':'remote','meowKey':a117_0x9ee5bd(0x181),'type':a117_0x9ee5bd(0x178),'description':'Use\x20remote','hidden':!![]},{'name':a117_0x9ee5bd(0x153),'meowKey':a117_0x9ee5bd(0x153),'type':a117_0x9ee5bd(0x178),'description':a117_0x9ee5bd(0x191),'hidden':!![]},{'name':a117_0x9ee5bd(0x166),'meowKey':a117_0x9ee5bd(0x1a4),'type':a117_0x9ee5bd(0x18b),'description':'Operation\x20type','hidden':!![]},{'name':'function-node','meowKey':a117_0x9ee5bd(0x18f),'type':'string','description':a117_0x9ee5bd(0x19b),'hidden':!![]}];function a117_0x1ba5(_0x42f348,_0x4b556e){_0x42f348=_0x42f348-0x14f;const _0xce858f=a117_0xce85();let _0x1ba595=_0xce858f[_0x42f348];return _0x1ba595;}function a117_0xce85(){const _0x57de3e=['datasetcode','10080GzFAJM','remote','meowKey','Skip\x20confirmation\x20for\x20high-risk\x20writes','@lovrabet/rabetbase-cli','Select\x20app\x20profile\x20by\x20name','appcode','format','1544fDnyaQ','Keyword\x20filter','db-id','string','watch','fromEntries','yes','functionNode','717770UcdrZr','Verbose\x20output','params','Config\x20value','schemas','SQL\x20name','pagesize','enableBffSave','json\x20|\x20pretty\x20|\x20compress','type','page','Function\x20node','all','SQL\x20code','Watch\x20mode','key','description','JSON\x20params','Description','project','operationType','sql','Override\x20appcode','6raEDOc','force','Force\x20non-interactive\x20mode\x20(CI)','863114xLntma','<name>','dryRun','8677548NTKknR','verbose','Page\x20number','app','skipImports','Schemas','env','Skip\x20import\x20generation','Config\x20key','keyword','15456mDZpFp','rabetbase','Preview\x20operation\x20without\x20executing','File\x20path','Apply\x20to\x20all','dbId','Type\x20filter','Show\x20help','Alias\x20for\x20--non-interactive','target','operation-type','name','121828yJtZaN','Use\x20global\x20config\x20scope','4258490ohuegX','map','value','operation','dbid','DB\x20ID','Name','18NNzrek','output','skip-imports','non-interactive','global','Use\x20project\x20config\x20scope','nonInteractive','boolean','Filter\x20JSON\x20output\x20(bundled\x20jq\x20via\x20node-jq,\x20else\x20PATH;\x20use\x20with\x20--format\x20json\x20or\x20compress)','file','1132ZRxzaP','dry-run','<code>','code'];a117_0xce85=function(){return _0x57de3e;};return a117_0xce85();}export const PIPELINE_FLAG_NAMES=new Set([a117_0x9ee5bd(0x186),a117_0x9ee5bd(0x155),a117_0x9ee5bd(0x158),a117_0x9ee5bd(0x187),'jq',a117_0x9ee5bd(0x17c),a117_0x9ee5bd(0x18e),a117_0x9ee5bd(0x174),'ci']);export function buildMeowFlags(){const _0x19a5a3=a117_0x9ee5bd;return Object[_0x19a5a3(0x18d)](GLOBAL_FLAGS[_0x19a5a3(0x16b)](_0x562b6c=>[_0x562b6c[_0x19a5a3(0x182)],{'type':_0x562b6c[_0x19a5a3(0x199)]}]));}
|
package/lib/constant/defaults.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a118_0x394586=a118_0x454c;(function(_0x45a108,_0x2e81a4){const _0x12130e=a118_0x454c,_0x28473a=_0x45a108();while(!![]){try{const _0x2fca34=-parseInt(_0x12130e(0x150))/0x1+parseInt(_0x12130e(0x153))/0x2*(parseInt(_0x12130e(0x14a))/0x3)+-parseInt(_0x12130e(0x14b))/0x4+parseInt(_0x12130e(0x14c))/0x5*(-parseInt(_0x12130e(0x14f))/0x6)+-parseInt(_0x12130e(0x151))/0x7*(-parseInt(_0x12130e(0x157))/0x8)+-parseInt(_0x12130e(0x152))/0x9*(-parseInt(_0x12130e(0x155))/0xa)+parseInt(_0x12130e(0x14d))/0xb;if(_0x2fca34===_0x2e81a4)break;else _0x28473a['push'](_0x28473a['shift']());}catch(_0x5a5ec5){_0x28473a['push'](_0x28473a['shift']());}}}(a118_0x2c77,0x4c11e));function a118_0x454c(_0x40f492,_0x3b67cf){_0x40f492=_0x40f492-0x14a;const _0x2c778c=a118_0x2c77();let _0x454c89=_0x2c778c[_0x40f492];return _0x454c89;}import{DEFAULT_API_DIR}from'../constant/paths.js';function a118_0x2c77(){const _0x54529a=['2485175RDSEFm','high-risk-write','1811310fwbZrd','314119EOQjIp','2084579dhSjio','264825aRAtCV','478526bqDVxO','compress','10mtcvid','en-US','16Mdrhlx','3dzLice','650484RgvJvx','5YpBWXb'];a118_0x2c77=function(){return _0x54529a;};return a118_0x2c77();}export const DEFAULT_CONFIG_VALUES={'env':'production','format':a118_0x394586(0x154),'locale':a118_0x394586(0x156),'riskLevel':a118_0x394586(0x14e),'apiDir':DEFAULT_API_DIR};export const DEFAULT_COMMAND_OUTPUT_FORMAT=a118_0x394586(0x154);
|
package/lib/constant/domain.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a119_0x427953=a119_0x1680;(function(_0xf430f3,_0x1b5f3a){const _0x33102e=a119_0x1680,_0x4ba3fb=_0xf430f3();while(!![]){try{const _0x749f60=-parseInt(_0x33102e(0x1de))/0x1*(-parseInt(_0x33102e(0x1d5))/0x2)+parseInt(_0x33102e(0x1e1))/0x3*(parseInt(_0x33102e(0x1df))/0x4)+parseInt(_0x33102e(0x1d8))/0x5+parseInt(_0x33102e(0x1e0))/0x6*(parseInt(_0x33102e(0x1d6))/0x7)+-parseInt(_0x33102e(0x1d9))/0x8+parseInt(_0x33102e(0x1e3))/0x9+-parseInt(_0x33102e(0x1db))/0xa;if(_0x749f60===_0x1b5f3a)break;else _0x4ba3fb['push'](_0x4ba3fb['shift']());}catch(_0x3c9cff){_0x4ba3fb['push'](_0x4ba3fb['shift']());}}}(a119_0x44b4,0xe36bb));import{getEnv,isProduction}from'../constant/env.js';let customApiDomain,customUserDomain,customRuntimeDomain;export function initDomains(_0x572a66){const _0x3798d2=a119_0x1680;customApiDomain=_0x572a66?.[_0x3798d2(0x1dd)],customUserDomain=_0x572a66?.[_0x3798d2(0x1d7)],customRuntimeDomain=_0x572a66?.[_0x3798d2(0x1e4)];}export const getUserDomain=()=>customUserDomain||(isProduction(getEnv())?'https://user.lovrabet.com':'https://user-daily.lovrabet.com');function a119_0x1680(_0x257e18,_0x3cb7d4){_0x257e18=_0x257e18-0x1d5;const _0x44b4e5=a119_0x44b4();let _0x1680c6=_0x44b4e5[_0x257e18];return _0x1680c6;}export const getApiDomain=()=>customApiDomain||(isProduction(getEnv())?a119_0x427953(0x1e2):a119_0x427953(0x1dc));export const getRuntimeDomain=()=>customRuntimeDomain||(isProduction(getEnv())?'https://runtime.lovrabet.com':a119_0x427953(0x1da));function a119_0x44b4(){const _0x2a2535=['1263380dIGdgv','48eTYwEi','15txntoz','https://api.lovrabet.com','9968697RYRXwJ','runtimeDomain','2eOHksk','673246haPFXW','userDomain','1559525gaxAqx','9714544CgOJqs','https://daily-runtime.lovrabet.com','20939410kugFWQ','https://daily-api.lovrabet.com','apiDomain','471587nYsEBv'];a119_0x44b4=function(){return _0x2a2535;};return a119_0x44b4();}
|
package/lib/constant/env.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a120_0x5e9e3a=a120_0x2d39;function a120_0x2d39(_0x4cb70d,_0x36ec2a){_0x4cb70d=_0x4cb70d-0x1b1;const _0x41560a=a120_0x4156();let _0x2d39c4=_0x41560a[_0x4cb70d];return _0x2d39c4;}(function(_0x3efb01,_0x260cac){const _0x4c7f43=a120_0x2d39,_0x1db337=_0x3efb01();while(!![]){try{const _0x2b25d1=parseInt(_0x4c7f43(0x1bc))/0x1+parseInt(_0x4c7f43(0x1ba))/0x2+-parseInt(_0x4c7f43(0x1b8))/0x3*(-parseInt(_0x4c7f43(0x1b4))/0x4)+-parseInt(_0x4c7f43(0x1c0))/0x5*(-parseInt(_0x4c7f43(0x1bd))/0x6)+parseInt(_0x4c7f43(0x1b9))/0x7*(parseInt(_0x4c7f43(0x1bb))/0x8)+-parseInt(_0x4c7f43(0x1b6))/0x9*(-parseInt(_0x4c7f43(0x1b5))/0xa)+parseInt(_0x4c7f43(0x1b3))/0xb*(-parseInt(_0x4c7f43(0x1b2))/0xc);if(_0x2b25d1===_0x260cac)break;else _0x1db337['push'](_0x1db337['shift']());}catch(_0x347825){_0x1db337['push'](_0x1db337['shift']());}}}(a120_0x4156,0x263c7));export const RABETBASE_ENV_VALUES=[a120_0x5e9e3a(0x1bf),a120_0x5e9e3a(0x1b7)];export function normalizeEnv(_0x4ab5d5){const _0x5cedc4=a120_0x5e9e3a;return _0x4ab5d5===_0x5cedc4(0x1be)?'production':_0x4ab5d5;}function a120_0x4156(){const _0x2b4dec=['906BxaTar','online','production','1605czxWRV','dev','4207932MtbpoF','22irWxcm','10964YQDtyA','160PiBSAy','2358ZYhclB','daily','177ZiXXOg','119oGuHgo','458384tfCMIR','52336LIgaRO','303149NFpjSV'];a120_0x4156=function(){return _0x2b4dec;};return a120_0x4156();}export function isProduction(_0x444b5a){const _0x23561d=a120_0x5e9e3a;return normalizeEnv(_0x444b5a)===_0x23561d(0x1bf);}export function isDaily(_0x181195){return normalizeEnv(_0x181195)==='daily';}export function isDev(_0x1aa658){const _0x39620f=a120_0x5e9e3a,_0x443112=normalizeEnv(_0x1aa658);return _0x443112==='development'||_0x443112===_0x39620f(0x1b1);}let env=normalizeEnv(process.env.RABETBASE_ENV||process.env.LOVRABET_ENV||a120_0x5e9e3a(0x1bf));export function getEnv(){return env;}export function initEnv(_0x50b1e){env=normalizeEnv(_0x50b1e);}
|
package/lib/constant/output.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a121_0x37ed95=a121_0x30ce;function a121_0x3025(){const _0x30db5d=['9LWpZgk','json','380752ecJpNz','1555518LcqiOj','2057924jAbiyi','112854rNDXFM','85GIDQaS','22927580PgPUac','600199UgMgoQ','4714812zKGYgB','133kgmDAY'];a121_0x3025=function(){return _0x30db5d;};return a121_0x3025();}(function(_0xf398a3,_0x1e5cf0){const _0x27a80d=a121_0x30ce,_0x277f7a=_0xf398a3();while(!![]){try{const _0x48aed8=parseInt(_0x27a80d(0x16e))/0x1+-parseInt(_0x27a80d(0x16a))/0x2+parseInt(_0x27a80d(0x174))/0x3+-parseInt(_0x27a80d(0x16f))/0x4+-parseInt(_0x27a80d(0x16c))/0x5*(-parseInt(_0x27a80d(0x16b))/0x6)+-parseInt(_0x27a80d(0x170))/0x7*(parseInt(_0x27a80d(0x173))/0x8)+parseInt(_0x27a80d(0x171))/0x9*(parseInt(_0x27a80d(0x16d))/0xa);if(_0x48aed8===_0x1e5cf0)break;else _0x277f7a['push'](_0x277f7a['shift']());}catch(_0x1b1f7a){_0x277f7a['push'](_0x277f7a['shift']());}}}(a121_0x3025,0x97301));function a121_0x30ce(_0x53f8bc,_0x2b6fc3){_0x53f8bc=_0x53f8bc-0x16a;const _0x3025df=a121_0x3025();let _0x30ceba=_0x3025df[_0x53f8bc];return _0x30ceba;}export const RABETBASE_OUTPUT_FORMAT_VALUES=[a121_0x37ed95(0x172),'pretty','compress'];
|
package/lib/constant/paths.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a122_0x805a(_0x1a709a,_0x2cebff){_0x1a709a=_0x1a709a-0x14c;const _0x5ed571=a122_0x5ed5();let _0x805ac2=_0x5ed571[_0x1a709a];return _0x805ac2;}const a122_0xb6edde=a122_0x805a;(function(_0x376e77,_0x77dd43){const _0x4c4b9d=a122_0x805a,_0x363308=_0x376e77();while(!![]){try{const _0x1ef74c=parseInt(_0x4c4b9d(0x14c))/0x1*(-parseInt(_0x4c4b9d(0x154))/0x2)+parseInt(_0x4c4b9d(0x153))/0x3*(-parseInt(_0x4c4b9d(0x14d))/0x4)+-parseInt(_0x4c4b9d(0x157))/0x5*(parseInt(_0x4c4b9d(0x14e))/0x6)+-parseInt(_0x4c4b9d(0x152))/0x7*(parseInt(_0x4c4b9d(0x150))/0x8)+parseInt(_0x4c4b9d(0x158))/0x9+-parseInt(_0x4c4b9d(0x151))/0xa*(-parseInt(_0x4c4b9d(0x156))/0xb)+parseInt(_0x4c4b9d(0x14f))/0xc;if(_0x1ef74c===_0x77dd43)break;else _0x363308['push'](_0x363308['shift']());}catch(_0x1b73d){_0x363308['push'](_0x363308['shift']());}}}(a122_0x5ed5,0x45f90));function a122_0x5ed5(){const _0xac16bd=['8aSiZkM','4421410aHcINq','3614030CpMQGr','1600098ygxhLR','21694Qqkiog','./src/api','11nEhxdl','7960nMELKG','4076784ChXXVg','29KpNDGl','4PTsqFR','1614nDVzDI','14207496wSOIPM'];a122_0x5ed5=function(){return _0xac16bd;};return a122_0x5ed5();}export const DEFAULT_API_DIR=a122_0xb6edde(0x155);
|
package/lib/constant/risk.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a123_0x2a64(_0x1c823d,_0x378661){_0x1c823d=_0x1c823d-0x178;const _0x5a8f27=a123_0x5a8f();let _0x2a6469=_0x5a8f27[_0x1c823d];return _0x2a6469;}function a123_0x5a8f(){const _0x48a4c3=['high-risk-write','3818610lZdLQK','105894yjcRmt','16bvrTkg','write','442519QsBRaX','2420tWzouz','570WOjNeQ','450699cwFLVP','1692901AyjafG','2WQLvgB','272QChKUh','6787fVIMke'];a123_0x5a8f=function(){return _0x48a4c3;};return a123_0x5a8f();}const a123_0x14c070=a123_0x2a64;(function(_0x4c01ba,_0x1ed318){const _0x1aff9b=a123_0x2a64,_0x1c0aae=_0x4c01ba();while(!![]){try{const _0x1a6215=-parseInt(_0x1aff9b(0x181))/0x1*(-parseInt(_0x1aff9b(0x179))/0x2)+-parseInt(_0x1aff9b(0x184))/0x3+parseInt(_0x1aff9b(0x17a))/0x4*(-parseInt(_0x1aff9b(0x183))/0x5)+-parseInt(_0x1aff9b(0x17e))/0x6+-parseInt(_0x1aff9b(0x178))/0x7*(parseInt(_0x1aff9b(0x17f))/0x8)+parseInt(_0x1aff9b(0x17d))/0x9+parseInt(_0x1aff9b(0x182))/0xa*(parseInt(_0x1aff9b(0x17b))/0xb);if(_0x1a6215===_0x1ed318)break;else _0x1c0aae['push'](_0x1c0aae['shift']());}catch(_0x23d4d5){_0x1c0aae['push'](_0x1c0aae['shift']());}}}(a123_0x5a8f,0x571c3));export const RISK_LEVEL_VALUES=['read',a123_0x14c070(0x180),a123_0x14c070(0x17c)];
|