@lovrabet/rabetbase-cli 2.3.2 → 2.3.3-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/api-doc.js +1 -1
- package/lib/api/fetch-model-list.js +1 -1
- package/lib/api/generate-api-file.js +1 -1
- package/lib/auth/auth-server-ui.js +1 -1
- package/lib/auth/auth-server.js +1 -1
- package/lib/auth/constant.js +1 -1
- package/lib/auth/get-cookie.js +1 -1
- package/lib/auth/get-session-user.js +1 -1
- package/lib/auth/is-session-valid.js +1 -1
- package/lib/auth/login-success-html.js +1 -1
- package/lib/auth/logout.js +1 -1
- package/lib/cli-flags.js +1 -1
- package/lib/cli.js +1 -1
- package/lib/commands/api/generate.js +1 -1
- package/lib/commands/api/index.js +1 -1
- package/lib/commands/api/list.js +1 -1
- package/lib/commands/api/pull.js +1 -1
- package/lib/commands/api/shared.js +1 -1
- package/lib/commands/app/add.js +1 -1
- package/lib/commands/app/discover.js +1 -1
- package/lib/commands/app/index.js +1 -1
- package/lib/commands/app/list.js +1 -1
- package/lib/commands/app/remove.js +1 -1
- package/lib/commands/app/shared.js +1 -1
- package/lib/commands/app/use.js +1 -1
- package/lib/commands/app-config/delete.js +1 -1
- package/lib/commands/app-config/get.js +1 -1
- package/lib/commands/app-config/index.js +1 -1
- package/lib/commands/app-config/list.js +1 -1
- package/lib/commands/app-config/set.js +1 -1
- package/lib/commands/app-config/shared.js +1 -1
- package/lib/commands/auth/index.js +1 -1
- package/lib/commands/bff/create.js +1 -1
- package/lib/commands/bff/delete.js +1 -1
- package/lib/commands/bff/detail.js +1 -1
- package/lib/commands/bff/index.js +1 -1
- package/lib/commands/bff/list.js +1 -1
- package/lib/commands/bff/pull.js +1 -1
- package/lib/commands/bff/push.js +1 -1
- package/lib/commands/bff/status.js +1 -1
- package/lib/commands/cli-skill/index.js +1 -1
- package/lib/commands/cli-update.js +1 -1
- package/lib/commands/codegen/index.js +1 -1
- package/lib/commands/codegen/sdk.js +1 -1
- package/lib/commands/codegen/sql.js +1 -1
- package/lib/commands/common/app-selector.js +1 -1
- package/lib/commands/common/flags.js +1 -1
- package/lib/commands/common/validate.js +1 -1
- package/lib/commands/config/get.js +1 -1
- package/lib/commands/config/index.js +1 -1
- package/lib/commands/config/list.js +1 -1
- package/lib/commands/config/set.js +1 -1
- package/lib/commands/config/shared.js +1 -1
- package/lib/commands/data/filter.js +1 -1
- package/lib/commands/data/getOne.js +1 -1
- package/lib/commands/data/index.js +1 -1
- package/lib/commands/data/shared.js +1 -1
- package/lib/commands/dataset/business-group-update.js +1 -1
- package/lib/commands/dataset/capability.js +1 -1
- package/lib/commands/dataset/delete.js +1 -1
- package/lib/commands/dataset/detail.js +1 -1
- package/lib/commands/dataset/extend-update.js +1 -1
- package/lib/commands/dataset/field-update.js +1 -1
- package/lib/commands/dataset/generate.js +1 -0
- package/lib/commands/dataset/index.js +1 -1
- package/lib/commands/dataset/list.js +1 -1
- package/lib/commands/dataset/operations.js +1 -1
- package/lib/commands/dataset/relation-audit.js +1 -1
- package/lib/commands/dataset/relation-create.js +1 -1
- package/lib/commands/dataset/relation-delete.js +1 -1
- package/lib/commands/dataset/relation-shared.js +1 -1
- package/lib/commands/dataset/relation-update.js +1 -1
- package/lib/commands/dataset/relations.js +1 -1
- package/lib/commands/dataset/rename.js +1 -1
- package/lib/commands/dataset/restore.js +1 -1
- package/lib/commands/db/analyze-cancel.js +1 -1
- package/lib/commands/db/analyze-start.js +1 -1
- package/lib/commands/db/analyze-status.js +1 -1
- package/lib/commands/db/create.js +1 -1
- package/lib/commands/db/delete.js +1 -1
- package/lib/commands/db/detail.js +1 -1
- package/lib/commands/db/diff.js +1 -1
- package/lib/commands/db/index.js +1 -1
- package/lib/commands/db/list.js +1 -1
- package/lib/commands/db/shared.js +1 -1
- package/lib/commands/db/tables.js +1 -1
- package/lib/commands/db/test.js +1 -1
- package/lib/commands/db/update.js +1 -1
- package/lib/commands/doctor.js +1 -1
- package/lib/commands/init/index.js +1 -1
- package/lib/commands/issue/index.js +1 -1
- package/lib/commands/issue/nudge.js +1 -1
- package/lib/commands/issue/report.js +1 -1
- package/lib/commands/issue/shared.js +1 -1
- package/lib/commands/logs/index.js +1 -1
- package/lib/commands/menu/index.js +1 -1
- package/lib/commands/menu/list.js +1 -1
- package/lib/commands/menu/shared/compare-table.js +1 -1
- package/lib/commands/menu/shared/index.js +1 -1
- package/lib/commands/menu/shared/inquirer.js +1 -1
- package/lib/commands/menu/shared/local-pages.js +1 -1
- package/lib/commands/menu/shared/logic.js +1 -1
- package/lib/commands/menu/shared/service.js +1 -1
- package/lib/commands/menu/shared/sync-core.js +1 -1
- package/lib/commands/menu/shared/update-core.js +1 -1
- package/lib/commands/menu/shared/valid-url.js +1 -1
- package/lib/commands/menu/sync.js +1 -1
- package/lib/commands/menu/update.js +1 -1
- package/lib/commands/page/generate-start.js +1 -1
- package/lib/commands/page/generate-status.js +1 -1
- package/lib/commands/page/index.js +1 -1
- package/lib/commands/page/pull.js +1 -1
- package/lib/commands/page/push.js +1 -1
- package/lib/commands/page/relation-audit.js +1 -1
- package/lib/commands/page/shared.js +1 -1
- package/lib/commands/page/standard-page-status.js +1 -1
- package/lib/commands/page/sync.js +1 -1
- package/lib/commands/project/create/enhanced-guided-create.js +1 -1
- package/lib/commands/project/create/format-elapsed.js +1 -1
- package/lib/commands/project/create/main.js +1 -1
- package/lib/commands/project/create/non-interactive.js +1 -1
- package/lib/commands/project/create/project-template-path.js +1 -1
- package/lib/commands/project/create/use-copy-project-template.js +1 -1
- package/lib/commands/project/create/use-format-code.js +1 -1
- package/lib/commands/project/create/use-install-dependencies.js +1 -1
- package/lib/commands/project/index.js +1 -1
- package/lib/commands/project/init.js +1 -1
- package/lib/commands/project/upgrade.js +1 -1
- package/lib/commands/registry.js +1 -1
- package/lib/commands/run/index.js +1 -1
- package/lib/commands/schema.js +1 -1
- package/lib/commands/sql/create.js +1 -1
- package/lib/commands/sql/delete.js +1 -1
- package/lib/commands/sql/detail.js +1 -1
- package/lib/commands/sql/exec.js +1 -1
- package/lib/commands/sql/index.js +1 -1
- package/lib/commands/sql/list.js +1 -1
- package/lib/commands/sql/pull.js +1 -1
- package/lib/commands/sql/push.js +1 -1
- package/lib/commands/sql/save.js +1 -1
- package/lib/commands/sql/shared.js +1 -1
- package/lib/commands/sql/status.js +1 -1
- package/lib/commands/sql/validate.js +1 -1
- package/lib/commands/workspace/index.js +1 -1
- package/lib/config/schema.js +1 -1
- package/lib/constant/cdn.js +1 -1
- package/lib/constant/cli.js +1 -1
- package/lib/constant/defaults.js +1 -1
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/constant/output.js +1 -1
- package/lib/constant/paths.js +1 -1
- package/lib/constant/risk.js +1 -1
- package/lib/context/app-resolver.js +1 -1
- package/lib/context/auth-resolver.js +1 -1
- package/lib/context/config-loader.js +1 -1
- package/lib/context.js +1 -1
- package/lib/core/alias-resolver.js +1 -1
- package/lib/core/api-client.js +1 -1
- package/lib/core/bff/config.js +1 -1
- package/lib/core/bff/file-system.js +1 -1
- package/lib/core/bff/hash.js +1 -1
- package/lib/core/bff/lock.js +1 -1
- package/lib/core/bff/utils.js +1 -1
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/page/file-system.js +1 -1
- package/lib/core/page/hash.js +1 -1
- package/lib/core/page/lock.js +1 -1
- package/lib/core/sql-sync/config.js +1 -1
- package/lib/core/sql-sync/file-system.js +1 -1
- package/lib/core/sql-sync/hash.js +1 -1
- package/lib/core/sql-sync/lock.js +1 -1
- package/lib/core/sql-sync/utils.js +1 -1
- package/lib/core/sql-validator.js +1 -1
- package/lib/errors.js +1 -1
- package/lib/framework/build-all-flags.js +1 -1
- package/lib/framework/flags.js +1 -1
- package/lib/framework/help.js +1 -1
- package/lib/framework/index.js +1 -1
- package/lib/framework/output.js +1 -1
- package/lib/framework/response.js +1 -1
- package/lib/framework/runner-alias.js +1 -1
- package/lib/framework/runner.js +1 -1
- package/lib/framework/schema-export.js +1 -1
- package/lib/framework/types.js +1 -1
- package/lib/generated/build-info.js +1 -1
- package/lib/help.js +1 -1
- package/lib/skills/main.js +1 -1
- package/lib/skills/npx-skills-add.js +1 -1
- package/lib/telemetry/cli-command-trace.js +1 -1
- package/lib/telemetry/cli-help-trace.js +1 -1
- package/lib/telemetry/ensure-cli-otel-config.js +1 -1
- package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
- package/lib/telemetry/send-cli-trace-log.js +1 -1
- package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
- package/lib/utils/ai_config.js +1 -1
- package/lib/utils/apply-jq-filter.js +1 -1
- package/lib/utils/cdn-config.js +1 -1
- package/lib/utils/check-sdk-version.js +1 -1
- package/lib/utils/cli-version-check.js +1 -1
- package/lib/utils/cli-version-policy.js +1 -1
- package/lib/utils/config.js +1 -1
- package/lib/utils/copy-directory.js +1 -1
- package/lib/utils/entity-with-id.js +1 -1
- package/lib/utils/file-utils.js +1 -1
- package/lib/utils/guides-cdn.js +1 -1
- package/lib/utils/http-client.js +1 -1
- package/lib/utils/is-non-interactive.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/params.js +1 -1
- package/lib/utils/platform.js +1 -1
- package/lib/utils/rules-cdn.js +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.js +1 -1
- package/lib/utils/update-notice.js +1 -1
- package/lib/utils/version.js +1 -1
- package/lib/utils/with-active-cookie.js +1 -1
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +1 -1
package/lib/commands/sql/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a137_0x52ed0d=a137_0x2ddd;(function(_0x599918,_0x1066b9){const _0x51107e=a137_0x2ddd,_0x55689a=_0x599918();while(!![]){try{const _0x6e2d97=-parseInt(_0x51107e(0xcc))/0x1+-parseInt(_0x51107e(0xff))/0x2+-parseInt(_0x51107e(0xe7))/0x3*(-parseInt(_0x51107e(0xfc))/0x4)+parseInt(_0x51107e(0x103))/0x5+parseInt(_0x51107e(0xf5))/0x6+-parseInt(_0x51107e(0xe0))/0x7*(parseInt(_0x51107e(0xdf))/0x8)+parseInt(_0x51107e(0xf9))/0x9*(parseInt(_0x51107e(0xf6))/0xa);if(_0x6e2d97===_0x1066b9)break;else _0x55689a['push'](_0x55689a['shift']());}catch(_0xccaa2){_0x55689a['push'](_0x55689a['shift']());}}}(a137_0x8a10,0x45253));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';const PAGE_SIZE=0x64;function a137_0x8a10(){const _0x6dcdb9=['Force\x20overwrite\x20local\x20unsynced\x20changes','unchanged','pull','dbId','appCode','Force\x20pull\x20cancelled.','boolean','8dPXSqE','408093qkomqy','sqlRoot','apps','force','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','push','utf8','1692663DVJGcF','POST','sqlRootDir','length','totalCount','test','Pull\x20complete:\x20','replace','lockFilePath','\x20written,\x20','bool','filter','catch','sqlName','294894RIZWwA','71590OmXBqQ','message','sqlContent','36afXZsA','Would\x20pull\x20','split','4SLamaq','string','local\x20differs\x20from\x20remote','402022GSewCw','toISOString','sqlCode','description','1352000wpdfSt','lastSync','Filter\x20by\x20SQL\x20display\x20name','str','sql','skipped','sqls','conflict','369877lnPntI','sqlcode','join','No\x20remote\x20SQL\x20queries\x20matched.','cancelled','nonInteractive','\x20failed','path','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','write','name','mybatisXml'];a137_0x8a10=function(){return _0x6dcdb9;};return a137_0x8a10();}async function fetchAllSqlQueries(_0xd287,_0x3e0a82){const _0x36d7c8=a137_0x2ddd,_0x288aef=[];let _0x5e690d=0x1;while(!![]){const _0x121c01=await listSqlQueries(_0xd287,{'currentPage':_0x5e690d,'pageSize':PAGE_SIZE,'sqlCode':_0x3e0a82['sqlCode'],'sqlName':_0x3e0a82['sqlName']}),_0x220fe5=_0x121c01['tableData']??[];_0x288aef[_0x36d7c8(0xe5)](..._0x220fe5);if(_0x220fe5['length']===0x0)break;const _0x3d2a41=_0x121c01['paging']?.[_0x36d7c8(0xeb)];if(_0x3d2a41!=null?_0x288aef[_0x36d7c8(0xea)]>=_0x3d2a41:_0x220fe5[_0x36d7c8(0xea)]<PAGE_SIZE)break;_0x5e690d++;}return _0x288aef;}async function ensureSqlContent(_0x2305b0){const _0x698b16=a137_0x2ddd;if(_0x2305b0[_0x698b16(0xf8)]!=null&&String(_0x2305b0[_0x698b16(0xf8)])['length']>0x0)return _0x2305b0;return getSqlQueryDetail(_0x2305b0[_0x698b16(0x101)]);}export const sqlPull={'service':a137_0x52ed0d(0xc8),'command':a137_0x52ed0d(0xda),'description':a137_0x52ed0d(0xe4),'risk':a137_0x52ed0d(0xd5),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a137_0x52ed0d(0xd6),'type':a137_0x52ed0d(0xfd),'description':a137_0x52ed0d(0x105)},{'name':'force','type':a137_0x52ed0d(0xde),'description':a137_0x52ed0d(0xd8)}],async 'dryRun'(_0x28d1df){const _0x5d4207=a137_0x52ed0d,_0x120554=loadSqlProjectConfig(_0x28d1df[_0x5d4207(0xdc)]),_0x39bd00=await readSqlLockFile(_0x120554[_0x5d4207(0xef)]),{appLock:_0x1fee3b}=ensureSqlLockScope(_0x39bd00??createEmptySqlLock(),_0x120554[_0x5d4207(0xdc)],_0x120554[_0x5d4207(0xe1)],_0x5d4207(0xda)),_0x3cc443=await fetchAllSqlQueries(_0x28d1df[_0x5d4207(0xdc)],{'sqlCode':_0x28d1df[_0x5d4207(0xc7)](_0x5d4207(0xcd))||undefined,'sqlName':_0x28d1df[_0x5d4207(0xc7)](_0x5d4207(0xd6))||undefined}),_0x393f90=[];for(const _0x4e3e91 of _0x3cc443){const _0x2a4871=await ensureSqlContent(_0x4e3e91),_0x4dad24=ensureRemoteSqlContent(_0x2a4871),_0x50ee0c=detectModeFromSql(_0x2a4871),_0x324993=_0x2a4871[_0x5d4207(0xdb)]?await getDbName(_0x28d1df['appCode'],Number(_0x2a4871[_0x5d4207(0xdb)]))[_0x5d4207(0xf3)](()=>undefined):undefined,_0x3a0be7=buildLocalSqlFileContent({'sqlCode':_0x2a4871[_0x5d4207(0x101)],'sqlName':_0x2a4871[_0x5d4207(0xf4)],'dbId':_0x2a4871['dbId']},_0x4dad24,{'dbName':_0x324993,'mode':_0x50ee0c,'syncedAt':new Date()['toISOString'](),'description':_0x2a4871['description']}),_0x1b9c80=buildSqlLockEntry(_0x2a4871,_0x4dad24,'',{'dbName':_0x324993}),_0x1dac34=resolveLocalSqlFilePath(_0x120554,_0x2a4871[_0x5d4207(0x101)],_0x1b9c80);let _0x273308='would_pull',_0x13e2f1;if(await fileExists(_0x1dac34)){const _0x59cf00=await readFile(_0x1dac34,'utf8');isEquivalentPulledSqlFile(_0x59cf00,_0x3a0be7,_0x50ee0c)?(_0x273308=_0x5d4207(0xc9),_0x13e2f1=_0x5d4207(0xd9)):(_0x273308=_0x5d4207(0xcb),_0x13e2f1='local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)');}_0x393f90['push']({'sqlCode':_0x2a4871[_0x5d4207(0x101)],'sqlName':_0x2a4871[_0x5d4207(0xf4)],'filePath':_0x1dac34,'status':_0x273308,'reason':_0x13e2f1});}return{'method':_0x5d4207(0xe8),'url':_0x5d4207(0xd4),'body':{'appCode':_0x28d1df[_0x5d4207(0xdc)],'sqlCode':_0x28d1df[_0x5d4207(0xc7)](_0x5d4207(0xcd))||null,'sqlName':_0x28d1df['str'](_0x5d4207(0xd6))||null,'files':_0x393f90},'description':_0x5d4207(0xfa)+_0x393f90[_0x5d4207(0xea)]+'\x20SQL\x20file(s)\x20into\x20'+_0x120554[_0x5d4207(0xe9)]};},async 'execute'(_0x1f8f0f){const _0x13108e=a137_0x52ed0d,_0x714696=loadSqlProjectConfig(_0x1f8f0f[_0x13108e(0xdc)]),_0x4d085f=await readSqlLockFile(_0x714696[_0x13108e(0xef)]),{lockData:_0x12c315,appLock:_0x58ebc3}=ensureSqlLockScope(_0x4d085f??createEmptySqlLock(),_0x714696[_0x13108e(0xdc)],_0x714696[_0x13108e(0xe1)],_0x13108e(0xda)),_0x19312e=_0x1f8f0f[_0x13108e(0xf1)](_0x13108e(0xe3)),_0x9eab67=await fetchAllSqlQueries(_0x1f8f0f[_0x13108e(0xdc)],{'sqlCode':_0x1f8f0f['str'](_0x13108e(0xcd))||undefined,'sqlName':_0x1f8f0f[_0x13108e(0xc7)](_0x13108e(0xd6))||undefined});if(_0x9eab67[_0x13108e(0xea)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x13108e(0xcf)};const _0x9c0848=[],_0x584699=[];for(const _0x5a1f94 of _0x9eab67){try{_0x9c0848[_0x13108e(0xe5)](await ensureSqlContent(_0x5a1f94));}catch(_0x4434e1){_0x584699[_0x13108e(0xe5)]({'sqlCode':_0x5a1f94['sqlCode'],'error':_0x4434e1 instanceof Error?_0x4434e1[_0x13108e(0xf7)]:String(_0x4434e1)});}}if(_0x19312e&&!_0x1f8f0f[_0x13108e(0xd1)]){let _0x46d7b3=![];for(const _0x250016 of _0x9c0848){const _0x5d6f79=detectModeFromSql(_0x250016),_0x389a02=_0x250016['dbId']?await getDbName(_0x1f8f0f[_0x13108e(0xdc)],Number(_0x250016[_0x13108e(0xdb)]))[_0x13108e(0xf3)](()=>undefined):undefined,_0x1a3a2b=buildLocalSqlFileContent({'sqlCode':_0x250016[_0x13108e(0x101)],'sqlName':_0x250016[_0x13108e(0xf4)],'dbId':_0x250016['dbId']},ensureRemoteSqlContent(_0x250016),{'dbName':_0x389a02,'mode':_0x5d6f79,'syncedAt':new Date()[_0x13108e(0x100)](),'description':_0x250016['description']}),_0x2794a3=resolveLocalSqlFilePath(_0x714696,_0x250016['sqlCode'],buildSqlLockEntry(_0x250016,ensureRemoteSqlContent(_0x250016),'',{'dbName':_0x389a02}));if(await fileExists(_0x2794a3)){const _0x1c2c8b=await readFile(_0x2794a3,_0x13108e(0xe6));if(!isEquivalentPulledSqlFile(_0x1c2c8b,_0x1a3a2b,_0x5d6f79)){_0x46d7b3=!![];break;}}}if(_0x46d7b3){const _0x2e47ce=await confirmForceOverwrite('Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.');if(!_0x2e47ce)throw CliErrors[_0x13108e(0xd0)](_0x13108e(0xdd));}}const _0x31bcc5=cloneSqlLockData(_0x12c315),_0x152b41=_0x31bcc5[_0x13108e(0xe2)][_0x714696[_0x13108e(0xdc)]],_0x522af9=[],_0x23de16=[];for(const _0x5db5f6 of _0x9c0848){const _0x4a130a=_0x152b41['sqls'][_0x5db5f6[_0x13108e(0x101)]],_0x220ffa=ensureRemoteSqlContent(_0x5db5f6),_0x170c8b=detectModeFromSql(_0x5db5f6),_0x26f685=_0x5db5f6[_0x13108e(0xdb)]?await getDbName(_0x1f8f0f['appCode'],Number(_0x5db5f6[_0x13108e(0xdb)]))[_0x13108e(0xf3)](()=>undefined):undefined,_0x518cd5=buildLocalSqlFileContent({'sqlCode':_0x5db5f6[_0x13108e(0x101)],'sqlName':_0x5db5f6[_0x13108e(0xf4)],'dbId':_0x5db5f6[_0x13108e(0xdb)]},_0x220ffa,{'dbName':_0x26f685,'mode':_0x170c8b,'syncedAt':new Date()[_0x13108e(0x100)](),'description':_0x5db5f6[_0x13108e(0x102)]}),_0x72c4e3=buildSqlLockEntry(_0x5db5f6,_0x220ffa,computeSqlContentHash(_0x518cd5),{'dbName':_0x26f685}),_0x175d25=_0x72c4e3[_0x13108e(0xd3)],_0x5697cd=join(_0x714696['sqlRootDir'],_0x175d25);try{if(await fileExists(_0x5697cd)){const _0x164c0f=await readFile(_0x5697cd,'utf8');if(isEquivalentPulledSqlFile(_0x164c0f,_0x518cd5,_0x170c8b)){_0x23de16[_0x13108e(0xe5)]({'sqlCode':_0x5db5f6[_0x13108e(0x101)],'reason':'unchanged'}),_0x152b41[_0x13108e(0xca)][_0x5db5f6[_0x13108e(0x101)]]={..._0x72c4e3,'hash':computeSqlContentHash(_0x164c0f),'path':_0x175d25};continue;}if(!_0x19312e){_0x23de16[_0x13108e(0xe5)]({'sqlCode':_0x5db5f6[_0x13108e(0x101)],'reason':_0x13108e(0xfe)});continue;}}const _0x1699cd=_0x4a130a?.[_0x13108e(0xd3)]?join(_0x714696['sqlRootDir'],_0x4a130a[_0x13108e(0xd3)]):undefined;_0x1699cd&&_0x1699cd!==_0x5697cd&&await fileExists(_0x1699cd)&&await rm(_0x1699cd,{'force':!![]}),await ensureParentDirectory(_0x5697cd),await writeFile(_0x5697cd,_0x518cd5,_0x13108e(0xe6)),_0x152b41[_0x13108e(0xca)][_0x5db5f6[_0x13108e(0x101)]]={..._0x72c4e3,'path':_0x175d25},_0x522af9['push']({'sqlCode':_0x5db5f6[_0x13108e(0x101)],'filePath':_0x5697cd});}catch(_0x22ae34){_0x584699['push']({'sqlCode':_0x5db5f6['sqlCode'],'error':_0x22ae34 instanceof Error?_0x22ae34[_0x13108e(0xf7)]:String(_0x22ae34)});}}return _0x152b41[_0x13108e(0x104)]=new Date()[_0x13108e(0x100)](),await writeSqlLockFile(_0x714696['lockFilePath'],_0x31bcc5),{'ok':_0x584699[_0x13108e(0xea)]===0x0,'data':{'pulled':_0x522af9,'skipped':_0x23de16,'failed':_0x584699},'message':_0x13108e(0xed)+_0x522af9['length']+_0x13108e(0xf0)+_0x23de16[_0x13108e(0xea)]+'\x20skipped,\x20'+_0x584699['length']+_0x13108e(0xd2)};}};function detectModeFromSql(_0x43a8e3){const _0x4aac31=a137_0x52ed0d,_0xd2d002=ensureRemoteSqlContent(_0x43a8e3),_0x4acd37=stripLocalSqlMetadata(_0xd2d002,'mybatisXml')['trimStart']();if(/^<(select|insert|update|delete)\b/i['test'](_0x4acd37))return _0x4aac31(0xd7);return _0x4aac31(0xc8);}function isEquivalentPulledSqlFile(_0xca8080,_0x2d06fe,_0x449dcb){return normalizePullComparableContent(_0xca8080,_0x449dcb)===normalizePullComparableContent(_0x2d06fe,_0x449dcb);}function a137_0x2ddd(_0x342f87,_0x5b0320){_0x342f87=_0x342f87-0xc7;const _0x8a108f=a137_0x8a10();let _0x2dddae=_0x8a108f[_0x342f87];return _0x2dddae;}function normalizePullComparableContent(_0x10e7e5,_0xd1870e){const _0x38d3b0=a137_0x52ed0d,_0x2bf58d=_0x10e7e5[_0x38d3b0(0xee)](/\r\n/g,'\x0a')[_0x38d3b0(0xfb)]('\x0a'),_0x14b691=_0x2bf58d[_0x38d3b0(0xf2)](_0xa2e2e9=>!isSyncedAtMetadataLine(_0xa2e2e9,_0xd1870e));return _0x14b691[_0x38d3b0(0xce)]('\x0a');}function isSyncedAtMetadataLine(_0x20f5be,_0x559eb9){const _0x57d3c0=a137_0x52ed0d;if(_0x559eb9===_0x57d3c0(0xd7))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x57d3c0(0xec)](_0x20f5be);return/^\s*--\s*@lovrabet\.syncedAt:/['test'](_0x20f5be);}
|
|
1
|
+
const a138_0x2f785e=a138_0x2549;(function(_0x1f5d6a,_0x3a93d2){const _0x3aa6ae=a138_0x2549,_0x74c6df=_0x1f5d6a();while(!![]){try{const _0x291f0e=-parseInt(_0x3aa6ae(0xca))/0x1+parseInt(_0x3aa6ae(0xc5))/0x2+parseInt(_0x3aa6ae(0xa4))/0x3*(parseInt(_0x3aa6ae(0xbe))/0x4)+-parseInt(_0x3aa6ae(0xc9))/0x5+-parseInt(_0x3aa6ae(0xc0))/0x6+parseInt(_0x3aa6ae(0x8f))/0x7+parseInt(_0x3aa6ae(0x9c))/0x8*(parseInt(_0x3aa6ae(0x9a))/0x9);if(_0x291f0e===_0x3a93d2)break;else _0x74c6df['push'](_0x74c6df['shift']());}catch(_0x6e2dba){_0x74c6df['push'](_0x74c6df['shift']());}}}(a138_0x2d96,0xa8412));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';function a138_0x2d96(){const _0x3c90df=['apps','push','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','dbId','sqlRootDir','appCode','Force\x20overwrite\x20local\x20unsynced\x20changes','sqlCode','8145arAMXf','tableData','12392vxXThm','lastSync','catch','sqlcode','lockFilePath','boolean','skipped','write','39faKNLb','name','string','unchanged','mybatisXml','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','cancelled','replace','force','str','Pull\x20complete:\x20','nonInteractive','sql','\x20skipped,\x20','path','POST','sqls','totalCount','length','test','sqlContent','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','\x20failed','paging','split','sqlRoot','65684lSNVhK','description','1762380WOeIHw','\x20SQL\x20file(s)\x20into\x20','sqlName','toISOString','bool','461386gkRnNN','filter','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','Filter\x20by\x20SQL\x20display\x20name','1563150tzoAEy','1229538ItYNrw','message','4753399wyNVmE','utf8','pull'];a138_0x2d96=function(){return _0x3c90df;};return a138_0x2d96();}function a138_0x2549(_0x1b2b0b,_0x359387){_0x1b2b0b=_0x1b2b0b-0x8e;const _0x2d963c=a138_0x2d96();let _0x254949=_0x2d963c[_0x1b2b0b];return _0x254949;}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(_0x409dee,_0x4f2d5b){const _0x3482cf=a138_0x2549,_0x5e1ee7=[];let _0x6fbc26=0x1;while(!![]){const _0x2dc644=await listSqlQueries(_0x409dee,{'currentPage':_0x6fbc26,'pageSize':PAGE_SIZE,'sqlCode':_0x4f2d5b['sqlCode'],'sqlName':_0x4f2d5b[_0x3482cf(0xc2)]}),_0x56ae19=_0x2dc644[_0x3482cf(0x9b)]??[];_0x5e1ee7[_0x3482cf(0x93)](..._0x56ae19);if(_0x56ae19[_0x3482cf(0xb6)]===0x0)break;const _0x48bdce=_0x2dc644[_0x3482cf(0xbb)]?.[_0x3482cf(0xb5)];if(_0x48bdce!=null?_0x5e1ee7[_0x3482cf(0xb6)]>=_0x48bdce:_0x56ae19[_0x3482cf(0xb6)]<PAGE_SIZE)break;_0x6fbc26++;}return _0x5e1ee7;}async function ensureSqlContent(_0x439e00){const _0x8d6433=a138_0x2549;if(_0x439e00[_0x8d6433(0xb8)]!=null&&String(_0x439e00[_0x8d6433(0xb8)])[_0x8d6433(0xb6)]>0x0)return _0x439e00;return getSqlQueryDetail(_0x439e00[_0x8d6433(0x99)]);}export const sqlPull={'service':'sql','command':a138_0x2f785e(0x91),'description':a138_0x2f785e(0xc7),'risk':a138_0x2f785e(0xa3),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'name','type':a138_0x2f785e(0xa6),'description':a138_0x2f785e(0xc8)},{'name':'force','type':a138_0x2f785e(0xa1),'description':a138_0x2f785e(0x98)}],async 'dryRun'(_0x2a9f68){const _0x529962=a138_0x2f785e,_0x14e267=loadSqlProjectConfig(_0x2a9f68[_0x529962(0x97)]),_0x34d545=await readSqlLockFile(_0x14e267[_0x529962(0xa0)]),{appLock:_0xb151ea}=ensureSqlLockScope(_0x34d545??createEmptySqlLock(),_0x14e267['appCode'],_0x14e267['sqlRoot'],_0x529962(0x91)),_0x25bb10=await fetchAllSqlQueries(_0x2a9f68['appCode'],{'sqlCode':_0x2a9f68[_0x529962(0xad)]('sqlcode')||undefined,'sqlName':_0x2a9f68[_0x529962(0xad)](_0x529962(0xa5))||undefined}),_0x54e98b=[];for(const _0x38a25c of _0x25bb10){const _0x2441c7=await ensureSqlContent(_0x38a25c),_0x3688d2=ensureRemoteSqlContent(_0x2441c7),_0x2b34d7=detectModeFromSql(_0x2441c7),_0x1949a0=_0x2441c7[_0x529962(0x95)]?await getDbName(_0x2a9f68[_0x529962(0x97)],Number(_0x2441c7[_0x529962(0x95)]))['catch'](()=>undefined):undefined,_0x4a7bce=buildLocalSqlFileContent({'sqlCode':_0x2441c7[_0x529962(0x99)],'sqlName':_0x2441c7[_0x529962(0xc2)],'dbId':_0x2441c7[_0x529962(0x95)]},_0x3688d2,{'dbName':_0x1949a0,'mode':_0x2b34d7,'syncedAt':new Date()['toISOString'](),'description':_0x2441c7['description']}),_0x2d3748=buildSqlLockEntry(_0x2441c7,_0x3688d2,'',{'dbName':_0x1949a0}),_0x5e55f6=resolveLocalSqlFilePath(_0x14e267,_0x2441c7[_0x529962(0x99)],_0x2d3748);let _0x10f3fd='would_pull',_0x7f267a;if(await fileExists(_0x5e55f6)){const _0x398dbd=await readFile(_0x5e55f6,_0x529962(0x90));isEquivalentPulledSqlFile(_0x398dbd,_0x4a7bce,_0x2b34d7)?(_0x10f3fd=_0x529962(0xa2),_0x7f267a=_0x529962(0xa7)):(_0x10f3fd='conflict',_0x7f267a=_0x529962(0xb9));}_0x54e98b['push']({'sqlCode':_0x2441c7[_0x529962(0x99)],'sqlName':_0x2441c7[_0x529962(0xc2)],'filePath':_0x5e55f6,'status':_0x10f3fd,'reason':_0x7f267a});}return{'method':_0x529962(0xb3),'url':_0x529962(0xa9),'body':{'appCode':_0x2a9f68[_0x529962(0x97)],'sqlCode':_0x2a9f68[_0x529962(0xad)](_0x529962(0x9f))||null,'sqlName':_0x2a9f68[_0x529962(0xad)]('name')||null,'files':_0x54e98b},'description':'Would\x20pull\x20'+_0x54e98b[_0x529962(0xb6)]+_0x529962(0xc1)+_0x14e267[_0x529962(0x96)]};},async 'execute'(_0x10ca54){const _0x590acb=a138_0x2f785e,_0x30041f=loadSqlProjectConfig(_0x10ca54[_0x590acb(0x97)]),_0xd9f5ba=await readSqlLockFile(_0x30041f[_0x590acb(0xa0)]),{lockData:_0x25c688,appLock:_0x58fd31}=ensureSqlLockScope(_0xd9f5ba??createEmptySqlLock(),_0x30041f[_0x590acb(0x97)],_0x30041f[_0x590acb(0xbd)],'pull'),_0x108470=_0x10ca54[_0x590acb(0xc4)](_0x590acb(0xac)),_0x107cb8=await fetchAllSqlQueries(_0x10ca54[_0x590acb(0x97)],{'sqlCode':_0x10ca54[_0x590acb(0xad)](_0x590acb(0x9f))||undefined,'sqlName':_0x10ca54[_0x590acb(0xad)](_0x590acb(0xa5))||undefined});if(_0x107cb8['length']===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':'No\x20remote\x20SQL\x20queries\x20matched.'};const _0x578023=[],_0x32c437=[];for(const _0x30da57 of _0x107cb8){try{_0x578023[_0x590acb(0x93)](await ensureSqlContent(_0x30da57));}catch(_0x3bff0f){_0x32c437[_0x590acb(0x93)]({'sqlCode':_0x30da57[_0x590acb(0x99)],'error':_0x3bff0f instanceof Error?_0x3bff0f[_0x590acb(0x8e)]:String(_0x3bff0f)});}}if(_0x108470&&!_0x10ca54[_0x590acb(0xaf)]){let _0x284915=![];for(const _0x252d73 of _0x578023){const _0x211fa5=detectModeFromSql(_0x252d73),_0x2c8864=_0x252d73[_0x590acb(0x95)]?await getDbName(_0x10ca54[_0x590acb(0x97)],Number(_0x252d73['dbId']))[_0x590acb(0x9e)](()=>undefined):undefined,_0x5d0e38=buildLocalSqlFileContent({'sqlCode':_0x252d73['sqlCode'],'sqlName':_0x252d73[_0x590acb(0xc2)],'dbId':_0x252d73[_0x590acb(0x95)]},ensureRemoteSqlContent(_0x252d73),{'dbName':_0x2c8864,'mode':_0x211fa5,'syncedAt':new Date()[_0x590acb(0xc3)](),'description':_0x252d73['description']}),_0x219c6f=resolveLocalSqlFilePath(_0x30041f,_0x252d73[_0x590acb(0x99)],buildSqlLockEntry(_0x252d73,ensureRemoteSqlContent(_0x252d73),'',{'dbName':_0x2c8864}));if(await fileExists(_0x219c6f)){const _0x20ce8d=await readFile(_0x219c6f,'utf8');if(!isEquivalentPulledSqlFile(_0x20ce8d,_0x5d0e38,_0x211fa5)){_0x284915=!![];break;}}}if(_0x284915){const _0x1a5212=await confirmForceOverwrite(_0x590acb(0x94));if(!_0x1a5212)throw CliErrors[_0x590acb(0xaa)]('Force\x20pull\x20cancelled.');}}const _0x1ac875=cloneSqlLockData(_0x25c688),_0x125011=_0x1ac875[_0x590acb(0x92)][_0x30041f[_0x590acb(0x97)]],_0x551a48=[],_0x51c2ff=[];for(const _0x46755b of _0x578023){const _0x5bbc6c=_0x125011[_0x590acb(0xb4)][_0x46755b[_0x590acb(0x99)]],_0x36d903=ensureRemoteSqlContent(_0x46755b),_0xc871c4=detectModeFromSql(_0x46755b),_0x988ff0=_0x46755b[_0x590acb(0x95)]?await getDbName(_0x10ca54[_0x590acb(0x97)],Number(_0x46755b[_0x590acb(0x95)]))[_0x590acb(0x9e)](()=>undefined):undefined,_0x3dc335=buildLocalSqlFileContent({'sqlCode':_0x46755b[_0x590acb(0x99)],'sqlName':_0x46755b['sqlName'],'dbId':_0x46755b[_0x590acb(0x95)]},_0x36d903,{'dbName':_0x988ff0,'mode':_0xc871c4,'syncedAt':new Date()[_0x590acb(0xc3)](),'description':_0x46755b[_0x590acb(0xbf)]}),_0x13b6a9=buildSqlLockEntry(_0x46755b,_0x36d903,computeSqlContentHash(_0x3dc335),{'dbName':_0x988ff0}),_0x45dd2a=_0x13b6a9[_0x590acb(0xb2)],_0x3030ea=join(_0x30041f[_0x590acb(0x96)],_0x45dd2a);try{if(await fileExists(_0x3030ea)){const _0x4151d5=await readFile(_0x3030ea,_0x590acb(0x90));if(isEquivalentPulledSqlFile(_0x4151d5,_0x3dc335,_0xc871c4)){_0x51c2ff['push']({'sqlCode':_0x46755b[_0x590acb(0x99)],'reason':_0x590acb(0xa7)}),_0x125011[_0x590acb(0xb4)][_0x46755b['sqlCode']]={..._0x13b6a9,'hash':computeSqlContentHash(_0x4151d5),'path':_0x45dd2a};continue;}if(!_0x108470){_0x51c2ff['push']({'sqlCode':_0x46755b[_0x590acb(0x99)],'reason':'local\x20differs\x20from\x20remote'});continue;}}const _0x551ddd=_0x5bbc6c?.[_0x590acb(0xb2)]?join(_0x30041f['sqlRootDir'],_0x5bbc6c[_0x590acb(0xb2)]):undefined;_0x551ddd&&_0x551ddd!==_0x3030ea&&await fileExists(_0x551ddd)&&await rm(_0x551ddd,{'force':!![]}),await ensureParentDirectory(_0x3030ea),await writeFile(_0x3030ea,_0x3dc335,_0x590acb(0x90)),_0x125011[_0x590acb(0xb4)][_0x46755b[_0x590acb(0x99)]]={..._0x13b6a9,'path':_0x45dd2a},_0x551a48[_0x590acb(0x93)]({'sqlCode':_0x46755b[_0x590acb(0x99)],'filePath':_0x3030ea});}catch(_0x242547){_0x32c437['push']({'sqlCode':_0x46755b[_0x590acb(0x99)],'error':_0x242547 instanceof Error?_0x242547[_0x590acb(0x8e)]:String(_0x242547)});}}return _0x125011[_0x590acb(0x9d)]=new Date()[_0x590acb(0xc3)](),await writeSqlLockFile(_0x30041f[_0x590acb(0xa0)],_0x1ac875),{'ok':_0x32c437[_0x590acb(0xb6)]===0x0,'data':{'pulled':_0x551a48,'skipped':_0x51c2ff,'failed':_0x32c437},'message':_0x590acb(0xae)+_0x551a48[_0x590acb(0xb6)]+'\x20written,\x20'+_0x51c2ff[_0x590acb(0xb6)]+_0x590acb(0xb1)+_0x32c437['length']+_0x590acb(0xba)};}};function detectModeFromSql(_0x39599c){const _0x19f304=a138_0x2f785e,_0x3e4a1c=ensureRemoteSqlContent(_0x39599c),_0x294586=stripLocalSqlMetadata(_0x3e4a1c,'mybatisXml')['trimStart']();if(/^<(select|insert|update|delete)\b/i[_0x19f304(0xb7)](_0x294586))return _0x19f304(0xa8);return _0x19f304(0xb0);}function isEquivalentPulledSqlFile(_0x42e29a,_0x5f49ad,_0x4e5aba){return normalizePullComparableContent(_0x42e29a,_0x4e5aba)===normalizePullComparableContent(_0x5f49ad,_0x4e5aba);}function normalizePullComparableContent(_0x313147,_0x332131){const _0x19a219=a138_0x2f785e,_0x451fbd=_0x313147[_0x19a219(0xab)](/\r\n/g,'\x0a')[_0x19a219(0xbc)]('\x0a'),_0x3d19df=_0x451fbd[_0x19a219(0xc6)](_0x358a5a=>!isSyncedAtMetadataLine(_0x358a5a,_0x332131));return _0x3d19df['join']('\x0a');}function isSyncedAtMetadataLine(_0x3e5936,_0x350bd7){const _0x4c8312=a138_0x2f785e;if(_0x350bd7===_0x4c8312(0xa8))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x4c8312(0xb7)](_0x3e5936);return/^\s*--\s*@lovrabet\.syncedAt:/['test'](_0x3e5936);}
|
package/lib/commands/sql/push.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a138_0x3cc0f7=a138_0x5303;(function(_0x377892,_0x428aed){const _0x9239df=a138_0x5303,_0x4a66fa=_0x377892();while(!![]){try{const _0x4d1f76=-parseInt(_0x9239df(0x9c))/0x1*(parseInt(_0x9239df(0x8a))/0x2)+-parseInt(_0x9239df(0x99))/0x3*(parseInt(_0x9239df(0x80))/0x4)+parseInt(_0x9239df(0xa2))/0x5*(-parseInt(_0x9239df(0x82))/0x6)+-parseInt(_0x9239df(0x7f))/0x7+-parseInt(_0x9239df(0x98))/0x8+-parseInt(_0x9239df(0xb0))/0x9+-parseInt(_0x9239df(0x77))/0xa*(-parseInt(_0x9239df(0xb4))/0xb);if(_0x4d1f76===_0x428aed)break;else _0x4a66fa['push'](_0x4a66fa['shift']());}catch(_0x17e325){_0x4a66fa['push'](_0x4a66fa['shift']());}}}(a138_0x565a,0x8a006));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';function a138_0x565a(){const _0x5c4db8=['Push\x20local\x20SQL\x20files\x20to\x20remote','/smartapi/custom/updateUserCustomSql','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','\x20SQL\x20file(s)','31386LxzCoy','unchanged','get','filePath','toISOString','sqlName','bool','\x20failed','sqlRootDir','version','Would\x20push\x20','sqlCode','exec','Local\x20SQL\x20not\x20found:\x20','8997880ABIBsZ','3RPYZJp','\x20skipped,\x20','sqlConfig','41PmMddi','utf8','sqlcode','lockFilePath','No\x20database\x20matches\x20local\x20directory\x20\x22','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','292310zbJgPD','dbId','str','push','No\x20local\x20SQL\x20files\x20found.','sqls','length','mode','Push\x20complete:\x20','catch','appCode','boolean','isFinite','sqlRoot','1129113cyJXHE','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','path','45265CbsPLJ','sql','POST','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','projectRoot','dbName','startsWith','8440FjQMTK','remoteId','validation','replace','hash','dbDirectory','relativePath','lastSync','845551PqcPGk','299760pvVZKO','force','84jnQoyn','entries','filter','has'];a138_0x565a=function(){return _0x5c4db8;};return a138_0x565a();}import{updateSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';function a138_0x5303(_0x3bcb0f,_0x30b8b3){_0x3bcb0f=_0x3bcb0f-0x73;const _0x565a0b=a138_0x565a();let _0x530384=_0x565a0b[_0x3bcb0f];return _0x530384;}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(_0x265084,_0x6dde74,_0x3191f6){const _0x296583=a138_0x5303,_0x2febb8=await scanLocalSqlQueries(_0x265084),_0x53bf92=new Map();for(const _0xaf7f54 of _0x2febb8){if(_0x3191f6&&_0xaf7f54[_0x296583(0x95)]!==_0x3191f6)continue;const _0x150199=_0x53bf92[_0x296583(0x8c)](_0xaf7f54[_0x296583(0x95)])??[];_0x150199[_0x296583(0xa5)](_0xaf7f54),_0x53bf92['set'](_0xaf7f54[_0x296583(0x95)],_0x150199);}if(_0x3191f6&&!_0x53bf92[_0x296583(0x85)](_0x3191f6))throw CliErrors['validation'](_0x296583(0x97)+_0x3191f6);const _0x35b560=[];for(const [_0x33270d,_0x50a18f]of _0x53bf92[_0x296583(0x83)]()){if(_0x50a18f[_0x296583(0xa8)]===0x1){_0x35b560[_0x296583(0xa5)](_0x50a18f[0x0]);continue;}const _0x320ff9=_0x6dde74[_0x296583(0xa7)][_0x33270d],_0x2e2549=_0x320ff9?.[_0x296583(0xb3)],_0x5f1892=_0x2e2549?_0x50a18f[_0x296583(0x84)](_0x47d8a1=>_0x47d8a1[_0x296583(0x7d)]!==_0x2e2549):_0x50a18f;if(_0x320ff9&&_0x5f1892[_0x296583(0xa8)]===0x1){_0x35b560['push'](_0x5f1892[0x0]);continue;}throw CliErrors[_0x296583(0x79)](_0x296583(0xb1)+_0x33270d+_0x296583(0x73));}return _0x35b560;}export const sqlPush={'service':a138_0x3cc0f7(0xb5),'command':a138_0x3cc0f7(0xa5),'description':a138_0x3cc0f7(0x86),'risk':'high-risk-write','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a138_0x3cc0f7(0x81),'type':a138_0x3cc0f7(0xad),'description':a138_0x3cc0f7(0x88)}],async 'dryRun'(_0x2fcc79){const _0x3348ba=a138_0x3cc0f7,_0x426b21=loadSqlProjectConfig(_0x2fcc79['appCode']),_0x5cc070=await readSqlLockFile(_0x426b21['lockFilePath']),{appLock:_0x49c3a2}=ensureSqlLockScope(_0x5cc070??createEmptySqlLock(),_0x2fcc79[_0x3348ba(0xac)],_0x426b21[_0x3348ba(0xaf)],_0x3348ba(0xa5)),_0x162300=await getTargetSqlQueries(_0x426b21,_0x49c3a2,_0x2fcc79[_0x3348ba(0xa4)](_0x3348ba(0x9e))||undefined),_0x47cca2=[];for(const _0x285639 of _0x162300){const _0x17b5ff=await computeSqlFileHash(_0x285639['filePath']),_0x3c6125=_0x49c3a2[_0x3348ba(0xa7)][_0x285639[_0x3348ba(0x95)]],_0x2e8e97=!!_0x3c6125&&(_0x3c6125[_0x3348ba(0xb3)]!==_0x285639['relativePath']||!!_0x285639['sqlName']&&_0x3c6125[_0x3348ba(0x8f)]!==_0x285639[_0x3348ba(0x8f)]);if(!_0x2fcc79[_0x3348ba(0x90)](_0x3348ba(0x81))&&_0x3c6125&&_0x3c6125[_0x3348ba(0x7b)]===_0x17b5ff&&!_0x2e8e97)continue;_0x47cca2['push'](_0x285639[_0x3348ba(0x95)]);}return{'method':_0x3348ba(0xb6),'url':_0x3348ba(0x87),'body':{'sqlCodes':_0x47cca2,'appCode':_0x2fcc79[_0x3348ba(0xac)]},'description':_0x3348ba(0x94)+_0x47cca2[_0x3348ba(0xa8)]+_0x3348ba(0x89)};},async 'execute'(_0x145e61){const _0x57b382=a138_0x3cc0f7,_0x582143=loadSqlProjectConfig(_0x145e61[_0x57b382(0xac)]),_0x21ce8f=await readSqlLockFile(_0x582143[_0x57b382(0x9f)]),{lockData:_0x41e6d7,appLock:_0x256263}=ensureSqlLockScope(_0x21ce8f??createEmptySqlLock(),_0x145e61['appCode'],_0x582143[_0x57b382(0xaf)],_0x57b382(0xa5)),_0xc32360=await getTargetSqlQueries(_0x582143,_0x256263,_0x145e61[_0x57b382(0xa4)](_0x57b382(0x9e))||undefined);if(_0xc32360[_0x57b382(0xa8)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x57b382(0xa6)};const _0x396906=[],_0x3242a5=[],_0x468d4a=[];for(const _0x5df7bc of _0xc32360){const _0x2d6579=_0x256263[_0x57b382(0xa7)][_0x5df7bc[_0x57b382(0x95)]];if(!_0x2d6579){_0x468d4a[_0x57b382(0xa5)]({'sqlCode':_0x5df7bc[_0x57b382(0x95)],'error':'local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first'});continue;}try{const _0x2f6c8b=await computeSqlFileHash(_0x5df7bc[_0x57b382(0x8d)]),_0x5bfe1b=_0x2d6579['path']!==_0x5df7bc[_0x57b382(0x7d)]||!!_0x5df7bc[_0x57b382(0x8f)]&&_0x2d6579[_0x57b382(0x8f)]!==_0x5df7bc[_0x57b382(0x8f)];if(!_0x145e61[_0x57b382(0x90)](_0x57b382(0x81))&&_0x2d6579['hash']===_0x2f6c8b&&!_0x5bfe1b){_0x3242a5[_0x57b382(0xa5)]({'sqlCode':_0x5df7bc[_0x57b382(0x95)],'reason':_0x57b382(0x8b)});continue;}if(_0x2d6579[_0x57b382(0x93)]==null){_0x468d4a['push']({'sqlCode':_0x5df7bc[_0x57b382(0x95)],'error':_0x57b382(0xa1)});continue;}const _0x478dfd=await readFile(_0x5df7bc[_0x57b382(0x8d)],_0x57b382(0x9d)),_0x5e6f59=stripLocalSqlMetadata(_0x478dfd,_0x5df7bc[_0x57b382(0xa9)]),_0x4cb2fe=_0x5df7bc[_0x57b382(0x8f)]||_0x2d6579[_0x57b382(0x8f)],_0x29d9a7=await resolveTargetDbBinding(_0x145e61[_0x57b382(0xac)],_0x5df7bc,_0x2d6579),_0x298335=await updateSqlQuery({'id':_0x2d6579['remoteId'],'appCode':_0x145e61[_0x57b382(0xac)],'sqlCode':_0x5df7bc[_0x57b382(0x95)],'sqlName':_0x4cb2fe,'dbId':_0x29d9a7[_0x57b382(0xa3)],'version':_0x2d6579[_0x57b382(0x93)],'sqlContent':_0x5e6f59,'sqlConfig':_0x2d6579[_0x57b382(0x9b)]??undefined}),_0x57c8d2=_0x298335[_0x57b382(0xa3)]?await getDbName(_0x145e61[_0x57b382(0xac)],Number(_0x298335[_0x57b382(0xa3)]))['catch'](()=>_0x29d9a7[_0x57b382(0x75)]):_0x29d9a7[_0x57b382(0x75)];_0x256263[_0x57b382(0xa7)][_0x5df7bc[_0x57b382(0x95)]]={...buildSqlLockEntry(_0x298335,_0x5e6f59,_0x2f6c8b,{'dbName':_0x57c8d2}),'path':_0x5df7bc[_0x57b382(0x7d)],'mode':_0x2d6579[_0x57b382(0xa9)]},await archivePreviousSqlFileIfNeeded(_0x582143,_0x2d6579['path'],_0x5df7bc[_0x57b382(0x7d)]),_0x396906[_0x57b382(0xa5)]({'sqlCode':_0x5df7bc[_0x57b382(0x95)],'remoteId':_0x2d6579[_0x57b382(0x78)]});}catch(_0x2ba4ca){_0x468d4a['push']({'sqlCode':_0x5df7bc[_0x57b382(0x95)],'error':_0x2ba4ca instanceof Error?_0x2ba4ca['message']:String(_0x2ba4ca)});}}return _0x256263[_0x57b382(0x7e)]=new Date()['toISOString'](),await writeSqlLockFile(_0x582143[_0x57b382(0x9f)],_0x41e6d7),{'ok':_0x468d4a[_0x57b382(0xa8)]===0x0,'data':{'pushed':_0x396906,'skipped':_0x3242a5,'failed':_0x468d4a},'message':_0x57b382(0xaa)+_0x396906['length']+'\x20pushed,\x20'+_0x3242a5[_0x57b382(0xa8)]+_0x57b382(0x9a)+_0x468d4a[_0x57b382(0xa8)]+_0x57b382(0x91)};}};async function archivePreviousSqlFileIfNeeded(_0x20f3ec,_0x20ac2a,_0x4f4e08){const _0x272dd1=a138_0x3cc0f7;if(!_0x20ac2a||_0x20ac2a===_0x4f4e08)return;const _0x3b3220=join(_0x20f3ec['sqlRootDir'],_0x20ac2a);if(!await fileExists(_0x3b3220))return;const _0x1d0bf0=await moveToTrash(_0x20f3ec[_0x272dd1(0x74)],_0x20f3ec['trashDir'],_0x3b3220);await cleanupEmptyDirectories(dirname(_0x3b3220),_0x20f3ec[_0x272dd1(0x92)]),void _0x1d0bf0;}async function moveToTrash(_0x12f905,_0x35476c,_0x110ee8){const _0x13bc59=a138_0x3cc0f7,_0x284370=new Date()[_0x13bc59(0x8e)]()[_0x13bc59(0x7a)](/[:.]/g,'-'),_0x553e94=relative(_0x12f905,_0x110ee8),_0x1c5d18=join(_0x35476c,_0x284370,_0x553e94);return await mkdir(dirname(_0x1c5d18),{'recursive':!![]}),await rename(_0x110ee8,_0x1c5d18),_0x1c5d18;}async function cleanupEmptyDirectories(_0x50d4e5,_0x5df95f){const _0x38f588=a138_0x3cc0f7;let _0x1026a1=resolve(_0x50d4e5);const _0x1ab269=resolve(_0x5df95f);while(_0x1026a1[_0x38f588(0x76)](''+_0x1ab269+sep)||_0x1026a1===_0x1ab269){if(_0x1026a1===_0x1ab269)return;try{const _0x24cf0f=await readdir(_0x1026a1);if(_0x24cf0f[_0x38f588(0xa8)]>0x0)return;await rmdir(_0x1026a1);}catch{return;}_0x1026a1=dirname(_0x1026a1);}}async function resolveTargetDbBinding(_0x504932,_0x54c946,_0x14ed1e){const _0x15266c=a138_0x3cc0f7,_0x12e566=_0x54c946[_0x15266c(0x7c)];if(!_0x12e566)return{'dbId':_0x14ed1e[_0x15266c(0xa3)],'dbName':_0x14ed1e['dbName']};const _0x47109e=buildDbDirectoryName(_0x14ed1e['dbName'],_0x14ed1e['dbId']);if(_0x12e566===_0x47109e)return{'dbId':_0x14ed1e['dbId'],'dbName':_0x14ed1e[_0x15266c(0x75)]};const _0x837010=parseExplicitDbDirectory(_0x12e566);if(_0x837010!=null)return{'dbId':_0x837010,'dbName':await getDbName(_0x504932,_0x837010)[_0x15266c(0xab)](()=>undefined)};const _0x45d70b=await listDatabases(_0x504932),_0x14ab2a=_0x45d70b[_0x15266c(0x84)](_0x14932a=>buildDbDirectoryName(_0x14932a['dbName'],_0x14932a[_0x15266c(0xa3)])===_0x12e566);if(_0x14ab2a[_0x15266c(0xa8)]===0x1)return{'dbId':_0x14ab2a[0x0]['dbId'],'dbName':_0x14ab2a[0x0][_0x15266c(0x75)]};if(_0x14ab2a[_0x15266c(0xa8)]===0x0)throw CliErrors[_0x15266c(0x79)](_0x15266c(0xa0)+_0x12e566+'\x22\x20for\x20sqlCode\x20'+_0x54c946[_0x15266c(0x95)]+'.');const _0x5ea6c7=_0x14ab2a['map'](_0x19e63f=>_0x19e63f[_0x15266c(0x75)]+'\x20('+_0x19e63f[_0x15266c(0xa3)]+')')['join'](',\x20');throw CliErrors[_0x15266c(0x79)]('Local\x20directory\x20\x22'+_0x12e566+_0x15266c(0xb2)+_0x54c946[_0x15266c(0x95)]+':\x20'+_0x5ea6c7);}function parseExplicitDbDirectory(_0x5ac461){const _0x35681e=a138_0x3cc0f7,_0x58071d=/^db-(\d+)$/[_0x35681e(0x96)](_0x5ac461);if(!_0x58071d)return null;const _0x55ab4e=Number(_0x58071d[0x1]);return Number[_0x35681e(0xae)](_0x55ab4e)&&_0x55ab4e>0x0?_0x55ab4e:null;}
|
|
1
|
+
const a139_0x512f68=a139_0x287e;(function(_0x5e7919,_0x1fe9e0){const _0x155ece=a139_0x287e,_0x494a62=_0x5e7919();while(!![]){try{const _0x178dcd=-parseInt(_0x155ece(0x169))/0x1*(parseInt(_0x155ece(0x194))/0x2)+parseInt(_0x155ece(0x17f))/0x3+parseInt(_0x155ece(0x173))/0x4+parseInt(_0x155ece(0x18a))/0x5+-parseInt(_0x155ece(0x19a))/0x6+parseInt(_0x155ece(0x187))/0x7+parseInt(_0x155ece(0x19c))/0x8*(-parseInt(_0x155ece(0x186))/0x9);if(_0x178dcd===_0x1fe9e0)break;else _0x494a62['push'](_0x494a62['shift']());}catch(_0x30e233){_0x494a62['push'](_0x494a62['shift']());}}}(a139_0x53db,0x35282));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';function a139_0x53db(){const _0x2b1441=['isFinite','Push\x20local\x20SQL\x20files\x20to\x20remote','26bquWkt','sqlcode','lockFilePath','startsWith','projectRoot','\x20skipped,\x20','1270332yHgUSo','relativePath','136LgOqBZ','force','replace','boolean','length','Would\x20push\x20','push','path','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','mode','hash','get','catch','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','24445EpMBKL','validation','high-risk-write','exec','message','dbName','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','\x20pushed,\x20','version','toISOString','1637412DhkKOb','sqlRoot','sqlName','filter','\x22\x20for\x20sqlCode\x20','set','sqls','trashDir','remoteId','bool','\x20SQL\x20file(s)','entries','1194456etFHei','/smartapi/custom/updateUserCustomSql','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','Push\x20complete:\x20','Local\x20directory\x20\x22','sqlCode','appCode','119142OsuxTE','252546HXimjX','Local\x20SQL\x20not\x20found:\x20','dbDirectory','643500Suadib','str','POST','filePath','dbId','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','No\x20database\x20matches\x20local\x20directory\x20\x22','sql'];a139_0x53db=function(){return _0x2b1441;};return a139_0x53db();}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';function a139_0x287e(_0x1c7cfc,_0x580967){_0x1c7cfc=_0x1c7cfc-0x163;const _0x53db8a=a139_0x53db();let _0x287ebc=_0x53db8a[_0x1c7cfc];return _0x287ebc;}import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';async function getTargetSqlQueries(_0x299f65,_0x3a7262,_0x50de64){const _0x5efea7=a139_0x287e,_0xecfda3=await scanLocalSqlQueries(_0x299f65),_0x5a00ca=new Map();for(const _0x3b411b of _0xecfda3){if(_0x50de64&&_0x3b411b[_0x5efea7(0x184)]!==_0x50de64)continue;const _0x1e047f=_0x5a00ca[_0x5efea7(0x166)](_0x3b411b[_0x5efea7(0x184)])??[];_0x1e047f[_0x5efea7(0x1a2)](_0x3b411b),_0x5a00ca[_0x5efea7(0x178)](_0x3b411b[_0x5efea7(0x184)],_0x1e047f);}if(_0x50de64&&!_0x5a00ca['has'](_0x50de64))throw CliErrors['validation'](_0x5efea7(0x188)+_0x50de64);const _0x3e1ebf=[];for(const [_0x1c0850,_0x2345a5]of _0x5a00ca[_0x5efea7(0x17e)]()){if(_0x2345a5[_0x5efea7(0x1a0)]===0x1){_0x3e1ebf['push'](_0x2345a5[0x0]);continue;}const _0x5b44d5=_0x3a7262['sqls'][_0x1c0850],_0x744c8d=_0x5b44d5?.[_0x5efea7(0x1a3)],_0x12d152=_0x744c8d?_0x2345a5[_0x5efea7(0x176)](_0x418624=>_0x418624[_0x5efea7(0x19b)]!==_0x744c8d):_0x2345a5;if(_0x5b44d5&&_0x12d152['length']===0x1){_0x3e1ebf[_0x5efea7(0x1a2)](_0x12d152[0x0]);continue;}throw CliErrors[_0x5efea7(0x16a)](_0x5efea7(0x168)+_0x1c0850+'.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.');}return _0x3e1ebf;}export const sqlPush={'service':a139_0x512f68(0x191),'command':a139_0x512f68(0x1a2),'description':a139_0x512f68(0x193),'risk':a139_0x512f68(0x16b),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'force','type':a139_0x512f68(0x19f),'description':a139_0x512f68(0x16f)}],async 'dryRun'(_0x3a8127){const _0xb78175=a139_0x512f68,_0x21621f=loadSqlProjectConfig(_0x3a8127[_0xb78175(0x185)]),_0x1e50ed=await readSqlLockFile(_0x21621f[_0xb78175(0x196)]),{appLock:_0x2f1e3e}=ensureSqlLockScope(_0x1e50ed??createEmptySqlLock(),_0x3a8127[_0xb78175(0x185)],_0x21621f[_0xb78175(0x174)],_0xb78175(0x1a2)),_0x1d2dda=await getTargetSqlQueries(_0x21621f,_0x2f1e3e,_0x3a8127[_0xb78175(0x18b)](_0xb78175(0x195))||undefined),_0x2c26d0=[];for(const _0x1d992a of _0x1d2dda){const _0x2bd8a2=await computeSqlFileHash(_0x1d992a['filePath']),_0x4bfec1=_0x2f1e3e[_0xb78175(0x179)][_0x1d992a[_0xb78175(0x184)]],_0x51b3f8=!!_0x4bfec1&&(_0x4bfec1[_0xb78175(0x1a3)]!==_0x1d992a[_0xb78175(0x19b)]||!!_0x1d992a[_0xb78175(0x175)]&&_0x4bfec1[_0xb78175(0x175)]!==_0x1d992a['sqlName']);if(!_0x3a8127[_0xb78175(0x17c)]('force')&&_0x4bfec1&&_0x4bfec1[_0xb78175(0x165)]===_0x2bd8a2&&!_0x51b3f8)continue;_0x2c26d0['push'](_0x1d992a[_0xb78175(0x184)]);}return{'method':_0xb78175(0x18c),'url':_0xb78175(0x180),'body':{'sqlCodes':_0x2c26d0,'appCode':_0x3a8127[_0xb78175(0x185)]},'description':_0xb78175(0x1a1)+_0x2c26d0[_0xb78175(0x1a0)]+_0xb78175(0x17d)};},async 'execute'(_0x2726cf){const _0x4f2093=a139_0x512f68,_0x6167e1=loadSqlProjectConfig(_0x2726cf['appCode']),_0x13a820=await readSqlLockFile(_0x6167e1[_0x4f2093(0x196)]),{lockData:_0xa0c1b7,appLock:_0x4ff84f}=ensureSqlLockScope(_0x13a820??createEmptySqlLock(),_0x2726cf['appCode'],_0x6167e1[_0x4f2093(0x174)],'push'),_0x331ee1=await getTargetSqlQueries(_0x6167e1,_0x4ff84f,_0x2726cf[_0x4f2093(0x18b)](_0x4f2093(0x195))||undefined);if(_0x331ee1[_0x4f2093(0x1a0)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':'No\x20local\x20SQL\x20files\x20found.'};const _0x392c42=[],_0x2de71f=[],_0x146750=[];for(const _0x1a3390 of _0x331ee1){const _0x9eca93=_0x4ff84f['sqls'][_0x1a3390[_0x4f2093(0x184)]];if(!_0x9eca93){_0x146750[_0x4f2093(0x1a2)]({'sqlCode':_0x1a3390[_0x4f2093(0x184)],'error':_0x4f2093(0x181)});continue;}try{const _0x15058a=await computeSqlFileHash(_0x1a3390['filePath']),_0x327c2e=_0x9eca93[_0x4f2093(0x1a3)]!==_0x1a3390[_0x4f2093(0x19b)]||!!_0x1a3390['sqlName']&&_0x9eca93[_0x4f2093(0x175)]!==_0x1a3390[_0x4f2093(0x175)];if(!_0x2726cf[_0x4f2093(0x17c)](_0x4f2093(0x19d))&&_0x9eca93[_0x4f2093(0x165)]===_0x15058a&&!_0x327c2e){_0x2de71f[_0x4f2093(0x1a2)]({'sqlCode':_0x1a3390[_0x4f2093(0x184)],'reason':'unchanged'});continue;}if(_0x9eca93[_0x4f2093(0x171)]==null){_0x146750[_0x4f2093(0x1a2)]({'sqlCode':_0x1a3390[_0x4f2093(0x184)],'error':_0x4f2093(0x163)});continue;}const _0x4a5e6c=await readFile(_0x1a3390[_0x4f2093(0x18d)],'utf8'),_0xa3d144=stripLocalSqlMetadata(_0x4a5e6c,_0x1a3390[_0x4f2093(0x164)]),_0x286844=_0x1a3390['sqlName']||_0x9eca93[_0x4f2093(0x175)],_0x227dd5=await resolveTargetDbBinding(_0x2726cf[_0x4f2093(0x185)],_0x1a3390,_0x9eca93),_0x5ef6b9=await updateSqlQuery({'id':_0x9eca93[_0x4f2093(0x17b)],'appCode':_0x2726cf['appCode'],'sqlCode':_0x1a3390[_0x4f2093(0x184)],'sqlName':_0x286844,'dbId':_0x227dd5['dbId'],'version':_0x9eca93['version'],'sqlContent':_0xa3d144,'sqlConfig':_0x9eca93['sqlConfig']??undefined}),_0x2f4e7b=_0x5ef6b9[_0x4f2093(0x18e)]?await getDbName(_0x2726cf[_0x4f2093(0x185)],Number(_0x5ef6b9[_0x4f2093(0x18e)]))[_0x4f2093(0x167)](()=>_0x227dd5[_0x4f2093(0x16e)]):_0x227dd5[_0x4f2093(0x16e)];_0x4ff84f['sqls'][_0x1a3390[_0x4f2093(0x184)]]={...buildSqlLockEntry(_0x5ef6b9,_0xa3d144,_0x15058a,{'dbName':_0x2f4e7b}),'path':_0x1a3390[_0x4f2093(0x19b)],'mode':_0x9eca93[_0x4f2093(0x164)]},await archivePreviousSqlFileIfNeeded(_0x6167e1,_0x9eca93[_0x4f2093(0x1a3)],_0x1a3390[_0x4f2093(0x19b)]),_0x392c42[_0x4f2093(0x1a2)]({'sqlCode':_0x1a3390[_0x4f2093(0x184)],'remoteId':_0x9eca93[_0x4f2093(0x17b)]});}catch(_0x3e3ac2){_0x146750[_0x4f2093(0x1a2)]({'sqlCode':_0x1a3390[_0x4f2093(0x184)],'error':_0x3e3ac2 instanceof Error?_0x3e3ac2[_0x4f2093(0x16d)]:String(_0x3e3ac2)});}}return _0x4ff84f['lastSync']=new Date()['toISOString'](),await writeSqlLockFile(_0x6167e1[_0x4f2093(0x196)],_0xa0c1b7),{'ok':_0x146750[_0x4f2093(0x1a0)]===0x0,'data':{'pushed':_0x392c42,'skipped':_0x2de71f,'failed':_0x146750},'message':_0x4f2093(0x182)+_0x392c42[_0x4f2093(0x1a0)]+_0x4f2093(0x170)+_0x2de71f[_0x4f2093(0x1a0)]+_0x4f2093(0x199)+_0x146750[_0x4f2093(0x1a0)]+'\x20failed'};}};async function archivePreviousSqlFileIfNeeded(_0x4f201c,_0x4300fc,_0x3b5879){const _0x4f5a69=a139_0x512f68;if(!_0x4300fc||_0x4300fc===_0x3b5879)return;const _0x3fc003=join(_0x4f201c['sqlRootDir'],_0x4300fc);if(!await fileExists(_0x3fc003))return;const _0x2cbbbd=await moveToTrash(_0x4f201c[_0x4f5a69(0x198)],_0x4f201c[_0x4f5a69(0x17a)],_0x3fc003);await cleanupEmptyDirectories(dirname(_0x3fc003),_0x4f201c['sqlRootDir']),void _0x2cbbbd;}async function moveToTrash(_0x962338,_0x4d623e,_0x17b48a){const _0x208060=a139_0x512f68,_0x40071a=new Date()[_0x208060(0x172)]()[_0x208060(0x19e)](/[:.]/g,'-'),_0x4cd8c3=relative(_0x962338,_0x17b48a),_0x1da5ea=join(_0x4d623e,_0x40071a,_0x4cd8c3);return await mkdir(dirname(_0x1da5ea),{'recursive':!![]}),await rename(_0x17b48a,_0x1da5ea),_0x1da5ea;}async function cleanupEmptyDirectories(_0x516d64,_0x350481){const _0x132ec1=a139_0x512f68;let _0x51ade6=resolve(_0x516d64);const _0x1dd990=resolve(_0x350481);while(_0x51ade6[_0x132ec1(0x197)](''+_0x1dd990+sep)||_0x51ade6===_0x1dd990){if(_0x51ade6===_0x1dd990)return;try{const _0x25ffb0=await readdir(_0x51ade6);if(_0x25ffb0[_0x132ec1(0x1a0)]>0x0)return;await rmdir(_0x51ade6);}catch{return;}_0x51ade6=dirname(_0x51ade6);}}async function resolveTargetDbBinding(_0x2df628,_0x1340f5,_0x1b268a){const _0x11ca76=a139_0x512f68,_0x540906=_0x1340f5[_0x11ca76(0x189)];if(!_0x540906)return{'dbId':_0x1b268a[_0x11ca76(0x18e)],'dbName':_0x1b268a[_0x11ca76(0x16e)]};const _0x4a32a2=buildDbDirectoryName(_0x1b268a['dbName'],_0x1b268a[_0x11ca76(0x18e)]);if(_0x540906===_0x4a32a2)return{'dbId':_0x1b268a[_0x11ca76(0x18e)],'dbName':_0x1b268a[_0x11ca76(0x16e)]};const _0x2efe1e=parseExplicitDbDirectory(_0x540906);if(_0x2efe1e!=null)return{'dbId':_0x2efe1e,'dbName':await getDbName(_0x2df628,_0x2efe1e)[_0x11ca76(0x167)](()=>undefined)};const _0x3733ef=await listDatabases(_0x2df628),_0x37fa87=_0x3733ef['filter'](_0x1fd2c2=>buildDbDirectoryName(_0x1fd2c2['dbName'],_0x1fd2c2[_0x11ca76(0x18e)])===_0x540906);if(_0x37fa87[_0x11ca76(0x1a0)]===0x1)return{'dbId':_0x37fa87[0x0]['dbId'],'dbName':_0x37fa87[0x0]['dbName']};if(_0x37fa87[_0x11ca76(0x1a0)]===0x0)throw CliErrors[_0x11ca76(0x16a)](_0x11ca76(0x190)+_0x540906+_0x11ca76(0x177)+_0x1340f5[_0x11ca76(0x184)]+'.');const _0x3e3f45=_0x37fa87['map'](_0x5ec89d=>_0x5ec89d[_0x11ca76(0x16e)]+'\x20('+_0x5ec89d[_0x11ca76(0x18e)]+')')['join'](',\x20');throw CliErrors[_0x11ca76(0x16a)](_0x11ca76(0x183)+_0x540906+_0x11ca76(0x18f)+_0x1340f5[_0x11ca76(0x184)]+':\x20'+_0x3e3f45);}function parseExplicitDbDirectory(_0x1cd850){const _0x43506d=a139_0x512f68,_0x19a0d2=/^db-(\d+)$/[_0x43506d(0x16c)](_0x1cd850);if(!_0x19a0d2)return null;const _0x19c52f=Number(_0x19a0d2[0x1]);return Number[_0x43506d(0x192)](_0x19c52f)&&_0x19c52f>0x0?_0x19c52f:null;}
|
package/lib/commands/sql/save.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a140_0x4835(){const _0x2a6be3=['21itDVgB','406596IGwbwE','790425xKONWQ','30nwBXIr','99gSfapk','write','save','30aYrdru','24210yIBosE','`rabetbase\x20sql\x20save`\x20has\x20been\x20deprecated.','424698AzMems','file','SQL\x20query\x20display\x20name','Query\x20description','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`.','843284cHmkgW','375656DDMlvW','sqlname','validation','string','Deprecated:\x20use\x20sql\x20create\x20to\x20create\x20and\x20sql\x20push\x20to\x20update','join','424800OAJZxl','sql','9csnOvx','description','Target\x20database\x20—\x20accepts\x20a\x20numeric\x20ID\x20or\x20database\x20name\x20(e.g.\x20ecommerce_db)'];a140_0x4835=function(){return _0x2a6be3;};return a140_0x4835();}function a140_0x515e(_0xf84ff9,_0x46b590){_0xf84ff9=_0xf84ff9-0xa6;const _0x4835b2=a140_0x4835();let _0x515e69=_0x4835b2[_0xf84ff9];return _0x515e69;}const a140_0x1023fd=a140_0x515e;(function(_0x514e2d,_0x2d8e1a){const _0x1f0b1a=a140_0x515e,_0x50fa33=_0x514e2d();while(!![]){try{const _0x1c8933=-parseInt(_0x1f0b1a(0xb7))/0x1*(-parseInt(_0x1f0b1a(0xa7))/0x2)+-parseInt(_0x1f0b1a(0xbc))/0x3+parseInt(_0x1f0b1a(0xae))/0x4+parseInt(_0x1f0b1a(0xbd))/0x5*(-parseInt(_0x1f0b1a(0xa9))/0x6)+parseInt(_0x1f0b1a(0xba))/0x7*(parseInt(_0x1f0b1a(0xaf))/0x8)+-parseInt(_0x1f0b1a(0xb5))/0x9*(-parseInt(_0x1f0b1a(0xa6))/0xa)+-parseInt(_0x1f0b1a(0xbe))/0xb*(-parseInt(_0x1f0b1a(0xbb))/0xc);if(_0x1c8933===_0x2d8e1a)break;else _0x50fa33['push'](_0x50fa33['shift']());}catch(_0x15f478){_0x50fa33['push'](_0x50fa33['shift']());}}}(a140_0x4835,0x35783));import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';const SQL_SAVE_DEPRECATED_HINT=[a140_0x1023fd(0xa8),'Create\x20new\x20SQL\x20with\x20`rabetbase\x20sql\x20create\x20--name\x20<name>\x20--db-id\x20<id>\x20--mode\x20sql|mybatisXml`.',a140_0x1023fd(0xad)][a140_0x1023fd(0xb4)]('\x0a');export const sqlSave={'service':a140_0x1023fd(0xb6),'command':a140_0x1023fd(0xc0),'description':a140_0x1023fd(0xb3),'risk':a140_0x1023fd(0xbf),'requiresAuth':![],'requiresAppCode':![],'flags':[{'name':a140_0x1023fd(0xaa),'type':'string','required':!![],'description':'Path\x20to\x20the\x20SQL\x20file'},SQLCODE_FLAG_OPTIONAL,{'name':a140_0x1023fd(0xb0),'type':'string','description':a140_0x1023fd(0xab)},{'name':'db','type':a140_0x1023fd(0xb2),'description':a140_0x1023fd(0xb9)},{'name':a140_0x1023fd(0xb8),'type':a140_0x1023fd(0xb2),'description':a140_0x1023fd(0xac)}],async 'validate'(){const _0x3b8930=a140_0x1023fd;throw CliErrors[_0x3b8930(0xb1)](SQL_SAVE_DEPRECATED_HINT);},async 'execute'(){throw CliErrors['validation'](SQL_SAVE_DEPRECATED_HINT);}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a141_0x3adc25=a141_0x5338;(function(_0x569f2d,_0x2fd742){const _0x40c3be=a141_0x5338,_0x838513=_0x569f2d();while(!![]){try{const _0x24de7f=-parseInt(_0x40c3be(0x217))/0x1*(-parseInt(_0x40c3be(0x1f3))/0x2)+parseInt(_0x40c3be(0x1f2))/0x3+parseInt(_0x40c3be(0x20c))/0x4+-parseInt(_0x40c3be(0x207))/0x5+-parseInt(_0x40c3be(0x1fe))/0x6+-parseInt(_0x40c3be(0x206))/0x7*(-parseInt(_0x40c3be(0x1f8))/0x8)+-parseInt(_0x40c3be(0x215))/0x9;if(_0x24de7f===_0x2fd742)break;else _0x838513['push'](_0x838513['shift']());}catch(_0x3c17f4){_0x838513['push'](_0x838513['shift']());}}}(a141_0x239b,0x60e2f));import{createInterface}from'node:readline';function a141_0x5338(_0x16bfa7,_0x31c123){_0x16bfa7=_0x16bfa7-0x1f1;const _0x239bee=a141_0x239b();let _0x5338f9=_0x239bee[_0x16bfa7];return _0x5338f9;}import{join}from'node:path';import{buildDefaultSqlFileName,buildSqlRelativePath,detectSqlMode}from'../../core/sql-sync/utils.js';export const SQL_LOCAL_REL_DIR=a141_0x3adc25(0x1ff);export function buildSqlLockEntry(_0x238bb6,_0x1697a9,_0x2813a8,_0x4a38e5){const _0x1f8696=a141_0x3adc25,_0x429e0a=detectSqlMode(_0x1697a9);return{'path':buildSqlRelativePath(_0x238bb6[_0x1f8696(0x200)],_0x238bb6[_0x1f8696(0x201)],_0x4a38e5?.['dbName'],_0x429e0a,_0x238bb6[_0x1f8696(0x205)]),'hash':_0x2813a8,'remoteId':_0x238bb6['id'],'version':_0x238bb6[_0x1f8696(0x1fd)],'dbId':Number(_0x238bb6[_0x1f8696(0x205)]),'dbName':_0x4a38e5?.[_0x1f8696(0x20b)],'sqlName':_0x238bb6['sqlName'],'sqlConfig':_0x238bb6['sqlConfig']??undefined,'mode':_0x429e0a};}export function cloneSqlLockData(_0x3136d7){const _0x4e60df=a141_0x3adc25;return{'apps':Object[_0x4e60df(0x1fc)](Object[_0x4e60df(0x21b)](_0x3136d7[_0x4e60df(0x214)])[_0x4e60df(0x1f4)](([_0xc55dd0,_0x54b827])=>[_0xc55dd0,{'sqlRoot':_0x54b827[_0x4e60df(0x1f9)],'lastSync':_0x54b827[_0x4e60df(0x20d)],'sqls':{..._0x54b827[_0x4e60df(0x209)]}}]))};}export function ensureRemoteSqlContent(_0x249336){return _0x249336['sqlContent']??'';}export function buildLocalSqlFileContent(_0x37e909,_0x709bc2,_0x2d74e0){const _0x4418ff=a141_0x3adc25,_0x205f16=_0x2d74e0?.['mode']??detectSqlMode(_0x709bc2),_0x3f92e6=stripLocalSqlMetadata(_0x709bc2,_0x205f16)[_0x4418ff(0x211)](),_0x4e6208=[...buildMetadataHeaderLines({'sqlCode':_0x37e909[_0x4418ff(0x200)],'sqlName':_0x37e909[_0x4418ff(0x201)],'dbId':_0x37e909[_0x4418ff(0x205)],'dbName':_0x2d74e0?.[_0x4418ff(0x20b)],'mode':_0x205f16,'syncedAt':_0x2d74e0?.['syncedAt'],'description':_0x2d74e0?.['description']},_0x205f16),'',_0x3f92e6],_0xce2a54=_0x4e6208['join']('\x0a');return _0xce2a54[_0x4418ff(0x20f)]('\x0a')?_0xce2a54:_0xce2a54+'\x0a';}export function stripLocalSqlMetadata(_0x10a8b7,_0x47f326){const _0x11d13d=a141_0x3adc25,_0x1aa5e3=_0x10a8b7['replace'](/\r\n/g,'\x0a')[_0x11d13d(0x203)]('\x0a'),_0x4018b7=[];let _0x461be5=0x0;if(_0x47f326===_0x11d13d(0x218))while(_0x461be5<_0x1aa5e3[_0x11d13d(0x204)]){const _0x2ea91a=_0x1aa5e3[_0x461be5]??'';if(/^\s*<!--\s*@lovrabet\./['test'](_0x2ea91a)){_0x461be5++;continue;}if(_0x2ea91a[_0x11d13d(0x211)]()===''&&_0x461be5>0x0){_0x461be5++;continue;}break;}else while(_0x461be5<_0x1aa5e3[_0x11d13d(0x204)]){const _0x3f4b4d=_0x1aa5e3[_0x461be5]??'';if(/^\s*--\s*@lovrabet\./[_0x11d13d(0x20e)](_0x3f4b4d)){_0x461be5++;continue;}if(_0x3f4b4d['trim']()===''&&_0x461be5>0x0){_0x461be5++;continue;}break;}for(;_0x461be5<_0x1aa5e3[_0x11d13d(0x204)];_0x461be5++){_0x4018b7['push'](_0x1aa5e3[_0x461be5]);}return _0x4018b7[_0x11d13d(0x21a)]('\x0a')[_0x11d13d(0x1f6)]();}export function resolveSqlMode(_0x170335,_0x21ef09){const _0x50f98b=a141_0x3adc25;if(_0x21ef09?.['mode'])return _0x21ef09[_0x50f98b(0x216)];return detectSqlMode(_0x170335);}export function resolveSqlFileName(_0x21d18e,_0x17a7a1,_0x344e98){const _0x5dfe8b=a141_0x3adc25;if(_0x344e98?.[_0x5dfe8b(0x1f5)])return _0x344e98[_0x5dfe8b(0x1f5)];if(_0x344e98?.[_0x5dfe8b(0x201)]||_0x344e98?.[_0x5dfe8b(0x20b)])return buildSqlRelativePath(_0x21d18e,_0x344e98?.[_0x5dfe8b(0x201)],_0x344e98?.['dbName'],resolveSqlMode(_0x17a7a1,_0x344e98),_0x344e98?.[_0x5dfe8b(0x205)]);return buildDefaultSqlFileName(_0x21d18e,resolveSqlMode(_0x17a7a1,_0x344e98));}export function resolveSqlLocalDir(_0x34d22c,_0x51956f){return join(_0x34d22c,SQL_LOCAL_REL_DIR,_0x51956f);}export async function confirmForceOverwrite(_0x1a7ae8){const _0xaf2ce7=a141_0x3adc25,_0x220b57=createInterface({'input':process[_0xaf2ce7(0x1f1)],'output':process[_0xaf2ce7(0x1f7)]}),_0x5e3567=await new Promise(_0x1d730b=>{const _0x1f64ad=_0xaf2ce7;_0x220b57[_0x1f64ad(0x202)](_0x1a7ae8+_0x1f64ad(0x20a),_0x1d730b);});return _0x220b57[_0xaf2ce7(0x219)](),['y','yes'][_0xaf2ce7(0x213)](_0x5e3567['trim']()['toLowerCase']());}export function findSqlLockScope(_0x21de8e,_0x1ed7fa){const _0x3cdd19=a141_0x3adc25;return _0x21de8e[_0x3cdd19(0x214)][_0x1ed7fa];}function buildMetadataHeaderLines(_0x4fd1fa,_0x779275){const _0x3c64ba=a141_0x3adc25,_0x287e91=[[_0x3c64ba(0x200),_0x4fd1fa[_0x3c64ba(0x200)]],[_0x3c64ba(0x201),_0x4fd1fa['sqlName']],[_0x3c64ba(0x205),_0x4fd1fa[_0x3c64ba(0x205)]],[_0x3c64ba(0x20b),_0x4fd1fa[_0x3c64ba(0x20b)]],[_0x3c64ba(0x216),_0x4fd1fa['mode']],[_0x3c64ba(0x208),_0x4fd1fa[_0x3c64ba(0x208)]],[_0x3c64ba(0x1fb),_0x4fd1fa[_0x3c64ba(0x1fb)]]];if(_0x779275==='mybatisXml')return _0x287e91[_0x3c64ba(0x210)](([,_0x50b695])=>_0x50b695!==undefined&&_0x50b695!==null&&String(_0x50b695)[_0x3c64ba(0x211)]()!=='')['map'](([_0x903077,_0x120f65])=>'<!--\x20@lovrabet.'+_0x903077+':\x20'+String(_0x120f65)+_0x3c64ba(0x212));return _0x287e91[_0x3c64ba(0x210)](([,_0xca2307])=>_0xca2307!==undefined&&_0xca2307!==null&&String(_0xca2307)[_0x3c64ba(0x211)]()!=='')[_0x3c64ba(0x1f4)](([_0x4da03c,_0x5e9a6e])=>_0x3c64ba(0x1fa)+_0x4da03c+':\x20'+String(_0x5e9a6e));}function a141_0x239b(){const _0x4f4fd9=['path','trimStart','stderr','8OixYsL','sqlRoot','--\x20@lovrabet.','description','fromEntries','version','3898752pHIpUm','.rabetbase/sql','sqlCode','sqlName','question','split','length','dbId','3327107NbOHid','2523280cNUSYg','syncedAt','sqls','\x20[y/N]\x20','dbName','2503964FHLvSw','lastSync','test','endsWith','filter','trim','\x20-->','includes','apps','5162391PkGGkg','mode','42976UwWejt','mybatisXml','close','join','entries','stdin','2168310aJgXmI','14DBRzlK','map'];a141_0x239b=function(){return _0x4f4fd9;};return a141_0x239b();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a142_0x10e5af=a142_0x202a;function a142_0x3aff(){const _0x43be56=['push','status','sqls','16722fztYRo','733656ajiMAb','tableData','\x20remote-only','1350NwBeqQ','1588ZHvcsj','map','totalCount','301oBqYal','sqlRoot','All\x20SQL\x20queries\x20are\x20in\x20sync.','14QGkfnE','bool','keys','\x20missing,\x20','787455EQaOjk','lockKey','length','lockFilePath','filePath','sqlName','read','relativePath','Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','64591bJiOSb','appCode','10684710ueOpeh','sql','1038420DNAVne','paging','has','remote'];a142_0x3aff=function(){return _0x43be56;};return a142_0x3aff();}function a142_0x202a(_0x54ede2,_0x1a35bb){_0x54ede2=_0x54ede2-0x1cc;const _0x3affdc=a142_0x3aff();let _0x202ad1=_0x3affdc[_0x54ede2];return _0x202ad1;}(function(_0x168100,_0x5b9916){const _0x191650=a142_0x202a,_0x387e2f=_0x168100();while(!![]){try{const _0x23399b=parseInt(_0x191650(0x1d1))/0x1*(-parseInt(_0x191650(0x1e7))/0x2)+-parseInt(_0x191650(0x1d5))/0x3+parseInt(_0x191650(0x1e1))/0x4*(parseInt(_0x191650(0x1e0))/0x5)+parseInt(_0x191650(0x1dc))/0x6*(parseInt(_0x191650(0x1e4))/0x7)+-parseInt(_0x191650(0x1dd))/0x8+-parseInt(_0x191650(0x1eb))/0x9+parseInt(_0x191650(0x1d3))/0xa;if(_0x23399b===_0x5b9916)break;else _0x387e2f['push'](_0x387e2f['shift']());}catch(_0x591a72){_0x387e2f['push'](_0x387e2f['shift']());}}}(a142_0x3aff,0x4da47));import{listSqlQueries}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile}from'../../core/sql-sync/lock.js';const PAGE_SIZE=0x64;async function fetchAllSqlCodes(_0x53c23e){const _0x258527=a142_0x202a,_0x1695ac=[];let _0x47938a=0x1;while(!![]){const _0x1a4e67=await listSqlQueries(_0x53c23e,{'currentPage':_0x47938a,'pageSize':PAGE_SIZE}),_0x1a825c=_0x1a4e67[_0x258527(0x1de)]??[];_0x1695ac[_0x258527(0x1d9)](..._0x1a825c[_0x258527(0x1e2)](_0x16caa6=>_0x16caa6['sqlCode']));if(_0x1a825c[_0x258527(0x1ed)]===0x0)break;const _0x169156=_0x1a4e67[_0x258527(0x1d6)]?.[_0x258527(0x1e3)];if(_0x169156!=null?_0x1695ac[_0x258527(0x1ed)]>=_0x169156:_0x1a825c[_0x258527(0x1ed)]<PAGE_SIZE)break;_0x47938a++;}return _0x1695ac;}export const sqlStatus={'service':a142_0x10e5af(0x1d4),'command':a142_0x10e5af(0x1da),'description':a142_0x10e5af(0x1d0),'risk':a142_0x10e5af(0x1ce),'flags':[{'name':a142_0x10e5af(0x1d8),'type':'boolean','description':'Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally'}],async 'execute'(_0x201239){const _0x41e2f4=a142_0x10e5af,_0x13cf50=loadSqlProjectConfig(_0x201239[_0x41e2f4(0x1d2)]),_0x42cc9d=await readSqlLockFile(_0x13cf50[_0x41e2f4(0x1ee)]),{appLock:_0x5314bb}=ensureSqlLockScope(_0x42cc9d??createEmptySqlLock(),_0x13cf50[_0x41e2f4(0x1d2)],_0x13cf50[_0x41e2f4(0x1e5)],_0x41e2f4(0x1da)),_0x247224=await scanLocalSqlQueries(_0x13cf50),_0x56766a=[],_0x1caf12=[],_0x1082d9=[],_0x2156e5=[],_0x1fedae=new Set(_0x247224[_0x41e2f4(0x1e2)](_0x5535d7=>_0x5535d7[_0x41e2f4(0x1ec)]));for(const _0x4b4dc8 of _0x247224){const _0x3423b2=await computeSqlFileHash(_0x4b4dc8[_0x41e2f4(0x1cc)]),_0x21ba3d=_0x5314bb[_0x41e2f4(0x1db)][_0x4b4dc8[_0x41e2f4(0x1ec)]],_0x6703c5=!!_0x21ba3d&&_0x21ba3d['path']!==_0x4b4dc8[_0x41e2f4(0x1cf)],_0x250603=!!_0x21ba3d&&!!_0x4b4dc8[_0x41e2f4(0x1cd)]&&_0x21ba3d[_0x41e2f4(0x1cd)]!==_0x4b4dc8['sqlName'];if(!_0x21ba3d)_0x56766a[_0x41e2f4(0x1d9)](_0x4b4dc8['lockKey']);else _0x21ba3d['hash']!==_0x3423b2||_0x6703c5||_0x250603?_0x1caf12[_0x41e2f4(0x1d9)](_0x4b4dc8['lockKey']):_0x1082d9[_0x41e2f4(0x1d9)](_0x4b4dc8['lockKey']);}for(const _0x17b421 of Object[_0x41e2f4(0x1e9)](_0x5314bb[_0x41e2f4(0x1db)])){!_0x1fedae[_0x41e2f4(0x1d7)](_0x17b421)&&_0x2156e5[_0x41e2f4(0x1d9)](_0x17b421);}const _0x3034a0=[];if(_0x201239[_0x41e2f4(0x1e8)](_0x41e2f4(0x1d8))){const _0x210f75=await fetchAllSqlCodes(_0x201239[_0x41e2f4(0x1d2)]);for(const _0x4e86f7 of _0x210f75){!_0x1fedae[_0x41e2f4(0x1d7)](_0x4e86f7)&&!_0x5314bb['sqls'][_0x4e86f7]&&_0x3034a0[_0x41e2f4(0x1d9)](_0x4e86f7);}}const _0x230183=_0x56766a['length']===0x0&&_0x1caf12[_0x41e2f4(0x1ed)]===0x0&&_0x2156e5[_0x41e2f4(0x1ed)]===0x0&&_0x3034a0[_0x41e2f4(0x1ed)]===0x0;return{'ok':!![],'data':{'added':_0x56766a,'modified':_0x1caf12,'missing':_0x2156e5,'unchanged':_0x1082d9,'remoteOnly':_0x3034a0},'message':_0x230183?_0x41e2f4(0x1e6):_0x56766a[_0x41e2f4(0x1ed)]+'\x20added,\x20'+_0x1caf12['length']+'\x20modified,\x20'+_0x2156e5['length']+_0x41e2f4(0x1ea)+_0x1082d9[_0x41e2f4(0x1ed)]+'\x20unchanged'+(_0x3034a0['length']>0x0?',\x20'+_0x3034a0[_0x41e2f4(0x1ed)]+_0x41e2f4(0x1df):'')};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a143_0x4b984a=a143_0x5d53;(function(_0x4ac2dd,_0x455503){const _0x27fb53=a143_0x5d53,_0x35e023=_0x4ac2dd();while(!![]){try{const _0xdf72dd=-parseInt(_0x27fb53(0x1c2))/0x1*(parseInt(_0x27fb53(0x1e6))/0x2)+parseInt(_0x27fb53(0x1c9))/0x3*(parseInt(_0x27fb53(0x1de))/0x4)+parseInt(_0x27fb53(0x1c3))/0x5*(-parseInt(_0x27fb53(0x1bb))/0x6)+-parseInt(_0x27fb53(0x1b7))/0x7+-parseInt(_0x27fb53(0x1c4))/0x8*(-parseInt(_0x27fb53(0x1d7))/0x9)+parseInt(_0x27fb53(0x1d9))/0xa+parseInt(_0x27fb53(0x1df))/0xb;if(_0xdf72dd===_0x455503)break;else _0x35e023['push'](_0x35e023['shift']());}catch(_0x38c9e6){_0x35e023['push'](_0x35e023['shift']());}}}(a143_0x339e,0x858c4));import{readFileSync,existsSync}from'node:fs';import{resolve}from'node:path';import{validateSql}from'../../core/sql-validator.js';function a143_0x5d53(_0xfb0bf5,_0x7d8d){_0xfb0bf5=_0xfb0bf5-0x1b6;const _0x339e8f=a143_0x339e();let _0x5d53dc=_0x339e8f[_0xfb0bf5];return _0x5d53dc;}function a143_0x339e(){const _0x27d1a1=['SQL\x20schema\x20validation','File\x20not\x20found:\x20','message','parameters','valid','33094RtMceh','dbtableConfig','1975358FSBTHm','cwd','length','file','6lGAtcF','filter','\x22\x20not\x20found\x20in\x20any\x20dataset','tables','fields','read','split','32zNPHSi','4853590rsOurZ','137416IXfCnZ','validation','tableName','appCode','str','45537USDTMJ','toLowerCase','isSelectOnly','Path\x20to\x20the\x20SQL\x20file\x20to\x20validate','\x22\x20not\x20found\x20or\x20not\x20accessible','sql','utf-8','sqlType','schemas','schemaWarnings','name','map','Dataset\x20\x22','Comma-separated\x20dataset\x20codes\x20to\x20cross-check\x20table/column\x20names\x20against','135ANvJsx','reason','6959530iwwzCT','validate','isArray','Table\x20\x22','trim','224ehJVqA','5783756mbZDNX','string'];a143_0x339e=function(){return _0x27d1a1;};return a143_0x339e();}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':a143_0x4b984a(0x1ce),'command':a143_0x4b984a(0x1da),'description':'Validate\x20SQL\x20content\x20without\x20saving\x20(type\x20detection,\x20parameter\x20extraction,\x20optional\x20schema\x20check)','risk':a143_0x4b984a(0x1c0),'flags':[{'name':a143_0x4b984a(0x1ba),'type':a143_0x4b984a(0x1e0),'description':a143_0x4b984a(0x1cc)},{'name':a143_0x4b984a(0x1ce),'type':a143_0x4b984a(0x1e0),'description':'Inline\x20SQL\x20content\x20to\x20validate\x20(alternative\x20to\x20--file)'},{'name':a143_0x4b984a(0x1d1),'type':a143_0x4b984a(0x1e0),'description':a143_0x4b984a(0x1d6)}],async 'execute'(_0x3371fd){const _0x2992a5=a143_0x4b984a,_0x5233a6=_0x3371fd[_0x2992a5(0x1c8)](_0x2992a5(0x1ba)),_0x5865e7=_0x3371fd[_0x2992a5(0x1c8)]('sql');if(!_0x5233a6&&!_0x5865e7)throw CliErrors['flagMissing'](_0x2992a5(0x1ba),'Provide\x20--file\x20or\x20--sql');let _0x34380c;if(_0x5233a6){const _0x36b555=resolve(process[_0x2992a5(0x1b8)](),_0x5233a6);if(!existsSync(_0x36b555))throw CliErrors[_0x2992a5(0x1c5)](_0x2992a5(0x1e2)+_0x36b555);_0x34380c=readFileSync(_0x36b555,_0x2992a5(0x1cf));}else _0x34380c=_0x5865e7;const _0x55e23a=validateSql(_0x34380c),_0x44417c={'valid':_0x55e23a[_0x2992a5(0x1e5)],'sqlType':_0x55e23a[_0x2992a5(0x1d0)]['type'],'isSelectOnly':_0x55e23a['sqlType'][_0x2992a5(0x1cb)],'isDangerous':_0x55e23a['sqlType']['isDangerous'],'tables':_0x55e23a[_0x2992a5(0x1be)],'parameters':_0x55e23a[_0x2992a5(0x1e4)],'message':_0x55e23a[_0x2992a5(0x1e3)]};_0x55e23a['sqlType'][_0x2992a5(0x1d8)]&&(_0x44417c['reason']=_0x55e23a[_0x2992a5(0x1d0)][_0x2992a5(0x1d8)]);const _0x295470=_0x3371fd[_0x2992a5(0x1c8)](_0x2992a5(0x1d1));if(_0x295470&&_0x55e23a['valid']){const _0x435455=_0x295470[_0x2992a5(0x1c1)](',')[_0x2992a5(0x1d4)](_0x14cacb=>_0x14cacb[_0x2992a5(0x1dd)]())[_0x2992a5(0x1bc)](Boolean),_0x250fb6=[],_0x24b742=filterDbTableBackedDatasets(await listDatasets(_0x3371fd[_0x2992a5(0x1c7)])),_0x53f6ef=new Map(_0x24b742['map'](_0x3aa895=>[_0x3aa895[_0x2992a5(0x1b6)]?.[_0x2992a5(0x1c6)]?.[_0x2992a5(0x1ca)](),_0x3aa895]));for(const _0x1e3fa2 of _0x55e23a[_0x2992a5(0x1be)]){const _0x3bb72e=_0x53f6ef['get'](_0x1e3fa2[_0x2992a5(0x1ca)]());!_0x3bb72e&&_0x250fb6['push'](_0x2992a5(0x1dc)+_0x1e3fa2+_0x2992a5(0x1bd));}for(const _0x2a098f of _0x435455){let _0x3f024f;try{_0x3f024f=await getDatasetDetail(_0x2a098f);}catch{_0x250fb6['push'](_0x2992a5(0x1d5)+_0x2a098f+_0x2992a5(0x1cd));continue;}assertDatasetIsDbTableBacked(_0x3f024f,_0x2992a5(0x1e1));const _0x1e803e=Array[_0x2992a5(0x1db)](_0x3f024f[_0x2992a5(0x1bf)])?_0x3f024f[_0x2992a5(0x1bf)]:[],_0x42663e=new Set(_0x1e803e[_0x2992a5(0x1d4)](_0x1b179b=>_0x1b179b[_0x2992a5(0x1d3)]?.[_0x2992a5(0x1ca)]())),_0x48b530=_0x3f024f[_0x2992a5(0x1b6)]?.[_0x2992a5(0x1c6)]||_0x3f024f[_0x2992a5(0x1c6)]||_0x2a098f;_0x44417c['schema:'+_0x48b530]={'code':_0x2a098f,'tableName':_0x48b530,'fieldCount':_0x42663e['size'],'fields':Array['from'](_0x42663e)};}_0x250fb6[_0x2992a5(0x1b9)]>0x0&&(_0x44417c[_0x2992a5(0x1d2)]=_0x250fb6);}return{'ok':_0x55e23a[_0x2992a5(0x1e5)],'data':_0x44417c,'message':_0x55e23a[_0x2992a5(0x1e3)]};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a144_0x345c47=a144_0x320d;(function(_0x508e78,_0x4ee633){const _0x2b8085=a144_0x320d,_0x5007d1=_0x508e78();while(!![]){try{const _0x580621=-parseInt(_0x2b8085(0x1a5))/0x1+-parseInt(_0x2b8085(0x18d))/0x2+-parseInt(_0x2b8085(0x176))/0x3+parseInt(_0x2b8085(0x18c))/0x4*(-parseInt(_0x2b8085(0x17c))/0x5)+parseInt(_0x2b8085(0x186))/0x6+-parseInt(_0x2b8085(0x1a8))/0x7+parseInt(_0x2b8085(0x196))/0x8;if(_0x580621===_0x4ee633)break;else _0x5007d1['push'](_0x5007d1['shift']());}catch(_0x59bb4c){_0x5007d1['push'](_0x5007d1['shift']());}}}(a144_0xf11b,0x7c8ec));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';function a144_0xf11b(){const _0x230bbe=['updated','App\x20code\x20to\x20bind\x20to\x20this\x20workspace','app','\x20(appcode:\x20','join','write','\x20--app\x20','object','844821TqdKaw','appcode','\x20--appcode\x20<code>`.','3415321QEvEeL','\x20workspace\x20use\x20--app\x20<name>`.','Workspace\x20','number','1523763LRabpP','init','workspace','\x20workspace\x20','defaultApp','trim','5wFmxwe','pageSize','str','\x20workspace\x20init\x20--appcode\x20<code>`\x20or\x20`','locale','defaultFormat','Switch\x20the\x20current\x20workspace\x20app\x20binding','isArray','format','apiDir','292572ejSsHl','Invalid\x20appcode:\x20','App\x20profile\x20name\x20to\x20use\x20in\x20this\x20workspace','workspace.','use','validation','2287160woThXm','2037504mYfunq','Initialize\x20the\x20current\x20workspace\x20app\x20binding','\x20workspace\x20<init|use>\x20--app\x20<name>\x20[--appcode\x20<code>]','env','riskLevel','initialized','.\x20Credentials:\x20not\x20written.','apps','globalConfig','31140904rtzvBY','project','keys',').\x20Config:\x20','Use\x20`','API\x20directory\x20path\x20for\x20this\x20workspace\x20app\x20profile','string'];a144_0xf11b=function(){return _0x230bbe;};return a144_0xf11b();}import{validateAppcode}from'../../commands/common/validate.js';import{readConfigFile,readRawConfigWithLayers,resolveWriteConfigPath,writeConfigFile}from'../../context.js';const WORKSPACE_USAGE=CLI_BIN_NAME+a144_0x345c47(0x18f),SAFE_PROFILE_KEYS=[a144_0x345c47(0x1a6),a144_0x345c47(0x190),'apiDir','format',a144_0x345c47(0x17d),a144_0x345c47(0x191),a144_0x345c47(0x180)],workspaceFlags=[{'name':a144_0x345c47(0x19f),'type':a144_0x345c47(0x19c),'description':a144_0x345c47(0x188)},{'name':a144_0x345c47(0x1a6),'type':a144_0x345c47(0x19c),'description':a144_0x345c47(0x19e)},{'name':a144_0x345c47(0x190),'type':'string','description':'Target\x20environment','enum':[...RABETBASE_ENV_VALUES]},{'name':a144_0x345c47(0x185),'type':a144_0x345c47(0x19c),'description':a144_0x345c47(0x19b)},{'name':a144_0x345c47(0x181),'type':a144_0x345c47(0x19c),'description':'Default\x20output\x20format\x20for\x20this\x20workspace\x20app\x20profile','enum':[...RABETBASE_OUTPUT_FORMAT_VALUES]},{'name':a144_0x345c47(0x17d),'type':a144_0x345c47(0x1ab),'description':'Default\x20page\x20size\x20for\x20this\x20workspace\x20app\x20profile'},{'name':a144_0x345c47(0x191),'type':a144_0x345c47(0x19c),'description':'Risk\x20level\x20for\x20this\x20workspace\x20app\x20profile','enum':[...RISK_LEVEL_VALUES]},{'name':a144_0x345c47(0x180),'type':a144_0x345c47(0x19c),'description':'Locale\x20for\x20this\x20workspace\x20app\x20profile'}];function isRecord(_0x5f1572){const _0x48f376=a144_0x345c47;return!!_0x5f1572&&typeof _0x5f1572===_0x48f376(0x1a4)&&!Array[_0x48f376(0x183)](_0x5f1572);}function assertValidAppcode(_0x158235){const _0xbfae2a=a144_0x345c47,{valid:_0x574e56,message:_0x4cde0c}=validateAppcode(_0x158235);if(!_0x574e56)throw CliErrors['validation'](_0xbfae2a(0x187)+_0x158235,_0x4cde0c);}function sanitizeProfile(_0x1d8804){if(!isRecord(_0x1d8804))return{};const _0xcae1a6={};for(const _0x46056c of SAFE_PROFILE_KEYS){if(_0x1d8804[_0x46056c]!==undefined)_0xcae1a6[_0x46056c]=_0x1d8804[_0x46056c];}return _0xcae1a6;}function cloneProfile(_0x34e241){return isRecord(_0x34e241)?{..._0x34e241}:{};}function collectWorkspaceProfileOverrides(_0x42018e){const _0x12e89a=a144_0x345c47,_0x17992a={},_0x4f9b63=_0x42018e['str']('env'),_0x3e4a40=_0x42018e[_0x12e89a(0x17e)]('apiDir'),_0x4004b0=_0x42018e[_0x12e89a(0x17e)](_0x12e89a(0x181)),_0x144f09=_0x42018e['flag']('pageSize'),_0x5e1198=_0x42018e[_0x12e89a(0x17e)](_0x12e89a(0x191)),_0x370bfa=_0x42018e['str'](_0x12e89a(0x180));if(_0x4f9b63)_0x17992a[_0x12e89a(0x190)]=_0x4f9b63;if(_0x3e4a40)_0x17992a['apiDir']=_0x3e4a40;if(_0x4004b0)_0x17992a[_0x12e89a(0x184)]=_0x4004b0;if(_0x144f09!==undefined&&_0x144f09!=='')_0x17992a['pageSize']=Number(_0x144f09);if(_0x5e1198)_0x17992a[_0x12e89a(0x191)]=_0x5e1198;if(_0x370bfa)_0x17992a[_0x12e89a(0x180)]=_0x370bfa;return _0x17992a;}async function validateWorkspaceArgs(_0x4f08fd){const _0x17261e=a144_0x345c47,_0x209ce5=_0x4f08fd['str'](_0x17261e(0x19f))[_0x17261e(0x17b)](),_0x48beb8=_0x4f08fd[_0x17261e(0x17e)](_0x17261e(0x1a6))[_0x17261e(0x17b)]();if(!_0x209ce5&&!_0x48beb8)throw CliErrors[_0x17261e(0x18b)]('Missing\x20workspace\x20app\x20selector.',_0x17261e(0x19a)+CLI_BIN_NAME+_0x17261e(0x17f)+CLI_BIN_NAME+_0x17261e(0x1a9));if(_0x48beb8)assertValidAppcode(_0x48beb8);}function resolveKnownApps(){const _0x2aad19=a144_0x345c47,{config:_0x3eefb7,layers:_0x42c282}=readRawConfigWithLayers(),_0xf0b6e4=isRecord(_0x3eefb7[_0x2aad19(0x194)])?_0x3eefb7[_0x2aad19(0x194)]:{},_0x343534=isRecord(_0x42c282[_0x2aad19(0x195)]['apps'])?_0x42c282[_0x2aad19(0x195)][_0x2aad19(0x194)]:{};return{..._0x343534,..._0xf0b6e4};}async function configureWorkspace(_0x373010,_0x5d52eb){const _0x159d98=a144_0x345c47,_0x1c7cad=_0x373010[_0x159d98(0x17e)]('app')['trim'](),_0x17eb3a=_0x373010[_0x159d98(0x17e)](_0x159d98(0x1a6))['trim'](),_0x315fd0=_0x1c7cad||_0x17eb3a;if(!_0x315fd0)throw CliErrors[_0x159d98(0x18b)]('Missing\x20workspace\x20app\x20selector.',_0x159d98(0x19a)+CLI_BIN_NAME+_0x159d98(0x17f)+CLI_BIN_NAME+_0x159d98(0x1a9));if(_0x17eb3a)assertValidAppcode(_0x17eb3a);const _0x4ec2f6=resolveWriteConfigPath(_0x159d98(0x197)),_0x41b20c=readConfigFile(_0x4ec2f6),_0x4a8341=resolveKnownApps(),_0x22648a=isRecord(_0x41b20c[_0x159d98(0x194)])?{..._0x41b20c[_0x159d98(0x194)]}:{},_0x3f2133=cloneProfile(_0x22648a[_0x315fd0]),_0x248ef1=sanitizeProfile(_0x4a8341[_0x315fd0]),_0x17d697=_0x17eb3a?{}:_0x248ef1,_0x350197=_0x17eb3a||_0x17d697[_0x159d98(0x1a6)];if(!_0x350197){const _0x5533d3=Object[_0x159d98(0x198)](_0x4a8341),_0x3d46c2=_0x5533d3['length']===0x0?_0x159d98(0x19a)+CLI_BIN_NAME+_0x159d98(0x179)+_0x5d52eb+_0x159d98(0x1a3)+_0x315fd0+_0x159d98(0x1a7):'Pass\x20--appcode\x20<code>,\x20or\x20choose\x20one\x20of:\x20'+_0x5533d3[_0x159d98(0x1a1)](',\x20');throw CliErrors[_0x159d98(0x18b)]('App\x20\x22'+_0x315fd0+'\x22\x20not\x20found.',_0x3d46c2);}assertValidAppcode(String(_0x350197));const _0x1b2c04={..._0x17d697,..._0x3f2133,'appcode':String(_0x350197),...collectWorkspaceProfileOverrides(_0x373010)};return _0x22648a[_0x315fd0]=_0x1b2c04,_0x41b20c[_0x159d98(0x194)]=_0x22648a,_0x41b20c[_0x159d98(0x17a)]=_0x315fd0,delete _0x41b20c['appcode'],delete _0x41b20c['app'],_0x1b2c04[_0x159d98(0x190)]&&(_0x41b20c[_0x159d98(0x190)]=_0x1b2c04['env']),writeConfigFile(_0x4ec2f6,_0x41b20c),{'ok':!![],'message':_0x159d98(0x1aa)+(_0x5d52eb==='init'?_0x159d98(0x192):_0x159d98(0x19d))+':\x20'+_0x315fd0+_0x159d98(0x1a0)+_0x1b2c04[_0x159d98(0x1a6)]+_0x159d98(0x199)+_0x4ec2f6+_0x159d98(0x193),'data':{'operation':_0x159d98(0x189)+_0x5d52eb,'configPath':_0x4ec2f6,'app':_0x315fd0,'appcode':_0x1b2c04[_0x159d98(0x1a6)],'env':_0x1b2c04[_0x159d98(0x190)]??null,'credentialsWritten':![]}};}const workspaceInitDefinition={'service':a144_0x345c47(0x178),'command':a144_0x345c47(0x177),'description':a144_0x345c47(0x18e),'risk':a144_0x345c47(0x1a2),'requiresAuth':![],'requiresAppCode':![],'args':[],'flags':workspaceFlags,'validate':validateWorkspaceArgs,'execute':_0x13b60c=>configureWorkspace(_0x13b60c,a144_0x345c47(0x177))},workspaceUseDefinition={'service':a144_0x345c47(0x178),'command':a144_0x345c47(0x18a),'description':a144_0x345c47(0x182),'risk':a144_0x345c47(0x1a2),'requiresAuth':![],'requiresAppCode':![],'args':[],'flags':workspaceFlags,'validate':validateWorkspaceArgs,'execute':_0xf4ac63=>configureWorkspace(_0xf4ac63,'use')};export const workspaceDefinitions=[workspaceInitDefinition,workspaceUseDefinition];function a144_0x320d(_0x35b6fb,_0x2fe9c1){_0x35b6fb=_0x35b6fb-0x176;const _0xf11b78=a144_0xf11b();let _0x320dc7=_0xf11b78[_0x35b6fb];return _0x320dc7;}export{WORKSPACE_USAGE};
|
package/lib/config/schema.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a145_0x5993c4=a145_0x59aa;(function(_0x9075e6,_0x304a42){const _0x4981a1=a145_0x59aa,_0x2ebc07=_0x9075e6();while(!![]){try{const _0x582728=-parseInt(_0x4981a1(0xd3))/0x1*(parseInt(_0x4981a1(0xe0))/0x2)+parseInt(_0x4981a1(0xe8))/0x3*(-parseInt(_0x4981a1(0xed))/0x4)+-parseInt(_0x4981a1(0xd2))/0x5+parseInt(_0x4981a1(0xe2))/0x6*(parseInt(_0x4981a1(0xdd))/0x7)+-parseInt(_0x4981a1(0xe6))/0x8+parseInt(_0x4981a1(0xce))/0x9+parseInt(_0x4981a1(0xe4))/0xa;if(_0x582728===_0x304a42)break;else _0x2ebc07['push'](_0x2ebc07['shift']());}catch(_0x55d608){_0x2ebc07['push'](_0x2ebc07['shift']());}}}(a145_0x5bdc,0x7ab6f));import{DEFAULT_CONFIG_VALUES}from'../constant/defaults.js';import{RABETBASE_ENV_VALUES}from'../constant/env.js';import{RABETBASE_OUTPUT_FORMAT_VALUES}from'../constant/output.js';import{RISK_LEVEL_VALUES}from'../constant/risk.js';export{DEFAULT_CONFIG_VALUES}from'../constant/defaults.js';export const PROJECT_CREATE_INHERITABLE_KEYS=['cookie',a145_0x5993c4(0xf0),a145_0x5993c4(0xe7),a145_0x5993c4(0xde),'riskLevel'];export const TOP_LEVEL_CONFIG_KEYS=new Set([a145_0x5993c4(0xec),a145_0x5993c4(0xcb),a145_0x5993c4(0xe7),a145_0x5993c4(0xde),a145_0x5993c4(0xd6),'accessKey',a145_0x5993c4(0xe9)]);export const CONFIG_ENUM_VALUES={'env':[...RABETBASE_ENV_VALUES],'format':[...RABETBASE_OUTPUT_FORMAT_VALUES]};export function formatConfigKeyList(_0x72452a){const _0x5ade6f=a145_0x5993c4;return[..._0x72452a][_0x5ade6f(0xd4)](',\x20');}export function getTopLevelConfigKeyList(){return[...TOP_LEVEL_CONFIG_KEYS];}function a145_0x59aa(_0x4d0208,_0x295003){_0x4d0208=_0x4d0208-0xcb;const _0x5bdccd=a145_0x5bdc();let _0x59aacf=_0x5bdccd[_0x4d0208];return _0x59aacf;}export function isTopLevelConfigKey(_0x4ad48c){return TOP_LEVEL_CONFIG_KEYS['has'](_0x4ad48c);}export function getTopLevelConfigKeySummary(){return formatConfigKeyList(getTopLevelConfigKeyList());}export function getConfigCommandKeyDescription(){const _0x5bf2ab=a145_0x5993c4;return _0x5bf2ab(0xdb)+getTopLevelConfigKeySummary()+')';}export const APP_PROFILE_FLAG_KEY_MAP={'env':'env','apiDir':a145_0x5993c4(0xe9),'cookie':a145_0x5993c4(0xd6),'accessKey':a145_0x5993c4(0xf0),'defaultFormat':a145_0x5993c4(0xde),'pageSize':a145_0x5993c4(0xcc),'riskLevel':a145_0x5993c4(0xd9),'locale':a145_0x5993c4(0xe7)};export function getAppProfileFlagDefs(){const _0x5a89b7=a145_0x5993c4;return[{'name':_0x5a89b7(0xcb),'type':_0x5a89b7(0xef),'description':_0x5a89b7(0xcf),'enum':[...RABETBASE_ENV_VALUES]},{'name':_0x5a89b7(0xe9),'type':_0x5a89b7(0xef),'description':'API\x20directory\x20path'},{'name':_0x5a89b7(0xd6),'type':_0x5a89b7(0xef),'description':_0x5a89b7(0xd5),'hidden':!![]},{'name':_0x5a89b7(0xf0),'type':_0x5a89b7(0xef),'description':_0x5a89b7(0xe1),'hidden':!![]},{'name':'defaultFormat','type':'string','description':'Default\x20output\x20format\x20for\x20this\x20app\x20(profile)','enum':[...RABETBASE_OUTPUT_FORMAT_VALUES]},{'name':_0x5a89b7(0xcc),'type':_0x5a89b7(0xdc),'description':_0x5a89b7(0xd1)},{'name':_0x5a89b7(0xd9),'type':_0x5a89b7(0xef),'description':'Risk\x20level','enum':[...RISK_LEVEL_VALUES]},{'name':_0x5a89b7(0xe7),'type':_0x5a89b7(0xef),'description':'Locale'}];}function a145_0x5bdc(){const _0x28bc7a=['2004968zFJBzY','format','apps','1621736bgSsLw','Access\x20key','12sENVZP','app','17207010XboaTD','inherit','5763208gjArFw','locale','14865KBzyiB','apiDir','length','filter','appcode','4GHCYil','zh-CN','string','accessKey','env','pageSize','toLowerCase','4013577HtnXqZ','Target\x20environment','map','Default\x20page\x20size','3503195QxBkjC','1skbKuQ','join','Auth\x20cookie','cookie','defaultApp','en-US','riskLevel','entries','Config\x20key\x20(','number'];a145_0x5bdc=function(){return _0x28bc7a;};return a145_0x5bdc();}export function collectAppProfileOverrides(_0x18b3bf){const _0x5b4d6d=a145_0x5993c4,_0x5d60df={};for(const [_0x414050,_0x23ce59]of Object[_0x5b4d6d(0xda)](APP_PROFILE_FLAG_KEY_MAP)){const _0x4508b9=_0x18b3bf(_0x414050);if(!_0x4508b9)continue;_0x5d60df[_0x23ce59]=_0x23ce59===_0x5b4d6d(0xcc)?Number(_0x4508b9):_0x4508b9;}return _0x5d60df;}export function buildAppProfileListFields(_0x4a145e){const _0x2763c5=a145_0x5993c4;return{'env':_0x4a145e[_0x2763c5(0xcb)]??null,'apiDir':_0x4a145e['apiDir']??null,'hasCookie':!!_0x4a145e[_0x2763c5(0xd6)],'hasAccessKey':!!_0x4a145e[_0x2763c5(0xf0)],'format':_0x4a145e['format']??null,'pageSize':_0x4a145e[_0x2763c5(0xcc)]??null,'riskLevel':_0x4a145e['riskLevel']??null,'locale':_0x4a145e[_0x2763c5(0xe7)]??null};}export function buildAppDoctorFields(_0x2d924f,_0x454263){const _0x3806e2=a145_0x5993c4;return{'env':{'value':_0x2d924f[_0x3806e2(0xcb)]||_0x454263[_0x3806e2(0xcb)],'source':_0x2d924f[_0x3806e2(0xcb)]?'app':'inherit'},'apiDir':{'value':_0x2d924f['apiDir']||_0x454263[_0x3806e2(0xe9)],'source':_0x2d924f[_0x3806e2(0xe9)]?_0x3806e2(0xe3):_0x3806e2(0xe5)},'cookie':{'value':_0x2d924f[_0x3806e2(0xd6)]||_0x454263[_0x3806e2(0xd6)],'source':_0x2d924f['cookie']?_0x3806e2(0xe3):_0x3806e2(0xe5)},'accessKey':{'value':_0x2d924f['accessKey']||_0x454263[_0x3806e2(0xf0)],'source':_0x2d924f['accessKey']?_0x3806e2(0xe3):_0x3806e2(0xe5)}};}export function buildCanonicalAppConfig(_0x3f7d84,_0x5487bf){const _0x1df2a3=a145_0x5993c4,_0x58dd5a=_0x3f7d84[_0x1df2a3(0xd0)](_0x10a43d=>String(_0x10a43d||'')['trim']())[_0x1df2a3(0xeb)](Boolean);if(_0x58dd5a['length']===0x0)return{};const _0x4629c9={};for(const _0x273491 of _0x58dd5a){_0x4629c9[_0x273491]=_0x5487bf?{'appcode':_0x273491,'env':_0x5487bf}:{'appcode':_0x273491};}return{'apps':_0x4629c9,'defaultApp':_0x58dd5a[0x0]};}export function buildCanonicalProjectConfig(_0x914100,_0x8b2ec1){const _0x598786=a145_0x5993c4,{appCodes:appCodes=[],env:_0x3bdd3c,metadata:_0x4a66e6}=_0x8b2ec1,_0x27ba15={..._0x914100,..._0x4a66e6||{}};delete _0x27ba15[_0x598786(0xec)],delete _0x27ba15[_0x598786(0xe3)];if(_0x3bdd3c)_0x27ba15[_0x598786(0xcb)]=_0x3bdd3c;else!_0x27ba15[_0x598786(0xcb)]&&(_0x27ba15[_0x598786(0xcb)]=DEFAULT_CONFIG_VALUES[_0x598786(0xcb)]);const _0xb11b8f=buildCanonicalAppConfig(appCodes,_0x27ba15['env']);return Object['keys'](_0xb11b8f)[_0x598786(0xea)]>0x0&&(_0x27ba15['apps']=_0xb11b8f[_0x598786(0xdf)],_0x27ba15[_0x598786(0xd7)]=_0xb11b8f['defaultApp']),_0x27ba15;}const LOCALE_MAP={'zh':a145_0x5993c4(0xee),'zh-cn':a145_0x5993c4(0xee),'zh_cn':a145_0x5993c4(0xee),'en':a145_0x5993c4(0xd8),'en-us':a145_0x5993c4(0xd8),'en_us':a145_0x5993c4(0xd8)};export function normalizeLocale(_0x1af449){const _0x543293=a145_0x5993c4;if(!_0x1af449)return null;return LOCALE_MAP[_0x1af449[_0x543293(0xcd)]()]??null;}
|
package/lib/constant/cdn.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a146_0x1edbbf=a146_0x2cd9;(function(_0xba3037,_0x355de2){const _0x27250f=a146_0x2cd9,_0x5a1d18=_0xba3037();while(!![]){try{const _0x3ca3c7=parseInt(_0x27250f(0x81))/0x1+-parseInt(_0x27250f(0x7a))/0x2+parseInt(_0x27250f(0x7d))/0x3+-parseInt(_0x27250f(0x7f))/0x4*(-parseInt(_0x27250f(0x7b))/0x5)+-parseInt(_0x27250f(0x7c))/0x6+parseInt(_0x27250f(0x78))/0x7*(parseInt(_0x27250f(0x80))/0x8)+-parseInt(_0x27250f(0x79))/0x9*(parseInt(_0x27250f(0x77))/0xa);if(_0x3ca3c7===_0x355de2)break;else _0x5a1d18['push'](_0x5a1d18['shift']());}catch(_0x43fcbe){_0x5a1d18['push'](_0x5a1d18['shift']());}}}(a146_0x2df9,0x8cd34));function a146_0x2df9(){const _0x3ccad8=['16yFwUoA','934009WJuIYI','7528090ctsmAt','100240UFkbyq','18FCIsoi','965104jGtXcb','8375QueNVC','934188pkjnFl','2294292BsuywI','https://g.lovrabet.com/dist/rabetbase-cli/config/index.json','2372KTkJTZ'];a146_0x2df9=function(){return _0x3ccad8;};return a146_0x2df9();}function a146_0x2cd9(_0x16a5a7,_0x1994be){_0x16a5a7=_0x16a5a7-0x77;const _0x2df9d2=a146_0x2df9();let _0x2cd946=_0x2df9d2[_0x16a5a7];return _0x2cd946;}export const CLI_VERSION_POLICY_URL=a146_0x1edbbf(0x7e);
|
package/lib/constant/cli.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a147_0x12327b=a147_0x416c;function a147_0x92a9(){const _0x5a7b2d=['Select\x20app\x20profile\x20by\x20name','schemas','Read\x20value\x20from\x20environment\x20variable','Code\x20filter','db-id','382267WGegAQ','40xFGVeG','fromEnv','556970svkIlU','production\x20|\x20daily','Type\x20filter','Use\x20remote','verbose','Rabetbase\x20CLI','dbid','target','sql','Expected\x20affected\x20count','app','DB\x20ID','3154854PWckBL','Environment','Page\x20number','enableBffSave','non-interactive','name','36UZrEXa','expected-count','15qxNMjd','Description','dry-run','Force\x20non-interactive\x20mode\x20(CI)','skipImports','Reveal\x20sensitive\x20value','@lovrabet/rabetbase-cli','page','sqlname','env','value','Confirm\x20destructive\x20action','skip-imports','Apply\x20to\x20all','stdin','string','type','help','appcode','pagesize','Output\x20path','global','Page\x20size','Use\x20project\x20config\x20scope','Tags','Watch\x20mode','sqlcode','format','Title','Use\x20global\x20config\x20scope','file','output','keyword','confirm','Config\x20key','title','1474711uXfFwv','dryRun','2GYxdjb','map','Preview\x20operation\x20without\x20executing','datasetcode','all','functionNode','description','<code>','tags','Skip\x20confirmation\x20for\x20high-risk\x20writes','<name>','meowKey','Override\x20appcode','code','Description\x20file','JSON\x20params','json\x20|\x20pretty\x20|\x20compress','<expr>','reveal','Keyword\x20filter','enable-bff-save','Name','expectedCount','Target\x20path','force','yes','Function\x20node','remote','Alias\x20for\x20--non-interactive','SQL\x20name','clear','22510719DMBOlx','project','Operation\x20type','fromEntries','Dataset\x20code','boolean','Schemas','Enable\x20BFF\x20save','35116TsHZgp','key','4181675rNNoSK','SQL\x20code','from-env','sql-name'];a147_0x92a9=function(){return _0x5a7b2d;};return a147_0x92a9();}(function(_0x51b9b4,_0x16d5c5){const _0x52753f=a147_0x416c,_0x322b15=_0x51b9b4();while(!![]){try{const _0x13622e=-parseInt(_0x52753f(0x194))/0x1*(-parseInt(_0x52753f(0x162))/0x2)+-parseInt(_0x52753f(0x13c))/0x3*(-parseInt(_0x52753f(0x189))/0x4)+parseInt(_0x52753f(0x18b))/0x5+parseInt(_0x52753f(0x1a3))/0x6+parseInt(_0x52753f(0x160))/0x7*(parseInt(_0x52753f(0x195))/0x8)+parseInt(_0x52753f(0x1a9))/0x9*(-parseInt(_0x52753f(0x197))/0xa)+-parseInt(_0x52753f(0x181))/0xb;if(_0x13622e===_0x16d5c5)break;else _0x322b15['push'](_0x322b15['shift']());}catch(_0xa213e9){_0x322b15['push'](_0x322b15['shift']());}}}(a147_0x92a9,0x8bc26));function a147_0x416c(_0x5664c4,_0x4ca3c2){_0x5664c4=_0x5664c4-0x13b;const _0x92a9df=a147_0x92a9();let _0x416c41=_0x92a9df[_0x5664c4];return _0x416c41;}export const CLI_BIN_NAME='rabetbase';export const CLI_DISPLAY_NAME=a147_0x12327b(0x19c);export const NPM_PACKAGE_NAME=a147_0x12327b(0x142);export const GLOBAL_FLAGS=[{'name':a147_0x12327b(0x14e),'meowKey':a147_0x12327b(0x14e),'type':'string','description':a147_0x12327b(0x16e),'hint':a147_0x12327b(0x169)},{'name':a147_0x12327b(0x1a1),'meowKey':a147_0x12327b(0x1a1),'type':a147_0x12327b(0x14b),'description':a147_0x12327b(0x18f),'hint':a147_0x12327b(0x16c)},{'name':a147_0x12327b(0x145),'meowKey':a147_0x12327b(0x145),'type':a147_0x12327b(0x14b),'description':a147_0x12327b(0x1a4),'hint':a147_0x12327b(0x198)},{'name':a147_0x12327b(0x157),'meowKey':a147_0x12327b(0x157),'type':'string','description':'Output\x20format','hint':a147_0x12327b(0x172)},{'name':'jq','meowKey':'jq','type':'string','description':'Filter\x20JSON\x20output\x20(JQ_PATH\x20>\x20bundled\x20jq\x20>\x20PATH;\x20use\x20with\x20--format\x20json\x20or\x20compress)','hint':a147_0x12327b(0x173)},{'name':a147_0x12327b(0x13e),'meowKey':a147_0x12327b(0x161),'type':a147_0x12327b(0x186),'description':a147_0x12327b(0x164)},{'name':a147_0x12327b(0x17b),'meowKey':a147_0x12327b(0x17b),'type':a147_0x12327b(0x186),'description':a147_0x12327b(0x16b)},{'name':a147_0x12327b(0x1a7),'meowKey':'nonInteractive','type':'boolean','description':a147_0x12327b(0x13f)},{'name':a147_0x12327b(0x151),'meowKey':a147_0x12327b(0x151),'type':'boolean','description':a147_0x12327b(0x159)},{'name':a147_0x12327b(0x182),'meowKey':a147_0x12327b(0x182),'type':a147_0x12327b(0x186),'description':a147_0x12327b(0x153)},{'name':'ci','meowKey':'ci','type':a147_0x12327b(0x186),'description':a147_0x12327b(0x17e),'hidden':!![]},{'name':'help','meowKey':a147_0x12327b(0x14d),'type':a147_0x12327b(0x186),'description':'Show\x20help'},{'name':a147_0x12327b(0x1a8),'meowKey':'name','type':a147_0x12327b(0x14b),'description':a147_0x12327b(0x177),'hidden':!![]},{'name':a147_0x12327b(0x15f),'meowKey':a147_0x12327b(0x15f),'type':a147_0x12327b(0x14b),'description':a147_0x12327b(0x158),'hidden':!![]},{'name':a147_0x12327b(0x180),'meowKey':a147_0x12327b(0x180),'type':'boolean','description':'Clear','hidden':!![]},{'name':'watch','meowKey':'watch','type':a147_0x12327b(0x186),'description':a147_0x12327b(0x155),'hidden':!![]},{'name':a147_0x12327b(0x15b),'meowKey':'output','type':a147_0x12327b(0x14b),'description':a147_0x12327b(0x150),'hidden':!![]},{'name':'params','meowKey':'params','type':a147_0x12327b(0x14b),'description':a147_0x12327b(0x171),'hidden':!![]},{'name':a147_0x12327b(0x165),'meowKey':a147_0x12327b(0x165),'type':'string','description':a147_0x12327b(0x185),'hidden':!![]},{'name':a147_0x12327b(0x166),'meowKey':a147_0x12327b(0x166),'type':a147_0x12327b(0x186),'description':a147_0x12327b(0x149),'hidden':!![]},{'name':a147_0x12327b(0x176),'meowKey':a147_0x12327b(0x1a6),'type':a147_0x12327b(0x186),'description':a147_0x12327b(0x188),'hidden':!![]},{'name':'id','meowKey':'id','type':'string','description':'Record\x20ID','hidden':!![]},{'name':a147_0x12327b(0x14c),'meowKey':'type','type':'string','description':a147_0x12327b(0x199),'hidden':!![]},{'name':a147_0x12327b(0x15a),'meowKey':a147_0x12327b(0x15a),'type':a147_0x12327b(0x14b),'description':'File\x20path','hidden':!![]},{'name':'sqlcode','meowKey':a147_0x12327b(0x156),'type':a147_0x12327b(0x14b),'description':a147_0x12327b(0x18c),'hidden':!![]},{'name':a147_0x12327b(0x18e),'meowKey':'sqlName','type':a147_0x12327b(0x14b),'description':a147_0x12327b(0x17f),'hidden':!![]},{'name':a147_0x12327b(0x144),'meowKey':a147_0x12327b(0x144),'type':a147_0x12327b(0x14b),'description':a147_0x12327b(0x17f),'hidden':!![]},{'name':a147_0x12327b(0x193),'meowKey':'dbId','type':a147_0x12327b(0x14b),'description':a147_0x12327b(0x1a2),'hidden':!![]},{'name':a147_0x12327b(0x19d),'meowKey':'dbid','type':a147_0x12327b(0x14b),'description':a147_0x12327b(0x1a2),'hidden':!![]},{'name':a147_0x12327b(0x168),'meowKey':a147_0x12327b(0x168),'type':a147_0x12327b(0x14b),'description':a147_0x12327b(0x13d),'hidden':!![]},{'name':'description-file','meowKey':'descriptionFile','type':'string','description':a147_0x12327b(0x170),'hidden':!![]},{'name':a147_0x12327b(0x143),'meowKey':a147_0x12327b(0x143),'type':a147_0x12327b(0x14b),'description':a147_0x12327b(0x1a5),'hidden':!![]},{'name':a147_0x12327b(0x14f),'meowKey':a147_0x12327b(0x14f),'type':a147_0x12327b(0x14b),'description':a147_0x12327b(0x152),'hidden':!![]},{'name':a147_0x12327b(0x15c),'meowKey':'keyword','type':'string','description':a147_0x12327b(0x175),'hidden':!![]},{'name':a147_0x12327b(0x16f),'meowKey':a147_0x12327b(0x16f),'type':a147_0x12327b(0x14b),'description':a147_0x12327b(0x192),'hidden':!![]},{'name':a147_0x12327b(0x19f),'meowKey':'sql','type':'string','description':'SQL\x20string','hidden':!![]},{'name':a147_0x12327b(0x190),'meowKey':'schemas','type':a147_0x12327b(0x14b),'description':a147_0x12327b(0x187),'hidden':!![]},{'name':'operation','meowKey':'operation','type':'string','description':a147_0x12327b(0x183),'hidden':!![]},{'name':'target','meowKey':a147_0x12327b(0x19e),'type':a147_0x12327b(0x14b),'description':a147_0x12327b(0x179),'hidden':!![]},{'name':a147_0x12327b(0x148),'meowKey':a147_0x12327b(0x140),'type':a147_0x12327b(0x186),'description':'Skip\x20import\x20generation','hidden':!![]},{'name':a147_0x12327b(0x18a),'meowKey':'key','type':a147_0x12327b(0x14b),'description':a147_0x12327b(0x15e),'hidden':!![]},{'name':'value','meowKey':a147_0x12327b(0x146),'type':a147_0x12327b(0x14b),'description':'Config\x20value','hidden':!![]},{'name':'tags','meowKey':a147_0x12327b(0x16a),'type':a147_0x12327b(0x14b),'description':a147_0x12327b(0x154),'hidden':!![]},{'name':'stdin','meowKey':a147_0x12327b(0x14a),'type':'boolean','description':'Read\x20value\x20from\x20stdin','hidden':!![]},{'name':a147_0x12327b(0x18d),'meowKey':a147_0x12327b(0x196),'type':a147_0x12327b(0x14b),'description':a147_0x12327b(0x191),'hidden':!![]},{'name':a147_0x12327b(0x174),'meowKey':a147_0x12327b(0x174),'type':'boolean','description':a147_0x12327b(0x141),'hidden':!![]},{'name':a147_0x12327b(0x17a),'meowKey':a147_0x12327b(0x17a),'type':'boolean','description':'Force\x20overwrite','hidden':!![]},{'name':a147_0x12327b(0x15d),'meowKey':a147_0x12327b(0x15d),'type':a147_0x12327b(0x186),'description':a147_0x12327b(0x147),'hidden':!![]},{'name':a147_0x12327b(0x17d),'meowKey':a147_0x12327b(0x17d),'type':a147_0x12327b(0x186),'description':a147_0x12327b(0x19a),'hidden':!![]},{'name':a147_0x12327b(0x19b),'meowKey':a147_0x12327b(0x19b),'type':a147_0x12327b(0x186),'description':'Verbose\x20output','hidden':!![]},{'name':a147_0x12327b(0x13b),'meowKey':a147_0x12327b(0x178),'type':a147_0x12327b(0x14b),'description':a147_0x12327b(0x1a0),'hidden':!![]},{'name':'operation-type','meowKey':'operationType','type':'string','description':a147_0x12327b(0x183),'hidden':!![]},{'name':'function-node','meowKey':a147_0x12327b(0x167),'type':a147_0x12327b(0x14b),'description':a147_0x12327b(0x17c),'hidden':!![]}];export const PIPELINE_FLAG_NAMES=new Set([a147_0x12327b(0x14e),a147_0x12327b(0x1a1),a147_0x12327b(0x145),a147_0x12327b(0x157),'jq',a147_0x12327b(0x13e),a147_0x12327b(0x17b),'non-interactive','ci']);export function buildMeowFlags(){const _0x4de759=a147_0x12327b;return Object[_0x4de759(0x184)](GLOBAL_FLAGS[_0x4de759(0x163)](_0x5d0e71=>[_0x5d0e71[_0x4de759(0x16d)],{'type':_0x5d0e71[_0x4de759(0x14c)]}]));}
|
package/lib/constant/defaults.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a148_0x5901c6=a148_0x3fd7;(function(_0x3b8e71,_0x30a3d0){const _0x121583=a148_0x3fd7,_0x1ced7b=_0x3b8e71();while(!![]){try{const _0x3626fb=-parseInt(_0x121583(0x94))/0x1+parseInt(_0x121583(0x8f))/0x2*(-parseInt(_0x121583(0x8e))/0x3)+-parseInt(_0x121583(0x93))/0x4+parseInt(_0x121583(0x98))/0x5*(-parseInt(_0x121583(0x97))/0x6)+-parseInt(_0x121583(0x96))/0x7+parseInt(_0x121583(0x99))/0x8+-parseInt(_0x121583(0x91))/0x9*(-parseInt(_0x121583(0x90))/0xa);if(_0x3626fb===_0x30a3d0)break;else _0x1ced7b['push'](_0x1ced7b['shift']());}catch(_0x357ac1){_0x1ced7b['push'](_0x1ced7b['shift']());}}}(a148_0x142b,0xd629a));function a148_0x142b(){const _0x34f1d2=['high-risk-write','2919492ergVki','99665UdVXih','compress','2676653hxzXMq','1597638nobNvn','5eysTQn','12975288PyevUI','30lCWiVA','31910NmvuPl','79030STgEcB','1017bcpwga'];a148_0x142b=function(){return _0x34f1d2;};return a148_0x142b();}import{DEFAULT_API_DIR}from'../constant/paths.js';function a148_0x3fd7(_0x375d02,_0x276441){_0x375d02=_0x375d02-0x8e;const _0x142b7e=a148_0x142b();let _0x3fd74a=_0x142b7e[_0x375d02];return _0x3fd74a;}export const DEFAULT_CONFIG_VALUES={'env':'production','format':a148_0x5901c6(0x95),'locale':'en-US','riskLevel':a148_0x5901c6(0x92),'apiDir':DEFAULT_API_DIR};export const DEFAULT_COMMAND_OUTPUT_FORMAT=a148_0x5901c6(0x95);
|
package/lib/constant/domain.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a149_0x270a(_0x2e6f83,_0xc15755){_0x2e6f83=_0x2e6f83-0xf2;const _0x2a5db9=a149_0x2a5d();let _0x270a03=_0x2a5db9[_0x2e6f83];return _0x270a03;}const a149_0x218fdc=a149_0x270a;(function(_0x3c41e9,_0x3981f1){const _0x481ddf=a149_0x270a,_0x24aa1d=_0x3c41e9();while(!![]){try{const _0x9c10=-parseInt(_0x481ddf(0xf2))/0x1+-parseInt(_0x481ddf(0x100))/0x2+parseInt(_0x481ddf(0xfb))/0x3+parseInt(_0x481ddf(0x102))/0x4+parseInt(_0x481ddf(0xfe))/0x5+-parseInt(_0x481ddf(0xf5))/0x6+-parseInt(_0x481ddf(0xff))/0x7*(parseInt(_0x481ddf(0xfd))/0x8);if(_0x9c10===_0x3981f1)break;else _0x24aa1d['push'](_0x24aa1d['shift']());}catch(_0x2cc73c){_0x24aa1d['push'](_0x24aa1d['shift']());}}}(a149_0x2a5d,0xba515));import{getEnv,isProduction}from'../constant/env.js';let customApiDomain,customUserDomain,customRuntimeDomain;export function initDomains(_0x4a0aef){const _0x3ee7ba=a149_0x270a;customApiDomain=_0x4a0aef?.['apiDomain'],customUserDomain=_0x4a0aef?.[_0x3ee7ba(0xf8)],customRuntimeDomain=_0x4a0aef?.[_0x3ee7ba(0xf3)];}export const getUserDomain=()=>customUserDomain||(isProduction(getEnv())?a149_0x218fdc(0xfc):a149_0x218fdc(0xf6));export const getApiDomain=()=>customApiDomain||(isProduction(getEnv())?a149_0x218fdc(0xf9):a149_0x218fdc(0xfa));function a149_0x2a5d(){const _0x2175d3=['https://api.lovrabet.com','https://daily-api.lovrabet.com','2937654ZwFYYj','https://user.lovrabet.com','23104aNdbqd','6838220owLzRL','1687RiNSPs','1157618SuKvPq','https://runtime.lovrabet.com','5166608PDHeKl','702202yccLPN','runtimeDomain','/web-app/app/','5390028aQwOKM','https://user-daily.lovrabet.com','https://daily-runtime.lovrabet.com','userDomain'];a149_0x2a5d=function(){return _0x2175d3;};return a149_0x2a5d();}export const getRuntimeDomain=()=>customRuntimeDomain||(isProduction(getEnv())?a149_0x218fdc(0x101):a149_0x218fdc(0xf7));export const getAppDomain=()=>isProduction(getEnv())?'https://app.lovrabet.com':'https://daily.lovrabet.com';export const getAppBaseUrl=_0x26ad33=>{const _0x569c8b=a149_0x218fdc,_0x56d99f=encodeURIComponent(_0x26ad33['trim']());return isProduction(getEnv())?getAppDomain()+'/app/'+_0x56d99f:getAppDomain()+_0x569c8b(0xf4)+_0x56d99f;};
|