@lovrabet/rabetbase-cli 2.1.8 → 2.1.9
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_0x4585ee=a121_0x28f9;(function(_0x3525b5,_0x771c74){const _0xe869a6=a121_0x28f9,_0x57e2bf=_0x3525b5();while(!![]){try{const _0x1e7a24=parseInt(_0xe869a6(0xec))/0x1*(-parseInt(_0xe869a6(0x10d))/0x2)+parseInt(_0xe869a6(0x115))/0x3+-parseInt(_0xe869a6(0xfa))/0x4*(-parseInt(_0xe869a6(0x107))/0x5)+parseInt(_0xe869a6(0x102))/0x6+parseInt(_0xe869a6(0x10a))/0x7*(parseInt(_0xe869a6(0xfe))/0x8)+-parseInt(_0xe869a6(0x10e))/0x9*(parseInt(_0xe869a6(0x100))/0xa)+-parseInt(_0xe869a6(0xff))/0xb;if(_0x1e7a24===_0x771c74)break;else _0x57e2bf['push'](_0x57e2bf['shift']());}catch(_0x1d00b9){_0x57e2bf['push'](_0x57e2bf['shift']());}}}(a121_0x468e,0x6fef9));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a121_0x28f9(_0x42ac03,_0xca87a6){_0x42ac03=_0x42ac03-0xe4;const _0x468e67=a121_0x468e();let _0x28f9b1=_0x468e67[_0x42ac03];return _0x28f9b1;}import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';async function getTargetSqlQueries(_0x246cfe,_0x36ec73,_0x5e8609){const _0x1a0e65=a121_0x28f9,_0x4eaf99=await scanLocalSqlQueries(_0x246cfe),_0x2d6fc7=new Map();for(const _0x3481ad of _0x4eaf99){if(_0x5e8609&&_0x3481ad[_0x1a0e65(0xf7)]!==_0x5e8609)continue;const _0x5a213e=_0x2d6fc7[_0x1a0e65(0xfd)](_0x3481ad[_0x1a0e65(0xf7)])??[];_0x5a213e['push'](_0x3481ad),_0x2d6fc7[_0x1a0e65(0x11d)](_0x3481ad[_0x1a0e65(0xf7)],_0x5a213e);}if(_0x5e8609&&!_0x2d6fc7['has'](_0x5e8609))throw CliErrors[_0x1a0e65(0xf5)](_0x1a0e65(0xf6)+_0x5e8609);const _0xb350ad=[];for(const [_0x35fdc1,_0x826910]of _0x2d6fc7['entries']()){if(_0x826910[_0x1a0e65(0x103)]===0x1){_0xb350ad[_0x1a0e65(0xeb)](_0x826910[0x0]);continue;}const _0x2c3152=_0x36ec73[_0x1a0e65(0x104)][_0x35fdc1],_0x1ebb53=_0x2c3152?.[_0x1a0e65(0xf0)],_0xc9afd0=_0x1ebb53?_0x826910[_0x1a0e65(0xf9)](_0x5b8d46=>_0x5b8d46['relativePath']!==_0x1ebb53):_0x826910;if(_0x2c3152&&_0xc9afd0[_0x1a0e65(0x103)]===0x1){_0xb350ad['push'](_0xc9afd0[0x0]);continue;}throw CliErrors[_0x1a0e65(0xf5)]('Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20'+_0x35fdc1+_0x1a0e65(0x11b));}return _0xb350ad;}export const sqlPush={'service':'sql','command':a121_0x4585ee(0xeb),'description':a121_0x4585ee(0x113),'risk':a121_0x4585ee(0xe7),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a121_0x4585ee(0x10f),'type':a121_0x4585ee(0x120),'description':a121_0x4585ee(0x106)}],async 'dryRun'(_0x2c6d27){const _0xe8d0d=a121_0x4585ee,_0x324e15=loadSqlProjectConfig(_0x2c6d27[_0xe8d0d(0x121)]),_0x361af9=await readSqlLockFile(_0x324e15[_0xe8d0d(0xe5)]),{appLock:_0x408030}=ensureSqlLockScope(_0x361af9??createEmptySqlLock(),_0x2c6d27[_0xe8d0d(0x121)],_0x324e15[_0xe8d0d(0x11f)],_0xe8d0d(0xeb)),_0x1b29bd=await getTargetSqlQueries(_0x324e15,_0x408030,_0x2c6d27[_0xe8d0d(0xe9)]('sqlcode')||undefined),_0x49ac3d=[];for(const _0x4cfed9 of _0x1b29bd){const _0x567079=await computeSqlFileHash(_0x4cfed9[_0xe8d0d(0xe8)]),_0x3032c1=_0x408030[_0xe8d0d(0x104)][_0x4cfed9[_0xe8d0d(0xf7)]],_0xf53ca6=!!_0x3032c1&&(_0x3032c1[_0xe8d0d(0xf0)]!==_0x4cfed9[_0xe8d0d(0x108)]||!!_0x4cfed9[_0xe8d0d(0x110)]&&_0x3032c1[_0xe8d0d(0x110)]!==_0x4cfed9[_0xe8d0d(0x110)]);if(!_0x2c6d27['bool'](_0xe8d0d(0x10f))&&_0x3032c1&&_0x3032c1[_0xe8d0d(0x114)]===_0x567079&&!_0xf53ca6)continue;_0x49ac3d['push'](_0x4cfed9[_0xe8d0d(0xf7)]);}return{'method':_0xe8d0d(0x109),'url':_0xe8d0d(0xee),'body':{'sqlCodes':_0x49ac3d,'appCode':_0x2c6d27[_0xe8d0d(0x121)]},'description':'Would\x20push\x20'+_0x49ac3d[_0xe8d0d(0x103)]+'\x20SQL\x20file(s)'};},async 'execute'(_0x5cd0d1){const _0x5a413f=a121_0x4585ee,_0x1e81c4=loadSqlProjectConfig(_0x5cd0d1[_0x5a413f(0x121)]),_0x1859fe=await readSqlLockFile(_0x1e81c4['lockFilePath']),{lockData:_0x127585,appLock:_0x35f708}=ensureSqlLockScope(_0x1859fe??createEmptySqlLock(),_0x5cd0d1[_0x5a413f(0x121)],_0x1e81c4['sqlRoot'],_0x5a413f(0xeb)),_0x2f12da=await getTargetSqlQueries(_0x1e81c4,_0x35f708,_0x5cd0d1['str']('sqlcode')||undefined);if(_0x2f12da[_0x5a413f(0x103)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x5a413f(0x11c)};const _0xdc2b2c=[],_0x20ccea=[],_0x3b2e1b=[];for(const _0x357d38 of _0x2f12da){const _0x3355ea=_0x35f708['sqls'][_0x357d38['sqlCode']];if(!_0x3355ea){_0x3b2e1b['push']({'sqlCode':_0x357d38[_0x5a413f(0xf7)],'error':'local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first'});continue;}try{const _0x4dc014=await computeSqlFileHash(_0x357d38[_0x5a413f(0xe8)]),_0x4040b7=_0x3355ea[_0x5a413f(0xf0)]!==_0x357d38['relativePath']||!!_0x357d38[_0x5a413f(0x110)]&&_0x3355ea['sqlName']!==_0x357d38['sqlName'];if(!_0x5cd0d1['bool'](_0x5a413f(0x10f))&&_0x3355ea[_0x5a413f(0x114)]===_0x4dc014&&!_0x4040b7){_0x20ccea[_0x5a413f(0xeb)]({'sqlCode':_0x357d38[_0x5a413f(0xf7)],'reason':_0x5a413f(0xe6)});continue;}if(_0x3355ea[_0x5a413f(0xf3)]==null){_0x3b2e1b[_0x5a413f(0xeb)]({'sqlCode':_0x357d38[_0x5a413f(0xf7)],'error':_0x5a413f(0xf2)});continue;}const _0x396d16=await readFile(_0x357d38[_0x5a413f(0xe8)],'utf8'),_0x24fec9=stripLocalSqlMetadata(_0x396d16,_0x357d38['mode']),_0x3cd0e1=_0x357d38['sqlName']||_0x3355ea['sqlName'],_0x13345f=await resolveTargetDbBinding(_0x5cd0d1[_0x5a413f(0x121)],_0x357d38,_0x3355ea),_0x352b77=await updateSqlQuery({'id':_0x3355ea[_0x5a413f(0x10b)],'appCode':_0x5cd0d1[_0x5a413f(0x121)],'sqlCode':_0x357d38[_0x5a413f(0xf7)],'sqlName':_0x3cd0e1,'dbId':_0x13345f[_0x5a413f(0x105)],'version':_0x3355ea[_0x5a413f(0xf3)],'sqlContent':_0x24fec9,'sqlConfig':_0x3355ea[_0x5a413f(0x111)]??undefined}),_0x217310=_0x352b77[_0x5a413f(0x105)]?await getDbName(_0x5cd0d1['appCode'],Number(_0x352b77[_0x5a413f(0x105)]))[_0x5a413f(0xfc)](()=>_0x13345f[_0x5a413f(0x10c)]):_0x13345f['dbName'];_0x35f708[_0x5a413f(0x104)][_0x357d38[_0x5a413f(0xf7)]]={...buildSqlLockEntry(_0x352b77,_0x24fec9,_0x4dc014,{'dbName':_0x217310}),'path':_0x357d38[_0x5a413f(0x108)],'mode':_0x3355ea[_0x5a413f(0x112)]},await archivePreviousSqlFileIfNeeded(_0x1e81c4,_0x3355ea['path'],_0x357d38['relativePath']),_0xdc2b2c[_0x5a413f(0xeb)]({'sqlCode':_0x357d38[_0x5a413f(0xf7)],'remoteId':_0x3355ea['remoteId']});}catch(_0x25c779){_0x3b2e1b[_0x5a413f(0xeb)]({'sqlCode':_0x357d38[_0x5a413f(0xf7)],'error':_0x25c779 instanceof Error?_0x25c779[_0x5a413f(0xe4)]:String(_0x25c779)});}}return _0x35f708[_0x5a413f(0xed)]=new Date()[_0x5a413f(0x119)](),await writeSqlLockFile(_0x1e81c4[_0x5a413f(0xe5)],_0x127585),{'ok':_0x3b2e1b[_0x5a413f(0x103)]===0x0,'data':{'pushed':_0xdc2b2c,'skipped':_0x20ccea,'failed':_0x3b2e1b},'message':_0x5a413f(0x116)+_0xdc2b2c[_0x5a413f(0x103)]+'\x20pushed,\x20'+_0x20ccea['length']+_0x5a413f(0xef)+_0x3b2e1b[_0x5a413f(0x103)]+'\x20failed'};}};function a121_0x468e(){const _0x34d3f7=['str','sqlRootDir','push','3tsvDEP','lastSync','/smartapi/custom/updateUserCustomSql','\x20skipped,\x20','path','replace','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','version','startsWith','validation','Local\x20SQL\x20not\x20found:\x20','sqlCode','exec','filter','88OUwjim','trashDir','catch','get','6184tGRoQP','4528018Lmjbpu','60STAmuH','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','1448178PcuxnH','length','sqls','dbId','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','13415CAAtIl','relativePath','POST','7581gQNKcq','remoteId','dbName','125318YmalDQ','841959IepVrX','force','sqlName','sqlConfig','mode','Push\x20local\x20SQL\x20files\x20to\x20remote','hash','1445586kYiZLp','Push\x20complete:\x20','Local\x20directory\x20\x22','dbDirectory','toISOString','\x22\x20for\x20sqlCode\x20','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','No\x20local\x20SQL\x20files\x20found.','set','join','sqlRoot','boolean','appCode','message','lockFilePath','unchanged','high-risk-write','filePath'];a121_0x468e=function(){return _0x34d3f7;};return a121_0x468e();}async function archivePreviousSqlFileIfNeeded(_0x5bc858,_0x47265f,_0x490480){const _0x46ae6c=a121_0x4585ee;if(!_0x47265f||_0x47265f===_0x490480)return;const _0xc2d39d=join(_0x5bc858[_0x46ae6c(0xea)],_0x47265f);if(!await fileExists(_0xc2d39d))return;const _0x29a683=await moveToTrash(_0x5bc858['projectRoot'],_0x5bc858[_0x46ae6c(0xfb)],_0xc2d39d);await cleanupEmptyDirectories(dirname(_0xc2d39d),_0x5bc858[_0x46ae6c(0xea)]),void _0x29a683;}async function moveToTrash(_0x4e2b91,_0x1ea841,_0x3b46ce){const _0x4dee21=a121_0x4585ee,_0xb02742=new Date()[_0x4dee21(0x119)]()[_0x4dee21(0xf1)](/[:.]/g,'-'),_0x329d45=relative(_0x4e2b91,_0x3b46ce),_0x154d63=join(_0x1ea841,_0xb02742,_0x329d45);return await mkdir(dirname(_0x154d63),{'recursive':!![]}),await rename(_0x3b46ce,_0x154d63),_0x154d63;}async function cleanupEmptyDirectories(_0x4134ed,_0xa975b4){const _0x28e386=a121_0x4585ee;let _0x16429c=resolve(_0x4134ed);const _0xb1d4e3=resolve(_0xa975b4);while(_0x16429c[_0x28e386(0xf4)](''+_0xb1d4e3+sep)||_0x16429c===_0xb1d4e3){if(_0x16429c===_0xb1d4e3)return;try{const _0xe57b59=await readdir(_0x16429c);if(_0xe57b59['length']>0x0)return;await rmdir(_0x16429c);}catch{return;}_0x16429c=dirname(_0x16429c);}}async function resolveTargetDbBinding(_0x1da415,_0x29533e,_0x339fc4){const _0x27fb2a=a121_0x4585ee,_0x5a292f=_0x29533e[_0x27fb2a(0x118)];if(!_0x5a292f)return{'dbId':_0x339fc4[_0x27fb2a(0x105)],'dbName':_0x339fc4['dbName']};const _0x1b19b9=buildDbDirectoryName(_0x339fc4[_0x27fb2a(0x10c)],_0x339fc4[_0x27fb2a(0x105)]);if(_0x5a292f===_0x1b19b9)return{'dbId':_0x339fc4[_0x27fb2a(0x105)],'dbName':_0x339fc4['dbName']};const _0x263195=parseExplicitDbDirectory(_0x5a292f);if(_0x263195!=null)return{'dbId':_0x263195,'dbName':await getDbName(_0x1da415,_0x263195)[_0x27fb2a(0xfc)](()=>undefined)};const _0x50727d=await listDatabases(_0x1da415),_0x238885=_0x50727d['filter'](_0x4a07a4=>buildDbDirectoryName(_0x4a07a4['dbName'],_0x4a07a4['dbId'])===_0x5a292f);if(_0x238885[_0x27fb2a(0x103)]===0x1)return{'dbId':_0x238885[0x0][_0x27fb2a(0x105)],'dbName':_0x238885[0x0]['dbName']};if(_0x238885[_0x27fb2a(0x103)]===0x0)throw CliErrors['validation']('No\x20database\x20matches\x20local\x20directory\x20\x22'+_0x5a292f+_0x27fb2a(0x11a)+_0x29533e[_0x27fb2a(0xf7)]+'.');const _0x15b208=_0x238885['map'](_0x903cb3=>_0x903cb3[_0x27fb2a(0x10c)]+'\x20('+_0x903cb3[_0x27fb2a(0x105)]+')')[_0x27fb2a(0x11e)](',\x20');throw CliErrors[_0x27fb2a(0xf5)](_0x27fb2a(0x117)+_0x5a292f+_0x27fb2a(0x101)+_0x29533e[_0x27fb2a(0xf7)]+':\x20'+_0x15b208);}function parseExplicitDbDirectory(_0x2aeb50){const _0x16be5a=a121_0x4585ee,_0x17c8a0=/^db-(\d+)$/[_0x16be5a(0xf8)](_0x2aeb50);if(!_0x17c8a0)return null;const _0x1b0f4a=Number(_0x17c8a0[0x1]);return Number['isFinite'](_0x1b0f4a)&&_0x1b0f4a>0x0?_0x1b0f4a:null;}
|
|
1
|
+
const a121_0x27487b=a121_0x5636;(function(_0x5accb0,_0x5eab89){const _0x5d329c=a121_0x5636,_0x58a3fa=_0x5accb0();while(!![]){try{const _0x5d9794=-parseInt(_0x5d329c(0x13e))/0x1+parseInt(_0x5d329c(0x12e))/0x2+parseInt(_0x5d329c(0x114))/0x3+parseInt(_0x5d329c(0x12f))/0x4+-parseInt(_0x5d329c(0x117))/0x5*(parseInt(_0x5d329c(0x121))/0x6)+parseInt(_0x5d329c(0x130))/0x7*(-parseInt(_0x5d329c(0x139))/0x8)+parseInt(_0x5d329c(0x147))/0x9;if(_0x5d9794===_0x5eab89)break;else _0x58a3fa['push'](_0x58a3fa['shift']());}catch(_0x6a09df){_0x58a3fa['push'](_0x58a3fa['shift']());}}}(a121_0x3e16,0x93138));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';function a121_0x5636(_0x2c1031,_0x5b9b17){_0x2c1031=_0x2c1031-0x10c;const _0x3e161c=a121_0x3e16();let _0x5636ff=_0x3e161c[_0x2c1031];return _0x5636ff;}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(_0x1b28a2,_0x258ede,_0x525e33){const _0x15bb5d=a121_0x5636,_0xfe25fe=await scanLocalSqlQueries(_0x1b28a2),_0xdc1f88=new Map();for(const _0x26b007 of _0xfe25fe){if(_0x525e33&&_0x26b007[_0x15bb5d(0x13c)]!==_0x525e33)continue;const _0x42e7bc=_0xdc1f88[_0x15bb5d(0x11e)](_0x26b007[_0x15bb5d(0x13c)])??[];_0x42e7bc[_0x15bb5d(0x127)](_0x26b007),_0xdc1f88['set'](_0x26b007[_0x15bb5d(0x13c)],_0x42e7bc);}if(_0x525e33&&!_0xdc1f88[_0x15bb5d(0x12b)](_0x525e33))throw CliErrors[_0x15bb5d(0x13b)]('Local\x20SQL\x20not\x20found:\x20'+_0x525e33);const _0x3a5c68=[];for(const [_0x502def,_0x13f079]of _0xdc1f88[_0x15bb5d(0x10f)]()){if(_0x13f079['length']===0x1){_0x3a5c68['push'](_0x13f079[0x0]);continue;}const _0x55746e=_0x258ede[_0x15bb5d(0x124)][_0x502def],_0x35fa65=_0x55746e?.[_0x15bb5d(0x144)],_0x2c57ff=_0x35fa65?_0x13f079[_0x15bb5d(0x11d)](_0x2e9474=>_0x2e9474['relativePath']!==_0x35fa65):_0x13f079;if(_0x55746e&&_0x2c57ff[_0x15bb5d(0x111)]===0x1){_0x3a5c68['push'](_0x2c57ff[0x0]);continue;}throw CliErrors[_0x15bb5d(0x13b)](_0x15bb5d(0x143)+_0x502def+_0x15bb5d(0x12c));}return _0x3a5c68;}export const sqlPush={'service':a121_0x27487b(0x126),'command':a121_0x27487b(0x127),'description':a121_0x27487b(0x125),'risk':a121_0x27487b(0x118),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a121_0x27487b(0x10c),'type':a121_0x27487b(0x133),'description':'Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock'}],async 'dryRun'(_0x4fdfe0){const _0x970348=a121_0x27487b,_0x1d88f9=loadSqlProjectConfig(_0x4fdfe0['appCode']),_0x4794d3=await readSqlLockFile(_0x1d88f9[_0x970348(0x120)]),{appLock:_0x5477a4}=ensureSqlLockScope(_0x4794d3??createEmptySqlLock(),_0x4fdfe0[_0x970348(0x13d)],_0x1d88f9['sqlRoot'],'push'),_0x5e346=await getTargetSqlQueries(_0x1d88f9,_0x5477a4,_0x4fdfe0[_0x970348(0x146)](_0x970348(0x135))||undefined),_0xbd524=[];for(const _0x54f64a of _0x5e346){const _0x1bd2b5=await computeSqlFileHash(_0x54f64a[_0x970348(0x13a)]),_0x5a788a=_0x5477a4['sqls'][_0x54f64a[_0x970348(0x13c)]],_0x53b213=!!_0x5a788a&&(_0x5a788a['path']!==_0x54f64a['relativePath']||!!_0x54f64a[_0x970348(0x136)]&&_0x5a788a['sqlName']!==_0x54f64a[_0x970348(0x136)]);if(!_0x4fdfe0[_0x970348(0x129)](_0x970348(0x10c))&&_0x5a788a&&_0x5a788a[_0x970348(0x123)]===_0x1bd2b5&&!_0x53b213)continue;_0xbd524[_0x970348(0x127)](_0x54f64a['sqlCode']);}return{'method':_0x970348(0x10e),'url':_0x970348(0x113),'body':{'sqlCodes':_0xbd524,'appCode':_0x4fdfe0['appCode']},'description':_0x970348(0x140)+_0xbd524['length']+_0x970348(0x11a)};},async 'execute'(_0x185076){const _0x2fce28=a121_0x27487b,_0x438def=loadSqlProjectConfig(_0x185076[_0x2fce28(0x13d)]),_0x558bc9=await readSqlLockFile(_0x438def[_0x2fce28(0x120)]),{lockData:_0x50290f,appLock:_0x295e4a}=ensureSqlLockScope(_0x558bc9??createEmptySqlLock(),_0x185076[_0x2fce28(0x13d)],_0x438def[_0x2fce28(0x132)],'push'),_0x24b585=await getTargetSqlQueries(_0x438def,_0x295e4a,_0x185076[_0x2fce28(0x146)]('sqlcode')||undefined);if(_0x24b585[_0x2fce28(0x111)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':'No\x20local\x20SQL\x20files\x20found.'};const _0x304e51=[],_0x177fb7=[],_0x23fe0a=[];for(const _0x1b390b of _0x24b585){const _0x33d6c7=_0x295e4a[_0x2fce28(0x124)][_0x1b390b['sqlCode']];if(!_0x33d6c7){_0x23fe0a[_0x2fce28(0x127)]({'sqlCode':_0x1b390b[_0x2fce28(0x13c)],'error':'local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first'});continue;}try{const _0x2a544c=await computeSqlFileHash(_0x1b390b[_0x2fce28(0x13a)]),_0x2fb720=_0x33d6c7[_0x2fce28(0x144)]!==_0x1b390b[_0x2fce28(0x138)]||!!_0x1b390b[_0x2fce28(0x136)]&&_0x33d6c7['sqlName']!==_0x1b390b[_0x2fce28(0x136)];if(!_0x185076[_0x2fce28(0x129)]('force')&&_0x33d6c7[_0x2fce28(0x123)]===_0x2a544c&&!_0x2fb720){_0x177fb7[_0x2fce28(0x127)]({'sqlCode':_0x1b390b['sqlCode'],'reason':_0x2fce28(0x11f)});continue;}if(_0x33d6c7['version']==null){_0x23fe0a[_0x2fce28(0x127)]({'sqlCode':_0x1b390b['sqlCode'],'error':_0x2fce28(0x142)});continue;}const _0x5cd0db=await readFile(_0x1b390b[_0x2fce28(0x13a)],'utf8'),_0x1a7328=stripLocalSqlMetadata(_0x5cd0db,_0x1b390b['mode']),_0x852f7c=_0x1b390b[_0x2fce28(0x136)]||_0x33d6c7[_0x2fce28(0x136)],_0x3e4189=await resolveTargetDbBinding(_0x185076['appCode'],_0x1b390b,_0x33d6c7),_0x517427=await updateSqlQuery({'id':_0x33d6c7[_0x2fce28(0x11c)],'appCode':_0x185076[_0x2fce28(0x13d)],'sqlCode':_0x1b390b[_0x2fce28(0x13c)],'sqlName':_0x852f7c,'dbId':_0x3e4189[_0x2fce28(0x131)],'version':_0x33d6c7[_0x2fce28(0x112)],'sqlContent':_0x1a7328,'sqlConfig':_0x33d6c7[_0x2fce28(0x12a)]??undefined}),_0x345993=_0x517427[_0x2fce28(0x131)]?await getDbName(_0x185076[_0x2fce28(0x13d)],Number(_0x517427['dbId']))[_0x2fce28(0x119)](()=>_0x3e4189[_0x2fce28(0x122)]):_0x3e4189[_0x2fce28(0x122)];_0x295e4a[_0x2fce28(0x124)][_0x1b390b[_0x2fce28(0x13c)]]={...buildSqlLockEntry(_0x517427,_0x1a7328,_0x2a544c,{'dbName':_0x345993}),'path':_0x1b390b[_0x2fce28(0x138)],'mode':_0x33d6c7[_0x2fce28(0x10d)]},await archivePreviousSqlFileIfNeeded(_0x438def,_0x33d6c7[_0x2fce28(0x144)],_0x1b390b[_0x2fce28(0x138)]),_0x304e51[_0x2fce28(0x127)]({'sqlCode':_0x1b390b[_0x2fce28(0x13c)],'remoteId':_0x33d6c7[_0x2fce28(0x11c)]});}catch(_0x2908a6){_0x23fe0a['push']({'sqlCode':_0x1b390b[_0x2fce28(0x13c)],'error':_0x2908a6 instanceof Error?_0x2908a6[_0x2fce28(0x13f)]:String(_0x2908a6)});}}return _0x295e4a['lastSync']=new Date()[_0x2fce28(0x115)](),await writeSqlLockFile(_0x438def[_0x2fce28(0x120)],_0x50290f),{'ok':_0x23fe0a[_0x2fce28(0x111)]===0x0,'data':{'pushed':_0x304e51,'skipped':_0x177fb7,'failed':_0x23fe0a},'message':'Push\x20complete:\x20'+_0x304e51[_0x2fce28(0x111)]+_0x2fce28(0x128)+_0x177fb7[_0x2fce28(0x111)]+_0x2fce28(0x12d)+_0x23fe0a[_0x2fce28(0x111)]+_0x2fce28(0x137)};}};async function archivePreviousSqlFileIfNeeded(_0x142403,_0x404844,_0x4587eb){const _0x57d707=a121_0x27487b;if(!_0x404844||_0x404844===_0x4587eb)return;const _0x2ff59f=join(_0x142403[_0x57d707(0x116)],_0x404844);if(!await fileExists(_0x2ff59f))return;const _0x1098c2=await moveToTrash(_0x142403['projectRoot'],_0x142403[_0x57d707(0x145)],_0x2ff59f);await cleanupEmptyDirectories(dirname(_0x2ff59f),_0x142403[_0x57d707(0x116)]),void _0x1098c2;}async function moveToTrash(_0x42161b,_0x1ec182,_0x3b73ff){const _0x741f67=a121_0x27487b,_0x241961=new Date()[_0x741f67(0x115)]()['replace'](/[:.]/g,'-'),_0x416ce6=relative(_0x42161b,_0x3b73ff),_0x2b8ebd=join(_0x1ec182,_0x241961,_0x416ce6);return await mkdir(dirname(_0x2b8ebd),{'recursive':!![]}),await rename(_0x3b73ff,_0x2b8ebd),_0x2b8ebd;}async function cleanupEmptyDirectories(_0x5dce44,_0x3117be){const _0x5345a4=a121_0x27487b;let _0x47d3ef=resolve(_0x5dce44);const _0x20938c=resolve(_0x3117be);while(_0x47d3ef[_0x5345a4(0x148)](''+_0x20938c+sep)||_0x47d3ef===_0x20938c){if(_0x47d3ef===_0x20938c)return;try{const _0x5abf65=await readdir(_0x47d3ef);if(_0x5abf65[_0x5345a4(0x111)]>0x0)return;await rmdir(_0x47d3ef);}catch{return;}_0x47d3ef=dirname(_0x47d3ef);}}async function resolveTargetDbBinding(_0x8330fb,_0x32df63,_0x56eb8c){const _0x23dc35=a121_0x27487b,_0xc7262=_0x32df63[_0x23dc35(0x141)];if(!_0xc7262)return{'dbId':_0x56eb8c[_0x23dc35(0x131)],'dbName':_0x56eb8c[_0x23dc35(0x122)]};const _0x4052ee=buildDbDirectoryName(_0x56eb8c[_0x23dc35(0x122)],_0x56eb8c[_0x23dc35(0x131)]);if(_0xc7262===_0x4052ee)return{'dbId':_0x56eb8c[_0x23dc35(0x131)],'dbName':_0x56eb8c[_0x23dc35(0x122)]};const _0x1b124a=parseExplicitDbDirectory(_0xc7262);if(_0x1b124a!=null)return{'dbId':_0x1b124a,'dbName':await getDbName(_0x8330fb,_0x1b124a)[_0x23dc35(0x119)](()=>undefined)};const _0x3ced0e=await listDatabases(_0x8330fb),_0x39a005=_0x3ced0e[_0x23dc35(0x11d)](_0xa49cfe=>buildDbDirectoryName(_0xa49cfe[_0x23dc35(0x122)],_0xa49cfe['dbId'])===_0xc7262);if(_0x39a005[_0x23dc35(0x111)]===0x1)return{'dbId':_0x39a005[0x0][_0x23dc35(0x131)],'dbName':_0x39a005[0x0][_0x23dc35(0x122)]};if(_0x39a005[_0x23dc35(0x111)]===0x0)throw CliErrors['validation']('No\x20database\x20matches\x20local\x20directory\x20\x22'+_0xc7262+_0x23dc35(0x134)+_0x32df63[_0x23dc35(0x13c)]+'.');const _0x56874d=_0x39a005['map'](_0x3a2962=>_0x3a2962['dbName']+'\x20('+_0x3a2962[_0x23dc35(0x131)]+')')[_0x23dc35(0x11b)](',\x20');throw CliErrors[_0x23dc35(0x13b)]('Local\x20directory\x20\x22'+_0xc7262+'\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20'+_0x32df63['sqlCode']+':\x20'+_0x56874d);}function a121_0x3e16(){const _0x131fe9=['sqlcode','sqlName','\x20failed','relativePath','398584ESLeJH','filePath','validation','sqlCode','appCode','766018KBPFkI','message','Would\x20push\x20','dbDirectory','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','path','trashDir','str','15696099VKdtWj','startsWith','force','mode','POST','entries','isFinite','length','version','/smartapi/custom/updateUserCustomSql','651600lAyVMI','toISOString','sqlRootDir','410vpBxlA','high-risk-write','catch','\x20SQL\x20file(s)','join','remoteId','filter','get','unchanged','lockFilePath','70542gMCAaq','dbName','hash','sqls','Push\x20local\x20SQL\x20files\x20to\x20remote','sql','push','\x20pushed,\x20','bool','sqlConfig','has','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','\x20skipped,\x20','858972BYwOqN','4350992OxuGqA','161VqvDFK','dbId','sqlRoot','boolean','\x22\x20for\x20sqlCode\x20'];a121_0x3e16=function(){return _0x131fe9;};return a121_0x3e16();}function parseExplicitDbDirectory(_0x426af2){const _0x57e7e5=a121_0x27487b,_0x59207a=/^db-(\d+)$/['exec'](_0x426af2);if(!_0x59207a)return null;const _0x15464a=Number(_0x59207a[0x1]);return Number[_0x57e7e5(0x110)](_0x15464a)&&_0x15464a>0x0?_0x15464a:null;}
|
package/lib/commands/sql/save.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a122_0x4d0b(){const _0x2b17bd=['24YyKvqS','Path\x20to\x20the\x20SQL\x20file','description','SQL\x20query\x20display\x20name','58jWOGMw','3401rBpoIM','902BrWmdk','9020bBKtuj','Target\x20database\x20—\x20accepts\x20a\x20numeric\x20ID\x20or\x20database\x20name\x20(e.g.\x20ecommerce_db)','string','save','2571003APUfGH','join','3990660OYunTS','sql','267510iWwFfQ','sqlname','1382876tvIFsg','1013873DJPbHe','Create\x20new\x20SQL\x20with\x20`rabetbase\x20sql\x20create\x20--name\x20<name>\x20--db-id\x20<id>\x20--mode\x20sql|mybatisXml`.','write','validation','Deprecated:\x20use\x20sql\x20create\x20to\x20create\x20and\x20sql\x20push\x20to\x20update','3QqGKUT','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`.','8dJVGWD'];a122_0x4d0b=function(){return _0x2b17bd;};return a122_0x4d0b();}const a122_0x511e8f=a122_0x5d92;(function(_0x700b81,_0x50b7b4){const _0x424e15=a122_0x5d92,_0x2ba6c4=_0x700b81();while(!![]){try{const _0x4d7ea8=-parseInt(_0x424e15(0x185))/0x1*(-parseInt(_0x424e15(0x184))/0x2)+parseInt(_0x424e15(0x17d))/0x3*(parseInt(_0x424e15(0x177))/0x4)+-parseInt(_0x424e15(0x175))/0x5*(parseInt(_0x424e15(0x180))/0x6)+parseInt(_0x424e15(0x178))/0x7*(-parseInt(_0x424e15(0x17f))/0x8)+-parseInt(_0x424e15(0x171))/0x9+parseInt(_0x424e15(0x187))/0xa*(parseInt(_0x424e15(0x186))/0xb)+parseInt(_0x424e15(0x173))/0xc;if(_0x4d7ea8===_0x50b7b4)break;else _0x2ba6c4['push'](_0x2ba6c4['shift']());}catch(_0xca7d1){_0x2ba6c4['push'](_0x2ba6c4['shift']());}}}(a122_0x4d0b,0x32611));import{CliErrors}from'../../errors.js';function a122_0x5d92(_0x55fced,_0xa2f2b2){_0x55fced=_0x55fced-0x16e;const _0x4d0b89=a122_0x4d0b();let _0x5d92fa=_0x4d0b89[_0x55fced];return _0x5d92fa;}import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';const SQL_SAVE_DEPRECATED_HINT=['`rabetbase\x20sql\x20save`\x20has\x20been\x20deprecated.',a122_0x511e8f(0x179),a122_0x511e8f(0x17e)][a122_0x511e8f(0x172)]('\x0a');export const sqlSave={'service':a122_0x511e8f(0x174),'command':a122_0x511e8f(0x170),'description':a122_0x511e8f(0x17c),'risk':a122_0x511e8f(0x17a),'requiresAuth':![],'requiresAppCode':![],'flags':[{'name':'file','type':'string','required':!![],'description':a122_0x511e8f(0x181)},SQLCODE_FLAG_OPTIONAL,{'name':a122_0x511e8f(0x176),'type':a122_0x511e8f(0x16f),'description':a122_0x511e8f(0x183)},{'name':'db','type':a122_0x511e8f(0x16f),'description':a122_0x511e8f(0x16e)},{'name':a122_0x511e8f(0x182),'type':a122_0x511e8f(0x16f),'description':'Query\x20description'}],async 'validate'(){const _0x32a579=a122_0x511e8f;throw CliErrors[_0x32a579(0x17b)](SQL_SAVE_DEPRECATED_HINT);},async 'execute'(){const _0x30d185=a122_0x511e8f;throw CliErrors[_0x30d185(0x17b)](SQL_SAVE_DEPRECATED_HINT);}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
const a123_0x5e60cf=a123_0x4105;(function(_0x4b1aa4,_0x4ea193){const _0x13e244=a123_0x4105,_0x2a060d=_0x4b1aa4();while(!![]){try{const _0x1c3cb5=parseInt(_0x13e244(0x15f))/0x1+-parseInt(_0x13e244(0x17c))/0x2*(parseInt(_0x13e244(0x17d))/0x3)+parseInt(_0x13e244(0x15c))/0x4*(-parseInt(_0x13e244(0x178))/0x5)+-parseInt(_0x13e244(0x182))/0x6+-parseInt(_0x13e244(0x17a))/0x7+-parseInt(_0x13e244(0x175))/0x8+-parseInt(_0x13e244(0x16e))/0x9*(-parseInt(_0x13e244(0x158))/0xa);if(_0x1c3cb5===_0x4ea193)break;else _0x2a060d['push'](_0x2a060d['shift']());}catch(_0x27d843){_0x2a060d['push'](_0x2a060d['shift']());}}}(a123_0x40c7,0x7428e));import{createInterface}from'node:readline';import{join}from'node:path';function a123_0x40c7(){const _0x3f078b=['test','sqlConfig','890hNFZaS','syncedAt','path','mode','4OxSwEM','sqlCode','trim','599655LOGNpJ','dbName','toLowerCase','trimStart','split','stderr','--\x20@lovrabet.','filter','dbId','lastSync','description','<!--\x20@lovrabet.','\x20[y/N]\x20','sqls','map','220041CzDDSO','length','entries','replace','apps','\x20-->','sqlContent','5215520mtAcSD','mybatisXml','version','4450340LFROMS','sqlRoot','3653986jqsBhq','yes','64606DslHjz','6FBIkEX','join','includes','sqlName','close','1027284YDSGrH','endsWith','.rabetbase/sql'];a123_0x40c7=function(){return _0x3f078b;};return a123_0x40c7();}import{buildDefaultSqlFileName,buildSqlRelativePath,detectSqlMode}from'../../core/sql-sync/utils.js';export const SQL_LOCAL_REL_DIR=a123_0x5e60cf(0x155);export function buildSqlLockEntry(_0x218b90,_0x89c005,_0x1de6b2,_0x243761){const _0x3463ee=a123_0x5e60cf,_0x33d9ad=detectSqlMode(_0x89c005);return{'path':buildSqlRelativePath(_0x218b90[_0x3463ee(0x15d)],_0x218b90['sqlName'],_0x243761?.[_0x3463ee(0x160)],_0x33d9ad,_0x218b90[_0x3463ee(0x167)]),'hash':_0x1de6b2,'remoteId':_0x218b90['id'],'version':_0x218b90[_0x3463ee(0x177)],'dbId':Number(_0x218b90[_0x3463ee(0x167)]),'dbName':_0x243761?.[_0x3463ee(0x160)],'sqlName':_0x218b90[_0x3463ee(0x180)],'sqlConfig':_0x218b90[_0x3463ee(0x157)]??undefined,'mode':_0x33d9ad};}export function cloneSqlLockData(_0x2b96f2){const _0x13f293=a123_0x5e60cf;return{'apps':Object['fromEntries'](Object[_0x13f293(0x170)](_0x2b96f2[_0x13f293(0x172)])[_0x13f293(0x16d)](([_0x3184e6,_0x18983e])=>[_0x3184e6,{'sqlRoot':_0x18983e[_0x13f293(0x179)],'lastSync':_0x18983e[_0x13f293(0x168)],'sqls':{..._0x18983e[_0x13f293(0x16c)]}}]))};}export function ensureRemoteSqlContent(_0x470395){const _0x5d8e61=a123_0x5e60cf;return _0x470395[_0x5d8e61(0x174)]??'';}function a123_0x4105(_0x12ab8b,_0x2bc23a){_0x12ab8b=_0x12ab8b-0x155;const _0x40c7cf=a123_0x40c7();let _0x41055e=_0x40c7cf[_0x12ab8b];return _0x41055e;}export function buildLocalSqlFileContent(_0x1c2ff4,_0x28516b,_0x2927b1){const _0xcb8d08=a123_0x5e60cf,_0x46bece=_0x2927b1?.[_0xcb8d08(0x15b)]??detectSqlMode(_0x28516b),_0x1acced=stripLocalSqlMetadata(_0x28516b,_0x46bece)['trim'](),_0x3e4f4e=[...buildMetadataHeaderLines({'sqlCode':_0x1c2ff4[_0xcb8d08(0x15d)],'sqlName':_0x1c2ff4['sqlName'],'dbId':_0x1c2ff4[_0xcb8d08(0x167)],'dbName':_0x2927b1?.[_0xcb8d08(0x160)],'mode':_0x46bece,'syncedAt':_0x2927b1?.[_0xcb8d08(0x159)],'description':_0x2927b1?.[_0xcb8d08(0x169)]},_0x46bece),'',_0x1acced],_0x5f4197=_0x3e4f4e[_0xcb8d08(0x17e)]('\x0a');return _0x5f4197[_0xcb8d08(0x183)]('\x0a')?_0x5f4197:_0x5f4197+'\x0a';}export function stripLocalSqlMetadata(_0x18b5c0,_0x23d368){const _0x3d7e12=a123_0x5e60cf,_0x504c97=_0x18b5c0[_0x3d7e12(0x171)](/\r\n/g,'\x0a')[_0x3d7e12(0x163)]('\x0a'),_0x9107fd=[];let _0x5ee04e=0x0;if(_0x23d368===_0x3d7e12(0x176))while(_0x5ee04e<_0x504c97[_0x3d7e12(0x16f)]){const _0xe4db52=_0x504c97[_0x5ee04e]??'';if(/^\s*<!--\s*@lovrabet\./['test'](_0xe4db52)){_0x5ee04e++;continue;}if(_0xe4db52[_0x3d7e12(0x15e)]()===''&&_0x5ee04e>0x0){_0x5ee04e++;continue;}break;}else while(_0x5ee04e<_0x504c97[_0x3d7e12(0x16f)]){const _0x3bdb03=_0x504c97[_0x5ee04e]??'';if(/^\s*--\s*@lovrabet\./[_0x3d7e12(0x156)](_0x3bdb03)){_0x5ee04e++;continue;}if(_0x3bdb03[_0x3d7e12(0x15e)]()===''&&_0x5ee04e>0x0){_0x5ee04e++;continue;}break;}for(;_0x5ee04e<_0x504c97[_0x3d7e12(0x16f)];_0x5ee04e++){_0x9107fd['push'](_0x504c97[_0x5ee04e]);}return _0x9107fd['join']('\x0a')[_0x3d7e12(0x162)]();}export function resolveSqlMode(_0x4c5427,_0x147b95){const _0x3ddd5c=a123_0x5e60cf;if(_0x147b95?.['mode'])return _0x147b95[_0x3ddd5c(0x15b)];return detectSqlMode(_0x4c5427);}export function resolveSqlFileName(_0xf8d0af,_0x21ff0d,_0x1d5202){const _0x1fcd24=a123_0x5e60cf;if(_0x1d5202?.[_0x1fcd24(0x15a)])return _0x1d5202[_0x1fcd24(0x15a)];if(_0x1d5202?.[_0x1fcd24(0x180)]||_0x1d5202?.[_0x1fcd24(0x160)])return buildSqlRelativePath(_0xf8d0af,_0x1d5202?.[_0x1fcd24(0x180)],_0x1d5202?.[_0x1fcd24(0x160)],resolveSqlMode(_0x21ff0d,_0x1d5202),_0x1d5202?.[_0x1fcd24(0x167)]);return buildDefaultSqlFileName(_0xf8d0af,resolveSqlMode(_0x21ff0d,_0x1d5202));}export function resolveSqlLocalDir(_0xe87214,_0x38ec53){return join(_0xe87214,SQL_LOCAL_REL_DIR,_0x38ec53);}export async function confirmForceOverwrite(_0x1e5482){const _0x188ed5=a123_0x5e60cf,_0x34edfe=createInterface({'input':process['stdin'],'output':process[_0x188ed5(0x164)]}),_0x7c6b8e=await new Promise(_0x3637fb=>{const _0x8a1013=_0x188ed5;_0x34edfe['question'](_0x1e5482+_0x8a1013(0x16b),_0x3637fb);});return _0x34edfe[_0x188ed5(0x181)](),['y',_0x188ed5(0x17b)][_0x188ed5(0x17f)](_0x7c6b8e[_0x188ed5(0x15e)]()[_0x188ed5(0x161)]());}export function findSqlLockScope(_0x39d4f0,_0x30d887){const _0x3fbbb1=a123_0x5e60cf;return _0x39d4f0[_0x3fbbb1(0x172)][_0x30d887];}function buildMetadataHeaderLines(_0x4c5ebd,_0x193634){const _0x430959=a123_0x5e60cf,_0xf4e46e=[[_0x430959(0x15d),_0x4c5ebd[_0x430959(0x15d)]],[_0x430959(0x180),_0x4c5ebd['sqlName']],[_0x430959(0x167),_0x4c5ebd['dbId']],['dbName',_0x4c5ebd[_0x430959(0x160)]],[_0x430959(0x15b),_0x4c5ebd['mode']],[_0x430959(0x159),_0x4c5ebd[_0x430959(0x159)]],[_0x430959(0x169),_0x4c5ebd[_0x430959(0x169)]]];if(_0x193634==='mybatisXml')return _0xf4e46e[_0x430959(0x166)](([,_0x76fa2a])=>_0x76fa2a!==undefined&&_0x76fa2a!==null&&String(_0x76fa2a)[_0x430959(0x15e)]()!=='')[_0x430959(0x16d)](([_0x23f4a4,_0x237335])=>_0x430959(0x16a)+_0x23f4a4+':\x20'+String(_0x237335)+_0x430959(0x173));return _0xf4e46e[_0x430959(0x166)](([,_0x5636e3])=>_0x5636e3!==undefined&&_0x5636e3!==null&&String(_0x5636e3)[_0x430959(0x15e)]()!=='')['map'](([_0x53f124,_0x29a9ad])=>_0x430959(0x165)+_0x53f124+':\x20'+String(_0x29a9ad));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a124_0x2455d2=a124_0x54c4;(function(_0x14d71,_0x29a370){const _0x3c73e9=a124_0x54c4,_0x50e9b0=_0x14d71();while(!![]){try{const _0x3ce82=parseInt(_0x3c73e9(0x1b4))/0x1*(-parseInt(_0x3c73e9(0x1ba))/0x2)+-parseInt(_0x3c73e9(0x1a2))/0x3*(parseInt(_0x3c73e9(0x1bd))/0x4)+-parseInt(_0x3c73e9(0x1a1))/0x5+-parseInt(_0x3c73e9(0x1a9))/0x6+-parseInt(_0x3c73e9(0x1a4))/0x7*(parseInt(_0x3c73e9(0x1c1))/0x8)+parseInt(_0x3c73e9(0x1af))/0x9*(-parseInt(_0x3c73e9(0x1c5))/0xa)+parseInt(_0x3c73e9(0x1a3))/0xb;if(_0x3ce82===_0x29a370)break;else _0x50e9b0['push'](_0x50e9b0['shift']());}catch(_0x1e322e){_0x50e9b0['push'](_0x50e9b0['shift']());}}}(a124_0x677a,0xa0199));function a124_0x677a(){const _0x3ab4df=['5236878BpUMqH','sql','status','\x20missing,\x20','length','appCode','365832uigaWM','map','paging','filePath','Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','332uOPQar','Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally','lockKey','tableData','sqlRoot','remote','7058iQjzUa','bool','sqlCode','4881724ObiGWc','keys','push','has','2913736KuCFao','relativePath','\x20remote-only','All\x20SQL\x20queries\x20are\x20in\x20sync.','70YZnGhU','sqls','hash','479210BSRvVW','3nqsCsH','55323983wxfBhC','14CnvqwN','sqlName','\x20unchanged','path','read'];a124_0x677a=function(){return _0x3ab4df;};return a124_0x677a();}import{listSqlQueries}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';function a124_0x54c4(_0x3ae7d6,_0x450b04){_0x3ae7d6=_0x3ae7d6-0x19f;const _0x677a7=a124_0x677a();let _0x54c45a=_0x677a7[_0x3ae7d6];return _0x54c45a;}import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile}from'../../core/sql-sync/lock.js';const PAGE_SIZE=0x64;async function fetchAllSqlCodes(_0x321fa9){const _0x39e241=a124_0x54c4,_0x2066a3=[];let _0xbb3166=0x1;while(!![]){const _0x1a06d5=await listSqlQueries(_0x321fa9,{'currentPage':_0xbb3166,'pageSize':PAGE_SIZE}),_0x26eef5=_0x1a06d5[_0x39e241(0x1b7)]??[];_0x2066a3[_0x39e241(0x1bf)](..._0x26eef5[_0x39e241(0x1b0)](_0x611345=>_0x611345[_0x39e241(0x1bc)]));if(_0x26eef5['length']===0x0)break;const _0x4fd0ea=_0x1a06d5[_0x39e241(0x1b1)]?.['totalCount'];if(_0x4fd0ea!=null?_0x2066a3['length']>=_0x4fd0ea:_0x26eef5[_0x39e241(0x1ad)]<PAGE_SIZE)break;_0xbb3166++;}return _0x2066a3;}export const sqlStatus={'service':a124_0x2455d2(0x1aa),'command':a124_0x2455d2(0x1ab),'description':a124_0x2455d2(0x1b3),'risk':a124_0x2455d2(0x1a8),'flags':[{'name':'remote','type':'boolean','description':a124_0x2455d2(0x1b5)}],async 'execute'(_0x31d968){const _0x365d9b=a124_0x2455d2,_0x4a28dd=loadSqlProjectConfig(_0x31d968[_0x365d9b(0x1ae)]),_0x323752=await readSqlLockFile(_0x4a28dd['lockFilePath']),{appLock:_0x5f5812}=ensureSqlLockScope(_0x323752??createEmptySqlLock(),_0x4a28dd[_0x365d9b(0x1ae)],_0x4a28dd[_0x365d9b(0x1b8)],_0x365d9b(0x1ab)),_0x5dd69a=await scanLocalSqlQueries(_0x4a28dd),_0x1382bd=[],_0x18d366=[],_0x164943=[],_0x1d834f=[],_0x1a4ead=new Set(_0x5dd69a[_0x365d9b(0x1b0)](_0x5d4aac=>_0x5d4aac[_0x365d9b(0x1b6)]));for(const _0x583ef1 of _0x5dd69a){const _0x1ba499=await computeSqlFileHash(_0x583ef1[_0x365d9b(0x1b2)]),_0x41dfb2=_0x5f5812[_0x365d9b(0x19f)][_0x583ef1['lockKey']],_0x4f61aa=!!_0x41dfb2&&_0x41dfb2[_0x365d9b(0x1a7)]!==_0x583ef1[_0x365d9b(0x1c2)],_0x53946c=!!_0x41dfb2&&!!_0x583ef1[_0x365d9b(0x1a5)]&&_0x41dfb2[_0x365d9b(0x1a5)]!==_0x583ef1[_0x365d9b(0x1a5)];if(!_0x41dfb2)_0x1382bd['push'](_0x583ef1['lockKey']);else _0x41dfb2[_0x365d9b(0x1a0)]!==_0x1ba499||_0x4f61aa||_0x53946c?_0x18d366['push'](_0x583ef1[_0x365d9b(0x1b6)]):_0x164943[_0x365d9b(0x1bf)](_0x583ef1[_0x365d9b(0x1b6)]);}for(const _0x103996 of Object[_0x365d9b(0x1be)](_0x5f5812[_0x365d9b(0x19f)])){!_0x1a4ead[_0x365d9b(0x1c0)](_0x103996)&&_0x1d834f[_0x365d9b(0x1bf)](_0x103996);}const _0x20fe68=[];if(_0x31d968[_0x365d9b(0x1bb)](_0x365d9b(0x1b9))){const _0x1738a2=await fetchAllSqlCodes(_0x31d968['appCode']);for(const _0x532f06 of _0x1738a2){!_0x1a4ead['has'](_0x532f06)&&!_0x5f5812['sqls'][_0x532f06]&&_0x20fe68['push'](_0x532f06);}}const _0x254f6b=_0x1382bd[_0x365d9b(0x1ad)]===0x0&&_0x18d366[_0x365d9b(0x1ad)]===0x0&&_0x1d834f[_0x365d9b(0x1ad)]===0x0&&_0x20fe68[_0x365d9b(0x1ad)]===0x0;return{'ok':!![],'data':{'added':_0x1382bd,'modified':_0x18d366,'missing':_0x1d834f,'unchanged':_0x164943,'remoteOnly':_0x20fe68},'message':_0x254f6b?_0x365d9b(0x1c4):_0x1382bd[_0x365d9b(0x1ad)]+'\x20added,\x20'+_0x18d366[_0x365d9b(0x1ad)]+'\x20modified,\x20'+_0x1d834f['length']+_0x365d9b(0x1ac)+_0x164943[_0x365d9b(0x1ad)]+_0x365d9b(0x1a6)+(_0x20fe68[_0x365d9b(0x1ad)]>0x0?',\x20'+_0x20fe68[_0x365d9b(0x1ad)]+_0x365d9b(0x1c3):'')};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a125_0x1362(_0x348a51,_0x3615d6){_0x348a51=_0x348a51-0x135;const _0x4e98af=a125_0x4e98();let _0x1362ba=_0x4e98af[_0x348a51];return _0x1362ba;}const a125_0x2818fe=a125_0x1362;(function(_0xf03a6d,_0x4d37a8){const _0x4828a1=a125_0x1362,_0x535055=_0xf03a6d();while(!![]){try{const _0xe0e5b=-parseInt(_0x4828a1(0x15f))/0x1*(parseInt(_0x4828a1(0x154))/0x2)+parseInt(_0x4828a1(0x14d))/0x3+parseInt(_0x4828a1(0x14a))/0x4+parseInt(_0x4828a1(0x135))/0x5+-parseInt(_0x4828a1(0x14c))/0x6+-parseInt(_0x4828a1(0x138))/0x7*(parseInt(_0x4828a1(0x13f))/0x8)+parseInt(_0x4828a1(0x13a))/0x9;if(_0xe0e5b===_0x4d37a8)break;else _0x535055['push'](_0x535055['shift']());}catch(_0x20cf72){_0x535055['push'](_0x535055['shift']());}}}(a125_0x4e98,0x4358a));import{readFileSync,existsSync}from'node:fs';function a125_0x4e98(){const _0x1acf2d=['split','759470Fwelbu','isSelectOnly','sql','462LmIZdm','str','1903545EFJTlW','parameters','Comma-separated\x20dataset\x20codes\x20to\x20cross-check\x20table/column\x20names\x20against','cwd','Dataset\x20\x22','40120JZkIzE','string','get','file','fields','toLowerCase','size','tables','File\x20not\x20found:\x20','appCode','map','1516132jNbffV','Provide\x20--file\x20or\x20--sql','668082ivUGgp','1547772mGjDwH','utf-8','validation','isArray','schemas','\x22\x20not\x20found\x20in\x20any\x20dataset','valid','1080338EbfUUv','Path\x20to\x20the\x20SQL\x20file\x20to\x20validate','Table\x20\x22','isDangerous','sqlType','\x22\x20not\x20found\x20or\x20not\x20accessible','tableName','from','filter','name','push','1pqHtlG','message','reason','Inline\x20SQL\x20content\x20to\x20validate\x20(alternative\x20to\x20--file)','flagMissing','Validate\x20SQL\x20content\x20without\x20saving\x20(type\x20detection,\x20parameter\x20extraction,\x20optional\x20schema\x20check)'];a125_0x4e98=function(){return _0x1acf2d;};return a125_0x4e98();}import{resolve}from'node:path';import{validateSql}from'../../core/sql-validator.js';import{getDatasetDetail,listDatasets}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';export const sqlValidate={'service':a125_0x2818fe(0x137),'command':'validate','description':a125_0x2818fe(0x164),'risk':'read','flags':[{'name':a125_0x2818fe(0x142),'type':a125_0x2818fe(0x140),'description':a125_0x2818fe(0x155)},{'name':a125_0x2818fe(0x137),'type':a125_0x2818fe(0x140),'description':a125_0x2818fe(0x162)},{'name':a125_0x2818fe(0x151),'type':a125_0x2818fe(0x140),'description':a125_0x2818fe(0x13c)}],async 'execute'(_0x75d018){const _0x3d8f73=a125_0x2818fe,_0x2243b8=_0x75d018[_0x3d8f73(0x139)](_0x3d8f73(0x142)),_0x198f12=_0x75d018[_0x3d8f73(0x139)](_0x3d8f73(0x137));if(!_0x2243b8&&!_0x198f12)throw CliErrors[_0x3d8f73(0x163)](_0x3d8f73(0x142),_0x3d8f73(0x14b));let _0x14da6c;if(_0x2243b8){const _0xa94f79=resolve(process[_0x3d8f73(0x13d)](),_0x2243b8);if(!existsSync(_0xa94f79))throw CliErrors[_0x3d8f73(0x14f)](_0x3d8f73(0x147)+_0xa94f79);_0x14da6c=readFileSync(_0xa94f79,_0x3d8f73(0x14e));}else _0x14da6c=_0x198f12;const _0x4494f0=validateSql(_0x14da6c),_0x5d4020={'valid':_0x4494f0[_0x3d8f73(0x153)],'sqlType':_0x4494f0[_0x3d8f73(0x158)]['type'],'isSelectOnly':_0x4494f0[_0x3d8f73(0x158)][_0x3d8f73(0x136)],'isDangerous':_0x4494f0['sqlType'][_0x3d8f73(0x157)],'tables':_0x4494f0[_0x3d8f73(0x146)],'parameters':_0x4494f0[_0x3d8f73(0x13b)],'message':_0x4494f0[_0x3d8f73(0x160)]};_0x4494f0['sqlType'][_0x3d8f73(0x161)]&&(_0x5d4020[_0x3d8f73(0x161)]=_0x4494f0[_0x3d8f73(0x158)]['reason']);const _0x28b4ca=_0x75d018['str']('schemas');if(_0x28b4ca&&_0x4494f0[_0x3d8f73(0x153)]){const _0x531571=_0x28b4ca[_0x3d8f73(0x165)](',')[_0x3d8f73(0x149)](_0x186f40=>_0x186f40['trim']())[_0x3d8f73(0x15c)](Boolean),_0x2c6e55=[],_0x23d3fd=await listDatasets(_0x75d018[_0x3d8f73(0x148)]),_0x5307fd=new Map(_0x23d3fd[_0x3d8f73(0x149)](_0x5348e7=>[_0x5348e7['dbtableConfig']?.['tableName']?.[_0x3d8f73(0x144)](),_0x5348e7]));for(const _0x5c5365 of _0x4494f0[_0x3d8f73(0x146)]){const _0x475879=_0x5307fd[_0x3d8f73(0x141)](_0x5c5365[_0x3d8f73(0x144)]());!_0x475879&&_0x2c6e55['push'](_0x3d8f73(0x156)+_0x5c5365+_0x3d8f73(0x152));}for(const _0xcc8437 of _0x531571){try{const _0x2fd24e=await getDatasetDetail(_0xcc8437),_0x22303b=Array[_0x3d8f73(0x150)](_0x2fd24e[_0x3d8f73(0x143)])?_0x2fd24e[_0x3d8f73(0x143)]:[],_0x2b259b=new Set(_0x22303b[_0x3d8f73(0x149)](_0x5918c8=>_0x5918c8[_0x3d8f73(0x15d)]?.[_0x3d8f73(0x144)]())),_0x280bc6=_0x2fd24e['dbtableConfig']?.[_0x3d8f73(0x15a)]||_0x2fd24e[_0x3d8f73(0x15a)]||_0xcc8437;_0x5d4020['schema:'+_0x280bc6]={'code':_0xcc8437,'tableName':_0x280bc6,'fieldCount':_0x2b259b[_0x3d8f73(0x145)],'fields':Array[_0x3d8f73(0x15b)](_0x2b259b)};}catch{_0x2c6e55[_0x3d8f73(0x15e)](_0x3d8f73(0x13e)+_0xcc8437+_0x3d8f73(0x159));}}_0x2c6e55['length']>0x0&&(_0x5d4020['schemaWarnings']=_0x2c6e55);}return{'ok':_0x4494f0[_0x3d8f73(0x153)],'data':_0x5d4020,'message':_0x4494f0[_0x3d8f73(0x160)]};}};
|
package/lib/config/schema.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a126_0x134329=a126_0x3b7c;(function(_0x38d3e7,_0x157f7c){const _0x10e9cf=a126_0x3b7c,_0x4a75ad=_0x38d3e7();while(!![]){try{const _0x1005c5=parseInt(_0x10e9cf(0xfa))/0x1+parseInt(_0x10e9cf(0xfb))/0x2+-parseInt(_0x10e9cf(0x108))/0x3*(parseInt(_0x10e9cf(0xfe))/0x4)+parseInt(_0x10e9cf(0x111))/0x5+-parseInt(_0x10e9cf(0x107))/0x6+parseInt(_0x10e9cf(0x10c))/0x7*(-parseInt(_0x10e9cf(0x11c))/0x8)+parseInt(_0x10e9cf(0x105))/0x9;if(_0x1005c5===_0x157f7c)break;else _0x4a75ad['push'](_0x4a75ad['shift']());}catch(_0x3f49d7){_0x4a75ad['push'](_0x4a75ad['shift']());}}}(a126_0x2849,0x3dcdd));import{DEFAULT_CONFIG_VALUES}from'../constant/defaults.js';import{RABETBASE_ENV_VALUES}from'../constant/env.js';import{RABETBASE_OUTPUT_FORMAT_VALUES}from'../constant/output.js';import{RISK_LEVEL_VALUES}from'../constant/risk.js';export{DEFAULT_CONFIG_VALUES}from'../constant/defaults.js';export const PROJECT_CREATE_INHERITABLE_KEYS=[a126_0x134329(0x104),'accessKey',a126_0x134329(0x113),'format',a126_0x134329(0x116)];export const TOP_LEVEL_CONFIG_KEYS=new Set([a126_0x134329(0x110),a126_0x134329(0x114),'locale',a126_0x134329(0x10b),a126_0x134329(0x104),a126_0x134329(0x103),a126_0x134329(0x106)]);export const CONFIG_ENUM_VALUES={'env':[...RABETBASE_ENV_VALUES],'format':[...RABETBASE_OUTPUT_FORMAT_VALUES]};export function formatConfigKeyList(_0x1f022b){const _0x5c88cb=a126_0x134329;return[..._0x1f022b][_0x5c88cb(0x11a)](',\x20');}export function getTopLevelConfigKeyList(){return[...TOP_LEVEL_CONFIG_KEYS];}export function isTopLevelConfigKey(_0x87cd27){return TOP_LEVEL_CONFIG_KEYS['has'](_0x87cd27);}export function getTopLevelConfigKeySummary(){return formatConfigKeyList(getTopLevelConfigKeyList());}export function getConfigCommandKeyDescription(){const _0x16de04=a126_0x134329;return _0x16de04(0x101)+getTopLevelConfigKeySummary()+')';}export const APP_PROFILE_FLAG_KEY_MAP={'env':a126_0x134329(0x114),'apiDir':a126_0x134329(0x106),'cookie':a126_0x134329(0x104),'accessKey':a126_0x134329(0x103),'defaultFormat':a126_0x134329(0x10b),'pageSize':'pageSize','riskLevel':'riskLevel','locale':a126_0x134329(0x113)};export function getAppProfileFlagDefs(){const _0x35ee82=a126_0x134329;return[{'name':_0x35ee82(0x114),'type':_0x35ee82(0x10d),'description':'Target\x20environment','enum':[...RABETBASE_ENV_VALUES]},{'name':_0x35ee82(0x106),'type':'string','description':_0x35ee82(0x100)},{'name':_0x35ee82(0x104),'type':_0x35ee82(0x10d),'description':_0x35ee82(0xf7),'hidden':!![]},{'name':_0x35ee82(0x103),'type':_0x35ee82(0x10d),'description':_0x35ee82(0x10a),'hidden':!![]},{'name':'defaultFormat','type':_0x35ee82(0x10d),'description':_0x35ee82(0x10f),'enum':[...RABETBASE_OUTPUT_FORMAT_VALUES]},{'name':_0x35ee82(0xff),'type':_0x35ee82(0x115),'description':'Default\x20page\x20size'},{'name':_0x35ee82(0x116),'type':'string','description':_0x35ee82(0x11b),'enum':[...RISK_LEVEL_VALUES]},{'name':_0x35ee82(0x113),'type':_0x35ee82(0x10d),'description':_0x35ee82(0x118)}];}export function collectAppProfileOverrides(_0x533ee9){const _0x25a46b=a126_0x134329,_0x36cd7a={};for(const [_0x5d4c83,_0x3ac20a]of Object[_0x25a46b(0x112)](APP_PROFILE_FLAG_KEY_MAP)){const _0x5539aa=_0x533ee9(_0x5d4c83);if(!_0x5539aa)continue;_0x36cd7a[_0x3ac20a]=_0x3ac20a===_0x25a46b(0xff)?Number(_0x5539aa):_0x5539aa;}return _0x36cd7a;}export function buildAppProfileListFields(_0x29794c){const _0x254848=a126_0x134329;return{'env':_0x29794c['env']??null,'apiDir':_0x29794c[_0x254848(0x106)]??null,'hasCookie':!!_0x29794c['cookie'],'hasAccessKey':!!_0x29794c[_0x254848(0x103)],'format':_0x29794c[_0x254848(0x10b)]??null,'pageSize':_0x29794c[_0x254848(0xff)]??null,'riskLevel':_0x29794c['riskLevel']??null,'locale':_0x29794c['locale']??null};}export function buildAppDoctorFields(_0x56f4e0,_0x196492){const _0x5ed940=a126_0x134329;return{'env':{'value':_0x56f4e0[_0x5ed940(0x114)]||_0x196492[_0x5ed940(0x114)],'source':_0x56f4e0['env']?'app':_0x5ed940(0x119)},'apiDir':{'value':_0x56f4e0['apiDir']||_0x196492[_0x5ed940(0x106)],'source':_0x56f4e0[_0x5ed940(0x106)]?_0x5ed940(0x109):_0x5ed940(0x119)},'cookie':{'value':_0x56f4e0[_0x5ed940(0x104)]||_0x196492[_0x5ed940(0x104)],'source':_0x56f4e0['cookie']?_0x5ed940(0x109):'inherit'},'accessKey':{'value':_0x56f4e0[_0x5ed940(0x103)]||_0x196492[_0x5ed940(0x103)],'source':_0x56f4e0[_0x5ed940(0x103)]?_0x5ed940(0x109):_0x5ed940(0x119)}};}export function buildCanonicalAppConfig(_0x38ad1f,_0x204b7f){const _0x29cce7=a126_0x134329,_0x539e34=_0x38ad1f[_0x29cce7(0x117)](_0x458b3a=>String(_0x458b3a||'')[_0x29cce7(0xfc)]())['filter'](Boolean);if(_0x539e34[_0x29cce7(0xfd)]===0x0)return{};const _0x337461={};for(const _0xce7c41 of _0x539e34){_0x337461[_0xce7c41]=_0x204b7f?{'appcode':_0xce7c41,'env':_0x204b7f}:{'appcode':_0xce7c41};}return{'apps':_0x337461,'defaultApp':_0x539e34[0x0]};}export function buildCanonicalProjectConfig(_0x464214,_0x17b591){const _0x47ac05=a126_0x134329,{appCodes:appCodes=[],env:_0x57cdc8,metadata:_0x3e981b}=_0x17b591,_0x3ce582={..._0x464214,..._0x3e981b||{}};delete _0x3ce582[_0x47ac05(0x110)],delete _0x3ce582['app'];if(_0x57cdc8)_0x3ce582[_0x47ac05(0x114)]=_0x57cdc8;else!_0x3ce582[_0x47ac05(0x114)]&&(_0x3ce582['env']=DEFAULT_CONFIG_VALUES[_0x47ac05(0x114)]);const _0xa81f48=buildCanonicalAppConfig(appCodes,_0x3ce582[_0x47ac05(0x114)]);return Object['keys'](_0xa81f48)[_0x47ac05(0xfd)]>0x0&&(_0x3ce582[_0x47ac05(0x102)]=_0xa81f48['apps'],_0x3ce582[_0x47ac05(0x10e)]=_0xa81f48[_0x47ac05(0x10e)]),_0x3ce582;}const LOCALE_MAP={'zh':a126_0x134329(0xf8),'zh-cn':'zh-CN','zh_cn':a126_0x134329(0xf8),'en':a126_0x134329(0xf9),'en-us':a126_0x134329(0xf9),'en_us':a126_0x134329(0xf9)};function a126_0x3b7c(_0x312730,_0x3f1e98){_0x312730=_0x312730-0xf7;const _0x2849c6=a126_0x2849();let _0x3b7c3a=_0x2849c6[_0x312730];return _0x3b7c3a;}export function normalizeLocale(_0x1f2481){if(!_0x1f2481)return null;return LOCALE_MAP[_0x1f2481['toLowerCase']()]??null;}function a126_0x2849(){const _0x22f672=['app','Access\x20key','format','469CjCAst','string','defaultApp','Default\x20output\x20format\x20for\x20this\x20app\x20(profile)','appcode','1488460fRnwyM','entries','locale','env','number','riskLevel','map','Locale','inherit','join','Risk\x20level','17704jLGZvD','Auth\x20cookie','zh-CN','en-US','274063Qydlds','897758aSEDyc','trim','length','8ueNjuB','pageSize','API\x20directory\x20path','Config\x20key\x20(','apps','accessKey','cookie','919377eOzSDv','apiDir','1515870kdUTne','703083GjYSjR'];a126_0x2849=function(){return _0x22f672;};return a126_0x2849();}
|
package/lib/constant/cdn.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a127_0x34ffc7=a127_0x1ee3;function a127_0x1ee3(_0x190526,_0x561022){_0x190526=_0x190526-0x131;const _0x572819=a127_0x5728();let _0x1ee36d=_0x572819[_0x190526];return _0x1ee36d;}(function(_0x5dad22,_0x1d5fd6){const _0x4bc71c=a127_0x1ee3,_0x45c0be=_0x5dad22();while(!![]){try{const _0x5e5537=parseInt(_0x4bc71c(0x132))/0x1*(parseInt(_0x4bc71c(0x13b))/0x2)+parseInt(_0x4bc71c(0x134))/0x3*(-parseInt(_0x4bc71c(0x136))/0x4)+parseInt(_0x4bc71c(0x133))/0x5*(-parseInt(_0x4bc71c(0x13a))/0x6)+parseInt(_0x4bc71c(0x138))/0x7+-parseInt(_0x4bc71c(0x131))/0x8+parseInt(_0x4bc71c(0x137))/0x9+parseInt(_0x4bc71c(0x135))/0xa;if(_0x5e5537===_0x1d5fd6)break;else _0x45c0be['push'](_0x45c0be['shift']());}catch(_0x6f3002){_0x45c0be['push'](_0x45c0be['shift']());}}}(a127_0x5728,0xa8fdc));export const CLI_VERSION_POLICY_URL=a127_0x34ffc7(0x139);function a127_0x5728(){const _0x23405c=['4hlTgkR','2629125RplVBO','9317504cdHBfT','https://g.lovrabet.com/dist/rabetbase-cli/config/index.json','30zrVHya','407578CAntkw','4806824rnRkwZ','2zyqnsQ','743215pKeCOf','2475183CInGOT','8305420RZcdyN'];a127_0x5728=function(){return _0x23405c;};return a127_0x5728();}
|
package/lib/constant/cli.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a128_0x5ecee1=a128_0x24b9;(function(_0xff3d24,_0x487a43){const _0x34f76e=a128_0x24b9,_0x509a45=_0xff3d24();while(!![]){try{const _0x12c570=-parseInt(_0x34f76e(0x1d8))/0x1*(parseInt(_0x34f76e(0x219))/0x2)+parseInt(_0x34f76e(0x207))/0x3+parseInt(_0x34f76e(0x210))/0x4*(parseInt(_0x34f76e(0x22c))/0x5)+parseInt(_0x34f76e(0x21f))/0x6+-parseInt(_0x34f76e(0x237))/0x7+parseInt(_0x34f76e(0x204))/0x8*(parseInt(_0x34f76e(0x228))/0x9)+-parseInt(_0x34f76e(0x1d7))/0xa;if(_0x12c570===_0x487a43)break;else _0x509a45['push'](_0x509a45['shift']());}catch(_0x2c2783){_0x509a45['push'](_0x509a45['shift']());}}}(a128_0x5a86,0x4efff));export const CLI_BIN_NAME=a128_0x5ecee1(0x224);function a128_0x5a86(){const _0x56cb29=['dbId','Operation\x20type','SQL\x20code','sql-name','operation','skip-imports','Code\x20filter','Schemas','Skip\x20confirmation\x20for\x20high-risk\x20writes','808qAoqIe','env','sqlname','213840hTyzul','skipImports','all','DB\x20ID','File\x20path','value','SQL\x20name','output','datasetcode','4tkXIYU','Alias\x20for\x20--non-interactive','Output\x20path','key','Skip\x20import\x20generation','appcode','string','dryRun','Use\x20global\x20config\x20scope','2uyrHDO','confirm','enable-bff-save','sql','yes','Select\x20app\x20profile\x20by\x20name','3259272RJjYFa','watch','verbose','non-interactive','remote','rabetbase','Page\x20size','Function\x20node','force','47979gpVojY','pagesize','db-id','Confirm\x20destructive\x20action','1341565ibxeSR','<name>','functionNode','expected-count','<expr>','function-node','format','nonInteractive','Environment','keyword','params','3919377NmvntQ','SQL\x20string','json\x20|\x20pretty\x20|\x20compress','Override\x20appcode','name','clear','351950SyOTKf','502547BQVTbT','boolean','schemas','Config\x20key','Use\x20remote','sqlcode','Enable\x20BFF\x20save','Keyword\x20filter','map','global','description','Filter\x20JSON\x20output\x20(JQ_PATH\x20>\x20bundled\x20jq\x20>\x20PATH;\x20use\x20with\x20--format\x20json\x20or\x20compress)','Expected\x20affected\x20count','help','Record\x20ID','Output\x20format','Dataset\x20code','enableBffSave','descriptionFile','Force\x20overwrite','app','Rabetbase\x20CLI','Description','file','dbid','project','target','production\x20|\x20daily','Page\x20number','type','operationType','Preview\x20operation\x20without\x20executing','Use\x20project\x20config\x20scope','Show\x20help','title'];a128_0x5a86=function(){return _0x56cb29;};return a128_0x5a86();}export const CLI_DISPLAY_NAME=a128_0x5ecee1(0x1ed);function a128_0x24b9(_0x451ea3,_0x4b3fc5){_0x451ea3=_0x451ea3-0x1d5;const _0x5a8680=a128_0x5a86();let _0x24b9e9=_0x5a8680[_0x451ea3];return _0x24b9e9;}export const NPM_PACKAGE_NAME='@lovrabet/rabetbase-cli';export const GLOBAL_FLAGS=[{'name':a128_0x5ecee1(0x215),'meowKey':a128_0x5ecee1(0x215),'type':a128_0x5ecee1(0x216),'description':a128_0x5ecee1(0x23a),'hint':'<code>'},{'name':a128_0x5ecee1(0x1ec),'meowKey':'app','type':a128_0x5ecee1(0x216),'description':a128_0x5ecee1(0x21e),'hint':a128_0x5ecee1(0x22d)},{'name':'env','meowKey':'env','type':a128_0x5ecee1(0x216),'description':a128_0x5ecee1(0x234),'hint':a128_0x5ecee1(0x1f3)},{'name':a128_0x5ecee1(0x232),'meowKey':a128_0x5ecee1(0x232),'type':a128_0x5ecee1(0x216),'description':a128_0x5ecee1(0x1e7),'hint':a128_0x5ecee1(0x239)},{'name':'jq','meowKey':'jq','type':a128_0x5ecee1(0x216),'description':a128_0x5ecee1(0x1e3),'hint':a128_0x5ecee1(0x230)},{'name':'dry-run','meowKey':a128_0x5ecee1(0x217),'type':a128_0x5ecee1(0x1d9),'description':a128_0x5ecee1(0x1f7)},{'name':a128_0x5ecee1(0x21d),'meowKey':a128_0x5ecee1(0x21d),'type':a128_0x5ecee1(0x1d9),'description':a128_0x5ecee1(0x203)},{'name':a128_0x5ecee1(0x222),'meowKey':a128_0x5ecee1(0x233),'type':'boolean','description':'Force\x20non-interactive\x20mode\x20(CI)'},{'name':'global','meowKey':a128_0x5ecee1(0x1e1),'type':a128_0x5ecee1(0x1d9),'description':a128_0x5ecee1(0x218)},{'name':a128_0x5ecee1(0x1f1),'meowKey':a128_0x5ecee1(0x1f1),'type':'boolean','description':a128_0x5ecee1(0x1f8)},{'name':'ci','meowKey':'ci','type':a128_0x5ecee1(0x1d9),'description':a128_0x5ecee1(0x211),'hidden':!![]},{'name':a128_0x5ecee1(0x1e5),'meowKey':a128_0x5ecee1(0x1e5),'type':a128_0x5ecee1(0x1d9),'description':a128_0x5ecee1(0x1f9)},{'name':a128_0x5ecee1(0x1d5),'meowKey':a128_0x5ecee1(0x1d5),'type':a128_0x5ecee1(0x216),'description':'Name','hidden':!![]},{'name':a128_0x5ecee1(0x1fa),'meowKey':'title','type':a128_0x5ecee1(0x216),'description':'Title','hidden':!![]},{'name':a128_0x5ecee1(0x1d6),'meowKey':a128_0x5ecee1(0x1d6),'type':a128_0x5ecee1(0x1d9),'description':'Clear','hidden':!![]},{'name':a128_0x5ecee1(0x220),'meowKey':a128_0x5ecee1(0x220),'type':a128_0x5ecee1(0x1d9),'description':'Watch\x20mode','hidden':!![]},{'name':a128_0x5ecee1(0x20e),'meowKey':'output','type':a128_0x5ecee1(0x216),'description':a128_0x5ecee1(0x212),'hidden':!![]},{'name':a128_0x5ecee1(0x236),'meowKey':a128_0x5ecee1(0x236),'type':a128_0x5ecee1(0x216),'description':'JSON\x20params','hidden':!![]},{'name':a128_0x5ecee1(0x20f),'meowKey':'datasetcode','type':a128_0x5ecee1(0x216),'description':a128_0x5ecee1(0x1e8),'hidden':!![]},{'name':a128_0x5ecee1(0x209),'meowKey':a128_0x5ecee1(0x209),'type':'boolean','description':'Apply\x20to\x20all','hidden':!![]},{'name':a128_0x5ecee1(0x21b),'meowKey':a128_0x5ecee1(0x1e9),'type':a128_0x5ecee1(0x1d9),'description':a128_0x5ecee1(0x1de),'hidden':!![]},{'name':'id','meowKey':'id','type':a128_0x5ecee1(0x216),'description':a128_0x5ecee1(0x1e6),'hidden':!![]},{'name':a128_0x5ecee1(0x1f5),'meowKey':a128_0x5ecee1(0x1f5),'type':'string','description':'Type\x20filter','hidden':!![]},{'name':'file','meowKey':a128_0x5ecee1(0x1ef),'type':a128_0x5ecee1(0x216),'description':a128_0x5ecee1(0x20b),'hidden':!![]},{'name':a128_0x5ecee1(0x1dd),'meowKey':a128_0x5ecee1(0x1dd),'type':a128_0x5ecee1(0x216),'description':a128_0x5ecee1(0x1fd),'hidden':!![]},{'name':a128_0x5ecee1(0x1fe),'meowKey':'sqlName','type':a128_0x5ecee1(0x216),'description':a128_0x5ecee1(0x20d),'hidden':!![]},{'name':a128_0x5ecee1(0x206),'meowKey':a128_0x5ecee1(0x206),'type':a128_0x5ecee1(0x216),'description':a128_0x5ecee1(0x20d),'hidden':!![]},{'name':a128_0x5ecee1(0x22a),'meowKey':a128_0x5ecee1(0x1fb),'type':'string','description':a128_0x5ecee1(0x20a),'hidden':!![]},{'name':a128_0x5ecee1(0x1f0),'meowKey':'dbid','type':'string','description':a128_0x5ecee1(0x20a),'hidden':!![]},{'name':a128_0x5ecee1(0x1e2),'meowKey':a128_0x5ecee1(0x1e2),'type':a128_0x5ecee1(0x216),'description':a128_0x5ecee1(0x1ee),'hidden':!![]},{'name':'description-file','meowKey':a128_0x5ecee1(0x1ea),'type':a128_0x5ecee1(0x216),'description':'Description\x20file','hidden':!![]},{'name':'page','meowKey':'page','type':'string','description':a128_0x5ecee1(0x1f4),'hidden':!![]},{'name':a128_0x5ecee1(0x229),'meowKey':a128_0x5ecee1(0x229),'type':a128_0x5ecee1(0x216),'description':a128_0x5ecee1(0x225),'hidden':!![]},{'name':a128_0x5ecee1(0x235),'meowKey':a128_0x5ecee1(0x235),'type':'string','description':a128_0x5ecee1(0x1df),'hidden':!![]},{'name':'code','meowKey':'code','type':a128_0x5ecee1(0x216),'description':a128_0x5ecee1(0x201),'hidden':!![]},{'name':a128_0x5ecee1(0x21c),'meowKey':a128_0x5ecee1(0x21c),'type':a128_0x5ecee1(0x216),'description':a128_0x5ecee1(0x238),'hidden':!![]},{'name':a128_0x5ecee1(0x1da),'meowKey':a128_0x5ecee1(0x1da),'type':a128_0x5ecee1(0x216),'description':a128_0x5ecee1(0x202),'hidden':!![]},{'name':'operation','meowKey':a128_0x5ecee1(0x1ff),'type':a128_0x5ecee1(0x216),'description':a128_0x5ecee1(0x1fc),'hidden':!![]},{'name':'target','meowKey':a128_0x5ecee1(0x1f2),'type':a128_0x5ecee1(0x216),'description':'Target\x20path','hidden':!![]},{'name':a128_0x5ecee1(0x200),'meowKey':a128_0x5ecee1(0x208),'type':'boolean','description':a128_0x5ecee1(0x214),'hidden':!![]},{'name':a128_0x5ecee1(0x213),'meowKey':'key','type':a128_0x5ecee1(0x216),'description':a128_0x5ecee1(0x1db),'hidden':!![]},{'name':'value','meowKey':a128_0x5ecee1(0x20c),'type':a128_0x5ecee1(0x216),'description':'Config\x20value','hidden':!![]},{'name':a128_0x5ecee1(0x227),'meowKey':a128_0x5ecee1(0x227),'type':a128_0x5ecee1(0x1d9),'description':a128_0x5ecee1(0x1eb),'hidden':!![]},{'name':'confirm','meowKey':a128_0x5ecee1(0x21a),'type':'boolean','description':a128_0x5ecee1(0x22b),'hidden':!![]},{'name':a128_0x5ecee1(0x223),'meowKey':a128_0x5ecee1(0x223),'type':'boolean','description':a128_0x5ecee1(0x1dc),'hidden':!![]},{'name':'verbose','meowKey':a128_0x5ecee1(0x221),'type':a128_0x5ecee1(0x1d9),'description':'Verbose\x20output','hidden':!![]},{'name':a128_0x5ecee1(0x22f),'meowKey':'expectedCount','type':a128_0x5ecee1(0x216),'description':a128_0x5ecee1(0x1e4),'hidden':!![]},{'name':'operation-type','meowKey':a128_0x5ecee1(0x1f6),'type':'string','description':'Operation\x20type','hidden':!![]},{'name':a128_0x5ecee1(0x231),'meowKey':a128_0x5ecee1(0x22e),'type':a128_0x5ecee1(0x216),'description':a128_0x5ecee1(0x226),'hidden':!![]}];export const PIPELINE_FLAG_NAMES=new Set([a128_0x5ecee1(0x215),a128_0x5ecee1(0x1ec),a128_0x5ecee1(0x205),'format','jq','dry-run',a128_0x5ecee1(0x21d),a128_0x5ecee1(0x222),'ci']);export function buildMeowFlags(){const _0x13dd49=a128_0x5ecee1;return Object['fromEntries'](GLOBAL_FLAGS[_0x13dd49(0x1e0)](_0x51bf9d=>[_0x51bf9d['meowKey'],{'type':_0x51bf9d['type']}]));}
|
package/lib/constant/defaults.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a129_0x4abbbd=a129_0x5b51;function a129_0x5b51(_0x28ab90,_0xc72e4c){_0x28ab90=_0x28ab90-0x144;const _0x389704=a129_0x3897();let _0x5b51c0=_0x389704[_0x28ab90];return _0x5b51c0;}(function(_0x308fc1,_0x531cb4){const _0x469340=a129_0x5b51,_0x5a8208=_0x308fc1();while(!![]){try{const _0x487846=-parseInt(_0x469340(0x14a))/0x1+-parseInt(_0x469340(0x14c))/0x2*(-parseInt(_0x469340(0x14b))/0x3)+parseInt(_0x469340(0x14f))/0x4+-parseInt(_0x469340(0x144))/0x5+parseInt(_0x469340(0x14d))/0x6+parseInt(_0x469340(0x145))/0x7*(-parseInt(_0x469340(0x149))/0x8)+parseInt(_0x469340(0x146))/0x9;if(_0x487846===_0x531cb4)break;else _0x5a8208['push'](_0x5a8208['shift']());}catch(_0x58db4e){_0x5a8208['push'](_0x5a8208['shift']());}}}(a129_0x3897,0x3fb53));import{DEFAULT_API_DIR}from'../constant/paths.js';export const DEFAULT_CONFIG_VALUES={'env':a129_0x4abbbd(0x147),'format':a129_0x4abbbd(0x150),'locale':a129_0x4abbbd(0x148),'riskLevel':a129_0x4abbbd(0x14e),'apiDir':DEFAULT_API_DIR};export const DEFAULT_COMMAND_OUTPUT_FORMAT=a129_0x4abbbd(0x150);function a129_0x3897(){const _0x49c3b7=['55624TIjqnb','320629TzZjvm','1014DdKyQn','2980taPeIT','766086FDfLMo','high-risk-write','335908unBDKD','compress','703575EhScJa','91pAGaAj','876618xItjxW','production','en-US'];a129_0x3897=function(){return _0x49c3b7;};return a129_0x3897();}
|
package/lib/constant/domain.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a130_0x59fd(_0x48ce4d,_0x4df10e){_0x48ce4d=_0x48ce4d-0x96;const _0x5ea80e=a130_0x5ea8();let _0x59fd0b=_0x5ea80e[_0x48ce4d];return _0x59fd0b;}const a130_0x1cf11d=a130_0x59fd;function a130_0x5ea8(){const _0x5de7a6=['968778scaJLQ','userDomain','133156BcvcNv','29940gRmaXH','1drzDZP','35QzIJdT','65bTgvSn','https://daily-runtime.lovrabet.com','1388004GGAkCs','259QxzRBs','1782PQyCdv','apiDomain','https://daily-api.lovrabet.com','802792wPkSKE','56388eAFKvd','27DDdkld','823800OcLkmK','https://user.lovrabet.com','https://api.lovrabet.com'];a130_0x5ea8=function(){return _0x5de7a6;};return a130_0x5ea8();}(function(_0x2cb3a0,_0xa32e86){const _0x14d86c=a130_0x59fd,_0x2b4842=_0x2cb3a0();while(!![]){try{const _0xb08363=-parseInt(_0x14d86c(0xa5))/0x1*(-parseInt(_0x14d86c(0xa1))/0x2)+-parseInt(_0x14d86c(0x9e))/0x3+-parseInt(_0x14d86c(0xa3))/0x4*(-parseInt(_0x14d86c(0xa6))/0x5)+-parseInt(_0x14d86c(0x9c))/0x6*(parseInt(_0x14d86c(0x97))/0x7)+-parseInt(_0x14d86c(0x9b))/0x8*(-parseInt(_0x14d86c(0x9d))/0x9)+-parseInt(_0x14d86c(0xa4))/0xa*(-parseInt(_0x14d86c(0x98))/0xb)+-parseInt(_0x14d86c(0x96))/0xc*(parseInt(_0x14d86c(0xa7))/0xd);if(_0xb08363===_0xa32e86)break;else _0x2b4842['push'](_0x2b4842['shift']());}catch(_0x1d8bda){_0x2b4842['push'](_0x2b4842['shift']());}}}(a130_0x5ea8,0x49eea));import{getEnv,isProduction}from'../constant/env.js';let customApiDomain,customUserDomain,customRuntimeDomain;export function initDomains(_0x1ca940){const _0x2560e4=a130_0x59fd;customApiDomain=_0x1ca940?.[_0x2560e4(0x99)],customUserDomain=_0x1ca940?.[_0x2560e4(0xa2)],customRuntimeDomain=_0x1ca940?.['runtimeDomain'];}export const getUserDomain=()=>customUserDomain||(isProduction(getEnv())?a130_0x1cf11d(0x9f):'https://user-daily.lovrabet.com');export const getApiDomain=()=>customApiDomain||(isProduction(getEnv())?a130_0x1cf11d(0xa0):a130_0x1cf11d(0x9a));export const getRuntimeDomain=()=>customRuntimeDomain||(isProduction(getEnv())?'https://runtime.lovrabet.com':a130_0x1cf11d(0xa8));
|
package/lib/constant/env.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a131_0x2b5331=a131_0x52c2;(function(_0x1267b4,_0x2510f4){const _0x2c60a5=a131_0x52c2,_0x164223=_0x1267b4();while(!![]){try{const _0x1b2fd6=parseInt(_0x2c60a5(0x144))/0x1+-parseInt(_0x2c60a5(0x13e))/0x2*(-parseInt(_0x2c60a5(0x149))/0x3)+-parseInt(_0x2c60a5(0x13f))/0x4*(parseInt(_0x2c60a5(0x147))/0x5)+-parseInt(_0x2c60a5(0x13d))/0x6+-parseInt(_0x2c60a5(0x143))/0x7*(-parseInt(_0x2c60a5(0x14a))/0x8)+parseInt(_0x2c60a5(0x140))/0x9*(parseInt(_0x2c60a5(0x148))/0xa)+parseInt(_0x2c60a5(0x142))/0xb*(-parseInt(_0x2c60a5(0x145))/0xc);if(_0x1b2fd6===_0x2510f4)break;else _0x164223['push'](_0x164223['shift']());}catch(_0x44bf4f){_0x164223['push'](_0x164223['shift']());}}}(a131_0x1f31,0xad963));export const RABETBASE_ENV_VALUES=['production','daily'];export function normalizeEnv(_0x31cd13){const _0x78f0dc=a131_0x52c2;return _0x31cd13==='online'?_0x78f0dc(0x146):_0x31cd13;}export function isProduction(_0x4aa6ef){return normalizeEnv(_0x4aa6ef)==='production';}function a131_0x1f31(){const _0x16d449=['development','7740755QvzJQn','4931150iCdROS','177434mSXPIi','12UbLsoC','production','890tPZESe','10aUrjBN','110091YdqegF','8FiLYbA','daily','4863690QDJLje','76JihOjf','19648cdVNTi','7409673mkfipd'];a131_0x1f31=function(){return _0x16d449;};return a131_0x1f31();}function a131_0x52c2(_0x4aec1a,_0x1cf2c5){_0x4aec1a=_0x4aec1a-0x13d;const _0x1f31a9=a131_0x1f31();let _0x52c2ce=_0x1f31a9[_0x4aec1a];return _0x52c2ce;}export function isDaily(_0x1a21df){const _0x196260=a131_0x52c2;return normalizeEnv(_0x1a21df)===_0x196260(0x14b);}export function isDev(_0x548d56){const _0x1cc45d=a131_0x52c2,_0x22bffd=normalizeEnv(_0x548d56);return _0x22bffd===_0x1cc45d(0x141)||_0x22bffd==='dev';}let env=normalizeEnv(process.env.RABETBASE_ENV||process.env.LOVRABET_ENV||a131_0x2b5331(0x146));export function getEnv(){return env;}export function initEnv(_0x11769b){env=normalizeEnv(_0x11769b);}
|
package/lib/constant/output.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a132_0x341917=a132_0x5505;function a132_0x420b(){const _0x3e41e5=['387035vGTTua','828400OsVFeo','json','pretty','6261iEGTTX','compress','294736eBdGNO','42bOyHvN','204CcnMlW','45YSRMkK','874153FADBIl','666008ordADs','17470840JozKdC'];a132_0x420b=function(){return _0x3e41e5;};return a132_0x420b();}(function(_0xbd9ffe,_0x518bc2){const _0x5c0133=a132_0x5505,_0x9091f7=_0xbd9ffe();while(!![]){try{const _0x13b165=parseInt(_0x5c0133(0x1b0))/0x1+-parseInt(_0x5c0133(0x1ad))/0x2*(-parseInt(_0x5c0133(0x1b6))/0x3)+parseInt(_0x5c0133(0x1b3))/0x4+parseInt(_0x5c0133(0x1b2))/0x5+parseInt(_0x5c0133(0x1b9))/0x6*(parseInt(_0x5c0133(0x1af))/0x7)+-parseInt(_0x5c0133(0x1b8))/0x8*(-parseInt(_0x5c0133(0x1ae))/0x9)+-parseInt(_0x5c0133(0x1b1))/0xa;if(_0x13b165===_0x518bc2)break;else _0x9091f7['push'](_0x9091f7['shift']());}catch(_0x1f30e7){_0x9091f7['push'](_0x9091f7['shift']());}}}(a132_0x420b,0x73e2c));function a132_0x5505(_0xa312bc,_0x5cfeed){_0xa312bc=_0xa312bc-0x1ad;const _0x420bd2=a132_0x420b();let _0x5505b8=_0x420bd2[_0xa312bc];return _0x5505b8;}export const RABETBASE_OUTPUT_FORMAT_VALUES=[a132_0x341917(0x1b4),a132_0x341917(0x1b5),a132_0x341917(0x1b7)];
|
package/lib/constant/paths.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a133_0x272d(){const _0x175031=['1624014ZKQxwT','15KQCFJm','2125315EpxXYP','./src/api','1999060JkqFht','1566860cSzrNS','81qHbSgp','1122314cCLCPm','1hlJoJp','11Ebrrqk','13820uwMnlj','246544jXrnLh'];a133_0x272d=function(){return _0x175031;};return a133_0x272d();}const a133_0x108be6=a133_0x201d;(function(_0x273319,_0xe7d84d){const _0x40283a=a133_0x201d,_0x2062d3=_0x273319();while(!![]){try{const _0x125888=parseInt(_0x40283a(0x169))/0x1*(-parseInt(_0x40283a(0x168))/0x2)+-parseInt(_0x40283a(0x16e))/0x3*(parseInt(_0x40283a(0x16b))/0x4)+parseInt(_0x40283a(0x16f))/0x5+-parseInt(_0x40283a(0x16d))/0x6+parseInt(_0x40283a(0x171))/0x7+-parseInt(_0x40283a(0x16c))/0x8*(-parseInt(_0x40283a(0x167))/0x9)+parseInt(_0x40283a(0x166))/0xa*(parseInt(_0x40283a(0x16a))/0xb);if(_0x125888===_0xe7d84d)break;else _0x2062d3['push'](_0x2062d3['shift']());}catch(_0x54cd8c){_0x2062d3['push'](_0x2062d3['shift']());}}}(a133_0x272d,0x482a6));function a133_0x201d(_0x16c52c,_0x4a5e2f){_0x16c52c=_0x16c52c-0x166;const _0x272dab=a133_0x272d();let _0x201d42=_0x272dab[_0x16c52c];return _0x201d42;}export const DEFAULT_API_DIR=a133_0x108be6(0x170);
|
package/lib/constant/risk.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a134_0x172c(){const _0x3af70a=['136300BowJhS','230MoIihO','160919wsijoT','write','read','320AReRPt','16LNnogf','6DpCMmy','253986tMpmaN','high-risk-write','4655784rvyyPp','7033355PTuAjz','75916aEsbAk','63720eIBmzq'];a134_0x172c=function(){return _0x3af70a;};return a134_0x172c();}const a134_0x4872cb=a134_0x3e07;function a134_0x3e07(_0xf1d87b,_0x3edb30){_0xf1d87b=_0xf1d87b-0x1a7;const _0x172c1a=a134_0x172c();let _0x3e07d5=_0x172c1a[_0xf1d87b];return _0x3e07d5;}(function(_0x4272ca,_0x39e277){const _0x49595a=a134_0x3e07,_0x1899a9=_0x4272ca();while(!![]){try{const _0x59f1c0=-parseInt(_0x49595a(0x1a7))/0x1+-parseInt(_0x49595a(0x1ad))/0x2*(-parseInt(_0x49595a(0x1af))/0x3)+-parseInt(_0x49595a(0x1b3))/0x4*(-parseInt(_0x49595a(0x1a8))/0x5)+parseInt(_0x49595a(0x1ae))/0x6*(-parseInt(_0x49595a(0x1b2))/0x7)+parseInt(_0x49595a(0x1b1))/0x8+parseInt(_0x49595a(0x1b4))/0x9+-parseInt(_0x49595a(0x1ac))/0xa*(parseInt(_0x49595a(0x1a9))/0xb);if(_0x59f1c0===_0x39e277)break;else _0x1899a9['push'](_0x1899a9['shift']());}catch(_0x1f8263){_0x1899a9['push'](_0x1899a9['shift']());}}}(a134_0x172c,0x8170e));export const RISK_LEVEL_VALUES=[a134_0x4872cb(0x1ab),a134_0x4872cb(0x1aa),a134_0x4872cb(0x1b0)];
|
package/lib/context.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a135_0x532b73=a135_0x24fb;(function(_0x169c96,_0x439da0){const _0x9a9678=a135_0x24fb,_0x1597bd=_0x169c96();while(!![]){try{const _0x102550=parseInt(_0x9a9678(0x1f6))/0x1*(-parseInt(_0x9a9678(0x1b6))/0x2)+parseInt(_0x9a9678(0x1c6))/0x3*(parseInt(_0x9a9678(0x1e0))/0x4)+parseInt(_0x9a9678(0x1c4))/0x5+-parseInt(_0x9a9678(0x1ae))/0x6*(parseInt(_0x9a9678(0x1b5))/0x7)+-parseInt(_0x9a9678(0x1f0))/0x8+parseInt(_0x9a9678(0x1de))/0x9*(parseInt(_0x9a9678(0x1b4))/0xa)+parseInt(_0x9a9678(0x1e7))/0xb;if(_0x102550===_0x439da0)break;else _0x1597bd['push'](_0x1597bd['shift']());}catch(_0x12bd7a){_0x1597bd['push'](_0x1597bd['shift']());}}}(a135_0x5ce0,0x22252));import{readFileSync,writeFileSync,existsSync,mkdirSync,renameSync,unlinkSync}from'node:fs';import{resolve,dirname,parse}from'node:path';import{homedir}from'node:os';function a135_0x24fb(_0x3345f6,_0x22a2b7){_0x3345f6=_0x3345f6-0x1ab;const _0x5ce007=a135_0x5ce0();let _0x24fbb1=_0x5ce007[_0x3345f6];return _0x24fbb1;}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(_0x371a7a){return process.env[`RABETBASE_${_0x371a7a}`]||process.env[`LOVRABET_${_0x371a7a}`]||undefined;}export const NEW_CONFIG_NAME=a135_0x532b73(0x1df);export const CONFIG_NAMES=[a135_0x532b73(0x1df),a135_0x532b73(0x1ef),a135_0x532b73(0x1f5)];export const LEGACY_CONFIG_NAMES=CONFIG_NAMES[a135_0x532b73(0x1fe)](_0x58b63c=>_0x58b63c!==NEW_CONFIG_NAME);export function resolveConfigPath(_0x47cb1a){for(const _0x1a6c03 of CONFIG_NAMES){const _0x145bc7=resolve(_0x47cb1a,_0x1a6c03);if(existsSync(_0x145bc7))return _0x145bc7;}return undefined;}export function findProjectRootDirectory(_0x2254a5=process['cwd']()){let _0x2ffa9a=resolve(_0x2254a5);const {root:_0x2fa6a6}=parse(_0x2ffa9a),_0x72ec09=homedir();while(!![]){if(resolveConfigPath(_0x2ffa9a)){if(_0x2ffa9a===_0x72ec09)break;return _0x2ffa9a;}if(_0x2ffa9a===_0x2fa6a6||_0x2ffa9a===_0x72ec09)break;const _0x51d181=dirname(_0x2ffa9a);if(_0x51d181===_0x2ffa9a)break;_0x2ffa9a=_0x51d181;}return resolve(_0x2254a5);}export async function createContext(_0xa93fd8){const _0x4e5cc2=a135_0x532b73,_0x577534=readRawConfig(),_0x1c5aa6=buildConfig(_0x577534,_0xa93fd8),{initEnv:_0x5506f7}=await import(_0x4e5cc2(0x1be));if(_0x1c5aa6['env'])_0x5506f7(_0x1c5aa6['env']);else _0xa93fd8[_0x4e5cc2(0x1c2)]&&typeof _0xa93fd8[_0x4e5cc2(0x1c2)]===_0x4e5cc2(0x1f9)&&_0x5506f7(_0xa93fd8[_0x4e5cc2(0x1c2)]);const {initDomains:_0x187690,getUserDomain:_0x8f4ebf,getApiDomain:_0x58f50b}=await import(_0x4e5cc2(0x1d6));_0x187690({'apiDomain':_0x577534[_0x4e5cc2(0x1ea)]||undefined,'userDomain':_0x577534['userDomain']||undefined,'runtimeDomain':_0x577534[_0x4e5cc2(0x1ed)]||undefined});const _0x3bfef8={'apiDomain':_0x58f50b(),'userDomain':_0x8f4ebf()},_0x271928=await buildAuth(_0x1c5aa6);logger[_0x4e5cc2(0x1dd)](process['cwd']());const _0x5798c8=(CLI_BIN_NAME+'\x20'+process['argv'][_0x4e5cc2(0x1f2)](0x2)[_0x4e5cc2(0x1ce)]('\x20'))['trim']();logger[_0x4e5cc2(0x1ac)](_0x5798c8);const {isNonInteractive:_0x56884f}=await import(_0x4e5cc2(0x1da)),_0x120d81=_0x56884f(_0xa93fd8);return{'config':_0x1c5aa6,'auth':_0x271928,'logger':logger,'env':_0x3bfef8,'nonInteractive':_0x120d81};}export function buildConfigFromFlags(_0x287d1b){return buildConfig(readRawConfig(),_0x287d1b);}export function getProjectConfigPath(){const _0x33373f=a135_0x532b73;return resolveConfigPath(process[_0x33373f(0x1b3)]());}export function getGlobalConfigPath(){return resolveConfigPath(homedir());}export function isInProject(){return!!getProjectConfigPath();}export function inspectCliConfigJsonFile(_0xc8563e){const _0xde4097=a135_0x532b73;if(!existsSync(_0xc8563e))return{'status':_0xde4097(0x1f3)};try{const _0x1f52a2=readFileSync(_0xc8563e,{'encoding':'utf8'});if(!_0x1f52a2?.[_0xde4097(0x1db)]())return{'status':'empty'};const _0x932ed6=JSON['parse'](_0x1f52a2);return{'status':'ok','data':_0x932ed6};}catch(_0x4a049f){return{'status':_0xde4097(0x1bf),'message':_0x4a049f instanceof Error?_0x4a049f[_0xde4097(0x1d4)]:String(_0x4a049f)};}}function parseCliConfigJsonFile(_0x45394e,_0xb2e7a5,_0x43f11f){const _0x4fa659=a135_0x532b73,_0x435996=inspectCliConfigJsonFile(_0x45394e);if(_0x435996[_0x4fa659(0x1d1)]===_0x4fa659(0x1f3)||_0x435996[_0x4fa659(0x1d1)]==='empty')return{};if(_0x435996[_0x4fa659(0x1d1)]==='ok')return _0x435996[_0x4fa659(0x1ff)];return _0xb2e7a5===_0x4fa659(0x1cc)&&_0x43f11f&&console[_0x4fa659(0x1bf)](CLI_BIN_NAME+':\x20'+_0x43f11f+_0x4fa659(0x1bb)+_0x45394e+_0x4fa659(0x1ec)+_0x435996[_0x4fa659(0x1d4)]),{};}const normalizedWriteCache=new Map();function normalizeLegacyConfigShape(_0x23935a){const _0x5bfed0=a135_0x532b73;if(!_0x23935a||typeof _0x23935a!=='object')return{'config':{},'migrated':![]};const _0x454795={..._0x23935a},_0x59222e=_0x454795[_0x5bfed0(0x1d5)]&&typeof _0x454795[_0x5bfed0(0x1d5)]==='object'?{..._0x454795[_0x5bfed0(0x1d5)]}:{},_0x2e78f8=Object[_0x5bfed0(0x1f1)](_0x59222e)[_0x5bfed0(0x1e5)],_0x5ef1e5=_0x454795[_0x5bfed0(0x1b2)]||_0x454795[_0x5bfed0(0x1cd)];let _0x24e7f0=![];if(_0x5ef1e5&&_0x2e78f8===0x0){const _0x22d9e5=typeof _0x454795[_0x5bfed0(0x1c0)]===_0x5bfed0(0x1f9)&&_0x454795[_0x5bfed0(0x1c0)][_0x5bfed0(0x1db)]()?_0x454795[_0x5bfed0(0x1c0)]:String(_0x5ef1e5)[_0x5bfed0(0x1db)]();_0x59222e[_0x22d9e5]={'appcode':String(_0x5ef1e5)['trim'](),..._0x454795['env']!=null?{'env':_0x454795[_0x5bfed0(0x1c2)]}:{},..._0x454795['apiDir']!=null?{'apiDir':_0x454795[_0x5bfed0(0x1c9)]}:{},..._0x454795['cookie']!=null?{'cookie':_0x454795[_0x5bfed0(0x1e9)]}:{},..._0x454795[_0x5bfed0(0x1d0)]!=null?{'accessKey':_0x454795[_0x5bfed0(0x1d0)]}:{},..._0x454795[_0x5bfed0(0x1f7)]!=null?{'format':_0x454795['format']}:{},..._0x454795[_0x5bfed0(0x1ee)]!=null?{'pageSize':_0x454795[_0x5bfed0(0x1ee)]}:{},..._0x454795[_0x5bfed0(0x1b1)]!=null?{'riskLevel':_0x454795['riskLevel']}:{},..._0x454795['locale']!=null?{'locale':_0x454795[_0x5bfed0(0x1d8)]}:{}},_0x454795[_0x5bfed0(0x1d5)]=_0x59222e;if(!_0x454795[_0x5bfed0(0x1c0)])_0x454795['defaultApp']=_0x22d9e5;_0x24e7f0=!![];}return(_0x5bfed0(0x1b2)in _0x454795||_0x5bfed0(0x1cd)in _0x454795)&&(delete _0x454795['appcode'],delete _0x454795['app'],_0x24e7f0=!![]),{'config':_0x454795,'migrated':_0x24e7f0};}function writeNormalizedConfigIfNeeded(_0x4d7477,_0x163751){const _0x689e48=a135_0x532b73,_0x27c470=JSON['stringify'](_0x163751,null,0x2)+'\x0a';if(normalizedWriteCache['get'](_0x4d7477)===_0x27c470)return;writeConfigFile(_0x4d7477,_0x163751),normalizedWriteCache[_0x689e48(0x1c3)](_0x4d7477,_0x27c470);}function parseAndNormalizeConfig(_0x566e30,_0x19dbd2,_0x3a138c){const _0xd10cce=a135_0x532b73,_0x296122=parseCliConfigJsonFile(_0x566e30,_0x19dbd2,_0x3a138c),_0x20ea86=normalizeLegacyConfigShape(_0x296122);if(_0x20ea86[_0xd10cce(0x1bd)])try{writeNormalizedConfigIfNeeded(_0x566e30,_0x20ea86['config']);}catch{}return _0x20ea86[_0xd10cce(0x1e8)];}function a135_0x5ce0(){const _0x29b1f9=['authRequired','setLogPath','6561joxtdk','.rabetbase.json','4aFSQXV','./auth/get-cookie.js','Global','RISK_LEVEL','daily','length','maxRisk','1099813OawOmJ','config','cookie','apiDomain','MAX_RISK','\x0a\x20\x20','runtimeDomain','pageSize','.lovrabet.json','1665224CpNgEH','keys','slice','missing','merged','.lovrabetrc','9fhsxiz','format','inherit','string','PAGE_SIZE','api.ts','Project','ENV','filter','data','stringify','setRawCommand','https://g.lovrabet.com/dist/lovrabet-skill','14622eVsOwH','projectConfig','template_base_url','riskLevel','appcode','cwd','1090BUcEgL','7iBcCil','8722nmWQjc','write','utf8','.tmp','object','\x20config\x20file\x20ignored\x20(invalid\x20JSON\x20or\x20unreadable):\x20','project','migrated','./constant/env.js','error','defaultApp','FORMAT','env','set','517995XEeefN','entries','319962vbNHMH','map','APP','apiDir','silent','ACCESS_KEY','warn','app','join','-api.ts','accessKey','status','find','VERBOSE','message','apps','./constant/domain.js','true','locale','read','./utils/is-non-interactive.js','trim'];a135_0x5ce0=function(){return _0x29b1f9;};return a135_0x5ce0();}export function loadRawConfigLayers(_0x565e72){const _0x2a244b=a135_0x532b73;let _0x522ec0={},_0x300319={};const _0x148453=resolveConfigPath(homedir());_0x148453&&(_0x522ec0=parseAndNormalizeConfig(_0x148453,_0x2a244b(0x1cc),_0x2a244b(0x1e2)));const _0x4b6465=_0x565e72??findProjectRootDirectory(),_0x177230=resolveConfigPath(_0x4b6465);return _0x177230&&(_0x300319=parseAndNormalizeConfig(_0x177230,_0x2a244b(0x1cc),_0x2a244b(0x1fc))),{'globalPath':_0x148453,'projectPath':_0x177230,'globalConfig':_0x522ec0,'projectConfig':_0x300319};}function mergeRawConfigLayers(_0x45808c){const _0x1e7572=a135_0x532b73,{globalConfig:_0x5ef9f2,projectConfig:_0x148f3c}=_0x45808c;if(_0x148f3c[_0x1e7572(0x1f8)]===![]){const _0x9bf2e6={..._0x148f3c};delete _0x9bf2e6[_0x1e7572(0x1f8)];const _0x1e434a=_0x148f3c[_0x1e7572(0x1d5)]&&typeof _0x148f3c['apps']===_0x1e7572(0x1ba)?_0x148f3c[_0x1e7572(0x1d5)]:{};Object[_0x1e7572(0x1f1)](_0x1e434a)['length']>0x0?_0x9bf2e6[_0x1e7572(0x1d5)]=_0x1e434a:delete _0x9bf2e6['apps'];if(_0x1e7572(0x1c0)in _0x148f3c)_0x9bf2e6[_0x1e7572(0x1c0)]=_0x148f3c[_0x1e7572(0x1c0)];else Object[_0x1e7572(0x1f1)](_0x1e434a)[_0x1e7572(0x1e5)]>0x0&&(_0x9bf2e6[_0x1e7572(0x1c0)]=Object[_0x1e7572(0x1f1)](_0x1e434a)[0x0]);return _0x9bf2e6;}const _0x5ac23f=_0x5ef9f2['apps']&&typeof _0x5ef9f2[_0x1e7572(0x1d5)]==='object'?_0x5ef9f2[_0x1e7572(0x1d5)]:{},_0x3e0284=_0x148f3c[_0x1e7572(0x1d5)]&&typeof _0x148f3c[_0x1e7572(0x1d5)]==='object'?_0x148f3c['apps']:{},_0x380359={..._0x5ac23f,..._0x3e0284},_0x35291c={..._0x5ef9f2,..._0x148f3c};Object[_0x1e7572(0x1f1)](_0x380359)[_0x1e7572(0x1e5)]>0x0&&(_0x35291c[_0x1e7572(0x1d5)]=_0x380359);if('defaultApp'in _0x148f3c)_0x35291c[_0x1e7572(0x1c0)]=_0x148f3c[_0x1e7572(0x1c0)];else{if(_0x3e0284&&Object[_0x1e7572(0x1f1)](_0x3e0284)[_0x1e7572(0x1e5)]>0x0)_0x35291c['defaultApp']=Object[_0x1e7572(0x1f1)](_0x3e0284)[0x0];else{if(_0x5ef9f2[_0x1e7572(0x1c0)])_0x35291c[_0x1e7572(0x1c0)]=_0x5ef9f2[_0x1e7572(0x1c0)];else{const _0x43d87e=Object[_0x1e7572(0x1f1)](_0x5ac23f);_0x43d87e[_0x1e7572(0x1e5)]>0x0&&(_0x35291c[_0x1e7572(0x1c0)]=_0x43d87e[0x0]);}}}return _0x35291c;}export function readRawConfigWithLayers(_0x8be249){const _0x4e8ab9=loadRawConfigLayers(_0x8be249);return{'config':mergeRawConfigLayers(_0x4e8ab9),'layers':_0x4e8ab9};}export function readRawConfig(_0x4f779c){return mergeRawConfigLayers(loadRawConfigLayers(_0x4f779c));}export function getConfigAppCode(_0xeb5b64){const _0x2dfb6c=a135_0x532b73,_0x2a40c9=readRawConfig(_0xeb5b64);if(_0x2a40c9[_0x2dfb6c(0x1d5)]&&typeof _0x2a40c9[_0x2dfb6c(0x1d5)]===_0x2dfb6c(0x1ba)){const _0xb9551f=_0x2a40c9['defaultApp'];if(_0xb9551f&&_0x2a40c9[_0x2dfb6c(0x1d5)][_0xb9551f]?.['appcode'])return String(_0x2a40c9[_0x2dfb6c(0x1d5)][_0xb9551f][_0x2dfb6c(0x1b2)])[_0x2dfb6c(0x1db)]();const _0x543a75=Object['values'](_0x2a40c9['apps'])[0x0];if(_0x543a75?.[_0x2dfb6c(0x1b2)])return String(_0x543a75[_0x2dfb6c(0x1b2)])[_0x2dfb6c(0x1db)]();}const _0x39f5a3=_0x2a40c9[_0x2dfb6c(0x1b2)]||_0x2a40c9['app'];if(typeof _0x39f5a3!=='string'||_0x39f5a3[_0x2dfb6c(0x1db)]()==='')return undefined;return _0x39f5a3['trim']();}export function getMultiAppConfigs(_0x4be44f=a135_0x532b73(0x1bc),_0x110cf3){const _0x2a0bda=a135_0x532b73,_0x2aae19=_0x4be44f===_0x2a0bda(0x1f4)?readRawConfig(_0x110cf3):loadRawConfigLayers(_0x110cf3)[_0x2a0bda(0x1af)],_0x8935d9=_0x2aae19[_0x2a0bda(0x1d5)];if(!_0x8935d9||typeof _0x8935d9!==_0x2a0bda(0x1ba)||Object['keys'](_0x8935d9)[_0x2a0bda(0x1e5)]===0x0)return null;const _0x160aa4=_0x2aae19[_0x2a0bda(0x1c0)];return Object[_0x2a0bda(0x1c5)](_0x8935d9)[_0x2a0bda(0x1c7)](([_0x3057ec,_0x49a222])=>({'name':_0x3057ec,'appcode':_0x49a222?.[_0x2a0bda(0x1b2)]||'','isDefault':_0x3057ec===_0x160aa4,'env':_0x49a222?.[_0x2a0bda(0x1c2)],'apiDir':_0x49a222?.[_0x2a0bda(0x1c9)],'cookie':_0x49a222?.['cookie']||undefined}))[_0x2a0bda(0x1fe)](_0x4044c9=>_0x4044c9[_0x2a0bda(0x1b2)]);}export function getTemplateBaseUrl(_0x1cbee7){const _0x4f64bc=a135_0x532b73,_0x4904ab=readRawConfig(_0x1cbee7);if(_0x4904ab[_0x4f64bc(0x1b0)]&&typeof _0x4904ab[_0x4f64bc(0x1b0)]===_0x4f64bc(0x1f9))return _0x4904ab[_0x4f64bc(0x1b0)]['replace'](/\/$/,'');return _0x4f64bc(0x1ad);}export function readConfigFile(_0x4ea4f5){const _0x1daf32=a135_0x532b73;return parseAndNormalizeConfig(_0x4ea4f5,_0x1daf32(0x1ca));}export function writeConfigFile(_0x33799a,_0x1b858d){const _0x254037=a135_0x532b73,_0x181cdb=dirname(_0x33799a);!existsSync(_0x181cdb)&&mkdirSync(_0x181cdb,{'recursive':!![]});const _0x4d2c97=_0x33799a+_0x254037(0x1b9);try{writeFileSync(_0x4d2c97,JSON[_0x254037(0x1ab)](_0x1b858d,null,0x2)+'\x0a',{'encoding':_0x254037(0x1b8),'mode':0x180}),renameSync(_0x4d2c97,_0x33799a);}catch(_0x4cbbda){try{unlinkSync(_0x4d2c97);}catch{}throw _0x4cbbda;}}export function resolveWriteConfigPath(_0x37ccb4){const _0x393921=a135_0x532b73,_0x54ecd4=_0x37ccb4===_0x393921(0x1bc)?process[_0x393921(0x1b3)]():homedir(),_0x1b4a4e=resolveConfigPath(_0x54ecd4);return _0x1b4a4e??resolve(_0x54ecd4,NEW_CONFIG_NAME);}function buildConfig(_0x14dddd,_0x119e5e){const _0x391722=a135_0x532b73,_0x417af7={};if(_0x14dddd['apps']&&typeof _0x14dddd['apps']===_0x391722(0x1ba))for(const [_0x2c3372,_0x5b7b3a]of Object['entries'](_0x14dddd[_0x391722(0x1d5)])){_0x5b7b3a&&typeof _0x5b7b3a==='object'&&_0x5b7b3a[_0x391722(0x1b2)]&&(_0x417af7[_0x2c3372]=_0x5b7b3a);}const _0x4bc75b=_0x14dddd[_0x391722(0x1c0)]||undefined,_0xe3eeea=Object[_0x391722(0x1f1)](_0x417af7)[_0x391722(0x1e5)]>0x0,_0x3df9c7=_0x119e5e[_0x391722(0x1cd)]||env(_0x391722(0x1c8))||undefined,_0x5bc8bc=_0x3df9c7||_0x4bc75b||undefined,_0x266ce3=_0x119e5e[_0x391722(0x1b2)]||env('APPCODE')||undefined,_0x47fcc3=_0x266ce3?Object[_0x391722(0x1c5)](_0x417af7)['find'](([,_0x14f2ae])=>_0x14f2ae?.['appcode']===_0x266ce3):undefined,_0x18540f=_0x47fcc3?.[0x0],_0x1b5cb4=_0x47fcc3?.[0x1];let _0x71ee92=_0x266ce3?_0x18540f:_0x5bc8bc,_0x2faf36=_0x71ee92&&_0x417af7[_0x71ee92]?_0x417af7[_0x71ee92]:undefined;_0x266ce3&&_0x1b5cb4&&(_0x2faf36=_0x1b5cb4);const _0x1b28b8=_0x266ce3?_0x1b5cb4??_0x2faf36:_0x2faf36,_0x55cb20=_0x3df9c7||(_0x266ce3?_0x18540f:undefined),_0x2beda9=_0x266ce3||_0x1b28b8?.['appcode']||undefined,_0x2afd07=_0x119e5e[_0x391722(0x1c2)]||env(_0x391722(0x1fd))||_0x1b28b8?.['env']||_0x14dddd[_0x391722(0x1c2)]||DEFAULT_CONFIG_VALUES[_0x391722(0x1c2)],_0x56fb2f=_0x1b28b8?.[_0x391722(0x1d8)]||_0x14dddd[_0x391722(0x1d8)]||DEFAULT_CONFIG_VALUES[_0x391722(0x1d8)],_0x302584=env('COOKIE')||_0x1b28b8?.[_0x391722(0x1e9)]||_0x14dddd[_0x391722(0x1e9)]||undefined,_0x4e873a=env(_0x391722(0x1cb))||_0x1b28b8?.[_0x391722(0x1d0)]||_0x14dddd['accessKey']||undefined,_0x5cd364=_0x119e5e[_0x391722(0x1f7)]||env(_0x391722(0x1c1))||_0x1b28b8?.[_0x391722(0x1f7)]||_0x14dddd[_0x391722(0x1f7)],_0x4ddbab=normalizeLegacyOutputFormat(_0x5cd364),_0x3edcfd=env(_0x391722(0x1fa))||_0x1b28b8?.[_0x391722(0x1ee)]||_0x14dddd['pageSize'],_0x4f36d0=_0x3edcfd?Number(_0x3edcfd)||undefined:undefined,_0x4ccaca=env(_0x391722(0x1e3))||env(_0x391722(0x1eb))||_0x1b28b8?.[_0x391722(0x1b1)]||_0x14dddd['riskLevel']||_0x14dddd[_0x391722(0x1e6)],_0x550000=_0x4ccaca===_0x391722(0x1d9)||_0x4ccaca===_0x391722(0x1b7)?_0x4ccaca:DEFAULT_CONFIG_VALUES[_0x391722(0x1b1)],_0x2e40d6=env(_0x391722(0x1d3)),_0x5d0b26=_0x2e40d6==='1'||_0x2e40d6===_0x391722(0x1d7),_0x28cdec=_0x1b28b8?.[_0x391722(0x1c9)]||_0x14dddd[_0x391722(0x1c9)]||DEFAULT_CONFIG_VALUES[_0x391722(0x1c9)],_0x2b9293=isDaily(normalizeEnv(String(_0x2afd07)))?_0x391722(0x1e4):'production';return{'appCode':typeof _0x2beda9===_0x391722(0x1f9)&&_0x2beda9[_0x391722(0x1db)]()?_0x2beda9['trim']():undefined,'env':_0x2b9293,'locale':_0x56fb2f,'cookie':_0x302584,'accessKey':_0x4e873a,'format':_0x4ddbab,'pageSize':_0x4f36d0,'riskLevel':_0x550000,'verbose':_0x5d0b26,'apiDir':_0x28cdec,'apps':_0x417af7,'defaultApp':_0x4bc75b,'currentApp':_0xe3eeea?_0x71ee92:undefined,'explicitAppName':_0x55cb20,'raw':_0x14dddd};}async function buildAuth(_0x4e1d92){const _0x2dcb4b=a135_0x532b73,{getCookie:_0x2d500a}=await import(_0x2dcb4b(0x1e1)),_0x381de3=_0x4e1d92[_0x2dcb4b(0x1e9)]||_0x2d500a(),_0xb248ba=_0x381de3?await getIsSessionValid():![];return{'cookie':_0x381de3,'isLoggedIn':_0xb248ba,async 'getOrLogin'(){const _0x91f723=_0x2dcb4b;if(_0x381de3&&_0xb248ba)return _0x381de3;throw CliErrors[_0x91f723(0x1dc)]();}};}export function resolveApiFilePath(_0x245750,_0x1cb03c){const _0x35a141=a135_0x532b73,_0x563789=resolve(process[_0x35a141(0x1b3)](),_0x245750),_0x52ae12=resolve(_0x563789,_0x35a141(0x1fb));if(!_0x1cb03c)return _0x52ae12;const _0xd938f1=readRawConfig(),_0x420245=_0xd938f1[_0x35a141(0x1d5)]&&typeof _0xd938f1[_0x35a141(0x1d5)]==='object'?_0xd938f1[_0x35a141(0x1d5)]:{},_0x1a3381=Object[_0x35a141(0x1c5)](_0x420245)[_0x35a141(0x1d2)](([,_0x485dc9])=>_0x485dc9?.['appcode']===_0x1cb03c);if(!_0x1a3381)return _0x52ae12;const [_0x2b12ae,_0x18fdd1]=_0x1a3381,_0x514ad9=typeof _0xd938f1[_0x35a141(0x1c0)]==='string'?_0xd938f1[_0x35a141(0x1c0)]:undefined;if(_0x18fdd1?.['apiDir'])return _0x52ae12;if(_0x514ad9&&_0x2b12ae!==_0x514ad9)return resolve(_0x563789,_0x2b12ae+_0x35a141(0x1cf));return _0x52ae12;}
|
|
1
|
+
const a135_0x3fab52=a135_0x4f82;(function(_0x235008,_0x2fc49f){const _0x51e860=a135_0x4f82,_0x2e3472=_0x235008();while(!![]){try{const _0xc0faca=parseInt(_0x51e860(0xc3))/0x1*(-parseInt(_0x51e860(0xdb))/0x2)+parseInt(_0x51e860(0xb6))/0x3*(parseInt(_0x51e860(0xc2))/0x4)+-parseInt(_0x51e860(0xd5))/0x5*(-parseInt(_0x51e860(0xae))/0x6)+parseInt(_0x51e860(0xc6))/0x7*(parseInt(_0x51e860(0xde))/0x8)+-parseInt(_0x51e860(0xee))/0x9*(-parseInt(_0x51e860(0xbd))/0xa)+-parseInt(_0x51e860(0xf2))/0xb*(parseInt(_0x51e860(0xf3))/0xc)+-parseInt(_0x51e860(0xbe))/0xd;if(_0xc0faca===_0x2fc49f)break;else _0x2e3472['push'](_0x2e3472['shift']());}catch(_0x5ff658){_0x2e3472['push'](_0x2e3472['shift']());}}}(a135_0xaf50,0x80204));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(_0x340161){return process.env[`RABETBASE_${_0x340161}`]||process.env[`LOVRABET_${_0x340161}`]||undefined;}export const NEW_CONFIG_NAME=a135_0x3fab52(0xda);export const CONFIG_NAMES=[a135_0x3fab52(0xda),a135_0x3fab52(0xcf),'.lovrabetrc'];export const LEGACY_CONFIG_NAMES=CONFIG_NAMES[a135_0x3fab52(0xed)](_0x35eb89=>_0x35eb89!==NEW_CONFIG_NAME);export function resolveConfigPath(_0x242a2f){for(const _0x14c584 of CONFIG_NAMES){const _0x1c0118=resolve(_0x242a2f,_0x14c584);if(existsSync(_0x1c0118))return _0x1c0118;}return undefined;}export function findProjectRootDirectory(_0x336dc6=process[a135_0x3fab52(0xdf)]()){let _0x117c62=resolve(_0x336dc6);const {root:_0x36ea2e}=parse(_0x117c62),_0x217e43=homedir();while(!![]){if(resolveConfigPath(_0x117c62)){if(_0x117c62===_0x217e43)break;return _0x117c62;}if(_0x117c62===_0x36ea2e||_0x117c62===_0x217e43)break;const _0x2e72f4=dirname(_0x117c62);if(_0x2e72f4===_0x117c62)break;_0x117c62=_0x2e72f4;}return resolve(_0x336dc6);}export async function createContext(_0x547f81){const _0x1fa9ca=a135_0x3fab52,_0x448506=readRawConfig(),_0x36b45f=buildConfig(_0x448506,_0x547f81),{initEnv:_0x5c77f2}=await import(_0x1fa9ca(0xb3));if(_0x36b45f[_0x1fa9ca(0xef)])_0x5c77f2(_0x36b45f[_0x1fa9ca(0xef)]);else _0x547f81['env']&&typeof _0x547f81[_0x1fa9ca(0xef)]==='string'&&_0x5c77f2(_0x547f81[_0x1fa9ca(0xef)]);const {initDomains:_0xb8f47b,getUserDomain:_0x42ecf0,getApiDomain:_0x3676a6}=await import('./constant/domain.js');_0xb8f47b({'apiDomain':_0x448506[_0x1fa9ca(0xab)]||undefined,'userDomain':_0x448506['userDomain']||undefined,'runtimeDomain':_0x448506[_0x1fa9ca(0xd3)]||undefined});const _0x306c77={'apiDomain':_0x3676a6(),'userDomain':_0x42ecf0()},_0xa75589=await buildAuth(_0x36b45f);logger[_0x1fa9ca(0xc7)](process[_0x1fa9ca(0xdf)]());const _0x331d07=(CLI_BIN_NAME+'\x20'+process[_0x1fa9ca(0xc9)][_0x1fa9ca(0xd8)](0x2)[_0x1fa9ca(0xf5)]('\x20'))[_0x1fa9ca(0xe7)]();logger['setRawCommand'](_0x331d07);const {isNonInteractive:_0x5bb980}=await import('./utils/is-non-interactive.js'),_0x3e8220=_0x5bb980(_0x547f81);return{'config':_0x36b45f,'auth':_0xa75589,'logger':logger,'env':_0x306c77,'nonInteractive':_0x3e8220};}export function buildConfigFromFlags(_0x2b571c){return buildConfig(readRawConfig(),_0x2b571c);}export function getProjectConfigPath(){const _0x150139=a135_0x3fab52;return resolveConfigPath(process[_0x150139(0xdf)]());}export function getGlobalConfigPath(){return resolveConfigPath(homedir());}export function isInProject(){return!!getProjectConfigPath();}export function inspectCliConfigJsonFile(_0x420dec){const _0x5daf11=a135_0x3fab52;if(!existsSync(_0x420dec))return{'status':_0x5daf11(0xf1)};try{const _0x5149d1=readFileSync(_0x420dec,{'encoding':_0x5daf11(0xe9)});if(!_0x5149d1?.[_0x5daf11(0xe7)]())return{'status':_0x5daf11(0xcb)};const _0x410c73=JSON[_0x5daf11(0xe5)](_0x5149d1);return{'status':'ok','data':_0x410c73};}catch(_0x490f56){return{'status':_0x5daf11(0xf7),'message':_0x490f56 instanceof Error?_0x490f56[_0x5daf11(0xea)]:String(_0x490f56)};}}function parseCliConfigJsonFile(_0x3f4609,_0x383e83,_0x193828){const _0x535695=a135_0x3fab52,_0x1707ba=inspectCliConfigJsonFile(_0x3f4609);if(_0x1707ba['status']===_0x535695(0xf1)||_0x1707ba['status']===_0x535695(0xcb))return{};if(_0x1707ba[_0x535695(0xaa)]==='ok')return _0x1707ba[_0x535695(0xac)];return _0x383e83===_0x535695(0xf4)&&_0x193828&&console[_0x535695(0xf7)](CLI_BIN_NAME+':\x20'+_0x193828+_0x535695(0xe8)+_0x3f4609+'\x0a\x20\x20'+_0x1707ba[_0x535695(0xea)]),{};}const normalizedWriteCache=new Map();function normalizeLegacyConfigShape(_0x51d4e9){const _0x52210f=a135_0x3fab52;if(!_0x51d4e9||typeof _0x51d4e9!==_0x52210f(0xf9))return{'config':{},'migrated':![]};const _0x490465={..._0x51d4e9},_0x313a64=_0x490465[_0x52210f(0xf8)]&&typeof _0x490465['apps']===_0x52210f(0xf9)?{..._0x490465['apps']}:{},_0x36e5cc=Object[_0x52210f(0xc8)](_0x313a64)[_0x52210f(0xc5)],_0x5a4f83=_0x490465[_0x52210f(0xca)]||_0x490465['app'];let _0x220aa4=![];if(_0x5a4f83&&_0x36e5cc===0x0){const _0x4ffbf7=typeof _0x490465[_0x52210f(0xf0)]===_0x52210f(0xf6)&&_0x490465[_0x52210f(0xf0)]['trim']()?_0x490465['defaultApp']:String(_0x5a4f83)[_0x52210f(0xe7)]();_0x313a64[_0x4ffbf7]={'appcode':String(_0x5a4f83)[_0x52210f(0xe7)](),..._0x490465[_0x52210f(0xef)]!=null?{'env':_0x490465['env']}:{},..._0x490465[_0x52210f(0xe3)]!=null?{'apiDir':_0x490465[_0x52210f(0xe3)]}:{},..._0x490465[_0x52210f(0xba)]!=null?{'cookie':_0x490465[_0x52210f(0xba)]}:{},..._0x490465[_0x52210f(0xbf)]!=null?{'accessKey':_0x490465[_0x52210f(0xbf)]}:{},..._0x490465[_0x52210f(0xb9)]!=null?{'format':_0x490465['format']}:{},..._0x490465[_0x52210f(0xd1)]!=null?{'pageSize':_0x490465[_0x52210f(0xd1)]}:{},..._0x490465[_0x52210f(0xa9)]!=null?{'riskLevel':_0x490465[_0x52210f(0xa9)]}:{},..._0x490465[_0x52210f(0xc4)]!=null?{'locale':_0x490465[_0x52210f(0xc4)]}:{}},_0x490465['apps']=_0x313a64;if(!_0x490465[_0x52210f(0xf0)])_0x490465[_0x52210f(0xf0)]=_0x4ffbf7;_0x220aa4=!![];}return('appcode'in _0x490465||_0x52210f(0xcd)in _0x490465)&&(delete _0x490465[_0x52210f(0xca)],delete _0x490465['app'],_0x220aa4=!![]),{'config':_0x490465,'migrated':_0x220aa4};}function writeNormalizedConfigIfNeeded(_0x10580c,_0xda1f4d){const _0x3941fc=a135_0x3fab52,_0x4e1c34=JSON[_0x3941fc(0xd4)](_0xda1f4d,null,0x2)+'\x0a';if(normalizedWriteCache[_0x3941fc(0xd2)](_0x10580c)===_0x4e1c34)return;writeConfigFile(_0x10580c,_0xda1f4d),normalizedWriteCache['set'](_0x10580c,_0x4e1c34);}function parseAndNormalizeConfig(_0x15caaf,_0x4eeb89,_0x3cd453){const _0x56530b=a135_0x3fab52,_0x4c3936=parseCliConfigJsonFile(_0x15caaf,_0x4eeb89,_0x3cd453),_0x24fa6f=normalizeLegacyConfigShape(_0x4c3936);if(_0x24fa6f[_0x56530b(0xce)])try{writeNormalizedConfigIfNeeded(_0x15caaf,_0x24fa6f[_0x56530b(0xd0)]);}catch{}return _0x24fa6f[_0x56530b(0xd0)];}export function loadRawConfigLayers(_0x2ec146){const _0x51708f=a135_0x3fab52;let _0x429026={},_0x26b901={};const _0x5e3206=resolveConfigPath(homedir());_0x5e3206&&(_0x429026=parseAndNormalizeConfig(_0x5e3206,_0x51708f(0xf4),_0x51708f(0xe6)));const _0x18ea29=_0x2ec146??findProjectRootDirectory(),_0x343af9=resolveConfigPath(_0x18ea29);return _0x343af9&&(_0x26b901=parseAndNormalizeConfig(_0x343af9,_0x51708f(0xf4),_0x51708f(0xd9))),{'globalPath':_0x5e3206,'projectPath':_0x343af9,'globalConfig':_0x429026,'projectConfig':_0x26b901};}function mergeRawConfigLayers(_0x314bdf){const _0x175b22=a135_0x3fab52,{globalConfig:_0x2d2e62,projectConfig:_0x55c739}=_0x314bdf;if(_0x55c739[_0x175b22(0xe1)]===![]){const _0x377eb4={..._0x55c739};delete _0x377eb4['inherit'];const _0x1bf58b=_0x55c739['apps']&&typeof _0x55c739[_0x175b22(0xf8)]===_0x175b22(0xf9)?_0x55c739[_0x175b22(0xf8)]:{};Object[_0x175b22(0xc8)](_0x1bf58b)[_0x175b22(0xc5)]>0x0?_0x377eb4[_0x175b22(0xf8)]=_0x1bf58b:delete _0x377eb4[_0x175b22(0xf8)];if('defaultApp'in _0x55c739)_0x377eb4[_0x175b22(0xf0)]=_0x55c739['defaultApp'];else Object[_0x175b22(0xc8)](_0x1bf58b)['length']>0x0&&(_0x377eb4['defaultApp']=Object[_0x175b22(0xc8)](_0x1bf58b)[0x0]);return _0x377eb4;}const _0x4579ef=_0x2d2e62[_0x175b22(0xf8)]&&typeof _0x2d2e62[_0x175b22(0xf8)]===_0x175b22(0xf9)?_0x2d2e62[_0x175b22(0xf8)]:{},_0x55a2d0=_0x55c739[_0x175b22(0xf8)]&&typeof _0x55c739[_0x175b22(0xf8)]==='object'?_0x55c739[_0x175b22(0xf8)]:{},_0x47f53a={..._0x4579ef,..._0x55a2d0},_0x422ee1={..._0x2d2e62,..._0x55c739};Object[_0x175b22(0xc8)](_0x47f53a)['length']>0x0&&(_0x422ee1[_0x175b22(0xf8)]=_0x47f53a);if(_0x175b22(0xf0)in _0x55c739)_0x422ee1[_0x175b22(0xf0)]=_0x55c739['defaultApp'];else{if(_0x55a2d0&&Object[_0x175b22(0xc8)](_0x55a2d0)[_0x175b22(0xc5)]>0x0)_0x422ee1[_0x175b22(0xf0)]=Object['keys'](_0x55a2d0)[0x0];else{if(_0x2d2e62['defaultApp'])_0x422ee1['defaultApp']=_0x2d2e62[_0x175b22(0xf0)];else{const _0x452780=Object[_0x175b22(0xc8)](_0x4579ef);_0x452780[_0x175b22(0xc5)]>0x0&&(_0x422ee1[_0x175b22(0xf0)]=_0x452780[0x0]);}}}return _0x422ee1;}export function readRawConfigWithLayers(_0xf05dca){const _0x432799=loadRawConfigLayers(_0xf05dca);return{'config':mergeRawConfigLayers(_0x432799),'layers':_0x432799};}export function readRawConfig(_0x4b9c34){return mergeRawConfigLayers(loadRawConfigLayers(_0x4b9c34));}export function getConfigAppCode(_0x2bc039){const _0xae68ca=a135_0x3fab52,_0x650fea=readRawConfig(_0x2bc039);if(_0x650fea[_0xae68ca(0xf8)]&&typeof _0x650fea['apps']===_0xae68ca(0xf9)){const _0x26f403=_0x650fea[_0xae68ca(0xf0)];if(_0x26f403&&_0x650fea[_0xae68ca(0xf8)][_0x26f403]?.[_0xae68ca(0xca)])return String(_0x650fea[_0xae68ca(0xf8)][_0x26f403][_0xae68ca(0xca)])[_0xae68ca(0xe7)]();const _0x565b9e=Object[_0xae68ca(0xdc)](_0x650fea[_0xae68ca(0xf8)])[0x0];if(_0x565b9e?.['appcode'])return String(_0x565b9e['appcode'])['trim']();}const _0x19da05=_0x650fea['appcode']||_0x650fea[_0xae68ca(0xcd)];if(typeof _0x19da05!=='string'||_0x19da05[_0xae68ca(0xe7)]()==='')return undefined;return _0x19da05[_0xae68ca(0xe7)]();}function a135_0xaf50(){const _0x2be28b=['apiDir','https://g.lovrabet.com/dist/lovrabet-skill','parse','Global','trim','\x20config\x20file\x20ignored\x20(invalid\x20JSON\x20or\x20unreadable):\x20','utf8','message','./auth/get-cookie.js','projectConfig','filter','9JLqloS','env','defaultApp','missing','473wZfQZC','96972qNkOnc','warn','join','string','error','apps','object','riskLevel','status','apiDomain','data','find','55086kLaDLT','write','APPCODE','.tmp','-api.ts','./constant/env.js','silent','project','105KFveah','merged','daily','format','cookie','PAGE_SIZE','MAX_RISK','7856770eFvmRu','3182348zAtPqf','accessKey','APP','entries','21512sqPMvI','32887MWRrYy','locale','length','3941KRBUcY','setLogPath','keys','argv','appcode','empty','ENV','app','migrated','.lovrabet.json','config','pageSize','get','runtimeDomain','stringify','225bFJhxS','replace','template_base_url','slice','Project','.rabetbase.json','46ihUatZ','values','FORMAT','6912HnjXiL','cwd','COOKIE','inherit','VERBOSE'];a135_0xaf50=function(){return _0x2be28b;};return a135_0xaf50();}export function getMultiAppConfigs(_0x399f5c=a135_0x3fab52(0xb5),_0x2983f1){const _0x27baff=a135_0x3fab52,_0x376bd7=_0x399f5c===_0x27baff(0xb7)?readRawConfig(_0x2983f1):loadRawConfigLayers(_0x2983f1)[_0x27baff(0xec)],_0x37e3a9=_0x376bd7[_0x27baff(0xf8)];if(!_0x37e3a9||typeof _0x37e3a9!==_0x27baff(0xf9)||Object[_0x27baff(0xc8)](_0x37e3a9)['length']===0x0)return null;const _0x5c68a5=_0x376bd7[_0x27baff(0xf0)];return Object[_0x27baff(0xc1)](_0x37e3a9)['map'](([_0x2f4ccd,_0x1324ce])=>({'name':_0x2f4ccd,'appcode':_0x1324ce?.[_0x27baff(0xca)]||'','isDefault':_0x2f4ccd===_0x5c68a5,'env':_0x1324ce?.[_0x27baff(0xef)],'apiDir':_0x1324ce?.[_0x27baff(0xe3)],'cookie':_0x1324ce?.[_0x27baff(0xba)]||undefined}))[_0x27baff(0xed)](_0x3165a8=>_0x3165a8[_0x27baff(0xca)]);}function a135_0x4f82(_0xe99292,_0x3db45b){_0xe99292=_0xe99292-0xa9;const _0xaf504f=a135_0xaf50();let _0x4f828c=_0xaf504f[_0xe99292];return _0x4f828c;}export function getTemplateBaseUrl(_0x19f761){const _0x25bc74=a135_0x3fab52,_0x5a21f4=readRawConfig(_0x19f761);if(_0x5a21f4['template_base_url']&&typeof _0x5a21f4[_0x25bc74(0xd7)]===_0x25bc74(0xf6))return _0x5a21f4[_0x25bc74(0xd7)][_0x25bc74(0xd6)](/\/$/,'');return _0x25bc74(0xe4);}export function readConfigFile(_0x599b3e){const _0x55e6ba=a135_0x3fab52;return parseAndNormalizeConfig(_0x599b3e,_0x55e6ba(0xb4));}export function writeConfigFile(_0x5cf967,_0x46558c){const _0x7feac=a135_0x3fab52,_0x28ade4=dirname(_0x5cf967);!existsSync(_0x28ade4)&&mkdirSync(_0x28ade4,{'recursive':!![]});const _0x35b486=_0x5cf967+_0x7feac(0xb1);try{writeFileSync(_0x35b486,JSON['stringify'](_0x46558c,null,0x2)+'\x0a',{'encoding':'utf8','mode':0x180}),renameSync(_0x35b486,_0x5cf967);}catch(_0x4f9a47){try{unlinkSync(_0x35b486);}catch{}throw _0x4f9a47;}}export function resolveWriteConfigPath(_0x5072e3){const _0x4b1be8=a135_0x3fab52,_0xa32df7=_0x5072e3===_0x4b1be8(0xb5)?process[_0x4b1be8(0xdf)]():homedir(),_0x112aa0=resolveConfigPath(_0xa32df7);return _0x112aa0??resolve(_0xa32df7,NEW_CONFIG_NAME);}function buildConfig(_0x550ee1,_0xca368c){const _0x10f454=a135_0x3fab52,_0x1e084c={};if(_0x550ee1['apps']&&typeof _0x550ee1[_0x10f454(0xf8)]===_0x10f454(0xf9))for(const [_0x12b453,_0x35a9c9]of Object[_0x10f454(0xc1)](_0x550ee1[_0x10f454(0xf8)])){_0x35a9c9&&typeof _0x35a9c9==='object'&&_0x35a9c9[_0x10f454(0xca)]&&(_0x1e084c[_0x12b453]=_0x35a9c9);}const _0x53e7a2=_0x550ee1[_0x10f454(0xf0)]||undefined,_0x15a571=Object[_0x10f454(0xc8)](_0x1e084c)[_0x10f454(0xc5)]>0x0,_0x2ac291=_0xca368c[_0x10f454(0xcd)]||env(_0x10f454(0xc0))||undefined,_0x2eaae4=_0x2ac291||_0x53e7a2||undefined,_0xba84b8=_0xca368c[_0x10f454(0xca)]||env(_0x10f454(0xb0))||undefined,_0x3dfd7d=_0xba84b8?Object['entries'](_0x1e084c)['find'](([,_0x23fa9f])=>_0x23fa9f?.[_0x10f454(0xca)]===_0xba84b8):undefined,_0x4c20dc=_0x3dfd7d?.[0x0],_0x75babc=_0x3dfd7d?.[0x1];let _0x32a800=_0xba84b8?_0x4c20dc:_0x2eaae4,_0x3f9a85=_0x32a800&&_0x1e084c[_0x32a800]?_0x1e084c[_0x32a800]:undefined;_0xba84b8&&_0x75babc&&(_0x3f9a85=_0x75babc);const _0x1a35c1=_0xba84b8?_0x75babc??_0x3f9a85:_0x3f9a85,_0x3f8243=_0x2ac291||(_0xba84b8?_0x4c20dc:undefined),_0x41ed3b=_0xba84b8||_0x1a35c1?.[_0x10f454(0xca)]||undefined,_0x185861=_0xca368c['env']||env(_0x10f454(0xcc))||_0x1a35c1?.[_0x10f454(0xef)]||_0x550ee1[_0x10f454(0xef)]||DEFAULT_CONFIG_VALUES[_0x10f454(0xef)],_0x26a4fe=_0x1a35c1?.['locale']||_0x550ee1['locale']||DEFAULT_CONFIG_VALUES[_0x10f454(0xc4)],_0x3b9a36=env(_0x10f454(0xe0))||_0x1a35c1?.[_0x10f454(0xba)]||_0x550ee1[_0x10f454(0xba)]||undefined,_0x33633d=env('ACCESS_KEY')||_0x1a35c1?.[_0x10f454(0xbf)]||_0x550ee1['accessKey']||undefined,_0x3294cf=_0xca368c[_0x10f454(0xb9)]||env(_0x10f454(0xdd))||_0x1a35c1?.['format']||_0x550ee1[_0x10f454(0xb9)],_0x35d504=normalizeLegacyOutputFormat(_0x3294cf),_0x5a6b9f=env(_0x10f454(0xbb))||_0x1a35c1?.[_0x10f454(0xd1)]||_0x550ee1[_0x10f454(0xd1)],_0x4f35c7=_0x5a6b9f?Number(_0x5a6b9f)||undefined:undefined,_0x86cb09=env('RISK_LEVEL')||env(_0x10f454(0xbc))||_0x1a35c1?.['riskLevel']||_0x550ee1[_0x10f454(0xa9)]||_0x550ee1['maxRisk'],_0x58873b=_0x86cb09==='read'||_0x86cb09===_0x10f454(0xaf)?_0x86cb09:DEFAULT_CONFIG_VALUES[_0x10f454(0xa9)],_0x32872d=env(_0x10f454(0xe2)),_0x334700=_0x32872d==='1'||_0x32872d==='true',_0x3eec3e=_0x1a35c1?.['apiDir']||_0x550ee1[_0x10f454(0xe3)]||DEFAULT_CONFIG_VALUES[_0x10f454(0xe3)],_0x3f190a=isDaily(normalizeEnv(String(_0x185861)))?_0x10f454(0xb8):'production';return{'appCode':typeof _0x41ed3b===_0x10f454(0xf6)&&_0x41ed3b[_0x10f454(0xe7)]()?_0x41ed3b[_0x10f454(0xe7)]():undefined,'env':_0x3f190a,'locale':_0x26a4fe,'cookie':_0x3b9a36,'accessKey':_0x33633d,'format':_0x35d504,'pageSize':_0x4f35c7,'riskLevel':_0x58873b,'verbose':_0x334700,'apiDir':_0x3eec3e,'apps':_0x1e084c,'defaultApp':_0x53e7a2,'currentApp':_0x15a571?_0x32a800:undefined,'explicitAppName':_0x3f8243,'raw':_0x550ee1};}async function buildAuth(_0x562ed4){const _0x1387b4=a135_0x3fab52,{getCookie:_0xa87649}=await import(_0x1387b4(0xeb)),_0x58d4b1=_0x562ed4[_0x1387b4(0xba)]||_0xa87649(),_0x5a4f64=_0x58d4b1?await getIsSessionValid():![];return{'cookie':_0x58d4b1,'isLoggedIn':_0x5a4f64,async 'getOrLogin'(){if(_0x58d4b1&&_0x5a4f64)return _0x58d4b1;throw CliErrors['authRequired']();}};}export function resolveApiFilePath(_0x2709d6,_0x21856d){const _0x2c6cbd=a135_0x3fab52,_0x5133b4=resolve(process[_0x2c6cbd(0xdf)](),_0x2709d6),_0x13e953=resolve(_0x5133b4,'api.ts');if(!_0x21856d)return _0x13e953;const _0x350dcf=readRawConfig(),_0x5e1fdd=_0x350dcf[_0x2c6cbd(0xf8)]&&typeof _0x350dcf[_0x2c6cbd(0xf8)]==='object'?_0x350dcf[_0x2c6cbd(0xf8)]:{},_0x460692=Object['entries'](_0x5e1fdd)[_0x2c6cbd(0xad)](([,_0x30874d])=>_0x30874d?.[_0x2c6cbd(0xca)]===_0x21856d);if(!_0x460692)return _0x13e953;const [_0x11c0d7,_0x17c720]=_0x460692,_0x4e4727=typeof _0x350dcf['defaultApp']===_0x2c6cbd(0xf6)?_0x350dcf[_0x2c6cbd(0xf0)]:undefined;if(_0x17c720?.['apiDir'])return _0x13e953;if(_0x4e4727&&_0x11c0d7!==_0x4e4727)return resolve(_0x5133b4,_0x11c0d7+_0x2c6cbd(0xb2));return _0x13e953;}
|