@lovrabet/rabetbase-cli 2.1.12-beta.0 → 2.1.12-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/api-doc.js +1 -1
- package/lib/api/fetch-model-list.js +1 -1
- package/lib/api/generate-api-file.js +1 -1
- package/lib/auth/auth-server-ui.js +1 -1
- package/lib/auth/auth-server.js +1 -1
- package/lib/auth/constant.js +1 -1
- package/lib/auth/get-cookie.js +1 -1
- package/lib/auth/get-session-user.js +1 -1
- package/lib/auth/is-session-valid.js +1 -1
- package/lib/auth/login-success-html.js +1 -1
- package/lib/auth/logout.js +1 -1
- package/lib/cli-flags.js +1 -1
- package/lib/cli.js +1 -1
- package/lib/commands/api/generate.js +1 -1
- package/lib/commands/api/index.js +1 -1
- package/lib/commands/api/list.js +1 -1
- package/lib/commands/api/pull.js +1 -1
- package/lib/commands/api/shared.js +1 -1
- package/lib/commands/app/add.js +1 -1
- package/lib/commands/app/discover.js +1 -1
- package/lib/commands/app/index.js +1 -1
- package/lib/commands/app/list.js +1 -1
- package/lib/commands/app/remove.js +1 -1
- package/lib/commands/app/shared.js +1 -1
- package/lib/commands/app/use.js +1 -1
- package/lib/commands/auth/index.js +1 -1
- package/lib/commands/bff/create.js +1 -1
- package/lib/commands/bff/delete.js +1 -1
- package/lib/commands/bff/detail.js +1 -1
- package/lib/commands/bff/index.js +1 -1
- package/lib/commands/bff/list.js +1 -1
- package/lib/commands/bff/pull.js +1 -1
- package/lib/commands/bff/push.js +1 -1
- package/lib/commands/bff/status.js +1 -1
- package/lib/commands/cli-update.js +1 -1
- package/lib/commands/codegen/index.js +1 -1
- package/lib/commands/codegen/sdk.js +1 -1
- package/lib/commands/codegen/sql.js +1 -1
- package/lib/commands/common/app-selector.js +1 -1
- package/lib/commands/common/flags.js +1 -1
- package/lib/commands/common/validate.js +1 -1
- package/lib/commands/config/get.js +1 -1
- package/lib/commands/config/index.js +1 -1
- package/lib/commands/config/list.js +1 -1
- package/lib/commands/config/set.js +1 -1
- package/lib/commands/config/shared.js +1 -1
- package/lib/commands/data/filter.js +1 -1
- package/lib/commands/data/getOne.js +1 -1
- package/lib/commands/data/index.js +1 -1
- package/lib/commands/data/shared.js +1 -1
- package/lib/commands/dataset/capability.js +1 -1
- package/lib/commands/dataset/delete.js +1 -1
- package/lib/commands/dataset/detail.js +1 -1
- package/lib/commands/dataset/field-update.js +1 -1
- package/lib/commands/dataset/index.js +1 -1
- package/lib/commands/dataset/link-create.js +1 -1
- package/lib/commands/dataset/link-delete.js +1 -1
- package/lib/commands/dataset/link-shared.js +1 -1
- package/lib/commands/dataset/link-update.js +1 -1
- package/lib/commands/dataset/links.js +1 -1
- package/lib/commands/dataset/list.js +1 -1
- package/lib/commands/dataset/operations.js +1 -1
- package/lib/commands/db/analyze-cancel.js +1 -1
- package/lib/commands/db/analyze-start.js +1 -1
- package/lib/commands/db/analyze-status.js +1 -1
- package/lib/commands/db/create.js +1 -1
- package/lib/commands/db/delete.js +1 -1
- package/lib/commands/db/detail.js +1 -1
- package/lib/commands/db/diff.js +1 -1
- package/lib/commands/db/index.js +1 -1
- package/lib/commands/db/list.js +1 -1
- package/lib/commands/db/shared.js +1 -1
- package/lib/commands/db/tables.js +1 -1
- package/lib/commands/db/test.js +1 -1
- package/lib/commands/db/update.js +1 -1
- package/lib/commands/doctor.js +1 -1
- package/lib/commands/init/index.js +1 -1
- package/lib/commands/issue/index.js +1 -1
- package/lib/commands/issue/nudge.js +1 -0
- package/lib/commands/issue/report.js +1 -1
- package/lib/commands/issue/shared.js +1 -0
- package/lib/commands/logs/index.js +1 -1
- package/lib/commands/menu/index.js +1 -1
- package/lib/commands/menu/shared/compare-table.js +1 -1
- package/lib/commands/menu/shared/index.js +1 -1
- package/lib/commands/menu/shared/inquirer.js +1 -1
- package/lib/commands/menu/shared/local-pages.js +1 -1
- package/lib/commands/menu/shared/logic.js +1 -1
- package/lib/commands/menu/shared/service.js +1 -1
- package/lib/commands/menu/shared/sync-core.js +1 -1
- package/lib/commands/menu/shared/update-core.js +1 -1
- package/lib/commands/menu/shared/valid-url.js +1 -1
- package/lib/commands/menu/sync.js +1 -1
- package/lib/commands/menu/update.js +1 -1
- package/lib/commands/page/generate-start.js +1 -1
- package/lib/commands/page/generate-status.js +1 -1
- package/lib/commands/page/index.js +1 -1
- package/lib/commands/page/pull.js +1 -1
- package/lib/commands/page/push.js +1 -1
- package/lib/commands/page/shared.js +1 -1
- package/lib/commands/page/standard-page-status.js +1 -1
- package/lib/commands/page/sync.js +1 -1
- package/lib/commands/project/create/enhanced-guided-create.js +1 -1
- package/lib/commands/project/create/format-elapsed.js +1 -1
- package/lib/commands/project/create/main.js +1 -1
- package/lib/commands/project/create/non-interactive.js +1 -1
- package/lib/commands/project/create/project-template-path.js +1 -1
- package/lib/commands/project/create/use-copy-project-template.js +1 -1
- package/lib/commands/project/create/use-format-code.js +1 -1
- package/lib/commands/project/create/use-install-dependencies.js +1 -1
- package/lib/commands/project/index.js +1 -1
- package/lib/commands/project/init.js +1 -1
- package/lib/commands/project/upgrade.js +1 -1
- package/lib/commands/registry.js +1 -1
- package/lib/commands/run/index.js +1 -1
- package/lib/commands/schema.js +1 -1
- package/lib/commands/skill/index.js +1 -1
- package/lib/commands/sql/create.js +1 -1
- package/lib/commands/sql/delete.js +1 -1
- package/lib/commands/sql/detail.js +1 -1
- package/lib/commands/sql/exec.js +1 -1
- package/lib/commands/sql/index.js +1 -1
- package/lib/commands/sql/list.js +1 -1
- package/lib/commands/sql/pull.js +1 -1
- package/lib/commands/sql/push.js +1 -1
- package/lib/commands/sql/save.js +1 -1
- package/lib/commands/sql/shared.js +1 -1
- package/lib/commands/sql/status.js +1 -1
- package/lib/commands/sql/validate.js +1 -1
- package/lib/config/schema.js +1 -1
- package/lib/constant/cdn.js +1 -1
- package/lib/constant/cli.js +1 -1
- package/lib/constant/defaults.js +1 -1
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/constant/output.js +1 -1
- package/lib/constant/paths.js +1 -1
- package/lib/constant/risk.js +1 -1
- package/lib/context.js +1 -1
- package/lib/core/alias-resolver.js +1 -1
- package/lib/core/api-client.js +1 -1
- package/lib/core/bff/config.js +1 -1
- package/lib/core/bff/file-system.js +1 -1
- package/lib/core/bff/hash.js +1 -1
- package/lib/core/bff/lock.js +1 -1
- package/lib/core/bff/utils.js +1 -1
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/page/file-system.js +1 -1
- package/lib/core/page/hash.js +1 -1
- package/lib/core/page/lock.js +1 -1
- package/lib/core/sql-sync/config.js +1 -1
- package/lib/core/sql-sync/file-system.js +1 -1
- package/lib/core/sql-sync/hash.js +1 -1
- package/lib/core/sql-sync/lock.js +1 -1
- package/lib/core/sql-sync/utils.js +1 -1
- package/lib/core/sql-validator.js +1 -1
- package/lib/errors.js +1 -1
- package/lib/framework/build-all-flags.js +1 -1
- package/lib/framework/flags.js +1 -1
- package/lib/framework/help.js +1 -1
- package/lib/framework/index.js +1 -1
- package/lib/framework/output.js +1 -1
- package/lib/framework/response.js +1 -1
- package/lib/framework/runner-alias.js +1 -1
- package/lib/framework/runner.js +1 -1
- package/lib/framework/schema-export.js +1 -1
- package/lib/framework/types.js +1 -1
- package/lib/generated/build-info.js +1 -1
- package/lib/help.js +1 -1
- package/lib/skills/main.js +1 -1
- package/lib/skills/npx-skills-add.js +1 -1
- package/lib/telemetry/cli-command-trace.js +1 -1
- package/lib/telemetry/cli-help-trace.js +1 -1
- package/lib/telemetry/ensure-cli-otel-config.js +1 -1
- package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
- package/lib/telemetry/send-cli-trace-log.js +1 -1
- package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
- package/lib/utils/ai_config.js +1 -1
- package/lib/utils/apply-jq-filter.js +1 -1
- package/lib/utils/cdn-config.js +1 -1
- package/lib/utils/check-sdk-version.js +1 -1
- package/lib/utils/cli-version-check.js +1 -1
- package/lib/utils/cli-version-policy.js +1 -1
- package/lib/utils/config.js +1 -1
- package/lib/utils/copy-directory.js +1 -1
- package/lib/utils/entity-with-id.js +1 -1
- package/lib/utils/file-utils.js +1 -1
- package/lib/utils/guides-cdn.js +1 -1
- package/lib/utils/http-client.js +1 -1
- package/lib/utils/is-non-interactive.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/params.js +1 -1
- package/lib/utils/platform.js +1 -1
- package/lib/utils/rules-cdn.js +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.js +1 -1
- package/lib/utils/version.js +1 -1
- package/lib/utils/with-active-cookie.js +1 -1
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +3 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x1ccec4,_0x51a0f8){const _0x4f45d1=a122_0x2617,_0x1fac68=_0x1ccec4();while(!![]){try{const _0xa4351d=parseInt(_0x4f45d1(0xa5))/0x1+parseInt(_0x4f45d1(0xa2))/0x2*(-parseInt(_0x4f45d1(0x9d))/0x3)+parseInt(_0x4f45d1(0xa6))/0x4+-parseInt(_0x4f45d1(0xa0))/0x5+parseInt(_0x4f45d1(0xa1))/0x6*(-parseInt(_0x4f45d1(0xa4))/0x7)+parseInt(_0x4f45d1(0x9f))/0x8+-parseInt(_0x4f45d1(0x9e))/0x9*(-parseInt(_0x4f45d1(0xa3))/0xa);if(_0xa4351d===_0x51a0f8)break;else _0x1fac68['push'](_0x1fac68['shift']());}catch(_0x531554){_0x1fac68['push'](_0x1fac68['shift']());}}}(a122_0x3c39,0x7a623));import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';function a122_0x2617(_0x1fec78,_0x10af11){_0x1fec78=_0x1fec78-0x9d;const _0x3c394e=a122_0x3c39();let _0x2617c4=_0x3c394e[_0x1fec78];return _0x2617c4;}import{sqlSave}from'../../commands/sql/save.js';import{sqlExec}from'../../commands/sql/exec.js';import{sqlPull}from'../../commands/sql/pull.js';import{sqlCreate}from'../../commands/sql/create.js';function a122_0x3c39(){const _0xb24e49=['18390lWITZU','301pfvxwQ','157665iRJXVz','1745788NCfvGO','105177zxPmqy','1953wKWmkY','2645024aBCTXc','1338325sbmELI','38286xjZefW','16uZLesR'];a122_0x3c39=function(){return _0xb24e49;};return a122_0x3c39();}import{sqlStatus}from'../../commands/sql/status.js';import{sqlPush}from'../../commands/sql/push.js';import{sqlDelete}from'../../commands/sql/delete.js';export const sqlDefinitions=[sqlList,sqlDetail,sqlStatus,sqlCreate,sqlPush,sqlValidate,sqlSave,sqlExec,sqlPull,sqlDelete];
|
package/lib/commands/sql/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a123_0x308b(){const _0x1f2549=['Page\x20size','Found\x20','boolean','3329034xgNbLG','map','No\x20custom\x20SQL\x20queries\x20found.','dbId','all','List\x20custom\x20SQL\x20queries','4209390fTUcSC','sqlCode','totalCount','558060McThcP','\x20SQL\x20queries\x20(total:\x20','num','number','pagesize','1335050haUIZS','sqlName','page','name','1GeosOB','sqlcode','153FbendZ','466296vIssrk','4gNrYJd','tableData','str','length','11133927YrmywD','description','7090854JXQcRw','paging','verbose','Filter\x20by\x20SQL\x20name','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','appCode'];a123_0x308b=function(){return _0x1f2549;};return a123_0x308b();}function a123_0x5f25(_0x13f36d,_0x44392e){_0x13f36d=_0x13f36d-0xf8;const _0x308b61=a123_0x308b();let _0x5f25f5=_0x308b61[_0x13f36d];return _0x5f25f5;}const a123_0xb46b84=a123_0x5f25;(function(_0x1d86ca,_0x46e095){const _0xb7c119=a123_0x5f25,_0xa7beb9=_0x1d86ca();while(!![]){try{const _0x217b1c=parseInt(_0xb7c119(0x119))/0x1*(parseInt(_0xb7c119(0x115))/0x2)+parseInt(_0xb7c119(0x107))/0x3*(-parseInt(_0xb7c119(0xf8))/0x4)+-parseInt(_0xb7c119(0x110))/0x5+parseInt(_0xb7c119(0xfe))/0x6+parseInt(_0xb7c119(0xfc))/0x7+-parseInt(_0xb7c119(0x11c))/0x8*(parseInt(_0xb7c119(0x11b))/0x9)+-parseInt(_0xb7c119(0x10d))/0xa;if(_0x217b1c===_0x46e095)break;else _0xa7beb9['push'](_0xa7beb9['shift']());}catch(_0x542c66){_0xa7beb9['push'](_0xa7beb9['shift']());}}}(a123_0x308b,0xc4f83));import{listSqlQueries}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':'sql','command':'list','description':a123_0xb46b84(0x10c),'risk':'read','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a123_0xb46b84(0x118),'type':'string','description':a123_0xb46b84(0x101)},{'name':'page','type':a123_0xb46b84(0x113),'description':'Page\x20number','default':0x1},{'name':a123_0xb46b84(0x114),'type':a123_0xb46b84(0x113),'description':a123_0xb46b84(0x104)},{'name':a123_0xb46b84(0x100),'type':a123_0xb46b84(0x106),'description':a123_0xb46b84(0x102)}],async 'execute'(_0x1adaf5){const _0x24bfc7=a123_0xb46b84,_0x1ac52f=await listSqlQueries(_0x1adaf5[_0x24bfc7(0x103)],{'sqlCode':_0x1adaf5['str'](_0x24bfc7(0x11a))||undefined,'sqlName':_0x1adaf5[_0x24bfc7(0xfa)](_0x24bfc7(0x118))||undefined,'currentPage':_0x1adaf5[_0x24bfc7(0x112)](_0x24bfc7(0x117)),'pageSize':_0x1adaf5[_0x24bfc7(0x112)](_0x24bfc7(0x114),0x32)}),_0x28e727=_0x1adaf5['bool'](_0x24bfc7(0x100)),_0x4c21b6=_0x1ac52f[_0x24bfc7(0xf9)]??[],_0x5d7869=_0x1ac52f[_0x24bfc7(0xff)]?.[_0x24bfc7(0x10f)]??_0x4c21b6[_0x24bfc7(0xfb)];let _0x4d1219;return _0x28e727?_0x4d1219=_0x4c21b6:_0x4d1219=await Promise[_0x24bfc7(0x10b)](_0x4c21b6[_0x24bfc7(0x108)](async _0x4620e9=>{const _0x1bf1ef=_0x24bfc7;let _0x2235c6;try{_0x2235c6=_0x4620e9['dbId']?await getDbName(_0x1adaf5['appCode'],_0x4620e9[_0x1bf1ef(0x10a)]):undefined;}catch{}return{'sqlCode':_0x4620e9[_0x1bf1ef(0x10e)],'sqlName':_0x4620e9[_0x1bf1ef(0x116)],'description':_0x4620e9[_0x1bf1ef(0xfd)]??'','db':_0x2235c6?_0x2235c6+'\x20('+_0x4620e9[_0x1bf1ef(0x10a)]+')':_0x4620e9[_0x1bf1ef(0x10a)]??''};})),{'ok':!![],'data':_0x4d1219,'message':_0x4c21b6[_0x24bfc7(0xfb)]===0x0?_0x24bfc7(0x109):_0x24bfc7(0x105)+_0x4c21b6[_0x24bfc7(0xfb)]+_0x24bfc7(0x111)+_0x5d7869+').'};}};
|
package/lib/commands/sql/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a122_0x743f62=a122_0x54bc;(function(_0x1857a,_0x428523){const _0x467aba=a122_0x54bc,_0x2411f1=_0x1857a();while(!![]){try{const _0x1025cf=-parseInt(_0x467aba(0x7b))/0x1+parseInt(_0x467aba(0x7d))/0x2+parseInt(_0x467aba(0x80))/0x3+-parseInt(_0x467aba(0xa6))/0x4*(-parseInt(_0x467aba(0x94))/0x5)+parseInt(_0x467aba(0xaa))/0x6*(-parseInt(_0x467aba(0x96))/0x7)+-parseInt(_0x467aba(0x77))/0x8+parseInt(_0x467aba(0x87))/0x9*(parseInt(_0x467aba(0x9c))/0xa);if(_0x1025cf===_0x428523)break;else _0x2411f1['push'](_0x2411f1['shift']());}catch(_0x147396){_0x2411f1['push'](_0x2411f1['shift']());}}}(a122_0x281c,0x2fa44));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';function a122_0x281c(){const _0x1fdd4f=['trimStart','12cERqmH','path','paging','name','\x20written,\x20','length','unchanged','str','2252168NugzCl','message','sqlcode','utf8','228763aPqaZu','nonInteractive','438432lyPVDH','sqls','Force\x20overwrite\x20local\x20unsynced\x20changes','517935nfMzSb','sqlRootDir','description','sqlCode','test','cancelled','mybatisXml','1287xIMWCu','sqlRoot','sqlName','write','apps','Would\x20pull\x20','filter','appCode','\x20skipped,\x20','No\x20remote\x20SQL\x20queries\x20matched.','bool','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','Force\x20pull\x20cancelled.','14410QFuKPs','catch','197477hrcTfK','sql','force','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','boolean','lockFilePath','14990YqLZCp','pull','skipped','tableData','\x20SQL\x20file(s)\x20into\x20','push','join','toISOString','dbId','totalCount','216oCtvzG','sqlContent','Filter\x20by\x20SQL\x20display\x20name'];a122_0x281c=function(){return _0x1fdd4f;};return a122_0x281c();}import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x382059,_0xc7dc35){const _0x349bb8=a122_0x54bc,_0x4d4787=[];let _0x4508d7=0x1;while(!![]){const _0x3180ee=await listSqlQueries(_0x382059,{'currentPage':_0x4508d7,'pageSize':PAGE_SIZE,'sqlCode':_0xc7dc35['sqlCode'],'sqlName':_0xc7dc35[_0x349bb8(0x89)]}),_0x5bf441=_0x3180ee[_0x349bb8(0x9f)]??[];_0x4d4787[_0x349bb8(0xa1)](..._0x5bf441);if(_0x5bf441[_0x349bb8(0x74)]===0x0)break;const _0x4b83cc=_0x3180ee[_0x349bb8(0xac)]?.[_0x349bb8(0xa5)];if(_0x4b83cc!=null?_0x4d4787[_0x349bb8(0x74)]>=_0x4b83cc:_0x5bf441['length']<PAGE_SIZE)break;_0x4508d7++;}return _0x4d4787;}async function ensureSqlContent(_0x1b309d){const _0x260151=a122_0x54bc;if(_0x1b309d[_0x260151(0xa7)]!=null&&String(_0x1b309d[_0x260151(0xa7)])[_0x260151(0x74)]>0x0)return _0x1b309d;return getSqlQueryDetail(_0x1b309d[_0x260151(0x83)]);}export const sqlPull={'service':a122_0x743f62(0x97),'command':a122_0x743f62(0x9d),'description':a122_0x743f62(0x99),'risk':a122_0x743f62(0x8a),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a122_0x743f62(0x72),'type':'string','description':a122_0x743f62(0xa8)},{'name':a122_0x743f62(0x98),'type':a122_0x743f62(0x9a),'description':a122_0x743f62(0x7f)}],async 'dryRun'(_0x307fd9){const _0x196a65=a122_0x743f62,_0x35f580=loadSqlProjectConfig(_0x307fd9[_0x196a65(0x8e)]),_0x43c78c=await readSqlLockFile(_0x35f580[_0x196a65(0x9b)]),{appLock:_0x251d06}=ensureSqlLockScope(_0x43c78c??createEmptySqlLock(),_0x35f580['appCode'],_0x35f580[_0x196a65(0x88)],_0x196a65(0x9d)),_0x45b081=await fetchAllSqlQueries(_0x307fd9[_0x196a65(0x8e)],{'sqlCode':_0x307fd9['str'](_0x196a65(0x79))||undefined,'sqlName':_0x307fd9['str'](_0x196a65(0x72))||undefined}),_0x47ea84=[];for(const _0x35711b of _0x45b081){const _0x14fe06=await ensureSqlContent(_0x35711b),_0x50dc9b=ensureRemoteSqlContent(_0x14fe06),_0x2b1861=detectModeFromSql(_0x14fe06),_0x32beef=_0x14fe06[_0x196a65(0xa4)]?await getDbName(_0x307fd9[_0x196a65(0x8e)],Number(_0x14fe06[_0x196a65(0xa4)]))[_0x196a65(0x95)](()=>undefined):undefined,_0x2afc82=buildLocalSqlFileContent({'sqlCode':_0x14fe06['sqlCode'],'sqlName':_0x14fe06['sqlName'],'dbId':_0x14fe06[_0x196a65(0xa4)]},_0x50dc9b,{'dbName':_0x32beef,'mode':_0x2b1861,'syncedAt':new Date()['toISOString'](),'description':_0x14fe06['description']}),_0x398574=buildSqlLockEntry(_0x14fe06,_0x50dc9b,'',{'dbName':_0x32beef}),_0x256f82=resolveLocalSqlFilePath(_0x35f580,_0x14fe06[_0x196a65(0x83)],_0x398574);let _0x4a8e66='would_pull',_0x5bea69;if(await fileExists(_0x256f82)){const _0x331b4d=await readFile(_0x256f82,_0x196a65(0x7a));isEquivalentPulledSqlFile(_0x331b4d,_0x2afc82,_0x2b1861)?(_0x4a8e66=_0x196a65(0x9e),_0x5bea69=_0x196a65(0x75)):(_0x4a8e66='conflict',_0x5bea69='local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)');}_0x47ea84[_0x196a65(0xa1)]({'sqlCode':_0x14fe06['sqlCode'],'sqlName':_0x14fe06['sqlName'],'filePath':_0x256f82,'status':_0x4a8e66,'reason':_0x5bea69});}return{'method':'POST','url':_0x196a65(0x92),'body':{'appCode':_0x307fd9['appCode'],'sqlCode':_0x307fd9['str'](_0x196a65(0x79))||null,'sqlName':_0x307fd9[_0x196a65(0x76)](_0x196a65(0x72))||null,'files':_0x47ea84},'description':_0x196a65(0x8c)+_0x47ea84[_0x196a65(0x74)]+_0x196a65(0xa0)+_0x35f580[_0x196a65(0x81)]};},async 'execute'(_0x5ca4c2){const _0x471939=a122_0x743f62,_0x5d0a08=loadSqlProjectConfig(_0x5ca4c2[_0x471939(0x8e)]),_0x36ad08=await readSqlLockFile(_0x5d0a08['lockFilePath']),{lockData:_0x5f0be1,appLock:_0x4a241d}=ensureSqlLockScope(_0x36ad08??createEmptySqlLock(),_0x5d0a08[_0x471939(0x8e)],_0x5d0a08[_0x471939(0x88)],_0x471939(0x9d)),_0x2cfa5b=_0x5ca4c2[_0x471939(0x91)]('force'),_0x4fd28e=await fetchAllSqlQueries(_0x5ca4c2[_0x471939(0x8e)],{'sqlCode':_0x5ca4c2['str'](_0x471939(0x79))||undefined,'sqlName':_0x5ca4c2['str'](_0x471939(0x72))||undefined});if(_0x4fd28e['length']===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x471939(0x90)};const _0x142eb0=[],_0x43f40a=[];for(const _0x4879bd of _0x4fd28e){try{_0x142eb0[_0x471939(0xa1)](await ensureSqlContent(_0x4879bd));}catch(_0x231c12){_0x43f40a[_0x471939(0xa1)]({'sqlCode':_0x4879bd[_0x471939(0x83)],'error':_0x231c12 instanceof Error?_0x231c12[_0x471939(0x78)]:String(_0x231c12)});}}if(_0x2cfa5b&&!_0x5ca4c2[_0x471939(0x7c)]){let _0x5bc2b5=![];for(const _0x58b78e of _0x142eb0){const _0x388d16=detectModeFromSql(_0x58b78e),_0x58bd9d=_0x58b78e[_0x471939(0xa4)]?await getDbName(_0x5ca4c2[_0x471939(0x8e)],Number(_0x58b78e['dbId']))[_0x471939(0x95)](()=>undefined):undefined,_0x546209=buildLocalSqlFileContent({'sqlCode':_0x58b78e[_0x471939(0x83)],'sqlName':_0x58b78e[_0x471939(0x89)],'dbId':_0x58b78e[_0x471939(0xa4)]},ensureRemoteSqlContent(_0x58b78e),{'dbName':_0x58bd9d,'mode':_0x388d16,'syncedAt':new Date()[_0x471939(0xa3)](),'description':_0x58b78e[_0x471939(0x82)]}),_0x2e8e81=resolveLocalSqlFilePath(_0x5d0a08,_0x58b78e[_0x471939(0x83)],buildSqlLockEntry(_0x58b78e,ensureRemoteSqlContent(_0x58b78e),'',{'dbName':_0x58bd9d}));if(await fileExists(_0x2e8e81)){const _0x216420=await readFile(_0x2e8e81,'utf8');if(!isEquivalentPulledSqlFile(_0x216420,_0x546209,_0x388d16)){_0x5bc2b5=!![];break;}}}if(_0x5bc2b5){const _0x172c69=await confirmForceOverwrite('Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.');if(!_0x172c69)throw CliErrors[_0x471939(0x85)](_0x471939(0x93));}}const _0x28a555=cloneSqlLockData(_0x5f0be1),_0x539417=_0x28a555[_0x471939(0x8b)][_0x5d0a08[_0x471939(0x8e)]],_0x10ee86=[],_0x240f99=[];for(const _0x3c5721 of _0x142eb0){const _0x168efe=_0x539417[_0x471939(0x7e)][_0x3c5721[_0x471939(0x83)]],_0x2f71df=ensureRemoteSqlContent(_0x3c5721),_0xf3045f=detectModeFromSql(_0x3c5721),_0x270bca=_0x3c5721[_0x471939(0xa4)]?await getDbName(_0x5ca4c2[_0x471939(0x8e)],Number(_0x3c5721['dbId']))[_0x471939(0x95)](()=>undefined):undefined,_0x4c7822=buildLocalSqlFileContent({'sqlCode':_0x3c5721[_0x471939(0x83)],'sqlName':_0x3c5721[_0x471939(0x89)],'dbId':_0x3c5721[_0x471939(0xa4)]},_0x2f71df,{'dbName':_0x270bca,'mode':_0xf3045f,'syncedAt':new Date()[_0x471939(0xa3)](),'description':_0x3c5721[_0x471939(0x82)]}),_0x25775d=buildSqlLockEntry(_0x3c5721,_0x2f71df,computeSqlContentHash(_0x4c7822),{'dbName':_0x270bca}),_0x3985b5=_0x25775d['path'],_0x121804=join(_0x5d0a08[_0x471939(0x81)],_0x3985b5);try{if(await fileExists(_0x121804)){const _0x498f0b=await readFile(_0x121804,_0x471939(0x7a));if(isEquivalentPulledSqlFile(_0x498f0b,_0x4c7822,_0xf3045f)){_0x240f99[_0x471939(0xa1)]({'sqlCode':_0x3c5721[_0x471939(0x83)],'reason':_0x471939(0x75)}),_0x539417[_0x471939(0x7e)][_0x3c5721[_0x471939(0x83)]]={..._0x25775d,'hash':computeSqlContentHash(_0x498f0b),'path':_0x3985b5};continue;}if(!_0x2cfa5b){_0x240f99['push']({'sqlCode':_0x3c5721[_0x471939(0x83)],'reason':'local\x20differs\x20from\x20remote'});continue;}}const _0x2a1fb6=_0x168efe?.[_0x471939(0xab)]?join(_0x5d0a08['sqlRootDir'],_0x168efe[_0x471939(0xab)]):undefined;_0x2a1fb6&&_0x2a1fb6!==_0x121804&&await fileExists(_0x2a1fb6)&&await rm(_0x2a1fb6,{'force':!![]}),await ensureParentDirectory(_0x121804),await writeFile(_0x121804,_0x4c7822,_0x471939(0x7a)),_0x539417[_0x471939(0x7e)][_0x3c5721[_0x471939(0x83)]]={..._0x25775d,'path':_0x3985b5},_0x10ee86[_0x471939(0xa1)]({'sqlCode':_0x3c5721[_0x471939(0x83)],'filePath':_0x121804});}catch(_0x1e6ce0){_0x43f40a[_0x471939(0xa1)]({'sqlCode':_0x3c5721['sqlCode'],'error':_0x1e6ce0 instanceof Error?_0x1e6ce0[_0x471939(0x78)]:String(_0x1e6ce0)});}}return _0x539417['lastSync']=new Date()['toISOString'](),await writeSqlLockFile(_0x5d0a08[_0x471939(0x9b)],_0x28a555),{'ok':_0x43f40a[_0x471939(0x74)]===0x0,'data':{'pulled':_0x10ee86,'skipped':_0x240f99,'failed':_0x43f40a},'message':'Pull\x20complete:\x20'+_0x10ee86[_0x471939(0x74)]+_0x471939(0x73)+_0x240f99[_0x471939(0x74)]+_0x471939(0x8f)+_0x43f40a['length']+'\x20failed'};}};function a122_0x54bc(_0x5d56f0,_0x3cfaa5){_0x5d56f0=_0x5d56f0-0x72;const _0x281c58=a122_0x281c();let _0x54bcba=_0x281c58[_0x5d56f0];return _0x54bcba;}function detectModeFromSql(_0x44d64e){const _0x2ed98c=a122_0x743f62,_0x292e0c=ensureRemoteSqlContent(_0x44d64e),_0x1944a9=stripLocalSqlMetadata(_0x292e0c,_0x2ed98c(0x86))[_0x2ed98c(0xa9)]();if(/^<(select|insert|update|delete)\b/i[_0x2ed98c(0x84)](_0x1944a9))return _0x2ed98c(0x86);return _0x2ed98c(0x97);}function isEquivalentPulledSqlFile(_0xd920fe,_0x2849f1,_0x4dc175){return normalizePullComparableContent(_0xd920fe,_0x4dc175)===normalizePullComparableContent(_0x2849f1,_0x4dc175);}function normalizePullComparableContent(_0x15da1d,_0x39f2f1){const _0x5b7fa2=a122_0x743f62,_0x2cd687=_0x15da1d['replace'](/\r\n/g,'\x0a')['split']('\x0a'),_0x1c91f0=_0x2cd687[_0x5b7fa2(0x8d)](_0x3ebb64=>!isSyncedAtMetadataLine(_0x3ebb64,_0x39f2f1));return _0x1c91f0[_0x5b7fa2(0xa2)]('\x0a');}function isSyncedAtMetadataLine(_0x47a7f7,_0x49628c){const _0x259cd6=a122_0x743f62;if(_0x49628c===_0x259cd6(0x86))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x259cd6(0x84)](_0x47a7f7);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x259cd6(0x84)](_0x47a7f7);}
|
|
1
|
+
const a124_0x1be652=a124_0x528c;(function(_0x516347,_0x2124e8){const _0x30cfc3=a124_0x528c,_0x46056d=_0x516347();while(!![]){try{const _0x14fc51=parseInt(_0x30cfc3(0xc3))/0x1+parseInt(_0x30cfc3(0x96))/0x2*(parseInt(_0x30cfc3(0xbb))/0x3)+parseInt(_0x30cfc3(0xa7))/0x4+parseInt(_0x30cfc3(0xc4))/0x5+parseInt(_0x30cfc3(0xcd))/0x6*(parseInt(_0x30cfc3(0xbc))/0x7)+-parseInt(_0x30cfc3(0xa4))/0x8*(-parseInt(_0x30cfc3(0xb1))/0x9)+-parseInt(_0x30cfc3(0xad))/0xa;if(_0x14fc51===_0x2124e8)break;else _0x46056d['push'](_0x46056d['shift']());}catch(_0x279aff){_0x46056d['push'](_0x46056d['shift']());}}}(a124_0x486a,0xba683));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';function a124_0x528c(_0x3f6cb8,_0x580e59){_0x3f6cb8=_0x3f6cb8-0x8f;const _0x486a1a=a124_0x486a();let _0x528ca4=_0x486a1a[_0x3f6cb8];return _0x528ca4;}import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';function a124_0x486a(){const _0x16a9fa=['sqlRoot','split','would_pull','381QvjiNZ','2360687xMwMil','lockFilePath','force','appCode','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','totalCount','Would\x20pull\x20','98097ZZXqeE','4455205DgjnNy','apps','join','No\x20remote\x20SQL\x20queries\x20matched.','dbId','sqlcode','replace','\x20failed','sql','24evJTCu','Pull\x20complete:\x20','Filter\x20by\x20SQL\x20display\x20name','tableData','catch','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','description','\x20SQL\x20file(s)\x20into\x20','sqlContent','path','cancelled','skipped','11202IIILks','sqlCode','toISOString','Force\x20pull\x20cancelled.','utf8','trimStart','test','local\x20differs\x20from\x20remote','\x20skipped,\x20','string','bool','sqlRootDir','\x20written,\x20','message','9259144nCImLI','sqlName','str','1829896GoyXuv','length','conflict','sqls','boolean','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','39007730ZQzZFV','nonInteractive','push','name','9vOdvjk','write','pull','mybatisXml','unchanged','paging','lastSync'];a124_0x486a=function(){return _0x16a9fa;};return a124_0x486a();}import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x59264b,_0x595a96){const _0x7736f3=a124_0x528c,_0x695b6=[];let _0xeb07d6=0x1;while(!![]){const _0x15245e=await listSqlQueries(_0x59264b,{'currentPage':_0xeb07d6,'pageSize':PAGE_SIZE,'sqlCode':_0x595a96['sqlCode'],'sqlName':_0x595a96[_0x7736f3(0xa5)]}),_0x2dcbb0=_0x15245e[_0x7736f3(0xd0)]??[];_0x695b6['push'](..._0x2dcbb0);if(_0x2dcbb0[_0x7736f3(0xa8)]===0x0)break;const _0x52deae=_0x15245e[_0x7736f3(0xb6)]?.[_0x7736f3(0xc1)];if(_0x52deae!=null?_0x695b6[_0x7736f3(0xa8)]>=_0x52deae:_0x2dcbb0[_0x7736f3(0xa8)]<PAGE_SIZE)break;_0xeb07d6++;}return _0x695b6;}async function ensureSqlContent(_0x594563){const _0x328095=a124_0x528c;if(_0x594563[_0x328095(0x92)]!=null&&String(_0x594563[_0x328095(0x92)])[_0x328095(0xa8)]>0x0)return _0x594563;return getSqlQueryDetail(_0x594563['sqlCode']);}export const sqlPull={'service':a124_0x1be652(0xcc),'command':a124_0x1be652(0xb3),'description':a124_0x1be652(0xac),'risk':a124_0x1be652(0xb2),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a124_0x1be652(0xb0),'type':a124_0x1be652(0x9f),'description':a124_0x1be652(0xcf)},{'name':'force','type':a124_0x1be652(0xab),'description':'Force\x20overwrite\x20local\x20unsynced\x20changes'}],async 'dryRun'(_0x792d74){const _0x334afb=a124_0x1be652,_0x4d2b0c=loadSqlProjectConfig(_0x792d74[_0x334afb(0xbf)]),_0x59c013=await readSqlLockFile(_0x4d2b0c[_0x334afb(0xbd)]),{appLock:_0x35ad7b}=ensureSqlLockScope(_0x59c013??createEmptySqlLock(),_0x4d2b0c[_0x334afb(0xbf)],_0x4d2b0c['sqlRoot'],_0x334afb(0xb3)),_0x688c4b=await fetchAllSqlQueries(_0x792d74['appCode'],{'sqlCode':_0x792d74['str'](_0x334afb(0xc9))||undefined,'sqlName':_0x792d74['str'](_0x334afb(0xb0))||undefined}),_0x21ae8c=[];for(const _0x903819 of _0x688c4b){const _0x4a9e9e=await ensureSqlContent(_0x903819),_0x1a1c88=ensureRemoteSqlContent(_0x4a9e9e),_0x293016=detectModeFromSql(_0x4a9e9e),_0x5f34a4=_0x4a9e9e[_0x334afb(0xc8)]?await getDbName(_0x792d74['appCode'],Number(_0x4a9e9e[_0x334afb(0xc8)]))[_0x334afb(0xd1)](()=>undefined):undefined,_0x1bb9b4=buildLocalSqlFileContent({'sqlCode':_0x4a9e9e[_0x334afb(0x97)],'sqlName':_0x4a9e9e[_0x334afb(0xa5)],'dbId':_0x4a9e9e[_0x334afb(0xc8)]},_0x1a1c88,{'dbName':_0x5f34a4,'mode':_0x293016,'syncedAt':new Date()[_0x334afb(0x98)](),'description':_0x4a9e9e[_0x334afb(0x90)]}),_0x266cc6=buildSqlLockEntry(_0x4a9e9e,_0x1a1c88,'',{'dbName':_0x5f34a4}),_0x37eaa5=resolveLocalSqlFilePath(_0x4d2b0c,_0x4a9e9e[_0x334afb(0x97)],_0x266cc6);let _0x8d3f0b=_0x334afb(0xba),_0x2d8c3e;if(await fileExists(_0x37eaa5)){const _0x12327f=await readFile(_0x37eaa5,_0x334afb(0x9a));isEquivalentPulledSqlFile(_0x12327f,_0x1bb9b4,_0x293016)?(_0x8d3f0b=_0x334afb(0x95),_0x2d8c3e=_0x334afb(0xb5)):(_0x8d3f0b=_0x334afb(0xa9),_0x2d8c3e=_0x334afb(0xc0));}_0x21ae8c['push']({'sqlCode':_0x4a9e9e[_0x334afb(0x97)],'sqlName':_0x4a9e9e['sqlName'],'filePath':_0x37eaa5,'status':_0x8d3f0b,'reason':_0x2d8c3e});}return{'method':'POST','url':'/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','body':{'appCode':_0x792d74[_0x334afb(0xbf)],'sqlCode':_0x792d74[_0x334afb(0xa6)](_0x334afb(0xc9))||null,'sqlName':_0x792d74[_0x334afb(0xa6)](_0x334afb(0xb0))||null,'files':_0x21ae8c},'description':_0x334afb(0xc2)+_0x21ae8c[_0x334afb(0xa8)]+_0x334afb(0x91)+_0x4d2b0c[_0x334afb(0xa1)]};},async 'execute'(_0x1c99c3){const _0xfe43ae=a124_0x1be652,_0x55a285=loadSqlProjectConfig(_0x1c99c3[_0xfe43ae(0xbf)]),_0x35bdd8=await readSqlLockFile(_0x55a285[_0xfe43ae(0xbd)]),{lockData:_0x20c5ef,appLock:_0x595e62}=ensureSqlLockScope(_0x35bdd8??createEmptySqlLock(),_0x55a285[_0xfe43ae(0xbf)],_0x55a285[_0xfe43ae(0xb8)],_0xfe43ae(0xb3)),_0x358ba1=_0x1c99c3[_0xfe43ae(0xa0)](_0xfe43ae(0xbe)),_0x14b3b6=await fetchAllSqlQueries(_0x1c99c3[_0xfe43ae(0xbf)],{'sqlCode':_0x1c99c3[_0xfe43ae(0xa6)](_0xfe43ae(0xc9))||undefined,'sqlName':_0x1c99c3['str'](_0xfe43ae(0xb0))||undefined});if(_0x14b3b6[_0xfe43ae(0xa8)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0xfe43ae(0xc7)};const _0x2478dc=[],_0x52c691=[];for(const _0x4dbe06 of _0x14b3b6){try{_0x2478dc[_0xfe43ae(0xaf)](await ensureSqlContent(_0x4dbe06));}catch(_0x3ccea3){_0x52c691[_0xfe43ae(0xaf)]({'sqlCode':_0x4dbe06[_0xfe43ae(0x97)],'error':_0x3ccea3 instanceof Error?_0x3ccea3['message']:String(_0x3ccea3)});}}if(_0x358ba1&&!_0x1c99c3[_0xfe43ae(0xae)]){let _0x3eac74=![];for(const _0x26f2f1 of _0x2478dc){const _0x18b7c6=detectModeFromSql(_0x26f2f1),_0x2830e9=_0x26f2f1[_0xfe43ae(0xc8)]?await getDbName(_0x1c99c3[_0xfe43ae(0xbf)],Number(_0x26f2f1[_0xfe43ae(0xc8)]))['catch'](()=>undefined):undefined,_0x136faa=buildLocalSqlFileContent({'sqlCode':_0x26f2f1[_0xfe43ae(0x97)],'sqlName':_0x26f2f1[_0xfe43ae(0xa5)],'dbId':_0x26f2f1[_0xfe43ae(0xc8)]},ensureRemoteSqlContent(_0x26f2f1),{'dbName':_0x2830e9,'mode':_0x18b7c6,'syncedAt':new Date()['toISOString'](),'description':_0x26f2f1['description']}),_0x36e327=resolveLocalSqlFilePath(_0x55a285,_0x26f2f1['sqlCode'],buildSqlLockEntry(_0x26f2f1,ensureRemoteSqlContent(_0x26f2f1),'',{'dbName':_0x2830e9}));if(await fileExists(_0x36e327)){const _0x400e6b=await readFile(_0x36e327,_0xfe43ae(0x9a));if(!isEquivalentPulledSqlFile(_0x400e6b,_0x136faa,_0x18b7c6)){_0x3eac74=!![];break;}}}if(_0x3eac74){const _0x22e9d=await confirmForceOverwrite(_0xfe43ae(0x8f));if(!_0x22e9d)throw CliErrors[_0xfe43ae(0x94)](_0xfe43ae(0x99));}}const _0x14b2e4=cloneSqlLockData(_0x20c5ef),_0x2536bf=_0x14b2e4[_0xfe43ae(0xc5)][_0x55a285['appCode']],_0x1cf63d=[],_0x2d4484=[];for(const _0x589090 of _0x2478dc){const _0x1e9549=_0x2536bf[_0xfe43ae(0xaa)][_0x589090[_0xfe43ae(0x97)]],_0x51448e=ensureRemoteSqlContent(_0x589090),_0x3aa174=detectModeFromSql(_0x589090),_0x3af6da=_0x589090[_0xfe43ae(0xc8)]?await getDbName(_0x1c99c3[_0xfe43ae(0xbf)],Number(_0x589090[_0xfe43ae(0xc8)]))[_0xfe43ae(0xd1)](()=>undefined):undefined,_0x10c753=buildLocalSqlFileContent({'sqlCode':_0x589090[_0xfe43ae(0x97)],'sqlName':_0x589090[_0xfe43ae(0xa5)],'dbId':_0x589090[_0xfe43ae(0xc8)]},_0x51448e,{'dbName':_0x3af6da,'mode':_0x3aa174,'syncedAt':new Date()[_0xfe43ae(0x98)](),'description':_0x589090[_0xfe43ae(0x90)]}),_0x431efa=buildSqlLockEntry(_0x589090,_0x51448e,computeSqlContentHash(_0x10c753),{'dbName':_0x3af6da}),_0x3eff78=_0x431efa[_0xfe43ae(0x93)],_0x4904ef=join(_0x55a285[_0xfe43ae(0xa1)],_0x3eff78);try{if(await fileExists(_0x4904ef)){const _0x5a1823=await readFile(_0x4904ef,'utf8');if(isEquivalentPulledSqlFile(_0x5a1823,_0x10c753,_0x3aa174)){_0x2d4484['push']({'sqlCode':_0x589090['sqlCode'],'reason':_0xfe43ae(0xb5)}),_0x2536bf[_0xfe43ae(0xaa)][_0x589090[_0xfe43ae(0x97)]]={..._0x431efa,'hash':computeSqlContentHash(_0x5a1823),'path':_0x3eff78};continue;}if(!_0x358ba1){_0x2d4484[_0xfe43ae(0xaf)]({'sqlCode':_0x589090['sqlCode'],'reason':_0xfe43ae(0x9d)});continue;}}const _0x10e359=_0x1e9549?.['path']?join(_0x55a285['sqlRootDir'],_0x1e9549[_0xfe43ae(0x93)]):undefined;_0x10e359&&_0x10e359!==_0x4904ef&&await fileExists(_0x10e359)&&await rm(_0x10e359,{'force':!![]}),await ensureParentDirectory(_0x4904ef),await writeFile(_0x4904ef,_0x10c753,_0xfe43ae(0x9a)),_0x2536bf[_0xfe43ae(0xaa)][_0x589090[_0xfe43ae(0x97)]]={..._0x431efa,'path':_0x3eff78},_0x1cf63d[_0xfe43ae(0xaf)]({'sqlCode':_0x589090[_0xfe43ae(0x97)],'filePath':_0x4904ef});}catch(_0xfaa775){_0x52c691[_0xfe43ae(0xaf)]({'sqlCode':_0x589090[_0xfe43ae(0x97)],'error':_0xfaa775 instanceof Error?_0xfaa775[_0xfe43ae(0xa3)]:String(_0xfaa775)});}}return _0x2536bf[_0xfe43ae(0xb7)]=new Date()[_0xfe43ae(0x98)](),await writeSqlLockFile(_0x55a285[_0xfe43ae(0xbd)],_0x14b2e4),{'ok':_0x52c691[_0xfe43ae(0xa8)]===0x0,'data':{'pulled':_0x1cf63d,'skipped':_0x2d4484,'failed':_0x52c691},'message':_0xfe43ae(0xce)+_0x1cf63d['length']+_0xfe43ae(0xa2)+_0x2d4484[_0xfe43ae(0xa8)]+_0xfe43ae(0x9e)+_0x52c691[_0xfe43ae(0xa8)]+_0xfe43ae(0xcb)};}};function detectModeFromSql(_0x5b0664){const _0x1f4dce=a124_0x1be652,_0x250d32=ensureRemoteSqlContent(_0x5b0664),_0x2c5e5b=stripLocalSqlMetadata(_0x250d32,_0x1f4dce(0xb4))[_0x1f4dce(0x9b)]();if(/^<(select|insert|update|delete)\b/i[_0x1f4dce(0x9c)](_0x2c5e5b))return _0x1f4dce(0xb4);return'sql';}function isEquivalentPulledSqlFile(_0x4aefad,_0x2f6d99,_0x7e8de3){return normalizePullComparableContent(_0x4aefad,_0x7e8de3)===normalizePullComparableContent(_0x2f6d99,_0x7e8de3);}function normalizePullComparableContent(_0x5d097f,_0x56d442){const _0x5409a5=a124_0x1be652,_0x5d0e00=_0x5d097f[_0x5409a5(0xca)](/\r\n/g,'\x0a')[_0x5409a5(0xb9)]('\x0a'),_0x3482c2=_0x5d0e00['filter'](_0x1980c2=>!isSyncedAtMetadataLine(_0x1980c2,_0x56d442));return _0x3482c2[_0x5409a5(0xc6)]('\x0a');}function isSyncedAtMetadataLine(_0x407bbf,_0x14636c){const _0x581056=a124_0x1be652;if(_0x14636c===_0x581056(0xb4))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x581056(0x9c)](_0x407bbf);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x581056(0x9c)](_0x407bbf);}
|
package/lib/commands/sql/push.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a123_0x184a25=a123_0x1d2e;function a123_0x25ed(){const _0x57e726=['boolean','toISOString','\x20SQL\x20file(s)','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','lockFilePath','650545mFFpfX','Would\x20push\x20','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','Local\x20SQL\x20not\x20found:\x20','2NwkbYT','8CgKHMe','1050300OupRCu','83937LpnXnn','length','force','4775397NqdjNA','hash','filePath','unchanged','\x22\x20for\x20sqlCode\x20','lastSync','sqlCode','high-risk-write','appCode','Local\x20directory\x20\x22','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','has','376xKsblm','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','\x20pushed,\x20','sqlConfig','Push\x20complete:\x20','No\x20database\x20matches\x20local\x20directory\x20\x22','324023GZajKC','2565576BZfWhc','\x20skipped,\x20','join','Push\x20local\x20SQL\x20files\x20to\x20remote','push','10PGCidH','dbDirectory','filter','sqls','isFinite','dbName','4296843LWKbGO','path','exec','version','catch','relativePath','mode','remoteId','dbId','trashDir','sqlRootDir','projectRoot','bool','replace','entries','sqlName','sqlRoot','utf8','message','validation','sqlcode'];a123_0x25ed=function(){return _0x57e726;};return a123_0x25ed();}(function(_0x51f6a4,_0xc82e6c){const _0x5a4f74=a123_0x1d2e,_0x10e433=_0x51f6a4();while(!![]){try{const _0x45bd96=-parseInt(_0x5a4f74(0x128))/0x1*(-parseInt(_0x5a4f74(0x152))/0x2)+-parseInt(_0x5a4f74(0x154))/0x3+-parseInt(_0x5a4f74(0x153))/0x4*(-parseInt(_0x5a4f74(0x14e))/0x5)+-parseInt(_0x5a4f74(0x129))/0x6+-parseInt(_0x5a4f74(0x155))/0x7*(-parseInt(_0x5a4f74(0x122))/0x8)+-parseInt(_0x5a4f74(0x134))/0x9+parseInt(_0x5a4f74(0x12e))/0xa*(parseInt(_0x5a4f74(0x158))/0xb);if(_0x45bd96===_0xc82e6c)break;else _0x10e433['push'](_0x10e433['shift']());}catch(_0x425c5d){_0x10e433['push'](_0x10e433['shift']());}}}(a123_0x25ed,0x4fca6));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';async function getTargetSqlQueries(_0x30caa8,_0xf53df,_0x4346fc){const _0xee5243=a123_0x1d2e,_0x5cfae4=await scanLocalSqlQueries(_0x30caa8),_0x546107=new Map();for(const _0x4029a3 of _0x5cfae4){if(_0x4346fc&&_0x4029a3[_0xee5243(0x11c)]!==_0x4346fc)continue;const _0x47c599=_0x546107['get'](_0x4029a3[_0xee5243(0x11c)])??[];_0x47c599[_0xee5243(0x12d)](_0x4029a3),_0x546107['set'](_0x4029a3['sqlCode'],_0x47c599);}if(_0x4346fc&&!_0x546107[_0xee5243(0x121)](_0x4346fc))throw CliErrors[_0xee5243(0x147)](_0xee5243(0x151)+_0x4346fc);const _0x219601=[];for(const [_0x406bee,_0x5bd34b]of _0x546107[_0xee5243(0x142)]()){if(_0x5bd34b[_0xee5243(0x156)]===0x1){_0x219601[_0xee5243(0x12d)](_0x5bd34b[0x0]);continue;}const _0x1b1e08=_0xf53df[_0xee5243(0x131)][_0x406bee],_0x23ef36=_0x1b1e08?.['path'],_0x2ae577=_0x23ef36?_0x5bd34b['filter'](_0x205fa6=>_0x205fa6[_0xee5243(0x139)]!==_0x23ef36):_0x5bd34b;if(_0x1b1e08&&_0x2ae577['length']===0x1){_0x219601[_0xee5243(0x12d)](_0x2ae577[0x0]);continue;}throw CliErrors[_0xee5243(0x147)](_0xee5243(0x123)+_0x406bee+_0xee5243(0x120));}return _0x219601;}function a123_0x1d2e(_0x216e7a,_0x266155){_0x216e7a=_0x216e7a-0x11b;const _0x25edf9=a123_0x25ed();let _0x1d2e10=_0x25edf9[_0x216e7a];return _0x1d2e10;}export const sqlPush={'service':'sql','command':a123_0x184a25(0x12d),'description':a123_0x184a25(0x12c),'risk':a123_0x184a25(0x11d),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a123_0x184a25(0x157),'type':a123_0x184a25(0x149),'description':a123_0x184a25(0x14c)}],async 'dryRun'(_0x2e2ec0){const _0xd4dba0=a123_0x184a25,_0x144bfc=loadSqlProjectConfig(_0x2e2ec0[_0xd4dba0(0x11e)]),_0x5ea1e0=await readSqlLockFile(_0x144bfc['lockFilePath']),{appLock:_0x536780}=ensureSqlLockScope(_0x5ea1e0??createEmptySqlLock(),_0x2e2ec0[_0xd4dba0(0x11e)],_0x144bfc[_0xd4dba0(0x144)],'push'),_0x18a17e=await getTargetSqlQueries(_0x144bfc,_0x536780,_0x2e2ec0['str'](_0xd4dba0(0x148))||undefined),_0x290d66=[];for(const _0x530755 of _0x18a17e){const _0x44d391=await computeSqlFileHash(_0x530755[_0xd4dba0(0x15a)]),_0x24c2bd=_0x536780[_0xd4dba0(0x131)][_0x530755[_0xd4dba0(0x11c)]],_0x9d355f=!!_0x24c2bd&&(_0x24c2bd[_0xd4dba0(0x135)]!==_0x530755[_0xd4dba0(0x139)]||!!_0x530755['sqlName']&&_0x24c2bd['sqlName']!==_0x530755[_0xd4dba0(0x143)]);if(!_0x2e2ec0[_0xd4dba0(0x140)](_0xd4dba0(0x157))&&_0x24c2bd&&_0x24c2bd['hash']===_0x44d391&&!_0x9d355f)continue;_0x290d66[_0xd4dba0(0x12d)](_0x530755['sqlCode']);}return{'method':'POST','url':'/smartapi/custom/updateUserCustomSql','body':{'sqlCodes':_0x290d66,'appCode':_0x2e2ec0[_0xd4dba0(0x11e)]},'description':_0xd4dba0(0x14f)+_0x290d66[_0xd4dba0(0x156)]+_0xd4dba0(0x14b)};},async 'execute'(_0x4e6b71){const _0x294248=a123_0x184a25,_0x525309=loadSqlProjectConfig(_0x4e6b71[_0x294248(0x11e)]),_0x293a4a=await readSqlLockFile(_0x525309[_0x294248(0x14d)]),{lockData:_0x2a0801,appLock:_0x3d621c}=ensureSqlLockScope(_0x293a4a??createEmptySqlLock(),_0x4e6b71[_0x294248(0x11e)],_0x525309[_0x294248(0x144)],'push'),_0x288898=await getTargetSqlQueries(_0x525309,_0x3d621c,_0x4e6b71['str'](_0x294248(0x148))||undefined);if(_0x288898[_0x294248(0x156)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':'No\x20local\x20SQL\x20files\x20found.'};const _0x4c3837=[],_0x6ee53f=[],_0x1c5a16=[];for(const _0x4adc8a of _0x288898){const _0x315742=_0x3d621c[_0x294248(0x131)][_0x4adc8a[_0x294248(0x11c)]];if(!_0x315742){_0x1c5a16['push']({'sqlCode':_0x4adc8a[_0x294248(0x11c)],'error':'local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first'});continue;}try{const _0x1bb621=await computeSqlFileHash(_0x4adc8a[_0x294248(0x15a)]),_0x5c4f3d=_0x315742[_0x294248(0x135)]!==_0x4adc8a[_0x294248(0x139)]||!!_0x4adc8a[_0x294248(0x143)]&&_0x315742['sqlName']!==_0x4adc8a[_0x294248(0x143)];if(!_0x4e6b71['bool'](_0x294248(0x157))&&_0x315742[_0x294248(0x159)]===_0x1bb621&&!_0x5c4f3d){_0x6ee53f[_0x294248(0x12d)]({'sqlCode':_0x4adc8a[_0x294248(0x11c)],'reason':_0x294248(0x15b)});continue;}if(_0x315742['version']==null){_0x1c5a16[_0x294248(0x12d)]({'sqlCode':_0x4adc8a[_0x294248(0x11c)],'error':_0x294248(0x150)});continue;}const _0x13d4f4=await readFile(_0x4adc8a[_0x294248(0x15a)],_0x294248(0x145)),_0x5cbf55=stripLocalSqlMetadata(_0x13d4f4,_0x4adc8a[_0x294248(0x13a)]),_0x3148cf=_0x4adc8a[_0x294248(0x143)]||_0x315742['sqlName'],_0x454b51=await resolveTargetDbBinding(_0x4e6b71[_0x294248(0x11e)],_0x4adc8a,_0x315742),_0x44cd98=await updateSqlQuery({'id':_0x315742['remoteId'],'appCode':_0x4e6b71[_0x294248(0x11e)],'sqlCode':_0x4adc8a[_0x294248(0x11c)],'sqlName':_0x3148cf,'dbId':_0x454b51[_0x294248(0x13c)],'version':_0x315742[_0x294248(0x137)],'sqlContent':_0x5cbf55,'sqlConfig':_0x315742[_0x294248(0x125)]??undefined}),_0x4c0923=_0x44cd98[_0x294248(0x13c)]?await getDbName(_0x4e6b71['appCode'],Number(_0x44cd98[_0x294248(0x13c)]))[_0x294248(0x138)](()=>_0x454b51[_0x294248(0x133)]):_0x454b51['dbName'];_0x3d621c[_0x294248(0x131)][_0x4adc8a[_0x294248(0x11c)]]={...buildSqlLockEntry(_0x44cd98,_0x5cbf55,_0x1bb621,{'dbName':_0x4c0923}),'path':_0x4adc8a['relativePath'],'mode':_0x315742['mode']},await archivePreviousSqlFileIfNeeded(_0x525309,_0x315742[_0x294248(0x135)],_0x4adc8a[_0x294248(0x139)]),_0x4c3837[_0x294248(0x12d)]({'sqlCode':_0x4adc8a[_0x294248(0x11c)],'remoteId':_0x315742[_0x294248(0x13b)]});}catch(_0x25ecc3){_0x1c5a16[_0x294248(0x12d)]({'sqlCode':_0x4adc8a[_0x294248(0x11c)],'error':_0x25ecc3 instanceof Error?_0x25ecc3[_0x294248(0x146)]:String(_0x25ecc3)});}}return _0x3d621c[_0x294248(0x11b)]=new Date()['toISOString'](),await writeSqlLockFile(_0x525309[_0x294248(0x14d)],_0x2a0801),{'ok':_0x1c5a16['length']===0x0,'data':{'pushed':_0x4c3837,'skipped':_0x6ee53f,'failed':_0x1c5a16},'message':_0x294248(0x126)+_0x4c3837[_0x294248(0x156)]+_0x294248(0x124)+_0x6ee53f['length']+_0x294248(0x12a)+_0x1c5a16['length']+'\x20failed'};}};async function archivePreviousSqlFileIfNeeded(_0x109ec5,_0x421596,_0x48841c){const _0x431c14=a123_0x184a25;if(!_0x421596||_0x421596===_0x48841c)return;const _0x4b94a1=join(_0x109ec5[_0x431c14(0x13e)],_0x421596);if(!await fileExists(_0x4b94a1))return;const _0x1a5672=await moveToTrash(_0x109ec5[_0x431c14(0x13f)],_0x109ec5[_0x431c14(0x13d)],_0x4b94a1);await cleanupEmptyDirectories(dirname(_0x4b94a1),_0x109ec5[_0x431c14(0x13e)]),void _0x1a5672;}async function moveToTrash(_0xd8cc3a,_0x5ad9fb,_0x5dea1f){const _0x4b94cc=a123_0x184a25,_0x3cec05=new Date()[_0x4b94cc(0x14a)]()[_0x4b94cc(0x141)](/[:.]/g,'-'),_0x2506e9=relative(_0xd8cc3a,_0x5dea1f),_0x2c5d7b=join(_0x5ad9fb,_0x3cec05,_0x2506e9);return await mkdir(dirname(_0x2c5d7b),{'recursive':!![]}),await rename(_0x5dea1f,_0x2c5d7b),_0x2c5d7b;}async function cleanupEmptyDirectories(_0x1c973b,_0x470907){let _0x506039=resolve(_0x1c973b);const _0x488cb5=resolve(_0x470907);while(_0x506039['startsWith'](''+_0x488cb5+sep)||_0x506039===_0x488cb5){if(_0x506039===_0x488cb5)return;try{const _0x3a7836=await readdir(_0x506039);if(_0x3a7836['length']>0x0)return;await rmdir(_0x506039);}catch{return;}_0x506039=dirname(_0x506039);}}async function resolveTargetDbBinding(_0x23ec7d,_0x32aea4,_0x173246){const _0x25db8c=a123_0x184a25,_0x21d2f1=_0x32aea4[_0x25db8c(0x12f)];if(!_0x21d2f1)return{'dbId':_0x173246[_0x25db8c(0x13c)],'dbName':_0x173246[_0x25db8c(0x133)]};const _0x42a685=buildDbDirectoryName(_0x173246['dbName'],_0x173246['dbId']);if(_0x21d2f1===_0x42a685)return{'dbId':_0x173246[_0x25db8c(0x13c)],'dbName':_0x173246[_0x25db8c(0x133)]};const _0x49cb65=parseExplicitDbDirectory(_0x21d2f1);if(_0x49cb65!=null)return{'dbId':_0x49cb65,'dbName':await getDbName(_0x23ec7d,_0x49cb65)[_0x25db8c(0x138)](()=>undefined)};const _0x1e39c4=await listDatabases(_0x23ec7d),_0x29a79a=_0x1e39c4[_0x25db8c(0x130)](_0x584c2c=>buildDbDirectoryName(_0x584c2c['dbName'],_0x584c2c['dbId'])===_0x21d2f1);if(_0x29a79a[_0x25db8c(0x156)]===0x1)return{'dbId':_0x29a79a[0x0]['dbId'],'dbName':_0x29a79a[0x0][_0x25db8c(0x133)]};if(_0x29a79a[_0x25db8c(0x156)]===0x0)throw CliErrors[_0x25db8c(0x147)](_0x25db8c(0x127)+_0x21d2f1+_0x25db8c(0x15c)+_0x32aea4[_0x25db8c(0x11c)]+'.');const _0x178040=_0x29a79a['map'](_0x403a14=>_0x403a14[_0x25db8c(0x133)]+'\x20('+_0x403a14[_0x25db8c(0x13c)]+')')[_0x25db8c(0x12b)](',\x20');throw CliErrors[_0x25db8c(0x147)](_0x25db8c(0x11f)+_0x21d2f1+'\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20'+_0x32aea4[_0x25db8c(0x11c)]+':\x20'+_0x178040);}function parseExplicitDbDirectory(_0x43bdc7){const _0x2b2ce2=a123_0x184a25,_0x1b0b67=/^db-(\d+)$/[_0x2b2ce2(0x136)](_0x43bdc7);if(!_0x1b0b67)return null;const _0x3a9c90=Number(_0x1b0b67[0x1]);return Number[_0x2b2ce2(0x132)](_0x3a9c90)&&_0x3a9c90>0x0?_0x3a9c90:null;}
|
|
1
|
+
const a125_0x17e9a1=a125_0x4067;(function(_0x2290cb,_0x209073){const _0x29d38c=a125_0x4067,_0x15e290=_0x2290cb();while(!![]){try{const _0x20eb8e=parseInt(_0x29d38c(0xa4))/0x1+parseInt(_0x29d38c(0x93))/0x2*(-parseInt(_0x29d38c(0x76))/0x3)+parseInt(_0x29d38c(0x94))/0x4*(-parseInt(_0x29d38c(0x6f))/0x5)+parseInt(_0x29d38c(0x7f))/0x6+parseInt(_0x29d38c(0x9e))/0x7+-parseInt(_0x29d38c(0x96))/0x8*(-parseInt(_0x29d38c(0x86))/0x9)+-parseInt(_0x29d38c(0xa8))/0xa;if(_0x20eb8e===_0x209073)break;else _0x15e290['push'](_0x15e290['shift']());}catch(_0x592e79){_0x15e290['push'](_0x15e290['shift']());}}}(a125_0x1482,0xaa1e2));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';function a125_0x1482(){const _0x4f2ebf=['1821615KdKRwD','set','validation','length','sqls','catch','get','3IwipOh','utf8','entries','hash','Local\x20directory\x20\x22','version','dbName','replace','/smartapi/custom/updateUserCustomSql','202608oONkiX','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','No\x20database\x20matches\x20local\x20directory\x20\x22','sqlName','\x20failed','sqlConfig','dbId','18RVsbSA','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','filePath','join','high-risk-write','force','trashDir','map','sqlcode','POST','str','bool','mode','35914kYpQHH','12sQaVRT','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','4456232QvWedL','Would\x20push\x20','sqlRootDir','has','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','push','sql','path','2893163kxokii','lockFilePath','exec','toISOString','Local\x20SQL\x20not\x20found:\x20','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','1183543ZJzItA','appCode','\x20SQL\x20file(s)','\x20skipped,\x20','9369500TEygkq','relativePath','sqlCode','remoteId','message','Push\x20complete:\x20','boolean','\x22\x20for\x20sqlCode\x20','\x20pushed,\x20','lastSync','isFinite','filter'];a125_0x1482=function(){return _0x4f2ebf;};return a125_0x1482();}import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';function a125_0x4067(_0x1ca41b,_0x3c86c7){_0x1ca41b=_0x1ca41b-0x69;const _0x1482c8=a125_0x1482();let _0x406754=_0x1482c8[_0x1ca41b];return _0x406754;}import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';async function getTargetSqlQueries(_0x38f0d6,_0x4651f4,_0x45b261){const _0x464d0f=a125_0x4067,_0x28329a=await scanLocalSqlQueries(_0x38f0d6),_0x1df78d=new Map();for(const _0x4a4a90 of _0x28329a){if(_0x45b261&&_0x4a4a90[_0x464d0f(0xaa)]!==_0x45b261)continue;const _0x3432fc=_0x1df78d[_0x464d0f(0x75)](_0x4a4a90['sqlCode'])??[];_0x3432fc[_0x464d0f(0x9b)](_0x4a4a90),_0x1df78d[_0x464d0f(0x70)](_0x4a4a90[_0x464d0f(0xaa)],_0x3432fc);}if(_0x45b261&&!_0x1df78d[_0x464d0f(0x99)](_0x45b261))throw CliErrors[_0x464d0f(0x71)](_0x464d0f(0xa2)+_0x45b261);const _0x133b4e=[];for(const [_0x3c41ca,_0x1c2435]of _0x1df78d[_0x464d0f(0x78)]()){if(_0x1c2435['length']===0x1){_0x133b4e[_0x464d0f(0x9b)](_0x1c2435[0x0]);continue;}const _0xf14e34=_0x4651f4[_0x464d0f(0x73)][_0x3c41ca],_0xac3aa8=_0xf14e34?.[_0x464d0f(0x9d)],_0x4a9485=_0xac3aa8?_0x1c2435[_0x464d0f(0x6e)](_0x8d63cc=>_0x8d63cc[_0x464d0f(0xa9)]!==_0xac3aa8):_0x1c2435;if(_0xf14e34&&_0x4a9485['length']===0x1){_0x133b4e[_0x464d0f(0x9b)](_0x4a9485[0x0]);continue;}throw CliErrors[_0x464d0f(0x71)](_0x464d0f(0xa3)+_0x3c41ca+_0x464d0f(0x9a));}return _0x133b4e;}export const sqlPush={'service':a125_0x17e9a1(0x9c),'command':a125_0x17e9a1(0x9b),'description':'Push\x20local\x20SQL\x20files\x20to\x20remote','risk':a125_0x17e9a1(0x8a),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a125_0x17e9a1(0x8b),'type':a125_0x17e9a1(0x69),'description':a125_0x17e9a1(0x95)}],async 'dryRun'(_0x3f4066){const _0x496667=a125_0x17e9a1,_0x5b8d08=loadSqlProjectConfig(_0x3f4066['appCode']),_0x457628=await readSqlLockFile(_0x5b8d08[_0x496667(0x9f)]),{appLock:_0x2f5507}=ensureSqlLockScope(_0x457628??createEmptySqlLock(),_0x3f4066[_0x496667(0xa5)],_0x5b8d08['sqlRoot'],_0x496667(0x9b)),_0x2942a1=await getTargetSqlQueries(_0x5b8d08,_0x2f5507,_0x3f4066['str'](_0x496667(0x8e))||undefined),_0x59d66a=[];for(const _0x4f8168 of _0x2942a1){const _0x1296ec=await computeSqlFileHash(_0x4f8168['filePath']),_0x62c958=_0x2f5507[_0x496667(0x73)][_0x4f8168[_0x496667(0xaa)]],_0x4c4756=!!_0x62c958&&(_0x62c958[_0x496667(0x9d)]!==_0x4f8168[_0x496667(0xa9)]||!!_0x4f8168[_0x496667(0x82)]&&_0x62c958[_0x496667(0x82)]!==_0x4f8168[_0x496667(0x82)]);if(!_0x3f4066['bool'](_0x496667(0x8b))&&_0x62c958&&_0x62c958['hash']===_0x1296ec&&!_0x4c4756)continue;_0x59d66a[_0x496667(0x9b)](_0x4f8168[_0x496667(0xaa)]);}return{'method':_0x496667(0x8f),'url':_0x496667(0x7e),'body':{'sqlCodes':_0x59d66a,'appCode':_0x3f4066[_0x496667(0xa5)]},'description':_0x496667(0x97)+_0x59d66a['length']+_0x496667(0xa6)};},async 'execute'(_0x1a4b55){const _0xb07b6c=a125_0x17e9a1,_0xa7bfa6=loadSqlProjectConfig(_0x1a4b55['appCode']),_0x4e3dc4=await readSqlLockFile(_0xa7bfa6[_0xb07b6c(0x9f)]),{lockData:_0xefd176,appLock:_0x38f5ae}=ensureSqlLockScope(_0x4e3dc4??createEmptySqlLock(),_0x1a4b55[_0xb07b6c(0xa5)],_0xa7bfa6['sqlRoot'],_0xb07b6c(0x9b)),_0x4655a9=await getTargetSqlQueries(_0xa7bfa6,_0x38f5ae,_0x1a4b55[_0xb07b6c(0x90)](_0xb07b6c(0x8e))||undefined);if(_0x4655a9[_0xb07b6c(0x72)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':'No\x20local\x20SQL\x20files\x20found.'};const _0x47c7f1=[],_0x1d6436=[],_0x5448af=[];for(const _0x4985e5 of _0x4655a9){const _0x538478=_0x38f5ae[_0xb07b6c(0x73)][_0x4985e5[_0xb07b6c(0xaa)]];if(!_0x538478){_0x5448af['push']({'sqlCode':_0x4985e5[_0xb07b6c(0xaa)],'error':'local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first'});continue;}try{const _0x533bc7=await computeSqlFileHash(_0x4985e5[_0xb07b6c(0x88)]),_0x350235=_0x538478[_0xb07b6c(0x9d)]!==_0x4985e5[_0xb07b6c(0xa9)]||!!_0x4985e5[_0xb07b6c(0x82)]&&_0x538478[_0xb07b6c(0x82)]!==_0x4985e5[_0xb07b6c(0x82)];if(!_0x1a4b55[_0xb07b6c(0x91)](_0xb07b6c(0x8b))&&_0x538478[_0xb07b6c(0x79)]===_0x533bc7&&!_0x350235){_0x1d6436[_0xb07b6c(0x9b)]({'sqlCode':_0x4985e5[_0xb07b6c(0xaa)],'reason':'unchanged'});continue;}if(_0x538478['version']==null){_0x5448af['push']({'sqlCode':_0x4985e5[_0xb07b6c(0xaa)],'error':_0xb07b6c(0x87)});continue;}const _0x6aeef3=await readFile(_0x4985e5['filePath'],_0xb07b6c(0x77)),_0x1daaea=stripLocalSqlMetadata(_0x6aeef3,_0x4985e5[_0xb07b6c(0x92)]),_0xb2fda=_0x4985e5['sqlName']||_0x538478[_0xb07b6c(0x82)],_0x81ff8c=await resolveTargetDbBinding(_0x1a4b55['appCode'],_0x4985e5,_0x538478),_0x3a4567=await updateSqlQuery({'id':_0x538478['remoteId'],'appCode':_0x1a4b55[_0xb07b6c(0xa5)],'sqlCode':_0x4985e5[_0xb07b6c(0xaa)],'sqlName':_0xb2fda,'dbId':_0x81ff8c['dbId'],'version':_0x538478[_0xb07b6c(0x7b)],'sqlContent':_0x1daaea,'sqlConfig':_0x538478[_0xb07b6c(0x84)]??undefined}),_0x44fdb7=_0x3a4567['dbId']?await getDbName(_0x1a4b55[_0xb07b6c(0xa5)],Number(_0x3a4567[_0xb07b6c(0x85)]))[_0xb07b6c(0x74)](()=>_0x81ff8c[_0xb07b6c(0x7c)]):_0x81ff8c['dbName'];_0x38f5ae[_0xb07b6c(0x73)][_0x4985e5[_0xb07b6c(0xaa)]]={...buildSqlLockEntry(_0x3a4567,_0x1daaea,_0x533bc7,{'dbName':_0x44fdb7}),'path':_0x4985e5[_0xb07b6c(0xa9)],'mode':_0x538478['mode']},await archivePreviousSqlFileIfNeeded(_0xa7bfa6,_0x538478[_0xb07b6c(0x9d)],_0x4985e5[_0xb07b6c(0xa9)]),_0x47c7f1[_0xb07b6c(0x9b)]({'sqlCode':_0x4985e5[_0xb07b6c(0xaa)],'remoteId':_0x538478[_0xb07b6c(0xab)]});}catch(_0x3912b6){_0x5448af['push']({'sqlCode':_0x4985e5['sqlCode'],'error':_0x3912b6 instanceof Error?_0x3912b6[_0xb07b6c(0xac)]:String(_0x3912b6)});}}return _0x38f5ae[_0xb07b6c(0x6c)]=new Date()[_0xb07b6c(0xa1)](),await writeSqlLockFile(_0xa7bfa6[_0xb07b6c(0x9f)],_0xefd176),{'ok':_0x5448af['length']===0x0,'data':{'pushed':_0x47c7f1,'skipped':_0x1d6436,'failed':_0x5448af},'message':_0xb07b6c(0xad)+_0x47c7f1[_0xb07b6c(0x72)]+_0xb07b6c(0x6b)+_0x1d6436['length']+_0xb07b6c(0xa7)+_0x5448af[_0xb07b6c(0x72)]+_0xb07b6c(0x83)};}};async function archivePreviousSqlFileIfNeeded(_0x1c1d77,_0x3d68bb,_0x26258f){const _0x1e590a=a125_0x17e9a1;if(!_0x3d68bb||_0x3d68bb===_0x26258f)return;const _0x58c77c=join(_0x1c1d77[_0x1e590a(0x98)],_0x3d68bb);if(!await fileExists(_0x58c77c))return;const _0x42222f=await moveToTrash(_0x1c1d77['projectRoot'],_0x1c1d77[_0x1e590a(0x8c)],_0x58c77c);await cleanupEmptyDirectories(dirname(_0x58c77c),_0x1c1d77[_0x1e590a(0x98)]),void _0x42222f;}async function moveToTrash(_0x397ef2,_0x18706d,_0x3f70b5){const _0x4bd6f2=a125_0x17e9a1,_0x5cc347=new Date()[_0x4bd6f2(0xa1)]()[_0x4bd6f2(0x7d)](/[:.]/g,'-'),_0x47b174=relative(_0x397ef2,_0x3f70b5),_0xb4033=join(_0x18706d,_0x5cc347,_0x47b174);return await mkdir(dirname(_0xb4033),{'recursive':!![]}),await rename(_0x3f70b5,_0xb4033),_0xb4033;}async function cleanupEmptyDirectories(_0x3049f9,_0x55c756){const _0x2d4ac9=a125_0x17e9a1;let _0x2d2edd=resolve(_0x3049f9);const _0x5d4f7a=resolve(_0x55c756);while(_0x2d2edd['startsWith'](''+_0x5d4f7a+sep)||_0x2d2edd===_0x5d4f7a){if(_0x2d2edd===_0x5d4f7a)return;try{const _0x4b2011=await readdir(_0x2d2edd);if(_0x4b2011[_0x2d4ac9(0x72)]>0x0)return;await rmdir(_0x2d2edd);}catch{return;}_0x2d2edd=dirname(_0x2d2edd);}}async function resolveTargetDbBinding(_0x4266f8,_0xb44a98,_0x175086){const _0x4e33c2=a125_0x17e9a1,_0x5646e3=_0xb44a98['dbDirectory'];if(!_0x5646e3)return{'dbId':_0x175086[_0x4e33c2(0x85)],'dbName':_0x175086[_0x4e33c2(0x7c)]};const _0x2b03b8=buildDbDirectoryName(_0x175086['dbName'],_0x175086[_0x4e33c2(0x85)]);if(_0x5646e3===_0x2b03b8)return{'dbId':_0x175086['dbId'],'dbName':_0x175086['dbName']};const _0x5b8874=parseExplicitDbDirectory(_0x5646e3);if(_0x5b8874!=null)return{'dbId':_0x5b8874,'dbName':await getDbName(_0x4266f8,_0x5b8874)['catch'](()=>undefined)};const _0x2bad91=await listDatabases(_0x4266f8),_0x430966=_0x2bad91['filter'](_0x2e7cb6=>buildDbDirectoryName(_0x2e7cb6[_0x4e33c2(0x7c)],_0x2e7cb6['dbId'])===_0x5646e3);if(_0x430966[_0x4e33c2(0x72)]===0x1)return{'dbId':_0x430966[0x0][_0x4e33c2(0x85)],'dbName':_0x430966[0x0][_0x4e33c2(0x7c)]};if(_0x430966[_0x4e33c2(0x72)]===0x0)throw CliErrors[_0x4e33c2(0x71)](_0x4e33c2(0x81)+_0x5646e3+_0x4e33c2(0x6a)+_0xb44a98[_0x4e33c2(0xaa)]+'.');const _0x5c77d3=_0x430966[_0x4e33c2(0x8d)](_0x3b7018=>_0x3b7018['dbName']+'\x20('+_0x3b7018[_0x4e33c2(0x85)]+')')[_0x4e33c2(0x89)](',\x20');throw CliErrors[_0x4e33c2(0x71)](_0x4e33c2(0x7a)+_0x5646e3+_0x4e33c2(0x80)+_0xb44a98[_0x4e33c2(0xaa)]+':\x20'+_0x5c77d3);}function parseExplicitDbDirectory(_0x189eb3){const _0x50ec41=a125_0x17e9a1,_0x1c5125=/^db-(\d+)$/[_0x50ec41(0xa0)](_0x189eb3);if(!_0x1c5125)return null;const _0x4925eb=Number(_0x1c5125[0x1]);return Number[_0x50ec41(0x6d)](_0x4925eb)&&_0x4925eb>0x0?_0x4925eb:null;}
|
package/lib/commands/sql/save.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a126_0xf82c(){const _0x52e523=['validation','15mMIqxb','5311572VHfKhJ','74962tpoIGh','string','sql','Create\x20new\x20SQL\x20with\x20`rabetbase\x20sql\x20create\x20--name\x20<name>\x20--db-id\x20<id>\x20--mode\x20sql|mybatisXml`.','27bxvTgV','sqlname','Path\x20to\x20the\x20SQL\x20file','22491GAZapO','38950Ajptuv','2222FHbBFw','write','109916PsQtxi','Query\x20description','`rabetbase\x20sql\x20save`\x20has\x20been\x20deprecated.','save','2611890hxdZFY','2264ZJwcjh','description','Update\x20existing\x20SQL\x20by\x20editing\x20the\x20synced\x20file\x20under\x20`.rabetbase/sql/<appCode>/<dbName|db-<id>>/`\x20and\x20then\x20running\x20`rabetbase\x20sql\x20push\x20--sqlcode\x20<code>\x20--yes`.','SQL\x20query\x20display\x20name','join','file','720357rkzJGk'];a126_0xf82c=function(){return _0x52e523;};return a126_0xf82c();}const a126_0x3a165d=a126_0x2a71;(function(_0x5ca29d,_0x5b5a22){const _0x26301f=a126_0x2a71,_0x323197=_0x5ca29d();while(!![]){try{const _0x254637=parseInt(_0x26301f(0x1a6))/0x1*(parseInt(_0x26301f(0x1a2))/0x2)+parseInt(_0x26301f(0x19e))/0x3+parseInt(_0x26301f(0x193))/0x4*(-parseInt(_0x26301f(0x1a0))/0x5)+parseInt(_0x26301f(0x1a1))/0x6+parseInt(_0x26301f(0x1a9))/0x7*(-parseInt(_0x26301f(0x198))/0x8)+parseInt(_0x26301f(0x197))/0x9+parseInt(_0x26301f(0x1aa))/0xa*(-parseInt(_0x26301f(0x191))/0xb);if(_0x254637===_0x5b5a22)break;else _0x323197['push'](_0x323197['shift']());}catch(_0x22709f){_0x323197['push'](_0x323197['shift']());}}}(a126_0xf82c,0x9e770));function a126_0x2a71(_0x5656ff,_0xafd417){_0x5656ff=_0x5656ff-0x191;const _0xf82c67=a126_0xf82c();let _0x2a714f=_0xf82c67[_0x5656ff];return _0x2a714f;}import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';const SQL_SAVE_DEPRECATED_HINT=[a126_0x3a165d(0x195),a126_0x3a165d(0x1a5),a126_0x3a165d(0x19a)][a126_0x3a165d(0x19c)]('\x0a');export const sqlSave={'service':a126_0x3a165d(0x1a4),'command':a126_0x3a165d(0x196),'description':'Deprecated:\x20use\x20sql\x20create\x20to\x20create\x20and\x20sql\x20push\x20to\x20update','risk':a126_0x3a165d(0x192),'requiresAuth':![],'requiresAppCode':![],'flags':[{'name':a126_0x3a165d(0x19d),'type':'string','required':!![],'description':a126_0x3a165d(0x1a8)},SQLCODE_FLAG_OPTIONAL,{'name':a126_0x3a165d(0x1a7),'type':'string','description':a126_0x3a165d(0x19b)},{'name':'db','type':a126_0x3a165d(0x1a3),'description':'Target\x20database\x20—\x20accepts\x20a\x20numeric\x20ID\x20or\x20database\x20name\x20(e.g.\x20ecommerce_db)'},{'name':a126_0x3a165d(0x199),'type':a126_0x3a165d(0x1a3),'description':a126_0x3a165d(0x194)}],async 'validate'(){const _0x2cc3c9=a126_0x3a165d;throw CliErrors[_0x2cc3c9(0x19f)](SQL_SAVE_DEPRECATED_HINT);},async 'execute'(){const _0x12c4f1=a126_0x3a165d;throw CliErrors[_0x12c4f1(0x19f)](SQL_SAVE_DEPRECATED_HINT);}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
const a127_0x2f743e=a127_0x46ad;(function(_0xbbf6e8,_0x1a4e2d){const _0x413494=a127_0x46ad,_0x179da7=_0xbbf6e8();while(!![]){try{const _0x3f2364=parseInt(_0x413494(0x12a))/0x1+-parseInt(_0x413494(0x13d))/0x2+parseInt(_0x413494(0x141))/0x3+-parseInt(_0x413494(0x145))/0x4+-parseInt(_0x413494(0x146))/0x5*(-parseInt(_0x413494(0x128))/0x6)+parseInt(_0x413494(0x131))/0x7*(-parseInt(_0x413494(0x12e))/0x8)+parseInt(_0x413494(0x12c))/0x9*(parseInt(_0x413494(0x142))/0xa);if(_0x3f2364===_0x1a4e2d)break;else _0x179da7['push'](_0x179da7['shift']());}catch(_0x2bc9ee){_0x179da7['push'](_0x179da7['shift']());}}}(a127_0x1bc3,0xe7d88));import{createInterface}from'node:readline';import{join}from'node:path';import{buildDefaultSqlFileName,buildSqlRelativePath,detectSqlMode}from'../../core/sql-sync/utils.js';function a127_0x46ad(_0x490528,_0x198374){_0x490528=_0x490528-0x11d;const _0x1bc3ec=a127_0x1bc3();let _0x46adaa=_0x1bc3ec[_0x490528];return _0x46adaa;}export const SQL_LOCAL_REL_DIR=a127_0x2f743e(0x124);export function buildSqlLockEntry(_0x3a4be6,_0x37b265,_0x5da66e,_0x4fb285){const _0x3ef761=a127_0x2f743e,_0x4ea19c=detectSqlMode(_0x37b265);return{'path':buildSqlRelativePath(_0x3a4be6[_0x3ef761(0x12d)],_0x3a4be6[_0x3ef761(0x13c)],_0x4fb285?.[_0x3ef761(0x148)],_0x4ea19c,_0x3a4be6[_0x3ef761(0x11e)]),'hash':_0x5da66e,'remoteId':_0x3a4be6['id'],'version':_0x3a4be6[_0x3ef761(0x147)],'dbId':Number(_0x3a4be6[_0x3ef761(0x11e)]),'dbName':_0x4fb285?.[_0x3ef761(0x148)],'sqlName':_0x3a4be6[_0x3ef761(0x13c)],'sqlConfig':_0x3a4be6['sqlConfig']??undefined,'mode':_0x4ea19c};}export function cloneSqlLockData(_0x146187){const _0x1be39c=a127_0x2f743e;return{'apps':Object[_0x1be39c(0x129)](Object[_0x1be39c(0x14b)](_0x146187[_0x1be39c(0x11d)])[_0x1be39c(0x12f)](([_0x2677a0,_0x3373f9])=>[_0x2677a0,{'sqlRoot':_0x3373f9[_0x1be39c(0x127)],'lastSync':_0x3373f9[_0x1be39c(0x144)],'sqls':{..._0x3373f9[_0x1be39c(0x149)]}}]))};}function a127_0x1bc3(){const _0x10ed7b=['test','\x20-->','sqlName','1278032IYqcaf','endsWith','join','push','4468416UIgVaf','20KSMdWa','\x20[y/N]\x20','lastSync','2414600LFjTXf','5ZSqrhs','version','dbName','sqls','filter','entries','apps','dbId','split','description','path','syncedAt','mybatisXml','.rabetbase/sql','question','stdin','sqlRoot','187776FpSpvE','fromEntries','12326TVGtox','length','8666847hqDzhE','sqlCode','8MJJvHG','map','trim','8867278heyqkx','yes','stderr','trimStart','sqlContent','mode','close','includes','toLowerCase'];a127_0x1bc3=function(){return _0x10ed7b;};return a127_0x1bc3();}export function ensureRemoteSqlContent(_0x48761c){const _0x1ecd03=a127_0x2f743e;return _0x48761c[_0x1ecd03(0x135)]??'';}export function buildLocalSqlFileContent(_0x280eb9,_0x15da0b,_0x5aed16){const _0x31149b=a127_0x2f743e,_0x1747c5=_0x5aed16?.[_0x31149b(0x136)]??detectSqlMode(_0x15da0b),_0x3cd74d=stripLocalSqlMetadata(_0x15da0b,_0x1747c5)['trim'](),_0x59be3f=[...buildMetadataHeaderLines({'sqlCode':_0x280eb9[_0x31149b(0x12d)],'sqlName':_0x280eb9[_0x31149b(0x13c)],'dbId':_0x280eb9[_0x31149b(0x11e)],'dbName':_0x5aed16?.[_0x31149b(0x148)],'mode':_0x1747c5,'syncedAt':_0x5aed16?.[_0x31149b(0x122)],'description':_0x5aed16?.[_0x31149b(0x120)]},_0x1747c5),'',_0x3cd74d],_0x43b28f=_0x59be3f['join']('\x0a');return _0x43b28f[_0x31149b(0x13e)]('\x0a')?_0x43b28f:_0x43b28f+'\x0a';}export function stripLocalSqlMetadata(_0x1c526f,_0x5b876c){const _0x5137ce=a127_0x2f743e,_0xec4283=_0x1c526f['replace'](/\r\n/g,'\x0a')[_0x5137ce(0x11f)]('\x0a'),_0x324f28=[];let _0x5b85a8=0x0;if(_0x5b876c==='mybatisXml')while(_0x5b85a8<_0xec4283['length']){const _0x32861b=_0xec4283[_0x5b85a8]??'';if(/^\s*<!--\s*@lovrabet\./[_0x5137ce(0x13a)](_0x32861b)){_0x5b85a8++;continue;}if(_0x32861b['trim']()===''&&_0x5b85a8>0x0){_0x5b85a8++;continue;}break;}else while(_0x5b85a8<_0xec4283[_0x5137ce(0x12b)]){const _0x1629a7=_0xec4283[_0x5b85a8]??'';if(/^\s*--\s*@lovrabet\./[_0x5137ce(0x13a)](_0x1629a7)){_0x5b85a8++;continue;}if(_0x1629a7[_0x5137ce(0x130)]()===''&&_0x5b85a8>0x0){_0x5b85a8++;continue;}break;}for(;_0x5b85a8<_0xec4283['length'];_0x5b85a8++){_0x324f28[_0x5137ce(0x140)](_0xec4283[_0x5b85a8]);}return _0x324f28[_0x5137ce(0x13f)]('\x0a')[_0x5137ce(0x134)]();}export function resolveSqlMode(_0x8720b4,_0x38c1d0){const _0x1dcc26=a127_0x2f743e;if(_0x38c1d0?.[_0x1dcc26(0x136)])return _0x38c1d0[_0x1dcc26(0x136)];return detectSqlMode(_0x8720b4);}export function resolveSqlFileName(_0x5524ab,_0x43917d,_0x5dad66){const _0x58628c=a127_0x2f743e;if(_0x5dad66?.[_0x58628c(0x121)])return _0x5dad66[_0x58628c(0x121)];if(_0x5dad66?.[_0x58628c(0x13c)]||_0x5dad66?.[_0x58628c(0x148)])return buildSqlRelativePath(_0x5524ab,_0x5dad66?.[_0x58628c(0x13c)],_0x5dad66?.[_0x58628c(0x148)],resolveSqlMode(_0x43917d,_0x5dad66),_0x5dad66?.[_0x58628c(0x11e)]);return buildDefaultSqlFileName(_0x5524ab,resolveSqlMode(_0x43917d,_0x5dad66));}export function resolveSqlLocalDir(_0x3ceddf,_0x3e7e63){return join(_0x3ceddf,SQL_LOCAL_REL_DIR,_0x3e7e63);}export async function confirmForceOverwrite(_0xc5da09){const _0xc2ba00=a127_0x2f743e,_0x5813af=createInterface({'input':process[_0xc2ba00(0x126)],'output':process[_0xc2ba00(0x133)]}),_0x327bae=await new Promise(_0x235d95=>{const _0x12fae8=_0xc2ba00;_0x5813af[_0x12fae8(0x125)](_0xc5da09+_0x12fae8(0x143),_0x235d95);});return _0x5813af[_0xc2ba00(0x137)](),['y',_0xc2ba00(0x132)][_0xc2ba00(0x138)](_0x327bae['trim']()[_0xc2ba00(0x139)]());}export function findSqlLockScope(_0x54b183,_0x587d9c){return _0x54b183['apps'][_0x587d9c];}function buildMetadataHeaderLines(_0x420102,_0x47bdb4){const _0x4f2e52=a127_0x2f743e,_0x1b3e70=[[_0x4f2e52(0x12d),_0x420102['sqlCode']],[_0x4f2e52(0x13c),_0x420102[_0x4f2e52(0x13c)]],['dbId',_0x420102['dbId']],[_0x4f2e52(0x148),_0x420102[_0x4f2e52(0x148)]],['mode',_0x420102[_0x4f2e52(0x136)]],[_0x4f2e52(0x122),_0x420102[_0x4f2e52(0x122)]],[_0x4f2e52(0x120),_0x420102[_0x4f2e52(0x120)]]];if(_0x47bdb4===_0x4f2e52(0x123))return _0x1b3e70[_0x4f2e52(0x14a)](([,_0x5c588a])=>_0x5c588a!==undefined&&_0x5c588a!==null&&String(_0x5c588a)[_0x4f2e52(0x130)]()!=='')['map'](([_0x47d7df,_0x114ec8])=>'<!--\x20@lovrabet.'+_0x47d7df+':\x20'+String(_0x114ec8)+_0x4f2e52(0x13b));return _0x1b3e70[_0x4f2e52(0x14a)](([,_0x5dc0c2])=>_0x5dc0c2!==undefined&&_0x5dc0c2!==null&&String(_0x5dc0c2)[_0x4f2e52(0x130)]()!=='')[_0x4f2e52(0x12f)](([_0x39911c,_0x546e0c])=>'--\x20@lovrabet.'+_0x39911c+':\x20'+String(_0x546e0c));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a128_0x53967e=a128_0x46f1;(function(_0x12b53f,_0x398e5a){const _0x3525d2=a128_0x46f1,_0x3f7aea=_0x12b53f();while(!![]){try{const _0x35f759=-parseInt(_0x3525d2(0x12b))/0x1+-parseInt(_0x3525d2(0x148))/0x2+parseInt(_0x3525d2(0x129))/0x3+parseInt(_0x3525d2(0x13f))/0x4+-parseInt(_0x3525d2(0x13a))/0x5*(-parseInt(_0x3525d2(0x137))/0x6)+parseInt(_0x3525d2(0x147))/0x7*(parseInt(_0x3525d2(0x13b))/0x8)+parseInt(_0x3525d2(0x139))/0x9*(-parseInt(_0x3525d2(0x12d))/0xa);if(_0x35f759===_0x398e5a)break;else _0x3f7aea['push'](_0x3f7aea['shift']());}catch(_0x1a2b1a){_0x3f7aea['push'](_0x3f7aea['shift']());}}}(a128_0x2d3b,0x89439));import{listSqlQueries}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile}from'../../core/sql-sync/lock.js';const PAGE_SIZE=0x64;async function fetchAllSqlCodes(_0x2c128b){const _0xec6805=a128_0x46f1,_0x356c66=[];let _0x299aa7=0x1;while(!![]){const _0x522ff9=await listSqlQueries(_0x2c128b,{'currentPage':_0x299aa7,'pageSize':PAGE_SIZE}),_0x1b113c=_0x522ff9[_0xec6805(0x12a)]??[];_0x356c66['push'](..._0x1b113c[_0xec6805(0x145)](_0x318449=>_0x318449[_0xec6805(0x136)]));if(_0x1b113c[_0xec6805(0x142)]===0x0)break;const _0x4f89d4=_0x522ff9[_0xec6805(0x12e)]?.[_0xec6805(0x135)];if(_0x4f89d4!=null?_0x356c66['length']>=_0x4f89d4:_0x1b113c[_0xec6805(0x142)]<PAGE_SIZE)break;_0x299aa7++;}return _0x356c66;}function a128_0x2d3b(){const _0x3a1579=['filePath','keys','1166784QKhUet','tableData','275852NvckpU','Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','175390LROPgZ','paging','path','Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally','boolean','lockKey','read','sqlRoot','totalCount','sqlCode','420204lObllq','\x20modified,\x20','216NWDzmN','20TXktIh','6162352SJNsss','All\x20SQL\x20queries\x20are\x20in\x20sync.','sqlName','hash','1671792yJBCiK','\x20added,\x20','has','length','bool','remote','map','push','7LCnnWe','1196570TTMbCK','\x20remote-only','sqls','status','appCode','\x20unchanged'];a128_0x2d3b=function(){return _0x3a1579;};return a128_0x2d3b();}function a128_0x46f1(_0xd67b5a,_0x59e6cb){_0xd67b5a=_0xd67b5a-0x125;const _0x2d3bd4=a128_0x2d3b();let _0x46f11f=_0x2d3bd4[_0xd67b5a];return _0x46f11f;}export const sqlStatus={'service':'sql','command':a128_0x53967e(0x14b),'description':a128_0x53967e(0x12c),'risk':a128_0x53967e(0x133),'flags':[{'name':a128_0x53967e(0x144),'type':a128_0x53967e(0x131),'description':a128_0x53967e(0x130)}],async 'execute'(_0x5418cc){const _0x38ab54=a128_0x53967e,_0x475031=loadSqlProjectConfig(_0x5418cc[_0x38ab54(0x125)]),_0x32c275=await readSqlLockFile(_0x475031['lockFilePath']),{appLock:_0x18ad75}=ensureSqlLockScope(_0x32c275??createEmptySqlLock(),_0x475031[_0x38ab54(0x125)],_0x475031[_0x38ab54(0x134)],'status'),_0x24666c=await scanLocalSqlQueries(_0x475031),_0x22ce40=[],_0x115de6=[],_0xf85719=[],_0x493cbb=[],_0xa1e36e=new Set(_0x24666c[_0x38ab54(0x145)](_0x1c4742=>_0x1c4742[_0x38ab54(0x132)]));for(const _0x1bee28 of _0x24666c){const _0x20b0d3=await computeSqlFileHash(_0x1bee28[_0x38ab54(0x127)]),_0x1c6645=_0x18ad75[_0x38ab54(0x14a)][_0x1bee28[_0x38ab54(0x132)]],_0x2fa243=!!_0x1c6645&&_0x1c6645[_0x38ab54(0x12f)]!==_0x1bee28['relativePath'],_0x75582f=!!_0x1c6645&&!!_0x1bee28[_0x38ab54(0x13d)]&&_0x1c6645[_0x38ab54(0x13d)]!==_0x1bee28[_0x38ab54(0x13d)];if(!_0x1c6645)_0x22ce40[_0x38ab54(0x146)](_0x1bee28['lockKey']);else _0x1c6645[_0x38ab54(0x13e)]!==_0x20b0d3||_0x2fa243||_0x75582f?_0x115de6['push'](_0x1bee28[_0x38ab54(0x132)]):_0xf85719[_0x38ab54(0x146)](_0x1bee28['lockKey']);}for(const _0x229297 of Object[_0x38ab54(0x128)](_0x18ad75['sqls'])){!_0xa1e36e[_0x38ab54(0x141)](_0x229297)&&_0x493cbb[_0x38ab54(0x146)](_0x229297);}const _0x31aa01=[];if(_0x5418cc[_0x38ab54(0x143)]('remote')){const _0x323119=await fetchAllSqlCodes(_0x5418cc[_0x38ab54(0x125)]);for(const _0x20c643 of _0x323119){!_0xa1e36e[_0x38ab54(0x141)](_0x20c643)&&!_0x18ad75[_0x38ab54(0x14a)][_0x20c643]&&_0x31aa01[_0x38ab54(0x146)](_0x20c643);}}const _0x4bbd60=_0x22ce40[_0x38ab54(0x142)]===0x0&&_0x115de6['length']===0x0&&_0x493cbb[_0x38ab54(0x142)]===0x0&&_0x31aa01[_0x38ab54(0x142)]===0x0;return{'ok':!![],'data':{'added':_0x22ce40,'modified':_0x115de6,'missing':_0x493cbb,'unchanged':_0xf85719,'remoteOnly':_0x31aa01},'message':_0x4bbd60?_0x38ab54(0x13c):_0x22ce40['length']+_0x38ab54(0x140)+_0x115de6[_0x38ab54(0x142)]+_0x38ab54(0x138)+_0x493cbb[_0x38ab54(0x142)]+'\x20missing,\x20'+_0xf85719['length']+_0x38ab54(0x126)+(_0x31aa01['length']>0x0?',\x20'+_0x31aa01[_0x38ab54(0x142)]+_0x38ab54(0x149):'')};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a129_0x489054=a129_0x33d6;(function(_0x3edafe,_0xdfc46d){const _0x47fe51=a129_0x33d6,_0x3ea317=_0x3edafe();while(!![]){try{const _0x3be28c=parseInt(_0x47fe51(0x1c6))/0x1+parseInt(_0x47fe51(0x1e4))/0x2+-parseInt(_0x47fe51(0x1d8))/0x3*(-parseInt(_0x47fe51(0x1e8))/0x4)+parseInt(_0x47fe51(0x1d4))/0x5*(parseInt(_0x47fe51(0x1d9))/0x6)+-parseInt(_0x47fe51(0x1d3))/0x7*(-parseInt(_0x47fe51(0x1d5))/0x8)+-parseInt(_0x47fe51(0x1c1))/0x9+-parseInt(_0x47fe51(0x1c7))/0xa;if(_0x3be28c===_0xdfc46d)break;else _0x3ea317['push'](_0x3ea317['shift']());}catch(_0x21f04b){_0x3ea317['push'](_0x3ea317['shift']());}}}(a129_0x4391,0x27ca3));import{readFileSync,existsSync}from'node:fs';import{resolve}from'node:path';function a129_0x4391(){const _0x1dc29c=['size','valid','schema:','Inline\x20SQL\x20content\x20to\x20validate\x20(alternative\x20to\x20--file)','sqlType','str','file','type','isDangerous','711450OyQaZl','Provide\x20--file\x20or\x20--sql','length','Validate\x20SQL\x20content\x20without\x20saving\x20(type\x20detection,\x20parameter\x20extraction,\x20optional\x20schema\x20check)','flagMissing','180971ahmonR','7907930PZbRla','cwd','name','utf-8','dbtableConfig','toLowerCase','map','string','appCode','File\x20not\x20found:\x20','\x22\x20not\x20found\x20or\x20not\x20accessible','isArray','3087rCsTff','1148765kjSxqq','4648EHYVoB','\x22\x20not\x20found\x20in\x20any\x20dataset','Table\x20\x22','3CyIKWi','6mjnakh','split','Path\x20to\x20the\x20SQL\x20file\x20to\x20validate','fields','schemas','schemaWarnings','parameters','message','reason','tables','push','517818zmrBVA','SQL\x20schema\x20validation','tableName','trim','427872BGdIhi','validate','validation','sql'];a129_0x4391=function(){return _0x1dc29c;};return a129_0x4391();}import{validateSql}from'../../core/sql-validator.js';import{getDatasetDetail,listDatasets}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{assertDatasetSupportsLocalDevelopment,filterDbBackedDatasets}from'../../commands/dataset/capability.js';function a129_0x33d6(_0x211ac0,_0x28b011){_0x211ac0=_0x211ac0-0x1bc;const _0x43912b=a129_0x4391();let _0x33d667=_0x43912b[_0x211ac0];return _0x33d667;}export const sqlValidate={'service':a129_0x489054(0x1eb),'command':a129_0x489054(0x1e9),'description':a129_0x489054(0x1c4),'risk':'read','flags':[{'name':'file','type':a129_0x489054(0x1ce),'description':a129_0x489054(0x1db)},{'name':a129_0x489054(0x1eb),'type':a129_0x489054(0x1ce),'description':a129_0x489054(0x1ef)},{'name':a129_0x489054(0x1dd),'type':a129_0x489054(0x1ce),'description':'Comma-separated\x20dataset\x20codes\x20to\x20cross-check\x20table/column\x20names\x20against'}],async 'execute'(_0x2f565d){const _0x372efd=a129_0x489054,_0x5541eb=_0x2f565d[_0x372efd(0x1bd)](_0x372efd(0x1be)),_0x5b6940=_0x2f565d[_0x372efd(0x1bd)](_0x372efd(0x1eb));if(!_0x5541eb&&!_0x5b6940)throw CliErrors[_0x372efd(0x1c5)](_0x372efd(0x1be),_0x372efd(0x1c2));let _0x4c4495;if(_0x5541eb){const _0x5b3b83=resolve(process[_0x372efd(0x1c8)](),_0x5541eb);if(!existsSync(_0x5b3b83))throw CliErrors[_0x372efd(0x1ea)](_0x372efd(0x1d0)+_0x5b3b83);_0x4c4495=readFileSync(_0x5b3b83,_0x372efd(0x1ca));}else _0x4c4495=_0x5b6940;const _0x5da1be=validateSql(_0x4c4495),_0x3c0f26={'valid':_0x5da1be[_0x372efd(0x1ed)],'sqlType':_0x5da1be[_0x372efd(0x1bc)][_0x372efd(0x1bf)],'isSelectOnly':_0x5da1be[_0x372efd(0x1bc)]['isSelectOnly'],'isDangerous':_0x5da1be[_0x372efd(0x1bc)][_0x372efd(0x1c0)],'tables':_0x5da1be[_0x372efd(0x1e2)],'parameters':_0x5da1be[_0x372efd(0x1df)],'message':_0x5da1be[_0x372efd(0x1e0)]};_0x5da1be['sqlType'][_0x372efd(0x1e1)]&&(_0x3c0f26[_0x372efd(0x1e1)]=_0x5da1be['sqlType'][_0x372efd(0x1e1)]);const _0x3b6697=_0x2f565d[_0x372efd(0x1bd)](_0x372efd(0x1dd));if(_0x3b6697&&_0x5da1be['valid']){const _0x2a2ab5=_0x3b6697[_0x372efd(0x1da)](',')[_0x372efd(0x1cd)](_0x31356c=>_0x31356c[_0x372efd(0x1e7)]())['filter'](Boolean),_0x1f45ca=[],_0x22b3d5=filterDbBackedDatasets(await listDatasets(_0x2f565d[_0x372efd(0x1cf)])),_0x40376f=new Map(_0x22b3d5[_0x372efd(0x1cd)](_0x184913=>[_0x184913[_0x372efd(0x1cb)]?.['tableName']?.[_0x372efd(0x1cc)](),_0x184913]));for(const _0x5d0b00 of _0x5da1be[_0x372efd(0x1e2)]){const _0x52c645=_0x40376f['get'](_0x5d0b00[_0x372efd(0x1cc)]());!_0x52c645&&_0x1f45ca[_0x372efd(0x1e3)](_0x372efd(0x1d7)+_0x5d0b00+_0x372efd(0x1d6));}for(const _0x186350 of _0x2a2ab5){let _0x2115b7;try{_0x2115b7=await getDatasetDetail(_0x186350);}catch{_0x1f45ca[_0x372efd(0x1e3)]('Dataset\x20\x22'+_0x186350+_0x372efd(0x1d1));continue;}assertDatasetSupportsLocalDevelopment(_0x2115b7,_0x372efd(0x1e5));const _0x2deb7f=Array[_0x372efd(0x1d2)](_0x2115b7['fields'])?_0x2115b7[_0x372efd(0x1dc)]:[],_0x4a70ea=new Set(_0x2deb7f[_0x372efd(0x1cd)](_0x3c889f=>_0x3c889f[_0x372efd(0x1c9)]?.[_0x372efd(0x1cc)]())),_0x5a5599=_0x2115b7[_0x372efd(0x1cb)]?.[_0x372efd(0x1e6)]||_0x2115b7[_0x372efd(0x1e6)]||_0x186350;_0x3c0f26[_0x372efd(0x1ee)+_0x5a5599]={'code':_0x186350,'tableName':_0x5a5599,'fieldCount':_0x4a70ea[_0x372efd(0x1ec)],'fields':Array['from'](_0x4a70ea)};}_0x1f45ca[_0x372efd(0x1c3)]>0x0&&(_0x3c0f26[_0x372efd(0x1de)]=_0x1f45ca);}return{'ok':_0x5da1be[_0x372efd(0x1ed)],'data':_0x3c0f26,'message':_0x5da1be[_0x372efd(0x1e0)]};}};
|
package/lib/config/schema.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a130_0x31d17b=a130_0x2f64;(function(_0x3ba1f7,_0x2bcde9){const _0x36edaa=a130_0x2f64,_0xcad2ce=_0x3ba1f7();while(!![]){try{const _0x3fc505=-parseInt(_0x36edaa(0x1da))/0x1*(-parseInt(_0x36edaa(0x1d1))/0x2)+parseInt(_0x36edaa(0x1cd))/0x3+-parseInt(_0x36edaa(0x1ce))/0x4+-parseInt(_0x36edaa(0x1c0))/0x5*(parseInt(_0x36edaa(0x1e5))/0x6)+-parseInt(_0x36edaa(0x1c5))/0x7+-parseInt(_0x36edaa(0x1ca))/0x8*(parseInt(_0x36edaa(0x1d6))/0x9)+-parseInt(_0x36edaa(0x1d3))/0xa*(-parseInt(_0x36edaa(0x1cb))/0xb);if(_0x3fc505===_0x2bcde9)break;else _0xcad2ce['push'](_0xcad2ce['shift']());}catch(_0x5706b1){_0xcad2ce['push'](_0xcad2ce['shift']());}}}(a130_0x1a6b,0x24035));import{DEFAULT_CONFIG_VALUES}from'../constant/defaults.js';import{RABETBASE_ENV_VALUES}from'../constant/env.js';import{RABETBASE_OUTPUT_FORMAT_VALUES}from'../constant/output.js';import{RISK_LEVEL_VALUES}from'../constant/risk.js';export{DEFAULT_CONFIG_VALUES}from'../constant/defaults.js';export const PROJECT_CREATE_INHERITABLE_KEYS=[a130_0x31d17b(0x1ea),a130_0x31d17b(0x1c4),a130_0x31d17b(0x1e6),a130_0x31d17b(0x1d7),a130_0x31d17b(0x1c3)];export const TOP_LEVEL_CONFIG_KEYS=new Set([a130_0x31d17b(0x1df),a130_0x31d17b(0x1e9),'locale',a130_0x31d17b(0x1d7),a130_0x31d17b(0x1ea),a130_0x31d17b(0x1c4),a130_0x31d17b(0x1c6)]);export const CONFIG_ENUM_VALUES={'env':[...RABETBASE_ENV_VALUES],'format':[...RABETBASE_OUTPUT_FORMAT_VALUES]};export function formatConfigKeyList(_0x15e500){const _0x46a0db=a130_0x31d17b;return[..._0x15e500][_0x46a0db(0x1d0)](',\x20');}export function getTopLevelConfigKeyList(){return[...TOP_LEVEL_CONFIG_KEYS];}export function isTopLevelConfigKey(_0x2cba70){return TOP_LEVEL_CONFIG_KEYS['has'](_0x2cba70);}export function getTopLevelConfigKeySummary(){return formatConfigKeyList(getTopLevelConfigKeyList());}export function getConfigCommandKeyDescription(){const _0x200696=a130_0x31d17b;return _0x200696(0x1e1)+getTopLevelConfigKeySummary()+')';}export const APP_PROFILE_FLAG_KEY_MAP={'env':a130_0x31d17b(0x1e9),'apiDir':'apiDir','cookie':a130_0x31d17b(0x1ea),'accessKey':a130_0x31d17b(0x1c4),'defaultFormat':'format','pageSize':a130_0x31d17b(0x1e0),'riskLevel':a130_0x31d17b(0x1c3),'locale':a130_0x31d17b(0x1e6)};export function getAppProfileFlagDefs(){const _0x3ee6c6=a130_0x31d17b;return[{'name':_0x3ee6c6(0x1e9),'type':'string','description':'Target\x20environment','enum':[...RABETBASE_ENV_VALUES]},{'name':_0x3ee6c6(0x1c6),'type':'string','description':_0x3ee6c6(0x1dd)},{'name':_0x3ee6c6(0x1ea),'type':_0x3ee6c6(0x1c7),'description':_0x3ee6c6(0x1de),'hidden':!![]},{'name':'accessKey','type':_0x3ee6c6(0x1c7),'description':'Access\x20key','hidden':!![]},{'name':'defaultFormat','type':_0x3ee6c6(0x1c7),'description':_0x3ee6c6(0x1dc),'enum':[...RABETBASE_OUTPUT_FORMAT_VALUES]},{'name':'pageSize','type':_0x3ee6c6(0x1e2),'description':_0x3ee6c6(0x1c9)},{'name':_0x3ee6c6(0x1c3),'type':_0x3ee6c6(0x1c7),'description':_0x3ee6c6(0x1d5),'enum':[...RISK_LEVEL_VALUES]},{'name':_0x3ee6c6(0x1e6),'type':_0x3ee6c6(0x1c7),'description':_0x3ee6c6(0x1c2)}];}export function collectAppProfileOverrides(_0x56f0e8){const _0x243459=a130_0x31d17b,_0x55095e={};for(const [_0x55a950,_0x128e62]of Object[_0x243459(0x1d2)](APP_PROFILE_FLAG_KEY_MAP)){const _0x1bf0db=_0x56f0e8(_0x55a950);if(!_0x1bf0db)continue;_0x55095e[_0x128e62]=_0x128e62===_0x243459(0x1e0)?Number(_0x1bf0db):_0x1bf0db;}return _0x55095e;}export function buildAppProfileListFields(_0x32dfa0){const _0x30b881=a130_0x31d17b;return{'env':_0x32dfa0['env']??null,'apiDir':_0x32dfa0[_0x30b881(0x1c6)]??null,'hasCookie':!!_0x32dfa0[_0x30b881(0x1ea)],'hasAccessKey':!!_0x32dfa0[_0x30b881(0x1c4)],'format':_0x32dfa0[_0x30b881(0x1d7)]??null,'pageSize':_0x32dfa0[_0x30b881(0x1e0)]??null,'riskLevel':_0x32dfa0[_0x30b881(0x1c3)]??null,'locale':_0x32dfa0[_0x30b881(0x1e6)]??null};}function a130_0x2f64(_0x304938,_0xf7fa33){_0x304938=_0x304938-0x1c0;const _0x1a6b22=a130_0x1a6b();let _0x2f64e9=_0x1a6b22[_0x304938];return _0x2f64e9;}export function buildAppDoctorFields(_0x64a55e,_0x38db69){const _0x3b8a97=a130_0x31d17b;return{'env':{'value':_0x64a55e[_0x3b8a97(0x1e9)]||_0x38db69[_0x3b8a97(0x1e9)],'source':_0x64a55e[_0x3b8a97(0x1e9)]?_0x3b8a97(0x1c8):'inherit'},'apiDir':{'value':_0x64a55e[_0x3b8a97(0x1c6)]||_0x38db69['apiDir'],'source':_0x64a55e[_0x3b8a97(0x1c6)]?'app':_0x3b8a97(0x1e7)},'cookie':{'value':_0x64a55e[_0x3b8a97(0x1ea)]||_0x38db69[_0x3b8a97(0x1ea)],'source':_0x64a55e[_0x3b8a97(0x1ea)]?_0x3b8a97(0x1c8):_0x3b8a97(0x1e7)},'accessKey':{'value':_0x64a55e[_0x3b8a97(0x1c4)]||_0x38db69[_0x3b8a97(0x1c4)],'source':_0x64a55e[_0x3b8a97(0x1c4)]?_0x3b8a97(0x1c8):_0x3b8a97(0x1e7)}};}export function buildCanonicalAppConfig(_0x45d31c,_0x44d4a9){const _0x5cd39f=a130_0x31d17b,_0x3bbbf8=_0x45d31c[_0x5cd39f(0x1d9)](_0x52fe68=>String(_0x52fe68||'')[_0x5cd39f(0x1e3)]())[_0x5cd39f(0x1d8)](Boolean);if(_0x3bbbf8['length']===0x0)return{};const _0x18851d={};for(const _0x417bce of _0x3bbbf8){_0x18851d[_0x417bce]=_0x44d4a9?{'appcode':_0x417bce,'env':_0x44d4a9}:{'appcode':_0x417bce};}return{'apps':_0x18851d,'defaultApp':_0x3bbbf8[0x0]};}export function buildCanonicalProjectConfig(_0x59f47e,_0x3a6fdf){const _0x39f295=a130_0x31d17b,{appCodes:appCodes=[],env:_0x533f80,metadata:_0x46c43f}=_0x3a6fdf,_0x3c3f0a={..._0x59f47e,..._0x46c43f||{}};delete _0x3c3f0a[_0x39f295(0x1df)],delete _0x3c3f0a[_0x39f295(0x1c8)];if(_0x533f80)_0x3c3f0a[_0x39f295(0x1e9)]=_0x533f80;else!_0x3c3f0a[_0x39f295(0x1e9)]&&(_0x3c3f0a[_0x39f295(0x1e9)]=DEFAULT_CONFIG_VALUES[_0x39f295(0x1e9)]);const _0x539971=buildCanonicalAppConfig(appCodes,_0x3c3f0a[_0x39f295(0x1e9)]);return Object[_0x39f295(0x1db)](_0x539971)[_0x39f295(0x1cc)]>0x0&&(_0x3c3f0a[_0x39f295(0x1cf)]=_0x539971[_0x39f295(0x1cf)],_0x3c3f0a['defaultApp']=_0x539971[_0x39f295(0x1d4)]),_0x3c3f0a;}const LOCALE_MAP={'zh':a130_0x31d17b(0x1e8),'zh-cn':a130_0x31d17b(0x1e8),'zh_cn':a130_0x31d17b(0x1e8),'en':'en-US','en-us':'en-US','en_us':a130_0x31d17b(0x1e4)};export function normalizeLocale(_0x33b8c4){const _0x3ebc7a=a130_0x31d17b;if(!_0x33b8c4)return null;return LOCALE_MAP[_0x33b8c4[_0x3ebc7a(0x1c1)]()]??null;}function a130_0x1a6b(){const _0x3395ed=['Default\x20page\x20size','1208fRXYDU','22wtMrHV','length','33054MBahGg','412672aBSqPn','apps','join','1044fZmolx','entries','2938390sFuCYI','defaultApp','Risk\x20level','6606JGIaPw','format','filter','map','328UKESzk','keys','Default\x20output\x20format\x20for\x20this\x20app\x20(profile)','API\x20directory\x20path','Auth\x20cookie','appcode','pageSize','Config\x20key\x20(','number','trim','en-US','2874QjKVCn','locale','inherit','zh-CN','env','cookie','1675ZQmMVS','toLowerCase','Locale','riskLevel','accessKey','1735552bBDxmB','apiDir','string','app'];a130_0x1a6b=function(){return _0x3395ed;};return a130_0x1a6b();}
|
package/lib/constant/cdn.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a131_0x51ee(_0x25f91a,_0x4bc71c){_0x25f91a=_0x25f91a-0x1b1;const _0x3a3c80=a131_0x3a3c();let _0x51eec0=_0x3a3c80[_0x25f91a];return _0x51eec0;}function a131_0x3a3c(){const _0x3d3e0d=['3644HfQBfs','5391ihGzDI','2965840twLaDQ','792qZlbQg','2JGrjQL','12080tFIdBv','15645XaigZe','5202054YbKBGf','5458770tKArtz','726TMpGNh','840849yxtEGH'];a131_0x3a3c=function(){return _0x3d3e0d;};return a131_0x3a3c();}(function(_0x521ac1,_0x3b58f4){const _0x1a8ed4=a131_0x51ee,_0x1ab52c=_0x521ac1();while(!![]){try{const _0x2beced=parseInt(_0x1a8ed4(0x1b6))/0x1*(parseInt(_0x1a8ed4(0x1bb))/0x2)+parseInt(_0x1a8ed4(0x1b5))/0x3*(parseInt(_0x1a8ed4(0x1b7))/0x4)+-parseInt(_0x1a8ed4(0x1b9))/0x5+-parseInt(_0x1a8ed4(0x1b4))/0x6+parseInt(_0x1a8ed4(0x1b2))/0x7*(-parseInt(_0x1a8ed4(0x1ba))/0x8)+parseInt(_0x1a8ed4(0x1b8))/0x9*(parseInt(_0x1a8ed4(0x1b1))/0xa)+parseInt(_0x1a8ed4(0x1b3))/0xb;if(_0x2beced===_0x3b58f4)break;else _0x1ab52c['push'](_0x1ab52c['shift']());}catch(_0x388480){_0x1ab52c['push'](_0x1ab52c['shift']());}}}(a131_0x3a3c,0x82455));export const CLI_VERSION_POLICY_URL='https://g.lovrabet.com/dist/rabetbase-cli/config/index.json';
|
package/lib/constant/cli.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a132_0x523ea3=a132_0x38b1;function a132_0x22e5(){const _0x58ab0b=['Apply\x20to\x20all','file','Function\x20node','nonInteractive','7714189Nlraxv','project','schemas','operation-type','non-interactive','keyword','Use\x20global\x20config\x20scope','Expected\x20affected\x20count','page','format','Filter\x20JSON\x20output\x20(JQ_PATH\x20>\x20bundled\x20jq\x20>\x20PATH;\x20use\x20with\x20--format\x20json\x20or\x20compress)','Config\x20key','Override\x20appcode','20828797LShlrV','db-id','skipImports','Config\x20value','10GhNWte','app','dry-run','Keyword\x20filter','Force\x20overwrite','3296172kMnnKc','SQL\x20name','output','map','SQL\x20code','Page\x20number','Output\x20format','42417LXgdTs','meowKey','Dataset\x20code','Force\x20non-interactive\x20mode\x20(CI)','verbose','Enable\x20BFF\x20save','help','Code\x20filter','sqlName','remote','sql','pagesize','enable-bff-save','expectedCount','3099368WAMwwL','yes','Rabetbase\x20CLI','Clear','title','datasetcode','function-node','boolean','Skip\x20confirmation\x20for\x20high-risk\x20writes','force','description-file','params','all','Description\x20file','5wcFejX','Name','clear','sqlname','Use\x20project\x20config\x20scope','2gFeNCu','target','716185OKQYvw','enableBffSave','Environment','appcode','string','json\x20|\x20pretty\x20|\x20compress','Use\x20remote','rabetbase','Operation\x20type','watch','sqlcode','<code>','key','operation','env','4990890kJdzrQ','sql-name','<expr>','expected-count','type','<name>','1880oLfajv','Watch\x20mode','name','confirm','Preview\x20operation\x20without\x20executing','DB\x20ID','Record\x20ID','operationType','Select\x20app\x20profile\x20by\x20name','global','code','descriptionFile','Alias\x20for\x20--non-interactive','dbid','description','Description'];a132_0x22e5=function(){return _0x58ab0b;};return a132_0x22e5();}(function(_0x2cf58a,_0x5b6f59){const _0x31d1f6=a132_0x38b1,_0x3ca348=_0x2cf58a();while(!![]){try{const _0x2e6ac7=-parseInt(_0x31d1f6(0x1e9))/0x1*(parseInt(_0x31d1f6(0x1e7))/0x2)+-parseInt(_0x31d1f6(0x228))/0x3+-parseInt(_0x31d1f6(0x23d))/0x4+-parseInt(_0x31d1f6(0x1e2))/0x5*(parseInt(_0x31d1f6(0x1f8))/0x6)+parseInt(_0x31d1f6(0x212))/0x7+-parseInt(_0x31d1f6(0x1fe))/0x8*(-parseInt(_0x31d1f6(0x22f))/0x9)+-parseInt(_0x31d1f6(0x223))/0xa*(-parseInt(_0x31d1f6(0x21f))/0xb);if(_0x2e6ac7===_0x5b6f59)break;else _0x3ca348['push'](_0x3ca348['shift']());}catch(_0x5e54e9){_0x3ca348['push'](_0x3ca348['shift']());}}}(a132_0x22e5,0xa6647));export const CLI_BIN_NAME=a132_0x523ea3(0x1f0);export const CLI_DISPLAY_NAME=a132_0x523ea3(0x23f);export const NPM_PACKAGE_NAME='@lovrabet/rabetbase-cli';export const GLOBAL_FLAGS=[{'name':a132_0x523ea3(0x1ec),'meowKey':'appcode','type':a132_0x523ea3(0x1ed),'description':a132_0x523ea3(0x21e),'hint':a132_0x523ea3(0x1f4)},{'name':a132_0x523ea3(0x224),'meowKey':a132_0x523ea3(0x224),'type':a132_0x523ea3(0x1ed),'description':a132_0x523ea3(0x206),'hint':a132_0x523ea3(0x1fd)},{'name':a132_0x523ea3(0x1f7),'meowKey':'env','type':a132_0x523ea3(0x1ed),'description':a132_0x523ea3(0x1eb),'hint':'production\x20|\x20daily'},{'name':a132_0x523ea3(0x21b),'meowKey':a132_0x523ea3(0x21b),'type':a132_0x523ea3(0x1ed),'description':a132_0x523ea3(0x22e),'hint':a132_0x523ea3(0x1ee)},{'name':'jq','meowKey':'jq','type':a132_0x523ea3(0x1ed),'description':a132_0x523ea3(0x21c),'hint':a132_0x523ea3(0x1fa)},{'name':a132_0x523ea3(0x225),'meowKey':'dryRun','type':a132_0x523ea3(0x1db),'description':a132_0x523ea3(0x202)},{'name':a132_0x523ea3(0x23e),'meowKey':a132_0x523ea3(0x23e),'type':a132_0x523ea3(0x1db),'description':a132_0x523ea3(0x1dc)},{'name':a132_0x523ea3(0x216),'meowKey':a132_0x523ea3(0x211),'type':'boolean','description':a132_0x523ea3(0x232)},{'name':'global','meowKey':a132_0x523ea3(0x207),'type':a132_0x523ea3(0x1db),'description':a132_0x523ea3(0x218)},{'name':a132_0x523ea3(0x213),'meowKey':a132_0x523ea3(0x213),'type':a132_0x523ea3(0x1db),'description':a132_0x523ea3(0x1e6)},{'name':'ci','meowKey':'ci','type':a132_0x523ea3(0x1db),'description':a132_0x523ea3(0x20a),'hidden':!![]},{'name':a132_0x523ea3(0x235),'meowKey':a132_0x523ea3(0x235),'type':a132_0x523ea3(0x1db),'description':'Show\x20help'},{'name':a132_0x523ea3(0x200),'meowKey':a132_0x523ea3(0x200),'type':a132_0x523ea3(0x1ed),'description':a132_0x523ea3(0x1e3),'hidden':!![]},{'name':a132_0x523ea3(0x241),'meowKey':a132_0x523ea3(0x241),'type':'string','description':'Title','hidden':!![]},{'name':a132_0x523ea3(0x1e4),'meowKey':a132_0x523ea3(0x1e4),'type':a132_0x523ea3(0x1db),'description':a132_0x523ea3(0x240),'hidden':!![]},{'name':a132_0x523ea3(0x1f2),'meowKey':a132_0x523ea3(0x1f2),'type':'boolean','description':a132_0x523ea3(0x1ff),'hidden':!![]},{'name':a132_0x523ea3(0x22a),'meowKey':a132_0x523ea3(0x22a),'type':a132_0x523ea3(0x1ed),'description':'Output\x20path','hidden':!![]},{'name':a132_0x523ea3(0x1df),'meowKey':'params','type':a132_0x523ea3(0x1ed),'description':'JSON\x20params','hidden':!![]},{'name':a132_0x523ea3(0x242),'meowKey':a132_0x523ea3(0x242),'type':a132_0x523ea3(0x1ed),'description':a132_0x523ea3(0x231),'hidden':!![]},{'name':'all','meowKey':a132_0x523ea3(0x1e0),'type':a132_0x523ea3(0x1db),'description':a132_0x523ea3(0x20e),'hidden':!![]},{'name':a132_0x523ea3(0x23b),'meowKey':a132_0x523ea3(0x1ea),'type':a132_0x523ea3(0x1db),'description':a132_0x523ea3(0x234),'hidden':!![]},{'name':'id','meowKey':'id','type':a132_0x523ea3(0x1ed),'description':a132_0x523ea3(0x204),'hidden':!![]},{'name':a132_0x523ea3(0x1fc),'meowKey':a132_0x523ea3(0x1fc),'type':a132_0x523ea3(0x1ed),'description':'Type\x20filter','hidden':!![]},{'name':'file','meowKey':a132_0x523ea3(0x20f),'type':a132_0x523ea3(0x1ed),'description':'File\x20path','hidden':!![]},{'name':a132_0x523ea3(0x1f3),'meowKey':'sqlcode','type':'string','description':a132_0x523ea3(0x22c),'hidden':!![]},{'name':a132_0x523ea3(0x1f9),'meowKey':a132_0x523ea3(0x237),'type':a132_0x523ea3(0x1ed),'description':a132_0x523ea3(0x229),'hidden':!![]},{'name':a132_0x523ea3(0x1e5),'meowKey':a132_0x523ea3(0x1e5),'type':a132_0x523ea3(0x1ed),'description':a132_0x523ea3(0x229),'hidden':!![]},{'name':a132_0x523ea3(0x220),'meowKey':'dbId','type':a132_0x523ea3(0x1ed),'description':a132_0x523ea3(0x203),'hidden':!![]},{'name':a132_0x523ea3(0x20b),'meowKey':a132_0x523ea3(0x20b),'type':'string','description':'DB\x20ID','hidden':!![]},{'name':a132_0x523ea3(0x20c),'meowKey':'description','type':a132_0x523ea3(0x1ed),'description':a132_0x523ea3(0x20d),'hidden':!![]},{'name':a132_0x523ea3(0x1de),'meowKey':a132_0x523ea3(0x209),'type':'string','description':a132_0x523ea3(0x1e1),'hidden':!![]},{'name':a132_0x523ea3(0x21a),'meowKey':a132_0x523ea3(0x21a),'type':'string','description':a132_0x523ea3(0x22d),'hidden':!![]},{'name':a132_0x523ea3(0x23a),'meowKey':'pagesize','type':a132_0x523ea3(0x1ed),'description':'Page\x20size','hidden':!![]},{'name':a132_0x523ea3(0x217),'meowKey':a132_0x523ea3(0x217),'type':a132_0x523ea3(0x1ed),'description':a132_0x523ea3(0x226),'hidden':!![]},{'name':'code','meowKey':a132_0x523ea3(0x208),'type':a132_0x523ea3(0x1ed),'description':a132_0x523ea3(0x236),'hidden':!![]},{'name':a132_0x523ea3(0x239),'meowKey':a132_0x523ea3(0x239),'type':a132_0x523ea3(0x1ed),'description':'SQL\x20string','hidden':!![]},{'name':a132_0x523ea3(0x214),'meowKey':a132_0x523ea3(0x214),'type':'string','description':'Schemas','hidden':!![]},{'name':'operation','meowKey':a132_0x523ea3(0x1f6),'type':a132_0x523ea3(0x1ed),'description':a132_0x523ea3(0x1f1),'hidden':!![]},{'name':a132_0x523ea3(0x1e8),'meowKey':a132_0x523ea3(0x1e8),'type':'string','description':'Target\x20path','hidden':!![]},{'name':'skip-imports','meowKey':a132_0x523ea3(0x221),'type':a132_0x523ea3(0x1db),'description':'Skip\x20import\x20generation','hidden':!![]},{'name':a132_0x523ea3(0x1f5),'meowKey':a132_0x523ea3(0x1f5),'type':a132_0x523ea3(0x1ed),'description':a132_0x523ea3(0x21d),'hidden':!![]},{'name':'value','meowKey':'value','type':a132_0x523ea3(0x1ed),'description':a132_0x523ea3(0x222),'hidden':!![]},{'name':'force','meowKey':a132_0x523ea3(0x1dd),'type':a132_0x523ea3(0x1db),'description':a132_0x523ea3(0x227),'hidden':!![]},{'name':a132_0x523ea3(0x201),'meowKey':a132_0x523ea3(0x201),'type':a132_0x523ea3(0x1db),'description':'Confirm\x20destructive\x20action','hidden':!![]},{'name':a132_0x523ea3(0x238),'meowKey':a132_0x523ea3(0x238),'type':'boolean','description':a132_0x523ea3(0x1ef),'hidden':!![]},{'name':a132_0x523ea3(0x233),'meowKey':a132_0x523ea3(0x233),'type':a132_0x523ea3(0x1db),'description':'Verbose\x20output','hidden':!![]},{'name':a132_0x523ea3(0x1fb),'meowKey':a132_0x523ea3(0x23c),'type':a132_0x523ea3(0x1ed),'description':a132_0x523ea3(0x219),'hidden':!![]},{'name':a132_0x523ea3(0x215),'meowKey':a132_0x523ea3(0x205),'type':a132_0x523ea3(0x1ed),'description':a132_0x523ea3(0x1f1),'hidden':!![]},{'name':a132_0x523ea3(0x1da),'meowKey':'functionNode','type':a132_0x523ea3(0x1ed),'description':a132_0x523ea3(0x210),'hidden':!![]}];function a132_0x38b1(_0x454624,_0x4372bd){_0x454624=_0x454624-0x1da;const _0x22e5bb=a132_0x22e5();let _0x38b140=_0x22e5bb[_0x454624];return _0x38b140;}export const PIPELINE_FLAG_NAMES=new Set([a132_0x523ea3(0x1ec),'app','env',a132_0x523ea3(0x21b),'jq',a132_0x523ea3(0x225),a132_0x523ea3(0x23e),a132_0x523ea3(0x216),'ci']);export function buildMeowFlags(){const _0x2dd75f=a132_0x523ea3;return Object['fromEntries'](GLOBAL_FLAGS[_0x2dd75f(0x22b)](_0x2910a5=>[_0x2910a5[_0x2dd75f(0x230)],{'type':_0x2910a5[_0x2dd75f(0x1fc)]}]));}
|
package/lib/constant/defaults.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a133_0xc4e1c6=a133_0x5bab;(function(_0x45b8b6,_0x1b6eba){const _0x584fcf=a133_0x5bab,_0x11be61=_0x45b8b6();while(!![]){try{const _0x107aa8=parseInt(_0x584fcf(0x1d3))/0x1+parseInt(_0x584fcf(0x1d6))/0x2+parseInt(_0x584fcf(0x1cd))/0x3*(-parseInt(_0x584fcf(0x1cf))/0x4)+-parseInt(_0x584fcf(0x1d1))/0x5*(parseInt(_0x584fcf(0x1cc))/0x6)+-parseInt(_0x584fcf(0x1d2))/0x7+parseInt(_0x584fcf(0x1ce))/0x8*(-parseInt(_0x584fcf(0x1cb))/0x9)+parseInt(_0x584fcf(0x1d4))/0xa*(parseInt(_0x584fcf(0x1d0))/0xb);if(_0x107aa8===_0x1b6eba)break;else _0x11be61['push'](_0x11be61['shift']());}catch(_0x19a3ec){_0x11be61['push'](_0x11be61['shift']());}}}(a133_0x5343,0x7d84a));import{DEFAULT_API_DIR}from'../constant/paths.js';function a133_0x5343(){const _0x483eae=['10PvWqOj','compress','1160252ZVjUdu','en-US','production','405639lfJvfl','1422FGSrSz','6rBKsQF','24FoFYSp','1222436Qztene','10382317hIfTLd','6135dpFdMD','4605608rsKaaZ','685323sDDtRf'];a133_0x5343=function(){return _0x483eae;};return a133_0x5343();}export const DEFAULT_CONFIG_VALUES={'env':a133_0xc4e1c6(0x1ca),'format':a133_0xc4e1c6(0x1d5),'locale':a133_0xc4e1c6(0x1d7),'riskLevel':'high-risk-write','apiDir':DEFAULT_API_DIR};function a133_0x5bab(_0x40b5c1,_0x4e504c){_0x40b5c1=_0x40b5c1-0x1ca;const _0x53434a=a133_0x5343();let _0x5baba8=_0x53434a[_0x40b5c1];return _0x5baba8;}export const DEFAULT_COMMAND_OUTPUT_FORMAT=a133_0xc4e1c6(0x1d5);
|
package/lib/constant/domain.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a134_0x3be0df=a134_0x51c8;(function(_0x22c45d,_0x35642d){const _0x24f875=a134_0x51c8,_0x2bdc61=_0x22c45d();while(!![]){try{const _0x1651a5=parseInt(_0x24f875(0x15f))/0x1+parseInt(_0x24f875(0x163))/0x2+-parseInt(_0x24f875(0x159))/0x3*(-parseInt(_0x24f875(0x160))/0x4)+parseInt(_0x24f875(0x164))/0x5*(-parseInt(_0x24f875(0x162))/0x6)+parseInt(_0x24f875(0x15a))/0x7*(-parseInt(_0x24f875(0x161))/0x8)+parseInt(_0x24f875(0x165))/0x9+-parseInt(_0x24f875(0x166))/0xa*(parseInt(_0x24f875(0x169))/0xb);if(_0x1651a5===_0x35642d)break;else _0x2bdc61['push'](_0x2bdc61['shift']());}catch(_0x307829){_0x2bdc61['push'](_0x2bdc61['shift']());}}}(a134_0x4acd,0x5bf32));function a134_0x4acd(){const _0x28cd41=['5405121tOMEQc','7112770aNRGEU','apiDomain','https://api.lovrabet.com','11oIeZWJ','3qwLgbJ','616YVGejo','runtimeDomain','https://user.lovrabet.com','https://daily-api.lovrabet.com','https://user-daily.lovrabet.com','593238SLZpFH','2842296DgjNwh','12832LyVBkY','48uKyFRW','25380LdWZar','430010PVWvWq'];a134_0x4acd=function(){return _0x28cd41;};return a134_0x4acd();}import{getEnv,isProduction}from'../constant/env.js';let customApiDomain,customUserDomain,customRuntimeDomain;export function initDomains(_0x33738d){const _0x23c824=a134_0x51c8;customApiDomain=_0x33738d?.[_0x23c824(0x167)],customUserDomain=_0x33738d?.['userDomain'],customRuntimeDomain=_0x33738d?.[_0x23c824(0x15b)];}export const getUserDomain=()=>customUserDomain||(isProduction(getEnv())?a134_0x3be0df(0x15c):a134_0x3be0df(0x15e));export const getApiDomain=()=>customApiDomain||(isProduction(getEnv())?a134_0x3be0df(0x168):a134_0x3be0df(0x15d));function a134_0x51c8(_0x2e7dfa,_0x17e394){_0x2e7dfa=_0x2e7dfa-0x159;const _0x4acdca=a134_0x4acd();let _0x51c8f6=_0x4acdca[_0x2e7dfa];return _0x51c8f6;}export const getRuntimeDomain=()=>customRuntimeDomain||(isProduction(getEnv())?'https://runtime.lovrabet.com':'https://daily-runtime.lovrabet.com');
|
package/lib/constant/env.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a135_0x1eabf3=a135_0x2869;(function(_0x17f2f5,_0x861a44){const _0x1176df=a135_0x2869,_0x470d0c=_0x17f2f5();while(!![]){try{const _0x50dcbe=-parseInt(_0x1176df(0x160))/0x1+parseInt(_0x1176df(0x15e))/0x2+parseInt(_0x1176df(0x15c))/0x3+parseInt(_0x1176df(0x158))/0x4+parseInt(_0x1176df(0x159))/0x5+-parseInt(_0x1176df(0x161))/0x6+-parseInt(_0x1176df(0x157))/0x7*(parseInt(_0x1176df(0x15d))/0x8);if(_0x50dcbe===_0x861a44)break;else _0x470d0c['push'](_0x470d0c['shift']());}catch(_0x2d0b32){_0x470d0c['push'](_0x470d0c['shift']());}}}(a135_0x36dc,0xc313d));export const RABETBASE_ENV_VALUES=['production',a135_0x1eabf3(0x15a)];export function normalizeEnv(_0x18c8f8){const _0x2f1835=a135_0x1eabf3;return _0x18c8f8==='online'?_0x2f1835(0x15b):_0x18c8f8;}export function isProduction(_0x1d82eb){const _0xf3e56a=a135_0x1eabf3;return normalizeEnv(_0x1d82eb)===_0xf3e56a(0x15b);}export function isDaily(_0x137bba){const _0x248b22=a135_0x1eabf3;return normalizeEnv(_0x137bba)===_0x248b22(0x15a);}function a135_0x2869(_0xea599c,_0x3a08f2){_0xea599c=_0xea599c-0x157;const _0x36dc12=a135_0x36dc();let _0x2869d1=_0x36dc12[_0xea599c];return _0x2869d1;}export function isDev(_0x365e2a){const _0x5ea987=a135_0x1eabf3,_0x4f54fa=normalizeEnv(_0x365e2a);return _0x4f54fa===_0x5ea987(0x15f)||_0x4f54fa==='dev';}function a135_0x36dc(){const _0x3af5ef=['daily','production','3821430dhHSfi','1456opkwek','330204pbGiow','development','1188255aqmsJl','8884962QSiNBE','7154iLAYIg','4720208zlvUpc','5175795ZucOIo'];a135_0x36dc=function(){return _0x3af5ef;};return a135_0x36dc();}let env=normalizeEnv(process.env.RABETBASE_ENV||process.env.LOVRABET_ENV||a135_0x1eabf3(0x15b));export function getEnv(){return env;}export function initEnv(_0xf05fe8){env=normalizeEnv(_0xf05fe8);}
|
package/lib/constant/output.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a136_0x1f11cc=a136_0x39e7;(function(_0x2e09af,_0x2a3eb3){const _0x51e7cc=a136_0x39e7,_0x33939b=_0x2e09af();while(!![]){try{const _0x489d65=-parseInt(_0x51e7cc(0xe1))/0x1*(-parseInt(_0x51e7cc(0xde))/0x2)+parseInt(_0x51e7cc(0xe4))/0x3*(-parseInt(_0x51e7cc(0xe2))/0x4)+parseInt(_0x51e7cc(0xe5))/0x5*(parseInt(_0x51e7cc(0xe3))/0x6)+-parseInt(_0x51e7cc(0xda))/0x7+-parseInt(_0x51e7cc(0xdf))/0x8*(-parseInt(_0x51e7cc(0xd9))/0x9)+parseInt(_0x51e7cc(0xe0))/0xa+-parseInt(_0x51e7cc(0xdb))/0xb;if(_0x489d65===_0x2a3eb3)break;else _0x33939b['push'](_0x33939b['shift']());}catch(_0x51dcb7){_0x33939b['push'](_0x33939b['shift']());}}}(a136_0x2aa6,0x47a93));export const RABETBASE_OUTPUT_FORMAT_VALUES=['json',a136_0x1f11cc(0xdd),a136_0x1f11cc(0xdc)];function a136_0x39e7(_0x2b94d4,_0x1daf42){_0x2b94d4=_0x2b94d4-0xd9;const _0x2aa656=a136_0x2aa6();let _0x39e74d=_0x2aa656[_0x2b94d4];return _0x39e74d;}function a136_0x2aa6(){const _0x884655=['1080FFHzKP','63qphcmV','2674763OkkhOM','2119997vIylnF','compress','pretty','20334TQqNRl','634864Tdgehq','3941320nWKEmi','1zJXuWc','539816rQzmHh','8706wWQZER','9ANpNfH'];a136_0x2aa6=function(){return _0x884655;};return a136_0x2aa6();}
|
package/lib/constant/paths.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a137_0x6ff6f9=a137_0x4c37;(function(_0x2f3b62,_0x72ff19){const _0x3119b8=a137_0x4c37,_0x1bc299=_0x2f3b62();while(!![]){try{const _0x148e63=parseInt(_0x3119b8(0x7a))/0x1+-parseInt(_0x3119b8(0x77))/0x2+parseInt(_0x3119b8(0x7b))/0x3*(parseInt(_0x3119b8(0x7c))/0x4)+-parseInt(_0x3119b8(0x75))/0x5+parseInt(_0x3119b8(0x73))/0x6+-parseInt(_0x3119b8(0x78))/0x7*(-parseInt(_0x3119b8(0x74))/0x8)+-parseInt(_0x3119b8(0x76))/0x9;if(_0x148e63===_0x72ff19)break;else _0x1bc299['push'](_0x1bc299['shift']());}catch(_0x2068c7){_0x1bc299['push'](_0x1bc299['shift']());}}}(a137_0x2b3f,0x842fc));function a137_0x2b3f(){const _0x488180=['688454NhifEx','48gcMhGl','238060QciYwd','1417206BqBJhb','2121168YjiBAq','4470090QsyzZu','10569870hfCoKj','124898UXKhdf','21CSepxH','./src/api'];a137_0x2b3f=function(){return _0x488180;};return a137_0x2b3f();}function a137_0x4c37(_0x4b6dca,_0x2de1f3){_0x4b6dca=_0x4b6dca-0x73;const _0x2b3fcb=a137_0x2b3f();let _0x4c370f=_0x2b3fcb[_0x4b6dca];return _0x4c370f;}export const DEFAULT_API_DIR=a137_0x6ff6f9(0x79);
|