@lovrabet/rabetbase-cli 2.1.2-beta.3 → 2.1.3-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/api-doc.js +1 -1
- package/lib/api/fetch-model-list.js +1 -1
- package/lib/api/generate-api-file.js +1 -1
- package/lib/auth/auth-server-ui.js +1 -1
- package/lib/auth/auth-server.js +1 -1
- package/lib/auth/constant.js +1 -1
- package/lib/auth/get-cookie.js +1 -1
- package/lib/auth/get-session-user.js +1 -1
- package/lib/auth/is-session-valid.js +1 -1
- package/lib/auth/login-success-html.js +1 -1
- package/lib/auth/logout.js +1 -1
- package/lib/cli-flags.js +1 -1
- package/lib/cli.js +1 -1
- package/lib/commands/api/generate.js +1 -1
- package/lib/commands/api/index.js +1 -1
- package/lib/commands/api/list.js +1 -1
- package/lib/commands/api/pull.js +1 -1
- package/lib/commands/api/shared.js +1 -1
- package/lib/commands/app/add.js +1 -1
- package/lib/commands/app/discover.js +1 -1
- package/lib/commands/app/index.js +1 -1
- package/lib/commands/app/list.js +1 -1
- package/lib/commands/app/remove.js +1 -1
- package/lib/commands/app/shared.js +1 -1
- package/lib/commands/app/use.js +1 -1
- package/lib/commands/auth/index.js +1 -1
- package/lib/commands/bff/create.js +1 -0
- package/lib/commands/bff/delete.js +1 -1
- package/lib/commands/bff/detail.js +1 -1
- package/lib/commands/bff/index.js +1 -1
- package/lib/commands/bff/list.js +1 -1
- package/lib/commands/bff/pull.js +1 -1
- package/lib/commands/bff/push.js +1 -1
- package/lib/commands/bff/status.js +1 -1
- package/lib/commands/cli-update.js +1 -1
- package/lib/commands/codegen/index.js +1 -1
- package/lib/commands/codegen/sdk.js +1 -1
- package/lib/commands/codegen/sql.js +1 -1
- package/lib/commands/common/app-selector.js +1 -1
- package/lib/commands/common/flags.js +1 -1
- package/lib/commands/common/validate.js +1 -1
- package/lib/commands/config/get.js +1 -1
- package/lib/commands/config/index.js +1 -1
- package/lib/commands/config/list.js +1 -1
- package/lib/commands/config/set.js +1 -1
- package/lib/commands/config/shared.js +1 -1
- package/lib/commands/dataset/detail.js +1 -1
- package/lib/commands/dataset/index.js +1 -1
- package/lib/commands/dataset/links.js +1 -1
- package/lib/commands/dataset/list.js +1 -1
- package/lib/commands/dataset/operations.js +1 -1
- package/lib/commands/db/analyze-cancel.js +1 -1
- package/lib/commands/db/analyze-start.js +1 -1
- package/lib/commands/db/analyze-status.js +1 -1
- package/lib/commands/db/create.js +1 -1
- package/lib/commands/db/delete.js +1 -1
- package/lib/commands/db/detail.js +1 -1
- package/lib/commands/db/diff.js +1 -1
- package/lib/commands/db/index.js +1 -1
- package/lib/commands/db/list.js +1 -1
- package/lib/commands/db/shared.js +1 -1
- package/lib/commands/db/tables.js +1 -1
- package/lib/commands/db/test.js +1 -1
- package/lib/commands/db/update.js +1 -1
- package/lib/commands/doctor.js +1 -1
- package/lib/commands/init/index.js +1 -1
- package/lib/commands/logs/index.js +1 -1
- package/lib/commands/menu/index.js +1 -1
- package/lib/commands/menu/shared/compare-table.js +1 -1
- package/lib/commands/menu/shared/index.js +1 -1
- package/lib/commands/menu/shared/inquirer.js +1 -1
- package/lib/commands/menu/shared/local-pages.js +1 -1
- package/lib/commands/menu/shared/logic.js +1 -1
- package/lib/commands/menu/shared/service.js +1 -1
- package/lib/commands/menu/shared/sync-core.js +1 -1
- package/lib/commands/menu/shared/update-core.js +1 -1
- package/lib/commands/menu/shared/valid-url.js +1 -1
- package/lib/commands/menu/sync.js +1 -1
- package/lib/commands/menu/update.js +1 -1
- package/lib/commands/page/generate-start.js +1 -0
- package/lib/commands/page/generate-status.js +1 -0
- package/lib/commands/page/index.js +1 -0
- package/lib/commands/page/pull.js +1 -0
- package/lib/commands/page/push.js +1 -0
- package/lib/commands/page/shared.js +1 -0
- package/lib/commands/page/standard-page-status.js +1 -0
- package/lib/commands/page/sync.js +1 -0
- package/lib/commands/project/create/enhanced-guided-create.js +1 -1
- package/lib/commands/project/create/format-elapsed.js +1 -1
- package/lib/commands/project/create/main.js +1 -1
- package/lib/commands/project/create/non-interactive.js +1 -1
- package/lib/commands/project/create/project-template-path.js +1 -1
- package/lib/commands/project/create/use-copy-project-template.js +1 -1
- package/lib/commands/project/create/use-format-code.js +1 -1
- package/lib/commands/project/create/use-install-dependencies.js +1 -1
- package/lib/commands/project/index.js +1 -1
- package/lib/commands/project/init.js +1 -1
- package/lib/commands/project/upgrade.js +1 -1
- package/lib/commands/registry.js +1 -1
- package/lib/commands/run/index.js +1 -1
- package/lib/commands/schema.js +1 -1
- package/lib/commands/skill/index.js +1 -1
- package/lib/commands/sql/create.js +1 -0
- package/lib/commands/sql/delete.js +1 -0
- 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 -0
- package/lib/commands/sql/save.js +1 -1
- package/lib/commands/sql/shared.js +1 -1
- package/lib/commands/sql/status.js +1 -0
- package/lib/commands/sql/validate.js +1 -1
- package/lib/config/schema.js +1 -1
- package/lib/constant/cdn.js +1 -0
- package/lib/constant/cli.js +1 -1
- package/lib/constant/defaults.js +1 -1
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/constant/output.js +1 -1
- package/lib/constant/paths.js +1 -1
- package/lib/constant/risk.js +1 -1
- package/lib/context.js +1 -1
- package/lib/core/alias-resolver.js +1 -1
- package/lib/core/api-client.js +1 -1
- package/lib/core/bff/config.js +1 -1
- package/lib/core/bff/file-system.js +1 -1
- package/lib/core/bff/hash.js +1 -1
- package/lib/core/bff/lock.js +1 -1
- package/lib/core/bff/utils.js +1 -1
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/page/file-system.js +1 -0
- package/lib/core/page/hash.js +1 -0
- package/lib/core/page/lock.js +1 -0
- package/lib/core/page/types.js +1 -0
- package/lib/core/sql-sync/config.js +1 -0
- package/lib/core/sql-sync/file-system.js +1 -0
- package/lib/core/sql-sync/hash.js +1 -0
- package/lib/core/sql-sync/lock.js +1 -0
- package/lib/core/sql-sync/types.js +1 -0
- package/lib/core/sql-sync/utils.js +1 -0
- package/lib/core/sql-validator.js +1 -1
- package/lib/errors.js +1 -1
- package/lib/framework/build-all-flags.js +1 -1
- package/lib/framework/flags.js +1 -1
- package/lib/framework/help.js +1 -1
- package/lib/framework/index.js +1 -1
- package/lib/framework/output.js +1 -1
- package/lib/framework/response.js +1 -1
- package/lib/framework/runner-alias.js +1 -1
- package/lib/framework/runner.js +1 -1
- package/lib/framework/schema-export.js +1 -1
- package/lib/framework/types.js +1 -1
- package/lib/generated/build-info.js +1 -1
- package/lib/help.js +1 -1
- package/lib/skills/main.js +1 -1
- package/lib/skills/npx-skills-add.js +1 -1
- package/lib/telemetry/cli-command-trace.js +1 -1
- package/lib/telemetry/cli-help-trace.js +1 -1
- package/lib/telemetry/ensure-cli-otel-config.js +1 -1
- package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
- package/lib/telemetry/send-cli-trace-log.js +1 -1
- package/lib/utils/ai_config.js +1 -1
- package/lib/utils/apply-jq-filter.js +1 -1
- package/lib/utils/cdn-config.js +1 -1
- package/lib/utils/check-sdk-version.js +1 -1
- package/lib/utils/cli-version-check.js +1 -1
- package/lib/utils/cli-version-policy.js +1 -0
- package/lib/utils/config.js +1 -1
- package/lib/utils/copy-directory.js +1 -1
- package/lib/utils/entity-with-id.js +1 -1
- package/lib/utils/file-utils.js +1 -1
- package/lib/utils/guides-cdn.js +1 -1
- package/lib/utils/http-client.js +1 -1
- package/lib/utils/is-non-interactive.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/platform.js +1 -1
- package/lib/utils/rules-cdn.js +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.js +1 -1
- package/lib/utils/version.js +1 -1
- package/lib/utils/with-active-cookie.js +1 -1
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +3 -2
- package/templates/skill/SKILL.md.tpl +1 -1
- package/lib/commands/bff/new.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a102_0x204b(_0x29d8e5,_0x48972e){_0x29d8e5=_0x29d8e5-0x1c0;const _0x60f876=a102_0x60f8();let _0x204bed=_0x60f876[_0x29d8e5];return _0x204bed;}const a102_0x3ee23f=a102_0x204b;function a102_0x60f8(){const _0x5db9cd=['11uDzmym','Install\x20developer\x20skill\x20package','148239VTUvqF','695dkWEXK','error','setLogPath','6706rJTSwG','write','info','apiError','lovrabet/rabetbase','skipped','install','unknown','4868KATfbl','184EzrxzU','Check\x20network\x20connectivity\x20and\x20try\x20again.','log','866988CDwUoX','cwd','pipe','1284528bMyQOO','skill','Installing\x20official\x20skill\x20via\x20npx\x20(npx\x20-y\x20skills\x20add\x20lovrabet/rabetbase\x20--global)...','nonInteractive','144MNPlxl','../../skills/npx-skills-add.js','20914230UMGfEN','\x20skill\x20installed','5735148pbdcyE'];a102_0x60f8=function(){return _0x5db9cd;};return a102_0x60f8();}(function(_0x7bd16d,_0x446eb3){const _0x35b0d0=a102_0x204b,_0x3ef779=_0x7bd16d();while(!![]){try{const _0x370f6a=-parseInt(_0x35b0d0(0x1d0))/0x1*(-parseInt(_0x35b0d0(0x1db))/0x2)+-parseInt(_0x35b0d0(0x1c9))/0x3+-parseInt(_0x35b0d0(0x1c5))/0x4*(parseInt(_0x35b0d0(0x1d8))/0x5)+-parseInt(_0x35b0d0(0x1d4))/0x6+-parseInt(_0x35b0d0(0x1cc))/0x7+-parseInt(_0x35b0d0(0x1c6))/0x8*(parseInt(_0x35b0d0(0x1d7))/0x9)+-parseInt(_0x35b0d0(0x1d2))/0xa*(-parseInt(_0x35b0d0(0x1d5))/0xb);if(_0x370f6a===_0x446eb3)break;else _0x3ef779['push'](_0x3ef779['shift']());}catch(_0x985feb){_0x3ef779['push'](_0x3ef779['shift']());}}}(a102_0x60f8,0x91f8d));import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';import{logger}from'../../utils/logger.js';export const skillDefinitions=[{'service':a102_0x3ee23f(0x1cd),'command':a102_0x3ee23f(0x1c3),'description':a102_0x3ee23f(0x1d6),'risk':a102_0x3ee23f(0x1dc),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[],async 'execute'(_0x501ee2){const _0x1ce5b2=a102_0x3ee23f;logger[_0x1ce5b2(0x1da)](process[_0x1ce5b2(0x1ca)]()),logger[_0x1ce5b2(0x1dd)]('skill-install','执行安装技能包命令(委托给\x20npx\x20skills\x20--global)');const {runNpxSkillsAddGlobal:_0x2ebc19}=await import(_0x1ce5b2(0x1d1)),_0x15f767=_0x501ee2[_0x1ce5b2(0x1cf)]?_0x1ce5b2(0x1cb):'inherit';console['log'](_0x1ce5b2(0x1ce));const _0x3b9657=_0x2ebc19(process[_0x1ce5b2(0x1ca)](),_0x1ce5b2(0x1c1),{'stdio':_0x15f767});if(_0x3b9657[_0x1ce5b2(0x1c2)])console[_0x1ce5b2(0x1c8)]('Skipped\x20npx\x20(RABETBASE_SKIP_NPX_SKILLS=1);\x20assuming\x20skill\x20is\x20already\x20present.');else{if(_0x3b9657['ok'])console[_0x1ce5b2(0x1c8)](CLI_BIN_NAME+_0x1ce5b2(0x1d3));else throw CliErrors[_0x1ce5b2(0x1c0)]('npx\x20skills\x20add\x20failed:\x20'+(_0x3b9657[_0x1ce5b2(0x1d9)]||_0x1ce5b2(0x1c4)),_0x1ce5b2(0x1c7));}return{'ok':!![]};}}];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const a103_0x52500a=a103_0x2cbc;(function(_0x19a066,_0x346001){const _0x2bbb6d=a103_0x2cbc,_0x3c8506=_0x19a066();while(!![]){try{const _0x5e701f=-parseInt(_0x2bbb6d(0x17b))/0x1+parseInt(_0x2bbb6d(0x14d))/0x2+-parseInt(_0x2bbb6d(0x16d))/0x3+-parseInt(_0x2bbb6d(0x149))/0x4+-parseInt(_0x2bbb6d(0x165))/0x5*(parseInt(_0x2bbb6d(0x168))/0x6)+-parseInt(_0x2bbb6d(0x144))/0x7*(-parseInt(_0x2bbb6d(0x15f))/0x8)+parseInt(_0x2bbb6d(0x139))/0x9;if(_0x5e701f===_0x346001)break;else _0x3c8506['push'](_0x3c8506['shift']());}catch(_0x55a955){_0x3c8506['push'](_0x3c8506['shift']());}}}(a103_0x9ac2,0xd9a23));import{writeFile}from'node:fs/promises';import{input,select}from'@inquirer/prompts';function a103_0x2cbc(_0x42d01c,_0x2868f7){_0x42d01c=_0x42d01c-0x139;const _0x9ac28d=a103_0x9ac2();let _0x2cbcd8=_0x9ac28d[_0x42d01c];return _0x2cbcd8;}import{createSqlQuery}from'../../core/api-client.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{buildSqlRelativePath}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function generateSqlTemplate(_0x249c91){const _0x45f405=a103_0x2cbc;if(_0x249c91===_0x45f405(0x141))return['<select\x20id=\x22query\x22\x20resultType=\x22map\x22>',_0x45f405(0x158),'</select>',''][_0x45f405(0x169)]('\x0a');return[_0x45f405(0x17a),''][_0x45f405(0x169)]('\x0a');}export const sqlCreate={'service':a103_0x52500a(0x171),'command':a103_0x52500a(0x148),'description':a103_0x52500a(0x15b),'risk':a103_0x52500a(0x167),'flags':[{'name':a103_0x52500a(0x153),'type':a103_0x52500a(0x170),'description':a103_0x52500a(0x140)},{'name':a103_0x52500a(0x174),'type':a103_0x52500a(0x16c),'description':a103_0x52500a(0x15e)},{'name':'mode','type':a103_0x52500a(0x170),'enum':[a103_0x52500a(0x171),a103_0x52500a(0x141)],'description':'Local\x20SQL\x20file\x20mode'}],async 'validate'(_0x2ba1c2){const _0x1336ea=a103_0x52500a;if(!_0x2ba1c2[_0x1336ea(0x14f)])return;if(!_0x2ba1c2[_0x1336ea(0x151)](_0x1336ea(0x153))[_0x1336ea(0x176)]())throw CliErrors['flagMissing']('name','--name\x20is\x20required\x20in\x20non-interactive\x20mode.');const _0x27684b=resolveProvidedDbId(_0x2ba1c2);if(typeof _0x27684b!==_0x1336ea(0x16c)||!Number['isFinite'](_0x27684b)||_0x27684b<=0x0)throw CliErrors[_0x1336ea(0x13b)]('db-id',_0x1336ea(0x160));if(!_0x2ba1c2[_0x1336ea(0x151)]('mode')['trim']())throw CliErrors[_0x1336ea(0x13b)](_0x1336ea(0x159),'--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');},async 'dryRun'(_0x14d521){const _0x15137b=a103_0x52500a,_0x15ee0e=loadSqlProjectConfig(_0x14d521['appCode']),{sqlName:_0x360ad1,dbId:_0x29cb5c,dbName:_0x4b419d,mode:_0x39fe85}=await resolveSqlNewInputs(_0x14d521),_0x668172=buildSqlRelativePath(_0x15137b(0x13d),_0x360ad1,_0x4b419d,_0x39fe85,_0x29cb5c),_0x2cfe3f=_0x15ee0e[_0x15137b(0x142)]+'/'+_0x668172;return{'method':_0x15137b(0x156),'url':'/smartapi/custom/saveUserCustomSql','body':{'appCode':_0x14d521[_0x15137b(0x13e)],'sqlName':_0x360ad1,'dbId':_0x29cb5c,'mode':_0x39fe85,'localPath':_0x2cfe3f},'description':'Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20'+_0x15ee0e[_0x15137b(0x142)]};},async 'execute'(_0x19e7d5){const _0x4d7ae3=a103_0x52500a,_0x3bd8fe=loadSqlProjectConfig(_0x19e7d5[_0x4d7ae3(0x13e)]),{sqlName:_0x5a75ad,dbId:_0x4ad1ea,dbName:_0x3b3de6,mode:_0x1971ce}=await resolveSqlNewInputs(_0x19e7d5),_0x2470ae=generateSqlTemplate(_0x1971ce),_0x3a5bd8=await createSqlQuery({'appCode':_0x19e7d5[_0x4d7ae3(0x13e)],'sqlName':_0x5a75ad,'dbId':_0x4ad1ea,'sqlContent':_0x2470ae}),_0x2f76f2=ensureRemoteSqlContent(_0x3a5bd8),_0x4bad0c=_0x3b3de6||await getDbName(_0x19e7d5[_0x4d7ae3(0x13e)],_0x4ad1ea)[_0x4d7ae3(0x16a)](()=>undefined),_0x1b6218=buildSqlRelativePath(_0x3a5bd8[_0x4d7ae3(0x152)],_0x3a5bd8['sqlName'],_0x4bad0c,_0x1971ce,_0x4ad1ea),_0x285c95=_0x3bd8fe[_0x4d7ae3(0x142)]+'/'+_0x1b6218,_0x139c1b=buildLocalSqlFileContent({'sqlCode':_0x3a5bd8[_0x4d7ae3(0x152)],'sqlName':_0x3a5bd8[_0x4d7ae3(0x13c)],'dbId':_0x3a5bd8['dbId']},_0x2f76f2,{'dbName':_0x4bad0c,'mode':_0x1971ce,'syncedAt':new Date()['toISOString'](),'description':_0x3a5bd8[_0x4d7ae3(0x16b)]});if(await fileExists(_0x285c95))throw CliErrors[_0x4d7ae3(0x161)](_0x4d7ae3(0x166)+_0x285c95);await ensureParentDirectory(_0x285c95),await writeFile(_0x285c95,_0x139c1b,'utf8');const _0x2fd0db=await readSqlLockFile(_0x3bd8fe[_0x4d7ae3(0x150)]),{lockData:_0x59ac5c,appLock:_0x439d4a}=ensureSqlLockScope(_0x2fd0db??createEmptySqlLock(),_0x3bd8fe[_0x4d7ae3(0x13e)],_0x3bd8fe[_0x4d7ae3(0x173)],'new');return _0x439d4a[_0x4d7ae3(0x146)][_0x3a5bd8[_0x4d7ae3(0x152)]]={...buildSqlLockEntry(_0x3a5bd8,_0x2f76f2,computeSqlContentHash(_0x139c1b),{'dbName':_0x4bad0c}),'path':_0x1b6218,'mode':_0x1971ce},_0x439d4a[_0x4d7ae3(0x163)]=new Date()[_0x4d7ae3(0x157)](),await writeSqlLockFile(_0x3bd8fe[_0x4d7ae3(0x150)],_0x59ac5c),{'ok':!![],'data':{'id':_0x3a5bd8['id'],'sqlCode':_0x3a5bd8[_0x4d7ae3(0x152)],'sqlName':_0x3a5bd8[_0x4d7ae3(0x13c)],'dbId':_0x3a5bd8[_0x4d7ae3(0x177)],'path':_0x285c95,'mode':_0x1971ce},'message':_0x4d7ae3(0x14a)+_0x3a5bd8[_0x4d7ae3(0x152)]};}};async function resolveSqlNewInputs(_0x491559){const _0x46a0fa=await resolveSqlNameInput(_0x491559),{dbId:_0xd56388,dbName:_0x178d00}=await resolveDbSelection(_0x491559),_0x50f4b1=await resolveSqlModeInput(_0x491559);return{'sqlName':_0x46a0fa,'dbId':_0xd56388,'dbName':_0x178d00,'mode':_0x50f4b1};}async function resolveSqlNameInput(_0x4ddd6d){const _0x4b0b87=a103_0x52500a,_0x5b1788=_0x4ddd6d[_0x4b0b87(0x151)](_0x4b0b87(0x153))[_0x4b0b87(0x176)]();if(_0x5b1788)return _0x5b1788;if(_0x4ddd6d['nonInteractive'])throw CliErrors[_0x4b0b87(0x13b)](_0x4b0b87(0x153),_0x4b0b87(0x14c));return(await input({'message':_0x4b0b87(0x147),'validate':_0x505627=>_0x505627[_0x4b0b87(0x176)]()?!![]:_0x4b0b87(0x13a)}))[_0x4b0b87(0x176)]();}async function resolveDbSelection(_0x17314c){const _0x28f07e=a103_0x52500a,_0x2dd848=resolveProvidedDbId(_0x17314c);if(typeof _0x2dd848===_0x28f07e(0x16c)&&Number[_0x28f07e(0x154)](_0x2dd848)&&_0x2dd848>0x0)return{'dbId':_0x2dd848,'dbName':await getDbName(_0x17314c[_0x28f07e(0x13e)],_0x2dd848)['catch'](()=>undefined)};if(_0x17314c['nonInteractive'])throw CliErrors[_0x28f07e(0x13b)](_0x28f07e(0x174),_0x28f07e(0x160));const _0xebecef=await listDatabases(_0x17314c[_0x28f07e(0x13e)])['catch'](()=>[]);if(_0xebecef['length']===0x1)return{'dbId':_0xebecef[0x0][_0x28f07e(0x177)],'dbName':_0xebecef[0x0][_0x28f07e(0x175)]};if(_0xebecef[_0x28f07e(0x172)]>0x1){const _0x599ef6=await select({'message':_0x28f07e(0x155),'choices':[..._0xebecef[_0x28f07e(0x17c)](_0x5cb82c=>({'name':_0x5cb82c[_0x28f07e(0x175)]+'\x20('+_0x5cb82c[_0x28f07e(0x177)]+')','value':serializeDbSelection(_0x5cb82c)})),{'name':_0x28f07e(0x179),'value':_0x28f07e(0x164)}]});if(_0x599ef6!==_0x28f07e(0x164))return deserializeDbSelection(_0x599ef6);}const _0x50dee1=await input({'message':_0x28f07e(0x15d),'validate':_0x3743e9=>{const _0x2fa13b=_0x28f07e,_0x2f2233=_0x3743e9[_0x2fa13b(0x176)]();if(!_0x2f2233)return _0x2fa13b(0x14e);const _0x6e6c1c=Number(_0x2f2233);if(!Number[_0x2fa13b(0x16f)](_0x6e6c1c)||_0x6e6c1c<=0x0)return _0x2fa13b(0x14b);return!![];}});return{'dbId':Number(_0x50dee1[_0x28f07e(0x176)]())};}async function resolveSqlModeInput(_0x19002b){const _0x522711=a103_0x52500a,_0x26cf98=_0x19002b[_0x522711(0x151)](_0x522711(0x159))['trim']();if(_0x26cf98===_0x522711(0x171)||_0x26cf98===_0x522711(0x141))return _0x26cf98;if(_0x19002b[_0x522711(0x14f)])throw CliErrors[_0x522711(0x13b)](_0x522711(0x159),'--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');return await select({'message':_0x522711(0x178),'choices':[{'name':_0x522711(0x143),'value':'sql','description':_0x522711(0x162)},{'name':_0x522711(0x13f),'value':_0x522711(0x141),'description':_0x522711(0x16e)}]});}function serializeDbSelection(_0x409ae0){const _0x3a2961=a103_0x52500a;return JSON[_0x3a2961(0x15c)]({'dbId':_0x409ae0[_0x3a2961(0x177)],'dbName':_0x409ae0[_0x3a2961(0x175)]});}function deserializeDbSelection(_0x172816){const _0x26882f=a103_0x52500a;try{const _0x367896=JSON[_0x26882f(0x15a)](_0x172816);if(typeof _0x367896[_0x26882f(0x177)]===_0x26882f(0x16c)&&Number['isFinite'](_0x367896['dbId']))return{'dbId':_0x367896['dbId'],'dbName':_0x367896[_0x26882f(0x175)]};}catch{}throw CliErrors[_0x26882f(0x161)](_0x26882f(0x145)+_0x172816);}function a103_0x9ac2(){const _0x377f47=['high-risk-write','8328954sAIiFf','join','catch','description','number','4853775afbvtQ','适合带动态标签的\x20MyBatis\x20XML\x20SQL','isInteger','string','sql','length','sqlRoot','db-id','dbName','trim','dbId','请选择本地\x20SQL\x20模式:','✎\x20手动输入\x20dbId','SELECT\x201\x20AS\x20id;','559633aAOVpx','map','15083991dYYaGu','SQL\x20名称不能为空','flagMissing','sqlName','<server-generated-sqlCode>','appCode','MyBatis\x20XML(mybatisXml)','SQL\x20query\x20display\x20name','mybatisXml','sqlRootDir','普通\x20SQL(sql)','7DnpWya','Invalid\x20database\x20selection\x20payload:\x20','sqls','请输入\x20SQL\x20名称:','create','2315844vLdyiO','Created\x20SQL\x20query\x20','dbId\x20必须为正整数','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','3543186mPAQiv','dbId\x20不能为空','nonInteractive','lockFilePath','str','sqlCode','name','isFinite','请选择目标数据库:','POST','toISOString','\x20\x20SELECT\x201\x20AS\x20id','mode','parse','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','stringify','请输入目标数据库\x20dbId:','Target\x20database\x20ID','12708104LMgJVc','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','validation','适合直接执行的普通\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20语句','lastSync','__manual__','5nWvVis','File\x20already\x20exists:\x20'];a103_0x9ac2=function(){return _0x377f47;};return a103_0x9ac2();}function resolveProvidedDbId(_0x4438a2){const _0x2c245f=a103_0x52500a,_0x503cdd=_0x4438a2['flag'](_0x2c245f(0x174));if(typeof _0x503cdd===_0x2c245f(0x16c)&&Number['isFinite'](_0x503cdd))return _0x503cdd;return undefined;}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const a104_0x361fdc=a104_0xcdde;(function(_0x3a4aff,_0x5a3619){const _0x3e105c=a104_0xcdde,_0x106ca4=_0x3a4aff();while(!![]){try{const _0x303fa9=-parseInt(_0x3e105c(0x7c))/0x1*(parseInt(_0x3e105c(0x71))/0x2)+parseInt(_0x3e105c(0x79))/0x3+-parseInt(_0x3e105c(0x8a))/0x4+parseInt(_0x3e105c(0x7b))/0x5+-parseInt(_0x3e105c(0x70))/0x6+-parseInt(_0x3e105c(0x7e))/0x7*(-parseInt(_0x3e105c(0x73))/0x8)+parseInt(_0x3e105c(0x7a))/0x9*(-parseInt(_0x3e105c(0x87))/0xa);if(_0x303fa9===_0x5a3619)break;else _0x106ca4['push'](_0x106ca4['shift']());}catch(_0x7ee64a){_0x106ca4['push'](_0x106ca4['shift']());}}}(a104_0x36fc,0xe92b7));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{deleteSqlQuery}from'../../core/api-client.js';function a104_0xcdde(_0xb90414,_0x169780){_0xb90414=_0xb90414-0x6c;const _0x36fcb4=a104_0x36fc();let _0xcdde88=_0x36fcb4[_0xb90414];return _0xcdde88;}import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{fileExists}from'../../core/bff/file-system.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDelete={'service':a104_0x361fdc(0x86),'command':a104_0x361fdc(0x6d),'description':a104_0x361fdc(0x76),'risk':a104_0x361fdc(0x74),'flags':[SQLCODE_FLAG],async 'validate'(_0xcca93a){const _0x62c78a=a104_0x361fdc,_0x5bb56d=loadSqlProjectConfig(_0xcca93a[_0x62c78a(0x90)]),_0x1a6504=await readSqlLockFile(_0x5bb56d['lockFilePath']);if(!_0x1a6504)throw CliErrors[_0x62c78a(0x7d)]('SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.');},async 'dryRun'(_0x432be1){const _0x39e3e5=a104_0x361fdc,_0x4b199c=loadSqlProjectConfig(_0x432be1[_0x39e3e5(0x90)]),_0x5132da=await readSqlLockFile(_0x4b199c[_0x39e3e5(0x8c)]);if(!_0x5132da)throw CliErrors[_0x39e3e5(0x7d)]('SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.');const {appLock:_0xe49c3b}=ensureSqlLockScope(_0x5132da,_0x432be1[_0x39e3e5(0x90)],_0x4b199c[_0x39e3e5(0x82)],_0x39e3e5(0x6d)),_0x3f1f72=_0x432be1[_0x39e3e5(0x84)]('sqlcode'),_0x309868=_0xe49c3b[_0x39e3e5(0x81)][_0x3f1f72];if(!_0x309868)throw CliErrors[_0x39e3e5(0x7d)](_0x39e3e5(0x8b)+_0x3f1f72+'\x22.');return{'method':_0x39e3e5(0x72),'url':_0x39e3e5(0x89),'body':{'sqlCode':_0x3f1f72,'id':_0x309868[_0x39e3e5(0x83)],'localPath':resolveLocalSqlFilePath(_0x4b199c,_0x3f1f72,_0x309868)},'description':_0x39e3e5(0x6f)+_0x3f1f72+'\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20'+_0x4b199c[_0x39e3e5(0x88)]};},async 'execute'(_0xe615c5){const _0x491e41=a104_0x361fdc,_0x36bff8=loadSqlProjectConfig(_0xe615c5[_0x491e41(0x90)]),_0x3d5bc9=await readSqlLockFile(_0x36bff8[_0x491e41(0x8c)]);if(!_0x3d5bc9)throw CliErrors[_0x491e41(0x7d)](_0x491e41(0x8f));const {lockData:_0x40bae6,appLock:_0x3fee60}=ensureSqlLockScope(_0x3d5bc9,_0xe615c5[_0x491e41(0x90)],_0x36bff8[_0x491e41(0x82)],_0x491e41(0x6d)),_0x23dc43=_0xe615c5[_0x491e41(0x84)](_0x491e41(0x8d)),_0x528108=_0x3fee60[_0x491e41(0x81)][_0x23dc43];if(!_0x528108)throw CliErrors['validation'](_0x491e41(0x8b)+_0x23dc43+'\x22.');await deleteSqlQuery({'id':_0x528108[_0x491e41(0x83)],'sqlCode':_0x23dc43}),_0x3fee60[_0x491e41(0x81)]=Object[_0x491e41(0x80)](Object[_0x491e41(0x7f)](_0x3fee60[_0x491e41(0x81)])[_0x491e41(0x75)](([_0x45391e])=>_0x45391e!==_0x23dc43)),_0x3fee60['lastSync']=new Date()['toISOString'](),await writeSqlLockFile(_0x36bff8[_0x491e41(0x8c)],_0x40bae6);const _0x1108e5=resolveLocalSqlFilePath(_0x36bff8,_0x23dc43,_0x528108);let _0x47aff9;await fileExists(_0x1108e5)&&(_0x47aff9=await moveToTrash(_0x36bff8[_0x491e41(0x85)],_0x36bff8['trashDir'],_0x1108e5),await cleanupEmptyDirectories(dirname(_0x1108e5),_0x36bff8[_0x491e41(0x77)]));const _0x458ee7={'deleted':_0x23dc43,'remoteId':_0x528108[_0x491e41(0x83)]};if(_0x47aff9)_0x458ee7[_0x491e41(0x78)]=_0x47aff9;return{'ok':!![],'data':_0x458ee7,'message':_0x491e41(0x8e)+_0x23dc43+(_0x47aff9?'\x20(local\x20file\x20moved\x20to\x20trash)':'')};}};async function moveToTrash(_0x3bf5eb,_0x159a0c,_0x3450fa){const _0x133a35=a104_0x361fdc,_0x1f5d64=new Date()[_0x133a35(0x6c)]()['replace'](/[:.]/g,'-'),_0x597a05=relative(_0x3bf5eb,_0x3450fa),_0x1862ec=join(_0x159a0c,_0x1f5d64,_0x597a05);return await mkdir(dirname(_0x1862ec),{'recursive':!![]}),await rename(_0x3450fa,_0x1862ec),_0x1862ec;}async function cleanupEmptyDirectories(_0x454ba5,_0x31f1da){const _0x45b8b8=a104_0x361fdc;let _0x1b4ca5=resolve(_0x454ba5);const _0x587c80=resolve(_0x31f1da);while(_0x1b4ca5[_0x45b8b8(0x6e)](''+_0x587c80+sep)||_0x1b4ca5===_0x587c80){if(_0x1b4ca5===_0x587c80)return;try{const _0x5540ce=await readdir(_0x1b4ca5);if(_0x5540ce['length']>0x0)return;await rmdir(_0x1b4ca5);}catch{return;}_0x1b4ca5=dirname(_0x1b4ca5);}}function a104_0x36fc(){const _0x7a4d09=['No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','lockFilePath','sqlcode','Deleted\x20','SQL\x20lock\x20file\x20not\x20found.','appCode','toISOString','delete','startsWith','Would\x20delete\x20SQL\x20','2408712dUVyfO','72812xoLLNF','POST','48QZidOh','high-risk-write','filter','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','sqlRootDir','trashedTo','2988183lLqezo','8109fDCZdf','7018750zaYrhU','11yoUwPl','validation','263263kpWjxg','entries','fromEntries','sqls','sqlRoot','remoteId','str','projectRoot','sql','390GbCRPB','trashDir','/smartapi/custom/deleteUserCustomSql','3333380dYdGjG'];a104_0x36fc=function(){return _0x7a4d09;};return a104_0x36fc();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a105_0x5a027c=a105_0x1bf1;(function(_0x5ce85a,_0x4240dd){const _0x333092=a105_0x1bf1,_0x4cc92a=_0x5ce85a();while(!![]){try{const _0x340282=parseInt(_0x333092(0xd8))/0x1+-parseInt(_0x333092(0xdb))/0x2*(-parseInt(_0x333092(0xd6))/0x3)+-parseInt(_0x333092(0xe0))/0x4+parseInt(_0x333092(0xdc))/0x5*(-parseInt(_0x333092(0xe6))/0x6)+-parseInt(_0x333092(0xda))/0x7*(-parseInt(_0x333092(0xd3))/0x8)+parseInt(_0x333092(0xe8))/0x9+-parseInt(_0x333092(0xd7))/0xa*(-parseInt(_0x333092(0xe3))/0xb);if(_0x340282===_0x4240dd)break;else _0x4cc92a['push'](_0x4cc92a['shift']());}catch(_0x3d5eeb){_0x4cc92a['push'](_0x4cc92a['shift']());}}}(a105_0x1067,0x29fe1));function a105_0x1bf1(_0x2aa802,_0x53f104){_0x2aa802=_0x2aa802-0xd2;const _0x10676f=a105_0x1067();let _0x1bf118=_0x10676f[_0x2aa802];return _0x1bf118;}import{getSqlQueryInfo}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';function a105_0x1067(){const _0x320f45=['306578sjmksm','sqlCode','61271BpnBdC','186Sbwetv','178735VgiLrZ','Return\x20full\x20raw\x20SQL\x20query\x20object','sqlName','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','791304QmdguE','detail','boolean','6281zYBmcz','verbose','bool','36HQCtKk','appCode','278298FGpEaT','description','32QwgPVr','dbId','sql','5727IYyDvo','600ZqVzQl'];a105_0x1067=function(){return _0x320f45;};return a105_0x1067();}export const sqlDetail={'service':a105_0x5a027c(0xd5),'command':a105_0x5a027c(0xe1),'description':a105_0x5a027c(0xdf),'risk':'read','flags':[SQLCODE_FLAG,{'name':a105_0x5a027c(0xe4),'type':a105_0x5a027c(0xe2),'description':a105_0x5a027c(0xdd)}],async 'execute'(_0x389d33){const _0x21cc1f=a105_0x5a027c,_0x350e9a=await getSqlQueryInfo(_0x389d33[_0x21cc1f(0xe7)],_0x389d33['str']('sqlcode')),_0x59abad=_0x389d33[_0x21cc1f(0xe5)](_0x21cc1f(0xe4));if(_0x59abad)return{'ok':!![],'data':_0x350e9a};const _0x3d0431=_0x350e9a[_0x21cc1f(0xd4)]?await getDbName(_0x389d33[_0x21cc1f(0xe7)],_0x350e9a[_0x21cc1f(0xd4)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x350e9a[_0x21cc1f(0xd9)],'sqlName':_0x350e9a[_0x21cc1f(0xde)],'db':_0x3d0431?_0x3d0431+'\x20('+_0x350e9a[_0x21cc1f(0xd4)]+')':_0x350e9a[_0x21cc1f(0xd4)]??'','description':_0x350e9a[_0x21cc1f(0xd2)]??'','sqlContent':_0x350e9a['sqlContent']??''}};}};
|
package/lib/commands/sql/exec.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a106_0x1b92(){const _0x5afc28=['read','194185iyHWPv','sql','127771IIDAfA','params','validation','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','execSuccess','367920zGAIsK','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','405035cAqJqm','str','length','Returned\x20','parse','now','exec','\x20row(s)\x20in\x20','296SRFRIU','416522SMvxyP','SQL\x20execution\x20failed','1145488ZTGUOb','71748VJhflS'];a106_0x1b92=function(){return _0x5afc28;};return a106_0x1b92();}const a106_0x5f3159=a106_0x1edd;function a106_0x1edd(_0x538aa8,_0x4e827c){_0x538aa8=_0x538aa8-0x1c8;const _0x1b92a5=a106_0x1b92();let _0x1eddef=_0x1b92a5[_0x538aa8];return _0x1eddef;}(function(_0x28073a,_0x4169c8){const _0x1d1638=a106_0x1edd,_0x3ca12e=_0x28073a();while(!![]){try{const _0x6946f7=parseInt(_0x1d1638(0x1d0))/0x1+-parseInt(_0x1d1638(0x1cb))/0x2+-parseInt(_0x1d1638(0x1d7))/0x3+-parseInt(_0x1d1638(0x1cd))/0x4+-parseInt(_0x1d1638(0x1d9))/0x5+parseInt(_0x1d1638(0x1ce))/0x6+parseInt(_0x1d1638(0x1d2))/0x7*(parseInt(_0x1d1638(0x1ca))/0x8);if(_0x6946f7===_0x4169c8)break;else _0x3ca12e['push'](_0x3ca12e['shift']());}catch(_0xf54b26){_0x3ca12e['push'](_0x3ca12e['shift']());}}}(a106_0x1b92,0x2cbb8));import{executeSql}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlExec={'service':a106_0x5f3159(0x1d1),'command':a106_0x5f3159(0x1c8),'description':a106_0x5f3159(0x1d8),'risk':a106_0x5f3159(0x1cf),'flags':[SQLCODE_FLAG,{'name':a106_0x5f3159(0x1d3),'type':'string','description':a106_0x5f3159(0x1d5)}],async 'execute'(_0x311c87){const _0x14a34c=a106_0x5f3159;let _0x34fd37;const _0x4c8779=_0x311c87[_0x14a34c(0x1da)](_0x14a34c(0x1d3));if(_0x4c8779)try{_0x34fd37=JSON[_0x14a34c(0x1dd)](_0x4c8779);}catch{throw CliErrors[_0x14a34c(0x1d4)]('Invalid\x20JSON\x20for\x20--params:\x20'+_0x4c8779);}const _0x5bfd3a=Date['now'](),_0x5c4d61=await executeSql(_0x311c87['appCode'],_0x311c87[_0x14a34c(0x1da)]('sqlcode'),_0x34fd37),_0x264f21=Date[_0x14a34c(0x1de)]()-_0x5bfd3a,_0x19979e=_0x5c4d61?.['execResult']??_0x5c4d61,_0x1c3940=_0x5c4d61?.[_0x14a34c(0x1d6)]??!![];if(!_0x1c3940)return{'ok':![],'data':{'error':_0x5c4d61?.['execError']||'SQL\x20execution\x20failed','elapsed':_0x264f21},'message':_0x14a34c(0x1cc)};const _0x1d0d9c=Array['isArray'](_0x19979e)?_0x19979e:[];return{'ok':!![],'data':{'rows':_0x1d0d9c,'rowCount':_0x1d0d9c[_0x14a34c(0x1db)],'elapsed':_0x264f21},'message':_0x14a34c(0x1dc)+_0x1d0d9c[_0x14a34c(0x1db)]+_0x14a34c(0x1c9)+_0x264f21+'ms'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x4df5f5,_0xc059fd){const _0x585f8c=a107_0x2eab,_0xee9cf8=_0x4df5f5();while(!![]){try{const _0x460050=parseInt(_0x585f8c(0x79))/0x1*(parseInt(_0x585f8c(0x7a))/0x2)+parseInt(_0x585f8c(0x78))/0x3*(-parseInt(_0x585f8c(0x7e))/0x4)+-parseInt(_0x585f8c(0x80))/0x5*(parseInt(_0x585f8c(0x7d))/0x6)+parseInt(_0x585f8c(0x7f))/0x7*(parseInt(_0x585f8c(0x7c))/0x8)+parseInt(_0x585f8c(0x81))/0x9+-parseInt(_0x585f8c(0x7b))/0xa+parseInt(_0x585f8c(0x82))/0xb;if(_0x460050===_0xc059fd)break;else _0xee9cf8['push'](_0xee9cf8['shift']());}catch(_0x2aff88){_0xee9cf8['push'](_0xee9cf8['shift']());}}}(a107_0x4e80,0x3525b));import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';import{sqlSave}from'../../commands/sql/save.js';function a107_0x2eab(_0x1fff08,_0x18c064){_0x1fff08=_0x1fff08-0x78;const _0x4e80a1=a107_0x4e80();let _0x2eabc2=_0x4e80a1[_0x1fff08];return _0x2eabc2;}import{sqlExec}from'../../commands/sql/exec.js';import{sqlPull}from'../../commands/sql/pull.js';import{sqlCreate}from'../../commands/sql/create.js';import{sqlStatus}from'../../commands/sql/status.js';import{sqlPush}from'../../commands/sql/push.js';function a107_0x4e80(){const _0x587eff=['2616cRoORO','7VbejQw','30pgDtPf','3771558GpVyhK','1513864JVFJIh','1563iHYirb','1QLaeOy','445838GtwgaM','2234860aEVLkp','2720464Ikfccg','337752RKHUsX'];a107_0x4e80=function(){return _0x587eff;};return a107_0x4e80();}import{sqlDelete}from'../../commands/sql/delete.js';export const sqlDefinitions=[sqlList,sqlDetail,sqlStatus,sqlCreate,sqlPush,sqlValidate,sqlSave,sqlExec,sqlPull,sqlDelete];
|
package/lib/commands/sql/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a108_0x5da2(_0x3f4593,_0x382bd8){_0x3f4593=_0x3f4593-0x1a7;const _0x5db8f6=a108_0x5db8();let _0x5da20d=_0x5db8f6[_0x3f4593];return _0x5da20d;}const a108_0x161773=a108_0x5da2;(function(_0x21b0e4,_0x37e0d9){const _0x38d577=a108_0x5da2,_0x17f0d5=_0x21b0e4();while(!![]){try{const _0x5cf882=-parseInt(_0x38d577(0x1b7))/0x1*(-parseInt(_0x38d577(0x1af))/0x2)+parseInt(_0x38d577(0x1b5))/0x3+-parseInt(_0x38d577(0x1b4))/0x4+parseInt(_0x38d577(0x1ac))/0x5*(-parseInt(_0x38d577(0x1c2))/0x6)+-parseInt(_0x38d577(0x1b0))/0x7*(parseInt(_0x38d577(0x1c4))/0x8)+-parseInt(_0x38d577(0x1a8))/0x9*(parseInt(_0x38d577(0x1a9))/0xa)+parseInt(_0x38d577(0x1b6))/0xb;if(_0x5cf882===_0x37e0d9)break;else _0x17f0d5['push'](_0x17f0d5['shift']());}catch(_0x18d0fa){_0x17f0d5['push'](_0x17f0d5['shift']());}}}(a108_0x5db8,0x1ba07));import{listSqlQueries}from'../../core/api-client.js';function a108_0x5db8(){const _0xbe4be8=['697820vplpsw','434703TBsBQe','3477507xfNazt','6kTBevk','tableData','map','appCode','number','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','No\x20custom\x20SQL\x20queries\x20found.','read','sqlCode','totalCount','list','6dWeQOE','dbId','974136sAUikg','Filter\x20by\x20SQL\x20name','num','pagesize','verbose','string','page','name','paging','\x20SQL\x20queries\x20(total:\x20','str','length','boolean','5121eekoPZ','2520WUteLn','bool','Page\x20size','127065fwtTEU','Found\x20','sqlName','39048lmoRyG','7UVNkaP','description','all','List\x20custom\x20SQL\x20queries'];a108_0x5db8=function(){return _0xbe4be8;};return a108_0x5db8();}import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':'sql','command':a108_0x161773(0x1c1),'description':a108_0x161773(0x1b3),'risk':a108_0x161773(0x1be),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a108_0x161773(0x1cb),'type':a108_0x161773(0x1c9),'description':a108_0x161773(0x1c5)},{'name':a108_0x161773(0x1ca),'type':a108_0x161773(0x1bb),'description':'Page\x20number','default':0x1},{'name':a108_0x161773(0x1c7),'type':'number','description':a108_0x161773(0x1ab)},{'name':'verbose','type':a108_0x161773(0x1a7),'description':a108_0x161773(0x1bc)}],async 'execute'(_0x432180){const _0x462f60=a108_0x161773,_0x57a1b5=await listSqlQueries(_0x432180[_0x462f60(0x1ba)],{'sqlCode':_0x432180[_0x462f60(0x1ce)]('sqlcode')||undefined,'sqlName':_0x432180['str'](_0x462f60(0x1cb))||undefined,'currentPage':_0x432180[_0x462f60(0x1c6)](_0x462f60(0x1ca)),'pageSize':_0x432180['num'](_0x462f60(0x1c7),0x32)}),_0x50a52e=_0x432180[_0x462f60(0x1aa)](_0x462f60(0x1c8)),_0x3a7476=_0x57a1b5[_0x462f60(0x1b8)]??[],_0x16244a=_0x57a1b5[_0x462f60(0x1cc)]?.[_0x462f60(0x1c0)]??_0x3a7476[_0x462f60(0x1cf)];let _0x56b81f;return _0x50a52e?_0x56b81f=_0x3a7476:_0x56b81f=await Promise[_0x462f60(0x1b2)](_0x3a7476[_0x462f60(0x1b9)](async _0x4b0917=>{const _0x3e8e20=_0x462f60;let _0x47e38d;try{_0x47e38d=_0x4b0917[_0x3e8e20(0x1c3)]?await getDbName(_0x432180[_0x3e8e20(0x1ba)],_0x4b0917[_0x3e8e20(0x1c3)]):undefined;}catch{}return{'sqlCode':_0x4b0917[_0x3e8e20(0x1bf)],'sqlName':_0x4b0917[_0x3e8e20(0x1ae)],'description':_0x4b0917[_0x3e8e20(0x1b1)]??'','db':_0x47e38d?_0x47e38d+'\x20('+_0x4b0917[_0x3e8e20(0x1c3)]+')':_0x4b0917[_0x3e8e20(0x1c3)]??''};})),{'ok':!![],'data':_0x56b81f,'message':_0x3a7476['length']===0x0?_0x462f60(0x1bd):_0x462f60(0x1ad)+_0x3a7476[_0x462f60(0x1cf)]+_0x462f60(0x1cd)+_0x16244a+').'};}};
|
package/lib/commands/sql/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a79_0x26115d=a79_0x2751;function a79_0x1b4b(){const _0x48c5d1=['\x20error(s)).','skipped','local\x20differs\x20from\x20remote','length','yes','appCode','Would\x20pull\x20','sqlcode','12JgAmjV','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','\x20SQL\x20file(s)\x20under\x20','close','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.\x20Continue?\x20[y/N]\x20','POST','cancelled','str','question','Pull\x20complete:\x20','9hTlFGe','stdin','unchanged','382YvrpND','stderr','name','\x20failed','sqlCode','Force\x20pull\x20cancelled.','tableData','sqlName','would_pull','paging','conflict','boolean','5080768soQIfl','message','645771UPIPbP','62otyMMr','10025260ZQZjnw','\x20written,\x20','14795580zFACkq','26380zMntXc','push','\x20skipped,\x20','Overwrite\x20local\x20files\x20that\x20differ\x20from\x20remote','string','/smartapi/custom/queryUserCustomSqlList','11WodQbW','sql','sqlContent','utf8','trim','362812kNeSvw','toLowerCase','1140ZadoAM','write','Pull\x20remote\x20custom\x20SQL\x20queries\x20into\x20.rabetbase/sql/'];a79_0x1b4b=function(){return _0x48c5d1;};return a79_0x1b4b();}(function(_0xf6a5d,_0xaf2ec9){const _0x1bc6b2=a79_0x2751,_0x38075d=_0xf6a5d();while(!![]){try{const _0x512323=-parseInt(_0x1bc6b2(0x12f))/0x1*(-parseInt(_0x1bc6b2(0x106))/0x2)+parseInt(_0x1bc6b2(0x122))/0x3*(parseInt(_0x1bc6b2(0x115))/0x4)+parseInt(_0x1bc6b2(0x10a))/0x5*(parseInt(_0x1bc6b2(0x117))/0x6)+parseInt(_0x1bc6b2(0x105))/0x7+-parseInt(_0x1bc6b2(0x103))/0x8*(parseInt(_0x1bc6b2(0x12c))/0x9)+parseInt(_0x1bc6b2(0x107))/0xa+-parseInt(_0x1bc6b2(0x110))/0xb*(parseInt(_0x1bc6b2(0x109))/0xc);if(_0x512323===_0xaf2ec9)break;else _0x38075d['push'](_0x38075d['shift']());}catch(_0x2b116f){_0x38075d['push'](_0x38075d['shift']());}}}(a79_0x1b4b,0x936a4));import{createInterface}from'node:readline';import{readFile,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryInfo,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{findProjectRootDirectory}from'../../context.js';import{assignSqlFileNames,buildPulledSqlFileContent,resolveSqlLocalDir}from'../../commands/sql/shared.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';const PAGE_SIZE=0x64;function a79_0x2751(_0x2894a4,_0x4a99d7){_0x2894a4=_0x2894a4-0xfd;const _0x1b4b21=a79_0x1b4b();let _0x275134=_0x1b4b21[_0x2894a4];return _0x275134;}async function fetchAllSqlQueries(_0x21da06,_0x21b65e){const _0x588f33=a79_0x2751,_0x471b8b=[];let _0x12112d=0x1;while(!![]){const _0x3628e8=await listSqlQueries(_0x21da06,{'currentPage':_0x12112d,'pageSize':PAGE_SIZE,'sqlCode':_0x21b65e[_0x588f33(0x133)],'sqlName':_0x21b65e[_0x588f33(0xfe)]}),_0x549d19=_0x3628e8[_0x588f33(0xfd)]??[];_0x471b8b['push'](..._0x549d19);if(_0x549d19[_0x588f33(0x11d)]===0x0)break;const _0x5108d4=_0x3628e8[_0x588f33(0x100)]?.['totalCount'];if(_0x5108d4!=null?_0x471b8b[_0x588f33(0x11d)]>=_0x5108d4:_0x549d19[_0x588f33(0x11d)]<PAGE_SIZE)break;_0x12112d++;}return _0x471b8b;}async function ensureSqlContent(_0x3e903d,_0x18940c){const _0x30a0f4=a79_0x2751;if(_0x18940c[_0x30a0f4(0x112)]!=null&&String(_0x18940c[_0x30a0f4(0x112)])['length']>0x0)return _0x18940c;return getSqlQueryInfo(_0x3e903d,_0x18940c[_0x30a0f4(0x133)]);}export const sqlPull={'service':a79_0x26115d(0x111),'command':'pull','description':a79_0x26115d(0x119),'risk':a79_0x26115d(0x118),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a79_0x26115d(0x131),'type':a79_0x26115d(0x10e),'description':'Filter\x20by\x20SQL\x20display\x20name\x20(API\x20filter)'},{'name':'force','type':a79_0x26115d(0x102),'description':a79_0x26115d(0x10d)}],async 'dryRun'(_0x4d6b4c){const _0x195cf1=a79_0x26115d,_0x12619a=findProjectRootDirectory(),_0x2a8fbf=resolveSqlLocalDir(_0x12619a),_0x212b2b=_0x4d6b4c[_0x195cf1(0x129)](_0x195cf1(0x121))||undefined,_0x14fff9=_0x4d6b4c[_0x195cf1(0x129)](_0x195cf1(0x131))||undefined,_0x17847e=await fetchAllSqlQueries(_0x4d6b4c[_0x195cf1(0x11f)],{'sqlCode':_0x212b2b,'sqlName':_0x14fff9}),_0x425648=[],_0x2047eb=[];for(const _0x168022 of _0x17847e){try{_0x425648[_0x195cf1(0x10b)](await ensureSqlContent(_0x4d6b4c[_0x195cf1(0x11f)],_0x168022));}catch(_0x1cc8cf){_0x2047eb[_0x195cf1(0x10b)]({'sqlCode':_0x168022[_0x195cf1(0x133)],'error':_0x1cc8cf instanceof Error?_0x1cc8cf[_0x195cf1(0x104)]:String(_0x1cc8cf)});}}const _0x54a967=assignSqlFileNames(_0x425648),_0x5661e0=[];for(const [_0x35ddd0,_0x19f119]of _0x54a967){const _0x565e5b=join(_0x2a8fbf,_0x35ddd0),_0x141f37=buildPulledSqlFileContent(_0x19f119);let _0x3a451f=_0x195cf1(0xff),_0x5c8074;if(await fileExists(_0x565e5b)){const _0x3cff2b=await readFile(_0x565e5b,_0x195cf1(0x113));_0x3cff2b===_0x141f37?(_0x3a451f=_0x195cf1(0x11b),_0x5c8074=_0x195cf1(0x12e)):(_0x3a451f=_0x195cf1(0x101),_0x5c8074=_0x195cf1(0x123));}_0x5661e0['push']({'sqlCode':_0x19f119['sqlCode'],'sqlName':_0x19f119['sqlName'],'filePath':_0x565e5b,'status':_0x3a451f,'reason':_0x5c8074});}return{'method':_0x195cf1(0x127),'url':_0x195cf1(0x10f),'body':{'appCode':_0x4d6b4c[_0x195cf1(0x11f)],'sqlCode':_0x212b2b??null,'sqlName':_0x14fff9??null,'loadErrors':_0x2047eb,'files':_0x5661e0},'description':_0x195cf1(0x120)+_0x5661e0[_0x195cf1(0x11d)]+_0x195cf1(0x124)+_0x2a8fbf};},async 'execute'(_0x461191){const _0x246f02=a79_0x26115d,_0x1a1a93=findProjectRootDirectory(),_0x1c213f=resolveSqlLocalDir(_0x1a1a93),_0x2ecab4=_0x461191['str'](_0x246f02(0x121))||undefined,_0x136c18=_0x461191[_0x246f02(0x129)](_0x246f02(0x131))||undefined,_0x3dce7d=_0x461191['bool']('force'),_0x182120=await fetchAllSqlQueries(_0x461191[_0x246f02(0x11f)],{'sqlCode':_0x2ecab4,'sqlName':_0x136c18});if(_0x182120[_0x246f02(0x11d)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':'No\x20remote\x20SQL\x20queries\x20matched.'};const _0x52a24e=[],_0x219b88=[];for(const _0x5265d3 of _0x182120){try{_0x52a24e[_0x246f02(0x10b)](await ensureSqlContent(_0x461191[_0x246f02(0x11f)],_0x5265d3));}catch(_0x59cba5){_0x219b88[_0x246f02(0x10b)]({'sqlCode':_0x5265d3['sqlCode'],'error':_0x59cba5 instanceof Error?_0x59cba5[_0x246f02(0x104)]:String(_0x59cba5)});}}if(_0x52a24e[_0x246f02(0x11d)]===0x0)return{'ok':![],'data':{'pulled':[],'skipped':[],'failed':_0x219b88},'message':'Pull\x20failed:\x20could\x20not\x20load\x20SQL\x20content\x20('+_0x219b88[_0x246f02(0x11d)]+_0x246f02(0x11a)};const _0x15d363=assignSqlFileNames(_0x52a24e);if(_0x3dce7d&&!_0x461191['nonInteractive']){let _0x537511=![];for(const [_0x5818d9,_0x4e9272]of _0x15d363){const _0x1a9bb5=join(_0x1c213f,_0x5818d9),_0x31e710=buildPulledSqlFileContent(_0x4e9272);if(await fileExists(_0x1a9bb5)){const _0x54ab96=await readFile(_0x1a9bb5,_0x246f02(0x113));if(_0x54ab96!==_0x31e710){_0x537511=!![];break;}}}if(_0x537511){const _0x54a02d=await confirmForce();if(!_0x54a02d)throw CliErrors[_0x246f02(0x128)](_0x246f02(0x134));}}const _0x4b4dfd=[],_0x2ba38d=[];for(const [_0x4a1a92,_0x15e826]of _0x15d363){const _0x190598=join(_0x1c213f,_0x4a1a92),_0x18fc6a=buildPulledSqlFileContent(_0x15e826);try{if(await fileExists(_0x190598)){const _0x1d5961=await readFile(_0x190598,'utf8');if(_0x1d5961===_0x18fc6a){_0x2ba38d[_0x246f02(0x10b)]({'sqlCode':_0x15e826[_0x246f02(0x133)],'reason':_0x246f02(0x12e)});continue;}if(!_0x3dce7d){_0x2ba38d['push']({'sqlCode':_0x15e826['sqlCode'],'reason':_0x246f02(0x11c)});continue;}}await ensureParentDirectory(_0x190598),await writeFile(_0x190598,_0x18fc6a,_0x246f02(0x113)),_0x4b4dfd['push']({'sqlCode':_0x15e826[_0x246f02(0x133)],'filePath':_0x190598});}catch(_0x4003d0){_0x219b88['push']({'sqlCode':_0x15e826[_0x246f02(0x133)],'error':_0x4003d0 instanceof Error?_0x4003d0[_0x246f02(0x104)]:String(_0x4003d0)});}}const _0x170213=_0x219b88['length']===0x0;return{'ok':_0x170213,'data':{'pulled':_0x4b4dfd,'skipped':_0x2ba38d,'failed':_0x219b88},'message':_0x246f02(0x12b)+_0x4b4dfd[_0x246f02(0x11d)]+_0x246f02(0x108)+_0x2ba38d['length']+_0x246f02(0x10c)+_0x219b88['length']+_0x246f02(0x132)};}};async function confirmForce(){const _0x5e90b6=a79_0x26115d,_0x323603=createInterface({'input':process[_0x5e90b6(0x12d)],'output':process[_0x5e90b6(0x130)]}),_0x1f0d63=await new Promise(_0x3dc4b7=>{const _0x5aa0e7=_0x5e90b6;_0x323603[_0x5aa0e7(0x12a)](_0x5aa0e7(0x126),_0x3dc4b7);});return _0x323603[_0x5e90b6(0x125)](),['y',_0x5e90b6(0x11e)]['includes'](_0x1f0d63[_0x5e90b6(0x114)]()[_0x5e90b6(0x116)]());}
|
|
1
|
+
const a109_0xf901e2=a109_0x31b8;(function(_0x1a732a,_0xdb90a7){const _0xcc463=a109_0x31b8,_0x41d526=_0x1a732a();while(!![]){try{const _0x2ac1b8=parseInt(_0xcc463(0x187))/0x1+parseInt(_0xcc463(0x1a7))/0x2*(-parseInt(_0xcc463(0x17f))/0x3)+-parseInt(_0xcc463(0x194))/0x4*(-parseInt(_0xcc463(0x1a2))/0x5)+-parseInt(_0xcc463(0x172))/0x6*(parseInt(_0xcc463(0x18f))/0x7)+parseInt(_0xcc463(0x198))/0x8*(parseInt(_0xcc463(0x192))/0x9)+parseInt(_0xcc463(0x188))/0xa+parseInt(_0xcc463(0x17d))/0xb;if(_0x2ac1b8===_0xdb90a7)break;else _0x41d526['push'](_0x41d526['shift']());}catch(_0x104549){_0x41d526['push'](_0x41d526['shift']());}}}(a109_0x3d4b,0x37855));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';function a109_0x31b8(_0x229130,_0x144e3a){_0x229130=_0x229130-0x170;const _0x3d4b2b=a109_0x3d4b();let _0x31b8ad=_0x3d4b2b[_0x229130];return _0x31b8ad;}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(_0x5719af,_0x2b7e4b){const _0x2abdf2=a109_0x31b8,_0x2a47fd=[];let _0x316f36=0x1;while(!![]){const _0x33cea9=await listSqlQueries(_0x5719af,{'currentPage':_0x316f36,'pageSize':PAGE_SIZE,'sqlCode':_0x2b7e4b[_0x2abdf2(0x1a1)],'sqlName':_0x2b7e4b[_0x2abdf2(0x173)]}),_0x727f73=_0x33cea9[_0x2abdf2(0x171)]??[];_0x2a47fd['push'](..._0x727f73);if(_0x727f73[_0x2abdf2(0x19b)]===0x0)break;const _0x54ffb7=_0x33cea9[_0x2abdf2(0x1a6)]?.[_0x2abdf2(0x1a3)];if(_0x54ffb7!=null?_0x2a47fd[_0x2abdf2(0x19b)]>=_0x54ffb7:_0x727f73[_0x2abdf2(0x19b)]<PAGE_SIZE)break;_0x316f36++;}return _0x2a47fd;}function a109_0x3d4b(){const _0x33139c=['pull','315289WlseWH','219480TujcTe','skipped','sqlcode','unchanged','push','write','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','36554ibWrNc','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','dbId','763299LrvtzW','Force\x20overwrite\x20local\x20unsynced\x20changes','301416txJECa','str','appCode','trimStart','8PEabZk','\x20skipped,\x20','force','length','sqlContent','lockFilePath','boolean','\x20SQL\x20file(s)\x20into\x20','toISOString','sqlCode','5HECCFe','totalCount','catch','test','paging','420166tArDFD','local\x20differs\x20from\x20remote','name','\x20written,\x20','tableData','216CgcEgu','sqlName','POST','sqls','path','apps','description','bool','Force\x20pull\x20cancelled.','utf8','sqlRootDir','3719859pWhMsQ','would_pull','6rSiVXj','Filter\x20by\x20SQL\x20display\x20name','message','conflict','sqlRoot','lastSync','sql'];a109_0x3d4b=function(){return _0x33139c;};return a109_0x3d4b();}async function ensureSqlContent(_0x49b44c){const _0x1ca7b6=a109_0x31b8;if(_0x49b44c[_0x1ca7b6(0x19c)]!=null&&String(_0x49b44c[_0x1ca7b6(0x19c)])[_0x1ca7b6(0x19b)]>0x0)return _0x49b44c;return getSqlQueryDetail(_0x49b44c[_0x1ca7b6(0x1a1)]);}export const sqlPull={'service':a109_0xf901e2(0x185),'command':a109_0xf901e2(0x186),'description':a109_0xf901e2(0x190),'risk':a109_0xf901e2(0x18d),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a109_0xf901e2(0x1a9),'type':'string','description':a109_0xf901e2(0x180)},{'name':a109_0xf901e2(0x19a),'type':a109_0xf901e2(0x19e),'description':a109_0xf901e2(0x193)}],async 'dryRun'(_0x2bf87f){const _0x1231b1=a109_0xf901e2,_0x2b9eed=loadSqlProjectConfig(_0x2bf87f[_0x1231b1(0x196)]),_0x255951=await readSqlLockFile(_0x2b9eed[_0x1231b1(0x19d)]),{appLock:_0x50f945}=ensureSqlLockScope(_0x255951??createEmptySqlLock(),_0x2b9eed[_0x1231b1(0x196)],_0x2b9eed[_0x1231b1(0x183)],_0x1231b1(0x186)),_0x52d6e9=await fetchAllSqlQueries(_0x2bf87f['appCode'],{'sqlCode':_0x2bf87f[_0x1231b1(0x195)]('sqlcode')||undefined,'sqlName':_0x2bf87f['str'](_0x1231b1(0x1a9))||undefined}),_0x519c8a=[];for(const _0x296c61 of _0x52d6e9){const _0xd58bb0=await ensureSqlContent(_0x296c61),_0x4e5ebb=ensureRemoteSqlContent(_0xd58bb0),_0x2957a2=_0xd58bb0['dbId']?await getDbName(_0x2bf87f[_0x1231b1(0x196)],Number(_0xd58bb0['dbId']))[_0x1231b1(0x1a4)](()=>undefined):undefined,_0x450682=buildLocalSqlFileContent({'sqlCode':_0xd58bb0[_0x1231b1(0x1a1)],'sqlName':_0xd58bb0['sqlName'],'dbId':_0xd58bb0[_0x1231b1(0x191)]},_0x4e5ebb,{'dbName':_0x2957a2,'mode':detectModeFromSql(_0xd58bb0),'syncedAt':new Date()[_0x1231b1(0x1a0)](),'description':_0xd58bb0['description']}),_0xf1a6c1=buildSqlLockEntry(_0xd58bb0,_0x4e5ebb,'',{'dbName':_0x2957a2}),_0x31cc0a=resolveLocalSqlFilePath(_0x2b9eed,_0xd58bb0[_0x1231b1(0x1a1)],_0xf1a6c1);let _0x370572=_0x1231b1(0x17e),_0x35c585;if(await fileExists(_0x31cc0a)){const _0x564c54=await readFile(_0x31cc0a,_0x1231b1(0x17b));_0x564c54===_0x450682?(_0x370572=_0x1231b1(0x189),_0x35c585='unchanged'):(_0x370572=_0x1231b1(0x182),_0x35c585=_0x1231b1(0x18e));}_0x519c8a['push']({'sqlCode':_0xd58bb0[_0x1231b1(0x1a1)],'sqlName':_0xd58bb0[_0x1231b1(0x173)],'filePath':_0x31cc0a,'status':_0x370572,'reason':_0x35c585});}return{'method':_0x1231b1(0x174),'url':'/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','body':{'appCode':_0x2bf87f[_0x1231b1(0x196)],'sqlCode':_0x2bf87f[_0x1231b1(0x195)](_0x1231b1(0x18a))||null,'sqlName':_0x2bf87f['str'](_0x1231b1(0x1a9))||null,'files':_0x519c8a},'description':'Would\x20pull\x20'+_0x519c8a[_0x1231b1(0x19b)]+_0x1231b1(0x19f)+_0x2b9eed['sqlRootDir']};},async 'execute'(_0x23e219){const _0x4452e2=a109_0xf901e2,_0x2eecbb=loadSqlProjectConfig(_0x23e219[_0x4452e2(0x196)]),_0xf59966=await readSqlLockFile(_0x2eecbb[_0x4452e2(0x19d)]),{lockData:_0x4cc0d3,appLock:_0x2e6922}=ensureSqlLockScope(_0xf59966??createEmptySqlLock(),_0x2eecbb[_0x4452e2(0x196)],_0x2eecbb[_0x4452e2(0x183)],_0x4452e2(0x186)),_0x449d48=_0x23e219[_0x4452e2(0x179)](_0x4452e2(0x19a)),_0x3d5145=await fetchAllSqlQueries(_0x23e219[_0x4452e2(0x196)],{'sqlCode':_0x23e219[_0x4452e2(0x195)](_0x4452e2(0x18a))||undefined,'sqlName':_0x23e219[_0x4452e2(0x195)](_0x4452e2(0x1a9))||undefined});if(_0x3d5145[_0x4452e2(0x19b)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':'No\x20remote\x20SQL\x20queries\x20matched.'};const _0x5f17da=[],_0x4a57cb=[];for(const _0x236ea5 of _0x3d5145){try{_0x5f17da[_0x4452e2(0x18c)](await ensureSqlContent(_0x236ea5));}catch(_0x1a26d9){_0x4a57cb[_0x4452e2(0x18c)]({'sqlCode':_0x236ea5[_0x4452e2(0x1a1)],'error':_0x1a26d9 instanceof Error?_0x1a26d9[_0x4452e2(0x181)]:String(_0x1a26d9)});}}if(_0x449d48&&!_0x23e219['nonInteractive']){let _0x35c408=![];for(const _0x177166 of _0x5f17da){const _0x29f44c=_0x177166['dbId']?await getDbName(_0x23e219[_0x4452e2(0x196)],Number(_0x177166[_0x4452e2(0x191)]))['catch'](()=>undefined):undefined,_0x41d255=resolveLocalSqlFilePath(_0x2eecbb,_0x177166['sqlCode'],buildSqlLockEntry(_0x177166,ensureRemoteSqlContent(_0x177166),'',{'dbName':_0x29f44c}));if(await fileExists(_0x41d255)){const _0x52cb8f=await readFile(_0x41d255,_0x4452e2(0x17b));if(_0x52cb8f!==ensureRemoteSqlContent(_0x177166)){_0x35c408=!![];break;}}}if(_0x35c408){const _0x50b8d2=await confirmForceOverwrite('Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.');if(!_0x50b8d2)throw CliErrors['cancelled'](_0x4452e2(0x17a));}}const _0x5b015d=cloneSqlLockData(_0x4cc0d3),_0x5a891f=_0x5b015d[_0x4452e2(0x177)][_0x2eecbb['appCode']],_0x2eabe3=[],_0x4360ec=[];for(const _0x1f3f1d of _0x5f17da){const _0xb55efb=_0x5a891f['sqls'][_0x1f3f1d[_0x4452e2(0x1a1)]],_0x4b4e15=ensureRemoteSqlContent(_0x1f3f1d),_0x4b65ff=_0x1f3f1d['dbId']?await getDbName(_0x23e219[_0x4452e2(0x196)],Number(_0x1f3f1d['dbId']))[_0x4452e2(0x1a4)](()=>undefined):undefined,_0x12c4d3=buildLocalSqlFileContent({'sqlCode':_0x1f3f1d[_0x4452e2(0x1a1)],'sqlName':_0x1f3f1d[_0x4452e2(0x173)],'dbId':_0x1f3f1d[_0x4452e2(0x191)]},_0x4b4e15,{'dbName':_0x4b65ff,'mode':detectModeFromSql(_0x1f3f1d),'syncedAt':new Date()['toISOString'](),'description':_0x1f3f1d[_0x4452e2(0x178)]}),_0x3fd8a0=buildSqlLockEntry(_0x1f3f1d,_0x4b4e15,computeSqlContentHash(_0x12c4d3),{'dbName':_0x4b65ff}),_0x4929d5=_0x3fd8a0[_0x4452e2(0x176)],_0x3c222f=join(_0x2eecbb[_0x4452e2(0x17c)],_0x4929d5);try{if(await fileExists(_0x3c222f)){const _0x23a28d=await readFile(_0x3c222f,'utf8');if(_0x23a28d===_0x12c4d3){_0x4360ec['push']({'sqlCode':_0x1f3f1d[_0x4452e2(0x1a1)],'reason':_0x4452e2(0x18b)}),_0x5a891f[_0x4452e2(0x175)][_0x1f3f1d[_0x4452e2(0x1a1)]]={..._0x3fd8a0,'path':_0x4929d5};continue;}if(!_0x449d48){_0x4360ec[_0x4452e2(0x18c)]({'sqlCode':_0x1f3f1d[_0x4452e2(0x1a1)],'reason':_0x4452e2(0x1a8)});continue;}}const _0x24af5a=_0xb55efb?.['path']?join(_0x2eecbb['sqlRootDir'],_0xb55efb['path']):undefined;_0x24af5a&&_0x24af5a!==_0x3c222f&&await fileExists(_0x24af5a)&&await rm(_0x24af5a,{'force':!![]}),await ensureParentDirectory(_0x3c222f),await writeFile(_0x3c222f,_0x12c4d3,_0x4452e2(0x17b)),_0x5a891f[_0x4452e2(0x175)][_0x1f3f1d[_0x4452e2(0x1a1)]]={..._0x3fd8a0,'path':_0x4929d5},_0x2eabe3[_0x4452e2(0x18c)]({'sqlCode':_0x1f3f1d[_0x4452e2(0x1a1)],'filePath':_0x3c222f});}catch(_0x4f36d8){_0x4a57cb[_0x4452e2(0x18c)]({'sqlCode':_0x1f3f1d[_0x4452e2(0x1a1)],'error':_0x4f36d8 instanceof Error?_0x4f36d8[_0x4452e2(0x181)]:String(_0x4f36d8)});}}return _0x5a891f[_0x4452e2(0x184)]=new Date()[_0x4452e2(0x1a0)](),await writeSqlLockFile(_0x2eecbb[_0x4452e2(0x19d)],_0x5b015d),{'ok':_0x4a57cb[_0x4452e2(0x19b)]===0x0,'data':{'pulled':_0x2eabe3,'skipped':_0x4360ec,'failed':_0x4a57cb},'message':'Pull\x20complete:\x20'+_0x2eabe3[_0x4452e2(0x19b)]+_0x4452e2(0x170)+_0x4360ec[_0x4452e2(0x19b)]+_0x4452e2(0x199)+_0x4a57cb[_0x4452e2(0x19b)]+'\x20failed'};}};function detectModeFromSql(_0x3c0e8b){const _0x4ad9ea=a109_0xf901e2,_0x4e7a9b=ensureRemoteSqlContent(_0x3c0e8b),_0x34cca5=stripLocalSqlMetadata(_0x4e7a9b,'mybatisXml')[_0x4ad9ea(0x197)]();if(/^<(select|insert|update|delete)\b/i[_0x4ad9ea(0x1a5)](_0x34cca5))return'mybatisXml';return _0x4ad9ea(0x185);}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const a110_0x1701b2=a110_0xd852;(function(_0x5387a2,_0x18c521){const _0x40a9cc=a110_0xd852,_0x32c315=_0x5387a2();while(!![]){try{const _0x52a83f=-parseInt(_0x40a9cc(0x1ed))/0x1+parseInt(_0x40a9cc(0x1bc))/0x2*(parseInt(_0x40a9cc(0x1d9))/0x3)+parseInt(_0x40a9cc(0x1e1))/0x4*(-parseInt(_0x40a9cc(0x1d4))/0x5)+parseInt(_0x40a9cc(0x1f4))/0x6*(parseInt(_0x40a9cc(0x1c8))/0x7)+parseInt(_0x40a9cc(0x1d6))/0x8+-parseInt(_0x40a9cc(0x1c9))/0x9+-parseInt(_0x40a9cc(0x1e4))/0xa*(-parseInt(_0x40a9cc(0x1c0))/0xb);if(_0x52a83f===_0x18c521)break;else _0x32c315['push'](_0x32c315['shift']());}catch(_0x1bda43){_0x32c315['push'](_0x32c315['shift']());}}}(a110_0x59b4,0xe8191));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';function a110_0xd852(_0x5187df,_0x3ba78d){_0x5187df=_0x5187df-0x1bc;const _0x59b45c=a110_0x59b4();let _0xd852a3=_0x59b45c[_0x5187df];return _0xd852a3;}import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';async function getTargetSqlQueries(_0x2ae5ed,_0x1feaaa,_0x68937){const _0x5f034c=a110_0xd852,_0x2e02ab=await scanLocalSqlQueries(_0x2ae5ed),_0x1e683b=new Map();for(const _0x4aeec5 of _0x2e02ab){if(_0x68937&&_0x4aeec5[_0x5f034c(0x1dc)]!==_0x68937)continue;const _0xed235a=_0x1e683b[_0x5f034c(0x1f2)](_0x4aeec5[_0x5f034c(0x1dc)])??[];_0xed235a[_0x5f034c(0x1cc)](_0x4aeec5),_0x1e683b['set'](_0x4aeec5[_0x5f034c(0x1dc)],_0xed235a);}if(_0x68937&&!_0x1e683b[_0x5f034c(0x1e5)](_0x68937))throw CliErrors[_0x5f034c(0x1e8)](_0x5f034c(0x1d1)+_0x68937);const _0x18170b=[];for(const [_0x21ca7d,_0x1e10a3]of _0x1e683b[_0x5f034c(0x1ee)]()){if(_0x1e10a3['length']===0x1){_0x18170b[_0x5f034c(0x1cc)](_0x1e10a3[0x0]);continue;}const _0xf359e7=_0x1feaaa['sqls'][_0x21ca7d],_0x515238=_0xf359e7?.[_0x5f034c(0x1e7)],_0x2c548d=_0x515238?_0x1e10a3['filter'](_0x14904a=>_0x14904a[_0x5f034c(0x1c5)]!==_0x515238):_0x1e10a3;if(_0xf359e7&&_0x2c548d[_0x5f034c(0x1d2)]===0x1){_0x18170b[_0x5f034c(0x1cc)](_0x2c548d[0x0]);continue;}throw CliErrors['validation']('Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20'+_0x21ca7d+'.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.');}return _0x18170b;}export const sqlPush={'service':'sql','command':a110_0x1701b2(0x1cc),'description':a110_0x1701b2(0x1c3),'risk':a110_0x1701b2(0x1f3),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a110_0x1701b2(0x1be),'type':'boolean','description':a110_0x1701b2(0x1d8)}],async 'dryRun'(_0x3f2054){const _0x3673ed=a110_0x1701b2,_0x3f4c26=loadSqlProjectConfig(_0x3f2054['appCode']),_0x9969d4=await readSqlLockFile(_0x3f4c26[_0x3673ed(0x1c7)]),{appLock:_0x22a83f}=ensureSqlLockScope(_0x9969d4??createEmptySqlLock(),_0x3f2054['appCode'],_0x3f4c26[_0x3673ed(0x1db)],_0x3673ed(0x1cc)),_0x20c739=await getTargetSqlQueries(_0x3f4c26,_0x22a83f,_0x3f2054[_0x3673ed(0x1f8)](_0x3673ed(0x1ef))||undefined),_0x52ced2=[];for(const _0x33a0c2 of _0x20c739){const _0x28da98=await computeSqlFileHash(_0x33a0c2['filePath']),_0x529b47=_0x22a83f['sqls'][_0x33a0c2['sqlCode']],_0x42aefe=!!_0x529b47&&(_0x529b47['path']!==_0x33a0c2[_0x3673ed(0x1c5)]||!!_0x33a0c2[_0x3673ed(0x1ea)]&&_0x529b47[_0x3673ed(0x1ea)]!==_0x33a0c2[_0x3673ed(0x1ea)]);if(!_0x3f2054[_0x3673ed(0x1cd)](_0x3673ed(0x1be))&&_0x529b47&&_0x529b47[_0x3673ed(0x1e2)]===_0x28da98&&!_0x42aefe)continue;_0x52ced2['push'](_0x33a0c2[_0x3673ed(0x1dc)]);}return{'method':_0x3673ed(0x1fc),'url':_0x3673ed(0x1e3),'body':{'sqlCodes':_0x52ced2,'appCode':_0x3f2054[_0x3673ed(0x1eb)]},'description':_0x3673ed(0x1c2)+_0x52ced2[_0x3673ed(0x1d2)]+_0x3673ed(0x1cf)};},async 'execute'(_0x523f43){const _0x330db6=a110_0x1701b2,_0x4687ea=loadSqlProjectConfig(_0x523f43[_0x330db6(0x1eb)]),_0x337968=await readSqlLockFile(_0x4687ea[_0x330db6(0x1c7)]),{lockData:_0xcaa9db,appLock:_0x1754c4}=ensureSqlLockScope(_0x337968??createEmptySqlLock(),_0x523f43[_0x330db6(0x1eb)],_0x4687ea[_0x330db6(0x1db)],_0x330db6(0x1cc)),_0x2536f2=await getTargetSqlQueries(_0x4687ea,_0x1754c4,_0x523f43['str'](_0x330db6(0x1ef))||undefined);if(_0x2536f2[_0x330db6(0x1d2)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x330db6(0x1da)};const _0x57731f=[],_0x4b6380=[],_0x352adf=[];for(const _0x19f28f of _0x2536f2){const _0x36234e=_0x1754c4[_0x330db6(0x1bd)][_0x19f28f[_0x330db6(0x1dc)]];if(!_0x36234e){_0x352adf['push']({'sqlCode':_0x19f28f[_0x330db6(0x1dc)],'error':_0x330db6(0x1ce)});continue;}try{const _0x44612d=await computeSqlFileHash(_0x19f28f['filePath']),_0x2bf06e=_0x36234e[_0x330db6(0x1e7)]!==_0x19f28f[_0x330db6(0x1c5)]||!!_0x19f28f[_0x330db6(0x1ea)]&&_0x36234e['sqlName']!==_0x19f28f['sqlName'];if(!_0x523f43[_0x330db6(0x1cd)](_0x330db6(0x1be))&&_0x36234e[_0x330db6(0x1e2)]===_0x44612d&&!_0x2bf06e){_0x4b6380[_0x330db6(0x1cc)]({'sqlCode':_0x19f28f[_0x330db6(0x1dc)],'reason':'unchanged'});continue;}if(_0x36234e[_0x330db6(0x1bf)]==null){_0x352adf[_0x330db6(0x1cc)]({'sqlCode':_0x19f28f[_0x330db6(0x1dc)],'error':_0x330db6(0x1c1)});continue;}const _0x460ac2=await readFile(_0x19f28f['filePath'],_0x330db6(0x1f5)),_0xd098ec=stripLocalSqlMetadata(_0x460ac2,_0x19f28f[_0x330db6(0x1c6)]),_0x26a0f6=_0x19f28f[_0x330db6(0x1ea)]||_0x36234e[_0x330db6(0x1ea)],_0x381f96=await resolveTargetDbBinding(_0x523f43['appCode'],_0x19f28f,_0x36234e),_0x166783=await updateSqlQuery({'id':_0x36234e['remoteId'],'appCode':_0x523f43[_0x330db6(0x1eb)],'sqlCode':_0x19f28f[_0x330db6(0x1dc)],'sqlName':_0x26a0f6,'dbId':_0x381f96['dbId'],'version':_0x36234e[_0x330db6(0x1bf)],'sqlContent':_0xd098ec,'sqlConfig':_0x36234e[_0x330db6(0x1d5)]??undefined}),_0x5cc535=_0x166783[_0x330db6(0x1d0)]?await getDbName(_0x523f43[_0x330db6(0x1eb)],Number(_0x166783[_0x330db6(0x1d0)]))[_0x330db6(0x1fb)](()=>_0x381f96['dbName']):_0x381f96[_0x330db6(0x1e9)];_0x1754c4[_0x330db6(0x1bd)][_0x19f28f[_0x330db6(0x1dc)]]={...buildSqlLockEntry(_0x166783,_0xd098ec,_0x44612d,{'dbName':_0x5cc535}),'path':_0x19f28f[_0x330db6(0x1c5)],'mode':_0x36234e[_0x330db6(0x1c6)]},await archivePreviousSqlFileIfNeeded(_0x4687ea,_0x36234e['path'],_0x19f28f['relativePath']),_0x57731f[_0x330db6(0x1cc)]({'sqlCode':_0x19f28f[_0x330db6(0x1dc)],'remoteId':_0x36234e['remoteId']});}catch(_0x4b2841){_0x352adf[_0x330db6(0x1cc)]({'sqlCode':_0x19f28f[_0x330db6(0x1dc)],'error':_0x4b2841 instanceof Error?_0x4b2841[_0x330db6(0x1de)]:String(_0x4b2841)});}}return _0x1754c4[_0x330db6(0x1cb)]=new Date()[_0x330db6(0x1d3)](),await writeSqlLockFile(_0x4687ea['lockFilePath'],_0xcaa9db),{'ok':_0x352adf[_0x330db6(0x1d2)]===0x0,'data':{'pushed':_0x57731f,'skipped':_0x4b6380,'failed':_0x352adf},'message':'Push\x20complete:\x20'+_0x57731f['length']+'\x20pushed,\x20'+_0x4b6380[_0x330db6(0x1d2)]+_0x330db6(0x1f7)+_0x352adf[_0x330db6(0x1d2)]+'\x20failed'};}};async function archivePreviousSqlFileIfNeeded(_0x175a60,_0x17b257,_0x448667){const _0x1b93e1=a110_0x1701b2;if(!_0x17b257||_0x17b257===_0x448667)return;const _0x49007e=join(_0x175a60[_0x1b93e1(0x1f0)],_0x17b257);if(!await fileExists(_0x49007e))return;const _0x311f14=await moveToTrash(_0x175a60[_0x1b93e1(0x1d7)],_0x175a60['trashDir'],_0x49007e);await cleanupEmptyDirectories(dirname(_0x49007e),_0x175a60[_0x1b93e1(0x1f0)]),void _0x311f14;}async function moveToTrash(_0x39c9aa,_0x4868ca,_0xe58740){const _0x4c2f1e=a110_0x1701b2,_0x173ce5=new Date()[_0x4c2f1e(0x1d3)]()[_0x4c2f1e(0x1e6)](/[:.]/g,'-'),_0x5b03e3=relative(_0x39c9aa,_0xe58740),_0xfa1fd7=join(_0x4868ca,_0x173ce5,_0x5b03e3);return await mkdir(dirname(_0xfa1fd7),{'recursive':!![]}),await rename(_0xe58740,_0xfa1fd7),_0xfa1fd7;}async function cleanupEmptyDirectories(_0x1ac306,_0xc06783){const _0x4576af=a110_0x1701b2;let _0x1cb4ee=resolve(_0x1ac306);const _0x5243a1=resolve(_0xc06783);while(_0x1cb4ee[_0x4576af(0x1fa)](''+_0x5243a1+sep)||_0x1cb4ee===_0x5243a1){if(_0x1cb4ee===_0x5243a1)return;try{const _0x1d3c5a=await readdir(_0x1cb4ee);if(_0x1d3c5a['length']>0x0)return;await rmdir(_0x1cb4ee);}catch{return;}_0x1cb4ee=dirname(_0x1cb4ee);}}function a110_0x59b4(){const _0x41b1a2=['1487710Orzvdx','sqls','force','version','23925033JnhHDX','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','Would\x20push\x20','Push\x20local\x20SQL\x20files\x20to\x20remote','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','relativePath','mode','lockFilePath','54299ueGUWO','14148936HkSHPG','dbDirectory','lastSync','push','bool','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','\x20SQL\x20file(s)','dbId','Local\x20SQL\x20not\x20found:\x20','length','toISOString','435vGBBWt','sqlConfig','2621672epEDQN','projectRoot','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','6GvQbYW','No\x20local\x20SQL\x20files\x20found.','sqlRoot','sqlCode','join','message','Local\x20directory\x20\x22','\x22\x20for\x20sqlCode\x20','52196RiGlbk','hash','/smartapi/custom/updateUserCustomSql','10YOdiKo','has','replace','path','validation','dbName','sqlName','appCode','map','1495932HPWizv','entries','sqlcode','sqlRootDir','No\x20database\x20matches\x20local\x20directory\x20\x22','get','high-risk-write','900iNadLq','utf8','exec','\x20skipped,\x20','str','filter','startsWith','catch','POST'];a110_0x59b4=function(){return _0x41b1a2;};return a110_0x59b4();}async function resolveTargetDbBinding(_0x1d5881,_0x541ada,_0xf29645){const _0x46cbf7=a110_0x1701b2,_0x2cb764=_0x541ada[_0x46cbf7(0x1ca)];if(!_0x2cb764)return{'dbId':_0xf29645[_0x46cbf7(0x1d0)],'dbName':_0xf29645['dbName']};const _0x15ec59=buildDbDirectoryName(_0xf29645['dbName'],_0xf29645[_0x46cbf7(0x1d0)]);if(_0x2cb764===_0x15ec59)return{'dbId':_0xf29645[_0x46cbf7(0x1d0)],'dbName':_0xf29645['dbName']};const _0x2e5cd0=parseExplicitDbDirectory(_0x2cb764);if(_0x2e5cd0!=null)return{'dbId':_0x2e5cd0,'dbName':await getDbName(_0x1d5881,_0x2e5cd0)[_0x46cbf7(0x1fb)](()=>undefined)};const _0x315da0=await listDatabases(_0x1d5881),_0x55adb7=_0x315da0[_0x46cbf7(0x1f9)](_0x2825a5=>buildDbDirectoryName(_0x2825a5['dbName'],_0x2825a5[_0x46cbf7(0x1d0)])===_0x2cb764);if(_0x55adb7[_0x46cbf7(0x1d2)]===0x1)return{'dbId':_0x55adb7[0x0][_0x46cbf7(0x1d0)],'dbName':_0x55adb7[0x0][_0x46cbf7(0x1e9)]};if(_0x55adb7[_0x46cbf7(0x1d2)]===0x0)throw CliErrors[_0x46cbf7(0x1e8)](_0x46cbf7(0x1f1)+_0x2cb764+_0x46cbf7(0x1e0)+_0x541ada['sqlCode']+'.');const _0x27c581=_0x55adb7[_0x46cbf7(0x1ec)](_0x246c47=>_0x246c47[_0x46cbf7(0x1e9)]+'\x20('+_0x246c47[_0x46cbf7(0x1d0)]+')')[_0x46cbf7(0x1dd)](',\x20');throw CliErrors[_0x46cbf7(0x1e8)](_0x46cbf7(0x1df)+_0x2cb764+_0x46cbf7(0x1c4)+_0x541ada[_0x46cbf7(0x1dc)]+':\x20'+_0x27c581);}function parseExplicitDbDirectory(_0x5ddc04){const _0x46bd51=a110_0x1701b2,_0x46a253=/^db-(\d+)$/[_0x46bd51(0x1f6)](_0x5ddc04);if(!_0x46a253)return null;const _0x256ce0=Number(_0x46a253[0x1]);return Number['isFinite'](_0x256ce0)&&_0x256ce0>0x0?_0x256ce0:null;}
|
package/lib/commands/sql/save.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a111_0x5d19a7=a111_0x597b;function a111_0x597b(_0x459cb3,_0x593c37){_0x459cb3=_0x459cb3-0x12e;const _0x28636c=a111_0x2863();let _0x597b11=_0x28636c[_0x459cb3];return _0x597b11;}(function(_0x1a572d,_0xe0cf3b){const _0x268a8b=a111_0x597b,_0x427f3e=_0x1a572d();while(!![]){try{const _0x443173=parseInt(_0x268a8b(0x13d))/0x1*(-parseInt(_0x268a8b(0x12e))/0x2)+parseInt(_0x268a8b(0x136))/0x3+parseInt(_0x268a8b(0x130))/0x4*(parseInt(_0x268a8b(0x132))/0x5)+parseInt(_0x268a8b(0x137))/0x6+-parseInt(_0x268a8b(0x146))/0x7*(-parseInt(_0x268a8b(0x139))/0x8)+-parseInt(_0x268a8b(0x144))/0x9+-parseInt(_0x268a8b(0x131))/0xa*(parseInt(_0x268a8b(0x140))/0xb);if(_0x443173===_0xe0cf3b)break;else _0x427f3e['push'](_0x427f3e['shift']());}catch(_0x3d0eae){_0x427f3e['push'](_0x427f3e['shift']());}}}(a111_0x2863,0xa5638));function a111_0x2863(){const _0x2ce25e=['1tDCZVS','Path\x20to\x20the\x20SQL\x20file','sql','11tXvQPV','join','string','Deprecated:\x20use\x20sql\x20create\x20to\x20create\x20and\x20sql\x20push\x20to\x20update','11699082yVfUGL','Target\x20database\x20—\x20accepts\x20a\x20numeric\x20ID\x20or\x20database\x20name\x20(e.g.\x20ecommerce_db)','119hSwSXh','1082788XKfHvy','description','12pMTePS','4313030pPAaKk','997365oNJuVR','Query\x20description','write','sqlname','4032975TwZaPe','3743700tyQmOh','validation','180392wDQjiy','`rabetbase\x20sql\x20save`\x20has\x20been\x20deprecated.','save','file'];a111_0x2863=function(){return _0x2ce25e;};return a111_0x2863();}import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';const SQL_SAVE_DEPRECATED_HINT=[a111_0x5d19a7(0x13a),'Create\x20new\x20SQL\x20with\x20`rabetbase\x20sql\x20create\x20--name\x20<name>\x20--db-id\x20<id>\x20--mode\x20sql|mybatisXml`.','Update\x20existing\x20SQL\x20by\x20editing\x20the\x20synced\x20file\x20under\x20`.rabetbase/sql/<appCode>/<dbName|db-<id>>/`\x20and\x20then\x20running\x20`rabetbase\x20sql\x20push\x20--sqlcode\x20<code>\x20--yes`.'][a111_0x5d19a7(0x141)]('\x0a');export const sqlSave={'service':a111_0x5d19a7(0x13f),'command':a111_0x5d19a7(0x13b),'description':a111_0x5d19a7(0x143),'risk':a111_0x5d19a7(0x134),'requiresAuth':![],'requiresAppCode':![],'flags':[{'name':a111_0x5d19a7(0x13c),'type':a111_0x5d19a7(0x142),'required':!![],'description':a111_0x5d19a7(0x13e)},SQLCODE_FLAG_OPTIONAL,{'name':a111_0x5d19a7(0x135),'type':a111_0x5d19a7(0x142),'description':'SQL\x20query\x20display\x20name'},{'name':'db','type':a111_0x5d19a7(0x142),'description':a111_0x5d19a7(0x145)},{'name':a111_0x5d19a7(0x12f),'type':'string','description':a111_0x5d19a7(0x133)}],async 'validate'(){const _0x446c6a=a111_0x5d19a7;throw CliErrors[_0x446c6a(0x138)](SQL_SAVE_DEPRECATED_HINT);},async 'execute'(){const _0x2184df=a111_0x5d19a7;throw CliErrors[_0x2184df(0x138)](SQL_SAVE_DEPRECATED_HINT);}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x49750d,_0x251d25){const _0x3f07fd=a112_0x1795,_0xd304e=_0x49750d();while(!![]){try{const _0x43cb33=-parseInt(_0x3f07fd(0x1ef))/0x1+parseInt(_0x3f07fd(0x209))/0x2*(-parseInt(_0x3f07fd(0x1f8))/0x3)+parseInt(_0x3f07fd(0x20a))/0x4*(parseInt(_0x3f07fd(0x1e5))/0x5)+parseInt(_0x3f07fd(0x1e9))/0x6*(-parseInt(_0x3f07fd(0x204))/0x7)+parseInt(_0x3f07fd(0x1fc))/0x8*(parseInt(_0x3f07fd(0x205))/0x9)+-parseInt(_0x3f07fd(0x20e))/0xa*(-parseInt(_0x3f07fd(0x1ff))/0xb)+parseInt(_0x3f07fd(0x201))/0xc;if(_0x43cb33===_0x251d25)break;else _0xd304e['push'](_0xd304e['shift']());}catch(_0x53878a){_0xd304e['push'](_0xd304e['shift']());}}}(a112_0x5902,0x8c529));import{createInterface}from'node:readline';import{join}from'node:path';function a112_0x1795(_0x336c43,_0x107f4a){_0x336c43=_0x336c43-0x1e3;const _0x5902a9=a112_0x5902();let _0x179538=_0x5902a9[_0x336c43];return _0x179538;}function a112_0x5902(){const _0x1ba1e6=['sqlContent','--\x20@lovrabet.','description','dbId','951999oRxbgm','replace','syncedAt','mode','\x20[y/N]\x20','yes','filter','sqlName','\x20-->','282474CpYnQd','toLowerCase','entries','trimStart','235008xCmRQN','test','dbName','1174591ATlAJc','join','15679728xVIpoa','stderr','sqlCode','6782797qiqsWE','252abXaZQ','path','version','map','12bHZrbp','1163284oKjpDj','sqlConfig','endsWith','sqlRoot','60IJSKwK','push','length','trim','stdin','5nUdStD','close','apps','fromEntries','6PcbUSt','sqls'];a112_0x5902=function(){return _0x1ba1e6;};return a112_0x5902();}import{buildDefaultSqlFileName,buildSqlRelativePath,detectSqlMode}from'../../core/sql-sync/utils.js';export const SQL_LOCAL_REL_DIR='.rabetbase/sql';export function buildSqlLockEntry(_0x17a08e,_0x2f64f5,_0x5cc9cd,_0x2317a7){const _0x368f84=a112_0x1795,_0x317ae7=detectSqlMode(_0x2f64f5);return{'path':buildSqlRelativePath(_0x17a08e['sqlCode'],_0x17a08e[_0x368f84(0x1f6)],_0x2317a7?.[_0x368f84(0x1fe)],_0x317ae7,_0x17a08e['dbId']),'hash':_0x5cc9cd,'remoteId':_0x17a08e['id'],'version':_0x17a08e[_0x368f84(0x207)],'dbId':Number(_0x17a08e['dbId']),'dbName':_0x2317a7?.[_0x368f84(0x1fe)],'sqlName':_0x17a08e[_0x368f84(0x1f6)],'sqlConfig':_0x17a08e[_0x368f84(0x20b)]??undefined,'mode':_0x317ae7};}export function cloneSqlLockData(_0x30f76e){const _0x2c90c7=a112_0x1795;return{'apps':Object[_0x2c90c7(0x1e8)](Object[_0x2c90c7(0x1fa)](_0x30f76e[_0x2c90c7(0x1e7)])['map'](([_0x30c420,_0x4beb1c])=>[_0x30c420,{'sqlRoot':_0x4beb1c[_0x2c90c7(0x20d)],'lastSync':_0x4beb1c['lastSync'],'sqls':{..._0x4beb1c[_0x2c90c7(0x1ea)]}}]))};}export function ensureRemoteSqlContent(_0x4b4740){const _0x17dda0=a112_0x1795;return _0x4b4740[_0x17dda0(0x1eb)]??'';}export function buildLocalSqlFileContent(_0x28649a,_0x4d0a0e,_0x2786f4){const _0x3864d9=a112_0x1795,_0x275a00=_0x2786f4?.[_0x3864d9(0x1f2)]??detectSqlMode(_0x4d0a0e),_0x5f185c=stripLocalSqlMetadata(_0x4d0a0e,_0x275a00)['trim'](),_0x461e6d=[...buildMetadataHeaderLines({'sqlCode':_0x28649a[_0x3864d9(0x203)],'sqlName':_0x28649a['sqlName'],'dbId':_0x28649a[_0x3864d9(0x1ee)],'dbName':_0x2786f4?.[_0x3864d9(0x1fe)],'mode':_0x275a00,'syncedAt':_0x2786f4?.[_0x3864d9(0x1f1)],'description':_0x2786f4?.[_0x3864d9(0x1ed)]},_0x275a00),'',_0x5f185c],_0x526868=_0x461e6d[_0x3864d9(0x200)]('\x0a');return _0x526868[_0x3864d9(0x20c)]('\x0a')?_0x526868:_0x526868+'\x0a';}export function stripLocalSqlMetadata(_0x15c6f9,_0x5e4909){const _0x51a482=a112_0x1795,_0x420e72=_0x15c6f9[_0x51a482(0x1f0)](/\r\n/g,'\x0a')['split']('\x0a'),_0x2836ed=[];let _0x164521=0x0;if(_0x5e4909==='mybatisXml')while(_0x164521<_0x420e72[_0x51a482(0x210)]){const _0x2e84fd=_0x420e72[_0x164521]??'';if(/^\s*<!--\s*@lovrabet\./[_0x51a482(0x1fd)](_0x2e84fd)){_0x164521++;continue;}if(_0x2e84fd[_0x51a482(0x1e3)]()===''&&_0x164521>0x0){_0x164521++;continue;}break;}else while(_0x164521<_0x420e72[_0x51a482(0x210)]){const _0x10bed6=_0x420e72[_0x164521]??'';if(/^\s*--\s*@lovrabet\./[_0x51a482(0x1fd)](_0x10bed6)){_0x164521++;continue;}if(_0x10bed6[_0x51a482(0x1e3)]()===''&&_0x164521>0x0){_0x164521++;continue;}break;}for(;_0x164521<_0x420e72[_0x51a482(0x210)];_0x164521++){_0x2836ed[_0x51a482(0x20f)](_0x420e72[_0x164521]);}return _0x2836ed['join']('\x0a')[_0x51a482(0x1fb)]();}export function resolveSqlMode(_0x218301,_0x4b678d){const _0x3f40d8=a112_0x1795;if(_0x4b678d?.[_0x3f40d8(0x1f2)])return _0x4b678d[_0x3f40d8(0x1f2)];return detectSqlMode(_0x218301);}export function resolveSqlFileName(_0x189012,_0x3cfa68,_0x1aa648){const _0x56ad9f=a112_0x1795;if(_0x1aa648?.[_0x56ad9f(0x206)])return _0x1aa648[_0x56ad9f(0x206)];if(_0x1aa648?.[_0x56ad9f(0x1f6)]||_0x1aa648?.[_0x56ad9f(0x1fe)])return buildSqlRelativePath(_0x189012,_0x1aa648?.['sqlName'],_0x1aa648?.[_0x56ad9f(0x1fe)],resolveSqlMode(_0x3cfa68,_0x1aa648),_0x1aa648?.[_0x56ad9f(0x1ee)]);return buildDefaultSqlFileName(_0x189012,resolveSqlMode(_0x3cfa68,_0x1aa648));}export function resolveSqlLocalDir(_0xcc46c7,_0x3ea73b){return join(_0xcc46c7,SQL_LOCAL_REL_DIR,_0x3ea73b);}export async function confirmForceOverwrite(_0xc0f7a1){const _0x30ee46=a112_0x1795,_0x302c19=createInterface({'input':process[_0x30ee46(0x1e4)],'output':process[_0x30ee46(0x202)]}),_0x2db195=await new Promise(_0x1e87cd=>{const _0x3e2461=_0x30ee46;_0x302c19['question'](_0xc0f7a1+_0x3e2461(0x1f3),_0x1e87cd);});return _0x302c19[_0x30ee46(0x1e6)](),['y',_0x30ee46(0x1f4)]['includes'](_0x2db195[_0x30ee46(0x1e3)]()[_0x30ee46(0x1f9)]());}export function findSqlLockScope(_0x4efa0b,_0x240d10){const _0x250b74=a112_0x1795;return _0x4efa0b[_0x250b74(0x1e7)][_0x240d10];}function buildMetadataHeaderLines(_0x37b206,_0x2225ed){const _0x5a47c3=a112_0x1795,_0xe0dad2=[[_0x5a47c3(0x203),_0x37b206[_0x5a47c3(0x203)]],['sqlName',_0x37b206[_0x5a47c3(0x1f6)]],[_0x5a47c3(0x1ee),_0x37b206[_0x5a47c3(0x1ee)]],[_0x5a47c3(0x1fe),_0x37b206[_0x5a47c3(0x1fe)]],[_0x5a47c3(0x1f2),_0x37b206['mode']],[_0x5a47c3(0x1f1),_0x37b206['syncedAt']],[_0x5a47c3(0x1ed),_0x37b206[_0x5a47c3(0x1ed)]]];if(_0x2225ed==='mybatisXml')return _0xe0dad2['filter'](([,_0x4b17d5])=>_0x4b17d5!==undefined&&_0x4b17d5!==null&&String(_0x4b17d5)[_0x5a47c3(0x1e3)]()!=='')[_0x5a47c3(0x208)](([_0x3f164e,_0x2fda49])=>'<!--\x20@lovrabet.'+_0x3f164e+':\x20'+String(_0x2fda49)+_0x5a47c3(0x1f7));return _0xe0dad2[_0x5a47c3(0x1f5)](([,_0x38303e])=>_0x38303e!==undefined&&_0x38303e!==null&&String(_0x38303e)['trim']()!=='')[_0x5a47c3(0x208)](([_0x5645fb,_0x246c3b])=>_0x5a47c3(0x1ec)+_0x5645fb+':\x20'+String(_0x246c3b));}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const a113_0x4bd4c9=a113_0x4e14;(function(_0x240ab4,_0x331d2a){const _0x4d18eb=a113_0x4e14,_0x99c3c1=_0x240ab4();while(!![]){try{const _0x4012ef=-parseInt(_0x4d18eb(0x177))/0x1+parseInt(_0x4d18eb(0x18d))/0x2+parseInt(_0x4d18eb(0x17d))/0x3*(-parseInt(_0x4d18eb(0x178))/0x4)+parseInt(_0x4d18eb(0x184))/0x5*(-parseInt(_0x4d18eb(0x183))/0x6)+parseInt(_0x4d18eb(0x188))/0x7+parseInt(_0x4d18eb(0x181))/0x8+parseInt(_0x4d18eb(0x18e))/0x9;if(_0x4012ef===_0x331d2a)break;else _0x99c3c1['push'](_0x99c3c1['shift']());}catch(_0x5c85bf){_0x99c3c1['push'](_0x99c3c1['shift']());}}}(a113_0x2516,0x296ef));function a113_0x2516(){const _0x284186=['filePath','\x20missing,\x20','\x20added,\x20','708ultKOC','sqls','Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally','has','1981568CqpDIO','remote','6uroGUZ','1006835YsLGGJ','\x20remote-only','sqlName','push','1781458KaKCOR','\x20modified,\x20','appCode','bool','read','350612COMpxR','1047582DAPPVr','tableData','All\x20SQL\x20queries\x20are\x20in\x20sync.','sql','map','Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','lockKey','sqlRoot','keys','relativePath','paging','path','306468pqZTgV','1972rknBMF','length'];a113_0x2516=function(){return _0x284186;};return a113_0x2516();}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 a113_0x4e14(_0x327a00,_0x3b9f38){_0x327a00=_0x327a00-0x171;const _0x251688=a113_0x2516();let _0x4e1412=_0x251688[_0x327a00];return _0x4e1412;}import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile}from'../../core/sql-sync/lock.js';const PAGE_SIZE=0x64;async function fetchAllSqlCodes(_0x47acf5){const _0x1ab6b2=a113_0x4e14,_0xb49b3f=[];let _0x58382e=0x1;while(!![]){const _0x24548d=await listSqlQueries(_0x47acf5,{'currentPage':_0x58382e,'pageSize':PAGE_SIZE}),_0x533f6f=_0x24548d[_0x1ab6b2(0x18f)]??[];_0xb49b3f[_0x1ab6b2(0x187)](..._0x533f6f[_0x1ab6b2(0x192)](_0xc0fac4=>_0xc0fac4['sqlCode']));if(_0x533f6f[_0x1ab6b2(0x179)]===0x0)break;const _0x512a3a=_0x24548d[_0x1ab6b2(0x175)]?.['totalCount'];if(_0x512a3a!=null?_0xb49b3f[_0x1ab6b2(0x179)]>=_0x512a3a:_0x533f6f['length']<PAGE_SIZE)break;_0x58382e++;}return _0xb49b3f;}export const sqlStatus={'service':a113_0x4bd4c9(0x191),'command':'status','description':a113_0x4bd4c9(0x193),'risk':a113_0x4bd4c9(0x18c),'flags':[{'name':a113_0x4bd4c9(0x182),'type':'boolean','description':a113_0x4bd4c9(0x17f)}],async 'execute'(_0x927e20){const _0x43736d=a113_0x4bd4c9,_0x8e8f55=loadSqlProjectConfig(_0x927e20[_0x43736d(0x18a)]),_0x28a83a=await readSqlLockFile(_0x8e8f55['lockFilePath']),{appLock:_0x30c18c}=ensureSqlLockScope(_0x28a83a??createEmptySqlLock(),_0x8e8f55['appCode'],_0x8e8f55[_0x43736d(0x172)],'status'),_0x59041a=await scanLocalSqlQueries(_0x8e8f55),_0x2989f7=[],_0x46f987=[],_0x4f852a=[],_0xb97fe0=[],_0x20fa0c=new Set(_0x59041a['map'](_0x527a99=>_0x527a99['lockKey']));for(const _0x27b50e of _0x59041a){const _0x1550f1=await computeSqlFileHash(_0x27b50e[_0x43736d(0x17a)]),_0x258ef6=_0x30c18c['sqls'][_0x27b50e[_0x43736d(0x171)]],_0x5063b7=!!_0x258ef6&&_0x258ef6[_0x43736d(0x176)]!==_0x27b50e[_0x43736d(0x174)],_0x1385bc=!!_0x258ef6&&!!_0x27b50e[_0x43736d(0x186)]&&_0x258ef6[_0x43736d(0x186)]!==_0x27b50e['sqlName'];if(!_0x258ef6)_0x2989f7[_0x43736d(0x187)](_0x27b50e['lockKey']);else _0x258ef6['hash']!==_0x1550f1||_0x5063b7||_0x1385bc?_0x46f987['push'](_0x27b50e[_0x43736d(0x171)]):_0x4f852a[_0x43736d(0x187)](_0x27b50e[_0x43736d(0x171)]);}for(const _0x175034 of Object[_0x43736d(0x173)](_0x30c18c[_0x43736d(0x17e)])){!_0x20fa0c[_0x43736d(0x180)](_0x175034)&&_0xb97fe0['push'](_0x175034);}const _0x41ef19=[];if(_0x927e20[_0x43736d(0x18b)](_0x43736d(0x182))){const _0x28b986=await fetchAllSqlCodes(_0x927e20[_0x43736d(0x18a)]);for(const _0x18cc24 of _0x28b986){!_0x20fa0c[_0x43736d(0x180)](_0x18cc24)&&!_0x30c18c[_0x43736d(0x17e)][_0x18cc24]&&_0x41ef19[_0x43736d(0x187)](_0x18cc24);}}const _0x2a678e=_0x2989f7['length']===0x0&&_0x46f987[_0x43736d(0x179)]===0x0&&_0xb97fe0[_0x43736d(0x179)]===0x0&&_0x41ef19[_0x43736d(0x179)]===0x0;return{'ok':!![],'data':{'added':_0x2989f7,'modified':_0x46f987,'missing':_0xb97fe0,'unchanged':_0x4f852a,'remoteOnly':_0x41ef19},'message':_0x2a678e?_0x43736d(0x190):_0x2989f7[_0x43736d(0x179)]+_0x43736d(0x17c)+_0x46f987[_0x43736d(0x179)]+_0x43736d(0x189)+_0xb97fe0[_0x43736d(0x179)]+_0x43736d(0x17b)+_0x4f852a[_0x43736d(0x179)]+'\x20unchanged'+(_0x41ef19[_0x43736d(0x179)]>0x0?',\x20'+_0x41ef19[_0x43736d(0x179)]+_0x43736d(0x185):'')};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a114_0x185b39=a114_0x9ccf;(function(_0x2e14b1,_0x4d447){const _0x28fb54=a114_0x9ccf,_0x1e7d96=_0x2e14b1();while(!![]){try{const _0x53bce7=parseInt(_0x28fb54(0x1aa))/0x1+-parseInt(_0x28fb54(0x1c3))/0x2*(-parseInt(_0x28fb54(0x1bd))/0x3)+parseInt(_0x28fb54(0x1a7))/0x4*(parseInt(_0x28fb54(0x1a3))/0x5)+parseInt(_0x28fb54(0x1ac))/0x6+parseInt(_0x28fb54(0x19e))/0x7*(parseInt(_0x28fb54(0x19c))/0x8)+-parseInt(_0x28fb54(0x1ba))/0x9+-parseInt(_0x28fb54(0x1a6))/0xa;if(_0x53bce7===_0x4d447)break;else _0x1e7d96['push'](_0x1e7d96['shift']());}catch(_0x5c63de){_0x1e7d96['push'](_0x1e7d96['shift']());}}}(a114_0x12e8,0x59326));function a114_0x9ccf(_0x2cf2b7,_0x30980f){_0x2cf2b7=_0x2cf2b7-0x197;const _0x12e893=a114_0x12e8();let _0x9ccf1=_0x12e893[_0x2cf2b7];return _0x9ccf1;}function a114_0x12e8(){const _0x62c6c1=['290534rBheyw','from','2928876IVsiZZ','split','size','schemaWarnings','map','Comma-separated\x20dataset\x20codes\x20to\x20cross-check\x20table/column\x20names\x20against','sqlType','type','str','length','read','isSelectOnly','file','schema:','3701124UXYvBI','sql','schemas','3weKtyp','validation','toLowerCase','message','push','dbtableConfig','1109642faliIh','string','tables','Dataset\x20\x22','tableName','reason','25616qoAEEN','flagMissing','1022ynXsuU','valid','parameters','get','validate','47830VABvtD','\x22\x20not\x20found\x20or\x20not\x20accessible','utf-8','11678970HrFEJz','60nEzvxf','isArray','\x22\x20not\x20found\x20in\x20any\x20dataset'];a114_0x12e8=function(){return _0x62c6c1;};return a114_0x12e8();}import{readFileSync,existsSync}from'node:fs';import{resolve}from'node:path';import{validateSql}from'../../core/sql-validator.js';import{getDatasetDetail,listDatasets}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';export const sqlValidate={'service':a114_0x185b39(0x1bb),'command':a114_0x185b39(0x1a2),'description':'Validate\x20SQL\x20content\x20without\x20saving\x20(type\x20detection,\x20parameter\x20extraction,\x20optional\x20schema\x20check)','risk':a114_0x185b39(0x1b6),'flags':[{'name':a114_0x185b39(0x1b8),'type':a114_0x185b39(0x197),'description':'Path\x20to\x20the\x20SQL\x20file\x20to\x20validate'},{'name':a114_0x185b39(0x1bb),'type':a114_0x185b39(0x197),'description':'Inline\x20SQL\x20content\x20to\x20validate\x20(alternative\x20to\x20--file)'},{'name':a114_0x185b39(0x1bc),'type':'string','description':a114_0x185b39(0x1b1)}],async 'execute'(_0x119be2){const _0x4789a2=a114_0x185b39,_0x1d8147=_0x119be2[_0x4789a2(0x1b4)]('file'),_0x175fb1=_0x119be2[_0x4789a2(0x1b4)]('sql');if(!_0x1d8147&&!_0x175fb1)throw CliErrors[_0x4789a2(0x19d)](_0x4789a2(0x1b8),'Provide\x20--file\x20or\x20--sql');let _0x123022;if(_0x1d8147){const _0x35208c=resolve(process['cwd'](),_0x1d8147);if(!existsSync(_0x35208c))throw CliErrors[_0x4789a2(0x1be)]('File\x20not\x20found:\x20'+_0x35208c);_0x123022=readFileSync(_0x35208c,_0x4789a2(0x1a5));}else _0x123022=_0x175fb1;const _0x114776=validateSql(_0x123022),_0x42fc73={'valid':_0x114776['valid'],'sqlType':_0x114776[_0x4789a2(0x1b2)][_0x4789a2(0x1b3)],'isSelectOnly':_0x114776[_0x4789a2(0x1b2)][_0x4789a2(0x1b7)],'isDangerous':_0x114776[_0x4789a2(0x1b2)]['isDangerous'],'tables':_0x114776[_0x4789a2(0x198)],'parameters':_0x114776[_0x4789a2(0x1a0)],'message':_0x114776[_0x4789a2(0x1c0)]};_0x114776[_0x4789a2(0x1b2)][_0x4789a2(0x19b)]&&(_0x42fc73['reason']=_0x114776[_0x4789a2(0x1b2)]['reason']);const _0x1d26ed=_0x119be2[_0x4789a2(0x1b4)](_0x4789a2(0x1bc));if(_0x1d26ed&&_0x114776[_0x4789a2(0x19f)]){const _0xd396f4=_0x1d26ed[_0x4789a2(0x1ad)](',')[_0x4789a2(0x1b0)](_0x2df50a=>_0x2df50a['trim']())['filter'](Boolean),_0x15c14d=[],_0x2318ca=await listDatasets(_0x119be2['appCode']),_0x1d3bd0=new Map(_0x2318ca['map'](_0x125099=>[_0x125099[_0x4789a2(0x1c2)]?.[_0x4789a2(0x19a)]?.['toLowerCase'](),_0x125099]));for(const _0x53e78f of _0x114776[_0x4789a2(0x198)]){const _0x3809d7=_0x1d3bd0[_0x4789a2(0x1a1)](_0x53e78f[_0x4789a2(0x1bf)]());!_0x3809d7&&_0x15c14d['push']('Table\x20\x22'+_0x53e78f+_0x4789a2(0x1a9));}for(const _0x354487 of _0xd396f4){try{const _0x30b3f9=await getDatasetDetail(_0x354487),_0x392d6e=Array[_0x4789a2(0x1a8)](_0x30b3f9['fields'])?_0x30b3f9['fields']:[],_0x2621d0=new Set(_0x392d6e[_0x4789a2(0x1b0)](_0x46bed1=>_0x46bed1['name']?.[_0x4789a2(0x1bf)]())),_0x1e11f2=_0x30b3f9[_0x4789a2(0x1c2)]?.['tableName']||_0x30b3f9['tableName']||_0x354487;_0x42fc73[_0x4789a2(0x1b9)+_0x1e11f2]={'code':_0x354487,'tableName':_0x1e11f2,'fieldCount':_0x2621d0[_0x4789a2(0x1ae)],'fields':Array[_0x4789a2(0x1ab)](_0x2621d0)};}catch{_0x15c14d[_0x4789a2(0x1c1)](_0x4789a2(0x199)+_0x354487+_0x4789a2(0x1a4));}}_0x15c14d[_0x4789a2(0x1b5)]>0x0&&(_0x42fc73[_0x4789a2(0x1af)]=_0x15c14d);}return{'ok':_0x114776[_0x4789a2(0x19f)],'data':_0x42fc73,'message':_0x114776[_0x4789a2(0x1c0)]};}};
|
package/lib/config/schema.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a115_0x50a78b=a115_0x3f2a;(function(_0x2aa60d,_0x1896a2){const _0x5c6331=a115_0x3f2a,_0x5a3e85=_0x2aa60d();while(!![]){try{const _0x358e23=parseInt(_0x5c6331(0x209))/0x1+parseInt(_0x5c6331(0x206))/0x2+parseInt(_0x5c6331(0x200))/0x3+parseInt(_0x5c6331(0x1fd))/0x4*(-parseInt(_0x5c6331(0x1e8))/0x5)+-parseInt(_0x5c6331(0x1f0))/0x6*(parseInt(_0x5c6331(0x1ef))/0x7)+-parseInt(_0x5c6331(0x1e9))/0x8+parseInt(_0x5c6331(0x205))/0x9;if(_0x358e23===_0x1896a2)break;else _0x5a3e85['push'](_0x5a3e85['shift']());}catch(_0x34ba27){_0x5a3e85['push'](_0x5a3e85['shift']());}}}(a115_0x308e,0xa2fa7));import{DEFAULT_CONFIG_VALUES}from'../constant/defaults.js';import{RABETBASE_ENV_VALUES}from'../constant/env.js';function a115_0x3f2a(_0x4a0801,_0x4c0c96){_0x4a0801=_0x4a0801-0x1e6;const _0x308e2d=a115_0x308e();let _0x3f2a95=_0x308e2d[_0x4a0801];return _0x3f2a95;}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';function a115_0x308e(){const _0x2ce440=['trim','zh-CN','appcode','app','toLowerCase','filter','accessKey','entries','riskLevel','28tGCBtv','apps','cookie','2090559wXDsaW','Config\x20key\x20(','length','Auth\x20cookie','pageSize','7823862rbrKMf','2547892NVfyth','apiDir','has','541714zoMcDq','Access\x20key','defaultFormat','en-US','locale','638740xnUaIR','5890000VrnGNA','defaultApp','inherit','format','env','map','21GwYUQh','2167572TqcqsF','string','Risk\x20level','Default\x20page\x20size'];a115_0x308e=function(){return _0x2ce440;};return a115_0x308e();}export const PROJECT_CREATE_INHERITABLE_KEYS=[a115_0x50a78b(0x1ff),'accessKey',a115_0x50a78b(0x1e7),'format',a115_0x50a78b(0x1fc)];export const TOP_LEVEL_CONFIG_KEYS=new Set(['appcode','env',a115_0x50a78b(0x1e7),'format',a115_0x50a78b(0x1ff),a115_0x50a78b(0x1fa),a115_0x50a78b(0x207)]);export const CONFIG_ENUM_VALUES={'env':[...RABETBASE_ENV_VALUES],'format':[...RABETBASE_OUTPUT_FORMAT_VALUES]};export function formatConfigKeyList(_0x1e4ba1){return[..._0x1e4ba1]['join'](',\x20');}export function getTopLevelConfigKeyList(){return[...TOP_LEVEL_CONFIG_KEYS];}export function isTopLevelConfigKey(_0x1c50bc){const _0x6f34dc=a115_0x50a78b;return TOP_LEVEL_CONFIG_KEYS[_0x6f34dc(0x208)](_0x1c50bc);}export function getTopLevelConfigKeySummary(){return formatConfigKeyList(getTopLevelConfigKeyList());}export function getConfigCommandKeyDescription(){const _0x199d23=a115_0x50a78b;return _0x199d23(0x201)+getTopLevelConfigKeySummary()+')';}export const APP_PROFILE_FLAG_KEY_MAP={'env':a115_0x50a78b(0x1ed),'apiDir':a115_0x50a78b(0x207),'cookie':'cookie','accessKey':a115_0x50a78b(0x1fa),'defaultFormat':a115_0x50a78b(0x1ec),'pageSize':a115_0x50a78b(0x204),'riskLevel':a115_0x50a78b(0x1fc),'locale':'locale'};export function getAppProfileFlagDefs(){const _0x448058=a115_0x50a78b;return[{'name':_0x448058(0x1ed),'type':'string','description':'Target\x20environment','enum':[...RABETBASE_ENV_VALUES]},{'name':_0x448058(0x207),'type':'string','description':'API\x20directory\x20path'},{'name':'cookie','type':'string','description':_0x448058(0x203),'hidden':!![]},{'name':_0x448058(0x1fa),'type':'string','description':_0x448058(0x20a),'hidden':!![]},{'name':_0x448058(0x20b),'type':'string','description':'Default\x20output\x20format\x20for\x20this\x20app\x20(profile)','enum':[...RABETBASE_OUTPUT_FORMAT_VALUES]},{'name':_0x448058(0x204),'type':'number','description':_0x448058(0x1f3)},{'name':'riskLevel','type':_0x448058(0x1f1),'description':_0x448058(0x1f2),'enum':[...RISK_LEVEL_VALUES]},{'name':_0x448058(0x1e7),'type':_0x448058(0x1f1),'description':'Locale'}];}export function collectAppProfileOverrides(_0x247a03){const _0x223013=a115_0x50a78b,_0x590ac1={};for(const [_0x3d1fc3,_0x579bad]of Object[_0x223013(0x1fb)](APP_PROFILE_FLAG_KEY_MAP)){const _0xbbde00=_0x247a03(_0x3d1fc3);if(!_0xbbde00)continue;_0x590ac1[_0x579bad]=_0x579bad===_0x223013(0x204)?Number(_0xbbde00):_0xbbde00;}return _0x590ac1;}export function buildAppProfileListFields(_0x26a8ff){const _0x26cbb1=a115_0x50a78b;return{'env':_0x26a8ff[_0x26cbb1(0x1ed)]??null,'apiDir':_0x26a8ff[_0x26cbb1(0x207)]??null,'hasCookie':!!_0x26a8ff['cookie'],'hasAccessKey':!!_0x26a8ff[_0x26cbb1(0x1fa)],'format':_0x26a8ff[_0x26cbb1(0x1ec)]??null,'pageSize':_0x26a8ff['pageSize']??null,'riskLevel':_0x26a8ff[_0x26cbb1(0x1fc)]??null,'locale':_0x26a8ff[_0x26cbb1(0x1e7)]??null};}export function buildAppDoctorFields(_0x2613b3,_0x166ca8){const _0x4e95ec=a115_0x50a78b;return{'env':{'value':_0x2613b3['env']||_0x166ca8[_0x4e95ec(0x1ed)],'source':_0x2613b3[_0x4e95ec(0x1ed)]?_0x4e95ec(0x1f7):'inherit'},'apiDir':{'value':_0x2613b3['apiDir']||_0x166ca8[_0x4e95ec(0x207)],'source':_0x2613b3['apiDir']?_0x4e95ec(0x1f7):_0x4e95ec(0x1eb)},'cookie':{'value':_0x2613b3[_0x4e95ec(0x1ff)]||_0x166ca8[_0x4e95ec(0x1ff)],'source':_0x2613b3[_0x4e95ec(0x1ff)]?'app':_0x4e95ec(0x1eb)},'accessKey':{'value':_0x2613b3[_0x4e95ec(0x1fa)]||_0x166ca8['accessKey'],'source':_0x2613b3[_0x4e95ec(0x1fa)]?_0x4e95ec(0x1f7):_0x4e95ec(0x1eb)}};}export function buildCanonicalAppConfig(_0x141168,_0x19516b){const _0x56d443=a115_0x50a78b,_0x51cc4b=_0x141168[_0x56d443(0x1ee)](_0x2ff040=>String(_0x2ff040||'')[_0x56d443(0x1f4)]())[_0x56d443(0x1f9)](Boolean);if(_0x51cc4b['length']===0x0)return{};const _0x269417={};for(const _0x4e7c50 of _0x51cc4b){_0x269417[_0x4e7c50]=_0x19516b?{'appcode':_0x4e7c50,'env':_0x19516b}:{'appcode':_0x4e7c50};}return{'apps':_0x269417,'defaultApp':_0x51cc4b[0x0]};}export function buildCanonicalProjectConfig(_0x3259be,_0x199641){const _0x153346=a115_0x50a78b,{appCodes:appCodes=[],env:_0x4527d6,metadata:_0x49d962}=_0x199641,_0x2cf5fe={..._0x3259be,..._0x49d962||{}};delete _0x2cf5fe[_0x153346(0x1f6)],delete _0x2cf5fe['app'];if(_0x4527d6)_0x2cf5fe['env']=_0x4527d6;else!_0x2cf5fe['env']&&(_0x2cf5fe['env']=DEFAULT_CONFIG_VALUES[_0x153346(0x1ed)]);const _0x158cd6=buildCanonicalAppConfig(appCodes,_0x2cf5fe['env']);return Object['keys'](_0x158cd6)[_0x153346(0x202)]>0x0&&(_0x2cf5fe['apps']=_0x158cd6[_0x153346(0x1fe)],_0x2cf5fe[_0x153346(0x1ea)]=_0x158cd6[_0x153346(0x1ea)]),_0x2cf5fe;}const LOCALE_MAP={'zh':'zh-CN','zh-cn':a115_0x50a78b(0x1f5),'zh_cn':a115_0x50a78b(0x1f5),'en':a115_0x50a78b(0x1e6),'en-us':'en-US','en_us':'en-US'};export function normalizeLocale(_0x374435){const _0x4ab8f2=a115_0x50a78b;if(!_0x374435)return null;return LOCALE_MAP[_0x374435[_0x4ab8f2(0x1f8)]()]??null;}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(_0x3d10ec,_0x55cf93){const _0x50085b=a116_0x2624,_0x13e86b=_0x3d10ec();while(!![]){try{const _0x4d0eaf=parseInt(_0x50085b(0x17b))/0x1*(parseInt(_0x50085b(0x17c))/0x2)+parseInt(_0x50085b(0x179))/0x3+parseInt(_0x50085b(0x17a))/0x4+parseInt(_0x50085b(0x17f))/0x5+parseInt(_0x50085b(0x181))/0x6+parseInt(_0x50085b(0x17e))/0x7+-parseInt(_0x50085b(0x180))/0x8*(parseInt(_0x50085b(0x17d))/0x9);if(_0x4d0eaf===_0x55cf93)break;else _0x13e86b['push'](_0x13e86b['shift']());}catch(_0x45e38a){_0x13e86b['push'](_0x13e86b['shift']());}}}(a116_0x4562,0xc1e33));export const CLI_VERSION_POLICY_URL='https://g.lovrabet.com/dist/rabetbase-cli/config/index.json';function a116_0x2624(_0xd416fc,_0xd10d39){_0xd416fc=_0xd416fc-0x179;const _0x456276=a116_0x4562();let _0x262492=_0x456276[_0xd416fc];return _0x262492;}function a116_0x4562(){const _0xff8e22=['3172914EAEwCf','1558428IGYMaf','1glXEJn','661058VQvkAE','81MmxhVv','5834234udPjOF','6379745awpXsO','3738968SrxEvq','6679902FBqGmS'];a116_0x4562=function(){return _0xff8e22;};return a116_0x4562();}
|
package/lib/constant/cli.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a117_0x42da54=a117_0x4268;function a117_0x4268(_0x32d60b,_0x6c6d52){_0x32d60b=_0x32d60b-0x121;const _0x4669cb=a117_0x4669();let _0x4268f0=_0x4669cb[_0x32d60b];return _0x4268f0;}(function(_0x2ef30c,_0x1364c3){const _0x1943a9=a117_0x4268,_0x3d6c3c=_0x2ef30c();while(!![]){try{const _0x5da9b3=parseInt(_0x1943a9(0x139))/0x1+-parseInt(_0x1943a9(0x178))/0x2+-parseInt(_0x1943a9(0x133))/0x3+parseInt(_0x1943a9(0x156))/0x4+parseInt(_0x1943a9(0x163))/0x5*(parseInt(_0x1943a9(0x157))/0x6)+-parseInt(_0x1943a9(0x16e))/0x7*(parseInt(_0x1943a9(0x12d))/0x8)+parseInt(_0x1943a9(0x151))/0x9;if(_0x5da9b3===_0x1364c3)break;else _0x3d6c3c['push'](_0x3d6c3c['shift']());}catch(_0x34a38f){_0x3d6c3c['push'](_0x3d6c3c['shift']());}}}(a117_0x4669,0xa3953));export const CLI_BIN_NAME=a117_0x42da54(0x158);export const CLI_DISPLAY_NAME=a117_0x42da54(0x134);export const NPM_PACKAGE_NAME='@lovrabet/rabetbase-cli';export const GLOBAL_FLAGS=[{'name':a117_0x42da54(0x15a),'meowKey':a117_0x42da54(0x15a),'type':'string','description':'Override\x20appcode','hint':'<code>'},{'name':'app','meowKey':a117_0x42da54(0x14d),'type':'string','description':'Select\x20app\x20profile\x20by\x20name','hint':a117_0x42da54(0x12e)},{'name':a117_0x42da54(0x175),'meowKey':a117_0x42da54(0x175),'type':'string','description':a117_0x42da54(0x154),'hint':a117_0x42da54(0x12a)},{'name':a117_0x42da54(0x16b),'meowKey':'format','type':a117_0x42da54(0x16d),'description':a117_0x42da54(0x15f),'hint':a117_0x42da54(0x14b)},{'name':'jq','meowKey':'jq','type':a117_0x42da54(0x16d),'description':a117_0x42da54(0x15e),'hint':a117_0x42da54(0x141)},{'name':a117_0x42da54(0x130),'meowKey':'dryRun','type':'boolean','description':a117_0x42da54(0x131)},{'name':a117_0x42da54(0x12b),'meowKey':a117_0x42da54(0x12b),'type':a117_0x42da54(0x121),'description':'Skip\x20confirmation\x20for\x20high-risk\x20writes'},{'name':a117_0x42da54(0x176),'meowKey':'nonInteractive','type':a117_0x42da54(0x121),'description':'Force\x20non-interactive\x20mode\x20(CI)'},{'name':'global','meowKey':'global','type':a117_0x42da54(0x121),'description':'Use\x20global\x20config\x20scope'},{'name':a117_0x42da54(0x155),'meowKey':a117_0x42da54(0x155),'type':a117_0x42da54(0x121),'description':'Use\x20project\x20config\x20scope'},{'name':'ci','meowKey':'ci','type':a117_0x42da54(0x121),'description':a117_0x42da54(0x124),'hidden':!![]},{'name':a117_0x42da54(0x146),'meowKey':a117_0x42da54(0x146),'type':'boolean','description':a117_0x42da54(0x13d)},{'name':a117_0x42da54(0x167),'meowKey':a117_0x42da54(0x167),'type':a117_0x42da54(0x16d),'description':'Name','hidden':!![]},{'name':a117_0x42da54(0x123),'meowKey':a117_0x42da54(0x123),'type':'boolean','description':'Clear','hidden':!![]},{'name':a117_0x42da54(0x13c),'meowKey':'watch','type':'boolean','description':a117_0x42da54(0x16f),'hidden':!![]},{'name':a117_0x42da54(0x162),'meowKey':a117_0x42da54(0x162),'type':a117_0x42da54(0x16d),'description':a117_0x42da54(0x177),'hidden':!![]},{'name':a117_0x42da54(0x16c),'meowKey':a117_0x42da54(0x16c),'type':'string','description':a117_0x42da54(0x128),'hidden':!![]},{'name':'datasetcode','meowKey':a117_0x42da54(0x166),'type':'string','description':a117_0x42da54(0x129),'hidden':!![]},{'name':a117_0x42da54(0x149),'meowKey':a117_0x42da54(0x149),'type':'boolean','description':a117_0x42da54(0x143),'hidden':!![]},{'name':a117_0x42da54(0x165),'meowKey':a117_0x42da54(0x161),'type':a117_0x42da54(0x121),'description':'Enable\x20BFF\x20save','hidden':!![]},{'name':'id','meowKey':'id','type':a117_0x42da54(0x16d),'description':'Record\x20ID','hidden':!![]},{'name':a117_0x42da54(0x171),'meowKey':'type','type':a117_0x42da54(0x16d),'description':a117_0x42da54(0x15d),'hidden':!![]},{'name':a117_0x42da54(0x152),'meowKey':a117_0x42da54(0x152),'type':'string','description':'File\x20path','hidden':!![]},{'name':'sqlcode','meowKey':a117_0x42da54(0x13a),'type':a117_0x42da54(0x16d),'description':a117_0x42da54(0x14e),'hidden':!![]},{'name':'sql-name','meowKey':a117_0x42da54(0x15c),'type':'string','description':'SQL\x20name','hidden':!![]},{'name':a117_0x42da54(0x164),'meowKey':a117_0x42da54(0x164),'type':a117_0x42da54(0x16d),'description':'SQL\x20name','hidden':!![]},{'name':a117_0x42da54(0x127),'meowKey':a117_0x42da54(0x170),'type':a117_0x42da54(0x16d),'description':a117_0x42da54(0x147),'hidden':!![]},{'name':a117_0x42da54(0x126),'meowKey':a117_0x42da54(0x126),'type':a117_0x42da54(0x16d),'description':a117_0x42da54(0x147),'hidden':!![]},{'name':a117_0x42da54(0x173),'meowKey':a117_0x42da54(0x173),'type':a117_0x42da54(0x16d),'description':'Description','hidden':!![]},{'name':'page','meowKey':a117_0x42da54(0x13e),'type':a117_0x42da54(0x16d),'description':a117_0x42da54(0x148),'hidden':!![]},{'name':'pagesize','meowKey':a117_0x42da54(0x12f),'type':a117_0x42da54(0x16d),'description':a117_0x42da54(0x12c),'hidden':!![]},{'name':'keyword','meowKey':a117_0x42da54(0x13f),'type':'string','description':'Keyword\x20filter','hidden':!![]},{'name':a117_0x42da54(0x15b),'meowKey':a117_0x42da54(0x15b),'type':a117_0x42da54(0x16d),'description':a117_0x42da54(0x14a),'hidden':!![]},{'name':'sql','meowKey':a117_0x42da54(0x174),'type':'string','description':a117_0x42da54(0x159),'hidden':!![]},{'name':'schemas','meowKey':a117_0x42da54(0x168),'type':'string','description':a117_0x42da54(0x135),'hidden':!![]},{'name':a117_0x42da54(0x179),'meowKey':a117_0x42da54(0x179),'type':a117_0x42da54(0x16d),'description':a117_0x42da54(0x169),'hidden':!![]},{'name':a117_0x42da54(0x132),'meowKey':a117_0x42da54(0x132),'type':a117_0x42da54(0x16d),'description':a117_0x42da54(0x125),'hidden':!![]},{'name':'skip-imports','meowKey':a117_0x42da54(0x150),'type':'boolean','description':'Skip\x20import\x20generation','hidden':!![]},{'name':a117_0x42da54(0x136),'meowKey':'key','type':'string','description':a117_0x42da54(0x137),'hidden':!![]},{'name':a117_0x42da54(0x153),'meowKey':'value','type':a117_0x42da54(0x16d),'description':a117_0x42da54(0x144),'hidden':!![]},{'name':a117_0x42da54(0x122),'meowKey':'force','type':a117_0x42da54(0x121),'description':a117_0x42da54(0x14f),'hidden':!![]},{'name':a117_0x42da54(0x160),'meowKey':a117_0x42da54(0x160),'type':a117_0x42da54(0x121),'description':a117_0x42da54(0x145),'hidden':!![]},{'name':a117_0x42da54(0x14c),'meowKey':'verbose','type':'boolean','description':a117_0x42da54(0x142),'hidden':!![]},{'name':a117_0x42da54(0x172),'meowKey':'operationType','type':'string','description':a117_0x42da54(0x169),'hidden':!![]},{'name':a117_0x42da54(0x16a),'meowKey':a117_0x42da54(0x138),'type':a117_0x42da54(0x16d),'description':'Function\x20node','hidden':!![]}];export const PIPELINE_FLAG_NAMES=new Set([a117_0x42da54(0x15a),a117_0x42da54(0x14d),a117_0x42da54(0x175),a117_0x42da54(0x16b),'jq',a117_0x42da54(0x130),a117_0x42da54(0x12b),a117_0x42da54(0x176),'ci']);export function buildMeowFlags(){const _0x5ee818=a117_0x42da54;return Object[_0x5ee818(0x140)](GLOBAL_FLAGS[_0x5ee818(0x13b)](_0x27b50d=>[_0x27b50d['meowKey'],{'type':_0x27b50d[_0x5ee818(0x171)]}]));}function a117_0x4669(){const _0x109a12=['sqlname','enable-bff-save','datasetcode','name','schemas','Operation\x20type','function-node','format','params','string','5547703lAixDr','Watch\x20mode','dbId','type','operation-type','description','sql','env','non-interactive','Output\x20path','2652590AnrtTO','operation','boolean','force','clear','Alias\x20for\x20--non-interactive','Target\x20path','dbid','db-id','JSON\x20params','Dataset\x20code','production\x20|\x20daily','yes','Page\x20size','8LKPlrz','<name>','pagesize','dry-run','Preview\x20operation\x20without\x20executing','target','2044092BImMMb','Rabetbase\x20CLI','Schemas','key','Config\x20key','functionNode','1205636dQsvHO','sqlcode','map','watch','Show\x20help','page','keyword','fromEntries','<expr>','Verbose\x20output','Apply\x20to\x20all','Config\x20value','Use\x20remote','help','DB\x20ID','Page\x20number','all','Code\x20filter','json\x20|\x20pretty\x20|\x20compress','verbose','app','SQL\x20code','Force\x20overwrite','skipImports','7903566IwQopY','file','value','Environment','project','4672372EUKIWP','24XuufOH','rabetbase','SQL\x20string','appcode','code','sqlName','Type\x20filter','Filter\x20JSON\x20output\x20(bundled\x20jq\x20via\x20node-jq,\x20else\x20PATH;\x20use\x20with\x20--format\x20json\x20or\x20compress)','Output\x20format','remote','enableBffSave','output','272900RBQRTz'];a117_0x4669=function(){return _0x109a12;};return a117_0x4669();}
|
package/lib/constant/defaults.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a118_0x16cf61=a118_0x249d;(function(_0x47bd3b,_0x1825c6){const _0x349bd4=a118_0x249d,_0x3f72b3=_0x47bd3b();while(!![]){try{const _0x756a04=-parseInt(_0x349bd4(0x1be))/0x1+-parseInt(_0x349bd4(0x1c2))/0x2*(parseInt(_0x349bd4(0x1c3))/0x3)+-parseInt(_0x349bd4(0x1c0))/0x4*(-parseInt(_0x349bd4(0x1bb))/0x5)+parseInt(_0x349bd4(0x1c1))/0x6+parseInt(_0x349bd4(0x1ba))/0x7+-parseInt(_0x349bd4(0x1b9))/0x8+parseInt(_0x349bd4(0x1b7))/0x9*(-parseInt(_0x349bd4(0x1bd))/0xa);if(_0x756a04===_0x1825c6)break;else _0x3f72b3['push'](_0x3f72b3['shift']());}catch(_0x188083){_0x3f72b3['push'](_0x3f72b3['shift']());}}}(a118_0x23e0,0x18ad5));import{DEFAULT_API_DIR}from'../constant/paths.js';function a118_0x23e0(){const _0x58178f=['621978BPVlXs','5134nzVSGM','18FxGDOI','18VHGMJo','production','523104ScrrAt','1362263TfiroN','559505UJYYKb','compress','413870MYSlMc','145532wTlZNS','high-risk-write','4cIFcgO'];a118_0x23e0=function(){return _0x58178f;};return a118_0x23e0();}export const DEFAULT_CONFIG_VALUES={'env':a118_0x16cf61(0x1b8),'format':a118_0x16cf61(0x1bc),'locale':'en-US','riskLevel':a118_0x16cf61(0x1bf),'apiDir':DEFAULT_API_DIR};function a118_0x249d(_0x2564af,_0x3df2de){_0x2564af=_0x2564af-0x1b7;const _0x23e071=a118_0x23e0();let _0x249d35=_0x23e071[_0x2564af];return _0x249d35;}export const DEFAULT_COMMAND_OUTPUT_FORMAT=a118_0x16cf61(0x1bc);
|
package/lib/constant/domain.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a119_0x4b8ab3=a119_0x3f16;(function(_0x1aa6bb,_0x508a7f){const _0x473a90=a119_0x3f16,_0x364506=_0x1aa6bb();while(!![]){try{const _0x19ebb4=-parseInt(_0x473a90(0xf7))/0x1*(parseInt(_0x473a90(0xea))/0x2)+-parseInt(_0x473a90(0xe9))/0x3+parseInt(_0x473a90(0xf2))/0x4*(-parseInt(_0x473a90(0xe7))/0x5)+parseInt(_0x473a90(0xf8))/0x6+-parseInt(_0x473a90(0xf6))/0x7*(parseInt(_0x473a90(0xf4))/0x8)+-parseInt(_0x473a90(0xf5))/0x9*(parseInt(_0x473a90(0xf0))/0xa)+parseInt(_0x473a90(0xed))/0xb;if(_0x19ebb4===_0x508a7f)break;else _0x364506['push'](_0x364506['shift']());}catch(_0x5b71a3){_0x364506['push'](_0x364506['shift']());}}}(a119_0x40be,0xd8269));import{getEnv,isProduction}from'../constant/env.js';function a119_0x40be(){const _0x3b62f4=['4012884iVoXfe','https://user.lovrabet.com','55zpjwcZ','apiDomain','4790817nSqjdx','2oIkafq','https://runtime.lovrabet.com','https://daily-runtime.lovrabet.com','69921181UPuMkq','runtimeDomain','https://user-daily.lovrabet.com','30jAVslt','https://daily-api.lovrabet.com','183388TJZOmx','https://api.lovrabet.com','1696emEddk','4579119iURqrS','29890pvTJPw','1607063TVJoas'];a119_0x40be=function(){return _0x3b62f4;};return a119_0x40be();}let customApiDomain,customUserDomain,customRuntimeDomain;export function initDomains(_0x16934a){const _0x2a911e=a119_0x3f16;customApiDomain=_0x16934a?.[_0x2a911e(0xe8)],customUserDomain=_0x16934a?.['userDomain'],customRuntimeDomain=_0x16934a?.[_0x2a911e(0xee)];}export const getUserDomain=()=>customUserDomain||(isProduction(getEnv())?a119_0x4b8ab3(0xe6):a119_0x4b8ab3(0xef));function a119_0x3f16(_0x3ef1bb,_0x5e1141){_0x3ef1bb=_0x3ef1bb-0xe6;const _0x40be91=a119_0x40be();let _0x3f168f=_0x40be91[_0x3ef1bb];return _0x3f168f;}export const getApiDomain=()=>customApiDomain||(isProduction(getEnv())?a119_0x4b8ab3(0xf3):a119_0x4b8ab3(0xf1));export const getRuntimeDomain=()=>customRuntimeDomain||(isProduction(getEnv())?a119_0x4b8ab3(0xeb):a119_0x4b8ab3(0xec));
|