@lovrabet/rabetbase-cli 2.2.4-beta.1 → 2.2.4-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/extend-update.js +1 -1
- package/lib/commands/dataset/field-update.js +1 -1
- package/lib/commands/dataset/index.js +1 -1
- package/lib/commands/dataset/list.js +1 -1
- package/lib/commands/dataset/operations.js +1 -1
- package/lib/commands/dataset/relation-create.js +1 -1
- package/lib/commands/dataset/relation-delete.js +1 -1
- package/lib/commands/dataset/relation-shared.js +1 -1
- package/lib/commands/dataset/relation-update.js +1 -1
- package/lib/commands/dataset/relations.js +1 -1
- package/lib/commands/dataset/rename.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 -1
- package/lib/commands/issue/report.js +1 -1
- package/lib/commands/issue/shared.js +1 -1
- package/lib/commands/logs/index.js +1 -1
- package/lib/commands/menu/index.js +1 -1
- package/lib/commands/menu/list.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/relation-audit.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/update-notice.js +1 -1
- package/lib/utils/version.js +1 -1
- package/lib/utils/with-active-cookie.js +1 -1
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x177bb2,_0x6b0328){const _0x3e40ef=a126_0x566c,_0x3ca309=_0x177bb2();while(!![]){try{const _0x36b44a=-parseInt(_0x3e40ef(0xd0))/0x1*(parseInt(_0x3e40ef(0xcf))/0x2)+-parseInt(_0x3e40ef(0xd2))/0x3*(parseInt(_0x3e40ef(0xd4))/0x4)+parseInt(_0x3e40ef(0xd1))/0x5*(parseInt(_0x3e40ef(0xd7))/0x6)+parseInt(_0x3e40ef(0xd6))/0x7*(parseInt(_0x3e40ef(0xd3))/0x8)+parseInt(_0x3e40ef(0xd5))/0x9+parseInt(_0x3e40ef(0xce))/0xa+-parseInt(_0x3e40ef(0xcd))/0xb*(parseInt(_0x3e40ef(0xd8))/0xc);if(_0x36b44a===_0x6b0328)break;else _0x3ca309['push'](_0x3ca309['shift']());}catch(_0x327796){_0x3ca309['push'](_0x3ca309['shift']());}}}(a126_0x2ebc,0x97f68));function a126_0x2ebc(){const _0x12d9af=['745296AiiquP','1672eEirgY','5360463OjEeOV','7fxghMK','5537076INbJvH','4708164gkiWEu','44gaBRDc','10364350zBeeEu','736rqlPlI','523PTNYaR','5usRJWE','1893mDZrvL'];a126_0x2ebc=function(){return _0x12d9af;};return a126_0x2ebc();}import{sqlList}from'../../commands/sql/list.js';function a126_0x566c(_0x37a8ab,_0x8a5720){_0x37a8ab=_0x37a8ab-0xcd;const _0x2ebc80=a126_0x2ebc();let _0x566c27=_0x2ebc80[_0x37a8ab];return _0x566c27;}import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';import{sqlSave}from'../../commands/sql/save.js';import{sqlExec}from'../../commands/sql/exec.js';import{sqlPull}from'../../commands/sql/pull.js';import{sqlCreate}from'../../commands/sql/create.js';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
|
+
const a127_0x221d5b=a127_0x1016;function a127_0x1016(_0x7f3506,_0x49ae60){_0x7f3506=_0x7f3506-0x1f2;const _0x32dd23=a127_0x32dd();let _0x101673=_0x32dd23[_0x7f3506];return _0x101673;}(function(_0x4b8a7c,_0xdd3ed3){const _0x31657b=a127_0x1016,_0x3e4380=_0x4b8a7c();while(!![]){try{const _0x520e7c=-parseInt(_0x31657b(0x1f6))/0x1*(-parseInt(_0x31657b(0x1f4))/0x2)+-parseInt(_0x31657b(0x202))/0x3*(-parseInt(_0x31657b(0x1fa))/0x4)+-parseInt(_0x31657b(0x206))/0x5*(-parseInt(_0x31657b(0x20b))/0x6)+parseInt(_0x31657b(0x209))/0x7+parseInt(_0x31657b(0x207))/0x8+parseInt(_0x31657b(0x1fd))/0x9+-parseInt(_0x31657b(0x208))/0xa;if(_0x520e7c===_0xdd3ed3)break;else _0x3e4380['push'](_0x3e4380['shift']());}catch(_0x36a0a3){_0x3e4380['push'](_0x3e4380['shift']());}}}(a127_0x32dd,0x2dcda));import{listSqlQueries}from'../../core/api-client.js';function a127_0x32dd(){const _0x4c45a8=['name','number','56226hfIttT','sqlCode','num','list','1379630BdMnrb','200136RmfJEU','6424010hykewr','2034662tuhTkX','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','6tCmhUY','sqlcode','paging','totalCount','length','bool','appCode','4BfPhwD','dbId','70754IEcpfU','No\x20custom\x20SQL\x20queries\x20found.','map','sql','4WJLnDZ','description','page','703368MRzFsW','str','all'];a127_0x32dd=function(){return _0x4c45a8;};return a127_0x32dd();}import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':a127_0x221d5b(0x1f9),'command':a127_0x221d5b(0x205),'description':'List\x20custom\x20SQL\x20queries','risk':'read','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a127_0x221d5b(0x200),'type':'string','description':'Filter\x20by\x20SQL\x20name'},{'name':a127_0x221d5b(0x1fc),'type':a127_0x221d5b(0x201),'description':'Page\x20number','default':0x1},{'name':'pagesize','type':a127_0x221d5b(0x201),'description':'Page\x20size'},{'name':'verbose','type':'boolean','description':a127_0x221d5b(0x20a)}],async 'execute'(_0x53b7f1){const _0x1a9a84=a127_0x221d5b,_0x23ea9f=await listSqlQueries(_0x53b7f1[_0x1a9a84(0x1f3)],{'sqlCode':_0x53b7f1[_0x1a9a84(0x1fe)](_0x1a9a84(0x20c))||undefined,'sqlName':_0x53b7f1[_0x1a9a84(0x1fe)](_0x1a9a84(0x200))||undefined,'currentPage':_0x53b7f1['num'](_0x1a9a84(0x1fc)),'pageSize':_0x53b7f1[_0x1a9a84(0x204)]('pagesize',0x32)}),_0x145a2f=_0x53b7f1[_0x1a9a84(0x1f2)]('verbose'),_0x1f3547=_0x23ea9f['tableData']??[],_0x3b29dc=_0x23ea9f[_0x1a9a84(0x20d)]?.[_0x1a9a84(0x20e)]??_0x1f3547[_0x1a9a84(0x20f)];let _0x1cf9c7;return _0x145a2f?_0x1cf9c7=_0x1f3547:_0x1cf9c7=await Promise[_0x1a9a84(0x1ff)](_0x1f3547[_0x1a9a84(0x1f8)](async _0x4a565c=>{const _0x59d2f5=_0x1a9a84;let _0x1ff6c9;try{_0x1ff6c9=_0x4a565c[_0x59d2f5(0x1f5)]?await getDbName(_0x53b7f1['appCode'],_0x4a565c[_0x59d2f5(0x1f5)]):undefined;}catch{}return{'sqlCode':_0x4a565c[_0x59d2f5(0x203)],'sqlName':_0x4a565c['sqlName'],'description':_0x4a565c[_0x59d2f5(0x1fb)]??'','db':_0x1ff6c9?_0x1ff6c9+'\x20('+_0x4a565c[_0x59d2f5(0x1f5)]+')':_0x4a565c[_0x59d2f5(0x1f5)]??''};})),{'ok':!![],'data':_0x1cf9c7,'message':_0x1f3547[_0x1a9a84(0x20f)]===0x0?_0x1a9a84(0x1f7):'Found\x20'+_0x1f3547[_0x1a9a84(0x20f)]+'\x20SQL\x20queries\x20(total:\x20'+_0x3b29dc+').'};}};
|
package/lib/commands/sql/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a128_0x1979bd=a128_0x5a49;(function(_0x31516e,_0x40a779){const _0x5b9f0c=a128_0x5a49,_0x1ed127=_0x31516e();while(!![]){try{const _0x4fca86=parseInt(_0x5b9f0c(0xd1))/0x1+-parseInt(_0x5b9f0c(0xce))/0x2*(parseInt(_0x5b9f0c(0xb7))/0x3)+-parseInt(_0x5b9f0c(0xb6))/0x4*(parseInt(_0x5b9f0c(0xe8))/0x5)+parseInt(_0x5b9f0c(0xc1))/0x6+-parseInt(_0x5b9f0c(0xdf))/0x7*(-parseInt(_0x5b9f0c(0xbf))/0x8)+parseInt(_0x5b9f0c(0xbd))/0x9+parseInt(_0x5b9f0c(0xc8))/0xa*(-parseInt(_0x5b9f0c(0xc2))/0xb);if(_0x4fca86===_0x40a779)break;else _0x1ed127['push'](_0x1ed127['shift']());}catch(_0x391e64){_0x1ed127['push'](_0x1ed127['shift']());}}}(a128_0xb4a8,0xe57ac));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';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';function a128_0xb4a8(){const _0x29aca8=['POST','local\x20differs\x20from\x20remote','Filter\x20by\x20SQL\x20display\x20name','test','replace','sqlcode','167655HwHvra','Would\x20pull\x20','toISOString','tableData','description','appCode','apps','sql','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','lockFilePath','bool','108wTNjtY','1227sdCQjX','\x20written,\x20','boolean','totalCount','message','\x20failed','12474297YCNGeh','unchanged','695016VmTnGW','dbId','3373374hTSgpm','33473SaSknu','name','mybatisXml','sqlCode','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','length','1140MaJtZt','sqlRootDir','cancelled','join','sqlContent','str','7484qRhJjN','push','conflict','297494mxMJjy','sqls','Force\x20overwrite\x20local\x20unsynced\x20changes','sqlName','filter','skipped','path','utf8','paging','pull','sqlRoot','catch','\x20SQL\x20file(s)\x20into\x20','lastSync','119ACyyOj','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','force'];a128_0xb4a8=function(){return _0x29aca8;};return a128_0xb4a8();}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(_0x2b7c0d,_0x92074e){const _0x52cb92=a128_0x5a49,_0x466fc8=[];let _0x10be0c=0x1;while(!![]){const _0x479db4=await listSqlQueries(_0x2b7c0d,{'currentPage':_0x10be0c,'pageSize':PAGE_SIZE,'sqlCode':_0x92074e[_0x52cb92(0xc5)],'sqlName':_0x92074e[_0x52cb92(0xd4)]}),_0x309426=_0x479db4[_0x52cb92(0xae)]??[];_0x466fc8[_0x52cb92(0xcf)](..._0x309426);if(_0x309426[_0x52cb92(0xc7)]===0x0)break;const _0x362c78=_0x479db4[_0x52cb92(0xd9)]?.[_0x52cb92(0xba)];if(_0x362c78!=null?_0x466fc8[_0x52cb92(0xc7)]>=_0x362c78:_0x309426[_0x52cb92(0xc7)]<PAGE_SIZE)break;_0x10be0c++;}return _0x466fc8;}async function ensureSqlContent(_0x420bbf){const _0x5965cd=a128_0x5a49;if(_0x420bbf[_0x5965cd(0xcc)]!=null&&String(_0x420bbf['sqlContent'])[_0x5965cd(0xc7)]>0x0)return _0x420bbf;return getSqlQueryDetail(_0x420bbf[_0x5965cd(0xc5)]);}export const sqlPull={'service':'sql','command':a128_0x1979bd(0xda),'description':a128_0x1979bd(0xe0),'risk':'write','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a128_0x1979bd(0xc3),'type':'string','description':a128_0x1979bd(0xe4)},{'name':a128_0x1979bd(0xe1),'type':a128_0x1979bd(0xb9),'description':a128_0x1979bd(0xd3)}],async 'dryRun'(_0x3353b5){const _0x4e5bba=a128_0x1979bd,_0x5c5aaf=loadSqlProjectConfig(_0x3353b5[_0x4e5bba(0xb0)]),_0x2ecbae=await readSqlLockFile(_0x5c5aaf[_0x4e5bba(0xb4)]),{appLock:_0x44de77}=ensureSqlLockScope(_0x2ecbae??createEmptySqlLock(),_0x5c5aaf[_0x4e5bba(0xb0)],_0x5c5aaf[_0x4e5bba(0xdb)],_0x4e5bba(0xda)),_0x1ee8dd=await fetchAllSqlQueries(_0x3353b5[_0x4e5bba(0xb0)],{'sqlCode':_0x3353b5[_0x4e5bba(0xcd)](_0x4e5bba(0xe7))||undefined,'sqlName':_0x3353b5[_0x4e5bba(0xcd)](_0x4e5bba(0xc3))||undefined}),_0x29ae9a=[];for(const _0x4c13da of _0x1ee8dd){const _0xe8bd0d=await ensureSqlContent(_0x4c13da),_0x4c5a80=ensureRemoteSqlContent(_0xe8bd0d),_0x319e67=detectModeFromSql(_0xe8bd0d),_0x2e8008=_0xe8bd0d['dbId']?await getDbName(_0x3353b5[_0x4e5bba(0xb0)],Number(_0xe8bd0d[_0x4e5bba(0xc0)]))[_0x4e5bba(0xdc)](()=>undefined):undefined,_0x386e68=buildLocalSqlFileContent({'sqlCode':_0xe8bd0d[_0x4e5bba(0xc5)],'sqlName':_0xe8bd0d[_0x4e5bba(0xd4)],'dbId':_0xe8bd0d[_0x4e5bba(0xc0)]},_0x4c5a80,{'dbName':_0x2e8008,'mode':_0x319e67,'syncedAt':new Date()[_0x4e5bba(0xad)](),'description':_0xe8bd0d['description']}),_0x32e824=buildSqlLockEntry(_0xe8bd0d,_0x4c5a80,'',{'dbName':_0x2e8008}),_0x21cbec=resolveLocalSqlFilePath(_0x5c5aaf,_0xe8bd0d[_0x4e5bba(0xc5)],_0x32e824);let _0x456292='would_pull',_0x2c4fb7;if(await fileExists(_0x21cbec)){const _0x1f8e8b=await readFile(_0x21cbec,_0x4e5bba(0xd8));isEquivalentPulledSqlFile(_0x1f8e8b,_0x386e68,_0x319e67)?(_0x456292=_0x4e5bba(0xd6),_0x2c4fb7='unchanged'):(_0x456292=_0x4e5bba(0xd0),_0x2c4fb7=_0x4e5bba(0xc6));}_0x29ae9a[_0x4e5bba(0xcf)]({'sqlCode':_0xe8bd0d['sqlCode'],'sqlName':_0xe8bd0d[_0x4e5bba(0xd4)],'filePath':_0x21cbec,'status':_0x456292,'reason':_0x2c4fb7});}return{'method':_0x4e5bba(0xe2),'url':'/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','body':{'appCode':_0x3353b5['appCode'],'sqlCode':_0x3353b5['str'](_0x4e5bba(0xe7))||null,'sqlName':_0x3353b5[_0x4e5bba(0xcd)](_0x4e5bba(0xc3))||null,'files':_0x29ae9a},'description':_0x4e5bba(0xe9)+_0x29ae9a[_0x4e5bba(0xc7)]+_0x4e5bba(0xdd)+_0x5c5aaf[_0x4e5bba(0xc9)]};},async 'execute'(_0x15048a){const _0x1e2dbf=a128_0x1979bd,_0x41087c=loadSqlProjectConfig(_0x15048a[_0x1e2dbf(0xb0)]),_0x393327=await readSqlLockFile(_0x41087c['lockFilePath']),{lockData:_0x4d4c91,appLock:_0x465db1}=ensureSqlLockScope(_0x393327??createEmptySqlLock(),_0x41087c[_0x1e2dbf(0xb0)],_0x41087c['sqlRoot'],'pull'),_0x134405=_0x15048a[_0x1e2dbf(0xb5)](_0x1e2dbf(0xe1)),_0x49756c=await fetchAllSqlQueries(_0x15048a[_0x1e2dbf(0xb0)],{'sqlCode':_0x15048a['str'](_0x1e2dbf(0xe7))||undefined,'sqlName':_0x15048a['str'](_0x1e2dbf(0xc3))||undefined});if(_0x49756c['length']===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':'No\x20remote\x20SQL\x20queries\x20matched.'};const _0x397a5a=[],_0x4336a9=[];for(const _0x52b742 of _0x49756c){try{_0x397a5a[_0x1e2dbf(0xcf)](await ensureSqlContent(_0x52b742));}catch(_0x1a6b0f){_0x4336a9['push']({'sqlCode':_0x52b742['sqlCode'],'error':_0x1a6b0f instanceof Error?_0x1a6b0f[_0x1e2dbf(0xbb)]:String(_0x1a6b0f)});}}if(_0x134405&&!_0x15048a['nonInteractive']){let _0x571098=![];for(const _0x1f5e12 of _0x397a5a){const _0x22da93=detectModeFromSql(_0x1f5e12),_0x5a718c=_0x1f5e12[_0x1e2dbf(0xc0)]?await getDbName(_0x15048a[_0x1e2dbf(0xb0)],Number(_0x1f5e12[_0x1e2dbf(0xc0)]))[_0x1e2dbf(0xdc)](()=>undefined):undefined,_0xdada8a=buildLocalSqlFileContent({'sqlCode':_0x1f5e12[_0x1e2dbf(0xc5)],'sqlName':_0x1f5e12['sqlName'],'dbId':_0x1f5e12[_0x1e2dbf(0xc0)]},ensureRemoteSqlContent(_0x1f5e12),{'dbName':_0x5a718c,'mode':_0x22da93,'syncedAt':new Date()['toISOString'](),'description':_0x1f5e12[_0x1e2dbf(0xaf)]}),_0x178c6a=resolveLocalSqlFilePath(_0x41087c,_0x1f5e12['sqlCode'],buildSqlLockEntry(_0x1f5e12,ensureRemoteSqlContent(_0x1f5e12),'',{'dbName':_0x5a718c}));if(await fileExists(_0x178c6a)){const _0x3fa328=await readFile(_0x178c6a,_0x1e2dbf(0xd8));if(!isEquivalentPulledSqlFile(_0x3fa328,_0xdada8a,_0x22da93)){_0x571098=!![];break;}}}if(_0x571098){const _0x5452f5=await confirmForceOverwrite(_0x1e2dbf(0xb3));if(!_0x5452f5)throw CliErrors[_0x1e2dbf(0xca)]('Force\x20pull\x20cancelled.');}}const _0x4df837=cloneSqlLockData(_0x4d4c91),_0x36304d=_0x4df837[_0x1e2dbf(0xb1)][_0x41087c['appCode']],_0x1cf22f=[],_0x2fd8b9=[];for(const _0x5f5c3c of _0x397a5a){const _0x3766bd=_0x36304d[_0x1e2dbf(0xd2)][_0x5f5c3c[_0x1e2dbf(0xc5)]],_0x3633b7=ensureRemoteSqlContent(_0x5f5c3c),_0x598119=detectModeFromSql(_0x5f5c3c),_0x3541d2=_0x5f5c3c[_0x1e2dbf(0xc0)]?await getDbName(_0x15048a[_0x1e2dbf(0xb0)],Number(_0x5f5c3c[_0x1e2dbf(0xc0)]))[_0x1e2dbf(0xdc)](()=>undefined):undefined,_0x13f049=buildLocalSqlFileContent({'sqlCode':_0x5f5c3c[_0x1e2dbf(0xc5)],'sqlName':_0x5f5c3c[_0x1e2dbf(0xd4)],'dbId':_0x5f5c3c['dbId']},_0x3633b7,{'dbName':_0x3541d2,'mode':_0x598119,'syncedAt':new Date()['toISOString'](),'description':_0x5f5c3c[_0x1e2dbf(0xaf)]}),_0x3a1edb=buildSqlLockEntry(_0x5f5c3c,_0x3633b7,computeSqlContentHash(_0x13f049),{'dbName':_0x3541d2}),_0x27af03=_0x3a1edb['path'],_0x40ec4e=join(_0x41087c[_0x1e2dbf(0xc9)],_0x27af03);try{if(await fileExists(_0x40ec4e)){const _0x60da38=await readFile(_0x40ec4e,'utf8');if(isEquivalentPulledSqlFile(_0x60da38,_0x13f049,_0x598119)){_0x2fd8b9[_0x1e2dbf(0xcf)]({'sqlCode':_0x5f5c3c['sqlCode'],'reason':_0x1e2dbf(0xbe)}),_0x36304d[_0x1e2dbf(0xd2)][_0x5f5c3c[_0x1e2dbf(0xc5)]]={..._0x3a1edb,'hash':computeSqlContentHash(_0x60da38),'path':_0x27af03};continue;}if(!_0x134405){_0x2fd8b9[_0x1e2dbf(0xcf)]({'sqlCode':_0x5f5c3c['sqlCode'],'reason':_0x1e2dbf(0xe3)});continue;}}const _0x1e6af9=_0x3766bd?.[_0x1e2dbf(0xd7)]?join(_0x41087c[_0x1e2dbf(0xc9)],_0x3766bd[_0x1e2dbf(0xd7)]):undefined;_0x1e6af9&&_0x1e6af9!==_0x40ec4e&&await fileExists(_0x1e6af9)&&await rm(_0x1e6af9,{'force':!![]}),await ensureParentDirectory(_0x40ec4e),await writeFile(_0x40ec4e,_0x13f049,_0x1e2dbf(0xd8)),_0x36304d[_0x1e2dbf(0xd2)][_0x5f5c3c[_0x1e2dbf(0xc5)]]={..._0x3a1edb,'path':_0x27af03},_0x1cf22f[_0x1e2dbf(0xcf)]({'sqlCode':_0x5f5c3c[_0x1e2dbf(0xc5)],'filePath':_0x40ec4e});}catch(_0x29b025){_0x4336a9['push']({'sqlCode':_0x5f5c3c[_0x1e2dbf(0xc5)],'error':_0x29b025 instanceof Error?_0x29b025[_0x1e2dbf(0xbb)]:String(_0x29b025)});}}return _0x36304d[_0x1e2dbf(0xde)]=new Date()[_0x1e2dbf(0xad)](),await writeSqlLockFile(_0x41087c['lockFilePath'],_0x4df837),{'ok':_0x4336a9[_0x1e2dbf(0xc7)]===0x0,'data':{'pulled':_0x1cf22f,'skipped':_0x2fd8b9,'failed':_0x4336a9},'message':'Pull\x20complete:\x20'+_0x1cf22f[_0x1e2dbf(0xc7)]+_0x1e2dbf(0xb8)+_0x2fd8b9[_0x1e2dbf(0xc7)]+'\x20skipped,\x20'+_0x4336a9[_0x1e2dbf(0xc7)]+_0x1e2dbf(0xbc)};}};function a128_0x5a49(_0x165701,_0x3069da){_0x165701=_0x165701-0xad;const _0xb4a829=a128_0xb4a8();let _0x5a49aa=_0xb4a829[_0x165701];return _0x5a49aa;}function detectModeFromSql(_0x7888e5){const _0x2ef16b=a128_0x1979bd,_0x104b0b=ensureRemoteSqlContent(_0x7888e5),_0x51b5f4=stripLocalSqlMetadata(_0x104b0b,'mybatisXml')['trimStart']();if(/^<(select|insert|update|delete)\b/i[_0x2ef16b(0xe5)](_0x51b5f4))return _0x2ef16b(0xc4);return _0x2ef16b(0xb2);}function isEquivalentPulledSqlFile(_0x1a3da8,_0x1f5f04,_0x4a2121){return normalizePullComparableContent(_0x1a3da8,_0x4a2121)===normalizePullComparableContent(_0x1f5f04,_0x4a2121);}function normalizePullComparableContent(_0x45c40f,_0x106ddd){const _0xe1c73d=a128_0x1979bd,_0x1ea924=_0x45c40f[_0xe1c73d(0xe6)](/\r\n/g,'\x0a')['split']('\x0a'),_0xe77c51=_0x1ea924[_0xe1c73d(0xd5)](_0x195282=>!isSyncedAtMetadataLine(_0x195282,_0x106ddd));return _0xe77c51[_0xe1c73d(0xcb)]('\x0a');}function isSyncedAtMetadataLine(_0x3bf1ec,_0x2e2c08){const _0x23c249=a128_0x1979bd;if(_0x2e2c08==='mybatisXml')return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x23c249(0xe5)](_0x3bf1ec);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x23c249(0xe5)](_0x3bf1ec);}
|
|
1
|
+
const a128_0x5d1edb=a128_0x2c59;(function(_0xd5bee9,_0x169852){const _0x195fc2=a128_0x2c59,_0x90245a=_0xd5bee9();while(!![]){try{const _0x1e6b1f=-parseInt(_0x195fc2(0x1f3))/0x1*(-parseInt(_0x195fc2(0x204))/0x2)+parseInt(_0x195fc2(0x22b))/0x3+-parseInt(_0x195fc2(0x211))/0x4*(-parseInt(_0x195fc2(0x1f0))/0x5)+-parseInt(_0x195fc2(0x20f))/0x6+parseInt(_0x195fc2(0x221))/0x7+-parseInt(_0x195fc2(0x1f7))/0x8+-parseInt(_0x195fc2(0x22e))/0x9;if(_0x1e6b1f===_0x169852)break;else _0x90245a['push'](_0x90245a['shift']());}catch(_0x543951){_0x90245a['push'](_0x90245a['shift']());}}}(a128_0x3802,0xb14c2));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';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;function a128_0x3802(){const _0x400490=['unchanged','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','\x20SQL\x20file(s)\x20into\x20','appCode','lastSync','sqlRoot','POST','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','name','sql','122SnpkVW','Force\x20pull\x20cancelled.','totalCount','path','tableData','toISOString','utf8','sqlName','message','description','\x20written,\x20','2586114oJDcHT','pull','535140KyGEND','split','bool','sqlcode','write','skipped','lockFilePath','sqlRootDir','str','test','sqlContent','mybatisXml','trimStart','local\x20differs\x20from\x20remote','filter','Filter\x20by\x20SQL\x20display\x20name','5640586KGAmFf','push','sqlCode','paging','No\x20remote\x20SQL\x20queries\x20matched.','Would\x20pull\x20','sqls','Force\x20overwrite\x20local\x20unsynced\x20changes','dbId','would_pull','3393585mweotA','\x20failed','length','15000183bKakqG','catch','nonInteractive','join','15kAUGiW','apps','Pull\x20complete:\x20','8538jTTfUO','force','conflict','string','282000XKQbkP','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)'];a128_0x3802=function(){return _0x400490;};return a128_0x3802();}function a128_0x2c59(_0x5b9415,_0xa9e157){_0x5b9415=_0x5b9415-0x1ef;const _0x38027b=a128_0x3802();let _0x2c591d=_0x38027b[_0x5b9415];return _0x2c591d;}async function fetchAllSqlQueries(_0x424ab9,_0x239867){const _0x1e0ce4=a128_0x2c59,_0x5dcda0=[];let _0x40163c=0x1;while(!![]){const _0x193351=await listSqlQueries(_0x424ab9,{'currentPage':_0x40163c,'pageSize':PAGE_SIZE,'sqlCode':_0x239867['sqlCode'],'sqlName':_0x239867['sqlName']}),_0x194a6d=_0x193351[_0x1e0ce4(0x208)]??[];_0x5dcda0['push'](..._0x194a6d);if(_0x194a6d['length']===0x0)break;const _0x134ce7=_0x193351[_0x1e0ce4(0x224)]?.[_0x1e0ce4(0x206)];if(_0x134ce7!=null?_0x5dcda0[_0x1e0ce4(0x22d)]>=_0x134ce7:_0x194a6d[_0x1e0ce4(0x22d)]<PAGE_SIZE)break;_0x40163c++;}return _0x5dcda0;}async function ensureSqlContent(_0x2a1927){const _0x1931b0=a128_0x2c59;if(_0x2a1927[_0x1931b0(0x21b)]!=null&&String(_0x2a1927[_0x1931b0(0x21b)])['length']>0x0)return _0x2a1927;return getSqlQueryDetail(_0x2a1927[_0x1931b0(0x223)]);}export const sqlPull={'service':a128_0x5d1edb(0x203),'command':a128_0x5d1edb(0x210),'description':a128_0x5d1edb(0x1fb),'risk':a128_0x5d1edb(0x215),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a128_0x5d1edb(0x202),'type':a128_0x5d1edb(0x1f6),'description':a128_0x5d1edb(0x220)},{'name':a128_0x5d1edb(0x1f4),'type':'boolean','description':a128_0x5d1edb(0x228)}],async 'dryRun'(_0x1e4719){const _0xddd9de=a128_0x5d1edb,_0x5dd25c=loadSqlProjectConfig(_0x1e4719[_0xddd9de(0x1fd)]),_0x5ecfa5=await readSqlLockFile(_0x5dd25c[_0xddd9de(0x217)]),{appLock:_0x35585f}=ensureSqlLockScope(_0x5ecfa5??createEmptySqlLock(),_0x5dd25c['appCode'],_0x5dd25c[_0xddd9de(0x1ff)],_0xddd9de(0x210)),_0x5f4604=await fetchAllSqlQueries(_0x1e4719[_0xddd9de(0x1fd)],{'sqlCode':_0x1e4719[_0xddd9de(0x219)](_0xddd9de(0x214))||undefined,'sqlName':_0x1e4719[_0xddd9de(0x219)](_0xddd9de(0x202))||undefined}),_0x4c03d6=[];for(const _0x2e2426 of _0x5f4604){const _0x5ec6b0=await ensureSqlContent(_0x2e2426),_0x7c193f=ensureRemoteSqlContent(_0x5ec6b0),_0x12ffc2=detectModeFromSql(_0x5ec6b0),_0x1a17ab=_0x5ec6b0[_0xddd9de(0x229)]?await getDbName(_0x1e4719[_0xddd9de(0x1fd)],Number(_0x5ec6b0[_0xddd9de(0x229)]))[_0xddd9de(0x22f)](()=>undefined):undefined,_0x226190=buildLocalSqlFileContent({'sqlCode':_0x5ec6b0[_0xddd9de(0x223)],'sqlName':_0x5ec6b0[_0xddd9de(0x20b)],'dbId':_0x5ec6b0[_0xddd9de(0x229)]},_0x7c193f,{'dbName':_0x1a17ab,'mode':_0x12ffc2,'syncedAt':new Date()['toISOString'](),'description':_0x5ec6b0[_0xddd9de(0x20d)]}),_0x2d6432=buildSqlLockEntry(_0x5ec6b0,_0x7c193f,'',{'dbName':_0x1a17ab}),_0x3bceab=resolveLocalSqlFilePath(_0x5dd25c,_0x5ec6b0[_0xddd9de(0x223)],_0x2d6432);let _0x420c02=_0xddd9de(0x22a),_0x10cbfe;if(await fileExists(_0x3bceab)){const _0x1ef6b4=await readFile(_0x3bceab,'utf8');isEquivalentPulledSqlFile(_0x1ef6b4,_0x226190,_0x12ffc2)?(_0x420c02=_0xddd9de(0x216),_0x10cbfe=_0xddd9de(0x1f9)):(_0x420c02=_0xddd9de(0x1f5),_0x10cbfe=_0xddd9de(0x1f8));}_0x4c03d6[_0xddd9de(0x222)]({'sqlCode':_0x5ec6b0[_0xddd9de(0x223)],'sqlName':_0x5ec6b0[_0xddd9de(0x20b)],'filePath':_0x3bceab,'status':_0x420c02,'reason':_0x10cbfe});}return{'method':_0xddd9de(0x200),'url':_0xddd9de(0x201),'body':{'appCode':_0x1e4719[_0xddd9de(0x1fd)],'sqlCode':_0x1e4719[_0xddd9de(0x219)](_0xddd9de(0x214))||null,'sqlName':_0x1e4719[_0xddd9de(0x219)](_0xddd9de(0x202))||null,'files':_0x4c03d6},'description':_0xddd9de(0x226)+_0x4c03d6[_0xddd9de(0x22d)]+_0xddd9de(0x1fc)+_0x5dd25c[_0xddd9de(0x218)]};},async 'execute'(_0x131474){const _0x5f1cf1=a128_0x5d1edb,_0x35f3d5=loadSqlProjectConfig(_0x131474[_0x5f1cf1(0x1fd)]),_0xce58c=await readSqlLockFile(_0x35f3d5[_0x5f1cf1(0x217)]),{lockData:_0x1a683a,appLock:_0x46940d}=ensureSqlLockScope(_0xce58c??createEmptySqlLock(),_0x35f3d5[_0x5f1cf1(0x1fd)],_0x35f3d5[_0x5f1cf1(0x1ff)],_0x5f1cf1(0x210)),_0x17a92d=_0x131474[_0x5f1cf1(0x213)]('force'),_0x43ed89=await fetchAllSqlQueries(_0x131474[_0x5f1cf1(0x1fd)],{'sqlCode':_0x131474[_0x5f1cf1(0x219)](_0x5f1cf1(0x214))||undefined,'sqlName':_0x131474[_0x5f1cf1(0x219)](_0x5f1cf1(0x202))||undefined});if(_0x43ed89['length']===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x5f1cf1(0x225)};const _0x1c5fd8=[],_0x16ba46=[];for(const _0x48f73d of _0x43ed89){try{_0x1c5fd8[_0x5f1cf1(0x222)](await ensureSqlContent(_0x48f73d));}catch(_0x43633d){_0x16ba46[_0x5f1cf1(0x222)]({'sqlCode':_0x48f73d[_0x5f1cf1(0x223)],'error':_0x43633d instanceof Error?_0x43633d[_0x5f1cf1(0x20c)]:String(_0x43633d)});}}if(_0x17a92d&&!_0x131474[_0x5f1cf1(0x230)]){let _0x5a464b=![];for(const _0x54a1b6 of _0x1c5fd8){const _0x5e51e9=detectModeFromSql(_0x54a1b6),_0x3deabd=_0x54a1b6['dbId']?await getDbName(_0x131474[_0x5f1cf1(0x1fd)],Number(_0x54a1b6['dbId']))['catch'](()=>undefined):undefined,_0x205a75=buildLocalSqlFileContent({'sqlCode':_0x54a1b6['sqlCode'],'sqlName':_0x54a1b6['sqlName'],'dbId':_0x54a1b6[_0x5f1cf1(0x229)]},ensureRemoteSqlContent(_0x54a1b6),{'dbName':_0x3deabd,'mode':_0x5e51e9,'syncedAt':new Date()[_0x5f1cf1(0x209)](),'description':_0x54a1b6[_0x5f1cf1(0x20d)]}),_0x31351f=resolveLocalSqlFilePath(_0x35f3d5,_0x54a1b6[_0x5f1cf1(0x223)],buildSqlLockEntry(_0x54a1b6,ensureRemoteSqlContent(_0x54a1b6),'',{'dbName':_0x3deabd}));if(await fileExists(_0x31351f)){const _0x1a4c60=await readFile(_0x31351f,'utf8');if(!isEquivalentPulledSqlFile(_0x1a4c60,_0x205a75,_0x5e51e9)){_0x5a464b=!![];break;}}}if(_0x5a464b){const _0x319a32=await confirmForceOverwrite(_0x5f1cf1(0x1fa));if(!_0x319a32)throw CliErrors['cancelled'](_0x5f1cf1(0x205));}}const _0x33f5e0=cloneSqlLockData(_0x1a683a),_0x27ad73=_0x33f5e0[_0x5f1cf1(0x1f1)][_0x35f3d5[_0x5f1cf1(0x1fd)]],_0x519a6a=[],_0xe8eaf9=[];for(const _0x34d5d2 of _0x1c5fd8){const _0x3bffb5=_0x27ad73['sqls'][_0x34d5d2['sqlCode']],_0x2b49b6=ensureRemoteSqlContent(_0x34d5d2),_0x3556f2=detectModeFromSql(_0x34d5d2),_0x13dcac=_0x34d5d2[_0x5f1cf1(0x229)]?await getDbName(_0x131474['appCode'],Number(_0x34d5d2[_0x5f1cf1(0x229)]))[_0x5f1cf1(0x22f)](()=>undefined):undefined,_0x1fd6c0=buildLocalSqlFileContent({'sqlCode':_0x34d5d2['sqlCode'],'sqlName':_0x34d5d2[_0x5f1cf1(0x20b)],'dbId':_0x34d5d2[_0x5f1cf1(0x229)]},_0x2b49b6,{'dbName':_0x13dcac,'mode':_0x3556f2,'syncedAt':new Date()[_0x5f1cf1(0x209)](),'description':_0x34d5d2[_0x5f1cf1(0x20d)]}),_0x172b11=buildSqlLockEntry(_0x34d5d2,_0x2b49b6,computeSqlContentHash(_0x1fd6c0),{'dbName':_0x13dcac}),_0x22b926=_0x172b11[_0x5f1cf1(0x207)],_0x359ec0=join(_0x35f3d5[_0x5f1cf1(0x218)],_0x22b926);try{if(await fileExists(_0x359ec0)){const _0x218a54=await readFile(_0x359ec0,_0x5f1cf1(0x20a));if(isEquivalentPulledSqlFile(_0x218a54,_0x1fd6c0,_0x3556f2)){_0xe8eaf9[_0x5f1cf1(0x222)]({'sqlCode':_0x34d5d2[_0x5f1cf1(0x223)],'reason':'unchanged'}),_0x27ad73[_0x5f1cf1(0x227)][_0x34d5d2[_0x5f1cf1(0x223)]]={..._0x172b11,'hash':computeSqlContentHash(_0x218a54),'path':_0x22b926};continue;}if(!_0x17a92d){_0xe8eaf9[_0x5f1cf1(0x222)]({'sqlCode':_0x34d5d2[_0x5f1cf1(0x223)],'reason':_0x5f1cf1(0x21e)});continue;}}const _0x1ae123=_0x3bffb5?.[_0x5f1cf1(0x207)]?join(_0x35f3d5['sqlRootDir'],_0x3bffb5[_0x5f1cf1(0x207)]):undefined;_0x1ae123&&_0x1ae123!==_0x359ec0&&await fileExists(_0x1ae123)&&await rm(_0x1ae123,{'force':!![]}),await ensureParentDirectory(_0x359ec0),await writeFile(_0x359ec0,_0x1fd6c0,_0x5f1cf1(0x20a)),_0x27ad73[_0x5f1cf1(0x227)][_0x34d5d2['sqlCode']]={..._0x172b11,'path':_0x22b926},_0x519a6a[_0x5f1cf1(0x222)]({'sqlCode':_0x34d5d2[_0x5f1cf1(0x223)],'filePath':_0x359ec0});}catch(_0x9eb56f){_0x16ba46['push']({'sqlCode':_0x34d5d2['sqlCode'],'error':_0x9eb56f instanceof Error?_0x9eb56f[_0x5f1cf1(0x20c)]:String(_0x9eb56f)});}}return _0x27ad73[_0x5f1cf1(0x1fe)]=new Date()[_0x5f1cf1(0x209)](),await writeSqlLockFile(_0x35f3d5['lockFilePath'],_0x33f5e0),{'ok':_0x16ba46[_0x5f1cf1(0x22d)]===0x0,'data':{'pulled':_0x519a6a,'skipped':_0xe8eaf9,'failed':_0x16ba46},'message':_0x5f1cf1(0x1f2)+_0x519a6a['length']+_0x5f1cf1(0x20e)+_0xe8eaf9[_0x5f1cf1(0x22d)]+'\x20skipped,\x20'+_0x16ba46['length']+_0x5f1cf1(0x22c)};}};function detectModeFromSql(_0x1758f7){const _0xb87dc6=a128_0x5d1edb,_0x54ea88=ensureRemoteSqlContent(_0x1758f7),_0x562f92=stripLocalSqlMetadata(_0x54ea88,_0xb87dc6(0x21c))[_0xb87dc6(0x21d)]();if(/^<(select|insert|update|delete)\b/i[_0xb87dc6(0x21a)](_0x562f92))return _0xb87dc6(0x21c);return'sql';}function isEquivalentPulledSqlFile(_0x27099f,_0x3530f6,_0x23f242){return normalizePullComparableContent(_0x27099f,_0x23f242)===normalizePullComparableContent(_0x3530f6,_0x23f242);}function normalizePullComparableContent(_0x56f27d,_0x30bdad){const _0x23bdab=a128_0x5d1edb,_0x552274=_0x56f27d['replace'](/\r\n/g,'\x0a')[_0x23bdab(0x212)]('\x0a'),_0x38c4df=_0x552274[_0x23bdab(0x21f)](_0x2b3f45=>!isSyncedAtMetadataLine(_0x2b3f45,_0x30bdad));return _0x38c4df[_0x23bdab(0x1ef)]('\x0a');}function isSyncedAtMetadataLine(_0x115ae1,_0x12cd26){const _0x3fbf0d=a128_0x5d1edb;if(_0x12cd26===_0x3fbf0d(0x21c))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x3fbf0d(0x21a)](_0x115ae1);return/^\s*--\s*@lovrabet\.syncedAt:/['test'](_0x115ae1);}
|
package/lib/commands/sql/push.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a129_0x50ca10=a129_0x739b;(function(_0x2fa844,_0x57650b){const _0x47126c=a129_0x739b,_0xc520=_0x2fa844();while(!![]){try{const _0x174aa6=parseInt(_0x47126c(0x17c))/0x1+parseInt(_0x47126c(0x1b0))/0x2+parseInt(_0x47126c(0x175))/0x3*(parseInt(_0x47126c(0x19f))/0x4)+-parseInt(_0x47126c(0x1a0))/0x5*(-parseInt(_0x47126c(0x173))/0x6)+-parseInt(_0x47126c(0x1a8))/0x7*(parseInt(_0x47126c(0x18e))/0x8)+parseInt(_0x47126c(0x19c))/0x9+-parseInt(_0x47126c(0x177))/0xa;if(_0x174aa6===_0x57650b)break;else _0xc520['push'](_0xc520['shift']());}catch(_0x3e948a){_0xc520['push'](_0xc520['shift']());}}}(a129_0x61cb,0xecdde));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';function a129_0x739b(_0x22879d,_0x40766a){_0x22879d=_0x22879d-0x172;const _0x61cb08=a129_0x61cb();let _0x739b99=_0x61cb08[_0x22879d];return _0x739b99;}function a129_0x61cb(){const _0x4d154=['lockFilePath','message','1385587LFZfay','unchanged','sqlRoot','\x20pushed,\x20','str','relativePath','filter','lastSync','/smartapi/custom/updateUserCustomSql','toISOString','Would\x20push\x20','sqls','mode','dbName','entries','dbDirectory','remoteId','path','8fEZMLg','sql','No\x20database\x20matches\x20local\x20directory\x20\x22','\x20SQL\x20file(s)','validation','bool','map','appCode','sqlName','sqlRootDir','sqlCode','boolean','utf8','Local\x20directory\x20\x22','15710634BfCbIb','catch','dbId','4VIQvvr','5780260uXDzFm','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','push','get','version','replace','startsWith','exec','3974621ctQPRC','Push\x20complete:\x20','\x20skipped,\x20','hash','sqlConfig','sqlcode','high-risk-write','filePath','1605574Hgpmdd','join','6ZBYOVV','force','1084911xgXPFt','No\x20local\x20SQL\x20files\x20found.','39136800uHPvQV','length','isFinite'];a129_0x61cb=function(){return _0x4d154;};return a129_0x61cb();}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(_0x228f14,_0x3cb418,_0xb58f10){const _0x641146=a129_0x739b,_0x102a81=await scanLocalSqlQueries(_0x228f14),_0x3d1a7b=new Map();for(const _0xb48cdb of _0x102a81){if(_0xb58f10&&_0xb48cdb['sqlCode']!==_0xb58f10)continue;const _0x560632=_0x3d1a7b[_0x641146(0x1a3)](_0xb48cdb[_0x641146(0x198)])??[];_0x560632['push'](_0xb48cdb),_0x3d1a7b['set'](_0xb48cdb['sqlCode'],_0x560632);}if(_0xb58f10&&!_0x3d1a7b['has'](_0xb58f10))throw CliErrors['validation']('Local\x20SQL\x20not\x20found:\x20'+_0xb58f10);const _0x528a22=[];for(const [_0x510bff,_0x436191]of _0x3d1a7b[_0x641146(0x18a)]()){if(_0x436191[_0x641146(0x178)]===0x1){_0x528a22[_0x641146(0x1a2)](_0x436191[0x0]);continue;}const _0x4d9020=_0x3cb418['sqls'][_0x510bff],_0x13dbbd=_0x4d9020?.[_0x641146(0x18d)],_0x32859e=_0x13dbbd?_0x436191[_0x641146(0x182)](_0x37ee77=>_0x37ee77[_0x641146(0x181)]!==_0x13dbbd):_0x436191;if(_0x4d9020&&_0x32859e[_0x641146(0x178)]===0x1){_0x528a22[_0x641146(0x1a2)](_0x32859e[0x0]);continue;}throw CliErrors['validation']('Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20'+_0x510bff+_0x641146(0x1a1));}return _0x528a22;}export const sqlPush={'service':a129_0x50ca10(0x18f),'command':a129_0x50ca10(0x1a2),'description':'Push\x20local\x20SQL\x20files\x20to\x20remote','risk':a129_0x50ca10(0x1ae),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a129_0x50ca10(0x174),'type':a129_0x50ca10(0x199),'description':'Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock'}],async 'dryRun'(_0xe59cca){const _0x19168a=a129_0x50ca10,_0x1f017f=loadSqlProjectConfig(_0xe59cca[_0x19168a(0x195)]),_0x15d76a=await readSqlLockFile(_0x1f017f[_0x19168a(0x17a)]),{appLock:_0x3b1b20}=ensureSqlLockScope(_0x15d76a??createEmptySqlLock(),_0xe59cca[_0x19168a(0x195)],_0x1f017f['sqlRoot'],_0x19168a(0x1a2)),_0x184c72=await getTargetSqlQueries(_0x1f017f,_0x3b1b20,_0xe59cca[_0x19168a(0x180)](_0x19168a(0x1ad))||undefined),_0x5617fc=[];for(const _0x30e791 of _0x184c72){const _0x536ae5=await computeSqlFileHash(_0x30e791[_0x19168a(0x1af)]),_0x20194c=_0x3b1b20[_0x19168a(0x187)][_0x30e791[_0x19168a(0x198)]],_0x14bc47=!!_0x20194c&&(_0x20194c[_0x19168a(0x18d)]!==_0x30e791[_0x19168a(0x181)]||!!_0x30e791[_0x19168a(0x196)]&&_0x20194c[_0x19168a(0x196)]!==_0x30e791[_0x19168a(0x196)]);if(!_0xe59cca[_0x19168a(0x193)](_0x19168a(0x174))&&_0x20194c&&_0x20194c['hash']===_0x536ae5&&!_0x14bc47)continue;_0x5617fc[_0x19168a(0x1a2)](_0x30e791[_0x19168a(0x198)]);}return{'method':'POST','url':_0x19168a(0x184),'body':{'sqlCodes':_0x5617fc,'appCode':_0xe59cca[_0x19168a(0x195)]},'description':_0x19168a(0x186)+_0x5617fc[_0x19168a(0x178)]+_0x19168a(0x191)};},async 'execute'(_0x58a5ed){const _0xae1e18=a129_0x50ca10,_0x5b05a9=loadSqlProjectConfig(_0x58a5ed[_0xae1e18(0x195)]),_0x29b81a=await readSqlLockFile(_0x5b05a9['lockFilePath']),{lockData:_0x2ea936,appLock:_0x567961}=ensureSqlLockScope(_0x29b81a??createEmptySqlLock(),_0x58a5ed[_0xae1e18(0x195)],_0x5b05a9[_0xae1e18(0x17e)],'push'),_0x39c519=await getTargetSqlQueries(_0x5b05a9,_0x567961,_0x58a5ed[_0xae1e18(0x180)]('sqlcode')||undefined);if(_0x39c519[_0xae1e18(0x178)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0xae1e18(0x176)};const _0x16a320=[],_0x5d5a57=[],_0x2fa317=[];for(const _0x4e50c8 of _0x39c519){const _0x142091=_0x567961[_0xae1e18(0x187)][_0x4e50c8[_0xae1e18(0x198)]];if(!_0x142091){_0x2fa317['push']({'sqlCode':_0x4e50c8['sqlCode'],'error':'local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first'});continue;}try{const _0x26548f=await computeSqlFileHash(_0x4e50c8[_0xae1e18(0x1af)]),_0x125e9e=_0x142091['path']!==_0x4e50c8[_0xae1e18(0x181)]||!!_0x4e50c8[_0xae1e18(0x196)]&&_0x142091[_0xae1e18(0x196)]!==_0x4e50c8['sqlName'];if(!_0x58a5ed['bool']('force')&&_0x142091[_0xae1e18(0x1ab)]===_0x26548f&&!_0x125e9e){_0x5d5a57[_0xae1e18(0x1a2)]({'sqlCode':_0x4e50c8[_0xae1e18(0x198)],'reason':_0xae1e18(0x17d)});continue;}if(_0x142091[_0xae1e18(0x1a4)]==null){_0x2fa317['push']({'sqlCode':_0x4e50c8['sqlCode'],'error':'missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first'});continue;}const _0x2c4d76=await readFile(_0x4e50c8['filePath'],_0xae1e18(0x19a)),_0x19099c=stripLocalSqlMetadata(_0x2c4d76,_0x4e50c8[_0xae1e18(0x188)]),_0x26621f=_0x4e50c8['sqlName']||_0x142091[_0xae1e18(0x196)],_0x4eb764=await resolveTargetDbBinding(_0x58a5ed[_0xae1e18(0x195)],_0x4e50c8,_0x142091),_0x1f29fb=await updateSqlQuery({'id':_0x142091['remoteId'],'appCode':_0x58a5ed[_0xae1e18(0x195)],'sqlCode':_0x4e50c8['sqlCode'],'sqlName':_0x26621f,'dbId':_0x4eb764[_0xae1e18(0x19e)],'version':_0x142091[_0xae1e18(0x1a4)],'sqlContent':_0x19099c,'sqlConfig':_0x142091[_0xae1e18(0x1ac)]??undefined}),_0x4b499b=_0x1f29fb['dbId']?await getDbName(_0x58a5ed['appCode'],Number(_0x1f29fb['dbId']))[_0xae1e18(0x19d)](()=>_0x4eb764[_0xae1e18(0x189)]):_0x4eb764[_0xae1e18(0x189)];_0x567961[_0xae1e18(0x187)][_0x4e50c8['sqlCode']]={...buildSqlLockEntry(_0x1f29fb,_0x19099c,_0x26548f,{'dbName':_0x4b499b}),'path':_0x4e50c8[_0xae1e18(0x181)],'mode':_0x142091[_0xae1e18(0x188)]},await archivePreviousSqlFileIfNeeded(_0x5b05a9,_0x142091[_0xae1e18(0x18d)],_0x4e50c8[_0xae1e18(0x181)]),_0x16a320[_0xae1e18(0x1a2)]({'sqlCode':_0x4e50c8[_0xae1e18(0x198)],'remoteId':_0x142091[_0xae1e18(0x18c)]});}catch(_0x3b0289){_0x2fa317[_0xae1e18(0x1a2)]({'sqlCode':_0x4e50c8['sqlCode'],'error':_0x3b0289 instanceof Error?_0x3b0289[_0xae1e18(0x17b)]:String(_0x3b0289)});}}return _0x567961[_0xae1e18(0x183)]=new Date()[_0xae1e18(0x185)](),await writeSqlLockFile(_0x5b05a9[_0xae1e18(0x17a)],_0x2ea936),{'ok':_0x2fa317['length']===0x0,'data':{'pushed':_0x16a320,'skipped':_0x5d5a57,'failed':_0x2fa317},'message':_0xae1e18(0x1a9)+_0x16a320['length']+_0xae1e18(0x17f)+_0x5d5a57[_0xae1e18(0x178)]+_0xae1e18(0x1aa)+_0x2fa317[_0xae1e18(0x178)]+'\x20failed'};}};async function archivePreviousSqlFileIfNeeded(_0x43dfac,_0x2cb08c,_0x375bbf){const _0x4b3c08=a129_0x50ca10;if(!_0x2cb08c||_0x2cb08c===_0x375bbf)return;const _0x244d52=join(_0x43dfac[_0x4b3c08(0x197)],_0x2cb08c);if(!await fileExists(_0x244d52))return;const _0x39a69b=await moveToTrash(_0x43dfac['projectRoot'],_0x43dfac['trashDir'],_0x244d52);await cleanupEmptyDirectories(dirname(_0x244d52),_0x43dfac[_0x4b3c08(0x197)]),void _0x39a69b;}async function moveToTrash(_0x56a014,_0x2e54c5,_0x469000){const _0x461fd9=a129_0x50ca10,_0x4f5bfd=new Date()[_0x461fd9(0x185)]()[_0x461fd9(0x1a5)](/[:.]/g,'-'),_0x1c375a=relative(_0x56a014,_0x469000),_0x413a3a=join(_0x2e54c5,_0x4f5bfd,_0x1c375a);return await mkdir(dirname(_0x413a3a),{'recursive':!![]}),await rename(_0x469000,_0x413a3a),_0x413a3a;}async function cleanupEmptyDirectories(_0x448869,_0x3b06a7){const _0x161eed=a129_0x50ca10;let _0x56ea17=resolve(_0x448869);const _0x15df75=resolve(_0x3b06a7);while(_0x56ea17[_0x161eed(0x1a6)](''+_0x15df75+sep)||_0x56ea17===_0x15df75){if(_0x56ea17===_0x15df75)return;try{const _0x1dbfdc=await readdir(_0x56ea17);if(_0x1dbfdc[_0x161eed(0x178)]>0x0)return;await rmdir(_0x56ea17);}catch{return;}_0x56ea17=dirname(_0x56ea17);}}async function resolveTargetDbBinding(_0x1df6b3,_0x333bbf,_0x1dbd40){const _0x3e0282=a129_0x50ca10,_0x36212b=_0x333bbf[_0x3e0282(0x18b)];if(!_0x36212b)return{'dbId':_0x1dbd40[_0x3e0282(0x19e)],'dbName':_0x1dbd40[_0x3e0282(0x189)]};const _0x4eb064=buildDbDirectoryName(_0x1dbd40[_0x3e0282(0x189)],_0x1dbd40[_0x3e0282(0x19e)]);if(_0x36212b===_0x4eb064)return{'dbId':_0x1dbd40[_0x3e0282(0x19e)],'dbName':_0x1dbd40[_0x3e0282(0x189)]};const _0x4fcff7=parseExplicitDbDirectory(_0x36212b);if(_0x4fcff7!=null)return{'dbId':_0x4fcff7,'dbName':await getDbName(_0x1df6b3,_0x4fcff7)[_0x3e0282(0x19d)](()=>undefined)};const _0x4076b1=await listDatabases(_0x1df6b3),_0x53bf79=_0x4076b1[_0x3e0282(0x182)](_0x471502=>buildDbDirectoryName(_0x471502[_0x3e0282(0x189)],_0x471502[_0x3e0282(0x19e)])===_0x36212b);if(_0x53bf79[_0x3e0282(0x178)]===0x1)return{'dbId':_0x53bf79[0x0][_0x3e0282(0x19e)],'dbName':_0x53bf79[0x0]['dbName']};if(_0x53bf79[_0x3e0282(0x178)]===0x0)throw CliErrors[_0x3e0282(0x192)](_0x3e0282(0x190)+_0x36212b+'\x22\x20for\x20sqlCode\x20'+_0x333bbf[_0x3e0282(0x198)]+'.');const _0x42afd0=_0x53bf79[_0x3e0282(0x194)](_0xc51128=>_0xc51128[_0x3e0282(0x189)]+'\x20('+_0xc51128['dbId']+')')[_0x3e0282(0x172)](',\x20');throw CliErrors[_0x3e0282(0x192)](_0x3e0282(0x19b)+_0x36212b+'\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20'+_0x333bbf['sqlCode']+':\x20'+_0x42afd0);}function parseExplicitDbDirectory(_0x43008b){const _0xce364e=a129_0x50ca10,_0x47544b=/^db-(\d+)$/[_0xce364e(0x1a7)](_0x43008b);if(!_0x47544b)return null;const _0x97af0e=Number(_0x47544b[0x1]);return Number[_0xce364e(0x179)](_0x97af0e)&&_0x97af0e>0x0?_0x97af0e:null;}
|
|
1
|
+
const a129_0xb7ea13=a129_0x197a;(function(_0x22a4a8,_0x116482){const _0x33287b=a129_0x197a,_0x1238bc=_0x22a4a8();while(!![]){try{const _0x5360a4=parseInt(_0x33287b(0x1e7))/0x1*(-parseInt(_0x33287b(0x1df))/0x2)+parseInt(_0x33287b(0x1be))/0x3*(-parseInt(_0x33287b(0x1c6))/0x4)+parseInt(_0x33287b(0x1c1))/0x5+parseInt(_0x33287b(0x1e2))/0x6*(-parseInt(_0x33287b(0x1e5))/0x7)+parseInt(_0x33287b(0x1c3))/0x8+-parseInt(_0x33287b(0x1b6))/0x9+parseInt(_0x33287b(0x1ba))/0xa*(parseInt(_0x33287b(0x1d0))/0xb);if(_0x5360a4===_0x116482)break;else _0x1238bc['push'](_0x1238bc['shift']());}catch(_0x2e7a8b){_0x1238bc['push'](_0x1238bc['shift']());}}}(a129_0x1e99,0x236ff));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';function a129_0x197a(_0x52e2d3,_0xf3408){_0x52e2d3=_0x52e2d3-0x1b1;const _0x1e9921=a129_0x1e99();let _0x197a31=_0x1e9921[_0x52e2d3];return _0x197a31;}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(_0x3144e4,_0x1d2474,_0x14d3d5){const _0x411697=a129_0x197a,_0x501d20=await scanLocalSqlQueries(_0x3144e4),_0x3028ef=new Map();for(const _0x4a1da7 of _0x501d20){if(_0x14d3d5&&_0x4a1da7[_0x411697(0x1cb)]!==_0x14d3d5)continue;const _0x47f040=_0x3028ef['get'](_0x4a1da7[_0x411697(0x1cb)])??[];_0x47f040[_0x411697(0x1ed)](_0x4a1da7),_0x3028ef[_0x411697(0x1c2)](_0x4a1da7[_0x411697(0x1cb)],_0x47f040);}if(_0x14d3d5&&!_0x3028ef[_0x411697(0x1b3)](_0x14d3d5))throw CliErrors[_0x411697(0x1f5)](_0x411697(0x1ef)+_0x14d3d5);const _0x49b72d=[];for(const [_0x280f79,_0x2ecb23]of _0x3028ef[_0x411697(0x1f2)]()){if(_0x2ecb23[_0x411697(0x1dd)]===0x1){_0x49b72d[_0x411697(0x1ed)](_0x2ecb23[0x0]);continue;}const _0x52e74a=_0x1d2474['sqls'][_0x280f79],_0x37eedb=_0x52e74a?.[_0x411697(0x1d6)],_0x34c195=_0x37eedb?_0x2ecb23[_0x411697(0x1b8)](_0x51f9f8=>_0x51f9f8[_0x411697(0x1b2)]!==_0x37eedb):_0x2ecb23;if(_0x52e74a&&_0x34c195[_0x411697(0x1dd)]===0x1){_0x49b72d[_0x411697(0x1ed)](_0x34c195[0x0]);continue;}throw CliErrors[_0x411697(0x1f5)](_0x411697(0x1f0)+_0x280f79+_0x411697(0x1bd));}return _0x49b72d;}export const sqlPush={'service':a129_0xb7ea13(0x1d8),'command':'push','description':a129_0xb7ea13(0x1da),'risk':a129_0xb7ea13(0x1ee),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a129_0xb7ea13(0x1ca),'type':a129_0xb7ea13(0x1cc),'description':a129_0xb7ea13(0x1bf)}],async 'dryRun'(_0x51e520){const _0x1d8ab0=a129_0xb7ea13,_0x3b2140=loadSqlProjectConfig(_0x51e520['appCode']),_0xfb17a0=await readSqlLockFile(_0x3b2140[_0x1d8ab0(0x1f6)]),{appLock:_0x31c7b9}=ensureSqlLockScope(_0xfb17a0??createEmptySqlLock(),_0x51e520['appCode'],_0x3b2140['sqlRoot'],'push'),_0x187b73=await getTargetSqlQueries(_0x3b2140,_0x31c7b9,_0x51e520[_0x1d8ab0(0x1b7)](_0x1d8ab0(0x1e0))||undefined),_0x577405=[];for(const _0x1d1d01 of _0x187b73){const _0x403265=await computeSqlFileHash(_0x1d1d01[_0x1d8ab0(0x1cf)]),_0x5134d5=_0x31c7b9[_0x1d8ab0(0x1c9)][_0x1d1d01[_0x1d8ab0(0x1cb)]],_0x587395=!!_0x5134d5&&(_0x5134d5[_0x1d8ab0(0x1d6)]!==_0x1d1d01['relativePath']||!!_0x1d1d01['sqlName']&&_0x5134d5[_0x1d8ab0(0x1c7)]!==_0x1d1d01['sqlName']);if(!_0x51e520[_0x1d8ab0(0x1c4)]('force')&&_0x5134d5&&_0x5134d5[_0x1d8ab0(0x1d9)]===_0x403265&&!_0x587395)continue;_0x577405[_0x1d8ab0(0x1ed)](_0x1d1d01[_0x1d8ab0(0x1cb)]);}return{'method':_0x1d8ab0(0x1e6),'url':_0x1d8ab0(0x1bc),'body':{'sqlCodes':_0x577405,'appCode':_0x51e520[_0x1d8ab0(0x1e4)]},'description':_0x1d8ab0(0x1d7)+_0x577405['length']+_0x1d8ab0(0x1db)};},async 'execute'(_0x38da69){const _0x293bbc=a129_0xb7ea13,_0x51e330=loadSqlProjectConfig(_0x38da69[_0x293bbc(0x1e4)]),_0x3743a0=await readSqlLockFile(_0x51e330['lockFilePath']),{lockData:_0x3ecbc2,appLock:_0x45dba1}=ensureSqlLockScope(_0x3743a0??createEmptySqlLock(),_0x38da69[_0x293bbc(0x1e4)],_0x51e330[_0x293bbc(0x1d4)],_0x293bbc(0x1ed)),_0x1f7581=await getTargetSqlQueries(_0x51e330,_0x45dba1,_0x38da69[_0x293bbc(0x1b7)](_0x293bbc(0x1e0))||undefined);if(_0x1f7581[_0x293bbc(0x1dd)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x293bbc(0x1c5)};const _0x5d1230=[],_0x5d836c=[],_0x3d9492=[];for(const _0x2b4536 of _0x1f7581){const _0x3ee408=_0x45dba1[_0x293bbc(0x1c9)][_0x2b4536[_0x293bbc(0x1cb)]];if(!_0x3ee408){_0x3d9492['push']({'sqlCode':_0x2b4536['sqlCode'],'error':_0x293bbc(0x1d1)});continue;}try{const _0x42fff7=await computeSqlFileHash(_0x2b4536[_0x293bbc(0x1cf)]),_0xfcf610=_0x3ee408[_0x293bbc(0x1d6)]!==_0x2b4536[_0x293bbc(0x1b2)]||!!_0x2b4536[_0x293bbc(0x1c7)]&&_0x3ee408[_0x293bbc(0x1c7)]!==_0x2b4536[_0x293bbc(0x1c7)];if(!_0x38da69[_0x293bbc(0x1c4)](_0x293bbc(0x1ca))&&_0x3ee408['hash']===_0x42fff7&&!_0xfcf610){_0x5d836c['push']({'sqlCode':_0x2b4536[_0x293bbc(0x1cb)],'reason':'unchanged'});continue;}if(_0x3ee408[_0x293bbc(0x1d2)]==null){_0x3d9492[_0x293bbc(0x1ed)]({'sqlCode':_0x2b4536[_0x293bbc(0x1cb)],'error':_0x293bbc(0x1ec)});continue;}const _0x1fa04a=await readFile(_0x2b4536[_0x293bbc(0x1cf)],_0x293bbc(0x1d3)),_0x3c60bb=stripLocalSqlMetadata(_0x1fa04a,_0x2b4536[_0x293bbc(0x1ea)]),_0x676e72=_0x2b4536[_0x293bbc(0x1c7)]||_0x3ee408[_0x293bbc(0x1c7)],_0x52597c=await resolveTargetDbBinding(_0x38da69['appCode'],_0x2b4536,_0x3ee408),_0x1af240=await updateSqlQuery({'id':_0x3ee408[_0x293bbc(0x1de)],'appCode':_0x38da69[_0x293bbc(0x1e4)],'sqlCode':_0x2b4536['sqlCode'],'sqlName':_0x676e72,'dbId':_0x52597c[_0x293bbc(0x1c0)],'version':_0x3ee408[_0x293bbc(0x1d2)],'sqlContent':_0x3c60bb,'sqlConfig':_0x3ee408[_0x293bbc(0x1e9)]??undefined}),_0x115c0e=_0x1af240[_0x293bbc(0x1c0)]?await getDbName(_0x38da69[_0x293bbc(0x1e4)],Number(_0x1af240[_0x293bbc(0x1c0)]))[_0x293bbc(0x1f1)](()=>_0x52597c['dbName']):_0x52597c[_0x293bbc(0x1b1)];_0x45dba1[_0x293bbc(0x1c9)][_0x2b4536[_0x293bbc(0x1cb)]]={...buildSqlLockEntry(_0x1af240,_0x3c60bb,_0x42fff7,{'dbName':_0x115c0e}),'path':_0x2b4536['relativePath'],'mode':_0x3ee408['mode']},await archivePreviousSqlFileIfNeeded(_0x51e330,_0x3ee408['path'],_0x2b4536[_0x293bbc(0x1b2)]),_0x5d1230['push']({'sqlCode':_0x2b4536['sqlCode'],'remoteId':_0x3ee408[_0x293bbc(0x1de)]});}catch(_0x2dd7ae){_0x3d9492['push']({'sqlCode':_0x2b4536[_0x293bbc(0x1cb)],'error':_0x2dd7ae instanceof Error?_0x2dd7ae['message']:String(_0x2dd7ae)});}}return _0x45dba1['lastSync']=new Date()[_0x293bbc(0x1b5)](),await writeSqlLockFile(_0x51e330[_0x293bbc(0x1f6)],_0x3ecbc2),{'ok':_0x3d9492['length']===0x0,'data':{'pushed':_0x5d1230,'skipped':_0x5d836c,'failed':_0x3d9492},'message':_0x293bbc(0x1cd)+_0x5d1230[_0x293bbc(0x1dd)]+_0x293bbc(0x1b9)+_0x5d836c['length']+_0x293bbc(0x1bb)+_0x3d9492[_0x293bbc(0x1dd)]+'\x20failed'};}};async function archivePreviousSqlFileIfNeeded(_0x4fae7f,_0x5e4c80,_0x4c3b95){const _0x160cd5=a129_0xb7ea13;if(!_0x5e4c80||_0x5e4c80===_0x4c3b95)return;const _0x1965c1=join(_0x4fae7f['sqlRootDir'],_0x5e4c80);if(!await fileExists(_0x1965c1))return;const _0x2ed16b=await moveToTrash(_0x4fae7f[_0x160cd5(0x1b4)],_0x4fae7f[_0x160cd5(0x1dc)],_0x1965c1);await cleanupEmptyDirectories(dirname(_0x1965c1),_0x4fae7f[_0x160cd5(0x1c8)]),void _0x2ed16b;}function a129_0x1e99(){const _0x45b828=['set','577680rtuorp','bool','No\x20local\x20SQL\x20files\x20found.','38188PYAivh','sqlName','sqlRootDir','sqls','force','sqlCode','boolean','Push\x20complete:\x20','Local\x20directory\x20\x22','filePath','6813829hWlBjN','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','version','utf8','sqlRoot','join','path','Would\x20push\x20','sql','hash','Push\x20local\x20SQL\x20files\x20to\x20remote','\x20SQL\x20file(s)','trashDir','length','remoteId','502952WeFVGn','sqlcode','isFinite','12waNgDx','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','appCode','186578FutAIZ','POST','1MTfrHe','startsWith','sqlConfig','mode','\x22\x20for\x20sqlCode\x20','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','push','high-risk-write','Local\x20SQL\x20not\x20found:\x20','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','catch','entries','map','replace','validation','lockFilePath','dbName','relativePath','has','projectRoot','toISOString','1592091oljLpn','str','filter','\x20pushed,\x20','10Kvezdr','\x20skipped,\x20','/smartapi/custom/updateUserCustomSql','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','48yrmHuH','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','dbId','439685ODbdtA'];a129_0x1e99=function(){return _0x45b828;};return a129_0x1e99();}async function moveToTrash(_0xfaeeb3,_0x4b4a36,_0x370c31){const _0x2acfa2=a129_0xb7ea13,_0x5a5c62=new Date()[_0x2acfa2(0x1b5)]()[_0x2acfa2(0x1f4)](/[:.]/g,'-'),_0x8c9dde=relative(_0xfaeeb3,_0x370c31),_0x58e2e9=join(_0x4b4a36,_0x5a5c62,_0x8c9dde);return await mkdir(dirname(_0x58e2e9),{'recursive':!![]}),await rename(_0x370c31,_0x58e2e9),_0x58e2e9;}async function cleanupEmptyDirectories(_0x2f16fe,_0x10d08c){const _0x565e60=a129_0xb7ea13;let _0x13b3e7=resolve(_0x2f16fe);const _0x2bafd4=resolve(_0x10d08c);while(_0x13b3e7[_0x565e60(0x1e8)](''+_0x2bafd4+sep)||_0x13b3e7===_0x2bafd4){if(_0x13b3e7===_0x2bafd4)return;try{const _0x2c1baf=await readdir(_0x13b3e7);if(_0x2c1baf[_0x565e60(0x1dd)]>0x0)return;await rmdir(_0x13b3e7);}catch{return;}_0x13b3e7=dirname(_0x13b3e7);}}async function resolveTargetDbBinding(_0x2ad0ed,_0x277c7f,_0x181145){const _0xd844a7=a129_0xb7ea13,_0x2ef1db=_0x277c7f['dbDirectory'];if(!_0x2ef1db)return{'dbId':_0x181145[_0xd844a7(0x1c0)],'dbName':_0x181145[_0xd844a7(0x1b1)]};const _0xf8c380=buildDbDirectoryName(_0x181145[_0xd844a7(0x1b1)],_0x181145['dbId']);if(_0x2ef1db===_0xf8c380)return{'dbId':_0x181145[_0xd844a7(0x1c0)],'dbName':_0x181145['dbName']};const _0x1471ea=parseExplicitDbDirectory(_0x2ef1db);if(_0x1471ea!=null)return{'dbId':_0x1471ea,'dbName':await getDbName(_0x2ad0ed,_0x1471ea)['catch'](()=>undefined)};const _0x2fb4dd=await listDatabases(_0x2ad0ed),_0x52821a=_0x2fb4dd[_0xd844a7(0x1b8)](_0x137ad5=>buildDbDirectoryName(_0x137ad5['dbName'],_0x137ad5[_0xd844a7(0x1c0)])===_0x2ef1db);if(_0x52821a[_0xd844a7(0x1dd)]===0x1)return{'dbId':_0x52821a[0x0]['dbId'],'dbName':_0x52821a[0x0][_0xd844a7(0x1b1)]};if(_0x52821a[_0xd844a7(0x1dd)]===0x0)throw CliErrors[_0xd844a7(0x1f5)]('No\x20database\x20matches\x20local\x20directory\x20\x22'+_0x2ef1db+_0xd844a7(0x1eb)+_0x277c7f[_0xd844a7(0x1cb)]+'.');const _0x5cd09b=_0x52821a[_0xd844a7(0x1f3)](_0x47dd72=>_0x47dd72['dbName']+'\x20('+_0x47dd72['dbId']+')')[_0xd844a7(0x1d5)](',\x20');throw CliErrors[_0xd844a7(0x1f5)](_0xd844a7(0x1ce)+_0x2ef1db+_0xd844a7(0x1e3)+_0x277c7f['sqlCode']+':\x20'+_0x5cd09b);}function parseExplicitDbDirectory(_0x1ee2e8){const _0x165c2a=a129_0xb7ea13,_0x11c661=/^db-(\d+)$/['exec'](_0x1ee2e8);if(!_0x11c661)return null;const _0x1e0aa5=Number(_0x11c661[0x1]);return Number[_0x165c2a(0x1e1)](_0x1e0aa5)&&_0x1e0aa5>0x0?_0x1e0aa5:null;}
|
package/lib/commands/sql/save.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a130_0x4650c3=a130_0x4acc;(function(_0x35103e,_0x4ba946){const _0x48a794=a130_0x4acc,_0x256986=_0x35103e();while(!![]){try{const _0x5ba814=-parseInt(_0x48a794(0x15d))/0x1+parseInt(_0x48a794(0x150))/0x2*(-parseInt(_0x48a794(0x156))/0x3)+parseInt(_0x48a794(0x151))/0x4*(parseInt(_0x48a794(0x15f))/0x5)+parseInt(_0x48a794(0x162))/0x6+parseInt(_0x48a794(0x152))/0x7*(-parseInt(_0x48a794(0x163))/0x8)+-parseInt(_0x48a794(0x15e))/0x9+parseInt(_0x48a794(0x164))/0xa;if(_0x5ba814===_0x4ba946)break;else _0x256986['push'](_0x256986['shift']());}catch(_0x21da71){_0x256986['push'](_0x256986['shift']());}}}(a130_0x121a,0x4fb75));import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a130_0x4acc(_0x466a91,_0x106c4b){_0x466a91=_0x466a91-0x150;const _0x121afd=a130_0x121a();let _0x4acc79=_0x121afd[_0x466a91];return _0x4acc79;}function a130_0x121a(){const _0x53f37d=['sql','SQL\x20query\x20display\x20name','file','Target\x20database\x20—\x20accepts\x20a\x20numeric\x20ID\x20or\x20database\x20name\x20(e.g.\x20ecommerce_db)','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`.','`rabetbase\x20sql\x20save`\x20has\x20been\x20deprecated.','135214XRPrVi','214416aoXKOs','5VvwYcO','Deprecated:\x20use\x20sql\x20create\x20to\x20create\x20and\x20sql\x20push\x20to\x20update','Path\x20to\x20the\x20SQL\x20file','87942KrSHDZ','3648yBgMUm','2726620AtBEwv','78WICNUL','1711700sQkhQd','399UgURLA','validation','write','string','15669Pvjrhl'];a130_0x121a=function(){return _0x53f37d;};return a130_0x121a();}const SQL_SAVE_DEPRECATED_HINT=[a130_0x4650c3(0x15c),'Create\x20new\x20SQL\x20with\x20`rabetbase\x20sql\x20create\x20--name\x20<name>\x20--db-id\x20<id>\x20--mode\x20sql|mybatisXml`.',a130_0x4650c3(0x15b)]['join']('\x0a');export const sqlSave={'service':a130_0x4650c3(0x157),'command':'save','description':a130_0x4650c3(0x160),'risk':a130_0x4650c3(0x154),'requiresAuth':![],'requiresAppCode':![],'flags':[{'name':a130_0x4650c3(0x159),'type':a130_0x4650c3(0x155),'required':!![],'description':a130_0x4650c3(0x161)},SQLCODE_FLAG_OPTIONAL,{'name':'sqlname','type':a130_0x4650c3(0x155),'description':a130_0x4650c3(0x158)},{'name':'db','type':a130_0x4650c3(0x155),'description':a130_0x4650c3(0x15a)},{'name':'description','type':a130_0x4650c3(0x155),'description':'Query\x20description'}],async 'validate'(){const _0x5aa31e=a130_0x4650c3;throw CliErrors[_0x5aa31e(0x153)](SQL_SAVE_DEPRECATED_HINT);},async 'execute'(){const _0x4b5261=a130_0x4650c3;throw CliErrors[_0x4b5261(0x153)](SQL_SAVE_DEPRECATED_HINT);}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x426c22,_0x3dfe4c){const _0x249fa5=a131_0x2a15,_0x3899a4=_0x426c22();while(!![]){try{const _0x1d086e=parseInt(_0x249fa5(0x103))/0x1+parseInt(_0x249fa5(0x11d))/0x2+-parseInt(_0x249fa5(0x11f))/0x3*(parseInt(_0x249fa5(0xfc))/0x4)+-parseInt(_0x249fa5(0x126))/0x5*(parseInt(_0x249fa5(0x123))/0x6)+parseInt(_0x249fa5(0x11a))/0x7+-parseInt(_0x249fa5(0x10b))/0x8+-parseInt(_0x249fa5(0x112))/0x9;if(_0x1d086e===_0x3dfe4c)break;else _0x3899a4['push'](_0x3899a4['shift']());}catch(_0x1cbd8b){_0x3899a4['push'](_0x3899a4['shift']());}}}(a131_0x2a2d,0x29fb2));import{createInterface}from'node:readline';import{join}from'node:path';import{buildDefaultSqlFileName,buildSqlRelativePath,detectSqlMode}from'../../core/sql-sync/utils.js';export const SQL_LOCAL_REL_DIR='.rabetbase/sql';export function buildSqlLockEntry(_0x231375,_0x15aea3,_0x2c161f,_0x38b3b7){const _0x3677be=a131_0x2a15,_0x1ec040=detectSqlMode(_0x15aea3);return{'path':buildSqlRelativePath(_0x231375[_0x3677be(0x106)],_0x231375[_0x3677be(0x115)],_0x38b3b7?.['dbName'],_0x1ec040,_0x231375['dbId']),'hash':_0x2c161f,'remoteId':_0x231375['id'],'version':_0x231375[_0x3677be(0x107)],'dbId':Number(_0x231375[_0x3677be(0x100)]),'dbName':_0x38b3b7?.[_0x3677be(0x10e)],'sqlName':_0x231375[_0x3677be(0x115)],'sqlConfig':_0x231375[_0x3677be(0x117)]??undefined,'mode':_0x1ec040};}export function cloneSqlLockData(_0x286275){const _0x8be37c=a131_0x2a15;return{'apps':Object[_0x8be37c(0x125)](Object[_0x8be37c(0xfe)](_0x286275[_0x8be37c(0x11b)])['map'](([_0x464730,_0x144861])=>[_0x464730,{'sqlRoot':_0x144861[_0x8be37c(0x11c)],'lastSync':_0x144861[_0x8be37c(0x111)],'sqls':{..._0x144861['sqls']}}]))};}export function ensureRemoteSqlContent(_0x432eb7){return _0x432eb7['sqlContent']??'';}export function buildLocalSqlFileContent(_0x178fff,_0xaa1bec,_0x247a41){const _0x33268b=a131_0x2a15,_0x1b6d14=_0x247a41?.[_0x33268b(0x124)]??detectSqlMode(_0xaa1bec),_0x4bd41b=stripLocalSqlMetadata(_0xaa1bec,_0x1b6d14)[_0x33268b(0xff)](),_0x53039b=[...buildMetadataHeaderLines({'sqlCode':_0x178fff['sqlCode'],'sqlName':_0x178fff[_0x33268b(0x115)],'dbId':_0x178fff[_0x33268b(0x100)],'dbName':_0x247a41?.[_0x33268b(0x10e)],'mode':_0x1b6d14,'syncedAt':_0x247a41?.[_0x33268b(0x110)],'description':_0x247a41?.[_0x33268b(0x104)]},_0x1b6d14),'',_0x4bd41b],_0x4ec157=_0x53039b[_0x33268b(0x10f)]('\x0a');return _0x4ec157['endsWith']('\x0a')?_0x4ec157:_0x4ec157+'\x0a';}export function stripLocalSqlMetadata(_0x3b2467,_0x46a261){const _0x1dcdfc=a131_0x2a15,_0x4541f8=_0x3b2467[_0x1dcdfc(0x10c)](/\r\n/g,'\x0a')[_0x1dcdfc(0x108)]('\x0a'),_0x127d00=[];let _0x3434e4=0x0;if(_0x46a261===_0x1dcdfc(0x102))while(_0x3434e4<_0x4541f8[_0x1dcdfc(0x119)]){const _0x5db850=_0x4541f8[_0x3434e4]??'';if(/^\s*<!--\s*@lovrabet\./[_0x1dcdfc(0x121)](_0x5db850)){_0x3434e4++;continue;}if(_0x5db850[_0x1dcdfc(0xff)]()===''&&_0x3434e4>0x0){_0x3434e4++;continue;}break;}else while(_0x3434e4<_0x4541f8['length']){const _0x357f64=_0x4541f8[_0x3434e4]??'';if(/^\s*--\s*@lovrabet\./[_0x1dcdfc(0x121)](_0x357f64)){_0x3434e4++;continue;}if(_0x357f64[_0x1dcdfc(0xff)]()===''&&_0x3434e4>0x0){_0x3434e4++;continue;}break;}for(;_0x3434e4<_0x4541f8['length'];_0x3434e4++){_0x127d00[_0x1dcdfc(0x10a)](_0x4541f8[_0x3434e4]);}return _0x127d00[_0x1dcdfc(0x10f)]('\x0a')['trimStart']();}export function resolveSqlMode(_0x442a53,_0x3d7903){const _0x4745ef=a131_0x2a15;if(_0x3d7903?.[_0x4745ef(0x124)])return _0x3d7903[_0x4745ef(0x124)];return detectSqlMode(_0x442a53);}function a131_0x2a2d(){const _0x52b101=['sqlCode','version','split','filter','push','694728fzPcYs','replace','stdin','dbName','join','syncedAt','lastSync','1215108YMIygL','\x20[y/N]\x20','stderr','sqlName','question','sqlConfig','\x20-->','length','2053219Dicthn','apps','sqlRoot','126386rLntxL','path','5913BQMYbx','--\x20@lovrabet.','test','toLowerCase','6UkrycJ','mode','fromEntries','459470cQARtj','52nbqpmI','includes','entries','trim','dbId','yes','mybatisXml','154814jEhulB','description','map'];a131_0x2a2d=function(){return _0x52b101;};return a131_0x2a2d();}export function resolveSqlFileName(_0x5413b5,_0x348b52,_0x4546ba){const _0x37c3f3=a131_0x2a15;if(_0x4546ba?.[_0x37c3f3(0x11e)])return _0x4546ba[_0x37c3f3(0x11e)];if(_0x4546ba?.[_0x37c3f3(0x115)]||_0x4546ba?.['dbName'])return buildSqlRelativePath(_0x5413b5,_0x4546ba?.[_0x37c3f3(0x115)],_0x4546ba?.[_0x37c3f3(0x10e)],resolveSqlMode(_0x348b52,_0x4546ba),_0x4546ba?.[_0x37c3f3(0x100)]);return buildDefaultSqlFileName(_0x5413b5,resolveSqlMode(_0x348b52,_0x4546ba));}export function resolveSqlLocalDir(_0x977f6f,_0x11a404){return join(_0x977f6f,SQL_LOCAL_REL_DIR,_0x11a404);}export async function confirmForceOverwrite(_0x42ec19){const _0x4ecd7d=a131_0x2a15,_0x4e3e71=createInterface({'input':process[_0x4ecd7d(0x10d)],'output':process[_0x4ecd7d(0x114)]}),_0x50e7de=await new Promise(_0x27c373=>{const _0x1f0906=_0x4ecd7d;_0x4e3e71[_0x1f0906(0x116)](_0x42ec19+_0x1f0906(0x113),_0x27c373);});return _0x4e3e71['close'](),['y',_0x4ecd7d(0x101)][_0x4ecd7d(0xfd)](_0x50e7de[_0x4ecd7d(0xff)]()[_0x4ecd7d(0x122)]());}export function findSqlLockScope(_0x5b9736,_0x1cc046){const _0x484b3a=a131_0x2a15;return _0x5b9736[_0x484b3a(0x11b)][_0x1cc046];}function a131_0x2a15(_0x41fdae,_0x261871){_0x41fdae=_0x41fdae-0xfc;const _0x2a2d28=a131_0x2a2d();let _0x2a15fe=_0x2a2d28[_0x41fdae];return _0x2a15fe;}function buildMetadataHeaderLines(_0x204910,_0x25200e){const _0x5ab563=a131_0x2a15,_0x53cb83=[[_0x5ab563(0x106),_0x204910[_0x5ab563(0x106)]],[_0x5ab563(0x115),_0x204910['sqlName']],[_0x5ab563(0x100),_0x204910[_0x5ab563(0x100)]],['dbName',_0x204910[_0x5ab563(0x10e)]],['mode',_0x204910[_0x5ab563(0x124)]],[_0x5ab563(0x110),_0x204910[_0x5ab563(0x110)]],[_0x5ab563(0x104),_0x204910[_0x5ab563(0x104)]]];if(_0x25200e===_0x5ab563(0x102))return _0x53cb83['filter'](([,_0x249a11])=>_0x249a11!==undefined&&_0x249a11!==null&&String(_0x249a11)[_0x5ab563(0xff)]()!=='')['map'](([_0x5b1092,_0x247a0f])=>'<!--\x20@lovrabet.'+_0x5b1092+':\x20'+String(_0x247a0f)+_0x5ab563(0x118));return _0x53cb83[_0x5ab563(0x109)](([,_0x22755f])=>_0x22755f!==undefined&&_0x22755f!==null&&String(_0x22755f)[_0x5ab563(0xff)]()!=='')[_0x5ab563(0x105)](([_0x2b0051,_0x3953fd])=>_0x5ab563(0x120)+_0x2b0051+':\x20'+String(_0x3953fd));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a132_0x194053=a132_0x29df;(function(_0x59cba7,_0x2ab77c){const _0x4e7d21=a132_0x29df,_0x5227f2=_0x59cba7();while(!![]){try{const _0x234d82=parseInt(_0x4e7d21(0x142))/0x1+parseInt(_0x4e7d21(0x141))/0x2+-parseInt(_0x4e7d21(0x124))/0x3*(-parseInt(_0x4e7d21(0x129))/0x4)+parseInt(_0x4e7d21(0x122))/0x5+-parseInt(_0x4e7d21(0x13a))/0x6+parseInt(_0x4e7d21(0x13d))/0x7*(parseInt(_0x4e7d21(0x12f))/0x8)+-parseInt(_0x4e7d21(0x128))/0x9;if(_0x234d82===_0x2ab77c)break;else _0x5227f2['push'](_0x5227f2['shift']());}catch(_0x364828){_0x5227f2['push'](_0x5227f2['shift']());}}}(a132_0x1ef3,0x712a3));import{listSqlQueries}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';function a132_0x29df(_0x2e2bbf,_0x473f04){_0x2e2bbf=_0x2e2bbf-0x122;const _0x1ef3cb=a132_0x1ef3();let _0x29df39=_0x1ef3cb[_0x2e2bbf];return _0x29df39;}import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';function a132_0x1ef3(){const _0x27c79b=['888FfeegV','sqls','totalCount','bool','lockFilePath','filePath','path','hash','\x20modified,\x20','Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','sqlRoot','3938862jqgfHC','remote','\x20missing,\x20','10087lZQyhA','sqlName','tableData','length','1328834IPRUjP','139910JWmSia','\x20remote-only','read','460490ZitnaU','map','213zerDRi','sqlCode','has','lockKey','1561644CLYaKs','13360asHFpE','appCode','boolean','sql','push','status'];a132_0x1ef3=function(){return _0x27c79b;};return a132_0x1ef3();}import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile}from'../../core/sql-sync/lock.js';const PAGE_SIZE=0x64;async function fetchAllSqlCodes(_0x3b6b78){const _0x5ac724=a132_0x29df,_0x126563=[];let _0x1ebcc3=0x1;while(!![]){const _0xb766c1=await listSqlQueries(_0x3b6b78,{'currentPage':_0x1ebcc3,'pageSize':PAGE_SIZE}),_0x184a56=_0xb766c1[_0x5ac724(0x13f)]??[];_0x126563['push'](..._0x184a56[_0x5ac724(0x123)](_0x307cef=>_0x307cef[_0x5ac724(0x125)]));if(_0x184a56['length']===0x0)break;const _0x3f9f63=_0xb766c1['paging']?.[_0x5ac724(0x131)];if(_0x3f9f63!=null?_0x126563[_0x5ac724(0x140)]>=_0x3f9f63:_0x184a56[_0x5ac724(0x140)]<PAGE_SIZE)break;_0x1ebcc3++;}return _0x126563;}export const sqlStatus={'service':a132_0x194053(0x12c),'command':a132_0x194053(0x12e),'description':a132_0x194053(0x138),'risk':a132_0x194053(0x144),'flags':[{'name':a132_0x194053(0x13b),'type':a132_0x194053(0x12b),'description':'Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally'}],async 'execute'(_0x205e13){const _0x14fea2=a132_0x194053,_0x99a5b2=loadSqlProjectConfig(_0x205e13[_0x14fea2(0x12a)]),_0x242289=await readSqlLockFile(_0x99a5b2[_0x14fea2(0x133)]),{appLock:_0x57a8b7}=ensureSqlLockScope(_0x242289??createEmptySqlLock(),_0x99a5b2[_0x14fea2(0x12a)],_0x99a5b2[_0x14fea2(0x139)],_0x14fea2(0x12e)),_0x1464db=await scanLocalSqlQueries(_0x99a5b2),_0x45938f=[],_0x344c40=[],_0x2bdd92=[],_0xefcb33=[],_0x2e21e6=new Set(_0x1464db[_0x14fea2(0x123)](_0x3f4c52=>_0x3f4c52[_0x14fea2(0x127)]));for(const _0x3b44ae of _0x1464db){const _0x185424=await computeSqlFileHash(_0x3b44ae[_0x14fea2(0x134)]),_0x919762=_0x57a8b7[_0x14fea2(0x130)][_0x3b44ae[_0x14fea2(0x127)]],_0x43f61a=!!_0x919762&&_0x919762[_0x14fea2(0x135)]!==_0x3b44ae['relativePath'],_0x45ba2e=!!_0x919762&&!!_0x3b44ae[_0x14fea2(0x13e)]&&_0x919762[_0x14fea2(0x13e)]!==_0x3b44ae[_0x14fea2(0x13e)];if(!_0x919762)_0x45938f[_0x14fea2(0x12d)](_0x3b44ae['lockKey']);else _0x919762[_0x14fea2(0x136)]!==_0x185424||_0x43f61a||_0x45ba2e?_0x344c40[_0x14fea2(0x12d)](_0x3b44ae[_0x14fea2(0x127)]):_0x2bdd92[_0x14fea2(0x12d)](_0x3b44ae['lockKey']);}for(const _0x451315 of Object['keys'](_0x57a8b7[_0x14fea2(0x130)])){!_0x2e21e6['has'](_0x451315)&&_0xefcb33[_0x14fea2(0x12d)](_0x451315);}const _0x410bc5=[];if(_0x205e13[_0x14fea2(0x132)](_0x14fea2(0x13b))){const _0xd5b0a9=await fetchAllSqlCodes(_0x205e13[_0x14fea2(0x12a)]);for(const _0x42b47a of _0xd5b0a9){!_0x2e21e6[_0x14fea2(0x126)](_0x42b47a)&&!_0x57a8b7[_0x14fea2(0x130)][_0x42b47a]&&_0x410bc5[_0x14fea2(0x12d)](_0x42b47a);}}const _0x8a4e84=_0x45938f[_0x14fea2(0x140)]===0x0&&_0x344c40[_0x14fea2(0x140)]===0x0&&_0xefcb33['length']===0x0&&_0x410bc5[_0x14fea2(0x140)]===0x0;return{'ok':!![],'data':{'added':_0x45938f,'modified':_0x344c40,'missing':_0xefcb33,'unchanged':_0x2bdd92,'remoteOnly':_0x410bc5},'message':_0x8a4e84?'All\x20SQL\x20queries\x20are\x20in\x20sync.':_0x45938f['length']+'\x20added,\x20'+_0x344c40[_0x14fea2(0x140)]+_0x14fea2(0x137)+_0xefcb33['length']+_0x14fea2(0x13c)+_0x2bdd92[_0x14fea2(0x140)]+'\x20unchanged'+(_0x410bc5[_0x14fea2(0x140)]>0x0?',\x20'+_0x410bc5[_0x14fea2(0x140)]+_0x14fea2(0x143):'')};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a133_0x4d4c97=a133_0x1d36;(function(_0x2ca758,_0x1bde6e){const _0x1ffc4b=a133_0x1d36,_0x15dc00=_0x2ca758();while(!![]){try{const _0x2f934a=-parseInt(_0x1ffc4b(0xef))/0x1*(parseInt(_0x1ffc4b(0xe7))/0x2)+parseInt(_0x1ffc4b(0xde))/0x3*(-parseInt(_0x1ffc4b(0xe6))/0x4)+parseInt(_0x1ffc4b(0xdf))/0x5+-parseInt(_0x1ffc4b(0xf9))/0x6+-parseInt(_0x1ffc4b(0x107))/0x7+-parseInt(_0x1ffc4b(0xe0))/0x8*(-parseInt(_0x1ffc4b(0xfa))/0x9)+parseInt(_0x1ffc4b(0xf7))/0xa*(parseInt(_0x1ffc4b(0xdc))/0xb);if(_0x2f934a===_0x1bde6e)break;else _0x15dc00['push'](_0x15dc00['shift']());}catch(_0x23d2a3){_0x15dc00['push'](_0x15dc00['shift']());}}}(a133_0xf08a,0xe9b35));import{readFileSync,existsSync}from'node:fs';function a133_0xf08a(){const _0x47e319=['filter','Inline\x20SQL\x20content\x20to\x20validate\x20(alternative\x20to\x20--file)','3184300SqdlFu','Validate\x20SQL\x20content\x20without\x20saving\x20(type\x20detection,\x20parameter\x20extraction,\x20optional\x20schema\x20check)','message','isDangerous','SQL\x20schema\x20validation','valid','fields','validation','sql','isArray','39061GgsyDL','tables','1810173cwMCOV','6970340klDzeH','8QRDQVq','from','get','string','schemaWarnings','\x22\x20not\x20found\x20in\x20any\x20dataset','8ViCfoK','430MHFAsD','Table\x20\x22','str','schemas','\x22\x20not\x20found\x20or\x20not\x20accessible','file','name','flagMissing','6193cQlPjK','read','map','validate','File\x20not\x20found:\x20','utf-8','appCode','toLowerCase','4810khanZI','schema:','1411140sOkXoL','9751545nAYpSV','tableName','isSelectOnly','type','dbtableConfig','trim','reason','Dataset\x20\x22','sqlType','length','push'];a133_0xf08a=function(){return _0x47e319;};return a133_0xf08a();}import{resolve}from'node:path';import{validateSql}from'../../core/sql-validator.js';import{getDatasetDetail,listDatasets}from'../../core/api-client.js';function a133_0x1d36(_0x4b7101,_0x144889){_0x4b7101=_0x4b7101-0xd8;const _0xf08a57=a133_0xf08a();let _0x1d36d2=_0xf08a57[_0x4b7101];return _0x1d36d2;}import{CliErrors}from'../../errors.js';import{assertDatasetIsDbTableBacked,filterDbTableBackedDatasets}from'../../commands/dataset/capability.js';export const sqlValidate={'service':a133_0x4d4c97(0xda),'command':a133_0x4d4c97(0xf2),'description':a133_0x4d4c97(0x108),'risk':a133_0x4d4c97(0xf0),'flags':[{'name':a133_0x4d4c97(0xec),'type':a133_0x4d4c97(0xe3),'description':'Path\x20to\x20the\x20SQL\x20file\x20to\x20validate'},{'name':a133_0x4d4c97(0xda),'type':a133_0x4d4c97(0xe3),'description':a133_0x4d4c97(0x106)},{'name':a133_0x4d4c97(0xea),'type':'string','description':'Comma-separated\x20dataset\x20codes\x20to\x20cross-check\x20table/column\x20names\x20against'}],async 'execute'(_0x4676aa){const _0x2c7a7b=a133_0x4d4c97,_0x4910c6=_0x4676aa[_0x2c7a7b(0xe9)](_0x2c7a7b(0xec)),_0x42e0ae=_0x4676aa[_0x2c7a7b(0xe9)](_0x2c7a7b(0xda));if(!_0x4910c6&&!_0x42e0ae)throw CliErrors[_0x2c7a7b(0xee)](_0x2c7a7b(0xec),'Provide\x20--file\x20or\x20--sql');let _0x1303a3;if(_0x4910c6){const _0x1919f8=resolve(process['cwd'](),_0x4910c6);if(!existsSync(_0x1919f8))throw CliErrors[_0x2c7a7b(0xd9)](_0x2c7a7b(0xf3)+_0x1919f8);_0x1303a3=readFileSync(_0x1919f8,_0x2c7a7b(0xf4));}else _0x1303a3=_0x42e0ae;const _0xeff894=validateSql(_0x1303a3),_0x10b2b4={'valid':_0xeff894['valid'],'sqlType':_0xeff894[_0x2c7a7b(0x102)][_0x2c7a7b(0xfd)],'isSelectOnly':_0xeff894['sqlType'][_0x2c7a7b(0xfc)],'isDangerous':_0xeff894[_0x2c7a7b(0x102)][_0x2c7a7b(0x10a)],'tables':_0xeff894['tables'],'parameters':_0xeff894['parameters'],'message':_0xeff894[_0x2c7a7b(0x109)]};_0xeff894[_0x2c7a7b(0x102)][_0x2c7a7b(0x100)]&&(_0x10b2b4[_0x2c7a7b(0x100)]=_0xeff894['sqlType'][_0x2c7a7b(0x100)]);const _0x1a2f68=_0x4676aa[_0x2c7a7b(0xe9)]('schemas');if(_0x1a2f68&&_0xeff894[_0x2c7a7b(0x10c)]){const _0x2a91ca=_0x1a2f68['split'](',')['map'](_0x4b87f8=>_0x4b87f8[_0x2c7a7b(0xff)]())[_0x2c7a7b(0x105)](Boolean),_0x23e2d6=[],_0xde3358=filterDbTableBackedDatasets(await listDatasets(_0x4676aa[_0x2c7a7b(0xf5)])),_0x3bee71=new Map(_0xde3358[_0x2c7a7b(0xf1)](_0x1a2e14=>[_0x1a2e14[_0x2c7a7b(0xfe)]?.['tableName']?.[_0x2c7a7b(0xf6)](),_0x1a2e14]));for(const _0x980452 of _0xeff894[_0x2c7a7b(0xdd)]){const _0x42143e=_0x3bee71[_0x2c7a7b(0xe2)](_0x980452['toLowerCase']());!_0x42143e&&_0x23e2d6[_0x2c7a7b(0x104)](_0x2c7a7b(0xe8)+_0x980452+_0x2c7a7b(0xe5));}for(const _0x3b11f9 of _0x2a91ca){let _0x2cc853;try{_0x2cc853=await getDatasetDetail(_0x3b11f9);}catch{_0x23e2d6[_0x2c7a7b(0x104)](_0x2c7a7b(0x101)+_0x3b11f9+_0x2c7a7b(0xeb));continue;}assertDatasetIsDbTableBacked(_0x2cc853,_0x2c7a7b(0x10b));const _0x18fa50=Array[_0x2c7a7b(0xdb)](_0x2cc853['fields'])?_0x2cc853[_0x2c7a7b(0xd8)]:[],_0x5acf5e=new Set(_0x18fa50[_0x2c7a7b(0xf1)](_0x3f5437=>_0x3f5437[_0x2c7a7b(0xed)]?.[_0x2c7a7b(0xf6)]())),_0x266f21=_0x2cc853[_0x2c7a7b(0xfe)]?.[_0x2c7a7b(0xfb)]||_0x2cc853[_0x2c7a7b(0xfb)]||_0x3b11f9;_0x10b2b4[_0x2c7a7b(0xf8)+_0x266f21]={'code':_0x3b11f9,'tableName':_0x266f21,'fieldCount':_0x5acf5e['size'],'fields':Array[_0x2c7a7b(0xe1)](_0x5acf5e)};}_0x23e2d6[_0x2c7a7b(0x103)]>0x0&&(_0x10b2b4[_0x2c7a7b(0xe4)]=_0x23e2d6);}return{'ok':_0xeff894[_0x2c7a7b(0x10c)],'data':_0x10b2b4,'message':_0xeff894[_0x2c7a7b(0x109)]};}};
|
package/lib/config/schema.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a134_0x5f13(){const _0x2b7b1a=['map','accessKey','698484VBgrFV','Config\x20key\x20(','appcode','7InKnma','Risk\x20level','zh-CN','has','Default\x20output\x20format\x20for\x20this\x20app\x20(profile)','trim','apps','env','join','entries','defaultFormat','apiDir','en-US','9564651fNkxDC','30PagbLw','riskLevel','defaultApp','keys','21072WkMyox','Auth\x20cookie','locale','app','452301BlJYbo','string','3047350EigAxG','API\x20directory\x20path','cookie','format','length','6906376lpozan','Access\x20key','Target\x20environment','Locale','pageSize','Default\x20page\x20size','10UcvSOg','4857904kXuhHK','number'];a134_0x5f13=function(){return _0x2b7b1a;};return a134_0x5f13();}const a134_0x466daa=a134_0xeb69;(function(_0x4d282b,_0x46763e){const _0x58aef9=a134_0xeb69,_0x2c7c25=_0x4d282b();while(!![]){try{const _0x4ae08f=-parseInt(_0x58aef9(0x182))/0x1*(-parseInt(_0x58aef9(0x17e))/0x2)+-parseInt(_0x58aef9(0x186))/0x3+parseInt(_0x58aef9(0x169))/0x4+-parseInt(_0x58aef9(0x188))/0x5+-parseInt(_0x58aef9(0x16d))/0x6*(-parseInt(_0x58aef9(0x170))/0x7)+parseInt(_0x58aef9(0x162))/0x8+-parseInt(_0x58aef9(0x17d))/0x9*(parseInt(_0x58aef9(0x168))/0xa);if(_0x4ae08f===_0x46763e)break;else _0x2c7c25['push'](_0x2c7c25['shift']());}catch(_0x2e4d7c){_0x2c7c25['push'](_0x2c7c25['shift']());}}}(a134_0x5f13,0xa7cbb));import{DEFAULT_CONFIG_VALUES}from'../constant/defaults.js';import{RABETBASE_ENV_VALUES}from'../constant/env.js';function a134_0xeb69(_0x3f7f3b,_0x27ca82){_0x3f7f3b=_0x3f7f3b-0x15e;const _0x5f135c=a134_0x5f13();let _0xeb6973=_0x5f135c[_0x3f7f3b];return _0xeb6973;}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=[a134_0x466daa(0x15f),a134_0x466daa(0x16c),'locale',a134_0x466daa(0x160),a134_0x466daa(0x17f)];export const TOP_LEVEL_CONFIG_KEYS=new Set([a134_0x466daa(0x16f),a134_0x466daa(0x177),'locale','format','cookie','accessKey',a134_0x466daa(0x17b)]);export const CONFIG_ENUM_VALUES={'env':[...RABETBASE_ENV_VALUES],'format':[...RABETBASE_OUTPUT_FORMAT_VALUES]};export function formatConfigKeyList(_0x3a0d17){const _0x2af8b8=a134_0x466daa;return[..._0x3a0d17][_0x2af8b8(0x178)](',\x20');}export function getTopLevelConfigKeyList(){return[...TOP_LEVEL_CONFIG_KEYS];}export function isTopLevelConfigKey(_0x127075){const _0x55d818=a134_0x466daa;return TOP_LEVEL_CONFIG_KEYS[_0x55d818(0x173)](_0x127075);}export function getTopLevelConfigKeySummary(){return formatConfigKeyList(getTopLevelConfigKeyList());}export function getConfigCommandKeyDescription(){const _0x5c84e1=a134_0x466daa;return _0x5c84e1(0x16e)+getTopLevelConfigKeySummary()+')';}export const APP_PROFILE_FLAG_KEY_MAP={'env':'env','apiDir':a134_0x466daa(0x17b),'cookie':a134_0x466daa(0x15f),'accessKey':a134_0x466daa(0x16c),'defaultFormat':'format','pageSize':a134_0x466daa(0x166),'riskLevel':a134_0x466daa(0x17f),'locale':a134_0x466daa(0x184)};export function getAppProfileFlagDefs(){const _0xd5b2fd=a134_0x466daa;return[{'name':'env','type':_0xd5b2fd(0x187),'description':_0xd5b2fd(0x164),'enum':[...RABETBASE_ENV_VALUES]},{'name':'apiDir','type':_0xd5b2fd(0x187),'description':_0xd5b2fd(0x15e)},{'name':'cookie','type':_0xd5b2fd(0x187),'description':_0xd5b2fd(0x183),'hidden':!![]},{'name':_0xd5b2fd(0x16c),'type':_0xd5b2fd(0x187),'description':_0xd5b2fd(0x163),'hidden':!![]},{'name':_0xd5b2fd(0x17a),'type':_0xd5b2fd(0x187),'description':_0xd5b2fd(0x174),'enum':[...RABETBASE_OUTPUT_FORMAT_VALUES]},{'name':'pageSize','type':_0xd5b2fd(0x16a),'description':_0xd5b2fd(0x167)},{'name':_0xd5b2fd(0x17f),'type':_0xd5b2fd(0x187),'description':_0xd5b2fd(0x171),'enum':[...RISK_LEVEL_VALUES]},{'name':_0xd5b2fd(0x184),'type':_0xd5b2fd(0x187),'description':_0xd5b2fd(0x165)}];}export function collectAppProfileOverrides(_0x766497){const _0x4e3032=a134_0x466daa,_0x2431ed={};for(const [_0x233b72,_0xbc2b56]of Object[_0x4e3032(0x179)](APP_PROFILE_FLAG_KEY_MAP)){const _0x387f07=_0x766497(_0x233b72);if(!_0x387f07)continue;_0x2431ed[_0xbc2b56]=_0xbc2b56===_0x4e3032(0x166)?Number(_0x387f07):_0x387f07;}return _0x2431ed;}export function buildAppProfileListFields(_0x6269ef){const _0x33bf4a=a134_0x466daa;return{'env':_0x6269ef[_0x33bf4a(0x177)]??null,'apiDir':_0x6269ef[_0x33bf4a(0x17b)]??null,'hasCookie':!!_0x6269ef[_0x33bf4a(0x15f)],'hasAccessKey':!!_0x6269ef[_0x33bf4a(0x16c)],'format':_0x6269ef['format']??null,'pageSize':_0x6269ef[_0x33bf4a(0x166)]??null,'riskLevel':_0x6269ef[_0x33bf4a(0x17f)]??null,'locale':_0x6269ef[_0x33bf4a(0x184)]??null};}export function buildAppDoctorFields(_0x554fe6,_0x17cd6b){const _0x3eead9=a134_0x466daa;return{'env':{'value':_0x554fe6[_0x3eead9(0x177)]||_0x17cd6b['env'],'source':_0x554fe6['env']?_0x3eead9(0x185):'inherit'},'apiDir':{'value':_0x554fe6['apiDir']||_0x17cd6b[_0x3eead9(0x17b)],'source':_0x554fe6[_0x3eead9(0x17b)]?_0x3eead9(0x185):'inherit'},'cookie':{'value':_0x554fe6['cookie']||_0x17cd6b['cookie'],'source':_0x554fe6['cookie']?_0x3eead9(0x185):'inherit'},'accessKey':{'value':_0x554fe6['accessKey']||_0x17cd6b['accessKey'],'source':_0x554fe6[_0x3eead9(0x16c)]?_0x3eead9(0x185):'inherit'}};}export function buildCanonicalAppConfig(_0x58a203,_0x2c7502){const _0x30df05=a134_0x466daa,_0x426d7b=_0x58a203[_0x30df05(0x16b)](_0x29e741=>String(_0x29e741||'')[_0x30df05(0x175)]())['filter'](Boolean);if(_0x426d7b['length']===0x0)return{};const _0x7e0d2e={};for(const _0x47a96f of _0x426d7b){_0x7e0d2e[_0x47a96f]=_0x2c7502?{'appcode':_0x47a96f,'env':_0x2c7502}:{'appcode':_0x47a96f};}return{'apps':_0x7e0d2e,'defaultApp':_0x426d7b[0x0]};}export function buildCanonicalProjectConfig(_0x21c1d9,_0x3a527d){const _0x1b25db=a134_0x466daa,{appCodes:appCodes=[],env:_0x1527bb,metadata:_0x4f43c4}=_0x3a527d,_0x387fbe={..._0x21c1d9,..._0x4f43c4||{}};delete _0x387fbe[_0x1b25db(0x16f)],delete _0x387fbe[_0x1b25db(0x185)];if(_0x1527bb)_0x387fbe['env']=_0x1527bb;else!_0x387fbe[_0x1b25db(0x177)]&&(_0x387fbe[_0x1b25db(0x177)]=DEFAULT_CONFIG_VALUES[_0x1b25db(0x177)]);const _0x485acf=buildCanonicalAppConfig(appCodes,_0x387fbe[_0x1b25db(0x177)]);return Object[_0x1b25db(0x181)](_0x485acf)[_0x1b25db(0x161)]>0x0&&(_0x387fbe[_0x1b25db(0x176)]=_0x485acf[_0x1b25db(0x176)],_0x387fbe['defaultApp']=_0x485acf[_0x1b25db(0x180)]),_0x387fbe;}const LOCALE_MAP={'zh':a134_0x466daa(0x172),'zh-cn':a134_0x466daa(0x172),'zh_cn':a134_0x466daa(0x172),'en':'en-US','en-us':a134_0x466daa(0x17c),'en_us':a134_0x466daa(0x17c)};export function normalizeLocale(_0x492003){if(!_0x492003)return null;return LOCALE_MAP[_0x492003['toLowerCase']()]??null;}
|
package/lib/constant/cdn.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a135_0x542d(_0x206bdd,_0x3bdde1){_0x206bdd=_0x206bdd-0x194;const _0x2c32c6=a135_0x2c32();let _0x542d2c=_0x2c32c6[_0x206bdd];return _0x542d2c;}const a135_0x1c650b=a135_0x542d;(function(_0x5b20b0,_0x2e90db){const _0xf922a2=a135_0x542d,_0x4edc87=_0x5b20b0();while(!![]){try{const _0x52d48d=-parseInt(_0xf922a2(0x199))/0x1*(parseInt(_0xf922a2(0x194))/0x2)+parseInt(_0xf922a2(0x196))/0x3*(-parseInt(_0xf922a2(0x19b))/0x4)+parseInt(_0xf922a2(0x197))/0x5*(-parseInt(_0xf922a2(0x1a1))/0x6)+-parseInt(_0xf922a2(0x19e))/0x7*(-parseInt(_0xf922a2(0x19c))/0x8)+parseInt(_0xf922a2(0x19d))/0x9*(-parseInt(_0xf922a2(0x19f))/0xa)+-parseInt(_0xf922a2(0x19a))/0xb+-parseInt(_0xf922a2(0x195))/0xc*(-parseInt(_0xf922a2(0x198))/0xd);if(_0x52d48d===_0x2e90db)break;else _0x4edc87['push'](_0x4edc87['shift']());}catch(_0x41440d){_0x4edc87['push'](_0x4edc87['shift']());}}}(a135_0x2c32,0xe773d));function a135_0x2c32(){const _0x5db857=['7886664oRfZKE','13788rbhPOV','7HqjQQe','9550kToCHt','https://g.lovrabet.com/dist/rabetbase-cli/config/index.json','18vWNNVo','3368062YFjZlk','12GWQDUJ','14097eVIvry','2303325YEQcUt','63402664kwgSNA','1VqkWpf','1918301KxigqX','180xbhlqc'];a135_0x2c32=function(){return _0x5db857;};return a135_0x2c32();}export const CLI_VERSION_POLICY_URL=a135_0x1c650b(0x1a0);
|
package/lib/constant/cli.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a136_0x1ca71b=a136_0x3da0;function a136_0x3cda(){const _0x3ac42c=['sqlcode','682233kzBllh','description-file','Watch\x20mode','confirm','Target\x20path','Show\x20help','description','schemas','Config\x20value','4420440uOvCTb','sqlName','remote','dbId','DB\x20ID','Skip\x20confirmation\x20for\x20high-risk\x20writes','511068GnjHYC','sql-name','Schemas','4377456HQTbMO','JSON\x20params','16WMyGcN','Config\x20key','Environment','file','Function\x20node','page','code','operation-type','app','Confirm\x20destructive\x20action','help','global','Apply\x20to\x20all','expected-count','type','3062857GTDKPV','Dataset\x20code','meowKey','fromEntries','name','Output\x20format','title','1735714jTGqHN','functionNode','json\x20|\x20pretty\x20|\x20compress','Force\x20overwrite','Force\x20non-interactive\x20mode\x20(CI)','1105674AIFwsd','@lovrabet/rabetbase-cli','project','datasetcode','pagesize','env','sql','keyword','Output\x20path','SQL\x20string','SQL\x20code','output','SQL\x20name','watch','Expected\x20affected\x20count','yes','nonInteractive','operation','params','force','verbose','non-interactive','5IUBgdm','44hCTwcF','<code>','Skip\x20import\x20generation','key','dryRun','skip-imports','Enable\x20BFF\x20save','<name>','8qbkseT','Code\x20filter','Filter\x20JSON\x20output\x20(JQ_PATH\x20>\x20bundled\x20jq\x20>\x20PATH;\x20use\x20with\x20--format\x20json\x20or\x20compress)','string','dry-run','Description\x20file','value','function-node','format','10AOANpS','enableBffSave','Description','Override\x20appcode','Select\x20app\x20profile\x20by\x20name','boolean','production\x20|\x20daily','appcode','all','dbid','<expr>','sqlname','map','Operation\x20type','db-id','Alias\x20for\x20--non-interactive','clear'];a136_0x3cda=function(){return _0x3ac42c;};return a136_0x3cda();}(function(_0x200927,_0x491586){const _0x5b7b35=a136_0x3da0,_0x53bb4f=_0x200927();while(!![]){try{const _0x2cafd2=-parseInt(_0x5b7b35(0x21c))/0x1+parseInt(_0x5b7b35(0x246))/0x2+-parseInt(_0x5b7b35(0x22b))/0x3*(-parseInt(_0x5b7b35(0x201))/0x4)+parseInt(_0x5b7b35(0x1f8))/0x5*(parseInt(_0x5b7b35(0x24b))/0x6)+-parseInt(_0x5b7b35(0x23f))/0x7*(-parseInt(_0x5b7b35(0x230))/0x8)+parseInt(_0x5b7b35(0x22e))/0x9*(parseInt(_0x5b7b35(0x20a))/0xa)+-parseInt(_0x5b7b35(0x1f9))/0xb*(parseInt(_0x5b7b35(0x225))/0xc);if(_0x2cafd2===_0x491586)break;else _0x53bb4f['push'](_0x53bb4f['shift']());}catch(_0x51e088){_0x53bb4f['push'](_0x53bb4f['shift']());}}}(a136_0x3cda,0x9225d));function a136_0x3da0(_0x1d2269,_0x14368e){_0x1d2269=_0x1d2269-0x1eb;const _0x3cdaf3=a136_0x3cda();let _0x3da0cc=_0x3cdaf3[_0x1d2269];return _0x3da0cc;}export const CLI_BIN_NAME='rabetbase';export const CLI_DISPLAY_NAME='Rabetbase\x20CLI';export const NPM_PACKAGE_NAME=a136_0x1ca71b(0x24c);export const GLOBAL_FLAGS=[{'name':'appcode','meowKey':a136_0x1ca71b(0x211),'type':a136_0x1ca71b(0x204),'description':a136_0x1ca71b(0x20d),'hint':a136_0x1ca71b(0x1fa)},{'name':a136_0x1ca71b(0x238),'meowKey':a136_0x1ca71b(0x238),'type':a136_0x1ca71b(0x204),'description':a136_0x1ca71b(0x20e),'hint':a136_0x1ca71b(0x200)},{'name':a136_0x1ca71b(0x250),'meowKey':a136_0x1ca71b(0x250),'type':a136_0x1ca71b(0x204),'description':a136_0x1ca71b(0x232),'hint':a136_0x1ca71b(0x210)},{'name':a136_0x1ca71b(0x209),'meowKey':'format','type':'string','description':a136_0x1ca71b(0x244),'hint':a136_0x1ca71b(0x248)},{'name':'jq','meowKey':'jq','type':a136_0x1ca71b(0x204),'description':a136_0x1ca71b(0x203),'hint':a136_0x1ca71b(0x214)},{'name':a136_0x1ca71b(0x205),'meowKey':a136_0x1ca71b(0x1fd),'type':'boolean','description':'Preview\x20operation\x20without\x20executing'},{'name':a136_0x1ca71b(0x1f1),'meowKey':'yes','type':a136_0x1ca71b(0x20f),'description':a136_0x1ca71b(0x22a)},{'name':a136_0x1ca71b(0x1f7),'meowKey':a136_0x1ca71b(0x1f2),'type':a136_0x1ca71b(0x20f),'description':a136_0x1ca71b(0x24a)},{'name':a136_0x1ca71b(0x23b),'meowKey':a136_0x1ca71b(0x23b),'type':a136_0x1ca71b(0x20f),'description':'Use\x20global\x20config\x20scope'},{'name':a136_0x1ca71b(0x24d),'meowKey':a136_0x1ca71b(0x24d),'type':a136_0x1ca71b(0x20f),'description':'Use\x20project\x20config\x20scope'},{'name':'ci','meowKey':'ci','type':a136_0x1ca71b(0x20f),'description':a136_0x1ca71b(0x219),'hidden':!![]},{'name':a136_0x1ca71b(0x23a),'meowKey':'help','type':a136_0x1ca71b(0x20f),'description':a136_0x1ca71b(0x221)},{'name':a136_0x1ca71b(0x243),'meowKey':a136_0x1ca71b(0x243),'type':a136_0x1ca71b(0x204),'description':'Name','hidden':!![]},{'name':'title','meowKey':a136_0x1ca71b(0x245),'type':a136_0x1ca71b(0x204),'description':'Title','hidden':!![]},{'name':a136_0x1ca71b(0x21a),'meowKey':'clear','type':a136_0x1ca71b(0x20f),'description':'Clear','hidden':!![]},{'name':a136_0x1ca71b(0x1ef),'meowKey':a136_0x1ca71b(0x1ef),'type':a136_0x1ca71b(0x20f),'description':a136_0x1ca71b(0x21e),'hidden':!![]},{'name':a136_0x1ca71b(0x1ed),'meowKey':a136_0x1ca71b(0x1ed),'type':'string','description':a136_0x1ca71b(0x253),'hidden':!![]},{'name':a136_0x1ca71b(0x1f4),'meowKey':'params','type':a136_0x1ca71b(0x204),'description':a136_0x1ca71b(0x22f),'hidden':!![]},{'name':'datasetcode','meowKey':a136_0x1ca71b(0x24e),'type':a136_0x1ca71b(0x204),'description':a136_0x1ca71b(0x240),'hidden':!![]},{'name':'all','meowKey':a136_0x1ca71b(0x212),'type':'boolean','description':a136_0x1ca71b(0x23c),'hidden':!![]},{'name':'enable-bff-save','meowKey':a136_0x1ca71b(0x20b),'type':'boolean','description':a136_0x1ca71b(0x1ff),'hidden':!![]},{'name':'id','meowKey':'id','type':a136_0x1ca71b(0x204),'description':'Record\x20ID','hidden':!![]},{'name':a136_0x1ca71b(0x23e),'meowKey':a136_0x1ca71b(0x23e),'type':a136_0x1ca71b(0x204),'description':'Type\x20filter','hidden':!![]},{'name':'file','meowKey':a136_0x1ca71b(0x233),'type':a136_0x1ca71b(0x204),'description':'File\x20path','hidden':!![]},{'name':a136_0x1ca71b(0x21b),'meowKey':a136_0x1ca71b(0x21b),'type':a136_0x1ca71b(0x204),'description':a136_0x1ca71b(0x1ec),'hidden':!![]},{'name':a136_0x1ca71b(0x22c),'meowKey':a136_0x1ca71b(0x226),'type':a136_0x1ca71b(0x204),'description':a136_0x1ca71b(0x1ee),'hidden':!![]},{'name':a136_0x1ca71b(0x215),'meowKey':'sqlname','type':a136_0x1ca71b(0x204),'description':a136_0x1ca71b(0x1ee),'hidden':!![]},{'name':a136_0x1ca71b(0x218),'meowKey':a136_0x1ca71b(0x228),'type':a136_0x1ca71b(0x204),'description':a136_0x1ca71b(0x229),'hidden':!![]},{'name':a136_0x1ca71b(0x213),'meowKey':a136_0x1ca71b(0x213),'type':a136_0x1ca71b(0x204),'description':'DB\x20ID','hidden':!![]},{'name':a136_0x1ca71b(0x222),'meowKey':a136_0x1ca71b(0x222),'type':a136_0x1ca71b(0x204),'description':a136_0x1ca71b(0x20c),'hidden':!![]},{'name':a136_0x1ca71b(0x21d),'meowKey':'descriptionFile','type':'string','description':a136_0x1ca71b(0x206),'hidden':!![]},{'name':a136_0x1ca71b(0x235),'meowKey':a136_0x1ca71b(0x235),'type':a136_0x1ca71b(0x204),'description':'Page\x20number','hidden':!![]},{'name':a136_0x1ca71b(0x24f),'meowKey':a136_0x1ca71b(0x24f),'type':a136_0x1ca71b(0x204),'description':'Page\x20size','hidden':!![]},{'name':a136_0x1ca71b(0x252),'meowKey':a136_0x1ca71b(0x252),'type':'string','description':'Keyword\x20filter','hidden':!![]},{'name':a136_0x1ca71b(0x236),'meowKey':a136_0x1ca71b(0x236),'type':a136_0x1ca71b(0x204),'description':a136_0x1ca71b(0x202),'hidden':!![]},{'name':a136_0x1ca71b(0x251),'meowKey':a136_0x1ca71b(0x251),'type':a136_0x1ca71b(0x204),'description':a136_0x1ca71b(0x1eb),'hidden':!![]},{'name':a136_0x1ca71b(0x223),'meowKey':a136_0x1ca71b(0x223),'type':a136_0x1ca71b(0x204),'description':a136_0x1ca71b(0x22d),'hidden':!![]},{'name':a136_0x1ca71b(0x1f3),'meowKey':a136_0x1ca71b(0x1f3),'type':a136_0x1ca71b(0x204),'description':a136_0x1ca71b(0x217),'hidden':!![]},{'name':'target','meowKey':'target','type':'string','description':a136_0x1ca71b(0x220),'hidden':!![]},{'name':a136_0x1ca71b(0x1fe),'meowKey':'skipImports','type':a136_0x1ca71b(0x20f),'description':a136_0x1ca71b(0x1fb),'hidden':!![]},{'name':a136_0x1ca71b(0x1fc),'meowKey':a136_0x1ca71b(0x1fc),'type':a136_0x1ca71b(0x204),'description':a136_0x1ca71b(0x231),'hidden':!![]},{'name':a136_0x1ca71b(0x207),'meowKey':a136_0x1ca71b(0x207),'type':'string','description':a136_0x1ca71b(0x224),'hidden':!![]},{'name':a136_0x1ca71b(0x1f5),'meowKey':a136_0x1ca71b(0x1f5),'type':a136_0x1ca71b(0x20f),'description':a136_0x1ca71b(0x249),'hidden':!![]},{'name':a136_0x1ca71b(0x21f),'meowKey':a136_0x1ca71b(0x21f),'type':a136_0x1ca71b(0x20f),'description':a136_0x1ca71b(0x239),'hidden':!![]},{'name':'remote','meowKey':a136_0x1ca71b(0x227),'type':a136_0x1ca71b(0x20f),'description':'Use\x20remote','hidden':!![]},{'name':a136_0x1ca71b(0x1f6),'meowKey':a136_0x1ca71b(0x1f6),'type':a136_0x1ca71b(0x20f),'description':'Verbose\x20output','hidden':!![]},{'name':a136_0x1ca71b(0x23d),'meowKey':'expectedCount','type':a136_0x1ca71b(0x204),'description':a136_0x1ca71b(0x1f0),'hidden':!![]},{'name':a136_0x1ca71b(0x237),'meowKey':'operationType','type':'string','description':'Operation\x20type','hidden':!![]},{'name':a136_0x1ca71b(0x208),'meowKey':a136_0x1ca71b(0x247),'type':a136_0x1ca71b(0x204),'description':a136_0x1ca71b(0x234),'hidden':!![]}];export const PIPELINE_FLAG_NAMES=new Set([a136_0x1ca71b(0x211),a136_0x1ca71b(0x238),a136_0x1ca71b(0x250),a136_0x1ca71b(0x209),'jq',a136_0x1ca71b(0x205),a136_0x1ca71b(0x1f1),a136_0x1ca71b(0x1f7),'ci']);export function buildMeowFlags(){const _0x5224e4=a136_0x1ca71b;return Object[_0x5224e4(0x242)](GLOBAL_FLAGS[_0x5224e4(0x216)](_0x115272=>[_0x115272[_0x5224e4(0x241)],{'type':_0x115272[_0x5224e4(0x23e)]}]));}
|
package/lib/constant/defaults.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a137_0x425dd7=a137_0xb5f4;function a137_0xb5f4(_0x4ac7b1,_0x3b6beb){_0x4ac7b1=_0x4ac7b1-0xeb;const _0x499322=a137_0x4993();let _0xb5f43a=_0x499322[_0x4ac7b1];return _0xb5f43a;}(function(_0x4a1889,_0x44f616){const _0x2c3088=a137_0xb5f4,_0x464c09=_0x4a1889();while(!![]){try{const _0x3c5928=-parseInt(_0x2c3088(0xee))/0x1*(parseInt(_0x2c3088(0xf4))/0x2)+-parseInt(_0x2c3088(0xf1))/0x3*(-parseInt(_0x2c3088(0xef))/0x4)+-parseInt(_0x2c3088(0xf7))/0x5+parseInt(_0x2c3088(0xf8))/0x6*(-parseInt(_0x2c3088(0xf6))/0x7)+parseInt(_0x2c3088(0xf0))/0x8+-parseInt(_0x2c3088(0xeb))/0x9+-parseInt(_0x2c3088(0xec))/0xa*(-parseInt(_0x2c3088(0xf2))/0xb);if(_0x3c5928===_0x44f616)break;else _0x464c09['push'](_0x464c09['shift']());}catch(_0x5398c6){_0x464c09['push'](_0x464c09['shift']());}}}(a137_0x4993,0xe96b1));import{DEFAULT_API_DIR}from'../constant/paths.js';export const DEFAULT_CONFIG_VALUES={'env':'production','format':a137_0x425dd7(0xf3),'locale':a137_0x425dd7(0xf5),'riskLevel':a137_0x425dd7(0xed),'apiDir':DEFAULT_API_DIR};export const DEFAULT_COMMAND_OUTPUT_FORMAT='compress';function a137_0x4993(){const _0x54d13c=['compress','7258PrOVhg','en-US','367997CyHoFl','4665125IGxKpo','138skKJoY','3093255ZdYOYO','10fPVWmN','high-risk-write','307mobbpB','3023236tHcFjG','9678408VjjXXp','6cuJUZI','20180798UoikWg'];a137_0x4993=function(){return _0x54d13c;};return a137_0x4993();}
|
package/lib/constant/domain.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a138_0x54d8(){const _0x2fb3bd=['1512660VyQBAO','20SwTJCv','runtimeDomain','/app/','apiDomain','https://daily-runtime.lovrabet.com','28015mSqZBv','trim','/web-app/app/','12165040Kxzpxi','https://runtime.lovrabet.com','https://user-daily.lovrabet.com','12ANoQVT','userDomain','1338EfADLy','https://api.lovrabet.com','1092650mVMjan','151702nDvloJ','12486591LtyJCe','7FZpIAp','https://daily-api.lovrabet.com','36857348lxOnxw'];a138_0x54d8=function(){return _0x2fb3bd;};return a138_0x54d8();}const a138_0x2ea072=a138_0x2e0d;function a138_0x2e0d(_0x95ac4f,_0x204ca2){_0x95ac4f=_0x95ac4f-0x1e7;const _0x54d8e3=a138_0x54d8();let _0x2e0d90=_0x54d8e3[_0x95ac4f];return _0x2e0d90;}(function(_0x27404a,_0x150650){const _0x4208fd=a138_0x2e0d,_0x2deff1=_0x27404a();while(!![]){try{const _0x1276c4=parseInt(_0x4208fd(0x1f5))/0x1*(parseInt(_0x4208fd(0x1fb))/0x2)+parseInt(_0x4208fd(0x1f0))/0x3*(parseInt(_0x4208fd(0x1fa))/0x4)+parseInt(_0x4208fd(0x1ea))/0x5*(parseInt(_0x4208fd(0x1f2))/0x6)+parseInt(_0x4208fd(0x1f7))/0x7*(-parseInt(_0x4208fd(0x1ed))/0x8)+parseInt(_0x4208fd(0x1f6))/0x9+parseInt(_0x4208fd(0x1f4))/0xa+-parseInt(_0x4208fd(0x1f9))/0xb;if(_0x1276c4===_0x150650)break;else _0x2deff1['push'](_0x2deff1['shift']());}catch(_0x2978a4){_0x2deff1['push'](_0x2deff1['shift']());}}}(a138_0x54d8,0xdcd43));import{getEnv,isProduction}from'../constant/env.js';let customApiDomain,customUserDomain,customRuntimeDomain;export function initDomains(_0x3fa793){const _0x172cc6=a138_0x2e0d;customApiDomain=_0x3fa793?.[_0x172cc6(0x1e8)],customUserDomain=_0x3fa793?.[_0x172cc6(0x1f1)],customRuntimeDomain=_0x3fa793?.[_0x172cc6(0x1fc)];}export const getUserDomain=()=>customUserDomain||(isProduction(getEnv())?'https://user.lovrabet.com':a138_0x2ea072(0x1ef));export const getApiDomain=()=>customApiDomain||(isProduction(getEnv())?a138_0x2ea072(0x1f3):a138_0x2ea072(0x1f8));export const getRuntimeDomain=()=>customRuntimeDomain||(isProduction(getEnv())?a138_0x2ea072(0x1ee):a138_0x2ea072(0x1e9));export const getAppDomain=()=>isProduction(getEnv())?'https://app.lovrabet.com':'https://daily.lovrabet.com';export const getAppBaseUrl=_0x480d57=>{const _0x4bd8c5=a138_0x2ea072,_0x58b0fb=encodeURIComponent(_0x480d57[_0x4bd8c5(0x1eb)]());return isProduction(getEnv())?getAppDomain()+_0x4bd8c5(0x1e7)+_0x58b0fb:getAppDomain()+_0x4bd8c5(0x1ec)+_0x58b0fb;};
|
package/lib/constant/env.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a139_0x3cb259=a139_0x53ef;function a139_0x52ef(){const _0x2a52a9=['1831312axfKnM','1865026lGvZLE','530600KdExKV','dev','9555ikLjQP','10449796XazGPe','25312716SeHTYS','3ArrdCW','online','production','1247875ZhzVID','daily','development','3930QMfOpx'];a139_0x52ef=function(){return _0x2a52a9;};return a139_0x52ef();}(function(_0x2efdd8,_0x5b4a4d){const _0x264d4c=a139_0x53ef,_0x29055f=_0x2efdd8();while(!![]){try{const _0xdbee3c=-parseInt(_0x264d4c(0x1ea))/0x1+parseInt(_0x264d4c(0x1ef))/0x2*(-parseInt(_0x264d4c(0x1e7))/0x3)+parseInt(_0x264d4c(0x1e2))/0x4+-parseInt(_0x264d4c(0x1e4))/0x5*(-parseInt(_0x264d4c(0x1ed))/0x6)+-parseInt(_0x264d4c(0x1e5))/0x7+parseInt(_0x264d4c(0x1ee))/0x8+parseInt(_0x264d4c(0x1e6))/0x9;if(_0xdbee3c===_0x5b4a4d)break;else _0x29055f['push'](_0x29055f['shift']());}catch(_0x3ac2c5){_0x29055f['push'](_0x29055f['shift']());}}}(a139_0x52ef,0xb7bc1));export const RABETBASE_ENV_VALUES=[a139_0x3cb259(0x1e9),a139_0x3cb259(0x1eb)];export function normalizeEnv(_0x370176){const _0x4c9a84=a139_0x3cb259;return _0x370176===_0x4c9a84(0x1e8)?_0x4c9a84(0x1e9):_0x370176;}export function isProduction(_0x36f146){const _0x10a4e3=a139_0x3cb259;return normalizeEnv(_0x36f146)===_0x10a4e3(0x1e9);}export function isDaily(_0x2c911f){return normalizeEnv(_0x2c911f)==='daily';}export function isDev(_0xa849c4){const _0x515257=a139_0x3cb259,_0x2e0fb0=normalizeEnv(_0xa849c4);return _0x2e0fb0===_0x515257(0x1ec)||_0x2e0fb0===_0x515257(0x1e3);}let env=normalizeEnv(process.env.RABETBASE_ENV||process.env.LOVRABET_ENV||'production');export function getEnv(){return env;}function a139_0x53ef(_0x556c94,_0x30b682){_0x556c94=_0x556c94-0x1e2;const _0x52ef7b=a139_0x52ef();let _0x53ef60=_0x52ef7b[_0x556c94];return _0x53ef60;}export function initEnv(_0x160075){env=normalizeEnv(_0x160075);}
|
package/lib/constant/output.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a140_0x26ea(_0x570dd0,_0x38e4ff){_0x570dd0=_0x570dd0-0x1a9;const _0x18601a=a140_0x1860();let _0x26ead0=_0x18601a[_0x570dd0];return _0x26ead0;}(function(_0x4748c3,_0x49ce0a){const _0x9e43f5=a140_0x26ea,_0x5022c1=_0x4748c3();while(!![]){try{const _0x5107f3=-parseInt(_0x9e43f5(0x1b3))/0x1*(-parseInt(_0x9e43f5(0x1aa))/0x2)+-parseInt(_0x9e43f5(0x1ae))/0x3+-parseInt(_0x9e43f5(0x1af))/0x4*(-parseInt(_0x9e43f5(0x1b0))/0x5)+parseInt(_0x9e43f5(0x1ac))/0x6*(-parseInt(_0x9e43f5(0x1ad))/0x7)+-parseInt(_0x9e43f5(0x1b1))/0x8*(-parseInt(_0x9e43f5(0x1b2))/0x9)+parseInt(_0x9e43f5(0x1ab))/0xa+-parseInt(_0x9e43f5(0x1a9))/0xb;if(_0x5107f3===_0x49ce0a)break;else _0x5022c1['push'](_0x5022c1['shift']());}catch(_0x47ba5b){_0x5022c1['push'](_0x5022c1['shift']());}}}(a140_0x1860,0xdb9d7));export const RABETBASE_OUTPUT_FORMAT_VALUES=['json','pretty','compress'];function a140_0x1860(){const _0x2782da=['11gqotJM','6215022rLtzpC','101032EQeMFY','17656390khUGEJ','3858XLtDTX','6083gRQDEh','4020759TOqFkF','3240yXeUPu','1405CeQgEd','2176WMuOZu','26955kDulBE'];a140_0x1860=function(){return _0x2782da;};return a140_0x1860();}
|