@lovrabet/rabetbase-cli 2.3.3-beta.2 → 2.3.3-beta.4
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/app-config/delete.js +1 -1
- package/lib/commands/app-config/get.js +1 -1
- package/lib/commands/app-config/index.js +1 -1
- package/lib/commands/app-config/list.js +1 -1
- package/lib/commands/app-config/set.js +1 -1
- package/lib/commands/app-config/shared.js +1 -1
- package/lib/commands/auth/index.js +1 -1
- package/lib/commands/bff/create.js +1 -1
- package/lib/commands/bff/delete.js +1 -1
- package/lib/commands/bff/detail.js +1 -1
- package/lib/commands/bff/index.js +1 -1
- package/lib/commands/bff/list.js +1 -1
- package/lib/commands/bff/pull.js +1 -1
- package/lib/commands/bff/push.js +1 -1
- package/lib/commands/bff/status.js +1 -1
- package/lib/commands/cli-skill/index.js +1 -1
- package/lib/commands/cli-update.js +1 -1
- package/lib/commands/codegen/index.js +1 -1
- package/lib/commands/codegen/sdk.js +1 -1
- package/lib/commands/codegen/sql.js +1 -1
- package/lib/commands/common/app-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/business-group-update.js +1 -1
- package/lib/commands/dataset/capability.js +1 -1
- package/lib/commands/dataset/delete.js +1 -1
- package/lib/commands/dataset/detail.js +1 -1
- package/lib/commands/dataset/extend-update.js +1 -1
- package/lib/commands/dataset/field-update.js +1 -1
- package/lib/commands/dataset/generate.js +1 -1
- package/lib/commands/dataset/index.js +1 -1
- package/lib/commands/dataset/list.js +1 -1
- package/lib/commands/dataset/operations.js +1 -1
- package/lib/commands/dataset/relation-audit.js +1 -1
- package/lib/commands/dataset/relation-create.js +1 -1
- package/lib/commands/dataset/relation-delete.js +1 -1
- package/lib/commands/dataset/relation-shared.js +1 -1
- package/lib/commands/dataset/relation-update.js +1 -1
- package/lib/commands/dataset/relations.js +1 -1
- package/lib/commands/dataset/rename.js +1 -1
- package/lib/commands/dataset/restore.js +1 -1
- package/lib/commands/db/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/nudge.js +1 -1
- package/lib/commands/issue/report.js +1 -1
- package/lib/commands/issue/shared.js +1 -1
- package/lib/commands/logs/index.js +1 -1
- package/lib/commands/menu/index.js +1 -1
- package/lib/commands/menu/list.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/relation-audit.js +1 -1
- package/lib/commands/page/shared.js +1 -1
- package/lib/commands/page/standard-page-status.js +1 -1
- package/lib/commands/page/sync.js +1 -1
- package/lib/commands/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/sql/create.js +1 -1
- package/lib/commands/sql/delete.js +1 -1
- package/lib/commands/sql/detail.js +1 -1
- package/lib/commands/sql/exec.js +1 -1
- package/lib/commands/sql/index.js +1 -1
- package/lib/commands/sql/list.js +1 -1
- package/lib/commands/sql/pull.js +1 -1
- package/lib/commands/sql/push.js +1 -1
- package/lib/commands/sql/save.js +1 -1
- package/lib/commands/sql/shared.js +1 -1
- package/lib/commands/sql/status.js +1 -1
- package/lib/commands/sql/validate.js +1 -1
- package/lib/commands/workspace/index.js +1 -1
- package/lib/config/schema.js +1 -1
- package/lib/constant/cdn.js +1 -1
- package/lib/constant/cli.js +1 -1
- package/lib/constant/defaults.js +1 -1
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/constant/output.js +1 -1
- package/lib/constant/paths.js +1 -1
- package/lib/constant/risk.js +1 -1
- package/lib/context/app-resolver.js +1 -1
- package/lib/context/auth-resolver.js +1 -1
- package/lib/context/config-loader.js +1 -1
- package/lib/context.js +1 -1
- package/lib/core/alias-resolver.js +1 -1
- package/lib/core/api-client.js +1 -1
- package/lib/core/bff/config.js +1 -1
- package/lib/core/bff/file-system.js +1 -1
- package/lib/core/bff/hash.js +1 -1
- package/lib/core/bff/lock.js +1 -1
- package/lib/core/bff/utils.js +1 -1
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/page/file-system.js +1 -1
- package/lib/core/page/hash.js +1 -1
- package/lib/core/page/lock.js +1 -1
- package/lib/core/sql-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/update-notice.js +1 -1
- package/lib/utils/version.js +1 -1
- package/lib/utils/with-active-cookie.js +1 -1
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +1 -1
package/lib/commands/sql/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a138_0x7842a5=a138_0x31e0;(function(_0x154507,_0x1a6fe2){const _0x413df0=a138_0x31e0,_0x176d0e=_0x154507();while(!![]){try{const _0xaaf62d=-parseInt(_0x413df0(0x13a))/0x1*(parseInt(_0x413df0(0x15a))/0x2)+parseInt(_0x413df0(0x161))/0x3*(-parseInt(_0x413df0(0x16b))/0x4)+parseInt(_0x413df0(0x15c))/0x5*(parseInt(_0x413df0(0x164))/0x6)+-parseInt(_0x413df0(0x13f))/0x7*(parseInt(_0x413df0(0x152))/0x8)+parseInt(_0x413df0(0x156))/0x9*(-parseInt(_0x413df0(0x148))/0xa)+parseInt(_0x413df0(0x133))/0xb*(-parseInt(_0x413df0(0x142))/0xc)+parseInt(_0x413df0(0x147))/0xd;if(_0xaaf62d===_0x1a6fe2)break;else _0x176d0e['push'](_0x176d0e['shift']());}catch(_0xb82244){_0x176d0e['push'](_0x176d0e['shift']());}}}(a138_0x1ef4,0x7a81d));import{readFile,rm,writeFile}from'node:fs/promises';function a138_0x1ef4(){const _0x12b565=['str','filter','27ETfHUp','lockFilePath','length','appCode','3372PHDHtZ','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','323005uyWCYD','POST','path','lastSync','\x20written,\x20','3TFQGBx','trimStart','skipped','12iRsREv','nonInteractive','catch','mybatisXml','sql','sqlRootDir','pull','1756796huFpBc','string','unchanged','description','utf8','\x20skipped,\x20','\x20failed','name','11FEuVbG','sqlContent','sqlName','sqlCode','would_pull','bool','toISOString','311VViPMs','push','apps','tableData','sqlRoot','7pVTKGo','test','sqls','8807388RuZIzT','split','message','replace','join','32493773WWISBy','98510rEXdJV','boolean','dbId','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','Filter\x20by\x20SQL\x20display\x20name','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','conflict','Would\x20pull\x20','sqlcode','3199096Tazxfq','totalCount'];a138_0x1ef4=function(){return _0x12b565;};return a138_0x1ef4();}import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';function a138_0x31e0(_0x1c5327,_0x54e104){_0x1c5327=_0x1c5327-0x130;const _0x1ef40b=a138_0x1ef4();let _0x31e0ee=_0x1ef40b[_0x1c5327];return _0x31e0ee;}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(_0x326db2,_0x822064){const _0xfc1e=a138_0x31e0,_0x500b24=[];let _0x8b561e=0x1;while(!![]){const _0x20f1ae=await listSqlQueries(_0x326db2,{'currentPage':_0x8b561e,'pageSize':PAGE_SIZE,'sqlCode':_0x822064['sqlCode'],'sqlName':_0x822064[_0xfc1e(0x135)]}),_0x56e75a=_0x20f1ae[_0xfc1e(0x13d)]??[];_0x500b24['push'](..._0x56e75a);if(_0x56e75a[_0xfc1e(0x158)]===0x0)break;const _0x45d0c9=_0x20f1ae['paging']?.[_0xfc1e(0x153)];if(_0x45d0c9!=null?_0x500b24['length']>=_0x45d0c9:_0x56e75a['length']<PAGE_SIZE)break;_0x8b561e++;}return _0x500b24;}async function ensureSqlContent(_0x5725c0){const _0x43cc00=a138_0x31e0;if(_0x5725c0[_0x43cc00(0x134)]!=null&&String(_0x5725c0[_0x43cc00(0x134)])[_0x43cc00(0x158)]>0x0)return _0x5725c0;return getSqlQueryDetail(_0x5725c0[_0x43cc00(0x136)]);}export const sqlPull={'service':a138_0x7842a5(0x168),'command':a138_0x7842a5(0x16a),'description':a138_0x7842a5(0x14e),'risk':'write','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a138_0x7842a5(0x132),'type':a138_0x7842a5(0x16c),'description':a138_0x7842a5(0x14d)},{'name':'force','type':a138_0x7842a5(0x149),'description':'Force\x20overwrite\x20local\x20unsynced\x20changes'}],async 'dryRun'(_0x5a4bad){const _0xed53c0=a138_0x7842a5,_0x5f5de9=loadSqlProjectConfig(_0x5a4bad[_0xed53c0(0x159)]),_0x34d178=await readSqlLockFile(_0x5f5de9[_0xed53c0(0x157)]),{appLock:_0x37d608}=ensureSqlLockScope(_0x34d178??createEmptySqlLock(),_0x5f5de9[_0xed53c0(0x159)],_0x5f5de9[_0xed53c0(0x13e)],_0xed53c0(0x16a)),_0x12585a=await fetchAllSqlQueries(_0x5a4bad[_0xed53c0(0x159)],{'sqlCode':_0x5a4bad[_0xed53c0(0x154)]('sqlcode')||undefined,'sqlName':_0x5a4bad[_0xed53c0(0x154)](_0xed53c0(0x132))||undefined}),_0x358dd5=[];for(const _0x40ecf3 of _0x12585a){const _0x490880=await ensureSqlContent(_0x40ecf3),_0x513b56=ensureRemoteSqlContent(_0x490880),_0x24a10c=detectModeFromSql(_0x490880),_0x3ae0fc=_0x490880['dbId']?await getDbName(_0x5a4bad[_0xed53c0(0x159)],Number(_0x490880[_0xed53c0(0x14a)]))[_0xed53c0(0x166)](()=>undefined):undefined,_0x234714=buildLocalSqlFileContent({'sqlCode':_0x490880[_0xed53c0(0x136)],'sqlName':_0x490880['sqlName'],'dbId':_0x490880[_0xed53c0(0x14a)]},_0x513b56,{'dbName':_0x3ae0fc,'mode':_0x24a10c,'syncedAt':new Date()[_0xed53c0(0x139)](),'description':_0x490880[_0xed53c0(0x16e)]}),_0x34ccbf=buildSqlLockEntry(_0x490880,_0x513b56,'',{'dbName':_0x3ae0fc}),_0x33b0f8=resolveLocalSqlFilePath(_0x5f5de9,_0x490880['sqlCode'],_0x34ccbf);let _0x2a0cb6=_0xed53c0(0x137),_0x413cbf;if(await fileExists(_0x33b0f8)){const _0x1504f4=await readFile(_0x33b0f8,_0xed53c0(0x16f));isEquivalentPulledSqlFile(_0x1504f4,_0x234714,_0x24a10c)?(_0x2a0cb6=_0xed53c0(0x163),_0x413cbf='unchanged'):(_0x2a0cb6=_0xed53c0(0x14f),_0x413cbf=_0xed53c0(0x15b));}_0x358dd5[_0xed53c0(0x13b)]({'sqlCode':_0x490880[_0xed53c0(0x136)],'sqlName':_0x490880[_0xed53c0(0x135)],'filePath':_0x33b0f8,'status':_0x2a0cb6,'reason':_0x413cbf});}return{'method':_0xed53c0(0x15d),'url':_0xed53c0(0x14b),'body':{'appCode':_0x5a4bad[_0xed53c0(0x159)],'sqlCode':_0x5a4bad['str'](_0xed53c0(0x151))||null,'sqlName':_0x5a4bad[_0xed53c0(0x154)]('name')||null,'files':_0x358dd5},'description':_0xed53c0(0x150)+_0x358dd5[_0xed53c0(0x158)]+'\x20SQL\x20file(s)\x20into\x20'+_0x5f5de9[_0xed53c0(0x169)]};},async 'execute'(_0x3a1cec){const _0x2185d7=a138_0x7842a5,_0x418f07=loadSqlProjectConfig(_0x3a1cec['appCode']),_0x267b04=await readSqlLockFile(_0x418f07[_0x2185d7(0x157)]),{lockData:_0x5f09c4,appLock:_0x846f04}=ensureSqlLockScope(_0x267b04??createEmptySqlLock(),_0x418f07[_0x2185d7(0x159)],_0x418f07['sqlRoot'],'pull'),_0x4582a8=_0x3a1cec[_0x2185d7(0x138)]('force'),_0x12c272=await fetchAllSqlQueries(_0x3a1cec[_0x2185d7(0x159)],{'sqlCode':_0x3a1cec['str'](_0x2185d7(0x151))||undefined,'sqlName':_0x3a1cec[_0x2185d7(0x154)](_0x2185d7(0x132))||undefined});if(_0x12c272[_0x2185d7(0x158)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':'No\x20remote\x20SQL\x20queries\x20matched.'};const _0x504eab=[],_0x43ddf1=[];for(const _0x24180d of _0x12c272){try{_0x504eab[_0x2185d7(0x13b)](await ensureSqlContent(_0x24180d));}catch(_0x1e5ce2){_0x43ddf1[_0x2185d7(0x13b)]({'sqlCode':_0x24180d['sqlCode'],'error':_0x1e5ce2 instanceof Error?_0x1e5ce2[_0x2185d7(0x144)]:String(_0x1e5ce2)});}}if(_0x4582a8&&!_0x3a1cec[_0x2185d7(0x165)]){let _0x416324=![];for(const _0x16c78b of _0x504eab){const _0x244232=detectModeFromSql(_0x16c78b),_0x299473=_0x16c78b['dbId']?await getDbName(_0x3a1cec[_0x2185d7(0x159)],Number(_0x16c78b[_0x2185d7(0x14a)]))['catch'](()=>undefined):undefined,_0x1e8991=buildLocalSqlFileContent({'sqlCode':_0x16c78b[_0x2185d7(0x136)],'sqlName':_0x16c78b[_0x2185d7(0x135)],'dbId':_0x16c78b[_0x2185d7(0x14a)]},ensureRemoteSqlContent(_0x16c78b),{'dbName':_0x299473,'mode':_0x244232,'syncedAt':new Date()[_0x2185d7(0x139)](),'description':_0x16c78b[_0x2185d7(0x16e)]}),_0x173c67=resolveLocalSqlFilePath(_0x418f07,_0x16c78b['sqlCode'],buildSqlLockEntry(_0x16c78b,ensureRemoteSqlContent(_0x16c78b),'',{'dbName':_0x299473}));if(await fileExists(_0x173c67)){const _0x4fbcb4=await readFile(_0x173c67,_0x2185d7(0x16f));if(!isEquivalentPulledSqlFile(_0x4fbcb4,_0x1e8991,_0x244232)){_0x416324=!![];break;}}}if(_0x416324){const _0x1d2d14=await confirmForceOverwrite(_0x2185d7(0x14c));if(!_0x1d2d14)throw CliErrors['cancelled']('Force\x20pull\x20cancelled.');}}const _0x27c8ad=cloneSqlLockData(_0x5f09c4),_0x5779dd=_0x27c8ad[_0x2185d7(0x13c)][_0x418f07['appCode']],_0x5d2909=[],_0x207d86=[];for(const _0x534270 of _0x504eab){const _0x1ce7b3=_0x5779dd[_0x2185d7(0x141)][_0x534270['sqlCode']],_0x896184=ensureRemoteSqlContent(_0x534270),_0x44a924=detectModeFromSql(_0x534270),_0x21d06a=_0x534270[_0x2185d7(0x14a)]?await getDbName(_0x3a1cec[_0x2185d7(0x159)],Number(_0x534270[_0x2185d7(0x14a)]))[_0x2185d7(0x166)](()=>undefined):undefined,_0x828fb1=buildLocalSqlFileContent({'sqlCode':_0x534270[_0x2185d7(0x136)],'sqlName':_0x534270[_0x2185d7(0x135)],'dbId':_0x534270[_0x2185d7(0x14a)]},_0x896184,{'dbName':_0x21d06a,'mode':_0x44a924,'syncedAt':new Date()[_0x2185d7(0x139)](),'description':_0x534270['description']}),_0x5d399d=buildSqlLockEntry(_0x534270,_0x896184,computeSqlContentHash(_0x828fb1),{'dbName':_0x21d06a}),_0x29835f=_0x5d399d[_0x2185d7(0x15e)],_0x2cb622=join(_0x418f07[_0x2185d7(0x169)],_0x29835f);try{if(await fileExists(_0x2cb622)){const _0xfed4b1=await readFile(_0x2cb622,_0x2185d7(0x16f));if(isEquivalentPulledSqlFile(_0xfed4b1,_0x828fb1,_0x44a924)){_0x207d86['push']({'sqlCode':_0x534270['sqlCode'],'reason':_0x2185d7(0x16d)}),_0x5779dd[_0x2185d7(0x141)][_0x534270['sqlCode']]={..._0x5d399d,'hash':computeSqlContentHash(_0xfed4b1),'path':_0x29835f};continue;}if(!_0x4582a8){_0x207d86[_0x2185d7(0x13b)]({'sqlCode':_0x534270[_0x2185d7(0x136)],'reason':'local\x20differs\x20from\x20remote'});continue;}}const _0x560204=_0x1ce7b3?.[_0x2185d7(0x15e)]?join(_0x418f07[_0x2185d7(0x169)],_0x1ce7b3[_0x2185d7(0x15e)]):undefined;_0x560204&&_0x560204!==_0x2cb622&&await fileExists(_0x560204)&&await rm(_0x560204,{'force':!![]}),await ensureParentDirectory(_0x2cb622),await writeFile(_0x2cb622,_0x828fb1,_0x2185d7(0x16f)),_0x5779dd[_0x2185d7(0x141)][_0x534270[_0x2185d7(0x136)]]={..._0x5d399d,'path':_0x29835f},_0x5d2909[_0x2185d7(0x13b)]({'sqlCode':_0x534270['sqlCode'],'filePath':_0x2cb622});}catch(_0x55aac9){_0x43ddf1[_0x2185d7(0x13b)]({'sqlCode':_0x534270[_0x2185d7(0x136)],'error':_0x55aac9 instanceof Error?_0x55aac9['message']:String(_0x55aac9)});}}return _0x5779dd[_0x2185d7(0x15f)]=new Date()[_0x2185d7(0x139)](),await writeSqlLockFile(_0x418f07[_0x2185d7(0x157)],_0x27c8ad),{'ok':_0x43ddf1[_0x2185d7(0x158)]===0x0,'data':{'pulled':_0x5d2909,'skipped':_0x207d86,'failed':_0x43ddf1},'message':'Pull\x20complete:\x20'+_0x5d2909['length']+_0x2185d7(0x160)+_0x207d86[_0x2185d7(0x158)]+_0x2185d7(0x130)+_0x43ddf1['length']+_0x2185d7(0x131)};}};function detectModeFromSql(_0x152ddc){const _0x5b06b1=a138_0x7842a5,_0x518355=ensureRemoteSqlContent(_0x152ddc),_0x4bd524=stripLocalSqlMetadata(_0x518355,'mybatisXml')[_0x5b06b1(0x162)]();if(/^<(select|insert|update|delete)\b/i['test'](_0x4bd524))return'mybatisXml';return _0x5b06b1(0x168);}function isEquivalentPulledSqlFile(_0x270024,_0x8a49a0,_0x188b43){return normalizePullComparableContent(_0x270024,_0x188b43)===normalizePullComparableContent(_0x8a49a0,_0x188b43);}function normalizePullComparableContent(_0x399ed0,_0x4d5618){const _0x16d67d=a138_0x7842a5,_0x3428af=_0x399ed0[_0x16d67d(0x145)](/\r\n/g,'\x0a')[_0x16d67d(0x143)]('\x0a'),_0x59dc67=_0x3428af[_0x16d67d(0x155)](_0x5b0e34=>!isSyncedAtMetadataLine(_0x5b0e34,_0x4d5618));return _0x59dc67[_0x16d67d(0x146)]('\x0a');}function isSyncedAtMetadataLine(_0x1ab83c,_0x3c215c){const _0xd679ab=a138_0x7842a5;if(_0x3c215c===_0xd679ab(0x167))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0xd679ab(0x140)](_0x1ab83c);return/^\s*--\s*@lovrabet\.syncedAt:/[_0xd679ab(0x140)](_0x1ab83c);}
|
|
1
|
+
const a138_0x4a8c15=a138_0x3793;(function(_0x5cbd61,_0x1bc466){const _0x1954f5=a138_0x3793,_0x562336=_0x5cbd61();while(!![]){try{const _0x2d5794=parseInt(_0x1954f5(0x115))/0x1*(parseInt(_0x1954f5(0x11f))/0x2)+-parseInt(_0x1954f5(0x139))/0x3+parseInt(_0x1954f5(0x11c))/0x4+-parseInt(_0x1954f5(0x143))/0x5+-parseInt(_0x1954f5(0x142))/0x6*(parseInt(_0x1954f5(0x12c))/0x7)+-parseInt(_0x1954f5(0x141))/0x8+parseInt(_0x1954f5(0x110))/0x9*(parseInt(_0x1954f5(0x137))/0xa);if(_0x2d5794===_0x1bc466)break;else _0x562336['push'](_0x562336['shift']());}catch(_0x530eb8){_0x562336['push'](_0x562336['shift']());}}}(a138_0x5029,0x79a76));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x5ed2d6,_0x3b32d6){const _0x33aeb1=a138_0x3793,_0x4fb686=[];let _0x229fa6=0x1;while(!![]){const _0x5b3232=await listSqlQueries(_0x5ed2d6,{'currentPage':_0x229fa6,'pageSize':PAGE_SIZE,'sqlCode':_0x3b32d6['sqlCode'],'sqlName':_0x3b32d6[_0x33aeb1(0x10d)]}),_0x5403af=_0x5b3232[_0x33aeb1(0x111)]??[];_0x4fb686[_0x33aeb1(0x12a)](..._0x5403af);if(_0x5403af['length']===0x0)break;const _0x4a15a2=_0x5b3232[_0x33aeb1(0x144)]?.['totalCount'];if(_0x4a15a2!=null?_0x4fb686[_0x33aeb1(0x14a)]>=_0x4a15a2:_0x5403af[_0x33aeb1(0x14a)]<PAGE_SIZE)break;_0x229fa6++;}return _0x4fb686;}function a138_0x3793(_0x501061,_0x1ce419){_0x501061=_0x501061-0x10a;const _0x50299c=a138_0x5029();let _0x37934f=_0x50299c[_0x501061];return _0x37934f;}async function ensureSqlContent(_0x50df30){const _0x482351=a138_0x3793;if(_0x50df30[_0x482351(0x120)]!=null&&String(_0x50df30['sqlContent'])[_0x482351(0x14a)]>0x0)return _0x50df30;return getSqlQueryDetail(_0x50df30[_0x482351(0x138)]);}export const sqlPull={'service':a138_0x4a8c15(0x113),'command':'pull','description':a138_0x4a8c15(0x114),'risk':a138_0x4a8c15(0x127),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a138_0x4a8c15(0x13b),'type':a138_0x4a8c15(0x112),'description':a138_0x4a8c15(0x149)},{'name':a138_0x4a8c15(0x12d),'type':a138_0x4a8c15(0x122),'description':a138_0x4a8c15(0x12e)}],async 'dryRun'(_0x2e602d){const _0x25b690=a138_0x4a8c15,_0x4beec0=loadSqlProjectConfig(_0x2e602d[_0x25b690(0x10b)]),_0x2f12b9=await readSqlLockFile(_0x4beec0[_0x25b690(0x10f)]),{appLock:_0x32596c}=ensureSqlLockScope(_0x2f12b9??createEmptySqlLock(),_0x4beec0['appCode'],_0x4beec0['sqlRoot'],_0x25b690(0x135)),_0x21b1bb=await fetchAllSqlQueries(_0x2e602d[_0x25b690(0x10b)],{'sqlCode':_0x2e602d[_0x25b690(0x130)](_0x25b690(0x119))||undefined,'sqlName':_0x2e602d[_0x25b690(0x130)]('name')||undefined}),_0x4c0630=[];for(const _0x42a42a of _0x21b1bb){const _0x333a5e=await ensureSqlContent(_0x42a42a),_0x5d7d1d=ensureRemoteSqlContent(_0x333a5e),_0x3be26a=detectModeFromSql(_0x333a5e),_0x48cf41=_0x333a5e[_0x25b690(0x147)]?await getDbName(_0x2e602d[_0x25b690(0x10b)],Number(_0x333a5e[_0x25b690(0x147)]))['catch'](()=>undefined):undefined,_0x43c188=buildLocalSqlFileContent({'sqlCode':_0x333a5e[_0x25b690(0x138)],'sqlName':_0x333a5e[_0x25b690(0x10d)],'dbId':_0x333a5e['dbId']},_0x5d7d1d,{'dbName':_0x48cf41,'mode':_0x3be26a,'syncedAt':new Date()['toISOString'](),'description':_0x333a5e[_0x25b690(0x123)]}),_0x12cc87=buildSqlLockEntry(_0x333a5e,_0x5d7d1d,'',{'dbName':_0x48cf41}),_0x4de717=resolveLocalSqlFilePath(_0x4beec0,_0x333a5e[_0x25b690(0x138)],_0x12cc87);let _0x30c20b=_0x25b690(0x13c),_0x3cd8bb;if(await fileExists(_0x4de717)){const _0x1d0c84=await readFile(_0x4de717,_0x25b690(0x11d));isEquivalentPulledSqlFile(_0x1d0c84,_0x43c188,_0x3be26a)?(_0x30c20b=_0x25b690(0x121),_0x3cd8bb=_0x25b690(0x10c)):(_0x30c20b=_0x25b690(0x125),_0x3cd8bb=_0x25b690(0x10e));}_0x4c0630[_0x25b690(0x12a)]({'sqlCode':_0x333a5e['sqlCode'],'sqlName':_0x333a5e['sqlName'],'filePath':_0x4de717,'status':_0x30c20b,'reason':_0x3cd8bb});}return{'method':_0x25b690(0x131),'url':_0x25b690(0x11e),'body':{'appCode':_0x2e602d['appCode'],'sqlCode':_0x2e602d[_0x25b690(0x130)](_0x25b690(0x119))||null,'sqlName':_0x2e602d[_0x25b690(0x130)](_0x25b690(0x13b))||null,'files':_0x4c0630},'description':'Would\x20pull\x20'+_0x4c0630[_0x25b690(0x14a)]+_0x25b690(0x11b)+_0x4beec0[_0x25b690(0x145)]};},async 'execute'(_0x2746ae){const _0x2dfcab=a138_0x4a8c15,_0x509d57=loadSqlProjectConfig(_0x2746ae['appCode']),_0x113891=await readSqlLockFile(_0x509d57['lockFilePath']),{lockData:_0x13c20b,appLock:_0x3ad80a}=ensureSqlLockScope(_0x113891??createEmptySqlLock(),_0x509d57[_0x2dfcab(0x10b)],_0x509d57[_0x2dfcab(0x132)],_0x2dfcab(0x135)),_0x4a3746=_0x2746ae[_0x2dfcab(0x133)]('force'),_0x265477=await fetchAllSqlQueries(_0x2746ae['appCode'],{'sqlCode':_0x2746ae[_0x2dfcab(0x130)]('sqlcode')||undefined,'sqlName':_0x2746ae[_0x2dfcab(0x130)](_0x2dfcab(0x13b))||undefined});if(_0x265477[_0x2dfcab(0x14a)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x2dfcab(0x13f)};const _0x1adcca=[],_0x425ff6=[];for(const _0x1e1a9e of _0x265477){try{_0x1adcca['push'](await ensureSqlContent(_0x1e1a9e));}catch(_0x37aa0a){_0x425ff6[_0x2dfcab(0x12a)]({'sqlCode':_0x1e1a9e['sqlCode'],'error':_0x37aa0a instanceof Error?_0x37aa0a['message']:String(_0x37aa0a)});}}if(_0x4a3746&&!_0x2746ae[_0x2dfcab(0x126)]){let _0x1e1e45=![];for(const _0xdfab24 of _0x1adcca){const _0x586ea9=detectModeFromSql(_0xdfab24),_0x5e465e=_0xdfab24[_0x2dfcab(0x147)]?await getDbName(_0x2746ae[_0x2dfcab(0x10b)],Number(_0xdfab24[_0x2dfcab(0x147)]))[_0x2dfcab(0x11a)](()=>undefined):undefined,_0x35c7cd=buildLocalSqlFileContent({'sqlCode':_0xdfab24[_0x2dfcab(0x138)],'sqlName':_0xdfab24['sqlName'],'dbId':_0xdfab24[_0x2dfcab(0x147)]},ensureRemoteSqlContent(_0xdfab24),{'dbName':_0x5e465e,'mode':_0x586ea9,'syncedAt':new Date()['toISOString'](),'description':_0xdfab24[_0x2dfcab(0x123)]}),_0x5bb7bc=resolveLocalSqlFilePath(_0x509d57,_0xdfab24[_0x2dfcab(0x138)],buildSqlLockEntry(_0xdfab24,ensureRemoteSqlContent(_0xdfab24),'',{'dbName':_0x5e465e}));if(await fileExists(_0x5bb7bc)){const _0x328e34=await readFile(_0x5bb7bc,'utf8');if(!isEquivalentPulledSqlFile(_0x328e34,_0x35c7cd,_0x586ea9)){_0x1e1e45=!![];break;}}}if(_0x1e1e45){const _0x19d0ae=await confirmForceOverwrite('Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.');if(!_0x19d0ae)throw CliErrors[_0x2dfcab(0x12b)](_0x2dfcab(0x13e));}}const _0x326160=cloneSqlLockData(_0x13c20b),_0x2c31f8=_0x326160[_0x2dfcab(0x136)][_0x509d57[_0x2dfcab(0x10b)]],_0x2d41d4=[],_0x239502=[];for(const _0x4a612f of _0x1adcca){const _0x1725d9=_0x2c31f8[_0x2dfcab(0x12f)][_0x4a612f[_0x2dfcab(0x138)]],_0x4ce31f=ensureRemoteSqlContent(_0x4a612f),_0x445820=detectModeFromSql(_0x4a612f),_0x4255cc=_0x4a612f['dbId']?await getDbName(_0x2746ae['appCode'],Number(_0x4a612f[_0x2dfcab(0x147)]))['catch'](()=>undefined):undefined,_0x4364c3=buildLocalSqlFileContent({'sqlCode':_0x4a612f[_0x2dfcab(0x138)],'sqlName':_0x4a612f[_0x2dfcab(0x10d)],'dbId':_0x4a612f[_0x2dfcab(0x147)]},_0x4ce31f,{'dbName':_0x4255cc,'mode':_0x445820,'syncedAt':new Date()[_0x2dfcab(0x116)](),'description':_0x4a612f['description']}),_0x5af268=buildSqlLockEntry(_0x4a612f,_0x4ce31f,computeSqlContentHash(_0x4364c3),{'dbName':_0x4255cc}),_0x35b307=_0x5af268['path'],_0x4a494d=join(_0x509d57[_0x2dfcab(0x145)],_0x35b307);try{if(await fileExists(_0x4a494d)){const _0xaf34dd=await readFile(_0x4a494d,'utf8');if(isEquivalentPulledSqlFile(_0xaf34dd,_0x4364c3,_0x445820)){_0x239502['push']({'sqlCode':_0x4a612f[_0x2dfcab(0x138)],'reason':_0x2dfcab(0x10c)}),_0x2c31f8[_0x2dfcab(0x12f)][_0x4a612f[_0x2dfcab(0x138)]]={..._0x5af268,'hash':computeSqlContentHash(_0xaf34dd),'path':_0x35b307};continue;}if(!_0x4a3746){_0x239502[_0x2dfcab(0x12a)]({'sqlCode':_0x4a612f[_0x2dfcab(0x138)],'reason':'local\x20differs\x20from\x20remote'});continue;}}const _0x12c0ca=_0x1725d9?.[_0x2dfcab(0x148)]?join(_0x509d57[_0x2dfcab(0x145)],_0x1725d9['path']):undefined;_0x12c0ca&&_0x12c0ca!==_0x4a494d&&await fileExists(_0x12c0ca)&&await rm(_0x12c0ca,{'force':!![]}),await ensureParentDirectory(_0x4a494d),await writeFile(_0x4a494d,_0x4364c3,_0x2dfcab(0x11d)),_0x2c31f8['sqls'][_0x4a612f[_0x2dfcab(0x138)]]={..._0x5af268,'path':_0x35b307},_0x2d41d4[_0x2dfcab(0x12a)]({'sqlCode':_0x4a612f[_0x2dfcab(0x138)],'filePath':_0x4a494d});}catch(_0x1eec84){_0x425ff6[_0x2dfcab(0x12a)]({'sqlCode':_0x4a612f[_0x2dfcab(0x138)],'error':_0x1eec84 instanceof Error?_0x1eec84[_0x2dfcab(0x10a)]:String(_0x1eec84)});}}return _0x2c31f8[_0x2dfcab(0x13a)]=new Date()['toISOString'](),await writeSqlLockFile(_0x509d57[_0x2dfcab(0x10f)],_0x326160),{'ok':_0x425ff6[_0x2dfcab(0x14a)]===0x0,'data':{'pulled':_0x2d41d4,'skipped':_0x239502,'failed':_0x425ff6},'message':'Pull\x20complete:\x20'+_0x2d41d4[_0x2dfcab(0x14a)]+_0x2dfcab(0x13d)+_0x239502[_0x2dfcab(0x14a)]+_0x2dfcab(0x118)+_0x425ff6[_0x2dfcab(0x14a)]+_0x2dfcab(0x128)};}};function detectModeFromSql(_0x1d7664){const _0xa9ad18=a138_0x4a8c15,_0x20bd87=ensureRemoteSqlContent(_0x1d7664),_0x5a8914=stripLocalSqlMetadata(_0x20bd87,'mybatisXml')[_0xa9ad18(0x146)]();if(/^<(select|insert|update|delete)\b/i[_0xa9ad18(0x117)](_0x5a8914))return'mybatisXml';return'sql';}function a138_0x5029(){const _0x21b1e2=['utf8','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','263132IEQRQP','sqlContent','skipped','boolean','description','replace','conflict','nonInteractive','write','\x20failed','join','push','cancelled','280IJWCDg','force','Force\x20overwrite\x20local\x20unsynced\x20changes','sqls','str','POST','sqlRoot','bool','split','pull','apps','650oeAnZi','sqlCode','2047593BHbVSq','lastSync','name','would_pull','\x20written,\x20','Force\x20pull\x20cancelled.','No\x20remote\x20SQL\x20queries\x20matched.','mybatisXml','6668520TzyhPt','85602TctFEZ','417945qwWHdP','paging','sqlRootDir','trimStart','dbId','path','Filter\x20by\x20SQL\x20display\x20name','length','message','appCode','unchanged','sqlName','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','lockFilePath','171765YUBvFn','tableData','string','sql','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','6HinYES','toISOString','test','\x20skipped,\x20','sqlcode','catch','\x20SQL\x20file(s)\x20into\x20','2554952zjqPNI'];a138_0x5029=function(){return _0x21b1e2;};return a138_0x5029();}function isEquivalentPulledSqlFile(_0x454d73,_0x1c1dff,_0xa7ba5e){return normalizePullComparableContent(_0x454d73,_0xa7ba5e)===normalizePullComparableContent(_0x1c1dff,_0xa7ba5e);}function normalizePullComparableContent(_0x2f7b02,_0x330336){const _0x53013b=a138_0x4a8c15,_0x2b068b=_0x2f7b02[_0x53013b(0x124)](/\r\n/g,'\x0a')[_0x53013b(0x134)]('\x0a'),_0x327dfc=_0x2b068b['filter'](_0x341516=>!isSyncedAtMetadataLine(_0x341516,_0x330336));return _0x327dfc[_0x53013b(0x129)]('\x0a');}function isSyncedAtMetadataLine(_0x316da8,_0x4dc0a9){const _0x22b247=a138_0x4a8c15;if(_0x4dc0a9===_0x22b247(0x140))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x22b247(0x117)](_0x316da8);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x22b247(0x117)](_0x316da8);}
|
package/lib/commands/sql/push.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a139_0x5a3b3f=a139_0x2f9f;(function(_0x530446,_0x12bf30){const _0x35c59f=a139_0x2f9f,_0x435ca2=_0x530446();while(!![]){try{const _0x303e21=-parseInt(_0x35c59f(0x20e))/0x1+-parseInt(_0x35c59f(0x235))/0x2*(-parseInt(_0x35c59f(0x1fa))/0x3)+-parseInt(_0x35c59f(0x224))/0x4*(parseInt(_0x35c59f(0x209))/0x5)+parseInt(_0x35c59f(0x1f5))/0x6+-parseInt(_0x35c59f(0x213))/0x7*(parseInt(_0x35c59f(0x214))/0x8)+parseInt(_0x35c59f(0x236))/0x9*(parseInt(_0x35c59f(0x220))/0xa)+-parseInt(_0x35c59f(0x233))/0xb;if(_0x303e21===_0x12bf30)break;else _0x435ca2['push'](_0x435ca2['shift']());}catch(_0x57eb8c){_0x435ca2['push'](_0x435ca2['shift']());}}}(a139_0x2480,0xa8135));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';function a139_0x2480(){const _0x280f82=['sqlRoot','sql','lastSync','sqlCode','mode','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','sqlcode','\x20SQL\x20file(s)','30EjfZfs','relativePath','\x20skipped,\x20','catch','Push\x20complete:\x20','857647IgpnlJ','\x20failed','boolean','unchanged','\x22\x20for\x20sqlCode\x20','75593SodNXs','136GjNWqz','dbId','filePath','entries','lockFilePath','remoteId','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','force','high-risk-write','set','/smartapi/custom/updateUserCustomSql','1584940ogeyPx','join','isFinite','version','518316NRqgJF','No\x20database\x20matches\x20local\x20directory\x20\x22','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','toISOString','\x20pushed,\x20','sqlName','POST','utf8','appCode','No\x20local\x20SQL\x20files\x20found.','str','sqlRootDir','filter','hash','push','1644423TzRnXk','dbDirectory','13042hKeJTU','18oWpGMt','Local\x20directory\x20\x22','bool','path','exec','get','8090724eSVhRk','dbName','length','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','sqls','456BFrRmf','validation','sqlConfig','has','message','trashDir'];a139_0x2480=function(){return _0x280f82;};return a139_0x2480();}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';function a139_0x2f9f(_0x310981,_0x43cff7){_0x310981=_0x310981-0x1f0;const _0x24802c=a139_0x2480();let _0x2f9f41=_0x24802c[_0x310981];return _0x2f9f41;}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(_0x2aaa65,_0x37e75d,_0xfd3119){const _0x13a07c=a139_0x2f9f,_0x4bdc39=await scanLocalSqlQueries(_0x2aaa65),_0x3687d7=new Map();for(const _0x52d0fb of _0x4bdc39){if(_0xfd3119&&_0x52d0fb[_0x13a07c(0x203)]!==_0xfd3119)continue;const _0x4c1686=_0x3687d7[_0x13a07c(0x1f4)](_0x52d0fb[_0x13a07c(0x203)])??[];_0x4c1686[_0x13a07c(0x232)](_0x52d0fb),_0x3687d7[_0x13a07c(0x21e)](_0x52d0fb['sqlCode'],_0x4c1686);}if(_0xfd3119&&!_0x3687d7[_0x13a07c(0x1fd)](_0xfd3119))throw CliErrors[_0x13a07c(0x1fb)]('Local\x20SQL\x20not\x20found:\x20'+_0xfd3119);const _0x4ac8a4=[];for(const [_0x312eef,_0x4e7d70]of _0x3687d7[_0x13a07c(0x217)]()){if(_0x4e7d70[_0x13a07c(0x1f7)]===0x1){_0x4ac8a4[_0x13a07c(0x232)](_0x4e7d70[0x0]);continue;}const _0x402a06=_0x37e75d[_0x13a07c(0x1f9)][_0x312eef],_0x324e27=_0x402a06?.['path'],_0x39f55d=_0x324e27?_0x4e7d70[_0x13a07c(0x230)](_0x31196b=>_0x31196b[_0x13a07c(0x20a)]!==_0x324e27):_0x4e7d70;if(_0x402a06&&_0x39f55d[_0x13a07c(0x1f7)]===0x1){_0x4ac8a4['push'](_0x39f55d[0x0]);continue;}throw CliErrors[_0x13a07c(0x1fb)](_0x13a07c(0x1f8)+_0x312eef+_0x13a07c(0x21a));}return _0x4ac8a4;}export const sqlPush={'service':a139_0x5a3b3f(0x201),'command':a139_0x5a3b3f(0x232),'description':'Push\x20local\x20SQL\x20files\x20to\x20remote','risk':a139_0x5a3b3f(0x21d),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'force','type':a139_0x5a3b3f(0x210),'description':a139_0x5a3b3f(0x206)}],async 'dryRun'(_0x2e39d3){const _0x2abab0=a139_0x5a3b3f,_0x1e810=loadSqlProjectConfig(_0x2e39d3[_0x2abab0(0x22c)]),_0x426235=await readSqlLockFile(_0x1e810[_0x2abab0(0x218)]),{appLock:_0x1dbdc0}=ensureSqlLockScope(_0x426235??createEmptySqlLock(),_0x2e39d3['appCode'],_0x1e810[_0x2abab0(0x200)],_0x2abab0(0x232)),_0x14ef32=await getTargetSqlQueries(_0x1e810,_0x1dbdc0,_0x2e39d3['str'](_0x2abab0(0x207))||undefined),_0x153dc8=[];for(const _0x35dfe4 of _0x14ef32){const _0x4aaaf7=await computeSqlFileHash(_0x35dfe4['filePath']),_0x25d667=_0x1dbdc0[_0x2abab0(0x1f9)][_0x35dfe4['sqlCode']],_0x30ff1a=!!_0x25d667&&(_0x25d667[_0x2abab0(0x1f2)]!==_0x35dfe4[_0x2abab0(0x20a)]||!!_0x35dfe4[_0x2abab0(0x229)]&&_0x25d667[_0x2abab0(0x229)]!==_0x35dfe4[_0x2abab0(0x229)]);if(!_0x2e39d3[_0x2abab0(0x1f1)](_0x2abab0(0x21c))&&_0x25d667&&_0x25d667['hash']===_0x4aaaf7&&!_0x30ff1a)continue;_0x153dc8[_0x2abab0(0x232)](_0x35dfe4['sqlCode']);}return{'method':_0x2abab0(0x22a),'url':_0x2abab0(0x21f),'body':{'sqlCodes':_0x153dc8,'appCode':_0x2e39d3['appCode']},'description':'Would\x20push\x20'+_0x153dc8[_0x2abab0(0x1f7)]+_0x2abab0(0x208)};},async 'execute'(_0x426488){const _0x10fe38=a139_0x5a3b3f,_0x489ddc=loadSqlProjectConfig(_0x426488[_0x10fe38(0x22c)]),_0x2bc62a=await readSqlLockFile(_0x489ddc[_0x10fe38(0x218)]),{lockData:_0x28f55d,appLock:_0xfec3d6}=ensureSqlLockScope(_0x2bc62a??createEmptySqlLock(),_0x426488[_0x10fe38(0x22c)],_0x489ddc['sqlRoot'],_0x10fe38(0x232)),_0x160f53=await getTargetSqlQueries(_0x489ddc,_0xfec3d6,_0x426488[_0x10fe38(0x22e)](_0x10fe38(0x207))||undefined);if(_0x160f53[_0x10fe38(0x1f7)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x10fe38(0x22d)};const _0x48563b=[],_0xcbabbf=[],_0x1f350d=[];for(const _0x4c28e5 of _0x160f53){const _0x11559e=_0xfec3d6[_0x10fe38(0x1f9)][_0x4c28e5[_0x10fe38(0x203)]];if(!_0x11559e){_0x1f350d[_0x10fe38(0x232)]({'sqlCode':_0x4c28e5[_0x10fe38(0x203)],'error':_0x10fe38(0x21b)});continue;}try{const _0xce753d=await computeSqlFileHash(_0x4c28e5[_0x10fe38(0x216)]),_0x278d3c=_0x11559e[_0x10fe38(0x1f2)]!==_0x4c28e5[_0x10fe38(0x20a)]||!!_0x4c28e5['sqlName']&&_0x11559e[_0x10fe38(0x229)]!==_0x4c28e5[_0x10fe38(0x229)];if(!_0x426488[_0x10fe38(0x1f1)]('force')&&_0x11559e[_0x10fe38(0x231)]===_0xce753d&&!_0x278d3c){_0xcbabbf[_0x10fe38(0x232)]({'sqlCode':_0x4c28e5[_0x10fe38(0x203)],'reason':_0x10fe38(0x211)});continue;}if(_0x11559e[_0x10fe38(0x223)]==null){_0x1f350d[_0x10fe38(0x232)]({'sqlCode':_0x4c28e5[_0x10fe38(0x203)],'error':_0x10fe38(0x205)});continue;}const _0x320df5=await readFile(_0x4c28e5['filePath'],_0x10fe38(0x22b)),_0x1925a4=stripLocalSqlMetadata(_0x320df5,_0x4c28e5[_0x10fe38(0x204)]),_0x534e75=_0x4c28e5[_0x10fe38(0x229)]||_0x11559e['sqlName'],_0x2d5e34=await resolveTargetDbBinding(_0x426488[_0x10fe38(0x22c)],_0x4c28e5,_0x11559e),_0x5e7b5a=await updateSqlQuery({'id':_0x11559e[_0x10fe38(0x219)],'appCode':_0x426488['appCode'],'sqlCode':_0x4c28e5[_0x10fe38(0x203)],'sqlName':_0x534e75,'dbId':_0x2d5e34[_0x10fe38(0x215)],'version':_0x11559e[_0x10fe38(0x223)],'sqlContent':_0x1925a4,'sqlConfig':_0x11559e[_0x10fe38(0x1fc)]??undefined}),_0x1527ce=_0x5e7b5a[_0x10fe38(0x215)]?await getDbName(_0x426488['appCode'],Number(_0x5e7b5a[_0x10fe38(0x215)]))[_0x10fe38(0x20c)](()=>_0x2d5e34['dbName']):_0x2d5e34[_0x10fe38(0x1f6)];_0xfec3d6[_0x10fe38(0x1f9)][_0x4c28e5[_0x10fe38(0x203)]]={...buildSqlLockEntry(_0x5e7b5a,_0x1925a4,_0xce753d,{'dbName':_0x1527ce}),'path':_0x4c28e5['relativePath'],'mode':_0x11559e[_0x10fe38(0x204)]},await archivePreviousSqlFileIfNeeded(_0x489ddc,_0x11559e[_0x10fe38(0x1f2)],_0x4c28e5[_0x10fe38(0x20a)]),_0x48563b[_0x10fe38(0x232)]({'sqlCode':_0x4c28e5[_0x10fe38(0x203)],'remoteId':_0x11559e[_0x10fe38(0x219)]});}catch(_0x22af82){_0x1f350d[_0x10fe38(0x232)]({'sqlCode':_0x4c28e5[_0x10fe38(0x203)],'error':_0x22af82 instanceof Error?_0x22af82[_0x10fe38(0x1fe)]:String(_0x22af82)});}}return _0xfec3d6[_0x10fe38(0x202)]=new Date()[_0x10fe38(0x227)](),await writeSqlLockFile(_0x489ddc[_0x10fe38(0x218)],_0x28f55d),{'ok':_0x1f350d[_0x10fe38(0x1f7)]===0x0,'data':{'pushed':_0x48563b,'skipped':_0xcbabbf,'failed':_0x1f350d},'message':_0x10fe38(0x20d)+_0x48563b[_0x10fe38(0x1f7)]+_0x10fe38(0x228)+_0xcbabbf['length']+_0x10fe38(0x20b)+_0x1f350d[_0x10fe38(0x1f7)]+_0x10fe38(0x20f)};}};async function archivePreviousSqlFileIfNeeded(_0x3f896b,_0x2a551f,_0x702521){const _0x554de9=a139_0x5a3b3f;if(!_0x2a551f||_0x2a551f===_0x702521)return;const _0x22b6a8=join(_0x3f896b[_0x554de9(0x22f)],_0x2a551f);if(!await fileExists(_0x22b6a8))return;const _0x1772d1=await moveToTrash(_0x3f896b['projectRoot'],_0x3f896b[_0x554de9(0x1ff)],_0x22b6a8);await cleanupEmptyDirectories(dirname(_0x22b6a8),_0x3f896b[_0x554de9(0x22f)]),void _0x1772d1;}async function moveToTrash(_0x59269b,_0x109632,_0x2401c8){const _0x57633f=new Date()['toISOString']()['replace'](/[:.]/g,'-'),_0x7e9b9a=relative(_0x59269b,_0x2401c8),_0x72ea38=join(_0x109632,_0x57633f,_0x7e9b9a);return await mkdir(dirname(_0x72ea38),{'recursive':!![]}),await rename(_0x2401c8,_0x72ea38),_0x72ea38;}async function cleanupEmptyDirectories(_0xd3d4e7,_0xc86d54){const _0x2ce520=a139_0x5a3b3f;let _0x4155f0=resolve(_0xd3d4e7);const _0x56c88c=resolve(_0xc86d54);while(_0x4155f0['startsWith'](''+_0x56c88c+sep)||_0x4155f0===_0x56c88c){if(_0x4155f0===_0x56c88c)return;try{const _0x1b0962=await readdir(_0x4155f0);if(_0x1b0962[_0x2ce520(0x1f7)]>0x0)return;await rmdir(_0x4155f0);}catch{return;}_0x4155f0=dirname(_0x4155f0);}}async function resolveTargetDbBinding(_0x32e405,_0x3ddaad,_0x3dcec1){const _0x40e4a6=a139_0x5a3b3f,_0x1e2221=_0x3ddaad[_0x40e4a6(0x234)];if(!_0x1e2221)return{'dbId':_0x3dcec1[_0x40e4a6(0x215)],'dbName':_0x3dcec1['dbName']};const _0x505a30=buildDbDirectoryName(_0x3dcec1['dbName'],_0x3dcec1[_0x40e4a6(0x215)]);if(_0x1e2221===_0x505a30)return{'dbId':_0x3dcec1[_0x40e4a6(0x215)],'dbName':_0x3dcec1[_0x40e4a6(0x1f6)]};const _0x5ae563=parseExplicitDbDirectory(_0x1e2221);if(_0x5ae563!=null)return{'dbId':_0x5ae563,'dbName':await getDbName(_0x32e405,_0x5ae563)[_0x40e4a6(0x20c)](()=>undefined)};const _0x4c5b70=await listDatabases(_0x32e405),_0x465b1d=_0x4c5b70[_0x40e4a6(0x230)](_0x544f2b=>buildDbDirectoryName(_0x544f2b['dbName'],_0x544f2b[_0x40e4a6(0x215)])===_0x1e2221);if(_0x465b1d[_0x40e4a6(0x1f7)]===0x1)return{'dbId':_0x465b1d[0x0][_0x40e4a6(0x215)],'dbName':_0x465b1d[0x0][_0x40e4a6(0x1f6)]};if(_0x465b1d[_0x40e4a6(0x1f7)]===0x0)throw CliErrors[_0x40e4a6(0x1fb)](_0x40e4a6(0x225)+_0x1e2221+_0x40e4a6(0x212)+_0x3ddaad[_0x40e4a6(0x203)]+'.');const _0xd294fc=_0x465b1d['map'](_0x5ac90d=>_0x5ac90d[_0x40e4a6(0x1f6)]+'\x20('+_0x5ac90d['dbId']+')')[_0x40e4a6(0x221)](',\x20');throw CliErrors[_0x40e4a6(0x1fb)](_0x40e4a6(0x1f0)+_0x1e2221+_0x40e4a6(0x226)+_0x3ddaad[_0x40e4a6(0x203)]+':\x20'+_0xd294fc);}function parseExplicitDbDirectory(_0x1e9f9e){const _0x25e7c8=a139_0x5a3b3f,_0x3a483a=/^db-(\d+)$/[_0x25e7c8(0x1f3)](_0x1e9f9e);if(!_0x3a483a)return null;const _0x5efdd4=Number(_0x3a483a[0x1]);return Number[_0x25e7c8(0x222)](_0x5efdd4)&&_0x5efdd4>0x0?_0x5efdd4:null;}
|
|
1
|
+
const a139_0x3b8f95=a139_0x21b2;(function(_0x57f002,_0x5955f3){const _0x1dd1cf=a139_0x21b2,_0x464652=_0x57f002();while(!![]){try{const _0x1e0b05=parseInt(_0x1dd1cf(0x19a))/0x1+parseInt(_0x1dd1cf(0x19b))/0x2*(-parseInt(_0x1dd1cf(0x1c7))/0x3)+-parseInt(_0x1dd1cf(0x1a0))/0x4+parseInt(_0x1dd1cf(0x1c0))/0x5+-parseInt(_0x1dd1cf(0x1be))/0x6+-parseInt(_0x1dd1cf(0x1c8))/0x7*(parseInt(_0x1dd1cf(0x1ab))/0x8)+parseInt(_0x1dd1cf(0x1a7))/0x9;if(_0x1e0b05===_0x5955f3)break;else _0x464652['push'](_0x464652['shift']());}catch(_0x408656){_0x464652['push'](_0x464652['shift']());}}}(a139_0x3c25,0xec4a2));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';function a139_0x3c25(){const _0x47772e=['filePath','sql','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','sqlConfig','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','Would\x20push\x20','map','validation','path','/smartapi/custom/updateUserCustomSql','version','catch','sqlName','message','\x20skipped,\x20','projectRoot','6445602nJcMkH','dbName','8259750mwoqqW','lockFilePath','No\x20database\x20matches\x20local\x20directory\x20\x22','get','dbId','Local\x20directory\x20\x22','\x20failed','39qqmdkR','12124595hHigGW','Push\x20complete:\x20','remoteId','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','sqlRoot','exec','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','mode','join','Push\x20local\x20SQL\x20files\x20to\x20remote','sqls','startsWith','hash','sqlCode','filter','appCode','Local\x20SQL\x20not\x20found:\x20','sqlRootDir','1629761apJgRa','288776svNuln','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','utf8','dbDirectory','\x22\x20for\x20sqlCode\x20','3422744OArcTx','push','toISOString','replace','sqlcode','str','\x20SQL\x20file(s)','29026917fDOOVN','isFinite','relativePath','length','8pUuwfa','force','boolean'];a139_0x3c25=function(){return _0x47772e;};return a139_0x3c25();}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(_0x452f3b,_0x49c649,_0x6fc9d6){const _0x32bbe7=a139_0x21b2,_0x39fdc4=await scanLocalSqlQueries(_0x452f3b),_0x37ce92=new Map();for(const _0x31f434 of _0x39fdc4){if(_0x6fc9d6&&_0x31f434[_0x32bbe7(0x195)]!==_0x6fc9d6)continue;const _0x2ebd15=_0x37ce92[_0x32bbe7(0x1c3)](_0x31f434[_0x32bbe7(0x195)])??[];_0x2ebd15['push'](_0x31f434),_0x37ce92['set'](_0x31f434[_0x32bbe7(0x195)],_0x2ebd15);}if(_0x6fc9d6&&!_0x37ce92['has'](_0x6fc9d6))throw CliErrors['validation'](_0x32bbe7(0x198)+_0x6fc9d6);const _0x2eb8d3=[];for(const [_0x30cdd7,_0x4f50f7]of _0x37ce92['entries']()){if(_0x4f50f7[_0x32bbe7(0x1aa)]===0x1){_0x2eb8d3[_0x32bbe7(0x1a1)](_0x4f50f7[0x0]);continue;}const _0x17346b=_0x49c649[_0x32bbe7(0x192)][_0x30cdd7],_0x4e1bef=_0x17346b?.['path'],_0x259a84=_0x4e1bef?_0x4f50f7['filter'](_0x2ec9b1=>_0x2ec9b1[_0x32bbe7(0x1a9)]!==_0x4e1bef):_0x4f50f7;if(_0x17346b&&_0x259a84[_0x32bbe7(0x1aa)]===0x1){_0x2eb8d3['push'](_0x259a84[0x0]);continue;}throw CliErrors[_0x32bbe7(0x1b5)](_0x32bbe7(0x1b2)+_0x30cdd7+_0x32bbe7(0x1cb));}return _0x2eb8d3;}function a139_0x21b2(_0x3738bb,_0x7cf320){_0x3738bb=_0x3738bb-0x18e;const _0x3c2598=a139_0x3c25();let _0x21b262=_0x3c2598[_0x3738bb];return _0x21b262;}export const sqlPush={'service':a139_0x3b8f95(0x1af),'command':a139_0x3b8f95(0x1a1),'description':a139_0x3b8f95(0x191),'risk':'high-risk-write','flags':[SQLCODE_FLAG_OPTIONAL,{'name':'force','type':a139_0x3b8f95(0x1ad),'description':'Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock'}],async 'dryRun'(_0x247d70){const _0x38b8ab=a139_0x3b8f95,_0x1ccb92=loadSqlProjectConfig(_0x247d70[_0x38b8ab(0x197)]),_0x4e1a7b=await readSqlLockFile(_0x1ccb92[_0x38b8ab(0x1c1)]),{appLock:_0x443418}=ensureSqlLockScope(_0x4e1a7b??createEmptySqlLock(),_0x247d70[_0x38b8ab(0x197)],_0x1ccb92[_0x38b8ab(0x1cc)],'push'),_0x498da0=await getTargetSqlQueries(_0x1ccb92,_0x443418,_0x247d70['str']('sqlcode')||undefined),_0x239fea=[];for(const _0x365f31 of _0x498da0){const _0x4427b6=await computeSqlFileHash(_0x365f31[_0x38b8ab(0x1ae)]),_0x2bd368=_0x443418[_0x38b8ab(0x192)][_0x365f31[_0x38b8ab(0x195)]],_0x3ae459=!!_0x2bd368&&(_0x2bd368[_0x38b8ab(0x1b6)]!==_0x365f31[_0x38b8ab(0x1a9)]||!!_0x365f31[_0x38b8ab(0x1ba)]&&_0x2bd368['sqlName']!==_0x365f31[_0x38b8ab(0x1ba)]);if(!_0x247d70['bool'](_0x38b8ab(0x1ac))&&_0x2bd368&&_0x2bd368[_0x38b8ab(0x194)]===_0x4427b6&&!_0x3ae459)continue;_0x239fea['push'](_0x365f31['sqlCode']);}return{'method':'POST','url':_0x38b8ab(0x1b7),'body':{'sqlCodes':_0x239fea,'appCode':_0x247d70[_0x38b8ab(0x197)]},'description':_0x38b8ab(0x1b3)+_0x239fea[_0x38b8ab(0x1aa)]+_0x38b8ab(0x1a6)};},async 'execute'(_0x1bd078){const _0x3eab2c=a139_0x3b8f95,_0x1a4412=loadSqlProjectConfig(_0x1bd078[_0x3eab2c(0x197)]),_0x4fc66b=await readSqlLockFile(_0x1a4412[_0x3eab2c(0x1c1)]),{lockData:_0x4889d6,appLock:_0x2a109a}=ensureSqlLockScope(_0x4fc66b??createEmptySqlLock(),_0x1bd078['appCode'],_0x1a4412[_0x3eab2c(0x1cc)],'push'),_0x1b4dd4=await getTargetSqlQueries(_0x1a4412,_0x2a109a,_0x1bd078[_0x3eab2c(0x1a5)](_0x3eab2c(0x1a4))||undefined);if(_0x1b4dd4[_0x3eab2c(0x1aa)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':'No\x20local\x20SQL\x20files\x20found.'};const _0x18b76a=[],_0x47f8f4=[],_0x1f66f1=[];for(const _0x391f25 of _0x1b4dd4){const _0x17df90=_0x2a109a[_0x3eab2c(0x192)][_0x391f25['sqlCode']];if(!_0x17df90){_0x1f66f1[_0x3eab2c(0x1a1)]({'sqlCode':_0x391f25[_0x3eab2c(0x195)],'error':_0x3eab2c(0x19c)});continue;}try{const _0x29400d=await computeSqlFileHash(_0x391f25[_0x3eab2c(0x1ae)]),_0x1a11ac=_0x17df90[_0x3eab2c(0x1b6)]!==_0x391f25[_0x3eab2c(0x1a9)]||!!_0x391f25[_0x3eab2c(0x1ba)]&&_0x17df90['sqlName']!==_0x391f25[_0x3eab2c(0x1ba)];if(!_0x1bd078['bool'](_0x3eab2c(0x1ac))&&_0x17df90[_0x3eab2c(0x194)]===_0x29400d&&!_0x1a11ac){_0x47f8f4[_0x3eab2c(0x1a1)]({'sqlCode':_0x391f25['sqlCode'],'reason':'unchanged'});continue;}if(_0x17df90[_0x3eab2c(0x1b8)]==null){_0x1f66f1[_0x3eab2c(0x1a1)]({'sqlCode':_0x391f25[_0x3eab2c(0x195)],'error':_0x3eab2c(0x18e)});continue;}const _0xc6b7de=await readFile(_0x391f25[_0x3eab2c(0x1ae)],_0x3eab2c(0x19d)),_0x34fc61=stripLocalSqlMetadata(_0xc6b7de,_0x391f25[_0x3eab2c(0x18f)]),_0x35abf3=_0x391f25['sqlName']||_0x17df90['sqlName'],_0x4becbc=await resolveTargetDbBinding(_0x1bd078[_0x3eab2c(0x197)],_0x391f25,_0x17df90),_0x3a3d87=await updateSqlQuery({'id':_0x17df90[_0x3eab2c(0x1ca)],'appCode':_0x1bd078[_0x3eab2c(0x197)],'sqlCode':_0x391f25[_0x3eab2c(0x195)],'sqlName':_0x35abf3,'dbId':_0x4becbc[_0x3eab2c(0x1c4)],'version':_0x17df90['version'],'sqlContent':_0x34fc61,'sqlConfig':_0x17df90[_0x3eab2c(0x1b1)]??undefined}),_0x46f338=_0x3a3d87['dbId']?await getDbName(_0x1bd078[_0x3eab2c(0x197)],Number(_0x3a3d87[_0x3eab2c(0x1c4)]))[_0x3eab2c(0x1b9)](()=>_0x4becbc['dbName']):_0x4becbc[_0x3eab2c(0x1bf)];_0x2a109a[_0x3eab2c(0x192)][_0x391f25[_0x3eab2c(0x195)]]={...buildSqlLockEntry(_0x3a3d87,_0x34fc61,_0x29400d,{'dbName':_0x46f338}),'path':_0x391f25[_0x3eab2c(0x1a9)],'mode':_0x17df90[_0x3eab2c(0x18f)]},await archivePreviousSqlFileIfNeeded(_0x1a4412,_0x17df90[_0x3eab2c(0x1b6)],_0x391f25[_0x3eab2c(0x1a9)]),_0x18b76a[_0x3eab2c(0x1a1)]({'sqlCode':_0x391f25[_0x3eab2c(0x195)],'remoteId':_0x17df90['remoteId']});}catch(_0x58cb29){_0x1f66f1[_0x3eab2c(0x1a1)]({'sqlCode':_0x391f25[_0x3eab2c(0x195)],'error':_0x58cb29 instanceof Error?_0x58cb29[_0x3eab2c(0x1bb)]:String(_0x58cb29)});}}return _0x2a109a['lastSync']=new Date()[_0x3eab2c(0x1a2)](),await writeSqlLockFile(_0x1a4412[_0x3eab2c(0x1c1)],_0x4889d6),{'ok':_0x1f66f1[_0x3eab2c(0x1aa)]===0x0,'data':{'pushed':_0x18b76a,'skipped':_0x47f8f4,'failed':_0x1f66f1},'message':_0x3eab2c(0x1c9)+_0x18b76a[_0x3eab2c(0x1aa)]+'\x20pushed,\x20'+_0x47f8f4['length']+_0x3eab2c(0x1bc)+_0x1f66f1[_0x3eab2c(0x1aa)]+_0x3eab2c(0x1c6)};}};async function archivePreviousSqlFileIfNeeded(_0x323d9f,_0x5894c6,_0x3d63de){const _0x26074c=a139_0x3b8f95;if(!_0x5894c6||_0x5894c6===_0x3d63de)return;const _0x4063c2=join(_0x323d9f[_0x26074c(0x199)],_0x5894c6);if(!await fileExists(_0x4063c2))return;const _0x53f423=await moveToTrash(_0x323d9f[_0x26074c(0x1bd)],_0x323d9f['trashDir'],_0x4063c2);await cleanupEmptyDirectories(dirname(_0x4063c2),_0x323d9f[_0x26074c(0x199)]),void _0x53f423;}async function moveToTrash(_0x252e3b,_0x394802,_0x5734c2){const _0x1aeb21=a139_0x3b8f95,_0x396683=new Date()[_0x1aeb21(0x1a2)]()[_0x1aeb21(0x1a3)](/[:.]/g,'-'),_0x160faa=relative(_0x252e3b,_0x5734c2),_0x5a974b=join(_0x394802,_0x396683,_0x160faa);return await mkdir(dirname(_0x5a974b),{'recursive':!![]}),await rename(_0x5734c2,_0x5a974b),_0x5a974b;}async function cleanupEmptyDirectories(_0x5a7cbb,_0x3a7fcf){const _0x5c77fc=a139_0x3b8f95;let _0x34f461=resolve(_0x5a7cbb);const _0x332299=resolve(_0x3a7fcf);while(_0x34f461[_0x5c77fc(0x193)](''+_0x332299+sep)||_0x34f461===_0x332299){if(_0x34f461===_0x332299)return;try{const _0x45d66a=await readdir(_0x34f461);if(_0x45d66a[_0x5c77fc(0x1aa)]>0x0)return;await rmdir(_0x34f461);}catch{return;}_0x34f461=dirname(_0x34f461);}}async function resolveTargetDbBinding(_0x267ff8,_0x10353b,_0x5b2ff6){const _0x467d1a=a139_0x3b8f95,_0x305706=_0x10353b[_0x467d1a(0x19e)];if(!_0x305706)return{'dbId':_0x5b2ff6[_0x467d1a(0x1c4)],'dbName':_0x5b2ff6['dbName']};const _0x1ca43f=buildDbDirectoryName(_0x5b2ff6[_0x467d1a(0x1bf)],_0x5b2ff6[_0x467d1a(0x1c4)]);if(_0x305706===_0x1ca43f)return{'dbId':_0x5b2ff6['dbId'],'dbName':_0x5b2ff6[_0x467d1a(0x1bf)]};const _0x4a7dac=parseExplicitDbDirectory(_0x305706);if(_0x4a7dac!=null)return{'dbId':_0x4a7dac,'dbName':await getDbName(_0x267ff8,_0x4a7dac)[_0x467d1a(0x1b9)](()=>undefined)};const _0x1bd814=await listDatabases(_0x267ff8),_0x3b7f51=_0x1bd814[_0x467d1a(0x196)](_0x2d54ae=>buildDbDirectoryName(_0x2d54ae[_0x467d1a(0x1bf)],_0x2d54ae[_0x467d1a(0x1c4)])===_0x305706);if(_0x3b7f51[_0x467d1a(0x1aa)]===0x1)return{'dbId':_0x3b7f51[0x0][_0x467d1a(0x1c4)],'dbName':_0x3b7f51[0x0][_0x467d1a(0x1bf)]};if(_0x3b7f51[_0x467d1a(0x1aa)]===0x0)throw CliErrors[_0x467d1a(0x1b5)](_0x467d1a(0x1c2)+_0x305706+_0x467d1a(0x19f)+_0x10353b[_0x467d1a(0x195)]+'.');const _0x1d5e1f=_0x3b7f51[_0x467d1a(0x1b4)](_0x4a67af=>_0x4a67af['dbName']+'\x20('+_0x4a67af[_0x467d1a(0x1c4)]+')')[_0x467d1a(0x190)](',\x20');throw CliErrors[_0x467d1a(0x1b5)](_0x467d1a(0x1c5)+_0x305706+_0x467d1a(0x1b0)+_0x10353b[_0x467d1a(0x195)]+':\x20'+_0x1d5e1f);}function parseExplicitDbDirectory(_0x1ad8b2){const _0x507fc7=a139_0x3b8f95,_0x1c6be0=/^db-(\d+)$/[_0x507fc7(0x1cd)](_0x1ad8b2);if(!_0x1c6be0)return null;const _0x94069=Number(_0x1c6be0[0x1]);return Number[_0x507fc7(0x1a8)](_0x94069)&&_0x94069>0x0?_0x94069:null;}
|
package/lib/commands/sql/save.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a140_0x263bb8=a140_0x179c;(function(_0x1cdb5c,_0x52749){const _0x578292=a140_0x179c,_0x4e61b1=_0x1cdb5c();while(!![]){try{const _0x58722b=-parseInt(_0x578292(0x1f0))/0x1*(parseInt(_0x578292(0x1f4))/0x2)+parseInt(_0x578292(0x1f6))/0x3+parseInt(_0x578292(0x1f9))/0x4*(-parseInt(_0x578292(0x202))/0x5)+parseInt(_0x578292(0x203))/0x6*(parseInt(_0x578292(0x1ee))/0x7)+parseInt(_0x578292(0x1ed))/0x8*(parseInt(_0x578292(0x201))/0x9)+-parseInt(_0x578292(0x1f3))/0xa*(-parseInt(_0x578292(0x1fe))/0xb)+parseInt(_0x578292(0x1ef))/0xc*(-parseInt(_0x578292(0x1e9))/0xd);if(_0x58722b===_0x52749)break;else _0x4e61b1['push'](_0x4e61b1['shift']());}catch(_0x58e59c){_0x4e61b1['push'](_0x4e61b1['shift']());}}}(a140_0x1009,0x54b87));function a140_0x1009(){const _0x3bb9a2=['Path\x20to\x20the\x20SQL\x20file','SQL\x20query\x20display\x20name','53810ItnhYo','1071258KYAkTi','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`.','908061oKzigy','save','`rabetbase\x20sql\x20save`\x20has\x20been\x20deprecated.','128GxaSTs','sql','Target\x20database\x20—\x20accepts\x20a\x20numeric\x20ID\x20or\x20database\x20name\x20(e.g.\x20ecommerce_db)','join','file','11lNjOpN','string','validation','4671MSKBau','95045CwReCf','2202zPMPhD','Create\x20new\x20SQL\x20with\x20`rabetbase\x20sql\x20create\x20--name\x20<name>\x20--db-id\x20<id>\x20--mode\x20sql|mybatisXml`.','247GyEJQx','sqlname','description','Query\x20description','9960tsphhd','13097poiBLp','94704jMJRyx','1LmQmau'];a140_0x1009=function(){return _0x3bb9a2;};return a140_0x1009();}import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';const SQL_SAVE_DEPRECATED_HINT=[a140_0x263bb8(0x1f8),a140_0x263bb8(0x1e8),a140_0x263bb8(0x1f5)][a140_0x263bb8(0x1fc)]('\x0a');function a140_0x179c(_0x5217bd,_0x559976){_0x5217bd=_0x5217bd-0x1e8;const _0x1009bc=a140_0x1009();let _0x179c2b=_0x1009bc[_0x5217bd];return _0x179c2b;}export const sqlSave={'service':a140_0x263bb8(0x1fa),'command':a140_0x263bb8(0x1f7),'description':'Deprecated:\x20use\x20sql\x20create\x20to\x20create\x20and\x20sql\x20push\x20to\x20update','risk':'write','requiresAuth':![],'requiresAppCode':![],'flags':[{'name':a140_0x263bb8(0x1fd),'type':a140_0x263bb8(0x1ff),'required':!![],'description':a140_0x263bb8(0x1f1)},SQLCODE_FLAG_OPTIONAL,{'name':a140_0x263bb8(0x1ea),'type':a140_0x263bb8(0x1ff),'description':a140_0x263bb8(0x1f2)},{'name':'db','type':'string','description':a140_0x263bb8(0x1fb)},{'name':a140_0x263bb8(0x1eb),'type':'string','description':a140_0x263bb8(0x1ec)}],async 'validate'(){throw CliErrors['validation'](SQL_SAVE_DEPRECATED_HINT);},async 'execute'(){const _0x52bb49=a140_0x263bb8;throw CliErrors[_0x52bb49(0x200)](SQL_SAVE_DEPRECATED_HINT);}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x29759f,_0x447f1f){const _0x39aeda=a141_0x9e66,_0x3774bd=_0x29759f();while(!![]){try{const _0x338b96=parseInt(_0x39aeda(0x12d))/0x1*(-parseInt(_0x39aeda(0x124))/0x2)+parseInt(_0x39aeda(0x128))/0x3+-parseInt(_0x39aeda(0x103))/0x4+-parseInt(_0x39aeda(0x11f))/0x5*(parseInt(_0x39aeda(0x121))/0x6)+parseInt(_0x39aeda(0x127))/0x7+-parseInt(_0x39aeda(0x126))/0x8*(parseInt(_0x39aeda(0x12f))/0x9)+parseInt(_0x39aeda(0x113))/0xa;if(_0x338b96===_0x447f1f)break;else _0x3774bd['push'](_0x3774bd['shift']());}catch(_0x4e68f0){_0x3774bd['push'](_0x3774bd['shift']());}}}(a141_0x41d6,0xc2a84));function a141_0x41d6(){const _0x56c1f1=['sqls','syncedAt','trimStart','join','sqlCode','fromEntries','map','20485660hjfrgB','length','split','dbId','apps','--\x20@lovrabet.','dbName','entries','sqlName','stdin','sqlConfig','stderr','10YrhSGU','sqlRoot','1933782BCHFFN','yes','question','10MlHUve','trim','43512SYKAqO','3668735apDjRR','1557021JRjOuc','toLowerCase','\x20-->','mode','filter','82557LxBrPf','sqlContent','1251cJzYLN','includes','path','1923848FjaHyH','\x20[y/N]\x20','test','push','replace','lastSync','endsWith','close','mybatisXml'];a141_0x41d6=function(){return _0x56c1f1;};return a141_0x41d6();}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(_0x8f0237,_0x4bd438,_0x1ae146,_0x5b9aab){const _0x553ff2=a141_0x9e66,_0x489d70=detectSqlMode(_0x4bd438);return{'path':buildSqlRelativePath(_0x8f0237['sqlCode'],_0x8f0237[_0x553ff2(0x11b)],_0x5b9aab?.[_0x553ff2(0x119)],_0x489d70,_0x8f0237[_0x553ff2(0x116)]),'hash':_0x1ae146,'remoteId':_0x8f0237['id'],'version':_0x8f0237['version'],'dbId':Number(_0x8f0237[_0x553ff2(0x116)]),'dbName':_0x5b9aab?.[_0x553ff2(0x119)],'sqlName':_0x8f0237[_0x553ff2(0x11b)],'sqlConfig':_0x8f0237[_0x553ff2(0x11d)]??undefined,'mode':_0x489d70};}export function cloneSqlLockData(_0x3cd2a5){const _0x29192b=a141_0x9e66;return{'apps':Object[_0x29192b(0x111)](Object[_0x29192b(0x11a)](_0x3cd2a5[_0x29192b(0x117)])[_0x29192b(0x112)](([_0x4c73f4,_0x22a98d])=>[_0x4c73f4,{'sqlRoot':_0x22a98d[_0x29192b(0x120)],'lastSync':_0x22a98d[_0x29192b(0x108)],'sqls':{..._0x22a98d[_0x29192b(0x10c)]}}]))};}export function ensureRemoteSqlContent(_0x53e488){const _0x5991d9=a141_0x9e66;return _0x53e488[_0x5991d9(0x12e)]??'';}export function buildLocalSqlFileContent(_0x1a8bb0,_0x3f1877,_0x4faae2){const _0x3713c7=a141_0x9e66,_0x2be994=_0x4faae2?.['mode']??detectSqlMode(_0x3f1877),_0x33bddc=stripLocalSqlMetadata(_0x3f1877,_0x2be994)[_0x3713c7(0x125)](),_0x4fea9d=[...buildMetadataHeaderLines({'sqlCode':_0x1a8bb0[_0x3713c7(0x110)],'sqlName':_0x1a8bb0[_0x3713c7(0x11b)],'dbId':_0x1a8bb0[_0x3713c7(0x116)],'dbName':_0x4faae2?.[_0x3713c7(0x119)],'mode':_0x2be994,'syncedAt':_0x4faae2?.[_0x3713c7(0x10d)],'description':_0x4faae2?.['description']},_0x2be994),'',_0x33bddc],_0x446c8e=_0x4fea9d[_0x3713c7(0x10f)]('\x0a');return _0x446c8e[_0x3713c7(0x109)]('\x0a')?_0x446c8e:_0x446c8e+'\x0a';}export function stripLocalSqlMetadata(_0x5e7e9d,_0x333ae6){const _0x2f4f47=a141_0x9e66,_0x278784=_0x5e7e9d[_0x2f4f47(0x107)](/\r\n/g,'\x0a')[_0x2f4f47(0x115)]('\x0a'),_0x292ed2=[];let _0x444465=0x0;if(_0x333ae6==='mybatisXml')while(_0x444465<_0x278784[_0x2f4f47(0x114)]){const _0x22c934=_0x278784[_0x444465]??'';if(/^\s*<!--\s*@lovrabet\./[_0x2f4f47(0x105)](_0x22c934)){_0x444465++;continue;}if(_0x22c934['trim']()===''&&_0x444465>0x0){_0x444465++;continue;}break;}else while(_0x444465<_0x278784[_0x2f4f47(0x114)]){const _0x4254aa=_0x278784[_0x444465]??'';if(/^\s*--\s*@lovrabet\./[_0x2f4f47(0x105)](_0x4254aa)){_0x444465++;continue;}if(_0x4254aa[_0x2f4f47(0x125)]()===''&&_0x444465>0x0){_0x444465++;continue;}break;}for(;_0x444465<_0x278784['length'];_0x444465++){_0x292ed2[_0x2f4f47(0x106)](_0x278784[_0x444465]);}return _0x292ed2['join']('\x0a')[_0x2f4f47(0x10e)]();}export function resolveSqlMode(_0x294511,_0x128e06){const _0x5a6f95=a141_0x9e66;if(_0x128e06?.[_0x5a6f95(0x12b)])return _0x128e06['mode'];return detectSqlMode(_0x294511);}export function resolveSqlFileName(_0x349efe,_0x1af83c,_0x1f62a2){const _0x3e1684=a141_0x9e66;if(_0x1f62a2?.[_0x3e1684(0x102)])return _0x1f62a2['path'];if(_0x1f62a2?.[_0x3e1684(0x11b)]||_0x1f62a2?.[_0x3e1684(0x119)])return buildSqlRelativePath(_0x349efe,_0x1f62a2?.[_0x3e1684(0x11b)],_0x1f62a2?.[_0x3e1684(0x119)],resolveSqlMode(_0x1af83c,_0x1f62a2),_0x1f62a2?.[_0x3e1684(0x116)]);return buildDefaultSqlFileName(_0x349efe,resolveSqlMode(_0x1af83c,_0x1f62a2));}function a141_0x9e66(_0x4b9979,_0x329ebc){_0x4b9979=_0x4b9979-0x102;const _0x41d676=a141_0x41d6();let _0x9e66db=_0x41d676[_0x4b9979];return _0x9e66db;}export function resolveSqlLocalDir(_0x43d4c5,_0x46df02){return join(_0x43d4c5,SQL_LOCAL_REL_DIR,_0x46df02);}export async function confirmForceOverwrite(_0x591094){const _0x2a0c1f=a141_0x9e66,_0x49ad05=createInterface({'input':process[_0x2a0c1f(0x11c)],'output':process[_0x2a0c1f(0x11e)]}),_0x1ae37d=await new Promise(_0x45e0c9=>{const _0x27dc35=_0x2a0c1f;_0x49ad05[_0x27dc35(0x123)](_0x591094+_0x27dc35(0x104),_0x45e0c9);});return _0x49ad05[_0x2a0c1f(0x10a)](),['y',_0x2a0c1f(0x122)][_0x2a0c1f(0x130)](_0x1ae37d[_0x2a0c1f(0x125)]()[_0x2a0c1f(0x129)]());}export function findSqlLockScope(_0x2cef85,_0x2eaf9a){const _0x304da3=a141_0x9e66;return _0x2cef85[_0x304da3(0x117)][_0x2eaf9a];}function buildMetadataHeaderLines(_0x16dca5,_0x2775a7){const _0x177279=a141_0x9e66,_0xfbe0f7=[['sqlCode',_0x16dca5[_0x177279(0x110)]],[_0x177279(0x11b),_0x16dca5[_0x177279(0x11b)]],[_0x177279(0x116),_0x16dca5[_0x177279(0x116)]],[_0x177279(0x119),_0x16dca5[_0x177279(0x119)]],[_0x177279(0x12b),_0x16dca5[_0x177279(0x12b)]],['syncedAt',_0x16dca5[_0x177279(0x10d)]],['description',_0x16dca5['description']]];if(_0x2775a7===_0x177279(0x10b))return _0xfbe0f7[_0x177279(0x12c)](([,_0x51ef2d])=>_0x51ef2d!==undefined&&_0x51ef2d!==null&&String(_0x51ef2d)[_0x177279(0x125)]()!=='')[_0x177279(0x112)](([_0x30ecff,_0x12a028])=>'<!--\x20@lovrabet.'+_0x30ecff+':\x20'+String(_0x12a028)+_0x177279(0x12a));return _0xfbe0f7['filter'](([,_0x2ca117])=>_0x2ca117!==undefined&&_0x2ca117!==null&&String(_0x2ca117)[_0x177279(0x125)]()!=='')[_0x177279(0x112)](([_0x1b3fac,_0x4d5a83])=>_0x177279(0x118)+_0x1b3fac+':\x20'+String(_0x4d5a83));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a142_0x3fe289=a142_0x441a;(function(_0x18a9ab,_0x27b6fd){const _0x409d33=a142_0x441a,_0x1d5dca=_0x18a9ab();while(!![]){try{const _0x5afe55=parseInt(_0x409d33(0x194))/0x1*(parseInt(_0x409d33(0x19f))/0x2)+-parseInt(_0x409d33(0x18b))/0x3+parseInt(_0x409d33(0x19b))/0x4*(parseInt(_0x409d33(0x199))/0x5)+parseInt(_0x409d33(0x185))/0x6*(parseInt(_0x409d33(0x196))/0x7)+-parseInt(_0x409d33(0x190))/0x8*(parseInt(_0x409d33(0x188))/0x9)+parseInt(_0x409d33(0x180))/0xa*(-parseInt(_0x409d33(0x182))/0xb)+parseInt(_0x409d33(0x19d))/0xc;if(_0x5afe55===_0x27b6fd)break;else _0x1d5dca['push'](_0x1d5dca['shift']());}catch(_0x3bafe8){_0x1d5dca['push'](_0x1d5dca['shift']());}}}(a142_0x57b5,0xcb344));import{listSqlQueries}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';function a142_0x57b5(){const _0x4bb842=['sqlRoot','4412202teNpmn','bool','\x20remote-only','appCode','sqlName','1073008dhxhhV','Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally','sqlCode','relativePath','7qrNDQz','status','77DrtzhW','Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','map','235TGIAqg','totalCount','98012LscTYv','sqls','7579116nKrucX','\x20modified,\x20','50062FgCTFK','filePath','path','has','boolean','hash','push','remote','tableData','length','122750JdagjM','read','451nHxpnZ','sql','lockFilePath','681960uhVaxH','lockKey','All\x20SQL\x20queries\x20are\x20in\x20sync.','27MVeKCD','\x20added,\x20'];a142_0x57b5=function(){return _0x4bb842;};return a142_0x57b5();}import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile}from'../../core/sql-sync/lock.js';const PAGE_SIZE=0x64;async function fetchAllSqlCodes(_0x547005){const _0x405d00=a142_0x441a,_0xb3f884=[];let _0xab55a4=0x1;while(!![]){const _0x2b68b9=await listSqlQueries(_0x547005,{'currentPage':_0xab55a4,'pageSize':PAGE_SIZE}),_0x43c5cb=_0x2b68b9[_0x405d00(0x17e)]??[];_0xb3f884['push'](..._0x43c5cb[_0x405d00(0x198)](_0x5654c7=>_0x5654c7[_0x405d00(0x192)]));if(_0x43c5cb[_0x405d00(0x17f)]===0x0)break;const _0xabbb6e=_0x2b68b9['paging']?.[_0x405d00(0x19a)];if(_0xabbb6e!=null?_0xb3f884[_0x405d00(0x17f)]>=_0xabbb6e:_0x43c5cb[_0x405d00(0x17f)]<PAGE_SIZE)break;_0xab55a4++;}return _0xb3f884;}function a142_0x441a(_0x3c069e,_0x8eaf3e){_0x3c069e=_0x3c069e-0x17e;const _0x57b5fa=a142_0x57b5();let _0x441a88=_0x57b5fa[_0x3c069e];return _0x441a88;}export const sqlStatus={'service':a142_0x3fe289(0x183),'command':a142_0x3fe289(0x195),'description':a142_0x3fe289(0x197),'risk':a142_0x3fe289(0x181),'flags':[{'name':a142_0x3fe289(0x1a6),'type':a142_0x3fe289(0x1a3),'description':a142_0x3fe289(0x191)}],async 'execute'(_0x4c5f8a){const _0xd2590a=a142_0x3fe289,_0x2092fb=loadSqlProjectConfig(_0x4c5f8a[_0xd2590a(0x18e)]),_0x1474de=await readSqlLockFile(_0x2092fb[_0xd2590a(0x184)]),{appLock:_0x2bcce3}=ensureSqlLockScope(_0x1474de??createEmptySqlLock(),_0x2092fb[_0xd2590a(0x18e)],_0x2092fb[_0xd2590a(0x18a)],'status'),_0x5a94b9=await scanLocalSqlQueries(_0x2092fb),_0x318f30=[],_0x5ee0a6=[],_0x4f8f4e=[],_0x3b8a2b=[],_0x2c3dd7=new Set(_0x5a94b9['map'](_0x4f9235=>_0x4f9235['lockKey']));for(const _0x48718c of _0x5a94b9){const _0x38cfde=await computeSqlFileHash(_0x48718c[_0xd2590a(0x1a0)]),_0x392e08=_0x2bcce3['sqls'][_0x48718c['lockKey']],_0x2ef3ea=!!_0x392e08&&_0x392e08[_0xd2590a(0x1a1)]!==_0x48718c[_0xd2590a(0x193)],_0x1f08df=!!_0x392e08&&!!_0x48718c[_0xd2590a(0x18f)]&&_0x392e08[_0xd2590a(0x18f)]!==_0x48718c[_0xd2590a(0x18f)];if(!_0x392e08)_0x318f30[_0xd2590a(0x1a5)](_0x48718c[_0xd2590a(0x186)]);else _0x392e08[_0xd2590a(0x1a4)]!==_0x38cfde||_0x2ef3ea||_0x1f08df?_0x5ee0a6[_0xd2590a(0x1a5)](_0x48718c['lockKey']):_0x4f8f4e[_0xd2590a(0x1a5)](_0x48718c[_0xd2590a(0x186)]);}for(const _0x223e32 of Object['keys'](_0x2bcce3['sqls'])){!_0x2c3dd7[_0xd2590a(0x1a2)](_0x223e32)&&_0x3b8a2b[_0xd2590a(0x1a5)](_0x223e32);}const _0x27ef05=[];if(_0x4c5f8a[_0xd2590a(0x18c)]('remote')){const _0x377c51=await fetchAllSqlCodes(_0x4c5f8a[_0xd2590a(0x18e)]);for(const _0x44b9d3 of _0x377c51){!_0x2c3dd7[_0xd2590a(0x1a2)](_0x44b9d3)&&!_0x2bcce3[_0xd2590a(0x19c)][_0x44b9d3]&&_0x27ef05[_0xd2590a(0x1a5)](_0x44b9d3);}}const _0x4dfc58=_0x318f30['length']===0x0&&_0x5ee0a6[_0xd2590a(0x17f)]===0x0&&_0x3b8a2b['length']===0x0&&_0x27ef05['length']===0x0;return{'ok':!![],'data':{'added':_0x318f30,'modified':_0x5ee0a6,'missing':_0x3b8a2b,'unchanged':_0x4f8f4e,'remoteOnly':_0x27ef05},'message':_0x4dfc58?_0xd2590a(0x187):_0x318f30[_0xd2590a(0x17f)]+_0xd2590a(0x189)+_0x5ee0a6[_0xd2590a(0x17f)]+_0xd2590a(0x19e)+_0x3b8a2b[_0xd2590a(0x17f)]+'\x20missing,\x20'+_0x4f8f4e[_0xd2590a(0x17f)]+'\x20unchanged'+(_0x27ef05[_0xd2590a(0x17f)]>0x0?',\x20'+_0x27ef05[_0xd2590a(0x17f)]+_0xd2590a(0x18d):'')};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a143_0x39f5a9=a143_0x199e;function a143_0x6cf9(){const _0x49f38a=['reason','isSelectOnly','\x22\x20not\x20found\x20or\x20not\x20accessible','schemas','isDangerous','from','5819473jsNePb','tables','validation','message','Dataset\x20\x22','sql','toLowerCase','1449500trQlXY','73014YcAMwv','88821zVicAt','string','340195IQrZBf','cwd','valid','14IZdfNL','file','614PLmKwY','133uAEMnE','push','size','str','split','name','parameters','SQL\x20schema\x20validation','152BCxscB','60OYgMLy','length','dbtableConfig','utf-8','appCode','Inline\x20SQL\x20content\x20to\x20validate\x20(alternative\x20to\x20--file)','Table\x20\x22','Path\x20to\x20the\x20SQL\x20file\x20to\x20validate','fields','filter','59908QXXdzE','trim','map','File\x20not\x20found:\x20','Validate\x20SQL\x20content\x20without\x20saving\x20(type\x20detection,\x20parameter\x20extraction,\x20optional\x20schema\x20check)','sqlType','tableName'];a143_0x6cf9=function(){return _0x49f38a;};return a143_0x6cf9();}(function(_0x30bbb7,_0x431047){const _0x7181ec=a143_0x199e,_0x3f8864=_0x30bbb7();while(!![]){try{const _0x162bd1=-parseInt(_0x7181ec(0x1eb))/0x1*(-parseInt(_0x7181ec(0x21b))/0x2)+-parseInt(_0x7181ec(0x1f4))/0x3*(-parseInt(_0x7181ec(0x1fe))/0x4)+parseInt(_0x7181ec(0x216))/0x5+parseInt(_0x7181ec(0x213))/0x6*(parseInt(_0x7181ec(0x219))/0x7)+parseInt(_0x7181ec(0x1f3))/0x8*(parseInt(_0x7181ec(0x214))/0x9)+parseInt(_0x7181ec(0x212))/0xa+-parseInt(_0x7181ec(0x20b))/0xb;if(_0x162bd1===_0x431047)break;else _0x3f8864['push'](_0x3f8864['shift']());}catch(_0x9a20cf){_0x3f8864['push'](_0x3f8864['shift']());}}}(a143_0x6cf9,0x39a86));import{readFileSync,existsSync}from'node:fs';import{resolve}from'node:path';import{validateSql}from'../../core/sql-validator.js';function a143_0x199e(_0xb178f4,_0x1fd0b1){_0xb178f4=_0xb178f4-0x1eb;const _0x6cf918=a143_0x6cf9();let _0x199eda=_0x6cf918[_0xb178f4];return _0x199eda;}import{getDatasetDetail,listDatasets}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{assertDatasetIsDbTableBacked,filterDbTableBackedDatasets}from'../../commands/dataset/capability.js';export const sqlValidate={'service':'sql','command':'validate','description':a143_0x39f5a9(0x202),'risk':'read','flags':[{'name':a143_0x39f5a9(0x21a),'type':a143_0x39f5a9(0x215),'description':a143_0x39f5a9(0x1fb)},{'name':a143_0x39f5a9(0x210),'type':'string','description':a143_0x39f5a9(0x1f9)},{'name':a143_0x39f5a9(0x208),'type':a143_0x39f5a9(0x215),'description':'Comma-separated\x20dataset\x20codes\x20to\x20cross-check\x20table/column\x20names\x20against'}],async 'execute'(_0x51f3cf){const _0x4f0664=a143_0x39f5a9,_0x3e83af=_0x51f3cf[_0x4f0664(0x1ee)](_0x4f0664(0x21a)),_0x5f01c4=_0x51f3cf[_0x4f0664(0x1ee)](_0x4f0664(0x210));if(!_0x3e83af&&!_0x5f01c4)throw CliErrors['flagMissing']('file','Provide\x20--file\x20or\x20--sql');let _0x31179f;if(_0x3e83af){const _0x24af4f=resolve(process[_0x4f0664(0x217)](),_0x3e83af);if(!existsSync(_0x24af4f))throw CliErrors[_0x4f0664(0x20d)](_0x4f0664(0x201)+_0x24af4f);_0x31179f=readFileSync(_0x24af4f,_0x4f0664(0x1f7));}else _0x31179f=_0x5f01c4;const _0x2fb28c=validateSql(_0x31179f),_0x27dca5={'valid':_0x2fb28c[_0x4f0664(0x218)],'sqlType':_0x2fb28c[_0x4f0664(0x203)]['type'],'isSelectOnly':_0x2fb28c[_0x4f0664(0x203)][_0x4f0664(0x206)],'isDangerous':_0x2fb28c[_0x4f0664(0x203)][_0x4f0664(0x209)],'tables':_0x2fb28c[_0x4f0664(0x20c)],'parameters':_0x2fb28c[_0x4f0664(0x1f1)],'message':_0x2fb28c[_0x4f0664(0x20e)]};_0x2fb28c['sqlType'][_0x4f0664(0x205)]&&(_0x27dca5[_0x4f0664(0x205)]=_0x2fb28c['sqlType'][_0x4f0664(0x205)]);const _0x4e7f03=_0x51f3cf[_0x4f0664(0x1ee)](_0x4f0664(0x208));if(_0x4e7f03&&_0x2fb28c['valid']){const _0x5cf2b6=_0x4e7f03[_0x4f0664(0x1ef)](',')[_0x4f0664(0x200)](_0x558662=>_0x558662[_0x4f0664(0x1ff)]())[_0x4f0664(0x1fd)](Boolean),_0x17f051=[],_0x4911df=filterDbTableBackedDatasets(await listDatasets(_0x51f3cf[_0x4f0664(0x1f8)])),_0x56d5f7=new Map(_0x4911df['map'](_0x205d9f=>[_0x205d9f[_0x4f0664(0x1f6)]?.[_0x4f0664(0x204)]?.['toLowerCase'](),_0x205d9f]));for(const _0x58dce0 of _0x2fb28c['tables']){const _0x5ac6c8=_0x56d5f7['get'](_0x58dce0[_0x4f0664(0x211)]());!_0x5ac6c8&&_0x17f051[_0x4f0664(0x1ec)](_0x4f0664(0x1fa)+_0x58dce0+'\x22\x20not\x20found\x20in\x20any\x20dataset');}for(const _0x1c442e of _0x5cf2b6){let _0x45a2d9;try{_0x45a2d9=await getDatasetDetail(_0x1c442e);}catch{_0x17f051[_0x4f0664(0x1ec)](_0x4f0664(0x20f)+_0x1c442e+_0x4f0664(0x207));continue;}assertDatasetIsDbTableBacked(_0x45a2d9,_0x4f0664(0x1f2));const _0x566cfe=Array['isArray'](_0x45a2d9['fields'])?_0x45a2d9[_0x4f0664(0x1fc)]:[],_0x4f85c2=new Set(_0x566cfe['map'](_0x415c5a=>_0x415c5a[_0x4f0664(0x1f0)]?.[_0x4f0664(0x211)]())),_0x30b6f8=_0x45a2d9['dbtableConfig']?.['tableName']||_0x45a2d9[_0x4f0664(0x204)]||_0x1c442e;_0x27dca5['schema:'+_0x30b6f8]={'code':_0x1c442e,'tableName':_0x30b6f8,'fieldCount':_0x4f85c2[_0x4f0664(0x1ed)],'fields':Array[_0x4f0664(0x20a)](_0x4f85c2)};}_0x17f051[_0x4f0664(0x1f5)]>0x0&&(_0x27dca5['schemaWarnings']=_0x17f051);}return{'ok':_0x2fb28c[_0x4f0664(0x218)],'data':_0x27dca5,'message':_0x2fb28c[_0x4f0664(0x20e)]};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a144_0x1c4420=a144_0x21a0;(function(_0x4aacc1,_0x1cda1c){const _0x282884=a144_0x21a0,_0x20cd58=_0x4aacc1();while(!![]){try{const _0x490753=-parseInt(_0x282884(0x16c))/0x1*(parseInt(_0x282884(0x16e))/0x2)+parseInt(_0x282884(0x156))/0x3+-parseInt(_0x282884(0x13c))/0x4*(-parseInt(_0x282884(0x161))/0x5)+parseInt(_0x282884(0x155))/0x6+-parseInt(_0x282884(0x158))/0x7+-parseInt(_0x282884(0x167))/0x8*(parseInt(_0x282884(0x143))/0x9)+parseInt(_0x282884(0x16a))/0xa*(parseInt(_0x282884(0x149))/0xb);if(_0x490753===_0x1cda1c)break;else _0x20cd58['push'](_0x20cd58['shift']());}catch(_0x1d9776){_0x20cd58['push'](_0x20cd58['shift']());}}}(a144_0x1f34,0x954f5));import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';import{RABETBASE_ENV_VALUES}from'../../constant/env.js';import{RABETBASE_OUTPUT_FORMAT_VALUES}from'../../constant/output.js';import{RISK_LEVEL_VALUES}from'../../constant/risk.js';import{validateAppcode}from'../../commands/common/validate.js';import{readConfigFile,readRawConfigWithLayers,resolveWriteConfigPath,writeConfigFile}from'../../context.js';const WORKSPACE_USAGE=CLI_BIN_NAME+a144_0x1c4420(0x14c),SAFE_PROFILE_KEYS=[a144_0x1c4420(0x13d),'env','apiDir',a144_0x1c4420(0x139),a144_0x1c4420(0x13f),'riskLevel',a144_0x1c4420(0x15e)],workspaceFlags=[{'name':a144_0x1c4420(0x151),'type':'string','description':a144_0x1c4420(0x13e)},{'name':a144_0x1c4420(0x13d),'type':a144_0x1c4420(0x14d),'description':a144_0x1c4420(0x160)},{'name':a144_0x1c4420(0x13b),'type':a144_0x1c4420(0x14d),'description':a144_0x1c4420(0x150),'enum':[...RABETBASE_ENV_VALUES]},{'name':a144_0x1c4420(0x142),'type':a144_0x1c4420(0x14d),'description':'API\x20directory\x20path\x20for\x20this\x20workspace\x20app\x20profile'},{'name':a144_0x1c4420(0x15c),'type':a144_0x1c4420(0x14d),'description':a144_0x1c4420(0x162),'enum':[...RABETBASE_OUTPUT_FORMAT_VALUES]},{'name':'pageSize','type':'number','description':a144_0x1c4420(0x141)},{'name':a144_0x1c4420(0x163),'type':a144_0x1c4420(0x14d),'description':'Risk\x20level\x20for\x20this\x20workspace\x20app\x20profile','enum':[...RISK_LEVEL_VALUES]},{'name':a144_0x1c4420(0x15e),'type':'string','description':'Locale\x20for\x20this\x20workspace\x20app\x20profile'}];function a144_0x1f34(){const _0x48be96=['\x20workspace\x20init\x20--appcode\x20<code>`\x20or\x20`','\x20--appcode\x20<code>`.','1800euwyhx','validation','Invalid\x20appcode:\x20','40lrmFXi','keys','31ZjLlDc','Pass\x20--appcode\x20<code>,\x20or\x20choose\x20one\x20of:\x20','69682NZUUJq','globalConfig','.\x20Credentials:\x20not\x20written.','format','workspace','env','34564THoCaV','appcode','App\x20profile\x20name\x20to\x20use\x20in\x20this\x20workspace','pageSize','apps','Default\x20page\x20size\x20for\x20this\x20workspace\x20app\x20profile','apiDir','16578MAbHAP','\x20(appcode:\x20','initialized','use','init','isArray','1047937JveGdy','project','App\x20\x22','\x20workspace\x20<init|use>\x20--app\x20<name>\x20[--appcode\x20<code>]','string','updated','str','Target\x20environment','app','\x20workspace\x20use\x20--app\x20<name>`.','\x20workspace\x20','Switch\x20the\x20current\x20workspace\x20app\x20binding','4392054kkBlUj','2240781jxuVIb','Workspace\x20','1241233LseSuf','workspace.','Initialize\x20the\x20current\x20workspace\x20app\x20binding','trim','defaultFormat','write','locale','join','App\x20code\x20to\x20bind\x20to\x20this\x20workspace','245iPTwkP','Default\x20output\x20format\x20for\x20this\x20workspace\x20app\x20profile','riskLevel','Use\x20`'];a144_0x1f34=function(){return _0x48be96;};return a144_0x1f34();}function isRecord(_0x2e8257){const _0x205d71=a144_0x1c4420;return!!_0x2e8257&&typeof _0x2e8257==='object'&&!Array[_0x205d71(0x148)](_0x2e8257);}function assertValidAppcode(_0x3c82eb){const _0x53ebb5=a144_0x1c4420,{valid:_0x1b25da,message:_0x390230}=validateAppcode(_0x3c82eb);if(!_0x1b25da)throw CliErrors[_0x53ebb5(0x168)](_0x53ebb5(0x169)+_0x3c82eb,_0x390230);}function sanitizeProfile(_0x48cbf1){if(!isRecord(_0x48cbf1))return{};const _0xec2048={};for(const _0xb1941a of SAFE_PROFILE_KEYS){if(_0x48cbf1[_0xb1941a]!==undefined)_0xec2048[_0xb1941a]=_0x48cbf1[_0xb1941a];}return _0xec2048;}function cloneProfile(_0x2dbef9){return isRecord(_0x2dbef9)?{..._0x2dbef9}:{};}function collectWorkspaceProfileOverrides(_0x4ffa3a){const _0x2ffc59=a144_0x1c4420,_0x2dd984={},_0x26070d=_0x4ffa3a['str'](_0x2ffc59(0x13b)),_0x11fee3=_0x4ffa3a[_0x2ffc59(0x14f)]('apiDir'),_0x139dba=_0x4ffa3a[_0x2ffc59(0x14f)](_0x2ffc59(0x15c)),_0x2e2fbb=_0x4ffa3a['flag'](_0x2ffc59(0x13f)),_0x4ed2e4=_0x4ffa3a[_0x2ffc59(0x14f)](_0x2ffc59(0x163)),_0x54c7dc=_0x4ffa3a['str'](_0x2ffc59(0x15e));if(_0x26070d)_0x2dd984[_0x2ffc59(0x13b)]=_0x26070d;if(_0x11fee3)_0x2dd984[_0x2ffc59(0x142)]=_0x11fee3;if(_0x139dba)_0x2dd984['format']=_0x139dba;if(_0x2e2fbb!==undefined&&_0x2e2fbb!=='')_0x2dd984[_0x2ffc59(0x13f)]=Number(_0x2e2fbb);if(_0x4ed2e4)_0x2dd984[_0x2ffc59(0x163)]=_0x4ed2e4;if(_0x54c7dc)_0x2dd984[_0x2ffc59(0x15e)]=_0x54c7dc;return _0x2dd984;}function a144_0x21a0(_0x5336fe,_0x4cb0e8){_0x5336fe=_0x5336fe-0x139;const _0x1f34ef=a144_0x1f34();let _0x21a02d=_0x1f34ef[_0x5336fe];return _0x21a02d;}async function validateWorkspaceArgs(_0x121552){const _0x9d0876=a144_0x1c4420,_0x586a2e=_0x121552[_0x9d0876(0x14f)](_0x9d0876(0x151))[_0x9d0876(0x15b)](),_0x5678a0=_0x121552[_0x9d0876(0x14f)](_0x9d0876(0x13d))[_0x9d0876(0x15b)]();if(!_0x586a2e&&!_0x5678a0)throw CliErrors[_0x9d0876(0x168)]('Missing\x20workspace\x20app\x20selector.','Use\x20`'+CLI_BIN_NAME+_0x9d0876(0x165)+CLI_BIN_NAME+_0x9d0876(0x152));if(_0x5678a0)assertValidAppcode(_0x5678a0);}function resolveKnownApps(){const _0x4dcf03=a144_0x1c4420,{config:_0xffac37,layers:_0x11927a}=readRawConfigWithLayers(),_0xd1ca96=isRecord(_0xffac37[_0x4dcf03(0x140)])?_0xffac37[_0x4dcf03(0x140)]:{},_0x4f906e=isRecord(_0x11927a[_0x4dcf03(0x16f)][_0x4dcf03(0x140)])?_0x11927a[_0x4dcf03(0x16f)]['apps']:{};return{..._0x4f906e,..._0xd1ca96};}async function configureWorkspace(_0x4f7b05,_0x119594){const _0x45fefa=a144_0x1c4420,_0x32559c=_0x4f7b05['str'](_0x45fefa(0x151))[_0x45fefa(0x15b)](),_0x939752=_0x4f7b05[_0x45fefa(0x14f)](_0x45fefa(0x13d))['trim'](),_0x828e41=_0x32559c||_0x939752;if(!_0x828e41)throw CliErrors['validation']('Missing\x20workspace\x20app\x20selector.',_0x45fefa(0x164)+CLI_BIN_NAME+_0x45fefa(0x165)+CLI_BIN_NAME+_0x45fefa(0x152));if(_0x939752)assertValidAppcode(_0x939752);const _0x5980e4=resolveWriteConfigPath(_0x45fefa(0x14a)),_0x3b6bd7=readConfigFile(_0x5980e4),_0x243e96=resolveKnownApps(),_0x2dcef4=isRecord(_0x3b6bd7[_0x45fefa(0x140)])?{..._0x3b6bd7[_0x45fefa(0x140)]}:{},_0x3a2f80=cloneProfile(_0x2dcef4[_0x828e41]),_0x2db419=sanitizeProfile(_0x243e96[_0x828e41]),_0x4ed331=_0x939752?{}:_0x2db419,_0x4733a7=_0x939752||_0x4ed331[_0x45fefa(0x13d)];if(!_0x4733a7){const _0x21ef50=Object[_0x45fefa(0x16b)](_0x243e96),_0xf20b5f=_0x21ef50['length']===0x0?_0x45fefa(0x164)+CLI_BIN_NAME+_0x45fefa(0x153)+_0x119594+'\x20--app\x20'+_0x828e41+_0x45fefa(0x166):_0x45fefa(0x16d)+_0x21ef50[_0x45fefa(0x15f)](',\x20');throw CliErrors[_0x45fefa(0x168)](_0x45fefa(0x14b)+_0x828e41+'\x22\x20not\x20found.',_0xf20b5f);}assertValidAppcode(String(_0x4733a7));const _0x34d4fc={..._0x4ed331,..._0x3a2f80,'appcode':String(_0x4733a7),...collectWorkspaceProfileOverrides(_0x4f7b05)};return _0x2dcef4[_0x828e41]=_0x34d4fc,_0x3b6bd7[_0x45fefa(0x140)]=_0x2dcef4,_0x3b6bd7['defaultApp']=_0x828e41,delete _0x3b6bd7['appcode'],delete _0x3b6bd7[_0x45fefa(0x151)],_0x34d4fc[_0x45fefa(0x13b)]&&(_0x3b6bd7[_0x45fefa(0x13b)]=_0x34d4fc[_0x45fefa(0x13b)]),writeConfigFile(_0x5980e4,_0x3b6bd7),{'ok':!![],'message':_0x45fefa(0x157)+(_0x119594===_0x45fefa(0x147)?_0x45fefa(0x145):_0x45fefa(0x14e))+':\x20'+_0x828e41+_0x45fefa(0x144)+_0x34d4fc[_0x45fefa(0x13d)]+').\x20Config:\x20'+_0x5980e4+_0x45fefa(0x170),'data':{'operation':_0x45fefa(0x159)+_0x119594,'configPath':_0x5980e4,'app':_0x828e41,'appcode':_0x34d4fc[_0x45fefa(0x13d)],'env':_0x34d4fc['env']??null,'credentialsWritten':![]}};}const workspaceInitDefinition={'service':a144_0x1c4420(0x13a),'command':a144_0x1c4420(0x147),'description':a144_0x1c4420(0x15a),'risk':a144_0x1c4420(0x15d),'requiresAuth':![],'requiresAppCode':![],'args':[],'flags':workspaceFlags,'validate':validateWorkspaceArgs,'execute':_0xae4aa6=>configureWorkspace(_0xae4aa6,a144_0x1c4420(0x147))},workspaceUseDefinition={'service':a144_0x1c4420(0x13a),'command':'use','description':a144_0x1c4420(0x154),'risk':a144_0x1c4420(0x15d),'requiresAuth':![],'requiresAppCode':![],'args':[],'flags':workspaceFlags,'validate':validateWorkspaceArgs,'execute':_0x3a4597=>configureWorkspace(_0x3a4597,a144_0x1c4420(0x146))};export const workspaceDefinitions=[workspaceInitDefinition,workspaceUseDefinition];export{WORKSPACE_USAGE};
|
package/lib/config/schema.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a145_0x63f95f=a145_0x377a;(function(_0x38ae66,_0x5dbad6){const _0xc06a6a=a145_0x377a,_0x58b9b2=_0x38ae66();while(!![]){try{const _0x7497cb=-parseInt(_0xc06a6a(0xc1))/0x1+-parseInt(_0xc06a6a(0xc0))/0x2+parseInt(_0xc06a6a(0xaa))/0x3+-parseInt(_0xc06a6a(0xbf))/0x4*(-parseInt(_0xc06a6a(0xab))/0x5)+-parseInt(_0xc06a6a(0xb9))/0x6*(parseInt(_0xc06a6a(0xb0))/0x7)+-parseInt(_0xc06a6a(0xc4))/0x8+-parseInt(_0xc06a6a(0xcd))/0x9*(-parseInt(_0xc06a6a(0xc3))/0xa);if(_0x7497cb===_0x5dbad6)break;else _0x58b9b2['push'](_0x58b9b2['shift']());}catch(_0x1bd1ef){_0x58b9b2['push'](_0x58b9b2['shift']());}}}(a145_0x4dec,0xb5037));import{DEFAULT_CONFIG_VALUES}from'../constant/defaults.js';import{RABETBASE_ENV_VALUES}from'../constant/env.js';import{RABETBASE_OUTPUT_FORMAT_VALUES}from'../constant/output.js';import{RISK_LEVEL_VALUES}from'../constant/risk.js';export{DEFAULT_CONFIG_VALUES}from'../constant/defaults.js';export const PROJECT_CREATE_INHERITABLE_KEYS=['cookie',a145_0x63f95f(0xcf),'locale','format',a145_0x63f95f(0xb6)];function a145_0x4dec(){const _0x2df847=['2084apnsXF','2635502SPUzbz','76334tdLLZQ','number','28830qdsloU','4487792uDhAMC','pageSize','string','apiDir','entries','app','en-US','keys','Default\x20page\x20size','7983fuiYwR','inherit','accessKey','cookie','appcode','apps','496488akjooH','12195FZAuPF','length','defaultFormat','Auth\x20cookie','trim','98jEsLox','Target\x20environment','toLowerCase','locale','Risk\x20level','zh-CN','riskLevel','env','map','555834eRuyCf','Default\x20output\x20format\x20for\x20this\x20app\x20(profile)','join','filter','defaultApp','Config\x20key\x20('];a145_0x4dec=function(){return _0x2df847;};return a145_0x4dec();}export const TOP_LEVEL_CONFIG_KEYS=new Set([a145_0x63f95f(0xd1),a145_0x63f95f(0xb7),a145_0x63f95f(0xb3),'format','cookie',a145_0x63f95f(0xcf),a145_0x63f95f(0xc7)]);export const CONFIG_ENUM_VALUES={'env':[...RABETBASE_ENV_VALUES],'format':[...RABETBASE_OUTPUT_FORMAT_VALUES]};export function formatConfigKeyList(_0x525e86){const _0x51fba0=a145_0x63f95f;return[..._0x525e86][_0x51fba0(0xbb)](',\x20');}export function getTopLevelConfigKeyList(){return[...TOP_LEVEL_CONFIG_KEYS];}export function isTopLevelConfigKey(_0xa7b7f5){return TOP_LEVEL_CONFIG_KEYS['has'](_0xa7b7f5);}export function getTopLevelConfigKeySummary(){return formatConfigKeyList(getTopLevelConfigKeyList());}export function getConfigCommandKeyDescription(){const _0x594c95=a145_0x63f95f;return _0x594c95(0xbe)+getTopLevelConfigKeySummary()+')';}export const APP_PROFILE_FLAG_KEY_MAP={'env':a145_0x63f95f(0xb7),'apiDir':a145_0x63f95f(0xc7),'cookie':a145_0x63f95f(0xd0),'accessKey':a145_0x63f95f(0xcf),'defaultFormat':'format','pageSize':a145_0x63f95f(0xc5),'riskLevel':'riskLevel','locale':a145_0x63f95f(0xb3)};export function getAppProfileFlagDefs(){const _0x554497=a145_0x63f95f;return[{'name':_0x554497(0xb7),'type':_0x554497(0xc6),'description':_0x554497(0xb1),'enum':[...RABETBASE_ENV_VALUES]},{'name':_0x554497(0xc7),'type':'string','description':'API\x20directory\x20path'},{'name':_0x554497(0xd0),'type':_0x554497(0xc6),'description':_0x554497(0xae),'hidden':!![]},{'name':_0x554497(0xcf),'type':_0x554497(0xc6),'description':'Access\x20key','hidden':!![]},{'name':_0x554497(0xad),'type':_0x554497(0xc6),'description':_0x554497(0xba),'enum':[...RABETBASE_OUTPUT_FORMAT_VALUES]},{'name':_0x554497(0xc5),'type':_0x554497(0xc2),'description':_0x554497(0xcc)},{'name':_0x554497(0xb6),'type':'string','description':_0x554497(0xb4),'enum':[...RISK_LEVEL_VALUES]},{'name':_0x554497(0xb3),'type':_0x554497(0xc6),'description':'Locale'}];}export function collectAppProfileOverrides(_0x201ea0){const _0x4fa326=a145_0x63f95f,_0x153b00={};for(const [_0x2ffad1,_0x1fbe31]of Object[_0x4fa326(0xc8)](APP_PROFILE_FLAG_KEY_MAP)){const _0x16348b=_0x201ea0(_0x2ffad1);if(!_0x16348b)continue;_0x153b00[_0x1fbe31]=_0x1fbe31===_0x4fa326(0xc5)?Number(_0x16348b):_0x16348b;}return _0x153b00;}export function buildAppProfileListFields(_0x45c8c6){const _0xe143d5=a145_0x63f95f;return{'env':_0x45c8c6[_0xe143d5(0xb7)]??null,'apiDir':_0x45c8c6[_0xe143d5(0xc7)]??null,'hasCookie':!!_0x45c8c6[_0xe143d5(0xd0)],'hasAccessKey':!!_0x45c8c6['accessKey'],'format':_0x45c8c6['format']??null,'pageSize':_0x45c8c6[_0xe143d5(0xc5)]??null,'riskLevel':_0x45c8c6[_0xe143d5(0xb6)]??null,'locale':_0x45c8c6['locale']??null};}export function buildAppDoctorFields(_0x319704,_0x1507ae){const _0x4fdf98=a145_0x63f95f;return{'env':{'value':_0x319704[_0x4fdf98(0xb7)]||_0x1507ae[_0x4fdf98(0xb7)],'source':_0x319704[_0x4fdf98(0xb7)]?_0x4fdf98(0xc9):_0x4fdf98(0xce)},'apiDir':{'value':_0x319704[_0x4fdf98(0xc7)]||_0x1507ae[_0x4fdf98(0xc7)],'source':_0x319704[_0x4fdf98(0xc7)]?_0x4fdf98(0xc9):_0x4fdf98(0xce)},'cookie':{'value':_0x319704[_0x4fdf98(0xd0)]||_0x1507ae[_0x4fdf98(0xd0)],'source':_0x319704[_0x4fdf98(0xd0)]?_0x4fdf98(0xc9):_0x4fdf98(0xce)},'accessKey':{'value':_0x319704['accessKey']||_0x1507ae[_0x4fdf98(0xcf)],'source':_0x319704[_0x4fdf98(0xcf)]?'app':_0x4fdf98(0xce)}};}export function buildCanonicalAppConfig(_0xd29839,_0x423848){const _0x32d52c=a145_0x63f95f,_0x43f844=_0xd29839[_0x32d52c(0xb8)](_0x1a3da5=>String(_0x1a3da5||'')[_0x32d52c(0xaf)]())[_0x32d52c(0xbc)](Boolean);if(_0x43f844[_0x32d52c(0xac)]===0x0)return{};const _0x1409ab={};for(const _0x5ee891 of _0x43f844){_0x1409ab[_0x5ee891]=_0x423848?{'appcode':_0x5ee891,'env':_0x423848}:{'appcode':_0x5ee891};}return{'apps':_0x1409ab,'defaultApp':_0x43f844[0x0]};}export function buildCanonicalProjectConfig(_0x5369f0,_0x52f712){const _0x3d8f75=a145_0x63f95f,{appCodes:appCodes=[],env:_0x1e18b3,metadata:_0x3db444}=_0x52f712,_0x48f647={..._0x5369f0,..._0x3db444||{}};delete _0x48f647[_0x3d8f75(0xd1)],delete _0x48f647[_0x3d8f75(0xc9)];if(_0x1e18b3)_0x48f647[_0x3d8f75(0xb7)]=_0x1e18b3;else!_0x48f647[_0x3d8f75(0xb7)]&&(_0x48f647[_0x3d8f75(0xb7)]=DEFAULT_CONFIG_VALUES[_0x3d8f75(0xb7)]);const _0x7dc623=buildCanonicalAppConfig(appCodes,_0x48f647[_0x3d8f75(0xb7)]);return Object[_0x3d8f75(0xcb)](_0x7dc623)[_0x3d8f75(0xac)]>0x0&&(_0x48f647[_0x3d8f75(0xa9)]=_0x7dc623[_0x3d8f75(0xa9)],_0x48f647[_0x3d8f75(0xbd)]=_0x7dc623[_0x3d8f75(0xbd)]),_0x48f647;}const LOCALE_MAP={'zh':a145_0x63f95f(0xb5),'zh-cn':a145_0x63f95f(0xb5),'zh_cn':a145_0x63f95f(0xb5),'en':a145_0x63f95f(0xca),'en-us':a145_0x63f95f(0xca),'en_us':a145_0x63f95f(0xca)};function a145_0x377a(_0x45e9af,_0xa4e746){_0x45e9af=_0x45e9af-0xa9;const _0x4dece0=a145_0x4dec();let _0x377a63=_0x4dece0[_0x45e9af];return _0x377a63;}export function normalizeLocale(_0x2c193e){const _0x5eeea5=a145_0x63f95f;if(!_0x2c193e)return null;return LOCALE_MAP[_0x2c193e[_0x5eeea5(0xb2)]()]??null;}
|
package/lib/constant/cdn.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a146_0x30d0(){const _0x1fb2c1=['1352320jUXwOA','1165053oAhFRf','2307239lDyItg','3663OpFLkG','21395881KIcqSw','6TrlJUV','4ivovNT','12HiaBcn','1328018oZfBtm','1307467ATMaZB','10ViOAqa','1SiSMNJ','10544XfqKsc'];a146_0x30d0=function(){return _0x1fb2c1;};return a146_0x30d0();}function a146_0x3e1b(_0x5586ab,_0x3bc52f){_0x5586ab=_0x5586ab-0xf0;const _0x30d0be=a146_0x30d0();let _0x3e1bbc=_0x30d0be[_0x5586ab];return _0x3e1bbc;}(function(_0x4edac1,_0x29f33b){const _0x556dc6=a146_0x3e1b,_0x4524c6=_0x4edac1();while(!![]){try{const _0x39116c=-parseInt(_0x556dc6(0xf0))/0x1*(parseInt(_0x556dc6(0xfa))/0x2)+-parseInt(_0x556dc6(0xf3))/0x3*(parseInt(_0x556dc6(0xf8))/0x4)+parseInt(_0x556dc6(0xf2))/0x5+parseInt(_0x556dc6(0xf7))/0x6*(-parseInt(_0x556dc6(0xfb))/0x7)+-parseInt(_0x556dc6(0xf1))/0x8*(parseInt(_0x556dc6(0xf5))/0x9)+-parseInt(_0x556dc6(0xfc))/0xa*(-parseInt(_0x556dc6(0xf4))/0xb)+-parseInt(_0x556dc6(0xf9))/0xc*(-parseInt(_0x556dc6(0xf6))/0xd);if(_0x39116c===_0x29f33b)break;else _0x4524c6['push'](_0x4524c6['shift']());}catch(_0x4e9346){_0x4524c6['push'](_0x4524c6['shift']());}}}(a146_0x30d0,0x55913));export const CLI_VERSION_POLICY_URL='https://g.lovrabet.com/dist/rabetbase-cli/config/index.json';
|
package/lib/constant/cli.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a147_0x715b0=a147_0x53d5;(function(_0x1707e9,_0x697e33){const _0xec7dee=a147_0x53d5,_0x511a55=_0x1707e9();while(!![]){try{const _0x354c4d=-parseInt(_0xec7dee(0xf1))/0x1*(parseInt(_0xec7dee(0x138))/0x2)+-parseInt(_0xec7dee(0xf2))/0x3*(parseInt(_0xec7dee(0x111))/0x4)+-parseInt(_0xec7dee(0x128))/0x5+-parseInt(_0xec7dee(0xff))/0x6+-parseInt(_0xec7dee(0x10a))/0x7+-parseInt(_0xec7dee(0xfd))/0x8+parseInt(_0xec7dee(0xe6))/0x9;if(_0x354c4d===_0x697e33)break;else _0x511a55['push'](_0x511a55['shift']());}catch(_0x2b6c9e){_0x511a55['push'](_0x511a55['shift']());}}}(a147_0x51d5,0xd30cd));export const CLI_BIN_NAME=a147_0x715b0(0x11f);export const CLI_DISPLAY_NAME=a147_0x715b0(0x147);export const NPM_PACKAGE_NAME='@lovrabet/rabetbase-cli';function a147_0x53d5(_0x5d217e,_0xc9d31b){_0x5d217e=_0x5d217e-0xe2;const _0x51d59a=a147_0x51d5();let _0x53d5a0=_0x51d59a[_0x5d217e];return _0x53d5a0;}function a147_0x51d5(){const _0x35f5fb=['Schemas','dbId','sqlname','DB\x20ID','value','project','Override\x20appcode','sqlName','description-file','479928ZHpBAF','env','name','file','enableBffSave','non-interactive','functionNode','enable-bff-save','tags','target','sql','production\x20|\x20daily','global','code','meowKey','Rabetbase\x20CLI','all','Description\x20file','json\x20|\x20pretty\x20|\x20compress','keyword','reveal','Use\x20remote','output','Title','app','fromEntries','Verbose\x20output','SQL\x20string','46192455olfSug','clear','Force\x20overwrite','stdin','string','nonInteractive','expected-count','Preview\x20operation\x20without\x20executing','sql-name','Show\x20help','Enable\x20BFF\x20save','1smBfRh','3fsXnfS','<expr>','Page\x20number','Function\x20node','params','schemas','<code>','operation','from-env','verbose','pagesize','4288696uefTyk','help','1648062szdAdL','key','Dataset\x20code','dry-run','boolean','page','fromEnv','db-id','expectedCount','Type\x20filter','appcode','1747578ddgtXi','watch','SQL\x20code','Page\x20size','dbid','Skip\x20confirmation\x20for\x20high-risk\x20writes','Confirm\x20destructive\x20action','5152492UEMsqi','yes','descriptionFile','description','Force\x20non-interactive\x20mode\x20(CI)','datasetcode','Use\x20project\x20config\x20scope','confirm','<name>','Reveal\x20sensitive\x20value','Record\x20ID','Read\x20value\x20from\x20stdin','JSON\x20params','Keyword\x20filter','rabetbase','remote','sqlcode','Tags','SQL\x20name','skipImports','Output\x20path','Description','Read\x20value\x20from\x20environment\x20variable','8397645sAlrGY','Config\x20value','Operation\x20type','type','format','Skip\x20import\x20generation','File\x20path'];a147_0x51d5=function(){return _0x35f5fb;};return a147_0x51d5();}export const GLOBAL_FLAGS=[{'name':a147_0x715b0(0x109),'meowKey':a147_0x715b0(0x109),'type':a147_0x715b0(0xea),'description':a147_0x715b0(0x135),'hint':a147_0x715b0(0xf8)},{'name':a147_0x715b0(0xe2),'meowKey':a147_0x715b0(0xe2),'type':a147_0x715b0(0xea),'description':'Select\x20app\x20profile\x20by\x20name','hint':a147_0x715b0(0x119)},{'name':a147_0x715b0(0x139),'meowKey':'env','type':a147_0x715b0(0xea),'description':'Environment','hint':a147_0x715b0(0x143)},{'name':a147_0x715b0(0x12c),'meowKey':a147_0x715b0(0x12c),'type':'string','description':'Output\x20format','hint':a147_0x715b0(0x14a)},{'name':'jq','meowKey':'jq','type':a147_0x715b0(0xea),'description':'Filter\x20JSON\x20output\x20(JQ_PATH\x20>\x20bundled\x20jq\x20>\x20PATH;\x20use\x20with\x20--format\x20json\x20or\x20compress)','hint':a147_0x715b0(0xf3)},{'name':a147_0x715b0(0x102),'meowKey':'dryRun','type':'boolean','description':a147_0x715b0(0xed)},{'name':a147_0x715b0(0x112),'meowKey':a147_0x715b0(0x112),'type':a147_0x715b0(0x103),'description':a147_0x715b0(0x10f)},{'name':'non-interactive','meowKey':a147_0x715b0(0xeb),'type':a147_0x715b0(0x103),'description':a147_0x715b0(0x115)},{'name':a147_0x715b0(0x144),'meowKey':a147_0x715b0(0x144),'type':a147_0x715b0(0x103),'description':'Use\x20global\x20config\x20scope'},{'name':a147_0x715b0(0x134),'meowKey':a147_0x715b0(0x134),'type':'boolean','description':a147_0x715b0(0x117)},{'name':'ci','meowKey':'ci','type':a147_0x715b0(0x103),'description':'Alias\x20for\x20--non-interactive','hidden':!![]},{'name':a147_0x715b0(0xfe),'meowKey':'help','type':'boolean','description':a147_0x715b0(0xef)},{'name':'name','meowKey':a147_0x715b0(0x13a),'type':a147_0x715b0(0xea),'description':'Name','hidden':!![]},{'name':'title','meowKey':'title','type':a147_0x715b0(0xea),'description':a147_0x715b0(0x14f),'hidden':!![]},{'name':a147_0x715b0(0xe7),'meowKey':a147_0x715b0(0xe7),'type':'boolean','description':'Clear','hidden':!![]},{'name':a147_0x715b0(0x10b),'meowKey':'watch','type':a147_0x715b0(0x103),'description':'Watch\x20mode','hidden':!![]},{'name':a147_0x715b0(0x14e),'meowKey':a147_0x715b0(0x14e),'type':a147_0x715b0(0xea),'description':a147_0x715b0(0x125),'hidden':!![]},{'name':a147_0x715b0(0xf6),'meowKey':a147_0x715b0(0xf6),'type':a147_0x715b0(0xea),'description':a147_0x715b0(0x11d),'hidden':!![]},{'name':a147_0x715b0(0x116),'meowKey':a147_0x715b0(0x116),'type':a147_0x715b0(0xea),'description':a147_0x715b0(0x101),'hidden':!![]},{'name':a147_0x715b0(0x148),'meowKey':a147_0x715b0(0x148),'type':a147_0x715b0(0x103),'description':'Apply\x20to\x20all','hidden':!![]},{'name':a147_0x715b0(0x13f),'meowKey':a147_0x715b0(0x13c),'type':'boolean','description':a147_0x715b0(0xf0),'hidden':!![]},{'name':'id','meowKey':'id','type':'string','description':a147_0x715b0(0x11b),'hidden':!![]},{'name':a147_0x715b0(0x12b),'meowKey':a147_0x715b0(0x12b),'type':'string','description':a147_0x715b0(0x108),'hidden':!![]},{'name':a147_0x715b0(0x13b),'meowKey':a147_0x715b0(0x13b),'type':'string','description':a147_0x715b0(0x12e),'hidden':!![]},{'name':a147_0x715b0(0x121),'meowKey':a147_0x715b0(0x121),'type':a147_0x715b0(0xea),'description':a147_0x715b0(0x10c),'hidden':!![]},{'name':a147_0x715b0(0xee),'meowKey':a147_0x715b0(0x136),'type':'string','description':'SQL\x20name','hidden':!![]},{'name':a147_0x715b0(0x131),'meowKey':a147_0x715b0(0x131),'type':'string','description':a147_0x715b0(0x123),'hidden':!![]},{'name':a147_0x715b0(0x106),'meowKey':a147_0x715b0(0x130),'type':a147_0x715b0(0xea),'description':a147_0x715b0(0x132),'hidden':!![]},{'name':a147_0x715b0(0x10e),'meowKey':'dbid','type':a147_0x715b0(0xea),'description':a147_0x715b0(0x132),'hidden':!![]},{'name':a147_0x715b0(0x114),'meowKey':a147_0x715b0(0x114),'type':a147_0x715b0(0xea),'description':a147_0x715b0(0x126),'hidden':!![]},{'name':a147_0x715b0(0x137),'meowKey':a147_0x715b0(0x113),'type':a147_0x715b0(0xea),'description':a147_0x715b0(0x149),'hidden':!![]},{'name':a147_0x715b0(0x104),'meowKey':a147_0x715b0(0x104),'type':a147_0x715b0(0xea),'description':a147_0x715b0(0xf4),'hidden':!![]},{'name':a147_0x715b0(0xfc),'meowKey':a147_0x715b0(0xfc),'type':'string','description':a147_0x715b0(0x10d),'hidden':!![]},{'name':'keyword','meowKey':a147_0x715b0(0x14b),'type':a147_0x715b0(0xea),'description':a147_0x715b0(0x11e),'hidden':!![]},{'name':a147_0x715b0(0x145),'meowKey':a147_0x715b0(0x145),'type':a147_0x715b0(0xea),'description':'Code\x20filter','hidden':!![]},{'name':a147_0x715b0(0x142),'meowKey':a147_0x715b0(0x142),'type':a147_0x715b0(0xea),'description':a147_0x715b0(0xe5),'hidden':!![]},{'name':a147_0x715b0(0xf7),'meowKey':'schemas','type':a147_0x715b0(0xea),'description':a147_0x715b0(0x12f),'hidden':!![]},{'name':a147_0x715b0(0xf9),'meowKey':a147_0x715b0(0xf9),'type':a147_0x715b0(0xea),'description':a147_0x715b0(0x12a),'hidden':!![]},{'name':a147_0x715b0(0x141),'meowKey':a147_0x715b0(0x141),'type':a147_0x715b0(0xea),'description':'Target\x20path','hidden':!![]},{'name':'skip-imports','meowKey':a147_0x715b0(0x124),'type':a147_0x715b0(0x103),'description':a147_0x715b0(0x12d),'hidden':!![]},{'name':a147_0x715b0(0x100),'meowKey':a147_0x715b0(0x100),'type':'string','description':'Config\x20key','hidden':!![]},{'name':a147_0x715b0(0x133),'meowKey':a147_0x715b0(0x133),'type':'string','description':a147_0x715b0(0x129),'hidden':!![]},{'name':a147_0x715b0(0x140),'meowKey':'tags','type':'string','description':a147_0x715b0(0x122),'hidden':!![]},{'name':a147_0x715b0(0xe9),'meowKey':a147_0x715b0(0xe9),'type':'boolean','description':a147_0x715b0(0x11c),'hidden':!![]},{'name':a147_0x715b0(0xfa),'meowKey':a147_0x715b0(0x105),'type':a147_0x715b0(0xea),'description':a147_0x715b0(0x127),'hidden':!![]},{'name':a147_0x715b0(0x14c),'meowKey':'reveal','type':a147_0x715b0(0x103),'description':a147_0x715b0(0x11a),'hidden':!![]},{'name':'force','meowKey':'force','type':a147_0x715b0(0x103),'description':a147_0x715b0(0xe8),'hidden':!![]},{'name':a147_0x715b0(0x118),'meowKey':a147_0x715b0(0x118),'type':a147_0x715b0(0x103),'description':a147_0x715b0(0x110),'hidden':!![]},{'name':a147_0x715b0(0x120),'meowKey':'remote','type':a147_0x715b0(0x103),'description':a147_0x715b0(0x14d),'hidden':!![]},{'name':a147_0x715b0(0xfb),'meowKey':'verbose','type':a147_0x715b0(0x103),'description':a147_0x715b0(0xe4),'hidden':!![]},{'name':a147_0x715b0(0xec),'meowKey':a147_0x715b0(0x107),'type':a147_0x715b0(0xea),'description':'Expected\x20affected\x20count','hidden':!![]},{'name':'operation-type','meowKey':'operationType','type':'string','description':'Operation\x20type','hidden':!![]},{'name':'function-node','meowKey':a147_0x715b0(0x13e),'type':a147_0x715b0(0xea),'description':a147_0x715b0(0xf5),'hidden':!![]}];export const PIPELINE_FLAG_NAMES=new Set(['appcode',a147_0x715b0(0xe2),a147_0x715b0(0x139),a147_0x715b0(0x12c),'jq',a147_0x715b0(0x102),a147_0x715b0(0x112),a147_0x715b0(0x13d),'ci']);export function buildMeowFlags(){const _0xb13fe8=a147_0x715b0;return Object[_0xb13fe8(0xe3)](GLOBAL_FLAGS['map'](_0x543a85=>[_0x543a85[_0xb13fe8(0x146)],{'type':_0x543a85[_0xb13fe8(0x12b)]}]));}
|
package/lib/constant/defaults.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a148_0x4eb3cd=a148_0x4b82;function a148_0x4b82(_0x4641b7,_0x5c7134){_0x4641b7=_0x4641b7-0x166;const _0x4a4e6c=a148_0x4a4e();let _0x4b82ca=_0x4a4e6c[_0x4641b7];return _0x4b82ca;}(function(_0x11a085,_0x324052){const _0x509437=a148_0x4b82,_0x325396=_0x11a085();while(!![]){try{const _0x5e2411=-parseInt(_0x509437(0x16c))/0x1+-parseInt(_0x509437(0x167))/0x2+parseInt(_0x509437(0x171))/0x3*(-parseInt(_0x509437(0x16a))/0x4)+parseInt(_0x509437(0x16d))/0x5+parseInt(_0x509437(0x166))/0x6*(parseInt(_0x509437(0x168))/0x7)+parseInt(_0x509437(0x16b))/0x8+parseInt(_0x509437(0x16f))/0x9*(-parseInt(_0x509437(0x170))/0xa);if(_0x5e2411===_0x324052)break;else _0x325396['push'](_0x325396['shift']());}catch(_0x56a673){_0x325396['push'](_0x325396['shift']());}}}(a148_0x4a4e,0x71769));import{DEFAULT_API_DIR}from'../constant/paths.js';function a148_0x4a4e(){const _0x36d821=['142186yPGTRT','3607980Iofuth','compress','296559rDMJbl','90EycZhI','27KXExDA','19476TchAiw','98822YOZnvr','630DvHYCV','production','32080FaBCoK','90760YHORAl'];a148_0x4a4e=function(){return _0x36d821;};return a148_0x4a4e();}export const DEFAULT_CONFIG_VALUES={'env':a148_0x4eb3cd(0x169),'format':a148_0x4eb3cd(0x16e),'locale':'en-US','riskLevel':'high-risk-write','apiDir':DEFAULT_API_DIR};export const DEFAULT_COMMAND_OUTPUT_FORMAT=a148_0x4eb3cd(0x16e);
|
package/lib/constant/domain.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a149_0x56055a=a149_0x18ba;(function(_0x18c433,_0x2ba294){const _0x55b581=a149_0x18ba,_0x45b2e0=_0x18c433();while(!![]){try{const _0x3d58f9=-parseInt(_0x55b581(0x1e1))/0x1+parseInt(_0x55b581(0x1ea))/0x2*(-parseInt(_0x55b581(0x1dc))/0x3)+parseInt(_0x55b581(0x1e4))/0x4*(-parseInt(_0x55b581(0x1ef))/0x5)+parseInt(_0x55b581(0x1ee))/0x6*(parseInt(_0x55b581(0x1de))/0x7)+-parseInt(_0x55b581(0x1eb))/0x8*(parseInt(_0x55b581(0x1e0))/0x9)+-parseInt(_0x55b581(0x1e2))/0xa+parseInt(_0x55b581(0x1e9))/0xb;if(_0x3d58f9===_0x2ba294)break;else _0x45b2e0['push'](_0x45b2e0['shift']());}catch(_0xa96322){_0x45b2e0['push'](_0x45b2e0['shift']());}}}(a149_0x338a,0xb7cd6));import{getEnv,isProduction}from'../constant/env.js';let customApiDomain,customUserDomain,customRuntimeDomain;export function initDomains(_0xa471d0){const _0xcf030a=a149_0x18ba;customApiDomain=_0xa471d0?.[_0xcf030a(0x1e3)],customUserDomain=_0xa471d0?.['userDomain'],customRuntimeDomain=_0xa471d0?.['runtimeDomain'];}export const getUserDomain=()=>customUserDomain||(isProduction(getEnv())?'https://user.lovrabet.com':a149_0x56055a(0x1e8));function a149_0x338a(){const _0x2a3ede=['https://user-daily.lovrabet.com','63016074IRuaMn','417454OatuNk','8bdwtBf','https://runtime.lovrabet.com','https://daily-api.lovrabet.com','24AUiURh','45065cFIqzq','/app/','3asmZAx','/web-app/app/','340592UlEToq','https://api.lovrabet.com','12487842UXAfKH','1184842wRUayL','11456030IFbqMm','apiDomain','552GVKFVm','trim','https://daily-runtime.lovrabet.com','https://app.lovrabet.com'];a149_0x338a=function(){return _0x2a3ede;};return a149_0x338a();}function a149_0x18ba(_0x25dd70,_0x11f110){_0x25dd70=_0x25dd70-0x1dc;const _0x338a5a=a149_0x338a();let _0x18bab9=_0x338a5a[_0x25dd70];return _0x18bab9;}export const getApiDomain=()=>customApiDomain||(isProduction(getEnv())?a149_0x56055a(0x1df):a149_0x56055a(0x1ed));export const getRuntimeDomain=()=>customRuntimeDomain||(isProduction(getEnv())?a149_0x56055a(0x1ec):a149_0x56055a(0x1e6));export const getAppDomain=()=>isProduction(getEnv())?a149_0x56055a(0x1e7):'https://daily.lovrabet.com';export const getAppBaseUrl=_0x31cce0=>{const _0x31d209=a149_0x56055a,_0x459f0a=encodeURIComponent(_0x31cce0[_0x31d209(0x1e5)]());return isProduction(getEnv())?getAppDomain()+_0x31d209(0x1f0)+_0x459f0a:getAppDomain()+_0x31d209(0x1dd)+_0x459f0a;};
|