@lovrabet/rabetbase-cli 2.1.9 → 2.1.10-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/api-doc.js +1 -1
- package/lib/api/fetch-model-list.js +1 -1
- package/lib/api/generate-api-file.js +1 -1
- package/lib/auth/auth-server-ui.js +1 -1
- package/lib/auth/auth-server.js +1 -1
- package/lib/auth/constant.js +1 -1
- package/lib/auth/get-cookie.js +1 -1
- package/lib/auth/get-session-user.js +1 -1
- package/lib/auth/is-session-valid.js +1 -1
- package/lib/auth/login-success-html.js +1 -1
- package/lib/auth/logout.js +1 -1
- package/lib/cli-flags.js +1 -1
- package/lib/cli.js +1 -1
- package/lib/commands/api/generate.js +1 -1
- package/lib/commands/api/index.js +1 -1
- package/lib/commands/api/list.js +1 -1
- package/lib/commands/api/pull.js +1 -1
- package/lib/commands/api/shared.js +1 -1
- package/lib/commands/app/add.js +1 -1
- package/lib/commands/app/discover.js +1 -1
- package/lib/commands/app/index.js +1 -1
- package/lib/commands/app/list.js +1 -1
- package/lib/commands/app/remove.js +1 -1
- package/lib/commands/app/shared.js +1 -1
- package/lib/commands/app/use.js +1 -1
- package/lib/commands/auth/index.js +1 -1
- package/lib/commands/bff/create.js +1 -1
- package/lib/commands/bff/delete.js +1 -1
- package/lib/commands/bff/detail.js +1 -1
- package/lib/commands/bff/index.js +1 -1
- package/lib/commands/bff/list.js +1 -1
- package/lib/commands/bff/pull.js +1 -1
- package/lib/commands/bff/push.js +1 -1
- package/lib/commands/bff/status.js +1 -1
- package/lib/commands/cli-update.js +1 -1
- package/lib/commands/codegen/index.js +1 -1
- package/lib/commands/codegen/sdk.js +1 -1
- package/lib/commands/codegen/sql.js +1 -1
- package/lib/commands/common/app-selector.js +1 -1
- package/lib/commands/common/flags.js +1 -1
- package/lib/commands/common/validate.js +1 -1
- package/lib/commands/config/get.js +1 -1
- package/lib/commands/config/index.js +1 -1
- package/lib/commands/config/list.js +1 -1
- package/lib/commands/config/set.js +1 -1
- package/lib/commands/config/shared.js +1 -1
- package/lib/commands/data/filter.js +1 -1
- package/lib/commands/data/getOne.js +1 -1
- package/lib/commands/data/index.js +1 -1
- package/lib/commands/data/shared.js +1 -1
- package/lib/commands/dataset/delete.js +1 -1
- package/lib/commands/dataset/detail.js +1 -1
- package/lib/commands/dataset/field-update.js +1 -0
- package/lib/commands/dataset/index.js +1 -1
- package/lib/commands/dataset/link-create.js +1 -1
- package/lib/commands/dataset/link-delete.js +1 -1
- package/lib/commands/dataset/link-shared.js +1 -1
- package/lib/commands/dataset/link-update.js +1 -1
- package/lib/commands/dataset/links.js +1 -1
- package/lib/commands/dataset/list.js +1 -1
- package/lib/commands/dataset/operations.js +1 -1
- package/lib/commands/db/analyze-cancel.js +1 -1
- package/lib/commands/db/analyze-start.js +1 -1
- package/lib/commands/db/analyze-status.js +1 -1
- package/lib/commands/db/create.js +1 -1
- package/lib/commands/db/delete.js +1 -1
- package/lib/commands/db/detail.js +1 -1
- package/lib/commands/db/diff.js +1 -1
- package/lib/commands/db/index.js +1 -1
- package/lib/commands/db/list.js +1 -1
- package/lib/commands/db/shared.js +1 -1
- package/lib/commands/db/tables.js +1 -1
- package/lib/commands/db/test.js +1 -1
- package/lib/commands/db/update.js +1 -1
- package/lib/commands/doctor.js +1 -1
- package/lib/commands/init/index.js +1 -1
- package/lib/commands/issue/index.js +1 -1
- package/lib/commands/issue/report.js +1 -1
- package/lib/commands/logs/index.js +1 -1
- package/lib/commands/menu/index.js +1 -1
- package/lib/commands/menu/shared/compare-table.js +1 -1
- package/lib/commands/menu/shared/index.js +1 -1
- package/lib/commands/menu/shared/inquirer.js +1 -1
- package/lib/commands/menu/shared/local-pages.js +1 -1
- package/lib/commands/menu/shared/logic.js +1 -1
- package/lib/commands/menu/shared/service.js +1 -1
- package/lib/commands/menu/shared/sync-core.js +1 -1
- package/lib/commands/menu/shared/update-core.js +1 -1
- package/lib/commands/menu/shared/valid-url.js +1 -1
- package/lib/commands/menu/sync.js +1 -1
- package/lib/commands/menu/update.js +1 -1
- package/lib/commands/page/generate-start.js +1 -1
- package/lib/commands/page/generate-status.js +1 -1
- package/lib/commands/page/index.js +1 -1
- package/lib/commands/page/pull.js +1 -1
- package/lib/commands/page/push.js +1 -1
- package/lib/commands/page/shared.js +1 -1
- package/lib/commands/page/standard-page-status.js +1 -1
- package/lib/commands/page/sync.js +1 -1
- package/lib/commands/project/create/enhanced-guided-create.js +1 -1
- package/lib/commands/project/create/format-elapsed.js +1 -1
- package/lib/commands/project/create/main.js +1 -1
- package/lib/commands/project/create/non-interactive.js +1 -1
- package/lib/commands/project/create/project-template-path.js +1 -1
- package/lib/commands/project/create/use-copy-project-template.js +1 -1
- package/lib/commands/project/create/use-format-code.js +1 -1
- package/lib/commands/project/create/use-install-dependencies.js +1 -1
- package/lib/commands/project/index.js +1 -1
- package/lib/commands/project/init.js +1 -1
- package/lib/commands/project/upgrade.js +1 -1
- package/lib/commands/registry.js +1 -1
- package/lib/commands/run/index.js +1 -1
- package/lib/commands/schema.js +1 -1
- package/lib/commands/skill/index.js +1 -1
- package/lib/commands/sql/create.js +1 -1
- package/lib/commands/sql/delete.js +1 -1
- package/lib/commands/sql/detail.js +1 -1
- package/lib/commands/sql/exec.js +1 -1
- package/lib/commands/sql/index.js +1 -1
- package/lib/commands/sql/list.js +1 -1
- package/lib/commands/sql/pull.js +1 -1
- package/lib/commands/sql/push.js +1 -1
- package/lib/commands/sql/save.js +1 -1
- package/lib/commands/sql/shared.js +1 -1
- package/lib/commands/sql/status.js +1 -1
- package/lib/commands/sql/validate.js +1 -1
- package/lib/config/schema.js +1 -1
- package/lib/constant/cdn.js +1 -1
- package/lib/constant/cli.js +1 -1
- package/lib/constant/defaults.js +1 -1
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/constant/output.js +1 -1
- package/lib/constant/paths.js +1 -1
- package/lib/constant/risk.js +1 -1
- package/lib/context.js +1 -1
- package/lib/core/alias-resolver.js +1 -1
- package/lib/core/api-client.js +1 -1
- package/lib/core/bff/config.js +1 -1
- package/lib/core/bff/file-system.js +1 -1
- package/lib/core/bff/hash.js +1 -1
- package/lib/core/bff/lock.js +1 -1
- package/lib/core/bff/utils.js +1 -1
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/page/file-system.js +1 -1
- package/lib/core/page/hash.js +1 -1
- package/lib/core/page/lock.js +1 -1
- package/lib/core/sql-sync/config.js +1 -1
- package/lib/core/sql-sync/file-system.js +1 -1
- package/lib/core/sql-sync/hash.js +1 -1
- package/lib/core/sql-sync/lock.js +1 -1
- package/lib/core/sql-sync/utils.js +1 -1
- package/lib/core/sql-validator.js +1 -1
- package/lib/errors.js +1 -1
- package/lib/framework/build-all-flags.js +1 -1
- package/lib/framework/flags.js +1 -1
- package/lib/framework/help.js +1 -1
- package/lib/framework/index.js +1 -1
- package/lib/framework/output.js +1 -1
- package/lib/framework/response.js +1 -1
- package/lib/framework/runner-alias.js +1 -1
- package/lib/framework/runner.js +1 -1
- package/lib/framework/schema-export.js +1 -1
- package/lib/framework/types.js +1 -1
- package/lib/generated/build-info.js +1 -1
- package/lib/help.js +1 -1
- package/lib/skills/main.js +1 -1
- package/lib/skills/npx-skills-add.js +1 -1
- package/lib/telemetry/cli-command-trace.js +1 -1
- package/lib/telemetry/cli-help-trace.js +1 -1
- package/lib/telemetry/ensure-cli-otel-config.js +1 -1
- package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
- package/lib/telemetry/send-cli-trace-log.js +1 -1
- package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
- package/lib/utils/ai_config.js +1 -1
- package/lib/utils/apply-jq-filter.js +1 -1
- package/lib/utils/cdn-config.js +1 -1
- package/lib/utils/check-sdk-version.js +1 -1
- package/lib/utils/cli-version-check.js +1 -1
- package/lib/utils/cli-version-policy.js +1 -1
- package/lib/utils/config.js +1 -1
- package/lib/utils/copy-directory.js +1 -1
- package/lib/utils/entity-with-id.js +1 -1
- package/lib/utils/file-utils.js +1 -1
- package/lib/utils/guides-cdn.js +1 -1
- package/lib/utils/http-client.js +1 -1
- package/lib/utils/is-non-interactive.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/params.js +1 -1
- package/lib/utils/platform.js +1 -1
- package/lib/utils/rules-cdn.js +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.js +1 -1
- package/lib/utils/version.js +1 -1
- package/lib/utils/with-active-cookie.js +1 -1
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +2 -1
package/lib/commands/sql/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a120_0x5bda34=a120_0x3f66;(function(_0x2a9746,_0xc5633c){const _0x240a83=a120_0x3f66,_0x5115c4=_0x2a9746();while(!![]){try{const _0x46d33b=parseInt(_0x240a83(0x20d))/0x1*(-parseInt(_0x240a83(0x1e7))/0x2)+-parseInt(_0x240a83(0x1e6))/0x3+parseInt(_0x240a83(0x201))/0x4+-parseInt(_0x240a83(0x1e5))/0x5+-parseInt(_0x240a83(0x225))/0x6*(parseInt(_0x240a83(0x204))/0x7)+parseInt(_0x240a83(0x1eb))/0x8*(-parseInt(_0x240a83(0x1fb))/0x9)+parseInt(_0x240a83(0x223))/0xa;if(_0x46d33b===_0xc5633c)break;else _0x5115c4['push'](_0x5115c4['shift']());}catch(_0x48d81f){_0x5115c4['push'](_0x5115c4['shift']());}}}(a120_0x3794,0xc9a34));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';function a120_0x3f66(_0x224227,_0x4a62ba){_0x224227=_0x224227-0x1e3;const _0x3794dd=a120_0x3794();let _0x3f6607=_0x3794dd[_0x224227];return _0x3f6607;}import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x453d42,_0x11f6b3){const _0x38d57c=a120_0x3f66,_0x330d38=[];let _0xa6680a=0x1;while(!![]){const _0x82a2ba=await listSqlQueries(_0x453d42,{'currentPage':_0xa6680a,'pageSize':PAGE_SIZE,'sqlCode':_0x11f6b3[_0x38d57c(0x1f8)],'sqlName':_0x11f6b3[_0x38d57c(0x1f4)]}),_0xc1f96c=_0x82a2ba['tableData']??[];_0x330d38[_0x38d57c(0x210)](..._0xc1f96c);if(_0xc1f96c[_0x38d57c(0x208)]===0x0)break;const _0xfbadd3=_0x82a2ba[_0x38d57c(0x220)]?.[_0x38d57c(0x1f0)];if(_0xfbadd3!=null?_0x330d38[_0x38d57c(0x208)]>=_0xfbadd3:_0xc1f96c[_0x38d57c(0x208)]<PAGE_SIZE)break;_0xa6680a++;}return _0x330d38;}async function ensureSqlContent(_0x57439c){const _0x23bfac=a120_0x3f66;if(_0x57439c[_0x23bfac(0x218)]!=null&&String(_0x57439c[_0x23bfac(0x218)])[_0x23bfac(0x208)]>0x0)return _0x57439c;return getSqlQueryDetail(_0x57439c[_0x23bfac(0x1f8)]);}export const sqlPull={'service':'sql','command':'pull','description':a120_0x5bda34(0x1ee),'risk':a120_0x5bda34(0x214),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a120_0x5bda34(0x216),'type':a120_0x5bda34(0x21d),'description':a120_0x5bda34(0x1fd)},{'name':a120_0x5bda34(0x1f2),'type':a120_0x5bda34(0x1f9),'description':a120_0x5bda34(0x222)}],async 'dryRun'(_0x382cbf){const _0x330a03=a120_0x5bda34,_0x46a784=loadSqlProjectConfig(_0x382cbf[_0x330a03(0x1f5)]),_0x42a900=await readSqlLockFile(_0x46a784['lockFilePath']),{appLock:_0x189f7c}=ensureSqlLockScope(_0x42a900??createEmptySqlLock(),_0x46a784[_0x330a03(0x1f5)],_0x46a784[_0x330a03(0x21a)],_0x330a03(0x1ff)),_0x406fb5=await fetchAllSqlQueries(_0x382cbf[_0x330a03(0x1f5)],{'sqlCode':_0x382cbf['str'](_0x330a03(0x219))||undefined,'sqlName':_0x382cbf[_0x330a03(0x1ef)](_0x330a03(0x216))||undefined}),_0x532913=[];for(const _0x19d590 of _0x406fb5){const _0x18255f=await ensureSqlContent(_0x19d590),_0x5bcfe6=ensureRemoteSqlContent(_0x18255f),_0x43ebb5=detectModeFromSql(_0x18255f),_0x3a122d=_0x18255f[_0x330a03(0x1e4)]?await getDbName(_0x382cbf['appCode'],Number(_0x18255f[_0x330a03(0x1e4)]))[_0x330a03(0x215)](()=>undefined):undefined,_0xe05460=buildLocalSqlFileContent({'sqlCode':_0x18255f[_0x330a03(0x1f8)],'sqlName':_0x18255f[_0x330a03(0x1f4)],'dbId':_0x18255f[_0x330a03(0x1e4)]},_0x5bcfe6,{'dbName':_0x3a122d,'mode':_0x43ebb5,'syncedAt':new Date()[_0x330a03(0x209)](),'description':_0x18255f[_0x330a03(0x20b)]}),_0x344e04=buildSqlLockEntry(_0x18255f,_0x5bcfe6,'',{'dbName':_0x3a122d}),_0x5e105b=resolveLocalSqlFilePath(_0x46a784,_0x18255f['sqlCode'],_0x344e04);let _0x5dfb3e=_0x330a03(0x202),_0x4b506a;if(await fileExists(_0x5e105b)){const _0x4974d3=await readFile(_0x5e105b,_0x330a03(0x1f7));isEquivalentPulledSqlFile(_0x4974d3,_0xe05460,_0x43ebb5)?(_0x5dfb3e=_0x330a03(0x217),_0x4b506a=_0x330a03(0x1fe)):(_0x5dfb3e=_0x330a03(0x207),_0x4b506a=_0x330a03(0x205));}_0x532913['push']({'sqlCode':_0x18255f[_0x330a03(0x1f8)],'sqlName':_0x18255f[_0x330a03(0x1f4)],'filePath':_0x5e105b,'status':_0x5dfb3e,'reason':_0x4b506a});}return{'method':_0x330a03(0x1fa),'url':'/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','body':{'appCode':_0x382cbf[_0x330a03(0x1f5)],'sqlCode':_0x382cbf[_0x330a03(0x1ef)](_0x330a03(0x219))||null,'sqlName':_0x382cbf[_0x330a03(0x1ef)](_0x330a03(0x216))||null,'files':_0x532913},'description':'Would\x20pull\x20'+_0x532913[_0x330a03(0x208)]+_0x330a03(0x1e9)+_0x46a784[_0x330a03(0x1f1)]};},async 'execute'(_0x4b749d){const _0x31579c=a120_0x5bda34,_0x289249=loadSqlProjectConfig(_0x4b749d[_0x31579c(0x1f5)]),_0x41b30a=await readSqlLockFile(_0x289249[_0x31579c(0x1f3)]),{lockData:_0x3a116d,appLock:_0x300120}=ensureSqlLockScope(_0x41b30a??createEmptySqlLock(),_0x289249[_0x31579c(0x1f5)],_0x289249[_0x31579c(0x21a)],_0x31579c(0x1ff)),_0x422c2d=_0x4b749d[_0x31579c(0x221)](_0x31579c(0x1f2)),_0x4d7bcc=await fetchAllSqlQueries(_0x4b749d[_0x31579c(0x1f5)],{'sqlCode':_0x4b749d[_0x31579c(0x1ef)](_0x31579c(0x219))||undefined,'sqlName':_0x4b749d[_0x31579c(0x1ef)](_0x31579c(0x216))||undefined});if(_0x4d7bcc[_0x31579c(0x208)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x31579c(0x21c)};const _0x5133d1=[],_0x2ea1b1=[];for(const _0x578c53 of _0x4d7bcc){try{_0x5133d1['push'](await ensureSqlContent(_0x578c53));}catch(_0x579d20){_0x2ea1b1[_0x31579c(0x210)]({'sqlCode':_0x578c53['sqlCode'],'error':_0x579d20 instanceof Error?_0x579d20[_0x31579c(0x1fc)]:String(_0x579d20)});}}if(_0x422c2d&&!_0x4b749d[_0x31579c(0x20c)]){let _0x183522=![];for(const _0x171793 of _0x5133d1){const _0x5ea632=detectModeFromSql(_0x171793),_0x1a0018=_0x171793[_0x31579c(0x1e4)]?await getDbName(_0x4b749d['appCode'],Number(_0x171793[_0x31579c(0x1e4)]))[_0x31579c(0x215)](()=>undefined):undefined,_0x2f8771=buildLocalSqlFileContent({'sqlCode':_0x171793[_0x31579c(0x1f8)],'sqlName':_0x171793[_0x31579c(0x1f4)],'dbId':_0x171793['dbId']},ensureRemoteSqlContent(_0x171793),{'dbName':_0x1a0018,'mode':_0x5ea632,'syncedAt':new Date()[_0x31579c(0x209)](),'description':_0x171793[_0x31579c(0x20b)]}),_0x40b6a1=resolveLocalSqlFilePath(_0x289249,_0x171793['sqlCode'],buildSqlLockEntry(_0x171793,ensureRemoteSqlContent(_0x171793),'',{'dbName':_0x1a0018}));if(await fileExists(_0x40b6a1)){const _0x4cff03=await readFile(_0x40b6a1,_0x31579c(0x1f7));if(!isEquivalentPulledSqlFile(_0x4cff03,_0x2f8771,_0x5ea632)){_0x183522=!![];break;}}}if(_0x183522){const _0xad85f2=await confirmForceOverwrite('Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.');if(!_0xad85f2)throw CliErrors[_0x31579c(0x1ec)](_0x31579c(0x1f6));}}const _0x226754=cloneSqlLockData(_0x3a116d),_0xcd2919=_0x226754[_0x31579c(0x200)][_0x289249[_0x31579c(0x1f5)]],_0x4275d0=[],_0x3ad743=[];for(const _0x4110cb of _0x5133d1){const _0x5c80d6=_0xcd2919['sqls'][_0x4110cb[_0x31579c(0x1f8)]],_0x53e275=ensureRemoteSqlContent(_0x4110cb),_0x42fa6a=detectModeFromSql(_0x4110cb),_0x57f5cf=_0x4110cb['dbId']?await getDbName(_0x4b749d[_0x31579c(0x1f5)],Number(_0x4110cb[_0x31579c(0x1e4)]))[_0x31579c(0x215)](()=>undefined):undefined,_0x4a2c32=buildLocalSqlFileContent({'sqlCode':_0x4110cb[_0x31579c(0x1f8)],'sqlName':_0x4110cb[_0x31579c(0x1f4)],'dbId':_0x4110cb[_0x31579c(0x1e4)]},_0x53e275,{'dbName':_0x57f5cf,'mode':_0x42fa6a,'syncedAt':new Date()[_0x31579c(0x209)](),'description':_0x4110cb[_0x31579c(0x20b)]}),_0xde1cb=buildSqlLockEntry(_0x4110cb,_0x53e275,computeSqlContentHash(_0x4a2c32),{'dbName':_0x57f5cf}),_0x30606f=_0xde1cb[_0x31579c(0x1e3)],_0x553850=join(_0x289249[_0x31579c(0x1f1)],_0x30606f);try{if(await fileExists(_0x553850)){const _0x5e23b4=await readFile(_0x553850,'utf8');if(isEquivalentPulledSqlFile(_0x5e23b4,_0x4a2c32,_0x42fa6a)){_0x3ad743[_0x31579c(0x210)]({'sqlCode':_0x4110cb[_0x31579c(0x1f8)],'reason':_0x31579c(0x1fe)}),_0xcd2919['sqls'][_0x4110cb[_0x31579c(0x1f8)]]={..._0xde1cb,'hash':computeSqlContentHash(_0x5e23b4),'path':_0x30606f};continue;}if(!_0x422c2d){_0x3ad743[_0x31579c(0x210)]({'sqlCode':_0x4110cb[_0x31579c(0x1f8)],'reason':_0x31579c(0x211)});continue;}}const _0x1eb960=_0x5c80d6?.[_0x31579c(0x1e3)]?join(_0x289249[_0x31579c(0x1f1)],_0x5c80d6['path']):undefined;_0x1eb960&&_0x1eb960!==_0x553850&&await fileExists(_0x1eb960)&&await rm(_0x1eb960,{'force':!![]}),await ensureParentDirectory(_0x553850),await writeFile(_0x553850,_0x4a2c32,_0x31579c(0x1f7)),_0xcd2919[_0x31579c(0x20e)][_0x4110cb[_0x31579c(0x1f8)]]={..._0xde1cb,'path':_0x30606f},_0x4275d0[_0x31579c(0x210)]({'sqlCode':_0x4110cb[_0x31579c(0x1f8)],'filePath':_0x553850});}catch(_0x934e7){_0x2ea1b1[_0x31579c(0x210)]({'sqlCode':_0x4110cb[_0x31579c(0x1f8)],'error':_0x934e7 instanceof Error?_0x934e7[_0x31579c(0x1fc)]:String(_0x934e7)});}}return _0xcd2919[_0x31579c(0x20a)]=new Date()[_0x31579c(0x209)](),await writeSqlLockFile(_0x289249[_0x31579c(0x1f3)],_0x226754),{'ok':_0x2ea1b1[_0x31579c(0x208)]===0x0,'data':{'pulled':_0x4275d0,'skipped':_0x3ad743,'failed':_0x2ea1b1},'message':_0x31579c(0x224)+_0x4275d0['length']+_0x31579c(0x21b)+_0x3ad743[_0x31579c(0x208)]+_0x31579c(0x1e8)+_0x2ea1b1[_0x31579c(0x208)]+_0x31579c(0x1ea)};}};function detectModeFromSql(_0x28a0ba){const _0x3174ac=a120_0x5bda34,_0x58fd97=ensureRemoteSqlContent(_0x28a0ba),_0x237e43=stripLocalSqlMetadata(_0x58fd97,'mybatisXml')[_0x3174ac(0x212)]();if(/^<(select|insert|update|delete)\b/i['test'](_0x237e43))return _0x3174ac(0x203);return _0x3174ac(0x213);}function a120_0x3794(){const _0x31d3b6=['72432VLlkSD','6NcQxTO','\x20skipped,\x20','\x20SQL\x20file(s)\x20into\x20','\x20failed','1432PZJIDD','cancelled','split','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','str','totalCount','sqlRootDir','force','lockFilePath','sqlName','appCode','Force\x20pull\x20cancelled.','utf8','sqlCode','boolean','POST','55899IHcLrB','message','Filter\x20by\x20SQL\x20display\x20name','unchanged','pull','apps','4248396iCBnJN','would_pull','mybatisXml','416948DibGsa','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','filter','conflict','length','toISOString','lastSync','description','nonInteractive','42597pBLRDg','sqls','join','push','local\x20differs\x20from\x20remote','trimStart','sql','write','catch','name','skipped','sqlContent','sqlcode','sqlRoot','\x20written,\x20','No\x20remote\x20SQL\x20queries\x20matched.','string','replace','test','paging','bool','Force\x20overwrite\x20local\x20unsynced\x20changes','21130050VEjPQs','Pull\x20complete:\x20','36kGWSRK','path','dbId','3640540LYyjqn'];a120_0x3794=function(){return _0x31d3b6;};return a120_0x3794();}function isEquivalentPulledSqlFile(_0x1b0750,_0x299575,_0x3e099e){return normalizePullComparableContent(_0x1b0750,_0x3e099e)===normalizePullComparableContent(_0x299575,_0x3e099e);}function normalizePullComparableContent(_0x17e1a8,_0x414db3){const _0x11928d=a120_0x5bda34,_0xbc1a82=_0x17e1a8[_0x11928d(0x21e)](/\r\n/g,'\x0a')[_0x11928d(0x1ed)]('\x0a'),_0x3359aa=_0xbc1a82[_0x11928d(0x206)](_0x20a07b=>!isSyncedAtMetadataLine(_0x20a07b,_0x414db3));return _0x3359aa[_0x11928d(0x20f)]('\x0a');}function isSyncedAtMetadataLine(_0x41bebf,_0x307136){const _0x1d409a=a120_0x5bda34;if(_0x307136===_0x1d409a(0x203))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x1d409a(0x21f)](_0x41bebf);return/^\s*--\s*@lovrabet\.syncedAt:/['test'](_0x41bebf);}
|
|
1
|
+
const a121_0xb8ffa6=a121_0x1de3;(function(_0x397860,_0x366394){const _0x35ae64=a121_0x1de3,_0x4ca59c=_0x397860();while(!![]){try{const _0x26aa9b=-parseInt(_0x35ae64(0x17f))/0x1+parseInt(_0x35ae64(0x179))/0x2+parseInt(_0x35ae64(0x17d))/0x3+parseInt(_0x35ae64(0x161))/0x4*(-parseInt(_0x35ae64(0x175))/0x5)+-parseInt(_0x35ae64(0x18e))/0x6+parseInt(_0x35ae64(0x192))/0x7*(-parseInt(_0x35ae64(0x15f))/0x8)+parseInt(_0x35ae64(0x190))/0x9;if(_0x26aa9b===_0x366394)break;else _0x4ca59c['push'](_0x4ca59c['shift']());}catch(_0x46802a){_0x4ca59c['push'](_0x4ca59c['shift']());}}}(a121_0xcd25,0x83bb8));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x40891c,_0x3da9bc){const _0x211da6=a121_0x1de3,_0x1740fb=[];let _0x22def3=0x1;while(!![]){const _0x58e118=await listSqlQueries(_0x40891c,{'currentPage':_0x22def3,'pageSize':PAGE_SIZE,'sqlCode':_0x3da9bc['sqlCode'],'sqlName':_0x3da9bc[_0x211da6(0x182)]}),_0x59e36f=_0x58e118[_0x211da6(0x171)]??[];_0x1740fb['push'](..._0x59e36f);if(_0x59e36f[_0x211da6(0x17a)]===0x0)break;const _0x4ac7fb=_0x58e118['paging']?.['totalCount'];if(_0x4ac7fb!=null?_0x1740fb[_0x211da6(0x17a)]>=_0x4ac7fb:_0x59e36f[_0x211da6(0x17a)]<PAGE_SIZE)break;_0x22def3++;}return _0x1740fb;}function a121_0xcd25(){const _0xe6296e=['trimStart','test','split','Force\x20overwrite\x20local\x20unsynced\x20changes','\x20written,\x20','appCode','sqlContent','str','pull','sqlRoot','cancelled','sqls','skipped','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','tableData','path','push','sqlcode','5QUMyAb','No\x20remote\x20SQL\x20queries\x20matched.','description','nonInteractive','269146gzHTAt','length','name','sql','58482GFHnWN','write','590282pVGNoG','string','apps','sqlName','\x20SQL\x20file(s)\x20into\x20','utf8','filter','mybatisXml','bool','POST','Pull\x20complete:\x20','toISOString','sqlRootDir','unchanged','\x20skipped,\x20','3402714lurJCP','Force\x20pull\x20cancelled.','29895876eVwlqg','lockFilePath','497psBtaP','lastSync','catch','conflict','replace','dbId','message','sqlCode','101176hqgQij','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','3523668JPnQjx','\x20failed'];a121_0xcd25=function(){return _0xe6296e;};return a121_0xcd25();}async function ensureSqlContent(_0x463446){const _0x4988c7=a121_0x1de3;if(_0x463446[_0x4988c7(0x169)]!=null&&String(_0x463446[_0x4988c7(0x169)])[_0x4988c7(0x17a)]>0x0)return _0x463446;return getSqlQueryDetail(_0x463446['sqlCode']);}function a121_0x1de3(_0x27027e,_0x3d8bfa){_0x27027e=_0x27027e-0x15d;const _0xcd257e=a121_0xcd25();let _0x1de38e=_0xcd257e[_0x27027e];return _0x1de38e;}export const sqlPull={'service':a121_0xb8ffa6(0x17c),'command':a121_0xb8ffa6(0x16b),'description':'Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','risk':a121_0xb8ffa6(0x17e),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a121_0xb8ffa6(0x17b),'type':a121_0xb8ffa6(0x180),'description':'Filter\x20by\x20SQL\x20display\x20name'},{'name':'force','type':'boolean','description':a121_0xb8ffa6(0x166)}],async 'dryRun'(_0x404a6b){const _0x5ca979=a121_0xb8ffa6,_0x1ecea9=loadSqlProjectConfig(_0x404a6b[_0x5ca979(0x168)]),_0xc77458=await readSqlLockFile(_0x1ecea9['lockFilePath']),{appLock:_0x4ce798}=ensureSqlLockScope(_0xc77458??createEmptySqlLock(),_0x1ecea9[_0x5ca979(0x168)],_0x1ecea9['sqlRoot'],_0x5ca979(0x16b)),_0x2819e3=await fetchAllSqlQueries(_0x404a6b['appCode'],{'sqlCode':_0x404a6b[_0x5ca979(0x16a)](_0x5ca979(0x174))||undefined,'sqlName':_0x404a6b[_0x5ca979(0x16a)](_0x5ca979(0x17b))||undefined}),_0x4a4130=[];for(const _0x4eb1d0 of _0x2819e3){const _0x12f6c8=await ensureSqlContent(_0x4eb1d0),_0x412329=ensureRemoteSqlContent(_0x12f6c8),_0x3d18a2=detectModeFromSql(_0x12f6c8),_0x3d4237=_0x12f6c8[_0x5ca979(0x197)]?await getDbName(_0x404a6b[_0x5ca979(0x168)],Number(_0x12f6c8['dbId']))['catch'](()=>undefined):undefined,_0x4a2870=buildLocalSqlFileContent({'sqlCode':_0x12f6c8[_0x5ca979(0x15e)],'sqlName':_0x12f6c8[_0x5ca979(0x182)],'dbId':_0x12f6c8[_0x5ca979(0x197)]},_0x412329,{'dbName':_0x3d4237,'mode':_0x3d18a2,'syncedAt':new Date()[_0x5ca979(0x18a)](),'description':_0x12f6c8[_0x5ca979(0x177)]}),_0x1f7a43=buildSqlLockEntry(_0x12f6c8,_0x412329,'',{'dbName':_0x3d4237}),_0x406183=resolveLocalSqlFilePath(_0x1ecea9,_0x12f6c8['sqlCode'],_0x1f7a43);let _0x201c96='would_pull',_0x2e8ba0;if(await fileExists(_0x406183)){const _0x189f64=await readFile(_0x406183,_0x5ca979(0x184));isEquivalentPulledSqlFile(_0x189f64,_0x4a2870,_0x3d18a2)?(_0x201c96=_0x5ca979(0x16f),_0x2e8ba0=_0x5ca979(0x18c)):(_0x201c96=_0x5ca979(0x195),_0x2e8ba0=_0x5ca979(0x170));}_0x4a4130[_0x5ca979(0x173)]({'sqlCode':_0x12f6c8[_0x5ca979(0x15e)],'sqlName':_0x12f6c8[_0x5ca979(0x182)],'filePath':_0x406183,'status':_0x201c96,'reason':_0x2e8ba0});}return{'method':_0x5ca979(0x188),'url':'/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','body':{'appCode':_0x404a6b[_0x5ca979(0x168)],'sqlCode':_0x404a6b[_0x5ca979(0x16a)](_0x5ca979(0x174))||null,'sqlName':_0x404a6b[_0x5ca979(0x16a)](_0x5ca979(0x17b))||null,'files':_0x4a4130},'description':'Would\x20pull\x20'+_0x4a4130[_0x5ca979(0x17a)]+_0x5ca979(0x183)+_0x1ecea9['sqlRootDir']};},async 'execute'(_0x599b02){const _0x4cb92f=a121_0xb8ffa6,_0x4ba6b5=loadSqlProjectConfig(_0x599b02[_0x4cb92f(0x168)]),_0x21ba81=await readSqlLockFile(_0x4ba6b5[_0x4cb92f(0x191)]),{lockData:_0x134623,appLock:_0x43399a}=ensureSqlLockScope(_0x21ba81??createEmptySqlLock(),_0x4ba6b5['appCode'],_0x4ba6b5[_0x4cb92f(0x16c)],_0x4cb92f(0x16b)),_0x45b176=_0x599b02[_0x4cb92f(0x187)]('force'),_0x47077d=await fetchAllSqlQueries(_0x599b02['appCode'],{'sqlCode':_0x599b02[_0x4cb92f(0x16a)](_0x4cb92f(0x174))||undefined,'sqlName':_0x599b02[_0x4cb92f(0x16a)](_0x4cb92f(0x17b))||undefined});if(_0x47077d[_0x4cb92f(0x17a)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x4cb92f(0x176)};const _0x2ef602=[],_0x364327=[];for(const _0x210ad2 of _0x47077d){try{_0x2ef602['push'](await ensureSqlContent(_0x210ad2));}catch(_0x3cce5d){_0x364327['push']({'sqlCode':_0x210ad2[_0x4cb92f(0x15e)],'error':_0x3cce5d instanceof Error?_0x3cce5d[_0x4cb92f(0x15d)]:String(_0x3cce5d)});}}if(_0x45b176&&!_0x599b02[_0x4cb92f(0x178)]){let _0x593e50=![];for(const _0x24d694 of _0x2ef602){const _0x114b33=detectModeFromSql(_0x24d694),_0x4577a3=_0x24d694[_0x4cb92f(0x197)]?await getDbName(_0x599b02['appCode'],Number(_0x24d694[_0x4cb92f(0x197)]))[_0x4cb92f(0x194)](()=>undefined):undefined,_0xacd6f6=buildLocalSqlFileContent({'sqlCode':_0x24d694[_0x4cb92f(0x15e)],'sqlName':_0x24d694[_0x4cb92f(0x182)],'dbId':_0x24d694[_0x4cb92f(0x197)]},ensureRemoteSqlContent(_0x24d694),{'dbName':_0x4577a3,'mode':_0x114b33,'syncedAt':new Date()[_0x4cb92f(0x18a)](),'description':_0x24d694[_0x4cb92f(0x177)]}),_0x20edcb=resolveLocalSqlFilePath(_0x4ba6b5,_0x24d694[_0x4cb92f(0x15e)],buildSqlLockEntry(_0x24d694,ensureRemoteSqlContent(_0x24d694),'',{'dbName':_0x4577a3}));if(await fileExists(_0x20edcb)){const _0x2017b1=await readFile(_0x20edcb,_0x4cb92f(0x184));if(!isEquivalentPulledSqlFile(_0x2017b1,_0xacd6f6,_0x114b33)){_0x593e50=!![];break;}}}if(_0x593e50){const _0x23bb90=await confirmForceOverwrite(_0x4cb92f(0x160));if(!_0x23bb90)throw CliErrors[_0x4cb92f(0x16d)](_0x4cb92f(0x18f));}}const _0x9b53de=cloneSqlLockData(_0x134623),_0x1ea490=_0x9b53de[_0x4cb92f(0x181)][_0x4ba6b5[_0x4cb92f(0x168)]],_0x455878=[],_0x5651fe=[];for(const _0x4fe0a7 of _0x2ef602){const _0x1d8f00=_0x1ea490['sqls'][_0x4fe0a7[_0x4cb92f(0x15e)]],_0x4510a2=ensureRemoteSqlContent(_0x4fe0a7),_0x3caa63=detectModeFromSql(_0x4fe0a7),_0x387142=_0x4fe0a7['dbId']?await getDbName(_0x599b02[_0x4cb92f(0x168)],Number(_0x4fe0a7[_0x4cb92f(0x197)]))[_0x4cb92f(0x194)](()=>undefined):undefined,_0x2ebe4c=buildLocalSqlFileContent({'sqlCode':_0x4fe0a7[_0x4cb92f(0x15e)],'sqlName':_0x4fe0a7[_0x4cb92f(0x182)],'dbId':_0x4fe0a7['dbId']},_0x4510a2,{'dbName':_0x387142,'mode':_0x3caa63,'syncedAt':new Date()['toISOString'](),'description':_0x4fe0a7[_0x4cb92f(0x177)]}),_0x4b3abb=buildSqlLockEntry(_0x4fe0a7,_0x4510a2,computeSqlContentHash(_0x2ebe4c),{'dbName':_0x387142}),_0x468842=_0x4b3abb[_0x4cb92f(0x172)],_0x48797c=join(_0x4ba6b5[_0x4cb92f(0x18b)],_0x468842);try{if(await fileExists(_0x48797c)){const _0x429ac1=await readFile(_0x48797c,'utf8');if(isEquivalentPulledSqlFile(_0x429ac1,_0x2ebe4c,_0x3caa63)){_0x5651fe[_0x4cb92f(0x173)]({'sqlCode':_0x4fe0a7[_0x4cb92f(0x15e)],'reason':_0x4cb92f(0x18c)}),_0x1ea490[_0x4cb92f(0x16e)][_0x4fe0a7[_0x4cb92f(0x15e)]]={..._0x4b3abb,'hash':computeSqlContentHash(_0x429ac1),'path':_0x468842};continue;}if(!_0x45b176){_0x5651fe[_0x4cb92f(0x173)]({'sqlCode':_0x4fe0a7[_0x4cb92f(0x15e)],'reason':'local\x20differs\x20from\x20remote'});continue;}}const _0xa3ad1e=_0x1d8f00?.[_0x4cb92f(0x172)]?join(_0x4ba6b5[_0x4cb92f(0x18b)],_0x1d8f00[_0x4cb92f(0x172)]):undefined;_0xa3ad1e&&_0xa3ad1e!==_0x48797c&&await fileExists(_0xa3ad1e)&&await rm(_0xa3ad1e,{'force':!![]}),await ensureParentDirectory(_0x48797c),await writeFile(_0x48797c,_0x2ebe4c,_0x4cb92f(0x184)),_0x1ea490[_0x4cb92f(0x16e)][_0x4fe0a7[_0x4cb92f(0x15e)]]={..._0x4b3abb,'path':_0x468842},_0x455878[_0x4cb92f(0x173)]({'sqlCode':_0x4fe0a7['sqlCode'],'filePath':_0x48797c});}catch(_0x430f91){_0x364327[_0x4cb92f(0x173)]({'sqlCode':_0x4fe0a7[_0x4cb92f(0x15e)],'error':_0x430f91 instanceof Error?_0x430f91[_0x4cb92f(0x15d)]:String(_0x430f91)});}}return _0x1ea490[_0x4cb92f(0x193)]=new Date()[_0x4cb92f(0x18a)](),await writeSqlLockFile(_0x4ba6b5['lockFilePath'],_0x9b53de),{'ok':_0x364327[_0x4cb92f(0x17a)]===0x0,'data':{'pulled':_0x455878,'skipped':_0x5651fe,'failed':_0x364327},'message':_0x4cb92f(0x189)+_0x455878[_0x4cb92f(0x17a)]+_0x4cb92f(0x167)+_0x5651fe[_0x4cb92f(0x17a)]+_0x4cb92f(0x18d)+_0x364327[_0x4cb92f(0x17a)]+_0x4cb92f(0x162)};}};function detectModeFromSql(_0x14b976){const _0x776c4=a121_0xb8ffa6,_0x301fe2=ensureRemoteSqlContent(_0x14b976),_0x1d9832=stripLocalSqlMetadata(_0x301fe2,_0x776c4(0x186))[_0x776c4(0x163)]();if(/^<(select|insert|update|delete)\b/i['test'](_0x1d9832))return _0x776c4(0x186);return _0x776c4(0x17c);}function isEquivalentPulledSqlFile(_0xc0cf4d,_0x6f5048,_0x55aa95){return normalizePullComparableContent(_0xc0cf4d,_0x55aa95)===normalizePullComparableContent(_0x6f5048,_0x55aa95);}function normalizePullComparableContent(_0x4177a6,_0x5a1045){const _0x4e5935=a121_0xb8ffa6,_0x5c50db=_0x4177a6[_0x4e5935(0x196)](/\r\n/g,'\x0a')[_0x4e5935(0x165)]('\x0a'),_0x4b8511=_0x5c50db[_0x4e5935(0x185)](_0x2bb1cc=>!isSyncedAtMetadataLine(_0x2bb1cc,_0x5a1045));return _0x4b8511['join']('\x0a');}function isSyncedAtMetadataLine(_0x1ee276,_0x5c770f){const _0x14bbc9=a121_0xb8ffa6;if(_0x5c770f===_0x14bbc9(0x186))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x14bbc9(0x164)](_0x1ee276);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x14bbc9(0x164)](_0x1ee276);}
|
package/lib/commands/sql/push.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a121_0x27487b=a121_0x5636;(function(_0x5accb0,_0x5eab89){const _0x5d329c=a121_0x5636,_0x58a3fa=_0x5accb0();while(!![]){try{const _0x5d9794=-parseInt(_0x5d329c(0x13e))/0x1+parseInt(_0x5d329c(0x12e))/0x2+parseInt(_0x5d329c(0x114))/0x3+parseInt(_0x5d329c(0x12f))/0x4+-parseInt(_0x5d329c(0x117))/0x5*(parseInt(_0x5d329c(0x121))/0x6)+parseInt(_0x5d329c(0x130))/0x7*(-parseInt(_0x5d329c(0x139))/0x8)+parseInt(_0x5d329c(0x147))/0x9;if(_0x5d9794===_0x5eab89)break;else _0x58a3fa['push'](_0x58a3fa['shift']());}catch(_0x6a09df){_0x58a3fa['push'](_0x58a3fa['shift']());}}}(a121_0x3e16,0x93138));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';function a121_0x5636(_0x2c1031,_0x5b9b17){_0x2c1031=_0x2c1031-0x10c;const _0x3e161c=a121_0x3e16();let _0x5636ff=_0x3e161c[_0x2c1031];return _0x5636ff;}import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';async function getTargetSqlQueries(_0x1b28a2,_0x258ede,_0x525e33){const _0x15bb5d=a121_0x5636,_0xfe25fe=await scanLocalSqlQueries(_0x1b28a2),_0xdc1f88=new Map();for(const _0x26b007 of _0xfe25fe){if(_0x525e33&&_0x26b007[_0x15bb5d(0x13c)]!==_0x525e33)continue;const _0x42e7bc=_0xdc1f88[_0x15bb5d(0x11e)](_0x26b007[_0x15bb5d(0x13c)])??[];_0x42e7bc[_0x15bb5d(0x127)](_0x26b007),_0xdc1f88['set'](_0x26b007[_0x15bb5d(0x13c)],_0x42e7bc);}if(_0x525e33&&!_0xdc1f88[_0x15bb5d(0x12b)](_0x525e33))throw CliErrors[_0x15bb5d(0x13b)]('Local\x20SQL\x20not\x20found:\x20'+_0x525e33);const _0x3a5c68=[];for(const [_0x502def,_0x13f079]of _0xdc1f88[_0x15bb5d(0x10f)]()){if(_0x13f079['length']===0x1){_0x3a5c68['push'](_0x13f079[0x0]);continue;}const _0x55746e=_0x258ede[_0x15bb5d(0x124)][_0x502def],_0x35fa65=_0x55746e?.[_0x15bb5d(0x144)],_0x2c57ff=_0x35fa65?_0x13f079[_0x15bb5d(0x11d)](_0x2e9474=>_0x2e9474['relativePath']!==_0x35fa65):_0x13f079;if(_0x55746e&&_0x2c57ff[_0x15bb5d(0x111)]===0x1){_0x3a5c68['push'](_0x2c57ff[0x0]);continue;}throw CliErrors[_0x15bb5d(0x13b)](_0x15bb5d(0x143)+_0x502def+_0x15bb5d(0x12c));}return _0x3a5c68;}export const sqlPush={'service':a121_0x27487b(0x126),'command':a121_0x27487b(0x127),'description':a121_0x27487b(0x125),'risk':a121_0x27487b(0x118),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a121_0x27487b(0x10c),'type':a121_0x27487b(0x133),'description':'Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock'}],async 'dryRun'(_0x4fdfe0){const _0x970348=a121_0x27487b,_0x1d88f9=loadSqlProjectConfig(_0x4fdfe0['appCode']),_0x4794d3=await readSqlLockFile(_0x1d88f9[_0x970348(0x120)]),{appLock:_0x5477a4}=ensureSqlLockScope(_0x4794d3??createEmptySqlLock(),_0x4fdfe0[_0x970348(0x13d)],_0x1d88f9['sqlRoot'],'push'),_0x5e346=await getTargetSqlQueries(_0x1d88f9,_0x5477a4,_0x4fdfe0[_0x970348(0x146)](_0x970348(0x135))||undefined),_0xbd524=[];for(const _0x54f64a of _0x5e346){const _0x1bd2b5=await computeSqlFileHash(_0x54f64a[_0x970348(0x13a)]),_0x5a788a=_0x5477a4['sqls'][_0x54f64a[_0x970348(0x13c)]],_0x53b213=!!_0x5a788a&&(_0x5a788a['path']!==_0x54f64a['relativePath']||!!_0x54f64a[_0x970348(0x136)]&&_0x5a788a['sqlName']!==_0x54f64a[_0x970348(0x136)]);if(!_0x4fdfe0[_0x970348(0x129)](_0x970348(0x10c))&&_0x5a788a&&_0x5a788a[_0x970348(0x123)]===_0x1bd2b5&&!_0x53b213)continue;_0xbd524[_0x970348(0x127)](_0x54f64a['sqlCode']);}return{'method':_0x970348(0x10e),'url':_0x970348(0x113),'body':{'sqlCodes':_0xbd524,'appCode':_0x4fdfe0['appCode']},'description':_0x970348(0x140)+_0xbd524['length']+_0x970348(0x11a)};},async 'execute'(_0x185076){const _0x2fce28=a121_0x27487b,_0x438def=loadSqlProjectConfig(_0x185076[_0x2fce28(0x13d)]),_0x558bc9=await readSqlLockFile(_0x438def[_0x2fce28(0x120)]),{lockData:_0x50290f,appLock:_0x295e4a}=ensureSqlLockScope(_0x558bc9??createEmptySqlLock(),_0x185076[_0x2fce28(0x13d)],_0x438def[_0x2fce28(0x132)],'push'),_0x24b585=await getTargetSqlQueries(_0x438def,_0x295e4a,_0x185076[_0x2fce28(0x146)]('sqlcode')||undefined);if(_0x24b585[_0x2fce28(0x111)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':'No\x20local\x20SQL\x20files\x20found.'};const _0x304e51=[],_0x177fb7=[],_0x23fe0a=[];for(const _0x1b390b of _0x24b585){const _0x33d6c7=_0x295e4a[_0x2fce28(0x124)][_0x1b390b['sqlCode']];if(!_0x33d6c7){_0x23fe0a[_0x2fce28(0x127)]({'sqlCode':_0x1b390b[_0x2fce28(0x13c)],'error':'local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first'});continue;}try{const _0x2a544c=await computeSqlFileHash(_0x1b390b[_0x2fce28(0x13a)]),_0x2fb720=_0x33d6c7[_0x2fce28(0x144)]!==_0x1b390b[_0x2fce28(0x138)]||!!_0x1b390b[_0x2fce28(0x136)]&&_0x33d6c7['sqlName']!==_0x1b390b[_0x2fce28(0x136)];if(!_0x185076[_0x2fce28(0x129)]('force')&&_0x33d6c7[_0x2fce28(0x123)]===_0x2a544c&&!_0x2fb720){_0x177fb7[_0x2fce28(0x127)]({'sqlCode':_0x1b390b['sqlCode'],'reason':_0x2fce28(0x11f)});continue;}if(_0x33d6c7['version']==null){_0x23fe0a[_0x2fce28(0x127)]({'sqlCode':_0x1b390b['sqlCode'],'error':_0x2fce28(0x142)});continue;}const _0x5cd0db=await readFile(_0x1b390b[_0x2fce28(0x13a)],'utf8'),_0x1a7328=stripLocalSqlMetadata(_0x5cd0db,_0x1b390b['mode']),_0x852f7c=_0x1b390b[_0x2fce28(0x136)]||_0x33d6c7[_0x2fce28(0x136)],_0x3e4189=await resolveTargetDbBinding(_0x185076['appCode'],_0x1b390b,_0x33d6c7),_0x517427=await updateSqlQuery({'id':_0x33d6c7[_0x2fce28(0x11c)],'appCode':_0x185076[_0x2fce28(0x13d)],'sqlCode':_0x1b390b[_0x2fce28(0x13c)],'sqlName':_0x852f7c,'dbId':_0x3e4189[_0x2fce28(0x131)],'version':_0x33d6c7[_0x2fce28(0x112)],'sqlContent':_0x1a7328,'sqlConfig':_0x33d6c7[_0x2fce28(0x12a)]??undefined}),_0x345993=_0x517427[_0x2fce28(0x131)]?await getDbName(_0x185076[_0x2fce28(0x13d)],Number(_0x517427['dbId']))[_0x2fce28(0x119)](()=>_0x3e4189[_0x2fce28(0x122)]):_0x3e4189[_0x2fce28(0x122)];_0x295e4a[_0x2fce28(0x124)][_0x1b390b[_0x2fce28(0x13c)]]={...buildSqlLockEntry(_0x517427,_0x1a7328,_0x2a544c,{'dbName':_0x345993}),'path':_0x1b390b[_0x2fce28(0x138)],'mode':_0x33d6c7[_0x2fce28(0x10d)]},await archivePreviousSqlFileIfNeeded(_0x438def,_0x33d6c7[_0x2fce28(0x144)],_0x1b390b[_0x2fce28(0x138)]),_0x304e51[_0x2fce28(0x127)]({'sqlCode':_0x1b390b[_0x2fce28(0x13c)],'remoteId':_0x33d6c7[_0x2fce28(0x11c)]});}catch(_0x2908a6){_0x23fe0a['push']({'sqlCode':_0x1b390b[_0x2fce28(0x13c)],'error':_0x2908a6 instanceof Error?_0x2908a6[_0x2fce28(0x13f)]:String(_0x2908a6)});}}return _0x295e4a['lastSync']=new Date()[_0x2fce28(0x115)](),await writeSqlLockFile(_0x438def[_0x2fce28(0x120)],_0x50290f),{'ok':_0x23fe0a[_0x2fce28(0x111)]===0x0,'data':{'pushed':_0x304e51,'skipped':_0x177fb7,'failed':_0x23fe0a},'message':'Push\x20complete:\x20'+_0x304e51[_0x2fce28(0x111)]+_0x2fce28(0x128)+_0x177fb7[_0x2fce28(0x111)]+_0x2fce28(0x12d)+_0x23fe0a[_0x2fce28(0x111)]+_0x2fce28(0x137)};}};async function archivePreviousSqlFileIfNeeded(_0x142403,_0x404844,_0x4587eb){const _0x57d707=a121_0x27487b;if(!_0x404844||_0x404844===_0x4587eb)return;const _0x2ff59f=join(_0x142403[_0x57d707(0x116)],_0x404844);if(!await fileExists(_0x2ff59f))return;const _0x1098c2=await moveToTrash(_0x142403['projectRoot'],_0x142403[_0x57d707(0x145)],_0x2ff59f);await cleanupEmptyDirectories(dirname(_0x2ff59f),_0x142403[_0x57d707(0x116)]),void _0x1098c2;}async function moveToTrash(_0x42161b,_0x1ec182,_0x3b73ff){const _0x741f67=a121_0x27487b,_0x241961=new Date()[_0x741f67(0x115)]()['replace'](/[:.]/g,'-'),_0x416ce6=relative(_0x42161b,_0x3b73ff),_0x2b8ebd=join(_0x1ec182,_0x241961,_0x416ce6);return await mkdir(dirname(_0x2b8ebd),{'recursive':!![]}),await rename(_0x3b73ff,_0x2b8ebd),_0x2b8ebd;}async function cleanupEmptyDirectories(_0x5dce44,_0x3117be){const _0x5345a4=a121_0x27487b;let _0x47d3ef=resolve(_0x5dce44);const _0x20938c=resolve(_0x3117be);while(_0x47d3ef[_0x5345a4(0x148)](''+_0x20938c+sep)||_0x47d3ef===_0x20938c){if(_0x47d3ef===_0x20938c)return;try{const _0x5abf65=await readdir(_0x47d3ef);if(_0x5abf65[_0x5345a4(0x111)]>0x0)return;await rmdir(_0x47d3ef);}catch{return;}_0x47d3ef=dirname(_0x47d3ef);}}async function resolveTargetDbBinding(_0x8330fb,_0x32df63,_0x56eb8c){const _0x23dc35=a121_0x27487b,_0xc7262=_0x32df63[_0x23dc35(0x141)];if(!_0xc7262)return{'dbId':_0x56eb8c[_0x23dc35(0x131)],'dbName':_0x56eb8c[_0x23dc35(0x122)]};const _0x4052ee=buildDbDirectoryName(_0x56eb8c[_0x23dc35(0x122)],_0x56eb8c[_0x23dc35(0x131)]);if(_0xc7262===_0x4052ee)return{'dbId':_0x56eb8c[_0x23dc35(0x131)],'dbName':_0x56eb8c[_0x23dc35(0x122)]};const _0x1b124a=parseExplicitDbDirectory(_0xc7262);if(_0x1b124a!=null)return{'dbId':_0x1b124a,'dbName':await getDbName(_0x8330fb,_0x1b124a)[_0x23dc35(0x119)](()=>undefined)};const _0x3ced0e=await listDatabases(_0x8330fb),_0x39a005=_0x3ced0e[_0x23dc35(0x11d)](_0xa49cfe=>buildDbDirectoryName(_0xa49cfe[_0x23dc35(0x122)],_0xa49cfe['dbId'])===_0xc7262);if(_0x39a005[_0x23dc35(0x111)]===0x1)return{'dbId':_0x39a005[0x0][_0x23dc35(0x131)],'dbName':_0x39a005[0x0][_0x23dc35(0x122)]};if(_0x39a005[_0x23dc35(0x111)]===0x0)throw CliErrors['validation']('No\x20database\x20matches\x20local\x20directory\x20\x22'+_0xc7262+_0x23dc35(0x134)+_0x32df63[_0x23dc35(0x13c)]+'.');const _0x56874d=_0x39a005['map'](_0x3a2962=>_0x3a2962['dbName']+'\x20('+_0x3a2962[_0x23dc35(0x131)]+')')[_0x23dc35(0x11b)](',\x20');throw CliErrors[_0x23dc35(0x13b)]('Local\x20directory\x20\x22'+_0xc7262+'\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20'+_0x32df63['sqlCode']+':\x20'+_0x56874d);}function a121_0x3e16(){const _0x131fe9=['sqlcode','sqlName','\x20failed','relativePath','398584ESLeJH','filePath','validation','sqlCode','appCode','766018KBPFkI','message','Would\x20push\x20','dbDirectory','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','path','trashDir','str','15696099VKdtWj','startsWith','force','mode','POST','entries','isFinite','length','version','/smartapi/custom/updateUserCustomSql','651600lAyVMI','toISOString','sqlRootDir','410vpBxlA','high-risk-write','catch','\x20SQL\x20file(s)','join','remoteId','filter','get','unchanged','lockFilePath','70542gMCAaq','dbName','hash','sqls','Push\x20local\x20SQL\x20files\x20to\x20remote','sql','push','\x20pushed,\x20','bool','sqlConfig','has','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','\x20skipped,\x20','858972BYwOqN','4350992OxuGqA','161VqvDFK','dbId','sqlRoot','boolean','\x22\x20for\x20sqlCode\x20'];a121_0x3e16=function(){return _0x131fe9;};return a121_0x3e16();}function parseExplicitDbDirectory(_0x426af2){const _0x57e7e5=a121_0x27487b,_0x59207a=/^db-(\d+)$/['exec'](_0x426af2);if(!_0x59207a)return null;const _0x15464a=Number(_0x59207a[0x1]);return Number[_0x57e7e5(0x110)](_0x15464a)&&_0x15464a>0x0?_0x15464a:null;}
|
|
1
|
+
const a122_0x4995ca=a122_0x2c40;(function(_0x40598c,_0x3ab99c){const _0x86143b=a122_0x2c40,_0x5c01db=_0x40598c();while(!![]){try{const _0xcd622f=-parseInt(_0x86143b(0xac))/0x1*(-parseInt(_0x86143b(0x7c))/0x2)+-parseInt(_0x86143b(0x88))/0x3+-parseInt(_0x86143b(0x9c))/0x4*(-parseInt(_0x86143b(0x7d))/0x5)+parseInt(_0x86143b(0xa9))/0x6+parseInt(_0x86143b(0x86))/0x7+-parseInt(_0x86143b(0x90))/0x8+-parseInt(_0x86143b(0x73))/0x9;if(_0xcd622f===_0x3ab99c)break;else _0x5c01db['push'](_0x5c01db['shift']());}catch(_0xb5a3b5){_0x5c01db['push'](_0x5c01db['shift']());}}}(a122_0x5834,0x1ac5b));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';function a122_0x5834(){const _0x56dac0=['push','toISOString','1095792oJdskm','startsWith','filter','lastSync','relativePath','force','dbName','length','sqlRootDir','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','No\x20database\x20matches\x20local\x20directory\x20\x22','3228DXFaZw','version','\x20SQL\x20file(s)','get','has','appCode','validation','sqlName','sql','sqlCode','Local\x20directory\x20\x22','dbId','hash','1098774iZqwoA','message','boolean','13559nMgFCE','Would\x20push\x20','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','path','map','1668060IHAXGM','dbDirectory','unchanged','exec','No\x20local\x20SQL\x20files\x20found.','\x20failed','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','trashDir','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','26jDDfTV','955TBVuyb','sqls','sqlcode','mode','\x20pushed,\x20','sqlRoot','lockFilePath','Push\x20complete:\x20','filePath','948507PdGqAG','remoteId','651183mLlCzZ','entries','projectRoot','high-risk-write','str','catch'];a122_0x5834=function(){return _0x56dac0;};return a122_0x5834();}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';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';async function getTargetSqlQueries(_0x37675c,_0xe0b56b,_0x3e0ecb){const _0x193084=a122_0x2c40,_0x3654b4=await scanLocalSqlQueries(_0x37675c),_0x36f08d=new Map();for(const _0x5c59b9 of _0x3654b4){if(_0x3e0ecb&&_0x5c59b9[_0x193084(0xa5)]!==_0x3e0ecb)continue;const _0x3251ab=_0x36f08d[_0x193084(0x9f)](_0x5c59b9[_0x193084(0xa5)])??[];_0x3251ab[_0x193084(0x8e)](_0x5c59b9),_0x36f08d['set'](_0x5c59b9['sqlCode'],_0x3251ab);}if(_0x3e0ecb&&!_0x36f08d[_0x193084(0xa0)](_0x3e0ecb))throw CliErrors[_0x193084(0xa2)]('Local\x20SQL\x20not\x20found:\x20'+_0x3e0ecb);const _0x2d660e=[];for(const [_0x4f4add,_0x2d9f8e]of _0x36f08d[_0x193084(0x89)]()){if(_0x2d9f8e[_0x193084(0x97)]===0x1){_0x2d660e[_0x193084(0x8e)](_0x2d9f8e[0x0]);continue;}const _0x4e4598=_0xe0b56b[_0x193084(0x7e)][_0x4f4add],_0x37459f=_0x4e4598?.[_0x193084(0xaf)],_0x5c7466=_0x37459f?_0x2d9f8e[_0x193084(0x92)](_0x525ca4=>_0x525ca4[_0x193084(0x94)]!==_0x37459f):_0x2d9f8e;if(_0x4e4598&&_0x5c7466[_0x193084(0x97)]===0x1){_0x2d660e[_0x193084(0x8e)](_0x5c7466[0x0]);continue;}throw CliErrors[_0x193084(0xa2)]('Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20'+_0x4f4add+_0x193084(0x7b));}return _0x2d660e;}export const sqlPush={'service':a122_0x4995ca(0xa4),'command':'push','description':'Push\x20local\x20SQL\x20files\x20to\x20remote','risk':a122_0x4995ca(0x8b),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'force','type':a122_0x4995ca(0xab),'description':a122_0x4995ca(0xae)}],async 'dryRun'(_0x1fe7df){const _0x1e95de=a122_0x4995ca,_0x234ae6=loadSqlProjectConfig(_0x1fe7df[_0x1e95de(0xa1)]),_0x588fba=await readSqlLockFile(_0x234ae6[_0x1e95de(0x83)]),{appLock:_0x193a2e}=ensureSqlLockScope(_0x588fba??createEmptySqlLock(),_0x1fe7df[_0x1e95de(0xa1)],_0x234ae6['sqlRoot'],_0x1e95de(0x8e)),_0x8c4343=await getTargetSqlQueries(_0x234ae6,_0x193a2e,_0x1fe7df[_0x1e95de(0x8c)]('sqlcode')||undefined),_0x1307cd=[];for(const _0x5cae76 of _0x8c4343){const _0x1b266c=await computeSqlFileHash(_0x5cae76['filePath']),_0x499bed=_0x193a2e[_0x1e95de(0x7e)][_0x5cae76[_0x1e95de(0xa5)]],_0x55c2a5=!!_0x499bed&&(_0x499bed[_0x1e95de(0xaf)]!==_0x5cae76[_0x1e95de(0x94)]||!!_0x5cae76[_0x1e95de(0xa3)]&&_0x499bed['sqlName']!==_0x5cae76[_0x1e95de(0xa3)]);if(!_0x1fe7df['bool'](_0x1e95de(0x95))&&_0x499bed&&_0x499bed[_0x1e95de(0xa8)]===_0x1b266c&&!_0x55c2a5)continue;_0x1307cd['push'](_0x5cae76[_0x1e95de(0xa5)]);}return{'method':'POST','url':'/smartapi/custom/updateUserCustomSql','body':{'sqlCodes':_0x1307cd,'appCode':_0x1fe7df[_0x1e95de(0xa1)]},'description':_0x1e95de(0xad)+_0x1307cd[_0x1e95de(0x97)]+_0x1e95de(0x9e)};},async 'execute'(_0x129823){const _0x549ad4=a122_0x4995ca,_0x3495b8=loadSqlProjectConfig(_0x129823[_0x549ad4(0xa1)]),_0x48223f=await readSqlLockFile(_0x3495b8['lockFilePath']),{lockData:_0x274b24,appLock:_0x238fc7}=ensureSqlLockScope(_0x48223f??createEmptySqlLock(),_0x129823[_0x549ad4(0xa1)],_0x3495b8[_0x549ad4(0x82)],_0x549ad4(0x8e)),_0x5bc8ae=await getTargetSqlQueries(_0x3495b8,_0x238fc7,_0x129823[_0x549ad4(0x8c)](_0x549ad4(0x7f))||undefined);if(_0x5bc8ae[_0x549ad4(0x97)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x549ad4(0x77)};const _0x165cca=[],_0x57b407=[],_0x3040d4=[];for(const _0x37e5cb of _0x5bc8ae){const _0x1d31ed=_0x238fc7[_0x549ad4(0x7e)][_0x37e5cb[_0x549ad4(0xa5)]];if(!_0x1d31ed){_0x3040d4[_0x549ad4(0x8e)]({'sqlCode':_0x37e5cb['sqlCode'],'error':_0x549ad4(0x9a)});continue;}try{const _0x5badcb=await computeSqlFileHash(_0x37e5cb[_0x549ad4(0x85)]),_0x4095ce=_0x1d31ed[_0x549ad4(0xaf)]!==_0x37e5cb[_0x549ad4(0x94)]||!!_0x37e5cb[_0x549ad4(0xa3)]&&_0x1d31ed[_0x549ad4(0xa3)]!==_0x37e5cb[_0x549ad4(0xa3)];if(!_0x129823['bool']('force')&&_0x1d31ed[_0x549ad4(0xa8)]===_0x5badcb&&!_0x4095ce){_0x57b407[_0x549ad4(0x8e)]({'sqlCode':_0x37e5cb[_0x549ad4(0xa5)],'reason':_0x549ad4(0x75)});continue;}if(_0x1d31ed[_0x549ad4(0x9d)]==null){_0x3040d4[_0x549ad4(0x8e)]({'sqlCode':_0x37e5cb[_0x549ad4(0xa5)],'error':_0x549ad4(0x79)});continue;}const _0x46c21b=await readFile(_0x37e5cb[_0x549ad4(0x85)],'utf8'),_0xefdc2e=stripLocalSqlMetadata(_0x46c21b,_0x37e5cb[_0x549ad4(0x80)]),_0x2036f7=_0x37e5cb[_0x549ad4(0xa3)]||_0x1d31ed[_0x549ad4(0xa3)],_0x743265=await resolveTargetDbBinding(_0x129823[_0x549ad4(0xa1)],_0x37e5cb,_0x1d31ed),_0x660831=await updateSqlQuery({'id':_0x1d31ed[_0x549ad4(0x87)],'appCode':_0x129823[_0x549ad4(0xa1)],'sqlCode':_0x37e5cb['sqlCode'],'sqlName':_0x2036f7,'dbId':_0x743265[_0x549ad4(0xa7)],'version':_0x1d31ed['version'],'sqlContent':_0xefdc2e,'sqlConfig':_0x1d31ed['sqlConfig']??undefined}),_0x592f8a=_0x660831[_0x549ad4(0xa7)]?await getDbName(_0x129823[_0x549ad4(0xa1)],Number(_0x660831[_0x549ad4(0xa7)]))[_0x549ad4(0x8d)](()=>_0x743265[_0x549ad4(0x96)]):_0x743265[_0x549ad4(0x96)];_0x238fc7[_0x549ad4(0x7e)][_0x37e5cb[_0x549ad4(0xa5)]]={...buildSqlLockEntry(_0x660831,_0xefdc2e,_0x5badcb,{'dbName':_0x592f8a}),'path':_0x37e5cb[_0x549ad4(0x94)],'mode':_0x1d31ed['mode']},await archivePreviousSqlFileIfNeeded(_0x3495b8,_0x1d31ed['path'],_0x37e5cb[_0x549ad4(0x94)]),_0x165cca[_0x549ad4(0x8e)]({'sqlCode':_0x37e5cb[_0x549ad4(0xa5)],'remoteId':_0x1d31ed[_0x549ad4(0x87)]});}catch(_0x97394d){_0x3040d4[_0x549ad4(0x8e)]({'sqlCode':_0x37e5cb['sqlCode'],'error':_0x97394d instanceof Error?_0x97394d[_0x549ad4(0xaa)]:String(_0x97394d)});}}return _0x238fc7[_0x549ad4(0x93)]=new Date()[_0x549ad4(0x8f)](),await writeSqlLockFile(_0x3495b8[_0x549ad4(0x83)],_0x274b24),{'ok':_0x3040d4[_0x549ad4(0x97)]===0x0,'data':{'pushed':_0x165cca,'skipped':_0x57b407,'failed':_0x3040d4},'message':_0x549ad4(0x84)+_0x165cca['length']+_0x549ad4(0x81)+_0x57b407[_0x549ad4(0x97)]+'\x20skipped,\x20'+_0x3040d4['length']+_0x549ad4(0x78)};}};async function archivePreviousSqlFileIfNeeded(_0x243abe,_0x3cd810,_0x598e02){const _0x200f1d=a122_0x4995ca;if(!_0x3cd810||_0x3cd810===_0x598e02)return;const _0x3bd009=join(_0x243abe[_0x200f1d(0x98)],_0x3cd810);if(!await fileExists(_0x3bd009))return;const _0xb60df8=await moveToTrash(_0x243abe[_0x200f1d(0x8a)],_0x243abe[_0x200f1d(0x7a)],_0x3bd009);await cleanupEmptyDirectories(dirname(_0x3bd009),_0x243abe[_0x200f1d(0x98)]),void _0xb60df8;}async function moveToTrash(_0x113d47,_0x4a6ce2,_0x4d947a){const _0xb11af4=a122_0x4995ca,_0x10f27b=new Date()[_0xb11af4(0x8f)]()['replace'](/[:.]/g,'-'),_0x2f8100=relative(_0x113d47,_0x4d947a),_0x3311ad=join(_0x4a6ce2,_0x10f27b,_0x2f8100);return await mkdir(dirname(_0x3311ad),{'recursive':!![]}),await rename(_0x4d947a,_0x3311ad),_0x3311ad;}async function cleanupEmptyDirectories(_0x5d16be,_0x523339){const _0x3d7c9f=a122_0x4995ca;let _0x5cd6dd=resolve(_0x5d16be);const _0x15de97=resolve(_0x523339);while(_0x5cd6dd[_0x3d7c9f(0x91)](''+_0x15de97+sep)||_0x5cd6dd===_0x15de97){if(_0x5cd6dd===_0x15de97)return;try{const _0x567af3=await readdir(_0x5cd6dd);if(_0x567af3['length']>0x0)return;await rmdir(_0x5cd6dd);}catch{return;}_0x5cd6dd=dirname(_0x5cd6dd);}}async function resolveTargetDbBinding(_0x38c825,_0x267a21,_0x5e85f7){const _0x2be84f=a122_0x4995ca,_0x3f3504=_0x267a21[_0x2be84f(0x74)];if(!_0x3f3504)return{'dbId':_0x5e85f7[_0x2be84f(0xa7)],'dbName':_0x5e85f7[_0x2be84f(0x96)]};const _0x1bb9e7=buildDbDirectoryName(_0x5e85f7['dbName'],_0x5e85f7[_0x2be84f(0xa7)]);if(_0x3f3504===_0x1bb9e7)return{'dbId':_0x5e85f7[_0x2be84f(0xa7)],'dbName':_0x5e85f7['dbName']};const _0x2df9f7=parseExplicitDbDirectory(_0x3f3504);if(_0x2df9f7!=null)return{'dbId':_0x2df9f7,'dbName':await getDbName(_0x38c825,_0x2df9f7)[_0x2be84f(0x8d)](()=>undefined)};const _0x29de73=await listDatabases(_0x38c825),_0x2bc4de=_0x29de73[_0x2be84f(0x92)](_0x4530ff=>buildDbDirectoryName(_0x4530ff[_0x2be84f(0x96)],_0x4530ff[_0x2be84f(0xa7)])===_0x3f3504);if(_0x2bc4de[_0x2be84f(0x97)]===0x1)return{'dbId':_0x2bc4de[0x0][_0x2be84f(0xa7)],'dbName':_0x2bc4de[0x0][_0x2be84f(0x96)]};if(_0x2bc4de['length']===0x0)throw CliErrors['validation'](_0x2be84f(0x9b)+_0x3f3504+'\x22\x20for\x20sqlCode\x20'+_0x267a21['sqlCode']+'.');const _0x4166a8=_0x2bc4de[_0x2be84f(0xb0)](_0x4fcfdd=>_0x4fcfdd[_0x2be84f(0x96)]+'\x20('+_0x4fcfdd[_0x2be84f(0xa7)]+')')['join'](',\x20');throw CliErrors[_0x2be84f(0xa2)](_0x2be84f(0xa6)+_0x3f3504+_0x2be84f(0x99)+_0x267a21[_0x2be84f(0xa5)]+':\x20'+_0x4166a8);}function a122_0x2c40(_0x57b6e2,_0x5c6142){_0x57b6e2=_0x57b6e2-0x73;const _0x5834c5=a122_0x5834();let _0x2c402e=_0x5834c5[_0x57b6e2];return _0x2c402e;}function parseExplicitDbDirectory(_0x5159bc){const _0x1ab763=a122_0x4995ca,_0xdddf72=/^db-(\d+)$/[_0x1ab763(0x76)](_0x5159bc);if(!_0xdddf72)return null;const _0x2fb389=Number(_0xdddf72[0x1]);return Number['isFinite'](_0x2fb389)&&_0x2fb389>0x0?_0x2fb389:null;}
|
package/lib/commands/sql/save.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a123_0x21e3(_0x51966d,_0x56b0f8){_0x51966d=_0x51966d-0x152;const _0x1140ac=a123_0x1140();let _0x21e318=_0x1140ac[_0x51966d];return _0x21e318;}const a123_0x48b781=a123_0x21e3;(function(_0x3f4b52,_0xf11d02){const _0x52dce7=a123_0x21e3,_0x1a3fbc=_0x3f4b52();while(!![]){try{const _0x25e301=-parseInt(_0x52dce7(0x15c))/0x1+parseInt(_0x52dce7(0x166))/0x2+parseInt(_0x52dce7(0x15b))/0x3+-parseInt(_0x52dce7(0x165))/0x4*(parseInt(_0x52dce7(0x158))/0x5)+-parseInt(_0x52dce7(0x15e))/0x6+parseInt(_0x52dce7(0x164))/0x7*(parseInt(_0x52dce7(0x156))/0x8)+-parseInt(_0x52dce7(0x15d))/0x9*(-parseInt(_0x52dce7(0x153))/0xa);if(_0x25e301===_0xf11d02)break;else _0x1a3fbc['push'](_0x1a3fbc['shift']());}catch(_0x32be0e){_0x1a3fbc['push'](_0x1a3fbc['shift']());}}}(a123_0x1140,0xdd3dc));import{CliErrors}from'../../errors.js';function a123_0x1140(){const _0x1f984e=['Deprecated:\x20use\x20sql\x20create\x20to\x20create\x20and\x20sql\x20push\x20to\x20update','64967kjeKot','4QwVgCX','152384kNZQJT','Target\x20database\x20—\x20accepts\x20a\x20numeric\x20ID\x20or\x20database\x20name\x20(e.g.\x20ecommerce_db)','`rabetbase\x20sql\x20save`\x20has\x20been\x20deprecated.','2410BbbdXt','Path\x20to\x20the\x20SQL\x20file','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`.','16TctwiO','file','8754005LbRglp','sqlname','sql','5130915rtaudM','1059560AWuUNh','135207shlizL','10254222vmtVEW','validation','Query\x20description','join','string'];a123_0x1140=function(){return _0x1f984e;};return a123_0x1140();}import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';const SQL_SAVE_DEPRECATED_HINT=[a123_0x48b781(0x152),'Create\x20new\x20SQL\x20with\x20`rabetbase\x20sql\x20create\x20--name\x20<name>\x20--db-id\x20<id>\x20--mode\x20sql|mybatisXml`.',a123_0x48b781(0x155)][a123_0x48b781(0x161)]('\x0a');export const sqlSave={'service':a123_0x48b781(0x15a),'command':'save','description':a123_0x48b781(0x163),'risk':'write','requiresAuth':![],'requiresAppCode':![],'flags':[{'name':a123_0x48b781(0x157),'type':a123_0x48b781(0x162),'required':!![],'description':a123_0x48b781(0x154)},SQLCODE_FLAG_OPTIONAL,{'name':a123_0x48b781(0x159),'type':a123_0x48b781(0x162),'description':'SQL\x20query\x20display\x20name'},{'name':'db','type':a123_0x48b781(0x162),'description':a123_0x48b781(0x167)},{'name':'description','type':a123_0x48b781(0x162),'description':a123_0x48b781(0x160)}],async 'validate'(){const _0x5393c2=a123_0x48b781;throw CliErrors[_0x5393c2(0x15f)](SQL_SAVE_DEPRECATED_HINT);},async 'execute'(){throw CliErrors['validation'](SQL_SAVE_DEPRECATED_HINT);}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a124_0x9ad5a1=a124_0x26d7;(function(_0x4bad88,_0x458596){const _0x56c4fc=a124_0x26d7,_0x2ae8b2=_0x4bad88();while(!![]){try{const _0x43c1ec=-parseInt(_0x56c4fc(0x1a4))/0x1+-parseInt(_0x56c4fc(0x1a2))/0x2*(-parseInt(_0x56c4fc(0x1a5))/0x3)+parseInt(_0x56c4fc(0x18e))/0x4*(-parseInt(_0x56c4fc(0x1a1))/0x5)+parseInt(_0x56c4fc(0x19a))/0x6+-parseInt(_0x56c4fc(0x192))/0x7+parseInt(_0x56c4fc(0x186))/0x8+-parseInt(_0x56c4fc(0x183))/0x9;if(_0x43c1ec===_0x458596)break;else _0x2ae8b2['push'](_0x2ae8b2['shift']());}catch(_0x18e853){_0x2ae8b2['push'](_0x2ae8b2['shift']());}}}(a124_0x543c,0x57099));function a124_0x26d7(_0xc347f7,_0x4636b2){_0xc347f7=_0xc347f7-0x17e;const _0x543cb8=a124_0x543c();let _0x26d710=_0x543cb8[_0xc347f7];return _0x26d710;}import{createInterface}from'node:readline';import{join}from'node:path';import{buildDefaultSqlFileName,buildSqlRelativePath,detectSqlMode}from'../../core/sql-sync/utils.js';export const SQL_LOCAL_REL_DIR=a124_0x9ad5a1(0x1a6);export function buildSqlLockEntry(_0x1138c3,_0x32dff8,_0x3d78eb,_0x2d542b){const _0x10cfac=a124_0x9ad5a1,_0x3afd48=detectSqlMode(_0x32dff8);return{'path':buildSqlRelativePath(_0x1138c3['sqlCode'],_0x1138c3['sqlName'],_0x2d542b?.[_0x10cfac(0x197)],_0x3afd48,_0x1138c3[_0x10cfac(0x189)]),'hash':_0x3d78eb,'remoteId':_0x1138c3['id'],'version':_0x1138c3[_0x10cfac(0x19d)],'dbId':Number(_0x1138c3[_0x10cfac(0x189)]),'dbName':_0x2d542b?.[_0x10cfac(0x197)],'sqlName':_0x1138c3[_0x10cfac(0x195)],'sqlConfig':_0x1138c3[_0x10cfac(0x1a3)]??undefined,'mode':_0x3afd48};}export function cloneSqlLockData(_0x2572b5){const _0x3bc77c=a124_0x9ad5a1;return{'apps':Object[_0x3bc77c(0x185)](Object[_0x3bc77c(0x181)](_0x2572b5['apps'])[_0x3bc77c(0x199)](([_0x56581e,_0x4b4b5f])=>[_0x56581e,{'sqlRoot':_0x4b4b5f['sqlRoot'],'lastSync':_0x4b4b5f[_0x3bc77c(0x191)],'sqls':{..._0x4b4b5f['sqls']}}]))};}export function ensureRemoteSqlContent(_0x4a685c){const _0x54ba3f=a124_0x9ad5a1;return _0x4a685c[_0x54ba3f(0x19b)]??'';}export function buildLocalSqlFileContent(_0x20399c,_0x59882f,_0x1c2f62){const _0x51b74d=a124_0x9ad5a1,_0x34523e=_0x1c2f62?.[_0x51b74d(0x198)]??detectSqlMode(_0x59882f),_0xab220d=stripLocalSqlMetadata(_0x59882f,_0x34523e)[_0x51b74d(0x18c)](),_0x194f02=[...buildMetadataHeaderLines({'sqlCode':_0x20399c[_0x51b74d(0x180)],'sqlName':_0x20399c[_0x51b74d(0x195)],'dbId':_0x20399c[_0x51b74d(0x189)],'dbName':_0x1c2f62?.[_0x51b74d(0x197)],'mode':_0x34523e,'syncedAt':_0x1c2f62?.['syncedAt'],'description':_0x1c2f62?.['description']},_0x34523e),'',_0xab220d],_0x25c2e8=_0x194f02[_0x51b74d(0x19e)]('\x0a');return _0x25c2e8[_0x51b74d(0x17e)]('\x0a')?_0x25c2e8:_0x25c2e8+'\x0a';}export function stripLocalSqlMetadata(_0x255175,_0x4cd094){const _0x124463=a124_0x9ad5a1,_0xde9c48=_0x255175[_0x124463(0x19c)](/\r\n/g,'\x0a')['split']('\x0a'),_0x46c476=[];let _0x510ea2=0x0;if(_0x4cd094===_0x124463(0x18b))while(_0x510ea2<_0xde9c48['length']){const _0x3b0ec1=_0xde9c48[_0x510ea2]??'';if(/^\s*<!--\s*@lovrabet\./[_0x124463(0x187)](_0x3b0ec1)){_0x510ea2++;continue;}if(_0x3b0ec1[_0x124463(0x18c)]()===''&&_0x510ea2>0x0){_0x510ea2++;continue;}break;}else while(_0x510ea2<_0xde9c48['length']){const _0x3c901a=_0xde9c48[_0x510ea2]??'';if(/^\s*--\s*@lovrabet\./[_0x124463(0x187)](_0x3c901a)){_0x510ea2++;continue;}if(_0x3c901a[_0x124463(0x18c)]()===''&&_0x510ea2>0x0){_0x510ea2++;continue;}break;}for(;_0x510ea2<_0xde9c48[_0x124463(0x18f)];_0x510ea2++){_0x46c476[_0x124463(0x193)](_0xde9c48[_0x510ea2]);}return _0x46c476['join']('\x0a')['trimStart']();}export function resolveSqlMode(_0x4d2ac5,_0x2a3814){if(_0x2a3814?.['mode'])return _0x2a3814['mode'];return detectSqlMode(_0x4d2ac5);}export function resolveSqlFileName(_0x37e9fe,_0x2e9e15,_0x14adde){const _0x389a83=a124_0x9ad5a1;if(_0x14adde?.[_0x389a83(0x194)])return _0x14adde[_0x389a83(0x194)];if(_0x14adde?.[_0x389a83(0x195)]||_0x14adde?.[_0x389a83(0x197)])return buildSqlRelativePath(_0x37e9fe,_0x14adde?.[_0x389a83(0x195)],_0x14adde?.[_0x389a83(0x197)],resolveSqlMode(_0x2e9e15,_0x14adde),_0x14adde?.['dbId']);return buildDefaultSqlFileName(_0x37e9fe,resolveSqlMode(_0x2e9e15,_0x14adde));}function a124_0x543c(){const _0x25e152=['sqlCode','entries','<!--\x20@lovrabet.','1084806nHncsx','\x20[y/N]\x20','fromEntries','3085128KXSKmb','test','toLowerCase','dbId','\x20-->','mybatisXml','trim','apps','160GzKGtR','length','--\x20@lovrabet.','lastSync','2158786blwoQs','push','path','sqlName','stdin','dbName','mode','map','3430086EMvkGW','sqlContent','replace','version','join','includes','stderr','55300uSKMLO','348zQFLEK','sqlConfig','314299bZSUHv','10083FJyojs','.rabetbase/sql','endsWith','filter'];a124_0x543c=function(){return _0x25e152;};return a124_0x543c();}export function resolveSqlLocalDir(_0x1cb85d,_0x56c53c){return join(_0x1cb85d,SQL_LOCAL_REL_DIR,_0x56c53c);}export async function confirmForceOverwrite(_0x171078){const _0x106e0b=a124_0x9ad5a1,_0x29828e=createInterface({'input':process[_0x106e0b(0x196)],'output':process[_0x106e0b(0x1a0)]}),_0x168220=await new Promise(_0x409820=>{const _0x425c67=_0x106e0b;_0x29828e['question'](_0x171078+_0x425c67(0x184),_0x409820);});return _0x29828e['close'](),['y','yes'][_0x106e0b(0x19f)](_0x168220[_0x106e0b(0x18c)]()[_0x106e0b(0x188)]());}export function findSqlLockScope(_0x538faa,_0x1a6f14){const _0x4618a3=a124_0x9ad5a1;return _0x538faa[_0x4618a3(0x18d)][_0x1a6f14];}function buildMetadataHeaderLines(_0x155631,_0x55a337){const _0x56262=a124_0x9ad5a1,_0x4d3708=[[_0x56262(0x180),_0x155631['sqlCode']],[_0x56262(0x195),_0x155631['sqlName']],['dbId',_0x155631['dbId']],[_0x56262(0x197),_0x155631['dbName']],[_0x56262(0x198),_0x155631[_0x56262(0x198)]],['syncedAt',_0x155631['syncedAt']],['description',_0x155631['description']]];if(_0x55a337===_0x56262(0x18b))return _0x4d3708['filter'](([,_0xa1c8d0])=>_0xa1c8d0!==undefined&&_0xa1c8d0!==null&&String(_0xa1c8d0)[_0x56262(0x18c)]()!=='')[_0x56262(0x199)](([_0x37ae02,_0x58c31d])=>_0x56262(0x182)+_0x37ae02+':\x20'+String(_0x58c31d)+_0x56262(0x18a));return _0x4d3708[_0x56262(0x17f)](([,_0xce7373])=>_0xce7373!==undefined&&_0xce7373!==null&&String(_0xce7373)['trim']()!=='')[_0x56262(0x199)](([_0x53ff0a,_0x37fb4d])=>_0x56262(0x190)+_0x53ff0a+':\x20'+String(_0x37fb4d));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a125_0x5052(){const _0x13e322=['1885304auBjlM','length','bool','\x20missing,\x20','push','sqlRoot','lockKey','4729984mjWvze','filePath','paging','appCode','1297994yhLNTY','keys','sqlCode','1klSuqU','7ogIIgc','has','Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally','3596790RLKfVi','All\x20SQL\x20queries\x20are\x20in\x20sync.','sqls','sql','remote','map','\x20unchanged','\x20modified,\x20','boolean','path','tableData','read','5962590gKFYAc','82575WCkuFA','3497568BsnUpJ','hash','Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','sqlName','\x20added,\x20'];a125_0x5052=function(){return _0x13e322;};return a125_0x5052();}const a125_0xdb1436=a125_0x42c0;(function(_0x1f9bb9,_0x45f7d0){const _0x28c861=a125_0x42c0,_0x23a0e7=_0x1f9bb9();while(!![]){try{const _0x1347b5=parseInt(_0x28c861(0x93))/0x1*(parseInt(_0x28c861(0x90))/0x2)+-parseInt(_0x28c861(0x80))/0x3+parseInt(_0x28c861(0x8c))/0x4+parseInt(_0x28c861(0x7f))/0x5+-parseInt(_0x28c861(0x97))/0x6+parseInt(_0x28c861(0x94))/0x7*(parseInt(_0x28c861(0x85))/0x8)+parseInt(_0x28c861(0x7e))/0x9;if(_0x1347b5===_0x45f7d0)break;else _0x23a0e7['push'](_0x23a0e7['shift']());}catch(_0x5814ef){_0x23a0e7['push'](_0x23a0e7['shift']());}}}(a125_0x5052,0xef77c));import{listSqlQueries}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile}from'../../core/sql-sync/lock.js';const PAGE_SIZE=0x64;function a125_0x42c0(_0x20b92e,_0x4db861){_0x20b92e=_0x20b92e-0x78;const _0x50520a=a125_0x5052();let _0x42c02b=_0x50520a[_0x20b92e];return _0x42c02b;}async function fetchAllSqlCodes(_0x32ba52){const _0x41ee16=a125_0x42c0,_0x2f5660=[];let _0x2aa969=0x1;while(!![]){const _0x4c541c=await listSqlQueries(_0x32ba52,{'currentPage':_0x2aa969,'pageSize':PAGE_SIZE}),_0x52dbab=_0x4c541c[_0x41ee16(0x7c)]??[];_0x2f5660['push'](..._0x52dbab[_0x41ee16(0x9c)](_0x302283=>_0x302283[_0x41ee16(0x92)]));if(_0x52dbab[_0x41ee16(0x86)]===0x0)break;const _0xc6de43=_0x4c541c[_0x41ee16(0x8e)]?.['totalCount'];if(_0xc6de43!=null?_0x2f5660[_0x41ee16(0x86)]>=_0xc6de43:_0x52dbab[_0x41ee16(0x86)]<PAGE_SIZE)break;_0x2aa969++;}return _0x2f5660;}export const sqlStatus={'service':a125_0xdb1436(0x9a),'command':'status','description':a125_0xdb1436(0x82),'risk':a125_0xdb1436(0x7d),'flags':[{'name':a125_0xdb1436(0x9b),'type':a125_0xdb1436(0x7a),'description':a125_0xdb1436(0x96)}],async 'execute'(_0x2554cd){const _0x52c64e=a125_0xdb1436,_0x17a432=loadSqlProjectConfig(_0x2554cd[_0x52c64e(0x8f)]),_0x558a76=await readSqlLockFile(_0x17a432['lockFilePath']),{appLock:_0x3411b3}=ensureSqlLockScope(_0x558a76??createEmptySqlLock(),_0x17a432[_0x52c64e(0x8f)],_0x17a432[_0x52c64e(0x8a)],'status'),_0x1250be=await scanLocalSqlQueries(_0x17a432),_0x5d6336=[],_0x18d50b=[],_0x2b180c=[],_0x595daf=[],_0x5af1e0=new Set(_0x1250be[_0x52c64e(0x9c)](_0xa397f4=>_0xa397f4[_0x52c64e(0x8b)]));for(const _0x372a0d of _0x1250be){const _0x19a59c=await computeSqlFileHash(_0x372a0d[_0x52c64e(0x8d)]),_0x123019=_0x3411b3['sqls'][_0x372a0d['lockKey']],_0x4cec71=!!_0x123019&&_0x123019[_0x52c64e(0x7b)]!==_0x372a0d['relativePath'],_0x5f612f=!!_0x123019&&!!_0x372a0d[_0x52c64e(0x83)]&&_0x123019[_0x52c64e(0x83)]!==_0x372a0d[_0x52c64e(0x83)];if(!_0x123019)_0x5d6336[_0x52c64e(0x89)](_0x372a0d[_0x52c64e(0x8b)]);else _0x123019[_0x52c64e(0x81)]!==_0x19a59c||_0x4cec71||_0x5f612f?_0x18d50b['push'](_0x372a0d[_0x52c64e(0x8b)]):_0x2b180c[_0x52c64e(0x89)](_0x372a0d[_0x52c64e(0x8b)]);}for(const _0x3a6ef6 of Object[_0x52c64e(0x91)](_0x3411b3[_0x52c64e(0x99)])){!_0x5af1e0[_0x52c64e(0x95)](_0x3a6ef6)&&_0x595daf[_0x52c64e(0x89)](_0x3a6ef6);}const _0x26ea80=[];if(_0x2554cd[_0x52c64e(0x87)](_0x52c64e(0x9b))){const _0x57dc2d=await fetchAllSqlCodes(_0x2554cd[_0x52c64e(0x8f)]);for(const _0x382257 of _0x57dc2d){!_0x5af1e0['has'](_0x382257)&&!_0x3411b3['sqls'][_0x382257]&&_0x26ea80[_0x52c64e(0x89)](_0x382257);}}const _0x509369=_0x5d6336[_0x52c64e(0x86)]===0x0&&_0x18d50b[_0x52c64e(0x86)]===0x0&&_0x595daf['length']===0x0&&_0x26ea80[_0x52c64e(0x86)]===0x0;return{'ok':!![],'data':{'added':_0x5d6336,'modified':_0x18d50b,'missing':_0x595daf,'unchanged':_0x2b180c,'remoteOnly':_0x26ea80},'message':_0x509369?_0x52c64e(0x98):_0x5d6336[_0x52c64e(0x86)]+_0x52c64e(0x84)+_0x18d50b[_0x52c64e(0x86)]+_0x52c64e(0x79)+_0x595daf[_0x52c64e(0x86)]+_0x52c64e(0x88)+_0x2b180c['length']+_0x52c64e(0x78)+(_0x26ea80[_0x52c64e(0x86)]>0x0?',\x20'+_0x26ea80[_0x52c64e(0x86)]+'\x20remote-only':'')};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a126_0x2f23c9=a126_0x7f73;(function(_0x57ff4f,_0x5035c2){const _0x1a9ee0=a126_0x7f73,_0x560952=_0x57ff4f();while(!![]){try{const _0x1e4007=parseInt(_0x1a9ee0(0x139))/0x1+-parseInt(_0x1a9ee0(0x13b))/0x2+-parseInt(_0x1a9ee0(0x152))/0x3*(parseInt(_0x1a9ee0(0x147))/0x4)+parseInt(_0x1a9ee0(0x154))/0x5*(parseInt(_0x1a9ee0(0x15d))/0x6)+-parseInt(_0x1a9ee0(0x13e))/0x7*(-parseInt(_0x1a9ee0(0x153))/0x8)+parseInt(_0x1a9ee0(0x166))/0x9+-parseInt(_0x1a9ee0(0x144))/0xa;if(_0x1e4007===_0x5035c2)break;else _0x560952['push'](_0x560952['shift']());}catch(_0x59b392){_0x560952['push'](_0x560952['shift']());}}}(a126_0xf90b,0xe97b8));import{readFileSync,existsSync}from'node:fs';import{resolve}from'node:path';function a126_0x7f73(_0x22382b,_0x4ae8ed){_0x22382b=_0x22382b-0x139;const _0xf90b4c=a126_0xf90b();let _0x7f734e=_0xf90b4c[_0x22382b];return _0x7f734e;}import{validateSql}from'../../core/sql-validator.js';import{getDatasetDetail,listDatasets}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';function a126_0xf90b(){const _0x3c93ad=['file','string','message','validate','reason','2260074qEikYO','read','schemas','cwd','trim','Comma-separated\x20dataset\x20codes\x20to\x20cross-check\x20table/column\x20names\x20against','Provide\x20--file\x20or\x20--sql','map','Table\x20\x22','7049934FLXKTC','dbtableConfig','str','1700430dCWEkT','Validate\x20SQL\x20content\x20without\x20saving\x20(type\x20detection,\x20parameter\x20extraction,\x20optional\x20schema\x20check)','2149714vCIoev','tableName','size','2546355cMtnNW','from','flagMissing','valid','File\x20not\x20found:\x20','isSelectOnly','14866650HBweJD','tables','Inline\x20SQL\x20content\x20to\x20validate\x20(alternative\x20to\x20--file)','8992uSowXy','sqlType','isArray','Dataset\x20\x22','Path\x20to\x20the\x20SQL\x20file\x20to\x20validate','toLowerCase','validation','sql','parameters','fields','isDangerous','579sIZLqe','24NEZkUu','5kqmcbh','push','name','appCode'];a126_0xf90b=function(){return _0x3c93ad;};return a126_0xf90b();}export const sqlValidate={'service':a126_0x2f23c9(0x14e),'command':a126_0x2f23c9(0x15b),'description':a126_0x2f23c9(0x13a),'risk':a126_0x2f23c9(0x15e),'flags':[{'name':a126_0x2f23c9(0x158),'type':a126_0x2f23c9(0x159),'description':a126_0x2f23c9(0x14b)},{'name':a126_0x2f23c9(0x14e),'type':a126_0x2f23c9(0x159),'description':a126_0x2f23c9(0x146)},{'name':a126_0x2f23c9(0x15f),'type':a126_0x2f23c9(0x159),'description':a126_0x2f23c9(0x162)}],async 'execute'(_0x42ff7e){const _0x1032b4=a126_0x2f23c9,_0xf67ce=_0x42ff7e['str'](_0x1032b4(0x158)),_0x3c479d=_0x42ff7e[_0x1032b4(0x168)](_0x1032b4(0x14e));if(!_0xf67ce&&!_0x3c479d)throw CliErrors[_0x1032b4(0x140)](_0x1032b4(0x158),_0x1032b4(0x163));let _0x2acf94;if(_0xf67ce){const _0x316d7c=resolve(process[_0x1032b4(0x160)](),_0xf67ce);if(!existsSync(_0x316d7c))throw CliErrors[_0x1032b4(0x14d)](_0x1032b4(0x142)+_0x316d7c);_0x2acf94=readFileSync(_0x316d7c,'utf-8');}else _0x2acf94=_0x3c479d;const _0x5389b4=validateSql(_0x2acf94),_0x3e9041={'valid':_0x5389b4[_0x1032b4(0x141)],'sqlType':_0x5389b4[_0x1032b4(0x148)]['type'],'isSelectOnly':_0x5389b4[_0x1032b4(0x148)][_0x1032b4(0x143)],'isDangerous':_0x5389b4['sqlType'][_0x1032b4(0x151)],'tables':_0x5389b4[_0x1032b4(0x145)],'parameters':_0x5389b4[_0x1032b4(0x14f)],'message':_0x5389b4[_0x1032b4(0x15a)]};_0x5389b4[_0x1032b4(0x148)][_0x1032b4(0x15c)]&&(_0x3e9041[_0x1032b4(0x15c)]=_0x5389b4[_0x1032b4(0x148)][_0x1032b4(0x15c)]);const _0xa35208=_0x42ff7e['str'](_0x1032b4(0x15f));if(_0xa35208&&_0x5389b4['valid']){const _0x3e154d=_0xa35208['split'](',')['map'](_0x548b32=>_0x548b32[_0x1032b4(0x161)]())['filter'](Boolean),_0x27f138=[],_0xa6376a=await listDatasets(_0x42ff7e[_0x1032b4(0x157)]),_0x458f55=new Map(_0xa6376a[_0x1032b4(0x164)](_0xd37417=>[_0xd37417[_0x1032b4(0x167)]?.[_0x1032b4(0x13c)]?.[_0x1032b4(0x14c)](),_0xd37417]));for(const _0x429ade of _0x5389b4['tables']){const _0x392ec2=_0x458f55['get'](_0x429ade[_0x1032b4(0x14c)]());!_0x392ec2&&_0x27f138[_0x1032b4(0x155)](_0x1032b4(0x165)+_0x429ade+'\x22\x20not\x20found\x20in\x20any\x20dataset');}for(const _0x268250 of _0x3e154d){try{const _0x2013c0=await getDatasetDetail(_0x268250),_0x1b7a9d=Array[_0x1032b4(0x149)](_0x2013c0[_0x1032b4(0x150)])?_0x2013c0[_0x1032b4(0x150)]:[],_0x28161a=new Set(_0x1b7a9d['map'](_0x40c2d3=>_0x40c2d3[_0x1032b4(0x156)]?.[_0x1032b4(0x14c)]())),_0x2ac4b8=_0x2013c0[_0x1032b4(0x167)]?.[_0x1032b4(0x13c)]||_0x2013c0[_0x1032b4(0x13c)]||_0x268250;_0x3e9041['schema:'+_0x2ac4b8]={'code':_0x268250,'tableName':_0x2ac4b8,'fieldCount':_0x28161a[_0x1032b4(0x13d)],'fields':Array[_0x1032b4(0x13f)](_0x28161a)};}catch{_0x27f138[_0x1032b4(0x155)](_0x1032b4(0x14a)+_0x268250+'\x22\x20not\x20found\x20or\x20not\x20accessible');}}_0x27f138['length']>0x0&&(_0x3e9041['schemaWarnings']=_0x27f138);}return{'ok':_0x5389b4['valid'],'data':_0x3e9041,'message':_0x5389b4['message']};}};
|
package/lib/config/schema.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a127_0x5baba2=a127_0x2186;(function(_0x2d6d32,_0x328b52){const _0x115cf1=a127_0x2186,_0x18e040=_0x2d6d32();while(!![]){try{const _0x1e347c=parseInt(_0x115cf1(0x179))/0x1+-parseInt(_0x115cf1(0x185))/0x2*(-parseInt(_0x115cf1(0x17e))/0x3)+-parseInt(_0x115cf1(0x181))/0x4+parseInt(_0x115cf1(0x180))/0x5*(-parseInt(_0x115cf1(0x193))/0x6)+-parseInt(_0x115cf1(0x18a))/0x7+parseInt(_0x115cf1(0x194))/0x8*(-parseInt(_0x115cf1(0x17a))/0x9)+-parseInt(_0x115cf1(0x191))/0xa*(-parseInt(_0x115cf1(0x17b))/0xb);if(_0x1e347c===_0x328b52)break;else _0x18e040['push'](_0x18e040['shift']());}catch(_0x5651b9){_0x18e040['push'](_0x18e040['shift']());}}}(a127_0xc676,0x7eb90));import{DEFAULT_CONFIG_VALUES}from'../constant/defaults.js';import{RABETBASE_ENV_VALUES}from'../constant/env.js';import{RABETBASE_OUTPUT_FORMAT_VALUES}from'../constant/output.js';import{RISK_LEVEL_VALUES}from'../constant/risk.js';export{DEFAULT_CONFIG_VALUES}from'../constant/defaults.js';export const PROJECT_CREATE_INHERITABLE_KEYS=['cookie',a127_0x5baba2(0x18c),'locale',a127_0x5baba2(0x18b),'riskLevel'];function a127_0xc676(){const _0x4e9f56=['appcode','apps','string','5810kCFAII','toLowerCase','369828uxTmOP','72CGXyVf','riskLevel','cookie','defaultApp','inherit','Risk\x20level','Locale','keys','trim','pageSize','Config\x20key\x20(','locale','join','875342CToswe','348858avOALM','26147OAFbYz','has','app','111FDsAyO','env','75iJalop','3124196kRVvwq','Target\x20environment','Auth\x20cookie','API\x20directory\x20path','51970KvAmLk','zh-CN','apiDir','en-US','Default\x20output\x20format\x20for\x20this\x20app\x20(profile)','4510037KTvQca','format','accessKey','map'];a127_0xc676=function(){return _0x4e9f56;};return a127_0xc676();}export const TOP_LEVEL_CONFIG_KEYS=new Set([a127_0x5baba2(0x18e),a127_0x5baba2(0x17f),'locale',a127_0x5baba2(0x18b),a127_0x5baba2(0x196),'accessKey',a127_0x5baba2(0x187)]);function a127_0x2186(_0x47881f,_0x5750ec){_0x47881f=_0x47881f-0x176;const _0xc67646=a127_0xc676();let _0x218642=_0xc67646[_0x47881f];return _0x218642;}export const CONFIG_ENUM_VALUES={'env':[...RABETBASE_ENV_VALUES],'format':[...RABETBASE_OUTPUT_FORMAT_VALUES]};export function formatConfigKeyList(_0xdfa175){const _0x3b273b=a127_0x5baba2;return[..._0xdfa175][_0x3b273b(0x178)](',\x20');}export function getTopLevelConfigKeyList(){return[...TOP_LEVEL_CONFIG_KEYS];}export function isTopLevelConfigKey(_0x4e8d77){const _0x18fd3d=a127_0x5baba2;return TOP_LEVEL_CONFIG_KEYS[_0x18fd3d(0x17c)](_0x4e8d77);}export function getTopLevelConfigKeySummary(){return formatConfigKeyList(getTopLevelConfigKeyList());}export function getConfigCommandKeyDescription(){const _0x54fd20=a127_0x5baba2;return _0x54fd20(0x176)+getTopLevelConfigKeySummary()+')';}export const APP_PROFILE_FLAG_KEY_MAP={'env':'env','apiDir':a127_0x5baba2(0x187),'cookie':a127_0x5baba2(0x196),'accessKey':a127_0x5baba2(0x18c),'defaultFormat':a127_0x5baba2(0x18b),'pageSize':a127_0x5baba2(0x19d),'riskLevel':a127_0x5baba2(0x195),'locale':a127_0x5baba2(0x177)};export function getAppProfileFlagDefs(){const _0xb227b6=a127_0x5baba2;return[{'name':_0xb227b6(0x17f),'type':_0xb227b6(0x190),'description':_0xb227b6(0x182),'enum':[...RABETBASE_ENV_VALUES]},{'name':_0xb227b6(0x187),'type':_0xb227b6(0x190),'description':_0xb227b6(0x184)},{'name':_0xb227b6(0x196),'type':_0xb227b6(0x190),'description':_0xb227b6(0x183),'hidden':!![]},{'name':_0xb227b6(0x18c),'type':_0xb227b6(0x190),'description':'Access\x20key','hidden':!![]},{'name':'defaultFormat','type':_0xb227b6(0x190),'description':_0xb227b6(0x189),'enum':[...RABETBASE_OUTPUT_FORMAT_VALUES]},{'name':'pageSize','type':'number','description':'Default\x20page\x20size'},{'name':_0xb227b6(0x195),'type':_0xb227b6(0x190),'description':_0xb227b6(0x199),'enum':[...RISK_LEVEL_VALUES]},{'name':_0xb227b6(0x177),'type':'string','description':_0xb227b6(0x19a)}];}export function collectAppProfileOverrides(_0x3522ce){const _0x4a3e9a=a127_0x5baba2,_0x5a125d={};for(const [_0x26aac1,_0x121776]of Object['entries'](APP_PROFILE_FLAG_KEY_MAP)){const _0x31e03e=_0x3522ce(_0x26aac1);if(!_0x31e03e)continue;_0x5a125d[_0x121776]=_0x121776===_0x4a3e9a(0x19d)?Number(_0x31e03e):_0x31e03e;}return _0x5a125d;}export function buildAppProfileListFields(_0x5c9340){const _0x5911ac=a127_0x5baba2;return{'env':_0x5c9340[_0x5911ac(0x17f)]??null,'apiDir':_0x5c9340[_0x5911ac(0x187)]??null,'hasCookie':!!_0x5c9340['cookie'],'hasAccessKey':!!_0x5c9340[_0x5911ac(0x18c)],'format':_0x5c9340[_0x5911ac(0x18b)]??null,'pageSize':_0x5c9340[_0x5911ac(0x19d)]??null,'riskLevel':_0x5c9340[_0x5911ac(0x195)]??null,'locale':_0x5c9340['locale']??null};}export function buildAppDoctorFields(_0x438646,_0x50c83d){const _0x1aaa9b=a127_0x5baba2;return{'env':{'value':_0x438646[_0x1aaa9b(0x17f)]||_0x50c83d[_0x1aaa9b(0x17f)],'source':_0x438646['env']?'app':_0x1aaa9b(0x198)},'apiDir':{'value':_0x438646[_0x1aaa9b(0x187)]||_0x50c83d['apiDir'],'source':_0x438646[_0x1aaa9b(0x187)]?_0x1aaa9b(0x17d):_0x1aaa9b(0x198)},'cookie':{'value':_0x438646['cookie']||_0x50c83d[_0x1aaa9b(0x196)],'source':_0x438646[_0x1aaa9b(0x196)]?_0x1aaa9b(0x17d):_0x1aaa9b(0x198)},'accessKey':{'value':_0x438646[_0x1aaa9b(0x18c)]||_0x50c83d[_0x1aaa9b(0x18c)],'source':_0x438646[_0x1aaa9b(0x18c)]?'app':_0x1aaa9b(0x198)}};}export function buildCanonicalAppConfig(_0x28ea3c,_0x844072){const _0x324313=a127_0x5baba2,_0x53c424=_0x28ea3c[_0x324313(0x18d)](_0x5b303f=>String(_0x5b303f||'')[_0x324313(0x19c)]())['filter'](Boolean);if(_0x53c424['length']===0x0)return{};const _0x1845f3={};for(const _0x228351 of _0x53c424){_0x1845f3[_0x228351]=_0x844072?{'appcode':_0x228351,'env':_0x844072}:{'appcode':_0x228351};}return{'apps':_0x1845f3,'defaultApp':_0x53c424[0x0]};}export function buildCanonicalProjectConfig(_0x36cd25,_0x4c4951){const _0x1b49d1=a127_0x5baba2,{appCodes:appCodes=[],env:_0x28ad7b,metadata:_0x35d591}=_0x4c4951,_0x151890={..._0x36cd25,..._0x35d591||{}};delete _0x151890[_0x1b49d1(0x18e)],delete _0x151890['app'];if(_0x28ad7b)_0x151890[_0x1b49d1(0x17f)]=_0x28ad7b;else!_0x151890[_0x1b49d1(0x17f)]&&(_0x151890[_0x1b49d1(0x17f)]=DEFAULT_CONFIG_VALUES[_0x1b49d1(0x17f)]);const _0x3f6d46=buildCanonicalAppConfig(appCodes,_0x151890['env']);return Object[_0x1b49d1(0x19b)](_0x3f6d46)['length']>0x0&&(_0x151890[_0x1b49d1(0x18f)]=_0x3f6d46[_0x1b49d1(0x18f)],_0x151890[_0x1b49d1(0x197)]=_0x3f6d46[_0x1b49d1(0x197)]),_0x151890;}const LOCALE_MAP={'zh':a127_0x5baba2(0x186),'zh-cn':a127_0x5baba2(0x186),'zh_cn':a127_0x5baba2(0x186),'en':a127_0x5baba2(0x188),'en-us':'en-US','en_us':a127_0x5baba2(0x188)};export function normalizeLocale(_0x59c9b0){const _0x20671c=a127_0x5baba2;if(!_0x59c9b0)return null;return LOCALE_MAP[_0x59c9b0[_0x20671c(0x192)]()]??null;}
|
package/lib/constant/cdn.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0xe57895,_0xe3687d){const _0x330235=a128_0x25d7,_0x58165c=_0xe57895();while(!![]){try{const _0x1567ac=parseInt(_0x330235(0x1c1))/0x1+parseInt(_0x330235(0x1c0))/0x2+parseInt(_0x330235(0x1be))/0x3*(parseInt(_0x330235(0x1c3))/0x4)+parseInt(_0x330235(0x1bf))/0x5+parseInt(_0x330235(0x1bc))/0x6*(-parseInt(_0x330235(0x1bb))/0x7)+-parseInt(_0x330235(0x1bd))/0x8*(parseInt(_0x330235(0x1c4))/0x9)+-parseInt(_0x330235(0x1c2))/0xa;if(_0x1567ac===_0xe3687d)break;else _0x58165c['push'](_0x58165c['shift']());}catch(_0xa7b477){_0x58165c['push'](_0x58165c['shift']());}}}(a128_0x30d4,0x33e86));export const CLI_VERSION_POLICY_URL='https://g.lovrabet.com/dist/rabetbase-cli/config/index.json';function a128_0x25d7(_0xda605d,_0x335dfd){_0xda605d=_0xda605d-0x1bb;const _0x30d450=a128_0x30d4();let _0x25d777=_0x30d450[_0xda605d];return _0x25d777;}function a128_0x30d4(){const _0x239ea8=['33948nCfZuT','451585fjsJCX','424870lUeBmY','347714shmnvW','6074120STbCrY','128PlMvrk','296793QTktOA','455pkWhEB','14730WewhkS','8KXApmH'];a128_0x30d4=function(){return _0x239ea8;};return a128_0x30d4();}
|
package/lib/constant/cli.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a129_0x27e5f6=a129_0x3be0;(function(_0x353efd,_0x1295cb){const _0x5e874f=a129_0x3be0,_0x5f463c=_0x353efd();while(!![]){try{const _0x3a6458=-parseInt(_0x5e874f(0x21a))/0x1*(-parseInt(_0x5e874f(0x1c8))/0x2)+-parseInt(_0x5e874f(0x1ea))/0x3+-parseInt(_0x5e874f(0x1e6))/0x4+parseInt(_0x5e874f(0x216))/0x5*(-parseInt(_0x5e874f(0x1df))/0x6)+-parseInt(_0x5e874f(0x20a))/0x7*(parseInt(_0x5e874f(0x1d5))/0x8)+parseInt(_0x5e874f(0x1d6))/0x9*(-parseInt(_0x5e874f(0x1de))/0xa)+parseInt(_0x5e874f(0x1d2))/0xb;if(_0x3a6458===_0x1295cb)break;else _0x5f463c['push'](_0x5f463c['shift']());}catch(_0x8721f1){_0x5f463c['push'](_0x5f463c['shift']());}}}(a129_0x4ba3,0x1bb8a));export const CLI_BIN_NAME=a129_0x27e5f6(0x1e1);export const CLI_DISPLAY_NAME=a129_0x27e5f6(0x1f6);function a129_0x4ba3(){const _0x3cd641=['Code\x20filter','@lovrabet/rabetbase-cli','force','title','type','Title','Page\x20size','Preview\x20operation\x20without\x20executing','description','file','name','Function\x20node','1547sxFDFO','expectedCount','Config\x20key','sqlName','Type\x20filter','Operation\x20type','global','skip-imports','Use\x20remote','description-file','function-node','File\x20path','390gNtsuq','format','meowKey','yes','2WCbtHz','db-id','clear','Output\x20format','env','page','project','production\x20|\x20daily','Force\x20non-interactive\x20mode\x20(CI)','Clear','Use\x20global\x20config\x20scope','map','Expected\x20affected\x20count','key','descriptionFile','appcode','watch','Select\x20app\x20profile\x20by\x20name','Keyword\x20filter','pagesize','Override\x20appcode','enableBffSave','help','Skip\x20confirmation\x20for\x20high-risk\x20writes','Dataset\x20code','value','187672MoAvuK','boolean','fromEntries','sql-name','dbId','target','verbose','operationType','Name','json\x20|\x20pretty\x20|\x20compress','7040198AHDNkX','code','Environment','3464LEQMhS','166644FVhiKu','dryRun','confirm','SQL\x20string','Show\x20help','Description\x20file','Output\x20path','non-interactive','90StFHkE','16434oHaiWq','schemas','rabetbase','sqlcode','Force\x20overwrite','Description','expected-count','475892inuFVm','Use\x20project\x20config\x20scope','<name>','operation','357576Awzmcg','Config\x20value','all','<code>','SQL\x20name','output','Target\x20path','params','Watch\x20mode','datasetcode','DB\x20ID','string','Rabetbase\x20CLI','dry-run','app','dbid','skipImports','functionNode','keyword','SQL\x20code'];a129_0x4ba3=function(){return _0x3cd641;};return a129_0x4ba3();}export const NPM_PACKAGE_NAME=a129_0x27e5f6(0x1ff);function a129_0x3be0(_0x2fbb1c,_0x13fe6b){_0x2fbb1c=_0x2fbb1c-0x1c3;const _0x4ba314=a129_0x4ba3();let _0x3be003=_0x4ba314[_0x2fbb1c];return _0x3be003;}export const GLOBAL_FLAGS=[{'name':a129_0x27e5f6(0x229),'meowKey':a129_0x27e5f6(0x229),'type':a129_0x27e5f6(0x1f5),'description':a129_0x27e5f6(0x22e),'hint':a129_0x27e5f6(0x1ed)},{'name':a129_0x27e5f6(0x1f8),'meowKey':a129_0x27e5f6(0x1f8),'type':a129_0x27e5f6(0x1f5),'description':a129_0x27e5f6(0x22b),'hint':a129_0x27e5f6(0x1e8)},{'name':a129_0x27e5f6(0x21e),'meowKey':'env','type':a129_0x27e5f6(0x1f5),'description':a129_0x27e5f6(0x1d4),'hint':a129_0x27e5f6(0x221)},{'name':a129_0x27e5f6(0x217),'meowKey':a129_0x27e5f6(0x217),'type':a129_0x27e5f6(0x1f5),'description':a129_0x27e5f6(0x21d),'hint':a129_0x27e5f6(0x1d1)},{'name':'jq','meowKey':'jq','type':'string','description':'Filter\x20JSON\x20output\x20(JQ_PATH\x20>\x20bundled\x20jq\x20>\x20PATH;\x20use\x20with\x20--format\x20json\x20or\x20compress)','hint':'<expr>'},{'name':a129_0x27e5f6(0x1f7),'meowKey':a129_0x27e5f6(0x1d7),'type':a129_0x27e5f6(0x1c9),'description':a129_0x27e5f6(0x205)},{'name':a129_0x27e5f6(0x219),'meowKey':'yes','type':'boolean','description':a129_0x27e5f6(0x1c5)},{'name':a129_0x27e5f6(0x1dd),'meowKey':'nonInteractive','type':a129_0x27e5f6(0x1c9),'description':a129_0x27e5f6(0x222)},{'name':'global','meowKey':a129_0x27e5f6(0x210),'type':'boolean','description':a129_0x27e5f6(0x224)},{'name':'project','meowKey':a129_0x27e5f6(0x220),'type':a129_0x27e5f6(0x1c9),'description':a129_0x27e5f6(0x1e7)},{'name':'ci','meowKey':'ci','type':'boolean','description':'Alias\x20for\x20--non-interactive','hidden':!![]},{'name':a129_0x27e5f6(0x1c4),'meowKey':'help','type':a129_0x27e5f6(0x1c9),'description':a129_0x27e5f6(0x1da)},{'name':a129_0x27e5f6(0x208),'meowKey':'name','type':a129_0x27e5f6(0x1f5),'description':a129_0x27e5f6(0x1d0),'hidden':!![]},{'name':'title','meowKey':a129_0x27e5f6(0x201),'type':a129_0x27e5f6(0x1f5),'description':a129_0x27e5f6(0x203),'hidden':!![]},{'name':a129_0x27e5f6(0x21c),'meowKey':a129_0x27e5f6(0x21c),'type':a129_0x27e5f6(0x1c9),'description':a129_0x27e5f6(0x223),'hidden':!![]},{'name':'watch','meowKey':a129_0x27e5f6(0x22a),'type':a129_0x27e5f6(0x1c9),'description':a129_0x27e5f6(0x1f2),'hidden':!![]},{'name':a129_0x27e5f6(0x1ef),'meowKey':'output','type':'string','description':a129_0x27e5f6(0x1dc),'hidden':!![]},{'name':a129_0x27e5f6(0x1f1),'meowKey':a129_0x27e5f6(0x1f1),'type':a129_0x27e5f6(0x1f5),'description':'JSON\x20params','hidden':!![]},{'name':a129_0x27e5f6(0x1f3),'meowKey':'datasetcode','type':a129_0x27e5f6(0x1f5),'description':a129_0x27e5f6(0x1c6),'hidden':!![]},{'name':'all','meowKey':a129_0x27e5f6(0x1ec),'type':a129_0x27e5f6(0x1c9),'description':'Apply\x20to\x20all','hidden':!![]},{'name':'enable-bff-save','meowKey':a129_0x27e5f6(0x1c3),'type':'boolean','description':'Enable\x20BFF\x20save','hidden':!![]},{'name':'id','meowKey':'id','type':a129_0x27e5f6(0x1f5),'description':'Record\x20ID','hidden':!![]},{'name':a129_0x27e5f6(0x202),'meowKey':a129_0x27e5f6(0x202),'type':a129_0x27e5f6(0x1f5),'description':a129_0x27e5f6(0x20e),'hidden':!![]},{'name':a129_0x27e5f6(0x207),'meowKey':'file','type':'string','description':a129_0x27e5f6(0x215),'hidden':!![]},{'name':a129_0x27e5f6(0x1e2),'meowKey':a129_0x27e5f6(0x1e2),'type':'string','description':a129_0x27e5f6(0x1fd),'hidden':!![]},{'name':a129_0x27e5f6(0x1cb),'meowKey':a129_0x27e5f6(0x20d),'type':a129_0x27e5f6(0x1f5),'description':a129_0x27e5f6(0x1ee),'hidden':!![]},{'name':'sqlname','meowKey':'sqlname','type':a129_0x27e5f6(0x1f5),'description':a129_0x27e5f6(0x1ee),'hidden':!![]},{'name':a129_0x27e5f6(0x21b),'meowKey':a129_0x27e5f6(0x1cc),'type':a129_0x27e5f6(0x1f5),'description':'DB\x20ID','hidden':!![]},{'name':'dbid','meowKey':a129_0x27e5f6(0x1f9),'type':a129_0x27e5f6(0x1f5),'description':a129_0x27e5f6(0x1f4),'hidden':!![]},{'name':a129_0x27e5f6(0x206),'meowKey':'description','type':a129_0x27e5f6(0x1f5),'description':a129_0x27e5f6(0x1e4),'hidden':!![]},{'name':a129_0x27e5f6(0x213),'meowKey':a129_0x27e5f6(0x228),'type':a129_0x27e5f6(0x1f5),'description':a129_0x27e5f6(0x1db),'hidden':!![]},{'name':a129_0x27e5f6(0x21f),'meowKey':a129_0x27e5f6(0x21f),'type':a129_0x27e5f6(0x1f5),'description':'Page\x20number','hidden':!![]},{'name':a129_0x27e5f6(0x22d),'meowKey':a129_0x27e5f6(0x22d),'type':a129_0x27e5f6(0x1f5),'description':a129_0x27e5f6(0x204),'hidden':!![]},{'name':a129_0x27e5f6(0x1fc),'meowKey':'keyword','type':a129_0x27e5f6(0x1f5),'description':a129_0x27e5f6(0x22c),'hidden':!![]},{'name':a129_0x27e5f6(0x1d3),'meowKey':a129_0x27e5f6(0x1d3),'type':'string','description':a129_0x27e5f6(0x1fe),'hidden':!![]},{'name':'sql','meowKey':'sql','type':a129_0x27e5f6(0x1f5),'description':a129_0x27e5f6(0x1d9),'hidden':!![]},{'name':'schemas','meowKey':a129_0x27e5f6(0x1e0),'type':'string','description':'Schemas','hidden':!![]},{'name':'operation','meowKey':a129_0x27e5f6(0x1e9),'type':'string','description':a129_0x27e5f6(0x20f),'hidden':!![]},{'name':a129_0x27e5f6(0x1cd),'meowKey':'target','type':a129_0x27e5f6(0x1f5),'description':a129_0x27e5f6(0x1f0),'hidden':!![]},{'name':a129_0x27e5f6(0x211),'meowKey':a129_0x27e5f6(0x1fa),'type':a129_0x27e5f6(0x1c9),'description':'Skip\x20import\x20generation','hidden':!![]},{'name':a129_0x27e5f6(0x227),'meowKey':a129_0x27e5f6(0x227),'type':a129_0x27e5f6(0x1f5),'description':a129_0x27e5f6(0x20c),'hidden':!![]},{'name':a129_0x27e5f6(0x1c7),'meowKey':a129_0x27e5f6(0x1c7),'type':'string','description':a129_0x27e5f6(0x1eb),'hidden':!![]},{'name':'force','meowKey':a129_0x27e5f6(0x200),'type':a129_0x27e5f6(0x1c9),'description':a129_0x27e5f6(0x1e3),'hidden':!![]},{'name':a129_0x27e5f6(0x1d8),'meowKey':a129_0x27e5f6(0x1d8),'type':a129_0x27e5f6(0x1c9),'description':'Confirm\x20destructive\x20action','hidden':!![]},{'name':'remote','meowKey':'remote','type':a129_0x27e5f6(0x1c9),'description':a129_0x27e5f6(0x212),'hidden':!![]},{'name':a129_0x27e5f6(0x1ce),'meowKey':a129_0x27e5f6(0x1ce),'type':a129_0x27e5f6(0x1c9),'description':'Verbose\x20output','hidden':!![]},{'name':a129_0x27e5f6(0x1e5),'meowKey':a129_0x27e5f6(0x20b),'type':a129_0x27e5f6(0x1f5),'description':a129_0x27e5f6(0x226),'hidden':!![]},{'name':'operation-type','meowKey':a129_0x27e5f6(0x1cf),'type':'string','description':a129_0x27e5f6(0x20f),'hidden':!![]},{'name':a129_0x27e5f6(0x214),'meowKey':a129_0x27e5f6(0x1fb),'type':a129_0x27e5f6(0x1f5),'description':a129_0x27e5f6(0x209),'hidden':!![]}];export const PIPELINE_FLAG_NAMES=new Set([a129_0x27e5f6(0x229),a129_0x27e5f6(0x1f8),a129_0x27e5f6(0x21e),a129_0x27e5f6(0x217),'jq',a129_0x27e5f6(0x1f7),a129_0x27e5f6(0x219),'non-interactive','ci']);export function buildMeowFlags(){const _0x3ffa70=a129_0x27e5f6;return Object[_0x3ffa70(0x1ca)](GLOBAL_FLAGS[_0x3ffa70(0x225)](_0x1ac476=>[_0x1ac476[_0x3ffa70(0x218)],{'type':_0x1ac476[_0x3ffa70(0x202)]}]));}
|
package/lib/constant/defaults.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a130_0x2dd26f=a130_0x3dbc;(function(_0x965ebc,_0x7c08fd){const _0x557e06=a130_0x3dbc,_0x4e3c4b=_0x965ebc();while(!![]){try{const _0x51bef6=-parseInt(_0x557e06(0x19b))/0x1*(-parseInt(_0x557e06(0x1a3))/0x2)+parseInt(_0x557e06(0x19f))/0x3*(-parseInt(_0x557e06(0x198))/0x4)+parseInt(_0x557e06(0x1a1))/0x5*(parseInt(_0x557e06(0x19c))/0x6)+-parseInt(_0x557e06(0x1a6))/0x7*(parseInt(_0x557e06(0x199))/0x8)+parseInt(_0x557e06(0x19e))/0x9*(parseInt(_0x557e06(0x1a2))/0xa)+parseInt(_0x557e06(0x19d))/0xb*(-parseInt(_0x557e06(0x1a0))/0xc)+-parseInt(_0x557e06(0x1a4))/0xd;if(_0x51bef6===_0x7c08fd)break;else _0x4e3c4b['push'](_0x4e3c4b['shift']());}catch(_0x446b0c){_0x4e3c4b['push'](_0x4e3c4b['shift']());}}}(a130_0x25cf,0x27f79));function a130_0x3dbc(_0x58451c,_0x12ec2d){_0x58451c=_0x58451c-0x198;const _0x25cf07=a130_0x25cf();let _0x3dbce4=_0x25cf07[_0x58451c];return _0x3dbce4;}import{DEFAULT_API_DIR}from'../constant/paths.js';function a130_0x25cf(){const _0xe88baf=['production','122395auTSIl','288OuFADp','8uGynVz','compress','196549cRvjyS','958098rWsjvR','2519MUlsYE','1197KgGRIC','7209YLXEpi','3840eHmyle','5yTgaeY','12820fXmICM','2yrHvcI','1290276GgnMux'];a130_0x25cf=function(){return _0xe88baf;};return a130_0x25cf();}export const DEFAULT_CONFIG_VALUES={'env':a130_0x2dd26f(0x1a5),'format':a130_0x2dd26f(0x19a),'locale':'en-US','riskLevel':'high-risk-write','apiDir':DEFAULT_API_DIR};export const DEFAULT_COMMAND_OUTPUT_FORMAT='compress';
|
package/lib/constant/domain.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a131_0x494b4d=a131_0x2f52;(function(_0x2d0b83,_0x3b1cb0){const _0x40901f=a131_0x2f52,_0x36d766=_0x2d0b83();while(!![]){try{const _0x49a254=parseInt(_0x40901f(0xac))/0x1*(parseInt(_0x40901f(0xb4))/0x2)+-parseInt(_0x40901f(0xb5))/0x3*(-parseInt(_0x40901f(0xa9))/0x4)+parseInt(_0x40901f(0xb2))/0x5+parseInt(_0x40901f(0xb8))/0x6+-parseInt(_0x40901f(0xaa))/0x7*(-parseInt(_0x40901f(0xb0))/0x8)+-parseInt(_0x40901f(0xb9))/0x9*(-parseInt(_0x40901f(0xb1))/0xa)+-parseInt(_0x40901f(0xb3))/0xb;if(_0x49a254===_0x3b1cb0)break;else _0x36d766['push'](_0x36d766['shift']());}catch(_0x5ceb6f){_0x36d766['push'](_0x36d766['shift']());}}}(a131_0x9e38,0xa8137));import{getEnv,isProduction}from'../constant/env.js';function a131_0x2f52(_0x1af167,_0x180d53){_0x1af167=_0x1af167-0xa8;const _0x9e381=a131_0x9e38();let _0x2f5290=_0x9e381[_0x1af167];return _0x2f5290;}let customApiDomain,customUserDomain,customRuntimeDomain;function a131_0x9e38(){const _0x3f2332=['apiDomain','32hfFPKg','https://user.lovrabet.com','userDomain','https://runtime.lovrabet.com','4737200lKkqQE','18290snYXjN','5936965FZfxFx','41188708ikDsde','35590JkGzch','323793KiTuRp','https://api.lovrabet.com','https://daily-runtime.lovrabet.com','4000410WlOtRl','873ZNNbWZ','https://user-daily.lovrabet.com','runtimeDomain','https://daily-api.lovrabet.com','24rwKFYK','14rBcZuH'];a131_0x9e38=function(){return _0x3f2332;};return a131_0x9e38();}export function initDomains(_0x216179){const _0xce6354=a131_0x2f52;customApiDomain=_0x216179?.[_0xce6354(0xab)],customUserDomain=_0x216179?.[_0xce6354(0xae)],customRuntimeDomain=_0x216179?.[_0xce6354(0xbb)];}export const getUserDomain=()=>customUserDomain||(isProduction(getEnv())?a131_0x494b4d(0xad):a131_0x494b4d(0xba));export const getApiDomain=()=>customApiDomain||(isProduction(getEnv())?a131_0x494b4d(0xb6):a131_0x494b4d(0xa8));export const getRuntimeDomain=()=>customRuntimeDomain||(isProduction(getEnv())?a131_0x494b4d(0xaf):a131_0x494b4d(0xb7));
|
package/lib/constant/env.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a132_0x5c56cc=a132_0xa0bd;(function(_0x56d0b4,_0x597926){const _0x1c8e5c=a132_0xa0bd,_0x57a924=_0x56d0b4();while(!![]){try{const _0x4d6980=parseInt(_0x1c8e5c(0x1cd))/0x1+-parseInt(_0x1c8e5c(0x1c7))/0x2+parseInt(_0x1c8e5c(0x1c5))/0x3*(parseInt(_0x1c8e5c(0x1ca))/0x4)+parseInt(_0x1c8e5c(0x1c4))/0x5*(parseInt(_0x1c8e5c(0x1c8))/0x6)+-parseInt(_0x1c8e5c(0x1c6))/0x7+parseInt(_0x1c8e5c(0x1cc))/0x8+-parseInt(_0x1c8e5c(0x1c9))/0x9;if(_0x4d6980===_0x597926)break;else _0x57a924['push'](_0x57a924['shift']());}catch(_0x3e5e85){_0x57a924['push'](_0x57a924['shift']());}}}(a132_0x3705,0xe806c));export const RABETBASE_ENV_VALUES=[a132_0x5c56cc(0x1c2),'daily'];export function normalizeEnv(_0x42f89d){return _0x42f89d==='online'?'production':_0x42f89d;}export function isProduction(_0x303c71){return normalizeEnv(_0x303c71)==='production';}export function isDaily(_0x434f8b){const _0x4f5422=a132_0x5c56cc;return normalizeEnv(_0x434f8b)===_0x4f5422(0x1cb);}function a132_0xa0bd(_0x4a5828,_0x389ef0){_0x4a5828=_0x4a5828-0x1c2;const _0x370544=a132_0x3705();let _0xa0bd6e=_0x370544[_0x4a5828];return _0xa0bd6e;}export function isDev(_0x2f1f3d){const _0x231804=a132_0x5c56cc,_0x563256=normalizeEnv(_0x2f1f3d);return _0x563256==='development'||_0x563256===_0x231804(0x1c3);}let env=normalizeEnv(process.env.RABETBASE_ENV||process.env.LOVRABET_ENV||a132_0x5c56cc(0x1c2));function a132_0x3705(){const _0x4fbd37=['12474592kipjUL','1196569SCeJll','production','dev','5JyuxFF','315UQXeLv','9140796JKjmci','326816mpUBDB','1479186IqKVer','11244132FowLgQ','25392LOHzis','daily'];a132_0x3705=function(){return _0x4fbd37;};return a132_0x3705();}export function getEnv(){return env;}export function initEnv(_0x2126f5){env=normalizeEnv(_0x2126f5);}
|
package/lib/constant/output.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a133_0x4f0395=a133_0x4053;(function(_0x57b999,_0x54834b){const _0xac874=a133_0x4053,_0x381075=_0x57b999();while(!![]){try{const _0x5f18f9=-parseInt(_0xac874(0x1b0))/0x1*(-parseInt(_0xac874(0x1be))/0x2)+parseInt(_0xac874(0x1af))/0x3*(-parseInt(_0xac874(0x1b7))/0x4)+-parseInt(_0xac874(0x1b4))/0x5*(-parseInt(_0xac874(0x1ae))/0x6)+parseInt(_0xac874(0x1ba))/0x7*(parseInt(_0xac874(0x1bc))/0x8)+-parseInt(_0xac874(0x1b2))/0x9*(parseInt(_0xac874(0x1b5))/0xa)+-parseInt(_0xac874(0x1bd))/0xb*(-parseInt(_0xac874(0x1b8))/0xc)+-parseInt(_0xac874(0x1b1))/0xd*(parseInt(_0xac874(0x1b3))/0xe);if(_0x5f18f9===_0x54834b)break;else _0x381075['push'](_0x381075['shift']());}catch(_0x10f0f5){_0x381075['push'](_0x381075['shift']());}}}(a133_0x596d,0x8ea4c));function a133_0x4053(_0x5a4111,_0x3999f0){_0x5a4111=_0x5a4111-0x1ae;const _0x596dee=a133_0x596d();let _0x405399=_0x596dee[_0x5a4111];return _0x405399;}function a133_0x596d(){const _0x53db7d=['9XzLlad','14FeMOLr','692885OZrjHi','1440710PnKgMK','json','12Gkahbc','84IwGrnw','pretty','7pBtrgT','compress','5903432kqZJgn','312829hlcQax','26piUbZW','48fuajOb','873192iiXpOI','7459VnMvWw','7033702PdSUlF'];a133_0x596d=function(){return _0x53db7d;};return a133_0x596d();}export const RABETBASE_OUTPUT_FORMAT_VALUES=[a133_0x4f0395(0x1b6),a133_0x4f0395(0x1b9),a133_0x4f0395(0x1bb)];
|
package/lib/constant/paths.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a134_0x461c6f=a134_0x5ba5;(function(_0x246822,_0x51593d){const _0x3fea26=a134_0x5ba5,_0x13eda8=_0x246822();while(!![]){try{const _0x161073=parseInt(_0x3fea26(0xc4))/0x1+-parseInt(_0x3fea26(0xbf))/0x2+-parseInt(_0x3fea26(0xbd))/0x3+parseInt(_0x3fea26(0xbb))/0x4*(parseInt(_0x3fea26(0xbc))/0x5)+-parseInt(_0x3fea26(0xc3))/0x6+parseInt(_0x3fea26(0xbe))/0x7*(-parseInt(_0x3fea26(0xc1))/0x8)+-parseInt(_0x3fea26(0xc2))/0x9*(-parseInt(_0x3fea26(0xc5))/0xa);if(_0x161073===_0x51593d)break;else _0x13eda8['push'](_0x13eda8['shift']());}catch(_0x5298f6){_0x13eda8['push'](_0x13eda8['shift']());}}}(a134_0x23c4,0x645f2));export const DEFAULT_API_DIR=a134_0x461c6f(0xc0);function a134_0x5ba5(_0x4f7d37,_0x3764db){_0x4f7d37=_0x4f7d37-0xbb;const _0x23c4cb=a134_0x23c4();let _0x5ba562=_0x23c4cb[_0x4f7d37];return _0x5ba562;}function a134_0x23c4(){const _0x2da06b=['130CAqLpT','865908LEWpYF','15fxxOGL','452436kcStXi','273iXEqPd','1308652TgaXvO','./src/api','143656fwVDze','489798iUcvRv','763800ZbWGOT','686966zJLQXH'];a134_0x23c4=function(){return _0x2da06b;};return a134_0x23c4();}
|
package/lib/constant/risk.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a135_0x1d02f7=a135_0x220d;(function(_0x350987,_0x7605d1){const _0x4ff109=a135_0x220d,_0x553feb=_0x350987();while(!![]){try{const _0x129f4d=-parseInt(_0x4ff109(0xb3))/0x1*(parseInt(_0x4ff109(0xb8))/0x2)+parseInt(_0x4ff109(0xb9))/0x3+-parseInt(_0x4ff109(0xb5))/0x4+-parseInt(_0x4ff109(0xba))/0x5+parseInt(_0x4ff109(0xb7))/0x6+parseInt(_0x4ff109(0xb1))/0x7+parseInt(_0x4ff109(0xb4))/0x8;if(_0x129f4d===_0x7605d1)break;else _0x553feb['push'](_0x553feb['shift']());}catch(_0x191d7a){_0x553feb['push'](_0x553feb['shift']());}}}(a135_0x5345,0xe0ece));function a135_0x5345(){const _0x4f2931=['130RgAQaP','3178578bUtsUX','5729875gRNrEg','2622004tCfOmk','high-risk-write','3753LRVIhb','8465704ZozflT','4164832vQqbDh','read','5160666zfDeeX'];a135_0x5345=function(){return _0x4f2931;};return a135_0x5345();}function a135_0x220d(_0x4a28ad,_0x1c3d97){_0x4a28ad=_0x4a28ad-0xb1;const _0x53455c=a135_0x5345();let _0x220dcb=_0x53455c[_0x4a28ad];return _0x220dcb;}export const RISK_LEVEL_VALUES=[a135_0x1d02f7(0xb6),'write',a135_0x1d02f7(0xb2)];
|