@lovrabet/rabetbase-cli 2.1.1 → 2.1.2-beta.0
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 -0
- 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 -0
- 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 -0
- 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/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/new.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/dataset/detail.js +1 -1
- package/lib/commands/dataset/index.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/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/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/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/save.js +1 -1
- package/lib/commands/sql/shared.js +1 -1
- package/lib/commands/sql/validate.js +1 -1
- package/lib/config/schema.js +1 -0
- package/lib/constant/cli.js +1 -1
- package/lib/constant/defaults.js +1 -0
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/constant/output.js +1 -0
- package/lib/constant/paths.js +1 -1
- package/lib/constant/risk.js +1 -0
- 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/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 -0
- 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/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/config.js +1 -1
- package/lib/utils/copy-directory.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/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 +3 -2
- package/lib/commands/api/doc.js +0 -1
- package/lib/commands/app/remote.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a101_0x5a1b(){const _0x435f45=['join','100578EDhFLi','replace','.sql','524063WsHCwz','sqlContent','trimEnd','endsWith','6615288ktwEuJ','888660nHnOFO','--\x20@lovrabet.sqlName:\x20','145pYkfAM','2451460udHCTs','sqlCode','77240vzzwBv','trim','sqlName','.rabetbase/sql','description','99046zIgWHu','set','18zeRJfh','98bzvusA','has','unnamed'];a101_0x5a1b=function(){return _0x435f45;};return a101_0x5a1b();}const a101_0xe19a4e=a101_0x1c80;(function(_0x3d45e8,_0x4a738d){const _0x4d7d40=a101_0x1c80,_0x3e3d9b=_0x3d45e8();while(!![]){try{const _0x492e7f=-parseInt(_0x4d7d40(0xe0))/0x1+parseInt(_0x4d7d40(0xd6))/0x2*(parseInt(_0x4d7d40(0xd8))/0x3)+-parseInt(_0x4d7d40(0xcc))/0x4+-parseInt(_0x4d7d40(0xce))/0x5*(-parseInt(_0x4d7d40(0xdd))/0x6)+-parseInt(_0x4d7d40(0xd9))/0x7*(parseInt(_0x4d7d40(0xd1))/0x8)+parseInt(_0x4d7d40(0xcb))/0x9+-parseInt(_0x4d7d40(0xcf))/0xa;if(_0x492e7f===_0x4a738d)break;else _0x3e3d9b['push'](_0x3e3d9b['shift']());}catch(_0x1a9286){_0x3e3d9b['push'](_0x3e3d9b['shift']());}}}(a101_0x5a1b,0x5fa49));function a101_0x1c80(_0x5f3af7,_0x1f899d){_0x5f3af7=_0x5f3af7-0xca;const _0x5a1be9=a101_0x5a1b();let _0x1c8096=_0x5a1be9[_0x5f3af7];return _0x1c8096;}import{join}from'node:path';export const SQL_LOCAL_REL_DIR=a101_0xe19a4e(0xd4);export function resolveSqlLocalDir(_0x2ae508){return join(_0x2ae508,SQL_LOCAL_REL_DIR);}export function safeSqlFileBaseName(_0x5ba10a){const _0x8fbf16=a101_0xe19a4e,_0x45b473=_0x5ba10a['trim']()||_0x8fbf16(0xdb),_0x45adeb=_0x45b473[_0x8fbf16(0xde)](/[/\\?%*:|"<>]/g,'_')['replace'](/\s+/g,'_')[_0x8fbf16(0xde)](/_+/g,'_');return _0x45adeb||_0x8fbf16(0xdb);}export function assignSqlFileNames(_0x2b0c88){const _0x29d85b=a101_0xe19a4e,_0x2911bb=new Map();for(const _0x4ed588 of _0x2b0c88){const _0x5f3df7=safeSqlFileBaseName(_0x4ed588[_0x29d85b(0xd3)]??_0x29d85b(0xdb));let _0x1fcb53=_0x5f3df7+'.sql';if(_0x2911bb[_0x29d85b(0xda)](_0x1fcb53)){const _0x34f39f=(_0x4ed588[_0x29d85b(0xd0)]??'unknown')[_0x29d85b(0xde)](/-/g,'');_0x1fcb53=_0x5f3df7+'__'+_0x34f39f+_0x29d85b(0xdf);}let _0x518ce0=0x0,_0x757071=_0x1fcb53;while(_0x2911bb[_0x29d85b(0xda)](_0x757071)){_0x518ce0++,_0x757071=_0x5f3df7+'__'+_0x518ce0+'.sql';}_0x2911bb[_0x29d85b(0xd7)](_0x757071,_0x4ed588);}return _0x2911bb;}export function buildPulledSqlFileContent(_0x51014f){const _0x2380f2=a101_0xe19a4e,_0x43c716=_0x51014f[_0x2380f2(0xd3)]??'unnamed',_0x3ace60=_0x51014f['sqlCode']??'',_0x4e8c6c=(_0x51014f[_0x2380f2(0xd5)]??'')[_0x2380f2(0xde)](/\r?\n/g,'\x20')[_0x2380f2(0xd2)](),_0x41f67c=_0x51014f[_0x2380f2(0xe1)]??'',_0x2a9bf5=[_0x2380f2(0xcd)+_0x43c716,'--\x20@lovrabet.sqlCode:\x20'+_0x3ace60,'--\x20@lovrabet.description:'+(_0x4e8c6c?'\x20'+_0x4e8c6c:''),'',_0x41f67c[_0x2380f2(0xe2)]()],_0x1ac08f=_0x2a9bf5[_0x2380f2(0xdc)]('\x0a');return _0x1ac08f[_0x2380f2(0xca)]('\x0a')?_0x1ac08f:_0x1ac08f+'\x0a';}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a102_0x2d6cec=a102_0x55b0;(function(_0x12c6b6,_0x1e712a){const _0x5e2f6a=a102_0x55b0,_0x2794ea=_0x12c6b6();while(!![]){try{const _0x2e69b7=parseInt(_0x5e2f6a(0x86))/0x1*(parseInt(_0x5e2f6a(0x76))/0x2)+parseInt(_0x5e2f6a(0x8c))/0x3+-parseInt(_0x5e2f6a(0x89))/0x4+parseInt(_0x5e2f6a(0x87))/0x5+parseInt(_0x5e2f6a(0x7d))/0x6+-parseInt(_0x5e2f6a(0x73))/0x7+-parseInt(_0x5e2f6a(0x9d))/0x8*(parseInt(_0x5e2f6a(0x82))/0x9);if(_0x2e69b7===_0x1e712a)break;else _0x2794ea['push'](_0x2794ea['shift']());}catch(_0x21bdc5){_0x2794ea['push'](_0x2794ea['shift']());}}}(a102_0x38a2,0x40a8f));function a102_0x38a2(){const _0xe7bcab=['valid','1523382flBWJF','name','parameters','304ozteEz','Comma-separated\x20dataset\x20codes\x20to\x20cross-check\x20table/column\x20names\x20against','length','reason','Validate\x20SQL\x20content\x20without\x20saving\x20(type\x20detection,\x20parameter\x20extraction,\x20optional\x20schema\x20check)','tables','from','337212VErvpz','tableName','fields','Inline\x20SQL\x20content\x20to\x20validate\x20(alternative\x20to\x20--file)','schema:','337437vMAoSQ','flagMissing','str','isDangerous','1612xgUkiA','1991860iezHIX','schemas','1158136WKglGz','sql','sqlType','667143xyGQOD','message','schemaWarnings','dbtableConfig','toLowerCase','utf-8','map','isSelectOnly','split','Dataset\x20\x22','push','Provide\x20--file\x20or\x20--sql','trim','file','isArray','type','validate','32YgnEFg','size','Table\x20\x22','File\x20not\x20found:\x20','\x22\x20not\x20found\x20in\x20any\x20dataset','filter','string','\x22\x20not\x20found\x20or\x20not\x20accessible','Path\x20to\x20the\x20SQL\x20file\x20to\x20validate'];a102_0x38a2=function(){return _0xe7bcab;};return a102_0x38a2();}import{readFileSync,existsSync}from'node:fs';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';function a102_0x55b0(_0x49b1b2,_0x4e799f){_0x49b1b2=_0x49b1b2-0x70;const _0x38a209=a102_0x38a2();let _0x55b0ad=_0x38a209[_0x49b1b2];return _0x55b0ad;}export const sqlValidate={'service':'sql','command':a102_0x2d6cec(0x9c),'description':a102_0x2d6cec(0x7a),'risk':'read','flags':[{'name':a102_0x2d6cec(0x99),'type':a102_0x2d6cec(0xa3),'description':a102_0x2d6cec(0x71)},{'name':'sql','type':a102_0x2d6cec(0xa3),'description':a102_0x2d6cec(0x80)},{'name':'schemas','type':'string','description':a102_0x2d6cec(0x77)}],async 'execute'(_0x2c061b){const _0x328dbe=a102_0x2d6cec,_0x673552=_0x2c061b[_0x328dbe(0x84)]('file'),_0x4c90a4=_0x2c061b['str'](_0x328dbe(0x8a));if(!_0x673552&&!_0x4c90a4)throw CliErrors[_0x328dbe(0x83)](_0x328dbe(0x99),_0x328dbe(0x97));let _0x2bafe4;if(_0x673552){const _0x35bbe5=resolve(process['cwd'](),_0x673552);if(!existsSync(_0x35bbe5))throw CliErrors['validation'](_0x328dbe(0xa0)+_0x35bbe5);_0x2bafe4=readFileSync(_0x35bbe5,_0x328dbe(0x91));}else _0x2bafe4=_0x4c90a4;const _0x3f06f9=validateSql(_0x2bafe4),_0x107dcf={'valid':_0x3f06f9[_0x328dbe(0x72)],'sqlType':_0x3f06f9[_0x328dbe(0x8b)][_0x328dbe(0x9b)],'isSelectOnly':_0x3f06f9[_0x328dbe(0x8b)][_0x328dbe(0x93)],'isDangerous':_0x3f06f9[_0x328dbe(0x8b)][_0x328dbe(0x85)],'tables':_0x3f06f9[_0x328dbe(0x7b)],'parameters':_0x3f06f9[_0x328dbe(0x75)],'message':_0x3f06f9[_0x328dbe(0x8d)]};_0x3f06f9[_0x328dbe(0x8b)]['reason']&&(_0x107dcf['reason']=_0x3f06f9[_0x328dbe(0x8b)][_0x328dbe(0x79)]);const _0x181740=_0x2c061b[_0x328dbe(0x84)](_0x328dbe(0x88));if(_0x181740&&_0x3f06f9[_0x328dbe(0x72)]){const _0x22abd0=_0x181740[_0x328dbe(0x94)](',')[_0x328dbe(0x92)](_0x3d248d=>_0x3d248d[_0x328dbe(0x98)]())[_0x328dbe(0xa2)](Boolean),_0x2a2850=[],_0x180471=await listDatasets(_0x2c061b['appCode']),_0xedef41=new Map(_0x180471[_0x328dbe(0x92)](_0x2c79bf=>[_0x2c79bf[_0x328dbe(0x8f)]?.['tableName']?.['toLowerCase'](),_0x2c79bf]));for(const _0x1b86de of _0x3f06f9[_0x328dbe(0x7b)]){const _0x4727ce=_0xedef41['get'](_0x1b86de[_0x328dbe(0x90)]());!_0x4727ce&&_0x2a2850[_0x328dbe(0x96)](_0x328dbe(0x9f)+_0x1b86de+_0x328dbe(0xa1));}for(const _0x240511 of _0x22abd0){try{const _0x3f607b=await getDatasetDetail(_0x240511),_0x1c42b3=Array[_0x328dbe(0x9a)](_0x3f607b[_0x328dbe(0x7f)])?_0x3f607b[_0x328dbe(0x7f)]:[],_0x3903d6=new Set(_0x1c42b3[_0x328dbe(0x92)](_0x449a98=>_0x449a98[_0x328dbe(0x74)]?.[_0x328dbe(0x90)]())),_0x3664a3=_0x3f607b['dbtableConfig']?.[_0x328dbe(0x7e)]||_0x3f607b[_0x328dbe(0x7e)]||_0x240511;_0x107dcf[_0x328dbe(0x81)+_0x3664a3]={'code':_0x240511,'tableName':_0x3664a3,'fieldCount':_0x3903d6[_0x328dbe(0x9e)],'fields':Array[_0x328dbe(0x7c)](_0x3903d6)};}catch{_0x2a2850[_0x328dbe(0x96)](_0x328dbe(0x95)+_0x240511+_0x328dbe(0x70));}}_0x2a2850[_0x328dbe(0x78)]>0x0&&(_0x107dcf[_0x328dbe(0x8e)]=_0x2a2850);}return{'ok':_0x3f06f9[_0x328dbe(0x72)],'data':_0x107dcf,'message':_0x3f06f9['message']};}};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const a103_0x3349bb=a103_0x3a7d;(function(_0x348c81,_0x5a8d49){const _0x3f2fbc=a103_0x3a7d,_0x919f74=_0x348c81();while(!![]){try{const _0x3314cb=parseInt(_0x3f2fbc(0x1e0))/0x1+parseInt(_0x3f2fbc(0x1f7))/0x2+-parseInt(_0x3f2fbc(0x1e5))/0x3*(-parseInt(_0x3f2fbc(0x1fe))/0x4)+-parseInt(_0x3f2fbc(0x1ee))/0x5+-parseInt(_0x3f2fbc(0x1fd))/0x6*(-parseInt(_0x3f2fbc(0x1eb))/0x7)+-parseInt(_0x3f2fbc(0x1f0))/0x8*(parseInt(_0x3f2fbc(0x1e8))/0x9)+-parseInt(_0x3f2fbc(0x1e9))/0xa*(-parseInt(_0x3f2fbc(0x1f9))/0xb);if(_0x3314cb===_0x5a8d49)break;else _0x919f74['push'](_0x919f74['shift']());}catch(_0x2bb1f2){_0x919f74['push'](_0x919f74['shift']());}}}(a103_0x430f,0x65d69));function a103_0x3a7d(_0x1896da,_0x5c0c3e){_0x1896da=_0x1896da-0x1df;const _0x430f8e=a103_0x430f();let _0x3a7d04=_0x430f8e[_0x1896da];return _0x3a7d04;}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=[a103_0x3349bb(0x1e6),a103_0x3349bb(0x1fa),a103_0x3349bb(0x1ff),a103_0x3349bb(0x201),'riskLevel'];export const TOP_LEVEL_CONFIG_KEYS=new Set([a103_0x3349bb(0x206),a103_0x3349bb(0x1e1),a103_0x3349bb(0x1ff),a103_0x3349bb(0x201),a103_0x3349bb(0x1e6),a103_0x3349bb(0x1fa),'apiDir']);export const CONFIG_ENUM_VALUES={'env':[...RABETBASE_ENV_VALUES],'format':[...RABETBASE_OUTPUT_FORMAT_VALUES]};export function formatConfigKeyList(_0xdbfd42){return[..._0xdbfd42]['join'](',\x20');}export function getTopLevelConfigKeyList(){return[...TOP_LEVEL_CONFIG_KEYS];}export function isTopLevelConfigKey(_0x359f0b){const _0x437c5f=a103_0x3349bb;return TOP_LEVEL_CONFIG_KEYS[_0x437c5f(0x1f5)](_0x359f0b);}export function getTopLevelConfigKeySummary(){return formatConfigKeyList(getTopLevelConfigKeyList());}export function getConfigCommandKeyDescription(){const _0x425e80=a103_0x3349bb;return _0x425e80(0x202)+getTopLevelConfigKeySummary()+')';}function a103_0x430f(){const _0x14690d=['format','Config\x20key\x20(','API\x20directory\x20path','apps','pageSize','appcode','Default\x20page\x20size','216252QMmfKr','env','apiDir','defaultFormat','Default\x20output\x20format\x20for\x20this\x20app\x20(profile)','4443vODplT','cookie','app','7390179waKsWe','10HLKNWY','Target\x20environment','7HOWRYc','Locale','zh-CN','3662530SVMPIh','en-US','8tSFZug','length','riskLevel','Auth\x20cookie','filter','has','number','765814AASZNU','trim','6107277VyfxEc','accessKey','Risk\x20level','inherit','4196406iesFqc','316WLIhGc','locale','string'];a103_0x430f=function(){return _0x14690d;};return a103_0x430f();}export const APP_PROFILE_FLAG_KEY_MAP={'env':a103_0x3349bb(0x1e1),'apiDir':a103_0x3349bb(0x1e2),'cookie':a103_0x3349bb(0x1e6),'accessKey':a103_0x3349bb(0x1fa),'defaultFormat':a103_0x3349bb(0x201),'pageSize':a103_0x3349bb(0x205),'riskLevel':'riskLevel','locale':a103_0x3349bb(0x1ff)};export function getAppProfileFlagDefs(){const _0x547afc=a103_0x3349bb;return[{'name':_0x547afc(0x1e1),'type':'string','description':_0x547afc(0x1ea),'enum':[...RABETBASE_ENV_VALUES]},{'name':_0x547afc(0x1e2),'type':_0x547afc(0x200),'description':_0x547afc(0x203)},{'name':_0x547afc(0x1e6),'type':_0x547afc(0x200),'description':_0x547afc(0x1f3),'hidden':!![]},{'name':_0x547afc(0x1fa),'type':_0x547afc(0x200),'description':'Access\x20key','hidden':!![]},{'name':_0x547afc(0x1e3),'type':_0x547afc(0x200),'description':_0x547afc(0x1e4),'enum':[...RABETBASE_OUTPUT_FORMAT_VALUES]},{'name':'pageSize','type':_0x547afc(0x1f6),'description':_0x547afc(0x1df)},{'name':_0x547afc(0x1f2),'type':_0x547afc(0x200),'description':_0x547afc(0x1fb),'enum':[...RISK_LEVEL_VALUES]},{'name':'locale','type':'string','description':_0x547afc(0x1ec)}];}export function collectAppProfileOverrides(_0x3a9d5b){const _0x132ee6=a103_0x3349bb,_0x4b366b={};for(const [_0x102009,_0x56fa8e]of Object['entries'](APP_PROFILE_FLAG_KEY_MAP)){const _0xd9e912=_0x3a9d5b(_0x102009);if(!_0xd9e912)continue;_0x4b366b[_0x56fa8e]=_0x56fa8e===_0x132ee6(0x205)?Number(_0xd9e912):_0xd9e912;}return _0x4b366b;}export function buildAppProfileListFields(_0x287afd){const _0x422303=a103_0x3349bb;return{'env':_0x287afd[_0x422303(0x1e1)]??null,'apiDir':_0x287afd['apiDir']??null,'hasCookie':!!_0x287afd['cookie'],'hasAccessKey':!!_0x287afd['accessKey'],'format':_0x287afd[_0x422303(0x201)]??null,'pageSize':_0x287afd['pageSize']??null,'riskLevel':_0x287afd[_0x422303(0x1f2)]??null,'locale':_0x287afd[_0x422303(0x1ff)]??null};}export function buildAppDoctorFields(_0x20508d,_0x3abb8d){const _0x490a11=a103_0x3349bb;return{'env':{'value':_0x20508d[_0x490a11(0x1e1)]||_0x3abb8d['env'],'source':_0x20508d[_0x490a11(0x1e1)]?_0x490a11(0x1e7):_0x490a11(0x1fc)},'apiDir':{'value':_0x20508d['apiDir']||_0x3abb8d[_0x490a11(0x1e2)],'source':_0x20508d[_0x490a11(0x1e2)]?'app':'inherit'},'cookie':{'value':_0x20508d['cookie']||_0x3abb8d['cookie'],'source':_0x20508d[_0x490a11(0x1e6)]?_0x490a11(0x1e7):'inherit'},'accessKey':{'value':_0x20508d[_0x490a11(0x1fa)]||_0x3abb8d[_0x490a11(0x1fa)],'source':_0x20508d[_0x490a11(0x1fa)]?_0x490a11(0x1e7):'inherit'}};}export function buildCanonicalAppConfig(_0xa4f799,_0x2fbe03){const _0x47fe2f=a103_0x3349bb,_0x3fa2fd=_0xa4f799['map'](_0x4ce38b=>String(_0x4ce38b||'')[_0x47fe2f(0x1f8)]())[_0x47fe2f(0x1f4)](Boolean);if(_0x3fa2fd[_0x47fe2f(0x1f1)]===0x0)return{};const _0x8920fe={};for(const _0x36a8e2 of _0x3fa2fd){_0x8920fe[_0x36a8e2]=_0x2fbe03?{'appcode':_0x36a8e2,'env':_0x2fbe03}:{'appcode':_0x36a8e2};}return{'apps':_0x8920fe,'defaultApp':_0x3fa2fd[0x0]};}export function buildCanonicalProjectConfig(_0x5deae2,_0x28c4e0){const _0x10dca5=a103_0x3349bb,{appCodes:appCodes=[],env:_0x3e19cf,metadata:_0x17e4b5}=_0x28c4e0,_0xe743c8={..._0x5deae2,..._0x17e4b5||{}};delete _0xe743c8['appcode'],delete _0xe743c8[_0x10dca5(0x1e7)];if(_0x3e19cf)_0xe743c8[_0x10dca5(0x1e1)]=_0x3e19cf;else!_0xe743c8[_0x10dca5(0x1e1)]&&(_0xe743c8[_0x10dca5(0x1e1)]=DEFAULT_CONFIG_VALUES[_0x10dca5(0x1e1)]);const _0x1cc1e3=buildCanonicalAppConfig(appCodes,_0xe743c8[_0x10dca5(0x1e1)]);return Object['keys'](_0x1cc1e3)[_0x10dca5(0x1f1)]>0x0&&(_0xe743c8[_0x10dca5(0x204)]=_0x1cc1e3[_0x10dca5(0x204)],_0xe743c8['defaultApp']=_0x1cc1e3['defaultApp']),_0xe743c8;}const LOCALE_MAP={'zh':'zh-CN','zh-cn':a103_0x3349bb(0x1ed),'zh_cn':a103_0x3349bb(0x1ed),'en':'en-US','en-us':a103_0x3349bb(0x1ef),'en_us':'en-US'};export function normalizeLocale(_0x598c7e){if(!_0x598c7e)return null;return LOCALE_MAP[_0x598c7e['toLowerCase']()]??null;}
|
package/lib/constant/cli.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a104_0x5000bb=a104_0xc000;(function(_0x107066,_0x44a69d){const _0x231c25=a104_0xc000,_0x2f54af=_0x107066();while(!![]){try{const _0x169d34=parseInt(_0x231c25(0x115))/0x1*(-parseInt(_0x231c25(0x153))/0x2)+-parseInt(_0x231c25(0x10e))/0x3+-parseInt(_0x231c25(0x15d))/0x4+parseInt(_0x231c25(0x138))/0x5*(parseInt(_0x231c25(0x117))/0x6)+-parseInt(_0x231c25(0x151))/0x7*(-parseInt(_0x231c25(0x135))/0x8)+-parseInt(_0x231c25(0x134))/0x9+parseInt(_0x231c25(0x10d))/0xa*(parseInt(_0x231c25(0x130))/0xb);if(_0x169d34===_0x44a69d)break;else _0x2f54af['push'](_0x2f54af['shift']());}catch(_0x216a11){_0x2f54af['push'](_0x2f54af['shift']());}}}(a104_0xee9a,0xd9840));function a104_0xc000(_0xf09550,_0x598a0c){_0xf09550=_0xf09550-0x109;const _0xee9a06=a104_0xee9a();let _0xc000e=_0xee9a06[_0xf09550];return _0xc000e;}function a104_0xee9a(){const _0x2fe0a3=['Output\x20path','yes','nonInteractive','Type\x20filter','keyword','map','operation','format','key','Use\x20remote','force','global','6587wpGWUQ','string','2DRVRbz','DB\x20ID','@lovrabet/rabetbase-cli','functionNode','SQL\x20string','Page\x20size','project','operationType','params','meowKey','123436JuwdCE','SQL\x20name','Page\x20number','env','Config\x20value','dbid','rabetbase','operation-type','verbose','output','Use\x20project\x20config\x20scope','pagesize','app','remote','Target\x20path','Output\x20format','2830350SxLvPG','2118048PvLrqU','Operation\x20type','json\x20|\x20pretty\x20|\x20compress','value','Dataset\x20code','name','Use\x20global\x20config\x20scope','1323919qWXBdd','<expr>','9783282FpdGdJ','non-interactive','sqlname','code','page','clear','sql','enable-bff-save','Force\x20overwrite','production\x20|\x20daily','Skip\x20import\x20generation','SQL\x20code','<code>','Select\x20app\x20profile\x20by\x20name','appcode','Keyword\x20filter','Clear','Enable\x20BFF\x20save','file','Watch\x20mode','Force\x20non-interactive\x20mode\x20(CI)','all','watch','enableBffSave','JSON\x20params','55SuxMJS','type','Alias\x20for\x20--non-interactive','Record\x20ID','13735674ZfVvst','12176URkqsT','Environment','Filter\x20JSON\x20output\x20(bundled\x20jq\x20via\x20node-jq,\x20else\x20PATH;\x20use\x20with\x20--format\x20json\x20or\x20compress)','5wrpTPo','Apply\x20to\x20all','Description','skip-imports','Rabetbase\x20CLI','dry-run','dryRun','help','schemas','Verbose\x20output','boolean','Override\x20appcode','datasetcode'];a104_0xee9a=function(){return _0x2fe0a3;};return a104_0xee9a();}export const CLI_BIN_NAME=a104_0x5000bb(0x163);export const CLI_DISPLAY_NAME=a104_0x5000bb(0x13c);export const NPM_PACKAGE_NAME=a104_0x5000bb(0x155);export const GLOBAL_FLAGS=[{'name':a104_0x5000bb(0x125),'meowKey':a104_0x5000bb(0x125),'type':a104_0x5000bb(0x152),'description':a104_0x5000bb(0x143),'hint':a104_0x5000bb(0x123)},{'name':a104_0x5000bb(0x109),'meowKey':a104_0x5000bb(0x109),'type':a104_0x5000bb(0x152),'description':a104_0x5000bb(0x124),'hint':'<name>'},{'name':a104_0x5000bb(0x160),'meowKey':'env','type':a104_0x5000bb(0x152),'description':a104_0x5000bb(0x136),'hint':a104_0x5000bb(0x120)},{'name':a104_0x5000bb(0x14c),'meowKey':a104_0x5000bb(0x14c),'type':'string','description':a104_0x5000bb(0x10c),'hint':a104_0x5000bb(0x110)},{'name':'jq','meowKey':'jq','type':a104_0x5000bb(0x152),'description':a104_0x5000bb(0x137),'hint':a104_0x5000bb(0x116)},{'name':'dry-run','meowKey':a104_0x5000bb(0x13e),'type':a104_0x5000bb(0x142),'description':'Preview\x20operation\x20without\x20executing'},{'name':a104_0x5000bb(0x146),'meowKey':a104_0x5000bb(0x146),'type':a104_0x5000bb(0x142),'description':'Skip\x20confirmation\x20for\x20high-risk\x20writes'},{'name':a104_0x5000bb(0x118),'meowKey':a104_0x5000bb(0x147),'type':a104_0x5000bb(0x142),'description':a104_0x5000bb(0x12b)},{'name':a104_0x5000bb(0x150),'meowKey':'global','type':'boolean','description':a104_0x5000bb(0x114)},{'name':'project','meowKey':a104_0x5000bb(0x159),'type':a104_0x5000bb(0x142),'description':a104_0x5000bb(0x167)},{'name':'ci','meowKey':'ci','type':a104_0x5000bb(0x142),'description':a104_0x5000bb(0x132),'hidden':!![]},{'name':a104_0x5000bb(0x13f),'meowKey':a104_0x5000bb(0x13f),'type':a104_0x5000bb(0x142),'description':'Show\x20help'},{'name':a104_0x5000bb(0x113),'meowKey':a104_0x5000bb(0x113),'type':a104_0x5000bb(0x152),'description':'Name','hidden':!![]},{'name':a104_0x5000bb(0x11c),'meowKey':a104_0x5000bb(0x11c),'type':a104_0x5000bb(0x142),'description':a104_0x5000bb(0x127),'hidden':!![]},{'name':a104_0x5000bb(0x12d),'meowKey':'watch','type':'boolean','description':a104_0x5000bb(0x12a),'hidden':!![]},{'name':'output','meowKey':a104_0x5000bb(0x166),'type':a104_0x5000bb(0x152),'description':a104_0x5000bb(0x145),'hidden':!![]},{'name':a104_0x5000bb(0x15b),'meowKey':a104_0x5000bb(0x15b),'type':a104_0x5000bb(0x152),'description':a104_0x5000bb(0x12f),'hidden':!![]},{'name':'datasetcode','meowKey':a104_0x5000bb(0x144),'type':'string','description':a104_0x5000bb(0x112),'hidden':!![]},{'name':a104_0x5000bb(0x12c),'meowKey':a104_0x5000bb(0x12c),'type':a104_0x5000bb(0x142),'description':a104_0x5000bb(0x139),'hidden':!![]},{'name':a104_0x5000bb(0x11e),'meowKey':a104_0x5000bb(0x12e),'type':'boolean','description':a104_0x5000bb(0x128),'hidden':!![]},{'name':'id','meowKey':'id','type':a104_0x5000bb(0x152),'description':a104_0x5000bb(0x133),'hidden':!![]},{'name':a104_0x5000bb(0x131),'meowKey':a104_0x5000bb(0x131),'type':a104_0x5000bb(0x152),'description':a104_0x5000bb(0x148),'hidden':!![]},{'name':a104_0x5000bb(0x129),'meowKey':'file','type':a104_0x5000bb(0x152),'description':'File\x20path','hidden':!![]},{'name':'sqlcode','meowKey':'sqlcode','type':a104_0x5000bb(0x152),'description':a104_0x5000bb(0x122),'hidden':!![]},{'name':a104_0x5000bb(0x119),'meowKey':a104_0x5000bb(0x119),'type':a104_0x5000bb(0x152),'description':a104_0x5000bb(0x15e),'hidden':!![]},{'name':a104_0x5000bb(0x162),'meowKey':'dbid','type':'string','description':a104_0x5000bb(0x154),'hidden':!![]},{'name':'description','meowKey':'description','type':a104_0x5000bb(0x152),'description':a104_0x5000bb(0x13a),'hidden':!![]},{'name':'page','meowKey':a104_0x5000bb(0x11b),'type':a104_0x5000bb(0x152),'description':a104_0x5000bb(0x15f),'hidden':!![]},{'name':a104_0x5000bb(0x168),'meowKey':'pagesize','type':a104_0x5000bb(0x152),'description':a104_0x5000bb(0x158),'hidden':!![]},{'name':'keyword','meowKey':a104_0x5000bb(0x149),'type':a104_0x5000bb(0x152),'description':a104_0x5000bb(0x126),'hidden':!![]},{'name':a104_0x5000bb(0x11a),'meowKey':a104_0x5000bb(0x11a),'type':a104_0x5000bb(0x152),'description':'Code\x20filter','hidden':!![]},{'name':'sql','meowKey':a104_0x5000bb(0x11d),'type':a104_0x5000bb(0x152),'description':a104_0x5000bb(0x157),'hidden':!![]},{'name':a104_0x5000bb(0x140),'meowKey':'schemas','type':'string','description':'Schemas','hidden':!![]},{'name':a104_0x5000bb(0x14b),'meowKey':a104_0x5000bb(0x14b),'type':a104_0x5000bb(0x152),'description':a104_0x5000bb(0x10f),'hidden':!![]},{'name':'target','meowKey':'target','type':'string','description':a104_0x5000bb(0x10b),'hidden':!![]},{'name':a104_0x5000bb(0x13b),'meowKey':'skipImports','type':a104_0x5000bb(0x142),'description':a104_0x5000bb(0x121),'hidden':!![]},{'name':a104_0x5000bb(0x14d),'meowKey':a104_0x5000bb(0x14d),'type':a104_0x5000bb(0x152),'description':'Config\x20key','hidden':!![]},{'name':a104_0x5000bb(0x111),'meowKey':a104_0x5000bb(0x111),'type':'string','description':a104_0x5000bb(0x161),'hidden':!![]},{'name':a104_0x5000bb(0x14f),'meowKey':a104_0x5000bb(0x14f),'type':a104_0x5000bb(0x142),'description':a104_0x5000bb(0x11f),'hidden':!![]},{'name':a104_0x5000bb(0x10a),'meowKey':a104_0x5000bb(0x10a),'type':a104_0x5000bb(0x142),'description':a104_0x5000bb(0x14e),'hidden':!![]},{'name':a104_0x5000bb(0x165),'meowKey':a104_0x5000bb(0x165),'type':'boolean','description':a104_0x5000bb(0x141),'hidden':!![]},{'name':a104_0x5000bb(0x164),'meowKey':a104_0x5000bb(0x15a),'type':a104_0x5000bb(0x152),'description':a104_0x5000bb(0x10f),'hidden':!![]},{'name':'function-node','meowKey':a104_0x5000bb(0x156),'type':a104_0x5000bb(0x152),'description':'Function\x20node','hidden':!![]}];export const PIPELINE_FLAG_NAMES=new Set([a104_0x5000bb(0x125),'app',a104_0x5000bb(0x160),a104_0x5000bb(0x14c),'jq',a104_0x5000bb(0x13d),a104_0x5000bb(0x146),'non-interactive','ci']);export function buildMeowFlags(){const _0x16a667=a104_0x5000bb;return Object['fromEntries'](GLOBAL_FLAGS[_0x16a667(0x14a)](_0x15edc2=>[_0x15edc2[_0x16a667(0x15c)],{'type':_0x15edc2[_0x16a667(0x131)]}]));}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const a105_0x3ef1ca=a105_0x355c;function a105_0x355c(_0x4e5d62,_0x1473fa){_0x4e5d62=_0x4e5d62-0x1a1;const _0x5e8c1d=a105_0x5e8c();let _0x355c56=_0x5e8c1d[_0x4e5d62];return _0x355c56;}(function(_0x41312f,_0x1d34df){const _0x44f993=a105_0x355c,_0x1aad24=_0x41312f();while(!![]){try{const _0x35818b=-parseInt(_0x44f993(0x1a1))/0x1*(parseInt(_0x44f993(0x1a6))/0x2)+-parseInt(_0x44f993(0x1ae))/0x3*(parseInt(_0x44f993(0x1a9))/0x4)+parseInt(_0x44f993(0x1a3))/0x5*(parseInt(_0x44f993(0x1aa))/0x6)+parseInt(_0x44f993(0x1ab))/0x7+-parseInt(_0x44f993(0x1ad))/0x8+-parseInt(_0x44f993(0x1a4))/0x9*(parseInt(_0x44f993(0x1ac))/0xa)+parseInt(_0x44f993(0x1af))/0xb;if(_0x35818b===_0x1d34df)break;else _0x1aad24['push'](_0x1aad24['shift']());}catch(_0x51ef03){_0x1aad24['push'](_0x1aad24['shift']());}}}(a105_0x5e8c,0x863f5));import{DEFAULT_API_DIR}from'../constant/paths.js';export const DEFAULT_CONFIG_VALUES={'env':a105_0x3ef1ca(0x1a2),'format':a105_0x3ef1ca(0x1a7),'locale':a105_0x3ef1ca(0x1a8),'riskLevel':a105_0x3ef1ca(0x1a5),'apiDir':DEFAULT_API_DIR};export const DEFAULT_COMMAND_OUTPUT_FORMAT='compress';function a105_0x5e8c(){const _0x57cf91=['production','37745HVNWOq','34866rtlRjF','high-risk-write','426ORfdAC','compress','en-US','4NWMMZn','300LxYgsG','2479715sEEASl','1970uhcMFi','8517296IHFHXR','773823uGgPAB','32712482mnZdls','5023aaAKKo'];a105_0x5e8c=function(){return _0x57cf91;};return a105_0x5e8c();}
|
package/lib/constant/domain.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a106_0x4dc1bc=a106_0xadc4;(function(_0x35723a,_0x1a8e37){const _0x33781b=a106_0xadc4,_0x4f7029=_0x35723a();while(!![]){try{const _0x4544b1=parseInt(_0x33781b(0x96))/0x1*(-parseInt(_0x33781b(0x9a))/0x2)+parseInt(_0x33781b(0x9b))/0x3*(parseInt(_0x33781b(0x9d))/0x4)+parseInt(_0x33781b(0x9e))/0x5+-parseInt(_0x33781b(0x91))/0x6+parseInt(_0x33781b(0x8f))/0x7*(-parseInt(_0x33781b(0x8d))/0x8)+parseInt(_0x33781b(0x9c))/0x9*(-parseInt(_0x33781b(0x99))/0xa)+parseInt(_0x33781b(0x94))/0xb*(parseInt(_0x33781b(0x8e))/0xc);if(_0x4544b1===_0x1a8e37)break;else _0x4f7029['push'](_0x4f7029['shift']());}catch(_0x7a93df){_0x4f7029['push'](_0x4f7029['shift']());}}}(a106_0x7ca0,0xaf36c));import{getEnv,isProduction}from'../constant/env.js';let customApiDomain,customUserDomain,customRuntimeDomain;export function initDomains(_0x5a2862){const _0x311cc1=a106_0xadc4;customApiDomain=_0x5a2862?.['apiDomain'],customUserDomain=_0x5a2862?.[_0x311cc1(0x93)],customRuntimeDomain=_0x5a2862?.[_0x311cc1(0x92)];}export const getUserDomain=()=>customUserDomain||(isProduction(getEnv())?a106_0x4dc1bc(0x97):a106_0x4dc1bc(0x98));export const getApiDomain=()=>customApiDomain||(isProduction(getEnv())?a106_0x4dc1bc(0x95):'https://daily-api.lovrabet.com');export const getRuntimeDomain=()=>customRuntimeDomain||(isProduction(getEnv())?a106_0x4dc1bc(0x90):'https://daily-runtime.lovrabet.com');function a106_0xadc4(_0x1c778b,_0x20e321){_0x1c778b=_0x1c778b-0x8d;const _0x7ca0b1=a106_0x7ca0();let _0xadc46b=_0x7ca0b1[_0x1c778b];return _0xadc46b;}function a106_0x7ca0(){const _0x4197ff=['8GqOuVA','12qxepIt','6278685TWpTzW','https://runtime.lovrabet.com','4203210qNrieF','runtimeDomain','userDomain','13057242ennZbP','https://api.lovrabet.com','5AfmrWX','https://user.lovrabet.com','https://user-daily.lovrabet.com','116590gsZXlP','59026llVbIi','3YIUwdR','99xwuVNB','4902816XjXjIB','891270nbqupD'];a106_0x7ca0=function(){return _0x4197ff;};return a106_0x7ca0();}
|
package/lib/constant/env.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a107_0x1ad1d5=a107_0x976d;(function(_0x375799,_0x397cb6){const _0x3464e6=a107_0x976d,_0x462565=_0x375799();while(!![]){try{const _0x3068db=-parseInt(_0x3464e6(0x19f))/0x1*(-parseInt(_0x3464e6(0x1a8))/0x2)+parseInt(_0x3464e6(0x1a5))/0x3*(-parseInt(_0x3464e6(0x19c))/0x4)+-parseInt(_0x3464e6(0x19a))/0x5*(parseInt(_0x3464e6(0x1a1))/0x6)+parseInt(_0x3464e6(0x1a6))/0x7*(-parseInt(_0x3464e6(0x19b))/0x8)+-parseInt(_0x3464e6(0x197))/0x9*(-parseInt(_0x3464e6(0x1a2))/0xa)+parseInt(_0x3464e6(0x198))/0xb+-parseInt(_0x3464e6(0x1a3))/0xc*(-parseInt(_0x3464e6(0x19d))/0xd);if(_0x3068db===_0x397cb6)break;else _0x462565['push'](_0x462565['shift']());}catch(_0x2b3cc9){_0x462565['push'](_0x462565['shift']());}}}(a107_0xc28f,0x69ee6));function a107_0x976d(_0x18b014,_0x17399f){_0x18b014=_0x18b014-0x197;const _0xc28ffa=a107_0xc28f();let _0x976da4=_0xc28ffa[_0x18b014];return _0x976da4;}export const RABETBASE_ENV_VALUES=[a107_0x1ad1d5(0x1a7),a107_0x1ad1d5(0x1a4)];export function normalizeEnv(_0x35eb4b){const _0x417e3e=a107_0x1ad1d5;return _0x35eb4b===_0x417e3e(0x199)?_0x417e3e(0x1a7):_0x35eb4b;}export function isProduction(_0x1efbf1){return normalizeEnv(_0x1efbf1)==='production';}export function isDaily(_0xa1ece2){const _0x4c8fe3=a107_0x1ad1d5;return normalizeEnv(_0xa1ece2)===_0x4c8fe3(0x1a4);}export function isDev(_0x38fef5){const _0x35ac06=a107_0x1ad1d5,_0x3cdae6=normalizeEnv(_0x38fef5);return _0x3cdae6===_0x35ac06(0x19e)||_0x3cdae6===_0x35ac06(0x1a0);}let env=normalizeEnv(process.env.RABETBASE_ENV||process.env.LOVRABET_ENV||'production');export function getEnv(){return env;}export function initEnv(_0x2f7a05){env=normalizeEnv(_0x2f7a05);}function a107_0xc28f(){const _0x59dbff=['35PHqtyF','811376eDWOoX','5652vdZlQu','14810809ViUNEY','development','1ItfPzd','dev','565368lJoziZ','349730QMkJKU','12djVwof','daily','1245BJuAEm','14TgPJqR','production','479824zCsUss','27HNqCfE','4384655LGwQQf','online'];a107_0xc28f=function(){return _0x59dbff;};return a107_0xc28f();}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function a108_0x39f5(_0x700ba1,_0x2b7c19){_0x700ba1=_0x700ba1-0xed;const _0x1ad9ca=a108_0x1ad9();let _0x39f5d0=_0x1ad9ca[_0x700ba1];return _0x39f5d0;}const a108_0x18fd87=a108_0x39f5;function a108_0x1ad9(){const _0x52f3e5=['28116KzSEKH','160mGesRj','832506GBzquh','115250WPfIez','515exVaNi','compress','5651464gyyBRN','json','2593332JGNtwx','3548676vLNHkF','2vBPDbj','732528iZscOp'];a108_0x1ad9=function(){return _0x52f3e5;};return a108_0x1ad9();}(function(_0x3d10d6,_0x406f88){const _0x2bbada=a108_0x39f5,_0xc5d6bc=_0x3d10d6();while(!![]){try{const _0x1eeb3f=parseInt(_0x2bbada(0xf3))/0x1+-parseInt(_0x2bbada(0xee))/0x2*(parseInt(_0x2bbada(0xf2))/0x3)+parseInt(_0x2bbada(0xed))/0x4+-parseInt(_0x2bbada(0xf4))/0x5*(parseInt(_0x2bbada(0xf0))/0x6)+-parseInt(_0x2bbada(0xf8))/0x7+-parseInt(_0x2bbada(0xf6))/0x8+-parseInt(_0x2bbada(0xef))/0x9*(-parseInt(_0x2bbada(0xf1))/0xa);if(_0x1eeb3f===_0x406f88)break;else _0xc5d6bc['push'](_0xc5d6bc['shift']());}catch(_0x279c91){_0xc5d6bc['push'](_0xc5d6bc['shift']());}}}(a108_0x1ad9,0x722a6));export const RABETBASE_OUTPUT_FORMAT_VALUES=[a108_0x18fd87(0xf7),'pretty',a108_0x18fd87(0xf5)];
|
package/lib/constant/paths.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a109_0x57b156=a109_0x7044;function a109_0x7044(_0x325687,_0x2e09ef){_0x325687=_0x325687-0x1b9;const _0x3d3d4f=a109_0x3d3d();let _0x70441c=_0x3d3d4f[_0x325687];return _0x70441c;}(function(_0x23c500,_0x143ba0){const _0x2cc6c6=a109_0x7044,_0x522271=_0x23c500();while(!![]){try{const _0x4f0aeb=parseInt(_0x2cc6c6(0x1bd))/0x1*(parseInt(_0x2cc6c6(0x1bb))/0x2)+parseInt(_0x2cc6c6(0x1b9))/0x3*(parseInt(_0x2cc6c6(0x1be))/0x4)+parseInt(_0x2cc6c6(0x1bf))/0x5*(parseInt(_0x2cc6c6(0x1c6))/0x6)+parseInt(_0x2cc6c6(0x1c1))/0x7+-parseInt(_0x2cc6c6(0x1ba))/0x8*(-parseInt(_0x2cc6c6(0x1c4))/0x9)+parseInt(_0x2cc6c6(0x1c3))/0xa*(parseInt(_0x2cc6c6(0x1c5))/0xb)+-parseInt(_0x2cc6c6(0x1bc))/0xc*(parseInt(_0x2cc6c6(0x1c0))/0xd);if(_0x4f0aeb===_0x143ba0)break;else _0x522271['push'](_0x522271['shift']());}catch(_0x1bfd92){_0x522271['push'](_0x522271['shift']());}}}(a109_0x3d3d,0xc00db));function a109_0x3d3d(){const _0x572605=['4887RQuQui','3644157iYHQLj','60ABMNaC','45IyREAp','2872NSkumA','2wSFVvX','60evUXoW','146912sHpvjE','54564EnNABE','585145hhvpxh','4882384gLITTC','1996141REiUvk','./src/api','20cOGBLQ'];a109_0x3d3d=function(){return _0x572605;};return a109_0x3d3d();}export const DEFAULT_API_DIR=a109_0x57b156(0x1c2);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const a110_0xa84346=a110_0x165c;function a110_0x3e80(){const _0x4712a9=['401359rABIUZ','read','1515771lLNRtt','104vsNWVV','7160nStCfS','2940126FqrbCq','2146362RvYaCl','high-risk-write','4890606ogEkQD','4196LOFBuV','19515933xoZvKp','write'];a110_0x3e80=function(){return _0x4712a9;};return a110_0x3e80();}(function(_0x51b1dc,_0x401cd2){const _0x2ae99d=a110_0x165c,_0x2b5203=_0x51b1dc();while(!![]){try{const _0x26bfb9=parseInt(_0x2ae99d(0x184))/0x1+-parseInt(_0x2ae99d(0x188))/0x2+parseInt(_0x2ae99d(0x187))/0x3+parseInt(_0x2ae99d(0x18b))/0x4*(parseInt(_0x2ae99d(0x186))/0x5)+parseInt(_0x2ae99d(0x18a))/0x6+parseInt(_0x2ae99d(0x182))/0x7*(-parseInt(_0x2ae99d(0x185))/0x8)+-parseInt(_0x2ae99d(0x18c))/0x9;if(_0x26bfb9===_0x401cd2)break;else _0x2b5203['push'](_0x2b5203['shift']());}catch(_0x5696b9){_0x2b5203['push'](_0x2b5203['shift']());}}}(a110_0x3e80,0xc9ae3));function a110_0x165c(_0x7b17c2,_0x4b17b5){_0x7b17c2=_0x7b17c2-0x181;const _0x3e80eb=a110_0x3e80();let _0x165cbe=_0x3e80eb[_0x7b17c2];return _0x165cbe;}export const RISK_LEVEL_VALUES=[a110_0xa84346(0x183),a110_0xa84346(0x181),a110_0xa84346(0x189)];
|
package/lib/context.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a106_0x376d2f=a106_0x27b6;(function(_0x7b25c5,_0x58fcf6){const _0x271284=a106_0x27b6,_0x53629e=_0x7b25c5();while(!![]){try{const _0x50e12a=parseInt(_0x271284(0xe3))/0x1*(-parseInt(_0x271284(0x10e))/0x2)+-parseInt(_0x271284(0xe4))/0x3+parseInt(_0x271284(0xe5))/0x4*(-parseInt(_0x271284(0x10b))/0x5)+-parseInt(_0x271284(0x10c))/0x6+-parseInt(_0x271284(0x101))/0x7*(-parseInt(_0x271284(0xf3))/0x8)+parseInt(_0x271284(0x119))/0x9*(-parseInt(_0x271284(0xf2))/0xa)+parseInt(_0x271284(0xfb))/0xb;if(_0x50e12a===_0x58fcf6)break;else _0x53629e['push'](_0x53629e['shift']());}catch(_0x41ea14){_0x53629e['push'](_0x53629e['shift']());}}}(a106_0x1c84,0x3e1ee));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_API_DIR}from'./constant/paths.js';import{normalizeEnv,isDaily}from'./constant/env.js';import{normalizeLegacyOutputFormat}from'./framework/types.js';function env(_0x421d7e){return process.env[`RABETBASE_${_0x421d7e}`]||process.env[`LOVRABET_${_0x421d7e}`]||undefined;}export const NEW_CONFIG_NAME=a106_0x376d2f(0xfd);export const CONFIG_NAMES=[a106_0x376d2f(0xfd),a106_0x376d2f(0xe2),'.lovrabetrc'];export const LEGACY_CONFIG_NAMES=CONFIG_NAMES[a106_0x376d2f(0x103)](_0x3e89d1=>_0x3e89d1!==NEW_CONFIG_NAME);export function resolveConfigPath(_0x547fce){for(const _0xe4559e of CONFIG_NAMES){const _0x3b215d=resolve(_0x547fce,_0xe4559e);if(existsSync(_0x3b215d))return _0x3b215d;}return undefined;}export function findProjectRootDirectory(_0x3a781a=process[a106_0x376d2f(0x110)]()){let _0x152dec=resolve(_0x3a781a);const {root:_0x5968bf}=parse(_0x152dec),_0x13de67=homedir();while(!![]){if(resolveConfigPath(_0x152dec)){if(_0x152dec===_0x13de67)break;return _0x152dec;}if(_0x152dec===_0x5968bf||_0x152dec===_0x13de67)break;const _0x53ba61=dirname(_0x152dec);if(_0x53ba61===_0x152dec)break;_0x152dec=_0x53ba61;}return resolve(_0x3a781a);}function a106_0x27b6(_0x59c146,_0x4f3652){_0x59c146=_0x59c146-0xd5;const _0x1c841c=a106_0x1c84();let _0x27b6e9=_0x1c841c[_0x59c146];return _0x27b6e9;}export async function createContext(_0x27daf5){const _0x7c2fd1=a106_0x376d2f,_0x3aa0aa=readRawConfig(),_0x2bb7d4=buildConfig(_0x3aa0aa,_0x27daf5),{initEnv:_0x926e62}=await import(_0x7c2fd1(0x115));if(_0x2bb7d4[_0x7c2fd1(0xeb)])_0x926e62(_0x2bb7d4[_0x7c2fd1(0xeb)]);else _0x27daf5['env']&&typeof _0x27daf5[_0x7c2fd1(0xeb)]===_0x7c2fd1(0xf7)&&_0x926e62(_0x27daf5[_0x7c2fd1(0xeb)]);const {initDomains:_0x12b94f,getUserDomain:_0x40b5a2,getApiDomain:_0x4b1376}=await import(_0x7c2fd1(0xff));_0x12b94f({'apiDomain':_0x3aa0aa[_0x7c2fd1(0xd5)]||undefined,'userDomain':_0x3aa0aa['userDomain']||undefined,'runtimeDomain':_0x3aa0aa['runtimeDomain']||undefined});const _0x15c559={'apiDomain':_0x4b1376(),'userDomain':_0x40b5a2()},_0x5e7329=await buildAuth(_0x2bb7d4);logger[_0x7c2fd1(0x10f)](process[_0x7c2fd1(0x110)]());const _0x369a67=(CLI_BIN_NAME+'\x20'+process[_0x7c2fd1(0x107)]['slice'](0x2)['join']('\x20'))[_0x7c2fd1(0x11b)]();logger[_0x7c2fd1(0xf6)](_0x369a67);const {isNonInteractive:_0x3104a8}=await import(_0x7c2fd1(0x117)),_0x524b7f=_0x3104a8(_0x27daf5);return{'config':_0x2bb7d4,'auth':_0x5e7329,'logger':logger,'env':_0x15c559,'nonInteractive':_0x524b7f};}export function buildConfigFromFlags(_0x45f416){return buildConfig(readRawConfig(),_0x45f416);}export function getProjectConfigPath(){const _0xfb89aa=a106_0x376d2f;return resolveConfigPath(process[_0xfb89aa(0x110)]());}export function getGlobalConfigPath(){return resolveConfigPath(homedir());}export function isInProject(){return!!getProjectConfigPath();}export function inspectCliConfigJsonFile(_0x5824fc){const _0x5118db=a106_0x376d2f;if(!existsSync(_0x5824fc))return{'status':'missing'};try{const _0x20ed4e=readFileSync(_0x5824fc,{'encoding':_0x5118db(0x112)});if(!_0x20ed4e?.[_0x5118db(0x11b)]())return{'status':'empty'};const _0x1707e1=JSON['parse'](_0x20ed4e);return{'status':'ok','data':_0x1707e1};}catch(_0x42305a){return{'status':'error','message':_0x42305a instanceof Error?_0x42305a[_0x5118db(0xd7)]:String(_0x42305a)};}}function parseCliConfigJsonFile(_0x437ee1,_0x49d860,_0x2f15e4){const _0x9a7e8=a106_0x376d2f,_0x42403e=inspectCliConfigJsonFile(_0x437ee1);if(_0x42403e[_0x9a7e8(0xf1)]===_0x9a7e8(0x116)||_0x42403e[_0x9a7e8(0xf1)]==='empty')return{};if(_0x42403e[_0x9a7e8(0xf1)]==='ok')return _0x42403e[_0x9a7e8(0xfc)];return _0x49d860===_0x9a7e8(0xed)&&_0x2f15e4&&console['error'](CLI_BIN_NAME+':\x20'+_0x2f15e4+_0x9a7e8(0xf8)+_0x437ee1+'\x0a\x20\x20'+_0x42403e['message']),{};}export function loadRawConfigLayers(_0xfc4606){const _0x4e6970=a106_0x376d2f;let _0x12fac1={},_0x150e69={};const _0x403d33=resolveConfigPath(homedir());_0x403d33&&(_0x12fac1=parseCliConfigJsonFile(_0x403d33,_0x4e6970(0xed),_0x4e6970(0x10d)));const _0x2d013d=_0xfc4606??findProjectRootDirectory(),_0x16dbbf=resolveConfigPath(_0x2d013d);return _0x16dbbf&&(_0x150e69=parseCliConfigJsonFile(_0x16dbbf,_0x4e6970(0xed),_0x4e6970(0xdf))),{'globalPath':_0x403d33,'projectPath':_0x16dbbf,'globalConfig':_0x12fac1,'projectConfig':_0x150e69};}function mergeRawConfigLayers(_0x39f477){const _0x4b4b20=a106_0x376d2f,{globalConfig:_0x2a40e6,projectConfig:_0x2c7933}=_0x39f477;if(_0x2c7933[_0x4b4b20(0xdb)]===![]){const _0x388a33={..._0x2c7933};delete _0x388a33['inherit'];const _0x1154b4=_0x2c7933[_0x4b4b20(0x105)]&&typeof _0x2c7933[_0x4b4b20(0x105)]===_0x4b4b20(0x106)?_0x2c7933[_0x4b4b20(0x105)]:{};Object['keys'](_0x1154b4)[_0x4b4b20(0xe6)]>0x0?_0x388a33[_0x4b4b20(0x105)]=_0x1154b4:delete _0x388a33[_0x4b4b20(0x105)];if(_0x4b4b20(0xef)in _0x2c7933)_0x388a33[_0x4b4b20(0xef)]=_0x2c7933['defaultApp'];else Object[_0x4b4b20(0xd9)](_0x1154b4)[_0x4b4b20(0xe6)]>0x0&&(_0x388a33[_0x4b4b20(0xef)]=Object[_0x4b4b20(0xd9)](_0x1154b4)[0x0]);return _0x388a33;}const _0x962192=_0x2a40e6[_0x4b4b20(0x105)]&&typeof _0x2a40e6[_0x4b4b20(0x105)]===_0x4b4b20(0x106)?_0x2a40e6[_0x4b4b20(0x105)]:{},_0x12e1cc=_0x2c7933[_0x4b4b20(0x105)]&&typeof _0x2c7933[_0x4b4b20(0x105)]===_0x4b4b20(0x106)?_0x2c7933['apps']:{},_0x448505={..._0x962192,..._0x12e1cc},_0x2d3767={..._0x2a40e6,..._0x2c7933};Object[_0x4b4b20(0xd9)](_0x448505)['length']>0x0&&(_0x2d3767[_0x4b4b20(0x105)]=_0x448505);if(_0x4b4b20(0xef)in _0x2c7933)_0x2d3767[_0x4b4b20(0xef)]=_0x2c7933[_0x4b4b20(0xef)];else{if(_0x12e1cc&&Object['keys'](_0x12e1cc)['length']>0x0)_0x2d3767[_0x4b4b20(0xef)]=Object['keys'](_0x12e1cc)[0x0];else{if(_0x2a40e6[_0x4b4b20(0xef)]){const _0x566947=Boolean(_0x2c7933[_0x4b4b20(0xd6)]||_0x2c7933[_0x4b4b20(0xde)]);_0x566947?delete _0x2d3767[_0x4b4b20(0xef)]:_0x2d3767[_0x4b4b20(0xef)]=_0x2a40e6[_0x4b4b20(0xef)];}}}return _0x2d3767;}export function readRawConfigWithLayers(_0x35f3fc){const _0x1207e8=loadRawConfigLayers(_0x35f3fc);return{'config':mergeRawConfigLayers(_0x1207e8),'layers':_0x1207e8};}export function readRawConfig(_0x2175c0){return mergeRawConfigLayers(loadRawConfigLayers(_0x2175c0));}export function readConfigFile(_0x4cb8b1){return parseCliConfigJsonFile(_0x4cb8b1,'silent');}export function writeConfigFile(_0x58616b,_0x96d7b9){const _0xc907bc=a106_0x376d2f,_0xb4b344=dirname(_0x58616b);!existsSync(_0xb4b344)&&mkdirSync(_0xb4b344,{'recursive':!![]});const _0x2a2edc=_0x58616b+_0xc907bc(0xe8);try{writeFileSync(_0x2a2edc,JSON[_0xc907bc(0xea)](_0x96d7b9,null,0x2)+'\x0a',{'encoding':_0xc907bc(0x112),'mode':0x180}),renameSync(_0x2a2edc,_0x58616b);}catch(_0x243db2){try{unlinkSync(_0x2a2edc);}catch{}throw _0x243db2;}}export function resolveWriteConfigPath(_0x133d72){const _0xbd3b7a=a106_0x376d2f,_0x338dda=_0x133d72===_0xbd3b7a(0x11a)?process[_0xbd3b7a(0x110)]():homedir(),_0x2f28be=resolveConfigPath(_0x338dda);return _0x2f28be??resolve(_0x338dda,NEW_CONFIG_NAME);}function buildConfig(_0x58bf67,_0x276342){const _0x2b490b=a106_0x376d2f,_0x53a606={};if(_0x58bf67[_0x2b490b(0x105)]&&typeof _0x58bf67['apps']===_0x2b490b(0x106))for(const [_0x40d0d7,_0x483dd3]of Object['entries'](_0x58bf67[_0x2b490b(0x105)])){_0x483dd3&&typeof _0x483dd3===_0x2b490b(0x106)&&_0x483dd3[_0x2b490b(0xd6)]&&(_0x53a606[_0x40d0d7]=_0x483dd3);}const _0x484785=_0x58bf67['defaultApp']||undefined,_0x231d27=Object[_0x2b490b(0xd9)](_0x53a606)['length']>0x0,_0x3ea4b3=_0x276342[_0x2b490b(0xde)]||env(_0x2b490b(0xf5))||undefined,_0x446d11=_0x3ea4b3||_0x484785||undefined,_0xb22c95=_0x276342[_0x2b490b(0xd6)]||env(_0x2b490b(0xda))||undefined,_0x2462cc=_0xb22c95?Object[_0x2b490b(0x10a)](_0x53a606)['find'](([,_0x10f928])=>_0x10f928?.['appcode']===_0xb22c95):undefined,_0x44bb3c=_0x2462cc?.[0x0],_0x355488=_0x2462cc?.[0x1];let _0x56135a=_0xb22c95?_0x44bb3c:_0x446d11,_0x3bc66a=_0x56135a&&_0x53a606[_0x56135a]?_0x53a606[_0x56135a]:undefined;_0xb22c95&&_0x355488&&(_0x3bc66a=_0x355488);const _0x280123=_0xb22c95?_0x355488??_0x3bc66a:_0x3bc66a,_0x3a1dd1=_0x3ea4b3||(_0xb22c95?_0x44bb3c:undefined),_0x22700e=_0xb22c95||_0x280123?.['appcode']||_0x58bf67['appcode']||_0x58bf67[_0x2b490b(0xde)]||undefined,_0x39f337=_0x276342['env']||env(_0x2b490b(0xdc))||_0x280123?.[_0x2b490b(0xeb)]||_0x58bf67['env']||_0x2b490b(0xe9),_0x535bb8=_0x280123?.[_0x2b490b(0x113)]||_0x58bf67[_0x2b490b(0x113)]||_0x2b490b(0xe7),_0x3bb5ec=env(_0x2b490b(0x109))||_0x280123?.[_0x2b490b(0x108)]||_0x58bf67[_0x2b490b(0x108)]||undefined,_0x1835ba=env(_0x2b490b(0x114))||_0x280123?.['accessKey']||_0x58bf67[_0x2b490b(0xfe)]||undefined,_0xfb09=_0x276342[_0x2b490b(0xee)]||env(_0x2b490b(0xe0))||_0x280123?.[_0x2b490b(0xee)]||_0x58bf67[_0x2b490b(0xee)],_0x26ccfc=normalizeLegacyOutputFormat(_0xfb09),_0x872890=env(_0x2b490b(0xdd))||_0x280123?.['pageSize']||_0x58bf67[_0x2b490b(0xe1)],_0x595476=_0x872890?Number(_0x872890)||undefined:undefined,_0xfbb4ad=env(_0x2b490b(0x104))||env(_0x2b490b(0xd8))||_0x280123?.[_0x2b490b(0xf0)]||_0x58bf67[_0x2b490b(0xf0)]||_0x58bf67[_0x2b490b(0x118)],_0x3a7c58=_0xfbb4ad==='read'||_0xfbb4ad===_0x2b490b(0x100)?_0xfbb4ad:_0x2b490b(0xfa),_0x2103ac=env(_0x2b490b(0x111)),_0xfea9a6=_0x2103ac==='1'||_0x2103ac==='true',_0x3f10f1=_0x280123?.[_0x2b490b(0xec)]||_0x58bf67[_0x2b490b(0xec)]||DEFAULT_API_DIR,_0x1e374b=isDaily(normalizeEnv(String(_0x39f337)))?_0x2b490b(0x11c):_0x2b490b(0xe9);return{'appCode':typeof _0x22700e===_0x2b490b(0xf7)&&_0x22700e[_0x2b490b(0x11b)]()?_0x22700e['trim']():undefined,'env':_0x1e374b,'locale':_0x535bb8,'cookie':_0x3bb5ec,'accessKey':_0x1835ba,'format':_0x26ccfc,'pageSize':_0x595476,'riskLevel':_0x3a7c58,'verbose':_0xfea9a6,'apiDir':_0x3f10f1,'apps':_0x53a606,'defaultApp':_0x484785,'currentApp':_0x231d27?_0x56135a:undefined,'explicitAppName':_0x3a1dd1,'raw':_0x58bf67};}async function buildAuth(_0x484219){const _0x519f21=a106_0x376d2f,{getCookie:_0x20cc53}=await import('./auth/get-cookie.js'),_0x4f2667=_0x484219[_0x519f21(0x108)]||_0x20cc53(),_0x32529b=_0x4f2667?await getIsSessionValid():![];return{'cookie':_0x4f2667,'isLoggedIn':_0x32529b,async 'getOrLogin'(){if(_0x4f2667&&_0x32529b)return _0x4f2667;throw CliErrors['authRequired']();}};}function a106_0x1c84(){const _0x181ca0=['production','stringify','env','apiDir','warn','format','defaultApp','riskLevel','status','29130PCwtZS','1378024TzdRZE','-api.ts','APP','setRawCommand','string','\x20config\x20file\x20ignored\x20(invalid\x20JSON\x20or\x20unreadable):\x20','find','high-risk-write','9109595XRoWSm','data','.rabetbase.json','accessKey','./constant/domain.js','write','7NMSqwc','api.ts','filter','RISK_LEVEL','apps','object','argv','cookie','COOKIE','entries','788590vlqOxT','1135602TXIlGV','Global','103134ZNlNUi','setLogPath','cwd','VERBOSE','utf8','locale','ACCESS_KEY','./constant/env.js','missing','./utils/is-non-interactive.js','maxRisk','198kvMQIE','project','trim','daily','apiDomain','appcode','message','MAX_RISK','keys','APPCODE','inherit','ENV','PAGE_SIZE','app','Project','FORMAT','pageSize','.lovrabet.json','2SuuvVR','695241daCdsu','4yOhRxk','length','en-US','.tmp'];a106_0x1c84=function(){return _0x181ca0;};return a106_0x1c84();}export function resolveApiFilePath(_0x17369f,_0x4388b5){const _0x339b35=a106_0x376d2f,_0x517378=resolve(process[_0x339b35(0x110)](),_0x17369f),_0x360c18=resolve(_0x517378,_0x339b35(0x102));if(!_0x4388b5)return _0x360c18;const _0x1e0cd9=readRawConfig(),_0x39c32d=_0x1e0cd9[_0x339b35(0x105)]&&typeof _0x1e0cd9[_0x339b35(0x105)]===_0x339b35(0x106)?_0x1e0cd9[_0x339b35(0x105)]:{},_0x10a057=Object[_0x339b35(0x10a)](_0x39c32d)[_0x339b35(0xf9)](([,_0x4f4c26])=>_0x4f4c26?.[_0x339b35(0xd6)]===_0x4388b5);if(!_0x10a057)return _0x360c18;const [_0x4ae294,_0x5a512c]=_0x10a057,_0x498dcf=typeof _0x1e0cd9['defaultApp']===_0x339b35(0xf7)?_0x1e0cd9['defaultApp']:undefined;if(_0x5a512c?.[_0x339b35(0xec)])return _0x360c18;if(_0x498dcf&&_0x4ae294!==_0x498dcf)return resolve(_0x517378,_0x4ae294+_0x339b35(0xf4));return _0x360c18;}
|
|
1
|
+
const a111_0xcd8bcc=a111_0x2d8f;(function(_0x287713,_0x37e72d){const _0x24ad89=a111_0x2d8f,_0x374508=_0x287713();while(!![]){try{const _0x36020b=-parseInt(_0x24ad89(0x185))/0x1*(-parseInt(_0x24ad89(0x1d0))/0x2)+-parseInt(_0x24ad89(0x1ad))/0x3+-parseInt(_0x24ad89(0x1c8))/0x4+-parseInt(_0x24ad89(0x1bf))/0x5*(parseInt(_0x24ad89(0x1ce))/0x6)+-parseInt(_0x24ad89(0x197))/0x7*(parseInt(_0x24ad89(0x1b7))/0x8)+-parseInt(_0x24ad89(0x1c0))/0x9+-parseInt(_0x24ad89(0x1c4))/0xa*(-parseInt(_0x24ad89(0x18b))/0xb);if(_0x36020b===_0x37e72d)break;else _0x374508['push'](_0x374508['shift']());}catch(_0x1b34c1){_0x374508['push'](_0x374508['shift']());}}}(a111_0x80ed,0xed507));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';function a111_0x2d8f(_0x3167fe,_0x4a049f){_0x3167fe=_0x3167fe-0x185;const _0x80ed54=a111_0x80ed();let _0x2d8ffa=_0x80ed54[_0x3167fe];return _0x2d8ffa;}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(_0x3196a0){return process.env[`RABETBASE_${_0x3196a0}`]||process.env[`LOVRABET_${_0x3196a0}`]||undefined;}export const NEW_CONFIG_NAME=a111_0xcd8bcc(0x1ac);export const CONFIG_NAMES=[a111_0xcd8bcc(0x1ac),'.lovrabet.json',a111_0xcd8bcc(0x1d1)];export const LEGACY_CONFIG_NAMES=CONFIG_NAMES[a111_0xcd8bcc(0x1af)](_0x738d6=>_0x738d6!==NEW_CONFIG_NAME);export function resolveConfigPath(_0x195dba){for(const _0x57a956 of CONFIG_NAMES){const _0x55b089=resolve(_0x195dba,_0x57a956);if(existsSync(_0x55b089))return _0x55b089;}return undefined;}export function findProjectRootDirectory(_0x21e835=process[a111_0xcd8bcc(0x1cf)]()){let _0x1f6e10=resolve(_0x21e835);const {root:_0x2fbb0e}=parse(_0x1f6e10),_0x10c8a7=homedir();while(!![]){if(resolveConfigPath(_0x1f6e10)){if(_0x1f6e10===_0x10c8a7)break;return _0x1f6e10;}if(_0x1f6e10===_0x2fbb0e||_0x1f6e10===_0x10c8a7)break;const _0x4b56cf=dirname(_0x1f6e10);if(_0x4b56cf===_0x1f6e10)break;_0x1f6e10=_0x4b56cf;}return resolve(_0x21e835);}export async function createContext(_0x574763){const _0x49e1ac=a111_0xcd8bcc,_0x3c6177=readRawConfig(),_0x1b35aa=buildConfig(_0x3c6177,_0x574763),{initEnv:_0x2eb72e}=await import('./constant/env.js');if(_0x1b35aa[_0x49e1ac(0x192)])_0x2eb72e(_0x1b35aa['env']);else _0x574763[_0x49e1ac(0x192)]&&typeof _0x574763[_0x49e1ac(0x192)]===_0x49e1ac(0x19f)&&_0x2eb72e(_0x574763[_0x49e1ac(0x192)]);const {initDomains:_0x2e31ef,getUserDomain:_0x11ec15,getApiDomain:_0x1f6d92}=await import(_0x49e1ac(0x19c));_0x2e31ef({'apiDomain':_0x3c6177[_0x49e1ac(0x19b)]||undefined,'userDomain':_0x3c6177[_0x49e1ac(0x193)]||undefined,'runtimeDomain':_0x3c6177[_0x49e1ac(0x1cb)]||undefined});const _0x35578a={'apiDomain':_0x1f6d92(),'userDomain':_0x11ec15()},_0x18ece3=await buildAuth(_0x1b35aa);logger[_0x49e1ac(0x187)](process['cwd']());const _0x2b6991=(CLI_BIN_NAME+'\x20'+process[_0x49e1ac(0x1ba)][_0x49e1ac(0x1ca)](0x2)['join']('\x20'))[_0x49e1ac(0x1d2)]();logger['setRawCommand'](_0x2b6991);const {isNonInteractive:_0x3bd77e}=await import(_0x49e1ac(0x18a)),_0x13e220=_0x3bd77e(_0x574763);return{'config':_0x1b35aa,'auth':_0x18ece3,'logger':logger,'env':_0x35578a,'nonInteractive':_0x13e220};}export function buildConfigFromFlags(_0x435920){return buildConfig(readRawConfig(),_0x435920);}export function getProjectConfigPath(){const _0x1520af=a111_0xcd8bcc;return resolveConfigPath(process[_0x1520af(0x1cf)]());}function a111_0x80ed(){const _0x3e2d37=['pageSize','authRequired','appcode','projectConfig','env','userDomain','locale','silent','data','24493xLvjHf','defaultApp','find','RISK_LEVEL','apiDomain','./constant/domain.js','apps','migrated','string','riskLevel','apiDir','write','inherit','./auth/get-cookie.js','APPCODE','\x0a\x20\x20','read','message','PAGE_SIZE','missing','api.ts','.rabetbase.json','2212143FwEdcS','COOKIE','filter','FORMAT','parse','set','length','-api.ts','error','empty','3368eCgFtS','entries','warn','argv','values','\x20config\x20file\x20ignored\x20(invalid\x20JSON\x20or\x20unreadable):\x20','keys','merged','6755yyEaCA','13459896EIKZMT','map','get','ENV','120OqAPbf','daily','status','https://g.lovrabet.com/dist/lovrabet-skill','5850780TapviR','object','slice','runtimeDomain','Project','accessKey','2496GCQgGm','cwd','756092ijuVHr','.lovrabetrc','trim','app','cookie','1xxZdSV','format','setLogPath','APP','template_base_url','./utils/is-non-interactive.js','5797649zPQvjG','config','replace'];a111_0x80ed=function(){return _0x3e2d37;};return a111_0x80ed();}export function getGlobalConfigPath(){return resolveConfigPath(homedir());}export function isInProject(){return!!getProjectConfigPath();}export function inspectCliConfigJsonFile(_0x445e72){const _0x47f4ba=a111_0xcd8bcc;if(!existsSync(_0x445e72))return{'status':_0x47f4ba(0x1aa)};try{const _0x33ffe8=readFileSync(_0x445e72,{'encoding':'utf8'});if(!_0x33ffe8?.[_0x47f4ba(0x1d2)]())return{'status':_0x47f4ba(0x1b6)};const _0x2f380d=JSON[_0x47f4ba(0x1b1)](_0x33ffe8);return{'status':'ok','data':_0x2f380d};}catch(_0x3a7150){return{'status':_0x47f4ba(0x1b5),'message':_0x3a7150 instanceof Error?_0x3a7150['message']:String(_0x3a7150)};}}function parseCliConfigJsonFile(_0x534ee8,_0x5165c5,_0x21c6cd){const _0x4d54df=a111_0xcd8bcc,_0x1569cf=inspectCliConfigJsonFile(_0x534ee8);if(_0x1569cf[_0x4d54df(0x1c6)]===_0x4d54df(0x1aa)||_0x1569cf[_0x4d54df(0x1c6)]==='empty')return{};if(_0x1569cf['status']==='ok')return _0x1569cf[_0x4d54df(0x196)];return _0x5165c5===_0x4d54df(0x1b9)&&_0x21c6cd&&console[_0x4d54df(0x1b5)](CLI_BIN_NAME+':\x20'+_0x21c6cd+_0x4d54df(0x1bc)+_0x534ee8+_0x4d54df(0x1a6)+_0x1569cf[_0x4d54df(0x1a8)]),{};}const normalizedWriteCache=new Map();function normalizeLegacyConfigShape(_0x544fa7){const _0x248e31=a111_0xcd8bcc;if(!_0x544fa7||typeof _0x544fa7!==_0x248e31(0x1c9))return{'config':{},'migrated':![]};const _0x1ec514={..._0x544fa7},_0x3ea702=_0x1ec514[_0x248e31(0x19d)]&&typeof _0x1ec514[_0x248e31(0x19d)]===_0x248e31(0x1c9)?{..._0x1ec514['apps']}:{},_0x44de28=Object['keys'](_0x3ea702)[_0x248e31(0x1b3)],_0x4a0ea3=_0x1ec514[_0x248e31(0x190)]||_0x1ec514[_0x248e31(0x1d3)];let _0xc1d464=![];if(_0x4a0ea3&&_0x44de28===0x0){const _0xf9eaf4=typeof _0x1ec514[_0x248e31(0x198)]==='string'&&_0x1ec514[_0x248e31(0x198)][_0x248e31(0x1d2)]()?_0x1ec514[_0x248e31(0x198)]:String(_0x4a0ea3)[_0x248e31(0x1d2)]();_0x3ea702[_0xf9eaf4]={'appcode':String(_0x4a0ea3)['trim'](),..._0x1ec514[_0x248e31(0x192)]!=null?{'env':_0x1ec514['env']}:{},..._0x1ec514[_0x248e31(0x1a1)]!=null?{'apiDir':_0x1ec514[_0x248e31(0x1a1)]}:{},..._0x1ec514[_0x248e31(0x1d4)]!=null?{'cookie':_0x1ec514[_0x248e31(0x1d4)]}:{},..._0x1ec514[_0x248e31(0x1cd)]!=null?{'accessKey':_0x1ec514[_0x248e31(0x1cd)]}:{},..._0x1ec514[_0x248e31(0x186)]!=null?{'format':_0x1ec514['format']}:{},..._0x1ec514[_0x248e31(0x18e)]!=null?{'pageSize':_0x1ec514[_0x248e31(0x18e)]}:{},..._0x1ec514['riskLevel']!=null?{'riskLevel':_0x1ec514[_0x248e31(0x1a0)]}:{},..._0x1ec514[_0x248e31(0x194)]!=null?{'locale':_0x1ec514[_0x248e31(0x194)]}:{}},_0x1ec514[_0x248e31(0x19d)]=_0x3ea702;if(!_0x1ec514[_0x248e31(0x198)])_0x1ec514[_0x248e31(0x198)]=_0xf9eaf4;_0xc1d464=!![];}return(_0x248e31(0x190)in _0x1ec514||_0x248e31(0x1d3)in _0x1ec514)&&(delete _0x1ec514[_0x248e31(0x190)],delete _0x1ec514['app'],_0xc1d464=!![]),{'config':_0x1ec514,'migrated':_0xc1d464};}function writeNormalizedConfigIfNeeded(_0x247be1,_0x168a90){const _0x9cfd34=a111_0xcd8bcc,_0x380e9a=JSON['stringify'](_0x168a90,null,0x2)+'\x0a';if(normalizedWriteCache[_0x9cfd34(0x1c2)](_0x247be1)===_0x380e9a)return;writeConfigFile(_0x247be1,_0x168a90),normalizedWriteCache[_0x9cfd34(0x1b2)](_0x247be1,_0x380e9a);}function parseAndNormalizeConfig(_0x2d34fc,_0x9e2b33,_0x5041a6){const _0x1497e6=a111_0xcd8bcc,_0x9aaa6f=parseCliConfigJsonFile(_0x2d34fc,_0x9e2b33,_0x5041a6),_0x2f3fd9=normalizeLegacyConfigShape(_0x9aaa6f);if(_0x2f3fd9[_0x1497e6(0x19e)])try{writeNormalizedConfigIfNeeded(_0x2d34fc,_0x2f3fd9[_0x1497e6(0x18c)]);}catch{}return _0x2f3fd9[_0x1497e6(0x18c)];}export function loadRawConfigLayers(_0x579527){const _0x2820c4=a111_0xcd8bcc;let _0x3fbc46={},_0x2325cf={};const _0x9d20ec=resolveConfigPath(homedir());_0x9d20ec&&(_0x3fbc46=parseAndNormalizeConfig(_0x9d20ec,_0x2820c4(0x1b9),'Global'));const _0x3c1319=_0x579527??findProjectRootDirectory(),_0x2885e2=resolveConfigPath(_0x3c1319);return _0x2885e2&&(_0x2325cf=parseAndNormalizeConfig(_0x2885e2,_0x2820c4(0x1b9),_0x2820c4(0x1cc))),{'globalPath':_0x9d20ec,'projectPath':_0x2885e2,'globalConfig':_0x3fbc46,'projectConfig':_0x2325cf};}function mergeRawConfigLayers(_0x51d431){const _0x43c4b7=a111_0xcd8bcc,{globalConfig:_0x3ec2e2,projectConfig:_0x1eb68f}=_0x51d431;if(_0x1eb68f[_0x43c4b7(0x1a3)]===![]){const _0x58cfda={..._0x1eb68f};delete _0x58cfda[_0x43c4b7(0x1a3)];const _0x5960d4=_0x1eb68f['apps']&&typeof _0x1eb68f[_0x43c4b7(0x19d)]===_0x43c4b7(0x1c9)?_0x1eb68f[_0x43c4b7(0x19d)]:{};Object[_0x43c4b7(0x1bd)](_0x5960d4)['length']>0x0?_0x58cfda['apps']=_0x5960d4:delete _0x58cfda[_0x43c4b7(0x19d)];if(_0x43c4b7(0x198)in _0x1eb68f)_0x58cfda['defaultApp']=_0x1eb68f['defaultApp'];else Object[_0x43c4b7(0x1bd)](_0x5960d4)[_0x43c4b7(0x1b3)]>0x0&&(_0x58cfda['defaultApp']=Object[_0x43c4b7(0x1bd)](_0x5960d4)[0x0]);return _0x58cfda;}const _0x574773=_0x3ec2e2[_0x43c4b7(0x19d)]&&typeof _0x3ec2e2[_0x43c4b7(0x19d)]===_0x43c4b7(0x1c9)?_0x3ec2e2[_0x43c4b7(0x19d)]:{},_0x3f13e7=_0x1eb68f[_0x43c4b7(0x19d)]&&typeof _0x1eb68f[_0x43c4b7(0x19d)]===_0x43c4b7(0x1c9)?_0x1eb68f[_0x43c4b7(0x19d)]:{},_0x550533={..._0x574773,..._0x3f13e7},_0x2a4b06={..._0x3ec2e2,..._0x1eb68f};Object[_0x43c4b7(0x1bd)](_0x550533)[_0x43c4b7(0x1b3)]>0x0&&(_0x2a4b06[_0x43c4b7(0x19d)]=_0x550533);if(_0x43c4b7(0x198)in _0x1eb68f)_0x2a4b06['defaultApp']=_0x1eb68f['defaultApp'];else{if(_0x3f13e7&&Object[_0x43c4b7(0x1bd)](_0x3f13e7)[_0x43c4b7(0x1b3)]>0x0)_0x2a4b06[_0x43c4b7(0x198)]=Object[_0x43c4b7(0x1bd)](_0x3f13e7)[0x0];else{if(_0x3ec2e2[_0x43c4b7(0x198)])_0x2a4b06['defaultApp']=_0x3ec2e2[_0x43c4b7(0x198)];else{const _0x1e4e7c=Object[_0x43c4b7(0x1bd)](_0x574773);_0x1e4e7c[_0x43c4b7(0x1b3)]>0x0&&(_0x2a4b06[_0x43c4b7(0x198)]=_0x1e4e7c[0x0]);}}}return _0x2a4b06;}export function readRawConfigWithLayers(_0x354fae){const _0x4baa10=loadRawConfigLayers(_0x354fae);return{'config':mergeRawConfigLayers(_0x4baa10),'layers':_0x4baa10};}export function readRawConfig(_0x56a68d){return mergeRawConfigLayers(loadRawConfigLayers(_0x56a68d));}export function getConfigAppCode(_0xfbd6c8){const _0x2db7e0=a111_0xcd8bcc,_0x39c1cc=readRawConfig(_0xfbd6c8);if(_0x39c1cc[_0x2db7e0(0x19d)]&&typeof _0x39c1cc['apps']===_0x2db7e0(0x1c9)){const _0x1cde1d=_0x39c1cc[_0x2db7e0(0x198)];if(_0x1cde1d&&_0x39c1cc[_0x2db7e0(0x19d)][_0x1cde1d]?.[_0x2db7e0(0x190)])return String(_0x39c1cc[_0x2db7e0(0x19d)][_0x1cde1d][_0x2db7e0(0x190)])[_0x2db7e0(0x1d2)]();const _0x213c7c=Object[_0x2db7e0(0x1bb)](_0x39c1cc['apps'])[0x0];if(_0x213c7c?.[_0x2db7e0(0x190)])return String(_0x213c7c['appcode'])[_0x2db7e0(0x1d2)]();}const _0x4b80a6=_0x39c1cc[_0x2db7e0(0x190)]||_0x39c1cc['app'];if(typeof _0x4b80a6!==_0x2db7e0(0x19f)||_0x4b80a6[_0x2db7e0(0x1d2)]()==='')return undefined;return _0x4b80a6['trim']();}export function getMultiAppConfigs(_0x174df6='project',_0x5db25f){const _0x2ab857=a111_0xcd8bcc,_0xedf821=_0x174df6===_0x2ab857(0x1be)?readRawConfig(_0x5db25f):loadRawConfigLayers(_0x5db25f)[_0x2ab857(0x191)],_0x3666f8=_0xedf821[_0x2ab857(0x19d)];if(!_0x3666f8||typeof _0x3666f8!==_0x2ab857(0x1c9)||Object[_0x2ab857(0x1bd)](_0x3666f8)[_0x2ab857(0x1b3)]===0x0)return null;const _0x4d87b4=_0xedf821[_0x2ab857(0x198)];return Object[_0x2ab857(0x1b8)](_0x3666f8)[_0x2ab857(0x1c1)](([_0x31ceb7,_0x2a65df])=>({'name':_0x31ceb7,'appcode':_0x2a65df?.['appcode']||'','isDefault':_0x31ceb7===_0x4d87b4,'env':_0x2a65df?.['env'],'apiDir':_0x2a65df?.[_0x2ab857(0x1a1)],'cookie':_0x2a65df?.[_0x2ab857(0x1d4)]||undefined}))[_0x2ab857(0x1af)](_0x28c36d=>_0x28c36d[_0x2ab857(0x190)]);}export function getTemplateBaseUrl(_0x10ccf0){const _0x4a72a8=a111_0xcd8bcc,_0x10ecf1=readRawConfig(_0x10ccf0);if(_0x10ecf1[_0x4a72a8(0x189)]&&typeof _0x10ecf1[_0x4a72a8(0x189)]==='string')return _0x10ecf1[_0x4a72a8(0x189)][_0x4a72a8(0x18d)](/\/$/,'');return _0x4a72a8(0x1c7);}export function readConfigFile(_0x23ba5b){const _0x3476b1=a111_0xcd8bcc;return parseAndNormalizeConfig(_0x23ba5b,_0x3476b1(0x195));}export function writeConfigFile(_0x43d49b,_0x518829){const _0x1720c8=dirname(_0x43d49b);!existsSync(_0x1720c8)&&mkdirSync(_0x1720c8,{'recursive':!![]});const _0x201987=_0x43d49b+'.tmp';try{writeFileSync(_0x201987,JSON['stringify'](_0x518829,null,0x2)+'\x0a',{'encoding':'utf8','mode':0x180}),renameSync(_0x201987,_0x43d49b);}catch(_0xa2b735){try{unlinkSync(_0x201987);}catch{}throw _0xa2b735;}}export function resolveWriteConfigPath(_0x2975f9){const _0x1de376=a111_0xcd8bcc,_0x5ca911=_0x2975f9==='project'?process[_0x1de376(0x1cf)]():homedir(),_0x315564=resolveConfigPath(_0x5ca911);return _0x315564??resolve(_0x5ca911,NEW_CONFIG_NAME);}function buildConfig(_0x17d366,_0x48161a){const _0x48b68e=a111_0xcd8bcc,_0x5a2b69={};if(_0x17d366['apps']&&typeof _0x17d366[_0x48b68e(0x19d)]===_0x48b68e(0x1c9))for(const [_0x5e8d87,_0x15f99e]of Object[_0x48b68e(0x1b8)](_0x17d366[_0x48b68e(0x19d)])){_0x15f99e&&typeof _0x15f99e===_0x48b68e(0x1c9)&&_0x15f99e[_0x48b68e(0x190)]&&(_0x5a2b69[_0x5e8d87]=_0x15f99e);}const _0x5b4cbc=_0x17d366[_0x48b68e(0x198)]||undefined,_0x14cffd=Object[_0x48b68e(0x1bd)](_0x5a2b69)[_0x48b68e(0x1b3)]>0x0,_0x37b73c=_0x48161a[_0x48b68e(0x1d3)]||env(_0x48b68e(0x188))||undefined,_0x1d405f=_0x37b73c||_0x5b4cbc||undefined,_0x357835=_0x48161a['appcode']||env(_0x48b68e(0x1a5))||undefined,_0x44a90d=_0x357835?Object[_0x48b68e(0x1b8)](_0x5a2b69)[_0x48b68e(0x199)](([,_0x1b7428])=>_0x1b7428?.[_0x48b68e(0x190)]===_0x357835):undefined,_0x30dd54=_0x44a90d?.[0x0],_0x51d809=_0x44a90d?.[0x1];let _0xb313c7=_0x357835?_0x30dd54:_0x1d405f,_0x396dc4=_0xb313c7&&_0x5a2b69[_0xb313c7]?_0x5a2b69[_0xb313c7]:undefined;_0x357835&&_0x51d809&&(_0x396dc4=_0x51d809);const _0x26bc5d=_0x357835?_0x51d809??_0x396dc4:_0x396dc4,_0x315a5d=_0x37b73c||(_0x357835?_0x30dd54:undefined),_0x480c61=_0x357835||_0x26bc5d?.['appcode']||undefined,_0x25eace=_0x48161a[_0x48b68e(0x192)]||env(_0x48b68e(0x1c3))||_0x26bc5d?.['env']||_0x17d366[_0x48b68e(0x192)]||DEFAULT_CONFIG_VALUES[_0x48b68e(0x192)],_0x283a34=_0x26bc5d?.['locale']||_0x17d366[_0x48b68e(0x194)]||DEFAULT_CONFIG_VALUES['locale'],_0x31a8f8=env(_0x48b68e(0x1ae))||_0x26bc5d?.['cookie']||_0x17d366['cookie']||undefined,_0x38a83a=env('ACCESS_KEY')||_0x26bc5d?.[_0x48b68e(0x1cd)]||_0x17d366['accessKey']||undefined,_0x2cb48a=_0x48161a['format']||env(_0x48b68e(0x1b0))||_0x26bc5d?.[_0x48b68e(0x186)]||_0x17d366[_0x48b68e(0x186)],_0x4b7653=normalizeLegacyOutputFormat(_0x2cb48a),_0x29147a=env(_0x48b68e(0x1a9))||_0x26bc5d?.[_0x48b68e(0x18e)]||_0x17d366[_0x48b68e(0x18e)],_0xf083af=_0x29147a?Number(_0x29147a)||undefined:undefined,_0x4bbbf0=env(_0x48b68e(0x19a))||env('MAX_RISK')||_0x26bc5d?.[_0x48b68e(0x1a0)]||_0x17d366[_0x48b68e(0x1a0)]||_0x17d366['maxRisk'],_0x584d52=_0x4bbbf0===_0x48b68e(0x1a7)||_0x4bbbf0===_0x48b68e(0x1a2)?_0x4bbbf0:DEFAULT_CONFIG_VALUES['riskLevel'],_0xa5f3b6=env('VERBOSE'),_0x41c66d=_0xa5f3b6==='1'||_0xa5f3b6==='true',_0x5e22c0=_0x26bc5d?.[_0x48b68e(0x1a1)]||_0x17d366[_0x48b68e(0x1a1)]||DEFAULT_CONFIG_VALUES['apiDir'],_0x4b1885=isDaily(normalizeEnv(String(_0x25eace)))?_0x48b68e(0x1c5):'production';return{'appCode':typeof _0x480c61===_0x48b68e(0x19f)&&_0x480c61['trim']()?_0x480c61['trim']():undefined,'env':_0x4b1885,'locale':_0x283a34,'cookie':_0x31a8f8,'accessKey':_0x38a83a,'format':_0x4b7653,'pageSize':_0xf083af,'riskLevel':_0x584d52,'verbose':_0x41c66d,'apiDir':_0x5e22c0,'apps':_0x5a2b69,'defaultApp':_0x5b4cbc,'currentApp':_0x14cffd?_0xb313c7:undefined,'explicitAppName':_0x315a5d,'raw':_0x17d366};}async function buildAuth(_0x1a77ed){const _0x36f103=a111_0xcd8bcc,{getCookie:_0x922d88}=await import(_0x36f103(0x1a4)),_0x3d1271=_0x1a77ed[_0x36f103(0x1d4)]||_0x922d88(),_0x1ad804=_0x3d1271?await getIsSessionValid():![];return{'cookie':_0x3d1271,'isLoggedIn':_0x1ad804,async 'getOrLogin'(){const _0x46db41=_0x36f103;if(_0x3d1271&&_0x1ad804)return _0x3d1271;throw CliErrors[_0x46db41(0x18f)]();}};}export function resolveApiFilePath(_0x219feb,_0x2c3040){const _0x5c7769=a111_0xcd8bcc,_0x2a5f29=resolve(process[_0x5c7769(0x1cf)](),_0x219feb),_0x3e5d60=resolve(_0x2a5f29,_0x5c7769(0x1ab));if(!_0x2c3040)return _0x3e5d60;const _0x15f2bc=readRawConfig(),_0x10e273=_0x15f2bc[_0x5c7769(0x19d)]&&typeof _0x15f2bc['apps']===_0x5c7769(0x1c9)?_0x15f2bc[_0x5c7769(0x19d)]:{},_0x4fadf7=Object['entries'](_0x10e273)['find'](([,_0x177529])=>_0x177529?.['appcode']===_0x2c3040);if(!_0x4fadf7)return _0x3e5d60;const [_0x4cba63,_0x172e0b]=_0x4fadf7,_0x2bf88c=typeof _0x15f2bc[_0x5c7769(0x198)]===_0x5c7769(0x19f)?_0x15f2bc[_0x5c7769(0x198)]:undefined;if(_0x172e0b?.['apiDir'])return _0x3e5d60;if(_0x2bf88c&&_0x4cba63!==_0x2bf88c)return resolve(_0x2a5f29,_0x4cba63+_0x5c7769(0x1b4));return _0x3e5d60;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x2f84ea,_0x45cec3){const _0x8a2ef4=a112_0x4360,_0x30305f=_0x2f84ea();while(!![]){try{const _0x2c91ac=parseInt(_0x8a2ef4(0x1f1))/0x1+parseInt(_0x8a2ef4(0x1f8))/0x2*(-parseInt(_0x8a2ef4(0x1f9))/0x3)+parseInt(_0x8a2ef4(0x1f4))/0x4+-parseInt(_0x8a2ef4(0x1f0))/0x5+parseInt(_0x8a2ef4(0x1ff))/0x6*(parseInt(_0x8a2ef4(0x1f5))/0x7)+parseInt(_0x8a2ef4(0x1f6))/0x8*(-parseInt(_0x8a2ef4(0x200))/0x9)+-parseInt(_0x8a2ef4(0x201))/0xa;if(_0x2c91ac===_0x45cec3)break;else _0x30305f['push'](_0x30305f['shift']());}catch(_0x2b1186){_0x30305f['push'](_0x30305f['shift']());}}}(a112_0x4aaf,0xf1245));import{readFileSync,existsSync}from'node:fs';import{resolve}from'node:path';const cache=new Map();function parseApiFile(_0x2a821c){const _0x1c6929=a112_0x4360,_0x4115ad=[],_0x1979e7=/\{\s*datasetCode:\s*"([^"]+)"\s*,\s*tableName:\s*"([^"]+)"\s*,\s*name:\s*"([^"]*?)"\s*,\s*alias:\s*"([^"]+)"\s*,?\s*\}/g;let _0x599ed0;while((_0x599ed0=_0x1979e7[_0x1c6929(0x1f3)](_0x2a821c))!==null){_0x4115ad[_0x1c6929(0x1f7)]({'datasetCode':_0x599ed0[0x1],'tableName':_0x599ed0[0x2],'name':_0x599ed0[0x3],'alias':_0x599ed0[0x4]});}return _0x4115ad;}function a112_0x4360(_0x4ccbcb,_0x14f156){_0x4ccbcb=_0x4ccbcb-0x1f0;const _0x4aaf93=a112_0x4aaf();let _0x436046=_0x4aaf93[_0x4ccbcb];return _0x436046;}export function loadAliasMap(_0x9f20d5,_0x588f2a,_0x4d061a){const _0x2987b9=a112_0x4360,_0x5f4de3=_0x4d061a??resolve(process['cwd'](),_0x9f20d5,_0x2987b9(0x1fe));if(cache[_0x2987b9(0x1fb)](_0x5f4de3))return cache['get'](_0x5f4de3);if(!existsSync(_0x5f4de3))return cache[_0x2987b9(0x1fa)](_0x5f4de3,[]),[];try{const _0x4252fb=readFileSync(_0x5f4de3,'utf-8'),_0x2b37e2=parseApiFile(_0x4252fb);return cache[_0x2987b9(0x1fa)](_0x5f4de3,_0x2b37e2),_0x2b37e2;}catch{return cache['set'](_0x5f4de3,[]),[];}}function a112_0x4aaf(){const _0x5b83cb=['96341fWbnEc','4208168HtQuzl','push','196mHBKGe','14295mxlmJM','set','has','datasetCode','find','api.ts','756uoFUgE','18aEQuGe','5411660lbbbFT','8539890RlhZal','1527628JEWqVX','alias','exec','5976428DuZtog'];a112_0x4aaf=function(){return _0x5b83cb;};return a112_0x4aaf();}export function resolveAlias(_0x3b5e23,_0x2f364d,_0x5b42ca,_0x2d4958){const _0x3436e2=a112_0x4360;if(!_0x2f364d)return undefined;const _0x593e36=loadAliasMap(_0x3b5e23,_0x5b42ca,_0x2d4958),_0x1f74e7=_0x593e36[_0x3436e2(0x1fd)](_0x42aac0=>_0x42aac0[_0x3436e2(0x1f2)]===_0x2f364d);return _0x1f74e7?.[_0x3436e2(0x1fc)];}export function listAliases(_0x332af5,_0x2daae4,_0x19458d){return loadAliasMap(_0x332af5,_0x2daae4,_0x19458d);}
|
package/lib/core/api-client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0x1591a4,_0x5ed34f){const _0x51e15b=a108_0x7a54,_0x2d5c99=_0x1591a4();while(!![]){try{const _0x1561aa=parseInt(_0x51e15b(0xa3))/0x1+parseInt(_0x51e15b(0x11b))/0x2*(parseInt(_0x51e15b(0xbe))/0x3)+-parseInt(_0x51e15b(0x123))/0x4*(parseInt(_0x51e15b(0x102))/0x5)+-parseInt(_0x51e15b(0xbd))/0x6*(-parseInt(_0x51e15b(0xda))/0x7)+-parseInt(_0x51e15b(0xf6))/0x8+parseInt(_0x51e15b(0xb7))/0x9+parseInt(_0x51e15b(0xbc))/0xa;if(_0x1561aa===_0x5ed34f)break;else _0x2d5c99['push'](_0x2d5c99['shift']());}catch(_0x466298){_0x2d5c99['push'](_0x2d5c99['shift']());}}}(a108_0x173b,0x9b91c));import{getCookie}from'../auth/get-cookie.js';import{getApiDomain,getRuntimeDomain}from'../constant/domain.js';import{CliErrors}from'../errors.js';import{extractList,extractPaging}from'../framework/response.js';let _activeCookie;export function setActiveCookie(_0x3bdbce){_activeCookie=_0x3bdbce||undefined;}export function clearActiveCookie(){_activeCookie=undefined;}async function apiRequest(_0x4f63d4,_0x192e17={}){const _0xd9d9d9=a108_0x7a54,{method:method=_0xd9d9d9(0xe1),body:_0x38fb8a,headers:headers={},timeout:timeout=0x7530,useRuntime:useRuntime=![]}=_0x192e17,_0x3503f6=useRuntime?getRuntimeDomain():getApiDomain(),_0x3e28f8=_activeCookie||getCookie(),_0x11303c=''+_0x3503f6+_0x4f63d4,_0x4401a1=new AbortController(),_0x40f6ab=setTimeout(()=>_0x4401a1[_0xd9d9d9(0xa6)](),timeout);try{const _0x3dab9b=await fetch(_0x11303c,{'method':method,'headers':{'Content-Type':'application/json','Cookie':_0x3e28f8,'X-Invoke-Source':'cli:rabetbase',...headers},'body':_0x38fb8a?JSON[_0xd9d9d9(0xd5)](_0x38fb8a):undefined,'signal':_0x4401a1[_0xd9d9d9(0x111)]});let _0x59027d;try{_0x59027d=await _0x3dab9b[_0xd9d9d9(0xab)]();}catch{throw CliErrors[_0xd9d9d9(0x10c)](_0xd9d9d9(0xa1)+_0x3dab9b['status']+')',_0x3dab9b['status']>=0x190?'Check\x20your\x20auth\x20cookie\x20and\x20try\x20again.':undefined);}if(!_0x3dab9b['ok']||_0x59027d['success']===![])throw CliErrors[_0xd9d9d9(0x10c)](_0x59027d[_0xd9d9d9(0xc5)]||_0x59027d[_0xd9d9d9(0xff)]||'API\x20error:\x20'+_0x3dab9b['status'],_0x59027d['errorCode']?_0xd9d9d9(0xf5)+_0x59027d['errorCode']:undefined);return _0x59027d;}catch(_0x1b9ddc){if(_0x1b9ddc instanceof Error&&_0x1b9ddc['name']===_0xd9d9d9(0xd3))throw CliErrors[_0xd9d9d9(0x10c)](_0xd9d9d9(0xd4)+_0x11303c);throw _0x1b9ddc;}finally{clearTimeout(_0x40f6ab);}}function isAuthFailure(_0xcff2e4){const _0x5a9a92=a108_0x7a54,_0x3ccf56=_0xcff2e4[_0x5a9a92(0xc5)]||_0xcff2e4[_0x5a9a92(0xff)]||_0xcff2e4[_0x5a9a92(0xf4)]?.[_0x5a9a92(0xff)]||_0xcff2e4[_0x5a9a92(0xfa)]||_0xcff2e4[_0x5a9a92(0xd8)]||'';return _0xcff2e4[_0x5a9a92(0x106)]===_0x5a9a92(0xf9)||_0xcff2e4[_0x5a9a92(0xcf)]===0x191||_0xcff2e4[_0x5a9a92(0xcf)]===_0x5a9a92(0xc8)||_0x3ccf56['includes'](_0x5a9a92(0xc8))||_0x3ccf56[_0x5a9a92(0xe2)](_0x5a9a92(0x104))||_0x3ccf56[_0x5a9a92(0xe2)]('登录')||_0x3ccf56[_0x5a9a92(0xe2)]('认证');}export async function platformFetch(_0x1c99c4,_0x44d666){const _0x37b33a=a108_0x7a54,_0x5ddad3=await fetch(_0x1c99c4,{'method':_0x44d666[_0x37b33a(0xb4)]??'GET','headers':{'Content-Type':_0x37b33a(0x109),'Cookie':_0x44d666[_0x37b33a(0x110)]},..._0x44d666['body']&&{'body':JSON['stringify'](_0x44d666['body'])}});if(!_0x5ddad3['ok']){if(_0x5ddad3['status']===0x191)throw CliErrors[_0x37b33a(0xa0)]();throw CliErrors[_0x37b33a(0x10c)](_0x44d666[_0x37b33a(0xac)]+_0x37b33a(0x119)+_0x5ddad3[_0x37b33a(0x11c)]);}const _0x253415=await _0x5ddad3[_0x37b33a(0xab)]();if(_0x253415[_0x37b33a(0xb5)]===![]){if(isAuthFailure(_0x253415))throw CliErrors[_0x37b33a(0xa0)]();throw CliErrors[_0x37b33a(0x10c)](_0x253415[_0x37b33a(0xc5)]||_0x253415['message']||_0x44d666['label']+_0x37b33a(0x108));}return _0x253415[_0x37b33a(0xf4)];}export async function listBffScripts(_0x47c4d0,_0x34060d,_0x52065b){const _0x4ade37=a108_0x7a54;let _0x37d9e9='/api/management/library/scripts/list?appCode='+_0x47c4d0;if(_0x34060d)_0x37d9e9+='&type='+_0x34060d;const _0x5ca561=await apiRequest(_0x37d9e9);let _0x197abe=extractList(_0x5ca561['data']);if(_0x52065b?.[_0x4ade37(0xb1)]){const _0x5e86f5=_0x52065b[_0x4ade37(0xb1)][_0x4ade37(0x11a)]();_0x197abe=_0x197abe[_0x4ade37(0xf7)](_0x1c106e=>_0x1c106e[_0x4ade37(0xbf)]?.['toLowerCase']()[_0x4ade37(0xe2)](_0x5e86f5)||_0x1c106e[_0x4ade37(0xc3)]?.['toLowerCase']()[_0x4ade37(0xe2)](_0x5e86f5));}return _0x197abe;}export async function getBffScriptInfo(_0x2a1a3e){const _0x24cf6c=a108_0x7a54,_0x29f2ba=await apiRequest(_0x24cf6c(0xbb)+_0x2a1a3e);if(!_0x29f2ba['data'])throw CliErrors[_0x24cf6c(0x105)]('BFF\x20script\x20not\x20found:\x20id='+_0x2a1a3e);return _0x29f2ba[_0x24cf6c(0xf4)];}export async function saveBffScript(_0x5b9366){const _0x3b3b0b=a108_0x7a54,_0x407260=await apiRequest(_0x3b3b0b(0xe4),{'method':_0x3b3b0b(0xd1),'body':_0x5b9366});return _0x407260['data'];}export async function deleteBffScript(_0x4306c3){const _0x33649b=a108_0x7a54;await apiRequest(_0x33649b(0xc6),{'method':_0x33649b(0xd1),'body':{'id':_0x4306c3}});}export async function getBffScriptStatistics(_0x316461){const _0x48e3b7=a108_0x7a54,_0x51b125=await apiRequest(_0x48e3b7(0xdd)+_0x316461);return extractList(_0x51b125[_0x48e3b7(0xf4)]);}export async function listBffDatasetOperations(_0x3198c7,_0x7a433f){const _0x1b1f8f=a108_0x7a54,_0xc7a84e=await apiRequest('/smartapi/dataset/get-dataset-operation',{'method':_0x1b1f8f(0xd1),'body':{'appCode':_0x3198c7,'datasetId':_0x7a433f}});return _0xc7a84e[_0x1b1f8f(0xf4)];}export async function listSqlQueries(_0x4e3776,_0x265e0f){const _0x5f1fb0=a108_0x7a54,_0x20b70e=await apiRequest(_0x5f1fb0(0xb6),{'method':'POST','body':{'appCode':_0x4e3776,'currentPage':_0x265e0f?.[_0x5f1fb0(0xb0)]??0x1,'pageSize':_0x265e0f?.[_0x5f1fb0(0xe0)]??0x32,'sqlCode':_0x265e0f?.[_0x5f1fb0(0xf3)],'sqlName':_0x265e0f?.['sqlName']}});return _0x20b70e['data'];}export async function getSqlQueryInfo(_0x2aadad,_0x3dd5a5){const _0x246640=a108_0x7a54,_0x20f7cd=await listSqlQueries(_0x2aadad,{'sqlCode':_0x3dd5a5}),_0x1dce6d=_0x20f7cd[_0x246640(0xd9)]?.[0x0];if(!_0x1dce6d)throw CliErrors[_0x246640(0x105)](_0x246640(0xcd)+_0x3dd5a5);return _0x1dce6d;}export async function saveSqlQuery(_0x42d7b4){const _0x36af26=a108_0x7a54,_0x57d7ed=await apiRequest(_0x36af26(0xf8),{'method':'POST','body':_0x42d7b4});return _0x57d7ed['data'];}export async function executeSql(_0x51b2c0,_0xfdd52a,_0x48bf50){const _0x369414=a108_0x7a54,_0x5e0759=await apiRequest(_0x369414(0xe9),{'method':_0x369414(0xd1),'body':{'appCode':_0x51b2c0,'sqlCode':_0xfdd52a,..._0x48bf50&&{'params':_0x48bf50}},'useRuntime':!![]});return _0x5e0759[_0x369414(0xf4)];}export async function listDatasets(_0x45ff97,_0x24f8ce){const _0xbc2e2b=a108_0x7a54,_0x5a3ec7={'appCode':_0x45ff97,'deleted':![]};if(_0x24f8ce?.[_0xbc2e2b(0xcf)])_0x5a3ec7['code']=_0x24f8ce[_0xbc2e2b(0xcf)];if(_0x24f8ce?.['name'])_0x5a3ec7['name']=_0x24f8ce[_0xbc2e2b(0xc1)];const _0x310721=await apiRequest('/smartapi/dataset/get-dataset-list',{'method':_0xbc2e2b(0xd1),'body':_0x5a3ec7});return extractList(_0x310721[_0xbc2e2b(0xf4)]);}function a108_0x7a54(_0x235679,_0x450ce8){_0x235679=_0x235679-0xa0;const _0x173bb2=a108_0x173b();let _0x7a545a=_0x173bb2[_0x235679];return _0x7a545a;}export async function searchDatasets(_0xd0d5b3,_0x290398){const _0x279512=a108_0x7a54,_0x57aa44=await listDatasets(_0xd0d5b3,{'name':_0x290398}),_0x239d06=_0x290398['toLowerCase'](),_0x394918=new Set(_0x57aa44[_0x279512(0xd2)](_0x4d88db=>_0x4d88db['id'])),_0x4b17b2=_0x57aa44[_0x279512(0xf7)](_0x1dd6d1=>_0x1dd6d1[_0x279512(0xfc)]?.['tableName']?.[_0x279512(0x11a)]()[_0x279512(0xe2)](_0x239d06)||_0x1dd6d1['description']?.['toLowerCase']()[_0x279512(0xe2)](_0x239d06)),_0x342005=await listDatasets(_0xd0d5b3,{'code':_0x290398});for(const _0x3f256c of _0x342005){!_0x394918['has'](_0x3f256c['id'])&&(_0x57aa44[_0x279512(0xee)](_0x3f256c),_0x394918['add'](_0x3f256c['id']));}return _0x57aa44;}export function normalizeDatasetOperations(_0x155084){const _0x12c83e=a108_0x7a54;if(Array[_0x12c83e(0xc4)](_0x155084))return _0x155084[_0x12c83e(0xf7)](_0x348c70=>_0x348c70!=null&&typeof _0x348c70===_0x12c83e(0xfd));if(_0x155084&&typeof _0x155084===_0x12c83e(0xfd))return Object[_0x12c83e(0x112)](_0x155084)['filter'](([,_0x354476])=>_0x354476!=null&&typeof _0x354476===_0x12c83e(0xfd))['map'](([_0x5301d6,_0x1a6fb3])=>({..._0x1a6fb3,'name':_0x1a6fb3[_0x12c83e(0xc1)]??_0x1a6fb3['operationName']??_0x5301d6}));return[];}function a108_0x173b(){const _0xe00c02=['toLowerCase','114ZIGeSY','status','(/*\x20params\x20*/);','const\x20client\x20=\x20new\x20LovrabetClient({\x20appCode:\x20\x27<YOUR_APP_CODE>\x27\x20});','set','\x20\x20params:\x20{\x20/*\x20parameter\x20values\x20*/\x20},','remove','enabled','628ISmWYE','if\x20(!data.execSuccess)\x20throw\x20new\x20Error(\x27SQL\x20execution\x20failed\x27);','.getOne(id);','/smartapi/dblink/getList','authRequired','API\x20returned\x20non-JSON\x20response\x20(HTTP\x20','/smartapi/dblink/delete','44644CZLVYn','\x20of\x20','});','abort','sqlName','modelCode','update','Dataset\x20not\x20found:\x20','json','label','toString','delete','//\x20SQL:\x20','currentPage','scriptName','\x22\x20not\x20found\x20in\x20dataset\x20','/smartapi/dblink/update','method','success','/smartapi/custom/queryUserCustomSqlList','3703644VnKvJQ','string','//\x20BFF\x20context:\x20context.client.sql.execute\x20returns\x20rows\x20directly','export\x20default\x20async\x20function\x20handler(params,\x20context)\x20{','/api/management/library/scripts/info?id=','8866250CDFLoM','2319042dmUgpP','10029aVFlSF','functionName','Use\x20the\x20platform\x20console\x20to\x20see\x20all.','name','/smartapi/dblink/testConnect','description','isArray','errorMsg','/api/management/library/scripts/delete','Operation\x20\x22','401','warn','\x20\x20\x20\x20sqlCode:\x20\x27','tableName','test','SQL\x20query\x20not\x20found:\x20','length','code','find','POST','map','AbortError','Request\x20timeout:\x20','stringify','\x20\x20return\x20rows;','dataset_','error','tableData','7msRdPq','\x20\x20});','const\x20result\x20=\x20await\x20client.models.','/api/management/library/scripts/statistics?appCode=','create','responseFields','pageSize','GET','includes','replace','/api/management/library/scripts/save','modelId','totalCount','.update(id,\x20{\x20/*\x20fields\x20*/\x20});','/smartapi/dblink/getAllTableList','/api/custom/executeSql','requestFields','const\x20data\x20=\x20await\x20client.sql.execute({','\x20\x20sqlCode:\x20\x27','/smartapi/app/getList','push','includeImports','join','import\x20{\x20LovrabetClient\x20}\x20from\x20\x27@lovrabet/sdk\x27;','\x20\x20currentPage:\x201,','sqlCode','data','API\x20error\x20code:\x20','8133384lcRzQf','filter','/api/node-toolbox/sql/save','UNAUTHORIZED','errorMessage','//\x20','dbtableConfig','object','/smartapi/dataset/get-driven-data?','message','type','displayName','8470kSZQCj','Warning:\x20showing\x20first\x20','Unauthorized','validation','errorCode','table','\x20failed','application/json','const\x20results\x20=\x20data.execResult\x20||\x20[];','path','apiError','/smartapi/question/er-config','/smartapi/db-analysis/start','operationName','cookie','signal','entries','operations','/smartapi/db-analysis/status/','tableList','pageIndex','/smartapi/db-analysis/jobs/cancel','/smartapi/dblink/create','\x20failed,\x20HTTP\x20'];a108_0x173b=function(){return _0xe00c02;};return a108_0x173b();}export async function getDatasetDetail(_0x31a1d6){const _0x3307eb=a108_0x7a54,_0x155ba3=/^\d+$/['test'](_0x31a1d6)?'id':'code',_0x19cc4e=await apiRequest(_0x3307eb(0xfe)+_0x155ba3+'='+_0x31a1d6);return _0x19cc4e[_0x3307eb(0xf4)];}export async function getDatasetOperations(_0x4ef482){const _0x1c7925=a108_0x7a54,_0x24255c=await getDatasetDetail(_0x4ef482),_0x41e3f6=normalizeDatasetOperations(_0x24255c[_0x1c7925(0x113)])[_0x1c7925(0xd2)](_0xe29d19=>({'name':_0xe29d19['name']||_0xe29d19[_0x1c7925(0x10f)],'displayName':_0xe29d19[_0x1c7925(0x101)]||_0xe29d19[_0x1c7925(0xc1)],'type':_0xe29d19[_0x1c7925(0x100)],'method':_0xe29d19[_0x1c7925(0xb4)],'path':_0xe29d19[_0x1c7925(0x10b)],'enabled':_0xe29d19[_0x1c7925(0x122)]??!![],'requestFields':_0xe29d19[_0x1c7925(0xea)],'responseFields':_0xe29d19[_0x1c7925(0xdf)]}));return{'dataset':{'id':_0x24255c['id']??_0x24255c['modelId'],'name':_0x24255c['name'],'code':_0x24255c[_0x1c7925(0xcf)]||_0x24255c[_0x1c7925(0xa8)],'tableName':_0x24255c[_0x1c7925(0xcb)]||_0x24255c[_0x1c7925(0xfc)]?.[_0x1c7925(0xcb)]},'operations':_0x41e3f6};}export async function getOperationDetail(_0x3cee1a,_0xe0c565,_0x2e1e83){const _0x498154=a108_0x7a54;let _0x2a8f11=_0xe0c565;if(!/^\d+$/[_0x498154(0xcc)](_0xe0c565)){const _0x41e261=await listDatasets(_0x3cee1a,{'code':_0xe0c565}),_0x20e47e=_0x41e261[_0x498154(0xd0)](_0x1f67c0=>_0x1f67c0[_0x498154(0xcf)]===_0xe0c565||String(_0x1f67c0['id'])===_0xe0c565);if(!_0x20e47e)throw CliErrors['validation'](_0x498154(0xaa)+_0xe0c565);_0x2a8f11=String(_0x20e47e['id']);}const _0x3bd6ab=await getDatasetDetail(_0x2a8f11),_0x4bac0c=normalizeDatasetOperations(_0x3bd6ab['operations'])['find'](_0xfd83c8=>(_0xfd83c8['name']||_0xfd83c8[_0x498154(0x10f)])===_0x2e1e83);if(!_0x4bac0c)throw CliErrors['validation'](_0x498154(0xc7)+_0x2e1e83+_0x498154(0xb2)+_0xe0c565);return{'dataset':{'id':_0x3bd6ab['id']??_0x3bd6ab[_0x498154(0xe5)],'name':_0x3bd6ab[_0x498154(0xc1)],'code':_0x3bd6ab[_0x498154(0xcf)]||_0x3bd6ab[_0x498154(0xa8)],'tableName':_0x3bd6ab['tableName']||_0x3bd6ab[_0x498154(0xfc)]?.[_0x498154(0xcb)]},'operation':_0x4bac0c};}export function generateSdkCode(_0x43a07e,_0x1bdab2,_0x292555){const _0x114380=a108_0x7a54,_0x5dc3f7=_0x292555?.['includeImports']??!![],_0x3c7d1a=_0x114380(0xd7)+_0x43a07e['code']?.[_0x114380(0xe3)](/-/g,'_'),_0x370846=_0x1bdab2[_0x114380(0xc1)]||_0x1bdab2[_0x114380(0x10f)]||_0x114380(0xf7),_0x5b3a3b=[];_0x5dc3f7&&_0x5b3a3b['push'](_0x114380(0xf1),'',_0x114380(0x11e),'');_0x5b3a3b['push'](_0x114380(0xfb)+_0x43a07e[_0x114380(0xc1)]+'\x20('+(_0x43a07e['tableName']||_0x114380(0x107))+')');if(_0x370846===_0x114380(0xf7))_0x5b3a3b[_0x114380(0xee)](_0x114380(0xdc)+_0x3c7d1a+'.filter({','\x20\x20where:\x20{},','\x20\x20pageSize:\x2020,',_0x114380(0xf2),_0x114380(0xa5));else{if(_0x370846==='getOne')_0x5b3a3b[_0x114380(0xee)](_0x114380(0xdc)+_0x3c7d1a+_0x114380(0x125));else{if(_0x370846===_0x114380(0xde))_0x5b3a3b[_0x114380(0xee)](_0x114380(0xdc)+_0x3c7d1a+'.create({\x20/*\x20fields\x20*/\x20});');else{if(_0x370846===_0x114380(0xa9))_0x5b3a3b[_0x114380(0xee)](_0x114380(0xdc)+_0x3c7d1a+_0x114380(0xe7));else _0x370846===_0x114380(0xae)||_0x370846===_0x114380(0x121)?_0x5b3a3b[_0x114380(0xee)](_0x114380(0xdc)+_0x3c7d1a+'.remove(id);'):_0x5b3a3b[_0x114380(0xee)](_0x114380(0xdc)+_0x3c7d1a+'.'+_0x370846+_0x114380(0x11d));}}}return _0x5b3a3b[_0x114380(0xf0)]('\x0a');}export function generateSqlCodeTemplate(_0x45ce9d,_0x338780){const _0x17b7c3=a108_0x7a54,_0x56ab04=_0x338780?.['target']??'sdk',_0x589e4b=_0x338780?.[_0x17b7c3(0xef)]??!![],_0xcc5284=[];return _0xcc5284[_0x17b7c3(0xee)](_0x17b7c3(0xaf)+_0x45ce9d[_0x17b7c3(0xa7)]+'\x20('+_0x45ce9d[_0x17b7c3(0xf3)]+')'),_0x56ab04==='sdk'?(_0x589e4b&&_0xcc5284['push'](_0x17b7c3(0xf1),'','const\x20client\x20=\x20new\x20LovrabetClient({\x20appCode:\x20\x27<YOUR_APP_CODE>\x27\x20});',''),_0xcc5284['push'](_0x17b7c3(0xeb),_0x17b7c3(0xec)+_0x45ce9d[_0x17b7c3(0xf3)]+'\x27,',_0x17b7c3(0x120),_0x17b7c3(0xa5),_0x17b7c3(0x124),_0x17b7c3(0x10a))):_0xcc5284[_0x17b7c3(0xee)](_0x17b7c3(0xb9),_0x17b7c3(0xba),'\x20\x20const\x20rows\x20=\x20await\x20context.client.sql.execute({',_0x17b7c3(0xca)+_0x45ce9d[_0x17b7c3(0xf3)]+'\x27,','\x20\x20\x20\x20params:\x20{\x20/*\x20parameter\x20values\x20*/\x20},',_0x17b7c3(0xdb),_0x17b7c3(0xd6),'}'),_0xcc5284[_0x17b7c3(0xf0)]('\x0a');}export async function getErConfig(_0x38c02f,_0xa556b9){const _0x2b460b=a108_0x7a54,_0x4e809c=await apiRequest(_0x2b460b(0x10d),{'method':'POST','body':{'appCode':_0x38c02f,'dblinkId':_0xa556b9}});return _0x4e809c['data'];}function buildQuery(_0x48b60c){const _0x45079b=a108_0x7a54,_0xa48de4=new URLSearchParams();for(const [_0x5bd9e7,_0x11df50]of Object[_0x45079b(0x112)](_0x48b60c)){if(_0x11df50===undefined||_0x11df50==='')continue;_0xa48de4[_0x45079b(0x11f)](_0x5bd9e7,String(_0x11df50));}const _0x72ec6c=_0xa48de4[_0x45079b(0xad)]();return _0x72ec6c?'?'+_0x72ec6c:'';}export async function listDbLinks(_0x185026,_0x4b3286){const _0x288824=a108_0x7a54,_0x54e92c=await apiRequest(_0x288824(0x126),{'method':_0x288824(0xd1),'body':{'appCode':_0x185026,'currentPage':_0x4b3286?.[_0x288824(0xb0)]??0x1,'pageSize':_0x4b3286?.['pageSize']??0x64}});return{'items':extractList(_0x54e92c[_0x288824(0xf4)]),'paging':extractPaging(_0x54e92c['data'])};}export async function getDbLinkInfo(_0x155a7c){const _0x4e076f=a108_0x7a54,_0x3d866b=await apiRequest('/smartapi/dblink/getOne'+buildQuery({'id':_0x155a7c}));return _0x3d866b[_0x4e076f(0xf4)];}export async function createDbLink(_0x120aef){const _0xee678f=a108_0x7a54,_0xcdfe47=await apiRequest(_0xee678f(0x118),{'method':_0xee678f(0xd1),'body':_0x120aef});return _0xcdfe47['data'];}export async function updateDbLink(_0x2436f9){const _0x6603e7=a108_0x7a54,_0x1653f5=await apiRequest(_0x6603e7(0xb3),{'method':_0x6603e7(0xd1),'body':_0x2436f9});return _0x1653f5[_0x6603e7(0xf4)];}export async function deleteDbLink(_0x428fa6){const _0x367e62=a108_0x7a54;await apiRequest(_0x367e62(0xa2),{'method':_0x367e62(0xd1),'body':{'id':_0x428fa6}});}export async function testDbLinkConnect(_0x455db0){const _0x1c46ab=a108_0x7a54,_0x2e3d9a=await apiRequest(_0x1c46ab(0xc2)+buildQuery({'id':_0x455db0}));return _0x2e3d9a[_0x1c46ab(0xf4)];}export async function startDbAnalysis(_0x3446da,_0x180a28){const _0x52e341=a108_0x7a54,_0x227e92=await apiRequest(_0x52e341(0x10e),{'method':_0x52e341(0xd1),'body':{'dbLinkId':_0x3446da,..._0x180a28&&_0x180a28[_0x52e341(0xce)]>0x0?{'tableNames':_0x180a28}:{}}}),_0x48dcba=_0x227e92[_0x52e341(0xf4)];if(typeof _0x48dcba==='string')return _0x48dcba;if(_0x48dcba&&typeof _0x48dcba===_0x52e341(0xfd)&&typeof _0x48dcba['planId']===_0x52e341(0xb8))return _0x48dcba['planId'];return _0x48dcba!=null?String(_0x48dcba):'';}export async function cancelDbAnalysis(_0x5cc69d){const _0x36b690=a108_0x7a54;await apiRequest(_0x36b690(0x117)+buildQuery({'planId':_0x5cc69d}),{'method':_0x36b690(0xd1)});}export async function getDbAnalysisStatus(_0x236a7a){const _0x5c5827=a108_0x7a54,_0x18a74a=await apiRequest(_0x5c5827(0x114)+encodeURIComponent(_0x236a7a));return _0x18a74a[_0x5c5827(0xf4)];}export async function getDbAllTableList(_0x3eae1f,_0x42e328){const _0x3192df=a108_0x7a54,_0x417f9b=await apiRequest(_0x3192df(0xe8)+buildQuery({'appCode':_0x3eae1f,'dbLinkId':_0x42e328})),_0x276f71=_0x417f9b[_0x3192df(0xf4)];if(Array['isArray'](_0x276f71))return _0x276f71;return extractList(_0x276f71);}export async function getDbTableDiff(_0x5c81e4,_0x3204a0,_0x204b0f){const _0x47cd3f=a108_0x7a54,_0x23d2b0=await apiRequest('/smartapi/dblink/getTableDiffV2ByPage'+buildQuery({'appCode':_0x5c81e4,'dbLinkId':_0x3204a0,'pageIndex':_0x204b0f?.[_0x47cd3f(0x116)]??0x1,'pageSize':_0x204b0f?.['pageSize']??0x14,'tableName':_0x204b0f?.[_0x47cd3f(0xcb)]})),_0x32f87b=_0x23d2b0[_0x47cd3f(0xf4)];return{'totalCount':_0x32f87b?.[_0x47cd3f(0xe6)]??0x0,'tableList':Array[_0x47cd3f(0xc4)](_0x32f87b?.[_0x47cd3f(0x115)])?_0x32f87b['tableList']:[]};}const REMOTE_APP_PAGE_SIZE=0xc8;export async function listRemoteApps(){const _0x12ecd0=a108_0x7a54,_0xec559f=await apiRequest(_0x12ecd0(0xed),{'method':_0x12ecd0(0xd1),'body':{'currentPage':0x1,'pageSize':REMOTE_APP_PAGE_SIZE}}),_0x4dba77=extractList(_0xec559f[_0x12ecd0(0xf4)]),_0x24975f=extractPaging(_0xec559f[_0x12ecd0(0xf4)]);return _0x24975f&&_0x24975f[_0x12ecd0(0xe6)]>REMOTE_APP_PAGE_SIZE&&console[_0x12ecd0(0xc9)](_0x12ecd0(0x103)+REMOTE_APP_PAGE_SIZE+_0x12ecd0(0xa4)+_0x24975f['totalCount']+'\x20apps.\x20'+_0x12ecd0(0xc0)),_0x4dba77;}
|
|
1
|
+
(function(_0x32aa36,_0x445b01){const _0x3ddfca=a113_0x3471,_0x98d44c=_0x32aa36();while(!![]){try{const _0x12dbb4=-parseInt(_0x3ddfca(0x19f))/0x1+parseInt(_0x3ddfca(0x1f5))/0x2+parseInt(_0x3ddfca(0x1bd))/0x3+parseInt(_0x3ddfca(0x1ee))/0x4+parseInt(_0x3ddfca(0x19d))/0x5*(-parseInt(_0x3ddfca(0x194))/0x6)+-parseInt(_0x3ddfca(0x1ff))/0x7+parseInt(_0x3ddfca(0x1b2))/0x8;if(_0x12dbb4===_0x445b01)break;else _0x98d44c['push'](_0x98d44c['shift']());}catch(_0xc06bd6){_0x98d44c['push'](_0x98d44c['shift']());}}}(a113_0x3905,0xb8b35));import{getCookie}from'../auth/get-cookie.js';import{getApiDomain,getRuntimeDomain}from'../constant/domain.js';import{CliErrors}from'../errors.js';import{extractList,extractPaging}from'../framework/response.js';function a113_0x3905(){const _0x569c3f=['Request\x20timeout:\x20','includeImports','errorCode','operationName','sqlCode','/smartapi/dblink/getTableDiffV2ByPage','/api/node-toolbox/sql/save','/smartapi/dblink/create','if\x20(!data.execSuccess)\x20throw\x20new\x20Error(\x27SQL\x20execution\x20failed\x27);','validation','\x20failed','\x20\x20\x20\x20sqlCode:\x20\x27','join','name','export\x20default\x20async\x20function\x20handler(params,\x20context)\x20{','Unauthorized','BFF\x20script\x20not\x20found:\x20id=','filter','Check\x20your\x20auth\x20cookie\x20and\x20try\x20again.','6rMnBfU','modelCode','totalCount','success','label','\x20\x20pageSize:\x2020,','toString','\x20\x20\x20\x20params:\x20{\x20/*\x20parameter\x20values\x20*/\x20},','errorMessage','4012490darVNC','apiError','1443303pAKZeK','isArray','entries','pageSize','//\x20BFF\x20context:\x20context.client.sql.execute\x20returns\x20rows\x20directly','create','/smartapi/dataset/get-dataset-operation','/smartapi/db-analysis/jobs/cancel','operations','pageIndex','scriptName','code','replace','const\x20result\x20=\x20await\x20client.models.','description','tableList','displayName','/api/management/library/scripts/info?id=','Warning:\x20showing\x20first\x20','9057440ZzVBdc','const\x20client\x20=\x20new\x20LovrabetClient({\x20appCode:\x20\x27<YOUR_APP_CODE>\x27\x20});','target','//\x20SQL:\x20','&type=','status','/smartapi/dblink/getOne','body','API\x20error\x20code:\x20','responseFields','set','4207332CqaMxs','\x20\x20const\x20rows\x20=\x20await\x20context.client.sql.execute({','tableName','json','AbortError','currentPage','(/*\x20params\x20*/);','\x20\x20return\x20rows;','/smartapi/dblink/getAllTableList','object','const\x20data\x20=\x20await\x20client.sql.execute({','\x20failed,\x20HTTP\x20','find','message','functionName','\x20\x20where:\x20{},','\x20\x20params:\x20{\x20/*\x20parameter\x20values\x20*/\x20},','stringify','\x20of\x20','/smartapi/dataset/get-dataset-list','test','dataset_','remove','errorMsg','table','\x20\x20currentPage:\x201,','string','has','UNAUTHORIZED','.create({\x20/*\x20fields\x20*/\x20});','authRequired','tableData','modelId','/api/management/library/scripts/delete','/api/management/library/scripts/statistics?appCode=','API\x20error:\x20','method','GET','/smartapi/db-analysis/status/','/smartapi/dataset/get-driven-data?','abort','API\x20returned\x20non-JSON\x20response\x20(HTTP\x20','enabled','length','cookie','requestFields','add','warn','\x20\x20});','1456732FwWDAc','data','type','Use\x20the\x20platform\x20console\x20to\x20see\x20all.','signal','sqlName','});','1471520TVFBaZ','push','POST','401','application/json','includes','.getOne(id);','map','dbtableConfig','SQL\x20query\x20not\x20found:\x20','4425631Kfgvld','toLowerCase','update'];a113_0x3905=function(){return _0x569c3f;};return a113_0x3905();}let _activeCookie;export function setActiveCookie(_0x343f9b){_activeCookie=_0x343f9b||undefined;}export function clearActiveCookie(){_activeCookie=undefined;}async function apiRequest(_0x49bc87,_0x1f6119={}){const _0x2eae73=a113_0x3471,{method:method=_0x2eae73(0x1e2),body:_0xfa57bf,headers:headers={},timeout:timeout=0x7530,useRuntime:useRuntime=![]}=_0x1f6119,_0xb62655=useRuntime?getRuntimeDomain():getApiDomain(),_0x439c9f=_activeCookie||getCookie(),_0x3d427e=''+_0xb62655+_0x49bc87,_0x1f6177=new AbortController(),_0x2f82e9=setTimeout(()=>_0x1f6177[_0x2eae73(0x1e5)](),timeout);try{const _0x451862=await fetch(_0x3d427e,{'method':method,'headers':{'Content-Type':_0x2eae73(0x1f9),'Cookie':_0x439c9f,'X-Invoke-Source':'cli:rabetbase',...headers},'body':_0xfa57bf?JSON['stringify'](_0xfa57bf):undefined,'signal':_0x1f6177[_0x2eae73(0x1f2)]});let _0x4f27e4;try{_0x4f27e4=await _0x451862[_0x2eae73(0x1c0)]();}catch{throw CliErrors[_0x2eae73(0x19e)](_0x2eae73(0x1e6)+_0x451862[_0x2eae73(0x1b7)]+')',_0x451862[_0x2eae73(0x1b7)]>=0x190?_0x2eae73(0x193):undefined);}if(!_0x451862['ok']||_0x4f27e4[_0x2eae73(0x197)]===![])throw CliErrors[_0x2eae73(0x19e)](_0x4f27e4[_0x2eae73(0x1d4)]||_0x4f27e4['message']||_0x2eae73(0x1e0)+_0x451862[_0x2eae73(0x1b7)],_0x4f27e4['errorCode']?_0x2eae73(0x1ba)+_0x4f27e4[_0x2eae73(0x204)]:undefined);return _0x4f27e4;}catch(_0x2b47fa){if(_0x2b47fa instanceof Error&&_0x2b47fa[_0x2eae73(0x18e)]===_0x2eae73(0x1c1))throw CliErrors[_0x2eae73(0x19e)](_0x2eae73(0x202)+_0x3d427e);throw _0x2b47fa;}finally{clearTimeout(_0x2f82e9);}}function isAuthFailure(_0x1884f5){const _0x102273=a113_0x3471,_0x466cff=_0x1884f5[_0x102273(0x1d4)]||_0x1884f5[_0x102273(0x1ca)]||_0x1884f5[_0x102273(0x1ef)]?.['message']||_0x1884f5[_0x102273(0x19c)]||_0x1884f5['error']||'';return _0x1884f5['errorCode']===_0x102273(0x1d9)||_0x1884f5[_0x102273(0x1aa)]===0x191||_0x1884f5['code']===_0x102273(0x1f8)||_0x466cff[_0x102273(0x1fa)](_0x102273(0x1f8))||_0x466cff[_0x102273(0x1fa)](_0x102273(0x190))||_0x466cff['includes']('登录')||_0x466cff[_0x102273(0x1fa)]('认证');}export async function platformFetch(_0xe60fb8,_0x34a3db){const _0x4199d6=a113_0x3471,_0x5dfa7b=await fetch(_0xe60fb8,{'method':_0x34a3db[_0x4199d6(0x1e1)]??_0x4199d6(0x1e2),'headers':{'Content-Type':_0x4199d6(0x1f9),'Cookie':_0x34a3db[_0x4199d6(0x1e9)]},..._0x34a3db[_0x4199d6(0x1b9)]&&{'body':JSON[_0x4199d6(0x1ce)](_0x34a3db[_0x4199d6(0x1b9)])}});if(!_0x5dfa7b['ok']){if(_0x5dfa7b[_0x4199d6(0x1b7)]===0x191)throw CliErrors['authRequired']();throw CliErrors[_0x4199d6(0x19e)](_0x34a3db[_0x4199d6(0x198)]+_0x4199d6(0x1c8)+_0x5dfa7b[_0x4199d6(0x1b7)]);}const _0x583de9=await _0x5dfa7b[_0x4199d6(0x1c0)]();if(_0x583de9['success']===![]){if(isAuthFailure(_0x583de9))throw CliErrors[_0x4199d6(0x1db)]();throw CliErrors[_0x4199d6(0x19e)](_0x583de9[_0x4199d6(0x1d4)]||_0x583de9[_0x4199d6(0x1ca)]||_0x34a3db[_0x4199d6(0x198)]+_0x4199d6(0x20c));}return _0x583de9['data'];}export async function listBffScripts(_0x263195,_0x49a6bc,_0x43994d){const _0x3fbfdb=a113_0x3471;let _0x5c1baf='/api/management/library/scripts/list?appCode='+_0x263195;if(_0x49a6bc)_0x5c1baf+=_0x3fbfdb(0x1b6)+_0x49a6bc;const _0x973550=await apiRequest(_0x5c1baf);let _0x74f7c2=extractList(_0x973550[_0x3fbfdb(0x1ef)]);if(_0x43994d?.[_0x3fbfdb(0x1a9)]){const _0x52ab23=_0x43994d[_0x3fbfdb(0x1a9)][_0x3fbfdb(0x200)]();_0x74f7c2=_0x74f7c2[_0x3fbfdb(0x192)](_0x2bcd88=>_0x2bcd88[_0x3fbfdb(0x1cb)]?.[_0x3fbfdb(0x200)]()[_0x3fbfdb(0x1fa)](_0x52ab23)||_0x2bcd88[_0x3fbfdb(0x1ad)]?.[_0x3fbfdb(0x200)]()[_0x3fbfdb(0x1fa)](_0x52ab23));}return _0x74f7c2;}export async function getBffScriptInfo(_0x1dec59){const _0x527b21=a113_0x3471,_0xbaaedc=await apiRequest(_0x527b21(0x1b0)+_0x1dec59);if(!_0xbaaedc[_0x527b21(0x1ef)])throw CliErrors[_0x527b21(0x20b)](_0x527b21(0x191)+_0x1dec59);return _0xbaaedc[_0x527b21(0x1ef)];}export async function saveBffScript(_0x596a5f){const _0xb50eb=a113_0x3471,_0x1e415d=await apiRequest('/api/management/library/scripts/save',{'method':_0xb50eb(0x1f7),'body':_0x596a5f});return _0x1e415d[_0xb50eb(0x1ef)];}export async function deleteBffScript(_0x211b7a){const _0xfa978e=a113_0x3471;await apiRequest(_0xfa978e(0x1de),{'method':_0xfa978e(0x1f7),'body':{'id':_0x211b7a}});}export async function getBffScriptStatistics(_0x211fa8){const _0x436773=a113_0x3471,_0x24440b=await apiRequest(_0x436773(0x1df)+_0x211fa8);return extractList(_0x24440b['data']);}export async function listBffDatasetOperations(_0x9ca3f3,_0x19050d){const _0x55fd67=a113_0x3471,_0x52d8a5=await apiRequest(_0x55fd67(0x1a5),{'method':_0x55fd67(0x1f7),'body':{'appCode':_0x9ca3f3,'datasetId':_0x19050d}});return _0x52d8a5[_0x55fd67(0x1ef)];}export async function listSqlQueries(_0x1d8c83,_0x9f702d){const _0x38a4cf=a113_0x3471,_0x1fe340=await apiRequest('/smartapi/custom/queryUserCustomSqlList',{'method':_0x38a4cf(0x1f7),'body':{'appCode':_0x1d8c83,'currentPage':_0x9f702d?.[_0x38a4cf(0x1c2)]??0x1,'pageSize':_0x9f702d?.[_0x38a4cf(0x1a2)]??0x32,'sqlCode':_0x9f702d?.[_0x38a4cf(0x206)],'sqlName':_0x9f702d?.['sqlName']}});return _0x1fe340[_0x38a4cf(0x1ef)];}export async function getSqlQueryInfo(_0x3043f2,_0x947c52){const _0x5b8442=a113_0x3471,_0x256f62=await listSqlQueries(_0x3043f2,{'sqlCode':_0x947c52}),_0x3cf6ca=_0x256f62[_0x5b8442(0x1dc)]?.[0x0];if(!_0x3cf6ca)throw CliErrors[_0x5b8442(0x20b)](_0x5b8442(0x1fe)+_0x947c52);return _0x3cf6ca;}export async function saveSqlQuery(_0x2b99d0){const _0x9cf8d0=a113_0x3471,_0x381570=await apiRequest(_0x9cf8d0(0x208),{'method':_0x9cf8d0(0x1f7),'body':_0x2b99d0});return _0x381570[_0x9cf8d0(0x1ef)];}export async function executeSql(_0xbca99,_0x5dc182,_0x46d805){const _0x4f22de=a113_0x3471,_0x5169be=await apiRequest('/api/custom/executeSql',{'method':_0x4f22de(0x1f7),'body':{'appCode':_0xbca99,'sqlCode':_0x5dc182,..._0x46d805&&{'params':_0x46d805}},'useRuntime':!![]});return _0x5169be[_0x4f22de(0x1ef)];}function a113_0x3471(_0x16ef67,_0x6b5d8c){_0x16ef67=_0x16ef67-0x18e;const _0x39051e=a113_0x3905();let _0x347127=_0x39051e[_0x16ef67];return _0x347127;}export async function listDatasets(_0x294008,_0x3cf691){const _0x597cb2=a113_0x3471,_0xb216b3={'appCode':_0x294008,'deleted':![]};if(_0x3cf691?.[_0x597cb2(0x1aa)])_0xb216b3[_0x597cb2(0x1aa)]=_0x3cf691[_0x597cb2(0x1aa)];if(_0x3cf691?.[_0x597cb2(0x18e)])_0xb216b3[_0x597cb2(0x18e)]=_0x3cf691[_0x597cb2(0x18e)];const _0x398ae5=await apiRequest(_0x597cb2(0x1d0),{'method':'POST','body':_0xb216b3});return extractList(_0x398ae5[_0x597cb2(0x1ef)]);}export async function searchDatasets(_0x3aad54,_0x53b1b0){const _0x5df17a=a113_0x3471,_0x2bbfca=await listDatasets(_0x3aad54,{'name':_0x53b1b0}),_0x2a188d=_0x53b1b0[_0x5df17a(0x200)](),_0x15d93c=new Set(_0x2bbfca[_0x5df17a(0x1fc)](_0x4ceb28=>_0x4ceb28['id'])),_0x28483e=_0x2bbfca[_0x5df17a(0x192)](_0xf2f58d=>_0xf2f58d[_0x5df17a(0x1fd)]?.[_0x5df17a(0x1bf)]?.[_0x5df17a(0x200)]()[_0x5df17a(0x1fa)](_0x2a188d)||_0xf2f58d[_0x5df17a(0x1ad)]?.[_0x5df17a(0x200)]()[_0x5df17a(0x1fa)](_0x2a188d)),_0x523aad=await listDatasets(_0x3aad54,{'code':_0x53b1b0});for(const _0x16b501 of _0x523aad){!_0x15d93c[_0x5df17a(0x1d8)](_0x16b501['id'])&&(_0x2bbfca['push'](_0x16b501),_0x15d93c[_0x5df17a(0x1eb)](_0x16b501['id']));}return _0x2bbfca;}export function normalizeDatasetOperations(_0x10d232){const _0x484eee=a113_0x3471;if(Array[_0x484eee(0x1a0)](_0x10d232))return _0x10d232['filter'](_0x370cc3=>_0x370cc3!=null&&typeof _0x370cc3===_0x484eee(0x1c6));if(_0x10d232&&typeof _0x10d232===_0x484eee(0x1c6))return Object[_0x484eee(0x1a1)](_0x10d232)[_0x484eee(0x192)](([,_0x3492fe])=>_0x3492fe!=null&&typeof _0x3492fe===_0x484eee(0x1c6))[_0x484eee(0x1fc)](([_0x11b8f7,_0x59a702])=>({..._0x59a702,'name':_0x59a702[_0x484eee(0x18e)]??_0x59a702['operationName']??_0x11b8f7}));return[];}export async function getDatasetDetail(_0x1725ff){const _0x2f43fe=a113_0x3471,_0x139b4f=/^\d+$/['test'](_0x1725ff)?'id':_0x2f43fe(0x1aa),_0x58e08b=await apiRequest(_0x2f43fe(0x1e4)+_0x139b4f+'='+_0x1725ff);return _0x58e08b['data'];}export async function getDatasetOperations(_0x4c231b){const _0x11f169=a113_0x3471,_0x37606d=await getDatasetDetail(_0x4c231b),_0x3e0890=normalizeDatasetOperations(_0x37606d[_0x11f169(0x1a7)])['map'](_0x21ce45=>({'name':_0x21ce45['name']||_0x21ce45[_0x11f169(0x205)],'displayName':_0x21ce45[_0x11f169(0x1af)]||_0x21ce45[_0x11f169(0x18e)],'type':_0x21ce45[_0x11f169(0x1f0)],'method':_0x21ce45[_0x11f169(0x1e1)],'path':_0x21ce45['path'],'enabled':_0x21ce45[_0x11f169(0x1e7)]??!![],'requestFields':_0x21ce45[_0x11f169(0x1ea)],'responseFields':_0x21ce45[_0x11f169(0x1bb)]}));return{'dataset':{'id':_0x37606d['id']??_0x37606d['modelId'],'name':_0x37606d[_0x11f169(0x18e)],'code':_0x37606d[_0x11f169(0x1aa)]||_0x37606d[_0x11f169(0x195)],'tableName':_0x37606d[_0x11f169(0x1bf)]||_0x37606d[_0x11f169(0x1fd)]?.[_0x11f169(0x1bf)]},'operations':_0x3e0890};}export async function getOperationDetail(_0x1cb939,_0x5448e1,_0x4110c5){const _0x4a4a20=a113_0x3471;let _0x40be5d=_0x5448e1;if(!/^\d+$/[_0x4a4a20(0x1d1)](_0x5448e1)){const _0x199cd9=await listDatasets(_0x1cb939,{'code':_0x5448e1}),_0x47db8e=_0x199cd9[_0x4a4a20(0x1c9)](_0x2b8883=>_0x2b8883[_0x4a4a20(0x1aa)]===_0x5448e1||String(_0x2b8883['id'])===_0x5448e1);if(!_0x47db8e)throw CliErrors[_0x4a4a20(0x20b)]('Dataset\x20not\x20found:\x20'+_0x5448e1);_0x40be5d=String(_0x47db8e['id']);}const _0x18bd56=await getDatasetDetail(_0x40be5d),_0x4f7282=normalizeDatasetOperations(_0x18bd56['operations'])[_0x4a4a20(0x1c9)](_0x39e61b=>(_0x39e61b['name']||_0x39e61b[_0x4a4a20(0x205)])===_0x4110c5);if(!_0x4f7282)throw CliErrors[_0x4a4a20(0x20b)]('Operation\x20\x22'+_0x4110c5+'\x22\x20not\x20found\x20in\x20dataset\x20'+_0x5448e1);return{'dataset':{'id':_0x18bd56['id']??_0x18bd56[_0x4a4a20(0x1dd)],'name':_0x18bd56[_0x4a4a20(0x18e)],'code':_0x18bd56['code']||_0x18bd56[_0x4a4a20(0x195)],'tableName':_0x18bd56[_0x4a4a20(0x1bf)]||_0x18bd56[_0x4a4a20(0x1fd)]?.[_0x4a4a20(0x1bf)]},'operation':_0x4f7282};}export function generateSdkCode(_0x3bd100,_0x132ff0,_0x3933b4){const _0x1f8519=a113_0x3471,_0x278078=_0x3933b4?.['includeImports']??!![],_0x542812=_0x1f8519(0x1d2)+_0x3bd100['code']?.[_0x1f8519(0x1ab)](/-/g,'_'),_0x56220c=_0x132ff0[_0x1f8519(0x18e)]||_0x132ff0[_0x1f8519(0x205)]||'filter',_0x337fc5=[];_0x278078&&_0x337fc5[_0x1f8519(0x1f6)]('import\x20{\x20LovrabetClient\x20}\x20from\x20\x27@lovrabet/sdk\x27;','',_0x1f8519(0x1b3),'');_0x337fc5[_0x1f8519(0x1f6)]('//\x20'+_0x3bd100['name']+'\x20('+(_0x3bd100[_0x1f8519(0x1bf)]||_0x1f8519(0x1d5))+')');if(_0x56220c===_0x1f8519(0x192))_0x337fc5[_0x1f8519(0x1f6)]('const\x20result\x20=\x20await\x20client.models.'+_0x542812+'.filter({',_0x1f8519(0x1cc),_0x1f8519(0x199),_0x1f8519(0x1d6),_0x1f8519(0x1f4));else{if(_0x56220c==='getOne')_0x337fc5[_0x1f8519(0x1f6)](_0x1f8519(0x1ac)+_0x542812+_0x1f8519(0x1fb));else{if(_0x56220c===_0x1f8519(0x1a4))_0x337fc5[_0x1f8519(0x1f6)](_0x1f8519(0x1ac)+_0x542812+_0x1f8519(0x1da));else{if(_0x56220c===_0x1f8519(0x201))_0x337fc5['push']('const\x20result\x20=\x20await\x20client.models.'+_0x542812+'.update(id,\x20{\x20/*\x20fields\x20*/\x20});');else _0x56220c==='delete'||_0x56220c===_0x1f8519(0x1d3)?_0x337fc5['push']('const\x20result\x20=\x20await\x20client.models.'+_0x542812+'.remove(id);'):_0x337fc5[_0x1f8519(0x1f6)]('const\x20result\x20=\x20await\x20client.models.'+_0x542812+'.'+_0x56220c+_0x1f8519(0x1c3));}}}return _0x337fc5['join']('\x0a');}export function generateSqlCodeTemplate(_0x22c545,_0x5ec4f0){const _0x17c823=a113_0x3471,_0x43dc7b=_0x5ec4f0?.[_0x17c823(0x1b4)]??'sdk',_0x2988e7=_0x5ec4f0?.[_0x17c823(0x203)]??!![],_0x55f67f=[];return _0x55f67f[_0x17c823(0x1f6)](_0x17c823(0x1b5)+_0x22c545[_0x17c823(0x1f3)]+'\x20('+_0x22c545[_0x17c823(0x206)]+')'),_0x43dc7b==='sdk'?(_0x2988e7&&_0x55f67f[_0x17c823(0x1f6)]('import\x20{\x20LovrabetClient\x20}\x20from\x20\x27@lovrabet/sdk\x27;','',_0x17c823(0x1b3),''),_0x55f67f[_0x17c823(0x1f6)](_0x17c823(0x1c7),'\x20\x20sqlCode:\x20\x27'+_0x22c545[_0x17c823(0x206)]+'\x27,',_0x17c823(0x1cd),_0x17c823(0x1f4),_0x17c823(0x20a),'const\x20results\x20=\x20data.execResult\x20||\x20[];')):_0x55f67f[_0x17c823(0x1f6)](_0x17c823(0x1a3),_0x17c823(0x18f),_0x17c823(0x1be),_0x17c823(0x20d)+_0x22c545[_0x17c823(0x206)]+'\x27,',_0x17c823(0x19b),_0x17c823(0x1ed),_0x17c823(0x1c4),'}'),_0x55f67f[_0x17c823(0x20e)]('\x0a');}export async function getErConfig(_0x1552d3,_0x8f6964){const _0x487830=a113_0x3471,_0xdf8f1f=await apiRequest('/smartapi/question/er-config',{'method':_0x487830(0x1f7),'body':{'appCode':_0x1552d3,'dblinkId':_0x8f6964}});return _0xdf8f1f[_0x487830(0x1ef)];}function buildQuery(_0x207a59){const _0x3fbe99=a113_0x3471,_0x267953=new URLSearchParams();for(const [_0x48bc2f,_0xdc872c]of Object[_0x3fbe99(0x1a1)](_0x207a59)){if(_0xdc872c===undefined||_0xdc872c==='')continue;_0x267953[_0x3fbe99(0x1bc)](_0x48bc2f,String(_0xdc872c));}const _0x37119c=_0x267953[_0x3fbe99(0x19a)]();return _0x37119c?'?'+_0x37119c:'';}export async function listDbLinks(_0x58dd38,_0x2fde16){const _0x29c062=a113_0x3471,_0x34c8d3=await apiRequest('/smartapi/dblink/getList',{'method':_0x29c062(0x1f7),'body':{'appCode':_0x58dd38,'currentPage':_0x2fde16?.['currentPage']??0x1,'pageSize':_0x2fde16?.[_0x29c062(0x1a2)]??0x64}});return{'items':extractList(_0x34c8d3[_0x29c062(0x1ef)]),'paging':extractPaging(_0x34c8d3[_0x29c062(0x1ef)])};}export async function getDbLinkInfo(_0x1080c0){const _0x4eb9ca=a113_0x3471,_0x3c864a=await apiRequest(_0x4eb9ca(0x1b8)+buildQuery({'id':_0x1080c0}));return _0x3c864a[_0x4eb9ca(0x1ef)];}export async function createDbLink(_0x16046a){const _0x4baae2=a113_0x3471,_0x2bef44=await apiRequest(_0x4baae2(0x209),{'method':_0x4baae2(0x1f7),'body':_0x16046a});return _0x2bef44[_0x4baae2(0x1ef)];}export async function updateDbLink(_0x9fc300){const _0x27b8df=a113_0x3471,_0x1cda97=await apiRequest('/smartapi/dblink/update',{'method':_0x27b8df(0x1f7),'body':_0x9fc300});return _0x1cda97[_0x27b8df(0x1ef)];}export async function deleteDbLink(_0x5bbd41){const _0x1cf84f=a113_0x3471;await apiRequest('/smartapi/dblink/delete',{'method':_0x1cf84f(0x1f7),'body':{'id':_0x5bbd41}});}export async function testDbLinkConnect(_0x23f5dc){const _0x332c5d=a113_0x3471,_0x2cc8c2=await apiRequest('/smartapi/dblink/testConnect'+buildQuery({'id':_0x23f5dc}));return _0x2cc8c2[_0x332c5d(0x1ef)];}export async function startDbAnalysis(_0x4d30bf,_0x493340){const _0x253ee1=a113_0x3471,_0x56bfd2=await apiRequest('/smartapi/db-analysis/start',{'method':'POST','body':{'dbLinkId':_0x4d30bf,..._0x493340&&_0x493340[_0x253ee1(0x1e8)]>0x0?{'tableNames':_0x493340}:{}}}),_0x35c285=_0x56bfd2[_0x253ee1(0x1ef)];if(typeof _0x35c285===_0x253ee1(0x1d7))return _0x35c285;if(_0x35c285&&typeof _0x35c285===_0x253ee1(0x1c6)&&typeof _0x35c285['planId']===_0x253ee1(0x1d7))return _0x35c285['planId'];return _0x35c285!=null?String(_0x35c285):'';}export async function cancelDbAnalysis(_0x4324c0){const _0x4d8244=a113_0x3471;await apiRequest(_0x4d8244(0x1a6)+buildQuery({'planId':_0x4324c0}),{'method':_0x4d8244(0x1f7)});}export async function getDbAnalysisStatus(_0x5ebd0e){const _0x3cd657=a113_0x3471,_0x5170cc=await apiRequest(_0x3cd657(0x1e3)+encodeURIComponent(_0x5ebd0e));return _0x5170cc[_0x3cd657(0x1ef)];}export async function getDbAllTableList(_0x52c30e,_0x3bd7c9){const _0x52cd35=a113_0x3471,_0x52f3db=await apiRequest(_0x52cd35(0x1c5)+buildQuery({'appCode':_0x52c30e,'dbLinkId':_0x3bd7c9})),_0x3b1e2d=_0x52f3db[_0x52cd35(0x1ef)];if(Array[_0x52cd35(0x1a0)](_0x3b1e2d))return _0x3b1e2d;return extractList(_0x3b1e2d);}export async function getDbTableDiff(_0x1533f2,_0x4c2b83,_0x36854d){const _0x569b8a=a113_0x3471,_0x2cefaa=await apiRequest(_0x569b8a(0x207)+buildQuery({'appCode':_0x1533f2,'dbLinkId':_0x4c2b83,'pageIndex':_0x36854d?.[_0x569b8a(0x1a8)]??0x1,'pageSize':_0x36854d?.['pageSize']??0x14,'tableName':_0x36854d?.['tableName']})),_0x220242=_0x2cefaa[_0x569b8a(0x1ef)];return{'totalCount':_0x220242?.[_0x569b8a(0x196)]??0x0,'tableList':Array[_0x569b8a(0x1a0)](_0x220242?.[_0x569b8a(0x1ae)])?_0x220242[_0x569b8a(0x1ae)]:[]};}const REMOTE_APP_PAGE_SIZE=0xc8;export async function listRemoteApps(){const _0x55e1c3=a113_0x3471,_0x2073ac=await apiRequest('/smartapi/app/getList',{'method':_0x55e1c3(0x1f7),'body':{'currentPage':0x1,'pageSize':REMOTE_APP_PAGE_SIZE}}),_0x37afca=extractList(_0x2073ac[_0x55e1c3(0x1ef)]),_0x35bc7e=extractPaging(_0x2073ac['data']);return _0x35bc7e&&_0x35bc7e[_0x55e1c3(0x196)]>REMOTE_APP_PAGE_SIZE&&console[_0x55e1c3(0x1ec)](_0x55e1c3(0x1b1)+REMOTE_APP_PAGE_SIZE+_0x55e1c3(0x1cf)+_0x35bc7e[_0x55e1c3(0x196)]+'\x20apps.\x20'+_0x55e1c3(0x1f1)),_0x37afca;}
|
package/lib/core/bff/config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a114_0x3009(_0x897382,_0x1f3a6c){_0x897382=_0x897382-0xaf;const _0x4b6622=a114_0x4b66();let _0x300996=_0x4b6622[_0x897382];return _0x300996;}const a114_0x419da6=a114_0x3009;(function(_0xa2d5cb,_0x31c410){const _0x47ef6f=a114_0x3009,_0xefdf24=_0xa2d5cb();while(!![]){try{const _0x4f7c74=parseInt(_0x47ef6f(0xb2))/0x1*(parseInt(_0x47ef6f(0xb1))/0x2)+-parseInt(_0x47ef6f(0xb8))/0x3+-parseInt(_0x47ef6f(0xaf))/0x4+-parseInt(_0x47ef6f(0xb6))/0x5+parseInt(_0x47ef6f(0xb7))/0x6+-parseInt(_0x47ef6f(0xbb))/0x7+parseInt(_0x47ef6f(0xb5))/0x8;if(_0x4f7c74===_0x31c410)break;else _0xefdf24['push'](_0xefdf24['shift']());}catch(_0x25451a){_0xefdf24['push'](_0xefdf24['shift']());}}}(a114_0x4b66,0x88479));function a114_0x4b66(){const _0x24e4b8=['1542236skYJqO','.rabetbase','2oJfZgJ','591463TwvQeV','bff','/bff','18135184jnEUOQ','5456810rpkGQW','853416lspgSI','1174302gbbwDt','bff.lock.json','bff-trash','4018287BkqRUO'];a114_0x4b66=function(){return _0x24e4b8;};return a114_0x4b66();}import{resolve}from'node:path';import{findProjectRootDirectory}from'../../context.js';const DOT_DIR=a114_0x419da6(0xb0),LOCK_FILE_NAME=a114_0x419da6(0xb9),TRASH_DIR_NAME=a114_0x419da6(0xba);export function loadBffProjectConfig(_0x367669,_0x463184){const _0x54bc16=a114_0x419da6,_0x93cb20=resolve(_0x463184??findProjectRootDirectory()),_0x12a797=DOT_DIR+_0x54bc16(0xb4),_0xcb4d3b=_0x12a797+'/'+_0x367669;return{'projectRoot':_0x93cb20,'appCode':_0x367669,'scriptsBaseDir':DOT_DIR,'scriptsWorkspaceRoot':_0x12a797,'scriptsRoot':_0xcb4d3b,'scriptsRootDir':resolve(_0x93cb20,DOT_DIR,_0x54bc16(0xb3),_0x367669),'lockFilePath':resolve(_0x93cb20,DOT_DIR,LOCK_FILE_NAME),'trashDir':resolve(_0x93cb20,DOT_DIR,TRASH_DIR_NAME)};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a115_0x2389d3=a115_0x50c2;(function(_0x5e2aba,_0x230140){const _0x55a0ca=a115_0x50c2,_0x45fadd=_0x5e2aba();while(!![]){try{const _0x88fdd6=parseInt(_0x55a0ca(0x100))/0x1*(parseInt(_0x55a0ca(0x103))/0x2)+parseInt(_0x55a0ca(0x102))/0x3+-parseInt(_0x55a0ca(0xe5))/0x4+parseInt(_0x55a0ca(0xf1))/0x5+parseInt(_0x55a0ca(0xf6))/0x6+parseInt(_0x55a0ca(0xf7))/0x7+-parseInt(_0x55a0ca(0xf8))/0x8*(parseInt(_0x55a0ca(0xeb))/0x9);if(_0x88fdd6===_0x230140)break;else _0x45fadd['push'](_0x45fadd['shift']());}catch(_0x200ef5){_0x45fadd['push'](_0x45fadd['shift']());}}}(a115_0x2124,0x75e40));import{access,mkdir,readdir,stat}from'node:fs/promises';import{constants}from'node:fs';import{dirname,join}from'node:path';import{findHookLocationByRemoteId,snakeToCamel}from'../../core/bff/utils.js';export const SUPPORTED_BFF_TYPES=[a115_0x2389d3(0xfe),a115_0x2389d3(0xfb),'HOOK'];export function normalizeBffType(_0x54c1b8){const _0xa0324=a115_0x2389d3;if(!_0x54c1b8)return undefined;const _0x340b18=_0x54c1b8['trim']()[_0xa0324(0xf3)]();return SUPPORTED_BFF_TYPES['includes'](_0x340b18)?_0x340b18:undefined;}async function scanJsFilesRecursively(_0x723294,_0x2b1869){const _0x520dd9=a115_0x2389d3,_0x155f96=[];try{const _0x3699c1=await readdir(_0x723294,{'withFileTypes':!![]});for(const _0x340c11 of _0x3699c1){const _0x206170=join(_0x723294,_0x340c11['name']);if(_0x340c11[_0x520dd9(0xf9)]())_0x155f96['push'](...await scanJsFilesRecursively(_0x206170,_0x2b1869+'/'+_0x340c11[_0x520dd9(0xf2)]));else _0x340c11[_0x520dd9(0xfc)]()&&_0x340c11[_0x520dd9(0xf2)][_0x520dd9(0xe2)]('.js')&&_0x155f96[_0x520dd9(0x104)]({'lockKey':_0x2b1869+'/'+_0x340c11[_0x520dd9(0xf2)][_0x520dd9(0x105)](/\.js$/,''),'filePath':_0x206170});}}catch(_0x2efd79){if(_0x2efd79[_0x520dd9(0xe8)]!==_0x520dd9(0x101))throw _0x2efd79;}return _0x155f96;}function a115_0x50c2(_0x210416,_0x37240e){_0x210416=_0x210416-0xe0;const _0x2124e0=a115_0x2124();let _0x50c2e0=_0x2124e0[_0x210416];return _0x50c2e0;}async function scanFlatFunctions(_0x2d6a5f,_0x54acfa){const _0x4eb99d=a115_0x2389d3,_0x267157=join(_0x2d6a5f['scriptsRootDir'],_0x54acfa),_0x1611d4=await scanJsFilesRecursively(_0x267157,_0x54acfa);return _0x1611d4[_0x4eb99d(0xe9)](({lockKey:_0x1485b3,filePath:_0x2e88d2})=>({'type':_0x54acfa,'name':_0x1485b3[_0x4eb99d(0xe7)]('/')['at'](-0x1)??'','filePath':_0x2e88d2,'lockKey':_0x1485b3}));}async function scanHookFunctions(_0x2f510a){const _0xb4ba20=a115_0x2389d3,_0x2f3338=join(_0x2f510a[_0xb4ba20(0xf5)],_0xb4ba20(0xe1)),_0x59c284=[];try{const _0x388661=await readdir(_0x2f3338,{'withFileTypes':!![]});for(const _0x57adc1 of _0x388661){if(!_0x57adc1[_0xb4ba20(0xf9)]())continue;const _0x5c5194=_0x57adc1[_0xb4ba20(0xf2)],_0x28cda1=join(_0x2f3338,_0x5c5194),_0x403d2d=await readdir(_0x28cda1,{'withFileTypes':!![]});for(const _0x227d1f of _0x403d2d){if(!_0x227d1f[_0xb4ba20(0xf9)]())continue;const _0x26e420=_0x227d1f['name'],_0x1f2bf9=join(_0x28cda1,_0x26e420),_0x10a0a6=await readdir(_0x1f2bf9,{'withFileTypes':!![]});for(const _0x4042a0 of _0x10a0a6){if(!_0x4042a0[_0xb4ba20(0xf9)]())continue;const _0x2a5437=_0x4042a0[_0xb4ba20(0xf2)],_0x16ae08=join(_0x1f2bf9,_0x2a5437),_0x2ab646=await readdir(_0x16ae08,{'withFileTypes':!![]});for(const _0x52e5a3 of _0x2ab646){if(!_0x52e5a3[_0xb4ba20(0xfc)]()||!_0x52e5a3[_0xb4ba20(0xf2)][_0xb4ba20(0xe2)]('.js'))continue;const _0xbbc5cb=_0x52e5a3[_0xb4ba20(0xf2)][_0xb4ba20(0x105)](/\.js$/,'');_0x59c284[_0xb4ba20(0x104)]({'type':'HOOK','name':_0xbbc5cb,'filePath':join(_0x16ae08,_0x52e5a3[_0xb4ba20(0xf2)]),'lockKey':_0xb4ba20(0xe6)+_0x5c5194+'/'+_0x26e420+'/'+_0x2a5437+'/'+_0xbbc5cb,'alias':_0x5c5194,'operationType':_0x26e420,'functionNode':_0x2a5437});}}}}}catch(_0xf679e0){if(_0xf679e0[_0xb4ba20(0xe8)]!==_0xb4ba20(0x101))throw _0xf679e0;}return _0x59c284;}function a115_0x2124(){const _0x121689=['scriptType','1385592kiqJNU','HOOK/','split','code','map','operationType','11979Vyogrl','beforeScriptId','after','all','set','functionNode','4703320ENUtAx','name','toUpperCase','datasetCode','scriptsRootDir','2595654byzWPP','1411067JHUHIN','11728JaYUHD','isDirectory','before','ENDPOINT','isFile','functionName','COMMON','afterScriptId','34589ZaPnVy','ENOENT','1437903XInqPA','42nucYKh','push','replace','F_OK','HOOK','endsWith','get'];a115_0x2124=function(){return _0x121689;};return a115_0x2124();}export async function scanLocalBffFunctions(_0x3605b,_0x588790){const _0x1966cd=a115_0x2389d3;if(_0x588790===_0x1966cd(0xfe)||_0x588790===_0x1966cd(0xfb))return scanFlatFunctions(_0x3605b,_0x588790);if(_0x588790==='HOOK')return scanHookFunctions(_0x3605b);const [_0xaea028,_0xf453c3,_0x459bbb]=await Promise[_0x1966cd(0xee)]([scanFlatFunctions(_0x3605b,_0x1966cd(0xfe)),scanFlatFunctions(_0x3605b,'ENDPOINT'),scanHookFunctions(_0x3605b)]);return[..._0xaea028,..._0xf453c3,..._0x459bbb];}export function resolveLocalFilePathFromLockKey(_0x597d4c,_0x300b0b){const _0x4a6df6=a115_0x2389d3;return join(_0x597d4c[_0x4a6df6(0xf5)],..._0x300b0b[_0x4a6df6(0xe7)]('/'))+'.js';}export function createHookLocationMap(_0x1e4b2b){const _0x40b36d=a115_0x2389d3,_0x4a1b61=new Map();for(const _0x2c2fbb of _0x1e4b2b){_0x2c2fbb[_0x40b36d(0xec)]&&_0x4a1b61['set'](_0x2c2fbb[_0x40b36d(0xec)],{'datasetCode':_0x2c2fbb[_0x40b36d(0xf4)],'operationType':snakeToCamel(_0x2c2fbb[_0x40b36d(0xea)]),'functionNode':_0x40b36d(0xfa)}),_0x2c2fbb[_0x40b36d(0xff)]&&_0x4a1b61[_0x40b36d(0xef)](_0x2c2fbb[_0x40b36d(0xff)],{'datasetCode':_0x2c2fbb[_0x40b36d(0xf4)],'operationType':snakeToCamel(_0x2c2fbb[_0x40b36d(0xea)]),'functionNode':_0x40b36d(0xed)});}return _0x4a1b61;}export function resolveRemoteScriptTarget(_0x169fe8,_0x5558bc,_0x5c0136,_0x1ac44d,_0x30c28e){const _0x485622=a115_0x2389d3,_0x25a380=normalizeBffType(_0x5558bc[_0x485622(0xe4)]);if(!_0x25a380||!_0x5558bc[_0x485622(0xfd)])return null;if(_0x25a380===_0x485622(0xe1)){const _0x419dd6=(_0x5558bc['id']?_0x5c0136[_0x485622(0xe3)](_0x5558bc['id']):undefined)??findHookLocationByRemoteId(_0x1ac44d,_0x5558bc['id']);if(!_0x419dd6)return null;const _0x2ed44a=_0x419dd6['alias']||_0x30c28e[_0x485622(0xe3)](_0x419dd6[_0x485622(0xf4)]),_0x30c724=_0x2ed44a??_0x419dd6[_0x485622(0xf4)],_0x7c5f7d={..._0x419dd6,'alias':_0x2ed44a},_0xedbd65=_0x485622(0xe6)+_0x30c724+'/'+_0x7c5f7d[_0x485622(0xea)]+'/'+_0x7c5f7d[_0x485622(0xf0)]+'/'+_0x5558bc[_0x485622(0xfd)];return{'lockKey':_0xedbd65,'filePath':resolveLocalFilePathFromLockKey(_0x169fe8,_0xedbd65),'type':_0x485622(0xe1),'hookLocation':_0x7c5f7d};}const _0x2e9844=_0x25a380+'/'+_0x5558bc['functionName'];return{'lockKey':_0x2e9844,'filePath':resolveLocalFilePathFromLockKey(_0x169fe8,_0x2e9844),'type':_0x25a380};}export async function ensureParentDirectory(_0x13f93f){await mkdir(dirname(_0x13f93f),{'recursive':!![]});}export async function fileExists(_0x13d335){const _0x456d42=a115_0x2389d3;try{return await access(_0x13d335,constants[_0x456d42(0xe0)]),!![];}catch{return![];}}export async function directoryExists(_0x54d263){try{const _0x286674=await stat(_0x54d263);return _0x286674['isDirectory']();}catch{return![];}}
|
package/lib/core/bff/hash.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0xf07025,_0x5b358e){const _0x3294a4=a116_0x479c,_0xab4cc2=_0xf07025();while(!![]){try{const _0x1d9c4f=parseInt(_0x3294a4(0x10f))/0x1+-parseInt(_0x3294a4(0x112))/0x2+-parseInt(_0x3294a4(0x116))/0x3*(-parseInt(_0x3294a4(0x110))/0x4)+-parseInt(_0x3294a4(0x10d))/0x5+-parseInt(_0x3294a4(0x114))/0x6*(parseInt(_0x3294a4(0x113))/0x7)+parseInt(_0x3294a4(0x117))/0x8+-parseInt(_0x3294a4(0x10e))/0x9;if(_0x1d9c4f===_0x5b358e)break;else _0xab4cc2['push'](_0xab4cc2['shift']());}catch(_0x155ed9){_0xab4cc2['push'](_0xab4cc2['shift']());}}}(a116_0x374d,0xba5c3));function a116_0x479c(_0x4a8b84,_0x1b172f){_0x4a8b84=_0x4a8b84-0x10b;const _0x374da0=a116_0x374d();let _0x479ce4=_0x374da0[_0x4a8b84];return _0x479ce4;}import{readFile}from'node:fs/promises';import a116_0x442284 from'node:crypto';export function computeContentHash(_0x292052){const _0x366cfa=a116_0x479c;return a116_0x442284[_0x366cfa(0x111)](_0x366cfa(0x115))[_0x366cfa(0x10b)](_0x292052)[_0x366cfa(0x10c)]('hex');}function a116_0x374d(){const _0xec6895=['683316ZJnpDL','md5','329370JzGVCl','8553208mVfKuo','utf8','update','digest','1649270sBoTJD','13715523ipyAOG','986406CEepkt','32RFZkQW','createHash','177946NlfTkw','14HUPyni'];a116_0x374d=function(){return _0xec6895;};return a116_0x374d();}export async function computeFileHash(_0x4bee0f){const _0x420cfb=a116_0x479c,_0x76bd9d=await readFile(_0x4bee0f,_0x420cfb(0x118));return computeContentHash(_0x76bd9d);}
|