@lovrabet/rabetbase-cli 2.1.7-beta.3 → 2.1.7-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/api-doc.js +1 -1
- package/lib/api/fetch-model-list.js +1 -1
- package/lib/api/generate-api-file.js +1 -1
- package/lib/auth/auth-server-ui.js +1 -1
- package/lib/auth/auth-server.js +1 -1
- package/lib/auth/constant.js +1 -1
- package/lib/auth/get-cookie.js +1 -1
- package/lib/auth/get-session-user.js +1 -1
- package/lib/auth/is-session-valid.js +1 -1
- package/lib/auth/login-success-html.js +1 -1
- package/lib/auth/logout.js +1 -1
- package/lib/cli-flags.js +1 -1
- package/lib/cli.js +1 -1
- package/lib/commands/api/generate.js +1 -1
- package/lib/commands/api/index.js +1 -1
- package/lib/commands/api/list.js +1 -1
- package/lib/commands/api/pull.js +1 -1
- package/lib/commands/api/shared.js +1 -1
- package/lib/commands/app/add.js +1 -1
- package/lib/commands/app/discover.js +1 -1
- package/lib/commands/app/index.js +1 -1
- package/lib/commands/app/list.js +1 -1
- package/lib/commands/app/remove.js +1 -1
- package/lib/commands/app/shared.js +1 -1
- package/lib/commands/app/use.js +1 -1
- package/lib/commands/auth/index.js +1 -1
- package/lib/commands/bff/create.js +1 -1
- package/lib/commands/bff/delete.js +1 -1
- package/lib/commands/bff/detail.js +1 -1
- package/lib/commands/bff/index.js +1 -1
- package/lib/commands/bff/list.js +1 -1
- package/lib/commands/bff/pull.js +1 -1
- package/lib/commands/bff/push.js +1 -1
- package/lib/commands/bff/status.js +1 -1
- package/lib/commands/cli-update.js +1 -1
- package/lib/commands/codegen/index.js +1 -1
- package/lib/commands/codegen/sdk.js +1 -1
- package/lib/commands/codegen/sql.js +1 -1
- package/lib/commands/common/app-selector.js +1 -1
- package/lib/commands/common/flags.js +1 -1
- package/lib/commands/common/validate.js +1 -1
- package/lib/commands/config/get.js +1 -1
- package/lib/commands/config/index.js +1 -1
- package/lib/commands/config/list.js +1 -1
- package/lib/commands/config/set.js +1 -1
- package/lib/commands/config/shared.js +1 -1
- package/lib/commands/data/filter.js +1 -1
- package/lib/commands/data/getOne.js +1 -1
- package/lib/commands/data/index.js +1 -1
- package/lib/commands/data/shared.js +1 -1
- package/lib/commands/dataset/delete.js +1 -1
- package/lib/commands/dataset/detail.js +1 -1
- package/lib/commands/dataset/index.js +1 -1
- package/lib/commands/dataset/link-create.js +1 -1
- package/lib/commands/dataset/link-delete.js +1 -1
- package/lib/commands/dataset/link-shared.js +1 -1
- package/lib/commands/dataset/link-update.js +1 -1
- package/lib/commands/dataset/links.js +1 -1
- package/lib/commands/dataset/list.js +1 -1
- package/lib/commands/dataset/operations.js +1 -1
- package/lib/commands/db/analyze-cancel.js +1 -1
- package/lib/commands/db/analyze-start.js +1 -1
- package/lib/commands/db/analyze-status.js +1 -1
- package/lib/commands/db/create.js +1 -1
- package/lib/commands/db/delete.js +1 -1
- package/lib/commands/db/detail.js +1 -1
- package/lib/commands/db/diff.js +1 -1
- package/lib/commands/db/index.js +1 -1
- package/lib/commands/db/list.js +1 -1
- package/lib/commands/db/shared.js +1 -1
- package/lib/commands/db/tables.js +1 -1
- package/lib/commands/db/test.js +1 -1
- package/lib/commands/db/update.js +1 -1
- package/lib/commands/doctor.js +1 -1
- package/lib/commands/init/index.js +1 -1
- package/lib/commands/issue/index.js +1 -1
- package/lib/commands/issue/report.js +1 -1
- package/lib/commands/logs/index.js +1 -1
- package/lib/commands/menu/index.js +1 -1
- package/lib/commands/menu/shared/compare-table.js +1 -1
- package/lib/commands/menu/shared/index.js +1 -1
- package/lib/commands/menu/shared/inquirer.js +1 -1
- package/lib/commands/menu/shared/local-pages.js +1 -1
- package/lib/commands/menu/shared/logic.js +1 -1
- package/lib/commands/menu/shared/service.js +1 -1
- package/lib/commands/menu/shared/sync-core.js +1 -1
- package/lib/commands/menu/shared/update-core.js +1 -1
- package/lib/commands/menu/shared/valid-url.js +1 -1
- package/lib/commands/menu/sync.js +1 -1
- package/lib/commands/menu/update.js +1 -1
- package/lib/commands/page/generate-start.js +1 -1
- package/lib/commands/page/generate-status.js +1 -1
- package/lib/commands/page/index.js +1 -1
- package/lib/commands/page/pull.js +1 -1
- package/lib/commands/page/push.js +1 -1
- package/lib/commands/page/shared.js +1 -1
- package/lib/commands/page/standard-page-status.js +1 -1
- package/lib/commands/page/sync.js +1 -1
- package/lib/commands/project/create/enhanced-guided-create.js +1 -1
- package/lib/commands/project/create/format-elapsed.js +1 -1
- package/lib/commands/project/create/main.js +1 -1
- package/lib/commands/project/create/non-interactive.js +1 -1
- package/lib/commands/project/create/project-template-path.js +1 -1
- package/lib/commands/project/create/use-copy-project-template.js +1 -1
- package/lib/commands/project/create/use-format-code.js +1 -1
- package/lib/commands/project/create/use-install-dependencies.js +1 -1
- package/lib/commands/project/index.js +1 -1
- package/lib/commands/project/init.js +1 -1
- package/lib/commands/project/upgrade.js +1 -1
- package/lib/commands/registry.js +1 -1
- package/lib/commands/run/index.js +1 -1
- package/lib/commands/schema.js +1 -1
- package/lib/commands/skill/index.js +1 -1
- package/lib/commands/sql/create.js +1 -1
- package/lib/commands/sql/delete.js +1 -1
- package/lib/commands/sql/detail.js +1 -1
- package/lib/commands/sql/exec.js +1 -1
- package/lib/commands/sql/index.js +1 -1
- package/lib/commands/sql/list.js +1 -1
- package/lib/commands/sql/pull.js +1 -1
- package/lib/commands/sql/push.js +1 -1
- package/lib/commands/sql/save.js +1 -1
- package/lib/commands/sql/shared.js +1 -1
- package/lib/commands/sql/status.js +1 -1
- package/lib/commands/sql/validate.js +1 -1
- package/lib/config/schema.js +1 -1
- package/lib/constant/cdn.js +1 -1
- package/lib/constant/cli.js +1 -1
- package/lib/constant/defaults.js +1 -1
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/constant/output.js +1 -1
- package/lib/constant/paths.js +1 -1
- package/lib/constant/risk.js +1 -1
- package/lib/context.js +1 -1
- package/lib/core/alias-resolver.js +1 -1
- package/lib/core/api-client.js +1 -1
- package/lib/core/bff/config.js +1 -1
- package/lib/core/bff/file-system.js +1 -1
- package/lib/core/bff/hash.js +1 -1
- package/lib/core/bff/lock.js +1 -1
- package/lib/core/bff/utils.js +1 -1
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/page/file-system.js +1 -1
- package/lib/core/page/hash.js +1 -1
- package/lib/core/page/lock.js +1 -1
- package/lib/core/sql-sync/config.js +1 -1
- package/lib/core/sql-sync/file-system.js +1 -1
- package/lib/core/sql-sync/hash.js +1 -1
- package/lib/core/sql-sync/lock.js +1 -1
- package/lib/core/sql-sync/utils.js +1 -1
- package/lib/core/sql-validator.js +1 -1
- package/lib/errors.js +1 -1
- package/lib/framework/build-all-flags.js +1 -1
- package/lib/framework/flags.js +1 -1
- package/lib/framework/help.js +1 -1
- package/lib/framework/index.js +1 -1
- package/lib/framework/output.js +1 -1
- package/lib/framework/response.js +1 -1
- package/lib/framework/runner-alias.js +1 -1
- package/lib/framework/runner.js +1 -1
- package/lib/framework/schema-export.js +1 -1
- package/lib/framework/types.js +1 -1
- package/lib/generated/build-info.js +1 -1
- package/lib/help.js +1 -1
- package/lib/skills/main.js +1 -1
- package/lib/skills/npx-skills-add.js +1 -1
- package/lib/telemetry/cli-command-trace.js +1 -1
- package/lib/telemetry/cli-help-trace.js +1 -1
- package/lib/telemetry/ensure-cli-otel-config.js +1 -1
- package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
- package/lib/telemetry/send-cli-trace-log.js +1 -1
- package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
- package/lib/utils/ai_config.js +1 -1
- package/lib/utils/apply-jq-filter.js +1 -1
- package/lib/utils/cdn-config.js +1 -1
- package/lib/utils/check-sdk-version.js +1 -1
- package/lib/utils/cli-version-check.js +1 -1
- package/lib/utils/cli-version-policy.js +1 -1
- package/lib/utils/config.js +1 -1
- package/lib/utils/copy-directory.js +1 -1
- package/lib/utils/entity-with-id.js +1 -1
- package/lib/utils/file-utils.js +1 -1
- package/lib/utils/guides-cdn.js +1 -1
- package/lib/utils/http-client.js +1 -1
- package/lib/utils/is-non-interactive.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/params.js +1 -1
- package/lib/utils/platform.js +1 -1
- package/lib/utils/rules-cdn.js +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.js +1 -1
- package/lib/utils/version.js +1 -1
- package/lib/utils/with-active-cookie.js +1 -1
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +1 -1
package/lib/commands/sql/push.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a121_0x2e0ece=a121_0x12d7;(function(_0x45d804,_0x3dbe72){const _0xbe75c=a121_0x12d7,_0x2f1038=_0x45d804();while(!![]){try{const _0x105183=-parseInt(_0xbe75c(0x87))/0x1*(-parseInt(_0xbe75c(0xa7))/0x2)+parseInt(_0xbe75c(0xa8))/0x3+parseInt(_0xbe75c(0x8c))/0x4*(-parseInt(_0xbe75c(0x67))/0x5)+-parseInt(_0xbe75c(0xa4))/0x6*(-parseInt(_0xbe75c(0x78))/0x7)+-parseInt(_0xbe75c(0x80))/0x8*(-parseInt(_0xbe75c(0x89))/0x9)+-parseInt(_0xbe75c(0x96))/0xa*(-parseInt(_0xbe75c(0xa5))/0xb)+parseInt(_0xbe75c(0x68))/0xc*(-parseInt(_0xbe75c(0x97))/0xd);if(_0x105183===_0x3dbe72)break;else _0x2f1038['push'](_0x2f1038['shift']());}catch(_0x2d7fb8){_0x2f1038['push'](_0x2f1038['shift']());}}}(a121_0x1b0f,0xb048e));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';function a121_0x12d7(_0x1d28a7,_0x288940){_0x1d28a7=_0x1d28a7-0x67;const _0x1b0f48=a121_0x1b0f();let _0x12d755=_0x1b0f48[_0x1d28a7];return _0x12d755;}import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';async function getTargetSqlQueries(_0x42908b,_0x5ade2b,_0x1d0ca1){const _0x227cf1=a121_0x12d7,_0x4b800d=await scanLocalSqlQueries(_0x42908b),_0x314212=new Map();for(const _0x1e8703 of _0x4b800d){if(_0x1d0ca1&&_0x1e8703[_0x227cf1(0x9d)]!==_0x1d0ca1)continue;const _0x3853e8=_0x314212[_0x227cf1(0x75)](_0x1e8703[_0x227cf1(0x9d)])??[];_0x3853e8[_0x227cf1(0x72)](_0x1e8703),_0x314212[_0x227cf1(0xa0)](_0x1e8703[_0x227cf1(0x9d)],_0x3853e8);}if(_0x1d0ca1&&!_0x314212[_0x227cf1(0x84)](_0x1d0ca1))throw CliErrors[_0x227cf1(0x6b)](_0x227cf1(0x6e)+_0x1d0ca1);const _0x44c1ce=[];for(const [_0x4fc31b,_0x505768]of _0x314212['entries']()){if(_0x505768[_0x227cf1(0x70)]===0x1){_0x44c1ce[_0x227cf1(0x72)](_0x505768[0x0]);continue;}const _0x5d2f90=_0x5ade2b[_0x227cf1(0x7e)][_0x4fc31b],_0x1ea271=_0x5d2f90?.['path'],_0x46426c=_0x1ea271?_0x505768[_0x227cf1(0x73)](_0x6ad6b5=>_0x6ad6b5[_0x227cf1(0x6c)]!==_0x1ea271):_0x505768;if(_0x5d2f90&&_0x46426c['length']===0x1){_0x44c1ce[_0x227cf1(0x72)](_0x46426c[0x0]);continue;}throw CliErrors['validation'](_0x227cf1(0x8a)+_0x4fc31b+_0x227cf1(0x9b));}return _0x44c1ce;}export const sqlPush={'service':'sql','command':a121_0x2e0ece(0x72),'description':a121_0x2e0ece(0x99),'risk':'high-risk-write','flags':[SQLCODE_FLAG_OPTIONAL,{'name':'force','type':'boolean','description':a121_0x2e0ece(0x7f)}],async 'dryRun'(_0x4d1490){const _0x22d890=a121_0x2e0ece,_0x8e1bde=loadSqlProjectConfig(_0x4d1490[_0x22d890(0x86)]),_0x1621ab=await readSqlLockFile(_0x8e1bde['lockFilePath']),{appLock:_0x2735b5}=ensureSqlLockScope(_0x1621ab??createEmptySqlLock(),_0x4d1490[_0x22d890(0x86)],_0x8e1bde['sqlRoot'],'push'),_0xbc754b=await getTargetSqlQueries(_0x8e1bde,_0x2735b5,_0x4d1490[_0x22d890(0x9f)](_0x22d890(0x7a))||undefined),_0x305548=[];for(const _0x7ea8a7 of _0xbc754b){const _0x3e3ed1=await computeSqlFileHash(_0x7ea8a7[_0x22d890(0x98)]),_0x12b5a6=_0x2735b5[_0x22d890(0x7e)][_0x7ea8a7[_0x22d890(0x9d)]],_0xd65402=!!_0x12b5a6&&(_0x12b5a6[_0x22d890(0x85)]!==_0x7ea8a7[_0x22d890(0x6c)]||!!_0x7ea8a7['sqlName']&&_0x12b5a6['sqlName']!==_0x7ea8a7['sqlName']);if(!_0x4d1490['bool'](_0x22d890(0xaa))&&_0x12b5a6&&_0x12b5a6[_0x22d890(0xa3)]===_0x3e3ed1&&!_0xd65402)continue;_0x305548['push'](_0x7ea8a7['sqlCode']);}return{'method':_0x22d890(0x6d),'url':'/smartapi/custom/updateUserCustomSql','body':{'sqlCodes':_0x305548,'appCode':_0x4d1490['appCode']},'description':_0x22d890(0x7d)+_0x305548[_0x22d890(0x70)]+'\x20SQL\x20file(s)'};},async 'execute'(_0x1c380d){const _0x1a3886=a121_0x2e0ece,_0x422000=loadSqlProjectConfig(_0x1c380d[_0x1a3886(0x86)]),_0x36a3a3=await readSqlLockFile(_0x422000[_0x1a3886(0x9c)]),{lockData:_0x5325ee,appLock:_0x87d590}=ensureSqlLockScope(_0x36a3a3??createEmptySqlLock(),_0x1c380d[_0x1a3886(0x86)],_0x422000[_0x1a3886(0x7c)],_0x1a3886(0x72)),_0x2bcad7=await getTargetSqlQueries(_0x422000,_0x87d590,_0x1c380d[_0x1a3886(0x9f)]('sqlcode')||undefined);if(_0x2bcad7[_0x1a3886(0x70)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x1a3886(0xa6)};const _0x51024b=[],_0x334de2=[],_0x18f232=[];for(const _0x5d6cb7 of _0x2bcad7){const _0x17fe0e=_0x87d590[_0x1a3886(0x7e)][_0x5d6cb7[_0x1a3886(0x9d)]];if(!_0x17fe0e){_0x18f232['push']({'sqlCode':_0x5d6cb7['sqlCode'],'error':_0x1a3886(0xa9)});continue;}try{const _0x431323=await computeSqlFileHash(_0x5d6cb7['filePath']),_0x5074d2=_0x17fe0e[_0x1a3886(0x85)]!==_0x5d6cb7['relativePath']||!!_0x5d6cb7[_0x1a3886(0x76)]&&_0x17fe0e[_0x1a3886(0x76)]!==_0x5d6cb7['sqlName'];if(!_0x1c380d[_0x1a3886(0x71)](_0x1a3886(0xaa))&&_0x17fe0e[_0x1a3886(0xa3)]===_0x431323&&!_0x5074d2){_0x334de2['push']({'sqlCode':_0x5d6cb7[_0x1a3886(0x9d)],'reason':'unchanged'});continue;}if(_0x17fe0e[_0x1a3886(0x7b)]==null){_0x18f232[_0x1a3886(0x72)]({'sqlCode':_0x5d6cb7[_0x1a3886(0x9d)],'error':_0x1a3886(0x9e)});continue;}const _0x2f3ba9=await readFile(_0x5d6cb7['filePath'],_0x1a3886(0x95)),_0x5d5af5=stripLocalSqlMetadata(_0x2f3ba9,_0x5d6cb7[_0x1a3886(0x6f)]),_0x5ac0ef=_0x5d6cb7[_0x1a3886(0x76)]||_0x17fe0e[_0x1a3886(0x76)],_0x20f641=await resolveTargetDbBinding(_0x1c380d[_0x1a3886(0x86)],_0x5d6cb7,_0x17fe0e),_0x315447=await updateSqlQuery({'id':_0x17fe0e['remoteId'],'appCode':_0x1c380d[_0x1a3886(0x86)],'sqlCode':_0x5d6cb7[_0x1a3886(0x9d)],'sqlName':_0x5ac0ef,'dbId':_0x20f641['dbId'],'version':_0x17fe0e['version'],'sqlContent':_0x5d5af5,'sqlConfig':_0x17fe0e[_0x1a3886(0x8e)]??undefined}),_0x447a83=_0x315447[_0x1a3886(0x93)]?await getDbName(_0x1c380d[_0x1a3886(0x86)],Number(_0x315447[_0x1a3886(0x93)]))['catch'](()=>_0x20f641[_0x1a3886(0x74)]):_0x20f641[_0x1a3886(0x74)];_0x87d590[_0x1a3886(0x7e)][_0x5d6cb7[_0x1a3886(0x9d)]]={...buildSqlLockEntry(_0x315447,_0x5d5af5,_0x431323,{'dbName':_0x447a83}),'path':_0x5d6cb7['relativePath'],'mode':_0x17fe0e[_0x1a3886(0x6f)]},await archivePreviousSqlFileIfNeeded(_0x422000,_0x17fe0e[_0x1a3886(0x85)],_0x5d6cb7['relativePath']),_0x51024b[_0x1a3886(0x72)]({'sqlCode':_0x5d6cb7[_0x1a3886(0x9d)],'remoteId':_0x17fe0e[_0x1a3886(0x83)]});}catch(_0x10ed0b){_0x18f232[_0x1a3886(0x72)]({'sqlCode':_0x5d6cb7[_0x1a3886(0x9d)],'error':_0x10ed0b instanceof Error?_0x10ed0b[_0x1a3886(0x77)]:String(_0x10ed0b)});}}return _0x87d590[_0x1a3886(0x92)]=new Date()[_0x1a3886(0x8d)](),await writeSqlLockFile(_0x422000[_0x1a3886(0x9c)],_0x5325ee),{'ok':_0x18f232[_0x1a3886(0x70)]===0x0,'data':{'pushed':_0x51024b,'skipped':_0x334de2,'failed':_0x18f232},'message':'Push\x20complete:\x20'+_0x51024b[_0x1a3886(0x70)]+'\x20pushed,\x20'+_0x334de2[_0x1a3886(0x70)]+_0x1a3886(0x88)+_0x18f232[_0x1a3886(0x70)]+_0x1a3886(0x91)};}};async function archivePreviousSqlFileIfNeeded(_0x3982bb,_0x29667d,_0x5e4b33){const _0x5ec4b5=a121_0x2e0ece;if(!_0x29667d||_0x29667d===_0x5e4b33)return;const _0x558bb7=join(_0x3982bb[_0x5ec4b5(0x6a)],_0x29667d);if(!await fileExists(_0x558bb7))return;const _0x10ca4c=await moveToTrash(_0x3982bb[_0x5ec4b5(0x79)],_0x3982bb[_0x5ec4b5(0x82)],_0x558bb7);await cleanupEmptyDirectories(dirname(_0x558bb7),_0x3982bb['sqlRootDir']),void _0x10ca4c;}async function moveToTrash(_0x29c8d9,_0x503ad7,_0x7a2255){const _0x388fcd=a121_0x2e0ece,_0x545052=new Date()['toISOString']()[_0x388fcd(0x8f)](/[:.]/g,'-'),_0x5b0056=relative(_0x29c8d9,_0x7a2255),_0x11d19f=join(_0x503ad7,_0x545052,_0x5b0056);return await mkdir(dirname(_0x11d19f),{'recursive':!![]}),await rename(_0x7a2255,_0x11d19f),_0x11d19f;}async function cleanupEmptyDirectories(_0x467531,_0x39a853){const _0x4fe855=a121_0x2e0ece;let _0x333e10=resolve(_0x467531);const _0x169bd1=resolve(_0x39a853);while(_0x333e10[_0x4fe855(0x81)](''+_0x169bd1+sep)||_0x333e10===_0x169bd1){if(_0x333e10===_0x169bd1)return;try{const _0xc215a4=await readdir(_0x333e10);if(_0xc215a4[_0x4fe855(0x70)]>0x0)return;await rmdir(_0x333e10);}catch{return;}_0x333e10=dirname(_0x333e10);}}function a121_0x1b0f(){const _0x3577db=['version','sqlRoot','Would\x20push\x20','sqls','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','28984NQOXfG','startsWith','trashDir','remoteId','has','path','appCode','3jMONgQ','\x20skipped,\x20','2880OusOHb','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','map','8jfaQDo','toISOString','sqlConfig','replace','\x22\x20for\x20sqlCode\x20','\x20failed','lastSync','dbId','catch','utf8','1405710ILfarL','6456710wjfpUT','filePath','Push\x20local\x20SQL\x20files\x20to\x20remote','join','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','lockFilePath','sqlCode','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','str','set','isFinite','No\x20database\x20matches\x20local\x20directory\x20\x22','hash','894RVnnZk','22pxzWPu','No\x20local\x20SQL\x20files\x20found.','716122Keqezn','1802163ySlBoQ','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','force','2160235uWlXgB','48TucMma','exec','sqlRootDir','validation','relativePath','POST','Local\x20SQL\x20not\x20found:\x20','mode','length','bool','push','filter','dbName','get','sqlName','message','21490sXfyYu','projectRoot','sqlcode'];a121_0x1b0f=function(){return _0x3577db;};return a121_0x1b0f();}async function resolveTargetDbBinding(_0x54ffab,_0x5390f4,_0x4a6d19){const _0x334f75=a121_0x2e0ece,_0x379fc7=_0x5390f4['dbDirectory'];if(!_0x379fc7)return{'dbId':_0x4a6d19[_0x334f75(0x93)],'dbName':_0x4a6d19[_0x334f75(0x74)]};const _0xeff393=buildDbDirectoryName(_0x4a6d19[_0x334f75(0x74)],_0x4a6d19[_0x334f75(0x93)]);if(_0x379fc7===_0xeff393)return{'dbId':_0x4a6d19[_0x334f75(0x93)],'dbName':_0x4a6d19[_0x334f75(0x74)]};const _0xa40703=parseExplicitDbDirectory(_0x379fc7);if(_0xa40703!=null)return{'dbId':_0xa40703,'dbName':await getDbName(_0x54ffab,_0xa40703)[_0x334f75(0x94)](()=>undefined)};const _0xa08413=await listDatabases(_0x54ffab),_0x174cca=_0xa08413[_0x334f75(0x73)](_0x545899=>buildDbDirectoryName(_0x545899['dbName'],_0x545899[_0x334f75(0x93)])===_0x379fc7);if(_0x174cca[_0x334f75(0x70)]===0x1)return{'dbId':_0x174cca[0x0]['dbId'],'dbName':_0x174cca[0x0][_0x334f75(0x74)]};if(_0x174cca[_0x334f75(0x70)]===0x0)throw CliErrors['validation'](_0x334f75(0xa2)+_0x379fc7+_0x334f75(0x90)+_0x5390f4['sqlCode']+'.');const _0x41f5d9=_0x174cca[_0x334f75(0x8b)](_0x24aaf9=>_0x24aaf9['dbName']+'\x20('+_0x24aaf9[_0x334f75(0x93)]+')')[_0x334f75(0x9a)](',\x20');throw CliErrors['validation']('Local\x20directory\x20\x22'+_0x379fc7+'\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20'+_0x5390f4[_0x334f75(0x9d)]+':\x20'+_0x41f5d9);}function parseExplicitDbDirectory(_0x50afdd){const _0x241307=a121_0x2e0ece,_0xfef79f=/^db-(\d+)$/[_0x241307(0x69)](_0x50afdd);if(!_0xfef79f)return null;const _0x5a651c=Number(_0xfef79f[0x1]);return Number[_0x241307(0xa1)](_0x5a651c)&&_0x5a651c>0x0?_0x5a651c:null;}
|
|
1
|
+
function a121_0x2d79(_0x3d881f,_0x5cdb9a){_0x3d881f=_0x3d881f-0x16e;const _0x165d74=a121_0x165d();let _0x2d7918=_0x165d74[_0x3d881f];return _0x2d7918;}const a121_0xebf95d=a121_0x2d79;(function(_0x724708,_0x27a25c){const _0x913c68=a121_0x2d79,_0x2bdeac=_0x724708();while(!![]){try{const _0x339fe0=-parseInt(_0x913c68(0x193))/0x1*(-parseInt(_0x913c68(0x1ae))/0x2)+parseInt(_0x913c68(0x19c))/0x3*(parseInt(_0x913c68(0x192))/0x4)+-parseInt(_0x913c68(0x182))/0x5*(parseInt(_0x913c68(0x190))/0x6)+-parseInt(_0x913c68(0x1a2))/0x7+parseInt(_0x913c68(0x171))/0x8+parseInt(_0x913c68(0x198))/0x9*(-parseInt(_0x913c68(0x16f))/0xa)+parseInt(_0x913c68(0x17b))/0xb;if(_0x339fe0===_0x27a25c)break;else _0x2bdeac['push'](_0x2bdeac['shift']());}catch(_0x282493){_0x2bdeac['push'](_0x2bdeac['shift']());}}}(a121_0x165d,0x3a405));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';function a121_0x165d(){const _0x4eed3e=['startsWith','str','mode','utf8','sqlRoot','sqls','appCode','Would\x20push\x20','18DXvnFS','isFinite','1856SUlvRB','51pQSHLW','\x20SQL\x20file(s)','version','lastSync','lockFilePath','9ZGOzNO','get','bool','exec','1293gPIWuU','dbName','trashDir','relativePath','No\x20database\x20matches\x20local\x20directory\x20\x22','path','909146SqFSzI','boolean','message','remoteId','sqlCode','\x20skipped,\x20','map','\x20pushed,\x20','sqlName','replace','filePath','catch','8336tsjSNF','validation','projectRoot','\x22\x20for\x20sqlCode\x20','2240130pEIgEe','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','2496432DDHfKo','toISOString','sql','unchanged','force','high-risk-write','Local\x20directory\x20\x22','No\x20local\x20SQL\x20files\x20found.','length','entries','908776AtRDrq','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','push','dbId','sqlRootDir','Push\x20local\x20SQL\x20files\x20to\x20remote','dbDirectory','357890ZwKYGZ','hash','filter','sqlcode','join','/smartapi/custom/updateUserCustomSql'];a121_0x165d=function(){return _0x4eed3e;};return a121_0x165d();}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(_0x496cd9,_0x3d18d5,_0x10d629){const _0x4c538e=a121_0x2d79,_0x48daf2=await scanLocalSqlQueries(_0x496cd9),_0x9f2646=new Map();for(const _0x22d195 of _0x48daf2){if(_0x10d629&&_0x22d195[_0x4c538e(0x1a6)]!==_0x10d629)continue;const _0x1350bd=_0x9f2646[_0x4c538e(0x199)](_0x22d195['sqlCode'])??[];_0x1350bd[_0x4c538e(0x17d)](_0x22d195),_0x9f2646['set'](_0x22d195['sqlCode'],_0x1350bd);}if(_0x10d629&&!_0x9f2646['has'](_0x10d629))throw CliErrors[_0x4c538e(0x1af)]('Local\x20SQL\x20not\x20found:\x20'+_0x10d629);const _0x2789c2=[];for(const [_0x4e01e3,_0x33f579]of _0x9f2646[_0x4c538e(0x17a)]()){if(_0x33f579[_0x4c538e(0x179)]===0x1){_0x2789c2[_0x4c538e(0x17d)](_0x33f579[0x0]);continue;}const _0x38efdb=_0x3d18d5['sqls'][_0x4e01e3],_0x3dfed0=_0x38efdb?.[_0x4c538e(0x1a1)],_0x336bf7=_0x3dfed0?_0x33f579[_0x4c538e(0x184)](_0x252634=>_0x252634[_0x4c538e(0x19f)]!==_0x3dfed0):_0x33f579;if(_0x38efdb&&_0x336bf7[_0x4c538e(0x179)]===0x1){_0x2789c2[_0x4c538e(0x17d)](_0x336bf7[0x0]);continue;}throw CliErrors[_0x4c538e(0x1af)]('Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20'+_0x4e01e3+'.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.');}return _0x2789c2;}export const sqlPush={'service':a121_0xebf95d(0x173),'command':a121_0xebf95d(0x17d),'description':a121_0xebf95d(0x180),'risk':a121_0xebf95d(0x176),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a121_0xebf95d(0x175),'type':a121_0xebf95d(0x1a3),'description':'Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock'}],async 'dryRun'(_0x5025e9){const _0x8aefb9=a121_0xebf95d,_0x2faf93=loadSqlProjectConfig(_0x5025e9[_0x8aefb9(0x18e)]),_0x162424=await readSqlLockFile(_0x2faf93[_0x8aefb9(0x197)]),{appLock:_0x211342}=ensureSqlLockScope(_0x162424??createEmptySqlLock(),_0x5025e9['appCode'],_0x2faf93[_0x8aefb9(0x18c)],_0x8aefb9(0x17d)),_0x23b129=await getTargetSqlQueries(_0x2faf93,_0x211342,_0x5025e9['str'](_0x8aefb9(0x185))||undefined),_0xd78b6=[];for(const _0x5098ac of _0x23b129){const _0x77252c=await computeSqlFileHash(_0x5098ac['filePath']),_0x5d7a94=_0x211342[_0x8aefb9(0x18d)][_0x5098ac[_0x8aefb9(0x1a6)]],_0x2668fe=!!_0x5d7a94&&(_0x5d7a94[_0x8aefb9(0x1a1)]!==_0x5098ac[_0x8aefb9(0x19f)]||!!_0x5098ac['sqlName']&&_0x5d7a94[_0x8aefb9(0x1aa)]!==_0x5098ac[_0x8aefb9(0x1aa)]);if(!_0x5025e9[_0x8aefb9(0x19a)](_0x8aefb9(0x175))&&_0x5d7a94&&_0x5d7a94[_0x8aefb9(0x183)]===_0x77252c&&!_0x2668fe)continue;_0xd78b6['push'](_0x5098ac[_0x8aefb9(0x1a6)]);}return{'method':'POST','url':_0x8aefb9(0x187),'body':{'sqlCodes':_0xd78b6,'appCode':_0x5025e9[_0x8aefb9(0x18e)]},'description':_0x8aefb9(0x18f)+_0xd78b6[_0x8aefb9(0x179)]+_0x8aefb9(0x194)};},async 'execute'(_0x296466){const _0x105166=a121_0xebf95d,_0x424666=loadSqlProjectConfig(_0x296466[_0x105166(0x18e)]),_0x110b0c=await readSqlLockFile(_0x424666[_0x105166(0x197)]),{lockData:_0x42e166,appLock:_0x2064ca}=ensureSqlLockScope(_0x110b0c??createEmptySqlLock(),_0x296466[_0x105166(0x18e)],_0x424666[_0x105166(0x18c)],_0x105166(0x17d)),_0x45144c=await getTargetSqlQueries(_0x424666,_0x2064ca,_0x296466[_0x105166(0x189)](_0x105166(0x185))||undefined);if(_0x45144c[_0x105166(0x179)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x105166(0x178)};const _0x2118f2=[],_0x35fcd2=[],_0x2cecbb=[];for(const _0x40e193 of _0x45144c){const _0x11ff2b=_0x2064ca['sqls'][_0x40e193[_0x105166(0x1a6)]];if(!_0x11ff2b){_0x2cecbb['push']({'sqlCode':_0x40e193[_0x105166(0x1a6)],'error':_0x105166(0x170)});continue;}try{const _0x402cc2=await computeSqlFileHash(_0x40e193[_0x105166(0x1ac)]),_0x309b43=_0x11ff2b[_0x105166(0x1a1)]!==_0x40e193[_0x105166(0x19f)]||!!_0x40e193[_0x105166(0x1aa)]&&_0x11ff2b[_0x105166(0x1aa)]!==_0x40e193[_0x105166(0x1aa)];if(!_0x296466[_0x105166(0x19a)](_0x105166(0x175))&&_0x11ff2b['hash']===_0x402cc2&&!_0x309b43){_0x35fcd2['push']({'sqlCode':_0x40e193[_0x105166(0x1a6)],'reason':_0x105166(0x174)});continue;}if(_0x11ff2b[_0x105166(0x195)]==null){_0x2cecbb['push']({'sqlCode':_0x40e193[_0x105166(0x1a6)],'error':'missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first'});continue;}const _0x134ac8=await readFile(_0x40e193[_0x105166(0x1ac)],_0x105166(0x18b)),_0x146fab=stripLocalSqlMetadata(_0x134ac8,_0x40e193[_0x105166(0x18a)]),_0x45a45e=_0x40e193['sqlName']||_0x11ff2b[_0x105166(0x1aa)],_0x5662ce=await resolveTargetDbBinding(_0x296466[_0x105166(0x18e)],_0x40e193,_0x11ff2b),_0x4a3b89=await updateSqlQuery({'id':_0x11ff2b[_0x105166(0x1a5)],'appCode':_0x296466[_0x105166(0x18e)],'sqlCode':_0x40e193[_0x105166(0x1a6)],'sqlName':_0x45a45e,'dbId':_0x5662ce[_0x105166(0x17e)],'version':_0x11ff2b[_0x105166(0x195)],'sqlContent':_0x146fab,'sqlConfig':_0x11ff2b['sqlConfig']??undefined}),_0x284abd=_0x4a3b89[_0x105166(0x17e)]?await getDbName(_0x296466[_0x105166(0x18e)],Number(_0x4a3b89['dbId']))[_0x105166(0x1ad)](()=>_0x5662ce[_0x105166(0x19d)]):_0x5662ce[_0x105166(0x19d)];_0x2064ca[_0x105166(0x18d)][_0x40e193[_0x105166(0x1a6)]]={...buildSqlLockEntry(_0x4a3b89,_0x146fab,_0x402cc2,{'dbName':_0x284abd}),'path':_0x40e193['relativePath'],'mode':_0x11ff2b['mode']},await archivePreviousSqlFileIfNeeded(_0x424666,_0x11ff2b[_0x105166(0x1a1)],_0x40e193[_0x105166(0x19f)]),_0x2118f2[_0x105166(0x17d)]({'sqlCode':_0x40e193['sqlCode'],'remoteId':_0x11ff2b['remoteId']});}catch(_0x5f1e28){_0x2cecbb[_0x105166(0x17d)]({'sqlCode':_0x40e193[_0x105166(0x1a6)],'error':_0x5f1e28 instanceof Error?_0x5f1e28[_0x105166(0x1a4)]:String(_0x5f1e28)});}}return _0x2064ca[_0x105166(0x196)]=new Date()[_0x105166(0x172)](),await writeSqlLockFile(_0x424666[_0x105166(0x197)],_0x42e166),{'ok':_0x2cecbb[_0x105166(0x179)]===0x0,'data':{'pushed':_0x2118f2,'skipped':_0x35fcd2,'failed':_0x2cecbb},'message':'Push\x20complete:\x20'+_0x2118f2[_0x105166(0x179)]+_0x105166(0x1a9)+_0x35fcd2[_0x105166(0x179)]+_0x105166(0x1a7)+_0x2cecbb[_0x105166(0x179)]+'\x20failed'};}};async function archivePreviousSqlFileIfNeeded(_0x1238df,_0x330419,_0x317109){const _0x22816b=a121_0xebf95d;if(!_0x330419||_0x330419===_0x317109)return;const _0x63dcf=join(_0x1238df[_0x22816b(0x17f)],_0x330419);if(!await fileExists(_0x63dcf))return;const _0x3e9a0c=await moveToTrash(_0x1238df[_0x22816b(0x1b0)],_0x1238df[_0x22816b(0x19e)],_0x63dcf);await cleanupEmptyDirectories(dirname(_0x63dcf),_0x1238df[_0x22816b(0x17f)]),void _0x3e9a0c;}async function moveToTrash(_0x507730,_0x50c44a,_0x578c26){const _0xcf9ed4=a121_0xebf95d,_0xa8ea7=new Date()[_0xcf9ed4(0x172)]()[_0xcf9ed4(0x1ab)](/[:.]/g,'-'),_0x39a661=relative(_0x507730,_0x578c26),_0x57a53f=join(_0x50c44a,_0xa8ea7,_0x39a661);return await mkdir(dirname(_0x57a53f),{'recursive':!![]}),await rename(_0x578c26,_0x57a53f),_0x57a53f;}async function cleanupEmptyDirectories(_0x280b17,_0x28ca3d){const _0x297deb=a121_0xebf95d;let _0x26eef4=resolve(_0x280b17);const _0x4833fd=resolve(_0x28ca3d);while(_0x26eef4[_0x297deb(0x188)](''+_0x4833fd+sep)||_0x26eef4===_0x4833fd){if(_0x26eef4===_0x4833fd)return;try{const _0x264cd9=await readdir(_0x26eef4);if(_0x264cd9[_0x297deb(0x179)]>0x0)return;await rmdir(_0x26eef4);}catch{return;}_0x26eef4=dirname(_0x26eef4);}}async function resolveTargetDbBinding(_0x1a9cb8,_0x4e6a2f,_0x179bd7){const _0x512d2b=a121_0xebf95d,_0x46fcb6=_0x4e6a2f[_0x512d2b(0x181)];if(!_0x46fcb6)return{'dbId':_0x179bd7[_0x512d2b(0x17e)],'dbName':_0x179bd7[_0x512d2b(0x19d)]};const _0x392dc8=buildDbDirectoryName(_0x179bd7[_0x512d2b(0x19d)],_0x179bd7[_0x512d2b(0x17e)]);if(_0x46fcb6===_0x392dc8)return{'dbId':_0x179bd7['dbId'],'dbName':_0x179bd7[_0x512d2b(0x19d)]};const _0x44c27b=parseExplicitDbDirectory(_0x46fcb6);if(_0x44c27b!=null)return{'dbId':_0x44c27b,'dbName':await getDbName(_0x1a9cb8,_0x44c27b)[_0x512d2b(0x1ad)](()=>undefined)};const _0x111cde=await listDatabases(_0x1a9cb8),_0xb36465=_0x111cde[_0x512d2b(0x184)](_0xd0750f=>buildDbDirectoryName(_0xd0750f[_0x512d2b(0x19d)],_0xd0750f[_0x512d2b(0x17e)])===_0x46fcb6);if(_0xb36465[_0x512d2b(0x179)]===0x1)return{'dbId':_0xb36465[0x0][_0x512d2b(0x17e)],'dbName':_0xb36465[0x0]['dbName']};if(_0xb36465[_0x512d2b(0x179)]===0x0)throw CliErrors['validation'](_0x512d2b(0x1a0)+_0x46fcb6+_0x512d2b(0x16e)+_0x4e6a2f[_0x512d2b(0x1a6)]+'.');const _0x41da72=_0xb36465[_0x512d2b(0x1a8)](_0x2db8fd=>_0x2db8fd[_0x512d2b(0x19d)]+'\x20('+_0x2db8fd[_0x512d2b(0x17e)]+')')[_0x512d2b(0x186)](',\x20');throw CliErrors['validation'](_0x512d2b(0x177)+_0x46fcb6+_0x512d2b(0x17c)+_0x4e6a2f[_0x512d2b(0x1a6)]+':\x20'+_0x41da72);}function parseExplicitDbDirectory(_0x51215a){const _0x149066=a121_0xebf95d,_0x38a987=/^db-(\d+)$/[_0x149066(0x19b)](_0x51215a);if(!_0x38a987)return null;const _0x2a7e8c=Number(_0x38a987[0x1]);return Number[_0x149066(0x191)](_0x2a7e8c)&&_0x2a7e8c>0x0?_0x2a7e8c:null;}
|
package/lib/commands/sql/save.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a122_0x436b(_0x525192,_0x164806){_0x525192=_0x525192-0x186;const _0x2da2f4=a122_0x2da2();let _0x436b12=_0x2da2f4[_0x525192];return _0x436b12;}const a122_0xb4fd12=a122_0x436b;(function(_0x3b56e1,_0x2ccc05){const _0x49c2d6=a122_0x436b,_0x30c501=_0x3b56e1();while(!![]){try{const _0x3e2000=-parseInt(_0x49c2d6(0x186))/0x1+-parseInt(_0x49c2d6(0x18d))/0x2*(parseInt(_0x49c2d6(0x187))/0x3)+parseInt(_0x49c2d6(0x193))/0x4*(parseInt(_0x49c2d6(0x188))/0x5)+-parseInt(_0x49c2d6(0x19c))/0x6*(-parseInt(_0x49c2d6(0x190))/0x7)+-parseInt(_0x49c2d6(0x18f))/0x8*(parseInt(_0x49c2d6(0x191))/0x9)+-parseInt(_0x49c2d6(0x18a))/0xa+parseInt(_0x49c2d6(0x198))/0xb;if(_0x3e2000===_0x2ccc05)break;else _0x30c501['push'](_0x30c501['shift']());}catch(_0xf0cff){_0x30c501['push'](_0x30c501['shift']());}}}(a122_0x2da2,0xde4ff));import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';const SQL_SAVE_DEPRECATED_HINT=[a122_0xb4fd12(0x189),'Create\x20new\x20SQL\x20with\x20`rabetbase\x20sql\x20create\x20--name\x20<name>\x20--db-id\x20<id>\x20--mode\x20sql|mybatisXml`.','Update\x20existing\x20SQL\x20by\x20editing\x20the\x20synced\x20file\x20under\x20`.rabetbase/sql/<appCode>/<dbName|db-<id>>/`\x20and\x20then\x20running\x20`rabetbase\x20sql\x20push\x20--sqlcode\x20<code>\x20--yes`.'][a122_0xb4fd12(0x18e)]('\x0a');function a122_0x2da2(){const _0x437613=['sql','SQL\x20query\x20display\x20name','Target\x20database\x20—\x20accepts\x20a\x20numeric\x20ID\x20or\x20database\x20name\x20(e.g.\x20ecommerce_db)','150oekZih','Path\x20to\x20the\x20SQL\x20file','1364183VHHxdv','3urcrdC','431835giBpdw','`rabetbase\x20sql\x20save`\x20has\x20been\x20deprecated.','5377630LTJwEi','file','sqlname','2936972echoMW','join','8DWBPYS','490217UbnOlo','1788399THGysS','Query\x20description','4FDRnaZ','string','validation','write','description','29068512FLuTfv'];a122_0x2da2=function(){return _0x437613;};return a122_0x2da2();}export const sqlSave={'service':a122_0xb4fd12(0x199),'command':'save','description':'Deprecated:\x20use\x20sql\x20create\x20to\x20create\x20and\x20sql\x20push\x20to\x20update','risk':a122_0xb4fd12(0x196),'requiresAuth':![],'requiresAppCode':![],'flags':[{'name':a122_0xb4fd12(0x18b),'type':'string','required':!![],'description':a122_0xb4fd12(0x19d)},SQLCODE_FLAG_OPTIONAL,{'name':a122_0xb4fd12(0x18c),'type':a122_0xb4fd12(0x194),'description':a122_0xb4fd12(0x19a)},{'name':'db','type':a122_0xb4fd12(0x194),'description':a122_0xb4fd12(0x19b)},{'name':a122_0xb4fd12(0x197),'type':'string','description':a122_0xb4fd12(0x192)}],async 'validate'(){const _0xfc1b6b=a122_0xb4fd12;throw CliErrors[_0xfc1b6b(0x195)](SQL_SAVE_DEPRECATED_HINT);},async 'execute'(){const _0x4233ba=a122_0xb4fd12;throw CliErrors[_0x4233ba(0x195)](SQL_SAVE_DEPRECATED_HINT);}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a123_0x251f66=a123_0x184e;(function(_0x2ca091,_0x2a634e){const _0x551ad5=a123_0x184e,_0xcf8e3c=_0x2ca091();while(!![]){try{const _0x255b21=parseInt(_0x551ad5(0x159))/0x1*(-parseInt(_0x551ad5(0x152))/0x2)+-parseInt(_0x551ad5(0x166))/0x3+-parseInt(_0x551ad5(0x160))/0x4+parseInt(_0x551ad5(0x155))/0x5+parseInt(_0x551ad5(0x147))/0x6*(parseInt(_0x551ad5(0x15d))/0x7)+parseInt(_0x551ad5(0x167))/0x8*(-parseInt(_0x551ad5(0x14f))/0x9)+parseInt(_0x551ad5(0x15a))/0xa;if(_0x255b21===_0x2a634e)break;else _0xcf8e3c['push'](_0xcf8e3c['shift']());}catch(_0x208a9a){_0xcf8e3c['push'](_0xcf8e3c['shift']());}}}(a123_0x1a36,0xb03f4));import{createInterface}from'node:readline';import{join}from'node:path';import{buildDefaultSqlFileName,buildSqlRelativePath,detectSqlMode}from'../../core/sql-sync/utils.js';export const SQL_LOCAL_REL_DIR=a123_0x251f66(0x15f);export function buildSqlLockEntry(_0x561064,_0x4d7837,_0x531067,_0x5bb0ee){const _0x1acb91=a123_0x251f66,_0x2cfb4c=detectSqlMode(_0x4d7837);return{'path':buildSqlRelativePath(_0x561064[_0x1acb91(0x145)],_0x561064[_0x1acb91(0x14d)],_0x5bb0ee?.['dbName'],_0x2cfb4c,_0x561064[_0x1acb91(0x14e)]),'hash':_0x531067,'remoteId':_0x561064['id'],'version':_0x561064['version'],'dbId':Number(_0x561064[_0x1acb91(0x14e)]),'dbName':_0x5bb0ee?.[_0x1acb91(0x14b)],'sqlName':_0x561064['sqlName'],'sqlConfig':_0x561064[_0x1acb91(0x169)]??undefined,'mode':_0x2cfb4c};}export function cloneSqlLockData(_0x4697a0){const _0x5cf40f=a123_0x251f66;return{'apps':Object[_0x5cf40f(0x151)](Object[_0x5cf40f(0x15c)](_0x4697a0['apps'])[_0x5cf40f(0x15b)](([_0x1f6aed,_0x57148d])=>[_0x1f6aed,{'sqlRoot':_0x57148d['sqlRoot'],'lastSync':_0x57148d[_0x5cf40f(0x165)],'sqls':{..._0x57148d['sqls']}}]))};}export function ensureRemoteSqlContent(_0x53f9b7){const _0x565661=a123_0x251f66;return _0x53f9b7[_0x565661(0x154)]??'';}export function buildLocalSqlFileContent(_0x1054f5,_0x5e049d,_0x15fa18){const _0x25fa85=a123_0x251f66,_0x423349=_0x15fa18?.[_0x25fa85(0x164)]??detectSqlMode(_0x5e049d),_0x2bdadf=stripLocalSqlMetadata(_0x5e049d,_0x423349)[_0x25fa85(0x158)](),_0x25d9b8=[...buildMetadataHeaderLines({'sqlCode':_0x1054f5['sqlCode'],'sqlName':_0x1054f5[_0x25fa85(0x14d)],'dbId':_0x1054f5[_0x25fa85(0x14e)],'dbName':_0x15fa18?.[_0x25fa85(0x14b)],'mode':_0x423349,'syncedAt':_0x15fa18?.[_0x25fa85(0x161)],'description':_0x15fa18?.[_0x25fa85(0x150)]},_0x423349),'',_0x2bdadf],_0x8dd8c3=_0x25d9b8[_0x25fa85(0x156)]('\x0a');return _0x8dd8c3[_0x25fa85(0x15e)]('\x0a')?_0x8dd8c3:_0x8dd8c3+'\x0a';}function a123_0x1a36(){const _0x149ccb=['trim','473174nXArRO','14446460mYoQYY','map','entries','4740673vGBTGR','endsWith','.rabetbase/sql','1022504ogrMJW','syncedAt','stdin','mybatisXml','mode','lastSync','1738698AvgrNp','8384304fbFTYK','filter','sqlConfig','path','includes','sqlCode','yes','6HqPzWl','\x20-->','close','split','dbName','replace','sqlName','dbId','9oOYyQn','description','fromEntries','2HwSARa','test','sqlContent','4782135THzuhE','join','length'];a123_0x1a36=function(){return _0x149ccb;};return a123_0x1a36();}export function stripLocalSqlMetadata(_0x1941d8,_0x485b84){const _0x452c66=a123_0x251f66,_0xf5ef8c=_0x1941d8[_0x452c66(0x14c)](/\r\n/g,'\x0a')[_0x452c66(0x14a)]('\x0a'),_0x473ea9=[];let _0x3b4bcd=0x0;if(_0x485b84===_0x452c66(0x163))while(_0x3b4bcd<_0xf5ef8c[_0x452c66(0x157)]){const _0x7d25e=_0xf5ef8c[_0x3b4bcd]??'';if(/^\s*<!--\s*@lovrabet\./[_0x452c66(0x153)](_0x7d25e)){_0x3b4bcd++;continue;}if(_0x7d25e[_0x452c66(0x158)]()===''&&_0x3b4bcd>0x0){_0x3b4bcd++;continue;}break;}else while(_0x3b4bcd<_0xf5ef8c[_0x452c66(0x157)]){const _0x366c1d=_0xf5ef8c[_0x3b4bcd]??'';if(/^\s*--\s*@lovrabet\./['test'](_0x366c1d)){_0x3b4bcd++;continue;}if(_0x366c1d[_0x452c66(0x158)]()===''&&_0x3b4bcd>0x0){_0x3b4bcd++;continue;}break;}for(;_0x3b4bcd<_0xf5ef8c[_0x452c66(0x157)];_0x3b4bcd++){_0x473ea9['push'](_0xf5ef8c[_0x3b4bcd]);}return _0x473ea9[_0x452c66(0x156)]('\x0a')['trimStart']();}export function resolveSqlMode(_0x50e74b,_0x44b9cb){const _0x49ace4=a123_0x251f66;if(_0x44b9cb?.[_0x49ace4(0x164)])return _0x44b9cb[_0x49ace4(0x164)];return detectSqlMode(_0x50e74b);}function a123_0x184e(_0x3cdd9d,_0x17e690){_0x3cdd9d=_0x3cdd9d-0x144;const _0x1a3674=a123_0x1a36();let _0x184ea2=_0x1a3674[_0x3cdd9d];return _0x184ea2;}export function resolveSqlFileName(_0x22397e,_0x59a52a,_0xd98ca9){const _0x115719=a123_0x251f66;if(_0xd98ca9?.[_0x115719(0x16a)])return _0xd98ca9['path'];if(_0xd98ca9?.[_0x115719(0x14d)]||_0xd98ca9?.[_0x115719(0x14b)])return buildSqlRelativePath(_0x22397e,_0xd98ca9?.[_0x115719(0x14d)],_0xd98ca9?.[_0x115719(0x14b)],resolveSqlMode(_0x59a52a,_0xd98ca9),_0xd98ca9?.['dbId']);return buildDefaultSqlFileName(_0x22397e,resolveSqlMode(_0x59a52a,_0xd98ca9));}export function resolveSqlLocalDir(_0x45b97c,_0x56e316){return join(_0x45b97c,SQL_LOCAL_REL_DIR,_0x56e316);}export async function confirmForceOverwrite(_0x2c38b9){const _0x12bc0c=a123_0x251f66,_0x5c97b4=createInterface({'input':process[_0x12bc0c(0x162)],'output':process['stderr']}),_0x37aea4=await new Promise(_0x309199=>{_0x5c97b4['question'](_0x2c38b9+'\x20[y/N]\x20',_0x309199);});return _0x5c97b4[_0x12bc0c(0x149)](),['y',_0x12bc0c(0x146)][_0x12bc0c(0x144)](_0x37aea4[_0x12bc0c(0x158)]()['toLowerCase']());}export function findSqlLockScope(_0x4e5014,_0x3a7cc3){return _0x4e5014['apps'][_0x3a7cc3];}function buildMetadataHeaderLines(_0x5e6b5d,_0x3f910c){const _0x3c7e9c=a123_0x251f66,_0x41c254=[['sqlCode',_0x5e6b5d[_0x3c7e9c(0x145)]],['sqlName',_0x5e6b5d['sqlName']],['dbId',_0x5e6b5d[_0x3c7e9c(0x14e)]],[_0x3c7e9c(0x14b),_0x5e6b5d[_0x3c7e9c(0x14b)]],[_0x3c7e9c(0x164),_0x5e6b5d[_0x3c7e9c(0x164)]],['syncedAt',_0x5e6b5d[_0x3c7e9c(0x161)]],[_0x3c7e9c(0x150),_0x5e6b5d[_0x3c7e9c(0x150)]]];if(_0x3f910c===_0x3c7e9c(0x163))return _0x41c254[_0x3c7e9c(0x168)](([,_0x5489fe])=>_0x5489fe!==undefined&&_0x5489fe!==null&&String(_0x5489fe)[_0x3c7e9c(0x158)]()!=='')[_0x3c7e9c(0x15b)](([_0xfce921,_0x1688c8])=>'<!--\x20@lovrabet.'+_0xfce921+':\x20'+String(_0x1688c8)+_0x3c7e9c(0x148));return _0x41c254['filter'](([,_0x5497b2])=>_0x5497b2!==undefined&&_0x5497b2!==null&&String(_0x5497b2)['trim']()!=='')[_0x3c7e9c(0x15b)](([_0x38681a,_0x5c906a])=>'--\x20@lovrabet.'+_0x38681a+':\x20'+String(_0x5c906a));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a124_0x4c3cdc=a124_0x48e2;(function(_0x251607,_0x4aadee){const _0x237931=a124_0x48e2,_0x242577=_0x251607();while(!![]){try{const _0x44dd56=-parseInt(_0x237931(0xcb))/0x1+-parseInt(_0x237931(0xd6))/0x2*(-parseInt(_0x237931(0xc7))/0x3)+-parseInt(_0x237931(0xe2))/0x4+-parseInt(_0x237931(0xcf))/0x5+parseInt(_0x237931(0xdb))/0x6*(parseInt(_0x237931(0xe1))/0x7)+parseInt(_0x237931(0xd1))/0x8+-parseInt(_0x237931(0xd8))/0x9*(-parseInt(_0x237931(0xd0))/0xa);if(_0x44dd56===_0x4aadee)break;else _0x242577['push'](_0x242577['shift']());}catch(_0x3f42b4){_0x242577['push'](_0x242577['shift']());}}}(a124_0x3e83,0xe5ad9));function a124_0x48e2(_0x1a7649,_0x2cdcfb){_0x1a7649=_0x1a7649-0xc4;const _0x3e837d=a124_0x3e83();let _0x48e253=_0x3e837d[_0x1a7649];return _0x48e253;}import{listSqlQueries}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile}from'../../core/sql-sync/lock.js';const PAGE_SIZE=0x64;function a124_0x3e83(){const _0x46b79c=['has','appCode','bool','relativePath','933zbbJZc','All\x20SQL\x20queries\x20are\x20in\x20sync.','\x20remote-only','push','358402BbNEPk','length','tableData','remote','3937005dIGuZX','1130AcgSrL','3487424AWvrkT','\x20added,\x20','boolean','lockFilePath','read','7094pLNkXA','sqls','52722gWfUhG','filePath','Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','1842VdOsuP','lockKey','sqlCode','keys','status','map','6433PUGstF','1586272EUeJNH','sqlName'];a124_0x3e83=function(){return _0x46b79c;};return a124_0x3e83();}async function fetchAllSqlCodes(_0x12f4a1){const _0x5b9d60=a124_0x48e2,_0x4b1ffe=[];let _0x2b5d03=0x1;while(!![]){const _0x3527eb=await listSqlQueries(_0x12f4a1,{'currentPage':_0x2b5d03,'pageSize':PAGE_SIZE}),_0xfb64a4=_0x3527eb[_0x5b9d60(0xcd)]??[];_0x4b1ffe[_0x5b9d60(0xca)](..._0xfb64a4['map'](_0x40282f=>_0x40282f[_0x5b9d60(0xdd)]));if(_0xfb64a4['length']===0x0)break;const _0x2cf583=_0x3527eb['paging']?.['totalCount'];if(_0x2cf583!=null?_0x4b1ffe['length']>=_0x2cf583:_0xfb64a4[_0x5b9d60(0xcc)]<PAGE_SIZE)break;_0x2b5d03++;}return _0x4b1ffe;}export const sqlStatus={'service':'sql','command':a124_0x4c3cdc(0xdf),'description':a124_0x4c3cdc(0xda),'risk':a124_0x4c3cdc(0xd5),'flags':[{'name':a124_0x4c3cdc(0xce),'type':a124_0x4c3cdc(0xd3),'description':'Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally'}],async 'execute'(_0x5833bb){const _0x593456=a124_0x4c3cdc,_0x484a94=loadSqlProjectConfig(_0x5833bb[_0x593456(0xc4)]),_0x10e3a6=await readSqlLockFile(_0x484a94[_0x593456(0xd4)]),{appLock:_0x411d2d}=ensureSqlLockScope(_0x10e3a6??createEmptySqlLock(),_0x484a94[_0x593456(0xc4)],_0x484a94['sqlRoot'],_0x593456(0xdf)),_0x420089=await scanLocalSqlQueries(_0x484a94),_0x3721e4=[],_0x3db0ac=[],_0x17240a=[],_0x2e05bc=[],_0x59a597=new Set(_0x420089[_0x593456(0xe0)](_0x5f16a2=>_0x5f16a2[_0x593456(0xdc)]));for(const _0x31d88e of _0x420089){const _0x170335=await computeSqlFileHash(_0x31d88e[_0x593456(0xd9)]),_0x549014=_0x411d2d['sqls'][_0x31d88e['lockKey']],_0x26564a=!!_0x549014&&_0x549014['path']!==_0x31d88e[_0x593456(0xc6)],_0x896ff9=!!_0x549014&&!!_0x31d88e[_0x593456(0xe3)]&&_0x549014['sqlName']!==_0x31d88e[_0x593456(0xe3)];if(!_0x549014)_0x3721e4[_0x593456(0xca)](_0x31d88e[_0x593456(0xdc)]);else _0x549014['hash']!==_0x170335||_0x26564a||_0x896ff9?_0x3db0ac[_0x593456(0xca)](_0x31d88e[_0x593456(0xdc)]):_0x17240a['push'](_0x31d88e[_0x593456(0xdc)]);}for(const _0x24a043 of Object[_0x593456(0xde)](_0x411d2d['sqls'])){!_0x59a597[_0x593456(0xe4)](_0x24a043)&&_0x2e05bc[_0x593456(0xca)](_0x24a043);}const _0x27f603=[];if(_0x5833bb[_0x593456(0xc5)](_0x593456(0xce))){const _0x441ed9=await fetchAllSqlCodes(_0x5833bb['appCode']);for(const _0x32e54c of _0x441ed9){!_0x59a597[_0x593456(0xe4)](_0x32e54c)&&!_0x411d2d[_0x593456(0xd7)][_0x32e54c]&&_0x27f603['push'](_0x32e54c);}}const _0x434766=_0x3721e4[_0x593456(0xcc)]===0x0&&_0x3db0ac[_0x593456(0xcc)]===0x0&&_0x2e05bc[_0x593456(0xcc)]===0x0&&_0x27f603[_0x593456(0xcc)]===0x0;return{'ok':!![],'data':{'added':_0x3721e4,'modified':_0x3db0ac,'missing':_0x2e05bc,'unchanged':_0x17240a,'remoteOnly':_0x27f603},'message':_0x434766?_0x593456(0xc8):_0x3721e4[_0x593456(0xcc)]+_0x593456(0xd2)+_0x3db0ac['length']+'\x20modified,\x20'+_0x2e05bc[_0x593456(0xcc)]+'\x20missing,\x20'+_0x17240a['length']+'\x20unchanged'+(_0x27f603[_0x593456(0xcc)]>0x0?',\x20'+_0x27f603[_0x593456(0xcc)]+_0x593456(0xc9):'')};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a125_0x53d6f4=a125_0x4558;(function(_0x52cb2d,_0x3f9d55){const _0x29c084=a125_0x4558,_0x7fcd70=_0x52cb2d();while(!![]){try{const _0x27ad97=-parseInt(_0x29c084(0x1dc))/0x1+parseInt(_0x29c084(0x1f0))/0x2+parseInt(_0x29c084(0x1f8))/0x3+parseInt(_0x29c084(0x1ef))/0x4+-parseInt(_0x29c084(0x1e5))/0x5*(parseInt(_0x29c084(0x1df))/0x6)+-parseInt(_0x29c084(0x1db))/0x7*(parseInt(_0x29c084(0x1e0))/0x8)+-parseInt(_0x29c084(0x1ec))/0x9*(-parseInt(_0x29c084(0x1eb))/0xa);if(_0x27ad97===_0x3f9d55)break;else _0x7fcd70['push'](_0x7fcd70['shift']());}catch(_0x10f5a2){_0x7fcd70['push'](_0x7fcd70['shift']());}}}(a125_0x4c0b,0x861a1));import{readFileSync,existsSync}from'node:fs';import{resolve}from'node:path';import{validateSql}from'../../core/sql-validator.js';function a125_0x4c0b(){const _0x41e7ab=['message','cwd','Dataset\x20\x22','fields','sqlType','file','toLowerCase','appCode','663397vQLVia','934342HXvcAK','Validate\x20SQL\x20content\x20without\x20saving\x20(type\x20detection,\x20parameter\x20extraction,\x20optional\x20schema\x20check)','isDangerous','27618MrrGTn','88eAkRdH','tableName','dbtableConfig','tables','valid','510eRNnjM','Table\x20\x22','parameters','str','sql','Inline\x20SQL\x20content\x20to\x20validate\x20(alternative\x20to\x20--file)','30wCeXhD','3294558rocHFh','validate','map','3732756mEGGnw','1225596PlrwfB','push','filter','isArray','string','length','get','Comma-separated\x20dataset\x20codes\x20to\x20cross-check\x20table/column\x20names\x20against','1054311FEdwmb','schemas','reason','\x22\x20not\x20found\x20or\x20not\x20accessible','trim','flagMissing','isSelectOnly'];a125_0x4c0b=function(){return _0x41e7ab;};return a125_0x4c0b();}import{getDatasetDetail,listDatasets}from'../../core/api-client.js';function a125_0x4558(_0x325de6,_0x430c5d){_0x325de6=_0x325de6-0x1d1;const _0x4c0b48=a125_0x4c0b();let _0x455817=_0x4c0b48[_0x325de6];return _0x455817;}import{CliErrors}from'../../errors.js';export const sqlValidate={'service':a125_0x53d6f4(0x1e9),'command':a125_0x53d6f4(0x1ed),'description':a125_0x53d6f4(0x1dd),'risk':'read','flags':[{'name':'file','type':a125_0x53d6f4(0x1f4),'description':'Path\x20to\x20the\x20SQL\x20file\x20to\x20validate'},{'name':'sql','type':a125_0x53d6f4(0x1f4),'description':a125_0x53d6f4(0x1ea)},{'name':a125_0x53d6f4(0x1f9),'type':a125_0x53d6f4(0x1f4),'description':a125_0x53d6f4(0x1f7)}],async 'execute'(_0x5301e6){const _0x3ced9d=a125_0x53d6f4,_0x596738=_0x5301e6[_0x3ced9d(0x1e8)](_0x3ced9d(0x1d8)),_0x22ed60=_0x5301e6[_0x3ced9d(0x1e8)](_0x3ced9d(0x1e9));if(!_0x596738&&!_0x22ed60)throw CliErrors[_0x3ced9d(0x1d1)](_0x3ced9d(0x1d8),'Provide\x20--file\x20or\x20--sql');let _0x1883b1;if(_0x596738){const _0x55694e=resolve(process[_0x3ced9d(0x1d4)](),_0x596738);if(!existsSync(_0x55694e))throw CliErrors['validation']('File\x20not\x20found:\x20'+_0x55694e);_0x1883b1=readFileSync(_0x55694e,'utf-8');}else _0x1883b1=_0x22ed60;const _0x4d36f6=validateSql(_0x1883b1),_0x5a30ac={'valid':_0x4d36f6[_0x3ced9d(0x1e4)],'sqlType':_0x4d36f6[_0x3ced9d(0x1d7)]['type'],'isSelectOnly':_0x4d36f6[_0x3ced9d(0x1d7)][_0x3ced9d(0x1d2)],'isDangerous':_0x4d36f6[_0x3ced9d(0x1d7)][_0x3ced9d(0x1de)],'tables':_0x4d36f6[_0x3ced9d(0x1e3)],'parameters':_0x4d36f6[_0x3ced9d(0x1e7)],'message':_0x4d36f6[_0x3ced9d(0x1d3)]};_0x4d36f6[_0x3ced9d(0x1d7)]['reason']&&(_0x5a30ac['reason']=_0x4d36f6[_0x3ced9d(0x1d7)][_0x3ced9d(0x1fa)]);const _0x50ace0=_0x5301e6[_0x3ced9d(0x1e8)](_0x3ced9d(0x1f9));if(_0x50ace0&&_0x4d36f6[_0x3ced9d(0x1e4)]){const _0x396d19=_0x50ace0['split'](',')[_0x3ced9d(0x1ee)](_0x2cd23e=>_0x2cd23e[_0x3ced9d(0x1fc)]())[_0x3ced9d(0x1f2)](Boolean),_0x21632b=[],_0xa17351=await listDatasets(_0x5301e6[_0x3ced9d(0x1da)]),_0x25200c=new Map(_0xa17351[_0x3ced9d(0x1ee)](_0xeeb962=>[_0xeeb962[_0x3ced9d(0x1e2)]?.['tableName']?.[_0x3ced9d(0x1d9)](),_0xeeb962]));for(const _0x59d6dc of _0x4d36f6[_0x3ced9d(0x1e3)]){const _0x4db79d=_0x25200c[_0x3ced9d(0x1f6)](_0x59d6dc[_0x3ced9d(0x1d9)]());!_0x4db79d&&_0x21632b[_0x3ced9d(0x1f1)](_0x3ced9d(0x1e6)+_0x59d6dc+'\x22\x20not\x20found\x20in\x20any\x20dataset');}for(const _0x5a3d53 of _0x396d19){try{const _0x43c72a=await getDatasetDetail(_0x5a3d53),_0xd912e6=Array[_0x3ced9d(0x1f3)](_0x43c72a[_0x3ced9d(0x1d6)])?_0x43c72a['fields']:[],_0x3a3752=new Set(_0xd912e6['map'](_0x2222aa=>_0x2222aa['name']?.[_0x3ced9d(0x1d9)]())),_0x20fe25=_0x43c72a[_0x3ced9d(0x1e2)]?.['tableName']||_0x43c72a[_0x3ced9d(0x1e1)]||_0x5a3d53;_0x5a30ac['schema:'+_0x20fe25]={'code':_0x5a3d53,'tableName':_0x20fe25,'fieldCount':_0x3a3752['size'],'fields':Array['from'](_0x3a3752)};}catch{_0x21632b[_0x3ced9d(0x1f1)](_0x3ced9d(0x1d5)+_0x5a3d53+_0x3ced9d(0x1fb));}}_0x21632b[_0x3ced9d(0x1f5)]>0x0&&(_0x5a30ac['schemaWarnings']=_0x21632b);}return{'ok':_0x4d36f6[_0x3ced9d(0x1e4)],'data':_0x5a30ac,'message':_0x4d36f6[_0x3ced9d(0x1d3)]};}};
|
package/lib/config/schema.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a126_0x2b3fed=a126_0x56f3;(function(_0x7d6f4c,_0x5f08b6){const _0x390b52=a126_0x56f3,_0x142417=_0x7d6f4c();while(!![]){try{const _0x1330fc=-parseInt(_0x390b52(0xe3))/0x1*(parseInt(_0x390b52(0xc8))/0x2)+-parseInt(_0x390b52(0xdf))/0x3*(parseInt(_0x390b52(0xd9))/0x4)+-parseInt(_0x390b52(0xd4))/0x5+parseInt(_0x390b52(0xd7))/0x6*(-parseInt(_0x390b52(0xc5))/0x7)+parseInt(_0x390b52(0xcd))/0x8*(-parseInt(_0x390b52(0xe1))/0x9)+-parseInt(_0x390b52(0xc4))/0xa+-parseInt(_0x390b52(0xdd))/0xb*(-parseInt(_0x390b52(0xc1))/0xc);if(_0x1330fc===_0x5f08b6)break;else _0x142417['push'](_0x142417['shift']());}catch(_0x231543){_0x142417['push'](_0x142417['shift']());}}}(a126_0x1c4b,0x2af16));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',a126_0x2b3fed(0xdb),a126_0x2b3fed(0xe2),a126_0x2b3fed(0xc2),a126_0x2b3fed(0xce)];function a126_0x1c4b(){const _0xcdf4ce=['number','55FEKJRc','Auth\x20cookie','501270PJRoCG','API\x20directory\x20path','4941zrEjSA','locale','1801FYbiuU','Config\x20key\x20(','appcode','map','join','apps','Risk\x20level','Default\x20page\x20size','1227684cqeaXr','format','cookie','92260FRaQwG','21AXlAiu','Default\x20output\x20format\x20for\x20this\x20app\x20(profile)','keys','16LoncAd','has','Access\x20key','entries','length','232icIplP','riskLevel','env','defaultApp','pageSize','zh-CN','app','249850ueqHCo','inherit','string','158052gNUjdk','en-US','4pRHVnV','apiDir','accessKey'];a126_0x1c4b=function(){return _0xcdf4ce;};return a126_0x1c4b();}export const TOP_LEVEL_CONFIG_KEYS=new Set([a126_0x2b3fed(0xe5),'env',a126_0x2b3fed(0xe2),a126_0x2b3fed(0xc2),a126_0x2b3fed(0xc3),a126_0x2b3fed(0xdb),a126_0x2b3fed(0xda)]);export const CONFIG_ENUM_VALUES={'env':[...RABETBASE_ENV_VALUES],'format':[...RABETBASE_OUTPUT_FORMAT_VALUES]};export function formatConfigKeyList(_0xfe0eeb){const _0x564449=a126_0x2b3fed;return[..._0xfe0eeb][_0x564449(0xbd)](',\x20');}export function getTopLevelConfigKeyList(){return[...TOP_LEVEL_CONFIG_KEYS];}export function isTopLevelConfigKey(_0xc16a58){const _0x3262f9=a126_0x2b3fed;return TOP_LEVEL_CONFIG_KEYS[_0x3262f9(0xc9)](_0xc16a58);}function a126_0x56f3(_0x338f8d,_0x1ffacb){_0x338f8d=_0x338f8d-0xbd;const _0x1c4b91=a126_0x1c4b();let _0x56f399=_0x1c4b91[_0x338f8d];return _0x56f399;}export function getTopLevelConfigKeySummary(){return formatConfigKeyList(getTopLevelConfigKeyList());}export function getConfigCommandKeyDescription(){const _0x52263d=a126_0x2b3fed;return _0x52263d(0xe4)+getTopLevelConfigKeySummary()+')';}export const APP_PROFILE_FLAG_KEY_MAP={'env':a126_0x2b3fed(0xcf),'apiDir':a126_0x2b3fed(0xda),'cookie':a126_0x2b3fed(0xc3),'accessKey':'accessKey','defaultFormat':a126_0x2b3fed(0xc2),'pageSize':'pageSize','riskLevel':a126_0x2b3fed(0xce),'locale':'locale'};export function getAppProfileFlagDefs(){const _0x580916=a126_0x2b3fed;return[{'name':_0x580916(0xcf),'type':_0x580916(0xd6),'description':'Target\x20environment','enum':[...RABETBASE_ENV_VALUES]},{'name':_0x580916(0xda),'type':_0x580916(0xd6),'description':_0x580916(0xe0)},{'name':'cookie','type':_0x580916(0xd6),'description':_0x580916(0xde),'hidden':!![]},{'name':_0x580916(0xdb),'type':_0x580916(0xd6),'description':_0x580916(0xca),'hidden':!![]},{'name':'defaultFormat','type':'string','description':_0x580916(0xc6),'enum':[...RABETBASE_OUTPUT_FORMAT_VALUES]},{'name':_0x580916(0xd1),'type':_0x580916(0xdc),'description':_0x580916(0xc0)},{'name':_0x580916(0xce),'type':'string','description':_0x580916(0xbf),'enum':[...RISK_LEVEL_VALUES]},{'name':_0x580916(0xe2),'type':_0x580916(0xd6),'description':'Locale'}];}export function collectAppProfileOverrides(_0x100216){const _0x52d9ed=a126_0x2b3fed,_0x19ada8={};for(const [_0x175f1e,_0x5a6805]of Object[_0x52d9ed(0xcb)](APP_PROFILE_FLAG_KEY_MAP)){const _0x3ac37c=_0x100216(_0x175f1e);if(!_0x3ac37c)continue;_0x19ada8[_0x5a6805]=_0x5a6805===_0x52d9ed(0xd1)?Number(_0x3ac37c):_0x3ac37c;}return _0x19ada8;}export function buildAppProfileListFields(_0x35c34a){const _0x549b42=a126_0x2b3fed;return{'env':_0x35c34a['env']??null,'apiDir':_0x35c34a[_0x549b42(0xda)]??null,'hasCookie':!!_0x35c34a[_0x549b42(0xc3)],'hasAccessKey':!!_0x35c34a[_0x549b42(0xdb)],'format':_0x35c34a['format']??null,'pageSize':_0x35c34a['pageSize']??null,'riskLevel':_0x35c34a[_0x549b42(0xce)]??null,'locale':_0x35c34a[_0x549b42(0xe2)]??null};}export function buildAppDoctorFields(_0x2f21d8,_0x3690cf){const _0x34075c=a126_0x2b3fed;return{'env':{'value':_0x2f21d8[_0x34075c(0xcf)]||_0x3690cf['env'],'source':_0x2f21d8['env']?_0x34075c(0xd3):_0x34075c(0xd5)},'apiDir':{'value':_0x2f21d8['apiDir']||_0x3690cf[_0x34075c(0xda)],'source':_0x2f21d8[_0x34075c(0xda)]?_0x34075c(0xd3):'inherit'},'cookie':{'value':_0x2f21d8[_0x34075c(0xc3)]||_0x3690cf[_0x34075c(0xc3)],'source':_0x2f21d8['cookie']?'app':'inherit'},'accessKey':{'value':_0x2f21d8[_0x34075c(0xdb)]||_0x3690cf[_0x34075c(0xdb)],'source':_0x2f21d8[_0x34075c(0xdb)]?_0x34075c(0xd3):_0x34075c(0xd5)}};}export function buildCanonicalAppConfig(_0x515c44,_0x2eb673){const _0x4c34fa=a126_0x2b3fed,_0xc659e6=_0x515c44[_0x4c34fa(0xe6)](_0x463596=>String(_0x463596||'')['trim']())['filter'](Boolean);if(_0xc659e6[_0x4c34fa(0xcc)]===0x0)return{};const _0x1a49b4={};for(const _0x34ff9d of _0xc659e6){_0x1a49b4[_0x34ff9d]=_0x2eb673?{'appcode':_0x34ff9d,'env':_0x2eb673}:{'appcode':_0x34ff9d};}return{'apps':_0x1a49b4,'defaultApp':_0xc659e6[0x0]};}export function buildCanonicalProjectConfig(_0x2bc76c,_0x156145){const _0x394c61=a126_0x2b3fed,{appCodes:appCodes=[],env:_0x4fd4a5,metadata:_0x1b9c0c}=_0x156145,_0x7dbb87={..._0x2bc76c,..._0x1b9c0c||{}};delete _0x7dbb87[_0x394c61(0xe5)],delete _0x7dbb87[_0x394c61(0xd3)];if(_0x4fd4a5)_0x7dbb87[_0x394c61(0xcf)]=_0x4fd4a5;else!_0x7dbb87['env']&&(_0x7dbb87[_0x394c61(0xcf)]=DEFAULT_CONFIG_VALUES[_0x394c61(0xcf)]);const _0xb8478d=buildCanonicalAppConfig(appCodes,_0x7dbb87['env']);return Object[_0x394c61(0xc7)](_0xb8478d)[_0x394c61(0xcc)]>0x0&&(_0x7dbb87[_0x394c61(0xbe)]=_0xb8478d[_0x394c61(0xbe)],_0x7dbb87[_0x394c61(0xd0)]=_0xb8478d[_0x394c61(0xd0)]),_0x7dbb87;}const LOCALE_MAP={'zh':a126_0x2b3fed(0xd2),'zh-cn':a126_0x2b3fed(0xd2),'zh_cn':a126_0x2b3fed(0xd2),'en':a126_0x2b3fed(0xd8),'en-us':a126_0x2b3fed(0xd8),'en_us':a126_0x2b3fed(0xd8)};export function normalizeLocale(_0x5cadc5){if(!_0x5cadc5)return null;return LOCALE_MAP[_0x5cadc5['toLowerCase']()]??null;}
|
package/lib/constant/cdn.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0xf9ccc1,_0xbcc2bc){const _0x3746b8=a127_0x2e36,_0x5dd289=_0xf9ccc1();while(!![]){try{const _0x156072=-parseInt(_0x3746b8(0x6c))/0x1+parseInt(_0x3746b8(0x65))/0x2*(parseInt(_0x3746b8(0x69))/0x3)+parseInt(_0x3746b8(0x6b))/0x4+parseInt(_0x3746b8(0x66))/0x5+-parseInt(_0x3746b8(0x6a))/0x6*(-parseInt(_0x3746b8(0x68))/0x7)+-parseInt(_0x3746b8(0x6d))/0x8+parseInt(_0x3746b8(0x67))/0x9;if(_0x156072===_0xbcc2bc)break;else _0x5dd289['push'](_0x5dd289['shift']());}catch(_0x583b31){_0x5dd289['push'](_0x5dd289['shift']());}}}(a127_0x3771,0xa29a5));function a127_0x3771(){const _0xd120=['39fCjKSL','68310UJqumZ','310208jlXDbZ','1132310XtbDBS','3585184bzDNnV','189146GMzBCT','3484210oasSvU','1568934XOzpmV','42mgIsKQ'];a127_0x3771=function(){return _0xd120;};return a127_0x3771();}function a127_0x2e36(_0x285269,_0x197667){_0x285269=_0x285269-0x65;const _0x3771ae=a127_0x3771();let _0x2e365b=_0x3771ae[_0x285269];return _0x2e365b;}export const CLI_VERSION_POLICY_URL='https://g.lovrabet.com/dist/rabetbase-cli/config/index.json';
|
package/lib/constant/cli.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a128_0x1cdcab=a128_0x4df6;(function(_0x1fdcd8,_0x574006){const _0x408cf3=a128_0x4df6,_0xae4a96=_0x1fdcd8();while(!![]){try{const _0x241c6f=-parseInt(_0x408cf3(0xd5))/0x1+-parseInt(_0x408cf3(0xbf))/0x2*(parseInt(_0x408cf3(0xd8))/0x3)+parseInt(_0x408cf3(0xee))/0x4*(parseInt(_0x408cf3(0xa1))/0x5)+-parseInt(_0x408cf3(0xa6))/0x6*(parseInt(_0x408cf3(0xcf))/0x7)+-parseInt(_0x408cf3(0xb2))/0x8+parseInt(_0x408cf3(0xcb))/0x9+parseInt(_0x408cf3(0xb9))/0xa*(parseInt(_0x408cf3(0xa4))/0xb);if(_0x241c6f===_0x574006)break;else _0xae4a96['push'](_0xae4a96['shift']());}catch(_0xad4f7c){_0xae4a96['push'](_0xae4a96['shift']());}}}(a128_0x308f,0x59627));export const CLI_BIN_NAME=a128_0x1cdcab(0xbb);export const CLI_DISPLAY_NAME='Rabetbase\x20CLI';export const NPM_PACKAGE_NAME=a128_0x1cdcab(0xd2);export const GLOBAL_FLAGS=[{'name':a128_0x1cdcab(0xc6),'meowKey':a128_0x1cdcab(0xc6),'type':a128_0x1cdcab(0xd3),'description':a128_0x1cdcab(0xe5),'hint':a128_0x1cdcab(0xe4)},{'name':'app','meowKey':a128_0x1cdcab(0xc0),'type':a128_0x1cdcab(0xd3),'description':a128_0x1cdcab(0xdd),'hint':'<name>'},{'name':a128_0x1cdcab(0xf9),'meowKey':a128_0x1cdcab(0xf9),'type':'string','description':'Environment','hint':'production\x20|\x20daily'},{'name':a128_0x1cdcab(0xdb),'meowKey':a128_0x1cdcab(0xdb),'type':a128_0x1cdcab(0xd3),'description':a128_0x1cdcab(0xa7),'hint':a128_0x1cdcab(0xae)},{'name':'jq','meowKey':'jq','type':a128_0x1cdcab(0xd3),'description':a128_0x1cdcab(0x9c),'hint':'<expr>'},{'name':'dry-run','meowKey':'dryRun','type':'boolean','description':a128_0x1cdcab(0xce)},{'name':a128_0x1cdcab(0xba),'meowKey':a128_0x1cdcab(0xba),'type':a128_0x1cdcab(0xd6),'description':'Skip\x20confirmation\x20for\x20high-risk\x20writes'},{'name':a128_0x1cdcab(0xad),'meowKey':a128_0x1cdcab(0xb5),'type':a128_0x1cdcab(0xd6),'description':'Force\x20non-interactive\x20mode\x20(CI)'},{'name':a128_0x1cdcab(0xc9),'meowKey':a128_0x1cdcab(0xc9),'type':a128_0x1cdcab(0xd6),'description':a128_0x1cdcab(0xde)},{'name':a128_0x1cdcab(0xa5),'meowKey':a128_0x1cdcab(0xa5),'type':a128_0x1cdcab(0xd6),'description':a128_0x1cdcab(0xf1)},{'name':'ci','meowKey':'ci','type':a128_0x1cdcab(0xd6),'description':'Alias\x20for\x20--non-interactive','hidden':!![]},{'name':a128_0x1cdcab(0xa0),'meowKey':a128_0x1cdcab(0xa0),'type':a128_0x1cdcab(0xd6),'description':'Show\x20help'},{'name':a128_0x1cdcab(0xa8),'meowKey':a128_0x1cdcab(0xa8),'type':a128_0x1cdcab(0xd3),'description':'Name','hidden':!![]},{'name':a128_0x1cdcab(0xf6),'meowKey':a128_0x1cdcab(0xf6),'type':'string','description':a128_0x1cdcab(0xf3),'hidden':!![]},{'name':a128_0x1cdcab(0xe7),'meowKey':a128_0x1cdcab(0xe7),'type':'boolean','description':a128_0x1cdcab(0xc3),'hidden':!![]},{'name':'watch','meowKey':a128_0x1cdcab(0xb0),'type':'boolean','description':a128_0x1cdcab(0xdc),'hidden':!![]},{'name':a128_0x1cdcab(0xc2),'meowKey':a128_0x1cdcab(0xc2),'type':a128_0x1cdcab(0xd3),'description':'Output\x20path','hidden':!![]},{'name':a128_0x1cdcab(0xd1),'meowKey':'params','type':'string','description':a128_0x1cdcab(0xe2),'hidden':!![]},{'name':a128_0x1cdcab(0xaa),'meowKey':a128_0x1cdcab(0xaa),'type':a128_0x1cdcab(0xd3),'description':a128_0x1cdcab(0xec),'hidden':!![]},{'name':a128_0x1cdcab(0xe1),'meowKey':a128_0x1cdcab(0xe1),'type':'boolean','description':a128_0x1cdcab(0xaf),'hidden':!![]},{'name':a128_0x1cdcab(0xda),'meowKey':'enableBffSave','type':a128_0x1cdcab(0xd6),'description':'Enable\x20BFF\x20save','hidden':!![]},{'name':'id','meowKey':'id','type':'string','description':a128_0x1cdcab(0xbe),'hidden':!![]},{'name':a128_0x1cdcab(0xb8),'meowKey':a128_0x1cdcab(0xb8),'type':a128_0x1cdcab(0xd3),'description':'Type\x20filter','hidden':!![]},{'name':'file','meowKey':'file','type':a128_0x1cdcab(0xd3),'description':a128_0x1cdcab(0xd7),'hidden':!![]},{'name':'sqlcode','meowKey':a128_0x1cdcab(0xa3),'type':'string','description':'SQL\x20code','hidden':!![]},{'name':a128_0x1cdcab(0xe0),'meowKey':a128_0x1cdcab(0xcd),'type':'string','description':a128_0x1cdcab(0xf4),'hidden':!![]},{'name':'sqlname','meowKey':'sqlname','type':a128_0x1cdcab(0xd3),'description':a128_0x1cdcab(0xf4),'hidden':!![]},{'name':a128_0x1cdcab(0xb1),'meowKey':a128_0x1cdcab(0xf7),'type':a128_0x1cdcab(0xd3),'description':'DB\x20ID','hidden':!![]},{'name':a128_0x1cdcab(0xbc),'meowKey':a128_0x1cdcab(0xbc),'type':a128_0x1cdcab(0xd3),'description':a128_0x1cdcab(0xb6),'hidden':!![]},{'name':a128_0x1cdcab(0xca),'meowKey':a128_0x1cdcab(0xca),'type':a128_0x1cdcab(0xd3),'description':'Description','hidden':!![]},{'name':a128_0x1cdcab(0xac),'meowKey':'descriptionFile','type':a128_0x1cdcab(0xd3),'description':a128_0x1cdcab(0xeb),'hidden':!![]},{'name':a128_0x1cdcab(0xcc),'meowKey':a128_0x1cdcab(0xcc),'type':a128_0x1cdcab(0xd3),'description':a128_0x1cdcab(0xf8),'hidden':!![]},{'name':a128_0x1cdcab(0xdf),'meowKey':'pagesize','type':a128_0x1cdcab(0xd3),'description':a128_0x1cdcab(0xfb),'hidden':!![]},{'name':a128_0x1cdcab(0xb4),'meowKey':a128_0x1cdcab(0xb4),'type':a128_0x1cdcab(0xd3),'description':a128_0x1cdcab(0xc1),'hidden':!![]},{'name':a128_0x1cdcab(0xd9),'meowKey':a128_0x1cdcab(0xd9),'type':a128_0x1cdcab(0xd3),'description':a128_0x1cdcab(0xfa),'hidden':!![]},{'name':a128_0x1cdcab(0xa2),'meowKey':'sql','type':'string','description':a128_0x1cdcab(0xea),'hidden':!![]},{'name':a128_0x1cdcab(0xb7),'meowKey':a128_0x1cdcab(0xb7),'type':a128_0x1cdcab(0xd3),'description':'Schemas','hidden':!![]},{'name':a128_0x1cdcab(0xf2),'meowKey':'operation','type':a128_0x1cdcab(0xd3),'description':a128_0x1cdcab(0xed),'hidden':!![]},{'name':a128_0x1cdcab(0xd4),'meowKey':a128_0x1cdcab(0xd4),'type':a128_0x1cdcab(0xd3),'description':'Target\x20path','hidden':!![]},{'name':'skip-imports','meowKey':a128_0x1cdcab(0xe6),'type':a128_0x1cdcab(0xd6),'description':a128_0x1cdcab(0xa9),'hidden':!![]},{'name':a128_0x1cdcab(0xf0),'meowKey':a128_0x1cdcab(0xf0),'type':'string','description':a128_0x1cdcab(0xd0),'hidden':!![]},{'name':a128_0x1cdcab(0xef),'meowKey':'value','type':'string','description':'Config\x20value','hidden':!![]},{'name':'force','meowKey':a128_0x1cdcab(0xb3),'type':'boolean','description':a128_0x1cdcab(0xc8),'hidden':!![]},{'name':a128_0x1cdcab(0x9f),'meowKey':a128_0x1cdcab(0x9f),'type':a128_0x1cdcab(0xd6),'description':a128_0x1cdcab(0xab),'hidden':!![]},{'name':'remote','meowKey':a128_0x1cdcab(0xc4),'type':a128_0x1cdcab(0xd6),'description':'Use\x20remote','hidden':!![]},{'name':a128_0x1cdcab(0xc5),'meowKey':a128_0x1cdcab(0xc5),'type':a128_0x1cdcab(0xd6),'description':a128_0x1cdcab(0xe9),'hidden':!![]},{'name':a128_0x1cdcab(0x9d),'meowKey':'expectedCount','type':a128_0x1cdcab(0xd3),'description':a128_0x1cdcab(0xf5),'hidden':!![]},{'name':a128_0x1cdcab(0xe3),'meowKey':a128_0x1cdcab(0xc7),'type':a128_0x1cdcab(0xd3),'description':a128_0x1cdcab(0xed),'hidden':!![]},{'name':'function-node','meowKey':'functionNode','type':a128_0x1cdcab(0xd3),'description':'Function\x20node','hidden':!![]}];function a128_0x308f(){const _0x3c8cce=['key','Use\x20project\x20config\x20scope','operation','Title','SQL\x20name','Expected\x20affected\x20count','title','dbId','Page\x20number','env','Code\x20filter','Page\x20size','Filter\x20JSON\x20output\x20(JQ_PATH\x20>\x20bundled\x20jq\x20>\x20PATH;\x20use\x20with\x20--format\x20json\x20or\x20compress)','expected-count','map','confirm','help','3040645OTeRvf','sql','sqlcode','913968AYuITZ','project','6rgIgvV','Output\x20format','name','Skip\x20import\x20generation','datasetcode','Confirm\x20destructive\x20action','description-file','non-interactive','json\x20|\x20pretty\x20|\x20compress','Apply\x20to\x20all','watch','db-id','2307656UgXCMI','force','keyword','nonInteractive','DB\x20ID','schemas','type','20ApSTPZ','yes','rabetbase','dbid','dry-run','Record\x20ID','20724cEAlLh','app','Keyword\x20filter','output','Clear','remote','verbose','appcode','operationType','Force\x20overwrite','global','description','5906664oTioOj','page','sqlName','Preview\x20operation\x20without\x20executing','760949DqPGVk','Config\x20key','params','@lovrabet/rabetbase-cli','string','target','594784aoVkIs','boolean','File\x20path','21mMmEee','code','enable-bff-save','format','Watch\x20mode','Select\x20app\x20profile\x20by\x20name','Use\x20global\x20config\x20scope','pagesize','sql-name','all','JSON\x20params','operation-type','<code>','Override\x20appcode','skipImports','clear','meowKey','Verbose\x20output','SQL\x20string','Description\x20file','Dataset\x20code','Operation\x20type','4hnXQqI','value'];a128_0x308f=function(){return _0x3c8cce;};return a128_0x308f();}export const PIPELINE_FLAG_NAMES=new Set([a128_0x1cdcab(0xc6),a128_0x1cdcab(0xc0),'env',a128_0x1cdcab(0xdb),'jq',a128_0x1cdcab(0xbd),'yes','non-interactive','ci']);function a128_0x4df6(_0x89669,_0x2d831c){_0x89669=_0x89669-0x9c;const _0x308fff=a128_0x308f();let _0x4df6ec=_0x308fff[_0x89669];return _0x4df6ec;}export function buildMeowFlags(){const _0x1982d9=a128_0x1cdcab;return Object['fromEntries'](GLOBAL_FLAGS[_0x1982d9(0x9e)](_0x59a076=>[_0x59a076[_0x1982d9(0xe8)],{'type':_0x59a076[_0x1982d9(0xb8)]}]));}
|
package/lib/constant/defaults.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a129_0x9727(){const _0xd3151d=['production','546590wHfltl','1255428YrULuD','6zxCunv','932157OiBqtd','en-US','38328AJbuai','1423915cfeqEJ','1275660riIJuL','compress','315jIrUQc','high-risk-write','1SIJfyr','17523410LbgrpH'];a129_0x9727=function(){return _0xd3151d;};return a129_0x9727();}const a129_0x4932c1=a129_0x4f68;(function(_0x6b7a72,_0x2b8892){const _0x512506=a129_0x4f68,_0x17af0d=_0x6b7a72();while(!![]){try{const _0x252819=-parseInt(_0x512506(0xd1))/0x1*(parseInt(_0x512506(0xd4))/0x2)+-parseInt(_0x512506(0xd7))/0x3+-parseInt(_0x512506(0xd5))/0x4+-parseInt(_0x512506(0xcc))/0x5*(parseInt(_0x512506(0xd6))/0x6)+-parseInt(_0x512506(0xcf))/0x7*(parseInt(_0x512506(0xcb))/0x8)+-parseInt(_0x512506(0xcd))/0x9+parseInt(_0x512506(0xd2))/0xa;if(_0x252819===_0x2b8892)break;else _0x17af0d['push'](_0x17af0d['shift']());}catch(_0x24c1ae){_0x17af0d['push'](_0x17af0d['shift']());}}}(a129_0x9727,0x33d80));import{DEFAULT_API_DIR}from'../constant/paths.js';function a129_0x4f68(_0x59dede,_0x5504ce){_0x59dede=_0x59dede-0xca;const _0x972747=a129_0x9727();let _0x4f68e8=_0x972747[_0x59dede];return _0x4f68e8;}export const DEFAULT_CONFIG_VALUES={'env':a129_0x4932c1(0xd3),'format':a129_0x4932c1(0xce),'locale':a129_0x4932c1(0xca),'riskLevel':a129_0x4932c1(0xd0),'apiDir':DEFAULT_API_DIR};export const DEFAULT_COMMAND_OUTPUT_FORMAT=a129_0x4932c1(0xce);
|
package/lib/constant/domain.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a130_0xa67f5c=a130_0x2231;(function(_0x2d498d,_0x1a5223){const _0x3ebc28=a130_0x2231,_0x5ed31e=_0x2d498d();while(!![]){try{const _0x2d71d1=-parseInt(_0x3ebc28(0x155))/0x1+-parseInt(_0x3ebc28(0x154))/0x2*(-parseInt(_0x3ebc28(0x150))/0x3)+parseInt(_0x3ebc28(0x15a))/0x4+parseInt(_0x3ebc28(0x14e))/0x5*(-parseInt(_0x3ebc28(0x156))/0x6)+parseInt(_0x3ebc28(0x14d))/0x7*(parseInt(_0x3ebc28(0x15d))/0x8)+-parseInt(_0x3ebc28(0x151))/0x9+-parseInt(_0x3ebc28(0x159))/0xa*(-parseInt(_0x3ebc28(0x15b))/0xb);if(_0x2d71d1===_0x1a5223)break;else _0x5ed31e['push'](_0x5ed31e['shift']());}catch(_0x13784c){_0x5ed31e['push'](_0x5ed31e['shift']());}}}(a130_0x2bde,0xd82e7));import{getEnv,isProduction}from'../constant/env.js';function a130_0x2bde(){const _0x389c0b=['https://user.lovrabet.com','9vWtwfN','3530790NkIBLH','https://api.lovrabet.com','userDomain','39358emJQpa','1033076OTGEZt','6Nxksyd','https://runtime.lovrabet.com','apiDomain','138210aaFIoE','1072404beyLqy','2497Hqbqpb','https://daily-runtime.lovrabet.com','1590328poPjpb','https://user-daily.lovrabet.com','21ayVCjY','8750065LPPPqO'];a130_0x2bde=function(){return _0x389c0b;};return a130_0x2bde();}let customApiDomain,customUserDomain,customRuntimeDomain;export function initDomains(_0x23853f){const _0x4c54f7=a130_0x2231;customApiDomain=_0x23853f?.[_0x4c54f7(0x158)],customUserDomain=_0x23853f?.[_0x4c54f7(0x153)],customRuntimeDomain=_0x23853f?.['runtimeDomain'];}export const getUserDomain=()=>customUserDomain||(isProduction(getEnv())?a130_0xa67f5c(0x14f):a130_0xa67f5c(0x15e));export const getApiDomain=()=>customApiDomain||(isProduction(getEnv())?a130_0xa67f5c(0x152):'https://daily-api.lovrabet.com');function a130_0x2231(_0x467c4c,_0x33624f){_0x467c4c=_0x467c4c-0x14d;const _0x2bdec9=a130_0x2bde();let _0x223107=_0x2bdec9[_0x467c4c];return _0x223107;}export const getRuntimeDomain=()=>customRuntimeDomain||(isProduction(getEnv())?a130_0xa67f5c(0x157):a130_0xa67f5c(0x15c));
|
package/lib/constant/env.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a131_0x3e0ef6=a131_0x3048;(function(_0x584368,_0x5ea518){const _0x4ce0b3=a131_0x3048,_0x2fd918=_0x584368();while(!![]){try{const _0x424430=-parseInt(_0x4ce0b3(0x1c4))/0x1+-parseInt(_0x4ce0b3(0x1c0))/0x2*(-parseInt(_0x4ce0b3(0x1bc))/0x3)+-parseInt(_0x4ce0b3(0x1c7))/0x4*(-parseInt(_0x4ce0b3(0x1c3))/0x5)+parseInt(_0x4ce0b3(0x1bf))/0x6+-parseInt(_0x4ce0b3(0x1c5))/0x7+parseInt(_0x4ce0b3(0x1c1))/0x8*(parseInt(_0x4ce0b3(0x1be))/0x9)+-parseInt(_0x4ce0b3(0x1c2))/0xa;if(_0x424430===_0x5ea518)break;else _0x2fd918['push'](_0x2fd918['shift']());}catch(_0x2ed91f){_0x2fd918['push'](_0x2fd918['shift']());}}}(a131_0xcaa8,0xc577b));export const RABETBASE_ENV_VALUES=[a131_0x3e0ef6(0x1bb),a131_0x3e0ef6(0x1c8)];export function normalizeEnv(_0xf9cb3d){const _0x5bd91f=a131_0x3e0ef6;return _0xf9cb3d===_0x5bd91f(0x1bd)?_0x5bd91f(0x1bb):_0xf9cb3d;}export function isProduction(_0x3b1fc1){const _0x11cd4d=a131_0x3e0ef6;return normalizeEnv(_0x3b1fc1)===_0x11cd4d(0x1bb);}export function isDaily(_0x281a36){const _0x24adeb=a131_0x3e0ef6;return normalizeEnv(_0x281a36)===_0x24adeb(0x1c8);}export function isDev(_0x225fce){const _0x15d9d8=a131_0x3e0ef6,_0x53d85e=normalizeEnv(_0x225fce);return _0x53d85e===_0x15d9d8(0x1c9)||_0x53d85e===_0x15d9d8(0x1c6);}let env=normalizeEnv(process.env.RABETBASE_ENV||process.env.LOVRABET_ENV||a131_0x3e0ef6(0x1bb));function a131_0x3048(_0x536f63,_0x101832){_0x536f63=_0x536f63-0x1bb;const _0xcaa8fd=a131_0xcaa8();let _0x30480a=_0xcaa8fd[_0x536f63];return _0x30480a;}function a131_0xcaa8(){const _0x51481f=['dev','4anyDpk','daily','development','production','4037718yrqNcT','online','387351vXnyfV','2236944dbHfhX','2cIzxrA','16sWsFBj','2792110apPCvU','5979625kLmehJ','649255zkUfAA','8844080KaTyQP'];a131_0xcaa8=function(){return _0x51481f;};return a131_0xcaa8();}export function getEnv(){return env;}export function initEnv(_0x33b12b){env=normalizeEnv(_0x33b12b);}
|
package/lib/constant/output.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a132_0x2a14f7=a132_0x17f6;function a132_0x13b8(){const _0x96838=['590bzfzCD','compress','855390BJFolP','689532dRuxSf','561570DTeOZv','121505ubSLwi','4NJHaZc','77481DHjiuj','pretty','8FjSiPd','json','167647IDYdCh','1062614bzoGiX'];a132_0x13b8=function(){return _0x96838;};return a132_0x13b8();}function a132_0x17f6(_0x31e728,_0x3fc19b){_0x31e728=_0x31e728-0x15f;const _0x13b85c=a132_0x13b8();let _0x17f6ae=_0x13b85c[_0x31e728];return _0x17f6ae;}(function(_0x312d18,_0x5c635d){const _0x3af715=a132_0x17f6,_0x3bb56f=_0x312d18();while(!![]){try{const _0x586f80=parseInt(_0x3af715(0x164))/0x1+parseInt(_0x3af715(0x16a))/0x2+parseInt(_0x3af715(0x169))/0x3*(parseInt(_0x3af715(0x15f))/0x4)+-parseInt(_0x3af715(0x16b))/0x5+-parseInt(_0x3af715(0x168))/0x6+parseInt(_0x3af715(0x165))/0x7*(parseInt(_0x3af715(0x162))/0x8)+-parseInt(_0x3af715(0x160))/0x9*(parseInt(_0x3af715(0x166))/0xa);if(_0x586f80===_0x5c635d)break;else _0x3bb56f['push'](_0x3bb56f['shift']());}catch(_0x21b677){_0x3bb56f['push'](_0x3bb56f['shift']());}}}(a132_0x13b8,0x25e91));export const RABETBASE_OUTPUT_FORMAT_VALUES=[a132_0x2a14f7(0x163),a132_0x2a14f7(0x161),a132_0x2a14f7(0x167)];
|
package/lib/constant/paths.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a133_0x1dad(_0xc1b7d2,_0x4934de){_0xc1b7d2=_0xc1b7d2-0x16d;const _0x46cebe=a133_0x46ce();let _0x1dad72=_0x46cebe[_0xc1b7d2];return _0x1dad72;}function a133_0x46ce(){const _0x5eccd1=['4222359cEzGGn','98srPyXK','8961073DVoAXd','1436iAtKUv','527202ULgHoT','20OPEkBw','8914FPPytf','11200880DAswHn','5843778FebPun','1355XakgSF','7lEVVdL'];a133_0x46ce=function(){return _0x5eccd1;};return a133_0x46ce();}(function(_0xc3f6f2,_0x38578d){const _0x4d6d32=a133_0x1dad,_0x3501ca=_0xc3f6f2();while(!![]){try{const _0x3e2061=parseInt(_0x4d6d32(0x175))/0x1*(-parseInt(_0x4d6d32(0x170))/0x2)+-parseInt(_0x4d6d32(0x173))/0x3+parseInt(_0x4d6d32(0x172))/0x4*(-parseInt(_0x4d6d32(0x16d))/0x5)+-parseInt(_0x4d6d32(0x177))/0x6*(-parseInt(_0x4d6d32(0x16e))/0x7)+-parseInt(_0x4d6d32(0x176))/0x8+parseInt(_0x4d6d32(0x16f))/0x9+parseInt(_0x4d6d32(0x174))/0xa*(parseInt(_0x4d6d32(0x171))/0xb);if(_0x3e2061===_0x38578d)break;else _0x3501ca['push'](_0x3501ca['shift']());}catch(_0x15da97){_0x3501ca['push'](_0x3501ca['shift']());}}}(a133_0x46ce,0xeafb1));export const DEFAULT_API_DIR='./src/api';
|
package/lib/constant/risk.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a134_0x41fe(_0x311686,_0x5bc3a3){_0x311686=_0x311686-0x154;const _0xdfdfb=a134_0xdfdf();let _0x41febf=_0xdfdfb[_0x311686];return _0x41febf;}const a134_0x3a88fe=a134_0x41fe;function a134_0xdfdf(){const _0x1df256=['54644jOoUtE','59331RXPfSJ','read','21iENBhE','30970UBbpll','293982vlgaeV','write','1639152XMaivj','48yBRKAU','4696812mkJytO','90001vUspCO','high-risk-write'];a134_0xdfdf=function(){return _0x1df256;};return a134_0xdfdf();}(function(_0x1b3703,_0x444acf){const _0x402ef4=a134_0x41fe,_0x35aef3=_0x1b3703();while(!![]){try{const _0x31c500=-parseInt(_0x402ef4(0x157))/0x1+parseInt(_0x402ef4(0x159))/0x2+parseInt(_0x402ef4(0x15a))/0x3*(-parseInt(_0x402ef4(0x155))/0x4)+parseInt(_0x402ef4(0x15d))/0x5+-parseInt(_0x402ef4(0x15e))/0x6*(-parseInt(_0x402ef4(0x15c))/0x7)+-parseInt(_0x402ef4(0x154))/0x8+parseInt(_0x402ef4(0x156))/0x9;if(_0x31c500===_0x444acf)break;else _0x35aef3['push'](_0x35aef3['shift']());}catch(_0x324fab){_0x35aef3['push'](_0x35aef3['shift']());}}}(a134_0xdfdf,0x298ac));export const RISK_LEVEL_VALUES=[a134_0x3a88fe(0x15b),a134_0x3a88fe(0x15f),a134_0x3a88fe(0x158)];
|
package/lib/context.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a135_0x3ac74b=a135_0xf113;(function(_0x17a675,_0x34cce4){const _0x2ab06d=a135_0xf113,_0x33a82c=_0x17a675();while(!![]){try{const _0x20a65b=parseInt(_0x2ab06d(0x153))/0x1*(parseInt(_0x2ab06d(0x196))/0x2)+-parseInt(_0x2ab06d(0x181))/0x3*(-parseInt(_0x2ab06d(0x159))/0x4)+-parseInt(_0x2ab06d(0x189))/0x5+-parseInt(_0x2ab06d(0x15b))/0x6+-parseInt(_0x2ab06d(0x190))/0x7*(-parseInt(_0x2ab06d(0x178))/0x8)+-parseInt(_0x2ab06d(0x170))/0x9+-parseInt(_0x2ab06d(0x18c))/0xa*(-parseInt(_0x2ab06d(0x15c))/0xb);if(_0x20a65b===_0x34cce4)break;else _0x33a82c['push'](_0x33a82c['shift']());}catch(_0x2948e3){_0x33a82c['push'](_0x33a82c['shift']());}}}(a135_0x3fb2,0x5bbf4));import{readFileSync,writeFileSync,existsSync,mkdirSync,renameSync,unlinkSync}from'node:fs';import{resolve,dirname,parse}from'node:path';import{homedir}from'node:os';import{logger}from'./utils/logger.js';import{getIsSessionValid}from'./auth/is-session-valid.js';import{CliErrors}from'./errors.js';import{CLI_BIN_NAME}from'./constant/cli.js';import{DEFAULT_CONFIG_VALUES}from'./constant/defaults.js';import{normalizeEnv,isDaily}from'./constant/env.js';import{normalizeLegacyOutputFormat}from'./framework/types.js';function env(_0x4f2cfb){return process.env[`RABETBASE_${_0x4f2cfb}`]||process.env[`LOVRABET_${_0x4f2cfb}`]||undefined;}export const NEW_CONFIG_NAME='.rabetbase.json';export const CONFIG_NAMES=[a135_0x3ac74b(0x160),a135_0x3ac74b(0x161),a135_0x3ac74b(0x158)];export const LEGACY_CONFIG_NAMES=CONFIG_NAMES[a135_0x3ac74b(0x194)](_0x17c99e=>_0x17c99e!==NEW_CONFIG_NAME);export function resolveConfigPath(_0x580964){for(const _0x53397a of CONFIG_NAMES){const _0x5d4a93=resolve(_0x580964,_0x53397a);if(existsSync(_0x5d4a93))return _0x5d4a93;}return undefined;}export function findProjectRootDirectory(_0x208987=process[a135_0x3ac74b(0x184)]()){let _0x3084c8=resolve(_0x208987);const {root:_0x4af422}=parse(_0x3084c8),_0x1061e1=homedir();while(!![]){if(resolveConfigPath(_0x3084c8)){if(_0x3084c8===_0x1061e1)break;return _0x3084c8;}if(_0x3084c8===_0x4af422||_0x3084c8===_0x1061e1)break;const _0x376c73=dirname(_0x3084c8);if(_0x376c73===_0x3084c8)break;_0x3084c8=_0x376c73;}return resolve(_0x208987);}export async function createContext(_0x54dd45){const _0x2a05b0=a135_0x3ac74b,_0x146eec=readRawConfig(),_0xcc01d=buildConfig(_0x146eec,_0x54dd45),{initEnv:_0x225747}=await import(_0x2a05b0(0x15d));if(_0xcc01d[_0x2a05b0(0x154)])_0x225747(_0xcc01d['env']);else _0x54dd45[_0x2a05b0(0x154)]&&typeof _0x54dd45[_0x2a05b0(0x154)]===_0x2a05b0(0x17f)&&_0x225747(_0x54dd45[_0x2a05b0(0x154)]);const {initDomains:_0x49c5fe,getUserDomain:_0x44e677,getApiDomain:_0x426869}=await import(_0x2a05b0(0x168));_0x49c5fe({'apiDomain':_0x146eec['apiDomain']||undefined,'userDomain':_0x146eec[_0x2a05b0(0x173)]||undefined,'runtimeDomain':_0x146eec[_0x2a05b0(0x16f)]||undefined});const _0x1c7b38={'apiDomain':_0x426869(),'userDomain':_0x44e677()},_0x4b85e2=await buildAuth(_0xcc01d);logger[_0x2a05b0(0x163)](process[_0x2a05b0(0x184)]());const _0x1b1437=(CLI_BIN_NAME+'\x20'+process['argv'][_0x2a05b0(0x14f)](0x2)['join']('\x20'))['trim']();logger[_0x2a05b0(0x165)](_0x1b1437);const {isNonInteractive:_0x2f4877}=await import('./utils/is-non-interactive.js'),_0x39e3c8=_0x2f4877(_0x54dd45);return{'config':_0xcc01d,'auth':_0x4b85e2,'logger':logger,'env':_0x1c7b38,'nonInteractive':_0x39e3c8};}export function buildConfigFromFlags(_0x50409c){return buildConfig(readRawConfig(),_0x50409c);}export function getProjectConfigPath(){const _0x93d886=a135_0x3ac74b;return resolveConfigPath(process[_0x93d886(0x184)]());}export function getGlobalConfigPath(){return resolveConfigPath(homedir());}export function isInProject(){return!!getProjectConfigPath();}function a135_0x3fb2(){const _0x271222=['./constant/domain.js','FORMAT','utf8','authRequired','defaultApp','https://g.lovrabet.com/dist/lovrabet-skill','./auth/get-cookie.js','runtimeDomain','1626237eRWCJI','APP','message','userDomain','\x20config\x20file\x20ignored\x20(invalid\x20JSON\x20or\x20unreadable):\x20','riskLevel','silent','entries','5423032xlhRNU','appcode','apiDir','parse','pageSize','APPCODE','Project','string','projectConfig','1113iRUZJO','get','length','cwd','PAGE_SIZE','inherit','merged','RISK_LEVEL','3533380lRfWdp','\x0a\x20\x20','Global','2246770qeFmNh','read','app','status','7wSpQZP','set','-api.ts','map','filter','maxRisk','22604euxncV','COOKIE','find','keys','locale','apps','values','accessKey','true','project','VERBOSE','trim','empty','slice','.tmp','config','api.ts','40JKwUPL','env','template_base_url','migrated','object','.lovrabetrc','1652EWDxOv','cookie','1468164bZIFuG','11QsoHzx','./constant/env.js','stringify','error','.rabetbase.json','.lovrabet.json','format','setLogPath','ENV','setRawCommand','production','replace'];a135_0x3fb2=function(){return _0x271222;};return a135_0x3fb2();}export function inspectCliConfigJsonFile(_0x30815e){const _0x1b0ec4=a135_0x3ac74b;if(!existsSync(_0x30815e))return{'status':'missing'};try{const _0x5b2e42=readFileSync(_0x30815e,{'encoding':'utf8'});if(!_0x5b2e42?.[_0x1b0ec4(0x14d)]())return{'status':'empty'};const _0x5ac6fe=JSON[_0x1b0ec4(0x17b)](_0x5b2e42);return{'status':'ok','data':_0x5ac6fe};}catch(_0x1ff285){return{'status':'error','message':_0x1ff285 instanceof Error?_0x1ff285[_0x1b0ec4(0x172)]:String(_0x1ff285)};}}function a135_0xf113(_0x2bbe50,_0x9017be){_0x2bbe50=_0x2bbe50-0x14d;const _0x3fb249=a135_0x3fb2();let _0xf11361=_0x3fb249[_0x2bbe50];return _0xf11361;}function parseCliConfigJsonFile(_0x4aebf2,_0x538a14,_0x548f65){const _0x8cee3b=a135_0x3ac74b,_0x7ccd6b=inspectCliConfigJsonFile(_0x4aebf2);if(_0x7ccd6b[_0x8cee3b(0x18f)]==='missing'||_0x7ccd6b[_0x8cee3b(0x18f)]===_0x8cee3b(0x14e))return{};if(_0x7ccd6b[_0x8cee3b(0x18f)]==='ok')return _0x7ccd6b['data'];return _0x538a14==='warn'&&_0x548f65&&console[_0x8cee3b(0x15f)](CLI_BIN_NAME+':\x20'+_0x548f65+_0x8cee3b(0x174)+_0x4aebf2+_0x8cee3b(0x18a)+_0x7ccd6b[_0x8cee3b(0x172)]),{};}const normalizedWriteCache=new Map();function normalizeLegacyConfigShape(_0x3b101c){const _0x2b1ff9=a135_0x3ac74b;if(!_0x3b101c||typeof _0x3b101c!==_0x2b1ff9(0x157))return{'config':{},'migrated':![]};const _0x5f0349={..._0x3b101c},_0x595163=_0x5f0349[_0x2b1ff9(0x19b)]&&typeof _0x5f0349[_0x2b1ff9(0x19b)]===_0x2b1ff9(0x157)?{..._0x5f0349[_0x2b1ff9(0x19b)]}:{},_0x1bd2af=Object['keys'](_0x595163)[_0x2b1ff9(0x183)],_0x55aa5a=_0x5f0349[_0x2b1ff9(0x179)]||_0x5f0349[_0x2b1ff9(0x18e)];let _0x3dc829=![];if(_0x55aa5a&&_0x1bd2af===0x0){const _0x43a057=typeof _0x5f0349[_0x2b1ff9(0x16c)]===_0x2b1ff9(0x17f)&&_0x5f0349[_0x2b1ff9(0x16c)]['trim']()?_0x5f0349[_0x2b1ff9(0x16c)]:String(_0x55aa5a)['trim']();_0x595163[_0x43a057]={'appcode':String(_0x55aa5a)[_0x2b1ff9(0x14d)](),..._0x5f0349['env']!=null?{'env':_0x5f0349[_0x2b1ff9(0x154)]}:{},..._0x5f0349[_0x2b1ff9(0x17a)]!=null?{'apiDir':_0x5f0349['apiDir']}:{},..._0x5f0349['cookie']!=null?{'cookie':_0x5f0349[_0x2b1ff9(0x15a)]}:{},..._0x5f0349[_0x2b1ff9(0x19d)]!=null?{'accessKey':_0x5f0349[_0x2b1ff9(0x19d)]}:{},..._0x5f0349['format']!=null?{'format':_0x5f0349[_0x2b1ff9(0x162)]}:{},..._0x5f0349[_0x2b1ff9(0x17c)]!=null?{'pageSize':_0x5f0349[_0x2b1ff9(0x17c)]}:{},..._0x5f0349['riskLevel']!=null?{'riskLevel':_0x5f0349[_0x2b1ff9(0x175)]}:{},..._0x5f0349['locale']!=null?{'locale':_0x5f0349[_0x2b1ff9(0x19a)]}:{}},_0x5f0349[_0x2b1ff9(0x19b)]=_0x595163;if(!_0x5f0349[_0x2b1ff9(0x16c)])_0x5f0349[_0x2b1ff9(0x16c)]=_0x43a057;_0x3dc829=!![];}return('appcode'in _0x5f0349||_0x2b1ff9(0x18e)in _0x5f0349)&&(delete _0x5f0349[_0x2b1ff9(0x179)],delete _0x5f0349[_0x2b1ff9(0x18e)],_0x3dc829=!![]),{'config':_0x5f0349,'migrated':_0x3dc829};}function writeNormalizedConfigIfNeeded(_0x1bfcc8,_0x1b6104){const _0xdc1cc1=a135_0x3ac74b,_0x3667e0=JSON['stringify'](_0x1b6104,null,0x2)+'\x0a';if(normalizedWriteCache[_0xdc1cc1(0x182)](_0x1bfcc8)===_0x3667e0)return;writeConfigFile(_0x1bfcc8,_0x1b6104),normalizedWriteCache[_0xdc1cc1(0x191)](_0x1bfcc8,_0x3667e0);}function parseAndNormalizeConfig(_0x4eac94,_0x391c09,_0x2830a8){const _0xb0c14b=a135_0x3ac74b,_0x4dee38=parseCliConfigJsonFile(_0x4eac94,_0x391c09,_0x2830a8),_0x367a92=normalizeLegacyConfigShape(_0x4dee38);if(_0x367a92[_0xb0c14b(0x156)])try{writeNormalizedConfigIfNeeded(_0x4eac94,_0x367a92['config']);}catch{}return _0x367a92[_0xb0c14b(0x151)];}export function loadRawConfigLayers(_0x495dac){const _0x1ff451=a135_0x3ac74b;let _0x45e314={},_0x5e6dfe={};const _0x278436=resolveConfigPath(homedir());_0x278436&&(_0x45e314=parseAndNormalizeConfig(_0x278436,'warn',_0x1ff451(0x18b)));const _0x27d6dc=_0x495dac??findProjectRootDirectory(),_0x4f4600=resolveConfigPath(_0x27d6dc);return _0x4f4600&&(_0x5e6dfe=parseAndNormalizeConfig(_0x4f4600,'warn',_0x1ff451(0x17e))),{'globalPath':_0x278436,'projectPath':_0x4f4600,'globalConfig':_0x45e314,'projectConfig':_0x5e6dfe};}function mergeRawConfigLayers(_0x31fb63){const _0x301f28=a135_0x3ac74b,{globalConfig:_0x5f28eb,projectConfig:_0x4d26a0}=_0x31fb63;if(_0x4d26a0[_0x301f28(0x186)]===![]){const _0x4f2b84={..._0x4d26a0};delete _0x4f2b84[_0x301f28(0x186)];const _0x3d5bb1=_0x4d26a0[_0x301f28(0x19b)]&&typeof _0x4d26a0[_0x301f28(0x19b)]===_0x301f28(0x157)?_0x4d26a0[_0x301f28(0x19b)]:{};Object[_0x301f28(0x199)](_0x3d5bb1)[_0x301f28(0x183)]>0x0?_0x4f2b84['apps']=_0x3d5bb1:delete _0x4f2b84[_0x301f28(0x19b)];if(_0x301f28(0x16c)in _0x4d26a0)_0x4f2b84[_0x301f28(0x16c)]=_0x4d26a0[_0x301f28(0x16c)];else Object['keys'](_0x3d5bb1)[_0x301f28(0x183)]>0x0&&(_0x4f2b84[_0x301f28(0x16c)]=Object[_0x301f28(0x199)](_0x3d5bb1)[0x0]);return _0x4f2b84;}const _0x1bd7a5=_0x5f28eb['apps']&&typeof _0x5f28eb['apps']===_0x301f28(0x157)?_0x5f28eb[_0x301f28(0x19b)]:{},_0x1946b2=_0x4d26a0[_0x301f28(0x19b)]&&typeof _0x4d26a0[_0x301f28(0x19b)]===_0x301f28(0x157)?_0x4d26a0[_0x301f28(0x19b)]:{},_0x3c8fcd={..._0x1bd7a5,..._0x1946b2},_0x369457={..._0x5f28eb,..._0x4d26a0};Object[_0x301f28(0x199)](_0x3c8fcd)[_0x301f28(0x183)]>0x0&&(_0x369457[_0x301f28(0x19b)]=_0x3c8fcd);if(_0x301f28(0x16c)in _0x4d26a0)_0x369457['defaultApp']=_0x4d26a0[_0x301f28(0x16c)];else{if(_0x1946b2&&Object[_0x301f28(0x199)](_0x1946b2)[_0x301f28(0x183)]>0x0)_0x369457[_0x301f28(0x16c)]=Object[_0x301f28(0x199)](_0x1946b2)[0x0];else{if(_0x5f28eb[_0x301f28(0x16c)])_0x369457[_0x301f28(0x16c)]=_0x5f28eb[_0x301f28(0x16c)];else{const _0x4ec1c2=Object[_0x301f28(0x199)](_0x1bd7a5);_0x4ec1c2[_0x301f28(0x183)]>0x0&&(_0x369457[_0x301f28(0x16c)]=_0x4ec1c2[0x0]);}}}return _0x369457;}export function readRawConfigWithLayers(_0x253607){const _0x40018c=loadRawConfigLayers(_0x253607);return{'config':mergeRawConfigLayers(_0x40018c),'layers':_0x40018c};}export function readRawConfig(_0x54d505){return mergeRawConfigLayers(loadRawConfigLayers(_0x54d505));}export function getConfigAppCode(_0x5b9aa7){const _0x55cbc2=a135_0x3ac74b,_0x55406d=readRawConfig(_0x5b9aa7);if(_0x55406d[_0x55cbc2(0x19b)]&&typeof _0x55406d[_0x55cbc2(0x19b)]===_0x55cbc2(0x157)){const _0x518378=_0x55406d[_0x55cbc2(0x16c)];if(_0x518378&&_0x55406d[_0x55cbc2(0x19b)][_0x518378]?.[_0x55cbc2(0x179)])return String(_0x55406d['apps'][_0x518378][_0x55cbc2(0x179)])['trim']();const _0x31fea8=Object[_0x55cbc2(0x19c)](_0x55406d['apps'])[0x0];if(_0x31fea8?.[_0x55cbc2(0x179)])return String(_0x31fea8[_0x55cbc2(0x179)])[_0x55cbc2(0x14d)]();}const _0x43b01f=_0x55406d[_0x55cbc2(0x179)]||_0x55406d[_0x55cbc2(0x18e)];if(typeof _0x43b01f!==_0x55cbc2(0x17f)||_0x43b01f[_0x55cbc2(0x14d)]()==='')return undefined;return _0x43b01f[_0x55cbc2(0x14d)]();}export function getMultiAppConfigs(_0x42b2f7=a135_0x3ac74b(0x19f),_0x139b7b){const _0x2be4ad=a135_0x3ac74b,_0x385b9a=_0x42b2f7===_0x2be4ad(0x187)?readRawConfig(_0x139b7b):loadRawConfigLayers(_0x139b7b)[_0x2be4ad(0x180)],_0x23693f=_0x385b9a[_0x2be4ad(0x19b)];if(!_0x23693f||typeof _0x23693f!==_0x2be4ad(0x157)||Object[_0x2be4ad(0x199)](_0x23693f)[_0x2be4ad(0x183)]===0x0)return null;const _0x140bd1=_0x385b9a[_0x2be4ad(0x16c)];return Object[_0x2be4ad(0x177)](_0x23693f)[_0x2be4ad(0x193)](([_0x1b5d2f,_0x313bad])=>({'name':_0x1b5d2f,'appcode':_0x313bad?.[_0x2be4ad(0x179)]||'','isDefault':_0x1b5d2f===_0x140bd1,'env':_0x313bad?.[_0x2be4ad(0x154)],'apiDir':_0x313bad?.['apiDir'],'cookie':_0x313bad?.[_0x2be4ad(0x15a)]||undefined}))['filter'](_0x5537e0=>_0x5537e0[_0x2be4ad(0x179)]);}export function getTemplateBaseUrl(_0x42c232){const _0x6b60c9=a135_0x3ac74b,_0x4563c2=readRawConfig(_0x42c232);if(_0x4563c2[_0x6b60c9(0x155)]&&typeof _0x4563c2['template_base_url']===_0x6b60c9(0x17f))return _0x4563c2[_0x6b60c9(0x155)][_0x6b60c9(0x167)](/\/$/,'');return _0x6b60c9(0x16d);}export function readConfigFile(_0x50c0b1){const _0x15048f=a135_0x3ac74b;return parseAndNormalizeConfig(_0x50c0b1,_0x15048f(0x176));}export function writeConfigFile(_0xdcfce2,_0x87e5b6){const _0xe79dd5=a135_0x3ac74b,_0x12bac2=dirname(_0xdcfce2);!existsSync(_0x12bac2)&&mkdirSync(_0x12bac2,{'recursive':!![]});const _0x3fbdc9=_0xdcfce2+_0xe79dd5(0x150);try{writeFileSync(_0x3fbdc9,JSON[_0xe79dd5(0x15e)](_0x87e5b6,null,0x2)+'\x0a',{'encoding':_0xe79dd5(0x16a),'mode':0x180}),renameSync(_0x3fbdc9,_0xdcfce2);}catch(_0x3595ac){try{unlinkSync(_0x3fbdc9);}catch{}throw _0x3595ac;}}export function resolveWriteConfigPath(_0x2664a6){const _0xa0b806=a135_0x3ac74b,_0x497bb2=_0x2664a6==='project'?process[_0xa0b806(0x184)]():homedir(),_0xf258b0=resolveConfigPath(_0x497bb2);return _0xf258b0??resolve(_0x497bb2,NEW_CONFIG_NAME);}function buildConfig(_0x55fef7,_0x4d96c3){const _0x5ddf78=a135_0x3ac74b,_0x2bc96c={};if(_0x55fef7['apps']&&typeof _0x55fef7[_0x5ddf78(0x19b)]===_0x5ddf78(0x157))for(const [_0x2b5e0f,_0x1b4059]of Object[_0x5ddf78(0x177)](_0x55fef7[_0x5ddf78(0x19b)])){_0x1b4059&&typeof _0x1b4059==='object'&&_0x1b4059[_0x5ddf78(0x179)]&&(_0x2bc96c[_0x2b5e0f]=_0x1b4059);}const _0x2d4ccf=_0x55fef7[_0x5ddf78(0x16c)]||undefined,_0x2f9f9a=Object['keys'](_0x2bc96c)[_0x5ddf78(0x183)]>0x0,_0x388769=_0x4d96c3['app']||env(_0x5ddf78(0x171))||undefined,_0x419ffa=_0x388769||_0x2d4ccf||undefined,_0x3fd402=_0x4d96c3[_0x5ddf78(0x179)]||env(_0x5ddf78(0x17d))||undefined,_0x25f335=_0x3fd402?Object[_0x5ddf78(0x177)](_0x2bc96c)[_0x5ddf78(0x198)](([,_0x33b97e])=>_0x33b97e?.['appcode']===_0x3fd402):undefined,_0x192594=_0x25f335?.[0x0],_0x18f331=_0x25f335?.[0x1];let _0x5d8d81=_0x3fd402?_0x192594:_0x419ffa,_0x4415e8=_0x5d8d81&&_0x2bc96c[_0x5d8d81]?_0x2bc96c[_0x5d8d81]:undefined;_0x3fd402&&_0x18f331&&(_0x4415e8=_0x18f331);const _0x34f22d=_0x3fd402?_0x18f331??_0x4415e8:_0x4415e8,_0x164804=_0x388769||(_0x3fd402?_0x192594:undefined),_0x18480a=_0x3fd402||_0x34f22d?.[_0x5ddf78(0x179)]||undefined,_0x5a947f=_0x4d96c3['env']||env(_0x5ddf78(0x164))||_0x34f22d?.[_0x5ddf78(0x154)]||_0x55fef7[_0x5ddf78(0x154)]||DEFAULT_CONFIG_VALUES[_0x5ddf78(0x154)],_0x298412=_0x34f22d?.['locale']||_0x55fef7['locale']||DEFAULT_CONFIG_VALUES[_0x5ddf78(0x19a)],_0xe44195=env(_0x5ddf78(0x197))||_0x34f22d?.[_0x5ddf78(0x15a)]||_0x55fef7[_0x5ddf78(0x15a)]||undefined,_0x1562c7=env('ACCESS_KEY')||_0x34f22d?.[_0x5ddf78(0x19d)]||_0x55fef7[_0x5ddf78(0x19d)]||undefined,_0x547132=_0x4d96c3['format']||env(_0x5ddf78(0x169))||_0x34f22d?.['format']||_0x55fef7[_0x5ddf78(0x162)],_0x35cff7=normalizeLegacyOutputFormat(_0x547132),_0xe35faa=env(_0x5ddf78(0x185))||_0x34f22d?.[_0x5ddf78(0x17c)]||_0x55fef7[_0x5ddf78(0x17c)],_0x477e7b=_0xe35faa?Number(_0xe35faa)||undefined:undefined,_0x4ca627=env(_0x5ddf78(0x188))||env('MAX_RISK')||_0x34f22d?.['riskLevel']||_0x55fef7['riskLevel']||_0x55fef7[_0x5ddf78(0x195)],_0x310d8a=_0x4ca627===_0x5ddf78(0x18d)||_0x4ca627==='write'?_0x4ca627:DEFAULT_CONFIG_VALUES[_0x5ddf78(0x175)],_0x195fbf=env(_0x5ddf78(0x1a0)),_0x3d3e16=_0x195fbf==='1'||_0x195fbf===_0x5ddf78(0x19e),_0x2b84e2=_0x34f22d?.[_0x5ddf78(0x17a)]||_0x55fef7['apiDir']||DEFAULT_CONFIG_VALUES['apiDir'],_0x72d738=isDaily(normalizeEnv(String(_0x5a947f)))?'daily':_0x5ddf78(0x166);return{'appCode':typeof _0x18480a==='string'&&_0x18480a[_0x5ddf78(0x14d)]()?_0x18480a[_0x5ddf78(0x14d)]():undefined,'env':_0x72d738,'locale':_0x298412,'cookie':_0xe44195,'accessKey':_0x1562c7,'format':_0x35cff7,'pageSize':_0x477e7b,'riskLevel':_0x310d8a,'verbose':_0x3d3e16,'apiDir':_0x2b84e2,'apps':_0x2bc96c,'defaultApp':_0x2d4ccf,'currentApp':_0x2f9f9a?_0x5d8d81:undefined,'explicitAppName':_0x164804,'raw':_0x55fef7};}async function buildAuth(_0x588dbb){const _0x5bd5fa=a135_0x3ac74b,{getCookie:_0x3b029c}=await import(_0x5bd5fa(0x16e)),_0x3b0721=_0x588dbb[_0x5bd5fa(0x15a)]||_0x3b029c(),_0x544813=_0x3b0721?await getIsSessionValid():![];return{'cookie':_0x3b0721,'isLoggedIn':_0x544813,async 'getOrLogin'(){const _0x385e15=_0x5bd5fa;if(_0x3b0721&&_0x544813)return _0x3b0721;throw CliErrors[_0x385e15(0x16b)]();}};}export function resolveApiFilePath(_0x29fab2,_0x69705b){const _0x4c8aac=a135_0x3ac74b,_0xbe0f89=resolve(process[_0x4c8aac(0x184)](),_0x29fab2),_0x2c8728=resolve(_0xbe0f89,_0x4c8aac(0x152));if(!_0x69705b)return _0x2c8728;const _0x216c91=readRawConfig(),_0x114efc=_0x216c91[_0x4c8aac(0x19b)]&&typeof _0x216c91['apps']==='object'?_0x216c91['apps']:{},_0x31077a=Object['entries'](_0x114efc)[_0x4c8aac(0x198)](([,_0x590fb1])=>_0x590fb1?.[_0x4c8aac(0x179)]===_0x69705b);if(!_0x31077a)return _0x2c8728;const [_0x55050d,_0x2f20e5]=_0x31077a,_0x3d67bc=typeof _0x216c91['defaultApp']===_0x4c8aac(0x17f)?_0x216c91['defaultApp']:undefined;if(_0x2f20e5?.[_0x4c8aac(0x17a)])return _0x2c8728;if(_0x3d67bc&&_0x55050d!==_0x3d67bc)return resolve(_0xbe0f89,_0x55050d+_0x4c8aac(0x192));return _0x2c8728;}
|
|
1
|
+
const a135_0x4f5558=a135_0x247a;(function(_0x58457e,_0x1a268f){const _0x445301=a135_0x247a,_0x397e7f=_0x58457e();while(!![]){try{const _0xacf717=parseInt(_0x445301(0x1e1))/0x1*(parseInt(_0x445301(0x1ec))/0x2)+parseInt(_0x445301(0x1b5))/0x3*(-parseInt(_0x445301(0x1c3))/0x4)+-parseInt(_0x445301(0x1eb))/0x5*(-parseInt(_0x445301(0x1bf))/0x6)+-parseInt(_0x445301(0x1bb))/0x7*(parseInt(_0x445301(0x1cc))/0x8)+-parseInt(_0x445301(0x1ad))/0x9+parseInt(_0x445301(0x1db))/0xa+parseInt(_0x445301(0x1d7))/0xb*(parseInt(_0x445301(0x1c5))/0xc);if(_0xacf717===_0x1a268f)break;else _0x397e7f['push'](_0x397e7f['shift']());}catch(_0x22ba60){_0x397e7f['push'](_0x397e7f['shift']());}}}(a135_0xac16,0xc03e4));import{readFileSync,writeFileSync,existsSync,mkdirSync,renameSync,unlinkSync}from'node:fs';import{resolve,dirname,parse}from'node:path';import{homedir}from'node:os';import{logger}from'./utils/logger.js';import{getIsSessionValid}from'./auth/is-session-valid.js';import{CliErrors}from'./errors.js';import{CLI_BIN_NAME}from'./constant/cli.js';import{DEFAULT_CONFIG_VALUES}from'./constant/defaults.js';import{normalizeEnv,isDaily}from'./constant/env.js';import{normalizeLegacyOutputFormat}from'./framework/types.js';function a135_0xac16(){const _0x75faa9=['string','warn','.lovrabet.json','8266734awadQH','template_base_url','-api.ts','error','defaultApp','migrated','authRequired','accessKey','85422QseMxO','trim','silent','maxRisk','pageSize','app','439061dQNyaP','utf8','set','cookie','48OgDLOb','./auth/get-cookie.js','./constant/domain.js','daily','184KMvYsU','userDomain','12bEwSGq','write','true','projectConfig','riskLevel','map','config','136bmsLhB','locale','appcode','apiDir','ACCESS_KEY','setRawCommand','status','object','.lovrabetrc','message','filter','19220003rSOGoZ','keys','https://g.lovrabet.com/dist/lovrabet-skill','.rabetbase.json','6957260Qzpzfn','runtimeDomain','./utils/is-non-interactive.js','stringify','COOKIE','Global','698lWkmAF','cwd','read','get','APP','find','apiDomain','apps','project','missing','898330pBPDnC','578BdrlNt','.tmp','parse','setLogPath','format','length','\x20config\x20file\x20ignored\x20(invalid\x20JSON\x20or\x20unreadable):\x20','PAGE_SIZE','inherit','argv','env','ENV','values','FORMAT','VERBOSE','empty','merged','APPCODE','entries'];a135_0xac16=function(){return _0x75faa9;};return a135_0xac16();}function env(_0x1daa96){return process.env[`RABETBASE_${_0x1daa96}`]||process.env[`LOVRABET_${_0x1daa96}`]||undefined;}function a135_0x247a(_0x4a0556,_0x5b72d3){_0x4a0556=_0x4a0556-0x1aa;const _0xac16d5=a135_0xac16();let _0x247a23=_0xac16d5[_0x4a0556];return _0x247a23;}export const NEW_CONFIG_NAME=a135_0x4f5558(0x1da);export const CONFIG_NAMES=[a135_0x4f5558(0x1da),a135_0x4f5558(0x1ac),a135_0x4f5558(0x1d4)];export const LEGACY_CONFIG_NAMES=CONFIG_NAMES[a135_0x4f5558(0x1d6)](_0x243038=>_0x243038!==NEW_CONFIG_NAME);export function resolveConfigPath(_0x483b27){for(const _0x449576 of CONFIG_NAMES){const _0x369a4f=resolve(_0x483b27,_0x449576);if(existsSync(_0x369a4f))return _0x369a4f;}return undefined;}export function findProjectRootDirectory(_0x522076=process[a135_0x4f5558(0x1e2)]()){let _0x4a54af=resolve(_0x522076);const {root:_0x4772c8}=parse(_0x4a54af),_0xb78a44=homedir();while(!![]){if(resolveConfigPath(_0x4a54af)){if(_0x4a54af===_0xb78a44)break;return _0x4a54af;}if(_0x4a54af===_0x4772c8||_0x4a54af===_0xb78a44)break;const _0x362457=dirname(_0x4a54af);if(_0x362457===_0x4a54af)break;_0x4a54af=_0x362457;}return resolve(_0x522076);}export async function createContext(_0x23196c){const _0x579e0c=a135_0x4f5558,_0x19c309=readRawConfig(),_0x332d4=buildConfig(_0x19c309,_0x23196c),{initEnv:_0x530b95}=await import('./constant/env.js');if(_0x332d4[_0x579e0c(0x1f6)])_0x530b95(_0x332d4[_0x579e0c(0x1f6)]);else _0x23196c['env']&&typeof _0x23196c[_0x579e0c(0x1f6)]===_0x579e0c(0x1aa)&&_0x530b95(_0x23196c[_0x579e0c(0x1f6)]);const {initDomains:_0x4f5919,getUserDomain:_0x3e15bb,getApiDomain:_0x56ea96}=await import(_0x579e0c(0x1c1));_0x4f5919({'apiDomain':_0x19c309[_0x579e0c(0x1e7)]||undefined,'userDomain':_0x19c309[_0x579e0c(0x1c4)]||undefined,'runtimeDomain':_0x19c309[_0x579e0c(0x1dc)]||undefined});const _0x5dbba6={'apiDomain':_0x56ea96(),'userDomain':_0x3e15bb()},_0x33f7fe=await buildAuth(_0x332d4);logger[_0x579e0c(0x1ef)](process[_0x579e0c(0x1e2)]());const _0x329716=(CLI_BIN_NAME+'\x20'+process[_0x579e0c(0x1f5)]['slice'](0x2)['join']('\x20'))[_0x579e0c(0x1b6)]();logger[_0x579e0c(0x1d1)](_0x329716);const {isNonInteractive:_0x4eeb5e}=await import(_0x579e0c(0x1dd)),_0x130860=_0x4eeb5e(_0x23196c);return{'config':_0x332d4,'auth':_0x33f7fe,'logger':logger,'env':_0x5dbba6,'nonInteractive':_0x130860};}export function buildConfigFromFlags(_0xa71792){return buildConfig(readRawConfig(),_0xa71792);}export function getProjectConfigPath(){const _0x59b5a2=a135_0x4f5558;return resolveConfigPath(process[_0x59b5a2(0x1e2)]());}export function getGlobalConfigPath(){return resolveConfigPath(homedir());}export function isInProject(){return!!getProjectConfigPath();}export function inspectCliConfigJsonFile(_0x5cb6a7){const _0x44a088=a135_0x4f5558;if(!existsSync(_0x5cb6a7))return{'status':'missing'};try{const _0x5ecbdc=readFileSync(_0x5cb6a7,{'encoding':'utf8'});if(!_0x5ecbdc?.[_0x44a088(0x1b6)]())return{'status':_0x44a088(0x1fb)};const _0x9a005c=JSON[_0x44a088(0x1ee)](_0x5ecbdc);return{'status':'ok','data':_0x9a005c};}catch(_0x39dc82){return{'status':_0x44a088(0x1b0),'message':_0x39dc82 instanceof Error?_0x39dc82[_0x44a088(0x1d5)]:String(_0x39dc82)};}}function parseCliConfigJsonFile(_0x5929c0,_0x238eb8,_0x5c4e04){const _0x449fb8=a135_0x4f5558,_0x19ee92=inspectCliConfigJsonFile(_0x5929c0);if(_0x19ee92[_0x449fb8(0x1d2)]===_0x449fb8(0x1ea)||_0x19ee92[_0x449fb8(0x1d2)]==='empty')return{};if(_0x19ee92[_0x449fb8(0x1d2)]==='ok')return _0x19ee92['data'];return _0x238eb8===_0x449fb8(0x1ab)&&_0x5c4e04&&console[_0x449fb8(0x1b0)](CLI_BIN_NAME+':\x20'+_0x5c4e04+_0x449fb8(0x1f2)+_0x5929c0+'\x0a\x20\x20'+_0x19ee92['message']),{};}const normalizedWriteCache=new Map();function normalizeLegacyConfigShape(_0x14a6c7){const _0x294daa=a135_0x4f5558;if(!_0x14a6c7||typeof _0x14a6c7!=='object')return{'config':{},'migrated':![]};const _0x31c4d9={..._0x14a6c7},_0x31b31e=_0x31c4d9[_0x294daa(0x1e8)]&&typeof _0x31c4d9[_0x294daa(0x1e8)]===_0x294daa(0x1d3)?{..._0x31c4d9['apps']}:{},_0x4c5a5f=Object[_0x294daa(0x1d8)](_0x31b31e)[_0x294daa(0x1f1)],_0x1d37c4=_0x31c4d9[_0x294daa(0x1ce)]||_0x31c4d9[_0x294daa(0x1ba)];let _0x4e25ea=![];if(_0x1d37c4&&_0x4c5a5f===0x0){const _0x30532b=typeof _0x31c4d9[_0x294daa(0x1b1)]==='string'&&_0x31c4d9[_0x294daa(0x1b1)][_0x294daa(0x1b6)]()?_0x31c4d9['defaultApp']:String(_0x1d37c4)[_0x294daa(0x1b6)]();_0x31b31e[_0x30532b]={'appcode':String(_0x1d37c4)[_0x294daa(0x1b6)](),..._0x31c4d9[_0x294daa(0x1f6)]!=null?{'env':_0x31c4d9['env']}:{},..._0x31c4d9[_0x294daa(0x1cf)]!=null?{'apiDir':_0x31c4d9[_0x294daa(0x1cf)]}:{},..._0x31c4d9[_0x294daa(0x1be)]!=null?{'cookie':_0x31c4d9['cookie']}:{},..._0x31c4d9['accessKey']!=null?{'accessKey':_0x31c4d9[_0x294daa(0x1b4)]}:{},..._0x31c4d9['format']!=null?{'format':_0x31c4d9[_0x294daa(0x1f0)]}:{},..._0x31c4d9[_0x294daa(0x1b9)]!=null?{'pageSize':_0x31c4d9['pageSize']}:{},..._0x31c4d9[_0x294daa(0x1c9)]!=null?{'riskLevel':_0x31c4d9['riskLevel']}:{},..._0x31c4d9[_0x294daa(0x1cd)]!=null?{'locale':_0x31c4d9[_0x294daa(0x1cd)]}:{}},_0x31c4d9[_0x294daa(0x1e8)]=_0x31b31e;if(!_0x31c4d9[_0x294daa(0x1b1)])_0x31c4d9[_0x294daa(0x1b1)]=_0x30532b;_0x4e25ea=!![];}return('appcode'in _0x31c4d9||_0x294daa(0x1ba)in _0x31c4d9)&&(delete _0x31c4d9[_0x294daa(0x1ce)],delete _0x31c4d9[_0x294daa(0x1ba)],_0x4e25ea=!![]),{'config':_0x31c4d9,'migrated':_0x4e25ea};}function writeNormalizedConfigIfNeeded(_0x431ebb,_0x472c10){const _0x1bda18=a135_0x4f5558,_0x3c354b=JSON[_0x1bda18(0x1de)](_0x472c10,null,0x2)+'\x0a';if(normalizedWriteCache[_0x1bda18(0x1e4)](_0x431ebb)===_0x3c354b)return;writeConfigFile(_0x431ebb,_0x472c10),normalizedWriteCache[_0x1bda18(0x1bd)](_0x431ebb,_0x3c354b);}function parseAndNormalizeConfig(_0x440df5,_0x1267ad,_0x3e8a85){const _0x2799e1=a135_0x4f5558,_0x152c9f=parseCliConfigJsonFile(_0x440df5,_0x1267ad,_0x3e8a85),_0x1150c1=normalizeLegacyConfigShape(_0x152c9f);if(_0x1150c1[_0x2799e1(0x1b2)])try{writeNormalizedConfigIfNeeded(_0x440df5,_0x1150c1['config']);}catch{}return _0x1150c1[_0x2799e1(0x1cb)];}export function loadRawConfigLayers(_0x3f9256){const _0x131093=a135_0x4f5558;let _0x39e270={},_0x1fa0c3={};const _0x46ccc1=resolveConfigPath(homedir());_0x46ccc1&&(_0x39e270=parseAndNormalizeConfig(_0x46ccc1,_0x131093(0x1ab),_0x131093(0x1e0)));const _0x58f17b=_0x3f9256??findProjectRootDirectory(),_0x9b35cd=resolveConfigPath(_0x58f17b);return _0x9b35cd&&(_0x1fa0c3=parseAndNormalizeConfig(_0x9b35cd,_0x131093(0x1ab),'Project')),{'globalPath':_0x46ccc1,'projectPath':_0x9b35cd,'globalConfig':_0x39e270,'projectConfig':_0x1fa0c3};}function mergeRawConfigLayers(_0x273618){const _0x3837ff=a135_0x4f5558,{globalConfig:_0x4066a2,projectConfig:_0x1b7cb4}=_0x273618;if(_0x1b7cb4['inherit']===![]){const _0x22df2e={..._0x1b7cb4};delete _0x22df2e[_0x3837ff(0x1f4)];const _0x184fdd=_0x1b7cb4[_0x3837ff(0x1e8)]&&typeof _0x1b7cb4[_0x3837ff(0x1e8)]===_0x3837ff(0x1d3)?_0x1b7cb4[_0x3837ff(0x1e8)]:{};Object['keys'](_0x184fdd)[_0x3837ff(0x1f1)]>0x0?_0x22df2e[_0x3837ff(0x1e8)]=_0x184fdd:delete _0x22df2e[_0x3837ff(0x1e8)];if(_0x3837ff(0x1b1)in _0x1b7cb4)_0x22df2e[_0x3837ff(0x1b1)]=_0x1b7cb4[_0x3837ff(0x1b1)];else Object['keys'](_0x184fdd)['length']>0x0&&(_0x22df2e[_0x3837ff(0x1b1)]=Object[_0x3837ff(0x1d8)](_0x184fdd)[0x0]);return _0x22df2e;}const _0x3ef068=_0x4066a2[_0x3837ff(0x1e8)]&&typeof _0x4066a2[_0x3837ff(0x1e8)]==='object'?_0x4066a2[_0x3837ff(0x1e8)]:{},_0x595cd2=_0x1b7cb4[_0x3837ff(0x1e8)]&&typeof _0x1b7cb4[_0x3837ff(0x1e8)]===_0x3837ff(0x1d3)?_0x1b7cb4[_0x3837ff(0x1e8)]:{},_0x252ba3={..._0x3ef068,..._0x595cd2},_0x111ec5={..._0x4066a2,..._0x1b7cb4};Object[_0x3837ff(0x1d8)](_0x252ba3)[_0x3837ff(0x1f1)]>0x0&&(_0x111ec5['apps']=_0x252ba3);if(_0x3837ff(0x1b1)in _0x1b7cb4)_0x111ec5[_0x3837ff(0x1b1)]=_0x1b7cb4['defaultApp'];else{if(_0x595cd2&&Object[_0x3837ff(0x1d8)](_0x595cd2)[_0x3837ff(0x1f1)]>0x0)_0x111ec5[_0x3837ff(0x1b1)]=Object['keys'](_0x595cd2)[0x0];else{if(_0x4066a2['defaultApp'])_0x111ec5[_0x3837ff(0x1b1)]=_0x4066a2[_0x3837ff(0x1b1)];else{const _0x23283d=Object[_0x3837ff(0x1d8)](_0x3ef068);_0x23283d[_0x3837ff(0x1f1)]>0x0&&(_0x111ec5[_0x3837ff(0x1b1)]=_0x23283d[0x0]);}}}return _0x111ec5;}export function readRawConfigWithLayers(_0x299279){const _0x370f42=loadRawConfigLayers(_0x299279);return{'config':mergeRawConfigLayers(_0x370f42),'layers':_0x370f42};}export function readRawConfig(_0x598fa6){return mergeRawConfigLayers(loadRawConfigLayers(_0x598fa6));}export function getConfigAppCode(_0x548d26){const _0x4001b4=a135_0x4f5558,_0x2a6dbd=readRawConfig(_0x548d26);if(_0x2a6dbd[_0x4001b4(0x1e8)]&&typeof _0x2a6dbd[_0x4001b4(0x1e8)]===_0x4001b4(0x1d3)){const _0x386bdb=_0x2a6dbd[_0x4001b4(0x1b1)];if(_0x386bdb&&_0x2a6dbd['apps'][_0x386bdb]?.['appcode'])return String(_0x2a6dbd['apps'][_0x386bdb][_0x4001b4(0x1ce)])[_0x4001b4(0x1b6)]();const _0x1a9eb9=Object[_0x4001b4(0x1f8)](_0x2a6dbd[_0x4001b4(0x1e8)])[0x0];if(_0x1a9eb9?.['appcode'])return String(_0x1a9eb9['appcode'])[_0x4001b4(0x1b6)]();}const _0x7cbcfc=_0x2a6dbd[_0x4001b4(0x1ce)]||_0x2a6dbd[_0x4001b4(0x1ba)];if(typeof _0x7cbcfc!=='string'||_0x7cbcfc[_0x4001b4(0x1b6)]()==='')return undefined;return _0x7cbcfc[_0x4001b4(0x1b6)]();}export function getMultiAppConfigs(_0x333445=a135_0x4f5558(0x1e9),_0x1f04de){const _0x1c8965=a135_0x4f5558,_0x10d762=_0x333445===_0x1c8965(0x1fc)?readRawConfig(_0x1f04de):loadRawConfigLayers(_0x1f04de)[_0x1c8965(0x1c8)],_0x55d6dd=_0x10d762[_0x1c8965(0x1e8)];if(!_0x55d6dd||typeof _0x55d6dd!==_0x1c8965(0x1d3)||Object['keys'](_0x55d6dd)[_0x1c8965(0x1f1)]===0x0)return null;const _0x47214d=_0x10d762[_0x1c8965(0x1b1)];return Object['entries'](_0x55d6dd)[_0x1c8965(0x1ca)](([_0x48e7eb,_0x5d4bb8])=>({'name':_0x48e7eb,'appcode':_0x5d4bb8?.[_0x1c8965(0x1ce)]||'','isDefault':_0x48e7eb===_0x47214d,'env':_0x5d4bb8?.[_0x1c8965(0x1f6)],'apiDir':_0x5d4bb8?.[_0x1c8965(0x1cf)],'cookie':_0x5d4bb8?.[_0x1c8965(0x1be)]||undefined}))[_0x1c8965(0x1d6)](_0x4de715=>_0x4de715[_0x1c8965(0x1ce)]);}export function getTemplateBaseUrl(_0x1cae0f){const _0x3116b2=a135_0x4f5558,_0x53a9d8=readRawConfig(_0x1cae0f);if(_0x53a9d8[_0x3116b2(0x1ae)]&&typeof _0x53a9d8[_0x3116b2(0x1ae)]===_0x3116b2(0x1aa))return _0x53a9d8[_0x3116b2(0x1ae)]['replace'](/\/$/,'');return _0x3116b2(0x1d9);}export function readConfigFile(_0x56b534){const _0x6c5dc=a135_0x4f5558;return parseAndNormalizeConfig(_0x56b534,_0x6c5dc(0x1b7));}export function writeConfigFile(_0x78247d,_0x2a1805){const _0x14b26a=a135_0x4f5558,_0x303c43=dirname(_0x78247d);!existsSync(_0x303c43)&&mkdirSync(_0x303c43,{'recursive':!![]});const _0x46a13a=_0x78247d+_0x14b26a(0x1ed);try{writeFileSync(_0x46a13a,JSON[_0x14b26a(0x1de)](_0x2a1805,null,0x2)+'\x0a',{'encoding':_0x14b26a(0x1bc),'mode':0x180}),renameSync(_0x46a13a,_0x78247d);}catch(_0xc41c19){try{unlinkSync(_0x46a13a);}catch{}throw _0xc41c19;}}export function resolveWriteConfigPath(_0x20e8a4){const _0x401bde=_0x20e8a4==='project'?process['cwd']():homedir(),_0x3d5c7f=resolveConfigPath(_0x401bde);return _0x3d5c7f??resolve(_0x401bde,NEW_CONFIG_NAME);}function buildConfig(_0x25cf87,_0x44ffd6){const _0x1b0d88=a135_0x4f5558,_0x2682c3={};if(_0x25cf87[_0x1b0d88(0x1e8)]&&typeof _0x25cf87[_0x1b0d88(0x1e8)]===_0x1b0d88(0x1d3))for(const [_0x106fe2,_0x1c375a]of Object[_0x1b0d88(0x1fe)](_0x25cf87['apps'])){_0x1c375a&&typeof _0x1c375a===_0x1b0d88(0x1d3)&&_0x1c375a['appcode']&&(_0x2682c3[_0x106fe2]=_0x1c375a);}const _0x5714f4=_0x25cf87['defaultApp']||undefined,_0x587c75=Object['keys'](_0x2682c3)[_0x1b0d88(0x1f1)]>0x0,_0x54f8cf=_0x44ffd6[_0x1b0d88(0x1ba)]||env(_0x1b0d88(0x1e5))||undefined,_0xb10251=_0x54f8cf||_0x5714f4||undefined,_0x28dbd1=_0x44ffd6[_0x1b0d88(0x1ce)]||env(_0x1b0d88(0x1fd))||undefined,_0x55619d=_0x28dbd1?Object[_0x1b0d88(0x1fe)](_0x2682c3)[_0x1b0d88(0x1e6)](([,_0x56d089])=>_0x56d089?.[_0x1b0d88(0x1ce)]===_0x28dbd1):undefined,_0x29802c=_0x55619d?.[0x0],_0x232392=_0x55619d?.[0x1];let _0x49526c=_0x28dbd1?_0x29802c:_0xb10251,_0x3ef06d=_0x49526c&&_0x2682c3[_0x49526c]?_0x2682c3[_0x49526c]:undefined;_0x28dbd1&&_0x232392&&(_0x3ef06d=_0x232392);const _0x147a15=_0x28dbd1?_0x232392??_0x3ef06d:_0x3ef06d,_0x60926e=_0x54f8cf||(_0x28dbd1?_0x29802c:undefined),_0x1db28c=_0x28dbd1||_0x147a15?.[_0x1b0d88(0x1ce)]||undefined,_0x135399=_0x44ffd6[_0x1b0d88(0x1f6)]||env(_0x1b0d88(0x1f7))||_0x147a15?.[_0x1b0d88(0x1f6)]||_0x25cf87[_0x1b0d88(0x1f6)]||DEFAULT_CONFIG_VALUES[_0x1b0d88(0x1f6)],_0x550152=_0x147a15?.[_0x1b0d88(0x1cd)]||_0x25cf87['locale']||DEFAULT_CONFIG_VALUES['locale'],_0x174d1a=env(_0x1b0d88(0x1df))||_0x147a15?.['cookie']||_0x25cf87[_0x1b0d88(0x1be)]||undefined,_0x495841=env(_0x1b0d88(0x1d0))||_0x147a15?.['accessKey']||_0x25cf87[_0x1b0d88(0x1b4)]||undefined,_0x577744=_0x44ffd6[_0x1b0d88(0x1f0)]||env(_0x1b0d88(0x1f9))||_0x147a15?.[_0x1b0d88(0x1f0)]||_0x25cf87['format'],_0x370f11=normalizeLegacyOutputFormat(_0x577744),_0x3088e8=env(_0x1b0d88(0x1f3))||_0x147a15?.[_0x1b0d88(0x1b9)]||_0x25cf87[_0x1b0d88(0x1b9)],_0x859262=_0x3088e8?Number(_0x3088e8)||undefined:undefined,_0x179d76=env('RISK_LEVEL')||env('MAX_RISK')||_0x147a15?.[_0x1b0d88(0x1c9)]||_0x25cf87[_0x1b0d88(0x1c9)]||_0x25cf87[_0x1b0d88(0x1b8)],_0x3949f6=_0x179d76===_0x1b0d88(0x1e3)||_0x179d76===_0x1b0d88(0x1c6)?_0x179d76:DEFAULT_CONFIG_VALUES[_0x1b0d88(0x1c9)],_0x137cc1=env(_0x1b0d88(0x1fa)),_0x5ba8d6=_0x137cc1==='1'||_0x137cc1===_0x1b0d88(0x1c7),_0x45c552=_0x147a15?.[_0x1b0d88(0x1cf)]||_0x25cf87[_0x1b0d88(0x1cf)]||DEFAULT_CONFIG_VALUES[_0x1b0d88(0x1cf)],_0x1220bc=isDaily(normalizeEnv(String(_0x135399)))?_0x1b0d88(0x1c2):'production';return{'appCode':typeof _0x1db28c==='string'&&_0x1db28c[_0x1b0d88(0x1b6)]()?_0x1db28c[_0x1b0d88(0x1b6)]():undefined,'env':_0x1220bc,'locale':_0x550152,'cookie':_0x174d1a,'accessKey':_0x495841,'format':_0x370f11,'pageSize':_0x859262,'riskLevel':_0x3949f6,'verbose':_0x5ba8d6,'apiDir':_0x45c552,'apps':_0x2682c3,'defaultApp':_0x5714f4,'currentApp':_0x587c75?_0x49526c:undefined,'explicitAppName':_0x60926e,'raw':_0x25cf87};}async function buildAuth(_0x1d85c4){const _0x2e4ad6=a135_0x4f5558,{getCookie:_0xd2245a}=await import(_0x2e4ad6(0x1c0)),_0x38d79f=_0x1d85c4[_0x2e4ad6(0x1be)]||_0xd2245a(),_0x147b09=_0x38d79f?await getIsSessionValid():![];return{'cookie':_0x38d79f,'isLoggedIn':_0x147b09,async 'getOrLogin'(){const _0x15f9a7=_0x2e4ad6;if(_0x38d79f&&_0x147b09)return _0x38d79f;throw CliErrors[_0x15f9a7(0x1b3)]();}};}export function resolveApiFilePath(_0x2e8c62,_0x5a2d3e){const _0x11b037=a135_0x4f5558,_0x148d2e=resolve(process[_0x11b037(0x1e2)](),_0x2e8c62),_0x3fe2b9=resolve(_0x148d2e,'api.ts');if(!_0x5a2d3e)return _0x3fe2b9;const _0x17664f=readRawConfig(),_0x8381b0=_0x17664f[_0x11b037(0x1e8)]&&typeof _0x17664f[_0x11b037(0x1e8)]===_0x11b037(0x1d3)?_0x17664f[_0x11b037(0x1e8)]:{},_0xf6cf63=Object[_0x11b037(0x1fe)](_0x8381b0)[_0x11b037(0x1e6)](([,_0xe22b7b])=>_0xe22b7b?.[_0x11b037(0x1ce)]===_0x5a2d3e);if(!_0xf6cf63)return _0x3fe2b9;const [_0x356243,_0xbc912d]=_0xf6cf63,_0x26fbe2=typeof _0x17664f['defaultApp']===_0x11b037(0x1aa)?_0x17664f[_0x11b037(0x1b1)]:undefined;if(_0xbc912d?.[_0x11b037(0x1cf)])return _0x3fe2b9;if(_0x26fbe2&&_0x356243!==_0x26fbe2)return resolve(_0x148d2e,_0x356243+_0x11b037(0x1af));return _0x3fe2b9;}
|