@lovrabet/rabetbase-cli 2.3.6 → 2.3.7-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/api-doc.js +1 -1
- package/lib/api/fetch-model-list.js +1 -1
- package/lib/api/generate-api-file.js +1 -1
- package/lib/auth/auth-server-ui.js +1 -1
- package/lib/auth/auth-server.js +1 -1
- package/lib/auth/constant.js +1 -1
- package/lib/auth/get-cookie.js +1 -1
- package/lib/auth/get-session-user.js +1 -1
- package/lib/auth/is-session-valid.js +1 -1
- package/lib/auth/login-success-html.js +1 -1
- package/lib/auth/logout.js +1 -1
- package/lib/cli-flags.js +1 -1
- package/lib/cli.js +1 -1
- package/lib/commands/api/generate.js +1 -1
- package/lib/commands/api/index.js +1 -1
- package/lib/commands/api/list.js +1 -1
- package/lib/commands/api/pull.js +1 -1
- package/lib/commands/api/shared.js +1 -1
- package/lib/commands/app/add.js +1 -1
- package/lib/commands/app/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/local-file.js +1 -0
- 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/file/index.js +1 -0
- 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_0x3c5819=a156_0x5b38;(function(_0x85826a,_0x405240){const _0x11b64c=a156_0x5b38,_0x5858e0=_0x85826a();while(!![]){try{const _0x18c7ac=parseInt(_0x11b64c(0x1f5))/0x1+-parseInt(_0x11b64c(0x1c6))/0x2*(-parseInt(_0x11b64c(0x1dc))/0x3)+parseInt(_0x11b64c(0x1dd))/0x4*(parseInt(_0x11b64c(0x1f1))/0x5)+-parseInt(_0x11b64c(0x1ed))/0x6*(parseInt(_0x11b64c(0x1ff))/0x7)+-parseInt(_0x11b64c(0x1d3))/0x8+-parseInt(_0x11b64c(0x1e2))/0x9+-parseInt(_0x11b64c(0x1ce))/0xa;if(_0x18c7ac===_0x405240)break;else _0x5858e0['push'](_0x5858e0['shift']());}catch(_0x233200){_0x5858e0['push'](_0x5858e0['shift']());}}}(a156_0x3210,0xa3f29));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';function a156_0x5b38(_0xb005fd,_0x1ff9a3){_0xb005fd=_0xb005fd-0x1c6;const _0x32106f=a156_0x3210();let _0x5b3820=_0x32106f[_0xb005fd];return _0x5b3820;}import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';function a156_0x3210(){const _0x2993fe=['toISOString','Filter\x20by\x20SQL\x20display\x20name','sqlcode','sqlCode','sqls','279iPMYjF','24Qszikz','mybatisXml','description','sql','push','4716324PYasQx','catch','appCode','sqlRoot','conflict','lastSync','write','tableData','dbId','test','sqlName','1288398pUiZgV','No\x20remote\x20SQL\x20queries\x20matched.','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','paging','1017550skJVvS','sqlContent','trimStart','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','80430GnXuEC','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','Force\x20overwrite\x20local\x20unsynced\x20changes','unchanged','string','Force\x20pull\x20cancelled.','length','lockFilePath','cancelled','Would\x20pull\x20','21gfFQwr','\x20written,\x20','local\x20differs\x20from\x20remote','21236ECOWWC','skipped','pull','POST','name','replace','path','str','1741890WnpQvk','apps','sqlRootDir','\x20SQL\x20file(s)\x20into\x20','utf8','2200088jiLVlD','force','filter','message'];a156_0x3210=function(){return _0x2993fe;};return a156_0x3210();}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(_0x1b6357,_0x7063bc){const _0x4bb2d0=a156_0x5b38,_0x9b0f9a=[];let _0x3ad9d7=0x1;while(!![]){const _0x46966b=await listSqlQueries(_0x1b6357,{'currentPage':_0x3ad9d7,'pageSize':PAGE_SIZE,'sqlCode':_0x7063bc[_0x4bb2d0(0x1da)],'sqlName':_0x7063bc[_0x4bb2d0(0x1ec)]}),_0x50eb57=_0x46966b[_0x4bb2d0(0x1e9)]??[];_0x9b0f9a[_0x4bb2d0(0x1e1)](..._0x50eb57);if(_0x50eb57[_0x4bb2d0(0x1fb)]===0x0)break;const _0x43f87d=_0x46966b[_0x4bb2d0(0x1f0)]?.['totalCount'];if(_0x43f87d!=null?_0x9b0f9a[_0x4bb2d0(0x1fb)]>=_0x43f87d:_0x50eb57[_0x4bb2d0(0x1fb)]<PAGE_SIZE)break;_0x3ad9d7++;}return _0x9b0f9a;}async function ensureSqlContent(_0x1b04b0){const _0x68dffa=a156_0x5b38;if(_0x1b04b0[_0x68dffa(0x1f2)]!=null&&String(_0x1b04b0['sqlContent'])[_0x68dffa(0x1fb)]>0x0)return _0x1b04b0;return getSqlQueryDetail(_0x1b04b0['sqlCode']);}export const sqlPull={'service':a156_0x3c5819(0x1e0),'command':a156_0x3c5819(0x1c8),'description':a156_0x3c5819(0x1f6),'risk':a156_0x3c5819(0x1e8),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'name','type':a156_0x3c5819(0x1f9),'description':a156_0x3c5819(0x1d8)},{'name':'force','type':'boolean','description':a156_0x3c5819(0x1f7)}],async 'dryRun'(_0x2fccd7){const _0x4f086f=a156_0x3c5819,_0xbb6647=loadSqlProjectConfig(_0x2fccd7[_0x4f086f(0x1e4)]),_0x47e9b6=await readSqlLockFile(_0xbb6647[_0x4f086f(0x1fc)]),{appLock:_0x3753dd}=ensureSqlLockScope(_0x47e9b6??createEmptySqlLock(),_0xbb6647[_0x4f086f(0x1e4)],_0xbb6647[_0x4f086f(0x1e5)],_0x4f086f(0x1c8)),_0x213ce3=await fetchAllSqlQueries(_0x2fccd7[_0x4f086f(0x1e4)],{'sqlCode':_0x2fccd7['str'](_0x4f086f(0x1d9))||undefined,'sqlName':_0x2fccd7[_0x4f086f(0x1cd)](_0x4f086f(0x1ca))||undefined}),_0x36ceaf=[];for(const _0x307dd2 of _0x213ce3){const _0x55417d=await ensureSqlContent(_0x307dd2),_0x1d4110=ensureRemoteSqlContent(_0x55417d),_0x5ec41f=detectModeFromSql(_0x55417d),_0x3160b6=_0x55417d[_0x4f086f(0x1ea)]?await getDbName(_0x2fccd7[_0x4f086f(0x1e4)],Number(_0x55417d[_0x4f086f(0x1ea)]))[_0x4f086f(0x1e3)](()=>undefined):undefined,_0x4fafb5=buildLocalSqlFileContent({'sqlCode':_0x55417d[_0x4f086f(0x1da)],'sqlName':_0x55417d[_0x4f086f(0x1ec)],'dbId':_0x55417d[_0x4f086f(0x1ea)]},_0x1d4110,{'dbName':_0x3160b6,'mode':_0x5ec41f,'syncedAt':new Date()[_0x4f086f(0x1d7)](),'description':_0x55417d[_0x4f086f(0x1df)]}),_0x42b60b=buildSqlLockEntry(_0x55417d,_0x1d4110,'',{'dbName':_0x3160b6}),_0x12baa9=resolveLocalSqlFilePath(_0xbb6647,_0x55417d['sqlCode'],_0x42b60b);let _0x47e07a='would_pull',_0x4b4f79;if(await fileExists(_0x12baa9)){const _0x24bca3=await readFile(_0x12baa9,'utf8');isEquivalentPulledSqlFile(_0x24bca3,_0x4fafb5,_0x5ec41f)?(_0x47e07a=_0x4f086f(0x1c7),_0x4b4f79=_0x4f086f(0x1f8)):(_0x47e07a=_0x4f086f(0x1e6),_0x4b4f79='local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)');}_0x36ceaf[_0x4f086f(0x1e1)]({'sqlCode':_0x55417d[_0x4f086f(0x1da)],'sqlName':_0x55417d['sqlName'],'filePath':_0x12baa9,'status':_0x47e07a,'reason':_0x4b4f79});}return{'method':_0x4f086f(0x1c9),'url':_0x4f086f(0x1f4),'body':{'appCode':_0x2fccd7[_0x4f086f(0x1e4)],'sqlCode':_0x2fccd7[_0x4f086f(0x1cd)]('sqlcode')||null,'sqlName':_0x2fccd7[_0x4f086f(0x1cd)](_0x4f086f(0x1ca))||null,'files':_0x36ceaf},'description':_0x4f086f(0x1fe)+_0x36ceaf['length']+_0x4f086f(0x1d1)+_0xbb6647[_0x4f086f(0x1d0)]};},async 'execute'(_0x584d29){const _0x135169=a156_0x3c5819,_0x1cace1=loadSqlProjectConfig(_0x584d29[_0x135169(0x1e4)]),_0x5eeff6=await readSqlLockFile(_0x1cace1[_0x135169(0x1fc)]),{lockData:_0x3f327e,appLock:_0x4dc0ee}=ensureSqlLockScope(_0x5eeff6??createEmptySqlLock(),_0x1cace1[_0x135169(0x1e4)],_0x1cace1[_0x135169(0x1e5)],'pull'),_0x46e3ca=_0x584d29['bool'](_0x135169(0x1d4)),_0x2f9d1b=await fetchAllSqlQueries(_0x584d29[_0x135169(0x1e4)],{'sqlCode':_0x584d29[_0x135169(0x1cd)](_0x135169(0x1d9))||undefined,'sqlName':_0x584d29[_0x135169(0x1cd)](_0x135169(0x1ca))||undefined});if(_0x2f9d1b[_0x135169(0x1fb)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x135169(0x1ee)};const _0x1b65b6=[],_0x3d6e63=[];for(const _0x1b5e00 of _0x2f9d1b){try{_0x1b65b6[_0x135169(0x1e1)](await ensureSqlContent(_0x1b5e00));}catch(_0x2ffea5){_0x3d6e63[_0x135169(0x1e1)]({'sqlCode':_0x1b5e00[_0x135169(0x1da)],'error':_0x2ffea5 instanceof Error?_0x2ffea5[_0x135169(0x1d6)]:String(_0x2ffea5)});}}if(_0x46e3ca&&!_0x584d29['nonInteractive']){let _0xd7b443=![];for(const _0x1007d3 of _0x1b65b6){const _0x1ed436=detectModeFromSql(_0x1007d3),_0x159b29=_0x1007d3[_0x135169(0x1ea)]?await getDbName(_0x584d29['appCode'],Number(_0x1007d3[_0x135169(0x1ea)]))[_0x135169(0x1e3)](()=>undefined):undefined,_0x134120=buildLocalSqlFileContent({'sqlCode':_0x1007d3[_0x135169(0x1da)],'sqlName':_0x1007d3[_0x135169(0x1ec)],'dbId':_0x1007d3['dbId']},ensureRemoteSqlContent(_0x1007d3),{'dbName':_0x159b29,'mode':_0x1ed436,'syncedAt':new Date()[_0x135169(0x1d7)](),'description':_0x1007d3[_0x135169(0x1df)]}),_0x97cce4=resolveLocalSqlFilePath(_0x1cace1,_0x1007d3[_0x135169(0x1da)],buildSqlLockEntry(_0x1007d3,ensureRemoteSqlContent(_0x1007d3),'',{'dbName':_0x159b29}));if(await fileExists(_0x97cce4)){const _0x1695f1=await readFile(_0x97cce4,'utf8');if(!isEquivalentPulledSqlFile(_0x1695f1,_0x134120,_0x1ed436)){_0xd7b443=!![];break;}}}if(_0xd7b443){const _0x46bb1e=await confirmForceOverwrite(_0x135169(0x1ef));if(!_0x46bb1e)throw CliErrors[_0x135169(0x1fd)](_0x135169(0x1fa));}}const _0x4487ac=cloneSqlLockData(_0x3f327e),_0x3a1d6d=_0x4487ac[_0x135169(0x1cf)][_0x1cace1[_0x135169(0x1e4)]],_0x32effb=[],_0x1c2796=[];for(const _0x23088f of _0x1b65b6){const _0x275f2a=_0x3a1d6d[_0x135169(0x1db)][_0x23088f[_0x135169(0x1da)]],_0x314752=ensureRemoteSqlContent(_0x23088f),_0x1d3870=detectModeFromSql(_0x23088f),_0x26d90e=_0x23088f['dbId']?await getDbName(_0x584d29[_0x135169(0x1e4)],Number(_0x23088f[_0x135169(0x1ea)]))['catch'](()=>undefined):undefined,_0x50b9d8=buildLocalSqlFileContent({'sqlCode':_0x23088f['sqlCode'],'sqlName':_0x23088f['sqlName'],'dbId':_0x23088f['dbId']},_0x314752,{'dbName':_0x26d90e,'mode':_0x1d3870,'syncedAt':new Date()[_0x135169(0x1d7)](),'description':_0x23088f[_0x135169(0x1df)]}),_0x350120=buildSqlLockEntry(_0x23088f,_0x314752,computeSqlContentHash(_0x50b9d8),{'dbName':_0x26d90e}),_0x43fc13=_0x350120[_0x135169(0x1cc)],_0x80f10e=join(_0x1cace1[_0x135169(0x1d0)],_0x43fc13);try{if(await fileExists(_0x80f10e)){const _0x124f51=await readFile(_0x80f10e,'utf8');if(isEquivalentPulledSqlFile(_0x124f51,_0x50b9d8,_0x1d3870)){_0x1c2796['push']({'sqlCode':_0x23088f['sqlCode'],'reason':'unchanged'}),_0x3a1d6d[_0x135169(0x1db)][_0x23088f[_0x135169(0x1da)]]={..._0x350120,'hash':computeSqlContentHash(_0x124f51),'path':_0x43fc13};continue;}if(!_0x46e3ca){_0x1c2796['push']({'sqlCode':_0x23088f[_0x135169(0x1da)],'reason':_0x135169(0x201)});continue;}}const _0x4947af=_0x275f2a?.['path']?join(_0x1cace1[_0x135169(0x1d0)],_0x275f2a[_0x135169(0x1cc)]):undefined;_0x4947af&&_0x4947af!==_0x80f10e&&await fileExists(_0x4947af)&&await rm(_0x4947af,{'force':!![]}),await ensureParentDirectory(_0x80f10e),await writeFile(_0x80f10e,_0x50b9d8,_0x135169(0x1d2)),_0x3a1d6d[_0x135169(0x1db)][_0x23088f[_0x135169(0x1da)]]={..._0x350120,'path':_0x43fc13},_0x32effb[_0x135169(0x1e1)]({'sqlCode':_0x23088f[_0x135169(0x1da)],'filePath':_0x80f10e});}catch(_0x586313){_0x3d6e63['push']({'sqlCode':_0x23088f['sqlCode'],'error':_0x586313 instanceof Error?_0x586313[_0x135169(0x1d6)]:String(_0x586313)});}}return _0x3a1d6d[_0x135169(0x1e7)]=new Date()[_0x135169(0x1d7)](),await writeSqlLockFile(_0x1cace1[_0x135169(0x1fc)],_0x4487ac),{'ok':_0x3d6e63['length']===0x0,'data':{'pulled':_0x32effb,'skipped':_0x1c2796,'failed':_0x3d6e63},'message':'Pull\x20complete:\x20'+_0x32effb[_0x135169(0x1fb)]+_0x135169(0x200)+_0x1c2796[_0x135169(0x1fb)]+'\x20skipped,\x20'+_0x3d6e63['length']+'\x20failed'};}};function detectModeFromSql(_0xe1e4af){const _0x72b6a4=a156_0x3c5819,_0x2fb697=ensureRemoteSqlContent(_0xe1e4af),_0x22ea1d=stripLocalSqlMetadata(_0x2fb697,_0x72b6a4(0x1de))[_0x72b6a4(0x1f3)]();if(/^<(select|insert|update|delete)\b/i[_0x72b6a4(0x1eb)](_0x22ea1d))return _0x72b6a4(0x1de);return _0x72b6a4(0x1e0);}function isEquivalentPulledSqlFile(_0x192d31,_0x28d25f,_0x11e50e){return normalizePullComparableContent(_0x192d31,_0x11e50e)===normalizePullComparableContent(_0x28d25f,_0x11e50e);}function normalizePullComparableContent(_0xd60c24,_0x3dd52a){const _0x24532b=a156_0x3c5819,_0x38e2ea=_0xd60c24[_0x24532b(0x1cb)](/\r\n/g,'\x0a')['split']('\x0a'),_0xf71e49=_0x38e2ea[_0x24532b(0x1d5)](_0x2c0f2=>!isSyncedAtMetadataLine(_0x2c0f2,_0x3dd52a));return _0xf71e49['join']('\x0a');}function isSyncedAtMetadataLine(_0x156da5,_0x3781d4){const _0x326488=a156_0x3c5819;if(_0x3781d4===_0x326488(0x1de))return/^\s*<!--\s*@lovrabet\.syncedAt:/['test'](_0x156da5);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x326488(0x1eb)](_0x156da5);}
|
|
1
|
+
const a158_0x36f9dc=a158_0x5ff6;(function(_0x5eaee1,_0x3f1d0e){const _0x31747d=a158_0x5ff6,_0x45321b=_0x5eaee1();while(!![]){try{const _0x412cbd=-parseInt(_0x31747d(0xaf))/0x1*(-parseInt(_0x31747d(0xe2))/0x2)+-parseInt(_0x31747d(0xaa))/0x3*(-parseInt(_0x31747d(0xad))/0x4)+-parseInt(_0x31747d(0xba))/0x5*(parseInt(_0x31747d(0xab))/0x6)+parseInt(_0x31747d(0xcb))/0x7*(-parseInt(_0x31747d(0xde))/0x8)+-parseInt(_0x31747d(0xd9))/0x9*(-parseInt(_0x31747d(0xdc))/0xa)+-parseInt(_0x31747d(0xe5))/0xb*(parseInt(_0x31747d(0xe3))/0xc)+-parseInt(_0x31747d(0xd3))/0xd*(-parseInt(_0x31747d(0xd5))/0xe);if(_0x412cbd===_0x3f1d0e)break;else _0x45321b['push'](_0x45321b['shift']());}catch(_0x833faf){_0x45321b['push'](_0x45321b['shift']());}}}(a158_0x2550,0x41220));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';function a158_0x2550(){const _0x465858=['local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','bool','nonInteractive','217365xawggd','description','utf8','join','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','str','string','sqlcode','replace','tableData','toISOString','path','sqlName','sqlCode','appCode','filter','\x20written,\x20','1862VFiMKk','lastSync','apps','unchanged','trimStart','cancelled','message','catch','6929JKvDBF','test','14434VJQPUC','No\x20remote\x20SQL\x20queries\x20matched.','conflict','sql','69453UmfXgY','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','push','110RnRqFF','lockFilePath','9560QtoUsm','sqlRoot','sqlContent','sqls','1908EzBbjQ','78612JrrCJf','split','649ICMPeJ','pull','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','write','Force\x20overwrite\x20local\x20unsynced\x20changes','501eClkbt','66FrImgp','dbId','11568KVQxrz','Filter\x20by\x20SQL\x20display\x20name','348nPKHFs','length','mybatisXml','Pull\x20complete:\x20','name','force','local\x20differs\x20from\x20remote','Force\x20pull\x20cancelled.'];a158_0x2550=function(){return _0x465858;};return a158_0x2550();}import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';function a158_0x5ff6(_0x11aaae,_0x484bf1){_0x11aaae=_0x11aaae-0xa9;const _0x2550a5=a158_0x2550();let _0x5ff666=_0x2550a5[_0x11aaae];return _0x5ff666;}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(_0x4c5f0c,_0x246bde){const _0x21333c=a158_0x5ff6,_0x59dd9d=[];let _0x4a46cc=0x1;while(!![]){const _0x3f0fc2=await listSqlQueries(_0x4c5f0c,{'currentPage':_0x4a46cc,'pageSize':PAGE_SIZE,'sqlCode':_0x246bde['sqlCode'],'sqlName':_0x246bde['sqlName']}),_0x31004d=_0x3f0fc2[_0x21333c(0xc3)]??[];_0x59dd9d[_0x21333c(0xdb)](..._0x31004d);if(_0x31004d[_0x21333c(0xb0)]===0x0)break;const _0x3a5317=_0x3f0fc2['paging']?.['totalCount'];if(_0x3a5317!=null?_0x59dd9d['length']>=_0x3a5317:_0x31004d['length']<PAGE_SIZE)break;_0x4a46cc++;}return _0x59dd9d;}async function ensureSqlContent(_0x461d85){const _0x3b70c3=a158_0x5ff6;if(_0x461d85['sqlContent']!=null&&String(_0x461d85[_0x3b70c3(0xe0)])[_0x3b70c3(0xb0)]>0x0)return _0x461d85;return getSqlQueryDetail(_0x461d85[_0x3b70c3(0xc7)]);}export const sqlPull={'service':a158_0x36f9dc(0xd8),'command':'pull','description':a158_0x36f9dc(0xbe),'risk':a158_0x36f9dc(0xe8),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a158_0x36f9dc(0xb3),'type':a158_0x36f9dc(0xc0),'description':a158_0x36f9dc(0xae)},{'name':a158_0x36f9dc(0xb4),'type':'boolean','description':a158_0x36f9dc(0xa9)}],async 'dryRun'(_0x30b7e0){const _0x45c60b=a158_0x36f9dc,_0x25cce7=loadSqlProjectConfig(_0x30b7e0['appCode']),_0x3c5983=await readSqlLockFile(_0x25cce7[_0x45c60b(0xdd)]),{appLock:_0x359c9c}=ensureSqlLockScope(_0x3c5983??createEmptySqlLock(),_0x25cce7[_0x45c60b(0xc8)],_0x25cce7[_0x45c60b(0xdf)],_0x45c60b(0xe6)),_0x596f31=await fetchAllSqlQueries(_0x30b7e0[_0x45c60b(0xc8)],{'sqlCode':_0x30b7e0[_0x45c60b(0xbf)](_0x45c60b(0xc1))||undefined,'sqlName':_0x30b7e0['str'](_0x45c60b(0xb3))||undefined}),_0x295d25=[];for(const _0x3df544 of _0x596f31){const _0x2740bc=await ensureSqlContent(_0x3df544),_0x371c60=ensureRemoteSqlContent(_0x2740bc),_0x53bdce=detectModeFromSql(_0x2740bc),_0x4424e0=_0x2740bc[_0x45c60b(0xac)]?await getDbName(_0x30b7e0[_0x45c60b(0xc8)],Number(_0x2740bc['dbId']))[_0x45c60b(0xd2)](()=>undefined):undefined,_0x4618a8=buildLocalSqlFileContent({'sqlCode':_0x2740bc[_0x45c60b(0xc7)],'sqlName':_0x2740bc[_0x45c60b(0xc6)],'dbId':_0x2740bc[_0x45c60b(0xac)]},_0x371c60,{'dbName':_0x4424e0,'mode':_0x53bdce,'syncedAt':new Date()[_0x45c60b(0xc4)](),'description':_0x2740bc[_0x45c60b(0xbb)]}),_0x4ff6f6=buildSqlLockEntry(_0x2740bc,_0x371c60,'',{'dbName':_0x4424e0}),_0x429e10=resolveLocalSqlFilePath(_0x25cce7,_0x2740bc[_0x45c60b(0xc7)],_0x4ff6f6);let _0x263988='would_pull',_0x51093a;if(await fileExists(_0x429e10)){const _0x4a9d3c=await readFile(_0x429e10,_0x45c60b(0xbc));isEquivalentPulledSqlFile(_0x4a9d3c,_0x4618a8,_0x53bdce)?(_0x263988='skipped',_0x51093a=_0x45c60b(0xce)):(_0x263988=_0x45c60b(0xd7),_0x51093a=_0x45c60b(0xb7));}_0x295d25[_0x45c60b(0xdb)]({'sqlCode':_0x2740bc[_0x45c60b(0xc7)],'sqlName':_0x2740bc[_0x45c60b(0xc6)],'filePath':_0x429e10,'status':_0x263988,'reason':_0x51093a});}return{'method':'POST','url':_0x45c60b(0xda),'body':{'appCode':_0x30b7e0[_0x45c60b(0xc8)],'sqlCode':_0x30b7e0[_0x45c60b(0xbf)](_0x45c60b(0xc1))||null,'sqlName':_0x30b7e0[_0x45c60b(0xbf)](_0x45c60b(0xb3))||null,'files':_0x295d25},'description':'Would\x20pull\x20'+_0x295d25[_0x45c60b(0xb0)]+'\x20SQL\x20file(s)\x20into\x20'+_0x25cce7['sqlRootDir']};},async 'execute'(_0x5c0ba4){const _0x147bd2=a158_0x36f9dc,_0x278263=loadSqlProjectConfig(_0x5c0ba4[_0x147bd2(0xc8)]),_0x10b4b8=await readSqlLockFile(_0x278263[_0x147bd2(0xdd)]),{lockData:_0x4063e8,appLock:_0xea551f}=ensureSqlLockScope(_0x10b4b8??createEmptySqlLock(),_0x278263['appCode'],_0x278263['sqlRoot'],_0x147bd2(0xe6)),_0xf92904=_0x5c0ba4[_0x147bd2(0xb8)](_0x147bd2(0xb4)),_0x3e8f56=await fetchAllSqlQueries(_0x5c0ba4['appCode'],{'sqlCode':_0x5c0ba4['str'](_0x147bd2(0xc1))||undefined,'sqlName':_0x5c0ba4[_0x147bd2(0xbf)](_0x147bd2(0xb3))||undefined});if(_0x3e8f56[_0x147bd2(0xb0)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x147bd2(0xd6)};const _0x308fdb=[],_0x8d6673=[];for(const _0x24d239 of _0x3e8f56){try{_0x308fdb[_0x147bd2(0xdb)](await ensureSqlContent(_0x24d239));}catch(_0x144b2a){_0x8d6673[_0x147bd2(0xdb)]({'sqlCode':_0x24d239['sqlCode'],'error':_0x144b2a instanceof Error?_0x144b2a[_0x147bd2(0xd1)]:String(_0x144b2a)});}}if(_0xf92904&&!_0x5c0ba4[_0x147bd2(0xb9)]){let _0x3c7145=![];for(const _0x2226c6 of _0x308fdb){const _0x45c015=detectModeFromSql(_0x2226c6),_0x453304=_0x2226c6[_0x147bd2(0xac)]?await getDbName(_0x5c0ba4['appCode'],Number(_0x2226c6[_0x147bd2(0xac)]))[_0x147bd2(0xd2)](()=>undefined):undefined,_0x1ff584=buildLocalSqlFileContent({'sqlCode':_0x2226c6[_0x147bd2(0xc7)],'sqlName':_0x2226c6[_0x147bd2(0xc6)],'dbId':_0x2226c6[_0x147bd2(0xac)]},ensureRemoteSqlContent(_0x2226c6),{'dbName':_0x453304,'mode':_0x45c015,'syncedAt':new Date()[_0x147bd2(0xc4)](),'description':_0x2226c6['description']}),_0x118e1a=resolveLocalSqlFilePath(_0x278263,_0x2226c6[_0x147bd2(0xc7)],buildSqlLockEntry(_0x2226c6,ensureRemoteSqlContent(_0x2226c6),'',{'dbName':_0x453304}));if(await fileExists(_0x118e1a)){const _0x12b81e=await readFile(_0x118e1a,'utf8');if(!isEquivalentPulledSqlFile(_0x12b81e,_0x1ff584,_0x45c015)){_0x3c7145=!![];break;}}}if(_0x3c7145){const _0x11aede=await confirmForceOverwrite(_0x147bd2(0xe7));if(!_0x11aede)throw CliErrors[_0x147bd2(0xd0)](_0x147bd2(0xb6));}}const _0x4eca2a=cloneSqlLockData(_0x4063e8),_0x1605d8=_0x4eca2a[_0x147bd2(0xcd)][_0x278263[_0x147bd2(0xc8)]],_0x32e46c=[],_0x2bef38=[];for(const _0x285f57 of _0x308fdb){const _0x377a15=_0x1605d8[_0x147bd2(0xe1)][_0x285f57[_0x147bd2(0xc7)]],_0x462834=ensureRemoteSqlContent(_0x285f57),_0x4cb2da=detectModeFromSql(_0x285f57),_0x614c7d=_0x285f57['dbId']?await getDbName(_0x5c0ba4[_0x147bd2(0xc8)],Number(_0x285f57['dbId']))[_0x147bd2(0xd2)](()=>undefined):undefined,_0x52dee4=buildLocalSqlFileContent({'sqlCode':_0x285f57[_0x147bd2(0xc7)],'sqlName':_0x285f57[_0x147bd2(0xc6)],'dbId':_0x285f57[_0x147bd2(0xac)]},_0x462834,{'dbName':_0x614c7d,'mode':_0x4cb2da,'syncedAt':new Date()[_0x147bd2(0xc4)](),'description':_0x285f57[_0x147bd2(0xbb)]}),_0x117a78=buildSqlLockEntry(_0x285f57,_0x462834,computeSqlContentHash(_0x52dee4),{'dbName':_0x614c7d}),_0x250a5a=_0x117a78[_0x147bd2(0xc5)],_0x4c2771=join(_0x278263['sqlRootDir'],_0x250a5a);try{if(await fileExists(_0x4c2771)){const _0x5de895=await readFile(_0x4c2771,_0x147bd2(0xbc));if(isEquivalentPulledSqlFile(_0x5de895,_0x52dee4,_0x4cb2da)){_0x2bef38['push']({'sqlCode':_0x285f57['sqlCode'],'reason':'unchanged'}),_0x1605d8['sqls'][_0x285f57[_0x147bd2(0xc7)]]={..._0x117a78,'hash':computeSqlContentHash(_0x5de895),'path':_0x250a5a};continue;}if(!_0xf92904){_0x2bef38[_0x147bd2(0xdb)]({'sqlCode':_0x285f57['sqlCode'],'reason':_0x147bd2(0xb5)});continue;}}const _0x2cac30=_0x377a15?.[_0x147bd2(0xc5)]?join(_0x278263['sqlRootDir'],_0x377a15[_0x147bd2(0xc5)]):undefined;_0x2cac30&&_0x2cac30!==_0x4c2771&&await fileExists(_0x2cac30)&&await rm(_0x2cac30,{'force':!![]}),await ensureParentDirectory(_0x4c2771),await writeFile(_0x4c2771,_0x52dee4,_0x147bd2(0xbc)),_0x1605d8[_0x147bd2(0xe1)][_0x285f57['sqlCode']]={..._0x117a78,'path':_0x250a5a},_0x32e46c[_0x147bd2(0xdb)]({'sqlCode':_0x285f57[_0x147bd2(0xc7)],'filePath':_0x4c2771});}catch(_0x4c1acd){_0x8d6673['push']({'sqlCode':_0x285f57['sqlCode'],'error':_0x4c1acd instanceof Error?_0x4c1acd[_0x147bd2(0xd1)]:String(_0x4c1acd)});}}return _0x1605d8[_0x147bd2(0xcc)]=new Date()[_0x147bd2(0xc4)](),await writeSqlLockFile(_0x278263[_0x147bd2(0xdd)],_0x4eca2a),{'ok':_0x8d6673[_0x147bd2(0xb0)]===0x0,'data':{'pulled':_0x32e46c,'skipped':_0x2bef38,'failed':_0x8d6673},'message':_0x147bd2(0xb2)+_0x32e46c[_0x147bd2(0xb0)]+_0x147bd2(0xca)+_0x2bef38[_0x147bd2(0xb0)]+'\x20skipped,\x20'+_0x8d6673[_0x147bd2(0xb0)]+'\x20failed'};}};function detectModeFromSql(_0x331577){const _0x26867a=a158_0x36f9dc,_0x5acbc8=ensureRemoteSqlContent(_0x331577),_0x460b5a=stripLocalSqlMetadata(_0x5acbc8,_0x26867a(0xb1))[_0x26867a(0xcf)]();if(/^<(select|insert|update|delete)\b/i['test'](_0x460b5a))return _0x26867a(0xb1);return _0x26867a(0xd8);}function isEquivalentPulledSqlFile(_0x4c75c6,_0x3b879f,_0x408c40){return normalizePullComparableContent(_0x4c75c6,_0x408c40)===normalizePullComparableContent(_0x3b879f,_0x408c40);}function normalizePullComparableContent(_0x5e4397,_0x470526){const _0x13c012=a158_0x36f9dc,_0x4d5e0b=_0x5e4397[_0x13c012(0xc2)](/\r\n/g,'\x0a')[_0x13c012(0xe4)]('\x0a'),_0xe6fce2=_0x4d5e0b[_0x13c012(0xc9)](_0x30c37e=>!isSyncedAtMetadataLine(_0x30c37e,_0x470526));return _0xe6fce2[_0x13c012(0xbd)]('\x0a');}function isSyncedAtMetadataLine(_0x212b77,_0x4c8314){const _0x44e873=a158_0x36f9dc;if(_0x4c8314===_0x44e873(0xb1))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x44e873(0xd4)](_0x212b77);return/^\s*--\s*@lovrabet\.syncedAt:/['test'](_0x212b77);}
|
package/lib/commands/sql/push.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a157_0x56aecf=a157_0x5cbd;(function(_0x40b394,_0xc0ea85){const _0x2ebd98=a157_0x5cbd,_0x20ac40=_0x40b394();while(!![]){try{const _0x4a75b4=parseInt(_0x2ebd98(0x20f))/0x1+-parseInt(_0x2ebd98(0x213))/0x2+-parseInt(_0x2ebd98(0x1fa))/0x3*(parseInt(_0x2ebd98(0x1ec))/0x4)+parseInt(_0x2ebd98(0x212))/0x5*(-parseInt(_0x2ebd98(0x1fb))/0x6)+parseInt(_0x2ebd98(0x216))/0x7*(-parseInt(_0x2ebd98(0x1ea))/0x8)+parseInt(_0x2ebd98(0x1e0))/0x9+-parseInt(_0x2ebd98(0x1f6))/0xa*(-parseInt(_0x2ebd98(0x1e4))/0xb);if(_0x4a75b4===_0xc0ea85)break;else _0x20ac40['push'](_0x20ac40['shift']());}catch(_0x18568c){_0x20ac40['push'](_0x20ac40['shift']());}}}(a157_0x2389,0x20236));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';function a157_0x5cbd(_0x40ff17,_0x250070){_0x40ff17=_0x40ff17-0x1de;const _0x238913=a157_0x2389();let _0x5cbde3=_0x238913[_0x40ff17];return _0x5cbde3;}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(_0xce3a56,_0x33d505,_0x15f998){const _0xe8132c=a157_0x5cbd,_0x41a9af=await scanLocalSqlQueries(_0xce3a56),_0x3a2b37=new Map();for(const _0x513815 of _0x41a9af){if(_0x15f998&&_0x513815['sqlCode']!==_0x15f998)continue;const _0x16cd93=_0x3a2b37[_0xe8132c(0x202)](_0x513815[_0xe8132c(0x1f0)])??[];_0x16cd93[_0xe8132c(0x1ed)](_0x513815),_0x3a2b37['set'](_0x513815[_0xe8132c(0x1f0)],_0x16cd93);}if(_0x15f998&&!_0x3a2b37[_0xe8132c(0x20d)](_0x15f998))throw CliErrors[_0xe8132c(0x1f3)]('Local\x20SQL\x20not\x20found:\x20'+_0x15f998);const _0x32298d=[];for(const [_0x13153f,_0x48f35b]of _0x3a2b37['entries']()){if(_0x48f35b[_0xe8132c(0x219)]===0x1){_0x32298d['push'](_0x48f35b[0x0]);continue;}const _0x285978=_0x33d505[_0xe8132c(0x203)][_0x13153f],_0x2f28f2=_0x285978?.[_0xe8132c(0x210)],_0x429421=_0x2f28f2?_0x48f35b[_0xe8132c(0x20b)](_0xbd7961=>_0xbd7961['relativePath']!==_0x2f28f2):_0x48f35b;if(_0x285978&&_0x429421['length']===0x1){_0x32298d[_0xe8132c(0x1ed)](_0x429421[0x0]);continue;}throw CliErrors[_0xe8132c(0x1f3)](_0xe8132c(0x1e5)+_0x13153f+_0xe8132c(0x1de));}return _0x32298d;}function a157_0x2389(){const _0x4b3227=['version','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','20qIRWRb','filePath','lockFilePath','sqlName','123TCFOaj','1098KapPCg','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','POST','sqlConfig','\x22\x20for\x20sqlCode\x20','Would\x20push\x20','str','get','sqls','bool','sqlcode','map','dbId','appCode','force','relativePath','filter','trashDir','has','Local\x20directory\x20\x22','208080HjRfsx','path','Push\x20complete:\x20','1095XvKrcB','407616aNPVfY','utf8','unchanged','1587362GokHlB','No\x20database\x20matches\x20local\x20directory\x20\x22','hash','length','sqlRoot','join','\x20failed','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','message','711270GaPNGm','catch','toISOString','remoteId','2940135XkJtNk','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','dbDirectory','dbName','high-risk-write','8zlPzni','\x20SQL\x20file(s)','21404qbOAZK','push','mode','isFinite','sqlCode','sqlRootDir','No\x20local\x20SQL\x20files\x20found.','validation'];a157_0x2389=function(){return _0x4b3227;};return a157_0x2389();}export const sqlPush={'service':'sql','command':'push','description':'Push\x20local\x20SQL\x20files\x20to\x20remote','risk':a157_0x56aecf(0x1e9),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a157_0x56aecf(0x209),'type':'boolean','description':a157_0x56aecf(0x1f5)}],async 'dryRun'(_0x5edde3){const _0x1eedd8=a157_0x56aecf,_0x57c869=loadSqlProjectConfig(_0x5edde3[_0x1eedd8(0x208)]),_0x1f8ac8=await readSqlLockFile(_0x57c869['lockFilePath']),{appLock:_0x50e948}=ensureSqlLockScope(_0x1f8ac8??createEmptySqlLock(),_0x5edde3[_0x1eedd8(0x208)],_0x57c869['sqlRoot'],'push'),_0x4a7aee=await getTargetSqlQueries(_0x57c869,_0x50e948,_0x5edde3[_0x1eedd8(0x201)](_0x1eedd8(0x205))||undefined),_0x24ddd8=[];for(const _0x3df94b of _0x4a7aee){const _0x193ca9=await computeSqlFileHash(_0x3df94b[_0x1eedd8(0x1f7)]),_0x3f1b7b=_0x50e948[_0x1eedd8(0x203)][_0x3df94b['sqlCode']],_0x20af68=!!_0x3f1b7b&&(_0x3f1b7b[_0x1eedd8(0x210)]!==_0x3df94b[_0x1eedd8(0x20a)]||!!_0x3df94b['sqlName']&&_0x3f1b7b['sqlName']!==_0x3df94b[_0x1eedd8(0x1f9)]);if(!_0x5edde3['bool'](_0x1eedd8(0x209))&&_0x3f1b7b&&_0x3f1b7b[_0x1eedd8(0x218)]===_0x193ca9&&!_0x20af68)continue;_0x24ddd8[_0x1eedd8(0x1ed)](_0x3df94b[_0x1eedd8(0x1f0)]);}return{'method':_0x1eedd8(0x1fd),'url':'/smartapi/custom/updateUserCustomSql','body':{'sqlCodes':_0x24ddd8,'appCode':_0x5edde3[_0x1eedd8(0x208)]},'description':_0x1eedd8(0x200)+_0x24ddd8[_0x1eedd8(0x219)]+_0x1eedd8(0x1eb)};},async 'execute'(_0x488fd7){const _0x2b5c2b=a157_0x56aecf,_0xc39d10=loadSqlProjectConfig(_0x488fd7[_0x2b5c2b(0x208)]),_0x5aef8b=await readSqlLockFile(_0xc39d10[_0x2b5c2b(0x1f8)]),{lockData:_0x423d35,appLock:_0x2af636}=ensureSqlLockScope(_0x5aef8b??createEmptySqlLock(),_0x488fd7[_0x2b5c2b(0x208)],_0xc39d10[_0x2b5c2b(0x21a)],_0x2b5c2b(0x1ed)),_0x5aed48=await getTargetSqlQueries(_0xc39d10,_0x2af636,_0x488fd7['str'](_0x2b5c2b(0x205))||undefined);if(_0x5aed48[_0x2b5c2b(0x219)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x2b5c2b(0x1f2)};const _0x4bd865=[],_0x57de41=[],_0x2f8167=[];for(const _0x42b5dd of _0x5aed48){const _0x47528b=_0x2af636[_0x2b5c2b(0x203)][_0x42b5dd['sqlCode']];if(!_0x47528b){_0x2f8167[_0x2b5c2b(0x1ed)]({'sqlCode':_0x42b5dd[_0x2b5c2b(0x1f0)],'error':'local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first'});continue;}try{const _0x367cdc=await computeSqlFileHash(_0x42b5dd['filePath']),_0x4c4717=_0x47528b[_0x2b5c2b(0x210)]!==_0x42b5dd[_0x2b5c2b(0x20a)]||!!_0x42b5dd[_0x2b5c2b(0x1f9)]&&_0x47528b[_0x2b5c2b(0x1f9)]!==_0x42b5dd[_0x2b5c2b(0x1f9)];if(!_0x488fd7[_0x2b5c2b(0x204)](_0x2b5c2b(0x209))&&_0x47528b[_0x2b5c2b(0x218)]===_0x367cdc&&!_0x4c4717){_0x57de41[_0x2b5c2b(0x1ed)]({'sqlCode':_0x42b5dd[_0x2b5c2b(0x1f0)],'reason':_0x2b5c2b(0x215)});continue;}if(_0x47528b[_0x2b5c2b(0x1f4)]==null){_0x2f8167[_0x2b5c2b(0x1ed)]({'sqlCode':_0x42b5dd[_0x2b5c2b(0x1f0)],'error':_0x2b5c2b(0x1e6)});continue;}const _0xfa3cf4=await readFile(_0x42b5dd[_0x2b5c2b(0x1f7)],_0x2b5c2b(0x214)),_0x2b24b1=stripLocalSqlMetadata(_0xfa3cf4,_0x42b5dd[_0x2b5c2b(0x1ee)]),_0xe64964=_0x42b5dd[_0x2b5c2b(0x1f9)]||_0x47528b[_0x2b5c2b(0x1f9)],_0xdc586=await resolveTargetDbBinding(_0x488fd7['appCode'],_0x42b5dd,_0x47528b),_0x46a0f3=await updateSqlQuery({'id':_0x47528b[_0x2b5c2b(0x1e3)],'appCode':_0x488fd7[_0x2b5c2b(0x208)],'sqlCode':_0x42b5dd[_0x2b5c2b(0x1f0)],'sqlName':_0xe64964,'dbId':_0xdc586[_0x2b5c2b(0x207)],'version':_0x47528b[_0x2b5c2b(0x1f4)],'sqlContent':_0x2b24b1,'sqlConfig':_0x47528b[_0x2b5c2b(0x1fe)]??undefined}),_0x4fa353=_0x46a0f3['dbId']?await getDbName(_0x488fd7[_0x2b5c2b(0x208)],Number(_0x46a0f3[_0x2b5c2b(0x207)]))[_0x2b5c2b(0x1e1)](()=>_0xdc586[_0x2b5c2b(0x1e8)]):_0xdc586['dbName'];_0x2af636[_0x2b5c2b(0x203)][_0x42b5dd[_0x2b5c2b(0x1f0)]]={...buildSqlLockEntry(_0x46a0f3,_0x2b24b1,_0x367cdc,{'dbName':_0x4fa353}),'path':_0x42b5dd[_0x2b5c2b(0x20a)],'mode':_0x47528b['mode']},await archivePreviousSqlFileIfNeeded(_0xc39d10,_0x47528b[_0x2b5c2b(0x210)],_0x42b5dd['relativePath']),_0x4bd865[_0x2b5c2b(0x1ed)]({'sqlCode':_0x42b5dd[_0x2b5c2b(0x1f0)],'remoteId':_0x47528b['remoteId']});}catch(_0x1a2f57){_0x2f8167[_0x2b5c2b(0x1ed)]({'sqlCode':_0x42b5dd[_0x2b5c2b(0x1f0)],'error':_0x1a2f57 instanceof Error?_0x1a2f57[_0x2b5c2b(0x1df)]:String(_0x1a2f57)});}}return _0x2af636['lastSync']=new Date()['toISOString'](),await writeSqlLockFile(_0xc39d10[_0x2b5c2b(0x1f8)],_0x423d35),{'ok':_0x2f8167[_0x2b5c2b(0x219)]===0x0,'data':{'pushed':_0x4bd865,'skipped':_0x57de41,'failed':_0x2f8167},'message':_0x2b5c2b(0x211)+_0x4bd865[_0x2b5c2b(0x219)]+'\x20pushed,\x20'+_0x57de41[_0x2b5c2b(0x219)]+'\x20skipped,\x20'+_0x2f8167['length']+_0x2b5c2b(0x21c)};}};async function archivePreviousSqlFileIfNeeded(_0x5a75ba,_0x451885,_0x5cca12){const _0xcb273b=a157_0x56aecf;if(!_0x451885||_0x451885===_0x5cca12)return;const _0x2f69a3=join(_0x5a75ba[_0xcb273b(0x1f1)],_0x451885);if(!await fileExists(_0x2f69a3))return;const _0x3b21cb=await moveToTrash(_0x5a75ba['projectRoot'],_0x5a75ba[_0xcb273b(0x20c)],_0x2f69a3);await cleanupEmptyDirectories(dirname(_0x2f69a3),_0x5a75ba[_0xcb273b(0x1f1)]),void _0x3b21cb;}async function moveToTrash(_0x5be437,_0x4ec202,_0x1e8ed7){const _0x563556=a157_0x56aecf,_0x148f65=new Date()[_0x563556(0x1e2)]()['replace'](/[:.]/g,'-'),_0x4eb31d=relative(_0x5be437,_0x1e8ed7),_0x574865=join(_0x4ec202,_0x148f65,_0x4eb31d);return await mkdir(dirname(_0x574865),{'recursive':!![]}),await rename(_0x1e8ed7,_0x574865),_0x574865;}async function cleanupEmptyDirectories(_0x1b6319,_0x11aa82){const _0xd4636a=a157_0x56aecf;let _0x4203dc=resolve(_0x1b6319);const _0x3fcff1=resolve(_0x11aa82);while(_0x4203dc['startsWith'](''+_0x3fcff1+sep)||_0x4203dc===_0x3fcff1){if(_0x4203dc===_0x3fcff1)return;try{const _0x44b5ac=await readdir(_0x4203dc);if(_0x44b5ac[_0xd4636a(0x219)]>0x0)return;await rmdir(_0x4203dc);}catch{return;}_0x4203dc=dirname(_0x4203dc);}}async function resolveTargetDbBinding(_0x4a4c8c,_0x1995a6,_0x3caabf){const _0xa21b76=a157_0x56aecf,_0x5b0df3=_0x1995a6[_0xa21b76(0x1e7)];if(!_0x5b0df3)return{'dbId':_0x3caabf[_0xa21b76(0x207)],'dbName':_0x3caabf[_0xa21b76(0x1e8)]};const _0x4e67f6=buildDbDirectoryName(_0x3caabf[_0xa21b76(0x1e8)],_0x3caabf['dbId']);if(_0x5b0df3===_0x4e67f6)return{'dbId':_0x3caabf[_0xa21b76(0x207)],'dbName':_0x3caabf[_0xa21b76(0x1e8)]};const _0x4225a9=parseExplicitDbDirectory(_0x5b0df3);if(_0x4225a9!=null)return{'dbId':_0x4225a9,'dbName':await getDbName(_0x4a4c8c,_0x4225a9)['catch'](()=>undefined)};const _0x1f869e=await listDatabases(_0x4a4c8c),_0x13dcb7=_0x1f869e['filter'](_0x132830=>buildDbDirectoryName(_0x132830['dbName'],_0x132830[_0xa21b76(0x207)])===_0x5b0df3);if(_0x13dcb7[_0xa21b76(0x219)]===0x1)return{'dbId':_0x13dcb7[0x0]['dbId'],'dbName':_0x13dcb7[0x0]['dbName']};if(_0x13dcb7[_0xa21b76(0x219)]===0x0)throw CliErrors[_0xa21b76(0x1f3)](_0xa21b76(0x217)+_0x5b0df3+_0xa21b76(0x1ff)+_0x1995a6['sqlCode']+'.');const _0x215c04=_0x13dcb7[_0xa21b76(0x206)](_0x5483ec=>_0x5483ec[_0xa21b76(0x1e8)]+'\x20('+_0x5483ec[_0xa21b76(0x207)]+')')[_0xa21b76(0x21b)](',\x20');throw CliErrors[_0xa21b76(0x1f3)](_0xa21b76(0x20e)+_0x5b0df3+_0xa21b76(0x1fc)+_0x1995a6[_0xa21b76(0x1f0)]+':\x20'+_0x215c04);}function parseExplicitDbDirectory(_0x458c51){const _0x2346e3=a157_0x56aecf,_0x1c509c=/^db-(\d+)$/['exec'](_0x458c51);if(!_0x1c509c)return null;const _0x8d8cfa=Number(_0x1c509c[0x1]);return Number[_0x2346e3(0x1ef)](_0x8d8cfa)&&_0x8d8cfa>0x0?_0x8d8cfa:null;}
|
|
1
|
+
const a159_0x307fe6=a159_0x23ec;(function(_0xe56ade,_0x4b6e20){const _0x57aaa4=a159_0x23ec,_0x26277a=_0xe56ade();while(!![]){try{const _0x4c2364=-parseInt(_0x57aaa4(0x149))/0x1+parseInt(_0x57aaa4(0x15b))/0x2*(-parseInt(_0x57aaa4(0x15d))/0x3)+-parseInt(_0x57aaa4(0x153))/0x4*(-parseInt(_0x57aaa4(0x13d))/0x5)+parseInt(_0x57aaa4(0x15a))/0x6+parseInt(_0x57aaa4(0x159))/0x7+-parseInt(_0x57aaa4(0x144))/0x8+-parseInt(_0x57aaa4(0x139))/0x9*(-parseInt(_0x57aaa4(0x134))/0xa);if(_0x4c2364===_0x4b6e20)break;else _0x26277a['push'](_0x26277a['shift']());}catch(_0x4d1775){_0x26277a['push'](_0x26277a['shift']());}}}(a159_0x2ed6,0x85ea1));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';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';async function getTargetSqlQueries(_0x21c330,_0x501551,_0x232be2){const _0x3566c8=a159_0x23ec,_0x2b7853=await scanLocalSqlQueries(_0x21c330),_0x150d30=new Map();for(const _0x3caf15 of _0x2b7853){if(_0x232be2&&_0x3caf15[_0x3566c8(0x16e)]!==_0x232be2)continue;const _0xa66d29=_0x150d30[_0x3566c8(0x154)](_0x3caf15[_0x3566c8(0x16e)])??[];_0xa66d29[_0x3566c8(0x130)](_0x3caf15),_0x150d30['set'](_0x3caf15[_0x3566c8(0x16e)],_0xa66d29);}if(_0x232be2&&!_0x150d30[_0x3566c8(0x14d)](_0x232be2))throw CliErrors[_0x3566c8(0x137)]('Local\x20SQL\x20not\x20found:\x20'+_0x232be2);const _0xbc996d=[];for(const [_0x575f11,_0x44f999]of _0x150d30[_0x3566c8(0x136)]()){if(_0x44f999[_0x3566c8(0x140)]===0x1){_0xbc996d['push'](_0x44f999[0x0]);continue;}const _0x3df98d=_0x501551[_0x3566c8(0x160)][_0x575f11],_0x54831d=_0x3df98d?.[_0x3566c8(0x16c)],_0x1c435b=_0x54831d?_0x44f999['filter'](_0x55003e=>_0x55003e[_0x3566c8(0x157)]!==_0x54831d):_0x44f999;if(_0x3df98d&&_0x1c435b[_0x3566c8(0x140)]===0x1){_0xbc996d[_0x3566c8(0x130)](_0x1c435b[0x0]);continue;}throw CliErrors[_0x3566c8(0x137)](_0x3566c8(0x147)+_0x575f11+_0x3566c8(0x13a));}return _0xbc996d;}export const sqlPush={'service':a159_0x307fe6(0x166),'command':a159_0x307fe6(0x130),'description':a159_0x307fe6(0x174),'risk':a159_0x307fe6(0x14a),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a159_0x307fe6(0x145),'type':a159_0x307fe6(0x135),'description':'Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock'}],async 'dryRun'(_0x5f57a2){const _0x78a3b1=a159_0x307fe6,_0x9c2212=loadSqlProjectConfig(_0x5f57a2[_0x78a3b1(0x133)]),_0x373e34=await readSqlLockFile(_0x9c2212[_0x78a3b1(0x172)]),{appLock:_0x31934c}=ensureSqlLockScope(_0x373e34??createEmptySqlLock(),_0x5f57a2[_0x78a3b1(0x133)],_0x9c2212[_0x78a3b1(0x170)],_0x78a3b1(0x130)),_0x3b3c9c=await getTargetSqlQueries(_0x9c2212,_0x31934c,_0x5f57a2[_0x78a3b1(0x148)](_0x78a3b1(0x14f))||undefined),_0x5a8032=[];for(const _0x3f8b36 of _0x3b3c9c){const _0x404f8f=await computeSqlFileHash(_0x3f8b36['filePath']),_0x191b70=_0x31934c[_0x78a3b1(0x160)][_0x3f8b36[_0x78a3b1(0x16e)]],_0x15c471=!!_0x191b70&&(_0x191b70[_0x78a3b1(0x16c)]!==_0x3f8b36['relativePath']||!!_0x3f8b36[_0x78a3b1(0x163)]&&_0x191b70[_0x78a3b1(0x163)]!==_0x3f8b36[_0x78a3b1(0x163)]);if(!_0x5f57a2['bool'](_0x78a3b1(0x145))&&_0x191b70&&_0x191b70[_0x78a3b1(0x152)]===_0x404f8f&&!_0x15c471)continue;_0x5a8032['push'](_0x3f8b36[_0x78a3b1(0x16e)]);}return{'method':_0x78a3b1(0x143),'url':_0x78a3b1(0x150),'body':{'sqlCodes':_0x5a8032,'appCode':_0x5f57a2[_0x78a3b1(0x133)]},'description':_0x78a3b1(0x164)+_0x5a8032['length']+_0x78a3b1(0x131)};},async 'execute'(_0xcded3d){const _0x358f48=a159_0x307fe6,_0x58d439=loadSqlProjectConfig(_0xcded3d[_0x358f48(0x133)]),_0x1a2480=await readSqlLockFile(_0x58d439['lockFilePath']),{lockData:_0x3ea56d,appLock:_0x2cce84}=ensureSqlLockScope(_0x1a2480??createEmptySqlLock(),_0xcded3d[_0x358f48(0x133)],_0x58d439[_0x358f48(0x170)],'push'),_0x3a0c3a=await getTargetSqlQueries(_0x58d439,_0x2cce84,_0xcded3d[_0x358f48(0x148)](_0x358f48(0x14f))||undefined);if(_0x3a0c3a[_0x358f48(0x140)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x358f48(0x162)};const _0x14fa79=[],_0x185185=[],_0x2f6e4f=[];for(const _0x16d699 of _0x3a0c3a){const _0x3b400d=_0x2cce84[_0x358f48(0x160)][_0x16d699[_0x358f48(0x16e)]];if(!_0x3b400d){_0x2f6e4f[_0x358f48(0x130)]({'sqlCode':_0x16d699[_0x358f48(0x16e)],'error':'local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first'});continue;}try{const _0x1e68d6=await computeSqlFileHash(_0x16d699[_0x358f48(0x161)]),_0x2d8ad1=_0x3b400d[_0x358f48(0x16c)]!==_0x16d699[_0x358f48(0x157)]||!!_0x16d699[_0x358f48(0x163)]&&_0x3b400d[_0x358f48(0x163)]!==_0x16d699['sqlName'];if(!_0xcded3d[_0x358f48(0x13e)](_0x358f48(0x145))&&_0x3b400d['hash']===_0x1e68d6&&!_0x2d8ad1){_0x185185[_0x358f48(0x130)]({'sqlCode':_0x16d699[_0x358f48(0x16e)],'reason':_0x358f48(0x13b)});continue;}if(_0x3b400d[_0x358f48(0x16a)]==null){_0x2f6e4f[_0x358f48(0x130)]({'sqlCode':_0x16d699[_0x358f48(0x16e)],'error':_0x358f48(0x14e)});continue;}const _0x4bd5e1=await readFile(_0x16d699[_0x358f48(0x161)],_0x358f48(0x151)),_0x53cb9e=stripLocalSqlMetadata(_0x4bd5e1,_0x16d699[_0x358f48(0x14c)]),_0x26411c=_0x16d699[_0x358f48(0x163)]||_0x3b400d[_0x358f48(0x163)],_0x48e559=await resolveTargetDbBinding(_0xcded3d[_0x358f48(0x133)],_0x16d699,_0x3b400d),_0x42d3fa=await updateSqlQuery({'id':_0x3b400d[_0x358f48(0x15e)],'appCode':_0xcded3d[_0x358f48(0x133)],'sqlCode':_0x16d699[_0x358f48(0x16e)],'sqlName':_0x26411c,'dbId':_0x48e559[_0x358f48(0x158)],'version':_0x3b400d[_0x358f48(0x16a)],'sqlContent':_0x53cb9e,'sqlConfig':_0x3b400d[_0x358f48(0x16f)]??undefined}),_0xed4546=_0x42d3fa[_0x358f48(0x158)]?await getDbName(_0xcded3d[_0x358f48(0x133)],Number(_0x42d3fa[_0x358f48(0x158)]))['catch'](()=>_0x48e559['dbName']):_0x48e559[_0x358f48(0x15f)];_0x2cce84[_0x358f48(0x160)][_0x16d699['sqlCode']]={...buildSqlLockEntry(_0x42d3fa,_0x53cb9e,_0x1e68d6,{'dbName':_0xed4546}),'path':_0x16d699['relativePath'],'mode':_0x3b400d[_0x358f48(0x14c)]},await archivePreviousSqlFileIfNeeded(_0x58d439,_0x3b400d[_0x358f48(0x16c)],_0x16d699[_0x358f48(0x157)]),_0x14fa79['push']({'sqlCode':_0x16d699['sqlCode'],'remoteId':_0x3b400d[_0x358f48(0x15e)]});}catch(_0x2ae0f4){_0x2f6e4f['push']({'sqlCode':_0x16d699['sqlCode'],'error':_0x2ae0f4 instanceof Error?_0x2ae0f4[_0x358f48(0x168)]:String(_0x2ae0f4)});}}return _0x2cce84[_0x358f48(0x14b)]=new Date()[_0x358f48(0x167)](),await writeSqlLockFile(_0x58d439[_0x358f48(0x172)],_0x3ea56d),{'ok':_0x2f6e4f[_0x358f48(0x140)]===0x0,'data':{'pushed':_0x14fa79,'skipped':_0x185185,'failed':_0x2f6e4f},'message':_0x358f48(0x171)+_0x14fa79[_0x358f48(0x140)]+_0x358f48(0x16b)+_0x185185[_0x358f48(0x140)]+_0x358f48(0x15c)+_0x2f6e4f[_0x358f48(0x140)]+_0x358f48(0x175)};}};function a159_0x23ec(_0x3b99f3,_0x5f071b){_0x3b99f3=_0x3b99f3-0x130;const _0x2ed62e=a159_0x2ed6();let _0x23ecc9=_0x2ed62e[_0x3b99f3];return _0x23ecc9;}async function archivePreviousSqlFileIfNeeded(_0x53b348,_0x22730b,_0x1903a7){const _0x50cdd3=a159_0x307fe6;if(!_0x22730b||_0x22730b===_0x1903a7)return;const _0x440206=join(_0x53b348['sqlRootDir'],_0x22730b);if(!await fileExists(_0x440206))return;const _0x58eb13=await moveToTrash(_0x53b348[_0x50cdd3(0x16d)],_0x53b348[_0x50cdd3(0x13c)],_0x440206);await cleanupEmptyDirectories(dirname(_0x440206),_0x53b348['sqlRootDir']),void _0x58eb13;}async function moveToTrash(_0x4d9340,_0x450aaa,_0x3e4ac3){const _0x5b28e8=a159_0x307fe6,_0xa92a3a=new Date()[_0x5b28e8(0x167)]()[_0x5b28e8(0x138)](/[:.]/g,'-'),_0x425174=relative(_0x4d9340,_0x3e4ac3),_0x4b4aba=join(_0x450aaa,_0xa92a3a,_0x425174);return await mkdir(dirname(_0x4b4aba),{'recursive':!![]}),await rename(_0x3e4ac3,_0x4b4aba),_0x4b4aba;}async function cleanupEmptyDirectories(_0x14c1af,_0x45d015){const _0x5e361c=a159_0x307fe6;let _0x38ae51=resolve(_0x14c1af);const _0x528c1f=resolve(_0x45d015);while(_0x38ae51[_0x5e361c(0x173)](''+_0x528c1f+sep)||_0x38ae51===_0x528c1f){if(_0x38ae51===_0x528c1f)return;try{const _0x29e379=await readdir(_0x38ae51);if(_0x29e379[_0x5e361c(0x140)]>0x0)return;await rmdir(_0x38ae51);}catch{return;}_0x38ae51=dirname(_0x38ae51);}}async function resolveTargetDbBinding(_0x52473e,_0x11f61e,_0x121790){const _0x119c93=a159_0x307fe6,_0x2522e3=_0x11f61e[_0x119c93(0x156)];if(!_0x2522e3)return{'dbId':_0x121790[_0x119c93(0x158)],'dbName':_0x121790['dbName']};const _0x529e1d=buildDbDirectoryName(_0x121790[_0x119c93(0x15f)],_0x121790['dbId']);if(_0x2522e3===_0x529e1d)return{'dbId':_0x121790[_0x119c93(0x158)],'dbName':_0x121790['dbName']};const _0x3d0234=parseExplicitDbDirectory(_0x2522e3);if(_0x3d0234!=null)return{'dbId':_0x3d0234,'dbName':await getDbName(_0x52473e,_0x3d0234)[_0x119c93(0x13f)](()=>undefined)};const _0x3eb38e=await listDatabases(_0x52473e),_0x100567=_0x3eb38e[_0x119c93(0x141)](_0x6b5aaa=>buildDbDirectoryName(_0x6b5aaa[_0x119c93(0x15f)],_0x6b5aaa['dbId'])===_0x2522e3);if(_0x100567[_0x119c93(0x140)]===0x1)return{'dbId':_0x100567[0x0][_0x119c93(0x158)],'dbName':_0x100567[0x0]['dbName']};if(_0x100567[_0x119c93(0x140)]===0x0)throw CliErrors[_0x119c93(0x137)](_0x119c93(0x169)+_0x2522e3+_0x119c93(0x142)+_0x11f61e['sqlCode']+'.');const _0x1b2eaf=_0x100567['map'](_0x4946f1=>_0x4946f1[_0x119c93(0x15f)]+'\x20('+_0x4946f1['dbId']+')')['join'](',\x20');throw CliErrors[_0x119c93(0x137)](_0x119c93(0x155)+_0x2522e3+_0x119c93(0x146)+_0x11f61e[_0x119c93(0x16e)]+':\x20'+_0x1b2eaf);}function parseExplicitDbDirectory(_0x57e14f){const _0x33e5c9=a159_0x307fe6,_0xbf6198=/^db-(\d+)$/[_0x33e5c9(0x132)](_0x57e14f);if(!_0xbf6198)return null;const _0x13b492=Number(_0xbf6198[0x1]);return Number[_0x33e5c9(0x165)](_0x13b492)&&_0x13b492>0x0?_0x13b492:null;}function a159_0x2ed6(){const _0x17699f=['bool','catch','length','filter','\x22\x20for\x20sqlCode\x20','POST','4405536uNiSjN','force','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','str','993498XrDYsq','high-risk-write','lastSync','mode','has','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','sqlcode','/smartapi/custom/updateUserCustomSql','utf8','hash','380VMkMwb','get','Local\x20directory\x20\x22','dbDirectory','relativePath','dbId','1207094Ecimde','1165734JJPDQW','32070ESwNDU','\x20skipped,\x20','177isAOJQ','remoteId','dbName','sqls','filePath','No\x20local\x20SQL\x20files\x20found.','sqlName','Would\x20push\x20','isFinite','sql','toISOString','message','No\x20database\x20matches\x20local\x20directory\x20\x22','version','\x20pushed,\x20','path','projectRoot','sqlCode','sqlConfig','sqlRoot','Push\x20complete:\x20','lockFilePath','startsWith','Push\x20local\x20SQL\x20files\x20to\x20remote','\x20failed','push','\x20SQL\x20file(s)','exec','appCode','70ZFsCiw','boolean','entries','validation','replace','2650464tZudoY','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','unchanged','trashDir','32135gRisPz'];a159_0x2ed6=function(){return _0x17699f;};return a159_0x2ed6();}
|
package/lib/commands/sql/save.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a160_0x465185=a160_0x181f;(function(_0x18f98a,_0x2383c4){const _0x2c7314=a160_0x181f,_0x19d5a9=_0x18f98a();while(!![]){try{const _0x2fe10a=-parseInt(_0x2c7314(0xc8))/0x1+-parseInt(_0x2c7314(0xc9))/0x2+parseInt(_0x2c7314(0xbc))/0x3*(parseInt(_0x2c7314(0xc1))/0x4)+parseInt(_0x2c7314(0xcc))/0x5+parseInt(_0x2c7314(0xbd))/0x6*(-parseInt(_0x2c7314(0xc2))/0x7)+-parseInt(_0x2c7314(0xc3))/0x8*(-parseInt(_0x2c7314(0xc0))/0x9)+-parseInt(_0x2c7314(0xcf))/0xa;if(_0x2fe10a===_0x2383c4)break;else _0x19d5a9['push'](_0x19d5a9['shift']());}catch(_0x192003){_0x19d5a9['push'](_0x19d5a9['shift']());}}}(a160_0x1dcd,0x2ef87));import{CliErrors}from'../../errors.js';function a160_0x181f(_0x29c965,_0x459bc2){_0x29c965=_0x29c965-0xbb;const _0x1dcd1a=a160_0x1dcd();let _0x181f20=_0x1dcd1a[_0x29c965];return _0x181f20;}import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';const SQL_SAVE_DEPRECATED_HINT=[a160_0x465185(0xc5),a160_0x465185(0xbb),a160_0x465185(0xca)][a160_0x465185(0xbf)]('\x0a');function a160_0x1dcd(){const _0x48c676=['1348290KHxdyF','write','sqlname','799670QchhqF','file','Target\x20database\x20—\x20accepts\x20a\x20numeric\x20ID\x20or\x20database\x20name\x20(e.g.\x20ecommerce_db)','Create\x20new\x20SQL\x20with\x20`rabetbase\x20sql\x20create\x20--name\x20<name>\x20--db-id\x20<id>\x20--mode\x20sql|mybatisXml`.','383871mPaBJQ','572526DeDgBe','validation','join','36AzIBAx','12YlYKlA','21GUbVHC','389320ytuTID','save','`rabetbase\x20sql\x20save`\x20has\x20been\x20deprecated.','Path\x20to\x20the\x20SQL\x20file','string','196227SmqSWv','186682QvuBnk','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`.','sql'];a160_0x1dcd=function(){return _0x48c676;};return a160_0x1dcd();}export const sqlSave={'service':a160_0x465185(0xcb),'command':a160_0x465185(0xc4),'description':'Deprecated:\x20use\x20sql\x20create\x20to\x20create\x20and\x20sql\x20push\x20to\x20update','risk':a160_0x465185(0xcd),'requiresAuth':![],'requiresAppCode':![],'flags':[{'name':a160_0x465185(0xd0),'type':a160_0x465185(0xc7),'required':!![],'description':a160_0x465185(0xc6)},SQLCODE_FLAG_OPTIONAL,{'name':a160_0x465185(0xce),'type':a160_0x465185(0xc7),'description':'SQL\x20query\x20display\x20name'},{'name':'db','type':a160_0x465185(0xc7),'description':a160_0x465185(0xd1)},{'name':'description','type':a160_0x465185(0xc7),'description':'Query\x20description'}],async 'validate'(){const _0x2d4cbe=a160_0x465185;throw CliErrors[_0x2d4cbe(0xbe)](SQL_SAVE_DEPRECATED_HINT);},async 'execute'(){const _0x3a843d=a160_0x465185;throw CliErrors[_0x3a843d(0xbe)](SQL_SAVE_DEPRECATED_HINT);}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a161_0x5b0a3f=a161_0x1283;(function(_0x1877da,_0x22c7f0){const _0x364af3=a161_0x1283,_0x3f5e74=_0x1877da();while(!![]){try{const _0x243138=parseInt(_0x364af3(0xcb))/0x1*(-parseInt(_0x364af3(0xc4))/0x2)+-parseInt(_0x364af3(0xc3))/0x3*(parseInt(_0x364af3(0xbe))/0x4)+parseInt(_0x364af3(0xd1))/0x5+parseInt(_0x364af3(0xcd))/0x6+-parseInt(_0x364af3(0xb5))/0x7+parseInt(_0x364af3(0xcc))/0x8*(-parseInt(_0x364af3(0xc9))/0x9)+parseInt(_0x364af3(0xaa))/0xa*(parseInt(_0x364af3(0xc0))/0xb);if(_0x243138===_0x22c7f0)break;else _0x3f5e74['push'](_0x3f5e74['shift']());}catch(_0x2a50c5){_0x3f5e74['push'](_0x3f5e74['shift']());}}}(a161_0x3827,0x88a74));import{createInterface}from'node:readline';import{join}from'node:path';import{buildDefaultSqlFileName,buildSqlRelativePath,detectSqlMode}from'../../core/sql-sync/utils.js';function a161_0x1283(_0xca0b20,_0x3da5a0){_0xca0b20=_0xca0b20-0xa7;const _0x38271f=a161_0x3827();let _0x128326=_0x38271f[_0xca0b20];return _0x128326;}export const SQL_LOCAL_REL_DIR=a161_0x5b0a3f(0xb1);export function buildSqlLockEntry(_0x51a0f7,_0x5074e4,_0x1ffad0,_0x4c3a42){const _0x4db765=a161_0x5b0a3f,_0x43d497=detectSqlMode(_0x5074e4);return{'path':buildSqlRelativePath(_0x51a0f7[_0x4db765(0xbf)],_0x51a0f7['sqlName'],_0x4c3a42?.[_0x4db765(0xb3)],_0x43d497,_0x51a0f7[_0x4db765(0xb0)]),'hash':_0x1ffad0,'remoteId':_0x51a0f7['id'],'version':_0x51a0f7[_0x4db765(0xbd)],'dbId':Number(_0x51a0f7[_0x4db765(0xb0)]),'dbName':_0x4c3a42?.[_0x4db765(0xb3)],'sqlName':_0x51a0f7[_0x4db765(0xbc)],'sqlConfig':_0x51a0f7['sqlConfig']??undefined,'mode':_0x43d497};}export function cloneSqlLockData(_0x2873c8){const _0x529bf8=a161_0x5b0a3f;return{'apps':Object['fromEntries'](Object[_0x529bf8(0xb9)](_0x2873c8[_0x529bf8(0xb6)])[_0x529bf8(0xad)](([_0x52c209,_0x379630])=>[_0x52c209,{'sqlRoot':_0x379630['sqlRoot'],'lastSync':_0x379630[_0x529bf8(0xab)],'sqls':{..._0x379630[_0x529bf8(0xb7)]}}]))};}export function ensureRemoteSqlContent(_0x2f2e23){return _0x2f2e23['sqlContent']??'';}export function buildLocalSqlFileContent(_0x11276e,_0x2a9dc3,_0x597dbe){const _0x2a2ca2=a161_0x5b0a3f,_0x526273=_0x597dbe?.[_0x2a2ca2(0xb4)]??detectSqlMode(_0x2a9dc3),_0x234353=stripLocalSqlMetadata(_0x2a9dc3,_0x526273)['trim'](),_0x53ff17=[...buildMetadataHeaderLines({'sqlCode':_0x11276e[_0x2a2ca2(0xbf)],'sqlName':_0x11276e[_0x2a2ca2(0xbc)],'dbId':_0x11276e['dbId'],'dbName':_0x597dbe?.[_0x2a2ca2(0xb3)],'mode':_0x526273,'syncedAt':_0x597dbe?.[_0x2a2ca2(0xcf)],'description':_0x597dbe?.[_0x2a2ca2(0xc8)]},_0x526273),'',_0x234353],_0x306028=_0x53ff17[_0x2a2ca2(0xc6)]('\x0a');return _0x306028['endsWith']('\x0a')?_0x306028:_0x306028+'\x0a';}export function stripLocalSqlMetadata(_0x58e8da,_0x8c47c4){const _0x1e1dd1=a161_0x5b0a3f,_0x3b5ba5=_0x58e8da[_0x1e1dd1(0xc1)](/\r\n/g,'\x0a')[_0x1e1dd1(0xae)]('\x0a'),_0x1a4513=[];let _0x4a484d=0x0;if(_0x8c47c4==='mybatisXml')while(_0x4a484d<_0x3b5ba5[_0x1e1dd1(0xd0)]){const _0x927888=_0x3b5ba5[_0x4a484d]??'';if(/^\s*<!--\s*@lovrabet\./[_0x1e1dd1(0xb8)](_0x927888)){_0x4a484d++;continue;}if(_0x927888[_0x1e1dd1(0xa7)]()===''&&_0x4a484d>0x0){_0x4a484d++;continue;}break;}else while(_0x4a484d<_0x3b5ba5[_0x1e1dd1(0xd0)]){const _0x268695=_0x3b5ba5[_0x4a484d]??'';if(/^\s*--\s*@lovrabet\./[_0x1e1dd1(0xb8)](_0x268695)){_0x4a484d++;continue;}if(_0x268695[_0x1e1dd1(0xa7)]()===''&&_0x4a484d>0x0){_0x4a484d++;continue;}break;}for(;_0x4a484d<_0x3b5ba5['length'];_0x4a484d++){_0x1a4513[_0x1e1dd1(0xac)](_0x3b5ba5[_0x4a484d]);}return _0x1a4513['join']('\x0a')[_0x1e1dd1(0xc5)]();}export function resolveSqlMode(_0x198d60,_0xc9bb53){const _0x3dd8bc=a161_0x5b0a3f;if(_0xc9bb53?.[_0x3dd8bc(0xb4)])return _0xc9bb53[_0x3dd8bc(0xb4)];return detectSqlMode(_0x198d60);}function a161_0x3827(){const _0x1711c9=['trimStart','join','stderr','description','261vGyVbw','toLowerCase','2Kwhfvv','303320hWenCC','5263380cfCVCn','includes','syncedAt','length','4575930rghHaL','<!--\x20@lovrabet.','trim','path','\x20-->','13112470jVkHhr','lastSync','push','map','split','question','dbId','.rabetbase/sql','yes','dbName','mode','5991930lnrWpL','apps','sqls','test','entries','close','filter','sqlName','version','2776BInxdJ','sqlCode','11BkoUVP','replace','--\x20@lovrabet.','1941ZbLFtm','139388RnNMIB'];a161_0x3827=function(){return _0x1711c9;};return a161_0x3827();}export function resolveSqlFileName(_0x67de37,_0x22436c,_0x5a99bd){const _0x3b1350=a161_0x5b0a3f;if(_0x5a99bd?.[_0x3b1350(0xa8)])return _0x5a99bd['path'];if(_0x5a99bd?.[_0x3b1350(0xbc)]||_0x5a99bd?.[_0x3b1350(0xb3)])return buildSqlRelativePath(_0x67de37,_0x5a99bd?.['sqlName'],_0x5a99bd?.[_0x3b1350(0xb3)],resolveSqlMode(_0x22436c,_0x5a99bd),_0x5a99bd?.[_0x3b1350(0xb0)]);return buildDefaultSqlFileName(_0x67de37,resolveSqlMode(_0x22436c,_0x5a99bd));}export function resolveSqlLocalDir(_0x48592a,_0x55fd90){return join(_0x48592a,SQL_LOCAL_REL_DIR,_0x55fd90);}export async function confirmForceOverwrite(_0x163d5d){const _0x4d004b=a161_0x5b0a3f,_0x253797=createInterface({'input':process['stdin'],'output':process[_0x4d004b(0xc7)]}),_0xe5822b=await new Promise(_0x232571=>{const _0x280352=_0x4d004b;_0x253797[_0x280352(0xaf)](_0x163d5d+'\x20[y/N]\x20',_0x232571);});return _0x253797[_0x4d004b(0xba)](),['y',_0x4d004b(0xb2)][_0x4d004b(0xce)](_0xe5822b[_0x4d004b(0xa7)]()[_0x4d004b(0xca)]());}export function findSqlLockScope(_0x4776e1,_0x530c52){return _0x4776e1['apps'][_0x530c52];}function buildMetadataHeaderLines(_0x5cc80d,_0x32c04b){const _0x3e4165=a161_0x5b0a3f,_0x37ebd4=[[_0x3e4165(0xbf),_0x5cc80d[_0x3e4165(0xbf)]],[_0x3e4165(0xbc),_0x5cc80d[_0x3e4165(0xbc)]],[_0x3e4165(0xb0),_0x5cc80d[_0x3e4165(0xb0)]],[_0x3e4165(0xb3),_0x5cc80d[_0x3e4165(0xb3)]],[_0x3e4165(0xb4),_0x5cc80d[_0x3e4165(0xb4)]],[_0x3e4165(0xcf),_0x5cc80d[_0x3e4165(0xcf)]],['description',_0x5cc80d[_0x3e4165(0xc8)]]];if(_0x32c04b==='mybatisXml')return _0x37ebd4[_0x3e4165(0xbb)](([,_0x462136])=>_0x462136!==undefined&&_0x462136!==null&&String(_0x462136)['trim']()!=='')[_0x3e4165(0xad)](([_0x163239,_0x6ecf8d])=>_0x3e4165(0xd2)+_0x163239+':\x20'+String(_0x6ecf8d)+_0x3e4165(0xa9));return _0x37ebd4['filter'](([,_0x5061f3])=>_0x5061f3!==undefined&&_0x5061f3!==null&&String(_0x5061f3)['trim']()!=='')['map'](([_0x3a49b5,_0x4d89a9])=>_0x3e4165(0xc2)+_0x3a49b5+':\x20'+String(_0x4d89a9));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a162_0x4efdcf=a162_0x4051;(function(_0x258571,_0xfd0977){const _0x593a42=a162_0x4051,_0x3aada4=_0x258571();while(!![]){try{const _0x465944=parseInt(_0x593a42(0x167))/0x1+parseInt(_0x593a42(0x151))/0x2*(-parseInt(_0x593a42(0x160))/0x3)+parseInt(_0x593a42(0x169))/0x4*(-parseInt(_0x593a42(0x154))/0x5)+-parseInt(_0x593a42(0x157))/0x6+parseInt(_0x593a42(0x163))/0x7*(-parseInt(_0x593a42(0x161))/0x8)+parseInt(_0x593a42(0x16e))/0x9+parseInt(_0x593a42(0x15e))/0xa;if(_0x465944===_0xfd0977)break;else _0x3aada4['push'](_0x3aada4['shift']());}catch(_0x1af080){_0x3aada4['push'](_0x3aada4['shift']());}}}(a162_0x5c02,0x84428));import{listSqlQueries}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';function a162_0x4051(_0x559a93,_0x498a0d){_0x559a93=_0x559a93-0x151;const _0x5c0246=a162_0x5c02();let _0x4051f4=_0x5c0246[_0x559a93];return _0x4051f4;}import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';function a162_0x5c02(){const _0x5812f6=['appCode','sqls','paging','119195XERETE','sqlName','464qqdvoh','push','relativePath','remote','sqlCode','5740083adDJeV','Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally','\x20unchanged','map','2kQQpQL','\x20remote-only','totalCount','4835ruYuLu','boolean','has','710250DuEBeG','sql','read','hash','lockKey','length','sqlRoot','7632590molqLY','lockFilePath','2034429UAqVmb','111704yvzJIo','path','35wIQWfS'];a162_0x5c02=function(){return _0x5812f6;};return a162_0x5c02();}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(_0x120dea){const _0x42afee=a162_0x4051,_0xaf22f5=[];let _0x214d4c=0x1;while(!![]){const _0x3093be=await listSqlQueries(_0x120dea,{'currentPage':_0x214d4c,'pageSize':PAGE_SIZE}),_0x4d2d17=_0x3093be['tableData']??[];_0xaf22f5[_0x42afee(0x16a)](..._0x4d2d17['map'](_0x5d40f3=>_0x5d40f3[_0x42afee(0x16d)]));if(_0x4d2d17[_0x42afee(0x15c)]===0x0)break;const _0x45ab48=_0x3093be[_0x42afee(0x166)]?.[_0x42afee(0x153)];if(_0x45ab48!=null?_0xaf22f5[_0x42afee(0x15c)]>=_0x45ab48:_0x4d2d17[_0x42afee(0x15c)]<PAGE_SIZE)break;_0x214d4c++;}return _0xaf22f5;}export const sqlStatus={'service':a162_0x4efdcf(0x158),'command':'status','description':'Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','risk':a162_0x4efdcf(0x159),'flags':[{'name':a162_0x4efdcf(0x16c),'type':a162_0x4efdcf(0x155),'description':a162_0x4efdcf(0x16f)}],async 'execute'(_0x573ea5){const _0x24716c=a162_0x4efdcf,_0x3b4ae3=loadSqlProjectConfig(_0x573ea5[_0x24716c(0x164)]),_0x20ea82=await readSqlLockFile(_0x3b4ae3[_0x24716c(0x15f)]),{appLock:_0x3a5dfa}=ensureSqlLockScope(_0x20ea82??createEmptySqlLock(),_0x3b4ae3[_0x24716c(0x164)],_0x3b4ae3[_0x24716c(0x15d)],'status'),_0x5ce4d9=await scanLocalSqlQueries(_0x3b4ae3),_0x5bb7f7=[],_0x216e07=[],_0x3163d4=[],_0x4cd0f0=[],_0x27255a=new Set(_0x5ce4d9[_0x24716c(0x171)](_0x133133=>_0x133133[_0x24716c(0x15b)]));for(const _0x15cafc of _0x5ce4d9){const _0x95b6c1=await computeSqlFileHash(_0x15cafc['filePath']),_0x2fad90=_0x3a5dfa[_0x24716c(0x165)][_0x15cafc['lockKey']],_0x3698db=!!_0x2fad90&&_0x2fad90[_0x24716c(0x162)]!==_0x15cafc[_0x24716c(0x16b)],_0x29a44a=!!_0x2fad90&&!!_0x15cafc[_0x24716c(0x168)]&&_0x2fad90[_0x24716c(0x168)]!==_0x15cafc[_0x24716c(0x168)];if(!_0x2fad90)_0x5bb7f7['push'](_0x15cafc[_0x24716c(0x15b)]);else _0x2fad90[_0x24716c(0x15a)]!==_0x95b6c1||_0x3698db||_0x29a44a?_0x216e07[_0x24716c(0x16a)](_0x15cafc[_0x24716c(0x15b)]):_0x3163d4[_0x24716c(0x16a)](_0x15cafc['lockKey']);}for(const _0x1ce96b of Object['keys'](_0x3a5dfa[_0x24716c(0x165)])){!_0x27255a[_0x24716c(0x156)](_0x1ce96b)&&_0x4cd0f0[_0x24716c(0x16a)](_0x1ce96b);}const _0x2f240d=[];if(_0x573ea5['bool'](_0x24716c(0x16c))){const _0x118585=await fetchAllSqlCodes(_0x573ea5[_0x24716c(0x164)]);for(const _0x185b49 of _0x118585){!_0x27255a[_0x24716c(0x156)](_0x185b49)&&!_0x3a5dfa['sqls'][_0x185b49]&&_0x2f240d[_0x24716c(0x16a)](_0x185b49);}}const _0x57c066=_0x5bb7f7[_0x24716c(0x15c)]===0x0&&_0x216e07[_0x24716c(0x15c)]===0x0&&_0x4cd0f0['length']===0x0&&_0x2f240d[_0x24716c(0x15c)]===0x0;return{'ok':!![],'data':{'added':_0x5bb7f7,'modified':_0x216e07,'missing':_0x4cd0f0,'unchanged':_0x3163d4,'remoteOnly':_0x2f240d},'message':_0x57c066?'All\x20SQL\x20queries\x20are\x20in\x20sync.':_0x5bb7f7['length']+'\x20added,\x20'+_0x216e07[_0x24716c(0x15c)]+'\x20modified,\x20'+_0x4cd0f0[_0x24716c(0x15c)]+'\x20missing,\x20'+_0x3163d4['length']+_0x24716c(0x170)+(_0x2f240d['length']>0x0?',\x20'+_0x2f240d[_0x24716c(0x15c)]+_0x24716c(0x152):'')};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a163_0x56818c=a163_0xd862;(function(_0x18e589,_0x30bd52){const _0x3a574a=a163_0xd862,_0x2118a4=_0x18e589();while(!![]){try{const _0x514e5d=-parseInt(_0x3a574a(0xf4))/0x1*(-parseInt(_0x3a574a(0xc4))/0x2)+parseInt(_0x3a574a(0xdb))/0x3*(-parseInt(_0x3a574a(0xc5))/0x4)+parseInt(_0x3a574a(0xd3))/0x5+parseInt(_0x3a574a(0xdf))/0x6+parseInt(_0x3a574a(0xf3))/0x7*(parseInt(_0x3a574a(0xcd))/0x8)+-parseInt(_0x3a574a(0xda))/0x9+parseInt(_0x3a574a(0xee))/0xa;if(_0x514e5d===_0x30bd52)break;else _0x2118a4['push'](_0x2118a4['shift']());}catch(_0x4d436a){_0x2118a4['push'](_0x2118a4['shift']());}}}(a163_0x83c2,0xe608a));function a163_0xd862(_0xdd1fce,_0x3226a9){_0xdd1fce=_0xdd1fce-0xc2;const _0x83c2f6=a163_0x83c2();let _0xd8627f=_0x83c2f6[_0xdd1fce];return _0xd8627f;}import{readFileSync,existsSync}from'node:fs';function a163_0x83c2(){const _0x482689=['trim','sqlType','7359520LWdtsE','name','cwd','split','\x22\x20not\x20found\x20in\x20any\x20dataset','20363LzVGfa','580eaKcLQ','validation','File\x20not\x20found:\x20','6452SNmMFC','316fBLTbS','get','Comma-separated\x20dataset\x20codes\x20to\x20cross-check\x20table/column\x20names\x20against','Provide\x20--file\x20or\x20--sql','validate','valid','SQL\x20schema\x20validation','string','1704qgKxoq','toLowerCase','tableName','Inline\x20SQL\x20content\x20to\x20validate\x20(alternative\x20to\x20--file)','size','sql','1737335bNYmDw','push','isArray','reason','message','from','Validate\x20SQL\x20content\x20without\x20saving\x20(type\x20detection,\x20parameter\x20extraction,\x20optional\x20schema\x20check)','15179724xtKcAb','63255BeKsAh','schemas','flagMissing','utf-8','4322718KdFpUI','Dataset\x20\x22','str','length','map','\x22\x20not\x20found\x20or\x20not\x20accessible','isSelectOnly','file','Table\x20\x22','appCode','tables','schema:','dbtableConfig'];a163_0x83c2=function(){return _0x482689;};return a163_0x83c2();}import{resolve}from'node:path';import{validateSql}from'../../core/sql-validator.js';import{getDatasetDetail,listDatasets}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{assertDatasetIsDbTableBacked,filterDbTableBackedDatasets}from'../../commands/dataset/capability.js';export const sqlValidate={'service':a163_0x56818c(0xd2),'command':a163_0x56818c(0xc9),'description':a163_0x56818c(0xd9),'risk':'read','flags':[{'name':'file','type':'string','description':'Path\x20to\x20the\x20SQL\x20file\x20to\x20validate'},{'name':a163_0x56818c(0xd2),'type':a163_0x56818c(0xcc),'description':a163_0x56818c(0xd0)},{'name':a163_0x56818c(0xdc),'type':a163_0x56818c(0xcc),'description':a163_0x56818c(0xc7)}],async 'execute'(_0x589067){const _0x2c8b91=a163_0x56818c,_0x3c5d36=_0x589067[_0x2c8b91(0xe1)](_0x2c8b91(0xe6)),_0x567508=_0x589067['str'](_0x2c8b91(0xd2));if(!_0x3c5d36&&!_0x567508)throw CliErrors[_0x2c8b91(0xdd)]('file',_0x2c8b91(0xc8));let _0x4dd74f;if(_0x3c5d36){const _0x484e18=resolve(process[_0x2c8b91(0xf0)](),_0x3c5d36);if(!existsSync(_0x484e18))throw CliErrors[_0x2c8b91(0xc2)](_0x2c8b91(0xc3)+_0x484e18);_0x4dd74f=readFileSync(_0x484e18,_0x2c8b91(0xde));}else _0x4dd74f=_0x567508;const _0x8a3990=validateSql(_0x4dd74f),_0x56b237={'valid':_0x8a3990[_0x2c8b91(0xca)],'sqlType':_0x8a3990[_0x2c8b91(0xed)]['type'],'isSelectOnly':_0x8a3990[_0x2c8b91(0xed)][_0x2c8b91(0xe5)],'isDangerous':_0x8a3990[_0x2c8b91(0xed)]['isDangerous'],'tables':_0x8a3990['tables'],'parameters':_0x8a3990['parameters'],'message':_0x8a3990[_0x2c8b91(0xd7)]};_0x8a3990[_0x2c8b91(0xed)][_0x2c8b91(0xd6)]&&(_0x56b237[_0x2c8b91(0xd6)]=_0x8a3990[_0x2c8b91(0xed)]['reason']);const _0x2ef533=_0x589067[_0x2c8b91(0xe1)](_0x2c8b91(0xdc));if(_0x2ef533&&_0x8a3990[_0x2c8b91(0xca)]){const _0x2f0a7f=_0x2ef533[_0x2c8b91(0xf1)](',')['map'](_0x5016c9=>_0x5016c9[_0x2c8b91(0xec)]())['filter'](Boolean),_0x25a02b=[],_0x2e1674=filterDbTableBackedDatasets(await listDatasets(_0x589067[_0x2c8b91(0xe8)])),_0x1f4c4e=new Map(_0x2e1674[_0x2c8b91(0xe3)](_0x26f28b=>[_0x26f28b[_0x2c8b91(0xeb)]?.[_0x2c8b91(0xcf)]?.[_0x2c8b91(0xce)](),_0x26f28b]));for(const _0xcb0aed of _0x8a3990[_0x2c8b91(0xe9)]){const _0x1e125b=_0x1f4c4e[_0x2c8b91(0xc6)](_0xcb0aed[_0x2c8b91(0xce)]());!_0x1e125b&&_0x25a02b[_0x2c8b91(0xd4)](_0x2c8b91(0xe7)+_0xcb0aed+_0x2c8b91(0xf2));}for(const _0x3b9ab5 of _0x2f0a7f){let _0xbbc00d;try{_0xbbc00d=await getDatasetDetail(_0x3b9ab5);}catch{_0x25a02b[_0x2c8b91(0xd4)](_0x2c8b91(0xe0)+_0x3b9ab5+_0x2c8b91(0xe4));continue;}assertDatasetIsDbTableBacked(_0xbbc00d,_0x2c8b91(0xcb));const _0x510cb1=Array[_0x2c8b91(0xd5)](_0xbbc00d['fields'])?_0xbbc00d['fields']:[],_0x380e18=new Set(_0x510cb1[_0x2c8b91(0xe3)](_0x3bd3ce=>_0x3bd3ce[_0x2c8b91(0xef)]?.[_0x2c8b91(0xce)]())),_0x13c51f=_0xbbc00d['dbtableConfig']?.['tableName']||_0xbbc00d[_0x2c8b91(0xcf)]||_0x3b9ab5;_0x56b237[_0x2c8b91(0xea)+_0x13c51f]={'code':_0x3b9ab5,'tableName':_0x13c51f,'fieldCount':_0x380e18[_0x2c8b91(0xd1)],'fields':Array[_0x2c8b91(0xd8)](_0x380e18)};}_0x25a02b[_0x2c8b91(0xe2)]>0x0&&(_0x56b237['schemaWarnings']=_0x25a02b);}return{'ok':_0x8a3990['valid'],'data':_0x56b237,'message':_0x8a3990[_0x2c8b91(0xd7)]};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a164_0xa24420=a164_0x41d3;function a164_0x41d3(_0x5707c8,_0x3270d3){_0x5707c8=_0x5707c8-0x6a;const _0x125f18=a164_0x125f();let _0x41d305=_0x125f18[_0x5707c8];return _0x41d305;}(function(_0x1013f3,_0x2b0c45){const _0x5a2afb=a164_0x41d3,_0x3a24ca=_0x1013f3();while(!![]){try{const _0x3796a2=-parseInt(_0x5a2afb(0x76))/0x1*(-parseInt(_0x5a2afb(0x70))/0x2)+-parseInt(_0x5a2afb(0x6d))/0x3+-parseInt(_0x5a2afb(0x74))/0x4+-parseInt(_0x5a2afb(0x6b))/0x5*(-parseInt(_0x5a2afb(0x75))/0x6)+parseInt(_0x5a2afb(0x71))/0x7*(parseInt(_0x5a2afb(0x6c))/0x8)+parseInt(_0x5a2afb(0x77))/0x9+-parseInt(_0x5a2afb(0x73))/0xa;if(_0x3796a2===_0x2b0c45)break;else _0x3a24ca['push'](_0x3a24ca['shift']());}catch(_0x2d8307){_0x3a24ca['push'](_0x3a24ca['shift']());}}}(a164_0x125f,0x6e112));function a164_0x125f(){const _0x426459=['App\x20profile\x20name','3061330LeMOfp','1775656grWwDZ','6kuoRVp','1yZfkIW','7524315EuugpY','workspace','Register\x20an\x20app\x20profile\x20in\x20the\x20current\x20workspace\x20(or\x20--global)','897125NqTRjs','814824KQiLpB','1035435BiEwEW','add','workspace\x20add','450014pmLjAE','21sbrivP'];a164_0x125f=function(){return _0x426459;};return a164_0x125f();}import{buildAppAddFlags,runAppAdd,validateAppName}from'../../commands/common/app-registry.js';export const workspaceAddDefinition={'service':a164_0xa24420(0x78),'command':a164_0xa24420(0x6e),'description':a164_0xa24420(0x6a),'risk':'write','requiresAuth':![],'requiresAppCode':![],'args':[{'name':'name','description':a164_0xa24420(0x72),'required':!![]}],'flags':buildAppAddFlags(),'validate':_0x571ff8=>validateAppName(_0x571ff8,a164_0xa24420(0x6f)),'execute':_0x575e16=>runAppAdd(_0x575e16,a164_0xa24420(0x6f))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a165_0xe7d13e=a165_0x2004;(function(_0x120484,_0x448cb1){const _0x5f8a51=a165_0x2004,_0x5463f8=_0x120484();while(!![]){try{const _0x446edd=parseInt(_0x5f8a51(0x8c))/0x1*(-parseInt(_0x5f8a51(0x9c))/0x2)+-parseInt(_0x5f8a51(0x74))/0x3*(parseInt(_0x5f8a51(0xa3))/0x4)+parseInt(_0x5f8a51(0xa5))/0x5+-parseInt(_0x5f8a51(0x84))/0x6+-parseInt(_0x5f8a51(0x78))/0x7*(-parseInt(_0x5f8a51(0x79))/0x8)+-parseInt(_0x5f8a51(0x8a))/0x9*(parseInt(_0x5f8a51(0x94))/0xa)+parseInt(_0x5f8a51(0x93))/0xb*(parseInt(_0x5f8a51(0x9a))/0xc);if(_0x446edd===_0x448cb1)break;else _0x5463f8['push'](_0x5463f8['shift']());}catch(_0x18d17d){_0x5463f8['push'](_0x5463f8['shift']());}}}(a165_0x3a1e,0xb1da6));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+'\x20workspace\x20<init|use>\x20--app\x20<name>\x20[--appcode\x20<code>]',SAFE_PROFILE_KEYS=[a165_0xe7d13e(0x8b),a165_0xe7d13e(0x88),a165_0xe7d13e(0x73),'format',a165_0xe7d13e(0x7a),a165_0xe7d13e(0x71),'locale'],workspaceFlags=[{'name':a165_0xe7d13e(0xa4),'type':'string','description':a165_0xe7d13e(0x8f)},{'name':a165_0xe7d13e(0x8b),'type':a165_0xe7d13e(0x99),'description':a165_0xe7d13e(0xa9)},{'name':a165_0xe7d13e(0x88),'type':a165_0xe7d13e(0x99),'description':a165_0xe7d13e(0x81),'enum':[...RABETBASE_ENV_VALUES]},{'name':a165_0xe7d13e(0x73),'type':a165_0xe7d13e(0x99),'description':a165_0xe7d13e(0x9d)},{'name':a165_0xe7d13e(0x86),'type':a165_0xe7d13e(0x99),'description':a165_0xe7d13e(0x9e),'enum':[...RABETBASE_OUTPUT_FORMAT_VALUES]},{'name':a165_0xe7d13e(0x7a),'type':a165_0xe7d13e(0x75),'description':a165_0xe7d13e(0x8d)},{'name':a165_0xe7d13e(0x71),'type':a165_0xe7d13e(0x99),'description':a165_0xe7d13e(0x89),'enum':[...RISK_LEVEL_VALUES]},{'name':a165_0xe7d13e(0x8e),'type':a165_0xe7d13e(0x99),'description':a165_0xe7d13e(0x7e)}];function isRecord(_0x39f407){const _0x10bc33=a165_0xe7d13e;return!!_0x39f407&&typeof _0x39f407===_0x10bc33(0x72)&&!Array['isArray'](_0x39f407);}function assertValidAppcode(_0x31d543){const _0x134634=a165_0xe7d13e,{valid:_0x23df5d,message:_0x53a6f2}=validateAppcode(_0x31d543);if(!_0x23df5d)throw CliErrors[_0x134634(0xa6)]('Invalid\x20appcode:\x20'+_0x31d543,_0x53a6f2);}function a165_0x3a1e(){const _0xd5b214=['7BBIsVz','567848yATcDe','pageSize','Use\x20`','defaultApp','\x20(appcode:\x20','Locale\x20for\x20this\x20workspace\x20app\x20profile','globalConfig','\x22\x20not\x20found.','Target\x20environment','workspace','apps','3315036EcJmfi','write','defaultFormat','.\x20Credentials:\x20not\x20written.','env','Risk\x20level\x20for\x20this\x20workspace\x20app\x20profile','492354brHCws','appcode','467135yKDvLC','Default\x20page\x20size\x20for\x20this\x20workspace\x20app\x20profile','locale','App\x20profile\x20name\x20to\x20use\x20in\x20this\x20workspace','\x20workspace\x20','project','trim','77Jwvzbx','20KoXTQr','str','use','flag','initialized','string','2854068IfOtKA','keys','2gqkBSc','API\x20directory\x20path\x20for\x20this\x20workspace\x20app\x20profile','Default\x20output\x20format\x20for\x20this\x20workspace\x20app\x20profile','Missing\x20workspace\x20app\x20selector.','\x20workspace\x20init\x20--appcode\x20<code>`\x20or\x20`','App\x20\x22','workspace.','4cqAqqQ','app','5228805SARmDX','validation','length','\x20--app\x20','App\x20code\x20to\x20bind\x20to\x20this\x20workspace','updated',').\x20Config:\x20','init','join','riskLevel','object','apiDir','2772228aanSKA','number','Initialize\x20the\x20current\x20workspace\x20app\x20binding','Pass\x20--appcode\x20<code>,\x20or\x20choose\x20one\x20of:\x20'];a165_0x3a1e=function(){return _0xd5b214;};return a165_0x3a1e();}function sanitizeProfile(_0x1f937d){if(!isRecord(_0x1f937d))return{};const _0x1373f0={};for(const _0x682ee5 of SAFE_PROFILE_KEYS){if(_0x1f937d[_0x682ee5]!==undefined)_0x1373f0[_0x682ee5]=_0x1f937d[_0x682ee5];}return _0x1373f0;}function cloneProfile(_0x4c9422){return isRecord(_0x4c9422)?{..._0x4c9422}:{};}function collectWorkspaceProfileOverrides(_0x5289fe){const _0x244e6f=a165_0xe7d13e,_0x2ee520={},_0x18b963=_0x5289fe[_0x244e6f(0x95)](_0x244e6f(0x88)),_0x59e155=_0x5289fe[_0x244e6f(0x95)](_0x244e6f(0x73)),_0x341bdb=_0x5289fe[_0x244e6f(0x95)](_0x244e6f(0x86)),_0x8935a8=_0x5289fe[_0x244e6f(0x97)](_0x244e6f(0x7a)),_0x356e7d=_0x5289fe['str'](_0x244e6f(0x71)),_0x22ff91=_0x5289fe[_0x244e6f(0x95)](_0x244e6f(0x8e));if(_0x18b963)_0x2ee520[_0x244e6f(0x88)]=_0x18b963;if(_0x59e155)_0x2ee520[_0x244e6f(0x73)]=_0x59e155;if(_0x341bdb)_0x2ee520['format']=_0x341bdb;if(_0x8935a8!==undefined&&_0x8935a8!=='')_0x2ee520[_0x244e6f(0x7a)]=Number(_0x8935a8);if(_0x356e7d)_0x2ee520[_0x244e6f(0x71)]=_0x356e7d;if(_0x22ff91)_0x2ee520[_0x244e6f(0x8e)]=_0x22ff91;return _0x2ee520;}async function validateWorkspaceArgs(_0x475030){const _0x3b1ba4=a165_0xe7d13e,_0x35b3dc=_0x475030[_0x3b1ba4(0x95)](_0x3b1ba4(0xa4))['trim'](),_0x3fe132=_0x475030[_0x3b1ba4(0x95)](_0x3b1ba4(0x8b))[_0x3b1ba4(0x92)]();if(!_0x35b3dc&&!_0x3fe132)throw CliErrors['validation'](_0x3b1ba4(0x9f),_0x3b1ba4(0x7b)+CLI_BIN_NAME+_0x3b1ba4(0xa0)+CLI_BIN_NAME+'\x20workspace\x20use\x20--app\x20<name>`.');if(_0x3fe132)assertValidAppcode(_0x3fe132);}function resolveKnownApps(){const _0x31e4fb=a165_0xe7d13e,{config:_0x28bfc7,layers:_0x295f57}=readRawConfigWithLayers(),_0x1dfd61=isRecord(_0x28bfc7[_0x31e4fb(0x83)])?_0x28bfc7[_0x31e4fb(0x83)]:{},_0x475d3f=isRecord(_0x295f57['globalConfig'][_0x31e4fb(0x83)])?_0x295f57[_0x31e4fb(0x7f)][_0x31e4fb(0x83)]:{};return{..._0x475d3f,..._0x1dfd61};}async function configureWorkspace(_0x59dbdd,_0x42d9a1){const _0x16e332=a165_0xe7d13e,_0x38a133=_0x59dbdd[_0x16e332(0x95)](_0x16e332(0xa4))[_0x16e332(0x92)](),_0x28833e=_0x59dbdd[_0x16e332(0x95)](_0x16e332(0x8b))[_0x16e332(0x92)](),_0x4ceede=_0x38a133||_0x28833e;if(!_0x4ceede)throw CliErrors[_0x16e332(0xa6)]('Missing\x20workspace\x20app\x20selector.',_0x16e332(0x7b)+CLI_BIN_NAME+_0x16e332(0xa0)+CLI_BIN_NAME+'\x20workspace\x20use\x20--app\x20<name>`.');if(_0x28833e)assertValidAppcode(_0x28833e);const _0x440dc9=resolveWriteConfigPath(_0x16e332(0x91)),_0x27d814=readConfigFile(_0x440dc9),_0x43d5dd=resolveKnownApps(),_0x1e2266=isRecord(_0x27d814[_0x16e332(0x83)])?{..._0x27d814[_0x16e332(0x83)]}:{},_0x3ca57f=cloneProfile(_0x1e2266[_0x4ceede]),_0x3ff547=sanitizeProfile(_0x43d5dd[_0x4ceede]),_0x10751c=_0x28833e?{}:_0x3ff547,_0x46c196=_0x28833e||_0x10751c[_0x16e332(0x8b)];if(!_0x46c196){const _0x463845=Object[_0x16e332(0x9b)](_0x43d5dd),_0x43e658=_0x463845[_0x16e332(0xa7)]===0x0?_0x16e332(0x7b)+CLI_BIN_NAME+_0x16e332(0x90)+_0x42d9a1+_0x16e332(0xa8)+_0x4ceede+'\x20--appcode\x20<code>`.':_0x16e332(0x77)+_0x463845[_0x16e332(0x70)](',\x20');throw CliErrors[_0x16e332(0xa6)](_0x16e332(0xa1)+_0x4ceede+_0x16e332(0x80),_0x43e658);}assertValidAppcode(String(_0x46c196));const _0x158dce={..._0x10751c,..._0x3ca57f,'appcode':String(_0x46c196),...collectWorkspaceProfileOverrides(_0x59dbdd)};return _0x1e2266[_0x4ceede]=_0x158dce,_0x27d814[_0x16e332(0x83)]=_0x1e2266,_0x27d814[_0x16e332(0x7c)]=_0x4ceede,delete _0x27d814['appcode'],delete _0x27d814[_0x16e332(0xa4)],_0x158dce['env']&&(_0x27d814[_0x16e332(0x88)]=_0x158dce['env']),writeConfigFile(_0x440dc9,_0x27d814),{'ok':!![],'message':'Workspace\x20'+(_0x42d9a1===_0x16e332(0x6f)?_0x16e332(0x98):_0x16e332(0xaa))+':\x20'+_0x4ceede+_0x16e332(0x7d)+_0x158dce[_0x16e332(0x8b)]+_0x16e332(0xab)+_0x440dc9+_0x16e332(0x87),'data':{'operation':_0x16e332(0xa2)+_0x42d9a1,'configPath':_0x440dc9,'app':_0x4ceede,'appcode':_0x158dce['appcode'],'env':_0x158dce[_0x16e332(0x88)]??null,'credentialsWritten':![]}};}function a165_0x2004(_0x450e00,_0x17fb51){_0x450e00=_0x450e00-0x6f;const _0x3a1e27=a165_0x3a1e();let _0x2004d2=_0x3a1e27[_0x450e00];return _0x2004d2;}const workspaceInitDefinition={'service':a165_0xe7d13e(0x82),'command':'init','description':a165_0xe7d13e(0x76),'risk':a165_0xe7d13e(0x85),'requiresAuth':![],'requiresAppCode':![],'args':[],'flags':workspaceFlags,'validate':validateWorkspaceArgs,'execute':_0x8d4ce6=>configureWorkspace(_0x8d4ce6,'init')},workspaceUseDefinition={'service':a165_0xe7d13e(0x82),'command':a165_0xe7d13e(0x96),'description':'Switch\x20the\x20current\x20workspace\x20app\x20binding','risk':a165_0xe7d13e(0x85),'requiresAuth':![],'requiresAppCode':![],'args':[],'flags':workspaceFlags,'validate':validateWorkspaceArgs,'execute':_0x36b2d1=>configureWorkspace(_0x36b2d1,'use')};export const workspaceDefinitions=[workspaceInitDefinition,workspaceUseDefinition,workspaceAddDefinition,workspaceRemoveDefinition];export{WORKSPACE_USAGE};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a166_0x29c1(_0xcd28cc,_0x11a83a){_0xcd28cc=_0xcd28cc-0x1a8;const _0x28b04a=a166_0x28b0();let _0x29c162=_0x28b04a[_0xcd28cc];return _0x29c162;}const a166_0x243e56=a166_0x29c1;(function(_0x531cee,_0xacea41){const _0x513f0a=a166_0x29c1,_0x1af1e0=_0x531cee();while(!![]){try{const _0x290d3b=parseInt(_0x513f0a(0x1a8))/0x1*(-parseInt(_0x513f0a(0x1ad))/0x2)+-parseInt(_0x513f0a(0x1ae))/0x3+parseInt(_0x513f0a(0x1b7))/0x4+parseInt(_0x513f0a(0x1af))/0x5+parseInt(_0x513f0a(0x1b8))/0x6*(parseInt(_0x513f0a(0x1b2))/0x7)+-parseInt(_0x513f0a(0x1b9))/0x8*(parseInt(_0x513f0a(0x1a9))/0x9)+parseInt(_0x513f0a(0x1b4))/0xa*(-parseInt(_0x513f0a(0x1b6))/0xb);if(_0x290d3b===_0xacea41)break;else _0x1af1e0['push'](_0x1af1e0['shift']());}catch(_0x4b0e3f){_0x1af1e0['push'](_0x1af1e0['shift']());}}}(a166_0x28b0,0x5757a));import{buildAppRemoveFlags,runAppRemove,validateAppName}from'../../commands/common/app-registry.js';function a166_0x28b0(){const _0x5a97cb=['1215900wfdMAL','2642100DHwKUa','workspace','App\x20profile\x20name\x20to\x20remove','4984609qVSaVQ','remove','1261430IgOECX','Remove\x20an\x20app\x20profile\x20from\x20the\x20current\x20workspace\x20(or\x20--global)','22XlXfZw','2684084oWmCtH','6tJsUDF','223160DjRsaI','700923HlNnUa','63asQeqe','name','workspace\x20remove','high-risk-write','2OmYkEJ'];a166_0x28b0=function(){return _0x5a97cb;};return a166_0x28b0();}export const workspaceRemoveDefinition={'service':a166_0x243e56(0x1b0),'command':a166_0x243e56(0x1b3),'description':a166_0x243e56(0x1b5),'risk':a166_0x243e56(0x1ac),'requiresAuth':![],'requiresAppCode':![],'args':[{'name':a166_0x243e56(0x1aa),'description':a166_0x243e56(0x1b1),'required':!![]}],'flags':buildAppRemoveFlags(),'validate':_0x42fb37=>validateAppName(_0x42fb37,a166_0x243e56(0x1ab)),'execute':_0x58f051=>runAppRemove(_0x58f051,a166_0x243e56(0x1ab))};
|
package/lib/config/schema.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a167_0x26cc55=a167_0x1e26;(function(_0x5ae54c,_0x1ae470){const _0x364841=a167_0x1e26,_0x3cd73a=_0x5ae54c();while(!![]){try{const _0x3f1be0=parseInt(_0x364841(0x1be))/0x1+parseInt(_0x364841(0x1ce))/0x2*(-parseInt(_0x364841(0x1d4))/0x3)+-parseInt(_0x364841(0x1d6))/0x4*(-parseInt(_0x364841(0x1cf))/0x5)+-parseInt(_0x364841(0x1d3))/0x6*(-parseInt(_0x364841(0x1db))/0x7)+parseInt(_0x364841(0x1e2))/0x8+-parseInt(_0x364841(0x1dd))/0x9*(-parseInt(_0x364841(0x1c8))/0xa)+-parseInt(_0x364841(0x1c7))/0xb;if(_0x3f1be0===_0x1ae470)break;else _0x3cd73a['push'](_0x3cd73a['shift']());}catch(_0x3d8add){_0x3cd73a['push'](_0x3cd73a['shift']());}}}(a167_0x37e4,0xe5f20));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=[a167_0x26cc55(0x1cc),a167_0x26cc55(0x1ca),a167_0x26cc55(0x1d7),'format',a167_0x26cc55(0x1d2)];export const TOP_LEVEL_CONFIG_KEYS=new Set([a167_0x26cc55(0x1df),a167_0x26cc55(0x1c3),a167_0x26cc55(0x1d7),'format','cookie',a167_0x26cc55(0x1ca),'apiDir']);export const CONFIG_ENUM_VALUES={'env':[...RABETBASE_ENV_VALUES],'format':[...RABETBASE_OUTPUT_FORMAT_VALUES]};export function formatConfigKeyList(_0x14dded){const _0x2296f1=a167_0x26cc55;return[..._0x14dded][_0x2296f1(0x1d1)](',\x20');}function a167_0x37e4(){const _0x91c52a=['Default\x20page\x20size','Access\x20key','35pASywO','inherit','6307731FMFuhC','length','appcode','Locale','apps','11944648cdLsVk','app','en-US','filter','string','entries','Risk\x20level','571329TBYnJC','defaultApp','Default\x20output\x20format\x20for\x20this\x20app\x20(profile)','number','apiDir','env','format','Auth\x20cookie','defaultFormat','27980546cUvHrv','20BVpdcI','trim','accessKey','zh-CN','cookie','Target\x20environment','2DYMaYv','6945kLYSKG','pageSize','join','riskLevel','207324eEeTlB','5056269LxpRrL','map','4412XXWXed','locale','toLowerCase'];a167_0x37e4=function(){return _0x91c52a;};return a167_0x37e4();}function a167_0x1e26(_0x166562,_0x32b25b){_0x166562=_0x166562-0x1bb;const _0x37e426=a167_0x37e4();let _0x1e26b0=_0x37e426[_0x166562];return _0x1e26b0;}export function getTopLevelConfigKeyList(){return[...TOP_LEVEL_CONFIG_KEYS];}export function isTopLevelConfigKey(_0x2e83b0){return TOP_LEVEL_CONFIG_KEYS['has'](_0x2e83b0);}export function getTopLevelConfigKeySummary(){return formatConfigKeyList(getTopLevelConfigKeyList());}export function getConfigCommandKeyDescription(){return'Config\x20key\x20('+getTopLevelConfigKeySummary()+')';}export const APP_PROFILE_FLAG_KEY_MAP={'env':'env','apiDir':a167_0x26cc55(0x1c2),'cookie':a167_0x26cc55(0x1cc),'accessKey':a167_0x26cc55(0x1ca),'defaultFormat':a167_0x26cc55(0x1c4),'pageSize':a167_0x26cc55(0x1d0),'riskLevel':'riskLevel','locale':a167_0x26cc55(0x1d7)};export function getAppProfileFlagDefs(){const _0x146505=a167_0x26cc55;return[{'name':_0x146505(0x1c3),'type':_0x146505(0x1bb),'description':_0x146505(0x1cd),'enum':[...RABETBASE_ENV_VALUES]},{'name':_0x146505(0x1c2),'type':_0x146505(0x1bb),'description':'API\x20directory\x20path'},{'name':'cookie','type':_0x146505(0x1bb),'description':_0x146505(0x1c5),'hidden':!![]},{'name':_0x146505(0x1ca),'type':_0x146505(0x1bb),'description':_0x146505(0x1da),'hidden':!![]},{'name':_0x146505(0x1c6),'type':'string','description':_0x146505(0x1c0),'enum':[...RABETBASE_OUTPUT_FORMAT_VALUES]},{'name':'pageSize','type':_0x146505(0x1c1),'description':_0x146505(0x1d9)},{'name':'riskLevel','type':_0x146505(0x1bb),'description':_0x146505(0x1bd),'enum':[...RISK_LEVEL_VALUES]},{'name':_0x146505(0x1d7),'type':'string','description':_0x146505(0x1e0)}];}export function collectAppProfileOverrides(_0x84e37c){const _0x3b8185=a167_0x26cc55,_0x20d15b={};for(const [_0x3ef571,_0x3ed377]of Object[_0x3b8185(0x1bc)](APP_PROFILE_FLAG_KEY_MAP)){const _0x3a0be7=_0x84e37c(_0x3ef571);if(!_0x3a0be7)continue;_0x20d15b[_0x3ed377]=_0x3ed377===_0x3b8185(0x1d0)?Number(_0x3a0be7):_0x3a0be7;}return _0x20d15b;}export function buildAppProfileListFields(_0x1f66e6){const _0x5817a2=a167_0x26cc55;return{'env':_0x1f66e6[_0x5817a2(0x1c3)]??null,'apiDir':_0x1f66e6[_0x5817a2(0x1c2)]??null,'hasCookie':!!_0x1f66e6[_0x5817a2(0x1cc)],'hasAccessKey':!!_0x1f66e6['accessKey'],'format':_0x1f66e6[_0x5817a2(0x1c4)]??null,'pageSize':_0x1f66e6['pageSize']??null,'riskLevel':_0x1f66e6[_0x5817a2(0x1d2)]??null,'locale':_0x1f66e6['locale']??null};}export function buildAppDoctorFields(_0x4be2ee,_0x5713ec){const _0x1a9006=a167_0x26cc55;return{'env':{'value':_0x4be2ee[_0x1a9006(0x1c3)]||_0x5713ec['env'],'source':_0x4be2ee['env']?_0x1a9006(0x1e3):_0x1a9006(0x1dc)},'apiDir':{'value':_0x4be2ee[_0x1a9006(0x1c2)]||_0x5713ec[_0x1a9006(0x1c2)],'source':_0x4be2ee[_0x1a9006(0x1c2)]?'app':_0x1a9006(0x1dc)},'cookie':{'value':_0x4be2ee['cookie']||_0x5713ec[_0x1a9006(0x1cc)],'source':_0x4be2ee[_0x1a9006(0x1cc)]?_0x1a9006(0x1e3):'inherit'},'accessKey':{'value':_0x4be2ee[_0x1a9006(0x1ca)]||_0x5713ec[_0x1a9006(0x1ca)],'source':_0x4be2ee[_0x1a9006(0x1ca)]?_0x1a9006(0x1e3):'inherit'}};}export function buildCanonicalAppConfig(_0x4c3fa6,_0x29a09a){const _0x85698d=a167_0x26cc55,_0x348d14=_0x4c3fa6[_0x85698d(0x1d5)](_0x5543d9=>String(_0x5543d9||'')[_0x85698d(0x1c9)]())[_0x85698d(0x1e5)](Boolean);if(_0x348d14[_0x85698d(0x1de)]===0x0)return{};const _0x5df17e={};for(const _0x265f5c of _0x348d14){_0x5df17e[_0x265f5c]=_0x29a09a?{'appcode':_0x265f5c,'env':_0x29a09a}:{'appcode':_0x265f5c};}return{'apps':_0x5df17e,'defaultApp':_0x348d14[0x0]};}export function buildCanonicalProjectConfig(_0x3317a6,_0x67bf29){const _0x1235ec=a167_0x26cc55,{appCodes:appCodes=[],env:_0x298a7f,metadata:_0x4163ae}=_0x67bf29,_0x280422={..._0x3317a6,..._0x4163ae||{}};delete _0x280422[_0x1235ec(0x1df)],delete _0x280422['app'];if(_0x298a7f)_0x280422['env']=_0x298a7f;else!_0x280422[_0x1235ec(0x1c3)]&&(_0x280422[_0x1235ec(0x1c3)]=DEFAULT_CONFIG_VALUES[_0x1235ec(0x1c3)]);const _0x27e5c1=buildCanonicalAppConfig(appCodes,_0x280422[_0x1235ec(0x1c3)]);return Object['keys'](_0x27e5c1)[_0x1235ec(0x1de)]>0x0&&(_0x280422['apps']=_0x27e5c1[_0x1235ec(0x1e1)],_0x280422[_0x1235ec(0x1bf)]=_0x27e5c1[_0x1235ec(0x1bf)]),_0x280422;}const LOCALE_MAP={'zh':a167_0x26cc55(0x1cb),'zh-cn':'zh-CN','zh_cn':'zh-CN','en':a167_0x26cc55(0x1e4),'en-us':'en-US','en_us':a167_0x26cc55(0x1e4)};export function normalizeLocale(_0x2046fb){const _0x379df2=a167_0x26cc55;if(!_0x2046fb)return null;return LOCALE_MAP[_0x2046fb[_0x379df2(0x1d8)]()]??null;}
|
package/lib/constant/cdn.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a168_0x4fe555=a168_0x43ae;function a168_0x43ae(_0x2817c4,_0x2af72c){_0x2817c4=_0x2817c4-0xce;const _0x10db27=a168_0x10db();let _0x43aeee=_0x10db27[_0x2817c4];return _0x43aeee;}function a168_0x10db(){const _0x33d19d=['391634iyBrvo','4053709MHIIOS','23211RnlHIb','2833520DWhSqg','https://g.lovrabet.com/dist/rabetbase-cli/config/index.json','75318lQKsdk','1DARGPI','1576YbUNnC','179223hcobby','392LJheTb','8NtygnA','225125LatSyh'];a168_0x10db=function(){return _0x33d19d;};return a168_0x10db();}(function(_0x366f99,_0x1aeb06){const _0x84a567=a168_0x43ae,_0x487d1=_0x366f99();while(!![]){try{const _0x3ae719=-parseInt(_0x84a567(0xd3))/0x1*(parseInt(_0x84a567(0xd9))/0x2)+-parseInt(_0x84a567(0xd5))/0x3*(-parseInt(_0x84a567(0xd7))/0x4)+parseInt(_0x84a567(0xd8))/0x5+-parseInt(_0x84a567(0xd2))/0x6*(parseInt(_0x84a567(0xd6))/0x7)+parseInt(_0x84a567(0xd4))/0x8*(parseInt(_0x84a567(0xcf))/0x9)+parseInt(_0x84a567(0xd0))/0xa+parseInt(_0x84a567(0xce))/0xb;if(_0x3ae719===_0x1aeb06)break;else _0x487d1['push'](_0x487d1['shift']());}catch(_0xd2c942){_0x487d1['push'](_0x487d1['shift']());}}}(a168_0x10db,0x67eb8));export const CLI_VERSION_POLICY_URL=a168_0x4fe555(0xd1);
|
package/lib/constant/cli.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a169_0x51c153=a169_0x2b69;function a169_0x2b69(_0x22b7d0,_0x25c97b){_0x22b7d0=_0x22b7d0-0x174;const _0x513d9f=a169_0x513d();let _0x2b6963=_0x513d9f[_0x22b7d0];return _0x2b6963;}(function(_0xef650,_0x429d67){const _0x8335ad=a169_0x2b69,_0x486994=_0xef650();while(!![]){try{const _0x538cd1=-parseInt(_0x8335ad(0x17e))/0x1+parseInt(_0x8335ad(0x1b1))/0x2+parseInt(_0x8335ad(0x1a4))/0x3*(-parseInt(_0x8335ad(0x178))/0x4)+-parseInt(_0x8335ad(0x177))/0x5+parseInt(_0x8335ad(0x1c2))/0x6+parseInt(_0x8335ad(0x184))/0x7+parseInt(_0x8335ad(0x18f))/0x8;if(_0x538cd1===_0x429d67)break;else _0x486994['push'](_0x486994['shift']());}catch(_0x39c85e){_0x486994['push'](_0x486994['shift']());}}}(a169_0x513d,0xdaa30));export const CLI_BIN_NAME=a169_0x51c153(0x1b5);function a169_0x513d(){const _0x332d9f=['1070442kwfFkU','datasetcode','Keyword\x20filter','SQL\x20code','rabetbase','remote','global','Use\x20project\x20config\x20scope','nonInteractive','enable-bff-save','type','expectedCount','db-id','sql','Clear','target','format','5296200IHhBkp','clear','keyword','value','schemas','meowKey','appcode','Read\x20value\x20from\x20environment\x20variable','Watch\x20mode','Preview\x20operation\x20without\x20executing','functionNode','Skip\x20import\x20generation','Dataset\x20code','reveal','File\x20path','env','all','sql-name','Environment','@lovrabet/rabetbase-cli','Function\x20node','expected-count','Use\x20global\x20config\x20scope','Title','dbid','Rabetbase\x20CLI','function-node','non-interactive','Use\x20remote','<name>','stdin','DB\x20ID','4065395iUjcyp','4868qAaagm','confirm','Expected\x20affected\x20count','dry-run','Apply\x20to\x20all','Record\x20ID','526360hqNZMC','watch','fromEnv','Config\x20value','boolean','key','973854TwuDHy','pagesize','Output\x20format','Reveal\x20sensitive\x20value','production\x20|\x20daily','Code\x20filter','Read\x20value\x20from\x20stdin','fromEntries','yes','title','output','9074456ANOrkb','force','help','enableBffSave','Force\x20non-interactive\x20mode\x20(CI)','tags','params','<expr>','string','Enable\x20BFF\x20save','JSON\x20params','file','sqlcode','Filter\x20JSON\x20output\x20(JQ_PATH\x20>\x20bundled\x20jq\x20>\x20PATH;\x20use\x20with\x20--format\x20json\x20or\x20compress)','verbose','operation','SQL\x20string','Alias\x20for\x20--non-interactive','dryRun','skip-imports','skipImports','1125mcefal','Select\x20app\x20profile\x20by\x20name','page','app','sqlname','Page\x20number','Force\x20overwrite','map','Operation\x20type','name','Page\x20size','Target\x20path','code'];a169_0x513d=function(){return _0x332d9f;};return a169_0x513d();}export const CLI_DISPLAY_NAME=a169_0x51c153(0x1db);export const NPM_PACKAGE_NAME=a169_0x51c153(0x1d5);export const GLOBAL_FLAGS=[{'name':a169_0x51c153(0x1c8),'meowKey':a169_0x51c153(0x1c8),'type':a169_0x51c153(0x197),'description':'Override\x20appcode','hint':'<code>'},{'name':a169_0x51c153(0x1a7),'meowKey':a169_0x51c153(0x1a7),'type':'string','description':a169_0x51c153(0x1a5),'hint':a169_0x51c153(0x174)},{'name':'env','meowKey':'env','type':a169_0x51c153(0x197),'description':a169_0x51c153(0x1d4),'hint':a169_0x51c153(0x188)},{'name':a169_0x51c153(0x1c1),'meowKey':a169_0x51c153(0x1c1),'type':a169_0x51c153(0x197),'description':a169_0x51c153(0x186),'hint':'json\x20|\x20pretty\x20|\x20compress'},{'name':'jq','meowKey':'jq','type':a169_0x51c153(0x197),'description':a169_0x51c153(0x19c),'hint':a169_0x51c153(0x196)},{'name':a169_0x51c153(0x17b),'meowKey':a169_0x51c153(0x1a1),'type':a169_0x51c153(0x182),'description':a169_0x51c153(0x1cb)},{'name':a169_0x51c153(0x18c),'meowKey':'yes','type':a169_0x51c153(0x182),'description':'Skip\x20confirmation\x20for\x20high-risk\x20writes'},{'name':a169_0x51c153(0x1dd),'meowKey':a169_0x51c153(0x1b9),'type':a169_0x51c153(0x182),'description':a169_0x51c153(0x193)},{'name':a169_0x51c153(0x1b7),'meowKey':'global','type':a169_0x51c153(0x182),'description':a169_0x51c153(0x1d8)},{'name':'project','meowKey':'project','type':a169_0x51c153(0x182),'description':a169_0x51c153(0x1b8)},{'name':'ci','meowKey':'ci','type':a169_0x51c153(0x182),'description':a169_0x51c153(0x1a0),'hidden':!![]},{'name':a169_0x51c153(0x191),'meowKey':a169_0x51c153(0x191),'type':a169_0x51c153(0x182),'description':'Show\x20help'},{'name':'name','meowKey':a169_0x51c153(0x1ad),'type':'string','description':'Name','hidden':!![]},{'name':a169_0x51c153(0x18d),'meowKey':a169_0x51c153(0x18d),'type':'string','description':a169_0x51c153(0x1d9),'hidden':!![]},{'name':a169_0x51c153(0x1c3),'meowKey':a169_0x51c153(0x1c3),'type':a169_0x51c153(0x182),'description':a169_0x51c153(0x1bf),'hidden':!![]},{'name':a169_0x51c153(0x17f),'meowKey':a169_0x51c153(0x17f),'type':a169_0x51c153(0x182),'description':a169_0x51c153(0x1ca),'hidden':!![]},{'name':a169_0x51c153(0x18e),'meowKey':a169_0x51c153(0x18e),'type':a169_0x51c153(0x197),'description':'Output\x20path','hidden':!![]},{'name':a169_0x51c153(0x195),'meowKey':a169_0x51c153(0x195),'type':a169_0x51c153(0x197),'description':a169_0x51c153(0x199),'hidden':!![]},{'name':a169_0x51c153(0x1b2),'meowKey':a169_0x51c153(0x1b2),'type':'string','description':a169_0x51c153(0x1ce),'hidden':!![]},{'name':'all','meowKey':a169_0x51c153(0x1d2),'type':a169_0x51c153(0x182),'description':a169_0x51c153(0x17c),'hidden':!![]},{'name':a169_0x51c153(0x1ba),'meowKey':a169_0x51c153(0x192),'type':a169_0x51c153(0x182),'description':a169_0x51c153(0x198),'hidden':!![]},{'name':'id','meowKey':'id','type':a169_0x51c153(0x197),'description':a169_0x51c153(0x17d),'hidden':!![]},{'name':a169_0x51c153(0x1bb),'meowKey':a169_0x51c153(0x1bb),'type':'string','description':'Type\x20filter','hidden':!![]},{'name':a169_0x51c153(0x19a),'meowKey':a169_0x51c153(0x19a),'type':a169_0x51c153(0x197),'description':a169_0x51c153(0x1d0),'hidden':!![]},{'name':'sqlcode','meowKey':a169_0x51c153(0x19b),'type':a169_0x51c153(0x197),'description':a169_0x51c153(0x1b4),'hidden':!![]},{'name':a169_0x51c153(0x1d3),'meowKey':'sqlName','type':a169_0x51c153(0x197),'description':'SQL\x20name','hidden':!![]},{'name':a169_0x51c153(0x1a8),'meowKey':'sqlname','type':'string','description':'SQL\x20name','hidden':!![]},{'name':a169_0x51c153(0x1bd),'meowKey':'dbId','type':a169_0x51c153(0x197),'description':a169_0x51c153(0x176),'hidden':!![]},{'name':a169_0x51c153(0x1da),'meowKey':a169_0x51c153(0x1da),'type':a169_0x51c153(0x197),'description':a169_0x51c153(0x176),'hidden':!![]},{'name':'description','meowKey':'description','type':a169_0x51c153(0x197),'description':'Description','hidden':!![]},{'name':'description-file','meowKey':'descriptionFile','type':a169_0x51c153(0x197),'description':'Description\x20file','hidden':!![]},{'name':a169_0x51c153(0x1a6),'meowKey':a169_0x51c153(0x1a6),'type':'string','description':a169_0x51c153(0x1a9),'hidden':!![]},{'name':a169_0x51c153(0x185),'meowKey':a169_0x51c153(0x185),'type':a169_0x51c153(0x197),'description':a169_0x51c153(0x1ae),'hidden':!![]},{'name':'keyword','meowKey':a169_0x51c153(0x1c4),'type':a169_0x51c153(0x197),'description':a169_0x51c153(0x1b3),'hidden':!![]},{'name':a169_0x51c153(0x1b0),'meowKey':a169_0x51c153(0x1b0),'type':a169_0x51c153(0x197),'description':a169_0x51c153(0x189),'hidden':!![]},{'name':a169_0x51c153(0x1be),'meowKey':a169_0x51c153(0x1be),'type':a169_0x51c153(0x197),'description':a169_0x51c153(0x19f),'hidden':!![]},{'name':'schemas','meowKey':a169_0x51c153(0x1c6),'type':'string','description':'Schemas','hidden':!![]},{'name':a169_0x51c153(0x19e),'meowKey':a169_0x51c153(0x19e),'type':'string','description':a169_0x51c153(0x1ac),'hidden':!![]},{'name':a169_0x51c153(0x1c0),'meowKey':a169_0x51c153(0x1c0),'type':a169_0x51c153(0x197),'description':a169_0x51c153(0x1af),'hidden':!![]},{'name':a169_0x51c153(0x1a2),'meowKey':a169_0x51c153(0x1a3),'type':a169_0x51c153(0x182),'description':a169_0x51c153(0x1cd),'hidden':!![]},{'name':a169_0x51c153(0x183),'meowKey':'key','type':a169_0x51c153(0x197),'description':'Config\x20key','hidden':!![]},{'name':a169_0x51c153(0x1c5),'meowKey':a169_0x51c153(0x1c5),'type':a169_0x51c153(0x197),'description':a169_0x51c153(0x181),'hidden':!![]},{'name':'tags','meowKey':a169_0x51c153(0x194),'type':'string','description':'Tags','hidden':!![]},{'name':a169_0x51c153(0x175),'meowKey':a169_0x51c153(0x175),'type':a169_0x51c153(0x182),'description':a169_0x51c153(0x18a),'hidden':!![]},{'name':'from-env','meowKey':a169_0x51c153(0x180),'type':a169_0x51c153(0x197),'description':a169_0x51c153(0x1c9),'hidden':!![]},{'name':a169_0x51c153(0x1cf),'meowKey':'reveal','type':'boolean','description':a169_0x51c153(0x187),'hidden':!![]},{'name':a169_0x51c153(0x190),'meowKey':a169_0x51c153(0x190),'type':a169_0x51c153(0x182),'description':a169_0x51c153(0x1aa),'hidden':!![]},{'name':a169_0x51c153(0x179),'meowKey':a169_0x51c153(0x179),'type':'boolean','description':'Confirm\x20destructive\x20action','hidden':!![]},{'name':a169_0x51c153(0x1b6),'meowKey':a169_0x51c153(0x1b6),'type':a169_0x51c153(0x182),'description':a169_0x51c153(0x1de),'hidden':!![]},{'name':'verbose','meowKey':a169_0x51c153(0x19d),'type':a169_0x51c153(0x182),'description':'Verbose\x20output','hidden':!![]},{'name':a169_0x51c153(0x1d7),'meowKey':a169_0x51c153(0x1bc),'type':a169_0x51c153(0x197),'description':a169_0x51c153(0x17a),'hidden':!![]},{'name':'operation-type','meowKey':'operationType','type':a169_0x51c153(0x197),'description':'Operation\x20type','hidden':!![]},{'name':a169_0x51c153(0x1dc),'meowKey':a169_0x51c153(0x1cc),'type':a169_0x51c153(0x197),'description':a169_0x51c153(0x1d6),'hidden':!![]}];export const PIPELINE_FLAG_NAMES=new Set(['appcode',a169_0x51c153(0x1a7),a169_0x51c153(0x1d1),a169_0x51c153(0x1c1),'jq',a169_0x51c153(0x17b),a169_0x51c153(0x18c),a169_0x51c153(0x1dd),'ci']);export function buildMeowFlags(){const _0x4d4694=a169_0x51c153;return Object[_0x4d4694(0x18b)](GLOBAL_FLAGS[_0x4d4694(0x1ab)](_0x375df2=>[_0x375df2[_0x4d4694(0x1c7)],{'type':_0x375df2[_0x4d4694(0x1bb)]}]));}
|