@lovrabet/rabetbase-cli 2.3.4-beta.4 → 2.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/api-doc.js +1 -1
- package/lib/api/fetch-model-list.js +1 -1
- package/lib/api/generate-api-file.js +1 -1
- package/lib/auth/auth-server-ui.js +1 -1
- package/lib/auth/auth-server.js +1 -1
- package/lib/auth/constant.js +1 -1
- package/lib/auth/get-cookie.js +1 -1
- package/lib/auth/get-session-user.js +1 -1
- package/lib/auth/is-session-valid.js +1 -1
- package/lib/auth/login-success-html.js +1 -1
- package/lib/auth/logout.js +1 -1
- package/lib/cli-flags.js +1 -1
- package/lib/cli.js +1 -1
- package/lib/commands/api/generate.js +1 -1
- package/lib/commands/api/index.js +1 -1
- package/lib/commands/api/list.js +1 -1
- package/lib/commands/api/pull.js +1 -1
- package/lib/commands/api/shared.js +1 -1
- package/lib/commands/app/add.js +1 -1
- package/lib/commands/app/index.js +1 -1
- package/lib/commands/app/list.js +1 -1
- package/lib/commands/app/remote-directory.js +1 -1
- package/lib/commands/app/remove.js +1 -1
- package/lib/commands/app/shared.js +1 -1
- package/lib/commands/app-config/delete.js +1 -1
- package/lib/commands/app-config/get.js +1 -1
- package/lib/commands/app-config/index.js +1 -1
- package/lib/commands/app-config/list.js +1 -1
- package/lib/commands/app-config/set.js +1 -1
- package/lib/commands/app-config/shared.js +1 -1
- package/lib/commands/auth/index.js +1 -1
- package/lib/commands/bff/create.js +1 -1
- package/lib/commands/bff/delete.js +1 -1
- package/lib/commands/bff/detail.js +1 -1
- package/lib/commands/bff/index.js +1 -1
- package/lib/commands/bff/list.js +1 -1
- package/lib/commands/bff/pull.js +1 -1
- package/lib/commands/bff/push.js +1 -1
- package/lib/commands/bff/status.js +1 -1
- package/lib/commands/cli-skill/index.js +1 -1
- package/lib/commands/cli-update.js +1 -1
- package/lib/commands/codegen/index.js +1 -1
- package/lib/commands/codegen/sdk.js +1 -1
- package/lib/commands/codegen/sql.js +1 -1
- package/lib/commands/common/app-registry.js +1 -1
- package/lib/commands/common/app-selector.js +1 -1
- package/lib/commands/common/dry-run.js +1 -1
- package/lib/commands/common/flags.js +1 -1
- package/lib/commands/common/validate.js +1 -1
- package/lib/commands/config/get.js +1 -1
- package/lib/commands/config/index.js +1 -1
- package/lib/commands/config/list.js +1 -1
- package/lib/commands/config/set.js +1 -1
- package/lib/commands/config/shared.js +1 -1
- package/lib/commands/data/filter.js +1 -1
- package/lib/commands/data/getOne.js +1 -1
- package/lib/commands/data/index.js +1 -1
- package/lib/commands/data/shared.js +1 -1
- package/lib/commands/dataset/business-group-update.js +1 -1
- package/lib/commands/dataset/capability.js +1 -1
- package/lib/commands/dataset/delete.js +1 -1
- package/lib/commands/dataset/detail.js +1 -1
- package/lib/commands/dataset/extend-update.js +1 -1
- package/lib/commands/dataset/field-update.js +1 -1
- package/lib/commands/dataset/generate.js +1 -1
- package/lib/commands/dataset/index.js +1 -1
- package/lib/commands/dataset/list.js +1 -1
- package/lib/commands/dataset/operations.js +1 -1
- package/lib/commands/dataset/relation-audit.js +1 -1
- package/lib/commands/dataset/relation-create.js +1 -1
- package/lib/commands/dataset/relation-delete.js +1 -1
- package/lib/commands/dataset/relation-shared.js +1 -1
- package/lib/commands/dataset/relation-update.js +1 -1
- package/lib/commands/dataset/relations.js +1 -1
- package/lib/commands/dataset/rename.js +1 -1
- package/lib/commands/dataset/restore.js +1 -1
- package/lib/commands/db/analyze-cancel.js +1 -1
- package/lib/commands/db/analyze-start.js +1 -1
- package/lib/commands/db/analyze-status.js +1 -1
- package/lib/commands/db/create.js +1 -1
- package/lib/commands/db/delete.js +1 -1
- package/lib/commands/db/detail.js +1 -1
- package/lib/commands/db/diff.js +1 -1
- package/lib/commands/db/index.js +1 -1
- package/lib/commands/db/list.js +1 -1
- package/lib/commands/db/shared.js +1 -1
- package/lib/commands/db/tables.js +1 -1
- package/lib/commands/db/test.js +1 -1
- package/lib/commands/db/update.js +1 -1
- package/lib/commands/doctor.js +1 -1
- package/lib/commands/init/index.js +1 -1
- package/lib/commands/issue/index.js +1 -1
- package/lib/commands/issue/nudge.js +1 -1
- package/lib/commands/issue/report.js +1 -1
- package/lib/commands/issue/shared.js +1 -1
- package/lib/commands/logs/index.js +1 -1
- package/lib/commands/menu/index.js +1 -1
- package/lib/commands/menu/list.js +1 -1
- package/lib/commands/menu/shared/compare-table.js +1 -1
- package/lib/commands/menu/shared/index.js +1 -1
- package/lib/commands/menu/shared/inquirer.js +1 -1
- package/lib/commands/menu/shared/local-pages.js +1 -1
- package/lib/commands/menu/shared/logic.js +1 -1
- package/lib/commands/menu/shared/service.js +1 -1
- package/lib/commands/menu/shared/sync-core.js +1 -1
- package/lib/commands/menu/shared/update-core.js +1 -1
- package/lib/commands/menu/shared/valid-url.js +1 -1
- package/lib/commands/menu/sync.js +1 -1
- package/lib/commands/menu/update.js +1 -1
- package/lib/commands/page/generate-start.js +1 -1
- package/lib/commands/page/generate-status.js +1 -1
- package/lib/commands/page/index.js +1 -1
- package/lib/commands/page/pull.js +1 -1
- package/lib/commands/page/push.js +1 -1
- package/lib/commands/page/relation-audit.js +1 -1
- package/lib/commands/page/shared.js +1 -1
- package/lib/commands/page/standard-page-status.js +1 -1
- package/lib/commands/page/sync.js +1 -1
- package/lib/commands/permit/index.js +1 -1
- package/lib/commands/permit/page-get.js +1 -1
- package/lib/commands/permit/page-set.js +1 -1
- package/lib/commands/permit/role-apis-set.js +1 -1
- package/lib/commands/permit/role-menus-set.js +1 -1
- package/lib/commands/permit/role-menus.js +1 -1
- package/lib/commands/permit/shared.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/role/create.js +1 -1
- package/lib/commands/role/delete.js +1 -1
- package/lib/commands/role/detail.js +1 -1
- package/lib/commands/role/index.js +1 -1
- package/lib/commands/role/list.js +1 -1
- package/lib/commands/role/shared.js +1 -1
- package/lib/commands/role/update.js +1 -1
- package/lib/commands/role/user-add.js +1 -1
- package/lib/commands/role/user-remove.js +1 -1
- package/lib/commands/role/user-resolve.js +1 -1
- package/lib/commands/run/index.js +1 -1
- package/lib/commands/schema.js +1 -1
- package/lib/commands/sql/create.js +1 -1
- package/lib/commands/sql/delete.js +1 -1
- package/lib/commands/sql/detail.js +1 -1
- package/lib/commands/sql/exec.js +1 -1
- package/lib/commands/sql/index.js +1 -1
- package/lib/commands/sql/list.js +1 -1
- package/lib/commands/sql/pull.js +1 -1
- package/lib/commands/sql/push.js +1 -1
- package/lib/commands/sql/save.js +1 -1
- package/lib/commands/sql/shared.js +1 -1
- package/lib/commands/sql/status.js +1 -1
- package/lib/commands/sql/validate.js +1 -1
- package/lib/commands/workspace/add.js +1 -1
- package/lib/commands/workspace/index.js +1 -1
- package/lib/commands/workspace/remove.js +1 -1
- package/lib/config/schema.js +1 -1
- package/lib/constant/cdn.js +1 -1
- package/lib/constant/cli.js +1 -1
- package/lib/constant/defaults.js +1 -1
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/constant/output.js +1 -1
- package/lib/constant/paths.js +1 -1
- package/lib/constant/risk.js +1 -1
- package/lib/context/app-resolver.js +1 -1
- package/lib/context/auth-resolver.js +1 -1
- package/lib/context/config-loader.js +1 -1
- package/lib/context.js +1 -1
- package/lib/core/alias-resolver.js +1 -1
- package/lib/core/api-client.js +1 -1
- package/lib/core/bff/config.js +1 -1
- package/lib/core/bff/file-system.js +1 -1
- package/lib/core/bff/hash.js +1 -1
- package/lib/core/bff/lock.js +1 -1
- package/lib/core/bff/utils.js +1 -1
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/page/file-system.js +1 -1
- package/lib/core/page/hash.js +1 -1
- package/lib/core/page/lock.js +1 -1
- package/lib/core/sql-sync/config.js +1 -1
- package/lib/core/sql-sync/file-system.js +1 -1
- package/lib/core/sql-sync/hash.js +1 -1
- package/lib/core/sql-sync/lock.js +1 -1
- package/lib/core/sql-sync/utils.js +1 -1
- package/lib/core/sql-validator.js +1 -1
- package/lib/errors.js +1 -1
- package/lib/framework/build-all-flags.js +1 -1
- package/lib/framework/flags.js +1 -1
- package/lib/framework/help.js +1 -1
- package/lib/framework/index.js +1 -1
- package/lib/framework/output.js +1 -1
- package/lib/framework/response.js +1 -1
- package/lib/framework/runner-alias.js +1 -1
- package/lib/framework/runner.js +1 -1
- package/lib/framework/schema-export.js +1 -1
- package/lib/framework/types.js +1 -1
- package/lib/generated/build-info.js +1 -1
- package/lib/help.js +1 -1
- package/lib/skills/main.js +1 -1
- package/lib/skills/npx-skills-add.js +1 -1
- package/lib/telemetry/cli-command-trace.js +1 -1
- package/lib/telemetry/cli-help-trace.js +1 -1
- package/lib/telemetry/ensure-cli-otel-config.js +1 -1
- package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
- package/lib/telemetry/send-cli-trace-log.js +1 -1
- package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
- package/lib/utils/ai_config.js +1 -1
- package/lib/utils/apply-jq-filter.js +1 -1
- package/lib/utils/cdn-config.js +1 -1
- package/lib/utils/check-sdk-version.js +1 -1
- package/lib/utils/cli-version-check.js +1 -1
- package/lib/utils/cli-version-policy.js +1 -1
- package/lib/utils/config.js +1 -1
- package/lib/utils/copy-directory.js +1 -1
- package/lib/utils/entity-with-id.js +1 -1
- package/lib/utils/file-utils.js +1 -1
- package/lib/utils/guides-cdn.js +1 -1
- package/lib/utils/http-client.js +1 -1
- package/lib/utils/is-non-interactive.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/params.js +1 -1
- package/lib/utils/platform.js +1 -1
- package/lib/utils/rules-cdn.js +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.js +1 -1
- package/lib/utils/update-notice.js +1 -1
- package/lib/utils/version.js +1 -1
- package/lib/utils/with-active-cookie.js +1 -1
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +1 -1
package/lib/commands/sql/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a156_0x19d547=a156_0x51bc;(function(_0x3956d3,_0x2d1a30){const _0x272ff2=a156_0x51bc,_0x5ab3ce=_0x3956d3();while(!![]){try{const _0xc2bec1=parseInt(_0x272ff2(0x1df))/0x1*(-parseInt(_0x272ff2(0x1e6))/0x2)+-parseInt(_0x272ff2(0x219))/0x3+-parseInt(_0x272ff2(0x215))/0x4+-parseInt(_0x272ff2(0x1e5))/0x5+-parseInt(_0x272ff2(0x1dc))/0x6*(-parseInt(_0x272ff2(0x1e0))/0x7)+parseInt(_0x272ff2(0x1fe))/0x8*(-parseInt(_0x272ff2(0x205))/0x9)+parseInt(_0x272ff2(0x1fc))/0xa;if(_0xc2bec1===_0x2d1a30)break;else _0x5ab3ce['push'](_0x5ab3ce['shift']());}catch(_0x2b407c){_0x5ab3ce['push'](_0x5ab3ce['shift']());}}}(a156_0x4d08,0x5fdf1));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';function a156_0x4d08(){const _0x19964e=['Filter\x20by\x20SQL\x20display\x20name','32220LJrlpS','pull','dbId','sqls','\x20SQL\x20file(s)\x20into\x20','lockFilePath','replace','appCode','message','lastSync','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','unchanged','filter','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','cancelled','mybatisXml','709740rHPtzX','boolean','sql','catch','963255RfCErK','toISOString','474oFlzRN','sqlCode','split','237612ylCEaE','36057GXzMXY','str','POST','description','\x20written,\x20','3762255gPDEbp','6YLJWeG','name','sqlName','tableData','\x20skipped,\x20','\x20failed','test','write','apps','No\x20remote\x20SQL\x20queries\x20matched.','Force\x20pull\x20cancelled.','trimStart','string','sqlRoot','path','push','Force\x20overwrite\x20local\x20unsynced\x20changes','join','bool','sqlRootDir','utf8','local\x20differs\x20from\x20remote','25116270Gmvkvi','sqlcode','1256vgUHOf','sqlContent','force','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','Would\x20pull\x20','length'];a156_0x4d08=function(){return _0x19964e;};return a156_0x4d08();}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(_0x775ff9,_0x2c3105){const _0x3a330c=a156_0x51bc,_0x4a2042=[];let _0x2412bf=0x1;while(!![]){const _0x3c4343=await listSqlQueries(_0x775ff9,{'currentPage':_0x2412bf,'pageSize':PAGE_SIZE,'sqlCode':_0x2c3105[_0x3a330c(0x1dd)],'sqlName':_0x2c3105[_0x3a330c(0x1e8)]}),_0xf61dcf=_0x3c4343[_0x3a330c(0x1e9)]??[];_0x4a2042['push'](..._0xf61dcf);if(_0xf61dcf[_0x3a330c(0x203)]===0x0)break;const _0x5b0eea=_0x3c4343['paging']?.['totalCount'];if(_0x5b0eea!=null?_0x4a2042[_0x3a330c(0x203)]>=_0x5b0eea:_0xf61dcf[_0x3a330c(0x203)]<PAGE_SIZE)break;_0x2412bf++;}return _0x4a2042;}async function ensureSqlContent(_0x5b556b){const _0x45f013=a156_0x51bc;if(_0x5b556b[_0x45f013(0x1ff)]!=null&&String(_0x5b556b[_0x45f013(0x1ff)])[_0x45f013(0x203)]>0x0)return _0x5b556b;return getSqlQueryDetail(_0x5b556b['sqlCode']);}export const sqlPull={'service':'sql','command':a156_0x19d547(0x206),'description':a156_0x19d547(0x212),'risk':a156_0x19d547(0x1ed),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a156_0x19d547(0x1e7),'type':a156_0x19d547(0x1f2),'description':a156_0x19d547(0x204)},{'name':a156_0x19d547(0x200),'type':a156_0x19d547(0x216),'description':a156_0x19d547(0x1f6)}],async 'dryRun'(_0x30a600){const _0x2a7079=a156_0x19d547,_0x21ce56=loadSqlProjectConfig(_0x30a600[_0x2a7079(0x20c)]),_0x51e32d=await readSqlLockFile(_0x21ce56[_0x2a7079(0x20a)]),{appLock:_0x701e83}=ensureSqlLockScope(_0x51e32d??createEmptySqlLock(),_0x21ce56['appCode'],_0x21ce56['sqlRoot'],_0x2a7079(0x206)),_0x1b0e58=await fetchAllSqlQueries(_0x30a600[_0x2a7079(0x20c)],{'sqlCode':_0x30a600[_0x2a7079(0x1e1)](_0x2a7079(0x1fd))||undefined,'sqlName':_0x30a600[_0x2a7079(0x1e1)](_0x2a7079(0x1e7))||undefined}),_0x1ea676=[];for(const _0x7b99c6 of _0x1b0e58){const _0x55a5ea=await ensureSqlContent(_0x7b99c6),_0x1198bc=ensureRemoteSqlContent(_0x55a5ea),_0x8d93ac=detectModeFromSql(_0x55a5ea),_0x493d06=_0x55a5ea['dbId']?await getDbName(_0x30a600[_0x2a7079(0x20c)],Number(_0x55a5ea[_0x2a7079(0x207)]))[_0x2a7079(0x218)](()=>undefined):undefined,_0x58141a=buildLocalSqlFileContent({'sqlCode':_0x55a5ea[_0x2a7079(0x1dd)],'sqlName':_0x55a5ea[_0x2a7079(0x1e8)],'dbId':_0x55a5ea['dbId']},_0x1198bc,{'dbName':_0x493d06,'mode':_0x8d93ac,'syncedAt':new Date()['toISOString'](),'description':_0x55a5ea[_0x2a7079(0x1e3)]}),_0x17ff0f=buildSqlLockEntry(_0x55a5ea,_0x1198bc,'',{'dbName':_0x493d06}),_0x4a38f2=resolveLocalSqlFilePath(_0x21ce56,_0x55a5ea['sqlCode'],_0x17ff0f);let _0x3004c2='would_pull',_0x56171e;if(await fileExists(_0x4a38f2)){const _0x5bee3c=await readFile(_0x4a38f2,_0x2a7079(0x1fa));isEquivalentPulledSqlFile(_0x5bee3c,_0x58141a,_0x8d93ac)?(_0x3004c2='skipped',_0x56171e='unchanged'):(_0x3004c2='conflict',_0x56171e='local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)');}_0x1ea676[_0x2a7079(0x1f5)]({'sqlCode':_0x55a5ea[_0x2a7079(0x1dd)],'sqlName':_0x55a5ea[_0x2a7079(0x1e8)],'filePath':_0x4a38f2,'status':_0x3004c2,'reason':_0x56171e});}return{'method':_0x2a7079(0x1e2),'url':_0x2a7079(0x201),'body':{'appCode':_0x30a600[_0x2a7079(0x20c)],'sqlCode':_0x30a600[_0x2a7079(0x1e1)](_0x2a7079(0x1fd))||null,'sqlName':_0x30a600[_0x2a7079(0x1e1)](_0x2a7079(0x1e7))||null,'files':_0x1ea676},'description':_0x2a7079(0x202)+_0x1ea676[_0x2a7079(0x203)]+_0x2a7079(0x209)+_0x21ce56[_0x2a7079(0x1f9)]};},async 'execute'(_0x4ea8c4){const _0x143d07=a156_0x19d547,_0x38c27c=loadSqlProjectConfig(_0x4ea8c4[_0x143d07(0x20c)]),_0x239e50=await readSqlLockFile(_0x38c27c['lockFilePath']),{lockData:_0x594aba,appLock:_0x1f98a6}=ensureSqlLockScope(_0x239e50??createEmptySqlLock(),_0x38c27c[_0x143d07(0x20c)],_0x38c27c[_0x143d07(0x1f3)],_0x143d07(0x206)),_0x1a5f12=_0x4ea8c4[_0x143d07(0x1f8)](_0x143d07(0x200)),_0x3be47b=await fetchAllSqlQueries(_0x4ea8c4['appCode'],{'sqlCode':_0x4ea8c4[_0x143d07(0x1e1)]('sqlcode')||undefined,'sqlName':_0x4ea8c4[_0x143d07(0x1e1)](_0x143d07(0x1e7))||undefined});if(_0x3be47b['length']===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x143d07(0x1ef)};const _0xd19cec=[],_0x5f067a=[];for(const _0x2ff81 of _0x3be47b){try{_0xd19cec['push'](await ensureSqlContent(_0x2ff81));}catch(_0x37e838){_0x5f067a['push']({'sqlCode':_0x2ff81[_0x143d07(0x1dd)],'error':_0x37e838 instanceof Error?_0x37e838[_0x143d07(0x20d)]:String(_0x37e838)});}}if(_0x1a5f12&&!_0x4ea8c4['nonInteractive']){let _0x190af1=![];for(const _0x2533a5 of _0xd19cec){const _0x57176d=detectModeFromSql(_0x2533a5),_0x55af91=_0x2533a5[_0x143d07(0x207)]?await getDbName(_0x4ea8c4[_0x143d07(0x20c)],Number(_0x2533a5['dbId']))[_0x143d07(0x218)](()=>undefined):undefined,_0xada290=buildLocalSqlFileContent({'sqlCode':_0x2533a5[_0x143d07(0x1dd)],'sqlName':_0x2533a5['sqlName'],'dbId':_0x2533a5[_0x143d07(0x207)]},ensureRemoteSqlContent(_0x2533a5),{'dbName':_0x55af91,'mode':_0x57176d,'syncedAt':new Date()['toISOString'](),'description':_0x2533a5[_0x143d07(0x1e3)]}),_0x1a72a0=resolveLocalSqlFilePath(_0x38c27c,_0x2533a5[_0x143d07(0x1dd)],buildSqlLockEntry(_0x2533a5,ensureRemoteSqlContent(_0x2533a5),'',{'dbName':_0x55af91}));if(await fileExists(_0x1a72a0)){const _0x3be062=await readFile(_0x1a72a0,_0x143d07(0x1fa));if(!isEquivalentPulledSqlFile(_0x3be062,_0xada290,_0x57176d)){_0x190af1=!![];break;}}}if(_0x190af1){const _0x113632=await confirmForceOverwrite(_0x143d07(0x20f));if(!_0x113632)throw CliErrors[_0x143d07(0x213)](_0x143d07(0x1f0));}}const _0x194815=cloneSqlLockData(_0x594aba),_0x27d203=_0x194815[_0x143d07(0x1ee)][_0x38c27c['appCode']],_0x2590ff=[],_0x28ad94=[];for(const _0x34722e of _0xd19cec){const _0x2e137b=_0x27d203[_0x143d07(0x208)][_0x34722e[_0x143d07(0x1dd)]],_0x4740ba=ensureRemoteSqlContent(_0x34722e),_0x3ad104=detectModeFromSql(_0x34722e),_0x317fdc=_0x34722e[_0x143d07(0x207)]?await getDbName(_0x4ea8c4['appCode'],Number(_0x34722e[_0x143d07(0x207)]))[_0x143d07(0x218)](()=>undefined):undefined,_0x5c8f54=buildLocalSqlFileContent({'sqlCode':_0x34722e[_0x143d07(0x1dd)],'sqlName':_0x34722e[_0x143d07(0x1e8)],'dbId':_0x34722e[_0x143d07(0x207)]},_0x4740ba,{'dbName':_0x317fdc,'mode':_0x3ad104,'syncedAt':new Date()[_0x143d07(0x1db)](),'description':_0x34722e['description']}),_0x57ead7=buildSqlLockEntry(_0x34722e,_0x4740ba,computeSqlContentHash(_0x5c8f54),{'dbName':_0x317fdc}),_0x312079=_0x57ead7[_0x143d07(0x1f4)],_0x3535c0=join(_0x38c27c[_0x143d07(0x1f9)],_0x312079);try{if(await fileExists(_0x3535c0)){const _0x55ac20=await readFile(_0x3535c0,_0x143d07(0x1fa));if(isEquivalentPulledSqlFile(_0x55ac20,_0x5c8f54,_0x3ad104)){_0x28ad94[_0x143d07(0x1f5)]({'sqlCode':_0x34722e[_0x143d07(0x1dd)],'reason':_0x143d07(0x210)}),_0x27d203[_0x143d07(0x208)][_0x34722e['sqlCode']]={..._0x57ead7,'hash':computeSqlContentHash(_0x55ac20),'path':_0x312079};continue;}if(!_0x1a5f12){_0x28ad94['push']({'sqlCode':_0x34722e[_0x143d07(0x1dd)],'reason':_0x143d07(0x1fb)});continue;}}const _0x16b1f9=_0x2e137b?.[_0x143d07(0x1f4)]?join(_0x38c27c[_0x143d07(0x1f9)],_0x2e137b['path']):undefined;_0x16b1f9&&_0x16b1f9!==_0x3535c0&&await fileExists(_0x16b1f9)&&await rm(_0x16b1f9,{'force':!![]}),await ensureParentDirectory(_0x3535c0),await writeFile(_0x3535c0,_0x5c8f54,_0x143d07(0x1fa)),_0x27d203[_0x143d07(0x208)][_0x34722e[_0x143d07(0x1dd)]]={..._0x57ead7,'path':_0x312079},_0x2590ff['push']({'sqlCode':_0x34722e[_0x143d07(0x1dd)],'filePath':_0x3535c0});}catch(_0x287486){_0x5f067a[_0x143d07(0x1f5)]({'sqlCode':_0x34722e[_0x143d07(0x1dd)],'error':_0x287486 instanceof Error?_0x287486[_0x143d07(0x20d)]:String(_0x287486)});}}return _0x27d203[_0x143d07(0x20e)]=new Date()['toISOString'](),await writeSqlLockFile(_0x38c27c['lockFilePath'],_0x194815),{'ok':_0x5f067a['length']===0x0,'data':{'pulled':_0x2590ff,'skipped':_0x28ad94,'failed':_0x5f067a},'message':'Pull\x20complete:\x20'+_0x2590ff[_0x143d07(0x203)]+_0x143d07(0x1e4)+_0x28ad94[_0x143d07(0x203)]+_0x143d07(0x1ea)+_0x5f067a[_0x143d07(0x203)]+_0x143d07(0x1eb)};}};function detectModeFromSql(_0x2ee725){const _0x11f6e1=a156_0x19d547,_0x8db7f=ensureRemoteSqlContent(_0x2ee725),_0x2b39bb=stripLocalSqlMetadata(_0x8db7f,_0x11f6e1(0x214))[_0x11f6e1(0x1f1)]();if(/^<(select|insert|update|delete)\b/i[_0x11f6e1(0x1ec)](_0x2b39bb))return'mybatisXml';return _0x11f6e1(0x217);}function isEquivalentPulledSqlFile(_0x413d0a,_0x106146,_0x4091bc){return normalizePullComparableContent(_0x413d0a,_0x4091bc)===normalizePullComparableContent(_0x106146,_0x4091bc);}function normalizePullComparableContent(_0x4ee8f8,_0x163773){const _0x482b63=a156_0x19d547,_0x2b9502=_0x4ee8f8[_0x482b63(0x20b)](/\r\n/g,'\x0a')[_0x482b63(0x1de)]('\x0a'),_0x13035d=_0x2b9502[_0x482b63(0x211)](_0x2717b1=>!isSyncedAtMetadataLine(_0x2717b1,_0x163773));return _0x13035d[_0x482b63(0x1f7)]('\x0a');}function a156_0x51bc(_0xb9702e,_0x3a99be){_0xb9702e=_0xb9702e-0x1db;const _0x4d0827=a156_0x4d08();let _0x51bc6f=_0x4d0827[_0xb9702e];return _0x51bc6f;}function isSyncedAtMetadataLine(_0x1fde0c,_0x2ea2ce){const _0x59d509=a156_0x19d547;if(_0x2ea2ce==='mybatisXml')return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x59d509(0x1ec)](_0x1fde0c);return/^\s*--\s*@lovrabet\.syncedAt:/['test'](_0x1fde0c);}
|
|
1
|
+
const a156_0x22638b=a156_0x23d2;(function(_0x2c6b69,_0x20727c){const _0x49c3fb=a156_0x23d2,_0x215a97=_0x2c6b69();while(!![]){try{const _0x208709=-parseInt(_0x49c3fb(0x144))/0x1*(-parseInt(_0x49c3fb(0x12c))/0x2)+parseInt(_0x49c3fb(0x124))/0x3*(parseInt(_0x49c3fb(0x153))/0x4)+-parseInt(_0x49c3fb(0x12a))/0x5+parseInt(_0x49c3fb(0x154))/0x6*(-parseInt(_0x49c3fb(0x137))/0x7)+parseInt(_0x49c3fb(0x134))/0x8*(-parseInt(_0x49c3fb(0x132))/0x9)+parseInt(_0x49c3fb(0x13d))/0xa*(parseInt(_0x49c3fb(0x13c))/0xb)+-parseInt(_0x49c3fb(0x138))/0xc*(-parseInt(_0x49c3fb(0x128))/0xd);if(_0x208709===_0x20727c)break;else _0x215a97['push'](_0x215a97['shift']());}catch(_0x1d0c16){_0x215a97['push'](_0x215a97['shift']());}}}(a156_0x1b54,0x6c9e2));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';function a156_0x1b54(){const _0xb0480c=['30643YcuTxX','boolean','message','trimStart','pull','skipped','cancelled','join','bool','sql','appCode','utf8','No\x20remote\x20SQL\x20queries\x20matched.','catch','mybatisXml','92bdRpCp','78kCkiqe','paging','Force\x20overwrite\x20local\x20unsynced\x20changes','sqlCode','local\x20differs\x20from\x20remote','totalCount','POST','string','push','replace','sqlContent','name','toISOString','unchanged','description','length','\x20skipped,\x20','str','71751OPmmJj','path','nonInteractive','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','91TXGkTN','\x20written,\x20','3982745kFeozd','would_pull','30mLOBVq','sqlRoot','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','\x20failed','Would\x20pull\x20','force','1105002aiQiQL','sqlRootDir','8AohNKC','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','sqlName','457338PtXWrC','1928676MtWoHt','lockFilePath','filter','conflict','173294twxVqL','50vwbsMB','apps','sqls','test','dbId','sqlcode','lastSync'];a156_0x1b54=function(){return _0xb0480c;};return a156_0x1b54();}function a156_0x23d2(_0x2b11fc,_0x14f889){_0x2b11fc=_0x2b11fc-0x11a;const _0x1b54f7=a156_0x1b54();let _0x23d25c=_0x1b54f7[_0x2b11fc];return _0x23d25c;}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(_0x5b0585,_0x46c845){const _0x5c95d1=a156_0x23d2,_0x394647=[];let _0x329990=0x1;while(!![]){const _0x3dc9e5=await listSqlQueries(_0x5b0585,{'currentPage':_0x329990,'pageSize':PAGE_SIZE,'sqlCode':_0x46c845['sqlCode'],'sqlName':_0x46c845[_0x5c95d1(0x136)]}),_0x3662a6=_0x3dc9e5['tableData']??[];_0x394647['push'](..._0x3662a6);if(_0x3662a6[_0x5c95d1(0x121)]===0x0)break;const _0x2360c8=_0x3dc9e5[_0x5c95d1(0x155)]?.[_0x5c95d1(0x159)];if(_0x2360c8!=null?_0x394647['length']>=_0x2360c8:_0x3662a6[_0x5c95d1(0x121)]<PAGE_SIZE)break;_0x329990++;}return _0x394647;}async function ensureSqlContent(_0x501626){const _0x4259e5=a156_0x23d2;if(_0x501626[_0x4259e5(0x11c)]!=null&&String(_0x501626[_0x4259e5(0x11c)])[_0x4259e5(0x121)]>0x0)return _0x501626;return getSqlQueryDetail(_0x501626['sqlCode']);}export const sqlPull={'service':a156_0x22638b(0x14d),'command':a156_0x22638b(0x148),'description':a156_0x22638b(0x135),'risk':'write','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a156_0x22638b(0x11d),'type':a156_0x22638b(0x15b),'description':'Filter\x20by\x20SQL\x20display\x20name'},{'name':a156_0x22638b(0x131),'type':a156_0x22638b(0x145),'description':a156_0x22638b(0x156)}],async 'dryRun'(_0x30fd5d){const _0xa96160=a156_0x22638b,_0x31eef7=loadSqlProjectConfig(_0x30fd5d[_0xa96160(0x14e)]),_0x323135=await readSqlLockFile(_0x31eef7[_0xa96160(0x139)]),{appLock:_0x286c6d}=ensureSqlLockScope(_0x323135??createEmptySqlLock(),_0x31eef7[_0xa96160(0x14e)],_0x31eef7[_0xa96160(0x12d)],_0xa96160(0x148)),_0x4d32fb=await fetchAllSqlQueries(_0x30fd5d['appCode'],{'sqlCode':_0x30fd5d[_0xa96160(0x123)](_0xa96160(0x142))||undefined,'sqlName':_0x30fd5d['str'](_0xa96160(0x11d))||undefined}),_0x47b136=[];for(const _0x292ccf of _0x4d32fb){const _0x4c84b3=await ensureSqlContent(_0x292ccf),_0x8c6e94=ensureRemoteSqlContent(_0x4c84b3),_0x56d873=detectModeFromSql(_0x4c84b3),_0x42fa9c=_0x4c84b3[_0xa96160(0x141)]?await getDbName(_0x30fd5d['appCode'],Number(_0x4c84b3[_0xa96160(0x141)]))[_0xa96160(0x151)](()=>undefined):undefined,_0x5b8e87=buildLocalSqlFileContent({'sqlCode':_0x4c84b3['sqlCode'],'sqlName':_0x4c84b3['sqlName'],'dbId':_0x4c84b3[_0xa96160(0x141)]},_0x8c6e94,{'dbName':_0x42fa9c,'mode':_0x56d873,'syncedAt':new Date()[_0xa96160(0x11e)](),'description':_0x4c84b3['description']}),_0x4e500c=buildSqlLockEntry(_0x4c84b3,_0x8c6e94,'',{'dbName':_0x42fa9c}),_0x3c7022=resolveLocalSqlFilePath(_0x31eef7,_0x4c84b3['sqlCode'],_0x4e500c);let _0x1a74bb=_0xa96160(0x12b),_0x570f52;if(await fileExists(_0x3c7022)){const _0x46308f=await readFile(_0x3c7022,_0xa96160(0x14f));isEquivalentPulledSqlFile(_0x46308f,_0x5b8e87,_0x56d873)?(_0x1a74bb=_0xa96160(0x149),_0x570f52='unchanged'):(_0x1a74bb=_0xa96160(0x13b),_0x570f52=_0xa96160(0x12e));}_0x47b136[_0xa96160(0x11a)]({'sqlCode':_0x4c84b3[_0xa96160(0x157)],'sqlName':_0x4c84b3[_0xa96160(0x136)],'filePath':_0x3c7022,'status':_0x1a74bb,'reason':_0x570f52});}return{'method':_0xa96160(0x15a),'url':_0xa96160(0x127),'body':{'appCode':_0x30fd5d[_0xa96160(0x14e)],'sqlCode':_0x30fd5d[_0xa96160(0x123)](_0xa96160(0x142))||null,'sqlName':_0x30fd5d['str']('name')||null,'files':_0x47b136},'description':_0xa96160(0x130)+_0x47b136['length']+'\x20SQL\x20file(s)\x20into\x20'+_0x31eef7[_0xa96160(0x133)]};},async 'execute'(_0x237c60){const _0x247a9a=a156_0x22638b,_0x5dcfdd=loadSqlProjectConfig(_0x237c60[_0x247a9a(0x14e)]),_0x58f65b=await readSqlLockFile(_0x5dcfdd[_0x247a9a(0x139)]),{lockData:_0x4bcd06,appLock:_0x33e479}=ensureSqlLockScope(_0x58f65b??createEmptySqlLock(),_0x5dcfdd['appCode'],_0x5dcfdd['sqlRoot'],_0x247a9a(0x148)),_0x44a4a5=_0x237c60[_0x247a9a(0x14c)](_0x247a9a(0x131)),_0x384cae=await fetchAllSqlQueries(_0x237c60[_0x247a9a(0x14e)],{'sqlCode':_0x237c60[_0x247a9a(0x123)]('sqlcode')||undefined,'sqlName':_0x237c60[_0x247a9a(0x123)](_0x247a9a(0x11d))||undefined});if(_0x384cae[_0x247a9a(0x121)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x247a9a(0x150)};const _0x4a8560=[],_0x4feac5=[];for(const _0x5591c1 of _0x384cae){try{_0x4a8560[_0x247a9a(0x11a)](await ensureSqlContent(_0x5591c1));}catch(_0x633e3f){_0x4feac5[_0x247a9a(0x11a)]({'sqlCode':_0x5591c1[_0x247a9a(0x157)],'error':_0x633e3f instanceof Error?_0x633e3f[_0x247a9a(0x146)]:String(_0x633e3f)});}}if(_0x44a4a5&&!_0x237c60[_0x247a9a(0x126)]){let _0x5c4a0a=![];for(const _0x417771 of _0x4a8560){const _0x845858=detectModeFromSql(_0x417771),_0xdc3495=_0x417771['dbId']?await getDbName(_0x237c60[_0x247a9a(0x14e)],Number(_0x417771['dbId']))[_0x247a9a(0x151)](()=>undefined):undefined,_0x1775df=buildLocalSqlFileContent({'sqlCode':_0x417771[_0x247a9a(0x157)],'sqlName':_0x417771[_0x247a9a(0x136)],'dbId':_0x417771[_0x247a9a(0x141)]},ensureRemoteSqlContent(_0x417771),{'dbName':_0xdc3495,'mode':_0x845858,'syncedAt':new Date()[_0x247a9a(0x11e)](),'description':_0x417771[_0x247a9a(0x120)]}),_0x361b53=resolveLocalSqlFilePath(_0x5dcfdd,_0x417771[_0x247a9a(0x157)],buildSqlLockEntry(_0x417771,ensureRemoteSqlContent(_0x417771),'',{'dbName':_0xdc3495}));if(await fileExists(_0x361b53)){const _0x485029=await readFile(_0x361b53,_0x247a9a(0x14f));if(!isEquivalentPulledSqlFile(_0x485029,_0x1775df,_0x845858)){_0x5c4a0a=!![];break;}}}if(_0x5c4a0a){const _0x3c5374=await confirmForceOverwrite('Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.');if(!_0x3c5374)throw CliErrors[_0x247a9a(0x14a)]('Force\x20pull\x20cancelled.');}}const _0x19a134=cloneSqlLockData(_0x4bcd06),_0x75d743=_0x19a134[_0x247a9a(0x13e)][_0x5dcfdd[_0x247a9a(0x14e)]],_0x303ac2=[],_0x2b5e4f=[];for(const _0x4472f1 of _0x4a8560){const _0x171e39=_0x75d743['sqls'][_0x4472f1['sqlCode']],_0x2a491a=ensureRemoteSqlContent(_0x4472f1),_0x317a1f=detectModeFromSql(_0x4472f1),_0x1b891e=_0x4472f1[_0x247a9a(0x141)]?await getDbName(_0x237c60[_0x247a9a(0x14e)],Number(_0x4472f1['dbId']))[_0x247a9a(0x151)](()=>undefined):undefined,_0x3f736c=buildLocalSqlFileContent({'sqlCode':_0x4472f1[_0x247a9a(0x157)],'sqlName':_0x4472f1[_0x247a9a(0x136)],'dbId':_0x4472f1[_0x247a9a(0x141)]},_0x2a491a,{'dbName':_0x1b891e,'mode':_0x317a1f,'syncedAt':new Date()[_0x247a9a(0x11e)](),'description':_0x4472f1[_0x247a9a(0x120)]}),_0x330689=buildSqlLockEntry(_0x4472f1,_0x2a491a,computeSqlContentHash(_0x3f736c),{'dbName':_0x1b891e}),_0x3413ad=_0x330689['path'],_0x2f23b9=join(_0x5dcfdd[_0x247a9a(0x133)],_0x3413ad);try{if(await fileExists(_0x2f23b9)){const _0x310424=await readFile(_0x2f23b9,_0x247a9a(0x14f));if(isEquivalentPulledSqlFile(_0x310424,_0x3f736c,_0x317a1f)){_0x2b5e4f[_0x247a9a(0x11a)]({'sqlCode':_0x4472f1[_0x247a9a(0x157)],'reason':_0x247a9a(0x11f)}),_0x75d743['sqls'][_0x4472f1[_0x247a9a(0x157)]]={..._0x330689,'hash':computeSqlContentHash(_0x310424),'path':_0x3413ad};continue;}if(!_0x44a4a5){_0x2b5e4f[_0x247a9a(0x11a)]({'sqlCode':_0x4472f1[_0x247a9a(0x157)],'reason':_0x247a9a(0x158)});continue;}}const _0x381a31=_0x171e39?.[_0x247a9a(0x125)]?join(_0x5dcfdd['sqlRootDir'],_0x171e39[_0x247a9a(0x125)]):undefined;_0x381a31&&_0x381a31!==_0x2f23b9&&await fileExists(_0x381a31)&&await rm(_0x381a31,{'force':!![]}),await ensureParentDirectory(_0x2f23b9),await writeFile(_0x2f23b9,_0x3f736c,_0x247a9a(0x14f)),_0x75d743[_0x247a9a(0x13f)][_0x4472f1['sqlCode']]={..._0x330689,'path':_0x3413ad},_0x303ac2['push']({'sqlCode':_0x4472f1[_0x247a9a(0x157)],'filePath':_0x2f23b9});}catch(_0x552c38){_0x4feac5[_0x247a9a(0x11a)]({'sqlCode':_0x4472f1[_0x247a9a(0x157)],'error':_0x552c38 instanceof Error?_0x552c38['message']:String(_0x552c38)});}}return _0x75d743[_0x247a9a(0x143)]=new Date()[_0x247a9a(0x11e)](),await writeSqlLockFile(_0x5dcfdd[_0x247a9a(0x139)],_0x19a134),{'ok':_0x4feac5['length']===0x0,'data':{'pulled':_0x303ac2,'skipped':_0x2b5e4f,'failed':_0x4feac5},'message':'Pull\x20complete:\x20'+_0x303ac2[_0x247a9a(0x121)]+_0x247a9a(0x129)+_0x2b5e4f[_0x247a9a(0x121)]+_0x247a9a(0x122)+_0x4feac5[_0x247a9a(0x121)]+_0x247a9a(0x12f)};}};function detectModeFromSql(_0x414884){const _0x59a891=a156_0x22638b,_0x59540b=ensureRemoteSqlContent(_0x414884),_0x2e347e=stripLocalSqlMetadata(_0x59540b,_0x59a891(0x152))[_0x59a891(0x147)]();if(/^<(select|insert|update|delete)\b/i['test'](_0x2e347e))return _0x59a891(0x152);return _0x59a891(0x14d);}function isEquivalentPulledSqlFile(_0x54c83e,_0x1e343c,_0x3877e1){return normalizePullComparableContent(_0x54c83e,_0x3877e1)===normalizePullComparableContent(_0x1e343c,_0x3877e1);}function normalizePullComparableContent(_0x184fb5,_0x3f6639){const _0x267f68=a156_0x22638b,_0x11899e=_0x184fb5[_0x267f68(0x11b)](/\r\n/g,'\x0a')['split']('\x0a'),_0x29b2e2=_0x11899e[_0x267f68(0x13a)](_0x3860af=>!isSyncedAtMetadataLine(_0x3860af,_0x3f6639));return _0x29b2e2[_0x267f68(0x14b)]('\x0a');}function isSyncedAtMetadataLine(_0x564200,_0x3fe7bf){const _0x88a489=a156_0x22638b;if(_0x3fe7bf==='mybatisXml')return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x88a489(0x140)](_0x564200);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x88a489(0x140)](_0x564200);}
|
package/lib/commands/sql/push.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a157_0xc91b0f=a157_0x5660;(function(_0x463887,_0x170dc0){const _0x1dc419=a157_0x5660,_0x277862=_0x463887();while(!![]){try{const _0x1b57af=parseInt(_0x1dc419(0x126))/0x1+parseInt(_0x1dc419(0x140))/0x2*(parseInt(_0x1dc419(0x13b))/0x3)+parseInt(_0x1dc419(0x12d))/0x4*(parseInt(_0x1dc419(0x120))/0x5)+parseInt(_0x1dc419(0x114))/0x6+-parseInt(_0x1dc419(0x13f))/0x7*(-parseInt(_0x1dc419(0x134))/0x8)+-parseInt(_0x1dc419(0x132))/0x9+-parseInt(_0x1dc419(0x129))/0xa;if(_0x1b57af===_0x170dc0)break;else _0x277862['push'](_0x277862['shift']());}catch(_0x24281e){_0x277862['push'](_0x277862['shift']());}}}(a157_0x2c2b,0x9f33b));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';function a157_0x2c2b(){const _0xbad247=['21agJroH','high-risk-write','exec','\x20pushed,\x20','4886YbDxgr','15608kgMVZD','message','No\x20local\x20SQL\x20files\x20found.','entries','lockFilePath','filePath','\x20skipped,\x20','dbDirectory','path','/smartapi/custom/updateUserCustomSql','push','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','sqlRoot','dbName','bool','validation','map','isFinite','appCode','utf8','remoteId','unchanged','5045628BZJFif','sqls','filter','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','join','sqlCode','lastSync','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','POST','\x20failed','set','toISOString','5GfnKmN','get','relativePath','length','\x22\x20for\x20sqlCode\x20','\x20SQL\x20file(s)','23329lxeqgg','sqlcode','sqlRootDir','8850740EAzPCc','Local\x20SQL\x20not\x20found:\x20','force','projectRoot','3421604ZJlBkl','Push\x20complete:\x20','hash','dbId','catch','7492725BSfbtN','startsWith','6824yoZgXK','replace','mode','sqlName','trashDir','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','str'];a157_0x2c2b=function(){return _0xbad247;};return a157_0x2c2b();}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(_0x172bdf,_0x5cb435,_0x3bec68){const _0x48284a=a157_0x5660,_0x35576c=await scanLocalSqlQueries(_0x172bdf),_0x1d0d9b=new Map();for(const _0x21de04 of _0x35576c){if(_0x3bec68&&_0x21de04[_0x48284a(0x119)]!==_0x3bec68)continue;const _0x38726f=_0x1d0d9b[_0x48284a(0x121)](_0x21de04[_0x48284a(0x119)])??[];_0x38726f[_0x48284a(0x14a)](_0x21de04),_0x1d0d9b[_0x48284a(0x11e)](_0x21de04[_0x48284a(0x119)],_0x38726f);}if(_0x3bec68&&!_0x1d0d9b['has'](_0x3bec68))throw CliErrors[_0x48284a(0x10d)](_0x48284a(0x12a)+_0x3bec68);const _0x32fdb0=[];for(const [_0xc89969,_0x3188ae]of _0x1d0d9b[_0x48284a(0x143)]()){if(_0x3188ae['length']===0x1){_0x32fdb0['push'](_0x3188ae[0x0]);continue;}const _0x1a8d37=_0x5cb435[_0x48284a(0x115)][_0xc89969],_0x4ab094=_0x1a8d37?.[_0x48284a(0x148)],_0x378da1=_0x4ab094?_0x3188ae[_0x48284a(0x116)](_0x58061e=>_0x58061e[_0x48284a(0x122)]!==_0x4ab094):_0x3188ae;if(_0x1a8d37&&_0x378da1['length']===0x1){_0x32fdb0[_0x48284a(0x14a)](_0x378da1[0x0]);continue;}throw CliErrors[_0x48284a(0x10d)]('Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20'+_0xc89969+_0x48284a(0x14b));}return _0x32fdb0;}export const sqlPush={'service':'sql','command':a157_0xc91b0f(0x14a),'description':'Push\x20local\x20SQL\x20files\x20to\x20remote','risk':a157_0xc91b0f(0x13c),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a157_0xc91b0f(0x12b),'type':'boolean','description':a157_0xc91b0f(0x117)}],async 'dryRun'(_0x105948){const _0x5603de=a157_0xc91b0f,_0x55e906=loadSqlProjectConfig(_0x105948['appCode']),_0x8bf608=await readSqlLockFile(_0x55e906[_0x5603de(0x144)]),{appLock:_0x3f1b0d}=ensureSqlLockScope(_0x8bf608??createEmptySqlLock(),_0x105948[_0x5603de(0x110)],_0x55e906['sqlRoot'],'push'),_0x5dfb2e=await getTargetSqlQueries(_0x55e906,_0x3f1b0d,_0x105948[_0x5603de(0x13a)]('sqlcode')||undefined),_0x40ff2a=[];for(const _0x3a5193 of _0x5dfb2e){const _0x3060fd=await computeSqlFileHash(_0x3a5193[_0x5603de(0x145)]),_0x12c283=_0x3f1b0d['sqls'][_0x3a5193['sqlCode']],_0x229094=!!_0x12c283&&(_0x12c283[_0x5603de(0x148)]!==_0x3a5193[_0x5603de(0x122)]||!!_0x3a5193[_0x5603de(0x137)]&&_0x12c283[_0x5603de(0x137)]!==_0x3a5193['sqlName']);if(!_0x105948[_0x5603de(0x10c)](_0x5603de(0x12b))&&_0x12c283&&_0x12c283[_0x5603de(0x12f)]===_0x3060fd&&!_0x229094)continue;_0x40ff2a['push'](_0x3a5193[_0x5603de(0x119)]);}return{'method':_0x5603de(0x11c),'url':_0x5603de(0x149),'body':{'sqlCodes':_0x40ff2a,'appCode':_0x105948[_0x5603de(0x110)]},'description':'Would\x20push\x20'+_0x40ff2a['length']+_0x5603de(0x125)};},async 'execute'(_0x2fee15){const _0x31d6fb=a157_0xc91b0f,_0x671c5d=loadSqlProjectConfig(_0x2fee15['appCode']),_0x462edd=await readSqlLockFile(_0x671c5d[_0x31d6fb(0x144)]),{lockData:_0x29b41d,appLock:_0x2ab5eb}=ensureSqlLockScope(_0x462edd??createEmptySqlLock(),_0x2fee15[_0x31d6fb(0x110)],_0x671c5d[_0x31d6fb(0x14c)],_0x31d6fb(0x14a)),_0x5c00f0=await getTargetSqlQueries(_0x671c5d,_0x2ab5eb,_0x2fee15[_0x31d6fb(0x13a)](_0x31d6fb(0x127))||undefined);if(_0x5c00f0[_0x31d6fb(0x123)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x31d6fb(0x142)};const _0x308edb=[],_0x4165c2=[],_0x5b5e07=[];for(const _0x55e98c of _0x5c00f0){const _0x17691b=_0x2ab5eb[_0x31d6fb(0x115)][_0x55e98c[_0x31d6fb(0x119)]];if(!_0x17691b){_0x5b5e07['push']({'sqlCode':_0x55e98c['sqlCode'],'error':_0x31d6fb(0x11b)});continue;}try{const _0xb498de=await computeSqlFileHash(_0x55e98c[_0x31d6fb(0x145)]),_0x32b597=_0x17691b[_0x31d6fb(0x148)]!==_0x55e98c['relativePath']||!!_0x55e98c[_0x31d6fb(0x137)]&&_0x17691b[_0x31d6fb(0x137)]!==_0x55e98c[_0x31d6fb(0x137)];if(!_0x2fee15['bool']('force')&&_0x17691b[_0x31d6fb(0x12f)]===_0xb498de&&!_0x32b597){_0x4165c2['push']({'sqlCode':_0x55e98c[_0x31d6fb(0x119)],'reason':_0x31d6fb(0x113)});continue;}if(_0x17691b['version']==null){_0x5b5e07[_0x31d6fb(0x14a)]({'sqlCode':_0x55e98c[_0x31d6fb(0x119)],'error':_0x31d6fb(0x139)});continue;}const _0x43c58a=await readFile(_0x55e98c[_0x31d6fb(0x145)],_0x31d6fb(0x111)),_0x97f374=stripLocalSqlMetadata(_0x43c58a,_0x55e98c[_0x31d6fb(0x136)]),_0x3b3f34=_0x55e98c['sqlName']||_0x17691b[_0x31d6fb(0x137)],_0x403575=await resolveTargetDbBinding(_0x2fee15[_0x31d6fb(0x110)],_0x55e98c,_0x17691b),_0x3fd7e9=await updateSqlQuery({'id':_0x17691b[_0x31d6fb(0x112)],'appCode':_0x2fee15['appCode'],'sqlCode':_0x55e98c[_0x31d6fb(0x119)],'sqlName':_0x3b3f34,'dbId':_0x403575[_0x31d6fb(0x130)],'version':_0x17691b['version'],'sqlContent':_0x97f374,'sqlConfig':_0x17691b['sqlConfig']??undefined}),_0x3453da=_0x3fd7e9[_0x31d6fb(0x130)]?await getDbName(_0x2fee15[_0x31d6fb(0x110)],Number(_0x3fd7e9[_0x31d6fb(0x130)]))['catch'](()=>_0x403575[_0x31d6fb(0x10b)]):_0x403575[_0x31d6fb(0x10b)];_0x2ab5eb[_0x31d6fb(0x115)][_0x55e98c[_0x31d6fb(0x119)]]={...buildSqlLockEntry(_0x3fd7e9,_0x97f374,_0xb498de,{'dbName':_0x3453da}),'path':_0x55e98c[_0x31d6fb(0x122)],'mode':_0x17691b[_0x31d6fb(0x136)]},await archivePreviousSqlFileIfNeeded(_0x671c5d,_0x17691b[_0x31d6fb(0x148)],_0x55e98c[_0x31d6fb(0x122)]),_0x308edb[_0x31d6fb(0x14a)]({'sqlCode':_0x55e98c['sqlCode'],'remoteId':_0x17691b[_0x31d6fb(0x112)]});}catch(_0x443a5b){_0x5b5e07['push']({'sqlCode':_0x55e98c[_0x31d6fb(0x119)],'error':_0x443a5b instanceof Error?_0x443a5b[_0x31d6fb(0x141)]:String(_0x443a5b)});}}return _0x2ab5eb[_0x31d6fb(0x11a)]=new Date()[_0x31d6fb(0x11f)](),await writeSqlLockFile(_0x671c5d[_0x31d6fb(0x144)],_0x29b41d),{'ok':_0x5b5e07[_0x31d6fb(0x123)]===0x0,'data':{'pushed':_0x308edb,'skipped':_0x4165c2,'failed':_0x5b5e07},'message':_0x31d6fb(0x12e)+_0x308edb[_0x31d6fb(0x123)]+_0x31d6fb(0x13e)+_0x4165c2['length']+_0x31d6fb(0x146)+_0x5b5e07[_0x31d6fb(0x123)]+_0x31d6fb(0x11d)};}};async function archivePreviousSqlFileIfNeeded(_0x574c1e,_0x1e8217,_0xe1abaa){const _0x47b845=a157_0xc91b0f;if(!_0x1e8217||_0x1e8217===_0xe1abaa)return;const _0x5cf931=join(_0x574c1e[_0x47b845(0x128)],_0x1e8217);if(!await fileExists(_0x5cf931))return;const _0x106b57=await moveToTrash(_0x574c1e[_0x47b845(0x12c)],_0x574c1e[_0x47b845(0x138)],_0x5cf931);await cleanupEmptyDirectories(dirname(_0x5cf931),_0x574c1e[_0x47b845(0x128)]),void _0x106b57;}function a157_0x5660(_0x4aa85b,_0x1d6862){_0x4aa85b=_0x4aa85b-0x10b;const _0x2c2b8f=a157_0x2c2b();let _0x5660ed=_0x2c2b8f[_0x4aa85b];return _0x5660ed;}async function moveToTrash(_0x146819,_0x167f42,_0x4b76f5){const _0x2f28fc=a157_0xc91b0f,_0x6776da=new Date()['toISOString']()[_0x2f28fc(0x135)](/[:.]/g,'-'),_0x334844=relative(_0x146819,_0x4b76f5),_0x306fa9=join(_0x167f42,_0x6776da,_0x334844);return await mkdir(dirname(_0x306fa9),{'recursive':!![]}),await rename(_0x4b76f5,_0x306fa9),_0x306fa9;}async function cleanupEmptyDirectories(_0x2baeb5,_0x540ebf){const _0x7a01ce=a157_0xc91b0f;let _0x2492e5=resolve(_0x2baeb5);const _0x2fd386=resolve(_0x540ebf);while(_0x2492e5[_0x7a01ce(0x133)](''+_0x2fd386+sep)||_0x2492e5===_0x2fd386){if(_0x2492e5===_0x2fd386)return;try{const _0x3c1c21=await readdir(_0x2492e5);if(_0x3c1c21[_0x7a01ce(0x123)]>0x0)return;await rmdir(_0x2492e5);}catch{return;}_0x2492e5=dirname(_0x2492e5);}}async function resolveTargetDbBinding(_0x2bbdd8,_0x2be121,_0x1ad3be){const _0x1aed20=a157_0xc91b0f,_0x4be6ca=_0x2be121[_0x1aed20(0x147)];if(!_0x4be6ca)return{'dbId':_0x1ad3be[_0x1aed20(0x130)],'dbName':_0x1ad3be[_0x1aed20(0x10b)]};const _0x416c49=buildDbDirectoryName(_0x1ad3be[_0x1aed20(0x10b)],_0x1ad3be[_0x1aed20(0x130)]);if(_0x4be6ca===_0x416c49)return{'dbId':_0x1ad3be[_0x1aed20(0x130)],'dbName':_0x1ad3be[_0x1aed20(0x10b)]};const _0x3dadf3=parseExplicitDbDirectory(_0x4be6ca);if(_0x3dadf3!=null)return{'dbId':_0x3dadf3,'dbName':await getDbName(_0x2bbdd8,_0x3dadf3)[_0x1aed20(0x131)](()=>undefined)};const _0x3610e1=await listDatabases(_0x2bbdd8),_0x4f8eda=_0x3610e1['filter'](_0x199dda=>buildDbDirectoryName(_0x199dda[_0x1aed20(0x10b)],_0x199dda[_0x1aed20(0x130)])===_0x4be6ca);if(_0x4f8eda['length']===0x1)return{'dbId':_0x4f8eda[0x0][_0x1aed20(0x130)],'dbName':_0x4f8eda[0x0][_0x1aed20(0x10b)]};if(_0x4f8eda[_0x1aed20(0x123)]===0x0)throw CliErrors[_0x1aed20(0x10d)]('No\x20database\x20matches\x20local\x20directory\x20\x22'+_0x4be6ca+_0x1aed20(0x124)+_0x2be121[_0x1aed20(0x119)]+'.');const _0xdebce6=_0x4f8eda[_0x1aed20(0x10e)](_0x3ed967=>_0x3ed967[_0x1aed20(0x10b)]+'\x20('+_0x3ed967[_0x1aed20(0x130)]+')')[_0x1aed20(0x118)](',\x20');throw CliErrors[_0x1aed20(0x10d)]('Local\x20directory\x20\x22'+_0x4be6ca+'\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20'+_0x2be121['sqlCode']+':\x20'+_0xdebce6);}function parseExplicitDbDirectory(_0x7de341){const _0xa7f16f=a157_0xc91b0f,_0x5d6da8=/^db-(\d+)$/[_0xa7f16f(0x13d)](_0x7de341);if(!_0x5d6da8)return null;const _0xd21720=Number(_0x5d6da8[0x1]);return Number[_0xa7f16f(0x10f)](_0xd21720)&&_0xd21720>0x0?_0xd21720:null;}
|
|
1
|
+
function a157_0x341d(){const _0x50ca40=['entries','get','Local\x20SQL\x20not\x20found:\x20','8726630Qcdekf','\x20skipped,\x20','Push\x20local\x20SQL\x20files\x20to\x20remote','utf8','mode','validation','sqlConfig','sql','boolean','dbDirectory','sqlcode','6TZsIRm','push','force','2294704qJkDSI','startsWith','path','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','trashDir','1223568NRqahh','\x20pushed,\x20','1532LfqNIZ','18PaOAHz','filePath','sqlName','unchanged','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','2039742iojxcz','Would\x20push\x20','hash','\x20failed','length','has','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','replace','6795vHUpyz','27021sVMXHg','No\x20local\x20SQL\x20files\x20found.','POST','sqls','lastSync','version','exec','\x22\x20for\x20sqlCode\x20','isFinite','sqlCode','dbId','bool','lockFilePath','sqlRootDir','relativePath','dbName','toISOString','127715lybpoH','str','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','appCode','catch','remoteId','filter'];a157_0x341d=function(){return _0x50ca40;};return a157_0x341d();}const a157_0x803951=a157_0x4783;(function(_0x4ca230,_0xbcf76b){const _0x2661fd=a157_0x4783,_0x4a8c91=_0x4ca230();while(!![]){try{const _0x4a8ee0=parseInt(_0x2661fd(0xef))/0x1*(parseInt(_0x2661fd(0x120))/0x2)+parseInt(_0x2661fd(0x125))/0x3+-parseInt(_0x2661fd(0x11f))/0x4*(-parseInt(_0x2661fd(0xee))/0x5)+-parseInt(_0x2661fd(0x115))/0x6*(parseInt(_0x2661fd(0x100))/0x7)+-parseInt(_0x2661fd(0x118))/0x8+parseInt(_0x2661fd(0x11d))/0x9+-parseInt(_0x2661fd(0x10a))/0xa;if(_0x4a8ee0===_0xbcf76b)break;else _0x4a8c91['push'](_0x4a8c91['shift']());}catch(_0x572fe5){_0x4a8c91['push'](_0x4a8c91['shift']());}}}(a157_0x341d,0x6218e));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';function a157_0x4783(_0x1f8b23,_0xcfea5b){_0x1f8b23=_0x1f8b23-0xea;const _0x341dc9=a157_0x341d();let _0x4783b9=_0x341dc9[_0x1f8b23];return _0x4783b9;}import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';async function getTargetSqlQueries(_0x2ec631,_0x2af120,_0x768741){const _0xd964ee=a157_0x4783,_0x197152=await scanLocalSqlQueries(_0x2ec631),_0x1a3b41=new Map();for(const _0x20b5a4 of _0x197152){if(_0x768741&&_0x20b5a4[_0xd964ee(0xf8)]!==_0x768741)continue;const _0x4665d2=_0x1a3b41[_0xd964ee(0x108)](_0x20b5a4[_0xd964ee(0xf8)])??[];_0x4665d2['push'](_0x20b5a4),_0x1a3b41['set'](_0x20b5a4[_0xd964ee(0xf8)],_0x4665d2);}if(_0x768741&&!_0x1a3b41[_0xd964ee(0xeb)](_0x768741))throw CliErrors[_0xd964ee(0x10f)](_0xd964ee(0x109)+_0x768741);const _0x26a798=[];for(const [_0x51a2e1,_0x4452d6]of _0x1a3b41[_0xd964ee(0x107)]()){if(_0x4452d6[_0xd964ee(0xea)]===0x1){_0x26a798[_0xd964ee(0x116)](_0x4452d6[0x0]);continue;}const _0x27bf27=_0x2af120[_0xd964ee(0xf2)][_0x51a2e1],_0x37845f=_0x27bf27?.[_0xd964ee(0x11a)],_0x4ce0d3=_0x37845f?_0x4452d6[_0xd964ee(0x106)](_0x3ca31c=>_0x3ca31c[_0xd964ee(0xfd)]!==_0x37845f):_0x4452d6;if(_0x27bf27&&_0x4ce0d3[_0xd964ee(0xea)]===0x1){_0x26a798[_0xd964ee(0x116)](_0x4ce0d3[0x0]);continue;}throw CliErrors[_0xd964ee(0x10f)](_0xd964ee(0x11b)+_0x51a2e1+_0xd964ee(0x102));}return _0x26a798;}export const sqlPush={'service':a157_0x803951(0x111),'command':a157_0x803951(0x116),'description':a157_0x803951(0x10c),'risk':'high-risk-write','flags':[SQLCODE_FLAG_OPTIONAL,{'name':'force','type':a157_0x803951(0x112),'description':'Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock'}],async 'dryRun'(_0x181c53){const _0x198e4f=a157_0x803951,_0x368d16=loadSqlProjectConfig(_0x181c53[_0x198e4f(0x103)]),_0x433a68=await readSqlLockFile(_0x368d16[_0x198e4f(0xfb)]),{appLock:_0x5f40ea}=ensureSqlLockScope(_0x433a68??createEmptySqlLock(),_0x181c53[_0x198e4f(0x103)],_0x368d16['sqlRoot'],_0x198e4f(0x116)),_0x28aa0f=await getTargetSqlQueries(_0x368d16,_0x5f40ea,_0x181c53[_0x198e4f(0x101)](_0x198e4f(0x114))||undefined),_0x2002c6=[];for(const _0x2a82f0 of _0x28aa0f){const _0x516143=await computeSqlFileHash(_0x2a82f0[_0x198e4f(0x121)]),_0xe1b803=_0x5f40ea[_0x198e4f(0xf2)][_0x2a82f0['sqlCode']],_0x2b5fe3=!!_0xe1b803&&(_0xe1b803['path']!==_0x2a82f0[_0x198e4f(0xfd)]||!!_0x2a82f0['sqlName']&&_0xe1b803['sqlName']!==_0x2a82f0['sqlName']);if(!_0x181c53[_0x198e4f(0xfa)](_0x198e4f(0x117))&&_0xe1b803&&_0xe1b803[_0x198e4f(0x127)]===_0x516143&&!_0x2b5fe3)continue;_0x2002c6[_0x198e4f(0x116)](_0x2a82f0[_0x198e4f(0xf8)]);}return{'method':_0x198e4f(0xf1),'url':'/smartapi/custom/updateUserCustomSql','body':{'sqlCodes':_0x2002c6,'appCode':_0x181c53['appCode']},'description':_0x198e4f(0x126)+_0x2002c6['length']+'\x20SQL\x20file(s)'};},async 'execute'(_0x26f335){const _0x4b6a82=a157_0x803951,_0xdd62d3=loadSqlProjectConfig(_0x26f335[_0x4b6a82(0x103)]),_0x3d64ec=await readSqlLockFile(_0xdd62d3[_0x4b6a82(0xfb)]),{lockData:_0x2c707d,appLock:_0x539c86}=ensureSqlLockScope(_0x3d64ec??createEmptySqlLock(),_0x26f335['appCode'],_0xdd62d3['sqlRoot'],_0x4b6a82(0x116)),_0x2b4e8e=await getTargetSqlQueries(_0xdd62d3,_0x539c86,_0x26f335['str'](_0x4b6a82(0x114))||undefined);if(_0x2b4e8e[_0x4b6a82(0xea)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x4b6a82(0xf0)};const _0x2459a0=[],_0xdc36c7=[],_0x4a3655=[];for(const _0x423c85 of _0x2b4e8e){const _0x594b25=_0x539c86['sqls'][_0x423c85[_0x4b6a82(0xf8)]];if(!_0x594b25){_0x4a3655[_0x4b6a82(0x116)]({'sqlCode':_0x423c85[_0x4b6a82(0xf8)],'error':'local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first'});continue;}try{const _0x56b612=await computeSqlFileHash(_0x423c85['filePath']),_0x25a819=_0x594b25['path']!==_0x423c85[_0x4b6a82(0xfd)]||!!_0x423c85[_0x4b6a82(0x122)]&&_0x594b25[_0x4b6a82(0x122)]!==_0x423c85[_0x4b6a82(0x122)];if(!_0x26f335[_0x4b6a82(0xfa)](_0x4b6a82(0x117))&&_0x594b25[_0x4b6a82(0x127)]===_0x56b612&&!_0x25a819){_0xdc36c7[_0x4b6a82(0x116)]({'sqlCode':_0x423c85[_0x4b6a82(0xf8)],'reason':_0x4b6a82(0x123)});continue;}if(_0x594b25[_0x4b6a82(0xf4)]==null){_0x4a3655['push']({'sqlCode':_0x423c85[_0x4b6a82(0xf8)],'error':_0x4b6a82(0x124)});continue;}const _0x3a9b5c=await readFile(_0x423c85[_0x4b6a82(0x121)],_0x4b6a82(0x10d)),_0x513e3=stripLocalSqlMetadata(_0x3a9b5c,_0x423c85[_0x4b6a82(0x10e)]),_0x448955=_0x423c85['sqlName']||_0x594b25[_0x4b6a82(0x122)],_0x2c0a2b=await resolveTargetDbBinding(_0x26f335['appCode'],_0x423c85,_0x594b25),_0x16165b=await updateSqlQuery({'id':_0x594b25['remoteId'],'appCode':_0x26f335[_0x4b6a82(0x103)],'sqlCode':_0x423c85[_0x4b6a82(0xf8)],'sqlName':_0x448955,'dbId':_0x2c0a2b[_0x4b6a82(0xf9)],'version':_0x594b25[_0x4b6a82(0xf4)],'sqlContent':_0x513e3,'sqlConfig':_0x594b25[_0x4b6a82(0x110)]??undefined}),_0x5a4d3b=_0x16165b['dbId']?await getDbName(_0x26f335[_0x4b6a82(0x103)],Number(_0x16165b['dbId']))[_0x4b6a82(0x104)](()=>_0x2c0a2b[_0x4b6a82(0xfe)]):_0x2c0a2b[_0x4b6a82(0xfe)];_0x539c86[_0x4b6a82(0xf2)][_0x423c85[_0x4b6a82(0xf8)]]={...buildSqlLockEntry(_0x16165b,_0x513e3,_0x56b612,{'dbName':_0x5a4d3b}),'path':_0x423c85[_0x4b6a82(0xfd)],'mode':_0x594b25[_0x4b6a82(0x10e)]},await archivePreviousSqlFileIfNeeded(_0xdd62d3,_0x594b25[_0x4b6a82(0x11a)],_0x423c85[_0x4b6a82(0xfd)]),_0x2459a0['push']({'sqlCode':_0x423c85[_0x4b6a82(0xf8)],'remoteId':_0x594b25[_0x4b6a82(0x105)]});}catch(_0x2dc9b5){_0x4a3655[_0x4b6a82(0x116)]({'sqlCode':_0x423c85[_0x4b6a82(0xf8)],'error':_0x2dc9b5 instanceof Error?_0x2dc9b5['message']:String(_0x2dc9b5)});}}return _0x539c86[_0x4b6a82(0xf3)]=new Date()[_0x4b6a82(0xff)](),await writeSqlLockFile(_0xdd62d3['lockFilePath'],_0x2c707d),{'ok':_0x4a3655[_0x4b6a82(0xea)]===0x0,'data':{'pushed':_0x2459a0,'skipped':_0xdc36c7,'failed':_0x4a3655},'message':'Push\x20complete:\x20'+_0x2459a0[_0x4b6a82(0xea)]+_0x4b6a82(0x11e)+_0xdc36c7['length']+_0x4b6a82(0x10b)+_0x4a3655[_0x4b6a82(0xea)]+_0x4b6a82(0x128)};}};async function archivePreviousSqlFileIfNeeded(_0x58c81d,_0x3f111c,_0x43ca8f){const _0x29784d=a157_0x803951;if(!_0x3f111c||_0x3f111c===_0x43ca8f)return;const _0x42f507=join(_0x58c81d[_0x29784d(0xfc)],_0x3f111c);if(!await fileExists(_0x42f507))return;const _0x40b1bb=await moveToTrash(_0x58c81d['projectRoot'],_0x58c81d[_0x29784d(0x11c)],_0x42f507);await cleanupEmptyDirectories(dirname(_0x42f507),_0x58c81d[_0x29784d(0xfc)]),void _0x40b1bb;}async function moveToTrash(_0x14c7fa,_0x36acd8,_0x3afcec){const _0x3dba6a=a157_0x803951,_0x178583=new Date()[_0x3dba6a(0xff)]()[_0x3dba6a(0xed)](/[:.]/g,'-'),_0x3a2a53=relative(_0x14c7fa,_0x3afcec),_0x52c774=join(_0x36acd8,_0x178583,_0x3a2a53);return await mkdir(dirname(_0x52c774),{'recursive':!![]}),await rename(_0x3afcec,_0x52c774),_0x52c774;}async function cleanupEmptyDirectories(_0x51de28,_0x1f95b3){const _0x1903e6=a157_0x803951;let _0x3c65ba=resolve(_0x51de28);const _0x307f0e=resolve(_0x1f95b3);while(_0x3c65ba[_0x1903e6(0x119)](''+_0x307f0e+sep)||_0x3c65ba===_0x307f0e){if(_0x3c65ba===_0x307f0e)return;try{const _0x38d96d=await readdir(_0x3c65ba);if(_0x38d96d[_0x1903e6(0xea)]>0x0)return;await rmdir(_0x3c65ba);}catch{return;}_0x3c65ba=dirname(_0x3c65ba);}}async function resolveTargetDbBinding(_0x108088,_0x10dc88,_0x2e24ce){const _0x59168e=a157_0x803951,_0xa6ca9a=_0x10dc88[_0x59168e(0x113)];if(!_0xa6ca9a)return{'dbId':_0x2e24ce[_0x59168e(0xf9)],'dbName':_0x2e24ce[_0x59168e(0xfe)]};const _0x21701e=buildDbDirectoryName(_0x2e24ce[_0x59168e(0xfe)],_0x2e24ce[_0x59168e(0xf9)]);if(_0xa6ca9a===_0x21701e)return{'dbId':_0x2e24ce[_0x59168e(0xf9)],'dbName':_0x2e24ce[_0x59168e(0xfe)]};const _0x4518c3=parseExplicitDbDirectory(_0xa6ca9a);if(_0x4518c3!=null)return{'dbId':_0x4518c3,'dbName':await getDbName(_0x108088,_0x4518c3)[_0x59168e(0x104)](()=>undefined)};const _0x2b99ea=await listDatabases(_0x108088),_0x41fb13=_0x2b99ea[_0x59168e(0x106)](_0x9973fe=>buildDbDirectoryName(_0x9973fe['dbName'],_0x9973fe['dbId'])===_0xa6ca9a);if(_0x41fb13[_0x59168e(0xea)]===0x1)return{'dbId':_0x41fb13[0x0]['dbId'],'dbName':_0x41fb13[0x0][_0x59168e(0xfe)]};if(_0x41fb13['length']===0x0)throw CliErrors[_0x59168e(0x10f)]('No\x20database\x20matches\x20local\x20directory\x20\x22'+_0xa6ca9a+_0x59168e(0xf6)+_0x10dc88['sqlCode']+'.');const _0x997a07=_0x41fb13['map'](_0x9cc867=>_0x9cc867[_0x59168e(0xfe)]+'\x20('+_0x9cc867[_0x59168e(0xf9)]+')')['join'](',\x20');throw CliErrors[_0x59168e(0x10f)]('Local\x20directory\x20\x22'+_0xa6ca9a+_0x59168e(0xec)+_0x10dc88[_0x59168e(0xf8)]+':\x20'+_0x997a07);}function parseExplicitDbDirectory(_0x1df7ee){const _0x1d1006=a157_0x803951,_0x5a1e7f=/^db-(\d+)$/[_0x1d1006(0xf5)](_0x1df7ee);if(!_0x5a1e7f)return null;const _0x3f6625=Number(_0x5a1e7f[0x1]);return Number[_0x1d1006(0xf7)](_0x3f6625)&&_0x3f6625>0x0?_0x3f6625:null;}
|
package/lib/commands/sql/save.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a158_0x29b8c8=a158_0x51e3;(function(_0x1c8e7c,_0x2ee40b){const _0x2e154d=a158_0x51e3,_0x215235=_0x1c8e7c();while(!![]){try{const _0x4b5b88=-parseInt(_0x2e154d(0xd1))/0x1+-parseInt(_0x2e154d(0xd2))/0x2*(-parseInt(_0x2e154d(0xd8))/0x3)+parseInt(_0x2e154d(0xc6))/0x4+-parseInt(_0x2e154d(0xc7))/0x5+-parseInt(_0x2e154d(0xd5))/0x6+-parseInt(_0x2e154d(0xc9))/0x7+-parseInt(_0x2e154d(0xd4))/0x8*(-parseInt(_0x2e154d(0xcc))/0x9);if(_0x4b5b88===_0x2ee40b)break;else _0x215235['push'](_0x215235['shift']());}catch(_0x42221d){_0x215235['push'](_0x215235['shift']());}}}(a158_0x340a,0x72527));function a158_0x51e3(_0x45174b,_0x1f52b0){_0x45174b=_0x45174b-0xc4;const _0x340ad5=a158_0x340a();let _0x51e30b=_0x340ad5[_0x45174b];return _0x51e30b;}function a158_0x340a(){const _0x2b1cb5=['3VJRMgz','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`.','`rabetbase\x20sql\x20save`\x20has\x20been\x20deprecated.','2566528SOiCkt','112690mlUhdi','Deprecated:\x20use\x20sql\x20create\x20to\x20create\x20and\x20sql\x20push\x20to\x20update','3517143CWfDDd','sql','string','11871mKFlhD','Create\x20new\x20SQL\x20with\x20`rabetbase\x20sql\x20create\x20--name\x20<name>\x20--db-id\x20<id>\x20--mode\x20sql|mybatisXml`.','Query\x20description','file','join','262509nEdAMn','778388SpHYNj','validation','3152kkFJOQ','1768518LhISpI','save','SQL\x20query\x20display\x20name'];a158_0x340a=function(){return _0x2b1cb5;};return a158_0x340a();}import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';const SQL_SAVE_DEPRECATED_HINT=[a158_0x29b8c8(0xc5),a158_0x29b8c8(0xcd),a158_0x29b8c8(0xc4)][a158_0x29b8c8(0xd0)]('\x0a');export const sqlSave={'service':a158_0x29b8c8(0xca),'command':a158_0x29b8c8(0xd6),'description':a158_0x29b8c8(0xc8),'risk':'write','requiresAuth':![],'requiresAppCode':![],'flags':[{'name':a158_0x29b8c8(0xcf),'type':'string','required':!![],'description':'Path\x20to\x20the\x20SQL\x20file'},SQLCODE_FLAG_OPTIONAL,{'name':'sqlname','type':a158_0x29b8c8(0xcb),'description':a158_0x29b8c8(0xd7)},{'name':'db','type':'string','description':'Target\x20database\x20—\x20accepts\x20a\x20numeric\x20ID\x20or\x20database\x20name\x20(e.g.\x20ecommerce_db)'},{'name':'description','type':a158_0x29b8c8(0xcb),'description':a158_0x29b8c8(0xce)}],async 'validate'(){const _0x281b17=a158_0x29b8c8;throw CliErrors[_0x281b17(0xd3)](SQL_SAVE_DEPRECATED_HINT);},async 'execute'(){const _0x13161b=a158_0x29b8c8;throw CliErrors[_0x13161b(0xd3)](SQL_SAVE_DEPRECATED_HINT);}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a159_0x4abf66=a159_0x5a7e;(function(_0x1d86aa,_0x133268){const _0x48acfd=a159_0x5a7e,_0x695b09=_0x1d86aa();while(!![]){try{const _0x1ac132=-parseInt(_0x48acfd(0x150))/0x1*(-parseInt(_0x48acfd(0x13f))/0x2)+parseInt(_0x48acfd(0x13b))/0x3+-parseInt(_0x48acfd(0x145))/0x4*(-parseInt(_0x48acfd(0x159))/0x5)+-parseInt(_0x48acfd(0x13d))/0x6+-parseInt(_0x48acfd(0x14b))/0x7+parseInt(_0x48acfd(0x151))/0x8+-parseInt(_0x48acfd(0x14f))/0x9;if(_0x1ac132===_0x133268)break;else _0x695b09['push'](_0x695b09['shift']());}catch(_0x1a28f3){_0x695b09['push'](_0x695b09['shift']());}}}(a159_0x1415,0x531e5));import{createInterface}from'node:readline';import{join}from'node:path';import{buildDefaultSqlFileName,buildSqlRelativePath,detectSqlMode}from'../../core/sql-sync/utils.js';function a159_0x1415(){const _0x5a79ef=['2vLbLsB','4702368fznImD','dbId','sqlCode','version','.rabetbase/sql','includes','dbName','--\x20@lovrabet.','5OCjtpu','mode','fromEntries','yes','stderr','endsWith','question','path','toLowerCase','map','1465992KGvwyn','sqlName','2244474zhndsz','trimStart','358448OCLgIi','<!--\x20@lovrabet.','length','sqls','stdin','split','594952ubYGEy','push','entries','apps','trim','syncedAt','709982lVKBOj','mybatisXml','filter','test','6909192ggrEJR'];a159_0x1415=function(){return _0x5a79ef;};return a159_0x1415();}export const SQL_LOCAL_REL_DIR=a159_0x4abf66(0x155);export function buildSqlLockEntry(_0x5d94e,_0x58df8f,_0x217ef9,_0x47de4){const _0x521569=a159_0x4abf66,_0x308ebb=detectSqlMode(_0x58df8f);return{'path':buildSqlRelativePath(_0x5d94e[_0x521569(0x153)],_0x5d94e[_0x521569(0x13c)],_0x47de4?.[_0x521569(0x157)],_0x308ebb,_0x5d94e[_0x521569(0x152)]),'hash':_0x217ef9,'remoteId':_0x5d94e['id'],'version':_0x5d94e[_0x521569(0x154)],'dbId':Number(_0x5d94e['dbId']),'dbName':_0x47de4?.[_0x521569(0x157)],'sqlName':_0x5d94e[_0x521569(0x13c)],'sqlConfig':_0x5d94e['sqlConfig']??undefined,'mode':_0x308ebb};}export function cloneSqlLockData(_0x2749d1){const _0x22d44d=a159_0x4abf66;return{'apps':Object[_0x22d44d(0x15b)](Object[_0x22d44d(0x147)](_0x2749d1['apps'])[_0x22d44d(0x13a)](([_0x108502,_0x24d1dd])=>[_0x108502,{'sqlRoot':_0x24d1dd['sqlRoot'],'lastSync':_0x24d1dd['lastSync'],'sqls':{..._0x24d1dd[_0x22d44d(0x142)]}}]))};}export function ensureRemoteSqlContent(_0x12b9cc){return _0x12b9cc['sqlContent']??'';}export function buildLocalSqlFileContent(_0x3f990e,_0x31cd63,_0x3785e9){const _0x2d738a=a159_0x4abf66,_0x26d9b3=_0x3785e9?.[_0x2d738a(0x15a)]??detectSqlMode(_0x31cd63),_0xd38e9=stripLocalSqlMetadata(_0x31cd63,_0x26d9b3)[_0x2d738a(0x149)](),_0x326200=[...buildMetadataHeaderLines({'sqlCode':_0x3f990e['sqlCode'],'sqlName':_0x3f990e['sqlName'],'dbId':_0x3f990e[_0x2d738a(0x152)],'dbName':_0x3785e9?.['dbName'],'mode':_0x26d9b3,'syncedAt':_0x3785e9?.[_0x2d738a(0x14a)],'description':_0x3785e9?.['description']},_0x26d9b3),'',_0xd38e9],_0x698e94=_0x326200['join']('\x0a');return _0x698e94[_0x2d738a(0x136)]('\x0a')?_0x698e94:_0x698e94+'\x0a';}export function stripLocalSqlMetadata(_0x1b760b,_0x374483){const _0x57f49b=a159_0x4abf66,_0x241d47=_0x1b760b['replace'](/\r\n/g,'\x0a')[_0x57f49b(0x144)]('\x0a'),_0x1f2ce2=[];let _0x79ede4=0x0;if(_0x374483===_0x57f49b(0x14c))while(_0x79ede4<_0x241d47[_0x57f49b(0x141)]){const _0x17d8a2=_0x241d47[_0x79ede4]??'';if(/^\s*<!--\s*@lovrabet\./[_0x57f49b(0x14e)](_0x17d8a2)){_0x79ede4++;continue;}if(_0x17d8a2[_0x57f49b(0x149)]()===''&&_0x79ede4>0x0){_0x79ede4++;continue;}break;}else while(_0x79ede4<_0x241d47[_0x57f49b(0x141)]){const _0x405b9c=_0x241d47[_0x79ede4]??'';if(/^\s*--\s*@lovrabet\./[_0x57f49b(0x14e)](_0x405b9c)){_0x79ede4++;continue;}if(_0x405b9c['trim']()===''&&_0x79ede4>0x0){_0x79ede4++;continue;}break;}for(;_0x79ede4<_0x241d47[_0x57f49b(0x141)];_0x79ede4++){_0x1f2ce2[_0x57f49b(0x146)](_0x241d47[_0x79ede4]);}return _0x1f2ce2['join']('\x0a')[_0x57f49b(0x13e)]();}export function resolveSqlMode(_0x5a3b50,_0x4aa0ed){const _0x5cd978=a159_0x4abf66;if(_0x4aa0ed?.[_0x5cd978(0x15a)])return _0x4aa0ed['mode'];return detectSqlMode(_0x5a3b50);}export function resolveSqlFileName(_0x55f353,_0x210e2f,_0x48fdbf){const _0x5e07c=a159_0x4abf66;if(_0x48fdbf?.['path'])return _0x48fdbf[_0x5e07c(0x138)];if(_0x48fdbf?.[_0x5e07c(0x13c)]||_0x48fdbf?.[_0x5e07c(0x157)])return buildSqlRelativePath(_0x55f353,_0x48fdbf?.['sqlName'],_0x48fdbf?.[_0x5e07c(0x157)],resolveSqlMode(_0x210e2f,_0x48fdbf),_0x48fdbf?.['dbId']);return buildDefaultSqlFileName(_0x55f353,resolveSqlMode(_0x210e2f,_0x48fdbf));}export function resolveSqlLocalDir(_0x187487,_0x2ad943){return join(_0x187487,SQL_LOCAL_REL_DIR,_0x2ad943);}export async function confirmForceOverwrite(_0x50ce1c){const _0x1158f5=a159_0x4abf66,_0x1c3c19=createInterface({'input':process[_0x1158f5(0x143)],'output':process[_0x1158f5(0x15d)]}),_0x1b672d=await new Promise(_0x5b8c62=>{const _0x22e466=_0x1158f5;_0x1c3c19[_0x22e466(0x137)](_0x50ce1c+'\x20[y/N]\x20',_0x5b8c62);});return _0x1c3c19['close'](),['y',_0x1158f5(0x15c)][_0x1158f5(0x156)](_0x1b672d[_0x1158f5(0x149)]()[_0x1158f5(0x139)]());}export function findSqlLockScope(_0x356516,_0x538452){const _0x6b0923=a159_0x4abf66;return _0x356516[_0x6b0923(0x148)][_0x538452];}function a159_0x5a7e(_0x303b2b,_0x5a16fb){_0x303b2b=_0x303b2b-0x136;const _0x1415f3=a159_0x1415();let _0x5a7e49=_0x1415f3[_0x303b2b];return _0x5a7e49;}function buildMetadataHeaderLines(_0x2e8fb2,_0x1b2d18){const _0x355c51=a159_0x4abf66,_0x40cbe2=[[_0x355c51(0x153),_0x2e8fb2['sqlCode']],[_0x355c51(0x13c),_0x2e8fb2['sqlName']],['dbId',_0x2e8fb2[_0x355c51(0x152)]],['dbName',_0x2e8fb2[_0x355c51(0x157)]],[_0x355c51(0x15a),_0x2e8fb2['mode']],['syncedAt',_0x2e8fb2['syncedAt']],['description',_0x2e8fb2['description']]];if(_0x1b2d18===_0x355c51(0x14c))return _0x40cbe2[_0x355c51(0x14d)](([,_0x16dd2c])=>_0x16dd2c!==undefined&&_0x16dd2c!==null&&String(_0x16dd2c)[_0x355c51(0x149)]()!=='')[_0x355c51(0x13a)](([_0x5b8c64,_0x4edfe7])=>_0x355c51(0x140)+_0x5b8c64+':\x20'+String(_0x4edfe7)+'\x20-->');return _0x40cbe2[_0x355c51(0x14d)](([,_0x2271fd])=>_0x2271fd!==undefined&&_0x2271fd!==null&&String(_0x2271fd)[_0x355c51(0x149)]()!=='')[_0x355c51(0x13a)](([_0x5d7011,_0x3f1040])=>_0x355c51(0x158)+_0x5d7011+':\x20'+String(_0x3f1040));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a160_0x3ae450=a160_0x61e0;(function(_0x3db269,_0x2fac97){const _0x235640=a160_0x61e0,_0x45ab8d=_0x3db269();while(!![]){try{const _0x36f1dd=parseInt(_0x235640(0x127))/0x1*(parseInt(_0x235640(0x132))/0x2)+parseInt(_0x235640(0x125))/0x3+parseInt(_0x235640(0x120))/0x4*(parseInt(_0x235640(0x133))/0x5)+parseInt(_0x235640(0x12a))/0x6+-parseInt(_0x235640(0x12c))/0x7*(-parseInt(_0x235640(0x128))/0x8)+parseInt(_0x235640(0x11e))/0x9+parseInt(_0x235640(0x131))/0xa*(-parseInt(_0x235640(0x135))/0xb);if(_0x36f1dd===_0x2fac97)break;else _0x45ab8d['push'](_0x45ab8d['shift']());}catch(_0x179f28){_0x45ab8d['push'](_0x45ab8d['shift']());}}}(a160_0x39f5,0xbe962));function a160_0x39f5(){const _0x4e11b1=['All\x20SQL\x20queries\x20are\x20in\x20sync.','lockKey','\x20missing,\x20','sql','Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally','sqls','lockFilePath','hash','13192263QSRTEf','length','9260bxUuso','status','sqlCode','sqlName','sqlRoot','3475035hNMQUB','appCode','4SPQkrc','5338120ssenxk','filePath','6155526BkWTbq','has','14aQlCCv','\x20remote-only','path','tableData','\x20added,\x20','4116470IimsIY','60218QmwfJN','440XfIxDa','remote','121EeaDwT','totalCount','map','keys','bool','\x20modified,\x20','read','push'];a160_0x39f5=function(){return _0x4e11b1;};return a160_0x39f5();}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;async function fetchAllSqlCodes(_0x2548ee){const _0x51e4cf=a160_0x61e0,_0x50ea69=[];let _0x232e4e=0x1;while(!![]){const _0x446f5c=await listSqlQueries(_0x2548ee,{'currentPage':_0x232e4e,'pageSize':PAGE_SIZE}),_0x49f5af=_0x446f5c[_0x51e4cf(0x12f)]??[];_0x50ea69[_0x51e4cf(0x13c)](..._0x49f5af[_0x51e4cf(0x137)](_0x8ce6bb=>_0x8ce6bb[_0x51e4cf(0x122)]));if(_0x49f5af[_0x51e4cf(0x11f)]===0x0)break;const _0x300625=_0x446f5c['paging']?.[_0x51e4cf(0x136)];if(_0x300625!=null?_0x50ea69['length']>=_0x300625:_0x49f5af[_0x51e4cf(0x11f)]<PAGE_SIZE)break;_0x232e4e++;}return _0x50ea69;}function a160_0x61e0(_0x171fa8,_0x282d45){_0x171fa8=_0x171fa8-0x117;const _0x39f54f=a160_0x39f5();let _0x61e043=_0x39f54f[_0x171fa8];return _0x61e043;}export const sqlStatus={'service':a160_0x3ae450(0x119),'command':a160_0x3ae450(0x121),'description':'Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','risk':a160_0x3ae450(0x13b),'flags':[{'name':'remote','type':'boolean','description':a160_0x3ae450(0x11a)}],async 'execute'(_0x596d3f){const _0x320115=a160_0x3ae450,_0x3868ea=loadSqlProjectConfig(_0x596d3f['appCode']),_0x396340=await readSqlLockFile(_0x3868ea[_0x320115(0x11c)]),{appLock:_0x5cf9fa}=ensureSqlLockScope(_0x396340??createEmptySqlLock(),_0x3868ea[_0x320115(0x126)],_0x3868ea[_0x320115(0x124)],_0x320115(0x121)),_0x24dd56=await scanLocalSqlQueries(_0x3868ea),_0x1ca2f1=[],_0x42bb39=[],_0x58b4ab=[],_0x51347e=[],_0x2de57c=new Set(_0x24dd56[_0x320115(0x137)](_0x207d15=>_0x207d15[_0x320115(0x117)]));for(const _0x553eb7 of _0x24dd56){const _0x17a556=await computeSqlFileHash(_0x553eb7[_0x320115(0x129)]),_0x593566=_0x5cf9fa['sqls'][_0x553eb7[_0x320115(0x117)]],_0x3dc856=!!_0x593566&&_0x593566[_0x320115(0x12e)]!==_0x553eb7['relativePath'],_0x223333=!!_0x593566&&!!_0x553eb7[_0x320115(0x123)]&&_0x593566[_0x320115(0x123)]!==_0x553eb7['sqlName'];if(!_0x593566)_0x1ca2f1[_0x320115(0x13c)](_0x553eb7[_0x320115(0x117)]);else _0x593566[_0x320115(0x11d)]!==_0x17a556||_0x3dc856||_0x223333?_0x42bb39[_0x320115(0x13c)](_0x553eb7[_0x320115(0x117)]):_0x58b4ab[_0x320115(0x13c)](_0x553eb7['lockKey']);}for(const _0x4e3f5a of Object[_0x320115(0x138)](_0x5cf9fa['sqls'])){!_0x2de57c[_0x320115(0x12b)](_0x4e3f5a)&&_0x51347e[_0x320115(0x13c)](_0x4e3f5a);}const _0x2da76e=[];if(_0x596d3f[_0x320115(0x139)](_0x320115(0x134))){const _0x44f97a=await fetchAllSqlCodes(_0x596d3f['appCode']);for(const _0x2769f8 of _0x44f97a){!_0x2de57c['has'](_0x2769f8)&&!_0x5cf9fa[_0x320115(0x11b)][_0x2769f8]&&_0x2da76e[_0x320115(0x13c)](_0x2769f8);}}const _0x28c562=_0x1ca2f1['length']===0x0&&_0x42bb39[_0x320115(0x11f)]===0x0&&_0x51347e[_0x320115(0x11f)]===0x0&&_0x2da76e['length']===0x0;return{'ok':!![],'data':{'added':_0x1ca2f1,'modified':_0x42bb39,'missing':_0x51347e,'unchanged':_0x58b4ab,'remoteOnly':_0x2da76e},'message':_0x28c562?_0x320115(0x13d):_0x1ca2f1['length']+_0x320115(0x130)+_0x42bb39['length']+_0x320115(0x13a)+_0x51347e['length']+_0x320115(0x118)+_0x58b4ab[_0x320115(0x11f)]+'\x20unchanged'+(_0x2da76e[_0x320115(0x11f)]>0x0?',\x20'+_0x2da76e['length']+_0x320115(0x12d):'')};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a161_0x5706ea=a161_0x28dc;(function(_0x3529fa,_0x1c08f7){const _0xdd56=a161_0x28dc,_0x573057=_0x3529fa();while(!![]){try{const _0x49a3ae=-parseInt(_0xdd56(0x13c))/0x1*(parseInt(_0xdd56(0x151))/0x2)+-parseInt(_0xdd56(0x14a))/0x3*(parseInt(_0xdd56(0x127))/0x4)+parseInt(_0xdd56(0x12d))/0x5*(-parseInt(_0xdd56(0x154))/0x6)+-parseInt(_0xdd56(0x139))/0x7*(-parseInt(_0xdd56(0x138))/0x8)+parseInt(_0xdd56(0x147))/0x9+-parseInt(_0xdd56(0x145))/0xa+parseInt(_0xdd56(0x146))/0xb;if(_0x49a3ae===_0x1c08f7)break;else _0x573057['push'](_0x573057['shift']());}catch(_0x58d5c1){_0x573057['push'](_0x573057['shift']());}}}(a161_0x2d6a,0x9d137));import{readFileSync,existsSync}from'node:fs';import{resolve}from'node:path';import{validateSql}from'../../core/sql-validator.js';import{getDatasetDetail,listDatasets}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';function a161_0x28dc(_0x353c08,_0x30528b){_0x353c08=_0x353c08-0x125;const _0x2d6a6b=a161_0x2d6a();let _0x28dc5f=_0x2d6a6b[_0x353c08];return _0x28dc5f;}function a161_0x2d6a(){const _0x1b3a20=['3255776WGpuZg','14cBLiVj','message','fields','1ZFjWrH','name','get','isArray','file','\x22\x20not\x20found\x20in\x20any\x20dataset','trim','reason','map','4616510plDnnI','18030848VizcIU','1789623fuSlNd','toLowerCase','parameters','3JXkKzL','type','isSelectOnly','size','Table\x20\x22','SQL\x20schema\x20validation','Path\x20to\x20the\x20SQL\x20file\x20to\x20validate','1096890XTCjwJ','split','filter','6CnGJRk','sql','tableName','length','validation','Inline\x20SQL\x20content\x20to\x20validate\x20(alternative\x20to\x20--file)','Dataset\x20\x22','Provide\x20--file\x20or\x20--sql','sqlType','1108020WTMZWS','dbtableConfig','str','utf-8','Comma-separated\x20dataset\x20codes\x20to\x20cross-check\x20table/column\x20names\x20against','schemas','3607375FVzbbn','isDangerous','valid','validate','tables','Validate\x20SQL\x20content\x20without\x20saving\x20(type\x20detection,\x20parameter\x20extraction,\x20optional\x20schema\x20check)','cwd','string','File\x20not\x20found:\x20','push','flagMissing'];a161_0x2d6a=function(){return _0x1b3a20;};return a161_0x2d6a();}import{assertDatasetIsDbTableBacked,filterDbTableBackedDatasets}from'../../commands/dataset/capability.js';export const sqlValidate={'service':'sql','command':a161_0x5706ea(0x130),'description':a161_0x5706ea(0x132),'risk':'read','flags':[{'name':'file','type':a161_0x5706ea(0x134),'description':a161_0x5706ea(0x150)},{'name':a161_0x5706ea(0x155),'type':a161_0x5706ea(0x134),'description':a161_0x5706ea(0x159)},{'name':a161_0x5706ea(0x12c),'type':a161_0x5706ea(0x134),'description':a161_0x5706ea(0x12b)}],async 'execute'(_0x257505){const _0x5d6675=a161_0x5706ea,_0x2c2ebf=_0x257505[_0x5d6675(0x129)](_0x5d6675(0x140)),_0x40ac38=_0x257505[_0x5d6675(0x129)](_0x5d6675(0x155));if(!_0x2c2ebf&&!_0x40ac38)throw CliErrors[_0x5d6675(0x137)](_0x5d6675(0x140),_0x5d6675(0x125));let _0x269b49;if(_0x2c2ebf){const _0xe00785=resolve(process[_0x5d6675(0x133)](),_0x2c2ebf);if(!existsSync(_0xe00785))throw CliErrors[_0x5d6675(0x158)](_0x5d6675(0x135)+_0xe00785);_0x269b49=readFileSync(_0xe00785,_0x5d6675(0x12a));}else _0x269b49=_0x40ac38;const _0x548d03=validateSql(_0x269b49),_0x2b092e={'valid':_0x548d03[_0x5d6675(0x12f)],'sqlType':_0x548d03[_0x5d6675(0x126)][_0x5d6675(0x14b)],'isSelectOnly':_0x548d03['sqlType'][_0x5d6675(0x14c)],'isDangerous':_0x548d03[_0x5d6675(0x126)][_0x5d6675(0x12e)],'tables':_0x548d03[_0x5d6675(0x131)],'parameters':_0x548d03[_0x5d6675(0x149)],'message':_0x548d03[_0x5d6675(0x13a)]};_0x548d03[_0x5d6675(0x126)][_0x5d6675(0x143)]&&(_0x2b092e['reason']=_0x548d03[_0x5d6675(0x126)][_0x5d6675(0x143)]);const _0x304b90=_0x257505[_0x5d6675(0x129)](_0x5d6675(0x12c));if(_0x304b90&&_0x548d03[_0x5d6675(0x12f)]){const _0x4fc490=_0x304b90[_0x5d6675(0x152)](',')[_0x5d6675(0x144)](_0x5ce2e7=>_0x5ce2e7[_0x5d6675(0x142)]())[_0x5d6675(0x153)](Boolean),_0x156db9=[],_0x340b77=filterDbTableBackedDatasets(await listDatasets(_0x257505['appCode'])),_0x1f87d4=new Map(_0x340b77[_0x5d6675(0x144)](_0x11f7ad=>[_0x11f7ad[_0x5d6675(0x128)]?.[_0x5d6675(0x156)]?.[_0x5d6675(0x148)](),_0x11f7ad]));for(const _0x2324f8 of _0x548d03[_0x5d6675(0x131)]){const _0x5853c3=_0x1f87d4[_0x5d6675(0x13e)](_0x2324f8[_0x5d6675(0x148)]());!_0x5853c3&&_0x156db9[_0x5d6675(0x136)](_0x5d6675(0x14e)+_0x2324f8+_0x5d6675(0x141));}for(const _0x4c0a42 of _0x4fc490){let _0x4cc21a;try{_0x4cc21a=await getDatasetDetail(_0x4c0a42);}catch{_0x156db9[_0x5d6675(0x136)](_0x5d6675(0x15a)+_0x4c0a42+'\x22\x20not\x20found\x20or\x20not\x20accessible');continue;}assertDatasetIsDbTableBacked(_0x4cc21a,_0x5d6675(0x14f));const _0x15f03a=Array[_0x5d6675(0x13f)](_0x4cc21a[_0x5d6675(0x13b)])?_0x4cc21a['fields']:[],_0x3d5fab=new Set(_0x15f03a[_0x5d6675(0x144)](_0x255ee3=>_0x255ee3[_0x5d6675(0x13d)]?.[_0x5d6675(0x148)]())),_0x210d69=_0x4cc21a[_0x5d6675(0x128)]?.[_0x5d6675(0x156)]||_0x4cc21a['tableName']||_0x4c0a42;_0x2b092e['schema:'+_0x210d69]={'code':_0x4c0a42,'tableName':_0x210d69,'fieldCount':_0x3d5fab[_0x5d6675(0x14d)],'fields':Array['from'](_0x3d5fab)};}_0x156db9[_0x5d6675(0x157)]>0x0&&(_0x2b092e['schemaWarnings']=_0x156db9);}return{'ok':_0x548d03[_0x5d6675(0x12f)],'data':_0x2b092e,'message':_0x548d03[_0x5d6675(0x13a)]};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a162_0x3fc27c=a162_0x3aef;(function(_0x3459ec,_0x52c765){const _0x1c45a1=a162_0x3aef,_0x41070=_0x3459ec();while(!![]){try{const _0x306f18=-parseInt(_0x1c45a1(0xf2))/0x1+parseInt(_0x1c45a1(0x100))/0x2*(-parseInt(_0x1c45a1(0xff))/0x3)+parseInt(_0x1c45a1(0xf3))/0x4*(parseInt(_0x1c45a1(0xf0))/0x5)+parseInt(_0x1c45a1(0xf5))/0x6+-parseInt(_0x1c45a1(0xfc))/0x7*(-parseInt(_0x1c45a1(0xf6))/0x8)+-parseInt(_0x1c45a1(0xfe))/0x9*(parseInt(_0x1c45a1(0xfa))/0xa)+parseInt(_0x1c45a1(0xf7))/0xb*(parseInt(_0x1c45a1(0xf8))/0xc);if(_0x306f18===_0x52c765)break;else _0x41070['push'](_0x41070['shift']());}catch(_0x12afd9){_0x41070['push'](_0x41070['shift']());}}}(a162_0x5e4f,0x8771d));import{buildAppAddFlags,runAppAdd,validateAppName}from'../../commands/common/app-registry.js';export const workspaceAddDefinition={'service':a162_0x3fc27c(0xf9),'command':a162_0x3fc27c(0xf4),'description':a162_0x3fc27c(0x101),'risk':a162_0x3fc27c(0xfd),'requiresAuth':![],'requiresAppCode':![],'args':[{'name':'name','description':a162_0x3fc27c(0xfb),'required':!![]}],'flags':buildAppAddFlags(),'validate':_0x4c8cbc=>validateAppName(_0x4c8cbc,a162_0x3fc27c(0xf1)),'execute':_0x14733c=>runAppAdd(_0x14733c,a162_0x3fc27c(0xf1))};function a162_0x3aef(_0x43aa3b,_0x2a09cf){_0x43aa3b=_0x43aa3b-0xf0;const _0x5e4fe3=a162_0x5e4f();let _0x3aef09=_0x5e4fe3[_0x43aa3b];return _0x3aef09;}function a162_0x5e4f(){const _0x774d6c=['32635aEILoh','workspace\x20add','1001001QJOiaI','4KaiQek','add','5752698dacPRb','1784kKZfVK','1956680MATSct','48cTaYaE','workspace','2710AsunQM','App\x20profile\x20name','32179JiUATs','write','26388ANvBTi','1054821hjEQqK','2uVROGu','Register\x20an\x20app\x20profile\x20in\x20the\x20current\x20workspace\x20(or\x20--global)'];a162_0x5e4f=function(){return _0x774d6c;};return a162_0x5e4f();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a163_0x40e528=a163_0x5e25;(function(_0x402a2c,_0x35a91a){const _0x296414=a163_0x5e25,_0x14ce42=_0x402a2c();while(!![]){try{const _0x5e6b93=parseInt(_0x296414(0x15c))/0x1+parseInt(_0x296414(0x15d))/0x2+-parseInt(_0x296414(0x139))/0x3+parseInt(_0x296414(0x16c))/0x4*(parseInt(_0x296414(0x145))/0x5)+-parseInt(_0x296414(0x137))/0x6*(-parseInt(_0x296414(0x153))/0x7)+parseInt(_0x296414(0x168))/0x8*(parseInt(_0x296414(0x13b))/0x9)+-parseInt(_0x296414(0x149))/0xa;if(_0x5e6b93===_0x35a91a)break;else _0x14ce42['push'](_0x14ce42['shift']());}catch(_0x9f2da7){_0x14ce42['push'](_0x14ce42['shift']());}}}(a163_0x3683,0x2ad0c));import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';import{RABETBASE_ENV_VALUES}from'../../constant/env.js';import{RABETBASE_OUTPUT_FORMAT_VALUES}from'../../constant/output.js';import{RISK_LEVEL_VALUES}from'../../constant/risk.js';import{validateAppcode}from'../../commands/common/validate.js';import{readConfigFile,readRawConfigWithLayers,resolveWriteConfigPath,writeConfigFile}from'../../context.js';import{workspaceAddDefinition}from'../../commands/workspace/add.js';import{workspaceRemoveDefinition}from'../../commands/workspace/remove.js';const WORKSPACE_USAGE=CLI_BIN_NAME+a163_0x40e528(0x142),SAFE_PROFILE_KEYS=[a163_0x40e528(0x138),a163_0x40e528(0x140),'apiDir',a163_0x40e528(0x16a),'pageSize',a163_0x40e528(0x14c),a163_0x40e528(0x152)],workspaceFlags=[{'name':a163_0x40e528(0x15b),'type':a163_0x40e528(0x150),'description':a163_0x40e528(0x13a)},{'name':a163_0x40e528(0x138),'type':a163_0x40e528(0x150),'description':a163_0x40e528(0x15f)},{'name':'env','type':'string','description':a163_0x40e528(0x158),'enum':[...RABETBASE_ENV_VALUES]},{'name':a163_0x40e528(0x14b),'type':a163_0x40e528(0x150),'description':a163_0x40e528(0x15a)},{'name':a163_0x40e528(0x14f),'type':a163_0x40e528(0x150),'description':'Default\x20output\x20format\x20for\x20this\x20workspace\x20app\x20profile','enum':[...RABETBASE_OUTPUT_FORMAT_VALUES]},{'name':a163_0x40e528(0x156),'type':a163_0x40e528(0x169),'description':a163_0x40e528(0x14e)},{'name':a163_0x40e528(0x14c),'type':a163_0x40e528(0x150),'description':'Risk\x20level\x20for\x20this\x20workspace\x20app\x20profile','enum':[...RISK_LEVEL_VALUES]},{'name':a163_0x40e528(0x152),'type':a163_0x40e528(0x150),'description':a163_0x40e528(0x167)}];function isRecord(_0x4a4fb3){const _0x1180b6=a163_0x40e528;return!!_0x4a4fb3&&typeof _0x4a4fb3===_0x1180b6(0x159)&&!Array[_0x1180b6(0x161)](_0x4a4fb3);}function assertValidAppcode(_0x31c6dd){const _0x55a471=a163_0x40e528,{valid:_0x39afb8,message:_0x286756}=validateAppcode(_0x31c6dd);if(!_0x39afb8)throw CliErrors[_0x55a471(0x170)](_0x55a471(0x164)+_0x31c6dd,_0x286756);}function a163_0x5e25(_0x2b2494,_0xb45583){_0x2b2494=_0x2b2494-0x137;const _0x3683ce=a163_0x3683();let _0x5e25cf=_0x3683ce[_0x2b2494];return _0x5e25cf;}function sanitizeProfile(_0x26c3a6){if(!isRecord(_0x26c3a6))return{};const _0xed454f={};for(const _0x2a5ec9 of SAFE_PROFILE_KEYS){if(_0x26c3a6[_0x2a5ec9]!==undefined)_0xed454f[_0x2a5ec9]=_0x26c3a6[_0x2a5ec9];}return _0xed454f;}function cloneProfile(_0x3c2de6){return isRecord(_0x3c2de6)?{..._0x3c2de6}:{};}function collectWorkspaceProfileOverrides(_0x494224){const _0xe587c=a163_0x40e528,_0x4bea8b={},_0x56ea0f=_0x494224[_0xe587c(0x154)]('env'),_0x2a2404=_0x494224['str'](_0xe587c(0x14b)),_0x33ceac=_0x494224[_0xe587c(0x154)](_0xe587c(0x14f)),_0x4d5e04=_0x494224['flag'](_0xe587c(0x156)),_0x1bf359=_0x494224[_0xe587c(0x154)](_0xe587c(0x14c)),_0x1a788a=_0x494224[_0xe587c(0x154)](_0xe587c(0x152));if(_0x56ea0f)_0x4bea8b[_0xe587c(0x140)]=_0x56ea0f;if(_0x2a2404)_0x4bea8b[_0xe587c(0x14b)]=_0x2a2404;if(_0x33ceac)_0x4bea8b[_0xe587c(0x16a)]=_0x33ceac;if(_0x4d5e04!==undefined&&_0x4d5e04!=='')_0x4bea8b['pageSize']=Number(_0x4d5e04);if(_0x1bf359)_0x4bea8b[_0xe587c(0x14c)]=_0x1bf359;if(_0x1a788a)_0x4bea8b['locale']=_0x1a788a;return _0x4bea8b;}async function validateWorkspaceArgs(_0x121d58){const _0x4998ec=a163_0x40e528,_0x5337f5=_0x121d58['str'](_0x4998ec(0x15b))['trim'](),_0x15e3b3=_0x121d58[_0x4998ec(0x154)](_0x4998ec(0x138))[_0x4998ec(0x151)]();if(!_0x5337f5&&!_0x15e3b3)throw CliErrors[_0x4998ec(0x170)]('Missing\x20workspace\x20app\x20selector.',_0x4998ec(0x166)+CLI_BIN_NAME+'\x20workspace\x20init\x20--appcode\x20<code>`\x20or\x20`'+CLI_BIN_NAME+'\x20workspace\x20use\x20--app\x20<name>`.');if(_0x15e3b3)assertValidAppcode(_0x15e3b3);}function resolveKnownApps(){const _0x3f8ba0=a163_0x40e528,{config:_0x3b3c43,layers:_0x5093de}=readRawConfigWithLayers(),_0xe1ccdf=isRecord(_0x3b3c43[_0x3f8ba0(0x13d)])?_0x3b3c43[_0x3f8ba0(0x13d)]:{},_0x269a65=isRecord(_0x5093de[_0x3f8ba0(0x165)][_0x3f8ba0(0x13d)])?_0x5093de[_0x3f8ba0(0x165)][_0x3f8ba0(0x13d)]:{};return{..._0x269a65,..._0xe1ccdf};}async function configureWorkspace(_0x5474f6,_0x4d3b8b){const _0x549582=a163_0x40e528,_0x2c135d=_0x5474f6[_0x549582(0x154)]('app')[_0x549582(0x151)](),_0x3b3a8d=_0x5474f6[_0x549582(0x154)](_0x549582(0x138))[_0x549582(0x151)](),_0x19859a=_0x2c135d||_0x3b3a8d;if(!_0x19859a)throw CliErrors[_0x549582(0x170)]('Missing\x20workspace\x20app\x20selector.','Use\x20`'+CLI_BIN_NAME+_0x549582(0x13c)+CLI_BIN_NAME+_0x549582(0x146));if(_0x3b3a8d)assertValidAppcode(_0x3b3a8d);const _0x426a47=resolveWriteConfigPath('project'),_0x173836=readConfigFile(_0x426a47),_0x2475bb=resolveKnownApps(),_0x1b73fe=isRecord(_0x173836['apps'])?{..._0x173836[_0x549582(0x13d)]}:{},_0x7e58a3=cloneProfile(_0x1b73fe[_0x19859a]),_0x5cf62b=sanitizeProfile(_0x2475bb[_0x19859a]),_0x4077c6=_0x3b3a8d?{}:_0x5cf62b,_0x50bbc6=_0x3b3a8d||_0x4077c6[_0x549582(0x138)];if(!_0x50bbc6){const _0x22e891=Object['keys'](_0x2475bb),_0x3aee48=_0x22e891[_0x549582(0x157)]===0x0?_0x549582(0x166)+CLI_BIN_NAME+_0x549582(0x148)+_0x4d3b8b+_0x549582(0x15e)+_0x19859a+'\x20--appcode\x20<code>`.':_0x549582(0x14a)+_0x22e891['join'](',\x20');throw CliErrors[_0x549582(0x170)](_0x549582(0x155)+_0x19859a+_0x549582(0x13e),_0x3aee48);}assertValidAppcode(String(_0x50bbc6));const _0x493af6={..._0x4077c6,..._0x7e58a3,'appcode':String(_0x50bbc6),...collectWorkspaceProfileOverrides(_0x5474f6)};return _0x1b73fe[_0x19859a]=_0x493af6,_0x173836[_0x549582(0x13d)]=_0x1b73fe,_0x173836[_0x549582(0x141)]=_0x19859a,delete _0x173836[_0x549582(0x138)],delete _0x173836[_0x549582(0x15b)],_0x493af6[_0x549582(0x140)]&&(_0x173836[_0x549582(0x140)]=_0x493af6['env']),writeConfigFile(_0x426a47,_0x173836),{'ok':!![],'message':_0x549582(0x14d)+(_0x4d3b8b===_0x549582(0x160)?_0x549582(0x13f):_0x549582(0x16f))+':\x20'+_0x19859a+_0x549582(0x144)+_0x493af6[_0x549582(0x138)]+_0x549582(0x16d)+_0x426a47+_0x549582(0x162),'data':{'operation':_0x549582(0x147)+_0x4d3b8b,'configPath':_0x426a47,'app':_0x19859a,'appcode':_0x493af6[_0x549582(0x138)],'env':_0x493af6[_0x549582(0x140)]??null,'credentialsWritten':![]}};}const workspaceInitDefinition={'service':a163_0x40e528(0x163),'command':'init','description':a163_0x40e528(0x16b),'risk':'write','requiresAuth':![],'requiresAppCode':![],'args':[],'flags':workspaceFlags,'validate':validateWorkspaceArgs,'execute':_0x23d16c=>configureWorkspace(_0x23d16c,a163_0x40e528(0x160))},workspaceUseDefinition={'service':'workspace','command':a163_0x40e528(0x143),'description':'Switch\x20the\x20current\x20workspace\x20app\x20binding','risk':a163_0x40e528(0x16e),'requiresAuth':![],'requiresAppCode':![],'args':[],'flags':workspaceFlags,'validate':validateWorkspaceArgs,'execute':_0x262856=>configureWorkspace(_0x262856,'use')};export const workspaceDefinitions=[workspaceInitDefinition,workspaceUseDefinition,workspaceAddDefinition,workspaceRemoveDefinition];function a163_0x3683(){const _0x116bbe=['235196pAFiHh','555484BsYMoO','\x20--app\x20','App\x20code\x20to\x20bind\x20to\x20this\x20workspace','init','isArray','.\x20Credentials:\x20not\x20written.','workspace','Invalid\x20appcode:\x20','globalConfig','Use\x20`','Locale\x20for\x20this\x20workspace\x20app\x20profile','8TyXCDn','number','format','Initialize\x20the\x20current\x20workspace\x20app\x20binding','172OejkWc',').\x20Config:\x20','write','updated','validation','6bEoHVJ','appcode','813369mmPDsC','App\x20profile\x20name\x20to\x20use\x20in\x20this\x20workspace','2866797ROwqBL','\x20workspace\x20init\x20--appcode\x20<code>`\x20or\x20`','apps','\x22\x20not\x20found.','initialized','env','defaultApp','\x20workspace\x20<init|use>\x20--app\x20<name>\x20[--appcode\x20<code>]','use','\x20(appcode:\x20','38085GhmKDG','\x20workspace\x20use\x20--app\x20<name>`.','workspace.','\x20workspace\x20','7796850dLJCLO','Pass\x20--appcode\x20<code>,\x20or\x20choose\x20one\x20of:\x20','apiDir','riskLevel','Workspace\x20','Default\x20page\x20size\x20for\x20this\x20workspace\x20app\x20profile','defaultFormat','string','trim','locale','470246yDhbRZ','str','App\x20\x22','pageSize','length','Target\x20environment','object','API\x20directory\x20path\x20for\x20this\x20workspace\x20app\x20profile','app'];a163_0x3683=function(){return _0x116bbe;};return a163_0x3683();}export{WORKSPACE_USAGE};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a164_0x12e7(_0x2b8d67,_0x4f034f){_0x2b8d67=_0x2b8d67-0xc7;const _0x142f39=a164_0x142f();let _0x12e75b=_0x142f39[_0x2b8d67];return _0x12e75b;}const a164_0x5700ac=a164_0x12e7;function a164_0x142f(){const _0x3733b8=['7104776EoVqEL','170TvLgTB','high-risk-write','117iokLUJ','name','3557668CdOaqg','Remove\x20an\x20app\x20profile\x20from\x20the\x20current\x20workspace\x20(or\x20--global)','remove','126inzbBv','workspace\x20remove','2916980FJsKdm','300531YcjXsN','1067240LepOpX','1990434AgxFmg','App\x20profile\x20name\x20to\x20remove','workspace','5vexyjJ','10943VmgduY'];a164_0x142f=function(){return _0x3733b8;};return a164_0x142f();}(function(_0x1782fa,_0x112578){const _0x3157d3=a164_0x12e7,_0x5b0b03=_0x1782fa();while(!![]){try{const _0x490522=parseInt(_0x3157d3(0xd2))/0x1*(parseInt(_0x3157d3(0xd4))/0x2)+parseInt(_0x3157d3(0xce))/0x3+parseInt(_0x3157d3(0xd8))/0x4*(-parseInt(_0x3157d3(0xd1))/0x5)+-parseInt(_0x3157d3(0xc9))/0x6*(-parseInt(_0x3157d3(0xcc))/0x7)+parseInt(_0x3157d3(0xd3))/0x8+parseInt(_0x3157d3(0xd6))/0x9*(-parseInt(_0x3157d3(0xcd))/0xa)+-parseInt(_0x3157d3(0xcb))/0xb;if(_0x490522===_0x112578)break;else _0x5b0b03['push'](_0x5b0b03['shift']());}catch(_0x3c3a75){_0x5b0b03['push'](_0x5b0b03['shift']());}}}(a164_0x142f,0xcd662));import{buildAppRemoveFlags,runAppRemove,validateAppName}from'../../commands/common/app-registry.js';export const workspaceRemoveDefinition={'service':a164_0x5700ac(0xd0),'command':a164_0x5700ac(0xc8),'description':a164_0x5700ac(0xc7),'risk':a164_0x5700ac(0xd5),'requiresAuth':![],'requiresAppCode':![],'args':[{'name':a164_0x5700ac(0xd7),'description':a164_0x5700ac(0xcf),'required':!![]}],'flags':buildAppRemoveFlags(),'validate':_0x1e7ea1=>validateAppName(_0x1e7ea1,a164_0x5700ac(0xca)),'execute':_0x693eab=>runAppRemove(_0x693eab,a164_0x5700ac(0xca))};
|
package/lib/config/schema.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a165_0x3b7628=a165_0x5df9;(function(_0x1854b2,_0xdff832){const _0x561d71=a165_0x5df9,_0x396bce=_0x1854b2();while(!![]){try{const _0x5d347=parseInt(_0x561d71(0x162))/0x1+-parseInt(_0x561d71(0x15e))/0x2*(-parseInt(_0x561d71(0x16f))/0x3)+-parseInt(_0x561d71(0x16b))/0x4+-parseInt(_0x561d71(0x16d))/0x5+-parseInt(_0x561d71(0x165))/0x6+parseInt(_0x561d71(0x164))/0x7+-parseInt(_0x561d71(0x176))/0x8*(-parseInt(_0x561d71(0x172))/0x9);if(_0x5d347===_0xdff832)break;else _0x396bce['push'](_0x396bce['shift']());}catch(_0x4e110c){_0x396bce['push'](_0x396bce['shift']());}}}(a165_0x4312,0x907a8));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=[a165_0x3b7628(0x166),'accessKey',a165_0x3b7628(0x15f),a165_0x3b7628(0x17a),a165_0x3b7628(0x160)];export const TOP_LEVEL_CONFIG_KEYS=new Set([a165_0x3b7628(0x16e),'env',a165_0x3b7628(0x15f),'format',a165_0x3b7628(0x166),a165_0x3b7628(0x167),'apiDir']);function a165_0x5df9(_0x495bc1,_0x2c4fdf){_0x495bc1=_0x495bc1-0x15b;const _0x43128c=a165_0x4312();let _0x5df9dc=_0x43128c[_0x495bc1];return _0x5df9dc;}export const CONFIG_ENUM_VALUES={'env':[...RABETBASE_ENV_VALUES],'format':[...RABETBASE_OUTPUT_FORMAT_VALUES]};export function formatConfigKeyList(_0xd72fc4){return[..._0xd72fc4]['join'](',\x20');}function a165_0x4312(){const _0x229941=['Default\x20page\x20size','toLowerCase','env','string','app','330LiXeLt','locale','riskLevel','apps','657268kIoCTh','API\x20directory\x20path','819042syPJsH','6140376YMaNgr','cookie','accessKey','length','pageSize','number','3232972VaUuik','inherit','5454980MECsAq','appcode','5505IcXXeD','map','Locale','90QDYMMS','filter','entries','zh-CN','1949896zHgExk','defaultApp','trim','apiDir','format','en-US','keys'];a165_0x4312=function(){return _0x229941;};return a165_0x4312();}export function getTopLevelConfigKeyList(){return[...TOP_LEVEL_CONFIG_KEYS];}export function isTopLevelConfigKey(_0x3e8364){return TOP_LEVEL_CONFIG_KEYS['has'](_0x3e8364);}export function getTopLevelConfigKeySummary(){return formatConfigKeyList(getTopLevelConfigKeyList());}export function getConfigCommandKeyDescription(){return'Config\x20key\x20('+getTopLevelConfigKeySummary()+')';}export const APP_PROFILE_FLAG_KEY_MAP={'env':a165_0x3b7628(0x15b),'apiDir':'apiDir','cookie':a165_0x3b7628(0x166),'accessKey':'accessKey','defaultFormat':a165_0x3b7628(0x17a),'pageSize':'pageSize','riskLevel':'riskLevel','locale':'locale'};export function getAppProfileFlagDefs(){const _0x259fe2=a165_0x3b7628;return[{'name':_0x259fe2(0x15b),'type':_0x259fe2(0x15c),'description':'Target\x20environment','enum':[...RABETBASE_ENV_VALUES]},{'name':'apiDir','type':_0x259fe2(0x15c),'description':_0x259fe2(0x163)},{'name':'cookie','type':_0x259fe2(0x15c),'description':'Auth\x20cookie','hidden':!![]},{'name':_0x259fe2(0x167),'type':_0x259fe2(0x15c),'description':'Access\x20key','hidden':!![]},{'name':'defaultFormat','type':_0x259fe2(0x15c),'description':'Default\x20output\x20format\x20for\x20this\x20app\x20(profile)','enum':[...RABETBASE_OUTPUT_FORMAT_VALUES]},{'name':'pageSize','type':_0x259fe2(0x16a),'description':_0x259fe2(0x17d)},{'name':_0x259fe2(0x160),'type':_0x259fe2(0x15c),'description':'Risk\x20level','enum':[...RISK_LEVEL_VALUES]},{'name':_0x259fe2(0x15f),'type':_0x259fe2(0x15c),'description':_0x259fe2(0x171)}];}export function collectAppProfileOverrides(_0x30d3c0){const _0x14e65d=a165_0x3b7628,_0x1182bf={};for(const [_0x126fde,_0x2b2a8f]of Object[_0x14e65d(0x174)](APP_PROFILE_FLAG_KEY_MAP)){const _0x293971=_0x30d3c0(_0x126fde);if(!_0x293971)continue;_0x1182bf[_0x2b2a8f]=_0x2b2a8f===_0x14e65d(0x169)?Number(_0x293971):_0x293971;}return _0x1182bf;}export function buildAppProfileListFields(_0xd17b78){const _0x371f01=a165_0x3b7628;return{'env':_0xd17b78[_0x371f01(0x15b)]??null,'apiDir':_0xd17b78['apiDir']??null,'hasCookie':!!_0xd17b78['cookie'],'hasAccessKey':!!_0xd17b78[_0x371f01(0x167)],'format':_0xd17b78[_0x371f01(0x17a)]??null,'pageSize':_0xd17b78['pageSize']??null,'riskLevel':_0xd17b78[_0x371f01(0x160)]??null,'locale':_0xd17b78[_0x371f01(0x15f)]??null};}export function buildAppDoctorFields(_0xfff69d,_0x11e740){const _0xcf2b7b=a165_0x3b7628;return{'env':{'value':_0xfff69d[_0xcf2b7b(0x15b)]||_0x11e740[_0xcf2b7b(0x15b)],'source':_0xfff69d['env']?_0xcf2b7b(0x15d):'inherit'},'apiDir':{'value':_0xfff69d[_0xcf2b7b(0x179)]||_0x11e740[_0xcf2b7b(0x179)],'source':_0xfff69d[_0xcf2b7b(0x179)]?'app':_0xcf2b7b(0x16c)},'cookie':{'value':_0xfff69d[_0xcf2b7b(0x166)]||_0x11e740[_0xcf2b7b(0x166)],'source':_0xfff69d['cookie']?_0xcf2b7b(0x15d):'inherit'},'accessKey':{'value':_0xfff69d[_0xcf2b7b(0x167)]||_0x11e740[_0xcf2b7b(0x167)],'source':_0xfff69d[_0xcf2b7b(0x167)]?_0xcf2b7b(0x15d):'inherit'}};}export function buildCanonicalAppConfig(_0x12c122,_0x4060d1){const _0x362d03=a165_0x3b7628,_0x485639=_0x12c122[_0x362d03(0x170)](_0x2d189d=>String(_0x2d189d||'')[_0x362d03(0x178)]())[_0x362d03(0x173)](Boolean);if(_0x485639[_0x362d03(0x168)]===0x0)return{};const _0x31a99d={};for(const _0x34e56a of _0x485639){_0x31a99d[_0x34e56a]=_0x4060d1?{'appcode':_0x34e56a,'env':_0x4060d1}:{'appcode':_0x34e56a};}return{'apps':_0x31a99d,'defaultApp':_0x485639[0x0]};}export function buildCanonicalProjectConfig(_0x261af4,_0xdd8d47){const _0x2ab39b=a165_0x3b7628,{appCodes:appCodes=[],env:_0x2824e6,metadata:_0x4327ce}=_0xdd8d47,_0x14e1d5={..._0x261af4,..._0x4327ce||{}};delete _0x14e1d5[_0x2ab39b(0x16e)],delete _0x14e1d5[_0x2ab39b(0x15d)];if(_0x2824e6)_0x14e1d5[_0x2ab39b(0x15b)]=_0x2824e6;else!_0x14e1d5[_0x2ab39b(0x15b)]&&(_0x14e1d5[_0x2ab39b(0x15b)]=DEFAULT_CONFIG_VALUES[_0x2ab39b(0x15b)]);const _0x30d0be=buildCanonicalAppConfig(appCodes,_0x14e1d5[_0x2ab39b(0x15b)]);return Object[_0x2ab39b(0x17c)](_0x30d0be)[_0x2ab39b(0x168)]>0x0&&(_0x14e1d5[_0x2ab39b(0x161)]=_0x30d0be[_0x2ab39b(0x161)],_0x14e1d5[_0x2ab39b(0x177)]=_0x30d0be[_0x2ab39b(0x177)]),_0x14e1d5;}const LOCALE_MAP={'zh':a165_0x3b7628(0x175),'zh-cn':a165_0x3b7628(0x175),'zh_cn':a165_0x3b7628(0x175),'en':'en-US','en-us':a165_0x3b7628(0x17b),'en_us':a165_0x3b7628(0x17b)};export function normalizeLocale(_0xe16266){const _0x27bc37=a165_0x3b7628;if(!_0xe16266)return null;return LOCALE_MAP[_0xe16266[_0x27bc37(0x17e)]()]??null;}
|
package/lib/constant/cdn.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a166_0x3ac6e2=a166_0x1bbe;function a166_0x1f7e(){const _0x3e8e25=['59847rdLSKC','8fWbTqH','183846xynTQd','780LJajtH','22ixbRFW','39699UtHlRr','1200080qrRDyU','57068fiMRoI','24515jOqCZT','208528JlPqFq','https://g.lovrabet.com/dist/rabetbase-cli/config/index.json','24nheWAe'];a166_0x1f7e=function(){return _0x3e8e25;};return a166_0x1f7e();}function a166_0x1bbe(_0x537d6e,_0x26a1b6){_0x537d6e=_0x537d6e-0x138;const _0x1f7e8f=a166_0x1f7e();let _0x1bbe8b=_0x1f7e8f[_0x537d6e];return _0x1bbe8b;}(function(_0x20cf51,_0x3a0bf5){const _0x15dd53=a166_0x1bbe,_0x53e945=_0x20cf51();while(!![]){try{const _0x1d348b=parseInt(_0x15dd53(0x139))/0x1+parseInt(_0x15dd53(0x13b))/0x2*(-parseInt(_0x15dd53(0x143))/0x3)+-parseInt(_0x15dd53(0x140))/0x4+parseInt(_0x15dd53(0x13f))/0x5*(-parseInt(_0x15dd53(0x142))/0x6)+-parseInt(_0x15dd53(0x13d))/0x7+-parseInt(_0x15dd53(0x138))/0x8*(-parseInt(_0x15dd53(0x13c))/0x9)+parseInt(_0x15dd53(0x13a))/0xa*(parseInt(_0x15dd53(0x13e))/0xb);if(_0x1d348b===_0x3a0bf5)break;else _0x53e945['push'](_0x53e945['shift']());}catch(_0x202faf){_0x53e945['push'](_0x53e945['shift']());}}}(a166_0x1f7e,0x1fcfa));export const CLI_VERSION_POLICY_URL=a166_0x3ac6e2(0x141);
|
package/lib/constant/cli.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a167_0x1b5098=a167_0x2654;(function(_0x107906,_0x47a44d){const _0x4cc5f8=a167_0x2654,_0x3a8e64=_0x107906();while(!![]){try{const _0x36786b=-parseInt(_0x4cc5f8(0x1f6))/0x1*(-parseInt(_0x4cc5f8(0x20b))/0x2)+parseInt(_0x4cc5f8(0x1df))/0x3*(parseInt(_0x4cc5f8(0x217))/0x4)+parseInt(_0x4cc5f8(0x1d2))/0x5*(parseInt(_0x4cc5f8(0x21d))/0x6)+-parseInt(_0x4cc5f8(0x20f))/0x7+parseInt(_0x4cc5f8(0x1e8))/0x8*(parseInt(_0x4cc5f8(0x232))/0x9)+-parseInt(_0x4cc5f8(0x21f))/0xa+parseInt(_0x4cc5f8(0x1ea))/0xb*(-parseInt(_0x4cc5f8(0x1ec))/0xc);if(_0x36786b===_0x47a44d)break;else _0x3a8e64['push'](_0x3a8e64['shift']());}catch(_0x2eeb5d){_0x3a8e64['push'](_0x3a8e64['shift']());}}}(a167_0x4c97,0x57ad5));function a167_0x4c97(){const _0x3cbda4=['Skip\x20confirmation\x20for\x20high-risk\x20writes','Select\x20app\x20profile\x20by\x20name','target','Confirm\x20destructive\x20action','app','Output\x20format','rabetbase','Show\x20help','Type\x20filter','functionNode','Page\x20size','2RPxLbT','all','dbid','Tags','208348DqURJi','Read\x20value\x20from\x20environment\x20variable','sqlcode','Rabetbase\x20CLI','file','SQL\x20code','Title','dryRun','96BEuqmT','Target\x20path','Config\x20key','Force\x20non-interactive\x20mode\x20(CI)','enable-bff-save','verbose','102RPlkBk','production\x20|\x20daily','1945230rFfPmW','map','Keyword\x20filter','schemas','Reveal\x20sensitive\x20value','remote','confirm','Filter\x20JSON\x20output\x20(JQ_PATH\x20>\x20bundled\x20jq\x20>\x20PATH;\x20use\x20with\x20--format\x20json\x20or\x20compress)','File\x20path','reveal','format','Apply\x20to\x20all','non-interactive','Schemas','SQL\x20name','skipImports','sql-name','Force\x20overwrite','Dataset\x20code','2339271glkHFx','@lovrabet/rabetbase-cli','enableBffSave','JSON\x20params','Page\x20number','sqlname','type','global','<expr>','Watch\x20mode','db-id','value','Preview\x20operation\x20without\x20executing','Override\x20appcode','Use\x20project\x20config\x20scope','60195eGXXmC','Use\x20global\x20config\x20scope','datasetcode','json\x20|\x20pretty\x20|\x20compress','yes','Verbose\x20output','watch','appcode','force','Clear','fromEnv','fromEntries','Use\x20remote','303fGSYQs','Environment','operation','dbId','tags','key','help','function-node','string','16NoUOVf','keyword','4301CvYTbk','title','19632xXpZBc','meowKey','boolean','project','description','Skip\x20import\x20generation','sql','env','Operation\x20type','params','496163gPGPoU','clear','sqlName','Record\x20ID','page','output','Read\x20value\x20from\x20stdin','from-env','nonInteractive','skip-imports'];a167_0x4c97=function(){return _0x3cbda4;};return a167_0x4c97();}export const CLI_BIN_NAME=a167_0x1b5098(0x206);export const CLI_DISPLAY_NAME=a167_0x1b5098(0x212);export const NPM_PACKAGE_NAME=a167_0x1b5098(0x233);function a167_0x2654(_0x2e4d8,_0x578e2d){_0x2e4d8=_0x2e4d8-0x1c8;const _0x4c975d=a167_0x4c97();let _0x265412=_0x4c975d[_0x2e4d8];return _0x265412;}export const GLOBAL_FLAGS=[{'name':'appcode','meowKey':'appcode','type':a167_0x1b5098(0x1e7),'description':a167_0x1b5098(0x1d0),'hint':'<code>'},{'name':a167_0x1b5098(0x204),'meowKey':a167_0x1b5098(0x204),'type':a167_0x1b5098(0x1e7),'description':a167_0x1b5098(0x201),'hint':'<name>'},{'name':a167_0x1b5098(0x1f3),'meowKey':a167_0x1b5098(0x1f3),'type':'string','description':a167_0x1b5098(0x1e0),'hint':a167_0x1b5098(0x21e)},{'name':a167_0x1b5098(0x229),'meowKey':a167_0x1b5098(0x229),'type':'string','description':a167_0x1b5098(0x205),'hint':a167_0x1b5098(0x1d5)},{'name':'jq','meowKey':'jq','type':a167_0x1b5098(0x1e7),'description':a167_0x1b5098(0x226),'hint':a167_0x1b5098(0x1cb)},{'name':'dry-run','meowKey':a167_0x1b5098(0x216),'type':'boolean','description':a167_0x1b5098(0x1cf)},{'name':'yes','meowKey':a167_0x1b5098(0x1d6),'type':'boolean','description':a167_0x1b5098(0x200)},{'name':'non-interactive','meowKey':a167_0x1b5098(0x1fe),'type':'boolean','description':a167_0x1b5098(0x21a)},{'name':a167_0x1b5098(0x1ca),'meowKey':a167_0x1b5098(0x1ca),'type':a167_0x1b5098(0x1ee),'description':a167_0x1b5098(0x1d3)},{'name':a167_0x1b5098(0x1ef),'meowKey':a167_0x1b5098(0x1ef),'type':a167_0x1b5098(0x1ee),'description':a167_0x1b5098(0x1d1)},{'name':'ci','meowKey':'ci','type':a167_0x1b5098(0x1ee),'description':'Alias\x20for\x20--non-interactive','hidden':!![]},{'name':a167_0x1b5098(0x1e5),'meowKey':a167_0x1b5098(0x1e5),'type':a167_0x1b5098(0x1ee),'description':a167_0x1b5098(0x207)},{'name':'name','meowKey':'name','type':'string','description':'Name','hidden':!![]},{'name':a167_0x1b5098(0x1eb),'meowKey':a167_0x1b5098(0x1eb),'type':a167_0x1b5098(0x1e7),'description':a167_0x1b5098(0x215),'hidden':!![]},{'name':a167_0x1b5098(0x1f7),'meowKey':a167_0x1b5098(0x1f7),'type':a167_0x1b5098(0x1ee),'description':a167_0x1b5098(0x1db),'hidden':!![]},{'name':a167_0x1b5098(0x1d8),'meowKey':'watch','type':a167_0x1b5098(0x1ee),'description':a167_0x1b5098(0x1cc),'hidden':!![]},{'name':a167_0x1b5098(0x1fb),'meowKey':a167_0x1b5098(0x1fb),'type':a167_0x1b5098(0x1e7),'description':'Output\x20path','hidden':!![]},{'name':a167_0x1b5098(0x1f5),'meowKey':a167_0x1b5098(0x1f5),'type':a167_0x1b5098(0x1e7),'description':a167_0x1b5098(0x235),'hidden':!![]},{'name':'datasetcode','meowKey':a167_0x1b5098(0x1d4),'type':a167_0x1b5098(0x1e7),'description':a167_0x1b5098(0x231),'hidden':!![]},{'name':a167_0x1b5098(0x20c),'meowKey':a167_0x1b5098(0x20c),'type':a167_0x1b5098(0x1ee),'description':a167_0x1b5098(0x22a),'hidden':!![]},{'name':a167_0x1b5098(0x21b),'meowKey':a167_0x1b5098(0x234),'type':'boolean','description':'Enable\x20BFF\x20save','hidden':!![]},{'name':'id','meowKey':'id','type':'string','description':a167_0x1b5098(0x1f9),'hidden':!![]},{'name':a167_0x1b5098(0x1c9),'meowKey':'type','type':'string','description':a167_0x1b5098(0x208),'hidden':!![]},{'name':a167_0x1b5098(0x213),'meowKey':'file','type':a167_0x1b5098(0x1e7),'description':a167_0x1b5098(0x227),'hidden':!![]},{'name':a167_0x1b5098(0x211),'meowKey':a167_0x1b5098(0x211),'type':'string','description':a167_0x1b5098(0x214),'hidden':!![]},{'name':a167_0x1b5098(0x22f),'meowKey':a167_0x1b5098(0x1f8),'type':a167_0x1b5098(0x1e7),'description':a167_0x1b5098(0x22d),'hidden':!![]},{'name':'sqlname','meowKey':a167_0x1b5098(0x1c8),'type':a167_0x1b5098(0x1e7),'description':a167_0x1b5098(0x22d),'hidden':!![]},{'name':a167_0x1b5098(0x1cd),'meowKey':a167_0x1b5098(0x1e2),'type':a167_0x1b5098(0x1e7),'description':'DB\x20ID','hidden':!![]},{'name':'dbid','meowKey':a167_0x1b5098(0x20d),'type':'string','description':'DB\x20ID','hidden':!![]},{'name':a167_0x1b5098(0x1f0),'meowKey':a167_0x1b5098(0x1f0),'type':'string','description':'Description','hidden':!![]},{'name':'description-file','meowKey':'descriptionFile','type':'string','description':'Description\x20file','hidden':!![]},{'name':a167_0x1b5098(0x1fa),'meowKey':a167_0x1b5098(0x1fa),'type':a167_0x1b5098(0x1e7),'description':a167_0x1b5098(0x236),'hidden':!![]},{'name':'pagesize','meowKey':'pagesize','type':a167_0x1b5098(0x1e7),'description':a167_0x1b5098(0x20a),'hidden':!![]},{'name':a167_0x1b5098(0x1e9),'meowKey':a167_0x1b5098(0x1e9),'type':'string','description':a167_0x1b5098(0x221),'hidden':!![]},{'name':'code','meowKey':'code','type':'string','description':'Code\x20filter','hidden':!![]},{'name':a167_0x1b5098(0x1f2),'meowKey':a167_0x1b5098(0x1f2),'type':a167_0x1b5098(0x1e7),'description':'SQL\x20string','hidden':!![]},{'name':a167_0x1b5098(0x222),'meowKey':a167_0x1b5098(0x222),'type':a167_0x1b5098(0x1e7),'description':a167_0x1b5098(0x22c),'hidden':!![]},{'name':a167_0x1b5098(0x1e1),'meowKey':a167_0x1b5098(0x1e1),'type':a167_0x1b5098(0x1e7),'description':a167_0x1b5098(0x1f4),'hidden':!![]},{'name':a167_0x1b5098(0x202),'meowKey':a167_0x1b5098(0x202),'type':a167_0x1b5098(0x1e7),'description':a167_0x1b5098(0x218),'hidden':!![]},{'name':a167_0x1b5098(0x1ff),'meowKey':a167_0x1b5098(0x22e),'type':a167_0x1b5098(0x1ee),'description':a167_0x1b5098(0x1f1),'hidden':!![]},{'name':'key','meowKey':a167_0x1b5098(0x1e4),'type':a167_0x1b5098(0x1e7),'description':a167_0x1b5098(0x219),'hidden':!![]},{'name':a167_0x1b5098(0x1ce),'meowKey':a167_0x1b5098(0x1ce),'type':a167_0x1b5098(0x1e7),'description':'Config\x20value','hidden':!![]},{'name':'tags','meowKey':a167_0x1b5098(0x1e3),'type':a167_0x1b5098(0x1e7),'description':a167_0x1b5098(0x20e),'hidden':!![]},{'name':'stdin','meowKey':'stdin','type':a167_0x1b5098(0x1ee),'description':a167_0x1b5098(0x1fc),'hidden':!![]},{'name':a167_0x1b5098(0x1fd),'meowKey':a167_0x1b5098(0x1dc),'type':a167_0x1b5098(0x1e7),'description':a167_0x1b5098(0x210),'hidden':!![]},{'name':a167_0x1b5098(0x228),'meowKey':a167_0x1b5098(0x228),'type':a167_0x1b5098(0x1ee),'description':a167_0x1b5098(0x223),'hidden':!![]},{'name':a167_0x1b5098(0x1da),'meowKey':a167_0x1b5098(0x1da),'type':a167_0x1b5098(0x1ee),'description':a167_0x1b5098(0x230),'hidden':!![]},{'name':'confirm','meowKey':a167_0x1b5098(0x225),'type':a167_0x1b5098(0x1ee),'description':a167_0x1b5098(0x203),'hidden':!![]},{'name':a167_0x1b5098(0x224),'meowKey':'remote','type':a167_0x1b5098(0x1ee),'description':a167_0x1b5098(0x1de),'hidden':!![]},{'name':a167_0x1b5098(0x21c),'meowKey':a167_0x1b5098(0x21c),'type':a167_0x1b5098(0x1ee),'description':a167_0x1b5098(0x1d7),'hidden':!![]},{'name':'expected-count','meowKey':'expectedCount','type':'string','description':'Expected\x20affected\x20count','hidden':!![]},{'name':'operation-type','meowKey':'operationType','type':'string','description':a167_0x1b5098(0x1f4),'hidden':!![]},{'name':a167_0x1b5098(0x1e6),'meowKey':a167_0x1b5098(0x209),'type':a167_0x1b5098(0x1e7),'description':'Function\x20node','hidden':!![]}];export const PIPELINE_FLAG_NAMES=new Set([a167_0x1b5098(0x1d9),a167_0x1b5098(0x204),a167_0x1b5098(0x1f3),a167_0x1b5098(0x229),'jq','dry-run',a167_0x1b5098(0x1d6),a167_0x1b5098(0x22b),'ci']);export function buildMeowFlags(){const _0x843115=a167_0x1b5098;return Object[_0x843115(0x1dd)](GLOBAL_FLAGS[_0x843115(0x220)](_0x58340b=>[_0x58340b[_0x843115(0x1ed)],{'type':_0x58340b[_0x843115(0x1c9)]}]));}
|
|
1
|
+
const a167_0xc99923=a167_0x5de0;(function(_0x51f9d3,_0x2b40ec){const _0x4efb0c=a167_0x5de0,_0x220820=_0x51f9d3();while(!![]){try{const _0x65de41=parseInt(_0x4efb0c(0x13f))/0x1+parseInt(_0x4efb0c(0x16c))/0x2*(parseInt(_0x4efb0c(0x11d))/0x3)+parseInt(_0x4efb0c(0x178))/0x4+-parseInt(_0x4efb0c(0x135))/0x5*(-parseInt(_0x4efb0c(0x12c))/0x6)+-parseInt(_0x4efb0c(0x155))/0x7*(parseInt(_0x4efb0c(0x16d))/0x8)+parseInt(_0x4efb0c(0x10a))/0x9+-parseInt(_0x4efb0c(0x141))/0xa;if(_0x65de41===_0x2b40ec)break;else _0x220820['push'](_0x220820['shift']());}catch(_0x476064){_0x220820['push'](_0x220820['shift']());}}}(a167_0x1c09,0x97984));export const CLI_BIN_NAME='rabetbase';export const CLI_DISPLAY_NAME=a167_0xc99923(0x14e);export const NPM_PACKAGE_NAME=a167_0xc99923(0x149);export const GLOBAL_FLAGS=[{'name':a167_0xc99923(0x12f),'meowKey':a167_0xc99923(0x12f),'type':a167_0xc99923(0x144),'description':a167_0xc99923(0x12a),'hint':'<code>'},{'name':'app','meowKey':'app','type':a167_0xc99923(0x144),'description':a167_0xc99923(0x164),'hint':a167_0xc99923(0x17a)},{'name':a167_0xc99923(0x150),'meowKey':a167_0xc99923(0x150),'type':a167_0xc99923(0x144),'description':a167_0xc99923(0x139),'hint':a167_0xc99923(0x11f)},{'name':'format','meowKey':a167_0xc99923(0x15c),'type':'string','description':a167_0xc99923(0x113),'hint':a167_0xc99923(0x11c)},{'name':'jq','meowKey':'jq','type':a167_0xc99923(0x144),'description':a167_0xc99923(0x14b),'hint':a167_0xc99923(0x13a)},{'name':'dry-run','meowKey':'dryRun','type':a167_0xc99923(0x126),'description':a167_0xc99923(0x123)},{'name':a167_0xc99923(0x171),'meowKey':a167_0xc99923(0x171),'type':a167_0xc99923(0x126),'description':a167_0xc99923(0x147)},{'name':a167_0xc99923(0x146),'meowKey':a167_0xc99923(0x169),'type':'boolean','description':a167_0xc99923(0x154)},{'name':a167_0xc99923(0x14a),'meowKey':a167_0xc99923(0x14a),'type':a167_0xc99923(0x126),'description':a167_0xc99923(0x158)},{'name':a167_0xc99923(0x133),'meowKey':a167_0xc99923(0x133),'type':a167_0xc99923(0x126),'description':a167_0xc99923(0x13e)},{'name':'ci','meowKey':'ci','type':a167_0xc99923(0x126),'description':a167_0xc99923(0x16a),'hidden':!![]},{'name':'help','meowKey':a167_0xc99923(0x173),'type':a167_0xc99923(0x126),'description':'Show\x20help'},{'name':a167_0xc99923(0x121),'meowKey':a167_0xc99923(0x121),'type':a167_0xc99923(0x144),'description':a167_0xc99923(0x142),'hidden':!![]},{'name':'title','meowKey':a167_0xc99923(0x162),'type':a167_0xc99923(0x144),'description':a167_0xc99923(0x16f),'hidden':!![]},{'name':a167_0xc99923(0x143),'meowKey':a167_0xc99923(0x143),'type':'boolean','description':a167_0xc99923(0x125),'hidden':!![]},{'name':a167_0xc99923(0x14f),'meowKey':a167_0xc99923(0x14f),'type':a167_0xc99923(0x126),'description':a167_0xc99923(0x148),'hidden':!![]},{'name':'output','meowKey':'output','type':a167_0xc99923(0x144),'description':'Output\x20path','hidden':!![]},{'name':a167_0xc99923(0x15f),'meowKey':a167_0xc99923(0x15f),'type':a167_0xc99923(0x144),'description':a167_0xc99923(0x174),'hidden':!![]},{'name':a167_0xc99923(0x111),'meowKey':a167_0xc99923(0x111),'type':a167_0xc99923(0x144),'description':a167_0xc99923(0x156),'hidden':!![]},{'name':a167_0xc99923(0x151),'meowKey':'all','type':'boolean','description':'Apply\x20to\x20all','hidden':!![]},{'name':a167_0xc99923(0x152),'meowKey':a167_0xc99923(0x12b),'type':'boolean','description':'Enable\x20BFF\x20save','hidden':!![]},{'name':'id','meowKey':'id','type':a167_0xc99923(0x144),'description':a167_0xc99923(0x10f),'hidden':!![]},{'name':'type','meowKey':a167_0xc99923(0x119),'type':a167_0xc99923(0x144),'description':a167_0xc99923(0x136),'hidden':!![]},{'name':a167_0xc99923(0x14d),'meowKey':a167_0xc99923(0x14d),'type':a167_0xc99923(0x144),'description':a167_0xc99923(0x120),'hidden':!![]},{'name':'sqlcode','meowKey':a167_0xc99923(0x116),'type':a167_0xc99923(0x144),'description':a167_0xc99923(0x10c),'hidden':!![]},{'name':a167_0xc99923(0x129),'meowKey':a167_0xc99923(0x15e),'type':a167_0xc99923(0x144),'description':a167_0xc99923(0x110),'hidden':!![]},{'name':a167_0xc99923(0x10e),'meowKey':'sqlname','type':'string','description':'SQL\x20name','hidden':!![]},{'name':'db-id','meowKey':a167_0xc99923(0x137),'type':a167_0xc99923(0x144),'description':a167_0xc99923(0x11b),'hidden':!![]},{'name':'dbid','meowKey':a167_0xc99923(0x11e),'type':a167_0xc99923(0x144),'description':'DB\x20ID','hidden':!![]},{'name':'description','meowKey':a167_0xc99923(0x170),'type':a167_0xc99923(0x144),'description':a167_0xc99923(0x109),'hidden':!![]},{'name':a167_0xc99923(0x117),'meowKey':a167_0xc99923(0x132),'type':'string','description':a167_0xc99923(0x12e),'hidden':!![]},{'name':a167_0xc99923(0x13b),'meowKey':a167_0xc99923(0x13b),'type':a167_0xc99923(0x144),'description':'Page\x20number','hidden':!![]},{'name':a167_0xc99923(0x177),'meowKey':a167_0xc99923(0x177),'type':a167_0xc99923(0x144),'description':a167_0xc99923(0x118),'hidden':!![]},{'name':a167_0xc99923(0x108),'meowKey':a167_0xc99923(0x108),'type':'string','description':a167_0xc99923(0x112),'hidden':!![]},{'name':'code','meowKey':a167_0xc99923(0x15b),'type':a167_0xc99923(0x144),'description':a167_0xc99923(0x157),'hidden':!![]},{'name':a167_0xc99923(0x159),'meowKey':a167_0xc99923(0x159),'type':a167_0xc99923(0x144),'description':a167_0xc99923(0x161),'hidden':!![]},{'name':a167_0xc99923(0x11a),'meowKey':a167_0xc99923(0x11a),'type':a167_0xc99923(0x144),'description':a167_0xc99923(0x138),'hidden':!![]},{'name':a167_0xc99923(0x165),'meowKey':'operation','type':a167_0xc99923(0x144),'description':a167_0xc99923(0x168),'hidden':!![]},{'name':a167_0xc99923(0x140),'meowKey':'target','type':a167_0xc99923(0x144),'description':a167_0xc99923(0x134),'hidden':!![]},{'name':a167_0xc99923(0x17b),'meowKey':a167_0xc99923(0x12d),'type':a167_0xc99923(0x126),'description':'Skip\x20import\x20generation','hidden':!![]},{'name':a167_0xc99923(0x130),'meowKey':'key','type':a167_0xc99923(0x144),'description':a167_0xc99923(0x131),'hidden':!![]},{'name':a167_0xc99923(0x176),'meowKey':a167_0xc99923(0x176),'type':'string','description':'Config\x20value','hidden':!![]},{'name':a167_0xc99923(0x172),'meowKey':a167_0xc99923(0x172),'type':a167_0xc99923(0x144),'description':a167_0xc99923(0x175),'hidden':!![]},{'name':a167_0xc99923(0x15d),'meowKey':'stdin','type':a167_0xc99923(0x126),'description':'Read\x20value\x20from\x20stdin','hidden':!![]},{'name':a167_0xc99923(0x179),'meowKey':a167_0xc99923(0x10d),'type':a167_0xc99923(0x144),'description':a167_0xc99923(0x127),'hidden':!![]},{'name':a167_0xc99923(0x14c),'meowKey':'reveal','type':a167_0xc99923(0x126),'description':a167_0xc99923(0x15a),'hidden':!![]},{'name':a167_0xc99923(0x166),'meowKey':a167_0xc99923(0x166),'type':'boolean','description':a167_0xc99923(0x124),'hidden':!![]},{'name':'confirm','meowKey':'confirm','type':a167_0xc99923(0x126),'description':a167_0xc99923(0x114),'hidden':!![]},{'name':a167_0xc99923(0x115),'meowKey':a167_0xc99923(0x115),'type':a167_0xc99923(0x126),'description':'Use\x20remote','hidden':!![]},{'name':a167_0xc99923(0x10b),'meowKey':a167_0xc99923(0x10b),'type':a167_0xc99923(0x126),'description':a167_0xc99923(0x163),'hidden':!![]},{'name':a167_0xc99923(0x153),'meowKey':a167_0xc99923(0x167),'type':a167_0xc99923(0x144),'description':a167_0xc99923(0x13c),'hidden':!![]},{'name':a167_0xc99923(0x16e),'meowKey':a167_0xc99923(0x16b),'type':a167_0xc99923(0x144),'description':a167_0xc99923(0x168),'hidden':!![]},{'name':a167_0xc99923(0x160),'meowKey':a167_0xc99923(0x13d),'type':'string','description':'Function\x20node','hidden':!![]}];function a167_0x1c09(){const _0x3e198b=['yes','tags','help','JSON\x20params','Tags','value','pagesize','717156yYhqiI','from-env','<name>','skip-imports','keyword','Description','6278760rFFuob','verbose','SQL\x20code','fromEnv','sqlname','Record\x20ID','SQL\x20name','datasetcode','Keyword\x20filter','Output\x20format','Confirm\x20destructive\x20action','remote','sqlcode','description-file','Page\x20size','type','schemas','DB\x20ID','json\x20|\x20pretty\x20|\x20compress','1371GazfdA','dbid','production\x20|\x20daily','File\x20path','name','map','Preview\x20operation\x20without\x20executing','Force\x20overwrite','Clear','boolean','Read\x20value\x20from\x20environment\x20variable','app','sql-name','Override\x20appcode','enableBffSave','6fzhjJQ','skipImports','Description\x20file','appcode','key','Config\x20key','descriptionFile','project','Target\x20path','4325455KNjXes','Type\x20filter','dbId','Schemas','Environment','<expr>','page','Expected\x20affected\x20count','functionNode','Use\x20project\x20config\x20scope','221760tbJWQK','target','14321960vyLIan','Name','clear','string','meowKey','non-interactive','Skip\x20confirmation\x20for\x20high-risk\x20writes','Watch\x20mode','@lovrabet/rabetbase-cli','global','Filter\x20JSON\x20output\x20(JQ_PATH\x20>\x20bundled\x20jq\x20>\x20PATH;\x20use\x20with\x20--format\x20json\x20or\x20compress)','reveal','file','Rabetbase\x20CLI','watch','env','all','enable-bff-save','expected-count','Force\x20non-interactive\x20mode\x20(CI)','20433DLYULR','Dataset\x20code','Code\x20filter','Use\x20global\x20config\x20scope','sql','Reveal\x20sensitive\x20value','code','format','stdin','sqlName','params','function-node','SQL\x20string','title','Verbose\x20output','Select\x20app\x20profile\x20by\x20name','operation','force','expectedCount','Operation\x20type','nonInteractive','Alias\x20for\x20--non-interactive','operationType','2716nCGtuK','1456OkOaWo','operation-type','Title','description'];a167_0x1c09=function(){return _0x3e198b;};return a167_0x1c09();}function a167_0x5de0(_0x585104,_0x47ec3e){_0x585104=_0x585104-0x108;const _0x1c0911=a167_0x1c09();let _0x5de0b9=_0x1c0911[_0x585104];return _0x5de0b9;}export const PIPELINE_FLAG_NAMES=new Set([a167_0xc99923(0x12f),a167_0xc99923(0x128),a167_0xc99923(0x150),a167_0xc99923(0x15c),'jq','dry-run',a167_0xc99923(0x171),'non-interactive','ci']);export function buildMeowFlags(){const _0x45240c=a167_0xc99923;return Object['fromEntries'](GLOBAL_FLAGS[_0x45240c(0x122)](_0x19f30f=>[_0x19f30f[_0x45240c(0x145)],{'type':_0x19f30f[_0x45240c(0x119)]}]));}
|
package/lib/constant/defaults.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a168_0x39cf(_0x4f29cc,_0x414508){_0x4f29cc=_0x4f29cc-0x1ee;const _0x26a219=a168_0x26a2();let _0x39cf23=_0x26a219[_0x4f29cc];return _0x39cf23;}const a168_0x379f15=a168_0x39cf;(function(_0x507c57,_0x19f090){const _0x4fe173=a168_0x39cf,_0x5370e1=_0x507c57();while(!![]){try{const _0x490604=-parseInt(_0x4fe173(0x1ee))/0x1+parseInt(_0x4fe173(0x1f4))/0x2*(-parseInt(_0x4fe173(0x1f3))/0x3)+parseInt(_0x4fe173(0x1f0))/0x4+-parseInt(_0x4fe173(0x1f1))/0x5+parseInt(_0x4fe173(0x1f6))/0x6+parseInt(_0x4fe173(0x1ef))/0x7+parseInt(_0x4fe173(0x1f5))/0x8;if(_0x490604===_0x19f090)break;else _0x5370e1['push'](_0x5370e1['shift']());}catch(_0x353f45){_0x5370e1['push'](_0x5370e1['shift']());}}}(a168_0x26a2,0x6853c));import{DEFAULT_API_DIR}from'../constant/paths.js';function a168_0x26a2(){const _0x4d3862=['24FAwwVy','1577416SKWClM','3230868tJLLqR','846360qXgbIa','5762596aMpfdT','2618256BKppIR','3462095WdMxNB','compress','61836YBYeAx'];a168_0x26a2=function(){return _0x4d3862;};return a168_0x26a2();}export const DEFAULT_CONFIG_VALUES={'env':'production','format':a168_0x379f15(0x1f2),'locale':'en-US','riskLevel':'high-risk-write','apiDir':DEFAULT_API_DIR};export const DEFAULT_COMMAND_OUTPUT_FORMAT=a168_0x379f15(0x1f2);
|