@lovrabet/rabetbase-cli 2.0.11 → 2.0.13
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/logout.js +1 -1
- package/lib/cli-flags.js +1 -1
- package/lib/cli.js +1 -1
- package/lib/commands/api/doc.js +1 -1
- package/lib/commands/api/index.js +1 -1
- package/lib/commands/api/list.js +1 -1
- package/lib/commands/api/pull.js +1 -1
- package/lib/commands/api/shared.js +1 -1
- package/lib/commands/app/add.js +1 -1
- package/lib/commands/app/index.js +1 -1
- package/lib/commands/app/list.js +1 -1
- package/lib/commands/app/remote.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/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 -0
- package/lib/commands/sql/save.js +1 -1
- package/lib/commands/sql/shared.js +1 -0
- package/lib/commands/sql/validate.js +1 -1
- package/lib/constant/cli.js +1 -1
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/constant/paths.js +1 -1
- package/lib/context.js +1 -1
- package/lib/core/alias-resolver.js +1 -1
- package/lib/core/api-client.js +1 -1
- package/lib/core/bff/config.js +1 -1
- package/lib/core/bff/file-system.js +1 -1
- package/lib/core/bff/hash.js +1 -1
- package/lib/core/bff/lock.js +1 -1
- package/lib/core/bff/utils.js +1 -1
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/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.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/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a80_0x93aff=a80_0x2952;(function(_0x243b81,_0x47c95d){const _0x277968=a80_0x2952,_0x37b021=_0x243b81();while(!![]){try{const _0x1e6c9c=-parseInt(_0x277968(0x1c5))/0x1*(-parseInt(_0x277968(0x1ba))/0x2)+parseInt(_0x277968(0x1b8))/0x3*(-parseInt(_0x277968(0x1c4))/0x4)+-parseInt(_0x277968(0x1c7))/0x5+-parseInt(_0x277968(0x1c9))/0x6+parseInt(_0x277968(0x1b4))/0x7+parseInt(_0x277968(0x1bd))/0x8*(-parseInt(_0x277968(0x1b6))/0x9)+parseInt(_0x277968(0x1c1))/0xa;if(_0x1e6c9c===_0x47c95d)break;else _0x37b021['push'](_0x37b021['shift']());}catch(_0x3b01ba){_0x37b021['push'](_0x37b021['shift']());}}}(a80_0x22b7,0xec538));import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';import{logger}from'../../utils/logger.js';function a80_0x2952(_0x3c4920,_0x4b1592){_0x3c4920=_0x3c4920-0x1b0;const _0x22b79c=a80_0x22b7();let _0x29523b=_0x22b79c[_0x3c4920];return _0x29523b;}function a80_0x22b7(){const _0x1326aa=['apiError','6858453KjhrGU','setLogPath','27vslUah','\x20skill\x20installed','3GVPvgq','log','2687900syTMRG','install','nonInteractive','3016472nsNOrA','../../skills/npx-skills-add.js','inherit','pipe','49669680TctjJM','npx\x20skills\x20add\x20failed:\x20','write','5828728CnArgZ','1izOtzt','skill-install','9341990rcvhaz','unknown','11195688HjVPWd','info','cwd','skill','skipped','Installing\x20official\x20skill\x20via\x20npx\x20(npx\x20-y\x20skills\x20add\x20lovrabet/rabetbase\x20--global)...','Skipped\x20npx\x20(RABETBASE_SKIP_NPX_SKILLS=1);\x20assuming\x20skill\x20is\x20already\x20present.'];a80_0x22b7=function(){return _0x1326aa;};return a80_0x22b7();}export const skillDefinitions=[{'service':a80_0x93aff(0x1cc),'command':a80_0x93aff(0x1bb),'description':'Install\x20developer\x20skill\x20package','risk':a80_0x93aff(0x1c3),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[],async 'execute'(_0x4fa18f){const _0x4f834b=a80_0x93aff;logger[_0x4f834b(0x1b5)](process[_0x4f834b(0x1cb)]()),logger[_0x4f834b(0x1ca)](_0x4f834b(0x1c6),'执行安装技能包命令(委托给\x20npx\x20skills\x20--global)');const {runNpxSkillsAddGlobal:_0x1edca5}=await import(_0x4f834b(0x1be)),_0x358b05=_0x4fa18f[_0x4f834b(0x1bc)]?_0x4f834b(0x1c0):_0x4f834b(0x1bf);console[_0x4f834b(0x1b9)](_0x4f834b(0x1b1));const _0x342f2b=_0x1edca5(process[_0x4f834b(0x1cb)](),'lovrabet/rabetbase',{'stdio':_0x358b05});if(_0x342f2b[_0x4f834b(0x1b0)])console[_0x4f834b(0x1b9)](_0x4f834b(0x1b2));else{if(_0x342f2b['ok'])console[_0x4f834b(0x1b9)](CLI_BIN_NAME+_0x4f834b(0x1b7));else throw CliErrors[_0x4f834b(0x1b3)](_0x4f834b(0x1c2)+(_0x342f2b['error']||_0x4f834b(0x1c8)),'Check\x20network\x20connectivity\x20and\x20try\x20again.');}return{'ok':!![]};}}];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a81_0x2ee90e=a81_0x2a40;(function(_0x51d6bd,_0x3ff790){const _0x3a164f=a81_0x2a40,_0x15e469=_0x51d6bd();while(!![]){try{const _0x4c3028=-parseInt(_0x3a164f(0x149))/0x1*(parseInt(_0x3a164f(0x133))/0x2)+parseInt(_0x3a164f(0x137))/0x3*(-parseInt(_0x3a164f(0x146))/0x4)+-parseInt(_0x3a164f(0x131))/0x5+-parseInt(_0x3a164f(0x134))/0x6*(parseInt(_0x3a164f(0x13e))/0x7)+-parseInt(_0x3a164f(0x145))/0x8*(parseInt(_0x3a164f(0x140))/0x9)+parseInt(_0x3a164f(0x13c))/0xa*(parseInt(_0x3a164f(0x139))/0xb)+parseInt(_0x3a164f(0x147))/0xc;if(_0x4c3028===_0x3ff790)break;else _0x15e469['push'](_0x15e469['shift']());}catch(_0x41f5d9){_0x15e469['push'](_0x15e469['shift']());}}}(a81_0x4515,0x8aada));function a81_0x4515(){const _0x2ee3e6=['35427372sGEFft','appCode','1pdVUQb','boolean','4329005FYGZsS','Return\x20full\x20raw\x20SQL\x20query\x20object','643638jDLyrz','6031686znScMv','sqlCode','sql','29433GYjTXK','read','2182895GhhiiG','bool','description','20eLfoYQ','sqlcode','7yogQuZ','dbId','837ARQuHq','detail','verbose','sqlName','str','4184PhdzoK','220RjghPw'];a81_0x4515=function(){return _0x2ee3e6;};return a81_0x4515();}import{getSqlQueryInfo}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';function a81_0x2a40(_0x8f0a40,_0x17cfaa){_0x8f0a40=_0x8f0a40-0x131;const _0x451520=a81_0x4515();let _0x2a4010=_0x451520[_0x8f0a40];return _0x2a4010;}import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':a81_0x2ee90e(0x136),'command':a81_0x2ee90e(0x141),'description':'Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','risk':a81_0x2ee90e(0x138),'flags':[SQLCODE_FLAG,{'name':'verbose','type':a81_0x2ee90e(0x14a),'description':a81_0x2ee90e(0x132)}],async 'execute'(_0x503c46){const _0x514cbc=a81_0x2ee90e,_0x260316=await getSqlQueryInfo(_0x503c46[_0x514cbc(0x148)],_0x503c46[_0x514cbc(0x144)](_0x514cbc(0x13d))),_0x562b0a=_0x503c46[_0x514cbc(0x13a)](_0x514cbc(0x142));if(_0x562b0a)return{'ok':!![],'data':_0x260316};const _0x571343=_0x260316[_0x514cbc(0x13f)]?await getDbName(_0x503c46[_0x514cbc(0x148)],_0x260316[_0x514cbc(0x13f)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x260316[_0x514cbc(0x135)],'sqlName':_0x260316[_0x514cbc(0x143)],'db':_0x571343?_0x571343+'\x20('+_0x260316['dbId']+')':_0x260316[_0x514cbc(0x13f)]??'','description':_0x260316[_0x514cbc(0x13b)]??'','sqlContent':_0x260316['sqlContent']??''}};}};
|
package/lib/commands/sql/exec.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a82_0x18d5bd=a82_0x3511;(function(_0x318024,_0x60070d){const _0x2772bc=a82_0x3511,_0xe14857=_0x318024();while(!![]){try{const _0x4f4b7b=parseInt(_0x2772bc(0x1dd))/0x1*(-parseInt(_0x2772bc(0x1d9))/0x2)+parseInt(_0x2772bc(0x1e6))/0x3*(-parseInt(_0x2772bc(0x1d2))/0x4)+parseInt(_0x2772bc(0x1d3))/0x5*(-parseInt(_0x2772bc(0x1e5))/0x6)+parseInt(_0x2772bc(0x1e3))/0x7*(parseInt(_0x2772bc(0x1e8))/0x8)+parseInt(_0x2772bc(0x1ea))/0x9*(parseInt(_0x2772bc(0x1f0))/0xa)+-parseInt(_0x2772bc(0x1eb))/0xb*(-parseInt(_0x2772bc(0x1da))/0xc)+parseInt(_0x2772bc(0x1e7))/0xd*(parseInt(_0x2772bc(0x1ed))/0xe);if(_0x4f4b7b===_0x60070d)break;else _0xe14857['push'](_0xe14857['shift']());}catch(_0x7cb058){_0xe14857['push'](_0xe14857['shift']());}}}(a82_0xfcd4,0xc833e));import{executeSql}from'../../core/api-client.js';function a82_0xfcd4(){const _0x346676=['Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','99405XazgMG','22liFSyw','validation','42zsbxjW','execResult','now','1250sGQfVk','Returned\x20','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','params','3201172qlRwYW','983995rbAVEf','string','Invalid\x20JSON\x20for\x20--params:\x20','length','\x20row(s)\x20in\x20','str','298020pxoLgo','3299316CWkQNB','isArray','sql','11KszotW','execSuccess','read','exec','sqlcode','SQL\x20execution\x20failed','9083858FsNWtP','execError','6fSSQkZ','3Qqaupc','988117NQipjk','8skMaHz'];a82_0xfcd4=function(){return _0x346676;};return a82_0xfcd4();}import{CliErrors}from'../../errors.js';function a82_0x3511(_0x372a6b,_0x9a8100){_0x372a6b=_0x372a6b-0x1d0;const _0xfcd408=a82_0xfcd4();let _0x3511cc=_0xfcd408[_0x372a6b];return _0x3511cc;}import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlExec={'service':a82_0x18d5bd(0x1dc),'command':a82_0x18d5bd(0x1e0),'description':a82_0x18d5bd(0x1e9),'risk':a82_0x18d5bd(0x1df),'flags':[SQLCODE_FLAG,{'name':'params','type':a82_0x18d5bd(0x1d4),'description':a82_0x18d5bd(0x1d0)}],async 'execute'(_0x232630){const _0x3e7920=a82_0x18d5bd;let _0x325a9b;const _0x1bb723=_0x232630['str'](_0x3e7920(0x1d1));if(_0x1bb723)try{_0x325a9b=JSON['parse'](_0x1bb723);}catch{throw CliErrors[_0x3e7920(0x1ec)](_0x3e7920(0x1d5)+_0x1bb723);}const _0x537d0b=Date[_0x3e7920(0x1ef)](),_0x1b0cc9=await executeSql(_0x232630['appCode'],_0x232630[_0x3e7920(0x1d8)](_0x3e7920(0x1e1)),_0x325a9b),_0x2ab280=Date['now']()-_0x537d0b,_0x23b9c6=_0x1b0cc9?.[_0x3e7920(0x1ee)]??_0x1b0cc9,_0xdf434a=_0x1b0cc9?.[_0x3e7920(0x1de)]??!![];if(!_0xdf434a)return{'ok':![],'data':{'error':_0x1b0cc9?.[_0x3e7920(0x1e4)]||_0x3e7920(0x1e2),'elapsed':_0x2ab280},'message':_0x3e7920(0x1e2)};const _0x30e285=Array[_0x3e7920(0x1db)](_0x23b9c6)?_0x23b9c6:[];return{'ok':!![],'data':{'rows':_0x30e285,'rowCount':_0x30e285[_0x3e7920(0x1d6)],'elapsed':_0x2ab280},'message':_0x3e7920(0x1f1)+_0x30e285[_0x3e7920(0x1d6)]+_0x3e7920(0x1d7)+_0x2ab280+'ms'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x1db9ae,_0x2785dd){const _0x5995e7=a83_0x552d,_0x40d4c6=_0x1db9ae();while(!![]){try{const _0x392fa9=-parseInt(_0x5995e7(0xb3))/0x1+parseInt(_0x5995e7(0xb5))/0x2+parseInt(_0x5995e7(0xae))/0x3+parseInt(_0x5995e7(0xaf))/0x4+-parseInt(_0x5995e7(0xad))/0x5*(parseInt(_0x5995e7(0xb2))/0x6)+parseInt(_0x5995e7(0xb0))/0x7+parseInt(_0x5995e7(0xb1))/0x8*(parseInt(_0x5995e7(0xb4))/0x9);if(_0x392fa9===_0x2785dd)break;else _0x40d4c6['push'](_0x40d4c6['shift']());}catch(_0x10a73d){_0x40d4c6['push'](_0x40d4c6['shift']());}}}(a83_0x4ef4,0x9650c));import{sqlList}from'../../commands/sql/list.js';function a83_0x4ef4(){const _0xc1c26f=['8lqOohV','12PbGTyC','841111etEsbk','5384961xbQMSU','351988nNPfFo','2483335sqgBZF','752571uTGLin','3970280VIKags','3026709AoCUtA'];a83_0x4ef4=function(){return _0xc1c26f;};return a83_0x4ef4();}import{sqlDetail}from'../../commands/sql/detail.js';function a83_0x552d(_0x1ede7a,_0x3e80ae){_0x1ede7a=_0x1ede7a-0xad;const _0x4ef4f1=a83_0x4ef4();let _0x552daf=_0x4ef4f1[_0x1ede7a];return _0x552daf;}import{sqlValidate}from'../../commands/sql/validate.js';import{sqlSave}from'../../commands/sql/save.js';import{sqlExec}from'../../commands/sql/exec.js';import{sqlPull}from'../../commands/sql/pull.js';export const sqlDefinitions=[sqlList,sqlDetail,sqlValidate,sqlSave,sqlExec,sqlPull];
|
package/lib/commands/sql/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a84_0x3c76(_0xe94410,_0x1fb709){_0xe94410=_0xe94410-0x104;const _0x12c3e3=a84_0x12c3();let _0x3c766d=_0x12c3e3[_0xe94410];return _0x3c766d;}const a84_0x4fbaec=a84_0x3c76;(function(_0x4b56f8,_0x1f2e5d){const _0xd965a2=a84_0x3c76,_0x4d7963=_0x4b56f8();while(!![]){try{const _0x3bca64=-parseInt(_0xd965a2(0x115))/0x1+parseInt(_0xd965a2(0x123))/0x2*(parseInt(_0xd965a2(0x11e))/0x3)+-parseInt(_0xd965a2(0x116))/0x4+parseInt(_0xd965a2(0x125))/0x5+-parseInt(_0xd965a2(0x108))/0x6*(-parseInt(_0xd965a2(0x124))/0x7)+parseInt(_0xd965a2(0x121))/0x8+-parseInt(_0xd965a2(0x11c))/0x9;if(_0x3bca64===_0x1f2e5d)break;else _0x4d7963['push'](_0x4d7963['shift']());}catch(_0x22ac55){_0x4d7963['push'](_0x4d7963['shift']());}}}(a84_0x12c3,0xc976c));import{listSqlQueries}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';function a84_0x12c3(){const _0x3e4c4d=['3698055dtsUZT','Found\x20','length','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','description','List\x20custom\x20SQL\x20queries','pagesize','Page\x20size','78XnqphJ','dbId','Page\x20number','page','sqlName','map','boolean','verbose','name','totalCount','No\x20custom\x20SQL\x20queries\x20found.','string','sqlcode','722361JBpnHd','5982412aetCwV','paging','sql','\x20SQL\x20queries\x20(total:\x20','str','bool','7957764GcOKRY','num','1893711BcjjIq','read','number','9719784vQMzeB','Filter\x20by\x20SQL\x20name','2EKbium','722365WCdJpi'];a84_0x12c3=function(){return _0x3e4c4d;};return a84_0x12c3();}import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':a84_0x4fbaec(0x118),'command':'list','description':a84_0x4fbaec(0x105),'risk':a84_0x4fbaec(0x11f),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'name','type':a84_0x4fbaec(0x113),'description':a84_0x4fbaec(0x122)},{'name':a84_0x4fbaec(0x10b),'type':a84_0x4fbaec(0x120),'description':a84_0x4fbaec(0x10a),'default':0x1},{'name':a84_0x4fbaec(0x106),'type':a84_0x4fbaec(0x120),'description':a84_0x4fbaec(0x107)},{'name':'verbose','type':a84_0x4fbaec(0x10e),'description':a84_0x4fbaec(0x128)}],async 'execute'(_0x387458){const _0x4fc076=a84_0x4fbaec,_0x5e4f48=await listSqlQueries(_0x387458['appCode'],{'sqlCode':_0x387458[_0x4fc076(0x11a)](_0x4fc076(0x114))||undefined,'sqlName':_0x387458[_0x4fc076(0x11a)](_0x4fc076(0x110))||undefined,'currentPage':_0x387458[_0x4fc076(0x11d)](_0x4fc076(0x10b)),'pageSize':_0x387458['num'](_0x4fc076(0x106),0x32)}),_0x33ec08=_0x387458[_0x4fc076(0x11b)](_0x4fc076(0x10f)),_0x20470f=_0x5e4f48['tableData']??[],_0xc7ef31=_0x5e4f48[_0x4fc076(0x117)]?.[_0x4fc076(0x111)]??_0x20470f[_0x4fc076(0x127)];let _0x2be616;return _0x33ec08?_0x2be616=_0x20470f:_0x2be616=await Promise['all'](_0x20470f[_0x4fc076(0x10d)](async _0x4c689a=>{const _0x5731cc=_0x4fc076;let _0x1e732f;try{_0x1e732f=_0x4c689a['dbId']?await getDbName(_0x387458['appCode'],_0x4c689a[_0x5731cc(0x109)]):undefined;}catch{}return{'sqlCode':_0x4c689a['sqlCode'],'sqlName':_0x4c689a[_0x5731cc(0x10c)],'description':_0x4c689a[_0x5731cc(0x104)]??'','db':_0x1e732f?_0x1e732f+'\x20('+_0x4c689a[_0x5731cc(0x109)]+')':_0x4c689a[_0x5731cc(0x109)]??''};})),{'ok':!![],'data':_0x2be616,'message':_0x20470f[_0x4fc076(0x127)]===0x0?_0x4fc076(0x112):_0x4fc076(0x126)+_0x20470f[_0x4fc076(0x127)]+_0x4fc076(0x119)+_0xc7ef31+').'};}};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const a85_0x3e9a3a=a85_0x565e;(function(_0x136450,_0x31f0fa){const _0x3fb4a2=a85_0x565e,_0x4e8c3f=_0x136450();while(!![]){try{const _0x4f0597=-parseInt(_0x3fb4a2(0x1c7))/0x1+-parseInt(_0x3fb4a2(0x1ba))/0x2*(parseInt(_0x3fb4a2(0x1d1))/0x3)+parseInt(_0x3fb4a2(0x1b4))/0x4*(parseInt(_0x3fb4a2(0x1e6))/0x5)+-parseInt(_0x3fb4a2(0x1d5))/0x6+parseInt(_0x3fb4a2(0x1c5))/0x7*(parseInt(_0x3fb4a2(0x1c6))/0x8)+-parseInt(_0x3fb4a2(0x1d3))/0x9*(parseInt(_0x3fb4a2(0x1c1))/0xa)+parseInt(_0x3fb4a2(0x1c2))/0xb*(parseInt(_0x3fb4a2(0x1b2))/0xc);if(_0x4f0597===_0x31f0fa)break;else _0x4e8c3f['push'](_0x4e8c3f['shift']());}catch(_0x269d82){_0x4e8c3f['push'](_0x4e8c3f['shift']());}}}(a85_0x1486,0x2f0e3));function a85_0x1486(){const _0x4a30ac=['\x20failed','skipped','sqlcode','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.\x20Continue?\x20[y/N]\x20','sqlContent','430atpiYU','force','sqlCode','stderr','cancelled','Force\x20pull\x20cancelled.','toLowerCase','85070ZhpXjj','3806wYPXok','POST','question','7cCSBti','1676264LfCshS','151028qOQvFK','Pull\x20failed:\x20could\x20not\x20load\x20SQL\x20content\x20(','appCode','totalCount','tableData','trim','Overwrite\x20local\x20files\x20that\x20differ\x20from\x20remote','sqlName','Would\x20pull\x20','\x20skipped,\x20','2280HZAWzJ','utf8','153TtAYgS','message','620730ZdVtMj','str','yes','write','push','Filter\x20by\x20SQL\x20display\x20name\x20(API\x20filter)','length','unchanged','close','local\x20differs\x20from\x20remote','includes','string','would_pull','name','conflict','No\x20remote\x20SQL\x20queries\x20matched.','\x20SQL\x20file(s)\x20under\x20','96210WXKIsn','/smartapi/custom/queryUserCustomSqlList','8916mJjJrO','boolean','60HKcylA'];a85_0x1486=function(){return _0x4a30ac;};return a85_0x1486();}function a85_0x565e(_0x23911d,_0x2163ad){_0x23911d=_0x23911d-0x1b1;const _0x1486aa=a85_0x1486();let _0x565e53=_0x1486aa[_0x23911d];return _0x565e53;}import{createInterface}from'node:readline';import{readFile,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryInfo,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{findProjectRootDirectory}from'../../context.js';import{assignSqlFileNames,buildPulledSqlFileContent,resolveSqlLocalDir}from'../../commands/sql/shared.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x2676d0,_0xcca800){const _0x3a3411=a85_0x565e,_0x4f3eaf=[];let _0x504455=0x1;while(!![]){const _0x1b2511=await listSqlQueries(_0x2676d0,{'currentPage':_0x504455,'pageSize':PAGE_SIZE,'sqlCode':_0xcca800[_0x3a3411(0x1bc)],'sqlName':_0xcca800[_0x3a3411(0x1ce)]}),_0x2839f3=_0x1b2511[_0x3a3411(0x1cb)]??[];_0x4f3eaf[_0x3a3411(0x1d9)](..._0x2839f3);if(_0x2839f3[_0x3a3411(0x1db)]===0x0)break;const _0x249ea4=_0x1b2511['paging']?.[_0x3a3411(0x1ca)];if(_0x249ea4!=null?_0x4f3eaf[_0x3a3411(0x1db)]>=_0x249ea4:_0x2839f3[_0x3a3411(0x1db)]<PAGE_SIZE)break;_0x504455++;}return _0x4f3eaf;}async function ensureSqlContent(_0xdd54a4,_0x5be29a){const _0x270bbd=a85_0x565e;if(_0x5be29a[_0x270bbd(0x1b9)]!=null&&String(_0x5be29a['sqlContent'])['length']>0x0)return _0x5be29a;return getSqlQueryInfo(_0xdd54a4,_0x5be29a[_0x270bbd(0x1bc)]);}export const sqlPull={'service':'sql','command':'pull','description':'Pull\x20remote\x20custom\x20SQL\x20queries\x20into\x20.rabetbase/sql/','risk':a85_0x3e9a3a(0x1d8),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'name','type':a85_0x3e9a3a(0x1e0),'description':a85_0x3e9a3a(0x1da)},{'name':a85_0x3e9a3a(0x1bb),'type':a85_0x3e9a3a(0x1b3),'description':a85_0x3e9a3a(0x1cd)}],async 'dryRun'(_0x4339b9){const _0x350943=a85_0x3e9a3a,_0x2ac2c6=findProjectRootDirectory(),_0x878df6=resolveSqlLocalDir(_0x2ac2c6),_0x293255=_0x4339b9[_0x350943(0x1d6)](_0x350943(0x1b7))||undefined,_0x2a3515=_0x4339b9[_0x350943(0x1d6)](_0x350943(0x1e2))||undefined,_0x3fd527=await fetchAllSqlQueries(_0x4339b9[_0x350943(0x1c9)],{'sqlCode':_0x293255,'sqlName':_0x2a3515}),_0x55ecdb=[],_0x1f89eb=[];for(const _0x3e3737 of _0x3fd527){try{_0x55ecdb[_0x350943(0x1d9)](await ensureSqlContent(_0x4339b9[_0x350943(0x1c9)],_0x3e3737));}catch(_0x1fc3aa){_0x1f89eb[_0x350943(0x1d9)]({'sqlCode':_0x3e3737['sqlCode'],'error':_0x1fc3aa instanceof Error?_0x1fc3aa[_0x350943(0x1d4)]:String(_0x1fc3aa)});}}const _0x2cc2e3=assignSqlFileNames(_0x55ecdb),_0x4345e5=[];for(const [_0x49eed7,_0x2df274]of _0x2cc2e3){const _0x1c70ea=join(_0x878df6,_0x49eed7),_0x234fdc=buildPulledSqlFileContent(_0x2df274);let _0x3f15e2=_0x350943(0x1e1),_0x32a679;if(await fileExists(_0x1c70ea)){const _0x4dbacf=await readFile(_0x1c70ea,_0x350943(0x1d2));_0x4dbacf===_0x234fdc?(_0x3f15e2=_0x350943(0x1b6),_0x32a679=_0x350943(0x1dc)):(_0x3f15e2=_0x350943(0x1e3),_0x32a679='local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)');}_0x4345e5[_0x350943(0x1d9)]({'sqlCode':_0x2df274[_0x350943(0x1bc)],'sqlName':_0x2df274['sqlName'],'filePath':_0x1c70ea,'status':_0x3f15e2,'reason':_0x32a679});}return{'method':_0x350943(0x1c3),'url':_0x350943(0x1b1),'body':{'appCode':_0x4339b9[_0x350943(0x1c9)],'sqlCode':_0x293255??null,'sqlName':_0x2a3515??null,'loadErrors':_0x1f89eb,'files':_0x4345e5},'description':_0x350943(0x1cf)+_0x4345e5[_0x350943(0x1db)]+_0x350943(0x1e5)+_0x878df6};},async 'execute'(_0x19739f){const _0xd6f087=a85_0x3e9a3a,_0x170b2b=findProjectRootDirectory(),_0x14147a=resolveSqlLocalDir(_0x170b2b),_0xe1e9d0=_0x19739f[_0xd6f087(0x1d6)](_0xd6f087(0x1b7))||undefined,_0x1b5f36=_0x19739f['str'](_0xd6f087(0x1e2))||undefined,_0x4149af=_0x19739f['bool'](_0xd6f087(0x1bb)),_0x4de1ff=await fetchAllSqlQueries(_0x19739f[_0xd6f087(0x1c9)],{'sqlCode':_0xe1e9d0,'sqlName':_0x1b5f36});if(_0x4de1ff[_0xd6f087(0x1db)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0xd6f087(0x1e4)};const _0x1a2e15=[],_0x5744bb=[];for(const _0x350b86 of _0x4de1ff){try{_0x1a2e15[_0xd6f087(0x1d9)](await ensureSqlContent(_0x19739f[_0xd6f087(0x1c9)],_0x350b86));}catch(_0x20c9b7){_0x5744bb[_0xd6f087(0x1d9)]({'sqlCode':_0x350b86[_0xd6f087(0x1bc)],'error':_0x20c9b7 instanceof Error?_0x20c9b7[_0xd6f087(0x1d4)]:String(_0x20c9b7)});}}if(_0x1a2e15[_0xd6f087(0x1db)]===0x0)return{'ok':![],'data':{'pulled':[],'skipped':[],'failed':_0x5744bb},'message':_0xd6f087(0x1c8)+_0x5744bb[_0xd6f087(0x1db)]+'\x20error(s)).'};const _0x5ca796=assignSqlFileNames(_0x1a2e15);if(_0x4149af&&!_0x19739f['nonInteractive']){let _0xa1dc02=![];for(const [_0x302e9c,_0x5a2fc5]of _0x5ca796){const _0xb3fbc=join(_0x14147a,_0x302e9c),_0x2386f3=buildPulledSqlFileContent(_0x5a2fc5);if(await fileExists(_0xb3fbc)){const _0x20850f=await readFile(_0xb3fbc,_0xd6f087(0x1d2));if(_0x20850f!==_0x2386f3){_0xa1dc02=!![];break;}}}if(_0xa1dc02){const _0x26e06d=await confirmForce();if(!_0x26e06d)throw CliErrors[_0xd6f087(0x1be)](_0xd6f087(0x1bf));}}const _0x540738=[],_0x2d2ef7=[];for(const [_0x3fc092,_0x268836]of _0x5ca796){const _0x363e1f=join(_0x14147a,_0x3fc092),_0x4277ff=buildPulledSqlFileContent(_0x268836);try{if(await fileExists(_0x363e1f)){const _0x2252b1=await readFile(_0x363e1f,_0xd6f087(0x1d2));if(_0x2252b1===_0x4277ff){_0x2d2ef7[_0xd6f087(0x1d9)]({'sqlCode':_0x268836[_0xd6f087(0x1bc)],'reason':_0xd6f087(0x1dc)});continue;}if(!_0x4149af){_0x2d2ef7[_0xd6f087(0x1d9)]({'sqlCode':_0x268836[_0xd6f087(0x1bc)],'reason':_0xd6f087(0x1de)});continue;}}await ensureParentDirectory(_0x363e1f),await writeFile(_0x363e1f,_0x4277ff,_0xd6f087(0x1d2)),_0x540738[_0xd6f087(0x1d9)]({'sqlCode':_0x268836[_0xd6f087(0x1bc)],'filePath':_0x363e1f});}catch(_0x4c8236){_0x5744bb[_0xd6f087(0x1d9)]({'sqlCode':_0x268836[_0xd6f087(0x1bc)],'error':_0x4c8236 instanceof Error?_0x4c8236['message']:String(_0x4c8236)});}}const _0x3e3835=_0x5744bb[_0xd6f087(0x1db)]===0x0;return{'ok':_0x3e3835,'data':{'pulled':_0x540738,'skipped':_0x2d2ef7,'failed':_0x5744bb},'message':'Pull\x20complete:\x20'+_0x540738[_0xd6f087(0x1db)]+'\x20written,\x20'+_0x2d2ef7[_0xd6f087(0x1db)]+_0xd6f087(0x1d0)+_0x5744bb[_0xd6f087(0x1db)]+_0xd6f087(0x1b5)};}};async function confirmForce(){const _0x272698=a85_0x3e9a3a,_0x452ad1=createInterface({'input':process['stdin'],'output':process[_0x272698(0x1bd)]}),_0x1bd49f=await new Promise(_0x41ff4a=>{const _0x49a815=_0x272698;_0x452ad1[_0x49a815(0x1c4)](_0x49a815(0x1b8),_0x41ff4a);});return _0x452ad1[_0x272698(0x1dd)](),['y',_0x272698(0x1d7)][_0x272698(0x1df)](_0x1bd49f[_0x272698(0x1cc)]()[_0x272698(0x1c0)]());}
|
package/lib/commands/sql/save.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a86_0x3eaa40=a86_0x57e2;(function(_0x49197f,_0x56eb6b){const _0x54400f=a86_0x57e2,_0x3c6358=_0x49197f();while(!![]){try{const _0x4ccd39=-parseInt(_0x54400f(0x1dc))/0x1+-parseInt(_0x54400f(0x1cd))/0x2+parseInt(_0x54400f(0x1bf))/0x3*(parseInt(_0x54400f(0x1d3))/0x4)+parseInt(_0x54400f(0x1c4))/0x5+parseInt(_0x54400f(0x1e0))/0x6+-parseInt(_0x54400f(0x1d9))/0x7+parseInt(_0x54400f(0x1d6))/0x8;if(_0x4ccd39===_0x56eb6b)break;else _0x3c6358['push'](_0x3c6358['shift']());}catch(_0xa2e16){_0x3c6358['push'](_0x3c6358['shift']());}}}(a86_0x5c7e,0xc4f59));import{readFileSync,existsSync}from'node:fs';import{resolve}from'node:path';import{saveSqlQuery}from'../../core/api-client.js';function a86_0x5c7e(){const _0x1da76c=['sqlcode','join','str','length','24pVwjaB','Path\x20to\x20the\x20SQL\x20file','sql','10003032rlbFjd','Updated','file','2084971pGKnql','none','\x20successfully','1400219ouBzLr','sqlName','sqlname','cwd','2230776dRUxHA','Target\x20database\x20—\x20accepts\x20a\x20numeric\x20ID\x20or\x20database\x20name\x20(e.g.\x20ecommerce_db)','sqlType','\x20chars)','save','description','message','sqlCode','dbId','string','write','\x20|\x20Params:\x20','POST','action','Validation:\x20','Save\x20or\x20update\x20a\x20custom\x20SQL\x20query\x20(validates\x20before\x20saving)','created','745428BaVIRN','appCode','tables','Created','utf-8','3777175ZKFDai','Conflict\x20detected','N/A','parameters','blocked','type','\x20|\x20Tables:\x20','validation','dbName','2727298DFaJwZ','SQL\x20validation\x20failed:\x20'];a86_0x5c7e=function(){return _0x1da76c;};return a86_0x5c7e();}import{resolveOneDb}from'../../core/db-resolver.js';import{validateSql}from'../../core/sql-validator.js';import{CliErrors}from'../../errors.js';function a86_0x57e2(_0x2b4101,_0x532b6c){_0x2b4101=_0x2b4101-0x1b8;const _0x5c7e19=a86_0x5c7e();let _0x57e2ca=_0x5c7e19[_0x2b4101];return _0x57e2ca;}import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlSave={'service':a86_0x3eaa40(0x1d5),'command':a86_0x3eaa40(0x1e4),'description':a86_0x3eaa40(0x1bd),'risk':a86_0x3eaa40(0x1b8),'flags':[{'name':a86_0x3eaa40(0x1d8),'type':a86_0x3eaa40(0x1e9),'required':!![],'description':a86_0x3eaa40(0x1d4)},SQLCODE_FLAG_OPTIONAL,{'name':a86_0x3eaa40(0x1de),'type':a86_0x3eaa40(0x1e9),'description':'SQL\x20query\x20display\x20name'},{'name':'db','type':a86_0x3eaa40(0x1e9),'description':a86_0x3eaa40(0x1e1)},{'name':a86_0x3eaa40(0x1e5),'type':a86_0x3eaa40(0x1e9),'description':'SQL\x20query\x20description'}],async 'validate'(_0x3868ce){const _0x42d8cf=a86_0x3eaa40,_0xf7c2d4=resolve(process[_0x42d8cf(0x1df)](),_0x3868ce[_0x42d8cf(0x1d1)](_0x42d8cf(0x1d8)));if(!existsSync(_0xf7c2d4))throw CliErrors[_0x42d8cf(0x1cb)]('File\x20not\x20found:\x20'+_0xf7c2d4);const _0x245d3a=readFileSync(_0xf7c2d4,'utf-8'),_0x1b5b98=validateSql(_0x245d3a);if(!_0x1b5b98['valid'])throw CliErrors['validation'](_0x42d8cf(0x1ce)+_0x1b5b98[_0x42d8cf(0x1e6)]);},async 'dryRun'(_0x40d3c4){const _0x579f5b=a86_0x3eaa40,_0x428bb0=resolve(process[_0x579f5b(0x1df)](),_0x40d3c4[_0x579f5b(0x1d1)](_0x579f5b(0x1d8))),_0x308d66=readFileSync(_0x428bb0,'utf-8'),_0x322d4c=validateSql(_0x308d66),_0x108d02=_0x40d3c4[_0x579f5b(0x1d1)]('db')||undefined,{db:_0x4633d6,error:_0x34aeb9}=await resolveOneDb(_0x40d3c4['appCode'],_0x108d02);return{'method':_0x579f5b(0x1ba),'url':'/api/node-toolbox/sql/save','body':{'appCode':_0x40d3c4[_0x579f5b(0x1c0)],'sqlContent':'('+_0x308d66[_0x579f5b(0x1d2)]+_0x579f5b(0x1e3),'sqlCode':_0x40d3c4[_0x579f5b(0x1d1)]('sqlcode')||undefined,'sqlName':_0x40d3c4[_0x579f5b(0x1d1)](_0x579f5b(0x1de))||undefined,'db':_0x4633d6?_0x4633d6[_0x579f5b(0x1cc)]+'\x20('+_0x4633d6[_0x579f5b(0x1e8)]+')':_0x34aeb9},'description':['Save\x20SQL\x20query\x20from\x20'+_0x40d3c4[_0x579f5b(0x1d1)]('file'),_0x579f5b(0x1bc)+_0x322d4c[_0x579f5b(0x1e6)],'Type:\x20'+_0x322d4c[_0x579f5b(0x1e2)][_0x579f5b(0x1c9)]+_0x579f5b(0x1ca)+(_0x322d4c[_0x579f5b(0x1c1)][_0x579f5b(0x1d0)](',\x20')||_0x579f5b(0x1c6))+_0x579f5b(0x1b9)+(_0x322d4c[_0x579f5b(0x1c7)][_0x579f5b(0x1d0)](',\x20')||_0x579f5b(0x1da))]['join']('\x0a')};},async 'execute'(_0x24d420){const _0x5a474c=a86_0x3eaa40,_0x47b687=resolve(process[_0x5a474c(0x1df)](),_0x24d420[_0x5a474c(0x1d1)](_0x5a474c(0x1d8))),_0x23675b=readFileSync(_0x47b687,_0x5a474c(0x1c3)),_0x26a12d=_0x24d420[_0x5a474c(0x1d1)]('db')||undefined,{db:_0x24afa1,error:_0x3fcb86}=await resolveOneDb(_0x24d420[_0x5a474c(0x1c0)],_0x26a12d);if(_0x3fcb86)throw CliErrors[_0x5a474c(0x1cb)](_0x3fcb86);const _0x38c73e=await saveSqlQuery({'appCode':_0x24d420[_0x5a474c(0x1c0)],'sqlContent':_0x23675b,'sqlCode':_0x24d420['str'](_0x5a474c(0x1cf))||undefined,'sqlName':_0x24d420['str'](_0x5a474c(0x1de))||undefined,'dbId':_0x24afa1[_0x5a474c(0x1e8)],'description':_0x24d420[_0x5a474c(0x1d1)](_0x5a474c(0x1e5))||undefined});if(_0x38c73e[_0x5a474c(0x1c8)])return{'ok':![],'data':_0x38c73e,'message':_0x38c73e[_0x5a474c(0x1e6)]||_0x5a474c(0x1c5)};return{'ok':!![],'data':{'sqlCode':_0x38c73e[_0x5a474c(0x1e7)],'sqlName':_0x38c73e[_0x5a474c(0x1dd)],'action':_0x38c73e[_0x5a474c(0x1bb)]},'message':(_0x38c73e['action']===_0x5a474c(0x1be)?_0x5a474c(0x1c2):_0x5a474c(0x1d7))+_0x5a474c(0x1db)+(_0x38c73e['sqlCode']?'\x20('+_0x38c73e[_0x5a474c(0x1e7)]+')':'')};}};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const a87_0x5928f9=a87_0xde12;(function(_0x5661f6,_0x502cb8){const _0xe62155=a87_0xde12,_0x453c81=_0x5661f6();while(!![]){try{const _0x16411d=parseInt(_0xe62155(0xd0))/0x1*(-parseInt(_0xe62155(0xc3))/0x2)+-parseInt(_0xe62155(0xc1))/0x3*(-parseInt(_0xe62155(0xc4))/0x4)+-parseInt(_0xe62155(0xc2))/0x5+-parseInt(_0xe62155(0xc5))/0x6+-parseInt(_0xe62155(0xc7))/0x7+-parseInt(_0xe62155(0xcf))/0x8*(parseInt(_0xe62155(0xd6))/0x9)+-parseInt(_0xe62155(0xcb))/0xa*(-parseInt(_0xe62155(0xd4))/0xb);if(_0x16411d===_0x502cb8)break;else _0x453c81['push'](_0x453c81['shift']());}catch(_0x3c45a8){_0x453c81['push'](_0x453c81['shift']());}}}(a87_0x355a,0xb6082));import{join}from'node:path';export const SQL_LOCAL_REL_DIR=a87_0x5928f9(0xc9);function a87_0x355a(){const _0x15be4b=['sqlContent','7402857CrCscU','--\x20@lovrabet.sqlCode:\x20','.rabetbase/sql','--\x20@lovrabet.description:','10SxFSiv','has','set','join','176584ikSTft','5287qKtRYu','sqlName','.sql','endsWith','48533221bgPhKK','trimEnd','333eVxBDv','replace','unnamed','78XnMlkP','5462385DrioaL','162RAAcKU','119348WZAors','6283770AFxsrE'];a87_0x355a=function(){return _0x15be4b;};return a87_0x355a();}export function resolveSqlLocalDir(_0x1b113c){return join(_0x1b113c,SQL_LOCAL_REL_DIR);}export function safeSqlFileBaseName(_0x7b6b2c){const _0x110a1f=a87_0x5928f9,_0x51c304=_0x7b6b2c['trim']()||_0x110a1f(0xc0),_0x21a069=_0x51c304[_0x110a1f(0xd7)](/[/\\?%*:|"<>]/g,'_')[_0x110a1f(0xd7)](/\s+/g,'_')[_0x110a1f(0xd7)](/_+/g,'_');return _0x21a069||'unnamed';}export function assignSqlFileNames(_0x5d4424){const _0x45cbf3=a87_0x5928f9,_0xb01f78=new Map();for(const _0x5ec0cc of _0x5d4424){const _0x38ffa4=safeSqlFileBaseName(_0x5ec0cc[_0x45cbf3(0xd1)]??_0x45cbf3(0xc0));let _0x3b7a66=_0x38ffa4+_0x45cbf3(0xd2);if(_0xb01f78[_0x45cbf3(0xcc)](_0x3b7a66)){const _0x4aaecb=(_0x5ec0cc['sqlCode']??'unknown')[_0x45cbf3(0xd7)](/-/g,'');_0x3b7a66=_0x38ffa4+'__'+_0x4aaecb+_0x45cbf3(0xd2);}let _0x4f81b4=0x0,_0xc9a3d3=_0x3b7a66;while(_0xb01f78['has'](_0xc9a3d3)){_0x4f81b4++,_0xc9a3d3=_0x38ffa4+'__'+_0x4f81b4+'.sql';}_0xb01f78[_0x45cbf3(0xcd)](_0xc9a3d3,_0x5ec0cc);}return _0xb01f78;}function a87_0xde12(_0xfcc341,_0x56cecd){_0xfcc341=_0xfcc341-0xc0;const _0x355a5b=a87_0x355a();let _0xde1280=_0x355a5b[_0xfcc341];return _0xde1280;}export function buildPulledSqlFileContent(_0x313c88){const _0x11e479=a87_0x5928f9,_0x511481=_0x313c88[_0x11e479(0xd1)]??_0x11e479(0xc0),_0x1846b1=_0x313c88['sqlCode']??'',_0x387cc8=(_0x313c88['description']??'')[_0x11e479(0xd7)](/\r?\n/g,'\x20')['trim'](),_0x45ca05=_0x313c88[_0x11e479(0xc6)]??'',_0x46caa0=['--\x20@lovrabet.sqlName:\x20'+_0x511481,_0x11e479(0xc8)+_0x1846b1,_0x11e479(0xca)+(_0x387cc8?'\x20'+_0x387cc8:''),'',_0x45ca05[_0x11e479(0xd5)]()],_0x32b4b8=_0x46caa0[_0x11e479(0xce)]('\x0a');return _0x32b4b8[_0x11e479(0xd3)]('\x0a')?_0x32b4b8:_0x32b4b8+'\x0a';}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a88_0x4dc15f=a88_0xe021;(function(_0x3daa50,_0x5db372){const _0x3c1669=a88_0xe021,_0x53e713=_0x3daa50();while(!![]){try{const _0x55a40f=-parseInt(_0x3c1669(0x89))/0x1+parseInt(_0x3c1669(0xa1))/0x2+parseInt(_0x3c1669(0x87))/0x3+parseInt(_0x3c1669(0xa4))/0x4*(parseInt(_0x3c1669(0x8e))/0x5)+-parseInt(_0x3c1669(0x94))/0x6*(parseInt(_0x3c1669(0x8b))/0x7)+parseInt(_0x3c1669(0xa2))/0x8+-parseInt(_0x3c1669(0x8c))/0x9;if(_0x55a40f===_0x5db372)break;else _0x53e713['push'](_0x53e713['shift']());}catch(_0x3099b5){_0x53e713['push'](_0x53e713['shift']());}}}(a88_0x586f,0x321a5));import{readFileSync,existsSync}from'node:fs';function a88_0x586f(){const _0x442a82=['\x22\x20not\x20found\x20in\x20any\x20dataset','type','sql','parameters','str','\x22\x20not\x20found\x20or\x20not\x20accessible','name','598410OZjcdL','986280vGQMjY','file','20SGHMSs','string','validation','map','Provide\x20--file\x20or\x20--sql','message','push','read','File\x20not\x20found:\x20','schemaWarnings','cwd','sqlType','dbtableConfig','isDangerous','schema:','utf-8','Dataset\x20\x22','tableName','1026678OKXupM','isSelectOnly','251775HeZgcI','trim','7TiHQtW','3441600hbIpHL','reason','162665AeskGn','Comma-separated\x20dataset\x20codes\x20to\x20cross-check\x20table/column\x20names\x20against','schemas','valid','size','filter','527910UZBNBS','Table\x20\x22','fields','tables','toLowerCase','get'];a88_0x586f=function(){return _0x442a82;};return a88_0x586f();}import{resolve}from'node:path';function a88_0xe021(_0xe66a7a,_0x1c4bd9){_0xe66a7a=_0xe66a7a-0x85;const _0x586f23=a88_0x586f();let _0xe0215=_0x586f23[_0xe66a7a];return _0xe0215;}import{validateSql}from'../../core/sql-validator.js';import{getDatasetDetail,listDatasets}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';export const sqlValidate={'service':a88_0x4dc15f(0x9c),'command':'validate','description':'Validate\x20SQL\x20content\x20without\x20saving\x20(type\x20detection,\x20parameter\x20extraction,\x20optional\x20schema\x20check)','risk':a88_0x4dc15f(0xab),'flags':[{'name':'file','type':a88_0x4dc15f(0xa5),'description':'Path\x20to\x20the\x20SQL\x20file\x20to\x20validate'},{'name':a88_0x4dc15f(0x9c),'type':a88_0x4dc15f(0xa5),'description':'Inline\x20SQL\x20content\x20to\x20validate\x20(alternative\x20to\x20--file)'},{'name':a88_0x4dc15f(0x90),'type':a88_0x4dc15f(0xa5),'description':a88_0x4dc15f(0x8f)}],async 'execute'(_0x18d5f5){const _0x3086e3=a88_0x4dc15f,_0x3c3e28=_0x18d5f5[_0x3086e3(0x9e)](_0x3086e3(0xa3)),_0x4c0a6a=_0x18d5f5['str'](_0x3086e3(0x9c));if(!_0x3c3e28&&!_0x4c0a6a)throw CliErrors['flagMissing']('file',_0x3086e3(0xa8));let _0xd36945;if(_0x3c3e28){const _0x507d41=resolve(process[_0x3086e3(0xae)](),_0x3c3e28);if(!existsSync(_0x507d41))throw CliErrors[_0x3086e3(0xa6)](_0x3086e3(0xac)+_0x507d41);_0xd36945=readFileSync(_0x507d41,_0x3086e3(0xb3));}else _0xd36945=_0x4c0a6a;const _0x208ad1=validateSql(_0xd36945),_0x3993a6={'valid':_0x208ad1[_0x3086e3(0x91)],'sqlType':_0x208ad1[_0x3086e3(0xaf)][_0x3086e3(0x9b)],'isSelectOnly':_0x208ad1[_0x3086e3(0xaf)][_0x3086e3(0x88)],'isDangerous':_0x208ad1[_0x3086e3(0xaf)][_0x3086e3(0xb1)],'tables':_0x208ad1[_0x3086e3(0x97)],'parameters':_0x208ad1[_0x3086e3(0x9d)],'message':_0x208ad1[_0x3086e3(0xa9)]};_0x208ad1[_0x3086e3(0xaf)][_0x3086e3(0x8d)]&&(_0x3993a6[_0x3086e3(0x8d)]=_0x208ad1[_0x3086e3(0xaf)][_0x3086e3(0x8d)]);const _0x55b519=_0x18d5f5[_0x3086e3(0x9e)](_0x3086e3(0x90));if(_0x55b519&&_0x208ad1[_0x3086e3(0x91)]){const _0x182e48=_0x55b519['split'](',')[_0x3086e3(0xa7)](_0x4e7ef8=>_0x4e7ef8[_0x3086e3(0x8a)]())[_0x3086e3(0x93)](Boolean),_0x135710=[],_0x263d57=await listDatasets(_0x18d5f5['appCode']),_0x152f37=new Map(_0x263d57[_0x3086e3(0xa7)](_0x4d9922=>[_0x4d9922[_0x3086e3(0xb0)]?.[_0x3086e3(0x86)]?.[_0x3086e3(0x98)](),_0x4d9922]));for(const _0x521202 of _0x208ad1['tables']){const _0x389f10=_0x152f37[_0x3086e3(0x99)](_0x521202['toLowerCase']());!_0x389f10&&_0x135710[_0x3086e3(0xaa)](_0x3086e3(0x95)+_0x521202+_0x3086e3(0x9a));}for(const _0x5cfcf0 of _0x182e48){try{const _0xe30687=await getDatasetDetail(_0x5cfcf0),_0x5749f6=Array['isArray'](_0xe30687['fields'])?_0xe30687[_0x3086e3(0x96)]:[],_0x5aa196=new Set(_0x5749f6[_0x3086e3(0xa7)](_0x2a26ed=>_0x2a26ed[_0x3086e3(0xa0)]?.[_0x3086e3(0x98)]())),_0x33a363=_0xe30687[_0x3086e3(0xb0)]?.['tableName']||_0xe30687['tableName']||_0x5cfcf0;_0x3993a6[_0x3086e3(0xb2)+_0x33a363]={'code':_0x5cfcf0,'tableName':_0x33a363,'fieldCount':_0x5aa196[_0x3086e3(0x92)],'fields':Array['from'](_0x5aa196)};}catch{_0x135710[_0x3086e3(0xaa)](_0x3086e3(0x85)+_0x5cfcf0+_0x3086e3(0x9f));}}_0x135710['length']>0x0&&(_0x3993a6[_0x3086e3(0xad)]=_0x135710);}return{'ok':_0x208ad1['valid'],'data':_0x3993a6,'message':_0x208ad1[_0x3086e3(0xa9)]};}};
|
package/lib/constant/cli.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a89_0x5b8f6b=a89_0x1b81;(function(_0x33fcce,_0x2386df){const _0x2b08df=a89_0x1b81,_0x309f8f=_0x33fcce();while(!![]){try{const _0x1bf3eb=parseInt(_0x2b08df(0x219))/0x1*(parseInt(_0x2b08df(0x20b))/0x2)+-parseInt(_0x2b08df(0x1da))/0x3*(-parseInt(_0x2b08df(0x1e9))/0x4)+parseInt(_0x2b08df(0x1e1))/0x5+-parseInt(_0x2b08df(0x21f))/0x6+parseInt(_0x2b08df(0x22e))/0x7*(-parseInt(_0x2b08df(0x1e8))/0x8)+parseInt(_0x2b08df(0x1ec))/0x9*(-parseInt(_0x2b08df(0x210))/0xa)+parseInt(_0x2b08df(0x1dd))/0xb;if(_0x1bf3eb===_0x2386df)break;else _0x309f8f['push'](_0x309f8f['shift']());}catch(_0xd5b49c){_0x309f8f['push'](_0x309f8f['shift']());}}}(a89_0x39c8,0xba21a));export const CLI_BIN_NAME='rabetbase';function a89_0x1b81(_0x461c48,_0x151d2a){_0x461c48=_0x461c48-0x1d4;const _0x39c8df=a89_0x39c8();let _0x1b8178=_0x39c8df[_0x461c48];return _0x1b8178;}export const CLI_DISPLAY_NAME=a89_0x5b8f6b(0x21a);export const NPM_PACKAGE_NAME='@lovrabet/rabetbase-cli';function a89_0x39c8(){const _0x4281e8=['sqlname','Override\x20appcode','pagesize','sql','Watch\x20mode','Skip\x20confirmation\x20for\x20high-risk\x20writes','sqlcode','page','Function\x20node','project','Description','Environment','force','<expr>','code','dryRun','JSON\x20params','target','2CjQwPe','nonInteractive','Type\x20filter','env','Alias\x20for\x20--non-interactive','731740fkZgkx','Skip\x20import\x20generation','skip-imports','Preview\x20operation\x20without\x20executing','Force\x20overwrite','boolean','file','name','fromEntries','817442VSywVf','Rabetbase\x20CLI','<name>','app','Record\x20ID','verbose','3709098AhHzTA','help','Clear','<code>','operation-type','Enable\x20BFF\x20save','Apply\x20to\x20all','keyword','datasetcode','schemas','string','map','Target\x20path','global','all','2678207hpSkZQ','Config\x20value','Dataset\x20code','Use\x20global\x20config\x20scope','SQL\x20code','description','Filter\x20JSON\x20output\x20(bundled\x20jq\x20via\x20node-jq,\x20else\x20PATH;\x20use\x20with\x20--format\x20json\x20or\x20compress)','File\x20path','format','Operation\x20type','Show\x20help','dry-run','5079ukkhzx','Config\x20key','yes','9915576OfCDsX','type','non-interactive','Force\x20non-interactive\x20mode\x20(CI)','4350450sPcEpN','output','Output\x20format','Use\x20remote','key','enableBffSave','Page\x20number','16SkUCnm','1892vICPcl','Use\x20project\x20config\x20scope','dbid','153heRPFZ','Code\x20filter','value','clear','Output\x20path','enable-bff-save','watch','params','functionNode','meowKey','Select\x20app\x20profile\x20by\x20name','Schemas','Verbose\x20output'];a89_0x39c8=function(){return _0x4281e8;};return a89_0x39c8();}export const GLOBAL_FLAGS=[{'name':'appcode','meowKey':'appcode','type':'string','description':a89_0x5b8f6b(0x1fa),'hint':a89_0x5b8f6b(0x222)},{'name':a89_0x5b8f6b(0x21c),'meowKey':'app','type':a89_0x5b8f6b(0x229),'description':a89_0x5b8f6b(0x1f6),'hint':a89_0x5b8f6b(0x21b)},{'name':a89_0x5b8f6b(0x20e),'meowKey':a89_0x5b8f6b(0x20e),'type':'string','description':a89_0x5b8f6b(0x204),'hint':'production\x20|\x20daily'},{'name':a89_0x5b8f6b(0x1d6),'meowKey':'format','type':'string','description':a89_0x5b8f6b(0x1e3),'hint':'json\x20|\x20pretty\x20|\x20compress'},{'name':'jq','meowKey':'jq','type':a89_0x5b8f6b(0x229),'description':a89_0x5b8f6b(0x1d4),'hint':a89_0x5b8f6b(0x206)},{'name':a89_0x5b8f6b(0x1d9),'meowKey':a89_0x5b8f6b(0x208),'type':a89_0x5b8f6b(0x215),'description':a89_0x5b8f6b(0x213)},{'name':a89_0x5b8f6b(0x1dc),'meowKey':a89_0x5b8f6b(0x1dc),'type':a89_0x5b8f6b(0x215),'description':a89_0x5b8f6b(0x1fe)},{'name':a89_0x5b8f6b(0x1df),'meowKey':a89_0x5b8f6b(0x20c),'type':a89_0x5b8f6b(0x215),'description':a89_0x5b8f6b(0x1e0)},{'name':a89_0x5b8f6b(0x22c),'meowKey':a89_0x5b8f6b(0x22c),'type':a89_0x5b8f6b(0x215),'description':a89_0x5b8f6b(0x231)},{'name':a89_0x5b8f6b(0x202),'meowKey':a89_0x5b8f6b(0x202),'type':'boolean','description':a89_0x5b8f6b(0x1ea)},{'name':'ci','meowKey':'ci','type':'boolean','description':a89_0x5b8f6b(0x20f),'hidden':!![]},{'name':a89_0x5b8f6b(0x220),'meowKey':a89_0x5b8f6b(0x220),'type':'boolean','description':a89_0x5b8f6b(0x1d8)},{'name':a89_0x5b8f6b(0x217),'meowKey':'name','type':a89_0x5b8f6b(0x229),'description':'Name','hidden':!![]},{'name':a89_0x5b8f6b(0x1ef),'meowKey':'clear','type':a89_0x5b8f6b(0x215),'description':a89_0x5b8f6b(0x221),'hidden':!![]},{'name':a89_0x5b8f6b(0x1f2),'meowKey':a89_0x5b8f6b(0x1f2),'type':a89_0x5b8f6b(0x215),'description':a89_0x5b8f6b(0x1fd),'hidden':!![]},{'name':a89_0x5b8f6b(0x1e2),'meowKey':'output','type':a89_0x5b8f6b(0x229),'description':a89_0x5b8f6b(0x1f0),'hidden':!![]},{'name':a89_0x5b8f6b(0x1f3),'meowKey':'params','type':a89_0x5b8f6b(0x229),'description':a89_0x5b8f6b(0x209),'hidden':!![]},{'name':'datasetcode','meowKey':a89_0x5b8f6b(0x227),'type':'string','description':a89_0x5b8f6b(0x230),'hidden':!![]},{'name':a89_0x5b8f6b(0x22d),'meowKey':a89_0x5b8f6b(0x22d),'type':a89_0x5b8f6b(0x215),'description':a89_0x5b8f6b(0x225),'hidden':!![]},{'name':a89_0x5b8f6b(0x1f1),'meowKey':a89_0x5b8f6b(0x1e6),'type':a89_0x5b8f6b(0x215),'description':a89_0x5b8f6b(0x224),'hidden':!![]},{'name':'id','meowKey':'id','type':'string','description':a89_0x5b8f6b(0x21d),'hidden':!![]},{'name':a89_0x5b8f6b(0x1de),'meowKey':a89_0x5b8f6b(0x1de),'type':'string','description':a89_0x5b8f6b(0x20d),'hidden':!![]},{'name':a89_0x5b8f6b(0x216),'meowKey':a89_0x5b8f6b(0x216),'type':a89_0x5b8f6b(0x229),'description':a89_0x5b8f6b(0x1d5),'hidden':!![]},{'name':'sqlcode','meowKey':a89_0x5b8f6b(0x1ff),'type':'string','description':a89_0x5b8f6b(0x232),'hidden':!![]},{'name':a89_0x5b8f6b(0x1f9),'meowKey':a89_0x5b8f6b(0x1f9),'type':'string','description':'SQL\x20name','hidden':!![]},{'name':'dbid','meowKey':a89_0x5b8f6b(0x1eb),'type':'string','description':'DB\x20ID','hidden':!![]},{'name':a89_0x5b8f6b(0x233),'meowKey':a89_0x5b8f6b(0x233),'type':a89_0x5b8f6b(0x229),'description':a89_0x5b8f6b(0x203),'hidden':!![]},{'name':a89_0x5b8f6b(0x200),'meowKey':'page','type':a89_0x5b8f6b(0x229),'description':a89_0x5b8f6b(0x1e7),'hidden':!![]},{'name':a89_0x5b8f6b(0x1fb),'meowKey':'pagesize','type':a89_0x5b8f6b(0x229),'description':'Page\x20size','hidden':!![]},{'name':a89_0x5b8f6b(0x226),'meowKey':a89_0x5b8f6b(0x226),'type':a89_0x5b8f6b(0x229),'description':'Keyword\x20filter','hidden':!![]},{'name':a89_0x5b8f6b(0x207),'meowKey':a89_0x5b8f6b(0x207),'type':'string','description':a89_0x5b8f6b(0x1ed),'hidden':!![]},{'name':a89_0x5b8f6b(0x1fc),'meowKey':a89_0x5b8f6b(0x1fc),'type':a89_0x5b8f6b(0x229),'description':'SQL\x20string','hidden':!![]},{'name':a89_0x5b8f6b(0x228),'meowKey':a89_0x5b8f6b(0x228),'type':a89_0x5b8f6b(0x229),'description':a89_0x5b8f6b(0x1f7),'hidden':!![]},{'name':'operation','meowKey':'operation','type':'string','description':'Operation\x20type','hidden':!![]},{'name':'target','meowKey':a89_0x5b8f6b(0x20a),'type':'string','description':a89_0x5b8f6b(0x22b),'hidden':!![]},{'name':a89_0x5b8f6b(0x212),'meowKey':'skipImports','type':a89_0x5b8f6b(0x215),'description':a89_0x5b8f6b(0x211),'hidden':!![]},{'name':a89_0x5b8f6b(0x1e5),'meowKey':a89_0x5b8f6b(0x1e5),'type':'string','description':a89_0x5b8f6b(0x1db),'hidden':!![]},{'name':a89_0x5b8f6b(0x1ee),'meowKey':a89_0x5b8f6b(0x1ee),'type':a89_0x5b8f6b(0x229),'description':a89_0x5b8f6b(0x22f),'hidden':!![]},{'name':a89_0x5b8f6b(0x205),'meowKey':a89_0x5b8f6b(0x205),'type':a89_0x5b8f6b(0x215),'description':a89_0x5b8f6b(0x214),'hidden':!![]},{'name':'remote','meowKey':'remote','type':a89_0x5b8f6b(0x215),'description':a89_0x5b8f6b(0x1e4),'hidden':!![]},{'name':'verbose','meowKey':a89_0x5b8f6b(0x21e),'type':a89_0x5b8f6b(0x215),'description':a89_0x5b8f6b(0x1f8),'hidden':!![]},{'name':a89_0x5b8f6b(0x223),'meowKey':'operationType','type':a89_0x5b8f6b(0x229),'description':a89_0x5b8f6b(0x1d7),'hidden':!![]},{'name':'function-node','meowKey':a89_0x5b8f6b(0x1f4),'type':a89_0x5b8f6b(0x229),'description':a89_0x5b8f6b(0x201),'hidden':!![]}];export function buildMeowFlags(){const _0x4a1b84=a89_0x5b8f6b;return Object[_0x4a1b84(0x218)](GLOBAL_FLAGS[_0x4a1b84(0x22a)](_0x2f861c=>[_0x2f861c[_0x4a1b84(0x1f5)],{'type':_0x2f861c[_0x4a1b84(0x1de)]}]));}
|
package/lib/constant/domain.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a90_0x39be(){const _0x2c60a0=['https://daily-runtime.lovrabet.com','3049950yfaoWU','12Glyxke','userDomain','6ZOQhgr','https://user.lovrabet.com','11kQsUOt','runtimeDomain','production','637990icwkNa','53088NBveEv','2sdZAdM','123168WPOhzU','https://user-daily.lovrabet.com','17960UpLfXo','12DGaiCR','234451EoEmaj','https://runtime.lovrabet.com','https://api.lovrabet.com','4546568LnQdEa','261czEMJJ'];a90_0x39be=function(){return _0x2c60a0;};return a90_0x39be();}const a90_0xc73a4a=a90_0x412a;(function(_0xd31063,_0x10abee){const _0x4a675e=a90_0x412a,_0x56b4f2=_0xd31063();while(!![]){try{const _0x1e3965=-parseInt(_0x4a675e(0xe7))/0x1+parseInt(_0x4a675e(0xe8))/0x2*(-parseInt(_0x4a675e(0xe9))/0x3)+parseInt(_0x4a675e(0xdf))/0x4*(-parseInt(_0x4a675e(0xe6))/0x5)+parseInt(_0x4a675e(0xe1))/0x6*(-parseInt(_0x4a675e(0xd8))/0x7)+parseInt(_0x4a675e(0xd6))/0x8*(parseInt(_0x4a675e(0xdc))/0x9)+-parseInt(_0x4a675e(0xde))/0xa*(-parseInt(_0x4a675e(0xe3))/0xb)+parseInt(_0x4a675e(0xd7))/0xc*(parseInt(_0x4a675e(0xdb))/0xd);if(_0x1e3965===_0x10abee)break;else _0x56b4f2['push'](_0x56b4f2['shift']());}catch(_0x3e30d0){_0x56b4f2['push'](_0x56b4f2['shift']());}}}(a90_0x39be,0x331fd));import{getEnv}from'../constant/env.js';let customApiDomain,customUserDomain,customRuntimeDomain;export function initDomains(_0x3b72ea){const _0x22bc8b=a90_0x412a;customApiDomain=_0x3b72ea?.['apiDomain'],customUserDomain=_0x3b72ea?.[_0x22bc8b(0xe0)],customRuntimeDomain=_0x3b72ea?.[_0x22bc8b(0xe4)];}export const getUserDomain=()=>customUserDomain||(getEnv()===a90_0xc73a4a(0xe5)?a90_0xc73a4a(0xe2):a90_0xc73a4a(0xea));function a90_0x412a(_0x4be483,_0x4a1ff3){_0x4be483=_0x4be483-0xd6;const _0x39bed2=a90_0x39be();let _0x412a0f=_0x39bed2[_0x4be483];return _0x412a0f;}export const getApiDomain=()=>customApiDomain||(getEnv()===a90_0xc73a4a(0xe5)?a90_0xc73a4a(0xda):'https://daily-api.lovrabet.com');export const getRuntimeDomain=()=>customRuntimeDomain||(getEnv()===a90_0xc73a4a(0xe5)?a90_0xc73a4a(0xd9):a90_0xc73a4a(0xdd));
|
package/lib/constant/env.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a91_0x31883b=a91_0x2a47;(function(_0x3ca48b,_0x220220){const _0x38372c=a91_0x2a47,_0x158837=_0x3ca48b();while(!![]){try{const _0x1842e8=-parseInt(_0x38372c(0xf0))/0x1*(-parseInt(_0x38372c(0xf7))/0x2)+parseInt(_0x38372c(0xf8))/0x3+parseInt(_0x38372c(0xf1))/0x4*(-parseInt(_0x38372c(0xfa))/0x5)+-parseInt(_0x38372c(0xf9))/0x6+-parseInt(_0x38372c(0xf3))/0x7+parseInt(_0x38372c(0xfc))/0x8*(-parseInt(_0x38372c(0xfb))/0x9)+-parseInt(_0x38372c(0xf6))/0xa*(-parseInt(_0x38372c(0xf2))/0xb);if(_0x1842e8===_0x220220)break;else _0x158837['push'](_0x158837['shift']());}catch(_0x14f800){_0x158837['push'](_0x158837['shift']());}}}(a91_0x4f9c,0xd13f8));function a91_0x2a47(_0x1e4e01,_0x4fa83a){_0x1e4e01=_0x1e4e01-0xf0;const _0x4f9c44=a91_0x4f9c();let _0x2a4723=_0x4f9c44[_0x1e4e01];return _0x2a4723;}export function normalizeEnv(_0x3cad43){const _0x4f47ea=a91_0x2a47;return _0x3cad43===_0x4f47ea(0xf4)?'production':_0x3cad43;}let env=normalizeEnv(process.env.RABETBASE_ENV||process.env.LOVRABET_ENV||a91_0x31883b(0xf5));function a91_0x4f9c(){const _0x536205=['4207530DwaTju','9498696WaVIXc','1555LDnRpX','6372207jfZolp','8yzSJIF','1JcSimH','8776HoRxxP','239756XmOGVm','5713862SqyjLo','online','production','1140REZAoD','1519130nYDwCr'];a91_0x4f9c=function(){return _0x536205;};return a91_0x4f9c();}export function getEnv(){return env;}export function initEnv(_0x3dead3){env=normalizeEnv(_0x3dead3);}
|
package/lib/constant/paths.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a92_0x1cf5bf=a92_0x47bb;function a92_0x47bb(_0x5a15b5,_0x9ff7bf){_0x5a15b5=_0x5a15b5-0x84;const _0x184c27=a92_0x184c();let _0x47bbaa=_0x184c27[_0x5a15b5];return _0x47bbaa;}(function(_0x5208fd,_0x581d67){const _0x20f7e9=a92_0x47bb,_0x1551c9=_0x5208fd();while(!![]){try{const _0x4f6bf8=-parseInt(_0x20f7e9(0x8c))/0x1+parseInt(_0x20f7e9(0x8f))/0x2*(-parseInt(_0x20f7e9(0x84))/0x3)+parseInt(_0x20f7e9(0x8d))/0x4+-parseInt(_0x20f7e9(0x87))/0x5+-parseInt(_0x20f7e9(0x85))/0x6*(-parseInt(_0x20f7e9(0x86))/0x7)+parseInt(_0x20f7e9(0x8a))/0x8*(-parseInt(_0x20f7e9(0x8b))/0x9)+-parseInt(_0x20f7e9(0x88))/0xa*(-parseInt(_0x20f7e9(0x8e))/0xb);if(_0x4f6bf8===_0x581d67)break;else _0x1551c9['push'](_0x1551c9['shift']());}catch(_0x1f5b40){_0x1551c9['push'](_0x1551c9['shift']());}}}(a92_0x184c,0xcf501));function a92_0x184c(){const _0x10759f=['940uyfjPx','./src/api','200mlcifW','344412wNpALN','1627693UKNekC','75996UilbnM','542817eOnXdg','1717158XbIxdU','3WsPFuG','108oyMajZ','311759sFPtBL','5835790RAhLjr'];a92_0x184c=function(){return _0x10759f;};return a92_0x184c();}export const DEFAULT_API_DIR=a92_0x1cf5bf(0x89);
|
package/lib/context.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a91_0x50add3=a91_0x2cf3;(function(_0x2f75b7,_0x50c86f){const _0x121bf3=a91_0x2cf3,_0x4cc0cc=_0x2f75b7();while(!![]){try{const _0x2a33c0=-parseInt(_0x121bf3(0x205))/0x1+-parseInt(_0x121bf3(0x234))/0x2+-parseInt(_0x121bf3(0x22e))/0x3*(-parseInt(_0x121bf3(0x216))/0x4)+-parseInt(_0x121bf3(0x220))/0x5*(-parseInt(_0x121bf3(0x206))/0x6)+parseInt(_0x121bf3(0x22b))/0x7*(parseInt(_0x121bf3(0x1f5))/0x8)+parseInt(_0x121bf3(0x200))/0x9+parseInt(_0x121bf3(0x212))/0xa*(-parseInt(_0x121bf3(0x1f7))/0xb);if(_0x2a33c0===_0x50c86f)break;else _0x4cc0cc['push'](_0x4cc0cc['shift']());}catch(_0x128734){_0x4cc0cc['push'](_0x4cc0cc['shift']());}}}(a91_0x1358,0x46457));import{readFileSync,writeFileSync,existsSync,mkdirSync,renameSync,unlinkSync}from'node:fs';import{resolve,dirname}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';function a91_0x1358(){const _0x28f506=['setLogPath','project','warn','1422065cUXwEC','.lovrabet.json','find','high-risk-write','read','utf8','\x0a\x20\x20','cookie','format','write','en-US','1770167khMMpb','./auth/get-cookie.js','ACCESS_KEY','209847trSiWH','PAGE_SIZE','accessKey','daily','riskLevel','object','1096562IZbVhb','.rabetbase.json','-api.ts','env','./constant/env.js','Global','cwd','MAX_RISK','COOKIE','VERBOSE','production','silent','appcode','16deyeDZ','apiDir','197571OawQTs','missing','keys','locale','userDomain','\x20config\x20file\x20ignored\x20(invalid\x20JSON\x20or\x20unreadable):\x20','pageSize','length','true','2843136AgOvHr','slice','apps','filter','api.ts','476024vcwryw','6fNntXc','app','.tmp','ENV','error','join','stringify','RISK_LEVEL','empty','defaultApp','Project','data','80bybUHe','trim','./utils/is-non-interactive.js','entries','20julCgm','string','authRequired','message','online','runtimeDomain','APPCODE'];a91_0x1358=function(){return _0x28f506;};return a91_0x1358();}import{DEFAULT_API_DIR}from'./constant/paths.js';import{normalizeLegacyOutputFormat}from'./framework/types.js';function env(_0x40b51b){return process.env[`RABETBASE_${_0x40b51b}`]||process.env[`LOVRABET_${_0x40b51b}`]||undefined;}export const NEW_CONFIG_NAME=a91_0x50add3(0x235);export const CONFIG_NAMES=['.rabetbase.json',a91_0x50add3(0x221),'.lovrabetrc'];export const LEGACY_CONFIG_NAMES=CONFIG_NAMES[a91_0x50add3(0x203)](_0xe53972=>_0xe53972!==NEW_CONFIG_NAME);export function resolveConfigPath(_0x40a6a6){for(const _0x5c5dc4 of CONFIG_NAMES){const _0x31b807=resolve(_0x40a6a6,_0x5c5dc4);if(existsSync(_0x31b807))return _0x31b807;}return undefined;}export async function createContext(_0x1e9aa9){const _0x4bb9a7=a91_0x50add3,_0x19c09c=readRawConfig(),_0x54e8b5=buildConfig(_0x19c09c,_0x1e9aa9),{initEnv:_0x51298d}=await import(_0x4bb9a7(0x1ec));if(_0x54e8b5[_0x4bb9a7(0x1eb)])_0x51298d(_0x54e8b5['env']);else _0x1e9aa9[_0x4bb9a7(0x1eb)]&&typeof _0x1e9aa9[_0x4bb9a7(0x1eb)]==='string'&&_0x51298d(_0x1e9aa9[_0x4bb9a7(0x1eb)]);const {initDomains:_0x779c96,getUserDomain:_0x3311d4,getApiDomain:_0x2e9929}=await import('./constant/domain.js');_0x779c96({'apiDomain':_0x19c09c['apiDomain']||undefined,'userDomain':_0x19c09c[_0x4bb9a7(0x1fb)]||undefined,'runtimeDomain':_0x19c09c[_0x4bb9a7(0x21b)]||undefined});const _0x393e27={'apiDomain':_0x2e9929(),'userDomain':_0x3311d4()},_0x543258=await buildAuth(_0x54e8b5);logger[_0x4bb9a7(0x21d)](process['cwd']());const _0x346833=(CLI_BIN_NAME+'\x20'+process['argv'][_0x4bb9a7(0x201)](0x2)[_0x4bb9a7(0x20b)]('\x20'))[_0x4bb9a7(0x213)]();logger['setRawCommand'](_0x346833);const {isNonInteractive:_0x393d98}=await import(_0x4bb9a7(0x214)),_0x2da333=_0x393d98(_0x1e9aa9);return{'config':_0x54e8b5,'auth':_0x543258,'logger':logger,'env':_0x393e27,'nonInteractive':_0x2da333};}export function buildConfigFromFlags(_0x34ea80){return buildConfig(readRawConfig(),_0x34ea80);}export function getProjectConfigPath(){return resolveConfigPath(process['cwd']());}export function getGlobalConfigPath(){return resolveConfigPath(homedir());}function a91_0x2cf3(_0x3f1f2c,_0x54ccec){_0x3f1f2c=_0x3f1f2c-0x1ea;const _0x1358a5=a91_0x1358();let _0x2cf325=_0x1358a5[_0x3f1f2c];return _0x2cf325;}export function isInProject(){return!!getProjectConfigPath();}export function inspectCliConfigJsonFile(_0x3cf7b2){const _0xfd8e74=a91_0x50add3;if(!existsSync(_0x3cf7b2))return{'status':_0xfd8e74(0x1f8)};try{const _0x59887c=readFileSync(_0x3cf7b2,{'encoding':'utf8'});if(!_0x59887c?.[_0xfd8e74(0x213)]())return{'status':'empty'};const _0x5e69ea=JSON['parse'](_0x59887c);return{'status':'ok','data':_0x5e69ea};}catch(_0x4b6afa){return{'status':_0xfd8e74(0x20a),'message':_0x4b6afa instanceof Error?_0x4b6afa['message']:String(_0x4b6afa)};}}function parseCliConfigJsonFile(_0x361ee7,_0x18e652,_0x274f20){const _0x310e6a=a91_0x50add3,_0x361eae=inspectCliConfigJsonFile(_0x361ee7);if(_0x361eae['status']===_0x310e6a(0x1f8)||_0x361eae['status']===_0x310e6a(0x20e))return{};if(_0x361eae['status']==='ok')return _0x361eae[_0x310e6a(0x211)];return _0x18e652===_0x310e6a(0x21f)&&_0x274f20&&console['error'](CLI_BIN_NAME+':\x20'+_0x274f20+_0x310e6a(0x1fc)+_0x361ee7+_0x310e6a(0x226)+_0x361eae[_0x310e6a(0x219)]),{};}export function loadRawConfigLayers(_0x5cf02a){const _0x8c768d=a91_0x50add3;let _0x1f0dd1={},_0x3b9460={};const _0x55a439=resolveConfigPath(homedir());_0x55a439&&(_0x1f0dd1=parseCliConfigJsonFile(_0x55a439,_0x8c768d(0x21f),_0x8c768d(0x1ed)));const _0x3f291a=_0x5cf02a||process[_0x8c768d(0x1ee)](),_0x5407ad=resolveConfigPath(_0x3f291a);return _0x5407ad&&(_0x3b9460=parseCliConfigJsonFile(_0x5407ad,'warn',_0x8c768d(0x210))),{'globalPath':_0x55a439,'projectPath':_0x5407ad,'globalConfig':_0x1f0dd1,'projectConfig':_0x3b9460};}function mergeRawConfigLayers(_0x663a0d){const _0x301e14=a91_0x50add3,{globalConfig:_0x775a98,projectConfig:_0x23f1e7}=_0x663a0d,_0x5c747b=_0x775a98[_0x301e14(0x202)]&&typeof _0x775a98[_0x301e14(0x202)]===_0x301e14(0x233)?_0x775a98[_0x301e14(0x202)]:{},_0x1ea6b9=_0x23f1e7['apps']&&typeof _0x23f1e7[_0x301e14(0x202)]===_0x301e14(0x233)?_0x23f1e7[_0x301e14(0x202)]:{},_0x108d7b={..._0x5c747b,..._0x1ea6b9},_0x56cec8={..._0x775a98,..._0x23f1e7};Object[_0x301e14(0x1f9)](_0x108d7b)[_0x301e14(0x1fe)]>0x0&&(_0x56cec8[_0x301e14(0x202)]=_0x108d7b);if(_0x301e14(0x20f)in _0x23f1e7)_0x56cec8['defaultApp']=_0x23f1e7[_0x301e14(0x20f)];else{if(_0x1ea6b9&&Object[_0x301e14(0x1f9)](_0x1ea6b9)[_0x301e14(0x1fe)]>0x0)_0x56cec8['defaultApp']=Object[_0x301e14(0x1f9)](_0x1ea6b9)[0x0];else _0x775a98['defaultApp']&&(_0x56cec8[_0x301e14(0x20f)]=_0x775a98[_0x301e14(0x20f)]);}return _0x56cec8;}export function readRawConfigWithLayers(_0x41e480){const _0x286f4c=loadRawConfigLayers(_0x41e480);return{'config':mergeRawConfigLayers(_0x286f4c),'layers':_0x286f4c};}export function readRawConfig(_0x29d221){return mergeRawConfigLayers(loadRawConfigLayers(_0x29d221));}export function readConfigFile(_0x3e75da){const _0x357559=a91_0x50add3;return parseCliConfigJsonFile(_0x3e75da,_0x357559(0x1f3));}export function writeConfigFile(_0x57b40b,_0x3b111f){const _0x3914b0=a91_0x50add3,_0x1520e4=dirname(_0x57b40b);!existsSync(_0x1520e4)&&mkdirSync(_0x1520e4,{'recursive':!![]});const _0x3d18da=_0x57b40b+_0x3914b0(0x208);try{writeFileSync(_0x3d18da,JSON[_0x3914b0(0x20c)](_0x3b111f,null,0x2)+'\x0a',{'encoding':_0x3914b0(0x225),'mode':0x180}),renameSync(_0x3d18da,_0x57b40b);}catch(_0x4a6199){try{unlinkSync(_0x3d18da);}catch{}throw _0x4a6199;}}export function resolveWriteConfigPath(_0xd66ccb){const _0x2d4b24=a91_0x50add3,_0x4ddee2=_0xd66ccb===_0x2d4b24(0x21e)?process[_0x2d4b24(0x1ee)]():homedir(),_0x37b99c=resolveConfigPath(_0x4ddee2);return _0x37b99c??resolve(_0x4ddee2,NEW_CONFIG_NAME);}function buildConfig(_0x4e0753,_0x1beabb){const _0x4cb7a4=a91_0x50add3,_0x4e3c18={};if(_0x4e0753[_0x4cb7a4(0x202)]&&typeof _0x4e0753[_0x4cb7a4(0x202)]===_0x4cb7a4(0x233))for(const [_0x1d41d3,_0xd6015c]of Object['entries'](_0x4e0753[_0x4cb7a4(0x202)])){_0xd6015c&&typeof _0xd6015c==='object'&&_0xd6015c['appcode']&&(_0x4e3c18[_0x1d41d3]=_0xd6015c);}const _0x5c7b2b=_0x4e0753[_0x4cb7a4(0x20f)]||undefined,_0x14775d=Object[_0x4cb7a4(0x1f9)](_0x4e3c18)['length']>0x0,_0x7c623c=_0x1beabb[_0x4cb7a4(0x207)]||env('APP')||undefined,_0x513390=_0x7c623c||_0x5c7b2b||undefined,_0x50cc51=_0x1beabb['appcode']||env(_0x4cb7a4(0x21c))||undefined,_0x191bf5=_0x50cc51?Object[_0x4cb7a4(0x215)](_0x4e3c18)['find'](([,_0x43d684])=>_0x43d684?.[_0x4cb7a4(0x1f4)]===_0x50cc51):undefined,_0x318ca4=_0x191bf5?.[0x0],_0x52d6a8=_0x191bf5?.[0x1];let _0x791d8f=_0x50cc51?_0x318ca4:_0x513390,_0x5d03b3=_0x791d8f&&_0x4e3c18[_0x791d8f]?_0x4e3c18[_0x791d8f]:undefined;_0x50cc51&&_0x52d6a8&&(_0x5d03b3=_0x52d6a8);const _0x53dd0a=_0x50cc51?_0x52d6a8??_0x5d03b3:_0x5d03b3,_0x4809e1=_0x7c623c||(_0x50cc51?_0x318ca4:undefined),_0x546ee5=_0x50cc51||_0x53dd0a?.['appcode']||_0x4e0753[_0x4cb7a4(0x1f4)]||_0x4e0753[_0x4cb7a4(0x207)]||undefined,_0x23e888=_0x1beabb[_0x4cb7a4(0x1eb)]||env(_0x4cb7a4(0x209))||_0x53dd0a?.[_0x4cb7a4(0x1eb)]||_0x4e0753[_0x4cb7a4(0x1eb)]||_0x4cb7a4(0x1f2),_0x1880e8=_0x53dd0a?.[_0x4cb7a4(0x1fa)]||_0x4e0753[_0x4cb7a4(0x1fa)]||_0x4cb7a4(0x22a),_0x45a84b=env(_0x4cb7a4(0x1f0))||_0x53dd0a?.['cookie']||_0x4e0753['cookie']||undefined,_0x42c441=env(_0x4cb7a4(0x22d))||_0x53dd0a?.[_0x4cb7a4(0x230)]||_0x4e0753[_0x4cb7a4(0x230)]||undefined,_0x41c28e=_0x1beabb[_0x4cb7a4(0x228)]||env('FORMAT')||_0x53dd0a?.[_0x4cb7a4(0x228)]||_0x4e0753[_0x4cb7a4(0x228)],_0x445103=normalizeLegacyOutputFormat(_0x41c28e),_0xa0f192=env(_0x4cb7a4(0x22f))||_0x53dd0a?.[_0x4cb7a4(0x1fd)]||_0x4e0753['pageSize'],_0x53d9ac=_0xa0f192?Number(_0xa0f192)||undefined:undefined,_0x31c230=env(_0x4cb7a4(0x20d))||env(_0x4cb7a4(0x1ef))||_0x53dd0a?.['riskLevel']||_0x4e0753[_0x4cb7a4(0x232)]||_0x4e0753['maxRisk'],_0x105c97=_0x31c230===_0x4cb7a4(0x224)||_0x31c230===_0x4cb7a4(0x229)?_0x31c230:_0x4cb7a4(0x223),_0x2a759f=env(_0x4cb7a4(0x1f1)),_0x2c7e06=_0x2a759f==='1'||_0x2a759f===_0x4cb7a4(0x1ff),_0x885e8=_0x53dd0a?.[_0x4cb7a4(0x1f6)]||_0x4e0753[_0x4cb7a4(0x1f6)]||DEFAULT_API_DIR;return{'appCode':typeof _0x546ee5===_0x4cb7a4(0x217)&&_0x546ee5[_0x4cb7a4(0x213)]()?_0x546ee5[_0x4cb7a4(0x213)]():undefined,'env':_0x23e888===_0x4cb7a4(0x21a)?_0x4cb7a4(0x1f2):_0x23e888===_0x4cb7a4(0x231)?_0x4cb7a4(0x231):'production','locale':_0x1880e8,'cookie':_0x45a84b,'accessKey':_0x42c441,'format':_0x445103,'pageSize':_0x53d9ac,'riskLevel':_0x105c97,'verbose':_0x2c7e06,'apiDir':_0x885e8,'apps':_0x4e3c18,'defaultApp':_0x5c7b2b,'currentApp':_0x14775d?_0x791d8f:undefined,'explicitAppName':_0x4809e1,'raw':_0x4e0753};}async function buildAuth(_0x207b2c){const _0x1c8ac0=a91_0x50add3,{getCookie:_0x33e985}=await import(_0x1c8ac0(0x22c)),_0x26ab3f=_0x207b2c[_0x1c8ac0(0x227)]||_0x33e985(),_0x3d8679=_0x26ab3f?await getIsSessionValid():![];return{'cookie':_0x26ab3f,'isLoggedIn':_0x3d8679,async 'getOrLogin'(){const _0x495ab9=_0x1c8ac0;if(_0x26ab3f&&_0x3d8679)return _0x26ab3f;throw CliErrors[_0x495ab9(0x218)]();}};}export function resolveApiFilePath(_0x4187e2,_0x38e08d){const _0xdb3f6d=a91_0x50add3,_0x244825=resolve(process[_0xdb3f6d(0x1ee)](),_0x4187e2),_0x267c03=resolve(_0x244825,_0xdb3f6d(0x204));if(!_0x38e08d)return _0x267c03;const _0x37ccb9=readRawConfig(),_0xe1d64e=_0x37ccb9['apps']&&typeof _0x37ccb9['apps']==='object'?_0x37ccb9[_0xdb3f6d(0x202)]:{},_0x1f32b8=Object[_0xdb3f6d(0x215)](_0xe1d64e)[_0xdb3f6d(0x222)](([,_0x38463f])=>_0x38463f?.[_0xdb3f6d(0x1f4)]===_0x38e08d);if(!_0x1f32b8)return _0x267c03;const [_0x53c235,_0x2687a9]=_0x1f32b8,_0x933e2e=typeof _0x37ccb9[_0xdb3f6d(0x20f)]==='string'?_0x37ccb9[_0xdb3f6d(0x20f)]:undefined;if(_0x2687a9?.[_0xdb3f6d(0x1f6)])return _0x267c03;if(_0x933e2e&&_0x53c235!==_0x933e2e)return resolve(_0x244825,_0x53c235+_0xdb3f6d(0x1ea));return _0x267c03;}
|
|
1
|
+
const a93_0x2763c8=a93_0x1868;(function(_0x524baf,_0x283214){const _0x57b4dc=a93_0x1868,_0x491410=_0x524baf();while(!![]){try{const _0x1f6d5b=-parseInt(_0x57b4dc(0x129))/0x1+-parseInt(_0x57b4dc(0x143))/0x2*(parseInt(_0x57b4dc(0x122))/0x3)+parseInt(_0x57b4dc(0x128))/0x4*(-parseInt(_0x57b4dc(0x151))/0x5)+parseInt(_0x57b4dc(0x11e))/0x6+parseInt(_0x57b4dc(0x135))/0x7*(-parseInt(_0x57b4dc(0x115))/0x8)+parseInt(_0x57b4dc(0x13b))/0x9+parseInt(_0x57b4dc(0x137))/0xa*(parseInt(_0x57b4dc(0x13d))/0xb);if(_0x1f6d5b===_0x283214)break;else _0x491410['push'](_0x491410['shift']());}catch(_0x4bafdb){_0x491410['push'](_0x491410['shift']());}}}(a93_0x2912,0x80cd1));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{normalizeLegacyOutputFormat}from'./framework/types.js';function env(_0x20bc5e){return process.env[`RABETBASE_${_0x20bc5e}`]||process.env[`LOVRABET_${_0x20bc5e}`]||undefined;}export const NEW_CONFIG_NAME=a93_0x2763c8(0x113);export const CONFIG_NAMES=['.rabetbase.json',a93_0x2763c8(0x114),a93_0x2763c8(0x120)];export const LEGACY_CONFIG_NAMES=CONFIG_NAMES[a93_0x2763c8(0x14b)](_0x42e23a=>_0x42e23a!==NEW_CONFIG_NAME);export function resolveConfigPath(_0x2345d3){for(const _0x20a84f of CONFIG_NAMES){const _0x4cd9fe=resolve(_0x2345d3,_0x20a84f);if(existsSync(_0x4cd9fe))return _0x4cd9fe;}return undefined;}export function findProjectRootDirectory(_0x4cc2d9=process[a93_0x2763c8(0x111)]()){let _0x4a5a8d=resolve(_0x4cc2d9);const {root:_0x2f3d46}=parse(_0x4a5a8d),_0x56f2b2=homedir();while(!![]){if(resolveConfigPath(_0x4a5a8d)){if(_0x4a5a8d===_0x56f2b2)break;return _0x4a5a8d;}if(_0x4a5a8d===_0x2f3d46||_0x4a5a8d===_0x56f2b2)break;const _0x545ed5=dirname(_0x4a5a8d);if(_0x545ed5===_0x4a5a8d)break;_0x4a5a8d=_0x545ed5;}return resolve(_0x4cc2d9);}export async function createContext(_0x4455d5){const _0x51b257=a93_0x2763c8,_0x1712e2=readRawConfig(),_0x1b382e=buildConfig(_0x1712e2,_0x4455d5),{initEnv:_0x4a02f4}=await import(_0x51b257(0x145));if(_0x1b382e['env'])_0x4a02f4(_0x1b382e[_0x51b257(0x125)]);else _0x4455d5['env']&&typeof _0x4455d5[_0x51b257(0x125)]===_0x51b257(0x12c)&&_0x4a02f4(_0x4455d5[_0x51b257(0x125)]);const {initDomains:_0x108c88,getUserDomain:_0x121b7f,getApiDomain:_0x270f26}=await import(_0x51b257(0x110));_0x108c88({'apiDomain':_0x1712e2[_0x51b257(0x14e)]||undefined,'userDomain':_0x1712e2[_0x51b257(0x132)]||undefined,'runtimeDomain':_0x1712e2[_0x51b257(0x124)]||undefined});const _0x1fcc3d={'apiDomain':_0x270f26(),'userDomain':_0x121b7f()},_0x25c77c=await buildAuth(_0x1b382e);logger[_0x51b257(0x13a)](process[_0x51b257(0x111)]());const _0xc56534=(CLI_BIN_NAME+'\x20'+process[_0x51b257(0x153)][_0x51b257(0x13e)](0x2)[_0x51b257(0x14d)]('\x20'))[_0x51b257(0x146)]();logger['setRawCommand'](_0xc56534);const {isNonInteractive:_0x28a6b8}=await import(_0x51b257(0x134)),_0x451752=_0x28a6b8(_0x4455d5);return{'config':_0x1b382e,'auth':_0x25c77c,'logger':logger,'env':_0x1fcc3d,'nonInteractive':_0x451752};}export function buildConfigFromFlags(_0x26ea27){return buildConfig(readRawConfig(),_0x26ea27);}export function getProjectConfigPath(){const _0x1c401f=a93_0x2763c8;return resolveConfigPath(process[_0x1c401f(0x111)]());}function a93_0x2912(){const _0x9bcc45=['1096183VeaPmf','slice','production','status','./auth/get-cookie.js','silent','469202TtsSVn','ACCESS_KEY','./constant/env.js','trim','api.ts','ENV','accessKey','FORMAT','filter','message','join','apiDomain','pageSize','RISK_LEVEL','485fTEHvO','apiDir','argv','authRequired','Global','format','parse','entries','maxRisk','keys','appcode','inherit','./constant/domain.js','cwd','defaultApp','.rabetbase.json','.lovrabet.json','5728NBoXSj','find','utf8','error','Project','locale','cookie','write','object','1096746XfRtdm','riskLevel','.lovrabetrc','apps','3Clqlpc','true','runtimeDomain','env','length','warn','37292LkanCs','92985oyZAwk','read','daily','string','.tmp','app','missing','stringify','-api.ts','userDomain','empty','./utils/is-non-interactive.js','9723vTRxDA','PAGE_SIZE','240IjzMRX','\x0a\x20\x20','data','setLogPath','1615923OpoVRA','en-US'];a93_0x2912=function(){return _0x9bcc45;};return a93_0x2912();}export function getGlobalConfigPath(){return resolveConfigPath(homedir());}export function isInProject(){return!!getProjectConfigPath();}export function inspectCliConfigJsonFile(_0x24c509){const _0x2d1beb=a93_0x2763c8;if(!existsSync(_0x24c509))return{'status':'missing'};try{const _0x384dba=readFileSync(_0x24c509,{'encoding':_0x2d1beb(0x117)});if(!_0x384dba?.['trim']())return{'status':_0x2d1beb(0x133)};const _0x4caf19=JSON[_0x2d1beb(0x157)](_0x384dba);return{'status':'ok','data':_0x4caf19};}catch(_0x281f57){return{'status':_0x2d1beb(0x118),'message':_0x281f57 instanceof Error?_0x281f57['message']:String(_0x281f57)};}}function a93_0x1868(_0x2765ab,_0x30f08b){_0x2765ab=_0x2765ab-0x10b;const _0x2912f3=a93_0x2912();let _0x186860=_0x2912f3[_0x2765ab];return _0x186860;}function parseCliConfigJsonFile(_0x39ef11,_0x5bae46,_0x3afc59){const _0x126619=a93_0x2763c8,_0xccb7dc=inspectCliConfigJsonFile(_0x39ef11);if(_0xccb7dc[_0x126619(0x140)]===_0x126619(0x12f)||_0xccb7dc[_0x126619(0x140)]===_0x126619(0x133))return{};if(_0xccb7dc[_0x126619(0x140)]==='ok')return _0xccb7dc[_0x126619(0x139)];return _0x5bae46==='warn'&&_0x3afc59&&console[_0x126619(0x118)](CLI_BIN_NAME+':\x20'+_0x3afc59+'\x20config\x20file\x20ignored\x20(invalid\x20JSON\x20or\x20unreadable):\x20'+_0x39ef11+_0x126619(0x138)+_0xccb7dc[_0x126619(0x14c)]),{};}export function loadRawConfigLayers(_0x2fd1b8){const _0x5a36a3=a93_0x2763c8;let _0x1b86f0={},_0x3ce6af={};const _0x1c2361=resolveConfigPath(homedir());_0x1c2361&&(_0x1b86f0=parseCliConfigJsonFile(_0x1c2361,'warn',_0x5a36a3(0x155)));const _0x25b990=_0x2fd1b8??findProjectRootDirectory(),_0x19d691=resolveConfigPath(_0x25b990);return _0x19d691&&(_0x3ce6af=parseCliConfigJsonFile(_0x19d691,_0x5a36a3(0x127),_0x5a36a3(0x119))),{'globalPath':_0x1c2361,'projectPath':_0x19d691,'globalConfig':_0x1b86f0,'projectConfig':_0x3ce6af};}function mergeRawConfigLayers(_0x16556a){const _0x6446de=a93_0x2763c8,{globalConfig:_0x72cd99,projectConfig:_0x4ad5e1}=_0x16556a;if(_0x4ad5e1[_0x6446de(0x10f)]===![]){const _0x22a752={..._0x4ad5e1};delete _0x22a752['inherit'];const _0x294095=_0x4ad5e1['apps']&&typeof _0x4ad5e1[_0x6446de(0x121)]==='object'?_0x4ad5e1['apps']:{};Object[_0x6446de(0x10d)](_0x294095)[_0x6446de(0x126)]>0x0?_0x22a752[_0x6446de(0x121)]=_0x294095:delete _0x22a752[_0x6446de(0x121)];if(_0x6446de(0x112)in _0x4ad5e1)_0x22a752[_0x6446de(0x112)]=_0x4ad5e1[_0x6446de(0x112)];else Object['keys'](_0x294095)['length']>0x0&&(_0x22a752[_0x6446de(0x112)]=Object[_0x6446de(0x10d)](_0x294095)[0x0]);return _0x22a752;}const _0x297a51=_0x72cd99['apps']&&typeof _0x72cd99[_0x6446de(0x121)]===_0x6446de(0x11d)?_0x72cd99[_0x6446de(0x121)]:{},_0x2701f6=_0x4ad5e1[_0x6446de(0x121)]&&typeof _0x4ad5e1[_0x6446de(0x121)]==='object'?_0x4ad5e1[_0x6446de(0x121)]:{},_0x48c718={..._0x297a51,..._0x2701f6},_0x2c2cc3={..._0x72cd99,..._0x4ad5e1};Object[_0x6446de(0x10d)](_0x48c718)[_0x6446de(0x126)]>0x0&&(_0x2c2cc3[_0x6446de(0x121)]=_0x48c718);if(_0x6446de(0x112)in _0x4ad5e1)_0x2c2cc3[_0x6446de(0x112)]=_0x4ad5e1[_0x6446de(0x112)];else{if(_0x2701f6&&Object[_0x6446de(0x10d)](_0x2701f6)['length']>0x0)_0x2c2cc3[_0x6446de(0x112)]=Object[_0x6446de(0x10d)](_0x2701f6)[0x0];else _0x72cd99[_0x6446de(0x112)]&&(_0x2c2cc3['defaultApp']=_0x72cd99['defaultApp']);}return _0x2c2cc3;}export function readRawConfigWithLayers(_0x29fd86){const _0x44dabf=loadRawConfigLayers(_0x29fd86);return{'config':mergeRawConfigLayers(_0x44dabf),'layers':_0x44dabf};}export function readRawConfig(_0x2da92a){return mergeRawConfigLayers(loadRawConfigLayers(_0x2da92a));}export function readConfigFile(_0x5e50f0){const _0x1b59de=a93_0x2763c8;return parseCliConfigJsonFile(_0x5e50f0,_0x1b59de(0x142));}export function writeConfigFile(_0x5a131c,_0x4468fa){const _0x5ce321=a93_0x2763c8,_0x3af8fe=dirname(_0x5a131c);!existsSync(_0x3af8fe)&&mkdirSync(_0x3af8fe,{'recursive':!![]});const _0x5d05a2=_0x5a131c+_0x5ce321(0x12d);try{writeFileSync(_0x5d05a2,JSON[_0x5ce321(0x130)](_0x4468fa,null,0x2)+'\x0a',{'encoding':_0x5ce321(0x117),'mode':0x180}),renameSync(_0x5d05a2,_0x5a131c);}catch(_0x1785b0){try{unlinkSync(_0x5d05a2);}catch{}throw _0x1785b0;}}export function resolveWriteConfigPath(_0x272bf4){const _0x39f722=a93_0x2763c8,_0x347e38=_0x272bf4==='project'?process[_0x39f722(0x111)]():homedir(),_0x4b97b9=resolveConfigPath(_0x347e38);return _0x4b97b9??resolve(_0x347e38,NEW_CONFIG_NAME);}function buildConfig(_0x27ef31,_0x173084){const _0xa095a3=a93_0x2763c8,_0x3c6d1c={};if(_0x27ef31[_0xa095a3(0x121)]&&typeof _0x27ef31[_0xa095a3(0x121)]===_0xa095a3(0x11d))for(const [_0x286875,_0x449401]of Object[_0xa095a3(0x10b)](_0x27ef31[_0xa095a3(0x121)])){_0x449401&&typeof _0x449401===_0xa095a3(0x11d)&&_0x449401['appcode']&&(_0x3c6d1c[_0x286875]=_0x449401);}const _0x2f460c=_0x27ef31[_0xa095a3(0x112)]||undefined,_0x58fdde=Object[_0xa095a3(0x10d)](_0x3c6d1c)[_0xa095a3(0x126)]>0x0,_0x342326=_0x173084[_0xa095a3(0x12e)]||env('APP')||undefined,_0x2b4f48=_0x342326||_0x2f460c||undefined,_0x36d711=_0x173084['appcode']||env('APPCODE')||undefined,_0x36f93e=_0x36d711?Object[_0xa095a3(0x10b)](_0x3c6d1c)[_0xa095a3(0x116)](([,_0x37b2ea])=>_0x37b2ea?.['appcode']===_0x36d711):undefined,_0x4dbc9c=_0x36f93e?.[0x0],_0x18b98c=_0x36f93e?.[0x1];let _0x2f754f=_0x36d711?_0x4dbc9c:_0x2b4f48,_0x484306=_0x2f754f&&_0x3c6d1c[_0x2f754f]?_0x3c6d1c[_0x2f754f]:undefined;_0x36d711&&_0x18b98c&&(_0x484306=_0x18b98c);const _0x33fbb2=_0x36d711?_0x18b98c??_0x484306:_0x484306,_0x28e525=_0x342326||(_0x36d711?_0x4dbc9c:undefined),_0x1d6608=_0x36d711||_0x33fbb2?.[_0xa095a3(0x10e)]||_0x27ef31[_0xa095a3(0x10e)]||_0x27ef31[_0xa095a3(0x12e)]||undefined,_0x4d6c9c=_0x173084[_0xa095a3(0x125)]||env(_0xa095a3(0x148))||_0x33fbb2?.[_0xa095a3(0x125)]||_0x27ef31['env']||_0xa095a3(0x13f),_0x1c1932=_0x33fbb2?.[_0xa095a3(0x11a)]||_0x27ef31[_0xa095a3(0x11a)]||_0xa095a3(0x13c),_0x1de7ae=env('COOKIE')||_0x33fbb2?.[_0xa095a3(0x11b)]||_0x27ef31['cookie']||undefined,_0x53f9f1=env(_0xa095a3(0x144))||_0x33fbb2?.[_0xa095a3(0x149)]||_0x27ef31['accessKey']||undefined,_0xf20098=_0x173084[_0xa095a3(0x156)]||env(_0xa095a3(0x14a))||_0x33fbb2?.[_0xa095a3(0x156)]||_0x27ef31[_0xa095a3(0x156)],_0x52baef=normalizeLegacyOutputFormat(_0xf20098),_0x51e888=env(_0xa095a3(0x136))||_0x33fbb2?.[_0xa095a3(0x14f)]||_0x27ef31[_0xa095a3(0x14f)],_0x2eeab1=_0x51e888?Number(_0x51e888)||undefined:undefined,_0x1ddc8d=env(_0xa095a3(0x150))||env('MAX_RISK')||_0x33fbb2?.[_0xa095a3(0x11f)]||_0x27ef31[_0xa095a3(0x11f)]||_0x27ef31[_0xa095a3(0x10c)],_0x356b9b=_0x1ddc8d===_0xa095a3(0x12a)||_0x1ddc8d===_0xa095a3(0x11c)?_0x1ddc8d:'high-risk-write',_0x6a403=env('VERBOSE'),_0x38ac28=_0x6a403==='1'||_0x6a403===_0xa095a3(0x123),_0x4de783=_0x33fbb2?.['apiDir']||_0x27ef31[_0xa095a3(0x152)]||DEFAULT_API_DIR;return{'appCode':typeof _0x1d6608==='string'&&_0x1d6608['trim']()?_0x1d6608[_0xa095a3(0x146)]():undefined,'env':_0x4d6c9c==='online'?_0xa095a3(0x13f):_0x4d6c9c===_0xa095a3(0x12b)?_0xa095a3(0x12b):'production','locale':_0x1c1932,'cookie':_0x1de7ae,'accessKey':_0x53f9f1,'format':_0x52baef,'pageSize':_0x2eeab1,'riskLevel':_0x356b9b,'verbose':_0x38ac28,'apiDir':_0x4de783,'apps':_0x3c6d1c,'defaultApp':_0x2f460c,'currentApp':_0x58fdde?_0x2f754f:undefined,'explicitAppName':_0x28e525,'raw':_0x27ef31};}async function buildAuth(_0x23560f){const _0x1cff55=a93_0x2763c8,{getCookie:_0x27817f}=await import(_0x1cff55(0x141)),_0x3a8ba8=_0x23560f[_0x1cff55(0x11b)]||_0x27817f(),_0xd24aa7=_0x3a8ba8?await getIsSessionValid():![];return{'cookie':_0x3a8ba8,'isLoggedIn':_0xd24aa7,async 'getOrLogin'(){const _0xb26bcd=_0x1cff55;if(_0x3a8ba8&&_0xd24aa7)return _0x3a8ba8;throw CliErrors[_0xb26bcd(0x154)]();}};}export function resolveApiFilePath(_0x100173,_0x40a684){const _0xa1e50=a93_0x2763c8,_0x2c4578=resolve(process['cwd'](),_0x100173),_0x5d4822=resolve(_0x2c4578,_0xa1e50(0x147));if(!_0x40a684)return _0x5d4822;const _0x3b149b=readRawConfig(),_0x543950=_0x3b149b['apps']&&typeof _0x3b149b['apps']===_0xa1e50(0x11d)?_0x3b149b['apps']:{},_0x2c67e5=Object['entries'](_0x543950)[_0xa1e50(0x116)](([,_0x2b99b8])=>_0x2b99b8?.['appcode']===_0x40a684);if(!_0x2c67e5)return _0x5d4822;const [_0x50fdad,_0xfee852]=_0x2c67e5,_0x4f3d9c=typeof _0x3b149b[_0xa1e50(0x112)]==='string'?_0x3b149b[_0xa1e50(0x112)]:undefined;if(_0xfee852?.[_0xa1e50(0x152)])return _0x5d4822;if(_0x4f3d9c&&_0x50fdad!==_0x4f3d9c)return resolve(_0x2c4578,_0x50fdad+_0xa1e50(0x131));return _0x5d4822;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x29104b,_0x23a31e){const _0xeb8721=a94_0x2994,_0x5d4f8e=_0x29104b();while(!![]){try{const _0xd9cc10=-parseInt(_0xeb8721(0xa5))/0x1*(parseInt(_0xeb8721(0xa2))/0x2)+-parseInt(_0xeb8721(0xa1))/0x3+parseInt(_0xeb8721(0xb1))/0x4*(-parseInt(_0xeb8721(0xa0))/0x5)+parseInt(_0xeb8721(0xac))/0x6+parseInt(_0xeb8721(0xa7))/0x7*(parseInt(_0xeb8721(0xaf))/0x8)+-parseInt(_0xeb8721(0xaa))/0x9+-parseInt(_0xeb8721(0xae))/0xa*(-parseInt(_0xeb8721(0xa6))/0xb);if(_0xd9cc10===_0x23a31e)break;else _0x5d4f8e['push'](_0x5d4f8e['shift']());}catch(_0x41e25a){_0x5d4f8e['push'](_0x5d4f8e['shift']());}}}(a94_0x2813,0x41227));import{readFileSync,existsSync}from'node:fs';import{resolve}from'node:path';function a94_0x2813(){const _0x1489ec=['4tOIfId','set','has','149579ACWvGC','15198502PANCih','7WjDaUG','datasetCode','cwd','3287745axhBSG','get','17934jigFBm','exec','10yNIACd','1142168ymcmav','api.ts','20CqnylO','416935PzgenM','537759uCxmQg'];a94_0x2813=function(){return _0x1489ec;};return a94_0x2813();}const cache=new Map();function parseApiFile(_0x4fb396){const _0x3e75dc=a94_0x2994,_0x59e729=[],_0x3ffb98=/\{\s*datasetCode:\s*"([^"]+)"\s*,\s*tableName:\s*"([^"]+)"\s*,\s*name:\s*"([^"]*?)"\s*,\s*alias:\s*"([^"]+)"\s*,?\s*\}/g;let _0x3b4100;while((_0x3b4100=_0x3ffb98[_0x3e75dc(0xad)](_0x4fb396))!==null){_0x59e729['push']({'datasetCode':_0x3b4100[0x1],'tableName':_0x3b4100[0x2],'name':_0x3b4100[0x3],'alias':_0x3b4100[0x4]});}return _0x59e729;}export function loadAliasMap(_0x44685c,_0x4f1eee,_0x1bcbf7){const _0x58b5cf=a94_0x2994,_0x277745=_0x1bcbf7??resolve(process[_0x58b5cf(0xa9)](),_0x44685c,_0x58b5cf(0xb0));if(cache[_0x58b5cf(0xa4)](_0x277745))return cache[_0x58b5cf(0xab)](_0x277745);if(!existsSync(_0x277745))return cache[_0x58b5cf(0xa3)](_0x277745,[]),[];try{const _0x295134=readFileSync(_0x277745,'utf-8'),_0x4c947e=parseApiFile(_0x295134);return cache[_0x58b5cf(0xa3)](_0x277745,_0x4c947e),_0x4c947e;}catch{return cache[_0x58b5cf(0xa3)](_0x277745,[]),[];}}export function resolveAlias(_0x4a3e28,_0x301cb5,_0x124e5a,_0x157bf9){const _0x41512a=a94_0x2994;if(!_0x301cb5)return undefined;const _0x31d40d=loadAliasMap(_0x4a3e28,_0x124e5a,_0x157bf9),_0x5c0f4d=_0x31d40d['find'](_0x47909f=>_0x47909f['alias']===_0x301cb5);return _0x5c0f4d?.[_0x41512a(0xa8)];}function a94_0x2994(_0x32b4e3,_0xcd8b8b){_0x32b4e3=_0x32b4e3-0xa0;const _0x2813d2=a94_0x2813();let _0x299436=_0x2813d2[_0x32b4e3];return _0x299436;}export function listAliases(_0xad6091,_0x5bf1a0,_0x5152bc){return loadAliasMap(_0xad6091,_0x5bf1a0,_0x5152bc);}
|
package/lib/core/api-client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0x2b1768,_0xb0152e){const _0xe48500=a93_0x39be,_0x2f1610=_0x2b1768();while(!![]){try{const _0x554d0a=-parseInt(_0xe48500(0x1fa))/0x1+-parseInt(_0xe48500(0x236))/0x2+-parseInt(_0xe48500(0x201))/0x3*(parseInt(_0xe48500(0x229))/0x4)+-parseInt(_0xe48500(0x1fb))/0x5+parseInt(_0xe48500(0x20c))/0x6*(-parseInt(_0xe48500(0x221))/0x7)+-parseInt(_0xe48500(0x22c))/0x8+parseInt(_0xe48500(0x20a))/0x9*(parseInt(_0xe48500(0x24b))/0xa);if(_0x554d0a===_0xb0152e)break;else _0x2f1610['push'](_0x2f1610['shift']());}catch(_0x5f3d74){_0x2f1610['push'](_0x2f1610['shift']());}}}(a93_0x1567,0x8c6dd));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(_0x3f8ec8){_activeCookie=_0x3f8ec8||undefined;}export function clearActiveCookie(){_activeCookie=undefined;}async function apiRequest(_0x509775,_0x2c9a71={}){const _0x1ee4d8=a93_0x39be,{method:method=_0x1ee4d8(0x1f8),body:_0xd5ffee,headers:headers={},timeout:timeout=0x7530,useRuntime:useRuntime=![]}=_0x2c9a71,_0x4734c2=useRuntime?getRuntimeDomain():getApiDomain(),_0x1ff702=_activeCookie||getCookie(),_0x1e6225=''+_0x4734c2+_0x509775,_0x393627=new AbortController(),_0x2ddefc=setTimeout(()=>_0x393627['abort'](),timeout);try{const _0x28871e=await fetch(_0x1e6225,{'method':method,'headers':{'Content-Type':'application/json','Cookie':_0x1ff702,'X-Invoke-Source':'cli:rabetbase',...headers},'body':_0xd5ffee?JSON[_0x1ee4d8(0x1f4)](_0xd5ffee):undefined,'signal':_0x393627[_0x1ee4d8(0x250)]});let _0x17fbda;try{_0x17fbda=await _0x28871e[_0x1ee4d8(0x213)]();}catch{throw CliErrors[_0x1ee4d8(0x22b)](_0x1ee4d8(0x248)+_0x28871e[_0x1ee4d8(0x1f1)]+')',_0x28871e[_0x1ee4d8(0x1f1)]>=0x190?_0x1ee4d8(0x253):undefined);}if(!_0x28871e['ok']||_0x17fbda[_0x1ee4d8(0x225)]===![])throw CliErrors['apiError'](_0x17fbda[_0x1ee4d8(0x208)]||_0x17fbda[_0x1ee4d8(0x20b)]||'API\x20error:\x20'+_0x28871e['status'],_0x17fbda['errorCode']?_0x1ee4d8(0x267)+_0x17fbda[_0x1ee4d8(0x200)]:undefined);return _0x17fbda;}catch(_0x12b321){if(_0x12b321 instanceof Error&&_0x12b321['name']==='AbortError')throw CliErrors['apiError'](_0x1ee4d8(0x21f)+_0x1e6225);throw _0x12b321;}finally{clearTimeout(_0x2ddefc);}}function isAuthFailure(_0x394a65){const _0x36b03f=a93_0x39be,_0x593322=_0x394a65[_0x36b03f(0x208)]||_0x394a65['message']||_0x394a65[_0x36b03f(0x209)]?.['message']||_0x394a65[_0x36b03f(0x216)]||_0x394a65[_0x36b03f(0x245)]||'';return _0x394a65[_0x36b03f(0x200)]===_0x36b03f(0x23b)||_0x394a65['code']===0x191||_0x394a65[_0x36b03f(0x24a)]==='401'||_0x593322['includes'](_0x36b03f(0x257))||_0x593322['includes'](_0x36b03f(0x240))||_0x593322[_0x36b03f(0x228)]('登录')||_0x593322[_0x36b03f(0x228)]('认证');}export async function platformFetch(_0x2a579d,_0x4b7bd3){const _0x96a422=a93_0x39be,_0x590aae=await fetch(_0x2a579d,{'method':_0x4b7bd3['method']??_0x96a422(0x1f8),'headers':{'Content-Type':'application/json','Cookie':_0x4b7bd3[_0x96a422(0x1ef)]},..._0x4b7bd3['body']&&{'body':JSON[_0x96a422(0x1f4)](_0x4b7bd3[_0x96a422(0x210)])}});if(!_0x590aae['ok']){if(_0x590aae[_0x96a422(0x1f1)]===0x191)throw CliErrors['authRequired']();throw CliErrors[_0x96a422(0x22b)](_0x4b7bd3['label']+_0x96a422(0x1f9)+_0x590aae[_0x96a422(0x1f1)]);}const _0x4b2168=await _0x590aae[_0x96a422(0x213)]();if(_0x4b2168[_0x96a422(0x225)]===![]){if(isAuthFailure(_0x4b2168))throw CliErrors[_0x96a422(0x252)]();throw CliErrors[_0x96a422(0x22b)](_0x4b2168['errorMsg']||_0x4b2168['message']||_0x4b7bd3[_0x96a422(0x215)]+_0x96a422(0x244));}return _0x4b2168[_0x96a422(0x209)];}export async function listBffScripts(_0x1de149,_0x237dc6,_0x2dbb56){const _0xfb28bc=a93_0x39be;let _0x354ce8=_0xfb28bc(0x21c)+_0x1de149;if(_0x237dc6)_0x354ce8+=_0xfb28bc(0x246)+_0x237dc6;const _0x579b45=await apiRequest(_0x354ce8);let _0x268369=extractList(_0x579b45['data']);if(_0x2dbb56?.['scriptName']){const _0x579082=_0x2dbb56[_0xfb28bc(0x247)][_0xfb28bc(0x1f0)]();_0x268369=_0x268369[_0xfb28bc(0x262)](_0xd9c02e=>_0xd9c02e[_0xfb28bc(0x22e)]?.[_0xfb28bc(0x1f0)]()['includes'](_0x579082)||_0xd9c02e[_0xfb28bc(0x259)]?.[_0xfb28bc(0x1f0)]()[_0xfb28bc(0x228)](_0x579082));}return _0x268369;}export async function getBffScriptInfo(_0x23faf4){const _0x31f434=a93_0x39be,_0x10cf0e=await apiRequest(_0x31f434(0x260)+_0x23faf4);if(!_0x10cf0e[_0x31f434(0x209)])throw CliErrors['validation'](_0x31f434(0x1fd)+_0x23faf4);return _0x10cf0e[_0x31f434(0x209)];}export async function saveBffScript(_0x12568d){const _0x2ad54a=a93_0x39be,_0x2ea0db=await apiRequest(_0x2ad54a(0x21b),{'method':'POST','body':_0x12568d});return _0x2ea0db[_0x2ad54a(0x209)];}export async function deleteBffScript(_0x30ef57){const _0x236926=a93_0x39be;await apiRequest(_0x236926(0x24d),{'method':_0x236926(0x212),'body':{'id':_0x30ef57}});}export async function getBffScriptStatistics(_0x498280){const _0x29d2c7=a93_0x39be,_0x278dba=await apiRequest(_0x29d2c7(0x249)+_0x498280);return extractList(_0x278dba[_0x29d2c7(0x209)]);}export async function listBffDatasetOperations(_0x75a8eb,_0x56cc08){const _0x3aeac7=a93_0x39be,_0x306a7b=await apiRequest('/smartapi/dataset/get-dataset-operation',{'method':_0x3aeac7(0x212),'body':{'appCode':_0x75a8eb,'datasetId':_0x56cc08}});return _0x306a7b['data'];}export async function listSqlQueries(_0x285be2,_0x58b5f0){const _0x224939=a93_0x39be,_0x46de56=await apiRequest(_0x224939(0x25f),{'method':_0x224939(0x212),'body':{'appCode':_0x285be2,'currentPage':_0x58b5f0?.[_0x224939(0x21d)]??0x1,'pageSize':_0x58b5f0?.[_0x224939(0x20f)]??0x32,'sqlCode':_0x58b5f0?.[_0x224939(0x1f2)],'sqlName':_0x58b5f0?.[_0x224939(0x230)]}});return _0x46de56[_0x224939(0x209)];}export async function getSqlQueryInfo(_0x1fcfd6,_0x2fdbf4){const _0x588520=a93_0x39be,_0x53a7f8=await listSqlQueries(_0x1fcfd6,{'sqlCode':_0x2fdbf4}),_0x429234=_0x53a7f8[_0x588520(0x232)]?.[0x0];if(!_0x429234)throw CliErrors[_0x588520(0x231)](_0x588520(0x258)+_0x2fdbf4);return _0x429234;}export async function saveSqlQuery(_0x3d967e){const _0x58a642=a93_0x39be,_0x2bffee=await apiRequest(_0x58a642(0x20e),{'method':_0x58a642(0x212),'body':_0x3d967e});return _0x2bffee[_0x58a642(0x209)];}export async function executeSql(_0xd295fa,_0x16a8d6,_0x2c7b25){const _0x3fbf6e=a93_0x39be,_0x4f17ca=await apiRequest(_0x3fbf6e(0x25c),{'method':_0x3fbf6e(0x212),'body':{'appCode':_0xd295fa,'sqlCode':_0x16a8d6,..._0x2c7b25&&{'params':_0x2c7b25}},'useRuntime':!![]});return _0x4f17ca[_0x3fbf6e(0x209)];}export async function listDatasets(_0x3cc323,_0x56632b){const _0x41ecf7=a93_0x39be,_0x48c7eb={'appCode':_0x3cc323,'deleted':![]};if(_0x56632b?.['code'])_0x48c7eb['code']=_0x56632b[_0x41ecf7(0x24a)];if(_0x56632b?.[_0x41ecf7(0x1f6)])_0x48c7eb[_0x41ecf7(0x1f6)]=_0x56632b[_0x41ecf7(0x1f6)];const _0xdbd8ef=await apiRequest(_0x41ecf7(0x223),{'method':'POST','body':_0x48c7eb});return extractList(_0xdbd8ef[_0x41ecf7(0x209)]);}export async function searchDatasets(_0x96b487,_0x2240a0){const _0xae3a23=a93_0x39be,_0x5d0346=await listDatasets(_0x96b487,{'name':_0x2240a0}),_0x23167e=_0x2240a0['toLowerCase'](),_0x5d58f1=new Set(_0x5d0346['map'](_0x21ca40=>_0x21ca40['id'])),_0x5ed7ab=_0x5d0346[_0xae3a23(0x262)](_0x4c13fd=>_0x4c13fd[_0xae3a23(0x24e)]?.[_0xae3a23(0x22f)]?.['toLowerCase']()[_0xae3a23(0x228)](_0x23167e)||_0x4c13fd[_0xae3a23(0x259)]?.[_0xae3a23(0x1f0)]()[_0xae3a23(0x228)](_0x23167e)),_0x2e95a2=await listDatasets(_0x96b487,{'code':_0x2240a0});for(const _0xc80d83 of _0x2e95a2){!_0x5d58f1['has'](_0xc80d83['id'])&&(_0x5d0346['push'](_0xc80d83),_0x5d58f1[_0xae3a23(0x20d)](_0xc80d83['id']));}return _0x5d0346;}export function normalizeDatasetOperations(_0x26b26d){const _0x112e4d=a93_0x39be;if(Array[_0x112e4d(0x235)](_0x26b26d))return _0x26b26d[_0x112e4d(0x262)](_0x32b0b8=>_0x32b0b8!=null&&typeof _0x32b0b8===_0x112e4d(0x218));if(_0x26b26d&&typeof _0x26b26d==='object')return Object['entries'](_0x26b26d)[_0x112e4d(0x262)](([,_0x1a23e1])=>_0x1a23e1!=null&&typeof _0x1a23e1===_0x112e4d(0x218))[_0x112e4d(0x224)](([_0x50c097,_0xeca100])=>({..._0xeca100,'name':_0xeca100[_0x112e4d(0x1f6)]??_0xeca100['operationName']??_0x50c097}));return[];}export async function getDatasetDetail(_0x421c35){const _0x2fc690=a93_0x39be,_0x142930=/^\d+$/[_0x2fc690(0x243)](_0x421c35)?'id':'code',_0x28f5bf=await apiRequest(_0x2fc690(0x220)+_0x142930+'='+_0x421c35);return _0x28f5bf[_0x2fc690(0x209)];}export async function getDatasetOperations(_0x1f438e){const _0x5847ad=a93_0x39be,_0x3b01e4=await getDatasetDetail(_0x1f438e),_0x34dc3d=normalizeDatasetOperations(_0x3b01e4[_0x5847ad(0x219)])[_0x5847ad(0x224)](_0x2fa515=>({'name':_0x2fa515[_0x5847ad(0x1f6)]||_0x2fa515[_0x5847ad(0x1ff)],'displayName':_0x2fa515[_0x5847ad(0x23d)]||_0x2fa515[_0x5847ad(0x1f6)],'type':_0x2fa515['type'],'method':_0x2fa515[_0x5847ad(0x25e)],'path':_0x2fa515[_0x5847ad(0x25b)],'enabled':_0x2fa515['enabled']??!![],'requestFields':_0x2fa515[_0x5847ad(0x234)],'responseFields':_0x2fa515[_0x5847ad(0x1fc)]}));return{'dataset':{'id':_0x3b01e4['id']??_0x3b01e4[_0x5847ad(0x268)],'name':_0x3b01e4[_0x5847ad(0x1f6)],'code':_0x3b01e4[_0x5847ad(0x24a)]||_0x3b01e4[_0x5847ad(0x239)],'tableName':_0x3b01e4[_0x5847ad(0x22f)]||_0x3b01e4[_0x5847ad(0x24e)]?.['tableName']},'operations':_0x34dc3d};}export async function getOperationDetail(_0x4cd7b2,_0x54364e,_0x4ee2e9){const _0x165afe=a93_0x39be;let _0x2751ca=_0x54364e;if(!/^\d+$/[_0x165afe(0x243)](_0x54364e)){const _0x5506c0=await listDatasets(_0x4cd7b2,{'code':_0x54364e}),_0x1caa7c=_0x5506c0[_0x165afe(0x214)](_0x1d2f31=>_0x1d2f31[_0x165afe(0x24a)]===_0x54364e||String(_0x1d2f31['id'])===_0x54364e);if(!_0x1caa7c)throw CliErrors[_0x165afe(0x231)](_0x165afe(0x264)+_0x54364e);_0x2751ca=String(_0x1caa7c['id']);}const _0x543085=await getDatasetDetail(_0x2751ca),_0x227dcf=normalizeDatasetOperations(_0x543085['operations'])[_0x165afe(0x214)](_0x19d21e=>(_0x19d21e[_0x165afe(0x1f6)]||_0x19d21e[_0x165afe(0x1ff)])===_0x4ee2e9);if(!_0x227dcf)throw CliErrors['validation'](_0x165afe(0x22a)+_0x4ee2e9+_0x165afe(0x21a)+_0x54364e);return{'dataset':{'id':_0x543085['id']??_0x543085[_0x165afe(0x268)],'name':_0x543085[_0x165afe(0x1f6)],'code':_0x543085[_0x165afe(0x24a)]||_0x543085[_0x165afe(0x239)],'tableName':_0x543085[_0x165afe(0x22f)]||_0x543085['dbtableConfig']?.[_0x165afe(0x22f)]},'operation':_0x227dcf};}export function generateSdkCode(_0x122dde,_0x28a205,_0x1c4401){const _0x56cf23=a93_0x39be,_0x3e85bb=_0x1c4401?.[_0x56cf23(0x23f)]??!![],_0x350e7c=_0x56cf23(0x24c)+_0x122dde[_0x56cf23(0x24a)]?.[_0x56cf23(0x227)](/-/g,'_'),_0x20bbba=_0x28a205['name']||_0x28a205[_0x56cf23(0x1ff)]||_0x56cf23(0x262),_0x1583e8=[];_0x3e85bb&&_0x1583e8[_0x56cf23(0x242)](_0x56cf23(0x24f),'',_0x56cf23(0x241),'');_0x1583e8[_0x56cf23(0x242)](_0x56cf23(0x1f7)+_0x122dde['name']+'\x20('+(_0x122dde[_0x56cf23(0x22f)]||_0x56cf23(0x237))+')');if(_0x20bbba==='filter')_0x1583e8[_0x56cf23(0x242)]('const\x20result\x20=\x20await\x20client.models.'+_0x350e7c+_0x56cf23(0x222),'\x20\x20where:\x20{},',_0x56cf23(0x23a),_0x56cf23(0x1f3),_0x56cf23(0x266));else{if(_0x20bbba==='getOne')_0x1583e8[_0x56cf23(0x242)](_0x56cf23(0x255)+_0x350e7c+_0x56cf23(0x25a));else{if(_0x20bbba===_0x56cf23(0x21e))_0x1583e8[_0x56cf23(0x242)](_0x56cf23(0x255)+_0x350e7c+_0x56cf23(0x254));else{if(_0x20bbba===_0x56cf23(0x23e))_0x1583e8[_0x56cf23(0x242)](_0x56cf23(0x255)+_0x350e7c+_0x56cf23(0x203));else _0x20bbba===_0x56cf23(0x204)||_0x20bbba===_0x56cf23(0x25d)?_0x1583e8[_0x56cf23(0x242)](_0x56cf23(0x255)+_0x350e7c+_0x56cf23(0x22d)):_0x1583e8[_0x56cf23(0x242)](_0x56cf23(0x255)+_0x350e7c+'.'+_0x20bbba+'(/*\x20params\x20*/);');}}}return _0x1583e8['join']('\x0a');}export function generateSqlCodeTemplate(_0x26b236,_0x70db25){const _0x311041=a93_0x39be,_0x44cfe6=_0x70db25?.[_0x311041(0x1fe)]??_0x311041(0x251),_0x504892=_0x70db25?.[_0x311041(0x23f)]??!![],_0x2a195c=[];return _0x2a195c[_0x311041(0x242)]('//\x20SQL:\x20'+_0x26b236[_0x311041(0x230)]+'\x20('+_0x26b236[_0x311041(0x1f2)]+')'),_0x44cfe6==='sdk'?(_0x504892&&_0x2a195c[_0x311041(0x242)](_0x311041(0x24f),'',_0x311041(0x241),''),_0x2a195c[_0x311041(0x242)]('const\x20data\x20=\x20await\x20client.sql.execute({',_0x311041(0x217)+_0x26b236['sqlCode']+'\x27,','\x20\x20params:\x20{\x20/*\x20parameter\x20values\x20*/\x20},','});','if\x20(!data.execSuccess)\x20throw\x20new\x20Error(\x27SQL\x20execution\x20failed\x27);',_0x311041(0x211))):_0x2a195c[_0x311041(0x242)]('//\x20BFF\x20context:\x20context.client.sql.execute\x20returns\x20rows\x20directly','export\x20default\x20async\x20function\x20handler(params,\x20context)\x20{',_0x311041(0x261),_0x311041(0x238)+_0x26b236[_0x311041(0x1f2)]+'\x27,',_0x311041(0x205),_0x311041(0x207),_0x311041(0x1f5),'}'),_0x2a195c[_0x311041(0x202)]('\x0a');}function a93_0x39be(_0x5a2128,_0x971bdf){_0x5a2128=_0x5a2128-0x1ef;const _0x156709=a93_0x1567();let _0x39be11=_0x156709[_0x5a2128];return _0x39be11;}function a93_0x1567(){const _0x4ef85a=['\x20failed,\x20HTTP\x20','916935WBdWjt','713570KlfMPW','responseFields','BFF\x20script\x20not\x20found:\x20id=','target','operationName','errorCode','345669HyPzZw','join','.update(id,\x20{\x20/*\x20fields\x20*/\x20});','delete','\x20\x20\x20\x20params:\x20{\x20/*\x20parameter\x20values\x20*/\x20},','/smartapi/app/getList','\x20\x20});','errorMsg','data','9GCvJUF','message','2166mXlFWX','add','/api/node-toolbox/sql/save','pageSize','body','const\x20results\x20=\x20data.execResult\x20||\x20[];','POST','json','find','label','errorMessage','\x20\x20sqlCode:\x20\x27','object','operations','\x22\x20not\x20found\x20in\x20dataset\x20','/api/management/library/scripts/save','/api/management/library/scripts/list?appCode=','currentPage','create','Request\x20timeout:\x20','/smartapi/dataset/get-driven-data?','3199OvRMiW','.filter({','/smartapi/dataset/get-dataset-list','map','success','Warning:\x20showing\x20first\x20','replace','includes','16wFLTKh','Operation\x20\x22','apiError','3506760oiJBFS','.remove(id);','functionName','tableName','sqlName','validation','tableData','warn','requestFields','isArray','92398EpoAxw','table','\x20\x20\x20\x20sqlCode:\x20\x27','modelCode','\x20\x20pageSize:\x2020,','UNAUTHORIZED','/smartapi/question/er-config','displayName','update','includeImports','Unauthorized','const\x20client\x20=\x20new\x20LovrabetClient({\x20appCode:\x20\x27<YOUR_APP_CODE>\x27\x20});','push','test','\x20failed','error','&type=','scriptName','API\x20returned\x20non-JSON\x20response\x20(HTTP\x20','/api/management/library/scripts/statistics?appCode=','code','27452590TcucRg','dataset_','/api/management/library/scripts/delete','dbtableConfig','import\x20{\x20LovrabetClient\x20}\x20from\x20\x27@lovrabet/sdk\x27;','signal','sdk','authRequired','Check\x20your\x20auth\x20cookie\x20and\x20try\x20again.','.create({\x20/*\x20fields\x20*/\x20});','const\x20result\x20=\x20await\x20client.models.','totalCount','401','SQL\x20query\x20not\x20found:\x20','description','.getOne(id);','path','/api/custom/executeSql','remove','method','/smartapi/custom/queryUserCustomSqlList','/api/management/library/scripts/info?id=','\x20\x20const\x20rows\x20=\x20await\x20context.client.sql.execute({','filter','\x20apps.\x20','Dataset\x20not\x20found:\x20','Use\x20the\x20platform\x20console\x20to\x20see\x20all.','});','API\x20error\x20code:\x20','modelId','cookie','toLowerCase','status','sqlCode','\x20\x20currentPage:\x201,','stringify','\x20\x20return\x20rows;','name','//\x20','GET'];a93_0x1567=function(){return _0x4ef85a;};return a93_0x1567();}export async function getErConfig(_0x5a2c0a,_0x15766e){const _0x569e4b=a93_0x39be,_0x39c562=await apiRequest(_0x569e4b(0x23c),{'method':'POST','body':{'appCode':_0x5a2c0a,'dblinkId':_0x15766e}});return _0x39c562['data'];}const REMOTE_APP_PAGE_SIZE=0xc8;export async function listRemoteApps(){const _0x39602a=a93_0x39be,_0x118668=await apiRequest(_0x39602a(0x206),{'method':_0x39602a(0x212),'body':{'currentPage':0x1,'pageSize':REMOTE_APP_PAGE_SIZE}}),_0x4fc17b=extractList(_0x118668[_0x39602a(0x209)]),_0x138997=extractPaging(_0x118668[_0x39602a(0x209)]);return _0x138997&&_0x138997['totalCount']>REMOTE_APP_PAGE_SIZE&&console[_0x39602a(0x233)](_0x39602a(0x226)+REMOTE_APP_PAGE_SIZE+'\x20of\x20'+_0x138997[_0x39602a(0x256)]+_0x39602a(0x263)+_0x39602a(0x265)),_0x4fc17b;}
|
|
1
|
+
(function(_0x260c91,_0x37ffe5){const _0x3f0750=a95_0x3372,_0xed6387=_0x260c91();while(!![]){try{const _0x35a221=parseInt(_0x3f0750(0x174))/0x1*(parseInt(_0x3f0750(0x1a5))/0x2)+parseInt(_0x3f0750(0x150))/0x3*(-parseInt(_0x3f0750(0x173))/0x4)+parseInt(_0x3f0750(0x19a))/0x5*(-parseInt(_0x3f0750(0x172))/0x6)+parseInt(_0x3f0750(0x184))/0x7+-parseInt(_0x3f0750(0x1a0))/0x8*(parseInt(_0x3f0750(0x178))/0x9)+-parseInt(_0x3f0750(0x15a))/0xa+parseInt(_0x3f0750(0x17e))/0xb;if(_0x35a221===_0x37ffe5)break;else _0xed6387['push'](_0xed6387['shift']());}catch(_0xc972d9){_0xed6387['push'](_0xed6387['shift']());}}}(a95_0x5d01,0x57b76));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(_0x2029d4){_activeCookie=_0x2029d4||undefined;}export function clearActiveCookie(){_activeCookie=undefined;}async function apiRequest(_0x592824,_0xa20afe={}){const _0x31f7ef=a95_0x3372,{method:method=_0x31f7ef(0x15b),body:_0x381234,headers:headers={},timeout:timeout=0x7530,useRuntime:useRuntime=![]}=_0xa20afe,_0x1153bc=useRuntime?getRuntimeDomain():getApiDomain(),_0xbd45c=_activeCookie||getCookie(),_0x3a96df=''+_0x1153bc+_0x592824,_0x5e261f=new AbortController(),_0x54f7da=setTimeout(()=>_0x5e261f['abort'](),timeout);try{const _0x5bc4ec=await fetch(_0x3a96df,{'method':method,'headers':{'Content-Type':_0x31f7ef(0x13c),'Cookie':_0xbd45c,'X-Invoke-Source':_0x31f7ef(0x15d),...headers},'body':_0x381234?JSON[_0x31f7ef(0x185)](_0x381234):undefined,'signal':_0x5e261f[_0x31f7ef(0x158)]});let _0x40d1f2;try{_0x40d1f2=await _0x5bc4ec[_0x31f7ef(0x162)]();}catch{throw CliErrors[_0x31f7ef(0x141)](_0x31f7ef(0x175)+_0x5bc4ec[_0x31f7ef(0x133)]+')',_0x5bc4ec['status']>=0x190?_0x31f7ef(0x160):undefined);}if(!_0x5bc4ec['ok']||_0x40d1f2['success']===![])throw CliErrors[_0x31f7ef(0x141)](_0x40d1f2[_0x31f7ef(0x149)]||_0x40d1f2[_0x31f7ef(0x16b)]||_0x31f7ef(0x17c)+_0x5bc4ec[_0x31f7ef(0x133)],_0x40d1f2['errorCode']?_0x31f7ef(0x19d)+_0x40d1f2[_0x31f7ef(0x18d)]:undefined);return _0x40d1f2;}catch(_0x3f367a){if(_0x3f367a instanceof Error&&_0x3f367a[_0x31f7ef(0x188)]===_0x31f7ef(0x19b))throw CliErrors[_0x31f7ef(0x141)]('Request\x20timeout:\x20'+_0x3a96df);throw _0x3f367a;}finally{clearTimeout(_0x54f7da);}}function isAuthFailure(_0x17e5fc){const _0x1889e1=a95_0x3372,_0x16e67c=_0x17e5fc[_0x1889e1(0x149)]||_0x17e5fc['message']||_0x17e5fc[_0x1889e1(0x199)]?.[_0x1889e1(0x16b)]||_0x17e5fc['errorMessage']||_0x17e5fc[_0x1889e1(0x130)]||'';return _0x17e5fc[_0x1889e1(0x18d)]===_0x1889e1(0x1a2)||_0x17e5fc[_0x1889e1(0x155)]===0x191||_0x17e5fc[_0x1889e1(0x155)]==='401'||_0x16e67c[_0x1889e1(0x176)](_0x1889e1(0x13f))||_0x16e67c[_0x1889e1(0x176)](_0x1889e1(0x1a3))||_0x16e67c['includes']('登录')||_0x16e67c[_0x1889e1(0x176)]('认证');}export async function platformFetch(_0x389fcf,_0x45a1cb){const _0x1dcc41=a95_0x3372,_0x28aec3=await fetch(_0x389fcf,{'method':_0x45a1cb[_0x1dcc41(0x13b)]??_0x1dcc41(0x15b),'headers':{'Content-Type':_0x1dcc41(0x13c),'Cookie':_0x45a1cb[_0x1dcc41(0x135)]},..._0x45a1cb[_0x1dcc41(0x18c)]&&{'body':JSON['stringify'](_0x45a1cb[_0x1dcc41(0x18c)])}});if(!_0x28aec3['ok']){if(_0x28aec3[_0x1dcc41(0x133)]===0x191)throw CliErrors[_0x1dcc41(0x12e)]();throw CliErrors[_0x1dcc41(0x141)](_0x45a1cb[_0x1dcc41(0x134)]+_0x1dcc41(0x18b)+_0x28aec3[_0x1dcc41(0x133)]);}const _0x4de0e5=await _0x28aec3[_0x1dcc41(0x162)]();if(_0x4de0e5[_0x1dcc41(0x19c)]===![]){if(isAuthFailure(_0x4de0e5))throw CliErrors[_0x1dcc41(0x12e)]();throw CliErrors[_0x1dcc41(0x141)](_0x4de0e5[_0x1dcc41(0x149)]||_0x4de0e5[_0x1dcc41(0x16b)]||_0x45a1cb['label']+_0x1dcc41(0x171));}return _0x4de0e5[_0x1dcc41(0x199)];}export async function listBffScripts(_0x4e0a3d,_0x3f17e4,_0x3314e1){const _0x3ec14c=a95_0x3372;let _0x1f0c74=_0x3ec14c(0x12f)+_0x4e0a3d;if(_0x3f17e4)_0x1f0c74+=_0x3ec14c(0x131)+_0x3f17e4;const _0x2ee356=await apiRequest(_0x1f0c74);let _0x963a9c=extractList(_0x2ee356[_0x3ec14c(0x199)]);if(_0x3314e1?.[_0x3ec14c(0x197)]){const _0xac8e42=_0x3314e1[_0x3ec14c(0x197)]['toLowerCase']();_0x963a9c=_0x963a9c[_0x3ec14c(0x14b)](_0xbef351=>_0xbef351[_0x3ec14c(0x156)]?.[_0x3ec14c(0x14f)]()[_0x3ec14c(0x176)](_0xac8e42)||_0xbef351[_0x3ec14c(0x16c)]?.[_0x3ec14c(0x14f)]()[_0x3ec14c(0x176)](_0xac8e42));}return _0x963a9c;}export async function getBffScriptInfo(_0x2a4d64){const _0xf0bc48=a95_0x3372,_0x59ff1b=await apiRequest(_0xf0bc48(0x12d)+_0x2a4d64);if(!_0x59ff1b[_0xf0bc48(0x199)])throw CliErrors[_0xf0bc48(0x18a)](_0xf0bc48(0x153)+_0x2a4d64);return _0x59ff1b[_0xf0bc48(0x199)];}export async function saveBffScript(_0x39c97d){const _0x191430=a95_0x3372,_0x96436f=await apiRequest('/api/management/library/scripts/save',{'method':_0x191430(0x13a),'body':_0x39c97d});return _0x96436f[_0x191430(0x199)];}function a95_0x5d01(){const _0x46c72e=['\x20failed','6MRqKtf','776fscdaF','1ExffVa','API\x20returned\x20non-JSON\x20response\x20(HTTP\x20','includes','\x20\x20where:\x20{},','18yDPykM','create','tableName','.getOne(id);','API\x20error:\x20','(/*\x20params\x20*/);','16444703FJzGSM','entries','table','export\x20default\x20async\x20function\x20handler(params,\x20context)\x20{','modelId','operationName','2490768iZQhjt','stringify','/smartapi/app/getList','totalCount','name','\x20\x20currentPage:\x201,','validation','\x20failed,\x20HTTP\x20','body','errorCode','pageSize','delete','/smartapi/custom/queryUserCustomSqlList','.create({\x20/*\x20fields\x20*/\x20});','Use\x20the\x20platform\x20console\x20to\x20see\x20all.','/smartapi/dataset/get-dataset-list','/api/management/library/scripts/delete','const\x20result\x20=\x20await\x20client.models.','isArray','scriptName','currentPage','data','1940870TfpSyB','AbortError','success','API\x20error\x20code:\x20','test','Operation\x20\x22','1412984UGRtnE','requestFields','UNAUTHORIZED','Unauthorized','\x20apps.\x20','602288UVUcLS','update','/api/management/library/scripts/info?id=','authRequired','/api/management/library/scripts/list?appCode=','error','&type=','enabled','status','label','cookie','/smartapi/dataset/get-driven-data?','replace','/api/management/library/scripts/statistics?appCode=','Dataset\x20not\x20found:\x20','POST','method','application/json','join','\x22\x20not\x20found\x20in\x20dataset\x20','401','object','apiError','/api/node-toolbox/sql/save','modelCode','/smartapi/question/er-config','});','getOne','find','.remove(id);','errorMsg','/smartapi/dataset/get-dataset-operation','filter','dbtableConfig','warn','sqlCode','toLowerCase','11049WoxXwV','\x20\x20return\x20rows;','has','BFF\x20script\x20not\x20found:\x20id=','path','code','functionName','const\x20results\x20=\x20data.execResult\x20||\x20[];','signal','//\x20','3367330uLZMLo','GET','operations','cli:rabetbase','sdk','const\x20client\x20=\x20new\x20LovrabetClient({\x20appCode:\x20\x27<YOUR_APP_CODE>\x27\x20});','Check\x20your\x20auth\x20cookie\x20and\x20try\x20again.','.filter({','json','sqlName','responseFields','\x20\x20sqlCode:\x20\x27','if\x20(!data.execSuccess)\x20throw\x20new\x20Error(\x27SQL\x20execution\x20failed\x27);','/api/custom/executeSql','\x20\x20params:\x20{\x20/*\x20parameter\x20values\x20*/\x20},','Warning:\x20showing\x20first\x20','remove','message','description','displayName','map','const\x20data\x20=\x20await\x20client.sql.execute({','push'];a95_0x5d01=function(){return _0x46c72e;};return a95_0x5d01();}function a95_0x3372(_0x16a46f,_0x8b183d){_0x16a46f=_0x16a46f-0x12d;const _0x5d0160=a95_0x5d01();let _0x33724e=_0x5d0160[_0x16a46f];return _0x33724e;}export async function deleteBffScript(_0x19cc8d){const _0x4c7099=a95_0x3372;await apiRequest(_0x4c7099(0x194),{'method':_0x4c7099(0x13a),'body':{'id':_0x19cc8d}});}export async function getBffScriptStatistics(_0x3ab625){const _0x48a3c4=a95_0x3372,_0x40d3f9=await apiRequest(_0x48a3c4(0x138)+_0x3ab625);return extractList(_0x40d3f9[_0x48a3c4(0x199)]);}export async function listBffDatasetOperations(_0x402254,_0x3f91d7){const _0x258052=a95_0x3372,_0x5d4d81=await apiRequest(_0x258052(0x14a),{'method':_0x258052(0x13a),'body':{'appCode':_0x402254,'datasetId':_0x3f91d7}});return _0x5d4d81[_0x258052(0x199)];}export async function listSqlQueries(_0x17265f,_0x9d4d03){const _0x33739c=a95_0x3372,_0x17e617=await apiRequest(_0x33739c(0x190),{'method':'POST','body':{'appCode':_0x17265f,'currentPage':_0x9d4d03?.[_0x33739c(0x198)]??0x1,'pageSize':_0x9d4d03?.[_0x33739c(0x18e)]??0x32,'sqlCode':_0x9d4d03?.[_0x33739c(0x14e)],'sqlName':_0x9d4d03?.['sqlName']}});return _0x17e617['data'];}export async function getSqlQueryInfo(_0x28f060,_0x18d89f){const _0x3e1b2d=a95_0x3372,_0x29a736=await listSqlQueries(_0x28f060,{'sqlCode':_0x18d89f}),_0x4cd175=_0x29a736['tableData']?.[0x0];if(!_0x4cd175)throw CliErrors[_0x3e1b2d(0x18a)]('SQL\x20query\x20not\x20found:\x20'+_0x18d89f);return _0x4cd175;}export async function saveSqlQuery(_0x361a31){const _0x1207a3=a95_0x3372,_0x3c3ba2=await apiRequest(_0x1207a3(0x142),{'method':_0x1207a3(0x13a),'body':_0x361a31});return _0x3c3ba2[_0x1207a3(0x199)];}export async function executeSql(_0x452d0b,_0xe99bb2,_0x115806){const _0x2ebee8=a95_0x3372,_0xfb13e4=await apiRequest(_0x2ebee8(0x167),{'method':_0x2ebee8(0x13a),'body':{'appCode':_0x452d0b,'sqlCode':_0xe99bb2,..._0x115806&&{'params':_0x115806}},'useRuntime':!![]});return _0xfb13e4[_0x2ebee8(0x199)];}export async function listDatasets(_0x17c506,_0x38ccd6){const _0x38e4fd=a95_0x3372,_0x304517={'appCode':_0x17c506,'deleted':![]};if(_0x38ccd6?.[_0x38e4fd(0x155)])_0x304517[_0x38e4fd(0x155)]=_0x38ccd6[_0x38e4fd(0x155)];if(_0x38ccd6?.[_0x38e4fd(0x188)])_0x304517[_0x38e4fd(0x188)]=_0x38ccd6['name'];const _0x416de6=await apiRequest(_0x38e4fd(0x193),{'method':_0x38e4fd(0x13a),'body':_0x304517});return extractList(_0x416de6[_0x38e4fd(0x199)]);}export async function searchDatasets(_0x29ba83,_0x3ba71f){const _0xb6ec3a=a95_0x3372,_0x44d806=await listDatasets(_0x29ba83,{'name':_0x3ba71f}),_0x3d33d3=_0x3ba71f[_0xb6ec3a(0x14f)](),_0x4928a5=new Set(_0x44d806['map'](_0x3237f2=>_0x3237f2['id'])),_0x3e1b41=_0x44d806[_0xb6ec3a(0x14b)](_0x1012fe=>_0x1012fe[_0xb6ec3a(0x14c)]?.['tableName']?.[_0xb6ec3a(0x14f)]()[_0xb6ec3a(0x176)](_0x3d33d3)||_0x1012fe[_0xb6ec3a(0x16c)]?.[_0xb6ec3a(0x14f)]()[_0xb6ec3a(0x176)](_0x3d33d3)),_0x4dc654=await listDatasets(_0x29ba83,{'code':_0x3ba71f});for(const _0x4ba3eb of _0x4dc654){!_0x4928a5[_0xb6ec3a(0x152)](_0x4ba3eb['id'])&&(_0x44d806['push'](_0x4ba3eb),_0x4928a5['add'](_0x4ba3eb['id']));}return _0x44d806;}export function normalizeDatasetOperations(_0x8cb28b){const _0x3a6357=a95_0x3372;if(Array[_0x3a6357(0x196)](_0x8cb28b))return _0x8cb28b['filter'](_0x4868b9=>_0x4868b9!=null&&typeof _0x4868b9===_0x3a6357(0x140));if(_0x8cb28b&&typeof _0x8cb28b==='object')return Object[_0x3a6357(0x17f)](_0x8cb28b)[_0x3a6357(0x14b)](([,_0x21309c])=>_0x21309c!=null&&typeof _0x21309c===_0x3a6357(0x140))[_0x3a6357(0x16e)](([_0x928234,_0xbb908b])=>({..._0xbb908b,'name':_0xbb908b['name']??_0xbb908b[_0x3a6357(0x183)]??_0x928234}));return[];}export async function getDatasetDetail(_0x16fedf){const _0x5d1f92=a95_0x3372,_0x293982=/^\d+$/[_0x5d1f92(0x19e)](_0x16fedf)?'id':_0x5d1f92(0x155),_0x32e0eb=await apiRequest(_0x5d1f92(0x136)+_0x293982+'='+_0x16fedf);return _0x32e0eb[_0x5d1f92(0x199)];}export async function getDatasetOperations(_0x281a6b){const _0x41392f=a95_0x3372,_0x1fdba1=await getDatasetDetail(_0x281a6b),_0x14efda=normalizeDatasetOperations(_0x1fdba1[_0x41392f(0x15c)])[_0x41392f(0x16e)](_0x3f6765=>({'name':_0x3f6765[_0x41392f(0x188)]||_0x3f6765[_0x41392f(0x183)],'displayName':_0x3f6765[_0x41392f(0x16d)]||_0x3f6765[_0x41392f(0x188)],'type':_0x3f6765['type'],'method':_0x3f6765[_0x41392f(0x13b)],'path':_0x3f6765[_0x41392f(0x154)],'enabled':_0x3f6765[_0x41392f(0x132)]??!![],'requestFields':_0x3f6765[_0x41392f(0x1a1)],'responseFields':_0x3f6765[_0x41392f(0x164)]}));return{'dataset':{'id':_0x1fdba1['id']??_0x1fdba1[_0x41392f(0x182)],'name':_0x1fdba1['name'],'code':_0x1fdba1[_0x41392f(0x155)]||_0x1fdba1[_0x41392f(0x143)],'tableName':_0x1fdba1['tableName']||_0x1fdba1[_0x41392f(0x14c)]?.['tableName']},'operations':_0x14efda};}export async function getOperationDetail(_0x1a602e,_0x12b8e7,_0x206587){const _0x9991d2=a95_0x3372;let _0x315735=_0x12b8e7;if(!/^\d+$/['test'](_0x12b8e7)){const _0x25866a=await listDatasets(_0x1a602e,{'code':_0x12b8e7}),_0x39366f=_0x25866a[_0x9991d2(0x147)](_0x46172c=>_0x46172c[_0x9991d2(0x155)]===_0x12b8e7||String(_0x46172c['id'])===_0x12b8e7);if(!_0x39366f)throw CliErrors['validation'](_0x9991d2(0x139)+_0x12b8e7);_0x315735=String(_0x39366f['id']);}const _0x18ab39=await getDatasetDetail(_0x315735),_0x1d439d=normalizeDatasetOperations(_0x18ab39['operations'])[_0x9991d2(0x147)](_0x5a14da=>(_0x5a14da[_0x9991d2(0x188)]||_0x5a14da[_0x9991d2(0x183)])===_0x206587);if(!_0x1d439d)throw CliErrors[_0x9991d2(0x18a)](_0x9991d2(0x19f)+_0x206587+_0x9991d2(0x13e)+_0x12b8e7);return{'dataset':{'id':_0x18ab39['id']??_0x18ab39[_0x9991d2(0x182)],'name':_0x18ab39[_0x9991d2(0x188)],'code':_0x18ab39[_0x9991d2(0x155)]||_0x18ab39[_0x9991d2(0x143)],'tableName':_0x18ab39['tableName']||_0x18ab39[_0x9991d2(0x14c)]?.[_0x9991d2(0x17a)]},'operation':_0x1d439d};}export function generateSdkCode(_0x1b48ed,_0x37f4d9,_0x50a52d){const _0x447d56=a95_0x3372,_0x277c55=_0x50a52d?.['includeImports']??!![],_0x35bb9e='dataset_'+_0x1b48ed[_0x447d56(0x155)]?.[_0x447d56(0x137)](/-/g,'_'),_0x444574=_0x37f4d9[_0x447d56(0x188)]||_0x37f4d9[_0x447d56(0x183)]||'filter',_0x593c1d=[];_0x277c55&&_0x593c1d[_0x447d56(0x170)]('import\x20{\x20LovrabetClient\x20}\x20from\x20\x27@lovrabet/sdk\x27;','',_0x447d56(0x15f),'');_0x593c1d['push'](_0x447d56(0x159)+_0x1b48ed[_0x447d56(0x188)]+'\x20('+(_0x1b48ed[_0x447d56(0x17a)]||_0x447d56(0x180))+')');if(_0x444574===_0x447d56(0x14b))_0x593c1d['push'](_0x447d56(0x195)+_0x35bb9e+_0x447d56(0x161),_0x447d56(0x177),'\x20\x20pageSize:\x2020,',_0x447d56(0x189),_0x447d56(0x145));else{if(_0x444574===_0x447d56(0x146))_0x593c1d[_0x447d56(0x170)](_0x447d56(0x195)+_0x35bb9e+_0x447d56(0x17b));else{if(_0x444574===_0x447d56(0x179))_0x593c1d[_0x447d56(0x170)](_0x447d56(0x195)+_0x35bb9e+_0x447d56(0x191));else{if(_0x444574===_0x447d56(0x1a6))_0x593c1d[_0x447d56(0x170)](_0x447d56(0x195)+_0x35bb9e+'.update(id,\x20{\x20/*\x20fields\x20*/\x20});');else _0x444574===_0x447d56(0x18f)||_0x444574===_0x447d56(0x16a)?_0x593c1d[_0x447d56(0x170)](_0x447d56(0x195)+_0x35bb9e+_0x447d56(0x148)):_0x593c1d[_0x447d56(0x170)](_0x447d56(0x195)+_0x35bb9e+'.'+_0x444574+_0x447d56(0x17d));}}}return _0x593c1d['join']('\x0a');}export function generateSqlCodeTemplate(_0x29a70c,_0x288abd){const _0x587759=a95_0x3372,_0xc1caca=_0x288abd?.['target']??_0x587759(0x15e),_0x2d3d01=_0x288abd?.['includeImports']??!![],_0x155a97=[];return _0x155a97[_0x587759(0x170)]('//\x20SQL:\x20'+_0x29a70c[_0x587759(0x163)]+'\x20('+_0x29a70c[_0x587759(0x14e)]+')'),_0xc1caca==='sdk'?(_0x2d3d01&&_0x155a97[_0x587759(0x170)]('import\x20{\x20LovrabetClient\x20}\x20from\x20\x27@lovrabet/sdk\x27;','','const\x20client\x20=\x20new\x20LovrabetClient({\x20appCode:\x20\x27<YOUR_APP_CODE>\x27\x20});',''),_0x155a97[_0x587759(0x170)](_0x587759(0x16f),_0x587759(0x165)+_0x29a70c[_0x587759(0x14e)]+'\x27,',_0x587759(0x168),_0x587759(0x145),_0x587759(0x166),_0x587759(0x157))):_0x155a97[_0x587759(0x170)]('//\x20BFF\x20context:\x20context.client.sql.execute\x20returns\x20rows\x20directly',_0x587759(0x181),'\x20\x20const\x20rows\x20=\x20await\x20context.client.sql.execute({','\x20\x20\x20\x20sqlCode:\x20\x27'+_0x29a70c['sqlCode']+'\x27,','\x20\x20\x20\x20params:\x20{\x20/*\x20parameter\x20values\x20*/\x20},','\x20\x20});',_0x587759(0x151),'}'),_0x155a97[_0x587759(0x13d)]('\x0a');}export async function getErConfig(_0x4dd5f0,_0x168a3e){const _0x3bde0b=a95_0x3372,_0x48fd6d=await apiRequest(_0x3bde0b(0x144),{'method':'POST','body':{'appCode':_0x4dd5f0,'dblinkId':_0x168a3e}});return _0x48fd6d[_0x3bde0b(0x199)];}const REMOTE_APP_PAGE_SIZE=0xc8;export async function listRemoteApps(){const _0x327bef=a95_0x3372,_0x2a19f4=await apiRequest(_0x327bef(0x186),{'method':_0x327bef(0x13a),'body':{'currentPage':0x1,'pageSize':REMOTE_APP_PAGE_SIZE}}),_0x52180a=extractList(_0x2a19f4['data']),_0x1bd5a4=extractPaging(_0x2a19f4[_0x327bef(0x199)]);return _0x1bd5a4&&_0x1bd5a4[_0x327bef(0x187)]>REMOTE_APP_PAGE_SIZE&&console[_0x327bef(0x14d)](_0x327bef(0x169)+REMOTE_APP_PAGE_SIZE+'\x20of\x20'+_0x1bd5a4[_0x327bef(0x187)]+_0x327bef(0x1a4)+_0x327bef(0x192)),_0x52180a;}
|
package/lib/core/bff/config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a96_0x30ee(_0x3867b1,_0x5a2899){_0x3867b1=_0x3867b1-0x64;const _0xb794e2=a96_0xb794();let _0x30ee7b=_0xb794e2[_0x3867b1];return _0x30ee7b;}const a96_0x33c391=a96_0x30ee;(function(_0x20db39,_0x10bcb9){const _0x2bf2a5=a96_0x30ee,_0x240e0e=_0x20db39();while(!![]){try{const _0x591c92=parseInt(_0x2bf2a5(0x6b))/0x1*(parseInt(_0x2bf2a5(0x6f))/0x2)+-parseInt(_0x2bf2a5(0x67))/0x3*(parseInt(_0x2bf2a5(0x65))/0x4)+-parseInt(_0x2bf2a5(0x6e))/0x5+-parseInt(_0x2bf2a5(0x70))/0x6+parseInt(_0x2bf2a5(0x69))/0x7*(parseInt(_0x2bf2a5(0x6a))/0x8)+parseInt(_0x2bf2a5(0x66))/0x9*(parseInt(_0x2bf2a5(0x6d))/0xa)+-parseInt(_0x2bf2a5(0x64))/0xb;if(_0x591c92===_0x10bcb9)break;else _0x240e0e['push'](_0x240e0e['shift']());}catch(_0x316f44){_0x240e0e['push'](_0x240e0e['shift']());}}}(a96_0xb794,0xd287b));import{resolve}from'node:path';import{findProjectRootDirectory}from'../../context.js';function a96_0xb794(){const _0x1af87f=['bff','406muLRgz','203304AErsJK','1XTPLOh','bff.lock.json','9266350FScndb','7575990LefWxI','2183188jeyLnD','29592jkkyBH','bff-trash','9836849vekVDY','861852kiIyWs','9WnxUcy','3cSsEFq'];a96_0xb794=function(){return _0x1af87f;};return a96_0xb794();}const DOT_DIR='.rabetbase',LOCK_FILE_NAME=a96_0x33c391(0x6c),TRASH_DIR_NAME=a96_0x33c391(0x71);export function loadBffProjectConfig(_0x526c25,_0xb46f50){const _0x500864=a96_0x33c391,_0x532fc0=resolve(_0xb46f50??findProjectRootDirectory()),_0x1f8427=DOT_DIR+'/bff',_0x2bcd5c=_0x1f8427+'/'+_0x526c25;return{'projectRoot':_0x532fc0,'appCode':_0x526c25,'scriptsBaseDir':DOT_DIR,'scriptsWorkspaceRoot':_0x1f8427,'scriptsRoot':_0x2bcd5c,'scriptsRootDir':resolve(_0x532fc0,DOT_DIR,_0x500864(0x68),_0x526c25),'lockFilePath':resolve(_0x532fc0,DOT_DIR,LOCK_FILE_NAME),'trashDir':resolve(_0x532fc0,DOT_DIR,TRASH_DIR_NAME)};}
|