@lovrabet/rabetbase-cli 2.3.9-beta.3 → 2.3.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/api-doc.js +1 -1
- package/lib/api/fetch-model-list.js +1 -1
- package/lib/api/generate-api-file.js +1 -1
- package/lib/auth/auth-server-ui.js +1 -1
- package/lib/auth/auth-server.js +1 -1
- package/lib/auth/constant.js +1 -1
- package/lib/auth/get-cookie.js +1 -1
- package/lib/auth/get-session-user.js +1 -1
- package/lib/auth/is-session-valid.js +1 -1
- package/lib/auth/login-success-html.js +1 -1
- package/lib/auth/logout.js +1 -1
- package/lib/cli-flags.js +1 -1
- package/lib/cli.js +1 -1
- package/lib/commands/api/generate.js +1 -1
- package/lib/commands/api/index.js +1 -1
- package/lib/commands/api/list.js +1 -1
- package/lib/commands/api/pull.js +1 -1
- package/lib/commands/api/shared.js +1 -1
- package/lib/commands/app/add.js +1 -1
- package/lib/commands/app/index.js +1 -1
- package/lib/commands/app/list.js +1 -1
- package/lib/commands/app/remote-directory.js +1 -1
- package/lib/commands/app/remove.js +1 -1
- package/lib/commands/app/shared.js +1 -1
- package/lib/commands/app-config/delete.js +1 -1
- package/lib/commands/app-config/get.js +1 -1
- package/lib/commands/app-config/index.js +1 -1
- package/lib/commands/app-config/list.js +1 -1
- package/lib/commands/app-config/set.js +1 -1
- package/lib/commands/app-config/shared.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-skill/index.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-registry.js +1 -1
- package/lib/commands/common/app-selector.js +1 -1
- package/lib/commands/common/async-task.js +1 -1
- package/lib/commands/common/dry-run.js +1 -1
- package/lib/commands/common/flags.js +1 -1
- package/lib/commands/common/local-file.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/business-group-update.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/generate.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-audit.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/dataset/restore.js +1 -1
- package/lib/commands/db/analysis-batching.js +1 -1
- package/lib/commands/db/analyze-batch-plan.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/file/index.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/delete.js +1 -1
- package/lib/commands/menu/group-create.js +1 -1
- package/lib/commands/menu/group-update.js +1 -1
- package/lib/commands/menu/index.js +1 -1
- package/lib/commands/menu/list.js +1 -1
- package/lib/commands/menu/regroup-start.js +1 -1
- package/lib/commands/menu/shared/compare-table.js +1 -1
- package/lib/commands/menu/shared/delete-plan.js +1 -1
- package/lib/commands/menu/shared/facts.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/mutations.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/notification/config-list.js +1 -1
- package/lib/commands/notification/index.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/permit/index.js +1 -1
- package/lib/commands/permit/page-get.js +1 -1
- package/lib/commands/permit/page-set.js +1 -1
- package/lib/commands/permit/role-apis-set.js +1 -1
- package/lib/commands/permit/role-menus-set.js +1 -1
- package/lib/commands/permit/role-menus.js +1 -1
- package/lib/commands/permit/shared.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/role/create.js +1 -1
- package/lib/commands/role/delete.js +1 -1
- package/lib/commands/role/detail.js +1 -1
- package/lib/commands/role/index.js +1 -1
- package/lib/commands/role/list.js +1 -1
- package/lib/commands/role/shared.js +1 -1
- package/lib/commands/role/update.js +1 -1
- package/lib/commands/role/user-add.js +1 -1
- package/lib/commands/role/user-remove.js +1 -1
- package/lib/commands/role/user-resolve.js +1 -1
- package/lib/commands/run/index.js +1 -1
- package/lib/commands/schema.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/commands/task/index.js +1 -1
- package/lib/commands/task/status.js +1 -1
- package/lib/commands/workspace/add.js +1 -1
- package/lib/commands/workspace/index.js +1 -1
- package/lib/commands/workspace/remove.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/app-resolver.js +1 -1
- package/lib/context/auth-resolver.js +1 -1
- package/lib/context/config-loader.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-index-auditor.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/error-output.js +1 -1
- package/lib/framework/explicit-yes.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
package/lib/commands/sql/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a169_0x364b89=a169_0x2291;function a169_0x38f7(){const _0x5aca2a=['Page\x20size','230988GWDdWY','bool','sql','num','list','appCode','sqlName','13609518YdVqPs','str','270632zOzuGE','verbose','876946gbTPHB','No\x20custom\x20SQL\x20queries\x20found.','9Rswgef','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','totalCount','string','2zyEeYJ','10776BoHUBP','2870PanwgZ','List\x20custom\x20SQL\x20queries','\x20SQL\x20queries\x20(total:\x20','tableData','803nFIGpI','paging','pagesize','dbId','Found\x20','read','91WLsDXd','number','80IBJkxZ','length','14035690ihbJkI','name','247686YyyJHD','description'];a169_0x38f7=function(){return _0x5aca2a;};return a169_0x38f7();}(function(_0x385334,_0x585b17){const _0x5ac285=a169_0x2291,_0x82d1d1=_0x385334();while(!![]){try{const _0x5d645b=-parseInt(_0x5ac285(0x1a4))/0x1*(-parseInt(_0x5ac285(0x19e))/0x2)+parseInt(_0x5ac285(0x190))/0x3*(parseInt(_0x5ac285(0x18c))/0x4)+-parseInt(_0x5ac285(0x1a6))/0x5*(parseInt(_0x5ac285(0x1a5))/0x6)+parseInt(_0x5ac285(0x18a))/0x7*(parseInt(_0x5ac285(0x19c))/0x8)+parseInt(_0x5ac285(0x1a0))/0x9*(parseInt(_0x5ac285(0x18e))/0xa)+-parseInt(_0x5ac285(0x1aa))/0xb*(parseInt(_0x5ac285(0x193))/0xc)+-parseInt(_0x5ac285(0x19a))/0xd;if(_0x5d645b===_0x585b17)break;else _0x82d1d1['push'](_0x82d1d1['shift']());}catch(_0x51922f){_0x82d1d1['push'](_0x82d1d1['shift']());}}}(a169_0x38f7,0xd8ef5));import{listSqlQueries}from'../../core/api-client.js';function a169_0x2291(_0x426d1c,_0x2a8c9a){_0x426d1c=_0x426d1c-0x185;const _0x38f79a=a169_0x38f7();let _0x2291e7=_0x38f79a[_0x426d1c];return _0x2291e7;}import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':a169_0x364b89(0x195),'command':a169_0x364b89(0x197),'description':a169_0x364b89(0x1a7),'risk':a169_0x364b89(0x189),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'name','type':a169_0x364b89(0x1a3),'description':'Filter\x20by\x20SQL\x20name'},{'name':'page','type':a169_0x364b89(0x18b),'description':'Page\x20number','default':0x1},{'name':a169_0x364b89(0x186),'type':a169_0x364b89(0x18b),'description':a169_0x364b89(0x192)},{'name':a169_0x364b89(0x19d),'type':'boolean','description':a169_0x364b89(0x1a1)}],async 'execute'(_0x5b3768){const _0x7a7e6=a169_0x364b89,_0x37e871=await listSqlQueries(_0x5b3768['appCode'],{'sqlCode':_0x5b3768[_0x7a7e6(0x19b)]('sqlcode')||undefined,'sqlName':_0x5b3768['str'](_0x7a7e6(0x18f))||undefined,'currentPage':_0x5b3768['num']('page'),'pageSize':_0x5b3768[_0x7a7e6(0x196)](_0x7a7e6(0x186),0x32)}),_0x526e45=_0x5b3768[_0x7a7e6(0x194)](_0x7a7e6(0x19d)),_0x390a53=_0x37e871[_0x7a7e6(0x1a9)]??[],_0x4af2b2=_0x37e871[_0x7a7e6(0x185)]?.[_0x7a7e6(0x1a2)]??_0x390a53[_0x7a7e6(0x18d)];let _0x2a9668;return _0x526e45?_0x2a9668=_0x390a53:_0x2a9668=await Promise['all'](_0x390a53['map'](async _0x50f7c6=>{const _0x5cc656=_0x7a7e6;let _0xad8fe6;try{_0xad8fe6=_0x50f7c6[_0x5cc656(0x187)]?await getDbName(_0x5b3768[_0x5cc656(0x198)],_0x50f7c6[_0x5cc656(0x187)]):undefined;}catch{}return{'sqlCode':_0x50f7c6['sqlCode'],'sqlName':_0x50f7c6[_0x5cc656(0x199)],'description':_0x50f7c6[_0x5cc656(0x191)]??'','db':_0xad8fe6?_0xad8fe6+'\x20('+_0x50f7c6[_0x5cc656(0x187)]+')':_0x50f7c6[_0x5cc656(0x187)]??''};})),{'ok':!![],'data':_0x2a9668,'message':_0x390a53['length']===0x0?_0x7a7e6(0x19f):_0x7a7e6(0x188)+_0x390a53[_0x7a7e6(0x18d)]+_0x7a7e6(0x1a8)+_0x4af2b2+').'};}};
|
package/lib/commands/sql/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a170_0x5e992d=a170_0x4467;function a170_0x4467(_0x430a70,_0x42ce95){_0x430a70=_0x430a70-0x1f4;const _0x2c4a4d=a170_0x2c4a();let _0x4467b5=_0x2c4a4d[_0x430a70];return _0x4467b5;}(function(_0x5ec66f,_0x2a3f48){const _0x702463=a170_0x4467,_0x9c3b6b=_0x5ec66f();while(!![]){try{const _0x58231d=-parseInt(_0x702463(0x208))/0x1+-parseInt(_0x702463(0x202))/0x2+parseInt(_0x702463(0x22a))/0x3*(parseInt(_0x702463(0x205))/0x4)+parseInt(_0x702463(0x201))/0x5*(parseInt(_0x702463(0x210))/0x6)+parseInt(_0x702463(0x221))/0x7*(-parseInt(_0x702463(0x225))/0x8)+parseInt(_0x702463(0x1f4))/0x9+parseInt(_0x702463(0x1ff))/0xa;if(_0x58231d===_0x2a3f48)break;else _0x9c3b6b['push'](_0x9c3b6b['shift']());}catch(_0x25fb03){_0x9c3b6b['push'](_0x9c3b6b['shift']());}}}(a170_0x2c4a,0x415bd));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';function a170_0x2c4a(){const _0x5cd5a4=['150uKmOkk','path','mybatisXml','Would\x20pull\x20','lockFilePath','utf8','POST','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','string','cancelled','Force\x20pull\x20cancelled.','split','lastSync','paging','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','push','trimStart','7NxJAPN','appCode','conflict','force','3865624VmazxS','dbId','length','sqls','bool','1593105gUOaAf','\x20skipped,\x20','filter','sqlContent','Pull\x20complete:\x20','\x20written,\x20','boolean','totalCount','str','1574343IVtkpH','sqlcode','catch','sqlRootDir','sqlName','Filter\x20by\x20SQL\x20display\x20name','message','description','sqlCode','\x20SQL\x20file(s)\x20into\x20','replace','3731770OhUpap','write','39085zzbXpf','823912bFHHLX','skipped','toISOString','4NtCNRS','would_pull','pull','111696gFeCwj','name','unchanged','test','apps','sql','\x20failed','No\x20remote\x20SQL\x20queries\x20matched.'];a170_0x2c4a=function(){return _0x5cd5a4;};return a170_0x2c4a();}import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x21fe2e,_0x44a1cb){const _0x484887=a170_0x4467,_0x424ba3=[];let _0x515a11=0x1;while(!![]){const _0x2ae78c=await listSqlQueries(_0x21fe2e,{'currentPage':_0x515a11,'pageSize':PAGE_SIZE,'sqlCode':_0x44a1cb['sqlCode'],'sqlName':_0x44a1cb['sqlName']}),_0x453aa7=_0x2ae78c['tableData']??[];_0x424ba3['push'](..._0x453aa7);if(_0x453aa7[_0x484887(0x227)]===0x0)break;const _0x2fd06c=_0x2ae78c[_0x484887(0x21d)]?.[_0x484887(0x231)];if(_0x2fd06c!=null?_0x424ba3[_0x484887(0x227)]>=_0x2fd06c:_0x453aa7[_0x484887(0x227)]<PAGE_SIZE)break;_0x515a11++;}return _0x424ba3;}async function ensureSqlContent(_0x171511){const _0x38cba7=a170_0x4467;if(_0x171511[_0x38cba7(0x22d)]!=null&&String(_0x171511[_0x38cba7(0x22d)])[_0x38cba7(0x227)]>0x0)return _0x171511;return getSqlQueryDetail(_0x171511[_0x38cba7(0x1fc)]);}export const sqlPull={'service':a170_0x5e992d(0x20d),'command':'pull','description':a170_0x5e992d(0x21e),'risk':a170_0x5e992d(0x200),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a170_0x5e992d(0x209),'type':a170_0x5e992d(0x218),'description':a170_0x5e992d(0x1f9)},{'name':a170_0x5e992d(0x224),'type':a170_0x5e992d(0x230),'description':'Force\x20overwrite\x20local\x20unsynced\x20changes'}],async 'dryRun'(_0x536783){const _0x7b59a3=a170_0x5e992d,_0x7491be=loadSqlProjectConfig(_0x536783[_0x7b59a3(0x222)]),_0x23703b=await readSqlLockFile(_0x7491be['lockFilePath']),{appLock:_0x2a528d}=ensureSqlLockScope(_0x23703b??createEmptySqlLock(),_0x7491be[_0x7b59a3(0x222)],_0x7491be['sqlRoot'],'pull'),_0x52652b=await fetchAllSqlQueries(_0x536783['appCode'],{'sqlCode':_0x536783[_0x7b59a3(0x232)](_0x7b59a3(0x1f5))||undefined,'sqlName':_0x536783[_0x7b59a3(0x232)]('name')||undefined}),_0x62290b=[];for(const _0x1d2706 of _0x52652b){const _0x9d7a9e=await ensureSqlContent(_0x1d2706),_0x4653a8=ensureRemoteSqlContent(_0x9d7a9e),_0x5d447a=detectModeFromSql(_0x9d7a9e),_0x3104ef=_0x9d7a9e[_0x7b59a3(0x226)]?await getDbName(_0x536783[_0x7b59a3(0x222)],Number(_0x9d7a9e[_0x7b59a3(0x226)]))[_0x7b59a3(0x1f6)](()=>undefined):undefined,_0xfeaf40=buildLocalSqlFileContent({'sqlCode':_0x9d7a9e[_0x7b59a3(0x1fc)],'sqlName':_0x9d7a9e[_0x7b59a3(0x1f8)],'dbId':_0x9d7a9e[_0x7b59a3(0x226)]},_0x4653a8,{'dbName':_0x3104ef,'mode':_0x5d447a,'syncedAt':new Date()[_0x7b59a3(0x204)](),'description':_0x9d7a9e[_0x7b59a3(0x1fb)]}),_0x1340f8=buildSqlLockEntry(_0x9d7a9e,_0x4653a8,'',{'dbName':_0x3104ef}),_0xa99426=resolveLocalSqlFilePath(_0x7491be,_0x9d7a9e[_0x7b59a3(0x1fc)],_0x1340f8);let _0x31cfab=_0x7b59a3(0x206),_0x22f7bd;if(await fileExists(_0xa99426)){const _0x148114=await readFile(_0xa99426,_0x7b59a3(0x215));isEquivalentPulledSqlFile(_0x148114,_0xfeaf40,_0x5d447a)?(_0x31cfab=_0x7b59a3(0x203),_0x22f7bd=_0x7b59a3(0x20a)):(_0x31cfab=_0x7b59a3(0x223),_0x22f7bd='local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)');}_0x62290b[_0x7b59a3(0x21f)]({'sqlCode':_0x9d7a9e[_0x7b59a3(0x1fc)],'sqlName':_0x9d7a9e[_0x7b59a3(0x1f8)],'filePath':_0xa99426,'status':_0x31cfab,'reason':_0x22f7bd});}return{'method':_0x7b59a3(0x216),'url':'/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','body':{'appCode':_0x536783[_0x7b59a3(0x222)],'sqlCode':_0x536783[_0x7b59a3(0x232)](_0x7b59a3(0x1f5))||null,'sqlName':_0x536783[_0x7b59a3(0x232)](_0x7b59a3(0x209))||null,'files':_0x62290b},'description':_0x7b59a3(0x213)+_0x62290b[_0x7b59a3(0x227)]+_0x7b59a3(0x1fd)+_0x7491be['sqlRootDir']};},async 'execute'(_0x53f1da){const _0x4225fa=a170_0x5e992d,_0x503fbf=loadSqlProjectConfig(_0x53f1da[_0x4225fa(0x222)]),_0x260aac=await readSqlLockFile(_0x503fbf[_0x4225fa(0x214)]),{lockData:_0x343548,appLock:_0x30ac60}=ensureSqlLockScope(_0x260aac??createEmptySqlLock(),_0x503fbf['appCode'],_0x503fbf['sqlRoot'],_0x4225fa(0x207)),_0x35e5de=_0x53f1da[_0x4225fa(0x229)]('force'),_0x23489b=await fetchAllSqlQueries(_0x53f1da['appCode'],{'sqlCode':_0x53f1da[_0x4225fa(0x232)](_0x4225fa(0x1f5))||undefined,'sqlName':_0x53f1da[_0x4225fa(0x232)](_0x4225fa(0x209))||undefined});if(_0x23489b[_0x4225fa(0x227)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x4225fa(0x20f)};const _0x2adc52=[],_0x3f545e=[];for(const _0x5da422 of _0x23489b){try{_0x2adc52[_0x4225fa(0x21f)](await ensureSqlContent(_0x5da422));}catch(_0x11cc8c){_0x3f545e[_0x4225fa(0x21f)]({'sqlCode':_0x5da422['sqlCode'],'error':_0x11cc8c instanceof Error?_0x11cc8c[_0x4225fa(0x1fa)]:String(_0x11cc8c)});}}if(_0x35e5de&&!_0x53f1da['nonInteractive']){let _0x3da236=![];for(const _0x592f0a of _0x2adc52){const _0x5ce742=detectModeFromSql(_0x592f0a),_0x33e0f5=_0x592f0a[_0x4225fa(0x226)]?await getDbName(_0x53f1da[_0x4225fa(0x222)],Number(_0x592f0a[_0x4225fa(0x226)]))[_0x4225fa(0x1f6)](()=>undefined):undefined,_0xed62a6=buildLocalSqlFileContent({'sqlCode':_0x592f0a['sqlCode'],'sqlName':_0x592f0a['sqlName'],'dbId':_0x592f0a['dbId']},ensureRemoteSqlContent(_0x592f0a),{'dbName':_0x33e0f5,'mode':_0x5ce742,'syncedAt':new Date()[_0x4225fa(0x204)](),'description':_0x592f0a['description']}),_0x4f12b9=resolveLocalSqlFilePath(_0x503fbf,_0x592f0a[_0x4225fa(0x1fc)],buildSqlLockEntry(_0x592f0a,ensureRemoteSqlContent(_0x592f0a),'',{'dbName':_0x33e0f5}));if(await fileExists(_0x4f12b9)){const _0x5f5d26=await readFile(_0x4f12b9,'utf8');if(!isEquivalentPulledSqlFile(_0x5f5d26,_0xed62a6,_0x5ce742)){_0x3da236=!![];break;}}}if(_0x3da236){const _0x12760d=await confirmForceOverwrite(_0x4225fa(0x217));if(!_0x12760d)throw CliErrors[_0x4225fa(0x219)](_0x4225fa(0x21a));}}const _0x4d2d96=cloneSqlLockData(_0x343548),_0x449c36=_0x4d2d96[_0x4225fa(0x20c)][_0x503fbf['appCode']],_0x54f9da=[],_0x35e6fd=[];for(const _0x577fdc of _0x2adc52){const _0x2fe978=_0x449c36['sqls'][_0x577fdc[_0x4225fa(0x1fc)]],_0x2df48e=ensureRemoteSqlContent(_0x577fdc),_0x337c57=detectModeFromSql(_0x577fdc),_0x4e86d5=_0x577fdc[_0x4225fa(0x226)]?await getDbName(_0x53f1da[_0x4225fa(0x222)],Number(_0x577fdc[_0x4225fa(0x226)]))[_0x4225fa(0x1f6)](()=>undefined):undefined,_0x288df8=buildLocalSqlFileContent({'sqlCode':_0x577fdc[_0x4225fa(0x1fc)],'sqlName':_0x577fdc[_0x4225fa(0x1f8)],'dbId':_0x577fdc[_0x4225fa(0x226)]},_0x2df48e,{'dbName':_0x4e86d5,'mode':_0x337c57,'syncedAt':new Date()[_0x4225fa(0x204)](),'description':_0x577fdc[_0x4225fa(0x1fb)]}),_0x45abf7=buildSqlLockEntry(_0x577fdc,_0x2df48e,computeSqlContentHash(_0x288df8),{'dbName':_0x4e86d5}),_0x15dfe8=_0x45abf7[_0x4225fa(0x211)],_0x439f3f=join(_0x503fbf[_0x4225fa(0x1f7)],_0x15dfe8);try{if(await fileExists(_0x439f3f)){const _0xeff5d=await readFile(_0x439f3f,_0x4225fa(0x215));if(isEquivalentPulledSqlFile(_0xeff5d,_0x288df8,_0x337c57)){_0x35e6fd['push']({'sqlCode':_0x577fdc[_0x4225fa(0x1fc)],'reason':_0x4225fa(0x20a)}),_0x449c36['sqls'][_0x577fdc[_0x4225fa(0x1fc)]]={..._0x45abf7,'hash':computeSqlContentHash(_0xeff5d),'path':_0x15dfe8};continue;}if(!_0x35e5de){_0x35e6fd['push']({'sqlCode':_0x577fdc['sqlCode'],'reason':'local\x20differs\x20from\x20remote'});continue;}}const _0x444bdb=_0x2fe978?.[_0x4225fa(0x211)]?join(_0x503fbf[_0x4225fa(0x1f7)],_0x2fe978[_0x4225fa(0x211)]):undefined;_0x444bdb&&_0x444bdb!==_0x439f3f&&await fileExists(_0x444bdb)&&await rm(_0x444bdb,{'force':!![]}),await ensureParentDirectory(_0x439f3f),await writeFile(_0x439f3f,_0x288df8,_0x4225fa(0x215)),_0x449c36[_0x4225fa(0x228)][_0x577fdc[_0x4225fa(0x1fc)]]={..._0x45abf7,'path':_0x15dfe8},_0x54f9da['push']({'sqlCode':_0x577fdc[_0x4225fa(0x1fc)],'filePath':_0x439f3f});}catch(_0x482541){_0x3f545e[_0x4225fa(0x21f)]({'sqlCode':_0x577fdc['sqlCode'],'error':_0x482541 instanceof Error?_0x482541[_0x4225fa(0x1fa)]:String(_0x482541)});}}return _0x449c36[_0x4225fa(0x21c)]=new Date()[_0x4225fa(0x204)](),await writeSqlLockFile(_0x503fbf['lockFilePath'],_0x4d2d96),{'ok':_0x3f545e[_0x4225fa(0x227)]===0x0,'data':{'pulled':_0x54f9da,'skipped':_0x35e6fd,'failed':_0x3f545e},'message':_0x4225fa(0x22e)+_0x54f9da[_0x4225fa(0x227)]+_0x4225fa(0x22f)+_0x35e6fd[_0x4225fa(0x227)]+_0x4225fa(0x22b)+_0x3f545e[_0x4225fa(0x227)]+_0x4225fa(0x20e)};}};function detectModeFromSql(_0x21a84c){const _0x1f7a4f=a170_0x5e992d,_0x44e8c4=ensureRemoteSqlContent(_0x21a84c),_0x287550=stripLocalSqlMetadata(_0x44e8c4,'mybatisXml')[_0x1f7a4f(0x220)]();if(/^<(select|insert|update|delete)\b/i['test'](_0x287550))return _0x1f7a4f(0x212);return _0x1f7a4f(0x20d);}function isEquivalentPulledSqlFile(_0x423167,_0x47c9b9,_0x4f5be9){return normalizePullComparableContent(_0x423167,_0x4f5be9)===normalizePullComparableContent(_0x47c9b9,_0x4f5be9);}function normalizePullComparableContent(_0x360577,_0x5d8cf6){const _0x3733d1=a170_0x5e992d,_0x5e9692=_0x360577[_0x3733d1(0x1fe)](/\r\n/g,'\x0a')[_0x3733d1(0x21b)]('\x0a'),_0x1528fb=_0x5e9692[_0x3733d1(0x22c)](_0xf69d95=>!isSyncedAtMetadataLine(_0xf69d95,_0x5d8cf6));return _0x1528fb['join']('\x0a');}function isSyncedAtMetadataLine(_0x29319a,_0x3725d5){const _0x55347e=a170_0x5e992d;if(_0x3725d5===_0x55347e(0x212))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x55347e(0x20b)](_0x29319a);return/^\s*--\s*@lovrabet\.syncedAt:/['test'](_0x29319a);}
|
|
1
|
+
const a170_0x289e6c=a170_0xb2ef;(function(_0x4d6173,_0x7806ef){const _0x5e4695=a170_0xb2ef,_0x150b33=_0x4d6173();while(!![]){try{const _0x490b54=parseInt(_0x5e4695(0x21a))/0x1*(parseInt(_0x5e4695(0x222))/0x2)+-parseInt(_0x5e4695(0x228))/0x3*(parseInt(_0x5e4695(0x20e))/0x4)+parseInt(_0x5e4695(0x211))/0x5*(-parseInt(_0x5e4695(0x1f4))/0x6)+-parseInt(_0x5e4695(0x1f2))/0x7+-parseInt(_0x5e4695(0x203))/0x8+parseInt(_0x5e4695(0x1f7))/0x9+-parseInt(_0x5e4695(0x20d))/0xa*(-parseInt(_0x5e4695(0x20a))/0xb);if(_0x490b54===_0x7806ef)break;else _0x150b33['push'](_0x150b33['shift']());}catch(_0x51ae32){_0x150b33['push'](_0x150b33['shift']());}}}(a170_0xef20,0xa0a33));function a170_0xef20(){const _0x269142=['description','tableData','\x20written,\x20','name','str','split','7999384VbwKGZ','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','boolean','pull','lastSync','conflict','push','52052nDWKvh','message','apps','5460TKWSLG','820yyznsy','Force\x20overwrite\x20local\x20unsynced\x20changes','path','120vkGUgv','would_pull','sqlcode','\x20SQL\x20file(s)\x20into\x20','force','skipped','sql','No\x20remote\x20SQL\x20queries\x20matched.','nonInteractive','1621QZwXdS','filter','catch','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','sqlCode','length','Force\x20pull\x20cancelled.','894hnZSYw','\x20skipped,\x20','test','replace','sqls','\x20failed','13407UwrEkd','sqlContent','trimStart','lockFilePath','Filter\x20by\x20SQL\x20display\x20name','Pull\x20complete:\x20','totalCount','appCode','utf8','sqlRoot','Would\x20pull\x20','string','unchanged','POST','3536582dZSOhR','write','259128Tsmujv','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','dbId','7267662dAjgSg','mybatisXml','sqlName','cancelled','sqlRootDir','toISOString'];a170_0xef20=function(){return _0x269142;};return a170_0xef20();}import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';function a170_0xb2ef(_0x2ddeb1,_0x1daf20){_0x2ddeb1=_0x2ddeb1-0x1ed;const _0xef2006=a170_0xef20();let _0xb2efc8=_0xef2006[_0x2ddeb1];return _0xb2efc8;}import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x226bcc,_0x2a5206){const _0x141e85=a170_0xb2ef,_0x13a761=[];let _0xb651ed=0x1;while(!![]){const _0x165496=await listSqlQueries(_0x226bcc,{'currentPage':_0xb651ed,'pageSize':PAGE_SIZE,'sqlCode':_0x2a5206['sqlCode'],'sqlName':_0x2a5206[_0x141e85(0x1f9)]}),_0x5b133b=_0x165496[_0x141e85(0x1fe)]??[];_0x13a761['push'](..._0x5b133b);if(_0x5b133b[_0x141e85(0x220)]===0x0)break;const _0x234883=_0x165496['paging']?.[_0x141e85(0x22e)];if(_0x234883!=null?_0x13a761[_0x141e85(0x220)]>=_0x234883:_0x5b133b[_0x141e85(0x220)]<PAGE_SIZE)break;_0xb651ed++;}return _0x13a761;}async function ensureSqlContent(_0x478260){const _0x1ed4b0=a170_0xb2ef;if(_0x478260[_0x1ed4b0(0x229)]!=null&&String(_0x478260[_0x1ed4b0(0x229)])[_0x1ed4b0(0x220)]>0x0)return _0x478260;return getSqlQueryDetail(_0x478260[_0x1ed4b0(0x21f)]);}export const sqlPull={'service':a170_0x289e6c(0x217),'command':a170_0x289e6c(0x206),'description':a170_0x289e6c(0x204),'risk':a170_0x289e6c(0x1f3),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'name','type':a170_0x289e6c(0x1ef),'description':a170_0x289e6c(0x22c)},{'name':a170_0x289e6c(0x215),'type':a170_0x289e6c(0x205),'description':a170_0x289e6c(0x20f)}],async 'dryRun'(_0x5367c1){const _0x53036d=a170_0x289e6c,_0x3dc721=loadSqlProjectConfig(_0x5367c1['appCode']),_0x552273=await readSqlLockFile(_0x3dc721[_0x53036d(0x22b)]),{appLock:_0x340941}=ensureSqlLockScope(_0x552273??createEmptySqlLock(),_0x3dc721[_0x53036d(0x22f)],_0x3dc721[_0x53036d(0x1ed)],_0x53036d(0x206)),_0x1e7f65=await fetchAllSqlQueries(_0x5367c1[_0x53036d(0x22f)],{'sqlCode':_0x5367c1['str'](_0x53036d(0x213))||undefined,'sqlName':_0x5367c1[_0x53036d(0x201)](_0x53036d(0x200))||undefined}),_0x380106=[];for(const _0x220a33 of _0x1e7f65){const _0x5382a7=await ensureSqlContent(_0x220a33),_0x4c4c54=ensureRemoteSqlContent(_0x5382a7),_0x46c9c4=detectModeFromSql(_0x5382a7),_0x18ee36=_0x5382a7[_0x53036d(0x1f6)]?await getDbName(_0x5367c1[_0x53036d(0x22f)],Number(_0x5382a7[_0x53036d(0x1f6)]))[_0x53036d(0x21c)](()=>undefined):undefined,_0x14b197=buildLocalSqlFileContent({'sqlCode':_0x5382a7[_0x53036d(0x21f)],'sqlName':_0x5382a7[_0x53036d(0x1f9)],'dbId':_0x5382a7[_0x53036d(0x1f6)]},_0x4c4c54,{'dbName':_0x18ee36,'mode':_0x46c9c4,'syncedAt':new Date()[_0x53036d(0x1fc)](),'description':_0x5382a7[_0x53036d(0x1fd)]}),_0x1c4cab=buildSqlLockEntry(_0x5382a7,_0x4c4c54,'',{'dbName':_0x18ee36}),_0x48f71e=resolveLocalSqlFilePath(_0x3dc721,_0x5382a7[_0x53036d(0x21f)],_0x1c4cab);let _0x4ccfde=_0x53036d(0x212),_0x348e1b;if(await fileExists(_0x48f71e)){const _0x544f49=await readFile(_0x48f71e,_0x53036d(0x230));isEquivalentPulledSqlFile(_0x544f49,_0x14b197,_0x46c9c4)?(_0x4ccfde=_0x53036d(0x216),_0x348e1b=_0x53036d(0x1f0)):(_0x4ccfde=_0x53036d(0x208),_0x348e1b=_0x53036d(0x21d));}_0x380106[_0x53036d(0x209)]({'sqlCode':_0x5382a7['sqlCode'],'sqlName':_0x5382a7[_0x53036d(0x1f9)],'filePath':_0x48f71e,'status':_0x4ccfde,'reason':_0x348e1b});}return{'method':_0x53036d(0x1f1),'url':_0x53036d(0x1f5),'body':{'appCode':_0x5367c1['appCode'],'sqlCode':_0x5367c1[_0x53036d(0x201)](_0x53036d(0x213))||null,'sqlName':_0x5367c1[_0x53036d(0x201)](_0x53036d(0x200))||null,'files':_0x380106},'description':_0x53036d(0x1ee)+_0x380106[_0x53036d(0x220)]+_0x53036d(0x214)+_0x3dc721[_0x53036d(0x1fb)]};},async 'execute'(_0x4551a6){const _0x27d585=a170_0x289e6c,_0x262daf=loadSqlProjectConfig(_0x4551a6['appCode']),_0x4def2b=await readSqlLockFile(_0x262daf[_0x27d585(0x22b)]),{lockData:_0x443965,appLock:_0x436cc1}=ensureSqlLockScope(_0x4def2b??createEmptySqlLock(),_0x262daf[_0x27d585(0x22f)],_0x262daf['sqlRoot'],_0x27d585(0x206)),_0x3283d0=_0x4551a6['bool'](_0x27d585(0x215)),_0x5a9d39=await fetchAllSqlQueries(_0x4551a6[_0x27d585(0x22f)],{'sqlCode':_0x4551a6[_0x27d585(0x201)](_0x27d585(0x213))||undefined,'sqlName':_0x4551a6[_0x27d585(0x201)](_0x27d585(0x200))||undefined});if(_0x5a9d39[_0x27d585(0x220)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x27d585(0x218)};const _0xc36d4a=[],_0x5c308c=[];for(const _0x254246 of _0x5a9d39){try{_0xc36d4a[_0x27d585(0x209)](await ensureSqlContent(_0x254246));}catch(_0xb0ff5b){_0x5c308c['push']({'sqlCode':_0x254246[_0x27d585(0x21f)],'error':_0xb0ff5b instanceof Error?_0xb0ff5b[_0x27d585(0x20b)]:String(_0xb0ff5b)});}}if(_0x3283d0&&!_0x4551a6[_0x27d585(0x219)]){let _0x8cde8d=![];for(const _0x509368 of _0xc36d4a){const _0x4cb803=detectModeFromSql(_0x509368),_0x5be37a=_0x509368[_0x27d585(0x1f6)]?await getDbName(_0x4551a6['appCode'],Number(_0x509368['dbId']))[_0x27d585(0x21c)](()=>undefined):undefined,_0x2353e3=buildLocalSqlFileContent({'sqlCode':_0x509368['sqlCode'],'sqlName':_0x509368[_0x27d585(0x1f9)],'dbId':_0x509368[_0x27d585(0x1f6)]},ensureRemoteSqlContent(_0x509368),{'dbName':_0x5be37a,'mode':_0x4cb803,'syncedAt':new Date()[_0x27d585(0x1fc)](),'description':_0x509368[_0x27d585(0x1fd)]}),_0x42ed4b=resolveLocalSqlFilePath(_0x262daf,_0x509368[_0x27d585(0x21f)],buildSqlLockEntry(_0x509368,ensureRemoteSqlContent(_0x509368),'',{'dbName':_0x5be37a}));if(await fileExists(_0x42ed4b)){const _0x5ec3e6=await readFile(_0x42ed4b,_0x27d585(0x230));if(!isEquivalentPulledSqlFile(_0x5ec3e6,_0x2353e3,_0x4cb803)){_0x8cde8d=!![];break;}}}if(_0x8cde8d){const _0x45dc06=await confirmForceOverwrite(_0x27d585(0x21e));if(!_0x45dc06)throw CliErrors[_0x27d585(0x1fa)](_0x27d585(0x221));}}const _0x429f1e=cloneSqlLockData(_0x443965),_0x533c9a=_0x429f1e[_0x27d585(0x20c)][_0x262daf['appCode']],_0x29fdf0=[],_0x5145c6=[];for(const _0x46bfc2 of _0xc36d4a){const _0x592a7e=_0x533c9a[_0x27d585(0x226)][_0x46bfc2['sqlCode']],_0x5f004f=ensureRemoteSqlContent(_0x46bfc2),_0x11e2aa=detectModeFromSql(_0x46bfc2),_0x2252b9=_0x46bfc2[_0x27d585(0x1f6)]?await getDbName(_0x4551a6[_0x27d585(0x22f)],Number(_0x46bfc2[_0x27d585(0x1f6)]))[_0x27d585(0x21c)](()=>undefined):undefined,_0xbb1b57=buildLocalSqlFileContent({'sqlCode':_0x46bfc2['sqlCode'],'sqlName':_0x46bfc2['sqlName'],'dbId':_0x46bfc2[_0x27d585(0x1f6)]},_0x5f004f,{'dbName':_0x2252b9,'mode':_0x11e2aa,'syncedAt':new Date()[_0x27d585(0x1fc)](),'description':_0x46bfc2['description']}),_0x17543f=buildSqlLockEntry(_0x46bfc2,_0x5f004f,computeSqlContentHash(_0xbb1b57),{'dbName':_0x2252b9}),_0x3dbfed=_0x17543f[_0x27d585(0x210)],_0x4ee2a3=join(_0x262daf['sqlRootDir'],_0x3dbfed);try{if(await fileExists(_0x4ee2a3)){const _0x1622ff=await readFile(_0x4ee2a3,_0x27d585(0x230));if(isEquivalentPulledSqlFile(_0x1622ff,_0xbb1b57,_0x11e2aa)){_0x5145c6[_0x27d585(0x209)]({'sqlCode':_0x46bfc2[_0x27d585(0x21f)],'reason':'unchanged'}),_0x533c9a[_0x27d585(0x226)][_0x46bfc2[_0x27d585(0x21f)]]={..._0x17543f,'hash':computeSqlContentHash(_0x1622ff),'path':_0x3dbfed};continue;}if(!_0x3283d0){_0x5145c6[_0x27d585(0x209)]({'sqlCode':_0x46bfc2[_0x27d585(0x21f)],'reason':'local\x20differs\x20from\x20remote'});continue;}}const _0xa1947b=_0x592a7e?.[_0x27d585(0x210)]?join(_0x262daf['sqlRootDir'],_0x592a7e[_0x27d585(0x210)]):undefined;_0xa1947b&&_0xa1947b!==_0x4ee2a3&&await fileExists(_0xa1947b)&&await rm(_0xa1947b,{'force':!![]}),await ensureParentDirectory(_0x4ee2a3),await writeFile(_0x4ee2a3,_0xbb1b57,_0x27d585(0x230)),_0x533c9a[_0x27d585(0x226)][_0x46bfc2[_0x27d585(0x21f)]]={..._0x17543f,'path':_0x3dbfed},_0x29fdf0[_0x27d585(0x209)]({'sqlCode':_0x46bfc2[_0x27d585(0x21f)],'filePath':_0x4ee2a3});}catch(_0xe357e3){_0x5c308c[_0x27d585(0x209)]({'sqlCode':_0x46bfc2['sqlCode'],'error':_0xe357e3 instanceof Error?_0xe357e3[_0x27d585(0x20b)]:String(_0xe357e3)});}}return _0x533c9a[_0x27d585(0x207)]=new Date()[_0x27d585(0x1fc)](),await writeSqlLockFile(_0x262daf[_0x27d585(0x22b)],_0x429f1e),{'ok':_0x5c308c['length']===0x0,'data':{'pulled':_0x29fdf0,'skipped':_0x5145c6,'failed':_0x5c308c},'message':_0x27d585(0x22d)+_0x29fdf0['length']+_0x27d585(0x1ff)+_0x5145c6[_0x27d585(0x220)]+_0x27d585(0x223)+_0x5c308c[_0x27d585(0x220)]+_0x27d585(0x227)};}};function detectModeFromSql(_0x24c0b8){const _0xa05d1c=a170_0x289e6c,_0x9993a0=ensureRemoteSqlContent(_0x24c0b8),_0x1228e3=stripLocalSqlMetadata(_0x9993a0,_0xa05d1c(0x1f8))[_0xa05d1c(0x22a)]();if(/^<(select|insert|update|delete)\b/i[_0xa05d1c(0x224)](_0x1228e3))return _0xa05d1c(0x1f8);return _0xa05d1c(0x217);}function isEquivalentPulledSqlFile(_0x520f62,_0x2bb77f,_0x387437){return normalizePullComparableContent(_0x520f62,_0x387437)===normalizePullComparableContent(_0x2bb77f,_0x387437);}function normalizePullComparableContent(_0x125f8f,_0x1181e5){const _0xec8e82=a170_0x289e6c,_0x38de13=_0x125f8f[_0xec8e82(0x225)](/\r\n/g,'\x0a')[_0xec8e82(0x202)]('\x0a'),_0x1c28c0=_0x38de13[_0xec8e82(0x21b)](_0x4df1cf=>!isSyncedAtMetadataLine(_0x4df1cf,_0x1181e5));return _0x1c28c0['join']('\x0a');}function isSyncedAtMetadataLine(_0xac9f9,_0x5e93d1){const _0x1f4105=a170_0x289e6c;if(_0x5e93d1===_0x1f4105(0x1f8))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x1f4105(0x224)](_0xac9f9);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x1f4105(0x224)](_0xac9f9);}
|
package/lib/commands/sql/push.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a171_0x42c8cb=a171_0x4512;(function(_0x9c5b34,_0x228b4f){const _0x3dc3bf=a171_0x4512,_0x57890e=_0x9c5b34();while(!![]){try{const _0x54bcb5=parseInt(_0x3dc3bf(0x1d8))/0x1*(parseInt(_0x3dc3bf(0x1b8))/0x2)+parseInt(_0x3dc3bf(0x1a6))/0x3*(parseInt(_0x3dc3bf(0x1bd))/0x4)+-parseInt(_0x3dc3bf(0x1c2))/0x5+-parseInt(_0x3dc3bf(0x1bc))/0x6*(-parseInt(_0x3dc3bf(0x1c8))/0x7)+parseInt(_0x3dc3bf(0x1d9))/0x8*(parseInt(_0x3dc3bf(0x1b1))/0x9)+parseInt(_0x3dc3bf(0x1dc))/0xa+-parseInt(_0x3dc3bf(0x1c0))/0xb*(parseInt(_0x3dc3bf(0x1a1))/0xc);if(_0x54bcb5===_0x228b4f)break;else _0x57890e['push'](_0x57890e['shift']());}catch(_0x545ba6){_0x57890e['push'](_0x57890e['shift']());}}}(a171_0x55c3,0x7d526));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';function a171_0x55c3(){const _0x456cc0=['entries','Local\x20directory\x20\x22','lockFilePath','filePath','hash','str','sqls','mode','length','exec','set','\x20failed','1011048nwiwBe','4448968veiiyh','sqlCode','sql','3937420vgEXtP','sqlcode','\x20SQL\x20file(s)','sqlRoot','path','push','24eXFdCa','message','force','validation','replace','24NmoeDf','/smartapi/custom/updateUserCustomSql','map','boolean','sqlConfig','dbName','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','sqlName','\x22\x20for\x20sqlCode\x20','POST','relativePath','9yTcYbj','isFinite','join','projectRoot','filter','\x20skipped,\x20','trashDir','2uFBsnT','version','dbId','startsWith','5634IVtcYP','111312SZwecw','bool','appCode','9122146YnPxjH','high-risk-write','4110010IChpEF','toISOString','remoteId','\x20pushed,\x20','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','Push\x20local\x20SQL\x20files\x20to\x20remote','6041MqSKpz','catch','sqlRootDir','Local\x20SQL\x20not\x20found:\x20'];a171_0x55c3=function(){return _0x456cc0;};return a171_0x55c3();}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(_0x22b9d5,_0x2b292f,_0x3eecff){const _0x594058=a171_0x4512,_0x54c42f=await scanLocalSqlQueries(_0x22b9d5),_0x5ade90=new Map();for(const _0x8579bf of _0x54c42f){if(_0x3eecff&&_0x8579bf[_0x594058(0x1da)]!==_0x3eecff)continue;const _0x327eb3=_0x5ade90['get'](_0x8579bf[_0x594058(0x1da)])??[];_0x327eb3[_0x594058(0x1a0)](_0x8579bf),_0x5ade90[_0x594058(0x1d6)](_0x8579bf['sqlCode'],_0x327eb3);}if(_0x3eecff&&!_0x5ade90['has'](_0x3eecff))throw CliErrors['validation'](_0x594058(0x1cb)+_0x3eecff);const _0xf373b9=[];for(const [_0x300e98,_0x2f27ab]of _0x5ade90[_0x594058(0x1cc)]()){if(_0x2f27ab[_0x594058(0x1d4)]===0x1){_0xf373b9[_0x594058(0x1a0)](_0x2f27ab[0x0]);continue;}const _0x32df4e=_0x2b292f[_0x594058(0x1d2)][_0x300e98],_0x4bbff8=_0x32df4e?.[_0x594058(0x19f)],_0xd7a07d=_0x4bbff8?_0x2f27ab[_0x594058(0x1b5)](_0x29138b=>_0x29138b['relativePath']!==_0x4bbff8):_0x2f27ab;if(_0x32df4e&&_0xd7a07d[_0x594058(0x1d4)]===0x1){_0xf373b9[_0x594058(0x1a0)](_0xd7a07d[0x0]);continue;}throw CliErrors[_0x594058(0x1a4)](_0x594058(0x1ac)+_0x300e98+_0x594058(0x1c6));}return _0xf373b9;}export const sqlPush={'service':a171_0x42c8cb(0x1db),'command':a171_0x42c8cb(0x1a0),'description':a171_0x42c8cb(0x1c7),'risk':a171_0x42c8cb(0x1c1),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a171_0x42c8cb(0x1a3),'type':a171_0x42c8cb(0x1a9),'description':'Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock'}],async 'dryRun'(_0x225ef5){const _0xec2b84=a171_0x42c8cb,_0xfe3fa9=loadSqlProjectConfig(_0x225ef5[_0xec2b84(0x1bf)]),_0x3e662e=await readSqlLockFile(_0xfe3fa9[_0xec2b84(0x1ce)]),{appLock:_0x4697b1}=ensureSqlLockScope(_0x3e662e??createEmptySqlLock(),_0x225ef5[_0xec2b84(0x1bf)],_0xfe3fa9[_0xec2b84(0x19e)],'push'),_0x260b88=await getTargetSqlQueries(_0xfe3fa9,_0x4697b1,_0x225ef5[_0xec2b84(0x1d1)](_0xec2b84(0x19c))||undefined),_0x5c86fa=[];for(const _0x49e70e of _0x260b88){const _0x2ada87=await computeSqlFileHash(_0x49e70e[_0xec2b84(0x1cf)]),_0x361266=_0x4697b1[_0xec2b84(0x1d2)][_0x49e70e['sqlCode']],_0x23a712=!!_0x361266&&(_0x361266['path']!==_0x49e70e['relativePath']||!!_0x49e70e[_0xec2b84(0x1ad)]&&_0x361266['sqlName']!==_0x49e70e[_0xec2b84(0x1ad)]);if(!_0x225ef5[_0xec2b84(0x1be)](_0xec2b84(0x1a3))&&_0x361266&&_0x361266[_0xec2b84(0x1d0)]===_0x2ada87&&!_0x23a712)continue;_0x5c86fa['push'](_0x49e70e[_0xec2b84(0x1da)]);}return{'method':_0xec2b84(0x1af),'url':_0xec2b84(0x1a7),'body':{'sqlCodes':_0x5c86fa,'appCode':_0x225ef5[_0xec2b84(0x1bf)]},'description':'Would\x20push\x20'+_0x5c86fa['length']+_0xec2b84(0x19d)};},async 'execute'(_0x38b7a4){const _0x3e721a=a171_0x42c8cb,_0x381ff9=loadSqlProjectConfig(_0x38b7a4[_0x3e721a(0x1bf)]),_0x16086d=await readSqlLockFile(_0x381ff9[_0x3e721a(0x1ce)]),{lockData:_0x26588a,appLock:_0x15765a}=ensureSqlLockScope(_0x16086d??createEmptySqlLock(),_0x38b7a4[_0x3e721a(0x1bf)],_0x381ff9[_0x3e721a(0x19e)],_0x3e721a(0x1a0)),_0x539015=await getTargetSqlQueries(_0x381ff9,_0x15765a,_0x38b7a4[_0x3e721a(0x1d1)](_0x3e721a(0x19c))||undefined);if(_0x539015['length']===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':'No\x20local\x20SQL\x20files\x20found.'};const _0x38e79e=[],_0x2efac2=[],_0x33da19=[];for(const _0x6c3b3d of _0x539015){const _0x2e63eb=_0x15765a[_0x3e721a(0x1d2)][_0x6c3b3d[_0x3e721a(0x1da)]];if(!_0x2e63eb){_0x33da19[_0x3e721a(0x1a0)]({'sqlCode':_0x6c3b3d[_0x3e721a(0x1da)],'error':'local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first'});continue;}try{const _0x3a44e7=await computeSqlFileHash(_0x6c3b3d[_0x3e721a(0x1cf)]),_0x4eeff3=_0x2e63eb[_0x3e721a(0x19f)]!==_0x6c3b3d[_0x3e721a(0x1b0)]||!!_0x6c3b3d[_0x3e721a(0x1ad)]&&_0x2e63eb[_0x3e721a(0x1ad)]!==_0x6c3b3d[_0x3e721a(0x1ad)];if(!_0x38b7a4[_0x3e721a(0x1be)]('force')&&_0x2e63eb[_0x3e721a(0x1d0)]===_0x3a44e7&&!_0x4eeff3){_0x2efac2[_0x3e721a(0x1a0)]({'sqlCode':_0x6c3b3d[_0x3e721a(0x1da)],'reason':'unchanged'});continue;}if(_0x2e63eb[_0x3e721a(0x1b9)]==null){_0x33da19[_0x3e721a(0x1a0)]({'sqlCode':_0x6c3b3d[_0x3e721a(0x1da)],'error':'missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first'});continue;}const _0x5781a0=await readFile(_0x6c3b3d[_0x3e721a(0x1cf)],'utf8'),_0x371297=stripLocalSqlMetadata(_0x5781a0,_0x6c3b3d[_0x3e721a(0x1d3)]),_0x2ef228=_0x6c3b3d[_0x3e721a(0x1ad)]||_0x2e63eb[_0x3e721a(0x1ad)],_0x591430=await resolveTargetDbBinding(_0x38b7a4[_0x3e721a(0x1bf)],_0x6c3b3d,_0x2e63eb),_0x1d0e97=await updateSqlQuery({'id':_0x2e63eb[_0x3e721a(0x1c4)],'appCode':_0x38b7a4[_0x3e721a(0x1bf)],'sqlCode':_0x6c3b3d[_0x3e721a(0x1da)],'sqlName':_0x2ef228,'dbId':_0x591430[_0x3e721a(0x1ba)],'version':_0x2e63eb[_0x3e721a(0x1b9)],'sqlContent':_0x371297,'sqlConfig':_0x2e63eb[_0x3e721a(0x1aa)]??undefined}),_0x2b322d=_0x1d0e97[_0x3e721a(0x1ba)]?await getDbName(_0x38b7a4['appCode'],Number(_0x1d0e97['dbId']))['catch'](()=>_0x591430[_0x3e721a(0x1ab)]):_0x591430[_0x3e721a(0x1ab)];_0x15765a[_0x3e721a(0x1d2)][_0x6c3b3d[_0x3e721a(0x1da)]]={...buildSqlLockEntry(_0x1d0e97,_0x371297,_0x3a44e7,{'dbName':_0x2b322d}),'path':_0x6c3b3d[_0x3e721a(0x1b0)],'mode':_0x2e63eb[_0x3e721a(0x1d3)]},await archivePreviousSqlFileIfNeeded(_0x381ff9,_0x2e63eb['path'],_0x6c3b3d[_0x3e721a(0x1b0)]),_0x38e79e[_0x3e721a(0x1a0)]({'sqlCode':_0x6c3b3d[_0x3e721a(0x1da)],'remoteId':_0x2e63eb[_0x3e721a(0x1c4)]});}catch(_0x3701d3){_0x33da19[_0x3e721a(0x1a0)]({'sqlCode':_0x6c3b3d[_0x3e721a(0x1da)],'error':_0x3701d3 instanceof Error?_0x3701d3[_0x3e721a(0x1a2)]:String(_0x3701d3)});}}return _0x15765a['lastSync']=new Date()[_0x3e721a(0x1c3)](),await writeSqlLockFile(_0x381ff9['lockFilePath'],_0x26588a),{'ok':_0x33da19['length']===0x0,'data':{'pushed':_0x38e79e,'skipped':_0x2efac2,'failed':_0x33da19},'message':'Push\x20complete:\x20'+_0x38e79e['length']+_0x3e721a(0x1c5)+_0x2efac2[_0x3e721a(0x1d4)]+_0x3e721a(0x1b6)+_0x33da19['length']+_0x3e721a(0x1d7)};}};function a171_0x4512(_0x3dc8ec,_0x2ca977){_0x3dc8ec=_0x3dc8ec-0x19c;const _0x55c3c1=a171_0x55c3();let _0x451257=_0x55c3c1[_0x3dc8ec];return _0x451257;}async function archivePreviousSqlFileIfNeeded(_0x8f9f30,_0x2e3daf,_0x176511){const _0x199a38=a171_0x42c8cb;if(!_0x2e3daf||_0x2e3daf===_0x176511)return;const _0x63e4ae=join(_0x8f9f30['sqlRootDir'],_0x2e3daf);if(!await fileExists(_0x63e4ae))return;const _0x3257d0=await moveToTrash(_0x8f9f30[_0x199a38(0x1b4)],_0x8f9f30[_0x199a38(0x1b7)],_0x63e4ae);await cleanupEmptyDirectories(dirname(_0x63e4ae),_0x8f9f30[_0x199a38(0x1ca)]),void _0x3257d0;}async function moveToTrash(_0x4581ba,_0xe33702,_0x79588c){const _0x571ca9=a171_0x42c8cb,_0x3dcdf5=new Date()[_0x571ca9(0x1c3)]()[_0x571ca9(0x1a5)](/[:.]/g,'-'),_0x23fe62=relative(_0x4581ba,_0x79588c),_0x30940a=join(_0xe33702,_0x3dcdf5,_0x23fe62);return await mkdir(dirname(_0x30940a),{'recursive':!![]}),await rename(_0x79588c,_0x30940a),_0x30940a;}async function cleanupEmptyDirectories(_0x3370c3,_0x4b2598){const _0x3913c9=a171_0x42c8cb;let _0x37a155=resolve(_0x3370c3);const _0x4e249b=resolve(_0x4b2598);while(_0x37a155[_0x3913c9(0x1bb)](''+_0x4e249b+sep)||_0x37a155===_0x4e249b){if(_0x37a155===_0x4e249b)return;try{const _0x4396b2=await readdir(_0x37a155);if(_0x4396b2[_0x3913c9(0x1d4)]>0x0)return;await rmdir(_0x37a155);}catch{return;}_0x37a155=dirname(_0x37a155);}}async function resolveTargetDbBinding(_0x57f600,_0x2db5b1,_0x3c544f){const _0xe3293c=a171_0x42c8cb,_0x555e73=_0x2db5b1['dbDirectory'];if(!_0x555e73)return{'dbId':_0x3c544f[_0xe3293c(0x1ba)],'dbName':_0x3c544f[_0xe3293c(0x1ab)]};const _0x5db6ca=buildDbDirectoryName(_0x3c544f[_0xe3293c(0x1ab)],_0x3c544f[_0xe3293c(0x1ba)]);if(_0x555e73===_0x5db6ca)return{'dbId':_0x3c544f['dbId'],'dbName':_0x3c544f[_0xe3293c(0x1ab)]};const _0x24ec36=parseExplicitDbDirectory(_0x555e73);if(_0x24ec36!=null)return{'dbId':_0x24ec36,'dbName':await getDbName(_0x57f600,_0x24ec36)[_0xe3293c(0x1c9)](()=>undefined)};const _0x5a5759=await listDatabases(_0x57f600),_0x45e154=_0x5a5759[_0xe3293c(0x1b5)](_0x4dc58c=>buildDbDirectoryName(_0x4dc58c[_0xe3293c(0x1ab)],_0x4dc58c[_0xe3293c(0x1ba)])===_0x555e73);if(_0x45e154[_0xe3293c(0x1d4)]===0x1)return{'dbId':_0x45e154[0x0]['dbId'],'dbName':_0x45e154[0x0][_0xe3293c(0x1ab)]};if(_0x45e154['length']===0x0)throw CliErrors[_0xe3293c(0x1a4)]('No\x20database\x20matches\x20local\x20directory\x20\x22'+_0x555e73+_0xe3293c(0x1ae)+_0x2db5b1['sqlCode']+'.');const _0x2d6ba8=_0x45e154[_0xe3293c(0x1a8)](_0x702f7a=>_0x702f7a[_0xe3293c(0x1ab)]+'\x20('+_0x702f7a[_0xe3293c(0x1ba)]+')')[_0xe3293c(0x1b3)](',\x20');throw CliErrors[_0xe3293c(0x1a4)](_0xe3293c(0x1cd)+_0x555e73+'\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20'+_0x2db5b1[_0xe3293c(0x1da)]+':\x20'+_0x2d6ba8);}function parseExplicitDbDirectory(_0x14b40e){const _0x34c836=a171_0x42c8cb,_0x3083d0=/^db-(\d+)$/[_0x34c836(0x1d5)](_0x14b40e);if(!_0x3083d0)return null;const _0xad0868=Number(_0x3083d0[0x1]);return Number[_0x34c836(0x1b2)](_0xad0868)&&_0xad0868>0x0?_0xad0868:null;}
|
|
1
|
+
const a171_0x4f8fc5=a171_0x1226;(function(_0x365627,_0x1dfd80){const _0x2664c1=a171_0x1226,_0x208f1e=_0x365627();while(!![]){try{const _0x21b9cf=-parseInt(_0x2664c1(0x137))/0x1+parseInt(_0x2664c1(0x10a))/0x2*(-parseInt(_0x2664c1(0x11b))/0x3)+parseInt(_0x2664c1(0x103))/0x4+parseInt(_0x2664c1(0x13c))/0x5*(-parseInt(_0x2664c1(0x12e))/0x6)+parseInt(_0x2664c1(0x110))/0x7*(parseInt(_0x2664c1(0x113))/0x8)+parseInt(_0x2664c1(0x119))/0x9+-parseInt(_0x2664c1(0x11d))/0xa*(-parseInt(_0x2664c1(0x121))/0xb);if(_0x21b9cf===_0x1dfd80)break;else _0x208f1e['push'](_0x208f1e['shift']());}catch(_0x246d7b){_0x208f1e['push'](_0x208f1e['shift']());}}}(a171_0x13ef,0x652a4));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';function a171_0x13ef(){const _0x27834a=['sqlRoot','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','get','Push\x20local\x20SQL\x20files\x20to\x20remote','\x20SQL\x20file(s)','appCode','24558YrKRSo','sqlRootDir','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','join','push','sqls','lockFilePath','catch','No\x20local\x20SQL\x20files\x20found.','403276mPhCnQ','remoteId','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','validation','\x20pushed,\x20','905yltCpY','projectRoot','\x20failed','mode','length','exec','Local\x20SQL\x20not\x20found:\x20','path','1461692VlfBlc','isFinite','force','sql','relativePath','bool','set','87018QYGVxR','toISOString','sqlName','filter','sqlCode','sqlcode','1799NSfESU','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','str','16312QmutxP','filePath','trashDir','No\x20database\x20matches\x20local\x20directory\x20\x22','message','high-risk-write','445707iDeKdW','Local\x20directory\x20\x22','3nOzBSO','\x22\x20for\x20sqlCode\x20','2070hgAHkY','boolean','startsWith','dbId','35233JPWwRj','Push\x20complete:\x20','map','\x20skipped,\x20','/smartapi/custom/updateUserCustomSql','hash','dbName'];a171_0x13ef=function(){return _0x27834a;};return a171_0x13ef();}function a171_0x1226(_0x4d8ee2,_0x4dc605){_0x4d8ee2=_0x4d8ee2-0x103;const _0x13ef14=a171_0x13ef();let _0x1226ad=_0x13ef14[_0x4d8ee2];return _0x1226ad;}async function getTargetSqlQueries(_0x4f0f5b,_0x5ece69,_0x8f9b49){const _0x1bd0f6=a171_0x1226,_0xdb8584=await scanLocalSqlQueries(_0x4f0f5b),_0x58160f=new Map();for(const _0x46a220 of _0xdb8584){if(_0x8f9b49&&_0x46a220[_0x1bd0f6(0x10e)]!==_0x8f9b49)continue;const _0x2b23b3=_0x58160f[_0x1bd0f6(0x12a)](_0x46a220['sqlCode'])??[];_0x2b23b3[_0x1bd0f6(0x132)](_0x46a220),_0x58160f[_0x1bd0f6(0x109)](_0x46a220[_0x1bd0f6(0x10e)],_0x2b23b3);}if(_0x8f9b49&&!_0x58160f['has'](_0x8f9b49))throw CliErrors[_0x1bd0f6(0x13a)](_0x1bd0f6(0x142)+_0x8f9b49);const _0x5a92bc=[];for(const [_0x3e488e,_0x4f3cf6]of _0x58160f['entries']()){if(_0x4f3cf6['length']===0x1){_0x5a92bc['push'](_0x4f3cf6[0x0]);continue;}const _0x30f0e3=_0x5ece69[_0x1bd0f6(0x133)][_0x3e488e],_0x2130bd=_0x30f0e3?.[_0x1bd0f6(0x143)],_0x36d87c=_0x2130bd?_0x4f3cf6[_0x1bd0f6(0x10d)](_0x1abfa5=>_0x1abfa5[_0x1bd0f6(0x107)]!==_0x2130bd):_0x4f3cf6;if(_0x30f0e3&&_0x36d87c['length']===0x1){_0x5a92bc[_0x1bd0f6(0x132)](_0x36d87c[0x0]);continue;}throw CliErrors['validation'](_0x1bd0f6(0x129)+_0x3e488e+'.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.');}return _0x5a92bc;}export const sqlPush={'service':a171_0x4f8fc5(0x106),'command':a171_0x4f8fc5(0x132),'description':a171_0x4f8fc5(0x12b),'risk':a171_0x4f8fc5(0x118),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a171_0x4f8fc5(0x105),'type':a171_0x4f8fc5(0x11e),'description':a171_0x4f8fc5(0x111)}],async 'dryRun'(_0x2c4d3e){const _0x129c25=a171_0x4f8fc5,_0x33ba05=loadSqlProjectConfig(_0x2c4d3e[_0x129c25(0x12d)]),_0x3aa521=await readSqlLockFile(_0x33ba05['lockFilePath']),{appLock:_0x50caf8}=ensureSqlLockScope(_0x3aa521??createEmptySqlLock(),_0x2c4d3e[_0x129c25(0x12d)],_0x33ba05[_0x129c25(0x128)],_0x129c25(0x132)),_0x2e2de4=await getTargetSqlQueries(_0x33ba05,_0x50caf8,_0x2c4d3e[_0x129c25(0x112)](_0x129c25(0x10f))||undefined),_0x56a5ac=[];for(const _0xa594e4 of _0x2e2de4){const _0x30eb84=await computeSqlFileHash(_0xa594e4[_0x129c25(0x114)]),_0xad72b3=_0x50caf8[_0x129c25(0x133)][_0xa594e4[_0x129c25(0x10e)]],_0x37975a=!!_0xad72b3&&(_0xad72b3[_0x129c25(0x143)]!==_0xa594e4['relativePath']||!!_0xa594e4['sqlName']&&_0xad72b3['sqlName']!==_0xa594e4[_0x129c25(0x10c)]);if(!_0x2c4d3e[_0x129c25(0x108)](_0x129c25(0x105))&&_0xad72b3&&_0xad72b3[_0x129c25(0x126)]===_0x30eb84&&!_0x37975a)continue;_0x56a5ac[_0x129c25(0x132)](_0xa594e4[_0x129c25(0x10e)]);}return{'method':'POST','url':_0x129c25(0x125),'body':{'sqlCodes':_0x56a5ac,'appCode':_0x2c4d3e[_0x129c25(0x12d)]},'description':'Would\x20push\x20'+_0x56a5ac[_0x129c25(0x140)]+_0x129c25(0x12c)};},async 'execute'(_0x481651){const _0x568abb=a171_0x4f8fc5,_0xc90e9a=loadSqlProjectConfig(_0x481651[_0x568abb(0x12d)]),_0x577c44=await readSqlLockFile(_0xc90e9a[_0x568abb(0x134)]),{lockData:_0x3499b6,appLock:_0x23b7a7}=ensureSqlLockScope(_0x577c44??createEmptySqlLock(),_0x481651['appCode'],_0xc90e9a[_0x568abb(0x128)],'push'),_0xc60809=await getTargetSqlQueries(_0xc90e9a,_0x23b7a7,_0x481651[_0x568abb(0x112)](_0x568abb(0x10f))||undefined);if(_0xc60809[_0x568abb(0x140)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x568abb(0x136)};const _0x93a356=[],_0x2add5f=[],_0x2b9a2d=[];for(const _0x4fc07f of _0xc60809){const _0x529f14=_0x23b7a7['sqls'][_0x4fc07f[_0x568abb(0x10e)]];if(!_0x529f14){_0x2b9a2d[_0x568abb(0x132)]({'sqlCode':_0x4fc07f[_0x568abb(0x10e)],'error':'local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first'});continue;}try{const _0x36f57c=await computeSqlFileHash(_0x4fc07f[_0x568abb(0x114)]),_0x620890=_0x529f14['path']!==_0x4fc07f[_0x568abb(0x107)]||!!_0x4fc07f[_0x568abb(0x10c)]&&_0x529f14[_0x568abb(0x10c)]!==_0x4fc07f['sqlName'];if(!_0x481651[_0x568abb(0x108)](_0x568abb(0x105))&&_0x529f14['hash']===_0x36f57c&&!_0x620890){_0x2add5f[_0x568abb(0x132)]({'sqlCode':_0x4fc07f[_0x568abb(0x10e)],'reason':'unchanged'});continue;}if(_0x529f14['version']==null){_0x2b9a2d[_0x568abb(0x132)]({'sqlCode':_0x4fc07f[_0x568abb(0x10e)],'error':_0x568abb(0x130)});continue;}const _0x176461=await readFile(_0x4fc07f[_0x568abb(0x114)],'utf8'),_0x460f27=stripLocalSqlMetadata(_0x176461,_0x4fc07f[_0x568abb(0x13f)]),_0x384b39=_0x4fc07f[_0x568abb(0x10c)]||_0x529f14[_0x568abb(0x10c)],_0xee4c69=await resolveTargetDbBinding(_0x481651['appCode'],_0x4fc07f,_0x529f14),_0x29cac2=await updateSqlQuery({'id':_0x529f14['remoteId'],'appCode':_0x481651[_0x568abb(0x12d)],'sqlCode':_0x4fc07f[_0x568abb(0x10e)],'sqlName':_0x384b39,'dbId':_0xee4c69[_0x568abb(0x120)],'version':_0x529f14['version'],'sqlContent':_0x460f27,'sqlConfig':_0x529f14['sqlConfig']??undefined}),_0x2df168=_0x29cac2['dbId']?await getDbName(_0x481651[_0x568abb(0x12d)],Number(_0x29cac2[_0x568abb(0x120)]))['catch'](()=>_0xee4c69[_0x568abb(0x127)]):_0xee4c69[_0x568abb(0x127)];_0x23b7a7[_0x568abb(0x133)][_0x4fc07f[_0x568abb(0x10e)]]={...buildSqlLockEntry(_0x29cac2,_0x460f27,_0x36f57c,{'dbName':_0x2df168}),'path':_0x4fc07f[_0x568abb(0x107)],'mode':_0x529f14['mode']},await archivePreviousSqlFileIfNeeded(_0xc90e9a,_0x529f14['path'],_0x4fc07f['relativePath']),_0x93a356[_0x568abb(0x132)]({'sqlCode':_0x4fc07f[_0x568abb(0x10e)],'remoteId':_0x529f14[_0x568abb(0x138)]});}catch(_0x53ffc1){_0x2b9a2d['push']({'sqlCode':_0x4fc07f[_0x568abb(0x10e)],'error':_0x53ffc1 instanceof Error?_0x53ffc1[_0x568abb(0x117)]:String(_0x53ffc1)});}}return _0x23b7a7['lastSync']=new Date()[_0x568abb(0x10b)](),await writeSqlLockFile(_0xc90e9a[_0x568abb(0x134)],_0x3499b6),{'ok':_0x2b9a2d['length']===0x0,'data':{'pushed':_0x93a356,'skipped':_0x2add5f,'failed':_0x2b9a2d},'message':_0x568abb(0x122)+_0x93a356['length']+_0x568abb(0x13b)+_0x2add5f[_0x568abb(0x140)]+_0x568abb(0x124)+_0x2b9a2d[_0x568abb(0x140)]+_0x568abb(0x13e)};}};async function archivePreviousSqlFileIfNeeded(_0x23bbbe,_0x5c1f2f,_0x2ccafa){const _0x96207=a171_0x4f8fc5;if(!_0x5c1f2f||_0x5c1f2f===_0x2ccafa)return;const _0x3805a7=join(_0x23bbbe[_0x96207(0x12f)],_0x5c1f2f);if(!await fileExists(_0x3805a7))return;const _0x3cc35a=await moveToTrash(_0x23bbbe[_0x96207(0x13d)],_0x23bbbe[_0x96207(0x115)],_0x3805a7);await cleanupEmptyDirectories(dirname(_0x3805a7),_0x23bbbe[_0x96207(0x12f)]),void _0x3cc35a;}async function moveToTrash(_0x324003,_0x37e32d,_0x2572cc){const _0x45e0b7=a171_0x4f8fc5,_0x3412d7=new Date()[_0x45e0b7(0x10b)]()['replace'](/[:.]/g,'-'),_0x50f5e6=relative(_0x324003,_0x2572cc),_0x17ea4a=join(_0x37e32d,_0x3412d7,_0x50f5e6);return await mkdir(dirname(_0x17ea4a),{'recursive':!![]}),await rename(_0x2572cc,_0x17ea4a),_0x17ea4a;}async function cleanupEmptyDirectories(_0x20c57c,_0x4ef459){const _0x63fa8f=a171_0x4f8fc5;let _0x32e01d=resolve(_0x20c57c);const _0x39cab5=resolve(_0x4ef459);while(_0x32e01d[_0x63fa8f(0x11f)](''+_0x39cab5+sep)||_0x32e01d===_0x39cab5){if(_0x32e01d===_0x39cab5)return;try{const _0x5ea43d=await readdir(_0x32e01d);if(_0x5ea43d[_0x63fa8f(0x140)]>0x0)return;await rmdir(_0x32e01d);}catch{return;}_0x32e01d=dirname(_0x32e01d);}}async function resolveTargetDbBinding(_0x31fbee,_0x4d3694,_0x5341d7){const _0xb10606=a171_0x4f8fc5,_0x2c8bd4=_0x4d3694['dbDirectory'];if(!_0x2c8bd4)return{'dbId':_0x5341d7[_0xb10606(0x120)],'dbName':_0x5341d7[_0xb10606(0x127)]};const _0x5b75c1=buildDbDirectoryName(_0x5341d7[_0xb10606(0x127)],_0x5341d7[_0xb10606(0x120)]);if(_0x2c8bd4===_0x5b75c1)return{'dbId':_0x5341d7['dbId'],'dbName':_0x5341d7[_0xb10606(0x127)]};const _0x116f1d=parseExplicitDbDirectory(_0x2c8bd4);if(_0x116f1d!=null)return{'dbId':_0x116f1d,'dbName':await getDbName(_0x31fbee,_0x116f1d)[_0xb10606(0x135)](()=>undefined)};const _0x1134dc=await listDatabases(_0x31fbee),_0x2f7b6d=_0x1134dc[_0xb10606(0x10d)](_0x34805e=>buildDbDirectoryName(_0x34805e[_0xb10606(0x127)],_0x34805e['dbId'])===_0x2c8bd4);if(_0x2f7b6d[_0xb10606(0x140)]===0x1)return{'dbId':_0x2f7b6d[0x0]['dbId'],'dbName':_0x2f7b6d[0x0][_0xb10606(0x127)]};if(_0x2f7b6d[_0xb10606(0x140)]===0x0)throw CliErrors['validation'](_0xb10606(0x116)+_0x2c8bd4+_0xb10606(0x11c)+_0x4d3694['sqlCode']+'.');const _0xaf00a0=_0x2f7b6d[_0xb10606(0x123)](_0x3bcfc1=>_0x3bcfc1['dbName']+'\x20('+_0x3bcfc1[_0xb10606(0x120)]+')')[_0xb10606(0x131)](',\x20');throw CliErrors[_0xb10606(0x13a)](_0xb10606(0x11a)+_0x2c8bd4+_0xb10606(0x139)+_0x4d3694[_0xb10606(0x10e)]+':\x20'+_0xaf00a0);}function parseExplicitDbDirectory(_0x3a42b9){const _0x5adc7e=a171_0x4f8fc5,_0x2151fe=/^db-(\d+)$/[_0x5adc7e(0x141)](_0x3a42b9);if(!_0x2151fe)return null;const _0x2c5dcb=Number(_0x2151fe[0x1]);return Number[_0x5adc7e(0x104)](_0x2c5dcb)&&_0x2c5dcb>0x0?_0x2c5dcb:null;}
|
package/lib/commands/sql/save.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a172_0x306138=a172_0x1651;(function(_0x2f46d9,_0x1b94b7){const _0x1ea1c3=a172_0x1651,_0x141ce9=_0x2f46d9();while(!![]){try{const _0x1a834a=-parseInt(_0x1ea1c3(0x99))/0x1*(-parseInt(_0x1ea1c3(0x9d))/0x2)+-parseInt(_0x1ea1c3(0x94))/0x3+-parseInt(_0x1ea1c3(0xa3))/0x4+-parseInt(_0x1ea1c3(0x91))/0x5*(parseInt(_0x1ea1c3(0xa2))/0x6)+-parseInt(_0x1ea1c3(0x9c))/0x7+-parseInt(_0x1ea1c3(0x8f))/0x8*(parseInt(_0x1ea1c3(0xa1))/0x9)+parseInt(_0x1ea1c3(0x9e))/0xa;if(_0x1a834a===_0x1b94b7)break;else _0x141ce9['push'](_0x141ce9['shift']());}catch(_0x18f657){_0x141ce9['push'](_0x141ce9['shift']());}}}(a172_0x3de1,0xeff21));import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';const SQL_SAVE_DEPRECATED_HINT=[a172_0x306138(0x93),a172_0x306138(0x97),a172_0x306138(0xa4)][a172_0x306138(0xa0)]('\x0a');function a172_0x3de1(){const _0x1bb44a=['validation','description','5397416XZsDnj','SQL\x20query\x20display\x20name','8552730bnhKqc','Path\x20to\x20the\x20SQL\x20file','`rabetbase\x20sql\x20save`\x20has\x20been\x20deprecated.','620013MtxukK','sqlname','save','Create\x20new\x20SQL\x20with\x20`rabetbase\x20sql\x20create\x20--name\x20<name>\x20--db-id\x20<id>\x20--mode\x20sql|mybatisXml`.','Target\x20database\x20—\x20accepts\x20a\x20numeric\x20ID\x20or\x20database\x20name\x20(e.g.\x20ecommerce_db)','4HvstJn','string','Deprecated:\x20use\x20sql\x20create\x20to\x20create\x20and\x20sql\x20push\x20to\x20update','8102556PobNdP','767066yGmBpS','40630020xgfDAP','write','join','9PaTvMP','6IlultL','3459660SetFtY','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`.','Query\x20description'];a172_0x3de1=function(){return _0x1bb44a;};return a172_0x3de1();}function a172_0x1651(_0x177a4d,_0x1c3ed7){_0x177a4d=_0x177a4d-0x8f;const _0x3de12c=a172_0x3de1();let _0x1651d5=_0x3de12c[_0x177a4d];return _0x1651d5;}export const sqlSave={'service':'sql','command':a172_0x306138(0x96),'description':a172_0x306138(0x9b),'risk':a172_0x306138(0x9f),'requiresAuth':![],'requiresAppCode':![],'flags':[{'name':'file','type':a172_0x306138(0x9a),'required':!![],'description':a172_0x306138(0x92)},SQLCODE_FLAG_OPTIONAL,{'name':a172_0x306138(0x95),'type':a172_0x306138(0x9a),'description':a172_0x306138(0x90)},{'name':'db','type':a172_0x306138(0x9a),'description':a172_0x306138(0x98)},{'name':a172_0x306138(0xa7),'type':a172_0x306138(0x9a),'description':a172_0x306138(0xa5)}],async 'validate'(){const _0x498226=a172_0x306138;throw CliErrors[_0x498226(0xa6)](SQL_SAVE_DEPRECATED_HINT);},async 'execute'(){const _0xc7e365=a172_0x306138;throw CliErrors[_0xc7e365(0xa6)](SQL_SAVE_DEPRECATED_HINT);}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a173_0x1f2e72=a173_0x57d4;(function(_0x20f762,_0x4b1c20){const _0x10a3d3=a173_0x57d4,_0x323f42=_0x20f762();while(!![]){try{const _0x196262=parseInt(_0x10a3d3(0x70))/0x1*(-parseInt(_0x10a3d3(0x84))/0x2)+-parseInt(_0x10a3d3(0x74))/0x3+-parseInt(_0x10a3d3(0x89))/0x4+-parseInt(_0x10a3d3(0x7d))/0x5+-parseInt(_0x10a3d3(0x87))/0x6+-parseInt(_0x10a3d3(0x83))/0x7+parseInt(_0x10a3d3(0x7e))/0x8;if(_0x196262===_0x4b1c20)break;else _0x323f42['push'](_0x323f42['shift']());}catch(_0x30e8da){_0x323f42['push'](_0x323f42['shift']());}}}(a173_0x427f,0x93d86));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=a173_0x1f2e72(0x88);export function buildSqlLockEntry(_0x3cd090,_0x41d62c,_0x2e75d6,_0x1b38b5){const _0x2469da=a173_0x1f2e72,_0x560e7c=detectSqlMode(_0x41d62c);return{'path':buildSqlRelativePath(_0x3cd090[_0x2469da(0x91)],_0x3cd090[_0x2469da(0x8a)],_0x1b38b5?.['dbName'],_0x560e7c,_0x3cd090[_0x2469da(0x76)]),'hash':_0x2e75d6,'remoteId':_0x3cd090['id'],'version':_0x3cd090[_0x2469da(0x73)],'dbId':Number(_0x3cd090['dbId']),'dbName':_0x1b38b5?.[_0x2469da(0x8f)],'sqlName':_0x3cd090[_0x2469da(0x8a)],'sqlConfig':_0x3cd090[_0x2469da(0x81)]??undefined,'mode':_0x560e7c};}function a173_0x427f(){const _0x1f7d6e=['mybatisXml','dbId','trimStart','endsWith','fromEntries','includes','question','length','4958240ZykzZr','37219128PkuInl','close','apps','sqlConfig','test','2867984wwLozz','2boGRgS','stderr','syncedAt','4535106cFjuSM','.rabetbase/sql','295612CcwwmW','sqlName','toLowerCase','mode','split','trim','dbName','map','sqlCode','stdin','description','lastSync','815585BhvmmC','join','\x20[y/N]\x20','version','3000354oMJzjs'];a173_0x427f=function(){return _0x1f7d6e;};return a173_0x427f();}export function cloneSqlLockData(_0x611fd1){const _0x109cbb=a173_0x1f2e72;return{'apps':Object[_0x109cbb(0x79)](Object['entries'](_0x611fd1[_0x109cbb(0x80)])[_0x109cbb(0x90)](([_0x2b2ed2,_0x3edc70])=>[_0x2b2ed2,{'sqlRoot':_0x3edc70['sqlRoot'],'lastSync':_0x3edc70[_0x109cbb(0x6f)],'sqls':{..._0x3edc70['sqls']}}]))};}export function ensureRemoteSqlContent(_0x45854c){return _0x45854c['sqlContent']??'';}export function buildLocalSqlFileContent(_0x2a6bd8,_0xfb7080,_0x23d38a){const _0x36ea25=a173_0x1f2e72,_0x1fb54c=_0x23d38a?.[_0x36ea25(0x8c)]??detectSqlMode(_0xfb7080),_0x4b37e3=stripLocalSqlMetadata(_0xfb7080,_0x1fb54c)['trim'](),_0x28061b=[...buildMetadataHeaderLines({'sqlCode':_0x2a6bd8[_0x36ea25(0x91)],'sqlName':_0x2a6bd8[_0x36ea25(0x8a)],'dbId':_0x2a6bd8[_0x36ea25(0x76)],'dbName':_0x23d38a?.['dbName'],'mode':_0x1fb54c,'syncedAt':_0x23d38a?.[_0x36ea25(0x86)],'description':_0x23d38a?.[_0x36ea25(0x6e)]},_0x1fb54c),'',_0x4b37e3],_0x36cb8a=_0x28061b[_0x36ea25(0x71)]('\x0a');return _0x36cb8a[_0x36ea25(0x78)]('\x0a')?_0x36cb8a:_0x36cb8a+'\x0a';}export function stripLocalSqlMetadata(_0x4718f6,_0x53db53){const _0x5f3888=a173_0x1f2e72,_0x57e870=_0x4718f6['replace'](/\r\n/g,'\x0a')[_0x5f3888(0x8d)]('\x0a'),_0x163ce0=[];let _0x41acbc=0x0;if(_0x53db53===_0x5f3888(0x75))while(_0x41acbc<_0x57e870[_0x5f3888(0x7c)]){const _0x31229d=_0x57e870[_0x41acbc]??'';if(/^\s*<!--\s*@lovrabet\./['test'](_0x31229d)){_0x41acbc++;continue;}if(_0x31229d['trim']()===''&&_0x41acbc>0x0){_0x41acbc++;continue;}break;}else while(_0x41acbc<_0x57e870['length']){const _0x2e70f0=_0x57e870[_0x41acbc]??'';if(/^\s*--\s*@lovrabet\./[_0x5f3888(0x82)](_0x2e70f0)){_0x41acbc++;continue;}if(_0x2e70f0[_0x5f3888(0x8e)]()===''&&_0x41acbc>0x0){_0x41acbc++;continue;}break;}for(;_0x41acbc<_0x57e870[_0x5f3888(0x7c)];_0x41acbc++){_0x163ce0['push'](_0x57e870[_0x41acbc]);}return _0x163ce0[_0x5f3888(0x71)]('\x0a')[_0x5f3888(0x77)]();}export function resolveSqlMode(_0x452322,_0x47fe3d){const _0x412722=a173_0x1f2e72;if(_0x47fe3d?.[_0x412722(0x8c)])return _0x47fe3d['mode'];return detectSqlMode(_0x452322);}export function resolveSqlFileName(_0x38b575,_0x98f235,_0x184a1e){const _0x4a0648=a173_0x1f2e72;if(_0x184a1e?.['path'])return _0x184a1e['path'];if(_0x184a1e?.['sqlName']||_0x184a1e?.[_0x4a0648(0x8f)])return buildSqlRelativePath(_0x38b575,_0x184a1e?.['sqlName'],_0x184a1e?.[_0x4a0648(0x8f)],resolveSqlMode(_0x98f235,_0x184a1e),_0x184a1e?.[_0x4a0648(0x76)]);return buildDefaultSqlFileName(_0x38b575,resolveSqlMode(_0x98f235,_0x184a1e));}export function resolveSqlLocalDir(_0x4302c6,_0x33f3df){return join(_0x4302c6,SQL_LOCAL_REL_DIR,_0x33f3df);}export async function confirmForceOverwrite(_0x2bc2d4){const _0x17a029=a173_0x1f2e72,_0x5b4429=createInterface({'input':process[_0x17a029(0x92)],'output':process[_0x17a029(0x85)]}),_0x29a535=await new Promise(_0x23040e=>{const _0x352cfd=_0x17a029;_0x5b4429[_0x352cfd(0x7b)](_0x2bc2d4+_0x352cfd(0x72),_0x23040e);});return _0x5b4429[_0x17a029(0x7f)](),['y','yes'][_0x17a029(0x7a)](_0x29a535['trim']()[_0x17a029(0x8b)]());}function a173_0x57d4(_0x1024ee,_0x444efb){_0x1024ee=_0x1024ee-0x6e;const _0x427f6c=a173_0x427f();let _0x57d47d=_0x427f6c[_0x1024ee];return _0x57d47d;}export function findSqlLockScope(_0x239397,_0x150fdb){return _0x239397['apps'][_0x150fdb];}function buildMetadataHeaderLines(_0x1b5932,_0x566a86){const _0x4858d1=a173_0x1f2e72,_0x154ed3=[[_0x4858d1(0x91),_0x1b5932['sqlCode']],[_0x4858d1(0x8a),_0x1b5932[_0x4858d1(0x8a)]],[_0x4858d1(0x76),_0x1b5932[_0x4858d1(0x76)]],[_0x4858d1(0x8f),_0x1b5932[_0x4858d1(0x8f)]],[_0x4858d1(0x8c),_0x1b5932[_0x4858d1(0x8c)]],[_0x4858d1(0x86),_0x1b5932[_0x4858d1(0x86)]],[_0x4858d1(0x6e),_0x1b5932[_0x4858d1(0x6e)]]];if(_0x566a86===_0x4858d1(0x75))return _0x154ed3['filter'](([,_0x525a2b])=>_0x525a2b!==undefined&&_0x525a2b!==null&&String(_0x525a2b)[_0x4858d1(0x8e)]()!=='')[_0x4858d1(0x90)](([_0x3868af,_0x51c41a])=>'<!--\x20@lovrabet.'+_0x3868af+':\x20'+String(_0x51c41a)+'\x20-->');return _0x154ed3['filter'](([,_0x43f674])=>_0x43f674!==undefined&&_0x43f674!==null&&String(_0x43f674)['trim']()!=='')[_0x4858d1(0x90)](([_0x3f3a24,_0xe4f7af])=>'--\x20@lovrabet.'+_0x3f3a24+':\x20'+String(_0xe4f7af));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a174_0x5bd750=a174_0x2b3e;(function(_0x73738d,_0x15a01f){const _0x586363=a174_0x2b3e,_0x3a13c7=_0x73738d();while(!![]){try{const _0x7b1905=parseInt(_0x586363(0x191))/0x1*(parseInt(_0x586363(0x1a4))/0x2)+-parseInt(_0x586363(0x1a1))/0x3+parseInt(_0x586363(0x196))/0x4*(-parseInt(_0x586363(0x193))/0x5)+-parseInt(_0x586363(0x19e))/0x6+-parseInt(_0x586363(0x18f))/0x7*(parseInt(_0x586363(0x1a0))/0x8)+-parseInt(_0x586363(0x1ae))/0x9*(parseInt(_0x586363(0x1ab))/0xa)+parseInt(_0x586363(0x1a6))/0xb;if(_0x7b1905===_0x15a01f)break;else _0x3a13c7['push'](_0x3a13c7['shift']());}catch(_0x742bc7){_0x3a13c7['push'](_0x3a13c7['shift']());}}}(a174_0x237e,0xa1730));import{listSqlQueries}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';function a174_0x2b3e(_0x17bda0,_0x1f4e57){_0x17bda0=_0x17bda0-0x189;const _0x237e84=a174_0x237e();let _0x2b3e0f=_0x237e84[_0x17bda0];return _0x2b3e0f;}import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile}from'../../core/sql-sync/lock.js';const PAGE_SIZE=0x64;function a174_0x237e(){const _0x34a13d=['appCode','lockKey','170xcezqR','totalCount','All\x20SQL\x20queries\x20are\x20in\x20sync.','397737nNMmeF','map','\x20remote-only','length','bool','remote','relativePath','63385OZHLfD','keys','1ExjLEZ','\x20modified,\x20','5NRxPbb','sqlRoot','hash','2360900rcjFPs','Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','sqlName','lockFilePath','read','status','sqls','\x20added,\x20','125670LJJdPh','tableData','456LYcQuB','3137808QHKbKG','path','push','221618qwfBrr','filePath','38225099UVXgkO','has','Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally'];a174_0x237e=function(){return _0x34a13d;};return a174_0x237e();}async function fetchAllSqlCodes(_0x49b27f){const _0x6411f1=a174_0x2b3e,_0x12c3c5=[];let _0x4d41e0=0x1;while(!![]){const _0xf3b212=await listSqlQueries(_0x49b27f,{'currentPage':_0x4d41e0,'pageSize':PAGE_SIZE}),_0x1ab38b=_0xf3b212[_0x6411f1(0x19f)]??[];_0x12c3c5[_0x6411f1(0x1a3)](..._0x1ab38b[_0x6411f1(0x189)](_0x3e4d6e=>_0x3e4d6e['sqlCode']));if(_0x1ab38b[_0x6411f1(0x18b)]===0x0)break;const _0x40ab73=_0xf3b212['paging']?.[_0x6411f1(0x1ac)];if(_0x40ab73!=null?_0x12c3c5['length']>=_0x40ab73:_0x1ab38b[_0x6411f1(0x18b)]<PAGE_SIZE)break;_0x4d41e0++;}return _0x12c3c5;}export const sqlStatus={'service':'sql','command':a174_0x5bd750(0x19b),'description':a174_0x5bd750(0x197),'risk':a174_0x5bd750(0x19a),'flags':[{'name':a174_0x5bd750(0x18d),'type':'boolean','description':a174_0x5bd750(0x1a8)}],async 'execute'(_0x435146){const _0x54e251=a174_0x5bd750,_0x2f6990=loadSqlProjectConfig(_0x435146[_0x54e251(0x1a9)]),_0x3bc224=await readSqlLockFile(_0x2f6990[_0x54e251(0x199)]),{appLock:_0x33d90e}=ensureSqlLockScope(_0x3bc224??createEmptySqlLock(),_0x2f6990[_0x54e251(0x1a9)],_0x2f6990[_0x54e251(0x194)],_0x54e251(0x19b)),_0x305aea=await scanLocalSqlQueries(_0x2f6990),_0x284712=[],_0x9dd119=[],_0x3aa04b=[],_0x4e44d2=[],_0x414851=new Set(_0x305aea[_0x54e251(0x189)](_0x160920=>_0x160920['lockKey']));for(const _0x42b32b of _0x305aea){const _0x1f8a2b=await computeSqlFileHash(_0x42b32b[_0x54e251(0x1a5)]),_0x5d728b=_0x33d90e[_0x54e251(0x19c)][_0x42b32b['lockKey']],_0x17aed9=!!_0x5d728b&&_0x5d728b[_0x54e251(0x1a2)]!==_0x42b32b[_0x54e251(0x18e)],_0xd5a574=!!_0x5d728b&&!!_0x42b32b[_0x54e251(0x198)]&&_0x5d728b[_0x54e251(0x198)]!==_0x42b32b[_0x54e251(0x198)];if(!_0x5d728b)_0x284712[_0x54e251(0x1a3)](_0x42b32b[_0x54e251(0x1aa)]);else _0x5d728b[_0x54e251(0x195)]!==_0x1f8a2b||_0x17aed9||_0xd5a574?_0x9dd119[_0x54e251(0x1a3)](_0x42b32b[_0x54e251(0x1aa)]):_0x3aa04b[_0x54e251(0x1a3)](_0x42b32b[_0x54e251(0x1aa)]);}for(const _0x11021e of Object[_0x54e251(0x190)](_0x33d90e['sqls'])){!_0x414851[_0x54e251(0x1a7)](_0x11021e)&&_0x4e44d2[_0x54e251(0x1a3)](_0x11021e);}const _0x55bce2=[];if(_0x435146[_0x54e251(0x18c)]('remote')){const _0x295438=await fetchAllSqlCodes(_0x435146[_0x54e251(0x1a9)]);for(const _0x3fd521 of _0x295438){!_0x414851[_0x54e251(0x1a7)](_0x3fd521)&&!_0x33d90e['sqls'][_0x3fd521]&&_0x55bce2[_0x54e251(0x1a3)](_0x3fd521);}}const _0x49412b=_0x284712[_0x54e251(0x18b)]===0x0&&_0x9dd119[_0x54e251(0x18b)]===0x0&&_0x4e44d2[_0x54e251(0x18b)]===0x0&&_0x55bce2[_0x54e251(0x18b)]===0x0;return{'ok':!![],'data':{'added':_0x284712,'modified':_0x9dd119,'missing':_0x4e44d2,'unchanged':_0x3aa04b,'remoteOnly':_0x55bce2},'message':_0x49412b?_0x54e251(0x1ad):_0x284712['length']+_0x54e251(0x19d)+_0x9dd119['length']+_0x54e251(0x192)+_0x4e44d2['length']+'\x20missing,\x20'+_0x3aa04b[_0x54e251(0x18b)]+'\x20unchanged'+(_0x55bce2[_0x54e251(0x18b)]>0x0?',\x20'+_0x55bce2[_0x54e251(0x18b)]+_0x54e251(0x18a):'')};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a175_0xa0d512=a175_0x1c05;function a175_0x1c05(_0x22dc87,_0x54ed67){_0x22dc87=_0x22dc87-0x110;const _0x3332b8=a175_0x3332();let _0x1c054b=_0x3332b8[_0x22dc87];return _0x1c054b;}(function(_0x3bfd2b,_0x33bc37){const _0x5758e5=a175_0x1c05,_0x37adcb=_0x3bfd2b();while(!![]){try{const _0x23b367=-parseInt(_0x5758e5(0x113))/0x1*(parseInt(_0x5758e5(0x12d))/0x2)+parseInt(_0x5758e5(0x145))/0x3+parseInt(_0x5758e5(0x124))/0x4*(parseInt(_0x5758e5(0x12c))/0x5)+parseInt(_0x5758e5(0x138))/0x6+parseInt(_0x5758e5(0x116))/0x7*(-parseInt(_0x5758e5(0x150))/0x8)+-parseInt(_0x5758e5(0x140))/0x9+parseInt(_0x5758e5(0x12f))/0xa*(parseInt(_0x5758e5(0x121))/0xb);if(_0x23b367===_0x33bc37)break;else _0x37adcb['push'](_0x37adcb['shift']());}catch(_0x3b5c81){_0x37adcb['push'](_0x37adcb['shift']());}}}(a175_0x3332,0x8eac4));import{readFileSync,existsSync}from'node:fs';import{resolve}from'node:path';function a175_0x3332(){const _0x6cc205=['Dataset\x20\x22','tables','3724569qJkZmP','filter','get','flagMissing','validation','2209836JWgXko','schemas','bool','find','from','check-indexes','toLowerCase','dataset','fields','dbtableConfig','index_name','284584WUNHWl','--check-indexes\x20requires\x20--schemas.','cwd','tableName','Provide\x20--file\x20or\x20--sql','valid','appCode','Audit\x20top-level\x20JOIN\x20equality\x20predicates\x20against\x20dataset\x20index\x20metadata','joinAudit','108686SvQnqg','reason','length','147arkmpQ','type','indexName','isArray','read','name','utf-8','sqlType','File\x20not\x20found:\x20','sql','boolean','13893JHFaHP','validate','Inline\x20SQL\x20content\x20to\x20validate\x20(alternative\x20to\x20--file)','4195768HqwkUh','columns','trim','\x22\x20not\x20found\x20or\x20not\x20accessible','string','schema:','isDangerous','Path\x20to\x20the\x20SQL\x20file\x20to\x20validate','5IcEQMt','2SFjdoc','pkField','30rCTIgb','indexes','map','Comma-separated\x20dataset\x20codes\x20to\x20cross-check\x20table/column\x20names\x20against','SQL\x20schema\x20validation','Validate\x20SQL\x20content\x20without\x20saving\x20(type\x20detection,\x20parameter\x20extraction,\x20optional\x20schema\x20check)','primary','file','columnNames','387630PHkaOF','str','unshift','split','push','\x22\x20not\x20found\x20in\x20any\x20dataset'];a175_0x3332=function(){return _0x6cc205;};return a175_0x3332();}import{validateSql}from'../../core/sql-validator.js';import{auditSqlJoinIndexes}from'../../core/sql-index-auditor.js';import{getDatasetDetail,listDatasets}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{assertDatasetIsDbTableBacked,filterDbTableBackedDatasets}from'../../commands/dataset/capability.js';export const sqlValidate={'service':a175_0xa0d512(0x11f),'command':a175_0xa0d512(0x122),'description':a175_0xa0d512(0x134),'risk':a175_0xa0d512(0x11a),'flags':[{'name':'file','type':'string','description':a175_0xa0d512(0x12b)},{'name':a175_0xa0d512(0x11f),'type':'string','description':a175_0xa0d512(0x123)},{'name':a175_0xa0d512(0x146),'type':a175_0xa0d512(0x128),'description':a175_0xa0d512(0x132)},{'name':a175_0xa0d512(0x14a),'type':a175_0xa0d512(0x120),'description':a175_0xa0d512(0x111)}],async 'execute'(_0x2971bc){const _0xcd4e65=a175_0xa0d512,_0x5225ed=_0x2971bc['str'](_0xcd4e65(0x136)),_0xe790e3=_0x2971bc[_0xcd4e65(0x139)]('sql'),_0x5a5f54=_0x2971bc[_0xcd4e65(0x139)](_0xcd4e65(0x146)),_0x49b51f=_0x2971bc[_0xcd4e65(0x147)](_0xcd4e65(0x14a));if(!_0x5225ed&&!_0xe790e3)throw CliErrors[_0xcd4e65(0x143)](_0xcd4e65(0x136),_0xcd4e65(0x154));if(_0x49b51f&&!_0x5a5f54)throw CliErrors[_0xcd4e65(0x144)](_0xcd4e65(0x151));let _0x131264;if(_0x5225ed){const _0x2bb527=resolve(process[_0xcd4e65(0x152)](),_0x5225ed);if(!existsSync(_0x2bb527))throw CliErrors[_0xcd4e65(0x144)](_0xcd4e65(0x11e)+_0x2bb527);_0x131264=readFileSync(_0x2bb527,_0xcd4e65(0x11c));}else _0x131264=_0xe790e3;const _0x2e7057=validateSql(_0x131264),_0x186b67={'valid':_0x2e7057[_0xcd4e65(0x155)],'sqlType':_0x2e7057[_0xcd4e65(0x11d)]['type'],'isSelectOnly':_0x2e7057[_0xcd4e65(0x11d)]['isSelectOnly'],'isDangerous':_0x2e7057[_0xcd4e65(0x11d)][_0xcd4e65(0x12a)],'tables':_0x2e7057[_0xcd4e65(0x13f)],'parameters':_0x2e7057['parameters'],'message':_0x2e7057['message']};_0x2e7057[_0xcd4e65(0x11d)]['reason']&&(_0x186b67[_0xcd4e65(0x114)]=_0x2e7057[_0xcd4e65(0x11d)][_0xcd4e65(0x114)]);if(_0x5a5f54&&_0x2e7057[_0xcd4e65(0x155)]){const _0x121a73=_0x5a5f54[_0xcd4e65(0x13b)](',')[_0xcd4e65(0x131)](_0x4438d4=>_0x4438d4[_0xcd4e65(0x126)]())['filter'](Boolean),_0x34bbe8=[],_0x4adea7=[],_0x2bc5f5=filterDbTableBackedDatasets(await listDatasets(_0x2971bc[_0xcd4e65(0x110)])),_0x1c33c4=new Map(_0x2bc5f5[_0xcd4e65(0x131)](_0x560bba=>[_0x560bba[_0xcd4e65(0x14e)]?.[_0xcd4e65(0x153)]?.[_0xcd4e65(0x14b)](),_0x560bba]));for(const _0x2ada1f of _0x2e7057['tables']){const _0x324049=_0x1c33c4[_0xcd4e65(0x142)](_0x2ada1f[_0xcd4e65(0x14b)]());!_0x324049&&_0x34bbe8['push']('Table\x20\x22'+_0x2ada1f+_0xcd4e65(0x13d));}for(const _0x4180c7 of _0x121a73){let _0x4771ae;try{_0x4771ae=await getDatasetDetail(_0x4180c7);}catch{_0x34bbe8[_0xcd4e65(0x13c)](_0xcd4e65(0x13e)+_0x4180c7+_0xcd4e65(0x127));continue;}assertDatasetIsDbTableBacked(_0x4771ae,_0xcd4e65(0x133));const _0x401dcc=Array[_0xcd4e65(0x119)](_0x4771ae['fields'])?_0x4771ae[_0xcd4e65(0x14d)]:[],_0x46c823=new Set(_0x401dcc[_0xcd4e65(0x131)](_0x342387=>_0x342387[_0xcd4e65(0x11b)]?.[_0xcd4e65(0x14b)]())),_0x4badd3=_0x4771ae[_0xcd4e65(0x14e)]?.[_0xcd4e65(0x153)]||_0x4771ae['tableName']||_0x4180c7;_0x186b67[_0xcd4e65(0x129)+_0x4badd3]={'code':_0x4180c7,'tableName':_0x4badd3,'fieldCount':_0x46c823['size'],'fields':Array[_0xcd4e65(0x149)](_0x46c823)};if(_0x49b51f){const _0x46ed51=normalizeDatasetIndexes(_0x4771ae);_0x4adea7[_0xcd4e65(0x13c)]({'tableName':_0x4badd3,..._0x46ed51});}}_0x34bbe8[_0xcd4e65(0x115)]>0x0&&(_0x186b67['schemaWarnings']=_0x34bbe8),_0x49b51f&&(_0x186b67[_0xcd4e65(0x112)]=auditSqlJoinIndexes(_0x131264,_0x4adea7));}return{'ok':_0x2e7057['valid'],'data':_0x186b67,'message':_0x2e7057['message']};}};function normalizeDatasetIndexes(_0x2d77e0){const _0xcbcfc3=a175_0xa0d512,_0x262a55=Array[_0xcbcfc3(0x119)](_0x2d77e0?.['dataset']?.[_0xcbcfc3(0x130)])?_0x2d77e0[_0xcbcfc3(0x14c)][_0xcbcfc3(0x130)]:Array[_0xcbcfc3(0x119)](_0x2d77e0?.[_0xcbcfc3(0x130)])?_0x2d77e0['indexes']:[],_0xc6a1e2=_0x262a55['flatMap'](_0x503b18=>{const _0x293df5=_0xcbcfc3,_0x59ef1c=Array[_0x293df5(0x119)](_0x503b18?.['index_columns'])?_0x503b18['index_columns']:Array[_0x293df5(0x119)](_0x503b18?.[_0x293df5(0x137)])?_0x503b18[_0x293df5(0x137)]:Array[_0x293df5(0x119)](_0x503b18?.[_0x293df5(0x125)])?_0x503b18[_0x293df5(0x125)]:[],_0x2f9e5d=_0x59ef1c[_0x293df5(0x141)](_0x243bce=>typeof _0x243bce==='string')[_0x293df5(0x131)](_0x3ac83a=>_0x3ac83a['trim']())[_0x293df5(0x141)](Boolean);if(_0x2f9e5d[_0x293df5(0x115)]===0x0)return[];const _0x1fee41=[_0x503b18?.[_0x293df5(0x118)],_0x503b18?.[_0x293df5(0x14f)],_0x503b18?.[_0x293df5(0x11b)]][_0x293df5(0x148)](_0x3d16f1=>typeof _0x3d16f1===_0x293df5(0x128)&&_0x3d16f1['trim']()),_0xb4c518=[_0x503b18?.['index_type'],_0x503b18?.[_0x293df5(0x117)]][_0x293df5(0x148)](_0x8068df=>typeof _0x8068df==='string'&&_0x8068df[_0x293df5(0x126)]());return[{..._0x1fee41?{'name':_0x1fee41['trim']()}:{},..._0xb4c518?{'type':_0xb4c518['trim']()}:{},'columns':_0x2f9e5d}];}),_0x375881=[..._0xc6a1e2],_0xe68722=typeof _0x2d77e0?.[_0xcbcfc3(0x14e)]?.['pkField']===_0xcbcfc3(0x128)?_0x2d77e0[_0xcbcfc3(0x14e)][_0xcbcfc3(0x12e)]['split'](',')['map'](_0x1e6d3f=>_0x1e6d3f['trim']())[_0xcbcfc3(0x141)](Boolean):[];return _0xe68722[_0xcbcfc3(0x115)]>0x0&&_0x375881[_0xcbcfc3(0x13a)]({'type':_0xcbcfc3(0x135),'columns':_0xe68722}),{'indexes':_0x375881,'metadataAvailable':_0xc6a1e2[_0xcbcfc3(0x115)]>0x0};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x17e6ce,_0x20920b){const _0xfc4cd9=a176_0x587d,_0x296522=_0x17e6ce();while(!![]){try{const _0x350c07=-parseInt(_0xfc4cd9(0x1d1))/0x1*(parseInt(_0xfc4cd9(0x1cd))/0x2)+parseInt(_0xfc4cd9(0x1d2))/0x3*(parseInt(_0xfc4cd9(0x1d3))/0x4)+-parseInt(_0xfc4cd9(0x1cc))/0x5+-parseInt(_0xfc4cd9(0x1cb))/0x6+-parseInt(_0xfc4cd9(0x1ce))/0x7+-parseInt(_0xfc4cd9(0x1cf))/0x8+parseInt(_0xfc4cd9(0x1d0))/0x9;if(_0x350c07===_0x20920b)break;else _0x296522['push'](_0x296522['shift']());}catch(_0x18ac4b){_0x296522['push'](_0x296522['shift']());}}}(a176_0x46c6,0x900df));import{taskStatus}from'../../commands/task/status.js';export const taskDefinitions=[taskStatus];function a176_0x587d(_0x1d1247,_0x56ab24){_0x1d1247=_0x1d1247-0x1cb;const _0x46c654=a176_0x46c6();let _0x587daa=_0x46c654[_0x1d1247];return _0x587daa;}function a176_0x46c6(){const _0x31f1c9=['378268nYoitv','6682230ebPIOU','2235730kvbrpd','742wLSMmi','5867099JIGpvM','2127216ymOYcJ','30450249FndcJW','601hJdbRD','3gUlgGc'];a176_0x46c6=function(){return _0x31f1c9;};return a176_0x46c6();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a177_0xcbf6ab=a177_0x1a93;function a177_0x1557(){const _0x24ab15=['38244svOlTi','390315ceJeGO','read','string','10194fLcchI','compress','appCode','cookie','Query\x20an\x20asynchronous\x20task;\x20repeat\x20for\x20PENDING\x20or\x20PROCESSING\x20until\x20SUCCESS\x20or\x20FAILED','7797420OckUSb','taskId','95UurKGp','4152nhcdGr','Task\x20status\x20response\x20id\x20mismatch:\x20requested\x20','str','30897aYVRUE','2zauwBo','status','isTerminal','Task\x20id\x20returned\x20by\x20an\x20asynchronous\x20platform\x20command','170iasDOF','task-id','apiError','416GsfORy',',\x20received\x20','42779PJbVEu','602gsRlHW'];a177_0x1557=function(){return _0x24ab15;};return a177_0x1557();}(function(_0x146071,_0x57f367){const _0x4e650d=a177_0x1a93,_0x4b997c=_0x146071();while(!![]){try{const _0x512cd1=parseInt(_0x4e650d(0x18e))/0x1*(-parseInt(_0x4e650d(0x19e))/0x2)+-parseInt(_0x4e650d(0x18f))/0x3+-parseInt(_0x4e650d(0x19a))/0x4*(-parseInt(_0x4e650d(0x199))/0x5)+parseInt(_0x4e650d(0x192))/0x6*(-parseInt(_0x4e650d(0x18d))/0x7)+-parseInt(_0x4e650d(0x18a))/0x8*(parseInt(_0x4e650d(0x19d))/0x9)+parseInt(_0x4e650d(0x1a2))/0xa*(-parseInt(_0x4e650d(0x18c))/0xb)+parseInt(_0x4e650d(0x197))/0xc;if(_0x512cd1===_0x57f367)break;else _0x4b997c['push'](_0x4b997c['shift']());}catch(_0x1f9fa9){_0x4b997c['push'](_0x4b997c['shift']());}}}(a177_0x1557,0x1af4f));import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asyncTaskMessage,buildAsyncTaskStatusCommand,normalizeAsyncTask}from'../../commands/common/async-task.js';import{getAsyncTaskStatus}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';function a177_0x1a93(_0x1f6777,_0x10af45){_0x1f6777=_0x1f6777-0x188;const _0x155739=a177_0x1557();let _0x1a9393=_0x155739[_0x1f6777];return _0x1a9393;}export const taskStatus={'service':'task','command':a177_0xcbf6ab(0x19f),'description':a177_0xcbf6ab(0x196),'risk':a177_0xcbf6ab(0x190),'defaultOutputFormat':a177_0xcbf6ab(0x193),'structuredErrors':!![],'flags':[{'name':a177_0xcbf6ab(0x188),'type':a177_0xcbf6ab(0x191),'required':!![],'description':a177_0xcbf6ab(0x1a1)},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x32901e){const _0x3e06e2=a177_0xcbf6ab;if(!_0x32901e['str']('task-id')['trim']())throw CliErrors['flagMissing'](_0x3e06e2(0x188));},async 'execute'(_0x2e0964){const _0xf3aaca=a177_0xcbf6ab,_0x3a5102=_0x2e0964[_0xf3aaca(0x19c)](_0xf3aaca(0x188))['trim'](),_0x52d975=normalizeAsyncTask(await getAsyncTaskStatus(_0x3a5102,_0x2e0964['appCode'],_0x2e0964[_0xf3aaca(0x195)]));if(_0x52d975[_0xf3aaca(0x198)]!==_0x3a5102)throw CliErrors[_0xf3aaca(0x189)](_0xf3aaca(0x19b)+_0x3a5102+_0xf3aaca(0x18b)+_0x52d975['taskId']+'.');const _0x367145=buildAsyncTaskStatusCommand(_0x52d975[_0xf3aaca(0x198)],_0x2e0964[_0xf3aaca(0x194)]);return{'ok':!![],'message':asyncTaskMessage(_0x52d975),'data':{'appCode':_0x2e0964[_0xf3aaca(0x194)],..._0x52d975,'query':_0x52d975[_0xf3aaca(0x1a0)]?null:{'command':_0x367145}}};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a178_0x4dc9ee=a178_0x2b08;function a178_0x1844(){const _0x4a7703=['199236CsFAmF','add','76jCGdTi','37119EilLqa','1582902PCpEFw','workspace','Register\x20an\x20app\x20profile\x20in\x20the\x20current\x20workspace\x20(or\x20--global)','2vgKnhA','write','name','App\x20profile\x20name','5509770iXnSmH','679032RgMHHv','35NbaZJV','1284995FSmZFa','workspace\x20add','27362IPRSRq'];a178_0x1844=function(){return _0x4a7703;};return a178_0x1844();}function a178_0x2b08(_0x6674ee,_0x24c15a){_0x6674ee=_0x6674ee-0x122;const _0x1844d2=a178_0x1844();let _0x2b08fd=_0x1844d2[_0x6674ee];return _0x2b08fd;}(function(_0x5575ce,_0x5ed594){const _0x51ce46=a178_0x2b08,_0x282a95=_0x5575ce();while(!![]){try{const _0x265541=parseInt(_0x51ce46(0x122))/0x1*(parseInt(_0x51ce46(0x12b))/0x2)+parseInt(_0x51ce46(0x12f))/0x3*(parseInt(_0x51ce46(0x12e))/0x4)+-parseInt(_0x51ce46(0x129))/0x5+-parseInt(_0x51ce46(0x12c))/0x6*(parseInt(_0x51ce46(0x128))/0x7)+-parseInt(_0x51ce46(0x127))/0x8+-parseInt(_0x51ce46(0x130))/0x9+parseInt(_0x51ce46(0x126))/0xa;if(_0x265541===_0x5ed594)break;else _0x282a95['push'](_0x282a95['shift']());}catch(_0x25b8e7){_0x282a95['push'](_0x282a95['shift']());}}}(a178_0x1844,0x1fa68));import{buildAppAddFlags,runAppAdd,validateAppName}from'../../commands/common/app-registry.js';export const workspaceAddDefinition={'service':a178_0x4dc9ee(0x131),'command':a178_0x4dc9ee(0x12d),'description':a178_0x4dc9ee(0x132),'risk':a178_0x4dc9ee(0x123),'requiresAuth':![],'requiresAppCode':![],'args':[{'name':a178_0x4dc9ee(0x124),'description':a178_0x4dc9ee(0x125),'required':!![]}],'flags':buildAppAddFlags(),'validate':_0x34f1e3=>validateAppName(_0x34f1e3,a178_0x4dc9ee(0x12a)),'execute':_0x3feb75=>runAppAdd(_0x3feb75,a178_0x4dc9ee(0x12a))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a179_0x33ec8f=a179_0x119d;function a179_0x119d(_0x2f5ee8,_0xad1ce4){_0x2f5ee8=_0x2f5ee8-0x9e;const _0x22081e=a179_0x2208();let _0x119db3=_0x22081e[_0x2f5ee8];return _0x119db3;}(function(_0x3ddb1e,_0x1e038e){const _0x2d505=a179_0x119d,_0x59e5ee=_0x3ddb1e();while(!![]){try{const _0x2e994a=-parseInt(_0x2d505(0xb8))/0x1*(-parseInt(_0x2d505(0xd0))/0x2)+parseInt(_0x2d505(0xc4))/0x3+-parseInt(_0x2d505(0xa0))/0x4+parseInt(_0x2d505(0xbd))/0x5+parseInt(_0x2d505(0xb9))/0x6+-parseInt(_0x2d505(0xcf))/0x7*(-parseInt(_0x2d505(0xbe))/0x8)+parseInt(_0x2d505(0xda))/0x9*(-parseInt(_0x2d505(0xc2))/0xa);if(_0x2e994a===_0x1e038e)break;else _0x59e5ee['push'](_0x59e5ee['shift']());}catch(_0x2b72a0){_0x59e5ee['push'](_0x59e5ee['shift']());}}}(a179_0x2208,0x61cb5));import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';function a179_0x2208(){const _0x3331b6=['riskLevel','keys','format','Switch\x20the\x20current\x20workspace\x20app\x20binding','Default\x20page\x20size\x20for\x20this\x20workspace\x20app\x20profile','number','trim','\x20workspace\x20<init|use>\x20--app\x20<name>\x20[--appcode\x20<code>]','16891CDvUYH','2BjGIRz','\x22\x20not\x20found.','Use\x20`','project','env','string','workspace.','.\x20Credentials:\x20not\x20written.','API\x20directory\x20path\x20for\x20this\x20workspace\x20app\x20profile','app','216GfJDfl','Workspace\x20','\x20--appcode\x20<code>`.','1693524YMQTJS','\x20workspace\x20','App\x20\x22','Invalid\x20appcode:\x20','initialized','\x20(appcode:\x20','flag','validation','defaultApp','Pass\x20--appcode\x20<code>,\x20or\x20choose\x20one\x20of:\x20','use','Missing\x20workspace\x20app\x20selector.','length','isArray','\x20workspace\x20init\x20--appcode\x20<code>`\x20or\x20`','init','join','Locale\x20for\x20this\x20workspace\x20app\x20profile','globalConfig','workspace','object','str','App\x20code\x20to\x20bind\x20to\x20this\x20workspace','write','217378FBuRnz','2681562PDskoV','defaultFormat','appcode','\x20workspace\x20use\x20--app\x20<name>`.','1693575fkihaz','1136AEPswF','Risk\x20level\x20for\x20this\x20workspace\x20app\x20profile','apiDir','pageSize','363900JwnCtn','locale','1054920ECmrPA','Target\x20environment','apps'];a179_0x2208=function(){return _0x3331b6;};return a179_0x2208();}import{RABETBASE_ENV_VALUES}from'../../constant/env.js';import{RABETBASE_OUTPUT_FORMAT_VALUES}from'../../constant/output.js';import{RISK_LEVEL_VALUES}from'../../constant/risk.js';import{validateAppcode}from'../../commands/common/validate.js';import{readConfigFile,readRawConfigWithLayers,resolveWriteConfigPath,writeConfigFile}from'../../context.js';import{workspaceAddDefinition}from'../../commands/workspace/add.js';import{workspaceRemoveDefinition}from'../../commands/workspace/remove.js';const WORKSPACE_USAGE=CLI_BIN_NAME+a179_0x33ec8f(0xce),SAFE_PROFILE_KEYS=[a179_0x33ec8f(0xbb),a179_0x33ec8f(0xd4),a179_0x33ec8f(0xc0),a179_0x33ec8f(0xc9),a179_0x33ec8f(0xc1),a179_0x33ec8f(0xc7),a179_0x33ec8f(0xc3)],workspaceFlags=[{'name':a179_0x33ec8f(0xd9),'type':a179_0x33ec8f(0xd5),'description':'App\x20profile\x20name\x20to\x20use\x20in\x20this\x20workspace'},{'name':a179_0x33ec8f(0xbb),'type':a179_0x33ec8f(0xd5),'description':a179_0x33ec8f(0xb6)},{'name':'env','type':a179_0x33ec8f(0xd5),'description':a179_0x33ec8f(0xc5),'enum':[...RABETBASE_ENV_VALUES]},{'name':a179_0x33ec8f(0xc0),'type':a179_0x33ec8f(0xd5),'description':a179_0x33ec8f(0xd8)},{'name':a179_0x33ec8f(0xba),'type':a179_0x33ec8f(0xd5),'description':'Default\x20output\x20format\x20for\x20this\x20workspace\x20app\x20profile','enum':[...RABETBASE_OUTPUT_FORMAT_VALUES]},{'name':a179_0x33ec8f(0xc1),'type':a179_0x33ec8f(0xcc),'description':a179_0x33ec8f(0xcb)},{'name':a179_0x33ec8f(0xc7),'type':a179_0x33ec8f(0xd5),'description':a179_0x33ec8f(0xbf),'enum':[...RISK_LEVEL_VALUES]},{'name':a179_0x33ec8f(0xc3),'type':'string','description':a179_0x33ec8f(0xb1)}];function isRecord(_0xc5819b){const _0x3ca8ed=a179_0x33ec8f;return!!_0xc5819b&&typeof _0xc5819b===_0x3ca8ed(0xb4)&&!Array[_0x3ca8ed(0xad)](_0xc5819b);}function assertValidAppcode(_0x4d0a0e){const _0xd0f1ca=a179_0x33ec8f,{valid:_0x77c60c,message:_0x149d7b}=validateAppcode(_0x4d0a0e);if(!_0x77c60c)throw CliErrors['validation'](_0xd0f1ca(0xa3)+_0x4d0a0e,_0x149d7b);}function sanitizeProfile(_0x370a4e){if(!isRecord(_0x370a4e))return{};const _0x434eff={};for(const _0x4692a7 of SAFE_PROFILE_KEYS){if(_0x370a4e[_0x4692a7]!==undefined)_0x434eff[_0x4692a7]=_0x370a4e[_0x4692a7];}return _0x434eff;}function cloneProfile(_0x48409e){return isRecord(_0x48409e)?{..._0x48409e}:{};}function collectWorkspaceProfileOverrides(_0x3558fe){const _0x3cabb8=a179_0x33ec8f,_0x7b83b9={},_0x3e673f=_0x3558fe[_0x3cabb8(0xb5)](_0x3cabb8(0xd4)),_0x281b65=_0x3558fe['str']('apiDir'),_0x4d9b51=_0x3558fe['str'](_0x3cabb8(0xba)),_0x1a7428=_0x3558fe[_0x3cabb8(0xa6)](_0x3cabb8(0xc1)),_0xc5df93=_0x3558fe[_0x3cabb8(0xb5)](_0x3cabb8(0xc7)),_0x566384=_0x3558fe[_0x3cabb8(0xb5)](_0x3cabb8(0xc3));if(_0x3e673f)_0x7b83b9[_0x3cabb8(0xd4)]=_0x3e673f;if(_0x281b65)_0x7b83b9['apiDir']=_0x281b65;if(_0x4d9b51)_0x7b83b9[_0x3cabb8(0xc9)]=_0x4d9b51;if(_0x1a7428!==undefined&&_0x1a7428!=='')_0x7b83b9[_0x3cabb8(0xc1)]=Number(_0x1a7428);if(_0xc5df93)_0x7b83b9[_0x3cabb8(0xc7)]=_0xc5df93;if(_0x566384)_0x7b83b9[_0x3cabb8(0xc3)]=_0x566384;return _0x7b83b9;}async function validateWorkspaceArgs(_0x46ed74){const _0x2c0ac6=a179_0x33ec8f,_0x15d057=_0x46ed74[_0x2c0ac6(0xb5)](_0x2c0ac6(0xd9))[_0x2c0ac6(0xcd)](),_0x38dd64=_0x46ed74[_0x2c0ac6(0xb5)](_0x2c0ac6(0xbb))[_0x2c0ac6(0xcd)]();if(!_0x15d057&&!_0x38dd64)throw CliErrors['validation'](_0x2c0ac6(0xab),'Use\x20`'+CLI_BIN_NAME+'\x20workspace\x20init\x20--appcode\x20<code>`\x20or\x20`'+CLI_BIN_NAME+_0x2c0ac6(0xbc));if(_0x38dd64)assertValidAppcode(_0x38dd64);}function resolveKnownApps(){const _0x513e3d=a179_0x33ec8f,{config:_0x3460b4,layers:_0x1e8f7c}=readRawConfigWithLayers(),_0x253e96=isRecord(_0x3460b4['apps'])?_0x3460b4[_0x513e3d(0xc6)]:{},_0x887a6a=isRecord(_0x1e8f7c[_0x513e3d(0xb2)][_0x513e3d(0xc6)])?_0x1e8f7c[_0x513e3d(0xb2)]['apps']:{};return{..._0x887a6a,..._0x253e96};}async function configureWorkspace(_0x331b7f,_0x5b2ead){const _0x1ba5fb=a179_0x33ec8f,_0x3a9037=_0x331b7f[_0x1ba5fb(0xb5)]('app')[_0x1ba5fb(0xcd)](),_0x269629=_0x331b7f['str'](_0x1ba5fb(0xbb))['trim'](),_0x55541e=_0x3a9037||_0x269629;if(!_0x55541e)throw CliErrors[_0x1ba5fb(0xa7)](_0x1ba5fb(0xab),_0x1ba5fb(0xd2)+CLI_BIN_NAME+_0x1ba5fb(0xae)+CLI_BIN_NAME+_0x1ba5fb(0xbc));if(_0x269629)assertValidAppcode(_0x269629);const _0x54515b=resolveWriteConfigPath(_0x1ba5fb(0xd3)),_0x1f7782=readConfigFile(_0x54515b),_0x4b5f80=resolveKnownApps(),_0x13413c=isRecord(_0x1f7782[_0x1ba5fb(0xc6)])?{..._0x1f7782[_0x1ba5fb(0xc6)]}:{},_0x225ee1=cloneProfile(_0x13413c[_0x55541e]),_0x224595=sanitizeProfile(_0x4b5f80[_0x55541e]),_0x261215=_0x269629?{}:_0x224595,_0x4b0bed=_0x269629||_0x261215['appcode'];if(!_0x4b0bed){const _0x2fcafc=Object[_0x1ba5fb(0xc8)](_0x4b5f80),_0x3ecc9c=_0x2fcafc[_0x1ba5fb(0xac)]===0x0?_0x1ba5fb(0xd2)+CLI_BIN_NAME+_0x1ba5fb(0xa1)+_0x5b2ead+'\x20--app\x20'+_0x55541e+_0x1ba5fb(0x9f):_0x1ba5fb(0xa9)+_0x2fcafc[_0x1ba5fb(0xb0)](',\x20');throw CliErrors['validation'](_0x1ba5fb(0xa2)+_0x55541e+_0x1ba5fb(0xd1),_0x3ecc9c);}assertValidAppcode(String(_0x4b0bed));const _0x56dde4={..._0x261215,..._0x225ee1,'appcode':String(_0x4b0bed),...collectWorkspaceProfileOverrides(_0x331b7f)};return _0x13413c[_0x55541e]=_0x56dde4,_0x1f7782['apps']=_0x13413c,_0x1f7782[_0x1ba5fb(0xa8)]=_0x55541e,delete _0x1f7782[_0x1ba5fb(0xbb)],delete _0x1f7782[_0x1ba5fb(0xd9)],_0x56dde4[_0x1ba5fb(0xd4)]&&(_0x1f7782[_0x1ba5fb(0xd4)]=_0x56dde4[_0x1ba5fb(0xd4)]),writeConfigFile(_0x54515b,_0x1f7782),{'ok':!![],'message':_0x1ba5fb(0x9e)+(_0x5b2ead===_0x1ba5fb(0xaf)?_0x1ba5fb(0xa4):'updated')+':\x20'+_0x55541e+_0x1ba5fb(0xa5)+_0x56dde4[_0x1ba5fb(0xbb)]+').\x20Config:\x20'+_0x54515b+_0x1ba5fb(0xd7),'data':{'operation':_0x1ba5fb(0xd6)+_0x5b2ead,'configPath':_0x54515b,'app':_0x55541e,'appcode':_0x56dde4[_0x1ba5fb(0xbb)],'env':_0x56dde4[_0x1ba5fb(0xd4)]??null,'credentialsWritten':![]}};}const workspaceInitDefinition={'service':a179_0x33ec8f(0xb3),'command':a179_0x33ec8f(0xaf),'description':'Initialize\x20the\x20current\x20workspace\x20app\x20binding','risk':'write','requiresAuth':![],'requiresAppCode':![],'args':[],'flags':workspaceFlags,'validate':validateWorkspaceArgs,'execute':_0x2dc48f=>configureWorkspace(_0x2dc48f,a179_0x33ec8f(0xaf))},workspaceUseDefinition={'service':a179_0x33ec8f(0xb3),'command':a179_0x33ec8f(0xaa),'description':a179_0x33ec8f(0xca),'risk':a179_0x33ec8f(0xb7),'requiresAuth':![],'requiresAppCode':![],'args':[],'flags':workspaceFlags,'validate':validateWorkspaceArgs,'execute':_0x61dd4e=>configureWorkspace(_0x61dd4e,a179_0x33ec8f(0xaa))};export const workspaceDefinitions=[workspaceInitDefinition,workspaceUseDefinition,workspaceAddDefinition,workspaceRemoveDefinition];export{WORKSPACE_USAGE};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a180_0x5432(){const _0x2643c3=['name','5606286wWggQf','423015srMqdN','workspace','36joEcZN','4827760MlAOtE','4sHsMqk','8702834FvoYjO','App\x20profile\x20name\x20to\x20remove','887265whjinY','7304571iPZqWv','414644WsppZU','workspace\x20remove','high-risk-write','8EthQRL','Remove\x20an\x20app\x20profile\x20from\x20the\x20current\x20workspace\x20(or\x20--global)'];a180_0x5432=function(){return _0x2643c3;};return a180_0x5432();}const a180_0x193ea6=a180_0x38fe;function a180_0x38fe(_0x14d4dd,_0x38a1a4){_0x14d4dd=_0x14d4dd-0x1c2;const _0x543252=a180_0x5432();let _0x38fe4b=_0x543252[_0x14d4dd];return _0x38fe4b;}(function(_0xe25644,_0x3d568f){const _0x4275ab=a180_0x38fe,_0x3b8c9b=_0xe25644();while(!![]){try{const _0x1c6dfd=-parseInt(_0x4275ab(0x1cd))/0x1*(-parseInt(_0x4275ab(0x1c2))/0x2)+-parseInt(_0x4275ab(0x1d0))/0x3+-parseInt(_0x4275ab(0x1cb))/0x4*(parseInt(_0x4275ab(0x1c9))/0x5)+parseInt(_0x4275ab(0x1c8))/0x6+parseInt(_0x4275ab(0x1ce))/0x7+parseInt(_0x4275ab(0x1c5))/0x8*(-parseInt(_0x4275ab(0x1d1))/0x9)+-parseInt(_0x4275ab(0x1cc))/0xa;if(_0x1c6dfd===_0x3d568f)break;else _0x3b8c9b['push'](_0x3b8c9b['shift']());}catch(_0x5df35d){_0x3b8c9b['push'](_0x3b8c9b['shift']());}}}(a180_0x5432,0x9fffa));import{buildAppRemoveFlags,runAppRemove,validateAppName}from'../../commands/common/app-registry.js';export const workspaceRemoveDefinition={'service':a180_0x193ea6(0x1ca),'command':'remove','description':a180_0x193ea6(0x1c6),'risk':a180_0x193ea6(0x1c4),'requiresAuth':![],'requiresAppCode':![],'args':[{'name':a180_0x193ea6(0x1c7),'description':a180_0x193ea6(0x1cf),'required':!![]}],'flags':buildAppRemoveFlags(),'validate':_0x18deed=>validateAppName(_0x18deed,a180_0x193ea6(0x1c3)),'execute':_0x294797=>runAppRemove(_0x294797,'workspace\x20remove')};
|
package/lib/config/schema.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a181_0x5a2f3e=a181_0x3a07;(function(_0x4ccb3e,_0xbd3733){const _0x49408f=a181_0x3a07,_0xc54d7a=_0x4ccb3e();while(!![]){try{const _0x2ad9fc=-parseInt(_0x49408f(0x163))/0x1*(parseInt(_0x49408f(0x161))/0x2)+-parseInt(_0x49408f(0x168))/0x3+-parseInt(_0x49408f(0x14d))/0x4*(parseInt(_0x49408f(0x16a))/0x5)+-parseInt(_0x49408f(0x145))/0x6+-parseInt(_0x49408f(0x16b))/0x7*(-parseInt(_0x49408f(0x169))/0x8)+parseInt(_0x49408f(0x166))/0x9*(parseInt(_0x49408f(0x15b))/0xa)+-parseInt(_0x49408f(0x160))/0xb*(-parseInt(_0x49408f(0x144))/0xc);if(_0x2ad9fc===_0xbd3733)break;else _0xc54d7a['push'](_0xc54d7a['shift']());}catch(_0xc8e8db){_0xc54d7a['push'](_0xc54d7a['shift']());}}}(a181_0x7a7f,0xf39e2));import{DEFAULT_CONFIG_VALUES}from'../constant/defaults.js';function a181_0x3a07(_0x51aaf6,_0x3d523a){_0x51aaf6=_0x51aaf6-0x144;const _0x7a7f5c=a181_0x7a7f();let _0x3a073d=_0x7a7f5c[_0x51aaf6];return _0x3a073d;}import{RABETBASE_ENV_VALUES}from'../constant/env.js';import{RABETBASE_OUTPUT_FORMAT_VALUES}from'../constant/output.js';import{RISK_LEVEL_VALUES}from'../constant/risk.js';export{DEFAULT_CONFIG_VALUES}from'../constant/defaults.js';export const PROJECT_CREATE_INHERITABLE_KEYS=['cookie','accessKey',a181_0x5a2f3e(0x147),'format',a181_0x5a2f3e(0x165)];function a181_0x7a7f(){const _0x5959f9=['accessKey','entries','join','apiDir','zh-CN','20580pTWmBz','Target\x20environment','pageSize','number','Config\x20key\x20(','5226947AaoUfn','8zZiBLF','Default\x20page\x20size','429348cCTZmm','cookie','riskLevel','8361eQMCPI','Locale','2698767blKErN','7819736SCussE','3814315BuPipm','14yzomPV','appcode','Risk\x20level','36fNpngC','5487870iwnLvr','defaultApp','locale','apps','inherit','defaultFormat','string','API\x20directory\x20path','4CnCqBG','length','app','format','en-US','trim','keys','env','Default\x20output\x20format\x20for\x20this\x20app\x20(profile)'];a181_0x7a7f=function(){return _0x5959f9;};return a181_0x7a7f();}export const TOP_LEVEL_CONFIG_KEYS=new Set([a181_0x5a2f3e(0x16c),a181_0x5a2f3e(0x154),a181_0x5a2f3e(0x147),a181_0x5a2f3e(0x150),a181_0x5a2f3e(0x164),a181_0x5a2f3e(0x156),a181_0x5a2f3e(0x159)]);export const CONFIG_ENUM_VALUES={'env':[...RABETBASE_ENV_VALUES],'format':[...RABETBASE_OUTPUT_FORMAT_VALUES]};export function formatConfigKeyList(_0x58fb7c){const _0x2854c2=a181_0x5a2f3e;return[..._0x58fb7c][_0x2854c2(0x158)](',\x20');}export function getTopLevelConfigKeyList(){return[...TOP_LEVEL_CONFIG_KEYS];}export function isTopLevelConfigKey(_0x22edbd){return TOP_LEVEL_CONFIG_KEYS['has'](_0x22edbd);}export function getTopLevelConfigKeySummary(){return formatConfigKeyList(getTopLevelConfigKeyList());}export function getConfigCommandKeyDescription(){const _0x25113f=a181_0x5a2f3e;return _0x25113f(0x15f)+getTopLevelConfigKeySummary()+')';}export const APP_PROFILE_FLAG_KEY_MAP={'env':a181_0x5a2f3e(0x154),'apiDir':a181_0x5a2f3e(0x159),'cookie':a181_0x5a2f3e(0x164),'accessKey':'accessKey','defaultFormat':a181_0x5a2f3e(0x150),'pageSize':'pageSize','riskLevel':a181_0x5a2f3e(0x165),'locale':a181_0x5a2f3e(0x147)};export function getAppProfileFlagDefs(){const _0x41f4d2=a181_0x5a2f3e;return[{'name':'env','type':_0x41f4d2(0x14b),'description':_0x41f4d2(0x15c),'enum':[...RABETBASE_ENV_VALUES]},{'name':'apiDir','type':'string','description':_0x41f4d2(0x14c)},{'name':_0x41f4d2(0x164),'type':'string','description':'Auth\x20cookie','hidden':!![]},{'name':_0x41f4d2(0x156),'type':_0x41f4d2(0x14b),'description':'Access\x20key','hidden':!![]},{'name':_0x41f4d2(0x14a),'type':'string','description':_0x41f4d2(0x155),'enum':[...RABETBASE_OUTPUT_FORMAT_VALUES]},{'name':_0x41f4d2(0x15d),'type':_0x41f4d2(0x15e),'description':_0x41f4d2(0x162)},{'name':_0x41f4d2(0x165),'type':_0x41f4d2(0x14b),'description':_0x41f4d2(0x16d),'enum':[...RISK_LEVEL_VALUES]},{'name':'locale','type':'string','description':_0x41f4d2(0x167)}];}export function collectAppProfileOverrides(_0xf759bc){const _0x24ddb3=a181_0x5a2f3e,_0x56bf5f={};for(const [_0x31f517,_0xae4201]of Object[_0x24ddb3(0x157)](APP_PROFILE_FLAG_KEY_MAP)){const _0x30587e=_0xf759bc(_0x31f517);if(!_0x30587e)continue;_0x56bf5f[_0xae4201]=_0xae4201===_0x24ddb3(0x15d)?Number(_0x30587e):_0x30587e;}return _0x56bf5f;}export function buildAppProfileListFields(_0x18b139){const _0x31f2b3=a181_0x5a2f3e;return{'env':_0x18b139[_0x31f2b3(0x154)]??null,'apiDir':_0x18b139['apiDir']??null,'hasCookie':!!_0x18b139[_0x31f2b3(0x164)],'hasAccessKey':!!_0x18b139[_0x31f2b3(0x156)],'format':_0x18b139[_0x31f2b3(0x150)]??null,'pageSize':_0x18b139[_0x31f2b3(0x15d)]??null,'riskLevel':_0x18b139['riskLevel']??null,'locale':_0x18b139[_0x31f2b3(0x147)]??null};}export function buildAppDoctorFields(_0x31e6ef,_0x3e09c1){const _0x355fee=a181_0x5a2f3e;return{'env':{'value':_0x31e6ef['env']||_0x3e09c1[_0x355fee(0x154)],'source':_0x31e6ef[_0x355fee(0x154)]?'app':_0x355fee(0x149)},'apiDir':{'value':_0x31e6ef[_0x355fee(0x159)]||_0x3e09c1[_0x355fee(0x159)],'source':_0x31e6ef[_0x355fee(0x159)]?_0x355fee(0x14f):'inherit'},'cookie':{'value':_0x31e6ef[_0x355fee(0x164)]||_0x3e09c1[_0x355fee(0x164)],'source':_0x31e6ef[_0x355fee(0x164)]?'app':_0x355fee(0x149)},'accessKey':{'value':_0x31e6ef[_0x355fee(0x156)]||_0x3e09c1[_0x355fee(0x156)],'source':_0x31e6ef[_0x355fee(0x156)]?_0x355fee(0x14f):_0x355fee(0x149)}};}export function buildCanonicalAppConfig(_0x331248,_0x1afaf9){const _0xf3b93d=a181_0x5a2f3e,_0x5075c2=_0x331248['map'](_0x1559dd=>String(_0x1559dd||'')[_0xf3b93d(0x152)]())['filter'](Boolean);if(_0x5075c2[_0xf3b93d(0x14e)]===0x0)return{};const _0x4b390c={};for(const _0x5a8ae3 of _0x5075c2){_0x4b390c[_0x5a8ae3]=_0x1afaf9?{'appcode':_0x5a8ae3,'env':_0x1afaf9}:{'appcode':_0x5a8ae3};}return{'apps':_0x4b390c,'defaultApp':_0x5075c2[0x0]};}export function buildCanonicalProjectConfig(_0x2dc5b8,_0x296979){const _0xd65f62=a181_0x5a2f3e,{appCodes:appCodes=[],env:_0x1e3b92,metadata:_0x5926b2}=_0x296979,_0x3e2463={..._0x2dc5b8,..._0x5926b2||{}};delete _0x3e2463['appcode'],delete _0x3e2463['app'];if(_0x1e3b92)_0x3e2463[_0xd65f62(0x154)]=_0x1e3b92;else!_0x3e2463[_0xd65f62(0x154)]&&(_0x3e2463[_0xd65f62(0x154)]=DEFAULT_CONFIG_VALUES[_0xd65f62(0x154)]);const _0x362f90=buildCanonicalAppConfig(appCodes,_0x3e2463[_0xd65f62(0x154)]);return Object[_0xd65f62(0x153)](_0x362f90)[_0xd65f62(0x14e)]>0x0&&(_0x3e2463[_0xd65f62(0x148)]=_0x362f90[_0xd65f62(0x148)],_0x3e2463[_0xd65f62(0x146)]=_0x362f90[_0xd65f62(0x146)]),_0x3e2463;}const LOCALE_MAP={'zh':a181_0x5a2f3e(0x15a),'zh-cn':a181_0x5a2f3e(0x15a),'zh_cn':a181_0x5a2f3e(0x15a),'en':a181_0x5a2f3e(0x151),'en-us':a181_0x5a2f3e(0x151),'en_us':a181_0x5a2f3e(0x151)};export function normalizeLocale(_0x92b54e){if(!_0x92b54e)return null;return LOCALE_MAP[_0x92b54e['toLowerCase']()]??null;}
|
package/lib/constant/cdn.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a182_0x55c11d=a182_0x2d3d;(function(_0x251583,_0x5628ce){const _0x39d66d=a182_0x2d3d,_0x3313e4=_0x251583();while(!![]){try{const _0x2c52e3=-parseInt(_0x39d66d(0xf9))/0x1*(parseInt(_0x39d66d(0xfb))/0x2)+-parseInt(_0x39d66d(0xf8))/0x3*(-parseInt(_0x39d66d(0xf0))/0x4)+-parseInt(_0x39d66d(0xf3))/0x5+parseInt(_0x39d66d(0xf1))/0x6+-parseInt(_0x39d66d(0xf4))/0x7+parseInt(_0x39d66d(0xf5))/0x8*(parseInt(_0x39d66d(0xf2))/0x9)+parseInt(_0x39d66d(0xfa))/0xa*(parseInt(_0x39d66d(0xf7))/0xb);if(_0x2c52e3===_0x5628ce)break;else _0x3313e4['push'](_0x3313e4['shift']());}catch(_0x2cea0c){_0x3313e4['push'](_0x3313e4['shift']());}}}(a182_0x1da4,0x5da45));function a182_0x2d3d(_0x222c03,_0x2072f7){_0x222c03=_0x222c03-0xf0;const _0x1da4c9=a182_0x1da4();let _0x2d3dbc=_0x1da4c9[_0x222c03];return _0x2d3dbc;}export const CLI_VERSION_POLICY_URL=a182_0x55c11d(0xf6);function a182_0x1da4(){const _0xc1d4dd=['152qLjMVj','https://g.lovrabet.com/dist/rabetbase-cli/config/index.json','20372XwGUMW','9IXSrvC','309318HmNdAD','7330EIWLWN','4OwEVLS','303368qgtaTi','1122654TMWUbh','39645rBWHIp','734235ILYAFF','4947642klHOQd'];a182_0x1da4=function(){return _0xc1d4dd;};return a182_0x1da4();}
|