@lovrabet/rabetbase-cli 2.1.11 → 2.1.12-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/api-doc.js +1 -1
- package/lib/api/fetch-model-list.js +1 -1
- package/lib/api/generate-api-file.js +1 -1
- package/lib/auth/auth-server-ui.js +1 -1
- package/lib/auth/auth-server.js +1 -1
- package/lib/auth/constant.js +1 -1
- package/lib/auth/get-cookie.js +1 -1
- package/lib/auth/get-session-user.js +1 -1
- package/lib/auth/is-session-valid.js +1 -1
- package/lib/auth/login-success-html.js +1 -1
- package/lib/auth/logout.js +1 -1
- package/lib/cli-flags.js +1 -1
- package/lib/cli.js +1 -1
- package/lib/commands/api/generate.js +1 -1
- package/lib/commands/api/index.js +1 -1
- package/lib/commands/api/list.js +1 -1
- package/lib/commands/api/pull.js +1 -1
- package/lib/commands/api/shared.js +1 -1
- package/lib/commands/app/add.js +1 -1
- package/lib/commands/app/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/data/filter.js +1 -1
- package/lib/commands/data/getOne.js +1 -1
- package/lib/commands/data/index.js +1 -1
- package/lib/commands/data/shared.js +1 -1
- package/lib/commands/dataset/capability.js +1 -1
- package/lib/commands/dataset/delete.js +1 -1
- package/lib/commands/dataset/detail.js +1 -1
- package/lib/commands/dataset/field-update.js +1 -1
- package/lib/commands/dataset/index.js +1 -1
- package/lib/commands/dataset/link-create.js +1 -1
- package/lib/commands/dataset/link-delete.js +1 -1
- package/lib/commands/dataset/link-shared.js +1 -1
- package/lib/commands/dataset/link-update.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/issue/index.js +1 -1
- package/lib/commands/issue/report.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/telemetry/send-platform-issue-collect-log.js +1 -1
- package/lib/utils/ai_config.js +1 -1
- package/lib/utils/apply-jq-filter.js +1 -1
- package/lib/utils/cdn-config.js +1 -1
- package/lib/utils/check-sdk-version.js +1 -1
- package/lib/utils/cli-version-check.js +1 -1
- package/lib/utils/cli-version-policy.js +1 -1
- package/lib/utils/config.js +1 -1
- package/lib/utils/copy-directory.js +1 -1
- package/lib/utils/entity-with-id.js +1 -1
- package/lib/utils/file-utils.js +1 -1
- package/lib/utils/guides-cdn.js +1 -1
- package/lib/utils/http-client.js +1 -1
- package/lib/utils/is-non-interactive.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/params.js +1 -1
- package/lib/utils/platform.js +1 -1
- package/lib/utils/rules-cdn.js +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.js +1 -1
- package/lib/utils/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 +2 -2
package/lib/commands/sql/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a122_0xe25332=a122_0x3cb8;function a122_0x4262(){const _0x58917d=['utf8','sqls','paging','18119739eUTdvD','path','2911980rpcVJB','\x20written,\x20','force','sqlCode','4vNQxOf','sqlName','message','lastSync','6mSievm','27tBglPz','POST','Force\x20pull\x20cancelled.','70PmMOqR','lockFilePath','pull','No\x20remote\x20SQL\x20queries\x20matched.','1744370XaoPJr','length','Force\x20overwrite\x20local\x20unsynced\x20changes','split','\x20failed','skipped','\x20skipped,\x20','str','tableData','appCode','sqlRootDir','test','trimStart','cancelled','would_pull','Filter\x20by\x20SQL\x20display\x20name','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','bool','sqlRoot','12UDdYyO','catch','Pull\x20complete:\x20','10891160nIrfET','sqlcode','sql','totalCount','push','unchanged','name','toISOString','2960BCcNkI','2114790wvasax','dbId','sqlContent','local\x20differs\x20from\x20remote','description','9663297YoZZeo','replace','mybatisXml'];a122_0x4262=function(){return _0x58917d;};return a122_0x4262();}(function(_0x1eaefe,_0x50899d){const _0x3bb18a=a122_0x3cb8,_0x5b33ff=_0x1eaefe();while(!![]){try{const _0x1a4cf6=parseInt(_0x3bb18a(0x159))/0x1*(parseInt(_0x3bb18a(0x13f))/0x2)+parseInt(_0x3bb18a(0x140))/0x3+-parseInt(_0x3bb18a(0x151))/0x4*(-parseInt(_0x3bb18a(0x14d))/0x5)+-parseInt(_0x3bb18a(0x155))/0x6*(parseInt(_0x3bb18a(0x145))/0x7)+-parseInt(_0x3bb18a(0x137))/0x8+-parseInt(_0x3bb18a(0x156))/0x9*(-parseInt(_0x3bb18a(0x15d))/0xa)+parseInt(_0x3bb18a(0x14b))/0xb*(parseInt(_0x3bb18a(0x134))/0xc);if(_0x1a4cf6===_0x50899d)break;else _0x5b33ff['push'](_0x5b33ff['shift']());}catch(_0x55b190){_0x5b33ff['push'](_0x5b33ff['shift']());}}}(a122_0x4262,0xc81a4));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';function a122_0x3cb8(_0x1f58a1,_0x5869f9){_0x1f58a1=_0x1f58a1-0x12c;const _0x42625c=a122_0x4262();let _0x3cb846=_0x42625c[_0x1f58a1];return _0x3cb846;}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(_0x337d76,_0x46eb46){const _0x19642b=a122_0x3cb8,_0x3b5dc6=[];let _0x32da19=0x1;while(!![]){const _0x97ae6a=await listSqlQueries(_0x337d76,{'currentPage':_0x32da19,'pageSize':PAGE_SIZE,'sqlCode':_0x46eb46[_0x19642b(0x150)],'sqlName':_0x46eb46[_0x19642b(0x152)]}),_0xda8c01=_0x97ae6a[_0x19642b(0x165)]??[];_0x3b5dc6[_0x19642b(0x13b)](..._0xda8c01);if(_0xda8c01[_0x19642b(0x15e)]===0x0)break;const _0x28da48=_0x97ae6a[_0x19642b(0x14a)]?.[_0x19642b(0x13a)];if(_0x28da48!=null?_0x3b5dc6[_0x19642b(0x15e)]>=_0x28da48:_0xda8c01[_0x19642b(0x15e)]<PAGE_SIZE)break;_0x32da19++;}return _0x3b5dc6;}async function ensureSqlContent(_0x433b56){const _0x211878=a122_0x3cb8;if(_0x433b56[_0x211878(0x142)]!=null&&String(_0x433b56[_0x211878(0x142)])[_0x211878(0x15e)]>0x0)return _0x433b56;return getSqlQueryDetail(_0x433b56[_0x211878(0x150)]);}export const sqlPull={'service':a122_0xe25332(0x139),'command':a122_0xe25332(0x15b),'description':'Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','risk':'write','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a122_0xe25332(0x13d),'type':'string','description':a122_0xe25332(0x130)},{'name':a122_0xe25332(0x14f),'type':'boolean','description':a122_0xe25332(0x15f)}],async 'dryRun'(_0x290611){const _0x358c51=a122_0xe25332,_0xedb627=loadSqlProjectConfig(_0x290611[_0x358c51(0x166)]),_0x1321ea=await readSqlLockFile(_0xedb627['lockFilePath']),{appLock:_0x315bb4}=ensureSqlLockScope(_0x1321ea??createEmptySqlLock(),_0xedb627[_0x358c51(0x166)],_0xedb627[_0x358c51(0x133)],_0x358c51(0x15b)),_0x2da727=await fetchAllSqlQueries(_0x290611[_0x358c51(0x166)],{'sqlCode':_0x290611['str'](_0x358c51(0x138))||undefined,'sqlName':_0x290611[_0x358c51(0x164)](_0x358c51(0x13d))||undefined}),_0xfc4ed0=[];for(const _0x388272 of _0x2da727){const _0x173402=await ensureSqlContent(_0x388272),_0x4efd2a=ensureRemoteSqlContent(_0x173402),_0x1ff38d=detectModeFromSql(_0x173402),_0x4d8562=_0x173402[_0x358c51(0x141)]?await getDbName(_0x290611[_0x358c51(0x166)],Number(_0x173402[_0x358c51(0x141)]))[_0x358c51(0x135)](()=>undefined):undefined,_0x3131c5=buildLocalSqlFileContent({'sqlCode':_0x173402[_0x358c51(0x150)],'sqlName':_0x173402['sqlName'],'dbId':_0x173402[_0x358c51(0x141)]},_0x4efd2a,{'dbName':_0x4d8562,'mode':_0x1ff38d,'syncedAt':new Date()['toISOString'](),'description':_0x173402[_0x358c51(0x144)]}),_0x4321d3=buildSqlLockEntry(_0x173402,_0x4efd2a,'',{'dbName':_0x4d8562}),_0x4df309=resolveLocalSqlFilePath(_0xedb627,_0x173402['sqlCode'],_0x4321d3);let _0x2e7a44=_0x358c51(0x12f),_0x4b43ea;if(await fileExists(_0x4df309)){const _0xeef235=await readFile(_0x4df309,_0x358c51(0x148));isEquivalentPulledSqlFile(_0xeef235,_0x3131c5,_0x1ff38d)?(_0x2e7a44=_0x358c51(0x162),_0x4b43ea=_0x358c51(0x13c)):(_0x2e7a44='conflict',_0x4b43ea='local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)');}_0xfc4ed0[_0x358c51(0x13b)]({'sqlCode':_0x173402[_0x358c51(0x150)],'sqlName':_0x173402[_0x358c51(0x152)],'filePath':_0x4df309,'status':_0x2e7a44,'reason':_0x4b43ea});}return{'method':_0x358c51(0x157),'url':'/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','body':{'appCode':_0x290611['appCode'],'sqlCode':_0x290611[_0x358c51(0x164)]('sqlcode')||null,'sqlName':_0x290611[_0x358c51(0x164)](_0x358c51(0x13d))||null,'files':_0xfc4ed0},'description':'Would\x20pull\x20'+_0xfc4ed0[_0x358c51(0x15e)]+'\x20SQL\x20file(s)\x20into\x20'+_0xedb627[_0x358c51(0x167)]};},async 'execute'(_0xef5581){const _0x31ff2e=a122_0xe25332,_0x22c0a8=loadSqlProjectConfig(_0xef5581[_0x31ff2e(0x166)]),_0x174c8c=await readSqlLockFile(_0x22c0a8['lockFilePath']),{lockData:_0x4ada0b,appLock:_0x2e9cef}=ensureSqlLockScope(_0x174c8c??createEmptySqlLock(),_0x22c0a8[_0x31ff2e(0x166)],_0x22c0a8['sqlRoot'],'pull'),_0xfab3f9=_0xef5581[_0x31ff2e(0x132)](_0x31ff2e(0x14f)),_0x40cc6d=await fetchAllSqlQueries(_0xef5581[_0x31ff2e(0x166)],{'sqlCode':_0xef5581['str']('sqlcode')||undefined,'sqlName':_0xef5581['str']('name')||undefined});if(_0x40cc6d['length']===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x31ff2e(0x15c)};const _0x342fa6=[],_0xc7d9a2=[];for(const _0x34275d of _0x40cc6d){try{_0x342fa6[_0x31ff2e(0x13b)](await ensureSqlContent(_0x34275d));}catch(_0xbe7334){_0xc7d9a2['push']({'sqlCode':_0x34275d[_0x31ff2e(0x150)],'error':_0xbe7334 instanceof Error?_0xbe7334[_0x31ff2e(0x153)]:String(_0xbe7334)});}}if(_0xfab3f9&&!_0xef5581['nonInteractive']){let _0x560087=![];for(const _0x25fcf1 of _0x342fa6){const _0xca8ce5=detectModeFromSql(_0x25fcf1),_0x10f32c=_0x25fcf1[_0x31ff2e(0x141)]?await getDbName(_0xef5581['appCode'],Number(_0x25fcf1[_0x31ff2e(0x141)]))[_0x31ff2e(0x135)](()=>undefined):undefined,_0x38ff07=buildLocalSqlFileContent({'sqlCode':_0x25fcf1[_0x31ff2e(0x150)],'sqlName':_0x25fcf1[_0x31ff2e(0x152)],'dbId':_0x25fcf1[_0x31ff2e(0x141)]},ensureRemoteSqlContent(_0x25fcf1),{'dbName':_0x10f32c,'mode':_0xca8ce5,'syncedAt':new Date()[_0x31ff2e(0x13e)](),'description':_0x25fcf1['description']}),_0x2a75ec=resolveLocalSqlFilePath(_0x22c0a8,_0x25fcf1[_0x31ff2e(0x150)],buildSqlLockEntry(_0x25fcf1,ensureRemoteSqlContent(_0x25fcf1),'',{'dbName':_0x10f32c}));if(await fileExists(_0x2a75ec)){const _0x47614f=await readFile(_0x2a75ec,_0x31ff2e(0x148));if(!isEquivalentPulledSqlFile(_0x47614f,_0x38ff07,_0xca8ce5)){_0x560087=!![];break;}}}if(_0x560087){const _0x36d234=await confirmForceOverwrite(_0x31ff2e(0x131));if(!_0x36d234)throw CliErrors[_0x31ff2e(0x12e)](_0x31ff2e(0x158));}}const _0x2a1a0b=cloneSqlLockData(_0x4ada0b),_0x309dd4=_0x2a1a0b['apps'][_0x22c0a8[_0x31ff2e(0x166)]],_0x1b93fe=[],_0x54cd37=[];for(const _0x5e3f0d of _0x342fa6){const _0xd09e7d=_0x309dd4[_0x31ff2e(0x149)][_0x5e3f0d[_0x31ff2e(0x150)]],_0x19eb76=ensureRemoteSqlContent(_0x5e3f0d),_0x203d3c=detectModeFromSql(_0x5e3f0d),_0x2283d9=_0x5e3f0d[_0x31ff2e(0x141)]?await getDbName(_0xef5581['appCode'],Number(_0x5e3f0d[_0x31ff2e(0x141)]))[_0x31ff2e(0x135)](()=>undefined):undefined,_0x5657e0=buildLocalSqlFileContent({'sqlCode':_0x5e3f0d[_0x31ff2e(0x150)],'sqlName':_0x5e3f0d[_0x31ff2e(0x152)],'dbId':_0x5e3f0d[_0x31ff2e(0x141)]},_0x19eb76,{'dbName':_0x2283d9,'mode':_0x203d3c,'syncedAt':new Date()[_0x31ff2e(0x13e)](),'description':_0x5e3f0d[_0x31ff2e(0x144)]}),_0x56702b=buildSqlLockEntry(_0x5e3f0d,_0x19eb76,computeSqlContentHash(_0x5657e0),{'dbName':_0x2283d9}),_0x58497a=_0x56702b[_0x31ff2e(0x14c)],_0x4f38b2=join(_0x22c0a8['sqlRootDir'],_0x58497a);try{if(await fileExists(_0x4f38b2)){const _0x52b990=await readFile(_0x4f38b2,'utf8');if(isEquivalentPulledSqlFile(_0x52b990,_0x5657e0,_0x203d3c)){_0x54cd37[_0x31ff2e(0x13b)]({'sqlCode':_0x5e3f0d[_0x31ff2e(0x150)],'reason':_0x31ff2e(0x13c)}),_0x309dd4[_0x31ff2e(0x149)][_0x5e3f0d['sqlCode']]={..._0x56702b,'hash':computeSqlContentHash(_0x52b990),'path':_0x58497a};continue;}if(!_0xfab3f9){_0x54cd37[_0x31ff2e(0x13b)]({'sqlCode':_0x5e3f0d['sqlCode'],'reason':_0x31ff2e(0x143)});continue;}}const _0x75a01=_0xd09e7d?.[_0x31ff2e(0x14c)]?join(_0x22c0a8[_0x31ff2e(0x167)],_0xd09e7d['path']):undefined;_0x75a01&&_0x75a01!==_0x4f38b2&&await fileExists(_0x75a01)&&await rm(_0x75a01,{'force':!![]}),await ensureParentDirectory(_0x4f38b2),await writeFile(_0x4f38b2,_0x5657e0,_0x31ff2e(0x148)),_0x309dd4[_0x31ff2e(0x149)][_0x5e3f0d['sqlCode']]={..._0x56702b,'path':_0x58497a},_0x1b93fe[_0x31ff2e(0x13b)]({'sqlCode':_0x5e3f0d[_0x31ff2e(0x150)],'filePath':_0x4f38b2});}catch(_0x2a5b5f){_0xc7d9a2['push']({'sqlCode':_0x5e3f0d[_0x31ff2e(0x150)],'error':_0x2a5b5f instanceof Error?_0x2a5b5f[_0x31ff2e(0x153)]:String(_0x2a5b5f)});}}return _0x309dd4[_0x31ff2e(0x154)]=new Date()[_0x31ff2e(0x13e)](),await writeSqlLockFile(_0x22c0a8[_0x31ff2e(0x15a)],_0x2a1a0b),{'ok':_0xc7d9a2['length']===0x0,'data':{'pulled':_0x1b93fe,'skipped':_0x54cd37,'failed':_0xc7d9a2},'message':_0x31ff2e(0x136)+_0x1b93fe[_0x31ff2e(0x15e)]+_0x31ff2e(0x14e)+_0x54cd37['length']+_0x31ff2e(0x163)+_0xc7d9a2[_0x31ff2e(0x15e)]+_0x31ff2e(0x161)};}};function detectModeFromSql(_0x591e79){const _0x3b2cc1=a122_0xe25332,_0x4a1b12=ensureRemoteSqlContent(_0x591e79),_0x3f7693=stripLocalSqlMetadata(_0x4a1b12,_0x3b2cc1(0x147))[_0x3b2cc1(0x12d)]();if(/^<(select|insert|update|delete)\b/i[_0x3b2cc1(0x12c)](_0x3f7693))return _0x3b2cc1(0x147);return _0x3b2cc1(0x139);}function isEquivalentPulledSqlFile(_0x5aa7b6,_0x4af99e,_0x120978){return normalizePullComparableContent(_0x5aa7b6,_0x120978)===normalizePullComparableContent(_0x4af99e,_0x120978);}function normalizePullComparableContent(_0x5e5bb5,_0x55b3bf){const _0x1b829b=a122_0xe25332,_0xb59673=_0x5e5bb5[_0x1b829b(0x146)](/\r\n/g,'\x0a')[_0x1b829b(0x160)]('\x0a'),_0x5dc6f3=_0xb59673['filter'](_0x528887=>!isSyncedAtMetadataLine(_0x528887,_0x55b3bf));return _0x5dc6f3['join']('\x0a');}function isSyncedAtMetadataLine(_0x2de522,_0x48872b){const _0x2415dc=a122_0xe25332;if(_0x48872b==='mybatisXml')return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x2415dc(0x12c)](_0x2de522);return/^\s*--\s*@lovrabet\.syncedAt:/['test'](_0x2de522);}
|
|
1
|
+
const a122_0x13f87d=a122_0x4b85;(function(_0x202886,_0x21702d){const _0x167c19=a122_0x4b85,_0xf56a4c=_0x202886();while(!![]){try{const _0x45c7ee=parseInt(_0x167c19(0x1a6))/0x1*(parseInt(_0x167c19(0x18e))/0x2)+parseInt(_0x167c19(0x1a8))/0x3+parseInt(_0x167c19(0x1ab))/0x4*(-parseInt(_0x167c19(0x1a5))/0x5)+-parseInt(_0x167c19(0x174))/0x6*(-parseInt(_0x167c19(0x194))/0x7)+-parseInt(_0x167c19(0x196))/0x8+-parseInt(_0x167c19(0x170))/0x9+parseInt(_0x167c19(0x177))/0xa;if(_0x45c7ee===_0x21702d)break;else _0xf56a4c['push'](_0xf56a4c['shift']());}catch(_0x35c221){_0xf56a4c['push'](_0xf56a4c['shift']());}}}(a122_0x242b,0x61943));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 a122_0x4b85(_0x1b05d0,_0x23d7ad){_0x1b05d0=_0x1b05d0-0x170;const _0x242b8c=a122_0x242b();let _0x4b85fc=_0x242b8c[_0x1b05d0];return _0x4b85fc;}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';function a122_0x242b(){const _0x274f63=['22JkxTKo','bool','2228811fHqlEC','path','sqlName','12608WMWZah','lastSync','string','Filter\x20by\x20SQL\x20display\x20name','6684390mWPQfL','split','toISOString','sqlContent','48534ARuwzp','catch','replace','6279700BdzltI','nonInteractive','would_pull','paging','write','utf8','test','sqls','force','unchanged','POST','sqlRootDir','tableData','pull','appCode','sqlRoot','\x20skipped,\x20','local\x20differs\x20from\x20remote','str','filter','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','mybatisXml','description','11446WioRYK','No\x20remote\x20SQL\x20queries\x20matched.','skipped','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','length','371uTEypr','totalCount','61960LlXrFc','cancelled','sql','push','\x20written,\x20','dbId','\x20SQL\x20file(s)\x20into\x20','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','lockFilePath','conflict','name','message','sqlCode','trimStart','\x20failed','1230VhRRit'];a122_0x242b=function(){return _0x274f63;};return a122_0x242b();}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(_0x81bece,_0x55d9f5){const _0x30e665=a122_0x4b85,_0xc646aa=[];let _0x440e96=0x1;while(!![]){const _0x824189=await listSqlQueries(_0x81bece,{'currentPage':_0x440e96,'pageSize':PAGE_SIZE,'sqlCode':_0x55d9f5[_0x30e665(0x1a2)],'sqlName':_0x55d9f5[_0x30e665(0x1aa)]}),_0x4f32fd=_0x824189[_0x30e665(0x183)]??[];_0xc646aa['push'](..._0x4f32fd);if(_0x4f32fd['length']===0x0)break;const _0x323019=_0x824189[_0x30e665(0x17a)]?.[_0x30e665(0x195)];if(_0x323019!=null?_0xc646aa['length']>=_0x323019:_0x4f32fd['length']<PAGE_SIZE)break;_0x440e96++;}return _0xc646aa;}async function ensureSqlContent(_0x12f1f1){const _0x424fff=a122_0x4b85;if(_0x12f1f1[_0x424fff(0x173)]!=null&&String(_0x12f1f1['sqlContent'])[_0x424fff(0x193)]>0x0)return _0x12f1f1;return getSqlQueryDetail(_0x12f1f1[_0x424fff(0x1a2)]);}export const sqlPull={'service':a122_0x13f87d(0x198),'command':a122_0x13f87d(0x184),'description':a122_0x13f87d(0x18b),'risk':a122_0x13f87d(0x17b),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a122_0x13f87d(0x1a0),'type':a122_0x13f87d(0x1ad),'description':a122_0x13f87d(0x1ae)},{'name':a122_0x13f87d(0x17f),'type':'boolean','description':'Force\x20overwrite\x20local\x20unsynced\x20changes'}],async 'dryRun'(_0x1efe29){const _0x173082=a122_0x13f87d,_0x1becf8=loadSqlProjectConfig(_0x1efe29[_0x173082(0x185)]),_0x616a15=await readSqlLockFile(_0x1becf8[_0x173082(0x19e)]),{appLock:_0x604519}=ensureSqlLockScope(_0x616a15??createEmptySqlLock(),_0x1becf8['appCode'],_0x1becf8[_0x173082(0x186)],_0x173082(0x184)),_0x4d7d33=await fetchAllSqlQueries(_0x1efe29[_0x173082(0x185)],{'sqlCode':_0x1efe29[_0x173082(0x189)]('sqlcode')||undefined,'sqlName':_0x1efe29['str'](_0x173082(0x1a0))||undefined}),_0x5d31cf=[];for(const _0x27b759 of _0x4d7d33){const _0xd96025=await ensureSqlContent(_0x27b759),_0x525c62=ensureRemoteSqlContent(_0xd96025),_0x1a2c91=detectModeFromSql(_0xd96025),_0x1471c2=_0xd96025[_0x173082(0x19b)]?await getDbName(_0x1efe29[_0x173082(0x185)],Number(_0xd96025['dbId']))[_0x173082(0x175)](()=>undefined):undefined,_0x2811cf=buildLocalSqlFileContent({'sqlCode':_0xd96025['sqlCode'],'sqlName':_0xd96025[_0x173082(0x1aa)],'dbId':_0xd96025[_0x173082(0x19b)]},_0x525c62,{'dbName':_0x1471c2,'mode':_0x1a2c91,'syncedAt':new Date()[_0x173082(0x172)](),'description':_0xd96025['description']}),_0x5bd745=buildSqlLockEntry(_0xd96025,_0x525c62,'',{'dbName':_0x1471c2}),_0x4059a6=resolveLocalSqlFilePath(_0x1becf8,_0xd96025[_0x173082(0x1a2)],_0x5bd745);let _0x246be7=_0x173082(0x179),_0x1a9497;if(await fileExists(_0x4059a6)){const _0x2ff453=await readFile(_0x4059a6,_0x173082(0x17c));isEquivalentPulledSqlFile(_0x2ff453,_0x2811cf,_0x1a2c91)?(_0x246be7=_0x173082(0x190),_0x1a9497=_0x173082(0x180)):(_0x246be7=_0x173082(0x19f),_0x1a9497=_0x173082(0x192));}_0x5d31cf[_0x173082(0x199)]({'sqlCode':_0xd96025[_0x173082(0x1a2)],'sqlName':_0xd96025['sqlName'],'filePath':_0x4059a6,'status':_0x246be7,'reason':_0x1a9497});}return{'method':_0x173082(0x181),'url':_0x173082(0x19d),'body':{'appCode':_0x1efe29[_0x173082(0x185)],'sqlCode':_0x1efe29[_0x173082(0x189)]('sqlcode')||null,'sqlName':_0x1efe29[_0x173082(0x189)](_0x173082(0x1a0))||null,'files':_0x5d31cf},'description':'Would\x20pull\x20'+_0x5d31cf[_0x173082(0x193)]+_0x173082(0x19c)+_0x1becf8[_0x173082(0x182)]};},async 'execute'(_0x3672fa){const _0x5bfb26=a122_0x13f87d,_0x5d17ea=loadSqlProjectConfig(_0x3672fa[_0x5bfb26(0x185)]),_0x54d66c=await readSqlLockFile(_0x5d17ea[_0x5bfb26(0x19e)]),{lockData:_0x21ad6a,appLock:_0x38fd22}=ensureSqlLockScope(_0x54d66c??createEmptySqlLock(),_0x5d17ea[_0x5bfb26(0x185)],_0x5d17ea[_0x5bfb26(0x186)],_0x5bfb26(0x184)),_0x588455=_0x3672fa[_0x5bfb26(0x1a7)](_0x5bfb26(0x17f)),_0x41d974=await fetchAllSqlQueries(_0x3672fa[_0x5bfb26(0x185)],{'sqlCode':_0x3672fa['str']('sqlcode')||undefined,'sqlName':_0x3672fa[_0x5bfb26(0x189)](_0x5bfb26(0x1a0))||undefined});if(_0x41d974[_0x5bfb26(0x193)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x5bfb26(0x18f)};const _0x21f561=[],_0x1c43b3=[];for(const _0x47d6f9 of _0x41d974){try{_0x21f561[_0x5bfb26(0x199)](await ensureSqlContent(_0x47d6f9));}catch(_0x152ff9){_0x1c43b3['push']({'sqlCode':_0x47d6f9['sqlCode'],'error':_0x152ff9 instanceof Error?_0x152ff9[_0x5bfb26(0x1a1)]:String(_0x152ff9)});}}if(_0x588455&&!_0x3672fa[_0x5bfb26(0x178)]){let _0x591132=![];for(const _0x84ee4b of _0x21f561){const _0x50983a=detectModeFromSql(_0x84ee4b),_0x2d91f7=_0x84ee4b['dbId']?await getDbName(_0x3672fa[_0x5bfb26(0x185)],Number(_0x84ee4b[_0x5bfb26(0x19b)]))[_0x5bfb26(0x175)](()=>undefined):undefined,_0x224b76=buildLocalSqlFileContent({'sqlCode':_0x84ee4b[_0x5bfb26(0x1a2)],'sqlName':_0x84ee4b[_0x5bfb26(0x1aa)],'dbId':_0x84ee4b['dbId']},ensureRemoteSqlContent(_0x84ee4b),{'dbName':_0x2d91f7,'mode':_0x50983a,'syncedAt':new Date()[_0x5bfb26(0x172)](),'description':_0x84ee4b[_0x5bfb26(0x18d)]}),_0x5331ec=resolveLocalSqlFilePath(_0x5d17ea,_0x84ee4b['sqlCode'],buildSqlLockEntry(_0x84ee4b,ensureRemoteSqlContent(_0x84ee4b),'',{'dbName':_0x2d91f7}));if(await fileExists(_0x5331ec)){const _0x74d8cf=await readFile(_0x5331ec,_0x5bfb26(0x17c));if(!isEquivalentPulledSqlFile(_0x74d8cf,_0x224b76,_0x50983a)){_0x591132=!![];break;}}}if(_0x591132){const _0x5c0407=await confirmForceOverwrite(_0x5bfb26(0x191));if(!_0x5c0407)throw CliErrors[_0x5bfb26(0x197)]('Force\x20pull\x20cancelled.');}}const _0x54960=cloneSqlLockData(_0x21ad6a),_0xe8a9e=_0x54960['apps'][_0x5d17ea[_0x5bfb26(0x185)]],_0x3bee4a=[],_0x44c709=[];for(const _0x53b477 of _0x21f561){const _0x4b2bed=_0xe8a9e['sqls'][_0x53b477['sqlCode']],_0x58ec7b=ensureRemoteSqlContent(_0x53b477),_0x35c4e1=detectModeFromSql(_0x53b477),_0x5de90b=_0x53b477[_0x5bfb26(0x19b)]?await getDbName(_0x3672fa[_0x5bfb26(0x185)],Number(_0x53b477['dbId']))[_0x5bfb26(0x175)](()=>undefined):undefined,_0x2d3689=buildLocalSqlFileContent({'sqlCode':_0x53b477[_0x5bfb26(0x1a2)],'sqlName':_0x53b477[_0x5bfb26(0x1aa)],'dbId':_0x53b477[_0x5bfb26(0x19b)]},_0x58ec7b,{'dbName':_0x5de90b,'mode':_0x35c4e1,'syncedAt':new Date()['toISOString'](),'description':_0x53b477[_0x5bfb26(0x18d)]}),_0x58d9e8=buildSqlLockEntry(_0x53b477,_0x58ec7b,computeSqlContentHash(_0x2d3689),{'dbName':_0x5de90b}),_0x5c42f1=_0x58d9e8[_0x5bfb26(0x1a9)],_0x52d8e2=join(_0x5d17ea[_0x5bfb26(0x182)],_0x5c42f1);try{if(await fileExists(_0x52d8e2)){const _0x183e78=await readFile(_0x52d8e2,_0x5bfb26(0x17c));if(isEquivalentPulledSqlFile(_0x183e78,_0x2d3689,_0x35c4e1)){_0x44c709[_0x5bfb26(0x199)]({'sqlCode':_0x53b477[_0x5bfb26(0x1a2)],'reason':'unchanged'}),_0xe8a9e[_0x5bfb26(0x17e)][_0x53b477['sqlCode']]={..._0x58d9e8,'hash':computeSqlContentHash(_0x183e78),'path':_0x5c42f1};continue;}if(!_0x588455){_0x44c709[_0x5bfb26(0x199)]({'sqlCode':_0x53b477[_0x5bfb26(0x1a2)],'reason':_0x5bfb26(0x188)});continue;}}const _0x204b86=_0x4b2bed?.[_0x5bfb26(0x1a9)]?join(_0x5d17ea[_0x5bfb26(0x182)],_0x4b2bed[_0x5bfb26(0x1a9)]):undefined;_0x204b86&&_0x204b86!==_0x52d8e2&&await fileExists(_0x204b86)&&await rm(_0x204b86,{'force':!![]}),await ensureParentDirectory(_0x52d8e2),await writeFile(_0x52d8e2,_0x2d3689,'utf8'),_0xe8a9e[_0x5bfb26(0x17e)][_0x53b477[_0x5bfb26(0x1a2)]]={..._0x58d9e8,'path':_0x5c42f1},_0x3bee4a[_0x5bfb26(0x199)]({'sqlCode':_0x53b477[_0x5bfb26(0x1a2)],'filePath':_0x52d8e2});}catch(_0xf694f4){_0x1c43b3['push']({'sqlCode':_0x53b477[_0x5bfb26(0x1a2)],'error':_0xf694f4 instanceof Error?_0xf694f4[_0x5bfb26(0x1a1)]:String(_0xf694f4)});}}return _0xe8a9e[_0x5bfb26(0x1ac)]=new Date()['toISOString'](),await writeSqlLockFile(_0x5d17ea['lockFilePath'],_0x54960),{'ok':_0x1c43b3['length']===0x0,'data':{'pulled':_0x3bee4a,'skipped':_0x44c709,'failed':_0x1c43b3},'message':'Pull\x20complete:\x20'+_0x3bee4a[_0x5bfb26(0x193)]+_0x5bfb26(0x19a)+_0x44c709['length']+_0x5bfb26(0x187)+_0x1c43b3['length']+_0x5bfb26(0x1a4)};}};function detectModeFromSql(_0x5898c4){const _0x4f7133=a122_0x13f87d,_0x540aa2=ensureRemoteSqlContent(_0x5898c4),_0x1abf10=stripLocalSqlMetadata(_0x540aa2,'mybatisXml')[_0x4f7133(0x1a3)]();if(/^<(select|insert|update|delete)\b/i[_0x4f7133(0x17d)](_0x1abf10))return _0x4f7133(0x18c);return _0x4f7133(0x198);}function isEquivalentPulledSqlFile(_0x3833b9,_0x8b0fb7,_0x3e684e){return normalizePullComparableContent(_0x3833b9,_0x3e684e)===normalizePullComparableContent(_0x8b0fb7,_0x3e684e);}function normalizePullComparableContent(_0x19326d,_0x5c7d1c){const _0x157dc3=a122_0x13f87d,_0x59ab71=_0x19326d[_0x157dc3(0x176)](/\r\n/g,'\x0a')[_0x157dc3(0x171)]('\x0a'),_0x324ce7=_0x59ab71[_0x157dc3(0x18a)](_0x209867=>!isSyncedAtMetadataLine(_0x209867,_0x5c7d1c));return _0x324ce7['join']('\x0a');}function isSyncedAtMetadataLine(_0x43d1ce,_0x1c5186){const _0x1675f9=a122_0x13f87d;if(_0x1c5186===_0x1675f9(0x18c))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x1675f9(0x17d)](_0x43d1ce);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x1675f9(0x17d)](_0x43d1ce);}
|
package/lib/commands/sql/push.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a123_0x2881db=a123_0x55e1;(function(_0x587683,_0x55ed6a){const _0xe96c99=a123_0x55e1,_0x264bbe=_0x587683();while(!![]){try{const _0x580e37=parseInt(_0xe96c99(0x179))/0x1+-parseInt(_0xe96c99(0x181))/0x2*(-parseInt(_0xe96c99(0x16e))/0x3)+-parseInt(_0xe96c99(0x18c))/0x4+parseInt(_0xe96c99(0x171))/0x5+parseInt(_0xe96c99(0x159))/0x6*(parseInt(_0xe96c99(0x18a))/0x7)+-parseInt(_0xe96c99(0x185))/0x8*(-parseInt(_0xe96c99(0x164))/0x9)+parseInt(_0xe96c99(0x16c))/0xa*(-parseInt(_0xe96c99(0x18f))/0xb);if(_0x580e37===_0x55ed6a)break;else _0x264bbe['push'](_0x264bbe['shift']());}catch(_0x524290){_0x264bbe['push'](_0x264bbe['shift']());}}}(a123_0x3046,0xa3060));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';function a123_0x3046(){const _0x3bc32b=['sqlCode','23859fZyUKs','startsWith','exec','sqlName','dbDirectory','\x20failed','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','sqlRootDir','sql','1165170IzSooZ','validation','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','sqlcode','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','str','Local\x20directory\x20\x22','Push\x20complete:\x20','trashDir','No\x20local\x20SQL\x20files\x20found.','filter','14481mKNnYy','boolean','Local\x20SQL\x20not\x20found:\x20','/smartapi/custom/updateUserCustomSql','filePath','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','message','sqlRoot','10420CwzMZZ','join','24iEAyWa','remoteId','POST','3923205AiAKbO','mode','dbId','sqls','replace','isFinite','has','projectRoot','182280ubCPZP','length','path','push','\x22\x20for\x20sqlCode\x20','utf8','version','catch','210228YDuUQR','toISOString','force','appCode','3024mRWWWR','high-risk-write','lockFilePath','relativePath','hash','28rqVziY','dbName','1059892SieZMj','bool'];a123_0x3046=function(){return _0x3bc32b;};return a123_0x3046();}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(_0x7b2e56,_0x5823ef,_0x5a31b0){const _0xcc40e6=a123_0x55e1,_0x428657=await scanLocalSqlQueries(_0x7b2e56),_0x12c073=new Map();for(const _0x522158 of _0x428657){if(_0x5a31b0&&_0x522158[_0xcc40e6(0x18e)]!==_0x5a31b0)continue;const _0x173468=_0x12c073['get'](_0x522158[_0xcc40e6(0x18e)])??[];_0x173468[_0xcc40e6(0x17c)](_0x522158),_0x12c073['set'](_0x522158['sqlCode'],_0x173468);}if(_0x5a31b0&&!_0x12c073[_0xcc40e6(0x177)](_0x5a31b0))throw CliErrors[_0xcc40e6(0x15a)](_0xcc40e6(0x166)+_0x5a31b0);const _0x2eeaef=[];for(const [_0x813213,_0x9740d6]of _0x12c073['entries']()){if(_0x9740d6[_0xcc40e6(0x17a)]===0x1){_0x2eeaef[_0xcc40e6(0x17c)](_0x9740d6[0x0]);continue;}const _0x37dd4c=_0x5823ef['sqls'][_0x813213],_0x2c7904=_0x37dd4c?.[_0xcc40e6(0x17b)],_0xaac98c=_0x2c7904?_0x9740d6['filter'](_0x3ac813=>_0x3ac813['relativePath']!==_0x2c7904):_0x9740d6;if(_0x37dd4c&&_0xaac98c[_0xcc40e6(0x17a)]===0x1){_0x2eeaef['push'](_0xaac98c[0x0]);continue;}throw CliErrors[_0xcc40e6(0x15a)](_0xcc40e6(0x169)+_0x813213+_0xcc40e6(0x15d));}return _0x2eeaef;}export const sqlPush={'service':a123_0x2881db(0x158),'command':a123_0x2881db(0x17c),'description':'Push\x20local\x20SQL\x20files\x20to\x20remote','risk':a123_0x2881db(0x186),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'force','type':a123_0x2881db(0x165),'description':'Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock'}],async 'dryRun'(_0xbe969c){const _0x58e5a8=a123_0x2881db,_0x22b342=loadSqlProjectConfig(_0xbe969c[_0x58e5a8(0x184)]),_0x97cd66=await readSqlLockFile(_0x22b342[_0x58e5a8(0x187)]),{appLock:_0x3b154c}=ensureSqlLockScope(_0x97cd66??createEmptySqlLock(),_0xbe969c[_0x58e5a8(0x184)],_0x22b342[_0x58e5a8(0x16b)],_0x58e5a8(0x17c)),_0x2920ac=await getTargetSqlQueries(_0x22b342,_0x3b154c,_0xbe969c[_0x58e5a8(0x15e)](_0x58e5a8(0x15c))||undefined),_0x405ba9=[];for(const _0x1be9a2 of _0x2920ac){const _0x328f1d=await computeSqlFileHash(_0x1be9a2[_0x58e5a8(0x168)]),_0x331c45=_0x3b154c['sqls'][_0x1be9a2[_0x58e5a8(0x18e)]],_0x1f4ca9=!!_0x331c45&&(_0x331c45[_0x58e5a8(0x17b)]!==_0x1be9a2[_0x58e5a8(0x188)]||!!_0x1be9a2[_0x58e5a8(0x192)]&&_0x331c45[_0x58e5a8(0x192)]!==_0x1be9a2[_0x58e5a8(0x192)]);if(!_0xbe969c['bool'](_0x58e5a8(0x183))&&_0x331c45&&_0x331c45[_0x58e5a8(0x189)]===_0x328f1d&&!_0x1f4ca9)continue;_0x405ba9[_0x58e5a8(0x17c)](_0x1be9a2[_0x58e5a8(0x18e)]);}return{'method':_0x58e5a8(0x170),'url':_0x58e5a8(0x167),'body':{'sqlCodes':_0x405ba9,'appCode':_0xbe969c[_0x58e5a8(0x184)]},'description':'Would\x20push\x20'+_0x405ba9[_0x58e5a8(0x17a)]+'\x20SQL\x20file(s)'};},async 'execute'(_0x2e486f){const _0x423fec=a123_0x2881db,_0x2092db=loadSqlProjectConfig(_0x2e486f[_0x423fec(0x184)]),_0x14d0da=await readSqlLockFile(_0x2092db['lockFilePath']),{lockData:_0x74c6c7,appLock:_0x4c935b}=ensureSqlLockScope(_0x14d0da??createEmptySqlLock(),_0x2e486f[_0x423fec(0x184)],_0x2092db[_0x423fec(0x16b)],_0x423fec(0x17c)),_0xe6f1f9=await getTargetSqlQueries(_0x2092db,_0x4c935b,_0x2e486f['str'](_0x423fec(0x15c))||undefined);if(_0xe6f1f9[_0x423fec(0x17a)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x423fec(0x162)};const _0x2fb438=[],_0x3fa6c6=[],_0x16ed89=[];for(const _0x32dfd4 of _0xe6f1f9){const _0x4a964d=_0x4c935b[_0x423fec(0x174)][_0x32dfd4[_0x423fec(0x18e)]];if(!_0x4a964d){_0x16ed89['push']({'sqlCode':_0x32dfd4[_0x423fec(0x18e)],'error':_0x423fec(0x15b)});continue;}try{const _0x16c1f9=await computeSqlFileHash(_0x32dfd4[_0x423fec(0x168)]),_0x58dd37=_0x4a964d[_0x423fec(0x17b)]!==_0x32dfd4[_0x423fec(0x188)]||!!_0x32dfd4[_0x423fec(0x192)]&&_0x4a964d[_0x423fec(0x192)]!==_0x32dfd4[_0x423fec(0x192)];if(!_0x2e486f[_0x423fec(0x18d)](_0x423fec(0x183))&&_0x4a964d[_0x423fec(0x189)]===_0x16c1f9&&!_0x58dd37){_0x3fa6c6[_0x423fec(0x17c)]({'sqlCode':_0x32dfd4[_0x423fec(0x18e)],'reason':'unchanged'});continue;}if(_0x4a964d[_0x423fec(0x17f)]==null){_0x16ed89[_0x423fec(0x17c)]({'sqlCode':_0x32dfd4[_0x423fec(0x18e)],'error':'missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first'});continue;}const _0x47b767=await readFile(_0x32dfd4[_0x423fec(0x168)],_0x423fec(0x17e)),_0xb377b0=stripLocalSqlMetadata(_0x47b767,_0x32dfd4[_0x423fec(0x172)]),_0x483cf1=_0x32dfd4['sqlName']||_0x4a964d[_0x423fec(0x192)],_0x3521f4=await resolveTargetDbBinding(_0x2e486f['appCode'],_0x32dfd4,_0x4a964d),_0x115e65=await updateSqlQuery({'id':_0x4a964d[_0x423fec(0x16f)],'appCode':_0x2e486f[_0x423fec(0x184)],'sqlCode':_0x32dfd4[_0x423fec(0x18e)],'sqlName':_0x483cf1,'dbId':_0x3521f4[_0x423fec(0x173)],'version':_0x4a964d[_0x423fec(0x17f)],'sqlContent':_0xb377b0,'sqlConfig':_0x4a964d['sqlConfig']??undefined}),_0x549e61=_0x115e65[_0x423fec(0x173)]?await getDbName(_0x2e486f[_0x423fec(0x184)],Number(_0x115e65[_0x423fec(0x173)]))[_0x423fec(0x180)](()=>_0x3521f4['dbName']):_0x3521f4[_0x423fec(0x18b)];_0x4c935b['sqls'][_0x32dfd4[_0x423fec(0x18e)]]={...buildSqlLockEntry(_0x115e65,_0xb377b0,_0x16c1f9,{'dbName':_0x549e61}),'path':_0x32dfd4[_0x423fec(0x188)],'mode':_0x4a964d[_0x423fec(0x172)]},await archivePreviousSqlFileIfNeeded(_0x2092db,_0x4a964d[_0x423fec(0x17b)],_0x32dfd4[_0x423fec(0x188)]),_0x2fb438['push']({'sqlCode':_0x32dfd4[_0x423fec(0x18e)],'remoteId':_0x4a964d[_0x423fec(0x16f)]});}catch(_0x4e5217){_0x16ed89[_0x423fec(0x17c)]({'sqlCode':_0x32dfd4[_0x423fec(0x18e)],'error':_0x4e5217 instanceof Error?_0x4e5217[_0x423fec(0x16a)]:String(_0x4e5217)});}}return _0x4c935b['lastSync']=new Date()[_0x423fec(0x182)](),await writeSqlLockFile(_0x2092db[_0x423fec(0x187)],_0x74c6c7),{'ok':_0x16ed89[_0x423fec(0x17a)]===0x0,'data':{'pushed':_0x2fb438,'skipped':_0x3fa6c6,'failed':_0x16ed89},'message':_0x423fec(0x160)+_0x2fb438[_0x423fec(0x17a)]+'\x20pushed,\x20'+_0x3fa6c6[_0x423fec(0x17a)]+'\x20skipped,\x20'+_0x16ed89[_0x423fec(0x17a)]+_0x423fec(0x155)};}};async function archivePreviousSqlFileIfNeeded(_0x1b80a2,_0xb51f74,_0xd4bd6f){const _0x46f312=a123_0x2881db;if(!_0xb51f74||_0xb51f74===_0xd4bd6f)return;const _0x4ba8a8=join(_0x1b80a2[_0x46f312(0x157)],_0xb51f74);if(!await fileExists(_0x4ba8a8))return;const _0x3897b0=await moveToTrash(_0x1b80a2[_0x46f312(0x178)],_0x1b80a2[_0x46f312(0x161)],_0x4ba8a8);await cleanupEmptyDirectories(dirname(_0x4ba8a8),_0x1b80a2[_0x46f312(0x157)]),void _0x3897b0;}function a123_0x55e1(_0x58f600,_0x22e3f0){_0x58f600=_0x58f600-0x155;const _0x3046df=a123_0x3046();let _0x55e1c7=_0x3046df[_0x58f600];return _0x55e1c7;}async function moveToTrash(_0x586320,_0x1655e1,_0x5d5192){const _0x58d00c=a123_0x2881db,_0x4cff51=new Date()[_0x58d00c(0x182)]()[_0x58d00c(0x175)](/[:.]/g,'-'),_0x4e8134=relative(_0x586320,_0x5d5192),_0x569de9=join(_0x1655e1,_0x4cff51,_0x4e8134);return await mkdir(dirname(_0x569de9),{'recursive':!![]}),await rename(_0x5d5192,_0x569de9),_0x569de9;}async function cleanupEmptyDirectories(_0x36384c,_0x357985){const _0x5ec1a9=a123_0x2881db;let _0x6df9b2=resolve(_0x36384c);const _0x499491=resolve(_0x357985);while(_0x6df9b2[_0x5ec1a9(0x190)](''+_0x499491+sep)||_0x6df9b2===_0x499491){if(_0x6df9b2===_0x499491)return;try{const _0x4c2f61=await readdir(_0x6df9b2);if(_0x4c2f61['length']>0x0)return;await rmdir(_0x6df9b2);}catch{return;}_0x6df9b2=dirname(_0x6df9b2);}}async function resolveTargetDbBinding(_0x5e1431,_0x4e0086,_0x2946ce){const _0x5c40ff=a123_0x2881db,_0x54bfe0=_0x4e0086[_0x5c40ff(0x193)];if(!_0x54bfe0)return{'dbId':_0x2946ce[_0x5c40ff(0x173)],'dbName':_0x2946ce[_0x5c40ff(0x18b)]};const _0x2aec10=buildDbDirectoryName(_0x2946ce['dbName'],_0x2946ce['dbId']);if(_0x54bfe0===_0x2aec10)return{'dbId':_0x2946ce[_0x5c40ff(0x173)],'dbName':_0x2946ce['dbName']};const _0x435e9b=parseExplicitDbDirectory(_0x54bfe0);if(_0x435e9b!=null)return{'dbId':_0x435e9b,'dbName':await getDbName(_0x5e1431,_0x435e9b)[_0x5c40ff(0x180)](()=>undefined)};const _0x359510=await listDatabases(_0x5e1431),_0x5be1a2=_0x359510[_0x5c40ff(0x163)](_0x34f825=>buildDbDirectoryName(_0x34f825[_0x5c40ff(0x18b)],_0x34f825[_0x5c40ff(0x173)])===_0x54bfe0);if(_0x5be1a2[_0x5c40ff(0x17a)]===0x1)return{'dbId':_0x5be1a2[0x0]['dbId'],'dbName':_0x5be1a2[0x0][_0x5c40ff(0x18b)]};if(_0x5be1a2[_0x5c40ff(0x17a)]===0x0)throw CliErrors[_0x5c40ff(0x15a)]('No\x20database\x20matches\x20local\x20directory\x20\x22'+_0x54bfe0+_0x5c40ff(0x17d)+_0x4e0086['sqlCode']+'.');const _0x17f3e8=_0x5be1a2['map'](_0x4f0c38=>_0x4f0c38[_0x5c40ff(0x18b)]+'\x20('+_0x4f0c38[_0x5c40ff(0x173)]+')')[_0x5c40ff(0x16d)](',\x20');throw CliErrors[_0x5c40ff(0x15a)](_0x5c40ff(0x15f)+_0x54bfe0+_0x5c40ff(0x156)+_0x4e0086['sqlCode']+':\x20'+_0x17f3e8);}function parseExplicitDbDirectory(_0x185634){const _0x48e0bd=a123_0x2881db,_0x2bb3bb=/^db-(\d+)$/[_0x48e0bd(0x191)](_0x185634);if(!_0x2bb3bb)return null;const _0x1d292e=Number(_0x2bb3bb[0x1]);return Number[_0x48e0bd(0x176)](_0x1d292e)&&_0x1d292e>0x0?_0x1d292e:null;}
|
|
1
|
+
const a123_0x16400e=a123_0x22a5;(function(_0x15bfb0,_0x548a72){const _0x3a8a41=a123_0x22a5,_0x5d669a=_0x15bfb0();while(!![]){try{const _0x452491=-parseInt(_0x3a8a41(0x186))/0x1+-parseInt(_0x3a8a41(0x19a))/0x2*(-parseInt(_0x3a8a41(0x194))/0x3)+parseInt(_0x3a8a41(0x197))/0x4+parseInt(_0x3a8a41(0x170))/0x5*(parseInt(_0x3a8a41(0x1a9))/0x6)+parseInt(_0x3a8a41(0x1a2))/0x7*(-parseInt(_0x3a8a41(0x187))/0x8)+-parseInt(_0x3a8a41(0x16e))/0x9*(-parseInt(_0x3a8a41(0x193))/0xa)+-parseInt(_0x3a8a41(0x19f))/0xb;if(_0x452491===_0x548a72)break;else _0x5d669a['push'](_0x5d669a['shift']());}catch(_0x54b79e){_0x5d669a['push'](_0x5d669a['shift']());}}}(a123_0x283e,0x6e80e));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';function a123_0x22a5(_0x28fc35,_0x3b6dce){_0x28fc35=_0x28fc35-0x16d;const _0x283eb9=a123_0x283e();let _0x22a5aa=_0x283eb9[_0x28fc35];return _0x22a5aa;}import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';function a123_0x283e(){const _0x245fe2=['bool','\x22\x20for\x20sqlCode\x20','toISOString','length','sqls','push','filter','validation','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','isFinite','4390YXicXH','1137SswTYN','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','remoteId','1690332odgecs','has','sqlRootDir','2594RkGnpD','str','lockFilePath','utf8','\x20SQL\x20file(s)','13537095wwqZEU','\x20skipped,\x20','\x20failed','14JuQeEe','version','get','sqlCode','sqlcode','set','relativePath','6PCSCiJ','dbName','No\x20local\x20SQL\x20files\x20found.','Push\x20local\x20SQL\x20files\x20to\x20remote','appCode','filePath','entries','18117yNlPaf','sqlName','3469835RhlCBE','Push\x20complete:\x20','Would\x20push\x20','map','Local\x20directory\x20\x22','catch','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','join','boolean','dbId','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','high-risk-write','unchanged','hash','/smartapi/custom/updateUserCustomSql','sqlRoot','\x20pushed,\x20','sqlConfig','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','path','force','trashDir','171563cPEVMQ','2547960MMmEiY','POST'];a123_0x283e=function(){return _0x245fe2;};return a123_0x283e();}import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';async function getTargetSqlQueries(_0x272e17,_0x5a95ec,_0x4194b3){const _0x33337f=a123_0x22a5,_0x46bdc1=await scanLocalSqlQueries(_0x272e17),_0x4e703e=new Map();for(const _0x5b85c8 of _0x46bdc1){if(_0x4194b3&&_0x5b85c8['sqlCode']!==_0x4194b3)continue;const _0x12ae29=_0x4e703e[_0x33337f(0x1a4)](_0x5b85c8[_0x33337f(0x1a5)])??[];_0x12ae29[_0x33337f(0x18e)](_0x5b85c8),_0x4e703e[_0x33337f(0x1a7)](_0x5b85c8[_0x33337f(0x1a5)],_0x12ae29);}if(_0x4194b3&&!_0x4e703e[_0x33337f(0x198)](_0x4194b3))throw CliErrors['validation']('Local\x20SQL\x20not\x20found:\x20'+_0x4194b3);const _0x2fa4b0=[];for(const [_0x3bb3bc,_0x387016]of _0x4e703e[_0x33337f(0x16d)]()){if(_0x387016['length']===0x1){_0x2fa4b0[_0x33337f(0x18e)](_0x387016[0x0]);continue;}const _0x399e28=_0x5a95ec[_0x33337f(0x18d)][_0x3bb3bc],_0x51b785=_0x399e28?.['path'],_0x3b02da=_0x51b785?_0x387016[_0x33337f(0x18f)](_0xb2b2e4=>_0xb2b2e4[_0x33337f(0x1a8)]!==_0x51b785):_0x387016;if(_0x399e28&&_0x3b02da['length']===0x1){_0x2fa4b0[_0x33337f(0x18e)](_0x3b02da[0x0]);continue;}throw CliErrors[_0x33337f(0x190)](_0x33337f(0x17a)+_0x3bb3bc+'.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.');}return _0x2fa4b0;}export const sqlPush={'service':'sql','command':a123_0x16400e(0x18e),'description':a123_0x16400e(0x1ac),'risk':a123_0x16400e(0x17b),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a123_0x16400e(0x184),'type':a123_0x16400e(0x178),'description':a123_0x16400e(0x191)}],async 'dryRun'(_0x17e1d5){const _0x5f030e=a123_0x16400e,_0x21e2d5=loadSqlProjectConfig(_0x17e1d5[_0x5f030e(0x1ad)]),_0xc8d33c=await readSqlLockFile(_0x21e2d5['lockFilePath']),{appLock:_0x54c21f}=ensureSqlLockScope(_0xc8d33c??createEmptySqlLock(),_0x17e1d5['appCode'],_0x21e2d5[_0x5f030e(0x17f)],'push'),_0x49f6d1=await getTargetSqlQueries(_0x21e2d5,_0x54c21f,_0x17e1d5[_0x5f030e(0x19b)](_0x5f030e(0x1a6))||undefined),_0x321adf=[];for(const _0x4e2a44 of _0x49f6d1){const _0x464840=await computeSqlFileHash(_0x4e2a44[_0x5f030e(0x1ae)]),_0x4a8b74=_0x54c21f[_0x5f030e(0x18d)][_0x4e2a44[_0x5f030e(0x1a5)]],_0x27cd9d=!!_0x4a8b74&&(_0x4a8b74[_0x5f030e(0x183)]!==_0x4e2a44[_0x5f030e(0x1a8)]||!!_0x4e2a44[_0x5f030e(0x16f)]&&_0x4a8b74[_0x5f030e(0x16f)]!==_0x4e2a44[_0x5f030e(0x16f)]);if(!_0x17e1d5[_0x5f030e(0x189)](_0x5f030e(0x184))&&_0x4a8b74&&_0x4a8b74[_0x5f030e(0x17d)]===_0x464840&&!_0x27cd9d)continue;_0x321adf[_0x5f030e(0x18e)](_0x4e2a44[_0x5f030e(0x1a5)]);}return{'method':_0x5f030e(0x188),'url':_0x5f030e(0x17e),'body':{'sqlCodes':_0x321adf,'appCode':_0x17e1d5[_0x5f030e(0x1ad)]},'description':_0x5f030e(0x172)+_0x321adf[_0x5f030e(0x18c)]+_0x5f030e(0x19e)};},async 'execute'(_0x1c543b){const _0x456080=a123_0x16400e,_0xbdd4e9=loadSqlProjectConfig(_0x1c543b['appCode']),_0x4dd2b0=await readSqlLockFile(_0xbdd4e9[_0x456080(0x19c)]),{lockData:_0x150567,appLock:_0x1cf9ee}=ensureSqlLockScope(_0x4dd2b0??createEmptySqlLock(),_0x1c543b[_0x456080(0x1ad)],_0xbdd4e9[_0x456080(0x17f)],'push'),_0x53a403=await getTargetSqlQueries(_0xbdd4e9,_0x1cf9ee,_0x1c543b[_0x456080(0x19b)](_0x456080(0x1a6))||undefined);if(_0x53a403[_0x456080(0x18c)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x456080(0x1ab)};const _0x3ba874=[],_0x3206e2=[],_0x2e56ef=[];for(const _0x25a20c of _0x53a403){const _0x1b55c5=_0x1cf9ee[_0x456080(0x18d)][_0x25a20c[_0x456080(0x1a5)]];if(!_0x1b55c5){_0x2e56ef[_0x456080(0x18e)]({'sqlCode':_0x25a20c[_0x456080(0x1a5)],'error':_0x456080(0x176)});continue;}try{const _0x47769b=await computeSqlFileHash(_0x25a20c['filePath']),_0x125552=_0x1b55c5[_0x456080(0x183)]!==_0x25a20c[_0x456080(0x1a8)]||!!_0x25a20c[_0x456080(0x16f)]&&_0x1b55c5[_0x456080(0x16f)]!==_0x25a20c[_0x456080(0x16f)];if(!_0x1c543b[_0x456080(0x189)](_0x456080(0x184))&&_0x1b55c5['hash']===_0x47769b&&!_0x125552){_0x3206e2[_0x456080(0x18e)]({'sqlCode':_0x25a20c[_0x456080(0x1a5)],'reason':_0x456080(0x17c)});continue;}if(_0x1b55c5[_0x456080(0x1a3)]==null){_0x2e56ef[_0x456080(0x18e)]({'sqlCode':_0x25a20c[_0x456080(0x1a5)],'error':_0x456080(0x195)});continue;}const _0x47b1dc=await readFile(_0x25a20c[_0x456080(0x1ae)],_0x456080(0x19d)),_0x21e53e=stripLocalSqlMetadata(_0x47b1dc,_0x25a20c['mode']),_0x254da0=_0x25a20c[_0x456080(0x16f)]||_0x1b55c5['sqlName'],_0x46b440=await resolveTargetDbBinding(_0x1c543b[_0x456080(0x1ad)],_0x25a20c,_0x1b55c5),_0x51944d=await updateSqlQuery({'id':_0x1b55c5[_0x456080(0x196)],'appCode':_0x1c543b[_0x456080(0x1ad)],'sqlCode':_0x25a20c[_0x456080(0x1a5)],'sqlName':_0x254da0,'dbId':_0x46b440[_0x456080(0x179)],'version':_0x1b55c5['version'],'sqlContent':_0x21e53e,'sqlConfig':_0x1b55c5[_0x456080(0x181)]??undefined}),_0xc9c41e=_0x51944d['dbId']?await getDbName(_0x1c543b[_0x456080(0x1ad)],Number(_0x51944d[_0x456080(0x179)]))['catch'](()=>_0x46b440[_0x456080(0x1aa)]):_0x46b440[_0x456080(0x1aa)];_0x1cf9ee[_0x456080(0x18d)][_0x25a20c[_0x456080(0x1a5)]]={...buildSqlLockEntry(_0x51944d,_0x21e53e,_0x47769b,{'dbName':_0xc9c41e}),'path':_0x25a20c[_0x456080(0x1a8)],'mode':_0x1b55c5['mode']},await archivePreviousSqlFileIfNeeded(_0xbdd4e9,_0x1b55c5['path'],_0x25a20c[_0x456080(0x1a8)]),_0x3ba874[_0x456080(0x18e)]({'sqlCode':_0x25a20c[_0x456080(0x1a5)],'remoteId':_0x1b55c5[_0x456080(0x196)]});}catch(_0x3b679a){_0x2e56ef[_0x456080(0x18e)]({'sqlCode':_0x25a20c[_0x456080(0x1a5)],'error':_0x3b679a instanceof Error?_0x3b679a['message']:String(_0x3b679a)});}}return _0x1cf9ee['lastSync']=new Date()[_0x456080(0x18b)](),await writeSqlLockFile(_0xbdd4e9[_0x456080(0x19c)],_0x150567),{'ok':_0x2e56ef[_0x456080(0x18c)]===0x0,'data':{'pushed':_0x3ba874,'skipped':_0x3206e2,'failed':_0x2e56ef},'message':_0x456080(0x171)+_0x3ba874[_0x456080(0x18c)]+_0x456080(0x180)+_0x3206e2[_0x456080(0x18c)]+_0x456080(0x1a0)+_0x2e56ef[_0x456080(0x18c)]+_0x456080(0x1a1)};}};async function archivePreviousSqlFileIfNeeded(_0x553151,_0x4e9f27,_0x5a49fe){const _0x413918=a123_0x16400e;if(!_0x4e9f27||_0x4e9f27===_0x5a49fe)return;const _0xc3cfd2=join(_0x553151[_0x413918(0x199)],_0x4e9f27);if(!await fileExists(_0xc3cfd2))return;const _0x1b34aa=await moveToTrash(_0x553151['projectRoot'],_0x553151[_0x413918(0x185)],_0xc3cfd2);await cleanupEmptyDirectories(dirname(_0xc3cfd2),_0x553151[_0x413918(0x199)]),void _0x1b34aa;}async function moveToTrash(_0xebc041,_0xb2101f,_0x539ee8){const _0x2ea74a=a123_0x16400e,_0x1ddaaf=new Date()[_0x2ea74a(0x18b)]()['replace'](/[:.]/g,'-'),_0x423c37=relative(_0xebc041,_0x539ee8),_0x1c80e6=join(_0xb2101f,_0x1ddaaf,_0x423c37);return await mkdir(dirname(_0x1c80e6),{'recursive':!![]}),await rename(_0x539ee8,_0x1c80e6),_0x1c80e6;}async function cleanupEmptyDirectories(_0x30fe19,_0x48e601){const _0x404207=a123_0x16400e;let _0x4fa98f=resolve(_0x30fe19);const _0x2f7804=resolve(_0x48e601);while(_0x4fa98f['startsWith'](''+_0x2f7804+sep)||_0x4fa98f===_0x2f7804){if(_0x4fa98f===_0x2f7804)return;try{const _0x107884=await readdir(_0x4fa98f);if(_0x107884[_0x404207(0x18c)]>0x0)return;await rmdir(_0x4fa98f);}catch{return;}_0x4fa98f=dirname(_0x4fa98f);}}async function resolveTargetDbBinding(_0x52e831,_0x412c34,_0x2373a7){const _0x574f88=a123_0x16400e,_0x395006=_0x412c34['dbDirectory'];if(!_0x395006)return{'dbId':_0x2373a7[_0x574f88(0x179)],'dbName':_0x2373a7['dbName']};const _0x4b3d47=buildDbDirectoryName(_0x2373a7[_0x574f88(0x1aa)],_0x2373a7[_0x574f88(0x179)]);if(_0x395006===_0x4b3d47)return{'dbId':_0x2373a7['dbId'],'dbName':_0x2373a7[_0x574f88(0x1aa)]};const _0x1f0741=parseExplicitDbDirectory(_0x395006);if(_0x1f0741!=null)return{'dbId':_0x1f0741,'dbName':await getDbName(_0x52e831,_0x1f0741)[_0x574f88(0x175)](()=>undefined)};const _0x16247d=await listDatabases(_0x52e831),_0x5dd466=_0x16247d[_0x574f88(0x18f)](_0x43cbb4=>buildDbDirectoryName(_0x43cbb4['dbName'],_0x43cbb4[_0x574f88(0x179)])===_0x395006);if(_0x5dd466[_0x574f88(0x18c)]===0x1)return{'dbId':_0x5dd466[0x0][_0x574f88(0x179)],'dbName':_0x5dd466[0x0][_0x574f88(0x1aa)]};if(_0x5dd466[_0x574f88(0x18c)]===0x0)throw CliErrors['validation']('No\x20database\x20matches\x20local\x20directory\x20\x22'+_0x395006+_0x574f88(0x18a)+_0x412c34['sqlCode']+'.');const _0x422e6f=_0x5dd466[_0x574f88(0x173)](_0xbf94ef=>_0xbf94ef[_0x574f88(0x1aa)]+'\x20('+_0xbf94ef[_0x574f88(0x179)]+')')[_0x574f88(0x177)](',\x20');throw CliErrors[_0x574f88(0x190)](_0x574f88(0x174)+_0x395006+_0x574f88(0x182)+_0x412c34[_0x574f88(0x1a5)]+':\x20'+_0x422e6f);}function parseExplicitDbDirectory(_0x17ef9c){const _0x5b62c8=a123_0x16400e,_0x155858=/^db-(\d+)$/['exec'](_0x17ef9c);if(!_0x155858)return null;const _0x2390e9=Number(_0x155858[0x1]);return Number[_0x5b62c8(0x192)](_0x2390e9)&&_0x2390e9>0x0?_0x2390e9:null;}
|
package/lib/commands/sql/save.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a124_0x280b1a=a124_0x1707;(function(_0x4dde70,_0xa6e48e){const _0x3ae58d=a124_0x1707,_0x2cce4b=_0x4dde70();while(!![]){try{const _0x154392=parseInt(_0x3ae58d(0x92))/0x1+parseInt(_0x3ae58d(0x9e))/0x2*(-parseInt(_0x3ae58d(0x9a))/0x3)+parseInt(_0x3ae58d(0x96))/0x4+-parseInt(_0x3ae58d(0xa1))/0x5*(parseInt(_0x3ae58d(0x94))/0x6)+parseInt(_0x3ae58d(0x99))/0x7+parseInt(_0x3ae58d(0x8c))/0x8*(-parseInt(_0x3ae58d(0x98))/0x9)+-parseInt(_0x3ae58d(0x9b))/0xa*(-parseInt(_0x3ae58d(0xa4))/0xb);if(_0x154392===_0xa6e48e)break;else _0x2cce4b['push'](_0x2cce4b['shift']());}catch(_0x45b409){_0x2cce4b['push'](_0x2cce4b['shift']());}}}(a124_0x9a8a,0xd1ad7));function a124_0x9a8a(){const _0x2038b5=['3890628zKVhyB','validation','9801747JjdFWp','5269124YtHICL','256854cfLaqx','810xuoWwt','Deprecated:\x20use\x20sql\x20create\x20to\x20create\x20and\x20sql\x20push\x20to\x20update','SQL\x20query\x20display\x20name','14iAhHVT','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`.','Query\x20description','3752525byrvjI','join','Target\x20database\x20—\x20accepts\x20a\x20numeric\x20ID\x20or\x20database\x20name\x20(e.g.\x20ecommerce_db)','172359mRCcRa','description','sql','8eofoDV','save','write','Create\x20new\x20SQL\x20with\x20`rabetbase\x20sql\x20create\x20--name\x20<name>\x20--db-id\x20<id>\x20--mode\x20sql|mybatisXml`.','`rabetbase\x20sql\x20save`\x20has\x20been\x20deprecated.','Path\x20to\x20the\x20SQL\x20file','1053680XlAMjl','string','12VfcbWt','sqlname'];a124_0x9a8a=function(){return _0x2038b5;};return a124_0x9a8a();}import{CliErrors}from'../../errors.js';function a124_0x1707(_0x2e6427,_0x228ae1){_0x2e6427=_0x2e6427-0x8c;const _0x9a8ae9=a124_0x9a8a();let _0x1707ce=_0x9a8ae9[_0x2e6427];return _0x1707ce;}import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';const SQL_SAVE_DEPRECATED_HINT=[a124_0x280b1a(0x90),a124_0x280b1a(0x8f),a124_0x280b1a(0x9f)][a124_0x280b1a(0xa2)]('\x0a');export const sqlSave={'service':a124_0x280b1a(0xa6),'command':a124_0x280b1a(0x8d),'description':a124_0x280b1a(0x9c),'risk':a124_0x280b1a(0x8e),'requiresAuth':![],'requiresAppCode':![],'flags':[{'name':'file','type':a124_0x280b1a(0x93),'required':!![],'description':a124_0x280b1a(0x91)},SQLCODE_FLAG_OPTIONAL,{'name':a124_0x280b1a(0x95),'type':'string','description':a124_0x280b1a(0x9d)},{'name':'db','type':'string','description':a124_0x280b1a(0xa3)},{'name':a124_0x280b1a(0xa5),'type':'string','description':a124_0x280b1a(0xa0)}],async 'validate'(){const _0x8ea64f=a124_0x280b1a;throw CliErrors[_0x8ea64f(0x97)](SQL_SAVE_DEPRECATED_HINT);},async 'execute'(){const _0x580da1=a124_0x280b1a;throw CliErrors[_0x580da1(0x97)](SQL_SAVE_DEPRECATED_HINT);}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x46736b,_0x1e308f){const _0x59026a=a125_0xea62,_0x467dcf=_0x46736b();while(!![]){try{const _0x103b36=-parseInt(_0x59026a(0xab))/0x1+parseInt(_0x59026a(0xb0))/0x2*(-parseInt(_0x59026a(0xc1))/0x3)+parseInt(_0x59026a(0xa5))/0x4*(parseInt(_0x59026a(0xc6))/0x5)+parseInt(_0x59026a(0xb6))/0x6*(parseInt(_0x59026a(0xb8))/0x7)+-parseInt(_0x59026a(0xac))/0x8*(parseInt(_0x59026a(0xcb))/0x9)+parseInt(_0x59026a(0xca))/0xa*(parseInt(_0x59026a(0xa2))/0xb)+parseInt(_0x59026a(0xa6))/0xc;if(_0x103b36===_0x1e308f)break;else _0x467dcf['push'](_0x467dcf['shift']());}catch(_0x55a4b0){_0x467dcf['push'](_0x467dcf['shift']());}}}(a125_0x3312,0x45e77));import{createInterface}from'node:readline';import{join}from'node:path';import{buildDefaultSqlFileName,buildSqlRelativePath,detectSqlMode}from'../../core/sql-sync/utils.js';export const SQL_LOCAL_REL_DIR='.rabetbase/sql';export function buildSqlLockEntry(_0x36dc7e,_0x461256,_0x443664,_0x4be529){const _0x41902c=a125_0xea62,_0x4e0326=detectSqlMode(_0x461256);return{'path':buildSqlRelativePath(_0x36dc7e['sqlCode'],_0x36dc7e[_0x41902c(0xaf)],_0x4be529?.[_0x41902c(0xc9)],_0x4e0326,_0x36dc7e[_0x41902c(0xb9)]),'hash':_0x443664,'remoteId':_0x36dc7e['id'],'version':_0x36dc7e[_0x41902c(0xcd)],'dbId':Number(_0x36dc7e[_0x41902c(0xb9)]),'dbName':_0x4be529?.[_0x41902c(0xc9)],'sqlName':_0x36dc7e[_0x41902c(0xaf)],'sqlConfig':_0x36dc7e['sqlConfig']??undefined,'mode':_0x4e0326};}export function cloneSqlLockData(_0x5a8a67){const _0x3398aa=a125_0xea62;return{'apps':Object[_0x3398aa(0xc7)](Object['entries'](_0x5a8a67[_0x3398aa(0xaa)])['map'](([_0x4fc5e0,_0x23de8b])=>[_0x4fc5e0,{'sqlRoot':_0x23de8b[_0x3398aa(0xce)],'lastSync':_0x23de8b[_0x3398aa(0xb4)],'sqls':{..._0x23de8b['sqls']}}]))};}export function ensureRemoteSqlContent(_0x837e33){const _0x4d3083=a125_0xea62;return _0x837e33[_0x4d3083(0xc3)]??'';}export function buildLocalSqlFileContent(_0xbf9d6e,_0x5b0cc9,_0x1012f8){const _0x15a54a=a125_0xea62,_0x18c1c5=_0x1012f8?.[_0x15a54a(0xbf)]??detectSqlMode(_0x5b0cc9),_0x20068f=stripLocalSqlMetadata(_0x5b0cc9,_0x18c1c5)['trim'](),_0x4c85e1=[...buildMetadataHeaderLines({'sqlCode':_0xbf9d6e[_0x15a54a(0xa3)],'sqlName':_0xbf9d6e[_0x15a54a(0xaf)],'dbId':_0xbf9d6e[_0x15a54a(0xb9)],'dbName':_0x1012f8?.[_0x15a54a(0xc9)],'mode':_0x18c1c5,'syncedAt':_0x1012f8?.[_0x15a54a(0xbe)],'description':_0x1012f8?.[_0x15a54a(0xb3)]},_0x18c1c5),'',_0x20068f],_0x5037dd=_0x4c85e1['join']('\x0a');return _0x5037dd['endsWith']('\x0a')?_0x5037dd:_0x5037dd+'\x0a';}export function stripLocalSqlMetadata(_0x17cbbb,_0x21991f){const _0x53f689=a125_0xea62,_0x120aab=_0x17cbbb[_0x53f689(0xba)](/\r\n/g,'\x0a')[_0x53f689(0xc4)]('\x0a'),_0x30b2f0=[];let _0x21223e=0x0;if(_0x21991f===_0x53f689(0xb1))while(_0x21223e<_0x120aab['length']){const _0x53287d=_0x120aab[_0x21223e]??'';if(/^\s*<!--\s*@lovrabet\./[_0x53f689(0xcf)](_0x53287d)){_0x21223e++;continue;}if(_0x53287d['trim']()===''&&_0x21223e>0x0){_0x21223e++;continue;}break;}else while(_0x21223e<_0x120aab[_0x53f689(0xbc)]){const _0x4e0654=_0x120aab[_0x21223e]??'';if(/^\s*--\s*@lovrabet\./[_0x53f689(0xcf)](_0x4e0654)){_0x21223e++;continue;}if(_0x4e0654[_0x53f689(0xc5)]()===''&&_0x21223e>0x0){_0x21223e++;continue;}break;}for(;_0x21223e<_0x120aab[_0x53f689(0xbc)];_0x21223e++){_0x30b2f0[_0x53f689(0xad)](_0x120aab[_0x21223e]);}return _0x30b2f0[_0x53f689(0xcc)]('\x0a')[_0x53f689(0xa8)]();}export function resolveSqlMode(_0x2783e4,_0x3df1cc){const _0x4df1eb=a125_0xea62;if(_0x3df1cc?.['mode'])return _0x3df1cc[_0x4df1eb(0xbf)];return detectSqlMode(_0x2783e4);}export function resolveSqlFileName(_0x31fa85,_0x35210c,_0x130ed1){const _0x461abc=a125_0xea62;if(_0x130ed1?.['path'])return _0x130ed1[_0x461abc(0xa9)];if(_0x130ed1?.[_0x461abc(0xaf)]||_0x130ed1?.[_0x461abc(0xc9)])return buildSqlRelativePath(_0x31fa85,_0x130ed1?.[_0x461abc(0xaf)],_0x130ed1?.[_0x461abc(0xc9)],resolveSqlMode(_0x35210c,_0x130ed1),_0x130ed1?.['dbId']);return buildDefaultSqlFileName(_0x31fa85,resolveSqlMode(_0x35210c,_0x130ed1));}function a125_0x3312(){const _0x477815=['path','apps','179838kYSUzx','2736zmaDDF','push','question','sqlName','46PQylKG','mybatisXml','--\x20@lovrabet.','description','lastSync','toLowerCase','2112090FAEsUt','yes','7dHmDpK','dbId','replace','filter','length','close','syncedAt','mode','\x20-->','12345pwcdwg','stderr','sqlContent','split','trim','1078170qJwljB','fromEntries','includes','dbName','10sPWLRU','15048AGdiSp','join','version','sqlRoot','test','3436862tqjyqW','sqlCode','stdin','4XuhBCX','3030516sKgLui','<!--\x20@lovrabet.','trimStart'];a125_0x3312=function(){return _0x477815;};return a125_0x3312();}export function resolveSqlLocalDir(_0x39fa62,_0x52c570){return join(_0x39fa62,SQL_LOCAL_REL_DIR,_0x52c570);}function a125_0xea62(_0x4e8e23,_0x3c8a5e){_0x4e8e23=_0x4e8e23-0xa2;const _0x3312b4=a125_0x3312();let _0xea62e0=_0x3312b4[_0x4e8e23];return _0xea62e0;}export async function confirmForceOverwrite(_0x109161){const _0x480309=a125_0xea62,_0x197e28=createInterface({'input':process[_0x480309(0xa4)],'output':process[_0x480309(0xc2)]}),_0x4c74ee=await new Promise(_0x30986c=>{const _0x59ff01=_0x480309;_0x197e28[_0x59ff01(0xae)](_0x109161+'\x20[y/N]\x20',_0x30986c);});return _0x197e28[_0x480309(0xbd)](),['y',_0x480309(0xb7)][_0x480309(0xc8)](_0x4c74ee['trim']()[_0x480309(0xb5)]());}export function findSqlLockScope(_0x158311,_0x3815eb){const _0x511675=a125_0xea62;return _0x158311[_0x511675(0xaa)][_0x3815eb];}function buildMetadataHeaderLines(_0x16b73b,_0x3f2a8d){const _0x20b10b=a125_0xea62,_0x32bb0c=[[_0x20b10b(0xa3),_0x16b73b[_0x20b10b(0xa3)]],[_0x20b10b(0xaf),_0x16b73b[_0x20b10b(0xaf)]],['dbId',_0x16b73b[_0x20b10b(0xb9)]],[_0x20b10b(0xc9),_0x16b73b[_0x20b10b(0xc9)]],[_0x20b10b(0xbf),_0x16b73b[_0x20b10b(0xbf)]],[_0x20b10b(0xbe),_0x16b73b[_0x20b10b(0xbe)]],[_0x20b10b(0xb3),_0x16b73b['description']]];if(_0x3f2a8d===_0x20b10b(0xb1))return _0x32bb0c[_0x20b10b(0xbb)](([,_0x5e4893])=>_0x5e4893!==undefined&&_0x5e4893!==null&&String(_0x5e4893)[_0x20b10b(0xc5)]()!=='')['map'](([_0x51d3b5,_0x5d7995])=>_0x20b10b(0xa7)+_0x51d3b5+':\x20'+String(_0x5d7995)+_0x20b10b(0xc0));return _0x32bb0c[_0x20b10b(0xbb)](([,_0x44fb08])=>_0x44fb08!==undefined&&_0x44fb08!==null&&String(_0x44fb08)['trim']()!=='')['map'](([_0x58ee73,_0x58a8e8])=>_0x20b10b(0xb2)+_0x58ee73+':\x20'+String(_0x58a8e8));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a126_0xe76a2=a126_0x5067;(function(_0x5e0ed8,_0x4faaf9){const _0x31b4cc=a126_0x5067,_0x437394=_0x5e0ed8();while(!![]){try{const _0x1b5210=-parseInt(_0x31b4cc(0xf7))/0x1+parseInt(_0x31b4cc(0xf1))/0x2+parseInt(_0x31b4cc(0xf5))/0x3+parseInt(_0x31b4cc(0xf0))/0x4*(parseInt(_0x31b4cc(0x104))/0x5)+parseInt(_0x31b4cc(0x10a))/0x6+-parseInt(_0x31b4cc(0xfe))/0x7+-parseInt(_0x31b4cc(0x110))/0x8*(-parseInt(_0x31b4cc(0x10d))/0x9);if(_0x1b5210===_0x4faaf9)break;else _0x437394['push'](_0x437394['shift']());}catch(_0x3a76d2){_0x437394['push'](_0x437394['shift']());}}}(a126_0x3df6,0x45dea));import{listSqlQueries}from'../../core/api-client.js';function a126_0x3df6(){const _0x2244be=['Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','268rdPRUI','102506SMnpwB','filePath','lockKey','\x20missing,\x20','1075083WCJmay','sql','369438RumPAs','appCode','relativePath','\x20modified,\x20','map','sqls','paging','2414923biLLZS','sqlRoot','push','\x20added,\x20','path','bool','33665WVtdcI','sqlName','hash','status','Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally','\x20remote-only','150732YXuLyq','tableData','has','18OPEczX','\x20unchanged','remote','459064HBoRHL','totalCount','length'];a126_0x3df6=function(){return _0x2244be;};return a126_0x3df6();}import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile}from'../../core/sql-sync/lock.js';const PAGE_SIZE=0x64;function a126_0x5067(_0x46d9d7,_0x1e3a04){_0x46d9d7=_0x46d9d7-0xef;const _0x3df62b=a126_0x3df6();let _0x506732=_0x3df62b[_0x46d9d7];return _0x506732;}async function fetchAllSqlCodes(_0x1df3b6){const _0x25da4c=a126_0x5067,_0x30fafe=[];let _0x2eca39=0x1;while(!![]){const _0x14b150=await listSqlQueries(_0x1df3b6,{'currentPage':_0x2eca39,'pageSize':PAGE_SIZE}),_0x19a217=_0x14b150[_0x25da4c(0x10b)]??[];_0x30fafe[_0x25da4c(0x100)](..._0x19a217[_0x25da4c(0xfb)](_0x36d264=>_0x36d264['sqlCode']));if(_0x19a217[_0x25da4c(0x112)]===0x0)break;const _0x3fadc6=_0x14b150[_0x25da4c(0xfd)]?.[_0x25da4c(0x111)];if(_0x3fadc6!=null?_0x30fafe[_0x25da4c(0x112)]>=_0x3fadc6:_0x19a217[_0x25da4c(0x112)]<PAGE_SIZE)break;_0x2eca39++;}return _0x30fafe;}export const sqlStatus={'service':a126_0xe76a2(0xf6),'command':a126_0xe76a2(0x107),'description':a126_0xe76a2(0xef),'risk':'read','flags':[{'name':'remote','type':'boolean','description':a126_0xe76a2(0x108)}],async 'execute'(_0x1ca3f2){const _0x56dcf5=a126_0xe76a2,_0x10e4f4=loadSqlProjectConfig(_0x1ca3f2['appCode']),_0x2ee773=await readSqlLockFile(_0x10e4f4['lockFilePath']),{appLock:_0x21ad9e}=ensureSqlLockScope(_0x2ee773??createEmptySqlLock(),_0x10e4f4[_0x56dcf5(0xf8)],_0x10e4f4[_0x56dcf5(0xff)],'status'),_0xe99b6a=await scanLocalSqlQueries(_0x10e4f4),_0x4f7d4a=[],_0x24392e=[],_0x52e968=[],_0x2a3628=[],_0x28bcd6=new Set(_0xe99b6a[_0x56dcf5(0xfb)](_0x108ff1=>_0x108ff1['lockKey']));for(const _0x1117f9 of _0xe99b6a){const _0x452313=await computeSqlFileHash(_0x1117f9[_0x56dcf5(0xf2)]),_0x561de6=_0x21ad9e[_0x56dcf5(0xfc)][_0x1117f9[_0x56dcf5(0xf3)]],_0x18da3c=!!_0x561de6&&_0x561de6[_0x56dcf5(0x102)]!==_0x1117f9[_0x56dcf5(0xf9)],_0x594ec8=!!_0x561de6&&!!_0x1117f9[_0x56dcf5(0x105)]&&_0x561de6[_0x56dcf5(0x105)]!==_0x1117f9['sqlName'];if(!_0x561de6)_0x4f7d4a['push'](_0x1117f9[_0x56dcf5(0xf3)]);else _0x561de6[_0x56dcf5(0x106)]!==_0x452313||_0x18da3c||_0x594ec8?_0x24392e[_0x56dcf5(0x100)](_0x1117f9[_0x56dcf5(0xf3)]):_0x52e968[_0x56dcf5(0x100)](_0x1117f9[_0x56dcf5(0xf3)]);}for(const _0x197995 of Object['keys'](_0x21ad9e['sqls'])){!_0x28bcd6['has'](_0x197995)&&_0x2a3628[_0x56dcf5(0x100)](_0x197995);}const _0x16eed5=[];if(_0x1ca3f2[_0x56dcf5(0x103)](_0x56dcf5(0x10f))){const _0x435d95=await fetchAllSqlCodes(_0x1ca3f2['appCode']);for(const _0x14b342 of _0x435d95){!_0x28bcd6[_0x56dcf5(0x10c)](_0x14b342)&&!_0x21ad9e[_0x56dcf5(0xfc)][_0x14b342]&&_0x16eed5['push'](_0x14b342);}}const _0x1370d6=_0x4f7d4a['length']===0x0&&_0x24392e['length']===0x0&&_0x2a3628[_0x56dcf5(0x112)]===0x0&&_0x16eed5['length']===0x0;return{'ok':!![],'data':{'added':_0x4f7d4a,'modified':_0x24392e,'missing':_0x2a3628,'unchanged':_0x52e968,'remoteOnly':_0x16eed5},'message':_0x1370d6?'All\x20SQL\x20queries\x20are\x20in\x20sync.':_0x4f7d4a[_0x56dcf5(0x112)]+_0x56dcf5(0x101)+_0x24392e['length']+_0x56dcf5(0xfa)+_0x2a3628['length']+_0x56dcf5(0xf4)+_0x52e968[_0x56dcf5(0x112)]+_0x56dcf5(0x10e)+(_0x16eed5['length']>0x0?',\x20'+_0x16eed5['length']+_0x56dcf5(0x109):'')};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a127_0x46ffba=a127_0x2aef;(function(_0x89adf1,_0x46dc15){const _0x71bd02=a127_0x2aef,_0x44d1c5=_0x89adf1();while(!![]){try{const _0x4af09c=-parseInt(_0x71bd02(0x1bf))/0x1+parseInt(_0x71bd02(0x1cb))/0x2+-parseInt(_0x71bd02(0x1b4))/0x3+parseInt(_0x71bd02(0x1ab))/0x4*(parseInt(_0x71bd02(0x1bb))/0x5)+parseInt(_0x71bd02(0x1b6))/0x6*(parseInt(_0x71bd02(0x1b0))/0x7)+-parseInt(_0x71bd02(0x1ba))/0x8*(parseInt(_0x71bd02(0x1d1))/0x9)+parseInt(_0x71bd02(0x1c7))/0xa;if(_0x4af09c===_0x46dc15)break;else _0x44d1c5['push'](_0x44d1c5['shift']());}catch(_0x42f0ff){_0x44d1c5['push'](_0x44d1c5['shift']());}}}(a127_0x3a26,0x788cc));import{readFileSync,existsSync}from'node:fs';import{resolve}from'node:path';import{validateSql}from'../../core/sql-validator.js';import{getDatasetDetail,listDatasets}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{assertDatasetSupportsLocalDevelopment,filterDbBackedDatasets}from'../../commands/dataset/capability.js';function a127_0x2aef(_0x273325,_0x58d431){_0x273325=_0x273325-0x1a4;const _0x3a266d=a127_0x3a26();let _0x2aef16=_0x3a266d[_0x273325];return _0x2aef16;}function a127_0x3a26(){const _0x4daeae=['7250080mMOarz','Dataset\x20\x22','type','Table\x20\x22','1005320xZKfZo','reason','message','tableName','Path\x20to\x20the\x20SQL\x20file\x20to\x20validate','size','29907PiHVOl','Comma-separated\x20dataset\x20codes\x20to\x20cross-check\x20table/column\x20names\x20against','push','Provide\x20--file\x20or\x20--sql','toLowerCase','\x22\x20not\x20found\x20in\x20any\x20dataset','fields','file','length','schemas','utf-8','filter','schema:','from','flagMissing','589076daLLUT','sqlType','name','tables','string','34258KRFhLt','valid','get','Inline\x20SQL\x20content\x20to\x20validate\x20(alternative\x20to\x20--file)','1306329dAUwkw','map','18ZwfVwe','schemaWarnings','dbtableConfig','cwd','304FuQGRl','25ioUKJW','read','split','isArray','923206NnonAp','Validate\x20SQL\x20content\x20without\x20saving\x20(type\x20detection,\x20parameter\x20extraction,\x20optional\x20schema\x20check)','isSelectOnly','str','File\x20not\x20found:\x20','trim','appCode','sql'];a127_0x3a26=function(){return _0x4daeae;};return a127_0x3a26();}export const sqlValidate={'service':'sql','command':'validate','description':a127_0x46ffba(0x1c0),'risk':a127_0x46ffba(0x1bc),'flags':[{'name':a127_0x46ffba(0x1d8),'type':a127_0x46ffba(0x1af),'description':a127_0x46ffba(0x1cf)},{'name':a127_0x46ffba(0x1c6),'type':a127_0x46ffba(0x1af),'description':a127_0x46ffba(0x1b3)},{'name':a127_0x46ffba(0x1a5),'type':a127_0x46ffba(0x1af),'description':a127_0x46ffba(0x1d2)}],async 'execute'(_0x53a2c3){const _0x170b65=a127_0x46ffba,_0xc1d928=_0x53a2c3['str']('file'),_0x477aef=_0x53a2c3[_0x170b65(0x1c2)]('sql');if(!_0xc1d928&&!_0x477aef)throw CliErrors[_0x170b65(0x1aa)](_0x170b65(0x1d8),_0x170b65(0x1d4));let _0x30a2c2;if(_0xc1d928){const _0x532163=resolve(process[_0x170b65(0x1b9)](),_0xc1d928);if(!existsSync(_0x532163))throw CliErrors['validation'](_0x170b65(0x1c3)+_0x532163);_0x30a2c2=readFileSync(_0x532163,_0x170b65(0x1a6));}else _0x30a2c2=_0x477aef;const _0x6f3628=validateSql(_0x30a2c2),_0x362d92={'valid':_0x6f3628['valid'],'sqlType':_0x6f3628['sqlType'][_0x170b65(0x1c9)],'isSelectOnly':_0x6f3628[_0x170b65(0x1ac)][_0x170b65(0x1c1)],'isDangerous':_0x6f3628[_0x170b65(0x1ac)]['isDangerous'],'tables':_0x6f3628['tables'],'parameters':_0x6f3628['parameters'],'message':_0x6f3628[_0x170b65(0x1cd)]};_0x6f3628[_0x170b65(0x1ac)][_0x170b65(0x1cc)]&&(_0x362d92['reason']=_0x6f3628['sqlType'][_0x170b65(0x1cc)]);const _0x59baf6=_0x53a2c3[_0x170b65(0x1c2)](_0x170b65(0x1a5));if(_0x59baf6&&_0x6f3628[_0x170b65(0x1b1)]){const _0x401155=_0x59baf6[_0x170b65(0x1bd)](',')[_0x170b65(0x1b5)](_0x1957cf=>_0x1957cf[_0x170b65(0x1c4)]())[_0x170b65(0x1a7)](Boolean),_0x25af04=[],_0x93ccc7=filterDbBackedDatasets(await listDatasets(_0x53a2c3[_0x170b65(0x1c5)])),_0x4b2732=new Map(_0x93ccc7['map'](_0x26f1be=>[_0x26f1be[_0x170b65(0x1b8)]?.[_0x170b65(0x1ce)]?.[_0x170b65(0x1d5)](),_0x26f1be]));for(const _0x350769 of _0x6f3628[_0x170b65(0x1ae)]){const _0x8b0067=_0x4b2732[_0x170b65(0x1b2)](_0x350769[_0x170b65(0x1d5)]());!_0x8b0067&&_0x25af04[_0x170b65(0x1d3)](_0x170b65(0x1ca)+_0x350769+_0x170b65(0x1d6));}for(const _0x4c4c6b of _0x401155){let _0x2b2e54;try{_0x2b2e54=await getDatasetDetail(_0x4c4c6b);}catch{_0x25af04['push'](_0x170b65(0x1c8)+_0x4c4c6b+'\x22\x20not\x20found\x20or\x20not\x20accessible');continue;}assertDatasetSupportsLocalDevelopment(_0x2b2e54,'SQL\x20schema\x20validation');const _0x561129=Array[_0x170b65(0x1be)](_0x2b2e54[_0x170b65(0x1d7)])?_0x2b2e54['fields']:[],_0x24029f=new Set(_0x561129[_0x170b65(0x1b5)](_0x292dad=>_0x292dad[_0x170b65(0x1ad)]?.[_0x170b65(0x1d5)]())),_0x2389c2=_0x2b2e54[_0x170b65(0x1b8)]?.['tableName']||_0x2b2e54[_0x170b65(0x1ce)]||_0x4c4c6b;_0x362d92[_0x170b65(0x1a8)+_0x2389c2]={'code':_0x4c4c6b,'tableName':_0x2389c2,'fieldCount':_0x24029f[_0x170b65(0x1d0)],'fields':Array[_0x170b65(0x1a9)](_0x24029f)};}_0x25af04[_0x170b65(0x1a4)]>0x0&&(_0x362d92[_0x170b65(0x1b7)]=_0x25af04);}return{'ok':_0x6f3628[_0x170b65(0x1b1)],'data':_0x362d92,'message':_0x6f3628['message']};}};
|
package/lib/config/schema.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a128_0x463b01=a128_0x128f;(function(_0x4cf672,_0x57c549){const _0x5700ee=a128_0x128f,_0x225101=_0x4cf672();while(!![]){try{const _0x29ec45=-parseInt(_0x5700ee(0x13c))/0x1+parseInt(_0x5700ee(0x143))/0x2+-parseInt(_0x5700ee(0x13d))/0x3*(parseInt(_0x5700ee(0x133))/0x4)+parseInt(_0x5700ee(0x13a))/0x5+parseInt(_0x5700ee(0x14e))/0x6*(-parseInt(_0x5700ee(0x138))/0x7)+parseInt(_0x5700ee(0x153))/0x8+parseInt(_0x5700ee(0x131))/0x9;if(_0x29ec45===_0x57c549)break;else _0x225101['push'](_0x225101['shift']());}catch(_0x5701a0){_0x225101['push'](_0x225101['shift']());}}}(a128_0x2134,0xa1ff5));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=[a128_0x463b01(0x135),a128_0x463b01(0x147),'locale','format',a128_0x463b01(0x13b)];export const TOP_LEVEL_CONFIG_KEYS=new Set([a128_0x463b01(0x146),'env',a128_0x463b01(0x132),'format','cookie',a128_0x463b01(0x147),a128_0x463b01(0x137)]);export const CONFIG_ENUM_VALUES={'env':[...RABETBASE_ENV_VALUES],'format':[...RABETBASE_OUTPUT_FORMAT_VALUES]};function a128_0x2134(){const _0x177627=['Config\x20key\x20(','Locale','zh-CN','2635932kYgTlG','format','join','appcode','accessKey','length','Auth\x20cookie','Access\x20key','Default\x20page\x20size','string','toLowerCase','26352xuSxeb','inherit','number','Target\x20environment','API\x20directory\x20path','6210408yFUotm','en-US','env','app','Risk\x20level','4583547FeNdsY','locale','468MFMALJ','trim','cookie','defaultFormat','apiDir','672nqSTZx','pageSize','70600ZPLetR','riskLevel','291010RLZfVS','31833YFapzj','defaultApp','apps'];a128_0x2134=function(){return _0x177627;};return a128_0x2134();}export function formatConfigKeyList(_0x31c51c){const _0x187927=a128_0x463b01;return[..._0x31c51c][_0x187927(0x145)](',\x20');}function a128_0x128f(_0x438e29,_0x3b3c2c){_0x438e29=_0x438e29-0x131;const _0x213452=a128_0x2134();let _0x128fa6=_0x213452[_0x438e29];return _0x128fa6;}export function getTopLevelConfigKeyList(){return[...TOP_LEVEL_CONFIG_KEYS];}export function isTopLevelConfigKey(_0x3cdec7){return TOP_LEVEL_CONFIG_KEYS['has'](_0x3cdec7);}export function getTopLevelConfigKeySummary(){return formatConfigKeyList(getTopLevelConfigKeyList());}export function getConfigCommandKeyDescription(){const _0x47d31d=a128_0x463b01;return _0x47d31d(0x140)+getTopLevelConfigKeySummary()+')';}export const APP_PROFILE_FLAG_KEY_MAP={'env':a128_0x463b01(0x155),'apiDir':'apiDir','cookie':a128_0x463b01(0x135),'accessKey':a128_0x463b01(0x147),'defaultFormat':a128_0x463b01(0x144),'pageSize':a128_0x463b01(0x139),'riskLevel':a128_0x463b01(0x13b),'locale':a128_0x463b01(0x132)};export function getAppProfileFlagDefs(){const _0x54a45d=a128_0x463b01;return[{'name':_0x54a45d(0x155),'type':_0x54a45d(0x14c),'description':_0x54a45d(0x151),'enum':[...RABETBASE_ENV_VALUES]},{'name':_0x54a45d(0x137),'type':_0x54a45d(0x14c),'description':_0x54a45d(0x152)},{'name':_0x54a45d(0x135),'type':_0x54a45d(0x14c),'description':_0x54a45d(0x149),'hidden':!![]},{'name':_0x54a45d(0x147),'type':_0x54a45d(0x14c),'description':_0x54a45d(0x14a),'hidden':!![]},{'name':_0x54a45d(0x136),'type':_0x54a45d(0x14c),'description':'Default\x20output\x20format\x20for\x20this\x20app\x20(profile)','enum':[...RABETBASE_OUTPUT_FORMAT_VALUES]},{'name':_0x54a45d(0x139),'type':_0x54a45d(0x150),'description':_0x54a45d(0x14b)},{'name':'riskLevel','type':_0x54a45d(0x14c),'description':_0x54a45d(0x157),'enum':[...RISK_LEVEL_VALUES]},{'name':_0x54a45d(0x132),'type':_0x54a45d(0x14c),'description':_0x54a45d(0x141)}];}export function collectAppProfileOverrides(_0x8c4a9d){const _0x9a89af=a128_0x463b01,_0xe7f801={};for(const [_0x1e2616,_0x5670a2]of Object['entries'](APP_PROFILE_FLAG_KEY_MAP)){const _0x29c935=_0x8c4a9d(_0x1e2616);if(!_0x29c935)continue;_0xe7f801[_0x5670a2]=_0x5670a2===_0x9a89af(0x139)?Number(_0x29c935):_0x29c935;}return _0xe7f801;}export function buildAppProfileListFields(_0x188708){const _0x178608=a128_0x463b01;return{'env':_0x188708[_0x178608(0x155)]??null,'apiDir':_0x188708[_0x178608(0x137)]??null,'hasCookie':!!_0x188708[_0x178608(0x135)],'hasAccessKey':!!_0x188708[_0x178608(0x147)],'format':_0x188708[_0x178608(0x144)]??null,'pageSize':_0x188708[_0x178608(0x139)]??null,'riskLevel':_0x188708['riskLevel']??null,'locale':_0x188708[_0x178608(0x132)]??null};}export function buildAppDoctorFields(_0x4c8e2b,_0x2df74a){const _0x3f056d=a128_0x463b01;return{'env':{'value':_0x4c8e2b[_0x3f056d(0x155)]||_0x2df74a[_0x3f056d(0x155)],'source':_0x4c8e2b[_0x3f056d(0x155)]?_0x3f056d(0x156):_0x3f056d(0x14f)},'apiDir':{'value':_0x4c8e2b[_0x3f056d(0x137)]||_0x2df74a[_0x3f056d(0x137)],'source':_0x4c8e2b[_0x3f056d(0x137)]?_0x3f056d(0x156):_0x3f056d(0x14f)},'cookie':{'value':_0x4c8e2b[_0x3f056d(0x135)]||_0x2df74a[_0x3f056d(0x135)],'source':_0x4c8e2b[_0x3f056d(0x135)]?_0x3f056d(0x156):_0x3f056d(0x14f)},'accessKey':{'value':_0x4c8e2b['accessKey']||_0x2df74a[_0x3f056d(0x147)],'source':_0x4c8e2b[_0x3f056d(0x147)]?'app':_0x3f056d(0x14f)}};}export function buildCanonicalAppConfig(_0xd8fd37,_0x13ac21){const _0x264a69=a128_0x463b01,_0x39bced=_0xd8fd37['map'](_0x178a6b=>String(_0x178a6b||'')[_0x264a69(0x134)]())['filter'](Boolean);if(_0x39bced[_0x264a69(0x148)]===0x0)return{};const _0x189cd1={};for(const _0x345d4f of _0x39bced){_0x189cd1[_0x345d4f]=_0x13ac21?{'appcode':_0x345d4f,'env':_0x13ac21}:{'appcode':_0x345d4f};}return{'apps':_0x189cd1,'defaultApp':_0x39bced[0x0]};}export function buildCanonicalProjectConfig(_0x22ca8e,_0x578ebc){const _0x51e39a=a128_0x463b01,{appCodes:appCodes=[],env:_0x13a554,metadata:_0x4bc0b6}=_0x578ebc,_0x7700dd={..._0x22ca8e,..._0x4bc0b6||{}};delete _0x7700dd[_0x51e39a(0x146)],delete _0x7700dd[_0x51e39a(0x156)];if(_0x13a554)_0x7700dd[_0x51e39a(0x155)]=_0x13a554;else!_0x7700dd['env']&&(_0x7700dd[_0x51e39a(0x155)]=DEFAULT_CONFIG_VALUES[_0x51e39a(0x155)]);const _0xd41ac1=buildCanonicalAppConfig(appCodes,_0x7700dd[_0x51e39a(0x155)]);return Object['keys'](_0xd41ac1)[_0x51e39a(0x148)]>0x0&&(_0x7700dd[_0x51e39a(0x13f)]=_0xd41ac1[_0x51e39a(0x13f)],_0x7700dd[_0x51e39a(0x13e)]=_0xd41ac1[_0x51e39a(0x13e)]),_0x7700dd;}const LOCALE_MAP={'zh':a128_0x463b01(0x142),'zh-cn':a128_0x463b01(0x142),'zh_cn':a128_0x463b01(0x142),'en':'en-US','en-us':a128_0x463b01(0x154),'en_us':a128_0x463b01(0x154)};export function normalizeLocale(_0x4d34f5){const _0x3c0d49=a128_0x463b01;if(!_0x4d34f5)return null;return LOCALE_MAP[_0x4d34f5[_0x3c0d49(0x14d)]()]??null;}
|
package/lib/constant/cdn.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a129_0x1a46b4=a129_0x250d;(function(_0x45b4f0,_0x231ee9){const _0x334e21=a129_0x250d,_0x9b271a=_0x45b4f0();while(!![]){try{const _0x2dc044=parseInt(_0x334e21(0xc7))/0x1*(-parseInt(_0x334e21(0xc5))/0x2)+parseInt(_0x334e21(0xcd))/0x3+parseInt(_0x334e21(0xcc))/0x4*(parseInt(_0x334e21(0xd0))/0x5)+parseInt(_0x334e21(0xce))/0x6+parseInt(_0x334e21(0xcb))/0x7*(-parseInt(_0x334e21(0xc6))/0x8)+parseInt(_0x334e21(0xca))/0x9*(-parseInt(_0x334e21(0xc9))/0xa)+parseInt(_0x334e21(0xcf))/0xb;if(_0x2dc044===_0x231ee9)break;else _0x9b271a['push'](_0x9b271a['shift']());}catch(_0x2e116f){_0x9b271a['push'](_0x9b271a['shift']());}}}(a129_0x1179,0x3b79a));function a129_0x250d(_0x5d734f,_0x2a683d){_0x5d734f=_0x5d734f-0xc5;const _0x117980=a129_0x1179();let _0x250df7=_0x117980[_0x5d734f];return _0x250df7;}export const CLI_VERSION_POLICY_URL=a129_0x1a46b4(0xc8);function a129_0x1179(){const _0x5002ad=['2406922xBLBTc','4nZtczt','96180jsXxPS','2800344eiSmaa','6400878YsdDtV','11790PsoTto','2Tkfipp','8JCRCDM','327943eAtvgW','https://g.lovrabet.com/dist/rabetbase-cli/config/index.json','1676410ntaMeT','9njTvUv'];a129_0x1179=function(){return _0x5002ad;};return a129_0x1179();}
|
package/lib/constant/cli.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a130_0x5f4988=a130_0x537d;(function(_0x2218e4,_0x5c7610){const _0x5670c7=a130_0x537d,_0x41915b=_0x2218e4();while(!![]){try{const _0x16067b=-parseInt(_0x5670c7(0x95))/0x1+-parseInt(_0x5670c7(0xa3))/0x2*(-parseInt(_0x5670c7(0xa2))/0x3)+parseInt(_0x5670c7(0xbc))/0x4+-parseInt(_0x5670c7(0xa5))/0x5*(-parseInt(_0x5670c7(0x96))/0x6)+parseInt(_0x5670c7(0x92))/0x7*(-parseInt(_0x5670c7(0xab))/0x8)+parseInt(_0x5670c7(0xc9))/0x9*(parseInt(_0x5670c7(0x9e))/0xa)+-parseInt(_0x5670c7(0x7b))/0xb*(parseInt(_0x5670c7(0xd7))/0xc);if(_0x16067b===_0x5c7610)break;else _0x41915b['push'](_0x41915b['shift']());}catch(_0x1325d4){_0x41915b['push'](_0x41915b['shift']());}}}(a130_0x4cac,0x98bf2));export const CLI_BIN_NAME='rabetbase';function a130_0x537d(_0x2ace0d,_0x139e74){_0x2ace0d=_0x2ace0d-0x70;const _0x4cac72=a130_0x4cac();let _0x537dda=_0x4cac72[_0x2ace0d];return _0x537dda;}export const CLI_DISPLAY_NAME=a130_0x5f4988(0x8d);export const NPM_PACKAGE_NAME=a130_0x5f4988(0xc8);export const GLOBAL_FLAGS=[{'name':a130_0x5f4988(0x80),'meowKey':a130_0x5f4988(0x80),'type':'string','description':a130_0x5f4988(0x8c),'hint':a130_0x5f4988(0xd2)},{'name':'app','meowKey':a130_0x5f4988(0x77),'type':'string','description':'Select\x20app\x20profile\x20by\x20name','hint':a130_0x5f4988(0xcd)},{'name':'env','meowKey':'env','type':a130_0x5f4988(0xc6),'description':a130_0x5f4988(0xd6),'hint':a130_0x5f4988(0xdf)},{'name':'format','meowKey':a130_0x5f4988(0xd1),'type':a130_0x5f4988(0xc6),'description':a130_0x5f4988(0xad),'hint':a130_0x5f4988(0xcb)},{'name':'jq','meowKey':'jq','type':a130_0x5f4988(0xc6),'description':a130_0x5f4988(0xa8),'hint':a130_0x5f4988(0xba)},{'name':'dry-run','meowKey':'dryRun','type':'boolean','description':a130_0x5f4988(0xa6)},{'name':a130_0x5f4988(0xc3),'meowKey':a130_0x5f4988(0xc3),'type':a130_0x5f4988(0x85),'description':a130_0x5f4988(0x73)},{'name':a130_0x5f4988(0xc2),'meowKey':'nonInteractive','type':a130_0x5f4988(0x85),'description':a130_0x5f4988(0xdd)},{'name':'global','meowKey':a130_0x5f4988(0xca),'type':a130_0x5f4988(0x85),'description':a130_0x5f4988(0x93)},{'name':'project','meowKey':a130_0x5f4988(0x72),'type':'boolean','description':a130_0x5f4988(0x7c)},{'name':'ci','meowKey':'ci','type':'boolean','description':a130_0x5f4988(0x8e),'hidden':!![]},{'name':a130_0x5f4988(0x75),'meowKey':a130_0x5f4988(0x75),'type':a130_0x5f4988(0x85),'description':a130_0x5f4988(0xb9)},{'name':a130_0x5f4988(0x9c),'meowKey':a130_0x5f4988(0x9c),'type':a130_0x5f4988(0xc6),'description':a130_0x5f4988(0xcf),'hidden':!![]},{'name':a130_0x5f4988(0x82),'meowKey':a130_0x5f4988(0x82),'type':a130_0x5f4988(0xc6),'description':a130_0x5f4988(0x81),'hidden':!![]},{'name':a130_0x5f4988(0x94),'meowKey':a130_0x5f4988(0x94),'type':a130_0x5f4988(0x85),'description':a130_0x5f4988(0xb0),'hidden':!![]},{'name':a130_0x5f4988(0x8a),'meowKey':'watch','type':a130_0x5f4988(0x85),'description':a130_0x5f4988(0x86),'hidden':!![]},{'name':'output','meowKey':a130_0x5f4988(0xa0),'type':a130_0x5f4988(0xc6),'description':'Output\x20path','hidden':!![]},{'name':a130_0x5f4988(0xa4),'meowKey':'params','type':a130_0x5f4988(0xc6),'description':a130_0x5f4988(0x88),'hidden':!![]},{'name':a130_0x5f4988(0xa9),'meowKey':a130_0x5f4988(0xa9),'type':a130_0x5f4988(0xc6),'description':a130_0x5f4988(0xc0),'hidden':!![]},{'name':a130_0x5f4988(0xc4),'meowKey':a130_0x5f4988(0xc4),'type':a130_0x5f4988(0x85),'description':a130_0x5f4988(0xb1),'hidden':!![]},{'name':a130_0x5f4988(0x90),'meowKey':a130_0x5f4988(0xc7),'type':a130_0x5f4988(0x85),'description':a130_0x5f4988(0x70),'hidden':!![]},{'name':'id','meowKey':'id','type':'string','description':a130_0x5f4988(0x9a),'hidden':!![]},{'name':'type','meowKey':a130_0x5f4988(0xda),'type':a130_0x5f4988(0xc6),'description':'Type\x20filter','hidden':!![]},{'name':'file','meowKey':a130_0x5f4988(0x76),'type':a130_0x5f4988(0xc6),'description':a130_0x5f4988(0xae),'hidden':!![]},{'name':a130_0x5f4988(0xa1),'meowKey':a130_0x5f4988(0xa1),'type':'string','description':'SQL\x20code','hidden':!![]},{'name':a130_0x5f4988(0x99),'meowKey':a130_0x5f4988(0xbe),'type':'string','description':a130_0x5f4988(0xaf),'hidden':!![]},{'name':'sqlname','meowKey':a130_0x5f4988(0xc5),'type':a130_0x5f4988(0xc6),'description':a130_0x5f4988(0xaf),'hidden':!![]},{'name':a130_0x5f4988(0xb7),'meowKey':a130_0x5f4988(0xb3),'type':'string','description':a130_0x5f4988(0xac),'hidden':!![]},{'name':a130_0x5f4988(0x83),'meowKey':a130_0x5f4988(0x83),'type':a130_0x5f4988(0xc6),'description':'DB\x20ID','hidden':!![]},{'name':a130_0x5f4988(0x91),'meowKey':a130_0x5f4988(0x91),'type':'string','description':a130_0x5f4988(0xc1),'hidden':!![]},{'name':a130_0x5f4988(0x8f),'meowKey':a130_0x5f4988(0xdb),'type':'string','description':a130_0x5f4988(0xdc),'hidden':!![]},{'name':a130_0x5f4988(0xbd),'meowKey':a130_0x5f4988(0xbd),'type':a130_0x5f4988(0xc6),'description':a130_0x5f4988(0xd5),'hidden':!![]},{'name':a130_0x5f4988(0xaa),'meowKey':a130_0x5f4988(0xaa),'type':'string','description':'Page\x20size','hidden':!![]},{'name':'keyword','meowKey':a130_0x5f4988(0xa7),'type':'string','description':a130_0x5f4988(0xd4),'hidden':!![]},{'name':a130_0x5f4988(0x7a),'meowKey':a130_0x5f4988(0x7a),'type':a130_0x5f4988(0xc6),'description':a130_0x5f4988(0x89),'hidden':!![]},{'name':a130_0x5f4988(0x7d),'meowKey':a130_0x5f4988(0x7d),'type':'string','description':a130_0x5f4988(0x9b),'hidden':!![]},{'name':a130_0x5f4988(0x87),'meowKey':'schemas','type':'string','description':'Schemas','hidden':!![]},{'name':'operation','meowKey':a130_0x5f4988(0xce),'type':a130_0x5f4988(0xc6),'description':'Operation\x20type','hidden':!![]},{'name':a130_0x5f4988(0x71),'meowKey':a130_0x5f4988(0x71),'type':a130_0x5f4988(0xc6),'description':a130_0x5f4988(0xb5),'hidden':!![]},{'name':a130_0x5f4988(0xd8),'meowKey':a130_0x5f4988(0xd0),'type':'boolean','description':'Skip\x20import\x20generation','hidden':!![]},{'name':a130_0x5f4988(0x97),'meowKey':'key','type':a130_0x5f4988(0xc6),'description':a130_0x5f4988(0xd9),'hidden':!![]},{'name':a130_0x5f4988(0xb8),'meowKey':'value','type':a130_0x5f4988(0xc6),'description':a130_0x5f4988(0x7e),'hidden':!![]},{'name':'force','meowKey':a130_0x5f4988(0xb4),'type':a130_0x5f4988(0x85),'description':'Force\x20overwrite','hidden':!![]},{'name':a130_0x5f4988(0xb6),'meowKey':a130_0x5f4988(0xb6),'type':a130_0x5f4988(0x85),'description':a130_0x5f4988(0x9d),'hidden':!![]},{'name':a130_0x5f4988(0x78),'meowKey':a130_0x5f4988(0x78),'type':a130_0x5f4988(0x85),'description':a130_0x5f4988(0xde),'hidden':!![]},{'name':a130_0x5f4988(0x74),'meowKey':a130_0x5f4988(0x74),'type':'boolean','description':a130_0x5f4988(0xbf),'hidden':!![]},{'name':a130_0x5f4988(0xbb),'meowKey':a130_0x5f4988(0x7f),'type':a130_0x5f4988(0xc6),'description':a130_0x5f4988(0xd3),'hidden':!![]},{'name':a130_0x5f4988(0x98),'meowKey':a130_0x5f4988(0x9f),'type':a130_0x5f4988(0xc6),'description':'Operation\x20type','hidden':!![]},{'name':'function-node','meowKey':a130_0x5f4988(0x84),'type':a130_0x5f4988(0xc6),'description':'Function\x20node','hidden':!![]}];export const PIPELINE_FLAG_NAMES=new Set([a130_0x5f4988(0x80),'app',a130_0x5f4988(0x79),'format','jq',a130_0x5f4988(0x8b),a130_0x5f4988(0xc3),a130_0x5f4988(0xc2),'ci']);function a130_0x4cac(){const _0x37bd83=['<code>','Expected\x20affected\x20count','Keyword\x20filter','Page\x20number','Environment','60LIGpwp','skip-imports','Config\x20key','type','descriptionFile','Description\x20file','Force\x20non-interactive\x20mode\x20(CI)','Use\x20remote','production\x20|\x20daily','Enable\x20BFF\x20save','target','project','Skip\x20confirmation\x20for\x20high-risk\x20writes','verbose','help','file','app','remote','env','code','3428645eblaom','Use\x20project\x20config\x20scope','sql','Config\x20value','expectedCount','appcode','Title','title','dbid','functionNode','boolean','Watch\x20mode','schemas','JSON\x20params','Code\x20filter','watch','dry-run','Override\x20appcode','Rabetbase\x20CLI','Alias\x20for\x20--non-interactive','description-file','enable-bff-save','description','5148619XtsqlK','Use\x20global\x20config\x20scope','clear','184847wYrvrL','936582tynTQQ','key','operation-type','sql-name','Record\x20ID','SQL\x20string','name','Confirm\x20destructive\x20action','26270YOgLIp','operationType','output','sqlcode','57dVKqzz','82642IEgCja','params','35wrjRpg','Preview\x20operation\x20without\x20executing','keyword','Filter\x20JSON\x20output\x20(JQ_PATH\x20>\x20bundled\x20jq\x20>\x20PATH;\x20use\x20with\x20--format\x20json\x20or\x20compress)','datasetcode','pagesize','8kpfqlP','DB\x20ID','Output\x20format','File\x20path','SQL\x20name','Clear','Apply\x20to\x20all','meowKey','dbId','force','Target\x20path','confirm','db-id','value','Show\x20help','<expr>','expected-count','4129252vPvQOe','page','sqlName','Verbose\x20output','Dataset\x20code','Description','non-interactive','yes','all','sqlname','string','enableBffSave','@lovrabet/rabetbase-cli','666KmxqFv','global','json\x20|\x20pretty\x20|\x20compress','fromEntries','<name>','operation','Name','skipImports','format'];a130_0x4cac=function(){return _0x37bd83;};return a130_0x4cac();}export function buildMeowFlags(){const _0x178c7e=a130_0x5f4988;return Object[_0x178c7e(0xcc)](GLOBAL_FLAGS['map'](_0x24fd03=>[_0x24fd03[_0x178c7e(0xb2)],{'type':_0x24fd03['type']}]));}
|
package/lib/constant/defaults.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a131_0x17e5(_0x19f331,_0x53ba57){_0x19f331=_0x19f331-0x1a1;const _0x1443d8=a131_0x1443();let _0x17e5b2=_0x1443d8[_0x19f331];return _0x17e5b2;}function a131_0x1443(){const _0x382744=['compress','9FLpfbB','high-risk-write','9HSRvbv','7163988NTEYKa','367480fqxZMF','13802446LZxiwE','5714415aQthHm','347994Yaonsd','production','25289192UYrutY','3697137hTsshV','en-US'];a131_0x1443=function(){return _0x382744;};return a131_0x1443();}const a131_0x4b331e=a131_0x17e5;(function(_0x3e34b1,_0x254121){const _0x103b99=a131_0x17e5,_0x5ed9f5=_0x3e34b1();while(!![]){try{const _0x54855f=parseInt(_0x103b99(0x1a8))/0x1*(-parseInt(_0x103b99(0x1a2))/0x2)+parseInt(_0x103b99(0x1a5))/0x3+parseInt(_0x103b99(0x1ac))/0x4+-parseInt(_0x103b99(0x1a1))/0x5+parseInt(_0x103b99(0x1ab))/0x6+-parseInt(_0x103b99(0x1ad))/0x7+parseInt(_0x103b99(0x1a4))/0x8*(parseInt(_0x103b99(0x1aa))/0x9);if(_0x54855f===_0x254121)break;else _0x5ed9f5['push'](_0x5ed9f5['shift']());}catch(_0x3a325f){_0x5ed9f5['push'](_0x5ed9f5['shift']());}}}(a131_0x1443,0xf3d6a));import{DEFAULT_API_DIR}from'../constant/paths.js';export const DEFAULT_CONFIG_VALUES={'env':a131_0x4b331e(0x1a3),'format':a131_0x4b331e(0x1a7),'locale':a131_0x4b331e(0x1a6),'riskLevel':a131_0x4b331e(0x1a9),'apiDir':DEFAULT_API_DIR};export const DEFAULT_COMMAND_OUTPUT_FORMAT=a131_0x4b331e(0x1a7);
|
package/lib/constant/domain.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a132_0x300e(_0x348145,_0x5bfdf9){_0x348145=_0x348145-0x7a;const _0x20ba9e=a132_0x20ba();let _0x300e64=_0x20ba9e[_0x348145];return _0x300e64;}const a132_0x27688a=a132_0x300e;(function(_0xe52537,_0x32e77b){const _0x402907=a132_0x300e,_0x204487=_0xe52537();while(!![]){try{const _0x44db86=-parseInt(_0x402907(0x7c))/0x1*(parseInt(_0x402907(0x83))/0x2)+parseInt(_0x402907(0x8a))/0x3+-parseInt(_0x402907(0x84))/0x4+-parseInt(_0x402907(0x88))/0x5+parseInt(_0x402907(0x89))/0x6+-parseInt(_0x402907(0x7d))/0x7*(parseInt(_0x402907(0x7e))/0x8)+parseInt(_0x402907(0x7a))/0x9*(parseInt(_0x402907(0x85))/0xa);if(_0x44db86===_0x32e77b)break;else _0x204487['push'](_0x204487['shift']());}catch(_0x3482da){_0x204487['push'](_0x204487['shift']());}}}(a132_0x20ba,0x25575));function a132_0x20ba(){const _0x42a186=['https://runtime.lovrabet.com','285215TnSDRw','1649760ZBVqXR','519615uvCpSc','https://user-daily.lovrabet.com','25623UCrISz','userDomain','2636vZlzaD','1582ggYjsh','2896LPzUtV','https://daily-runtime.lovrabet.com','apiDomain','https://daily-api.lovrabet.com','https://user.lovrabet.com','26iihXbH','590864pXcGQS','90ZwEIxk','runtimeDomain'];a132_0x20ba=function(){return _0x42a186;};return a132_0x20ba();}import{getEnv,isProduction}from'../constant/env.js';let customApiDomain,customUserDomain,customRuntimeDomain;export function initDomains(_0x5c28a9){const _0x56b748=a132_0x300e;customApiDomain=_0x5c28a9?.[_0x56b748(0x80)],customUserDomain=_0x5c28a9?.[_0x56b748(0x7b)],customRuntimeDomain=_0x5c28a9?.[_0x56b748(0x86)];}export const getUserDomain=()=>customUserDomain||(isProduction(getEnv())?a132_0x27688a(0x82):a132_0x27688a(0x8b));export const getApiDomain=()=>customApiDomain||(isProduction(getEnv())?'https://api.lovrabet.com':a132_0x27688a(0x81));export const getRuntimeDomain=()=>customRuntimeDomain||(isProduction(getEnv())?a132_0x27688a(0x87):a132_0x27688a(0x7f));
|
package/lib/constant/env.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a133_0x5c19(){const _0x3c0437=['24YXUSSi','2834272AWSnFt','10148hHhyss','development','22KzguGk','1047140AykAgm','186EdNvAa','682948mrcCru','daily','production','30CJdhOq','611288Lqtrgs','5154471YUvRLR','268635DFOMns','dev'];a133_0x5c19=function(){return _0x3c0437;};return a133_0x5c19();}const a133_0x594712=a133_0x268d;(function(_0x55cb2b,_0x4b5d0f){const _0x27078f=a133_0x268d,_0xc9ca25=_0x55cb2b();while(!![]){try{const _0xfc8272=-parseInt(_0x27078f(0x10f))/0x1+parseInt(_0x27078f(0x106))/0x2*(-parseInt(_0x27078f(0x10a))/0x3)+parseInt(_0x27078f(0x113))/0x4*(parseInt(_0x27078f(0x111))/0x5)+parseInt(_0x27078f(0x10e))/0x6*(parseInt(_0x27078f(0x10b))/0x7)+-parseInt(_0x27078f(0x105))/0x8+parseInt(_0x27078f(0x110))/0x9+parseInt(_0x27078f(0x109))/0xa*(parseInt(_0x27078f(0x108))/0xb);if(_0xfc8272===_0x4b5d0f)break;else _0xc9ca25['push'](_0xc9ca25['shift']());}catch(_0x41bf08){_0xc9ca25['push'](_0xc9ca25['shift']());}}}(a133_0x5c19,0x4c369));export const RABETBASE_ENV_VALUES=['production',a133_0x594712(0x10c)];export function normalizeEnv(_0x1035dd){return _0x1035dd==='online'?'production':_0x1035dd;}function a133_0x268d(_0x13943c,_0x3e338b){_0x13943c=_0x13943c-0x105;const _0x5c19c7=a133_0x5c19();let _0x268dc4=_0x5c19c7[_0x13943c];return _0x268dc4;}export function isProduction(_0x597ab4){const _0x21b3a0=a133_0x594712;return normalizeEnv(_0x597ab4)===_0x21b3a0(0x10d);}export function isDaily(_0x4219e1){const _0x55af5b=a133_0x594712;return normalizeEnv(_0x4219e1)===_0x55af5b(0x10c);}export function isDev(_0x458bef){const _0xff9007=a133_0x594712,_0x28c428=normalizeEnv(_0x458bef);return _0x28c428===_0xff9007(0x107)||_0x28c428===_0xff9007(0x112);}let env=normalizeEnv(process.env.RABETBASE_ENV||process.env.LOVRABET_ENV||a133_0x594712(0x10d));export function getEnv(){return env;}export function initEnv(_0x2c927b){env=normalizeEnv(_0x2c927b);}
|
package/lib/constant/output.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a134_0x3ff1(_0x59752d,_0x3ad76c){_0x59752d=_0x59752d-0x18c;const _0x3337cf=a134_0x3337();let _0x3ff12a=_0x3337cf[_0x59752d];return _0x3ff12a;}const a134_0x5ef67c=a134_0x3ff1;(function(_0x1a45c7,_0x2a3d2f){const _0x10e726=a134_0x3ff1,_0x162b5b=_0x1a45c7();while(!![]){try{const _0x676269=-parseInt(_0x10e726(0x191))/0x1+-parseInt(_0x10e726(0x192))/0x2+-parseInt(_0x10e726(0x194))/0x3*(parseInt(_0x10e726(0x18d))/0x4)+-parseInt(_0x10e726(0x18c))/0x5+-parseInt(_0x10e726(0x190))/0x6*(parseInt(_0x10e726(0x18f))/0x7)+parseInt(_0x10e726(0x18e))/0x8+parseInt(_0x10e726(0x196))/0x9;if(_0x676269===_0x2a3d2f)break;else _0x162b5b['push'](_0x162b5b['shift']());}catch(_0x405e18){_0x162b5b['push'](_0x162b5b['shift']());}}}(a134_0x3337,0x425f4));export const RABETBASE_OUTPUT_FORMAT_VALUES=[a134_0x5ef67c(0x193),'pretty',a134_0x5ef67c(0x195)];function a134_0x3337(){const _0x20aea9=['3658400sXhANj','7mCoRGe','2481786fdVhCL','763QBDoiv','486442RRYcfA','json','117bDuZFA','compress','9225585pGcEmn','980005PiZhCw','36604WFTEzQ'];a134_0x3337=function(){return _0x20aea9;};return a134_0x3337();}
|
package/lib/constant/paths.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a135_0x1b60(){const _0x50cc15=['254424pgQGfn','4lUxZkz','296778vRhxmw','8604GxVkGv','159677YRyBgR','102kXbYVl','19900dzYRTp','537480iOeHIj','105005SFgTPp','2456qoXDRb','4543ljtdGK'];a135_0x1b60=function(){return _0x50cc15;};return a135_0x1b60();}(function(_0x195b79,_0x3c6425){const _0x227084=a135_0x2090,_0x51467d=_0x195b79();while(!![]){try{const _0xc6d1f9=-parseInt(_0x227084(0x167))/0x1+-parseInt(_0x227084(0x16c))/0x2+parseInt(_0x227084(0x170))/0x3+-parseInt(_0x227084(0x166))/0x4*(parseInt(_0x227084(0x16d))/0x5)+parseInt(_0x227084(0x16a))/0x6*(-parseInt(_0x227084(0x169))/0x7)+parseInt(_0x227084(0x16e))/0x8*(parseInt(_0x227084(0x168))/0x9)+parseInt(_0x227084(0x16b))/0xa*(parseInt(_0x227084(0x16f))/0xb);if(_0xc6d1f9===_0x3c6425)break;else _0x51467d['push'](_0x51467d['shift']());}catch(_0x3ac55d){_0x51467d['push'](_0x51467d['shift']());}}}(a135_0x1b60,0x37248));function a135_0x2090(_0xed0073,_0x4197c9){_0xed0073=_0xed0073-0x166;const _0x1b60fc=a135_0x1b60();let _0x2090fb=_0x1b60fc[_0xed0073];return _0x2090fb;}export const DEFAULT_API_DIR='./src/api';
|
package/lib/constant/risk.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a136_0x48bc(){const _0x47b45e=['1823136hlVYgX','write','high-risk-write','60248TgUJsI','1839768CHgaWa','459HXWFEb','139068PnTlpZ','2084592KdkbGj','12RIcIDZ','224283XIvknf','1393855pxBCnZ'];a136_0x48bc=function(){return _0x47b45e;};return a136_0x48bc();}const a136_0x1fa6d3=a136_0x4e22;(function(_0x18d74b,_0x3eb7df){const _0x50e44b=a136_0x4e22,_0x2e25dc=_0x18d74b();while(!![]){try{const _0x25d26d=-parseInt(_0x50e44b(0x1de))/0x1+-parseInt(_0x50e44b(0x1e0))/0x2*(-parseInt(_0x50e44b(0x1e1))/0x3)+parseInt(_0x50e44b(0x1e3))/0x4+-parseInt(_0x50e44b(0x1e2))/0x5+-parseInt(_0x50e44b(0x1df))/0x6+-parseInt(_0x50e44b(0x1dc))/0x7+parseInt(_0x50e44b(0x1e6))/0x8*(parseInt(_0x50e44b(0x1dd))/0x9);if(_0x25d26d===_0x3eb7df)break;else _0x2e25dc['push'](_0x2e25dc['shift']());}catch(_0x1e2b43){_0x2e25dc['push'](_0x2e25dc['shift']());}}}(a136_0x48bc,0x3f8f0));function a136_0x4e22(_0x267eca,_0x191798){_0x267eca=_0x267eca-0x1dc;const _0x48bcb4=a136_0x48bc();let _0x4e2224=_0x48bcb4[_0x267eca];return _0x4e2224;}export const RISK_LEVEL_VALUES=['read',a136_0x1fa6d3(0x1e4),a136_0x1fa6d3(0x1e5)];
|