@lovrabet/rabetbase-cli 2.1.7-beta.3 → 2.1.7-beta.5
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
|
+
const a121_0xfc4116=a121_0x3ed8;(function(_0x286339,_0x1c0548){const _0x25d182=a121_0x3ed8,_0x12398d=_0x286339();while(!![]){try{const _0x362345=-parseInt(_0x25d182(0x190))/0x1+parseInt(_0x25d182(0x193))/0x2+parseInt(_0x25d182(0x17f))/0x3*(-parseInt(_0x25d182(0x177))/0x4)+-parseInt(_0x25d182(0x175))/0x5+-parseInt(_0x25d182(0x181))/0x6*(parseInt(_0x25d182(0x18f))/0x7)+-parseInt(_0x25d182(0x187))/0x8+parseInt(_0x25d182(0x16e))/0x9;if(_0x362345===_0x1c0548)break;else _0x12398d['push'](_0x12398d['shift']());}catch(_0x549830){_0x12398d['push'](_0x12398d['shift']());}}}(a121_0x15bd,0x1f7ca));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';function a121_0x15bd(){const _0x21dab9=['\x22\x20for\x20sqlCode\x20','utf8','entries','dbName','10144431sWSXea','remoteId','boolean','validation','replace','dbDirectory','sqlCode','919370FiDEVL','sqlRoot','176096EBsiwY','isFinite','Local\x20SQL\x20not\x20found:\x20','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','length','sqls','toISOString','dbId','12NoWEUx','\x20pushed,\x20','1337034RSxkyC','set','filter','catch','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','force','1992248XjhYIg','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','path','push','unchanged','sql','sqlcode','appCode','7eFmqCL','201956zXgaAy','lockFilePath','lastSync','71214lYuFeY','No\x20database\x20matches\x20local\x20directory\x20\x22','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','Push\x20local\x20SQL\x20files\x20to\x20remote','str','get','filePath','/smartapi/custom/updateUserCustomSql','\x20failed','Would\x20push\x20','relativePath','projectRoot','version','hash','has','trashDir','bool','POST','sqlName','message','mode'];a121_0x15bd=function(){return _0x21dab9;};return a121_0x15bd();}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';function a121_0x3ed8(_0x597e55,_0x547e9e){_0x597e55=_0x597e55-0x15f;const _0x15bd4c=a121_0x15bd();let _0x3ed815=_0x15bd4c[_0x597e55];return _0x3ed815;}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(_0x1985bc,_0x4abbd0,_0x27bf6d){const _0x414366=a121_0x3ed8,_0x2746bf=await scanLocalSqlQueries(_0x1985bc),_0x409bb7=new Map();for(const _0x1b2145 of _0x2746bf){if(_0x27bf6d&&_0x1b2145[_0x414366(0x174)]!==_0x27bf6d)continue;const _0x1d7a39=_0x409bb7[_0x414366(0x198)](_0x1b2145[_0x414366(0x174)])??[];_0x1d7a39['push'](_0x1b2145),_0x409bb7[_0x414366(0x182)](_0x1b2145['sqlCode'],_0x1d7a39);}if(_0x27bf6d&&!_0x409bb7[_0x414366(0x163)](_0x27bf6d))throw CliErrors[_0x414366(0x171)](_0x414366(0x179)+_0x27bf6d);const _0x2b29b4=[];for(const [_0x3c3c63,_0x17377c]of _0x409bb7[_0x414366(0x16c)]()){if(_0x17377c[_0x414366(0x17b)]===0x1){_0x2b29b4[_0x414366(0x18a)](_0x17377c[0x0]);continue;}const _0x5c9020=_0x4abbd0['sqls'][_0x3c3c63],_0x41d41d=_0x5c9020?.['path'],_0x367665=_0x41d41d?_0x17377c[_0x414366(0x183)](_0x2062cf=>_0x2062cf[_0x414366(0x15f)]!==_0x41d41d):_0x17377c;if(_0x5c9020&&_0x367665['length']===0x1){_0x2b29b4['push'](_0x367665[0x0]);continue;}throw CliErrors[_0x414366(0x171)]('Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20'+_0x3c3c63+_0x414366(0x188));}return _0x2b29b4;}export const sqlPush={'service':a121_0xfc4116(0x18c),'command':a121_0xfc4116(0x18a),'description':a121_0xfc4116(0x196),'risk':'high-risk-write','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a121_0xfc4116(0x186),'type':a121_0xfc4116(0x170),'description':'Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock'}],async 'dryRun'(_0x28bb93){const _0x270dca=a121_0xfc4116,_0x4e5077=loadSqlProjectConfig(_0x28bb93[_0x270dca(0x18e)]),_0x451937=await readSqlLockFile(_0x4e5077['lockFilePath']),{appLock:_0x2b2a62}=ensureSqlLockScope(_0x451937??createEmptySqlLock(),_0x28bb93[_0x270dca(0x18e)],_0x4e5077['sqlRoot'],_0x270dca(0x18a)),_0x1f3e2b=await getTargetSqlQueries(_0x4e5077,_0x2b2a62,_0x28bb93['str'](_0x270dca(0x18d))||undefined),_0xa51142=[];for(const _0x569db2 of _0x1f3e2b){const _0xa6b5f=await computeSqlFileHash(_0x569db2[_0x270dca(0x199)]),_0x23209e=_0x2b2a62[_0x270dca(0x17c)][_0x569db2[_0x270dca(0x174)]],_0x3407ee=!!_0x23209e&&(_0x23209e['path']!==_0x569db2[_0x270dca(0x15f)]||!!_0x569db2[_0x270dca(0x167)]&&_0x23209e[_0x270dca(0x167)]!==_0x569db2['sqlName']);if(!_0x28bb93[_0x270dca(0x165)]('force')&&_0x23209e&&_0x23209e[_0x270dca(0x162)]===_0xa6b5f&&!_0x3407ee)continue;_0xa51142['push'](_0x569db2[_0x270dca(0x174)]);}return{'method':_0x270dca(0x166),'url':_0x270dca(0x19a),'body':{'sqlCodes':_0xa51142,'appCode':_0x28bb93['appCode']},'description':_0x270dca(0x19c)+_0xa51142[_0x270dca(0x17b)]+'\x20SQL\x20file(s)'};},async 'execute'(_0xcc68aa){const _0x505627=a121_0xfc4116,_0x22383f=loadSqlProjectConfig(_0xcc68aa['appCode']),_0x5f4b7d=await readSqlLockFile(_0x22383f['lockFilePath']),{lockData:_0x189162,appLock:_0x38706f}=ensureSqlLockScope(_0x5f4b7d??createEmptySqlLock(),_0xcc68aa['appCode'],_0x22383f[_0x505627(0x176)],_0x505627(0x18a)),_0xe7f4fd=await getTargetSqlQueries(_0x22383f,_0x38706f,_0xcc68aa[_0x505627(0x197)]('sqlcode')||undefined);if(_0xe7f4fd[_0x505627(0x17b)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':'No\x20local\x20SQL\x20files\x20found.'};const _0x56e3b5=[],_0x23774e=[],_0x5a892d=[];for(const _0x44ccbc of _0xe7f4fd){const _0x155622=_0x38706f[_0x505627(0x17c)][_0x44ccbc['sqlCode']];if(!_0x155622){_0x5a892d[_0x505627(0x18a)]({'sqlCode':_0x44ccbc[_0x505627(0x174)],'error':_0x505627(0x195)});continue;}try{const _0x58ca29=await computeSqlFileHash(_0x44ccbc[_0x505627(0x199)]),_0x2b2040=_0x155622[_0x505627(0x189)]!==_0x44ccbc[_0x505627(0x15f)]||!!_0x44ccbc[_0x505627(0x167)]&&_0x155622[_0x505627(0x167)]!==_0x44ccbc[_0x505627(0x167)];if(!_0xcc68aa['bool'](_0x505627(0x186))&&_0x155622[_0x505627(0x162)]===_0x58ca29&&!_0x2b2040){_0x23774e[_0x505627(0x18a)]({'sqlCode':_0x44ccbc[_0x505627(0x174)],'reason':_0x505627(0x18b)});continue;}if(_0x155622[_0x505627(0x161)]==null){_0x5a892d[_0x505627(0x18a)]({'sqlCode':_0x44ccbc[_0x505627(0x174)],'error':_0x505627(0x185)});continue;}const _0x34a5ff=await readFile(_0x44ccbc[_0x505627(0x199)],_0x505627(0x16b)),_0x3844fb=stripLocalSqlMetadata(_0x34a5ff,_0x44ccbc[_0x505627(0x169)]),_0xf279ab=_0x44ccbc[_0x505627(0x167)]||_0x155622[_0x505627(0x167)],_0x1d7a6a=await resolveTargetDbBinding(_0xcc68aa[_0x505627(0x18e)],_0x44ccbc,_0x155622),_0x1ae721=await updateSqlQuery({'id':_0x155622[_0x505627(0x16f)],'appCode':_0xcc68aa[_0x505627(0x18e)],'sqlCode':_0x44ccbc[_0x505627(0x174)],'sqlName':_0xf279ab,'dbId':_0x1d7a6a[_0x505627(0x17e)],'version':_0x155622[_0x505627(0x161)],'sqlContent':_0x3844fb,'sqlConfig':_0x155622['sqlConfig']??undefined}),_0x2b939f=_0x1ae721[_0x505627(0x17e)]?await getDbName(_0xcc68aa[_0x505627(0x18e)],Number(_0x1ae721[_0x505627(0x17e)]))[_0x505627(0x184)](()=>_0x1d7a6a['dbName']):_0x1d7a6a[_0x505627(0x16d)];_0x38706f['sqls'][_0x44ccbc[_0x505627(0x174)]]={...buildSqlLockEntry(_0x1ae721,_0x3844fb,_0x58ca29,{'dbName':_0x2b939f}),'path':_0x44ccbc['relativePath'],'mode':_0x155622['mode']},await archivePreviousSqlFileIfNeeded(_0x22383f,_0x155622[_0x505627(0x189)],_0x44ccbc[_0x505627(0x15f)]),_0x56e3b5[_0x505627(0x18a)]({'sqlCode':_0x44ccbc[_0x505627(0x174)],'remoteId':_0x155622[_0x505627(0x16f)]});}catch(_0x4cd66a){_0x5a892d[_0x505627(0x18a)]({'sqlCode':_0x44ccbc[_0x505627(0x174)],'error':_0x4cd66a instanceof Error?_0x4cd66a[_0x505627(0x168)]:String(_0x4cd66a)});}}return _0x38706f[_0x505627(0x192)]=new Date()['toISOString'](),await writeSqlLockFile(_0x22383f[_0x505627(0x191)],_0x189162),{'ok':_0x5a892d[_0x505627(0x17b)]===0x0,'data':{'pushed':_0x56e3b5,'skipped':_0x23774e,'failed':_0x5a892d},'message':'Push\x20complete:\x20'+_0x56e3b5['length']+_0x505627(0x180)+_0x23774e[_0x505627(0x17b)]+'\x20skipped,\x20'+_0x5a892d[_0x505627(0x17b)]+_0x505627(0x19b)};}};async function archivePreviousSqlFileIfNeeded(_0x270f5d,_0x406408,_0x549783){const _0x39ba78=a121_0xfc4116;if(!_0x406408||_0x406408===_0x549783)return;const _0x3d267c=join(_0x270f5d['sqlRootDir'],_0x406408);if(!await fileExists(_0x3d267c))return;const _0x4738fb=await moveToTrash(_0x270f5d[_0x39ba78(0x160)],_0x270f5d[_0x39ba78(0x164)],_0x3d267c);await cleanupEmptyDirectories(dirname(_0x3d267c),_0x270f5d['sqlRootDir']),void _0x4738fb;}async function moveToTrash(_0x45f6d0,_0x2eee91,_0x5e8671){const _0x6cd10c=a121_0xfc4116,_0x299fbb=new Date()[_0x6cd10c(0x17d)]()[_0x6cd10c(0x172)](/[:.]/g,'-'),_0x49ce74=relative(_0x45f6d0,_0x5e8671),_0x458bfe=join(_0x2eee91,_0x299fbb,_0x49ce74);return await mkdir(dirname(_0x458bfe),{'recursive':!![]}),await rename(_0x5e8671,_0x458bfe),_0x458bfe;}async function cleanupEmptyDirectories(_0x3456cb,_0x2307dd){const _0x4a1eda=a121_0xfc4116;let _0x8f338a=resolve(_0x3456cb);const _0x3c5753=resolve(_0x2307dd);while(_0x8f338a['startsWith'](''+_0x3c5753+sep)||_0x8f338a===_0x3c5753){if(_0x8f338a===_0x3c5753)return;try{const _0x17141d=await readdir(_0x8f338a);if(_0x17141d[_0x4a1eda(0x17b)]>0x0)return;await rmdir(_0x8f338a);}catch{return;}_0x8f338a=dirname(_0x8f338a);}}async function resolveTargetDbBinding(_0x58482a,_0x1d1776,_0x4fb8d1){const _0x67f39=a121_0xfc4116,_0x4929e2=_0x1d1776[_0x67f39(0x173)];if(!_0x4929e2)return{'dbId':_0x4fb8d1[_0x67f39(0x17e)],'dbName':_0x4fb8d1[_0x67f39(0x16d)]};const _0x56120d=buildDbDirectoryName(_0x4fb8d1[_0x67f39(0x16d)],_0x4fb8d1[_0x67f39(0x17e)]);if(_0x4929e2===_0x56120d)return{'dbId':_0x4fb8d1[_0x67f39(0x17e)],'dbName':_0x4fb8d1[_0x67f39(0x16d)]};const _0x2f06af=parseExplicitDbDirectory(_0x4929e2);if(_0x2f06af!=null)return{'dbId':_0x2f06af,'dbName':await getDbName(_0x58482a,_0x2f06af)['catch'](()=>undefined)};const _0xcc8879=await listDatabases(_0x58482a),_0x19b807=_0xcc8879['filter'](_0x160854=>buildDbDirectoryName(_0x160854[_0x67f39(0x16d)],_0x160854[_0x67f39(0x17e)])===_0x4929e2);if(_0x19b807[_0x67f39(0x17b)]===0x1)return{'dbId':_0x19b807[0x0][_0x67f39(0x17e)],'dbName':_0x19b807[0x0]['dbName']};if(_0x19b807[_0x67f39(0x17b)]===0x0)throw CliErrors[_0x67f39(0x171)](_0x67f39(0x194)+_0x4929e2+_0x67f39(0x16a)+_0x1d1776[_0x67f39(0x174)]+'.');const _0x3f7205=_0x19b807['map'](_0x3c31c4=>_0x3c31c4[_0x67f39(0x16d)]+'\x20('+_0x3c31c4[_0x67f39(0x17e)]+')')['join'](',\x20');throw CliErrors[_0x67f39(0x171)]('Local\x20directory\x20\x22'+_0x4929e2+_0x67f39(0x17a)+_0x1d1776[_0x67f39(0x174)]+':\x20'+_0x3f7205);}function parseExplicitDbDirectory(_0x260111){const _0xaad2af=a121_0xfc4116,_0x13dd16=/^db-(\d+)$/['exec'](_0x260111);if(!_0x13dd16)return null;const _0x5bf2c0=Number(_0x13dd16[0x1]);return Number[_0xaad2af(0x178)](_0x5bf2c0)&&_0x5bf2c0>0x0?_0x5bf2c0:null;}
|
package/lib/commands/sql/save.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a122_0x559b4e=a122_0x5b13;(function(_0x31f01a,_0x3a5e36){const _0x21a257=a122_0x5b13,_0xb65697=_0x31f01a();while(!![]){try{const _0x28a530=parseInt(_0x21a257(0x101))/0x1*(parseInt(_0x21a257(0xf8))/0x2)+-parseInt(_0x21a257(0xf6))/0x3+-parseInt(_0x21a257(0xfa))/0x4+parseInt(_0x21a257(0xfc))/0x5+parseInt(_0x21a257(0xf9))/0x6*(parseInt(_0x21a257(0xf7))/0x7)+-parseInt(_0x21a257(0x106))/0x8+-parseInt(_0x21a257(0x10e))/0x9*(-parseInt(_0x21a257(0xfe))/0xa);if(_0x28a530===_0x3a5e36)break;else _0xb65697['push'](_0xb65697['shift']());}catch(_0x16ac3c){_0xb65697['push'](_0xb65697['shift']());}}}(a122_0x4234,0x99d72));import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';const SQL_SAVE_DEPRECATED_HINT=[a122_0x559b4e(0x10b),a122_0x559b4e(0xff),a122_0x559b4e(0x107)][a122_0x559b4e(0xfd)]('\x0a');function a122_0x4234(){const _0x2b6326=['write','validation','Target\x20database\x20—\x20accepts\x20a\x20numeric\x20ID\x20or\x20database\x20name\x20(e.g.\x20ecommerce_db)','sqlname','10016144LFkQMI','Update\x20existing\x20SQL\x20by\x20editing\x20the\x20synced\x20file\x20under\x20`.rabetbase/sql/<appCode>/<dbName|db-<id>>/`\x20and\x20then\x20running\x20`rabetbase\x20sql\x20push\x20--sqlcode\x20<code>\x20--yes`.','sql','save','description','`rabetbase\x20sql\x20save`\x20has\x20been\x20deprecated.','SQL\x20query\x20display\x20name','Path\x20to\x20the\x20SQL\x20file','18bSwYJQ','3386349pFKueF','103579jAxhVY','2132vTybgl','372HfovAq','681796BffXuS','Deprecated:\x20use\x20sql\x20create\x20to\x20create\x20and\x20sql\x20push\x20to\x20update','5325420UkMfpS','join','110090qDiiWH','Create\x20new\x20SQL\x20with\x20`rabetbase\x20sql\x20create\x20--name\x20<name>\x20--db-id\x20<id>\x20--mode\x20sql|mybatisXml`.','string','1104xuswFQ'];a122_0x4234=function(){return _0x2b6326;};return a122_0x4234();}function a122_0x5b13(_0x5821df,_0x3832c8){_0x5821df=_0x5821df-0xf6;const _0x4234a7=a122_0x4234();let _0x5b13f5=_0x4234a7[_0x5821df];return _0x5b13f5;}export const sqlSave={'service':a122_0x559b4e(0x108),'command':a122_0x559b4e(0x109),'description':a122_0x559b4e(0xfb),'risk':a122_0x559b4e(0x102),'requiresAuth':![],'requiresAppCode':![],'flags':[{'name':'file','type':a122_0x559b4e(0x100),'required':!![],'description':a122_0x559b4e(0x10d)},SQLCODE_FLAG_OPTIONAL,{'name':a122_0x559b4e(0x105),'type':'string','description':a122_0x559b4e(0x10c)},{'name':'db','type':a122_0x559b4e(0x100),'description':a122_0x559b4e(0x104)},{'name':a122_0x559b4e(0x10a),'type':a122_0x559b4e(0x100),'description':'Query\x20description'}],async 'validate'(){throw CliErrors['validation'](SQL_SAVE_DEPRECATED_HINT);},async 'execute'(){const _0x382c6b=a122_0x559b4e;throw CliErrors[_0x382c6b(0x103)](SQL_SAVE_DEPRECATED_HINT);}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x3b2308,_0x406b1e){const _0x20c2b5=a123_0x255b,_0x37bdfd=_0x3b2308();while(!![]){try{const _0x542159=-parseInt(_0x20c2b5(0xf0))/0x1+-parseInt(_0x20c2b5(0xe3))/0x2+parseInt(_0x20c2b5(0xe9))/0x3*(-parseInt(_0x20c2b5(0xcb))/0x4)+parseInt(_0x20c2b5(0xda))/0x5*(-parseInt(_0x20c2b5(0xe0))/0x6)+-parseInt(_0x20c2b5(0xe2))/0x7+-parseInt(_0x20c2b5(0xd4))/0x8*(-parseInt(_0x20c2b5(0xec))/0x9)+-parseInt(_0x20c2b5(0xd1))/0xa*(-parseInt(_0x20c2b5(0xe7))/0xb);if(_0x542159===_0x406b1e)break;else _0x37bdfd['push'](_0x37bdfd['shift']());}catch(_0x5c090b){_0x37bdfd['push'](_0x37bdfd['shift']());}}}(a123_0x2154,0x9ca8e));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='.rabetbase/sql';export function buildSqlLockEntry(_0xa7e493,_0x595a28,_0x51c42a,_0x388f9c){const _0xa95fcf=a123_0x255b,_0x53c028=detectSqlMode(_0x595a28);return{'path':buildSqlRelativePath(_0xa7e493[_0xa95fcf(0xc7)],_0xa7e493[_0xa95fcf(0xe4)],_0x388f9c?.['dbName'],_0x53c028,_0xa7e493['dbId']),'hash':_0x51c42a,'remoteId':_0xa7e493['id'],'version':_0xa7e493['version'],'dbId':Number(_0xa7e493[_0xa95fcf(0xde)]),'dbName':_0x388f9c?.[_0xa95fcf(0xce)],'sqlName':_0xa7e493[_0xa95fcf(0xe4)],'sqlConfig':_0xa7e493[_0xa95fcf(0xf2)]??undefined,'mode':_0x53c028};}export function cloneSqlLockData(_0x438fbe){const _0x13c592=a123_0x255b;return{'apps':Object['fromEntries'](Object[_0x13c592(0xed)](_0x438fbe[_0x13c592(0xd0)])[_0x13c592(0xd9)](([_0x56ec41,_0x308bd1])=>[_0x56ec41,{'sqlRoot':_0x308bd1[_0x13c592(0xd6)],'lastSync':_0x308bd1[_0x13c592(0xdd)],'sqls':{..._0x308bd1[_0x13c592(0xd8)]}}]))};}export function ensureRemoteSqlContent(_0x47e379){const _0x2343f9=a123_0x255b;return _0x47e379[_0x2343f9(0xca)]??'';}function a123_0x2154(){const _0x59fdfc=['dbId','\x20-->','70338iePsGz','stderr','237727oSbJah','548912zZNInC','sqlName','push','syncedAt','23032097eysmgD','endsWith','12uzABEj','stdin','<!--\x20@lovrabet.','477rJhBzP','entries','filter','length','142748zZNBsZ','toLowerCase','sqlConfig','sqlCode','test','path','sqlContent','906448ENRybF','mode','close','dbName','trimStart','apps','10GkvinU','description','question','95440pFRkmh','trim','sqlRoot','includes','sqls','map','310DeOIwx','mybatisXml','join','lastSync'];a123_0x2154=function(){return _0x59fdfc;};return a123_0x2154();}export function buildLocalSqlFileContent(_0x3b24f6,_0x3dd112,_0x4367c9){const _0x15fb6b=a123_0x255b,_0x3c5b7b=_0x4367c9?.[_0x15fb6b(0xcc)]??detectSqlMode(_0x3dd112),_0x38e98c=stripLocalSqlMetadata(_0x3dd112,_0x3c5b7b)['trim'](),_0x3a6b68=[...buildMetadataHeaderLines({'sqlCode':_0x3b24f6['sqlCode'],'sqlName':_0x3b24f6[_0x15fb6b(0xe4)],'dbId':_0x3b24f6[_0x15fb6b(0xde)],'dbName':_0x4367c9?.[_0x15fb6b(0xce)],'mode':_0x3c5b7b,'syncedAt':_0x4367c9?.[_0x15fb6b(0xe6)],'description':_0x4367c9?.[_0x15fb6b(0xd2)]},_0x3c5b7b),'',_0x38e98c],_0x4d3922=_0x3a6b68[_0x15fb6b(0xdc)]('\x0a');return _0x4d3922[_0x15fb6b(0xe8)]('\x0a')?_0x4d3922:_0x4d3922+'\x0a';}export function stripLocalSqlMetadata(_0x2ee9ea,_0x34cfdb){const _0x116a1c=a123_0x255b,_0xbee7b2=_0x2ee9ea['replace'](/\r\n/g,'\x0a')['split']('\x0a'),_0x3fd454=[];let _0x43d637=0x0;if(_0x34cfdb===_0x116a1c(0xdb))while(_0x43d637<_0xbee7b2[_0x116a1c(0xef)]){const _0x1eaadd=_0xbee7b2[_0x43d637]??'';if(/^\s*<!--\s*@lovrabet\./[_0x116a1c(0xc8)](_0x1eaadd)){_0x43d637++;continue;}if(_0x1eaadd['trim']()===''&&_0x43d637>0x0){_0x43d637++;continue;}break;}else while(_0x43d637<_0xbee7b2[_0x116a1c(0xef)]){const _0x25df1c=_0xbee7b2[_0x43d637]??'';if(/^\s*--\s*@lovrabet\./[_0x116a1c(0xc8)](_0x25df1c)){_0x43d637++;continue;}if(_0x25df1c['trim']()===''&&_0x43d637>0x0){_0x43d637++;continue;}break;}for(;_0x43d637<_0xbee7b2['length'];_0x43d637++){_0x3fd454[_0x116a1c(0xe5)](_0xbee7b2[_0x43d637]);}return _0x3fd454['join']('\x0a')[_0x116a1c(0xcf)]();}export function resolveSqlMode(_0x414171,_0x2d1e2a){const _0x39aa1e=a123_0x255b;if(_0x2d1e2a?.[_0x39aa1e(0xcc)])return _0x2d1e2a[_0x39aa1e(0xcc)];return detectSqlMode(_0x414171);}function a123_0x255b(_0x5ee08c,_0x9cbfd1){_0x5ee08c=_0x5ee08c-0xc7;const _0x21542e=a123_0x2154();let _0x255b6d=_0x21542e[_0x5ee08c];return _0x255b6d;}export function resolveSqlFileName(_0x178cc4,_0x33b50d,_0x2e622d){const _0x68a9fe=a123_0x255b;if(_0x2e622d?.[_0x68a9fe(0xc9)])return _0x2e622d['path'];if(_0x2e622d?.[_0x68a9fe(0xe4)]||_0x2e622d?.['dbName'])return buildSqlRelativePath(_0x178cc4,_0x2e622d?.[_0x68a9fe(0xe4)],_0x2e622d?.['dbName'],resolveSqlMode(_0x33b50d,_0x2e622d),_0x2e622d?.[_0x68a9fe(0xde)]);return buildDefaultSqlFileName(_0x178cc4,resolveSqlMode(_0x33b50d,_0x2e622d));}export function resolveSqlLocalDir(_0x2cfbc1,_0x30d6dc){return join(_0x2cfbc1,SQL_LOCAL_REL_DIR,_0x30d6dc);}export async function confirmForceOverwrite(_0x25cda7){const _0x3dc81c=a123_0x255b,_0x5028a5=createInterface({'input':process[_0x3dc81c(0xea)],'output':process[_0x3dc81c(0xe1)]}),_0x313574=await new Promise(_0x30edcf=>{const _0x3557bd=_0x3dc81c;_0x5028a5[_0x3557bd(0xd3)](_0x25cda7+'\x20[y/N]\x20',_0x30edcf);});return _0x5028a5[_0x3dc81c(0xcd)](),['y','yes'][_0x3dc81c(0xd7)](_0x313574['trim']()[_0x3dc81c(0xf1)]());}export function findSqlLockScope(_0x140332,_0x3ab5df){const _0x20fd26=a123_0x255b;return _0x140332[_0x20fd26(0xd0)][_0x3ab5df];}function buildMetadataHeaderLines(_0x1d791a,_0x431f2d){const _0x4c7e24=a123_0x255b,_0xab7dde=[[_0x4c7e24(0xc7),_0x1d791a[_0x4c7e24(0xc7)]],[_0x4c7e24(0xe4),_0x1d791a['sqlName']],['dbId',_0x1d791a[_0x4c7e24(0xde)]],[_0x4c7e24(0xce),_0x1d791a[_0x4c7e24(0xce)]],['mode',_0x1d791a[_0x4c7e24(0xcc)]],[_0x4c7e24(0xe6),_0x1d791a[_0x4c7e24(0xe6)]],['description',_0x1d791a[_0x4c7e24(0xd2)]]];if(_0x431f2d===_0x4c7e24(0xdb))return _0xab7dde['filter'](([,_0x27d58e])=>_0x27d58e!==undefined&&_0x27d58e!==null&&String(_0x27d58e)[_0x4c7e24(0xd5)]()!=='')[_0x4c7e24(0xd9)](([_0x593f4b,_0x136229])=>_0x4c7e24(0xeb)+_0x593f4b+':\x20'+String(_0x136229)+_0x4c7e24(0xdf));return _0xab7dde[_0x4c7e24(0xee)](([,_0x2d1d2a])=>_0x2d1d2a!==undefined&&_0x2d1d2a!==null&&String(_0x2d1d2a)[_0x4c7e24(0xd5)]()!=='')[_0x4c7e24(0xd9)](([_0x15a883,_0x30cf7b])=>'--\x20@lovrabet.'+_0x15a883+':\x20'+String(_0x30cf7b));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a124_0x60bf05=a124_0x10f1;(function(_0x555fd1,_0x55cc29){const _0x162e4a=a124_0x10f1,_0x577915=_0x555fd1();while(!![]){try{const _0x34eeb2=parseInt(_0x162e4a(0xf4))/0x1*(-parseInt(_0x162e4a(0xf2))/0x2)+parseInt(_0x162e4a(0xfa))/0x3+-parseInt(_0x162e4a(0xee))/0x4+-parseInt(_0x162e4a(0xe8))/0x5+parseInt(_0x162e4a(0xeb))/0x6+-parseInt(_0x162e4a(0xff))/0x7*(-parseInt(_0x162e4a(0x103))/0x8)+parseInt(_0x162e4a(0xef))/0x9;if(_0x34eeb2===_0x55cc29)break;else _0x577915['push'](_0x577915['shift']());}catch(_0x67b4c7){_0x577915['push'](_0x577915['shift']());}}}(a124_0x380a,0x8f16d));import{listSqlQueries}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';function a124_0x10f1(_0x2ab1ab,_0x5ba91f){_0x2ab1ab=_0x2ab1ab-0xe1;const _0x380aec=a124_0x380a();let _0x10f1d1=_0x380aec[_0x2ab1ab];return _0x10f1d1;}import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';function a124_0x380a(){const _0x25c15c=['4379884vcmKlr','14860089ESGiWD','boolean','keys','3572NuMIvC','push','376fFvGiw','sqls','filePath','tableData','paging','length','2031279KgyFgs','path','All\x20SQL\x20queries\x20are\x20in\x20sync.','bool','totalCount','7TCIJQa','hash','has','sqlName','7640776HdjloF','appCode','lockKey','sqlRoot','\x20added,\x20','\x20unchanged','lockFilePath','map','Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','4775275oUhDzL','\x20modified,\x20','remote','146064OreKGy','relativePath','status'];a124_0x380a=function(){return _0x25c15c;};return a124_0x380a();}import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile}from'../../core/sql-sync/lock.js';const PAGE_SIZE=0x64;async function fetchAllSqlCodes(_0x390c40){const _0x2bfcd6=a124_0x10f1,_0x477428=[];let _0x53d7d2=0x1;while(!![]){const _0x19feb5=await listSqlQueries(_0x390c40,{'currentPage':_0x53d7d2,'pageSize':PAGE_SIZE}),_0x5d2241=_0x19feb5[_0x2bfcd6(0xf7)]??[];_0x477428['push'](..._0x5d2241[_0x2bfcd6(0xe6)](_0x4424ea=>_0x4424ea['sqlCode']));if(_0x5d2241['length']===0x0)break;const _0x14156d=_0x19feb5[_0x2bfcd6(0xf8)]?.[_0x2bfcd6(0xfe)];if(_0x14156d!=null?_0x477428['length']>=_0x14156d:_0x5d2241['length']<PAGE_SIZE)break;_0x53d7d2++;}return _0x477428;}export const sqlStatus={'service':'sql','command':a124_0x60bf05(0xed),'description':a124_0x60bf05(0xe7),'risk':'read','flags':[{'name':a124_0x60bf05(0xea),'type':a124_0x60bf05(0xf0),'description':'Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally'}],async 'execute'(_0x4edb6f){const _0x32d836=a124_0x60bf05,_0x1df505=loadSqlProjectConfig(_0x4edb6f[_0x32d836(0x104)]),_0x1d1b79=await readSqlLockFile(_0x1df505[_0x32d836(0xe5)]),{appLock:_0x1bd574}=ensureSqlLockScope(_0x1d1b79??createEmptySqlLock(),_0x1df505[_0x32d836(0x104)],_0x1df505[_0x32d836(0xe2)],_0x32d836(0xed)),_0x43db4f=await scanLocalSqlQueries(_0x1df505),_0x3d37f7=[],_0x259477=[],_0x5e84fa=[],_0x498cc1=[],_0x59317c=new Set(_0x43db4f[_0x32d836(0xe6)](_0x40b8b6=>_0x40b8b6['lockKey']));for(const _0x36b709 of _0x43db4f){const _0x2e4f32=await computeSqlFileHash(_0x36b709[_0x32d836(0xf6)]),_0x21a301=_0x1bd574[_0x32d836(0xf5)][_0x36b709[_0x32d836(0xe1)]],_0x40cf19=!!_0x21a301&&_0x21a301[_0x32d836(0xfb)]!==_0x36b709[_0x32d836(0xec)],_0x1c791f=!!_0x21a301&&!!_0x36b709['sqlName']&&_0x21a301[_0x32d836(0x102)]!==_0x36b709[_0x32d836(0x102)];if(!_0x21a301)_0x3d37f7[_0x32d836(0xf3)](_0x36b709[_0x32d836(0xe1)]);else _0x21a301[_0x32d836(0x100)]!==_0x2e4f32||_0x40cf19||_0x1c791f?_0x259477['push'](_0x36b709[_0x32d836(0xe1)]):_0x5e84fa[_0x32d836(0xf3)](_0x36b709[_0x32d836(0xe1)]);}for(const _0x1fd7de of Object[_0x32d836(0xf1)](_0x1bd574[_0x32d836(0xf5)])){!_0x59317c[_0x32d836(0x101)](_0x1fd7de)&&_0x498cc1[_0x32d836(0xf3)](_0x1fd7de);}const _0x51566b=[];if(_0x4edb6f[_0x32d836(0xfd)](_0x32d836(0xea))){const _0x2e04de=await fetchAllSqlCodes(_0x4edb6f[_0x32d836(0x104)]);for(const _0x1cfd78 of _0x2e04de){!_0x59317c[_0x32d836(0x101)](_0x1cfd78)&&!_0x1bd574[_0x32d836(0xf5)][_0x1cfd78]&&_0x51566b[_0x32d836(0xf3)](_0x1cfd78);}}const _0x5903d9=_0x3d37f7[_0x32d836(0xf9)]===0x0&&_0x259477['length']===0x0&&_0x498cc1[_0x32d836(0xf9)]===0x0&&_0x51566b[_0x32d836(0xf9)]===0x0;return{'ok':!![],'data':{'added':_0x3d37f7,'modified':_0x259477,'missing':_0x498cc1,'unchanged':_0x5e84fa,'remoteOnly':_0x51566b},'message':_0x5903d9?_0x32d836(0xfc):_0x3d37f7[_0x32d836(0xf9)]+_0x32d836(0xe3)+_0x259477[_0x32d836(0xf9)]+_0x32d836(0xe9)+_0x498cc1[_0x32d836(0xf9)]+'\x20missing,\x20'+_0x5e84fa[_0x32d836(0xf9)]+_0x32d836(0xe4)+(_0x51566b[_0x32d836(0xf9)]>0x0?',\x20'+_0x51566b[_0x32d836(0xf9)]+'\x20remote-only':'')};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a125_0x56bf94=a125_0x4e39;(function(_0x50284e,_0x23b281){const _0x17dd3c=a125_0x4e39,_0x7f5bdb=_0x50284e();while(!![]){try{const _0x5c393c=parseInt(_0x17dd3c(0x1ea))/0x1+-parseInt(_0x17dd3c(0x1ec))/0x2*(parseInt(_0x17dd3c(0x202))/0x3)+-parseInt(_0x17dd3c(0x20a))/0x4+parseInt(_0x17dd3c(0x1e7))/0x5*(parseInt(_0x17dd3c(0x201))/0x6)+parseInt(_0x17dd3c(0x207))/0x7*(-parseInt(_0x17dd3c(0x208))/0x8)+-parseInt(_0x17dd3c(0x1f6))/0x9+parseInt(_0x17dd3c(0x1e2))/0xa;if(_0x5c393c===_0x23b281)break;else _0x7f5bdb['push'](_0x7f5bdb['shift']());}catch(_0x3b48d7){_0x7f5bdb['push'](_0x7f5bdb['shift']());}}}(a125_0x278f,0x3e667));import{readFileSync,existsSync}from'node:fs';import{resolve}from'node:path';function a125_0x4e39(_0x5d6a52,_0x7ed389){_0x5d6a52=_0x5d6a52-0x1da;const _0x278ff5=a125_0x278f();let _0x4e3949=_0x278ff5[_0x5d6a52];return _0x4e3949;}function a125_0x278f(){const _0x3db2a4=['1840044tZOsCt','Dataset\x20\x22','file','schemas','Path\x20to\x20the\x20SQL\x20file\x20to\x20validate','cwd','\x22\x20not\x20found\x20or\x20not\x20accessible','validation','utf-8','tableName','filter','7889760cVzYDr','sql','Comma-separated\x20dataset\x20codes\x20to\x20cross-check\x20table/column\x20names\x20against','type','push','115835FyolHE','toLowerCase','size','437085cbwvrP','Inline\x20SQL\x20content\x20to\x20validate\x20(alternative\x20to\x20--file)','290698baMBrE','appCode','isArray','split','validate','schemaWarnings','valid','flagMissing','message','isSelectOnly','3502431APgiNO','Provide\x20--file\x20or\x20--sql','get','\x22\x20not\x20found\x20in\x20any\x20dataset','parameters','isDangerous','reason','name','dbtableConfig','map','str','78VjGKxS','6cRxOEt','tables','sqlType','string','read','2947NDeLDH','2504CMnQzD','trim'];a125_0x278f=function(){return _0x3db2a4;};return a125_0x278f();}import{validateSql}from'../../core/sql-validator.js';import{getDatasetDetail,listDatasets}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';export const sqlValidate={'service':a125_0x56bf94(0x1e3),'command':a125_0x56bf94(0x1f0),'description':'Validate\x20SQL\x20content\x20without\x20saving\x20(type\x20detection,\x20parameter\x20extraction,\x20optional\x20schema\x20check)','risk':a125_0x56bf94(0x206),'flags':[{'name':'file','type':a125_0x56bf94(0x205),'description':a125_0x56bf94(0x1db)},{'name':a125_0x56bf94(0x1e3),'type':a125_0x56bf94(0x205),'description':a125_0x56bf94(0x1eb)},{'name':'schemas','type':a125_0x56bf94(0x205),'description':a125_0x56bf94(0x1e4)}],async 'execute'(_0x36a3cd){const _0xfc1657=a125_0x56bf94,_0x28fce9=_0x36a3cd[_0xfc1657(0x200)](_0xfc1657(0x20c)),_0x57d2b7=_0x36a3cd[_0xfc1657(0x200)](_0xfc1657(0x1e3));if(!_0x28fce9&&!_0x57d2b7)throw CliErrors[_0xfc1657(0x1f3)](_0xfc1657(0x20c),_0xfc1657(0x1f7));let _0x178269;if(_0x28fce9){const _0x454f8c=resolve(process[_0xfc1657(0x1dc)](),_0x28fce9);if(!existsSync(_0x454f8c))throw CliErrors[_0xfc1657(0x1de)]('File\x20not\x20found:\x20'+_0x454f8c);_0x178269=readFileSync(_0x454f8c,_0xfc1657(0x1df));}else _0x178269=_0x57d2b7;const _0x2354b8=validateSql(_0x178269),_0x3667fb={'valid':_0x2354b8[_0xfc1657(0x1f2)],'sqlType':_0x2354b8[_0xfc1657(0x204)][_0xfc1657(0x1e5)],'isSelectOnly':_0x2354b8[_0xfc1657(0x204)][_0xfc1657(0x1f5)],'isDangerous':_0x2354b8[_0xfc1657(0x204)][_0xfc1657(0x1fb)],'tables':_0x2354b8[_0xfc1657(0x203)],'parameters':_0x2354b8[_0xfc1657(0x1fa)],'message':_0x2354b8[_0xfc1657(0x1f4)]};_0x2354b8[_0xfc1657(0x204)][_0xfc1657(0x1fc)]&&(_0x3667fb[_0xfc1657(0x1fc)]=_0x2354b8[_0xfc1657(0x204)]['reason']);const _0x835a4d=_0x36a3cd[_0xfc1657(0x200)](_0xfc1657(0x1da));if(_0x835a4d&&_0x2354b8[_0xfc1657(0x1f2)]){const _0x4fe1ab=_0x835a4d[_0xfc1657(0x1ef)](',')['map'](_0x331059=>_0x331059[_0xfc1657(0x209)]())[_0xfc1657(0x1e1)](Boolean),_0x139f33=[],_0x5b3265=await listDatasets(_0x36a3cd[_0xfc1657(0x1ed)]),_0x28aca0=new Map(_0x5b3265[_0xfc1657(0x1ff)](_0x206195=>[_0x206195[_0xfc1657(0x1fe)]?.[_0xfc1657(0x1e0)]?.['toLowerCase'](),_0x206195]));for(const _0x2936a4 of _0x2354b8['tables']){const _0x4c226d=_0x28aca0[_0xfc1657(0x1f8)](_0x2936a4[_0xfc1657(0x1e8)]());!_0x4c226d&&_0x139f33[_0xfc1657(0x1e6)]('Table\x20\x22'+_0x2936a4+_0xfc1657(0x1f9));}for(const _0x21e054 of _0x4fe1ab){try{const _0x21e9ac=await getDatasetDetail(_0x21e054),_0x4e1ac1=Array[_0xfc1657(0x1ee)](_0x21e9ac['fields'])?_0x21e9ac['fields']:[],_0x189cd0=new Set(_0x4e1ac1[_0xfc1657(0x1ff)](_0x2bb53b=>_0x2bb53b[_0xfc1657(0x1fd)]?.[_0xfc1657(0x1e8)]())),_0x530be1=_0x21e9ac[_0xfc1657(0x1fe)]?.[_0xfc1657(0x1e0)]||_0x21e9ac['tableName']||_0x21e054;_0x3667fb['schema:'+_0x530be1]={'code':_0x21e054,'tableName':_0x530be1,'fieldCount':_0x189cd0[_0xfc1657(0x1e9)],'fields':Array['from'](_0x189cd0)};}catch{_0x139f33[_0xfc1657(0x1e6)](_0xfc1657(0x20b)+_0x21e054+_0xfc1657(0x1dd));}}_0x139f33['length']>0x0&&(_0x3667fb[_0xfc1657(0x1f1)]=_0x139f33);}return{'ok':_0x2354b8['valid'],'data':_0x3667fb,'message':_0x2354b8[_0xfc1657(0x1f4)]};}};
|
package/lib/config/schema.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a126_0x19eca1=a126_0x279c;(function(_0x44daed,_0x404ba8){const _0x28730e=a126_0x279c,_0x58f2fe=_0x44daed();while(!![]){try{const _0x4771c5=parseInt(_0x28730e(0x15a))/0x1*(-parseInt(_0x28730e(0x15f))/0x2)+-parseInt(_0x28730e(0x15b))/0x3+parseInt(_0x28730e(0x13d))/0x4*(-parseInt(_0x28730e(0x15d))/0x5)+parseInt(_0x28730e(0x13e))/0x6+parseInt(_0x28730e(0x15e))/0x7+-parseInt(_0x28730e(0x155))/0x8+-parseInt(_0x28730e(0x13a))/0x9*(-parseInt(_0x28730e(0x145))/0xa);if(_0x4771c5===_0x404ba8)break;else _0x58f2fe['push'](_0x58f2fe['shift']());}catch(_0x9111b7){_0x58f2fe['push'](_0x58f2fe['shift']());}}}(a126_0xf8dc,0xa6729));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';function a126_0xf8dc(){const _0x3c1f96=['300EUKcbz','Auth\x20cookie','filter','inherit','accessKey','pageSize','has','length','Access\x20key','Default\x20output\x20format\x20for\x20this\x20app\x20(profile)','string','map','apps','defaultApp','apiDir','env','4045576vlDGYX','Target\x20environment','Default\x20page\x20size','defaultFormat','cookie','65770miZvtw','1234059DgFTiB','entries','163325LnLHMy','2123856UvFhmr','12QFjSIq','toLowerCase','locale','appcode','Risk\x20level','Config\x20key\x20(','702306uvhNLx','zh-CN','app','124OeLnBz','2169756sWssRL','riskLevel','keys','format','join','en-US','API\x20directory\x20path'];a126_0xf8dc=function(){return _0x3c1f96;};return a126_0xf8dc();}export{DEFAULT_CONFIG_VALUES}from'../constant/defaults.js';export const PROJECT_CREATE_INHERITABLE_KEYS=[a126_0x19eca1(0x159),a126_0x19eca1(0x149),a126_0x19eca1(0x161),a126_0x19eca1(0x141),a126_0x19eca1(0x13f)];export const TOP_LEVEL_CONFIG_KEYS=new Set([a126_0x19eca1(0x162),a126_0x19eca1(0x154),a126_0x19eca1(0x161),a126_0x19eca1(0x141),'cookie',a126_0x19eca1(0x149),'apiDir']);export const CONFIG_ENUM_VALUES={'env':[...RABETBASE_ENV_VALUES],'format':[...RABETBASE_OUTPUT_FORMAT_VALUES]};export function formatConfigKeyList(_0x5db242){const _0x4b721d=a126_0x19eca1;return[..._0x5db242][_0x4b721d(0x142)](',\x20');}export function getTopLevelConfigKeyList(){return[...TOP_LEVEL_CONFIG_KEYS];}export function isTopLevelConfigKey(_0x298e0e){const _0x38125e=a126_0x19eca1;return TOP_LEVEL_CONFIG_KEYS[_0x38125e(0x14b)](_0x298e0e);}function a126_0x279c(_0x4c2187,_0x5c3f4b){_0x4c2187=_0x4c2187-0x13a;const _0xf8dcdd=a126_0xf8dc();let _0x279cfb=_0xf8dcdd[_0x4c2187];return _0x279cfb;}export function getTopLevelConfigKeySummary(){return formatConfigKeyList(getTopLevelConfigKeyList());}export function getConfigCommandKeyDescription(){const _0x4aa97b=a126_0x19eca1;return _0x4aa97b(0x164)+getTopLevelConfigKeySummary()+')';}export const APP_PROFILE_FLAG_KEY_MAP={'env':'env','apiDir':'apiDir','cookie':'cookie','accessKey':a126_0x19eca1(0x149),'defaultFormat':a126_0x19eca1(0x141),'pageSize':a126_0x19eca1(0x14a),'riskLevel':a126_0x19eca1(0x13f),'locale':a126_0x19eca1(0x161)};export function getAppProfileFlagDefs(){const _0x426d2a=a126_0x19eca1;return[{'name':_0x426d2a(0x154),'type':_0x426d2a(0x14f),'description':_0x426d2a(0x156),'enum':[...RABETBASE_ENV_VALUES]},{'name':_0x426d2a(0x153),'type':_0x426d2a(0x14f),'description':_0x426d2a(0x144)},{'name':'cookie','type':'string','description':_0x426d2a(0x146),'hidden':!![]},{'name':'accessKey','type':_0x426d2a(0x14f),'description':_0x426d2a(0x14d),'hidden':!![]},{'name':_0x426d2a(0x158),'type':_0x426d2a(0x14f),'description':_0x426d2a(0x14e),'enum':[...RABETBASE_OUTPUT_FORMAT_VALUES]},{'name':_0x426d2a(0x14a),'type':'number','description':_0x426d2a(0x157)},{'name':_0x426d2a(0x13f),'type':_0x426d2a(0x14f),'description':_0x426d2a(0x163),'enum':[...RISK_LEVEL_VALUES]},{'name':_0x426d2a(0x161),'type':'string','description':'Locale'}];}export function collectAppProfileOverrides(_0x5d61b7){const _0x59dd1b=a126_0x19eca1,_0x5a5415={};for(const [_0x3b17c0,_0x2cc087]of Object[_0x59dd1b(0x15c)](APP_PROFILE_FLAG_KEY_MAP)){const _0x493d1b=_0x5d61b7(_0x3b17c0);if(!_0x493d1b)continue;_0x5a5415[_0x2cc087]=_0x2cc087===_0x59dd1b(0x14a)?Number(_0x493d1b):_0x493d1b;}return _0x5a5415;}export function buildAppProfileListFields(_0x3d62ab){const _0x86d8b0=a126_0x19eca1;return{'env':_0x3d62ab[_0x86d8b0(0x154)]??null,'apiDir':_0x3d62ab[_0x86d8b0(0x153)]??null,'hasCookie':!!_0x3d62ab[_0x86d8b0(0x159)],'hasAccessKey':!!_0x3d62ab[_0x86d8b0(0x149)],'format':_0x3d62ab[_0x86d8b0(0x141)]??null,'pageSize':_0x3d62ab['pageSize']??null,'riskLevel':_0x3d62ab[_0x86d8b0(0x13f)]??null,'locale':_0x3d62ab[_0x86d8b0(0x161)]??null};}export function buildAppDoctorFields(_0x5dc1c9,_0x2730d4){const _0x51bb58=a126_0x19eca1;return{'env':{'value':_0x5dc1c9['env']||_0x2730d4[_0x51bb58(0x154)],'source':_0x5dc1c9['env']?_0x51bb58(0x13c):_0x51bb58(0x148)},'apiDir':{'value':_0x5dc1c9['apiDir']||_0x2730d4['apiDir'],'source':_0x5dc1c9['apiDir']?'app':_0x51bb58(0x148)},'cookie':{'value':_0x5dc1c9['cookie']||_0x2730d4[_0x51bb58(0x159)],'source':_0x5dc1c9[_0x51bb58(0x159)]?'app':_0x51bb58(0x148)},'accessKey':{'value':_0x5dc1c9[_0x51bb58(0x149)]||_0x2730d4[_0x51bb58(0x149)],'source':_0x5dc1c9[_0x51bb58(0x149)]?'app':_0x51bb58(0x148)}};}export function buildCanonicalAppConfig(_0x5b9e7c,_0x2b9797){const _0x29af99=a126_0x19eca1,_0x6c57d=_0x5b9e7c[_0x29af99(0x150)](_0x353bbc=>String(_0x353bbc||'')['trim']())[_0x29af99(0x147)](Boolean);if(_0x6c57d[_0x29af99(0x14c)]===0x0)return{};const _0x35d31e={};for(const _0x23abf2 of _0x6c57d){_0x35d31e[_0x23abf2]=_0x2b9797?{'appcode':_0x23abf2,'env':_0x2b9797}:{'appcode':_0x23abf2};}return{'apps':_0x35d31e,'defaultApp':_0x6c57d[0x0]};}export function buildCanonicalProjectConfig(_0x380b5b,_0x32a6cd){const _0x3666b6=a126_0x19eca1,{appCodes:appCodes=[],env:_0x35f984,metadata:_0x14314a}=_0x32a6cd,_0xe3013a={..._0x380b5b,..._0x14314a||{}};delete _0xe3013a['appcode'],delete _0xe3013a[_0x3666b6(0x13c)];if(_0x35f984)_0xe3013a[_0x3666b6(0x154)]=_0x35f984;else!_0xe3013a[_0x3666b6(0x154)]&&(_0xe3013a[_0x3666b6(0x154)]=DEFAULT_CONFIG_VALUES[_0x3666b6(0x154)]);const _0x567cba=buildCanonicalAppConfig(appCodes,_0xe3013a['env']);return Object[_0x3666b6(0x140)](_0x567cba)[_0x3666b6(0x14c)]>0x0&&(_0xe3013a[_0x3666b6(0x151)]=_0x567cba[_0x3666b6(0x151)],_0xe3013a[_0x3666b6(0x152)]=_0x567cba[_0x3666b6(0x152)]),_0xe3013a;}const LOCALE_MAP={'zh':a126_0x19eca1(0x13b),'zh-cn':a126_0x19eca1(0x13b),'zh_cn':a126_0x19eca1(0x13b),'en':a126_0x19eca1(0x143),'en-us':a126_0x19eca1(0x143),'en_us':a126_0x19eca1(0x143)};export function normalizeLocale(_0x39464a){const _0x302ff7=a126_0x19eca1;if(!_0x39464a)return null;return LOCALE_MAP[_0x39464a[_0x302ff7(0x160)]()]??null;}
|
package/lib/constant/cdn.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a127_0x70fd(_0x1a6a80,_0x2bbddf){_0x1a6a80=_0x1a6a80-0x9a;const _0x221a5c=a127_0x221a();let _0x70fd1=_0x221a5c[_0x1a6a80];return _0x70fd1;}const a127_0x12a320=a127_0x70fd;(function(_0x39024c,_0x33f190){const _0x5e7843=a127_0x70fd,_0x41eb57=_0x39024c();while(!![]){try{const _0x453fc2=-parseInt(_0x5e7843(0x9b))/0x1+parseInt(_0x5e7843(0x9c))/0x2+-parseInt(_0x5e7843(0xa4))/0x3+-parseInt(_0x5e7843(0x9a))/0x4*(parseInt(_0x5e7843(0xa3))/0x5)+-parseInt(_0x5e7843(0x9e))/0x6*(parseInt(_0x5e7843(0x9f))/0x7)+-parseInt(_0x5e7843(0xa5))/0x8*(-parseInt(_0x5e7843(0xa2))/0x9)+parseInt(_0x5e7843(0x9d))/0xa*(parseInt(_0x5e7843(0xa1))/0xb);if(_0x453fc2===_0x33f190)break;else _0x41eb57['push'](_0x41eb57['shift']());}catch(_0x56b890){_0x41eb57['push'](_0x41eb57['shift']());}}}(a127_0x221a,0x6f816));function a127_0x221a(){const _0xe02a21=['40MWjrep','44bwQnos','867903txiKTY','1760058YLNQgZ','3125800kkdPxE','132YEEXAv','190708AmyFTX','https://g.lovrabet.com/dist/rabetbase-cli/config/index.json','44CguodB','344772BiPHyD','61655TgBUvk','786753iMtjeZ'];a127_0x221a=function(){return _0xe02a21;};return a127_0x221a();}export const CLI_VERSION_POLICY_URL=a127_0x12a320(0xa0);
|
package/lib/constant/cli.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a128_0x3e1c6f=a128_0x2d75;(function(_0x49a578,_0x49598d){const _0x56a460=a128_0x2d75,_0x4476fa=_0x49a578();while(!![]){try{const _0x1118f5=-parseInt(_0x56a460(0x178))/0x1+parseInt(_0x56a460(0x18a))/0x2*(-parseInt(_0x56a460(0x185))/0x3)+-parseInt(_0x56a460(0x181))/0x4*(parseInt(_0x56a460(0x19c))/0x5)+parseInt(_0x56a460(0x158))/0x6*(-parseInt(_0x56a460(0x187))/0x7)+parseInt(_0x56a460(0x194))/0x8*(-parseInt(_0x56a460(0x18e))/0x9)+-parseInt(_0x56a460(0x162))/0xa+parseInt(_0x56a460(0x1be))/0xb*(parseInt(_0x56a460(0x195))/0xc);if(_0x1118f5===_0x49598d)break;else _0x4476fa['push'](_0x4476fa['shift']());}catch(_0x971ac0){_0x4476fa['push'](_0x4476fa['shift']());}}}(a128_0x1637,0x68c41));export const CLI_BIN_NAME=a128_0x3e1c6f(0x16c);export const CLI_DISPLAY_NAME=a128_0x3e1c6f(0x165);function a128_0x2d75(_0x195eee,_0x3954d3){_0x195eee=_0x195eee-0x14e;const _0x1637bc=a128_0x1637();let _0x2d75d9=_0x1637bc[_0x195eee];return _0x2d75d9;}export const NPM_PACKAGE_NAME=a128_0x3e1c6f(0x18c);export const GLOBAL_FLAGS=[{'name':a128_0x3e1c6f(0x1b7),'meowKey':'appcode','type':a128_0x3e1c6f(0x18d),'description':'Override\x20appcode','hint':a128_0x3e1c6f(0x179)},{'name':a128_0x3e1c6f(0x184),'meowKey':a128_0x3e1c6f(0x184),'type':a128_0x3e1c6f(0x18d),'description':a128_0x3e1c6f(0x19a),'hint':a128_0x3e1c6f(0x164)},{'name':a128_0x3e1c6f(0x156),'meowKey':a128_0x3e1c6f(0x156),'type':a128_0x3e1c6f(0x18d),'description':'Environment','hint':a128_0x3e1c6f(0x1aa)},{'name':a128_0x3e1c6f(0x16a),'meowKey':'format','type':'string','description':a128_0x3e1c6f(0x1a1),'hint':a128_0x3e1c6f(0x153)},{'name':'jq','meowKey':'jq','type':a128_0x3e1c6f(0x18d),'description':a128_0x3e1c6f(0x19d),'hint':a128_0x3e1c6f(0x197)},{'name':a128_0x3e1c6f(0x154),'meowKey':a128_0x3e1c6f(0x1ae),'type':'boolean','description':a128_0x3e1c6f(0x174)},{'name':'yes','meowKey':a128_0x3e1c6f(0x17d),'type':'boolean','description':a128_0x3e1c6f(0x1b2)},{'name':a128_0x3e1c6f(0x186),'meowKey':a128_0x3e1c6f(0x15d),'type':a128_0x3e1c6f(0x157),'description':a128_0x3e1c6f(0x1bb)},{'name':a128_0x3e1c6f(0x1a8),'meowKey':a128_0x3e1c6f(0x1a8),'type':a128_0x3e1c6f(0x157),'description':a128_0x3e1c6f(0x17a)},{'name':a128_0x3e1c6f(0x15f),'meowKey':a128_0x3e1c6f(0x15f),'type':a128_0x3e1c6f(0x157),'description':a128_0x3e1c6f(0x168)},{'name':'ci','meowKey':'ci','type':'boolean','description':a128_0x3e1c6f(0x1a4),'hidden':!![]},{'name':a128_0x3e1c6f(0x172),'meowKey':a128_0x3e1c6f(0x172),'type':a128_0x3e1c6f(0x157),'description':a128_0x3e1c6f(0x167)},{'name':'name','meowKey':'name','type':'string','description':a128_0x3e1c6f(0x1bd),'hidden':!![]},{'name':'title','meowKey':a128_0x3e1c6f(0x19f),'type':a128_0x3e1c6f(0x18d),'description':a128_0x3e1c6f(0x161),'hidden':!![]},{'name':'clear','meowKey':a128_0x3e1c6f(0x160),'type':a128_0x3e1c6f(0x157),'description':a128_0x3e1c6f(0x171),'hidden':!![]},{'name':'watch','meowKey':a128_0x3e1c6f(0x17e),'type':'boolean','description':a128_0x3e1c6f(0x192),'hidden':!![]},{'name':'output','meowKey':'output','type':'string','description':a128_0x3e1c6f(0x191),'hidden':!![]},{'name':'params','meowKey':a128_0x3e1c6f(0x16b),'type':a128_0x3e1c6f(0x18d),'description':a128_0x3e1c6f(0x15a),'hidden':!![]},{'name':a128_0x3e1c6f(0x1b4),'meowKey':'datasetcode','type':a128_0x3e1c6f(0x18d),'description':a128_0x3e1c6f(0x1b1),'hidden':!![]},{'name':a128_0x3e1c6f(0x173),'meowKey':'all','type':a128_0x3e1c6f(0x157),'description':a128_0x3e1c6f(0x152),'hidden':!![]},{'name':a128_0x3e1c6f(0x17b),'meowKey':'enableBffSave','type':a128_0x3e1c6f(0x157),'description':a128_0x3e1c6f(0x199),'hidden':!![]},{'name':'id','meowKey':'id','type':a128_0x3e1c6f(0x18d),'description':'Record\x20ID','hidden':!![]},{'name':a128_0x3e1c6f(0x175),'meowKey':a128_0x3e1c6f(0x175),'type':a128_0x3e1c6f(0x18d),'description':'Type\x20filter','hidden':!![]},{'name':a128_0x3e1c6f(0x19e),'meowKey':a128_0x3e1c6f(0x19e),'type':a128_0x3e1c6f(0x18d),'description':'File\x20path','hidden':!![]},{'name':a128_0x3e1c6f(0x15e),'meowKey':a128_0x3e1c6f(0x15e),'type':a128_0x3e1c6f(0x18d),'description':a128_0x3e1c6f(0x16f),'hidden':!![]},{'name':a128_0x3e1c6f(0x1a7),'meowKey':'sqlName','type':a128_0x3e1c6f(0x18d),'description':a128_0x3e1c6f(0x1b6),'hidden':!![]},{'name':a128_0x3e1c6f(0x1a6),'meowKey':a128_0x3e1c6f(0x1a6),'type':a128_0x3e1c6f(0x18d),'description':a128_0x3e1c6f(0x1b6),'hidden':!![]},{'name':a128_0x3e1c6f(0x1af),'meowKey':'dbId','type':'string','description':a128_0x3e1c6f(0x189),'hidden':!![]},{'name':a128_0x3e1c6f(0x18b),'meowKey':a128_0x3e1c6f(0x18b),'type':a128_0x3e1c6f(0x18d),'description':'DB\x20ID','hidden':!![]},{'name':a128_0x3e1c6f(0x170),'meowKey':a128_0x3e1c6f(0x170),'type':a128_0x3e1c6f(0x18d),'description':a128_0x3e1c6f(0x1b9),'hidden':!![]},{'name':a128_0x3e1c6f(0x17c),'meowKey':a128_0x3e1c6f(0x16e),'type':a128_0x3e1c6f(0x18d),'description':a128_0x3e1c6f(0x18f),'hidden':!![]},{'name':'page','meowKey':a128_0x3e1c6f(0x1b0),'type':a128_0x3e1c6f(0x18d),'description':a128_0x3e1c6f(0x169),'hidden':!![]},{'name':a128_0x3e1c6f(0x182),'meowKey':a128_0x3e1c6f(0x182),'type':a128_0x3e1c6f(0x18d),'description':a128_0x3e1c6f(0x1ab),'hidden':!![]},{'name':a128_0x3e1c6f(0x198),'meowKey':a128_0x3e1c6f(0x198),'type':a128_0x3e1c6f(0x18d),'description':'Keyword\x20filter','hidden':!![]},{'name':'code','meowKey':a128_0x3e1c6f(0x1a0),'type':a128_0x3e1c6f(0x18d),'description':a128_0x3e1c6f(0x1a2),'hidden':!![]},{'name':a128_0x3e1c6f(0x188),'meowKey':a128_0x3e1c6f(0x188),'type':a128_0x3e1c6f(0x18d),'description':a128_0x3e1c6f(0x17f),'hidden':!![]},{'name':a128_0x3e1c6f(0x176),'meowKey':'schemas','type':'string','description':a128_0x3e1c6f(0x159),'hidden':!![]},{'name':'operation','meowKey':a128_0x3e1c6f(0x1b3),'type':a128_0x3e1c6f(0x18d),'description':a128_0x3e1c6f(0x193),'hidden':!![]},{'name':a128_0x3e1c6f(0x1ad),'meowKey':'target','type':a128_0x3e1c6f(0x18d),'description':a128_0x3e1c6f(0x183),'hidden':!![]},{'name':a128_0x3e1c6f(0x150),'meowKey':'skipImports','type':a128_0x3e1c6f(0x157),'description':'Skip\x20import\x20generation','hidden':!![]},{'name':a128_0x3e1c6f(0x16d),'meowKey':a128_0x3e1c6f(0x16d),'type':'string','description':a128_0x3e1c6f(0x15b),'hidden':!![]},{'name':'value','meowKey':a128_0x3e1c6f(0x14f),'type':a128_0x3e1c6f(0x18d),'description':a128_0x3e1c6f(0x14e),'hidden':!![]},{'name':a128_0x3e1c6f(0x196),'meowKey':'force','type':'boolean','description':a128_0x3e1c6f(0x1ac),'hidden':!![]},{'name':a128_0x3e1c6f(0x190),'meowKey':a128_0x3e1c6f(0x190),'type':a128_0x3e1c6f(0x157),'description':a128_0x3e1c6f(0x1b5),'hidden':!![]},{'name':a128_0x3e1c6f(0x177),'meowKey':a128_0x3e1c6f(0x177),'type':a128_0x3e1c6f(0x157),'description':a128_0x3e1c6f(0x151),'hidden':!![]},{'name':a128_0x3e1c6f(0x1ba),'meowKey':a128_0x3e1c6f(0x1ba),'type':a128_0x3e1c6f(0x157),'description':a128_0x3e1c6f(0x1a3),'hidden':!![]},{'name':a128_0x3e1c6f(0x1a9),'meowKey':a128_0x3e1c6f(0x1b8),'type':a128_0x3e1c6f(0x18d),'description':a128_0x3e1c6f(0x19b),'hidden':!![]},{'name':a128_0x3e1c6f(0x180),'meowKey':a128_0x3e1c6f(0x1a5),'type':a128_0x3e1c6f(0x18d),'description':a128_0x3e1c6f(0x193),'hidden':!![]},{'name':a128_0x3e1c6f(0x1bc),'meowKey':a128_0x3e1c6f(0x166),'type':a128_0x3e1c6f(0x18d),'description':a128_0x3e1c6f(0x163),'hidden':!![]}];export const PIPELINE_FLAG_NAMES=new Set([a128_0x3e1c6f(0x1b7),a128_0x3e1c6f(0x184),'env',a128_0x3e1c6f(0x16a),'jq',a128_0x3e1c6f(0x154),a128_0x3e1c6f(0x17d),a128_0x3e1c6f(0x186),'ci']);export function buildMeowFlags(){const _0x11da27=a128_0x3e1c6f;return Object[_0x11da27(0x155)](GLOBAL_FLAGS[_0x11da27(0x15c)](_0x997898=>[_0x997898['meowKey'],{'type':_0x997898[_0x11da27(0x175)]}]));}function a128_0x1637(){const _0x4caf6d=['748596qNNrlw','Schemas','JSON\x20params','Config\x20key','map','nonInteractive','sqlcode','project','clear','Title','3251430pVnCwY','Function\x20node','<name>','Rabetbase\x20CLI','functionNode','Show\x20help','Use\x20project\x20config\x20scope','Page\x20number','format','params','rabetbase','key','descriptionFile','SQL\x20code','description','Clear','help','all','Preview\x20operation\x20without\x20executing','type','schemas','remote','444549vmZIZI','<code>','Use\x20global\x20config\x20scope','enable-bff-save','description-file','yes','watch','SQL\x20string','operation-type','541764PodEOv','pagesize','Target\x20path','app','115767StVsVJ','non-interactive','7NxLnHx','sql','DB\x20ID','6VflUkN','dbid','@lovrabet/rabetbase-cli','string','9rtUaoz','Description\x20file','confirm','Output\x20path','Watch\x20mode','Operation\x20type','739272kuMWjJ','48ObNwEE','force','<expr>','keyword','Enable\x20BFF\x20save','Select\x20app\x20profile\x20by\x20name','Expected\x20affected\x20count','5swiDfT','Filter\x20JSON\x20output\x20(JQ_PATH\x20>\x20bundled\x20jq\x20>\x20PATH;\x20use\x20with\x20--format\x20json\x20or\x20compress)','file','title','code','Output\x20format','Code\x20filter','Verbose\x20output','Alias\x20for\x20--non-interactive','operationType','sqlname','sql-name','global','expected-count','production\x20|\x20daily','Page\x20size','Force\x20overwrite','target','dryRun','db-id','page','Dataset\x20code','Skip\x20confirmation\x20for\x20high-risk\x20writes','operation','datasetcode','Confirm\x20destructive\x20action','SQL\x20name','appcode','expectedCount','Description','verbose','Force\x20non-interactive\x20mode\x20(CI)','function-node','Name','4584789SklWEq','Config\x20value','value','skip-imports','Use\x20remote','Apply\x20to\x20all','json\x20|\x20pretty\x20|\x20compress','dry-run','fromEntries','env','boolean'];a128_0x1637=function(){return _0x4caf6d;};return a128_0x1637();}
|
package/lib/constant/defaults.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a129_0x4543(){const _0x2407f4=['2157992dvaeAp','82186jaUaQU','6IyJvXu','952410VWHelg','527256UzGvqh','18NwSXMM','high-risk-write','compress','2678417aculAK','145076TAJsNs','production','11200120guicQU','12VbrWXz','en-US'];a129_0x4543=function(){return _0x2407f4;};return a129_0x4543();}const a129_0x591943=a129_0x108f;(function(_0x220ce5,_0x44d52f){const _0x5db122=a129_0x108f,_0x45ec95=_0x220ce5();while(!![]){try{const _0x12f7f4=-parseInt(_0x5db122(0x124))/0x1+parseInt(_0x5db122(0x12f))/0x2+-parseInt(_0x5db122(0x12c))/0x3*(parseInt(_0x5db122(0x129))/0x4)+-parseInt(_0x5db122(0x131))/0x5+-parseInt(_0x5db122(0x130))/0x6*(parseInt(_0x5db122(0x128))/0x7)+parseInt(_0x5db122(0x12e))/0x8*(parseInt(_0x5db122(0x125))/0x9)+parseInt(_0x5db122(0x12b))/0xa;if(_0x12f7f4===_0x44d52f)break;else _0x45ec95['push'](_0x45ec95['shift']());}catch(_0x51cf1e){_0x45ec95['push'](_0x45ec95['shift']());}}}(a129_0x4543,0x6f1f6));import{DEFAULT_API_DIR}from'../constant/paths.js';function a129_0x108f(_0x304171,_0x21d1c0){_0x304171=_0x304171-0x124;const _0x454371=a129_0x4543();let _0x108ffb=_0x454371[_0x304171];return _0x108ffb;}export const DEFAULT_CONFIG_VALUES={'env':a129_0x591943(0x12a),'format':a129_0x591943(0x127),'locale':a129_0x591943(0x12d),'riskLevel':a129_0x591943(0x126),'apiDir':DEFAULT_API_DIR};export const DEFAULT_COMMAND_OUTPUT_FORMAT=a129_0x591943(0x127);
|
package/lib/constant/domain.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a130_0x3571d7=a130_0x36dc;(function(_0x20a4a9,_0x2ce36f){const _0xbd8137=a130_0x36dc,_0x20799d=_0x20a4a9();while(!![]){try{const _0x327f2b=-parseInt(_0xbd8137(0x191))/0x1*(-parseInt(_0xbd8137(0x196))/0x2)+parseInt(_0xbd8137(0x199))/0x3*(-parseInt(_0xbd8137(0x192))/0x4)+parseInt(_0xbd8137(0x197))/0x5+-parseInt(_0xbd8137(0x19a))/0x6+-parseInt(_0xbd8137(0x193))/0x7*(parseInt(_0xbd8137(0x195))/0x8)+-parseInt(_0xbd8137(0x19b))/0x9+parseInt(_0xbd8137(0x194))/0xa;if(_0x327f2b===_0x2ce36f)break;else _0x20799d['push'](_0x20799d['shift']());}catch(_0x5fcc42){_0x20799d['push'](_0x20799d['shift']());}}}(a130_0x5d53,0xe844c));import{getEnv,isProduction}from'../constant/env.js';function a130_0x36dc(_0x30e069,_0x3e8ba0){_0x30e069=_0x30e069-0x190;const _0x5d5372=a130_0x5d53();let _0x36dcca=_0x5d5372[_0x30e069];return _0x36dcca;}let customApiDomain,customUserDomain,customRuntimeDomain;export function initDomains(_0x2f6bff){const _0x565668=a130_0x36dc;customApiDomain=_0x2f6bff?.['apiDomain'],customUserDomain=_0x2f6bff?.[_0x565668(0x19d)],customRuntimeDomain=_0x2f6bff?.['runtimeDomain'];}export const getUserDomain=()=>customUserDomain||(isProduction(getEnv())?a130_0x3571d7(0x19e):a130_0x3571d7(0x19c));function a130_0x5d53(){const _0x26116a=['10983136nijCSg','3382654WlgRwK','3961755RhoooR','https://api.lovrabet.com','2220861znzLGM','9942504tqNhBt','11773971PyymGt','https://user-daily.lovrabet.com','userDomain','https://user.lovrabet.com','https://daily-api.lovrabet.com','https://daily-runtime.lovrabet.com','1BayDna','4ZiWCLg','7RimXKk','35461760kxyyFB'];a130_0x5d53=function(){return _0x26116a;};return a130_0x5d53();}export const getApiDomain=()=>customApiDomain||(isProduction(getEnv())?a130_0x3571d7(0x198):a130_0x3571d7(0x19f));export const getRuntimeDomain=()=>customRuntimeDomain||(isProduction(getEnv())?'https://runtime.lovrabet.com':a130_0x3571d7(0x190));
|
package/lib/constant/env.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a131_0x243fcb=a131_0x2ca6;(function(_0x290ecf,_0x528761){const _0x2f4d9c=a131_0x2ca6,_0x1e3d3e=_0x290ecf();while(!![]){try{const _0x296624=parseInt(_0x2f4d9c(0x18f))/0x1*(-parseInt(_0x2f4d9c(0x187))/0x2)+-parseInt(_0x2f4d9c(0x185))/0x3+-parseInt(_0x2f4d9c(0x18a))/0x4+parseInt(_0x2f4d9c(0x184))/0x5*(-parseInt(_0x2f4d9c(0x18c))/0x6)+parseInt(_0x2f4d9c(0x18d))/0x7+-parseInt(_0x2f4d9c(0x186))/0x8+parseInt(_0x2f4d9c(0x189))/0x9;if(_0x296624===_0x528761)break;else _0x1e3d3e['push'](_0x1e3d3e['shift']());}catch(_0x807332){_0x1e3d3e['push'](_0x1e3d3e['shift']());}}}(a131_0x53c1,0x46391));export const RABETBASE_ENV_VALUES=[a131_0x243fcb(0x188),'daily'];export function normalizeEnv(_0x1d0488){const _0x2835d6=a131_0x243fcb;return _0x1d0488==='online'?_0x2835d6(0x188):_0x1d0488;}export function isProduction(_0x4d853e){const _0x4101e0=a131_0x243fcb;return normalizeEnv(_0x4d853e)===_0x4101e0(0x188);}export function isDaily(_0x27d67f){return normalizeEnv(_0x27d67f)==='daily';}function a131_0x2ca6(_0x34373d,_0x2e8bf6){_0x34373d=_0x34373d-0x184;const _0x53c101=a131_0x53c1();let _0x2ca6ca=_0x53c101[_0x34373d];return _0x2ca6ca;}export function isDev(_0x1d9ce4){const _0x2e7f0f=a131_0x243fcb,_0xbc0981=normalizeEnv(_0x1d9ce4);return _0xbc0981===_0x2e7f0f(0x18b)||_0xbc0981===_0x2e7f0f(0x18e);}let env=normalizeEnv(process.env.RABETBASE_ENV||process.env.LOVRABET_ENV||a131_0x243fcb(0x188));function a131_0x53c1(){const _0x2419ef=['dev','2ONfbtO','208385SEYAjH','141309iglqmS','4322024imfYWC','349974AovQBx','production','13525794UlpjDj','1595404nxePge','development','6SUZllD','1138375JjRXPL'];a131_0x53c1=function(){return _0x2419ef;};return a131_0x53c1();}export function getEnv(){return env;}export function initEnv(_0x2d4823){env=normalizeEnv(_0x2d4823);}
|
package/lib/constant/output.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a132_0x528d(_0x3e4d41,_0x5be260){_0x3e4d41=_0x3e4d41-0x14e;const _0x3be02c=a132_0x3be0();let _0x528dc3=_0x3be02c[_0x3e4d41];return _0x528dc3;}const a132_0x31863e=a132_0x528d;(function(_0x4692bb,_0x2145ab){const _0x2dafed=a132_0x528d,_0x3ed137=_0x4692bb();while(!![]){try{const _0xadc7a6=parseInt(_0x2dafed(0x14e))/0x1*(parseInt(_0x2dafed(0x159))/0x2)+parseInt(_0x2dafed(0x15a))/0x3*(-parseInt(_0x2dafed(0x151))/0x4)+parseInt(_0x2dafed(0x156))/0x5+parseInt(_0x2dafed(0x152))/0x6+-parseInt(_0x2dafed(0x150))/0x7+-parseInt(_0x2dafed(0x153))/0x8+parseInt(_0x2dafed(0x157))/0x9*(parseInt(_0x2dafed(0x158))/0xa);if(_0xadc7a6===_0x2145ab)break;else _0x3ed137['push'](_0x3ed137['shift']());}catch(_0x148135){_0x3ed137['push'](_0x3ed137['shift']());}}}(a132_0x3be0,0x573a7));export const RABETBASE_OUTPUT_FORMAT_VALUES=[a132_0x31863e(0x14f),a132_0x31863e(0x154),a132_0x31863e(0x155)];function a132_0x3be0(){const _0x246769=['490214lFbOMo','6tQelHQ','1YrRBzN','json','3804234DdXJEz','272836AWdajg','3793302JASCFo','3321440qPCxCA','pretty','compress','2662875tfrCBj','252WGQDZu','15160dAvQZl'];a132_0x3be0=function(){return _0x246769;};return a132_0x3be0();}
|
package/lib/constant/paths.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a133_0x2bc1d8=a133_0x43ea;function a133_0x43ea(_0x50b463,_0x2fcb51){_0x50b463=_0x50b463-0x17c;const _0x2683bf=a133_0x2683();let _0x43eac3=_0x2683bf[_0x50b463];return _0x43eac3;}function a133_0x2683(){const _0x4f6686=['./src/api','4157523libYqL','6wEOyqM','16358994GHUxGy','2365vjzhQs','568DicVJn','426262WOVClO','924Sfrepg','40425KKAUHs','113834qvqQyk','5619942ioSEXB','437930rCNRzR'];a133_0x2683=function(){return _0x4f6686;};return a133_0x2683();}(function(_0x2044d5,_0x5f30a3){const _0x44020e=a133_0x43ea,_0x1e7a4e=_0x2044d5();while(!![]){try{const _0x35953d=parseInt(_0x44020e(0x187))/0x1*(-parseInt(_0x44020e(0x17f))/0x2)+-parseInt(_0x44020e(0x186))/0x3+-parseInt(_0x44020e(0x180))/0x4*(parseInt(_0x44020e(0x181))/0x5)+-parseInt(_0x44020e(0x183))/0x6+parseInt(_0x44020e(0x182))/0x7*(-parseInt(_0x44020e(0x17e))/0x8)+-parseInt(_0x44020e(0x17c))/0x9+-parseInt(_0x44020e(0x184))/0xa*(-parseInt(_0x44020e(0x17d))/0xb);if(_0x35953d===_0x5f30a3)break;else _0x1e7a4e['push'](_0x1e7a4e['shift']());}catch(_0x1f401c){_0x1e7a4e['push'](_0x1e7a4e['shift']());}}}(a133_0x2683,0xedde4));export const DEFAULT_API_DIR=a133_0x2bc1d8(0x185);
|
package/lib/constant/risk.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a134_0x150a67=a134_0x5aa6;function a134_0x5aa6(_0x2f5e4b,_0x587eda){_0x2f5e4b=_0x2f5e4b-0xe0;const _0x27ba4b=a134_0x27ba();let _0x5aa692=_0x27ba4b[_0x2f5e4b];return _0x5aa692;}(function(_0x16ccf6,_0x250caa){const _0x4e28be=a134_0x5aa6,_0x7abfdc=_0x16ccf6();while(!![]){try{const _0x473105=-parseInt(_0x4e28be(0xe8))/0x1+-parseInt(_0x4e28be(0xea))/0x2*(-parseInt(_0x4e28be(0xe2))/0x3)+parseInt(_0x4e28be(0xe7))/0x4+-parseInt(_0x4e28be(0xe1))/0x5+-parseInt(_0x4e28be(0xe9))/0x6*(parseInt(_0x4e28be(0xe0))/0x7)+parseInt(_0x4e28be(0xe6))/0x8+parseInt(_0x4e28be(0xe5))/0x9;if(_0x473105===_0x250caa)break;else _0x7abfdc['push'](_0x7abfdc['shift']());}catch(_0x4878bf){_0x7abfdc['push'](_0x7abfdc['shift']());}}}(a134_0x27ba,0xdf56d));export const RISK_LEVEL_VALUES=[a134_0x150a67(0xe3),a134_0x150a67(0xeb),a134_0x150a67(0xe4)];function a134_0x27ba(){const _0x4423f0=['16430697QKMezO','911064uTetle','5671492CBGmvy','1548310xSVbAQ','7217256GiaQCW','26RhDARf','write','7RRpJLi','4779385DGyaBM','291801KtoyXT','read','high-risk-write'];a134_0x27ba=function(){return _0x4423f0;};return a134_0x27ba();}
|
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_0x249431=a135_0x34ff;(function(_0x3657c8,_0x3711d3){const _0x418c2f=a135_0x34ff,_0x752910=_0x3657c8();while(!![]){try{const _0x4b87b6=parseInt(_0x418c2f(0x154))/0x1*(parseInt(_0x418c2f(0x151))/0x2)+parseInt(_0x418c2f(0x18e))/0x3*(parseInt(_0x418c2f(0x188))/0x4)+-parseInt(_0x418c2f(0x15e))/0x5*(-parseInt(_0x418c2f(0x172))/0x6)+parseInt(_0x418c2f(0x15d))/0x7*(parseInt(_0x418c2f(0x16e))/0x8)+-parseInt(_0x418c2f(0x16b))/0x9*(-parseInt(_0x418c2f(0x185))/0xa)+parseInt(_0x418c2f(0x14d))/0xb*(parseInt(_0x418c2f(0x137))/0xc)+parseInt(_0x418c2f(0x17a))/0xd*(-parseInt(_0x418c2f(0x18d))/0xe);if(_0x4b87b6===_0x3711d3)break;else _0x752910['push'](_0x752910['shift']());}catch(_0x39b2a7){_0x752910['push'](_0x752910['shift']());}}}(a135_0x39e5,0xa05f5));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';function a135_0x34ff(_0x3df44d,_0x3341ee){_0x3df44d=_0x3df44d-0x136;const _0x39e503=a135_0x39e5();let _0x34ff8e=_0x39e503[_0x3df44d];return _0x34ff8e;}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(_0x1bffc0){return process.env[`RABETBASE_${_0x1bffc0}`]||process.env[`LOVRABET_${_0x1bffc0}`]||undefined;}export const NEW_CONFIG_NAME='.rabetbase.json';export const CONFIG_NAMES=[a135_0x249431(0x16c),a135_0x249431(0x14e),a135_0x249431(0x17c)];export const LEGACY_CONFIG_NAMES=CONFIG_NAMES[a135_0x249431(0x169)](_0x102244=>_0x102244!==NEW_CONFIG_NAME);export function resolveConfigPath(_0x231309){for(const _0x1f8886 of CONFIG_NAMES){const _0x9437eb=resolve(_0x231309,_0x1f8886);if(existsSync(_0x9437eb))return _0x9437eb;}return undefined;}export function findProjectRootDirectory(_0x26496c=process[a135_0x249431(0x13b)]()){let _0x445880=resolve(_0x26496c);const {root:_0x62e083}=parse(_0x445880),_0x16233f=homedir();while(!![]){if(resolveConfigPath(_0x445880)){if(_0x445880===_0x16233f)break;return _0x445880;}if(_0x445880===_0x62e083||_0x445880===_0x16233f)break;const _0x25b096=dirname(_0x445880);if(_0x25b096===_0x445880)break;_0x445880=_0x25b096;}return resolve(_0x26496c);}export async function createContext(_0x2b49da){const _0x2e2628=a135_0x249431,_0x376c97=readRawConfig(),_0x1c8594=buildConfig(_0x376c97,_0x2b49da),{initEnv:_0x28ab11}=await import(_0x2e2628(0x13f));if(_0x1c8594[_0x2e2628(0x167)])_0x28ab11(_0x1c8594[_0x2e2628(0x167)]);else _0x2b49da[_0x2e2628(0x167)]&&typeof _0x2b49da[_0x2e2628(0x167)]===_0x2e2628(0x18a)&&_0x28ab11(_0x2b49da['env']);const {initDomains:_0x55821d,getUserDomain:_0xf20b5,getApiDomain:_0x3b96d5}=await import(_0x2e2628(0x138));_0x55821d({'apiDomain':_0x376c97[_0x2e2628(0x15c)]||undefined,'userDomain':_0x376c97['userDomain']||undefined,'runtimeDomain':_0x376c97[_0x2e2628(0x16f)]||undefined});const _0x4db37c={'apiDomain':_0x3b96d5(),'userDomain':_0xf20b5()},_0x1e2e5f=await buildAuth(_0x1c8594);logger[_0x2e2628(0x140)](process[_0x2e2628(0x13b)]());const _0x29a851=(CLI_BIN_NAME+'\x20'+process['argv'][_0x2e2628(0x14f)](0x2)[_0x2e2628(0x160)]('\x20'))['trim']();logger['setRawCommand'](_0x29a851);const {isNonInteractive:_0x1d93fa}=await import('./utils/is-non-interactive.js'),_0x320498=_0x1d93fa(_0x2b49da);return{'config':_0x1c8594,'auth':_0x1e2e5f,'logger':logger,'env':_0x4db37c,'nonInteractive':_0x320498};}export function buildConfigFromFlags(_0x3407e3){return buildConfig(readRawConfig(),_0x3407e3);}export function getProjectConfigPath(){return resolveConfigPath(process['cwd']());}export function getGlobalConfigPath(){return resolveConfigPath(homedir());}export function isInProject(){return!!getProjectConfigPath();}export function inspectCliConfigJsonFile(_0xe8ae14){const _0x29ab1c=a135_0x249431;if(!existsSync(_0xe8ae14))return{'status':_0x29ab1c(0x18c)};try{const _0x1949d0=readFileSync(_0xe8ae14,{'encoding':_0x29ab1c(0x171)});if(!_0x1949d0?.[_0x29ab1c(0x15b)]())return{'status':'empty'};const _0x194b63=JSON[_0x29ab1c(0x13c)](_0x1949d0);return{'status':'ok','data':_0x194b63};}catch(_0x4cfefc){return{'status':_0x29ab1c(0x142),'message':_0x4cfefc instanceof Error?_0x4cfefc[_0x29ab1c(0x177)]:String(_0x4cfefc)};}}function parseCliConfigJsonFile(_0x4e62ec,_0x3cbb28,_0x3d2910){const _0x5b9b6c=a135_0x249431,_0x282e8d=inspectCliConfigJsonFile(_0x4e62ec);if(_0x282e8d[_0x5b9b6c(0x18f)]==='missing'||_0x282e8d['status']==='empty')return{};if(_0x282e8d[_0x5b9b6c(0x18f)]==='ok')return _0x282e8d[_0x5b9b6c(0x184)];return _0x3cbb28===_0x5b9b6c(0x14a)&&_0x3d2910&&console[_0x5b9b6c(0x142)](CLI_BIN_NAME+':\x20'+_0x3d2910+_0x5b9b6c(0x187)+_0x4e62ec+_0x5b9b6c(0x189)+_0x282e8d[_0x5b9b6c(0x177)]),{};}const normalizedWriteCache=new Map();function normalizeLegacyConfigShape(_0x57c12b){const _0x1cf80d=a135_0x249431;if(!_0x57c12b||typeof _0x57c12b!==_0x1cf80d(0x173))return{'config':{},'migrated':![]};const _0x477869={..._0x57c12b},_0x2fcc1b=_0x477869['apps']&&typeof _0x477869[_0x1cf80d(0x18b)]===_0x1cf80d(0x173)?{..._0x477869['apps']}:{},_0x564f01=Object[_0x1cf80d(0x158)](_0x2fcc1b)[_0x1cf80d(0x150)],_0x4828d8=_0x477869[_0x1cf80d(0x143)]||_0x477869[_0x1cf80d(0x13e)];let _0x1060d5=![];if(_0x4828d8&&_0x564f01===0x0){const _0x38b512=typeof _0x477869[_0x1cf80d(0x178)]===_0x1cf80d(0x18a)&&_0x477869[_0x1cf80d(0x178)][_0x1cf80d(0x15b)]()?_0x477869[_0x1cf80d(0x178)]:String(_0x4828d8)['trim']();_0x2fcc1b[_0x38b512]={'appcode':String(_0x4828d8)[_0x1cf80d(0x15b)](),..._0x477869[_0x1cf80d(0x167)]!=null?{'env':_0x477869[_0x1cf80d(0x167)]}:{},..._0x477869[_0x1cf80d(0x179)]!=null?{'apiDir':_0x477869['apiDir']}:{},..._0x477869['cookie']!=null?{'cookie':_0x477869[_0x1cf80d(0x141)]}:{},..._0x477869[_0x1cf80d(0x156)]!=null?{'accessKey':_0x477869[_0x1cf80d(0x156)]}:{},..._0x477869[_0x1cf80d(0x17e)]!=null?{'format':_0x477869['format']}:{},..._0x477869[_0x1cf80d(0x176)]!=null?{'pageSize':_0x477869[_0x1cf80d(0x176)]}:{},..._0x477869[_0x1cf80d(0x157)]!=null?{'riskLevel':_0x477869['riskLevel']}:{},..._0x477869[_0x1cf80d(0x149)]!=null?{'locale':_0x477869[_0x1cf80d(0x149)]}:{}},_0x477869[_0x1cf80d(0x18b)]=_0x2fcc1b;if(!_0x477869['defaultApp'])_0x477869[_0x1cf80d(0x178)]=_0x38b512;_0x1060d5=!![];}return(_0x1cf80d(0x143)in _0x477869||_0x1cf80d(0x13e)in _0x477869)&&(delete _0x477869[_0x1cf80d(0x143)],delete _0x477869[_0x1cf80d(0x13e)],_0x1060d5=!![]),{'config':_0x477869,'migrated':_0x1060d5};}function writeNormalizedConfigIfNeeded(_0x13eb6e,_0x3453e2){const _0x819d49=a135_0x249431,_0x2a1ae4=JSON['stringify'](_0x3453e2,null,0x2)+'\x0a';if(normalizedWriteCache[_0x819d49(0x166)](_0x13eb6e)===_0x2a1ae4)return;writeConfigFile(_0x13eb6e,_0x3453e2),normalizedWriteCache[_0x819d49(0x13d)](_0x13eb6e,_0x2a1ae4);}function parseAndNormalizeConfig(_0xae06d7,_0x35b0a6,_0x219def){const _0x3d9fc4=a135_0x249431,_0x13b658=parseCliConfigJsonFile(_0xae06d7,_0x35b0a6,_0x219def),_0x537d90=normalizeLegacyConfigShape(_0x13b658);if(_0x537d90[_0x3d9fc4(0x136)])try{writeNormalizedConfigIfNeeded(_0xae06d7,_0x537d90['config']);}catch{}return _0x537d90[_0x3d9fc4(0x16a)];}export function loadRawConfigLayers(_0x5733fb){const _0x535897=a135_0x249431;let _0x31747d={},_0x3f52dc={};const _0x134190=resolveConfigPath(homedir());_0x134190&&(_0x31747d=parseAndNormalizeConfig(_0x134190,_0x535897(0x14a),'Global'));const _0x184c24=_0x5733fb??findProjectRootDirectory(),_0x1feb69=resolveConfigPath(_0x184c24);return _0x1feb69&&(_0x3f52dc=parseAndNormalizeConfig(_0x1feb69,'warn',_0x535897(0x165))),{'globalPath':_0x134190,'projectPath':_0x1feb69,'globalConfig':_0x31747d,'projectConfig':_0x3f52dc};}function mergeRawConfigLayers(_0x50cbc1){const _0x472e78=a135_0x249431,{globalConfig:_0x112e04,projectConfig:_0x248044}=_0x50cbc1;if(_0x248044[_0x472e78(0x15a)]===![]){const _0x4ae7b3={..._0x248044};delete _0x4ae7b3['inherit'];const _0x255b8e=_0x248044[_0x472e78(0x18b)]&&typeof _0x248044[_0x472e78(0x18b)]===_0x472e78(0x173)?_0x248044['apps']:{};Object[_0x472e78(0x158)](_0x255b8e)[_0x472e78(0x150)]>0x0?_0x4ae7b3[_0x472e78(0x18b)]=_0x255b8e:delete _0x4ae7b3['apps'];if(_0x472e78(0x178)in _0x248044)_0x4ae7b3[_0x472e78(0x178)]=_0x248044[_0x472e78(0x178)];else Object[_0x472e78(0x158)](_0x255b8e)[_0x472e78(0x150)]>0x0&&(_0x4ae7b3[_0x472e78(0x178)]=Object[_0x472e78(0x158)](_0x255b8e)[0x0]);return _0x4ae7b3;}const _0x1819f0=_0x112e04[_0x472e78(0x18b)]&&typeof _0x112e04['apps']===_0x472e78(0x173)?_0x112e04['apps']:{},_0x3eff21=_0x248044[_0x472e78(0x18b)]&&typeof _0x248044[_0x472e78(0x18b)]===_0x472e78(0x173)?_0x248044[_0x472e78(0x18b)]:{},_0x27d6f4={..._0x1819f0,..._0x3eff21},_0x44b657={..._0x112e04,..._0x248044};Object[_0x472e78(0x158)](_0x27d6f4)['length']>0x0&&(_0x44b657[_0x472e78(0x18b)]=_0x27d6f4);if(_0x472e78(0x178)in _0x248044)_0x44b657['defaultApp']=_0x248044[_0x472e78(0x178)];else{if(_0x3eff21&&Object[_0x472e78(0x158)](_0x3eff21)['length']>0x0)_0x44b657[_0x472e78(0x178)]=Object[_0x472e78(0x158)](_0x3eff21)[0x0];else{if(_0x112e04[_0x472e78(0x178)])_0x44b657[_0x472e78(0x178)]=_0x112e04[_0x472e78(0x178)];else{const _0x2c6d0c=Object[_0x472e78(0x158)](_0x1819f0);_0x2c6d0c['length']>0x0&&(_0x44b657[_0x472e78(0x178)]=_0x2c6d0c[0x0]);}}}return _0x44b657;}export function readRawConfigWithLayers(_0x34335c){const _0x2c0223=loadRawConfigLayers(_0x34335c);return{'config':mergeRawConfigLayers(_0x2c0223),'layers':_0x2c0223};}function a135_0x39e5(){const _0x38d56f=['stringify','data','55570GrwezP','ENV','\x20config\x20file\x20ignored\x20(invalid\x20JSON\x20or\x20unreadable):\x20','1713748vdPuDH','\x0a\x20\x20','string','apps','missing','73570EKteqL','6ZeCGek','status','migrated','245244QQwoEN','./constant/domain.js','values','replace','cwd','parse','set','app','./constant/env.js','setLogPath','cookie','error','appcode','https://g.lovrabet.com/dist/lovrabet-skill','entries','true','read','production','locale','warn','.tmp','map','319NrrWuk','.lovrabet.json','slice','length','2dpdyOl','project','daily','108074Atdilf','find','accessKey','riskLevel','keys','-api.ts','inherit','trim','apiDomain','532lAVPNk','140tMqyVk','COOKIE','join','merged','authRequired','maxRisk','api.ts','Project','get','env','write','filter','config','1341DCXKQk','.rabetbase.json','APP','54744LjwlCZ','runtimeDomain','projectConfig','utf8','71016psrTNw','object','APPCODE','ACCESS_KEY','pageSize','message','defaultApp','apiDir','6383LVJZFZ','MAX_RISK','.lovrabetrc','template_base_url','format','silent','PAGE_SIZE','./auth/get-cookie.js','RISK_LEVEL'];a135_0x39e5=function(){return _0x38d56f;};return a135_0x39e5();}export function readRawConfig(_0x22c514){return mergeRawConfigLayers(loadRawConfigLayers(_0x22c514));}export function getConfigAppCode(_0x159ddc){const _0x3db7c7=a135_0x249431,_0x13609e=readRawConfig(_0x159ddc);if(_0x13609e[_0x3db7c7(0x18b)]&&typeof _0x13609e[_0x3db7c7(0x18b)]===_0x3db7c7(0x173)){const _0x601ac5=_0x13609e[_0x3db7c7(0x178)];if(_0x601ac5&&_0x13609e[_0x3db7c7(0x18b)][_0x601ac5]?.[_0x3db7c7(0x143)])return String(_0x13609e[_0x3db7c7(0x18b)][_0x601ac5][_0x3db7c7(0x143)])[_0x3db7c7(0x15b)]();const _0x1c60cf=Object[_0x3db7c7(0x139)](_0x13609e['apps'])[0x0];if(_0x1c60cf?.[_0x3db7c7(0x143)])return String(_0x1c60cf['appcode'])['trim']();}const _0x232ebf=_0x13609e[_0x3db7c7(0x143)]||_0x13609e[_0x3db7c7(0x13e)];if(typeof _0x232ebf!=='string'||_0x232ebf[_0x3db7c7(0x15b)]()==='')return undefined;return _0x232ebf[_0x3db7c7(0x15b)]();}export function getMultiAppConfigs(_0x196071=a135_0x249431(0x152),_0x9905bc){const _0x133e80=a135_0x249431,_0x12beb2=_0x196071===_0x133e80(0x161)?readRawConfig(_0x9905bc):loadRawConfigLayers(_0x9905bc)[_0x133e80(0x170)],_0x284f9d=_0x12beb2[_0x133e80(0x18b)];if(!_0x284f9d||typeof _0x284f9d!==_0x133e80(0x173)||Object[_0x133e80(0x158)](_0x284f9d)['length']===0x0)return null;const _0x29c193=_0x12beb2[_0x133e80(0x178)];return Object[_0x133e80(0x145)](_0x284f9d)[_0x133e80(0x14c)](([_0x221800,_0x2d330b])=>({'name':_0x221800,'appcode':_0x2d330b?.['appcode']||'','isDefault':_0x221800===_0x29c193,'env':_0x2d330b?.[_0x133e80(0x167)],'apiDir':_0x2d330b?.[_0x133e80(0x179)],'cookie':_0x2d330b?.[_0x133e80(0x141)]||undefined}))['filter'](_0x510d92=>_0x510d92['appcode']);}export function getTemplateBaseUrl(_0x532ebb){const _0x560ac6=a135_0x249431,_0x2c7b71=readRawConfig(_0x532ebb);if(_0x2c7b71[_0x560ac6(0x17d)]&&typeof _0x2c7b71['template_base_url']===_0x560ac6(0x18a))return _0x2c7b71[_0x560ac6(0x17d)][_0x560ac6(0x13a)](/\/$/,'');return _0x560ac6(0x144);}export function readConfigFile(_0x101b12){const _0x2f3bb9=a135_0x249431;return parseAndNormalizeConfig(_0x101b12,_0x2f3bb9(0x17f));}export function writeConfigFile(_0x27c148,_0x3dd0ba){const _0x5b4a77=a135_0x249431,_0x2ca868=dirname(_0x27c148);!existsSync(_0x2ca868)&&mkdirSync(_0x2ca868,{'recursive':!![]});const _0x2b76b2=_0x27c148+_0x5b4a77(0x14b);try{writeFileSync(_0x2b76b2,JSON[_0x5b4a77(0x183)](_0x3dd0ba,null,0x2)+'\x0a',{'encoding':_0x5b4a77(0x171),'mode':0x180}),renameSync(_0x2b76b2,_0x27c148);}catch(_0xd78908){try{unlinkSync(_0x2b76b2);}catch{}throw _0xd78908;}}export function resolveWriteConfigPath(_0x4cb80d){const _0x4fe0f7=a135_0x249431,_0x4eb334=_0x4cb80d==='project'?process[_0x4fe0f7(0x13b)]():homedir(),_0x2ec8cc=resolveConfigPath(_0x4eb334);return _0x2ec8cc??resolve(_0x4eb334,NEW_CONFIG_NAME);}function buildConfig(_0x546196,_0x1b9e38){const _0x6b4ea8=a135_0x249431,_0x45b08a={};if(_0x546196[_0x6b4ea8(0x18b)]&&typeof _0x546196[_0x6b4ea8(0x18b)]===_0x6b4ea8(0x173))for(const [_0x29ec72,_0x5a2e59]of Object['entries'](_0x546196['apps'])){_0x5a2e59&&typeof _0x5a2e59===_0x6b4ea8(0x173)&&_0x5a2e59[_0x6b4ea8(0x143)]&&(_0x45b08a[_0x29ec72]=_0x5a2e59);}const _0x2eae39=_0x546196['defaultApp']||undefined,_0x4084dd=Object['keys'](_0x45b08a)['length']>0x0,_0x7abe01=_0x1b9e38[_0x6b4ea8(0x13e)]||env(_0x6b4ea8(0x16d))||undefined,_0x40ab75=_0x7abe01||_0x2eae39||undefined,_0x15aa37=_0x1b9e38['appcode']||env(_0x6b4ea8(0x174))||undefined,_0x3f9c8e=_0x15aa37?Object[_0x6b4ea8(0x145)](_0x45b08a)[_0x6b4ea8(0x155)](([,_0x4a9a1b])=>_0x4a9a1b?.['appcode']===_0x15aa37):undefined,_0xbef94b=_0x3f9c8e?.[0x0],_0x58854c=_0x3f9c8e?.[0x1];let _0x4290bc=_0x15aa37?_0xbef94b:_0x40ab75,_0x5d9a74=_0x4290bc&&_0x45b08a[_0x4290bc]?_0x45b08a[_0x4290bc]:undefined;_0x15aa37&&_0x58854c&&(_0x5d9a74=_0x58854c);const _0x37c057=_0x15aa37?_0x58854c??_0x5d9a74:_0x5d9a74,_0x1db42a=_0x7abe01||(_0x15aa37?_0xbef94b:undefined),_0x317c41=_0x15aa37||_0x37c057?.[_0x6b4ea8(0x143)]||undefined,_0x31faa7=_0x1b9e38[_0x6b4ea8(0x167)]||env(_0x6b4ea8(0x186))||_0x37c057?.['env']||_0x546196[_0x6b4ea8(0x167)]||DEFAULT_CONFIG_VALUES[_0x6b4ea8(0x167)],_0x11f617=_0x37c057?.['locale']||_0x546196[_0x6b4ea8(0x149)]||DEFAULT_CONFIG_VALUES[_0x6b4ea8(0x149)],_0x2696be=env(_0x6b4ea8(0x15f))||_0x37c057?.[_0x6b4ea8(0x141)]||_0x546196[_0x6b4ea8(0x141)]||undefined,_0xac408c=env(_0x6b4ea8(0x175))||_0x37c057?.['accessKey']||_0x546196[_0x6b4ea8(0x156)]||undefined,_0x4007dd=_0x1b9e38[_0x6b4ea8(0x17e)]||env('FORMAT')||_0x37c057?.[_0x6b4ea8(0x17e)]||_0x546196['format'],_0x3128f6=normalizeLegacyOutputFormat(_0x4007dd),_0x3ae29d=env(_0x6b4ea8(0x180))||_0x37c057?.[_0x6b4ea8(0x176)]||_0x546196['pageSize'],_0x29dc12=_0x3ae29d?Number(_0x3ae29d)||undefined:undefined,_0x4f031f=env(_0x6b4ea8(0x182))||env(_0x6b4ea8(0x17b))||_0x37c057?.[_0x6b4ea8(0x157)]||_0x546196[_0x6b4ea8(0x157)]||_0x546196[_0x6b4ea8(0x163)],_0x466235=_0x4f031f===_0x6b4ea8(0x147)||_0x4f031f===_0x6b4ea8(0x168)?_0x4f031f:DEFAULT_CONFIG_VALUES[_0x6b4ea8(0x157)],_0x12d30f=env('VERBOSE'),_0x2c6280=_0x12d30f==='1'||_0x12d30f===_0x6b4ea8(0x146),_0x42a65f=_0x37c057?.[_0x6b4ea8(0x179)]||_0x546196[_0x6b4ea8(0x179)]||DEFAULT_CONFIG_VALUES[_0x6b4ea8(0x179)],_0xf02db6=isDaily(normalizeEnv(String(_0x31faa7)))?_0x6b4ea8(0x153):_0x6b4ea8(0x148);return{'appCode':typeof _0x317c41===_0x6b4ea8(0x18a)&&_0x317c41['trim']()?_0x317c41[_0x6b4ea8(0x15b)]():undefined,'env':_0xf02db6,'locale':_0x11f617,'cookie':_0x2696be,'accessKey':_0xac408c,'format':_0x3128f6,'pageSize':_0x29dc12,'riskLevel':_0x466235,'verbose':_0x2c6280,'apiDir':_0x42a65f,'apps':_0x45b08a,'defaultApp':_0x2eae39,'currentApp':_0x4084dd?_0x4290bc:undefined,'explicitAppName':_0x1db42a,'raw':_0x546196};}async function buildAuth(_0x14b357){const _0x33474b=a135_0x249431,{getCookie:_0x475a97}=await import(_0x33474b(0x181)),_0x30f25f=_0x14b357[_0x33474b(0x141)]||_0x475a97(),_0x237c53=_0x30f25f?await getIsSessionValid():![];return{'cookie':_0x30f25f,'isLoggedIn':_0x237c53,async 'getOrLogin'(){const _0x4857de=_0x33474b;if(_0x30f25f&&_0x237c53)return _0x30f25f;throw CliErrors[_0x4857de(0x162)]();}};}export function resolveApiFilePath(_0x5a9ea4,_0x193f43){const _0x2d3642=a135_0x249431,_0x14c1f8=resolve(process[_0x2d3642(0x13b)](),_0x5a9ea4),_0x8e2a68=resolve(_0x14c1f8,_0x2d3642(0x164));if(!_0x193f43)return _0x8e2a68;const _0x1527b0=readRawConfig(),_0x5b3cab=_0x1527b0[_0x2d3642(0x18b)]&&typeof _0x1527b0['apps']===_0x2d3642(0x173)?_0x1527b0[_0x2d3642(0x18b)]:{},_0x116b0d=Object['entries'](_0x5b3cab)['find'](([,_0x5ac8d8])=>_0x5ac8d8?.[_0x2d3642(0x143)]===_0x193f43);if(!_0x116b0d)return _0x8e2a68;const [_0x286850,_0x258bf7]=_0x116b0d,_0x4d0ae3=typeof _0x1527b0[_0x2d3642(0x178)]===_0x2d3642(0x18a)?_0x1527b0[_0x2d3642(0x178)]:undefined;if(_0x258bf7?.[_0x2d3642(0x179)])return _0x8e2a68;if(_0x4d0ae3&&_0x286850!==_0x4d0ae3)return resolve(_0x14c1f8,_0x286850+_0x2d3642(0x159));return _0x8e2a68;}
|