@lovrabet/rabetbase-cli 2.3.7-beta.4 → 2.3.7
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/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/index.js +1 -1
- package/lib/commands/menu/list.js +1 -1
- package/lib/commands/menu/shared/compare-table.js +1 -1
- package/lib/commands/menu/shared/index.js +1 -1
- package/lib/commands/menu/shared/inquirer.js +1 -1
- package/lib/commands/menu/shared/local-pages.js +1 -1
- package/lib/commands/menu/shared/logic.js +1 -1
- package/lib/commands/menu/shared/service.js +1 -1
- package/lib/commands/menu/shared/sync-core.js +1 -1
- package/lib/commands/menu/shared/update-core.js +1 -1
- package/lib/commands/menu/shared/valid-url.js +1 -1
- package/lib/commands/menu/sync.js +1 -1
- package/lib/commands/menu/update.js +1 -1
- package/lib/commands/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/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-sync/config.js +1 -1
- package/lib/core/sql-sync/file-system.js +1 -1
- package/lib/core/sql-sync/hash.js +1 -1
- package/lib/core/sql-sync/lock.js +1 -1
- package/lib/core/sql-sync/utils.js +1 -1
- package/lib/core/sql-validator.js +1 -1
- package/lib/errors.js +1 -1
- package/lib/framework/build-all-flags.js +1 -1
- package/lib/framework/flags.js +1 -1
- package/lib/framework/help.js +1 -1
- package/lib/framework/index.js +1 -1
- package/lib/framework/output.js +1 -1
- package/lib/framework/response.js +1 -1
- package/lib/framework/runner-alias.js +1 -1
- package/lib/framework/runner.js +1 -1
- package/lib/framework/schema-export.js +1 -1
- package/lib/framework/types.js +1 -1
- package/lib/generated/build-info.js +1 -1
- package/lib/help.js +1 -1
- package/lib/skills/main.js +1 -1
- package/lib/skills/npx-skills-add.js +1 -1
- package/lib/telemetry/cli-command-trace.js +1 -1
- package/lib/telemetry/cli-help-trace.js +1 -1
- package/lib/telemetry/ensure-cli-otel-config.js +1 -1
- package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
- package/lib/telemetry/send-cli-trace-log.js +1 -1
- package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
- package/lib/utils/ai_config.js +1 -1
- package/lib/utils/apply-jq-filter.js +1 -1
- package/lib/utils/cdn-config.js +1 -1
- package/lib/utils/check-sdk-version.js +1 -1
- package/lib/utils/cli-version-check.js +1 -1
- package/lib/utils/cli-version-policy.js +1 -1
- package/lib/utils/config.js +1 -1
- package/lib/utils/copy-directory.js +1 -1
- package/lib/utils/entity-with-id.js +1 -1
- package/lib/utils/file-utils.js +1 -1
- package/lib/utils/guides-cdn.js +1 -1
- package/lib/utils/http-client.js +1 -1
- package/lib/utils/is-non-interactive.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/params.js +1 -1
- package/lib/utils/platform.js +1 -1
- package/lib/utils/rules-cdn.js +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.js +1 -1
- package/lib/utils/update-notice.js +1 -1
- package/lib/utils/version.js +1 -1
- package/lib/utils/with-active-cookie.js +1 -1
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a158_0x2864(_0x3e52d9,_0x17b12d){_0x3e52d9=_0x3e52d9-0xbf;const _0x55c85d=a158_0x55c8();let _0x28648a=_0x55c85d[_0x3e52d9];return _0x28648a;}const a158_0x14c470=a158_0x2864;(function(_0xb46815,_0x122086){const _0xc5140f=a158_0x2864,_0x38cc60=_0xb46815();while(!![]){try{const _0x363a39=-parseInt(_0xc5140f(0xc4))/0x1+-parseInt(_0xc5140f(0xcb))/0x2+-parseInt(_0xc5140f(0xce))/0x3+-parseInt(_0xc5140f(0xca))/0x4+parseInt(_0xc5140f(0xc3))/0x5*(-parseInt(_0xc5140f(0xc1))/0x6)+parseInt(_0xc5140f(0xc2))/0x7+parseInt(_0xc5140f(0xc6))/0x8;if(_0x363a39===_0x122086)break;else _0x38cc60['push'](_0x38cc60['shift']());}catch(_0xa038ce){_0x38cc60['push'](_0x38cc60['shift']());}}}(a158_0x55c8,0xde614));import{getSqlQueryInfo}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';function a158_0x55c8(){const _0x4d2930=['36282480YJInID','dbId','sqlName','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','1898148LTtSlN','2198952awENdY','detail','verbose','3653031xarZtA','read','appCode','4641852FvjyXY','6216735PKmvuH','10fnRNbn','173573mqABxa','sqlcode'];a158_0x55c8=function(){return _0x4d2930;};return a158_0x55c8();}import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':'sql','command':a158_0x14c470(0xcc),'description':a158_0x14c470(0xc9),'risk':a158_0x14c470(0xbf),'flags':[SQLCODE_FLAG,{'name':a158_0x14c470(0xcd),'type':'boolean','description':'Return\x20full\x20raw\x20SQL\x20query\x20object'}],async 'execute'(_0x5b477c){const _0x3c40e4=a158_0x14c470,_0x595b5e=await getSqlQueryInfo(_0x5b477c[_0x3c40e4(0xc0)],_0x5b477c['str'](_0x3c40e4(0xc5))),_0x1911ae=_0x5b477c['bool'](_0x3c40e4(0xcd));if(_0x1911ae)return{'ok':!![],'data':_0x595b5e};const _0xe1fbb=_0x595b5e[_0x3c40e4(0xc7)]?await getDbName(_0x5b477c[_0x3c40e4(0xc0)],_0x595b5e[_0x3c40e4(0xc7)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x595b5e['sqlCode'],'sqlName':_0x595b5e[_0x3c40e4(0xc8)],'db':_0xe1fbb?_0xe1fbb+'\x20('+_0x595b5e[_0x3c40e4(0xc7)]+')':_0x595b5e[_0x3c40e4(0xc7)]??'','description':_0x595b5e['description']??'','sqlContent':_0x595b5e['sqlContent']??''}};}};
|
package/lib/commands/sql/exec.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a159_0x4474(_0x4efefa,_0x28ad2b){_0x4efefa=_0x4efefa-0x173;const _0x5ee59a=a159_0x5ee5();let _0x4474f8=_0x5ee59a[_0x4efefa];return _0x4474f8;}const a159_0x2c15c0=a159_0x4474;(function(_0x1e17e4,_0xec5e88){const _0x1f3cde=a159_0x4474,_0x465a61=_0x1e17e4();while(!![]){try{const _0x1988c1=parseInt(_0x1f3cde(0x176))/0x1+parseInt(_0x1f3cde(0x17d))/0x2*(-parseInt(_0x1f3cde(0x187))/0x3)+parseInt(_0x1f3cde(0x18a))/0x4+-parseInt(_0x1f3cde(0x188))/0x5*(-parseInt(_0x1f3cde(0x185))/0x6)+parseInt(_0x1f3cde(0x17a))/0x7*(-parseInt(_0x1f3cde(0x181))/0x8)+-parseInt(_0x1f3cde(0x17e))/0x9*(parseInt(_0x1f3cde(0x175))/0xa)+-parseInt(_0x1f3cde(0x18b))/0xb;if(_0x1988c1===_0xec5e88)break;else _0x465a61['push'](_0x465a61['shift']());}catch(_0xb9cded){_0x465a61['push'](_0x465a61['shift']());}}}(a159_0x5ee5,0xd8031));import{executeSql}from'../../core/api-client.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';function a159_0x5ee5(){const _0x26dc5c=['SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','now','2090030SXiOvI','632476LEVQuG','\x20row(s)\x20in\x20','execResult','str','7ZCcLHt','execError','isArray','851028teJnBM','36Kymjpe','length','params','2343720ccprra','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','SQL\x20execution\x20failed','Returned\x20','9123630gKYSRT','appCode','9KYgtjm','5OioNaF','execSuccess','5753936mrMAdn','3313871QwEskW'];a159_0x5ee5=function(){return _0x26dc5c;};return a159_0x5ee5();}import{parseJsonParams}from'../../utils/params.js';export const sqlExec={'service':'sql','command':'exec','description':a159_0x2c15c0(0x182),'risk':'read','flags':[SQLCODE_FLAG,{'name':'params','type':'string','description':a159_0x2c15c0(0x173)}],async 'execute'(_0x3cbbcc){const _0x17ec5c=a159_0x2c15c0,_0x2df0b=parseJsonParams(_0x3cbbcc[_0x17ec5c(0x179)](_0x17ec5c(0x180))),_0xed0ac1=Date[_0x17ec5c(0x174)](),_0x1f7b6e=await executeSql(_0x3cbbcc[_0x17ec5c(0x186)],_0x3cbbcc[_0x17ec5c(0x179)]('sqlcode'),_0x2df0b),_0x109413=Date[_0x17ec5c(0x174)]()-_0xed0ac1,_0x425a7c=_0x1f7b6e?.[_0x17ec5c(0x178)]??_0x1f7b6e,_0x332b0e=_0x1f7b6e?.[_0x17ec5c(0x189)]??!![];if(!_0x332b0e)return{'ok':![],'data':{'error':_0x1f7b6e?.[_0x17ec5c(0x17b)]||_0x17ec5c(0x183),'elapsed':_0x109413},'message':_0x17ec5c(0x183)};const _0x8fc9c5=Array[_0x17ec5c(0x17c)](_0x425a7c)?_0x425a7c:[];return{'ok':!![],'data':{'rows':_0x8fc9c5,'rowCount':_0x8fc9c5[_0x17ec5c(0x17f)],'elapsed':_0x109413},'message':_0x17ec5c(0x184)+_0x8fc9c5[_0x17ec5c(0x17f)]+_0x17ec5c(0x177)+_0x109413+'ms'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x8001f0,_0xe24ab0){const _0x53c9e2=a160_0x5d78,_0x424f7d=_0x8001f0();while(!![]){try{const _0x258ff1=parseInt(_0x53c9e2(0x1e4))/0x1+-parseInt(_0x53c9e2(0x1de))/0x2+-parseInt(_0x53c9e2(0x1df))/0x3*(-parseInt(_0x53c9e2(0x1dc))/0x4)+parseInt(_0x53c9e2(0x1dd))/0x5+parseInt(_0x53c9e2(0x1e0))/0x6+-parseInt(_0x53c9e2(0x1e1))/0x7+parseInt(_0x53c9e2(0x1e2))/0x8*(parseInt(_0x53c9e2(0x1e3))/0x9);if(_0x258ff1===_0xe24ab0)break;else _0x424f7d['push'](_0x424f7d['shift']());}catch(_0x1a9d73){_0x424f7d['push'](_0x424f7d['shift']());}}}(a160_0x41f3,0xaeace));import{sqlList}from'../../commands/sql/list.js';function a160_0x5d78(_0x55f839,_0x49c350){_0x55f839=_0x55f839-0x1dc;const _0x41f322=a160_0x41f3();let _0x5d7862=_0x41f322[_0x55f839];return _0x5d7862;}import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';import{sqlSave}from'../../commands/sql/save.js';import{sqlExec}from'../../commands/sql/exec.js';import{sqlPull}from'../../commands/sql/pull.js';import{sqlCreate}from'../../commands/sql/create.js';import{sqlStatus}from'../../commands/sql/status.js';import{sqlPush}from'../../commands/sql/push.js';import{sqlDelete}from'../../commands/sql/delete.js';function a160_0x41f3(){const _0x2791ab=['16Upyvgr','308799WYKAbG','1121522RsyJmZ','8SOEwEq','133310pRsJaJ','2120294LtFsli','660486ELbVUg','1033158skUZOv','375942cWRcDY'];a160_0x41f3=function(){return _0x2791ab;};return a160_0x41f3();}export const sqlDefinitions=[sqlList,sqlDetail,sqlStatus,sqlCreate,sqlPush,sqlValidate,sqlSave,sqlExec,sqlPull,sqlDelete];
|
package/lib/commands/sql/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a161_0x4a93cb=a161_0xd9a4;(function(_0x494395,_0x5b5ea4){const _0x2fbecb=a161_0xd9a4,_0x2528df=_0x494395();while(!![]){try{const _0x170aca=parseInt(_0x2fbecb(0x1c6))/0x1+parseInt(_0x2fbecb(0x1b2))/0x2*(-parseInt(_0x2fbecb(0x1a8))/0x3)+parseInt(_0x2fbecb(0x1ae))/0x4+parseInt(_0x2fbecb(0x1a5))/0x5+-parseInt(_0x2fbecb(0x1b0))/0x6+parseInt(_0x2fbecb(0x1cb))/0x7*(-parseInt(_0x2fbecb(0x1ca))/0x8)+parseInt(_0x2fbecb(0x1c7))/0x9*(parseInt(_0x2fbecb(0x1ac))/0xa);if(_0x170aca===_0x5b5ea4)break;else _0x2528df['push'](_0x2528df['shift']());}catch(_0x1a9daf){_0x2528df['push'](_0x2528df['shift']());}}}(a161_0x3558,0x61042));import{listSqlQueries}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';function a161_0xd9a4(_0x1bd2fb,_0x2a7f61){_0x1bd2fb=_0x1bd2fb-0x1a5;const _0x3558cc=a161_0x3558();let _0xd9a469=_0x3558cc[_0x1bd2fb];return _0xd9a469;}function a161_0x3558(){const _0x215cfd=['966610WuLSlF','name','list','1547079Nszheq','all','verbose','number','10QQfsXY','str','2245084bPzsxu','bool','3722952FWewAY','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','2kuKqiI','sql','sqlcode','length','List\x20custom\x20SQL\x20queries','string','appCode','tableData','read','Page\x20number','Found\x20','sqlCode','sqlName','No\x20custom\x20SQL\x20queries\x20found.','dbId','description','pagesize','num','page','paging','326793kKgbom','8295417cBqUTY','Filter\x20by\x20SQL\x20name','boolean','1252096TAvLjV','21oGjcVu'];a161_0x3558=function(){return _0x215cfd;};return a161_0x3558();}import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':a161_0x4a93cb(0x1b3),'command':a161_0x4a93cb(0x1a7),'description':a161_0x4a93cb(0x1b6),'risk':a161_0x4a93cb(0x1ba),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a161_0x4a93cb(0x1a6),'type':a161_0x4a93cb(0x1b7),'description':a161_0x4a93cb(0x1c8)},{'name':a161_0x4a93cb(0x1c4),'type':a161_0x4a93cb(0x1ab),'description':a161_0x4a93cb(0x1bb),'default':0x1},{'name':a161_0x4a93cb(0x1c2),'type':a161_0x4a93cb(0x1ab),'description':'Page\x20size'},{'name':a161_0x4a93cb(0x1aa),'type':a161_0x4a93cb(0x1c9),'description':a161_0x4a93cb(0x1b1)}],async 'execute'(_0x5e0863){const _0xd470ed=a161_0x4a93cb,_0xf7fd3e=await listSqlQueries(_0x5e0863[_0xd470ed(0x1b8)],{'sqlCode':_0x5e0863[_0xd470ed(0x1ad)](_0xd470ed(0x1b4))||undefined,'sqlName':_0x5e0863[_0xd470ed(0x1ad)](_0xd470ed(0x1a6))||undefined,'currentPage':_0x5e0863[_0xd470ed(0x1c3)](_0xd470ed(0x1c4)),'pageSize':_0x5e0863[_0xd470ed(0x1c3)](_0xd470ed(0x1c2),0x32)}),_0x458b9a=_0x5e0863[_0xd470ed(0x1af)](_0xd470ed(0x1aa)),_0x2672e2=_0xf7fd3e[_0xd470ed(0x1b9)]??[],_0x5343f9=_0xf7fd3e[_0xd470ed(0x1c5)]?.['totalCount']??_0x2672e2[_0xd470ed(0x1b5)];let _0x525d5b;return _0x458b9a?_0x525d5b=_0x2672e2:_0x525d5b=await Promise[_0xd470ed(0x1a9)](_0x2672e2['map'](async _0x190bcc=>{const _0x3f9d1f=_0xd470ed;let _0x4f3e8d;try{_0x4f3e8d=_0x190bcc[_0x3f9d1f(0x1c0)]?await getDbName(_0x5e0863[_0x3f9d1f(0x1b8)],_0x190bcc['dbId']):undefined;}catch{}return{'sqlCode':_0x190bcc[_0x3f9d1f(0x1bd)],'sqlName':_0x190bcc[_0x3f9d1f(0x1be)],'description':_0x190bcc[_0x3f9d1f(0x1c1)]??'','db':_0x4f3e8d?_0x4f3e8d+'\x20('+_0x190bcc[_0x3f9d1f(0x1c0)]+')':_0x190bcc[_0x3f9d1f(0x1c0)]??''};})),{'ok':!![],'data':_0x525d5b,'message':_0x2672e2[_0xd470ed(0x1b5)]===0x0?_0xd470ed(0x1bf):_0xd470ed(0x1bc)+_0x2672e2[_0xd470ed(0x1b5)]+'\x20SQL\x20queries\x20(total:\x20'+_0x5343f9+').'};}};
|
package/lib/commands/sql/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a162_0xb4b5f4=a162_0x56c7;(function(_0x549bfd,_0x1f6711){const _0x5a6f01=a162_0x56c7,_0x4a1892=_0x549bfd();while(!![]){try{const _0x591042=parseInt(_0x5a6f01(0x107))/0x1+parseInt(_0x5a6f01(0x101))/0x2+parseInt(_0x5a6f01(0x118))/0x3*(parseInt(_0x5a6f01(0xfc))/0x4)+-parseInt(_0x5a6f01(0x110))/0x5+-parseInt(_0x5a6f01(0x111))/0x6*(parseInt(_0x5a6f01(0xdb))/0x7)+parseInt(_0x5a6f01(0x102))/0x8*(parseInt(_0x5a6f01(0xdd))/0x9)+parseInt(_0x5a6f01(0x10a))/0xa*(-parseInt(_0x5a6f01(0xf2))/0xb);if(_0x591042===_0x1f6711)break;else _0x4a1892['push'](_0x4a1892['shift']());}catch(_0x497d56){_0x4a1892['push'](_0x4a1892['shift']());}}}(a162_0x2a7c,0x63538));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 a162_0x56c7(_0x2ec007,_0x3b94b9){_0x2ec007=_0x2ec007-0xda;const _0x2a7c6c=a162_0x2a7c();let _0x56c70e=_0x2a7c6c[_0x2ec007];return _0x56c70e;}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(_0x5e9a15,_0x325d3d){const _0x449e35=a162_0x56c7,_0x4db8c4=[];let _0x3a2788=0x1;while(!![]){const _0x5b4562=await listSqlQueries(_0x5e9a15,{'currentPage':_0x3a2788,'pageSize':PAGE_SIZE,'sqlCode':_0x325d3d[_0x449e35(0xea)],'sqlName':_0x325d3d[_0x449e35(0xdc)]}),_0x156e8e=_0x5b4562[_0x449e35(0xda)]??[];_0x4db8c4[_0x449e35(0xef)](..._0x156e8e);if(_0x156e8e[_0x449e35(0xf4)]===0x0)break;const _0x4bdc9c=_0x5b4562[_0x449e35(0xe0)]?.[_0x449e35(0x10d)];if(_0x4bdc9c!=null?_0x4db8c4['length']>=_0x4bdc9c:_0x156e8e['length']<PAGE_SIZE)break;_0x3a2788++;}return _0x4db8c4;}async function ensureSqlContent(_0x1836d3){const _0x34d132=a162_0x56c7;if(_0x1836d3['sqlContent']!=null&&String(_0x1836d3[_0x34d132(0xe5)])[_0x34d132(0xf4)]>0x0)return _0x1836d3;return getSqlQueryDetail(_0x1836d3[_0x34d132(0xea)]);}function a162_0x2a7c(){const _0x5a8532=['1350XLvfyy','path','pull','totalCount','cancelled','string','1108845odpmPO','714Xirdrv','message','Pull\x20complete:\x20','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','split','sqlRootDir','trimStart','1623UzMtrs','tableData','4151YCCiFp','sqlName','9ilKwBI','\x20failed','unchanged','paging','Would\x20pull\x20','replace','lockFilePath','bool','sqlContent','skipped','local\x20differs\x20from\x20remote','name','str','sqlCode','boolean','force','toISOString','nonInteractive','push','sqlRoot','join','87868uDOATh','Force\x20pull\x20cancelled.','length','appCode','POST','conflict','utf8','sqls','\x20written,\x20','sqlcode','3212lRvhhp','Filter\x20by\x20SQL\x20display\x20name','description','\x20skipped,\x20','test','1507710hJqgJc','4713608WpBZmD','would_pull','mybatisXml','catch','dbId','77yJVrhD','\x20SQL\x20file(s)\x20into\x20','apps'];a162_0x2a7c=function(){return _0x5a8532;};return a162_0x2a7c();}export const sqlPull={'service':'sql','command':a162_0xb4b5f4(0x10c),'description':'Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','risk':'write','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a162_0xb4b5f4(0xe8),'type':a162_0xb4b5f4(0x10f),'description':a162_0xb4b5f4(0xfd)},{'name':a162_0xb4b5f4(0xec),'type':a162_0xb4b5f4(0xeb),'description':'Force\x20overwrite\x20local\x20unsynced\x20changes'}],async 'dryRun'(_0x376a56){const _0x2f1991=a162_0xb4b5f4,_0x269870=loadSqlProjectConfig(_0x376a56[_0x2f1991(0xf5)]),_0x2acd7d=await readSqlLockFile(_0x269870['lockFilePath']),{appLock:_0x5b8f96}=ensureSqlLockScope(_0x2acd7d??createEmptySqlLock(),_0x269870['appCode'],_0x269870[_0x2f1991(0xf0)],'pull'),_0x15bd15=await fetchAllSqlQueries(_0x376a56[_0x2f1991(0xf5)],{'sqlCode':_0x376a56[_0x2f1991(0xe9)](_0x2f1991(0xfb))||undefined,'sqlName':_0x376a56[_0x2f1991(0xe9)](_0x2f1991(0xe8))||undefined}),_0x6306fb=[];for(const _0x243c4a of _0x15bd15){const _0x4e6fd3=await ensureSqlContent(_0x243c4a),_0x221566=ensureRemoteSqlContent(_0x4e6fd3),_0x1e12e8=detectModeFromSql(_0x4e6fd3),_0x3d56d9=_0x4e6fd3[_0x2f1991(0x106)]?await getDbName(_0x376a56['appCode'],Number(_0x4e6fd3['dbId']))[_0x2f1991(0x105)](()=>undefined):undefined,_0x527f4e=buildLocalSqlFileContent({'sqlCode':_0x4e6fd3['sqlCode'],'sqlName':_0x4e6fd3[_0x2f1991(0xdc)],'dbId':_0x4e6fd3[_0x2f1991(0x106)]},_0x221566,{'dbName':_0x3d56d9,'mode':_0x1e12e8,'syncedAt':new Date()[_0x2f1991(0xed)](),'description':_0x4e6fd3[_0x2f1991(0xfe)]}),_0x1d3b4e=buildSqlLockEntry(_0x4e6fd3,_0x221566,'',{'dbName':_0x3d56d9}),_0x3772a5=resolveLocalSqlFilePath(_0x269870,_0x4e6fd3[_0x2f1991(0xea)],_0x1d3b4e);let _0x46e559=_0x2f1991(0x103),_0x3b81f3;if(await fileExists(_0x3772a5)){const _0xd08d44=await readFile(_0x3772a5,_0x2f1991(0xf8));isEquivalentPulledSqlFile(_0xd08d44,_0x527f4e,_0x1e12e8)?(_0x46e559=_0x2f1991(0xe6),_0x3b81f3=_0x2f1991(0xdf)):(_0x46e559=_0x2f1991(0xf7),_0x3b81f3='local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)');}_0x6306fb['push']({'sqlCode':_0x4e6fd3['sqlCode'],'sqlName':_0x4e6fd3[_0x2f1991(0xdc)],'filePath':_0x3772a5,'status':_0x46e559,'reason':_0x3b81f3});}return{'method':_0x2f1991(0xf6),'url':_0x2f1991(0x114),'body':{'appCode':_0x376a56['appCode'],'sqlCode':_0x376a56[_0x2f1991(0xe9)](_0x2f1991(0xfb))||null,'sqlName':_0x376a56[_0x2f1991(0xe9)](_0x2f1991(0xe8))||null,'files':_0x6306fb},'description':_0x2f1991(0xe1)+_0x6306fb[_0x2f1991(0xf4)]+_0x2f1991(0x108)+_0x269870[_0x2f1991(0x116)]};},async 'execute'(_0x4a434d){const _0x1293f2=a162_0xb4b5f4,_0x578932=loadSqlProjectConfig(_0x4a434d[_0x1293f2(0xf5)]),_0x5a66db=await readSqlLockFile(_0x578932[_0x1293f2(0xe3)]),{lockData:_0x5e9b9c,appLock:_0x14a88c}=ensureSqlLockScope(_0x5a66db??createEmptySqlLock(),_0x578932['appCode'],_0x578932[_0x1293f2(0xf0)],_0x1293f2(0x10c)),_0xa67f27=_0x4a434d[_0x1293f2(0xe4)](_0x1293f2(0xec)),_0x29505b=await fetchAllSqlQueries(_0x4a434d[_0x1293f2(0xf5)],{'sqlCode':_0x4a434d[_0x1293f2(0xe9)](_0x1293f2(0xfb))||undefined,'sqlName':_0x4a434d[_0x1293f2(0xe9)](_0x1293f2(0xe8))||undefined});if(_0x29505b[_0x1293f2(0xf4)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':'No\x20remote\x20SQL\x20queries\x20matched.'};const _0xa6b2bf=[],_0x544179=[];for(const _0x11b499 of _0x29505b){try{_0xa6b2bf[_0x1293f2(0xef)](await ensureSqlContent(_0x11b499));}catch(_0x2a8374){_0x544179[_0x1293f2(0xef)]({'sqlCode':_0x11b499['sqlCode'],'error':_0x2a8374 instanceof Error?_0x2a8374[_0x1293f2(0x112)]:String(_0x2a8374)});}}if(_0xa67f27&&!_0x4a434d[_0x1293f2(0xee)]){let _0x147a92=![];for(const _0x542c0f of _0xa6b2bf){const _0x589487=detectModeFromSql(_0x542c0f),_0x5a21d8=_0x542c0f['dbId']?await getDbName(_0x4a434d['appCode'],Number(_0x542c0f[_0x1293f2(0x106)]))['catch'](()=>undefined):undefined,_0xe1ac3=buildLocalSqlFileContent({'sqlCode':_0x542c0f[_0x1293f2(0xea)],'sqlName':_0x542c0f[_0x1293f2(0xdc)],'dbId':_0x542c0f[_0x1293f2(0x106)]},ensureRemoteSqlContent(_0x542c0f),{'dbName':_0x5a21d8,'mode':_0x589487,'syncedAt':new Date()['toISOString'](),'description':_0x542c0f[_0x1293f2(0xfe)]}),_0x219c5d=resolveLocalSqlFilePath(_0x578932,_0x542c0f[_0x1293f2(0xea)],buildSqlLockEntry(_0x542c0f,ensureRemoteSqlContent(_0x542c0f),'',{'dbName':_0x5a21d8}));if(await fileExists(_0x219c5d)){const _0x59a334=await readFile(_0x219c5d,_0x1293f2(0xf8));if(!isEquivalentPulledSqlFile(_0x59a334,_0xe1ac3,_0x589487)){_0x147a92=!![];break;}}}if(_0x147a92){const _0x1d0121=await confirmForceOverwrite('Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.');if(!_0x1d0121)throw CliErrors[_0x1293f2(0x10e)](_0x1293f2(0xf3));}}const _0x29007a=cloneSqlLockData(_0x5e9b9c),_0x4baa21=_0x29007a[_0x1293f2(0x109)][_0x578932[_0x1293f2(0xf5)]],_0x1a47af=[],_0x45f15f=[];for(const _0x26e6b3 of _0xa6b2bf){const _0x1d6ef1=_0x4baa21[_0x1293f2(0xf9)][_0x26e6b3['sqlCode']],_0xaa1276=ensureRemoteSqlContent(_0x26e6b3),_0xdf3dc9=detectModeFromSql(_0x26e6b3),_0x3af37b=_0x26e6b3[_0x1293f2(0x106)]?await getDbName(_0x4a434d[_0x1293f2(0xf5)],Number(_0x26e6b3[_0x1293f2(0x106)]))['catch'](()=>undefined):undefined,_0x3103d8=buildLocalSqlFileContent({'sqlCode':_0x26e6b3['sqlCode'],'sqlName':_0x26e6b3[_0x1293f2(0xdc)],'dbId':_0x26e6b3[_0x1293f2(0x106)]},_0xaa1276,{'dbName':_0x3af37b,'mode':_0xdf3dc9,'syncedAt':new Date()[_0x1293f2(0xed)](),'description':_0x26e6b3[_0x1293f2(0xfe)]}),_0xe56cb1=buildSqlLockEntry(_0x26e6b3,_0xaa1276,computeSqlContentHash(_0x3103d8),{'dbName':_0x3af37b}),_0x37048e=_0xe56cb1[_0x1293f2(0x10b)],_0x2e1367=join(_0x578932[_0x1293f2(0x116)],_0x37048e);try{if(await fileExists(_0x2e1367)){const _0x4e3a92=await readFile(_0x2e1367,_0x1293f2(0xf8));if(isEquivalentPulledSqlFile(_0x4e3a92,_0x3103d8,_0xdf3dc9)){_0x45f15f[_0x1293f2(0xef)]({'sqlCode':_0x26e6b3[_0x1293f2(0xea)],'reason':_0x1293f2(0xdf)}),_0x4baa21['sqls'][_0x26e6b3[_0x1293f2(0xea)]]={..._0xe56cb1,'hash':computeSqlContentHash(_0x4e3a92),'path':_0x37048e};continue;}if(!_0xa67f27){_0x45f15f[_0x1293f2(0xef)]({'sqlCode':_0x26e6b3[_0x1293f2(0xea)],'reason':_0x1293f2(0xe7)});continue;}}const _0x50c711=_0x1d6ef1?.[_0x1293f2(0x10b)]?join(_0x578932[_0x1293f2(0x116)],_0x1d6ef1[_0x1293f2(0x10b)]):undefined;_0x50c711&&_0x50c711!==_0x2e1367&&await fileExists(_0x50c711)&&await rm(_0x50c711,{'force':!![]}),await ensureParentDirectory(_0x2e1367),await writeFile(_0x2e1367,_0x3103d8,_0x1293f2(0xf8)),_0x4baa21['sqls'][_0x26e6b3['sqlCode']]={..._0xe56cb1,'path':_0x37048e},_0x1a47af[_0x1293f2(0xef)]({'sqlCode':_0x26e6b3[_0x1293f2(0xea)],'filePath':_0x2e1367});}catch(_0xfed035){_0x544179[_0x1293f2(0xef)]({'sqlCode':_0x26e6b3[_0x1293f2(0xea)],'error':_0xfed035 instanceof Error?_0xfed035['message']:String(_0xfed035)});}}return _0x4baa21['lastSync']=new Date()[_0x1293f2(0xed)](),await writeSqlLockFile(_0x578932['lockFilePath'],_0x29007a),{'ok':_0x544179[_0x1293f2(0xf4)]===0x0,'data':{'pulled':_0x1a47af,'skipped':_0x45f15f,'failed':_0x544179},'message':_0x1293f2(0x113)+_0x1a47af[_0x1293f2(0xf4)]+_0x1293f2(0xfa)+_0x45f15f[_0x1293f2(0xf4)]+_0x1293f2(0xff)+_0x544179[_0x1293f2(0xf4)]+_0x1293f2(0xde)};}};function detectModeFromSql(_0x3dcadb){const _0x5db8a8=a162_0xb4b5f4,_0x5075b7=ensureRemoteSqlContent(_0x3dcadb),_0x4e804c=stripLocalSqlMetadata(_0x5075b7,_0x5db8a8(0x104))[_0x5db8a8(0x117)]();if(/^<(select|insert|update|delete)\b/i[_0x5db8a8(0x100)](_0x4e804c))return _0x5db8a8(0x104);return'sql';}function isEquivalentPulledSqlFile(_0x43ca67,_0x3713bb,_0x2e5b7a){return normalizePullComparableContent(_0x43ca67,_0x2e5b7a)===normalizePullComparableContent(_0x3713bb,_0x2e5b7a);}function normalizePullComparableContent(_0x506998,_0x531915){const _0x1c7aa5=a162_0xb4b5f4,_0x46bd83=_0x506998[_0x1c7aa5(0xe2)](/\r\n/g,'\x0a')[_0x1c7aa5(0x115)]('\x0a'),_0x4a529e=_0x46bd83['filter'](_0x51c8f8=>!isSyncedAtMetadataLine(_0x51c8f8,_0x531915));return _0x4a529e[_0x1c7aa5(0xf1)]('\x0a');}function isSyncedAtMetadataLine(_0x56b447,_0x56c31c){const _0x2b0880=a162_0xb4b5f4;if(_0x56c31c===_0x2b0880(0x104))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x2b0880(0x100)](_0x56b447);return/^\s*--\s*@lovrabet\.syncedAt:/['test'](_0x56b447);}
|
|
1
|
+
function a162_0x40b0(){const _0x2e4ff0=['\x20written,\x20','trimStart','description','totalCount','utf8','sql','sqlRoot','unchanged','cancelled','replace','message','local\x20differs\x20from\x20remote','split','sqlContent','sqlCode','catch','Pull\x20complete:\x20','filter','2321532hApwOV','lockFilePath','would_pull','sqlName','boolean','774FVzsxl','force','join','\x20SQL\x20file(s)\x20into\x20','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','480XncwoF','test','sqlRootDir','tableData','8796276afsYhb','Would\x20pull\x20','2068336TRgBcy','sqlcode','skipped','pull','length','sqls','path','Force\x20pull\x20cancelled.','dbId','appCode','448104dnnAOF','push','853564GLSxEJ','bool','84MmleUd','str','6188390QUQUhj','No\x20remote\x20SQL\x20queries\x20matched.','name','paging','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','string','toISOString'];a162_0x40b0=function(){return _0x2e4ff0;};return a162_0x40b0();}const a162_0x565b13=a162_0x4845;(function(_0x221478,_0x348fc9){const _0x172735=a162_0x4845,_0x1a62b7=_0x221478();while(!![]){try{const _0x49d916=-parseInt(_0x172735(0x194))/0x1+parseInt(_0x172735(0x188))/0x2+-parseInt(_0x172735(0x17d))/0x3*(-parseInt(_0x172735(0x182))/0x4)+parseInt(_0x172735(0x198))/0x5+-parseInt(_0x172735(0x186))/0x6+-parseInt(_0x172735(0x196))/0x7*(-parseInt(_0x172735(0x192))/0x8)+parseInt(_0x172735(0x178))/0x9;if(_0x49d916===_0x348fc9)break;else _0x1a62b7['push'](_0x1a62b7['shift']());}catch(_0x8fc7fd){_0x1a62b7['push'](_0x1a62b7['shift']());}}}(a162_0x40b0,0xdef94));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';function a162_0x4845(_0x5371e7,_0x5969cf){_0x5371e7=_0x5371e7-0x170;const _0x40b00e=a162_0x40b0();let _0x484583=_0x40b00e[_0x5371e7];return _0x484583;}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(_0x2768d2,_0x291a40){const _0x514850=a162_0x4845,_0x31038c=[];let _0x358e41=0x1;while(!![]){const _0x2a54e1=await listSqlQueries(_0x2768d2,{'currentPage':_0x358e41,'pageSize':PAGE_SIZE,'sqlCode':_0x291a40[_0x514850(0x174)],'sqlName':_0x291a40[_0x514850(0x17b)]}),_0x433d2f=_0x2a54e1[_0x514850(0x185)]??[];_0x31038c[_0x514850(0x193)](..._0x433d2f);if(_0x433d2f[_0x514850(0x18c)]===0x0)break;const _0x4fbd18=_0x2a54e1[_0x514850(0x19b)]?.[_0x514850(0x1a2)];if(_0x4fbd18!=null?_0x31038c[_0x514850(0x18c)]>=_0x4fbd18:_0x433d2f[_0x514850(0x18c)]<PAGE_SIZE)break;_0x358e41++;}return _0x31038c;}async function ensureSqlContent(_0x494d0d){const _0x42657c=a162_0x4845;if(_0x494d0d[_0x42657c(0x173)]!=null&&String(_0x494d0d[_0x42657c(0x173)])[_0x42657c(0x18c)]>0x0)return _0x494d0d;return getSqlQueryDetail(_0x494d0d['sqlCode']);}export const sqlPull={'service':a162_0x565b13(0x1a4),'command':a162_0x565b13(0x18b),'description':a162_0x565b13(0x19c),'risk':'write','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a162_0x565b13(0x19a),'type':a162_0x565b13(0x19d),'description':'Filter\x20by\x20SQL\x20display\x20name'},{'name':a162_0x565b13(0x17e),'type':a162_0x565b13(0x17c),'description':'Force\x20overwrite\x20local\x20unsynced\x20changes'}],async 'dryRun'(_0x17f633){const _0x5db496=a162_0x565b13,_0x52bcec=loadSqlProjectConfig(_0x17f633['appCode']),_0x3ab4f3=await readSqlLockFile(_0x52bcec[_0x5db496(0x179)]),{appLock:_0x43cf21}=ensureSqlLockScope(_0x3ab4f3??createEmptySqlLock(),_0x52bcec[_0x5db496(0x191)],_0x52bcec[_0x5db496(0x1a5)],_0x5db496(0x18b)),_0x4a770d=await fetchAllSqlQueries(_0x17f633[_0x5db496(0x191)],{'sqlCode':_0x17f633['str'](_0x5db496(0x189))||undefined,'sqlName':_0x17f633[_0x5db496(0x197)](_0x5db496(0x19a))||undefined}),_0x18d35a=[];for(const _0x498f39 of _0x4a770d){const _0x16a54f=await ensureSqlContent(_0x498f39),_0xac6b26=ensureRemoteSqlContent(_0x16a54f),_0x531a48=detectModeFromSql(_0x16a54f),_0x73860d=_0x16a54f[_0x5db496(0x190)]?await getDbName(_0x17f633[_0x5db496(0x191)],Number(_0x16a54f[_0x5db496(0x190)]))['catch'](()=>undefined):undefined,_0xbf0306=buildLocalSqlFileContent({'sqlCode':_0x16a54f[_0x5db496(0x174)],'sqlName':_0x16a54f[_0x5db496(0x17b)],'dbId':_0x16a54f[_0x5db496(0x190)]},_0xac6b26,{'dbName':_0x73860d,'mode':_0x531a48,'syncedAt':new Date()[_0x5db496(0x19e)](),'description':_0x16a54f[_0x5db496(0x1a1)]}),_0x5a455a=buildSqlLockEntry(_0x16a54f,_0xac6b26,'',{'dbName':_0x73860d}),_0x249f23=resolveLocalSqlFilePath(_0x52bcec,_0x16a54f['sqlCode'],_0x5a455a);let _0x4fb9da=_0x5db496(0x17a),_0x468826;if(await fileExists(_0x249f23)){const _0x5a9bfe=await readFile(_0x249f23,_0x5db496(0x1a3));isEquivalentPulledSqlFile(_0x5a9bfe,_0xbf0306,_0x531a48)?(_0x4fb9da=_0x5db496(0x18a),_0x468826='unchanged'):(_0x4fb9da='conflict',_0x468826=_0x5db496(0x181));}_0x18d35a['push']({'sqlCode':_0x16a54f['sqlCode'],'sqlName':_0x16a54f[_0x5db496(0x17b)],'filePath':_0x249f23,'status':_0x4fb9da,'reason':_0x468826});}return{'method':'POST','url':'/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','body':{'appCode':_0x17f633[_0x5db496(0x191)],'sqlCode':_0x17f633['str'](_0x5db496(0x189))||null,'sqlName':_0x17f633[_0x5db496(0x197)](_0x5db496(0x19a))||null,'files':_0x18d35a},'description':_0x5db496(0x187)+_0x18d35a[_0x5db496(0x18c)]+_0x5db496(0x180)+_0x52bcec['sqlRootDir']};},async 'execute'(_0x2f8b61){const _0x29d70d=a162_0x565b13,_0x416ca2=loadSqlProjectConfig(_0x2f8b61[_0x29d70d(0x191)]),_0x42e514=await readSqlLockFile(_0x416ca2[_0x29d70d(0x179)]),{lockData:_0x446a40,appLock:_0x1be8b8}=ensureSqlLockScope(_0x42e514??createEmptySqlLock(),_0x416ca2[_0x29d70d(0x191)],_0x416ca2['sqlRoot'],'pull'),_0x1a6088=_0x2f8b61[_0x29d70d(0x195)](_0x29d70d(0x17e)),_0x52d51d=await fetchAllSqlQueries(_0x2f8b61[_0x29d70d(0x191)],{'sqlCode':_0x2f8b61[_0x29d70d(0x197)](_0x29d70d(0x189))||undefined,'sqlName':_0x2f8b61[_0x29d70d(0x197)]('name')||undefined});if(_0x52d51d[_0x29d70d(0x18c)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x29d70d(0x199)};const _0x6e05ea=[],_0xc3fdd=[];for(const _0x292e49 of _0x52d51d){try{_0x6e05ea[_0x29d70d(0x193)](await ensureSqlContent(_0x292e49));}catch(_0x4c877d){_0xc3fdd[_0x29d70d(0x193)]({'sqlCode':_0x292e49[_0x29d70d(0x174)],'error':_0x4c877d instanceof Error?_0x4c877d[_0x29d70d(0x170)]:String(_0x4c877d)});}}if(_0x1a6088&&!_0x2f8b61['nonInteractive']){let _0x23e915=![];for(const _0x3614f3 of _0x6e05ea){const _0x5c7066=detectModeFromSql(_0x3614f3),_0x5b8220=_0x3614f3[_0x29d70d(0x190)]?await getDbName(_0x2f8b61[_0x29d70d(0x191)],Number(_0x3614f3[_0x29d70d(0x190)]))['catch'](()=>undefined):undefined,_0x282e7c=buildLocalSqlFileContent({'sqlCode':_0x3614f3[_0x29d70d(0x174)],'sqlName':_0x3614f3[_0x29d70d(0x17b)],'dbId':_0x3614f3[_0x29d70d(0x190)]},ensureRemoteSqlContent(_0x3614f3),{'dbName':_0x5b8220,'mode':_0x5c7066,'syncedAt':new Date()[_0x29d70d(0x19e)](),'description':_0x3614f3[_0x29d70d(0x1a1)]}),_0x2d7e7f=resolveLocalSqlFilePath(_0x416ca2,_0x3614f3[_0x29d70d(0x174)],buildSqlLockEntry(_0x3614f3,ensureRemoteSqlContent(_0x3614f3),'',{'dbName':_0x5b8220}));if(await fileExists(_0x2d7e7f)){const _0x10c320=await readFile(_0x2d7e7f,_0x29d70d(0x1a3));if(!isEquivalentPulledSqlFile(_0x10c320,_0x282e7c,_0x5c7066)){_0x23e915=!![];break;}}}if(_0x23e915){const _0x2c6394=await confirmForceOverwrite('Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.');if(!_0x2c6394)throw CliErrors[_0x29d70d(0x1a7)](_0x29d70d(0x18f));}}const _0x7041da=cloneSqlLockData(_0x446a40),_0x2bcbdf=_0x7041da['apps'][_0x416ca2[_0x29d70d(0x191)]],_0x421aa8=[],_0x329c7f=[];for(const _0x5b76d2 of _0x6e05ea){const _0x49018f=_0x2bcbdf[_0x29d70d(0x18d)][_0x5b76d2[_0x29d70d(0x174)]],_0x7b41d=ensureRemoteSqlContent(_0x5b76d2),_0x9f8ac4=detectModeFromSql(_0x5b76d2),_0x2600a2=_0x5b76d2[_0x29d70d(0x190)]?await getDbName(_0x2f8b61['appCode'],Number(_0x5b76d2['dbId']))[_0x29d70d(0x175)](()=>undefined):undefined,_0x401eaf=buildLocalSqlFileContent({'sqlCode':_0x5b76d2['sqlCode'],'sqlName':_0x5b76d2[_0x29d70d(0x17b)],'dbId':_0x5b76d2[_0x29d70d(0x190)]},_0x7b41d,{'dbName':_0x2600a2,'mode':_0x9f8ac4,'syncedAt':new Date()[_0x29d70d(0x19e)](),'description':_0x5b76d2[_0x29d70d(0x1a1)]}),_0x312ac7=buildSqlLockEntry(_0x5b76d2,_0x7b41d,computeSqlContentHash(_0x401eaf),{'dbName':_0x2600a2}),_0x370f52=_0x312ac7[_0x29d70d(0x18e)],_0x38470d=join(_0x416ca2[_0x29d70d(0x184)],_0x370f52);try{if(await fileExists(_0x38470d)){const _0x2d6ad1=await readFile(_0x38470d,'utf8');if(isEquivalentPulledSqlFile(_0x2d6ad1,_0x401eaf,_0x9f8ac4)){_0x329c7f[_0x29d70d(0x193)]({'sqlCode':_0x5b76d2[_0x29d70d(0x174)],'reason':_0x29d70d(0x1a6)}),_0x2bcbdf['sqls'][_0x5b76d2['sqlCode']]={..._0x312ac7,'hash':computeSqlContentHash(_0x2d6ad1),'path':_0x370f52};continue;}if(!_0x1a6088){_0x329c7f['push']({'sqlCode':_0x5b76d2[_0x29d70d(0x174)],'reason':_0x29d70d(0x171)});continue;}}const _0x18ce59=_0x49018f?.[_0x29d70d(0x18e)]?join(_0x416ca2[_0x29d70d(0x184)],_0x49018f[_0x29d70d(0x18e)]):undefined;_0x18ce59&&_0x18ce59!==_0x38470d&&await fileExists(_0x18ce59)&&await rm(_0x18ce59,{'force':!![]}),await ensureParentDirectory(_0x38470d),await writeFile(_0x38470d,_0x401eaf,'utf8'),_0x2bcbdf['sqls'][_0x5b76d2[_0x29d70d(0x174)]]={..._0x312ac7,'path':_0x370f52},_0x421aa8[_0x29d70d(0x193)]({'sqlCode':_0x5b76d2['sqlCode'],'filePath':_0x38470d});}catch(_0x8ff8d7){_0xc3fdd[_0x29d70d(0x193)]({'sqlCode':_0x5b76d2[_0x29d70d(0x174)],'error':_0x8ff8d7 instanceof Error?_0x8ff8d7[_0x29d70d(0x170)]:String(_0x8ff8d7)});}}return _0x2bcbdf['lastSync']=new Date()[_0x29d70d(0x19e)](),await writeSqlLockFile(_0x416ca2[_0x29d70d(0x179)],_0x7041da),{'ok':_0xc3fdd[_0x29d70d(0x18c)]===0x0,'data':{'pulled':_0x421aa8,'skipped':_0x329c7f,'failed':_0xc3fdd},'message':_0x29d70d(0x176)+_0x421aa8[_0x29d70d(0x18c)]+_0x29d70d(0x19f)+_0x329c7f[_0x29d70d(0x18c)]+'\x20skipped,\x20'+_0xc3fdd[_0x29d70d(0x18c)]+'\x20failed'};}};function detectModeFromSql(_0x1eec3d){const _0x27d19e=a162_0x565b13,_0x3f2eaf=ensureRemoteSqlContent(_0x1eec3d),_0x51471b=stripLocalSqlMetadata(_0x3f2eaf,'mybatisXml')[_0x27d19e(0x1a0)]();if(/^<(select|insert|update|delete)\b/i[_0x27d19e(0x183)](_0x51471b))return'mybatisXml';return _0x27d19e(0x1a4);}function isEquivalentPulledSqlFile(_0x5010f9,_0x4a2f78,_0x1b401c){return normalizePullComparableContent(_0x5010f9,_0x1b401c)===normalizePullComparableContent(_0x4a2f78,_0x1b401c);}function normalizePullComparableContent(_0x19ae46,_0x18d0a4){const _0x30b728=a162_0x565b13,_0x4a143d=_0x19ae46[_0x30b728(0x1a8)](/\r\n/g,'\x0a')[_0x30b728(0x172)]('\x0a'),_0x960c4e=_0x4a143d[_0x30b728(0x177)](_0x4a31d5=>!isSyncedAtMetadataLine(_0x4a31d5,_0x18d0a4));return _0x960c4e[_0x30b728(0x17f)]('\x0a');}function isSyncedAtMetadataLine(_0x2c68fc,_0x1c3b23){if(_0x1c3b23==='mybatisXml')return/^\s*<!--\s*@lovrabet\.syncedAt:/['test'](_0x2c68fc);return/^\s*--\s*@lovrabet\.syncedAt:/['test'](_0x2c68fc);}
|
package/lib/commands/sql/push.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a163_0x13e4d0=a163_0x14a6;(function(_0x5e123b,_0x597442){const _0x4bbdaa=a163_0x14a6,_0x136132=_0x5e123b();while(!![]){try{const _0x246ea4=-parseInt(_0x4bbdaa(0x19f))/0x1*(parseInt(_0x4bbdaa(0x18f))/0x2)+parseInt(_0x4bbdaa(0x19d))/0x3*(-parseInt(_0x4bbdaa(0x178))/0x4)+parseInt(_0x4bbdaa(0x1a7))/0x5+-parseInt(_0x4bbdaa(0x187))/0x6+-parseInt(_0x4bbdaa(0x185))/0x7*(parseInt(_0x4bbdaa(0x19c))/0x8)+parseInt(_0x4bbdaa(0x167))/0x9+parseInt(_0x4bbdaa(0x1a4))/0xa;if(_0x246ea4===_0x597442)break;else _0x136132['push'](_0x136132['shift']());}catch(_0x28fb48){_0x136132['push'](_0x136132['shift']());}}}(a163_0x2e89,0xb1d81));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';function a163_0x14a6(_0x5d7cac,_0x2cf83a){_0x5d7cac=_0x5d7cac-0x166;const _0x2e8923=a163_0x2e89();let _0x14a6d4=_0x2e8923[_0x5d7cac];return _0x14a6d4;}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(_0x3e5dc5,_0x3c4244,_0x2813ed){const _0xf3cf41=a163_0x14a6,_0x52260e=await scanLocalSqlQueries(_0x3e5dc5),_0x33ff18=new Map();for(const _0x32f6ff of _0x52260e){if(_0x2813ed&&_0x32f6ff['sqlCode']!==_0x2813ed)continue;const _0x294dec=_0x33ff18[_0xf3cf41(0x16c)](_0x32f6ff[_0xf3cf41(0x17a)])??[];_0x294dec['push'](_0x32f6ff),_0x33ff18[_0xf3cf41(0x183)](_0x32f6ff[_0xf3cf41(0x17a)],_0x294dec);}if(_0x2813ed&&!_0x33ff18[_0xf3cf41(0x191)](_0x2813ed))throw CliErrors[_0xf3cf41(0x1a6)](_0xf3cf41(0x173)+_0x2813ed);const _0x427afe=[];for(const [_0x2027d6,_0x209ad4]of _0x33ff18[_0xf3cf41(0x166)]()){if(_0x209ad4['length']===0x1){_0x427afe[_0xf3cf41(0x195)](_0x209ad4[0x0]);continue;}const _0x3a18ca=_0x3c4244['sqls'][_0x2027d6],_0x5780a7=_0x3a18ca?.[_0xf3cf41(0x1a5)],_0x1610e6=_0x5780a7?_0x209ad4[_0xf3cf41(0x16d)](_0x50d693=>_0x50d693[_0xf3cf41(0x193)]!==_0x5780a7):_0x209ad4;if(_0x3a18ca&&_0x1610e6[_0xf3cf41(0x177)]===0x1){_0x427afe[_0xf3cf41(0x195)](_0x1610e6[0x0]);continue;}throw CliErrors['validation'](_0xf3cf41(0x17d)+_0x2027d6+'.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.');}return _0x427afe;}function a163_0x2e89(){const _0x1ca8c4=['appCode','sqls','get','filter','/smartapi/custom/updateUserCustomSql','sqlRootDir','force','utf8','lastSync','Local\x20SQL\x20not\x20found:\x20','dbDirectory','lockFilePath','\x20failed','length','723368wuWNBz','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','sqlCode','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','sqlConfig','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','POST','mode','sqlName','dbId','dbName','set','Push\x20complete:\x20','5775007VDoaYv','bool','5478012SvocBx','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','startsWith','exec','version','Push\x20local\x20SQL\x20files\x20to\x20remote','sqlcode','map','458OtLqRm','str','has','filePath','relativePath','No\x20database\x20matches\x20local\x20directory\x20\x22','push','trashDir','hash','join','catch','\x20pushed,\x20','No\x20local\x20SQL\x20files\x20found.','8GHoQeC','18NAnsZp','toISOString','2977sWVGZT','Local\x20directory\x20\x22','replace','boolean','remoteId','32396690iKJLXX','path','validation','2678310jvblGJ','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','entries','4121154oMtYsc','\x20skipped,\x20','message'];a163_0x2e89=function(){return _0x1ca8c4;};return a163_0x2e89();}export const sqlPush={'service':'sql','command':'push','description':a163_0x13e4d0(0x18c),'risk':'high-risk-write','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a163_0x13e4d0(0x170),'type':a163_0x13e4d0(0x1a2),'description':a163_0x13e4d0(0x179)}],async 'dryRun'(_0x5cb1bb){const _0x5bf669=a163_0x13e4d0,_0x5e2ce3=loadSqlProjectConfig(_0x5cb1bb[_0x5bf669(0x16a)]),_0x6d4a84=await readSqlLockFile(_0x5e2ce3['lockFilePath']),{appLock:_0x3c1c14}=ensureSqlLockScope(_0x6d4a84??createEmptySqlLock(),_0x5cb1bb[_0x5bf669(0x16a)],_0x5e2ce3['sqlRoot'],_0x5bf669(0x195)),_0x3b7f74=await getTargetSqlQueries(_0x5e2ce3,_0x3c1c14,_0x5cb1bb[_0x5bf669(0x190)]('sqlcode')||undefined),_0x194861=[];for(const _0x251ef9 of _0x3b7f74){const _0xb289ce=await computeSqlFileHash(_0x251ef9[_0x5bf669(0x192)]),_0xf572d8=_0x3c1c14[_0x5bf669(0x16b)][_0x251ef9[_0x5bf669(0x17a)]],_0x5c2c14=!!_0xf572d8&&(_0xf572d8[_0x5bf669(0x1a5)]!==_0x251ef9[_0x5bf669(0x193)]||!!_0x251ef9['sqlName']&&_0xf572d8[_0x5bf669(0x180)]!==_0x251ef9[_0x5bf669(0x180)]);if(!_0x5cb1bb['bool']('force')&&_0xf572d8&&_0xf572d8[_0x5bf669(0x197)]===_0xb289ce&&!_0x5c2c14)continue;_0x194861['push'](_0x251ef9[_0x5bf669(0x17a)]);}return{'method':_0x5bf669(0x17e),'url':_0x5bf669(0x16e),'body':{'sqlCodes':_0x194861,'appCode':_0x5cb1bb[_0x5bf669(0x16a)]},'description':'Would\x20push\x20'+_0x194861['length']+'\x20SQL\x20file(s)'};},async 'execute'(_0x12036e){const _0x469e67=a163_0x13e4d0,_0x43013c=loadSqlProjectConfig(_0x12036e['appCode']),_0x5de111=await readSqlLockFile(_0x43013c[_0x469e67(0x175)]),{lockData:_0x21d693,appLock:_0x1121ee}=ensureSqlLockScope(_0x5de111??createEmptySqlLock(),_0x12036e['appCode'],_0x43013c['sqlRoot'],_0x469e67(0x195)),_0x51209d=await getTargetSqlQueries(_0x43013c,_0x1121ee,_0x12036e['str'](_0x469e67(0x18d))||undefined);if(_0x51209d['length']===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x469e67(0x19b)};const _0x4ca662=[],_0x4a441e=[],_0x13c00f=[];for(const _0x1c7357 of _0x51209d){const _0x3b9273=_0x1121ee[_0x469e67(0x16b)][_0x1c7357[_0x469e67(0x17a)]];if(!_0x3b9273){_0x13c00f['push']({'sqlCode':_0x1c7357[_0x469e67(0x17a)],'error':_0x469e67(0x188)});continue;}try{const _0x3093dd=await computeSqlFileHash(_0x1c7357[_0x469e67(0x192)]),_0x581882=_0x3b9273[_0x469e67(0x1a5)]!==_0x1c7357[_0x469e67(0x193)]||!!_0x1c7357['sqlName']&&_0x3b9273[_0x469e67(0x180)]!==_0x1c7357[_0x469e67(0x180)];if(!_0x12036e[_0x469e67(0x186)](_0x469e67(0x170))&&_0x3b9273['hash']===_0x3093dd&&!_0x581882){_0x4a441e[_0x469e67(0x195)]({'sqlCode':_0x1c7357[_0x469e67(0x17a)],'reason':'unchanged'});continue;}if(_0x3b9273[_0x469e67(0x18b)]==null){_0x13c00f[_0x469e67(0x195)]({'sqlCode':_0x1c7357[_0x469e67(0x17a)],'error':_0x469e67(0x17b)});continue;}const _0x591ca5=await readFile(_0x1c7357[_0x469e67(0x192)],_0x469e67(0x171)),_0xa067b4=stripLocalSqlMetadata(_0x591ca5,_0x1c7357[_0x469e67(0x17f)]),_0x11c4d2=_0x1c7357[_0x469e67(0x180)]||_0x3b9273[_0x469e67(0x180)],_0x3a4051=await resolveTargetDbBinding(_0x12036e[_0x469e67(0x16a)],_0x1c7357,_0x3b9273),_0x26f2f4=await updateSqlQuery({'id':_0x3b9273[_0x469e67(0x1a3)],'appCode':_0x12036e['appCode'],'sqlCode':_0x1c7357['sqlCode'],'sqlName':_0x11c4d2,'dbId':_0x3a4051[_0x469e67(0x181)],'version':_0x3b9273['version'],'sqlContent':_0xa067b4,'sqlConfig':_0x3b9273[_0x469e67(0x17c)]??undefined}),_0x44e413=_0x26f2f4[_0x469e67(0x181)]?await getDbName(_0x12036e['appCode'],Number(_0x26f2f4[_0x469e67(0x181)]))[_0x469e67(0x199)](()=>_0x3a4051[_0x469e67(0x182)]):_0x3a4051[_0x469e67(0x182)];_0x1121ee[_0x469e67(0x16b)][_0x1c7357[_0x469e67(0x17a)]]={...buildSqlLockEntry(_0x26f2f4,_0xa067b4,_0x3093dd,{'dbName':_0x44e413}),'path':_0x1c7357[_0x469e67(0x193)],'mode':_0x3b9273[_0x469e67(0x17f)]},await archivePreviousSqlFileIfNeeded(_0x43013c,_0x3b9273[_0x469e67(0x1a5)],_0x1c7357['relativePath']),_0x4ca662[_0x469e67(0x195)]({'sqlCode':_0x1c7357[_0x469e67(0x17a)],'remoteId':_0x3b9273[_0x469e67(0x1a3)]});}catch(_0x36c030){_0x13c00f[_0x469e67(0x195)]({'sqlCode':_0x1c7357[_0x469e67(0x17a)],'error':_0x36c030 instanceof Error?_0x36c030[_0x469e67(0x169)]:String(_0x36c030)});}}return _0x1121ee[_0x469e67(0x172)]=new Date()[_0x469e67(0x19e)](),await writeSqlLockFile(_0x43013c[_0x469e67(0x175)],_0x21d693),{'ok':_0x13c00f['length']===0x0,'data':{'pushed':_0x4ca662,'skipped':_0x4a441e,'failed':_0x13c00f},'message':_0x469e67(0x184)+_0x4ca662['length']+_0x469e67(0x19a)+_0x4a441e[_0x469e67(0x177)]+_0x469e67(0x168)+_0x13c00f[_0x469e67(0x177)]+_0x469e67(0x176)};}};async function archivePreviousSqlFileIfNeeded(_0x6f3bc7,_0x2fed95,_0x53c680){const _0x1c3a39=a163_0x13e4d0;if(!_0x2fed95||_0x2fed95===_0x53c680)return;const _0x6b9664=join(_0x6f3bc7[_0x1c3a39(0x16f)],_0x2fed95);if(!await fileExists(_0x6b9664))return;const _0x2306c0=await moveToTrash(_0x6f3bc7['projectRoot'],_0x6f3bc7[_0x1c3a39(0x196)],_0x6b9664);await cleanupEmptyDirectories(dirname(_0x6b9664),_0x6f3bc7[_0x1c3a39(0x16f)]),void _0x2306c0;}async function moveToTrash(_0x31d9b2,_0x58e3c9,_0x18aea1){const _0x4640bd=a163_0x13e4d0,_0x5137f7=new Date()['toISOString']()[_0x4640bd(0x1a1)](/[:.]/g,'-'),_0xa8f30c=relative(_0x31d9b2,_0x18aea1),_0x256089=join(_0x58e3c9,_0x5137f7,_0xa8f30c);return await mkdir(dirname(_0x256089),{'recursive':!![]}),await rename(_0x18aea1,_0x256089),_0x256089;}async function cleanupEmptyDirectories(_0x11df67,_0x13bbfa){const _0xfd47e1=a163_0x13e4d0;let _0x44a6f7=resolve(_0x11df67);const _0x979410=resolve(_0x13bbfa);while(_0x44a6f7[_0xfd47e1(0x189)](''+_0x979410+sep)||_0x44a6f7===_0x979410){if(_0x44a6f7===_0x979410)return;try{const _0x9598c6=await readdir(_0x44a6f7);if(_0x9598c6[_0xfd47e1(0x177)]>0x0)return;await rmdir(_0x44a6f7);}catch{return;}_0x44a6f7=dirname(_0x44a6f7);}}async function resolveTargetDbBinding(_0x269eb7,_0x237b69,_0x315615){const _0x4f06c9=a163_0x13e4d0,_0x34e774=_0x237b69[_0x4f06c9(0x174)];if(!_0x34e774)return{'dbId':_0x315615[_0x4f06c9(0x181)],'dbName':_0x315615[_0x4f06c9(0x182)]};const _0x2adfbd=buildDbDirectoryName(_0x315615['dbName'],_0x315615['dbId']);if(_0x34e774===_0x2adfbd)return{'dbId':_0x315615[_0x4f06c9(0x181)],'dbName':_0x315615['dbName']};const _0x25c460=parseExplicitDbDirectory(_0x34e774);if(_0x25c460!=null)return{'dbId':_0x25c460,'dbName':await getDbName(_0x269eb7,_0x25c460)[_0x4f06c9(0x199)](()=>undefined)};const _0x38babe=await listDatabases(_0x269eb7),_0x19d331=_0x38babe['filter'](_0x29ff7a=>buildDbDirectoryName(_0x29ff7a[_0x4f06c9(0x182)],_0x29ff7a[_0x4f06c9(0x181)])===_0x34e774);if(_0x19d331[_0x4f06c9(0x177)]===0x1)return{'dbId':_0x19d331[0x0][_0x4f06c9(0x181)],'dbName':_0x19d331[0x0][_0x4f06c9(0x182)]};if(_0x19d331[_0x4f06c9(0x177)]===0x0)throw CliErrors[_0x4f06c9(0x1a6)](_0x4f06c9(0x194)+_0x34e774+'\x22\x20for\x20sqlCode\x20'+_0x237b69[_0x4f06c9(0x17a)]+'.');const _0x368fcf=_0x19d331[_0x4f06c9(0x18e)](_0x11ce13=>_0x11ce13[_0x4f06c9(0x182)]+'\x20('+_0x11ce13[_0x4f06c9(0x181)]+')')[_0x4f06c9(0x198)](',\x20');throw CliErrors[_0x4f06c9(0x1a6)](_0x4f06c9(0x1a0)+_0x34e774+_0x4f06c9(0x1a8)+_0x237b69[_0x4f06c9(0x17a)]+':\x20'+_0x368fcf);}function parseExplicitDbDirectory(_0x18cf87){const _0xda2e7f=a163_0x13e4d0,_0xd3691a=/^db-(\d+)$/[_0xda2e7f(0x18a)](_0x18cf87);if(!_0xd3691a)return null;const _0x172e92=Number(_0xd3691a[0x1]);return Number['isFinite'](_0x172e92)&&_0x172e92>0x0?_0x172e92:null;}
|
|
1
|
+
function a163_0x4360(){const _0x5e75de=['missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','5322888dUlhrJ','relativePath','force','\x22\x20for\x20sqlCode\x20','sql','1071987tMDWMt','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','12241880GzYzsF','hash','\x20SQL\x20file(s)','sqlConfig','get','map','sqlCode','sqlName','2985252eTAQhb','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','No\x20local\x20SQL\x20files\x20found.','46056900ImPWpi','trashDir','226028hhXvgu','appCode','sqlRoot','isFinite','str','catch','lastSync','171PqDrbT','mode','projectRoot','POST','length','Push\x20complete:\x20','lockFilePath','sqlRootDir','entries','bool','sqlcode','2WXsXEB','sqls','filePath','Local\x20SQL\x20not\x20found:\x20','No\x20database\x20matches\x20local\x20directory\x20\x22','boolean','dbName','utf8','replace','validation','/smartapi/custom/updateUserCustomSql','320824VQdvJo','20rXsoyL','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','version','toISOString','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','dbId','remoteId','Local\x20directory\x20\x22','push','filter','exec','path'];a163_0x4360=function(){return _0x5e75de;};return a163_0x4360();}const a163_0x52e78e=a163_0x4f44;(function(_0x12180f,_0x55422f){const _0x5dd124=a163_0x4f44,_0x49edd3=_0x12180f();while(!![]){try{const _0x6f57c1=-parseInt(_0x5dd124(0x144))/0x1*(parseInt(_0x5dd124(0x126))/0x2)+-parseInt(_0x5dd124(0x14e))/0x3+parseInt(_0x5dd124(0x153))/0x4*(parseInt(_0x5dd124(0x132))/0x5)+-parseInt(_0x5dd124(0x13f))/0x6+-parseInt(_0x5dd124(0x146))/0x7+-parseInt(_0x5dd124(0x131))/0x8*(-parseInt(_0x5dd124(0x15a))/0x9)+parseInt(_0x5dd124(0x151))/0xa;if(_0x6f57c1===_0x55422f)break;else _0x49edd3['push'](_0x49edd3['shift']());}catch(_0x4c0b39){_0x49edd3['push'](_0x49edd3['shift']());}}}(a163_0x4360,0xd96f8));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';function a163_0x4f44(_0x49a33a,_0x5cf343){_0x49a33a=_0x49a33a-0x123;const _0x43607e=a163_0x4360();let _0x4f44b8=_0x43607e[_0x49a33a];return _0x4f44b8;}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(_0x454033,_0x2f0e97,_0x590d5d){const _0x5b4de1=a163_0x4f44,_0x19e60c=await scanLocalSqlQueries(_0x454033),_0x20e324=new Map();for(const _0xd11e9d of _0x19e60c){if(_0x590d5d&&_0xd11e9d[_0x5b4de1(0x14c)]!==_0x590d5d)continue;const _0x4190bf=_0x20e324[_0x5b4de1(0x14a)](_0xd11e9d[_0x5b4de1(0x14c)])??[];_0x4190bf[_0x5b4de1(0x13a)](_0xd11e9d),_0x20e324['set'](_0xd11e9d[_0x5b4de1(0x14c)],_0x4190bf);}if(_0x590d5d&&!_0x20e324['has'](_0x590d5d))throw CliErrors[_0x5b4de1(0x12f)](_0x5b4de1(0x129)+_0x590d5d);const _0x55332b=[];for(const [_0x59ed18,_0x367855]of _0x20e324[_0x5b4de1(0x123)]()){if(_0x367855[_0x5b4de1(0x15e)]===0x1){_0x55332b[_0x5b4de1(0x13a)](_0x367855[0x0]);continue;}const _0x3e9610=_0x2f0e97[_0x5b4de1(0x127)][_0x59ed18],_0x26bd8f=_0x3e9610?.['path'],_0x164344=_0x26bd8f?_0x367855[_0x5b4de1(0x13b)](_0x58fb05=>_0x58fb05[_0x5b4de1(0x140)]!==_0x26bd8f):_0x367855;if(_0x3e9610&&_0x164344[_0x5b4de1(0x15e)]===0x1){_0x55332b[_0x5b4de1(0x13a)](_0x164344[0x0]);continue;}throw CliErrors[_0x5b4de1(0x12f)](_0x5b4de1(0x136)+_0x59ed18+_0x5b4de1(0x14f));}return _0x55332b;}export const sqlPush={'service':a163_0x52e78e(0x143),'command':a163_0x52e78e(0x13a),'description':'Push\x20local\x20SQL\x20files\x20to\x20remote','risk':'high-risk-write','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a163_0x52e78e(0x141),'type':a163_0x52e78e(0x12b),'description':a163_0x52e78e(0x145)}],async 'dryRun'(_0xe092e6){const _0x41f587=a163_0x52e78e,_0x5f4db9=loadSqlProjectConfig(_0xe092e6['appCode']),_0x14a766=await readSqlLockFile(_0x5f4db9[_0x41f587(0x160)]),{appLock:_0x3b77ff}=ensureSqlLockScope(_0x14a766??createEmptySqlLock(),_0xe092e6[_0x41f587(0x154)],_0x5f4db9['sqlRoot'],'push'),_0xb62d11=await getTargetSqlQueries(_0x5f4db9,_0x3b77ff,_0xe092e6[_0x41f587(0x157)](_0x41f587(0x125))||undefined),_0x4be18c=[];for(const _0x92b8f9 of _0xb62d11){const _0x26f263=await computeSqlFileHash(_0x92b8f9['filePath']),_0x169dd9=_0x3b77ff[_0x41f587(0x127)][_0x92b8f9[_0x41f587(0x14c)]],_0x2f7f13=!!_0x169dd9&&(_0x169dd9[_0x41f587(0x13d)]!==_0x92b8f9[_0x41f587(0x140)]||!!_0x92b8f9[_0x41f587(0x14d)]&&_0x169dd9[_0x41f587(0x14d)]!==_0x92b8f9[_0x41f587(0x14d)]);if(!_0xe092e6['bool'](_0x41f587(0x141))&&_0x169dd9&&_0x169dd9[_0x41f587(0x147)]===_0x26f263&&!_0x2f7f13)continue;_0x4be18c[_0x41f587(0x13a)](_0x92b8f9[_0x41f587(0x14c)]);}return{'method':_0x41f587(0x15d),'url':_0x41f587(0x130),'body':{'sqlCodes':_0x4be18c,'appCode':_0xe092e6[_0x41f587(0x154)]},'description':'Would\x20push\x20'+_0x4be18c[_0x41f587(0x15e)]+_0x41f587(0x148)};},async 'execute'(_0x5b547b){const _0x18b49a=a163_0x52e78e,_0x23e050=loadSqlProjectConfig(_0x5b547b[_0x18b49a(0x154)]),_0x44920c=await readSqlLockFile(_0x23e050[_0x18b49a(0x160)]),{lockData:_0x1f45cd,appLock:_0x39f090}=ensureSqlLockScope(_0x44920c??createEmptySqlLock(),_0x5b547b['appCode'],_0x23e050[_0x18b49a(0x155)],'push'),_0x3b26a=await getTargetSqlQueries(_0x23e050,_0x39f090,_0x5b547b[_0x18b49a(0x157)](_0x18b49a(0x125))||undefined);if(_0x3b26a[_0x18b49a(0x15e)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x18b49a(0x150)};const _0x45dc5e=[],_0x13fe35=[],_0x19479d=[];for(const _0x42a360 of _0x3b26a){const _0x56858c=_0x39f090[_0x18b49a(0x127)][_0x42a360[_0x18b49a(0x14c)]];if(!_0x56858c){_0x19479d[_0x18b49a(0x13a)]({'sqlCode':_0x42a360[_0x18b49a(0x14c)],'error':'local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first'});continue;}try{const _0x236771=await computeSqlFileHash(_0x42a360[_0x18b49a(0x128)]),_0x46e436=_0x56858c[_0x18b49a(0x13d)]!==_0x42a360[_0x18b49a(0x140)]||!!_0x42a360[_0x18b49a(0x14d)]&&_0x56858c[_0x18b49a(0x14d)]!==_0x42a360[_0x18b49a(0x14d)];if(!_0x5b547b[_0x18b49a(0x124)]('force')&&_0x56858c['hash']===_0x236771&&!_0x46e436){_0x13fe35[_0x18b49a(0x13a)]({'sqlCode':_0x42a360[_0x18b49a(0x14c)],'reason':'unchanged'});continue;}if(_0x56858c[_0x18b49a(0x134)]==null){_0x19479d[_0x18b49a(0x13a)]({'sqlCode':_0x42a360[_0x18b49a(0x14c)],'error':_0x18b49a(0x13e)});continue;}const _0x24d065=await readFile(_0x42a360[_0x18b49a(0x128)],_0x18b49a(0x12d)),_0x81fafc=stripLocalSqlMetadata(_0x24d065,_0x42a360[_0x18b49a(0x15b)]),_0x122729=_0x42a360[_0x18b49a(0x14d)]||_0x56858c[_0x18b49a(0x14d)],_0x9c18ec=await resolveTargetDbBinding(_0x5b547b[_0x18b49a(0x154)],_0x42a360,_0x56858c),_0x107374=await updateSqlQuery({'id':_0x56858c[_0x18b49a(0x138)],'appCode':_0x5b547b['appCode'],'sqlCode':_0x42a360['sqlCode'],'sqlName':_0x122729,'dbId':_0x9c18ec[_0x18b49a(0x137)],'version':_0x56858c[_0x18b49a(0x134)],'sqlContent':_0x81fafc,'sqlConfig':_0x56858c[_0x18b49a(0x149)]??undefined}),_0x3e275d=_0x107374[_0x18b49a(0x137)]?await getDbName(_0x5b547b[_0x18b49a(0x154)],Number(_0x107374[_0x18b49a(0x137)]))[_0x18b49a(0x158)](()=>_0x9c18ec['dbName']):_0x9c18ec[_0x18b49a(0x12c)];_0x39f090[_0x18b49a(0x127)][_0x42a360[_0x18b49a(0x14c)]]={...buildSqlLockEntry(_0x107374,_0x81fafc,_0x236771,{'dbName':_0x3e275d}),'path':_0x42a360['relativePath'],'mode':_0x56858c[_0x18b49a(0x15b)]},await archivePreviousSqlFileIfNeeded(_0x23e050,_0x56858c['path'],_0x42a360[_0x18b49a(0x140)]),_0x45dc5e[_0x18b49a(0x13a)]({'sqlCode':_0x42a360[_0x18b49a(0x14c)],'remoteId':_0x56858c[_0x18b49a(0x138)]});}catch(_0x1c57d3){_0x19479d[_0x18b49a(0x13a)]({'sqlCode':_0x42a360[_0x18b49a(0x14c)],'error':_0x1c57d3 instanceof Error?_0x1c57d3['message']:String(_0x1c57d3)});}}return _0x39f090[_0x18b49a(0x159)]=new Date()[_0x18b49a(0x135)](),await writeSqlLockFile(_0x23e050[_0x18b49a(0x160)],_0x1f45cd),{'ok':_0x19479d[_0x18b49a(0x15e)]===0x0,'data':{'pushed':_0x45dc5e,'skipped':_0x13fe35,'failed':_0x19479d},'message':_0x18b49a(0x15f)+_0x45dc5e[_0x18b49a(0x15e)]+'\x20pushed,\x20'+_0x13fe35['length']+'\x20skipped,\x20'+_0x19479d[_0x18b49a(0x15e)]+'\x20failed'};}};async function archivePreviousSqlFileIfNeeded(_0x5e7f70,_0xc9d7e6,_0x4ffe0e){const _0x3a997a=a163_0x52e78e;if(!_0xc9d7e6||_0xc9d7e6===_0x4ffe0e)return;const _0x43f4f7=join(_0x5e7f70[_0x3a997a(0x161)],_0xc9d7e6);if(!await fileExists(_0x43f4f7))return;const _0x48c77a=await moveToTrash(_0x5e7f70[_0x3a997a(0x15c)],_0x5e7f70[_0x3a997a(0x152)],_0x43f4f7);await cleanupEmptyDirectories(dirname(_0x43f4f7),_0x5e7f70[_0x3a997a(0x161)]),void _0x48c77a;}async function moveToTrash(_0x2538b4,_0x7442fc,_0x5453c0){const _0x5cd74c=a163_0x52e78e,_0x18de28=new Date()['toISOString']()[_0x5cd74c(0x12e)](/[:.]/g,'-'),_0x266135=relative(_0x2538b4,_0x5453c0),_0x44d42d=join(_0x7442fc,_0x18de28,_0x266135);return await mkdir(dirname(_0x44d42d),{'recursive':!![]}),await rename(_0x5453c0,_0x44d42d),_0x44d42d;}async function cleanupEmptyDirectories(_0x1e43f0,_0x28b5e6){const _0x128b24=a163_0x52e78e;let _0x56b0ae=resolve(_0x1e43f0);const _0x3a8535=resolve(_0x28b5e6);while(_0x56b0ae['startsWith'](''+_0x3a8535+sep)||_0x56b0ae===_0x3a8535){if(_0x56b0ae===_0x3a8535)return;try{const _0x265de4=await readdir(_0x56b0ae);if(_0x265de4[_0x128b24(0x15e)]>0x0)return;await rmdir(_0x56b0ae);}catch{return;}_0x56b0ae=dirname(_0x56b0ae);}}async function resolveTargetDbBinding(_0x3f0ebd,_0x32c5dd,_0xa6ff1){const _0x5b5cda=a163_0x52e78e,_0x45704e=_0x32c5dd['dbDirectory'];if(!_0x45704e)return{'dbId':_0xa6ff1['dbId'],'dbName':_0xa6ff1[_0x5b5cda(0x12c)]};const _0x5a1869=buildDbDirectoryName(_0xa6ff1[_0x5b5cda(0x12c)],_0xa6ff1[_0x5b5cda(0x137)]);if(_0x45704e===_0x5a1869)return{'dbId':_0xa6ff1[_0x5b5cda(0x137)],'dbName':_0xa6ff1[_0x5b5cda(0x12c)]};const _0x32a280=parseExplicitDbDirectory(_0x45704e);if(_0x32a280!=null)return{'dbId':_0x32a280,'dbName':await getDbName(_0x3f0ebd,_0x32a280)[_0x5b5cda(0x158)](()=>undefined)};const _0x36901a=await listDatabases(_0x3f0ebd),_0x2347f8=_0x36901a[_0x5b5cda(0x13b)](_0x59edf1=>buildDbDirectoryName(_0x59edf1[_0x5b5cda(0x12c)],_0x59edf1[_0x5b5cda(0x137)])===_0x45704e);if(_0x2347f8[_0x5b5cda(0x15e)]===0x1)return{'dbId':_0x2347f8[0x0]['dbId'],'dbName':_0x2347f8[0x0][_0x5b5cda(0x12c)]};if(_0x2347f8[_0x5b5cda(0x15e)]===0x0)throw CliErrors[_0x5b5cda(0x12f)](_0x5b5cda(0x12a)+_0x45704e+_0x5b5cda(0x142)+_0x32c5dd[_0x5b5cda(0x14c)]+'.');const _0x32b1a1=_0x2347f8[_0x5b5cda(0x14b)](_0x2cf1ed=>_0x2cf1ed[_0x5b5cda(0x12c)]+'\x20('+_0x2cf1ed[_0x5b5cda(0x137)]+')')['join'](',\x20');throw CliErrors[_0x5b5cda(0x12f)](_0x5b5cda(0x139)+_0x45704e+_0x5b5cda(0x133)+_0x32c5dd[_0x5b5cda(0x14c)]+':\x20'+_0x32b1a1);}function parseExplicitDbDirectory(_0x31f43e){const _0xaff803=a163_0x52e78e,_0x1976cd=/^db-(\d+)$/[_0xaff803(0x13c)](_0x31f43e);if(!_0x1976cd)return null;const _0x326614=Number(_0x1976cd[0x1]);return Number[_0xaff803(0x156)](_0x326614)&&_0x326614>0x0?_0x326614:null;}
|
package/lib/commands/sql/save.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a164_0x2b6099=a164_0x20cb;(function(_0x47745f,_0x53dd33){const _0x4e50dd=a164_0x20cb,_0x388ec0=_0x47745f();while(!![]){try{const _0xa13e60=-parseInt(_0x4e50dd(0xdb))/0x1+parseInt(_0x4e50dd(0xd6))/0x2*(-parseInt(_0x4e50dd(0xd9))/0x3)+-parseInt(_0x4e50dd(0xc9))/0x4+parseInt(_0x4e50dd(0xce))/0x5+-parseInt(_0x4e50dd(0xd5))/0x6*(parseInt(_0x4e50dd(0xc8))/0x7)+parseInt(_0x4e50dd(0xd3))/0x8+-parseInt(_0x4e50dd(0xcc))/0x9*(-parseInt(_0x4e50dd(0xd1))/0xa);if(_0xa13e60===_0x53dd33)break;else _0x388ec0['push'](_0x388ec0['shift']());}catch(_0xb73418){_0x388ec0['push'](_0x388ec0['shift']());}}}(a164_0x1de2,0xd07fa));function a164_0x1de2(){const _0x15e2e3=['file','1509590oHWpVl','Target\x20database\x20—\x20accepts\x20a\x20numeric\x20ID\x20or\x20database\x20name\x20(e.g.\x20ecommerce_db)','sqlname','10muqZuV','`rabetbase\x20sql\x20save`\x20has\x20been\x20deprecated.','2140832rBzYFb','write','2555286gGMpDn','984532cXmpWf','string','Query\x20description','6VlOeLy','Deprecated:\x20use\x20sql\x20create\x20to\x20create\x20and\x20sql\x20push\x20to\x20update','790085eXvhND','validation','sql','28iSzfNf','1992032VKYHlw','description','Update\x20existing\x20SQL\x20by\x20editing\x20the\x20synced\x20file\x20under\x20`.rabetbase/sql/<appCode>/<dbName|db-<id>>/`\x20and\x20then\x20running\x20`rabetbase\x20sql\x20push\x20--sqlcode\x20<code>\x20--yes`.','38345733vgObKU'];a164_0x1de2=function(){return _0x15e2e3;};return a164_0x1de2();}import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a164_0x20cb(_0x1ca616,_0x329faf){_0x1ca616=_0x1ca616-0xc6;const _0x1de20b=a164_0x1de2();let _0x20cb78=_0x1de20b[_0x1ca616];return _0x20cb78;}const SQL_SAVE_DEPRECATED_HINT=[a164_0x2b6099(0xd2),'Create\x20new\x20SQL\x20with\x20`rabetbase\x20sql\x20create\x20--name\x20<name>\x20--db-id\x20<id>\x20--mode\x20sql|mybatisXml`.',a164_0x2b6099(0xcb)]['join']('\x0a');export const sqlSave={'service':a164_0x2b6099(0xc7),'command':'save','description':a164_0x2b6099(0xda),'risk':a164_0x2b6099(0xd4),'requiresAuth':![],'requiresAppCode':![],'flags':[{'name':a164_0x2b6099(0xcd),'type':'string','required':!![],'description':'Path\x20to\x20the\x20SQL\x20file'},SQLCODE_FLAG_OPTIONAL,{'name':a164_0x2b6099(0xd0),'type':a164_0x2b6099(0xd7),'description':'SQL\x20query\x20display\x20name'},{'name':'db','type':a164_0x2b6099(0xd7),'description':a164_0x2b6099(0xcf)},{'name':a164_0x2b6099(0xca),'type':'string','description':a164_0x2b6099(0xd8)}],async 'validate'(){const _0x2adc27=a164_0x2b6099;throw CliErrors[_0x2adc27(0xc6)](SQL_SAVE_DEPRECATED_HINT);},async 'execute'(){const _0x55992c=a164_0x2b6099;throw CliErrors[_0x55992c(0xc6)](SQL_SAVE_DEPRECATED_HINT);}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
const a165_0x3fdbe1=a165_0x245a;(function(_0x5af788,_0x2e561b){const _0x2999ed=a165_0x245a,_0x3990ba=_0x5af788();while(!![]){try{const _0x7484b0=-parseInt(_0x2999ed(0xc5))/0x1*(parseInt(_0x2999ed(0xc4))/0x2)+parseInt(_0x2999ed(0xe0))/0x3*(-parseInt(_0x2999ed(0xbb))/0x4)+-parseInt(_0x2999ed(0xb6))/0x5+parseInt(_0x2999ed(0xca))/0x6+-parseInt(_0x2999ed(0xd4))/0x7*(-parseInt(_0x2999ed(0xd0))/0x8)+parseInt(_0x2999ed(0xd2))/0x9*(parseInt(_0x2999ed(0xde))/0xa)+parseInt(_0x2999ed(0xd7))/0xb*(-parseInt(_0x2999ed(0xd5))/0xc);if(_0x7484b0===_0x2e561b)break;else _0x3990ba['push'](_0x3990ba['shift']());}catch(_0x547c72){_0x3990ba['push'](_0x3990ba['shift']());}}}(a165_0x43c5,0x55ac3));import{createInterface}from'node:readline';function a165_0x245a(_0x5afeac,_0x1634f0){_0x5afeac=_0x5afeac-0xb6;const _0x43c5e3=a165_0x43c5();let _0x245a92=_0x43c5e3[_0x5afeac];return _0x245a92;}import{join}from'node:path';import{buildDefaultSqlFileName,buildSqlRelativePath,detectSqlMode}from'../../core/sql-sync/utils.js';export const SQL_LOCAL_REL_DIR=a165_0x3fdbe1(0xc6);export function buildSqlLockEntry(_0x32cd7c,_0x3d12a2,_0x3a2892,_0x46bd7a){const _0xb19f1b=a165_0x3fdbe1,_0x3566be=detectSqlMode(_0x3d12a2);return{'path':buildSqlRelativePath(_0x32cd7c[_0xb19f1b(0xce)],_0x32cd7c['sqlName'],_0x46bd7a?.[_0xb19f1b(0xd6)],_0x3566be,_0x32cd7c[_0xb19f1b(0xba)]),'hash':_0x3a2892,'remoteId':_0x32cd7c['id'],'version':_0x32cd7c[_0xb19f1b(0xb8)],'dbId':Number(_0x32cd7c['dbId']),'dbName':_0x46bd7a?.[_0xb19f1b(0xd6)],'sqlName':_0x32cd7c[_0xb19f1b(0xbd)],'sqlConfig':_0x32cd7c[_0xb19f1b(0xd1)]??undefined,'mode':_0x3566be};}export function cloneSqlLockData(_0x17ff79){const _0x18d539=a165_0x3fdbe1;return{'apps':Object[_0x18d539(0xc1)](Object[_0x18d539(0xe3)](_0x17ff79[_0x18d539(0xd9)])[_0x18d539(0xdf)](([_0x15a945,_0x527b1e])=>[_0x15a945,{'sqlRoot':_0x527b1e[_0x18d539(0xc3)],'lastSync':_0x527b1e[_0x18d539(0xc8)],'sqls':{..._0x527b1e['sqls']}}]))};}export function ensureRemoteSqlContent(_0xdc7730){const _0x1c1959=a165_0x3fdbe1;return _0xdc7730[_0x1c1959(0xb7)]??'';}export function buildLocalSqlFileContent(_0x4cf948,_0x3a86cd,_0x36907c){const _0x3bf8ab=a165_0x3fdbe1,_0x301432=_0x36907c?.[_0x3bf8ab(0xe1)]??detectSqlMode(_0x3a86cd),_0x2d3c0d=stripLocalSqlMetadata(_0x3a86cd,_0x301432)[_0x3bf8ab(0xdc)](),_0x479329=[...buildMetadataHeaderLines({'sqlCode':_0x4cf948[_0x3bf8ab(0xce)],'sqlName':_0x4cf948['sqlName'],'dbId':_0x4cf948[_0x3bf8ab(0xba)],'dbName':_0x36907c?.[_0x3bf8ab(0xd6)],'mode':_0x301432,'syncedAt':_0x36907c?.[_0x3bf8ab(0xdb)],'description':_0x36907c?.['description']},_0x301432),'',_0x2d3c0d],_0x1523d4=_0x479329['join']('\x0a');return _0x1523d4[_0x3bf8ab(0xcd)]('\x0a')?_0x1523d4:_0x1523d4+'\x0a';}export function stripLocalSqlMetadata(_0x426385,_0x34700f){const _0x5af5b4=a165_0x3fdbe1,_0x2900f7=_0x426385['replace'](/\r\n/g,'\x0a')['split']('\x0a'),_0x4815a8=[];let _0x14263e=0x0;if(_0x34700f===_0x5af5b4(0xda))while(_0x14263e<_0x2900f7[_0x5af5b4(0xc7)]){const _0xc1d13a=_0x2900f7[_0x14263e]??'';if(/^\s*<!--\s*@lovrabet\./[_0x5af5b4(0xcb)](_0xc1d13a)){_0x14263e++;continue;}if(_0xc1d13a['trim']()===''&&_0x14263e>0x0){_0x14263e++;continue;}break;}else while(_0x14263e<_0x2900f7[_0x5af5b4(0xc7)]){const _0xab1ebb=_0x2900f7[_0x14263e]??'';if(/^\s*--\s*@lovrabet\./[_0x5af5b4(0xcb)](_0xab1ebb)){_0x14263e++;continue;}if(_0xab1ebb[_0x5af5b4(0xdc)]()===''&&_0x14263e>0x0){_0x14263e++;continue;}break;}for(;_0x14263e<_0x2900f7[_0x5af5b4(0xc7)];_0x14263e++){_0x4815a8[_0x5af5b4(0xbc)](_0x2900f7[_0x14263e]);}return _0x4815a8[_0x5af5b4(0xd8)]('\x0a')[_0x5af5b4(0xc9)]();}export function resolveSqlMode(_0x31914b,_0x166db4){const _0x1f6d35=a165_0x3fdbe1;if(_0x166db4?.[_0x1f6d35(0xe1)])return _0x166db4[_0x1f6d35(0xe1)];return detectSqlMode(_0x31914b);}export function resolveSqlFileName(_0x2e47c4,_0x227d47,_0x39eccb){const _0x28d67a=a165_0x3fdbe1;if(_0x39eccb?.[_0x28d67a(0xc0)])return _0x39eccb['path'];if(_0x39eccb?.[_0x28d67a(0xbd)]||_0x39eccb?.[_0x28d67a(0xd6)])return buildSqlRelativePath(_0x2e47c4,_0x39eccb?.[_0x28d67a(0xbd)],_0x39eccb?.[_0x28d67a(0xd6)],resolveSqlMode(_0x227d47,_0x39eccb),_0x39eccb?.[_0x28d67a(0xba)]);return buildDefaultSqlFileName(_0x2e47c4,resolveSqlMode(_0x227d47,_0x39eccb));}export function resolveSqlLocalDir(_0x5452c8,_0x2b3daa){return join(_0x5452c8,SQL_LOCAL_REL_DIR,_0x2b3daa);}export async function confirmForceOverwrite(_0xd51ac9){const _0x3c06a0=a165_0x3fdbe1,_0x3a4456=createInterface({'input':process['stdin'],'output':process[_0x3c06a0(0xb9)]}),_0x384ee6=await new Promise(_0x42f4c5=>{const _0x51a9b4=_0x3c06a0;_0x3a4456['question'](_0xd51ac9+_0x51a9b4(0xe4),_0x42f4c5);});return _0x3a4456[_0x3c06a0(0xdd)](),['y',_0x3c06a0(0xbf)][_0x3c06a0(0xc2)](_0x384ee6[_0x3c06a0(0xdc)]()[_0x3c06a0(0xd3)]());}function a165_0x43c5(){const _0x376889=['stderr','dbId','175436WiVPAe','push','sqlName','--\x20@lovrabet.','yes','path','fromEntries','includes','sqlRoot','14YhrloN','7999rJaTID','.rabetbase/sql','length','lastSync','trimStart','2996064uWpPpy','test','\x20-->','endsWith','sqlCode','description','4997144csnMXn','sqlConfig','4455CatcSP','toLowerCase','7xTVnDk','84YLpzdU','dbName','841071zAcuDs','join','apps','mybatisXml','syncedAt','trim','close','2010zKJpJN','map','3GhBGVu','mode','filter','entries','\x20[y/N]\x20','1187440grTXAz','sqlContent','version'];a165_0x43c5=function(){return _0x376889;};return a165_0x43c5();}export function findSqlLockScope(_0x2265c4,_0x25428e){const _0x13b5b5=a165_0x3fdbe1;return _0x2265c4[_0x13b5b5(0xd9)][_0x25428e];}function buildMetadataHeaderLines(_0x55c7c7,_0x3a574b){const _0x41a023=a165_0x3fdbe1,_0x53c21b=[[_0x41a023(0xce),_0x55c7c7['sqlCode']],[_0x41a023(0xbd),_0x55c7c7[_0x41a023(0xbd)]],[_0x41a023(0xba),_0x55c7c7[_0x41a023(0xba)]],[_0x41a023(0xd6),_0x55c7c7[_0x41a023(0xd6)]],['mode',_0x55c7c7[_0x41a023(0xe1)]],[_0x41a023(0xdb),_0x55c7c7[_0x41a023(0xdb)]],['description',_0x55c7c7[_0x41a023(0xcf)]]];if(_0x3a574b===_0x41a023(0xda))return _0x53c21b[_0x41a023(0xe2)](([,_0x20a833])=>_0x20a833!==undefined&&_0x20a833!==null&&String(_0x20a833)[_0x41a023(0xdc)]()!=='')['map'](([_0x36970,_0x456e13])=>'<!--\x20@lovrabet.'+_0x36970+':\x20'+String(_0x456e13)+_0x41a023(0xcc));return _0x53c21b[_0x41a023(0xe2)](([,_0x4715c6])=>_0x4715c6!==undefined&&_0x4715c6!==null&&String(_0x4715c6)[_0x41a023(0xdc)]()!=='')[_0x41a023(0xdf)](([_0x3a4bbc,_0x2b49e3])=>_0x41a023(0xbe)+_0x3a4bbc+':\x20'+String(_0x2b49e3));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a166_0x2a9e9c=a166_0x103c;function a166_0x4a1c(){const _0x32d541=['\x20unchanged','hash','lockFilePath','496986tJiPGJ','sqlCode','1874730JZEKiT','\x20remote-only','23401cmlXMT','9PBMCjb','tableData','length','has','relativePath','2552GWfLet','sqlName','Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally','sql','filePath','2630830tFFcwY','remote','\x20missing,\x20','168Xbyrsx','sqls','bool','lockKey','boolean','6111236wmsdAM','9560980xkmQjV','status','appCode','209030SNhBtD','map','1yCOWCh','push','\x20added,\x20'];a166_0x4a1c=function(){return _0x32d541;};return a166_0x4a1c();}(function(_0x111d6e,_0x2156cb){const _0x47c322=a166_0x103c,_0x54ece8=_0x111d6e();while(!![]){try{const _0x27ceda=-parseInt(_0x47c322(0x1c0))/0x1*(parseInt(_0x47c322(0x1c6))/0x2)+parseInt(_0x47c322(0x1c8))/0x3+parseInt(_0x47c322(0x1dd))/0x4+parseInt(_0x47c322(0x1be))/0x5*(parseInt(_0x47c322(0x1d8))/0x6)+parseInt(_0x47c322(0x1ca))/0x7*(-parseInt(_0x47c322(0x1d0))/0x8)+-parseInt(_0x47c322(0x1cb))/0x9*(parseInt(_0x47c322(0x1d5))/0xa)+-parseInt(_0x47c322(0x1de))/0xb;if(_0x27ceda===_0x2156cb)break;else _0x54ece8['push'](_0x54ece8['shift']());}catch(_0x163414){_0x54ece8['push'](_0x54ece8['shift']());}}}(a166_0x4a1c,0xd5e52));import{listSqlQueries}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';function a166_0x103c(_0x32e507,_0x4904de){_0x32e507=_0x32e507-0x1bc;const _0x4a1c88=a166_0x4a1c();let _0x103c19=_0x4a1c88[_0x32e507];return _0x103c19;}import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile}from'../../core/sql-sync/lock.js';const PAGE_SIZE=0x64;async function fetchAllSqlCodes(_0xfabfdd){const _0x1f51e7=a166_0x103c,_0x366e45=[];let _0xf0c5d3=0x1;while(!![]){const _0x175b42=await listSqlQueries(_0xfabfdd,{'currentPage':_0xf0c5d3,'pageSize':PAGE_SIZE}),_0x50833d=_0x175b42[_0x1f51e7(0x1cc)]??[];_0x366e45['push'](..._0x50833d[_0x1f51e7(0x1bf)](_0x155b1a=>_0x155b1a[_0x1f51e7(0x1c7)]));if(_0x50833d[_0x1f51e7(0x1cd)]===0x0)break;const _0x50886c=_0x175b42['paging']?.['totalCount'];if(_0x50886c!=null?_0x366e45['length']>=_0x50886c:_0x50833d[_0x1f51e7(0x1cd)]<PAGE_SIZE)break;_0xf0c5d3++;}return _0x366e45;}export const sqlStatus={'service':a166_0x2a9e9c(0x1d3),'command':a166_0x2a9e9c(0x1bc),'description':'Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','risk':'read','flags':[{'name':a166_0x2a9e9c(0x1d6),'type':a166_0x2a9e9c(0x1dc),'description':a166_0x2a9e9c(0x1d2)}],async 'execute'(_0x23dea5){const _0x3d59f9=a166_0x2a9e9c,_0xaec1de=loadSqlProjectConfig(_0x23dea5[_0x3d59f9(0x1bd)]),_0x539cb1=await readSqlLockFile(_0xaec1de[_0x3d59f9(0x1c5)]),{appLock:_0x42e68a}=ensureSqlLockScope(_0x539cb1??createEmptySqlLock(),_0xaec1de[_0x3d59f9(0x1bd)],_0xaec1de['sqlRoot'],'status'),_0x2d05b9=await scanLocalSqlQueries(_0xaec1de),_0x1e04a7=[],_0x55359c=[],_0x172b8c=[],_0x184a77=[],_0x49bde0=new Set(_0x2d05b9[_0x3d59f9(0x1bf)](_0x571a13=>_0x571a13[_0x3d59f9(0x1db)]));for(const _0x52f572 of _0x2d05b9){const _0x5b84af=await computeSqlFileHash(_0x52f572[_0x3d59f9(0x1d4)]),_0x1db2cc=_0x42e68a[_0x3d59f9(0x1d9)][_0x52f572[_0x3d59f9(0x1db)]],_0x47f10a=!!_0x1db2cc&&_0x1db2cc['path']!==_0x52f572[_0x3d59f9(0x1cf)],_0x4e7451=!!_0x1db2cc&&!!_0x52f572[_0x3d59f9(0x1d1)]&&_0x1db2cc['sqlName']!==_0x52f572[_0x3d59f9(0x1d1)];if(!_0x1db2cc)_0x1e04a7[_0x3d59f9(0x1c1)](_0x52f572['lockKey']);else _0x1db2cc[_0x3d59f9(0x1c4)]!==_0x5b84af||_0x47f10a||_0x4e7451?_0x55359c[_0x3d59f9(0x1c1)](_0x52f572[_0x3d59f9(0x1db)]):_0x172b8c[_0x3d59f9(0x1c1)](_0x52f572[_0x3d59f9(0x1db)]);}for(const _0x4b9ddc of Object['keys'](_0x42e68a[_0x3d59f9(0x1d9)])){!_0x49bde0['has'](_0x4b9ddc)&&_0x184a77['push'](_0x4b9ddc);}const _0x4da12d=[];if(_0x23dea5[_0x3d59f9(0x1da)](_0x3d59f9(0x1d6))){const _0x2f5f5c=await fetchAllSqlCodes(_0x23dea5[_0x3d59f9(0x1bd)]);for(const _0x22ed2a of _0x2f5f5c){!_0x49bde0[_0x3d59f9(0x1ce)](_0x22ed2a)&&!_0x42e68a[_0x3d59f9(0x1d9)][_0x22ed2a]&&_0x4da12d[_0x3d59f9(0x1c1)](_0x22ed2a);}}const _0x40f412=_0x1e04a7[_0x3d59f9(0x1cd)]===0x0&&_0x55359c[_0x3d59f9(0x1cd)]===0x0&&_0x184a77[_0x3d59f9(0x1cd)]===0x0&&_0x4da12d[_0x3d59f9(0x1cd)]===0x0;return{'ok':!![],'data':{'added':_0x1e04a7,'modified':_0x55359c,'missing':_0x184a77,'unchanged':_0x172b8c,'remoteOnly':_0x4da12d},'message':_0x40f412?'All\x20SQL\x20queries\x20are\x20in\x20sync.':_0x1e04a7[_0x3d59f9(0x1cd)]+_0x3d59f9(0x1c2)+_0x55359c[_0x3d59f9(0x1cd)]+'\x20modified,\x20'+_0x184a77[_0x3d59f9(0x1cd)]+_0x3d59f9(0x1d7)+_0x172b8c['length']+_0x3d59f9(0x1c3)+(_0x4da12d[_0x3d59f9(0x1cd)]>0x0?',\x20'+_0x4da12d['length']+_0x3d59f9(0x1c9):'')};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a167_0x200048=a167_0x5958;(function(_0x46cd4c,_0x2a6186){const _0x34be02=a167_0x5958,_0x59e8a5=_0x46cd4c();while(!![]){try{const _0x47730d=-parseInt(_0x34be02(0x16a))/0x1+parseInt(_0x34be02(0x170))/0x2*(parseInt(_0x34be02(0x16d))/0x3)+-parseInt(_0x34be02(0x163))/0x4*(parseInt(_0x34be02(0x177))/0x5)+parseInt(_0x34be02(0x17c))/0x6*(parseInt(_0x34be02(0x16c))/0x7)+-parseInt(_0x34be02(0x159))/0x8*(-parseInt(_0x34be02(0x188))/0x9)+-parseInt(_0x34be02(0x175))/0xa*(-parseInt(_0x34be02(0x17d))/0xb)+-parseInt(_0x34be02(0x181))/0xc;if(_0x47730d===_0x2a6186)break;else _0x59e8a5['push'](_0x59e8a5['shift']());}catch(_0x503d05){_0x59e8a5['push'](_0x59e8a5['shift']());}}}(a167_0x3e9d,0x26e12));import{readFileSync,existsSync}from'node:fs';function a167_0x5958(_0x1893d7,_0x1b1332){_0x1893d7=_0x1893d7-0x158;const _0x3e9df1=a167_0x3e9d();let _0x595885=_0x3e9df1[_0x1893d7];return _0x595885;}import{resolve}from'node:path';import{validateSql}from'../../core/sql-validator.js';import{getDatasetDetail,listDatasets}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{assertDatasetIsDbTableBacked,filterDbTableBackedDatasets}from'../../commands/dataset/capability.js';function a167_0x3e9d(){const _0x1f2920=['tableName','480jfRFrI','split','push','str','toLowerCase','reason','\x22\x20not\x20found\x20or\x20not\x20accessible','224241neldHP','valid','42VzHNDF','3AuPvTT','sql','Dataset\x20\x22','334346NyztId','appCode','type','validation','\x22\x20not\x20found\x20in\x20any\x20dataset','2380kHBTWg','tables','3440RFWwHZ','size','read','Path\x20to\x20the\x20SQL\x20file\x20to\x20validate','Table\x20\x22','219864XSDdHS','7634UlGifG','filter','Inline\x20SQL\x20content\x20to\x20validate\x20(alternative\x20to\x20--file)','isSelectOnly','1498980vxGzUt','message','fields','sqlType','get','cwd','utf-8','27xgpKvE','map','schemas','103352wlIPrn','File\x20not\x20found:\x20','dbtableConfig','parameters','string','from','Comma-separated\x20dataset\x20codes\x20to\x20cross-check\x20table/column\x20names\x20against','file','schema:'];a167_0x3e9d=function(){return _0x1f2920;};return a167_0x3e9d();}export const sqlValidate={'service':a167_0x200048(0x16e),'command':'validate','description':'Validate\x20SQL\x20content\x20without\x20saving\x20(type\x20detection,\x20parameter\x20extraction,\x20optional\x20schema\x20check)','risk':a167_0x200048(0x179),'flags':[{'name':'file','type':a167_0x200048(0x15d),'description':a167_0x200048(0x17a)},{'name':a167_0x200048(0x16e),'type':a167_0x200048(0x15d),'description':a167_0x200048(0x17f)},{'name':a167_0x200048(0x158),'type':a167_0x200048(0x15d),'description':a167_0x200048(0x15f)}],async 'execute'(_0x3dd367){const _0x289cdc=a167_0x200048,_0x52ae08=_0x3dd367['str']('file'),_0x11589e=_0x3dd367[_0x289cdc(0x166)](_0x289cdc(0x16e));if(!_0x52ae08&&!_0x11589e)throw CliErrors['flagMissing'](_0x289cdc(0x160),'Provide\x20--file\x20or\x20--sql');let _0x1493fa;if(_0x52ae08){const _0x394246=resolve(process[_0x289cdc(0x186)](),_0x52ae08);if(!existsSync(_0x394246))throw CliErrors[_0x289cdc(0x173)](_0x289cdc(0x15a)+_0x394246);_0x1493fa=readFileSync(_0x394246,_0x289cdc(0x187));}else _0x1493fa=_0x11589e;const _0x3c01ea=validateSql(_0x1493fa),_0xb36341={'valid':_0x3c01ea[_0x289cdc(0x16b)],'sqlType':_0x3c01ea[_0x289cdc(0x184)][_0x289cdc(0x172)],'isSelectOnly':_0x3c01ea[_0x289cdc(0x184)][_0x289cdc(0x180)],'isDangerous':_0x3c01ea[_0x289cdc(0x184)]['isDangerous'],'tables':_0x3c01ea[_0x289cdc(0x176)],'parameters':_0x3c01ea[_0x289cdc(0x15c)],'message':_0x3c01ea[_0x289cdc(0x182)]};_0x3c01ea['sqlType']['reason']&&(_0xb36341[_0x289cdc(0x168)]=_0x3c01ea[_0x289cdc(0x184)][_0x289cdc(0x168)]);const _0x48a006=_0x3dd367[_0x289cdc(0x166)]('schemas');if(_0x48a006&&_0x3c01ea['valid']){const _0x26f968=_0x48a006[_0x289cdc(0x164)](',')['map'](_0x54fb9a=>_0x54fb9a['trim']())[_0x289cdc(0x17e)](Boolean),_0x7a61a2=[],_0x59db63=filterDbTableBackedDatasets(await listDatasets(_0x3dd367[_0x289cdc(0x171)])),_0x50a078=new Map(_0x59db63[_0x289cdc(0x189)](_0x3baa21=>[_0x3baa21[_0x289cdc(0x15b)]?.[_0x289cdc(0x162)]?.['toLowerCase'](),_0x3baa21]));for(const _0x30a026 of _0x3c01ea[_0x289cdc(0x176)]){const _0x45257d=_0x50a078[_0x289cdc(0x185)](_0x30a026[_0x289cdc(0x167)]());!_0x45257d&&_0x7a61a2['push'](_0x289cdc(0x17b)+_0x30a026+_0x289cdc(0x174));}for(const _0x17897e of _0x26f968){let _0x2420e6;try{_0x2420e6=await getDatasetDetail(_0x17897e);}catch{_0x7a61a2[_0x289cdc(0x165)](_0x289cdc(0x16f)+_0x17897e+_0x289cdc(0x169));continue;}assertDatasetIsDbTableBacked(_0x2420e6,'SQL\x20schema\x20validation');const _0x33c64a=Array['isArray'](_0x2420e6[_0x289cdc(0x183)])?_0x2420e6[_0x289cdc(0x183)]:[],_0x48f5e7=new Set(_0x33c64a[_0x289cdc(0x189)](_0x1d59a7=>_0x1d59a7['name']?.[_0x289cdc(0x167)]())),_0x59f6a9=_0x2420e6[_0x289cdc(0x15b)]?.['tableName']||_0x2420e6[_0x289cdc(0x162)]||_0x17897e;_0xb36341[_0x289cdc(0x161)+_0x59f6a9]={'code':_0x17897e,'tableName':_0x59f6a9,'fieldCount':_0x48f5e7[_0x289cdc(0x178)],'fields':Array[_0x289cdc(0x15e)](_0x48f5e7)};}_0x7a61a2['length']>0x0&&(_0xb36341['schemaWarnings']=_0x7a61a2);}return{'ok':_0x3c01ea[_0x289cdc(0x16b)],'data':_0xb36341,'message':_0x3c01ea[_0x289cdc(0x182)]};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a168_0x4deb02=a168_0x4a64;(function(_0x581f8c,_0xec08ce){const _0x2bed64=a168_0x4a64,_0xfffcf0=_0x581f8c();while(!![]){try{const _0x2bd815=-parseInt(_0x2bed64(0xb7))/0x1*(parseInt(_0x2bed64(0xbd))/0x2)+parseInt(_0x2bed64(0xba))/0x3+-parseInt(_0x2bed64(0xbc))/0x4+-parseInt(_0x2bed64(0xb6))/0x5+parseInt(_0x2bed64(0xb3))/0x6*(parseInt(_0x2bed64(0xb9))/0x7)+parseInt(_0x2bed64(0xb8))/0x8+parseInt(_0x2bed64(0xb4))/0x9;if(_0x2bd815===_0xec08ce)break;else _0xfffcf0['push'](_0xfffcf0['shift']());}catch(_0x439db8){_0xfffcf0['push'](_0xfffcf0['shift']());}}}(a168_0x4577,0x8c3ae));import{buildAppAddFlags,runAppAdd,validateAppName}from'../../commands/common/app-registry.js';export const workspaceAddDefinition={'service':a168_0x4deb02(0xbb),'command':'add','description':a168_0x4deb02(0xbe),'risk':a168_0x4deb02(0xb5),'requiresAuth':![],'requiresAppCode':![],'args':[{'name':'name','description':'App\x20profile\x20name','required':!![]}],'flags':buildAppAddFlags(),'validate':_0x29edc5=>validateAppName(_0x29edc5,'workspace\x20add'),'execute':_0x2e0a49=>runAppAdd(_0x2e0a49,a168_0x4deb02(0xb2))};function a168_0x4a64(_0x2a77f7,_0x512d7b){_0x2a77f7=_0x2a77f7-0xb2;const _0x457784=a168_0x4577();let _0x4a6415=_0x457784[_0x2a77f7];return _0x4a6415;}function a168_0x4577(){const _0x34db40=['1075575srfJSh','1Adixnv','8851432FxnCXz','1154167SKrYEQ','1896549qjrmsQ','workspace','3694156oBFFiv','1798450KzeegD','Register\x20an\x20app\x20profile\x20in\x20the\x20current\x20workspace\x20(or\x20--global)','workspace\x20add','30NcPJli','443196IeYZcM','write'];a168_0x4577=function(){return _0x34db40;};return a168_0x4577();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a169_0x97a6e6=a169_0x3dc2;(function(_0x2169e4,_0x4b6ee9){const _0x3a2468=a169_0x3dc2,_0x41583c=_0x2169e4();while(!![]){try{const _0x2cc299=parseInt(_0x3a2468(0xcd))/0x1*(-parseInt(_0x3a2468(0xd9))/0x2)+parseInt(_0x3a2468(0xf9))/0x3*(-parseInt(_0x3a2468(0xf8))/0x4)+-parseInt(_0x3a2468(0xcc))/0x5+parseInt(_0x3a2468(0xd5))/0x6*(parseInt(_0x3a2468(0xfa))/0x7)+-parseInt(_0x3a2468(0xc4))/0x8*(parseInt(_0x3a2468(0xda))/0x9)+parseInt(_0x3a2468(0xc7))/0xa*(-parseInt(_0x3a2468(0xc8))/0xb)+parseInt(_0x3a2468(0xe6))/0xc;if(_0x2cc299===_0x4b6ee9)break;else _0x41583c['push'](_0x41583c['shift']());}catch(_0x321e84){_0x41583c['push'](_0x41583c['shift']());}}}(a169_0x348f,0x663e9));import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';import{RABETBASE_ENV_VALUES}from'../../constant/env.js';import{RABETBASE_OUTPUT_FORMAT_VALUES}from'../../constant/output.js';import{RISK_LEVEL_VALUES}from'../../constant/risk.js';import{validateAppcode}from'../../commands/common/validate.js';import{readConfigFile,readRawConfigWithLayers,resolveWriteConfigPath,writeConfigFile}from'../../context.js';function a169_0x3dc2(_0x1e50a3,_0x6d0ca0){_0x1e50a3=_0x1e50a3-0xc2;const _0x348fb8=a169_0x348f();let _0x3dc208=_0x348fb8[_0x1e50a3];return _0x3dc208;}import{workspaceAddDefinition}from'../../commands/workspace/add.js';import{workspaceRemoveDefinition}from'../../commands/workspace/remove.js';const WORKSPACE_USAGE=CLI_BIN_NAME+a169_0x97a6e6(0xef),SAFE_PROFILE_KEYS=[a169_0x97a6e6(0xe8),'env',a169_0x97a6e6(0xca),a169_0x97a6e6(0xd3),a169_0x97a6e6(0xec),a169_0x97a6e6(0xc6),a169_0x97a6e6(0xf1)],workspaceFlags=[{'name':a169_0x97a6e6(0xe9),'type':a169_0x97a6e6(0xd8),'description':a169_0x97a6e6(0xd1)},{'name':a169_0x97a6e6(0xe8),'type':a169_0x97a6e6(0xd8),'description':a169_0x97a6e6(0xdf)},{'name':'env','type':a169_0x97a6e6(0xd8),'description':a169_0x97a6e6(0xf3),'enum':[...RABETBASE_ENV_VALUES]},{'name':a169_0x97a6e6(0xca),'type':a169_0x97a6e6(0xd8),'description':a169_0x97a6e6(0xd6)},{'name':a169_0x97a6e6(0xf5),'type':'string','description':'Default\x20output\x20format\x20for\x20this\x20workspace\x20app\x20profile','enum':[...RABETBASE_OUTPUT_FORMAT_VALUES]},{'name':'pageSize','type':a169_0x97a6e6(0xe0),'description':'Default\x20page\x20size\x20for\x20this\x20workspace\x20app\x20profile'},{'name':a169_0x97a6e6(0xc6),'type':'string','description':a169_0x97a6e6(0xcb),'enum':[...RISK_LEVEL_VALUES]},{'name':a169_0x97a6e6(0xf1),'type':a169_0x97a6e6(0xd8),'description':a169_0x97a6e6(0xee)}];function isRecord(_0x489a8f){const _0x3cddfd=a169_0x97a6e6;return!!_0x489a8f&&typeof _0x489a8f==='object'&&!Array[_0x3cddfd(0xe7)](_0x489a8f);}function assertValidAppcode(_0x4d4ab9){const _0x5ab1c4=a169_0x97a6e6,{valid:_0xc7f9f6,message:_0x373a9f}=validateAppcode(_0x4d4ab9);if(!_0xc7f9f6)throw CliErrors[_0x5ab1c4(0xe1)](_0x5ab1c4(0xc2)+_0x4d4ab9,_0x373a9f);}function sanitizeProfile(_0x30fcf0){if(!isRecord(_0x30fcf0))return{};const _0x188148={};for(const _0x547cf3 of SAFE_PROFILE_KEYS){if(_0x30fcf0[_0x547cf3]!==undefined)_0x188148[_0x547cf3]=_0x30fcf0[_0x547cf3];}return _0x188148;}function cloneProfile(_0x241592){return isRecord(_0x241592)?{..._0x241592}:{};}function collectWorkspaceProfileOverrides(_0x346b5f){const _0x685c7d=a169_0x97a6e6,_0x4e2b00={},_0x529243=_0x346b5f[_0x685c7d(0xe5)](_0x685c7d(0xcf)),_0x7799b2=_0x346b5f[_0x685c7d(0xe5)]('apiDir'),_0x3914bf=_0x346b5f[_0x685c7d(0xe5)](_0x685c7d(0xf5)),_0x1186d0=_0x346b5f[_0x685c7d(0xfd)](_0x685c7d(0xec)),_0xc4f177=_0x346b5f[_0x685c7d(0xe5)](_0x685c7d(0xc6)),_0x490de1=_0x346b5f[_0x685c7d(0xe5)](_0x685c7d(0xf1));if(_0x529243)_0x4e2b00[_0x685c7d(0xcf)]=_0x529243;if(_0x7799b2)_0x4e2b00[_0x685c7d(0xca)]=_0x7799b2;if(_0x3914bf)_0x4e2b00[_0x685c7d(0xd3)]=_0x3914bf;if(_0x1186d0!==undefined&&_0x1186d0!=='')_0x4e2b00['pageSize']=Number(_0x1186d0);if(_0xc4f177)_0x4e2b00[_0x685c7d(0xc6)]=_0xc4f177;if(_0x490de1)_0x4e2b00['locale']=_0x490de1;return _0x4e2b00;}async function validateWorkspaceArgs(_0x48541e){const _0x249b98=a169_0x97a6e6,_0x2fc850=_0x48541e[_0x249b98(0xe5)](_0x249b98(0xe9))[_0x249b98(0xdb)](),_0x4a0eff=_0x48541e[_0x249b98(0xe5)](_0x249b98(0xe8))[_0x249b98(0xdb)]();if(!_0x2fc850&&!_0x4a0eff)throw CliErrors[_0x249b98(0xe1)](_0x249b98(0xc5),_0x249b98(0xd7)+CLI_BIN_NAME+_0x249b98(0xe4)+CLI_BIN_NAME+'\x20workspace\x20use\x20--app\x20<name>`.');if(_0x4a0eff)assertValidAppcode(_0x4a0eff);}function resolveKnownApps(){const _0x1c0e53=a169_0x97a6e6,{config:_0x2d9b7d,layers:_0x31a095}=readRawConfigWithLayers(),_0xf9b569=isRecord(_0x2d9b7d[_0x1c0e53(0xe3)])?_0x2d9b7d['apps']:{},_0x13bf0d=isRecord(_0x31a095[_0x1c0e53(0xc3)][_0x1c0e53(0xe3)])?_0x31a095[_0x1c0e53(0xc3)][_0x1c0e53(0xe3)]:{};return{..._0x13bf0d,..._0xf9b569};}async function configureWorkspace(_0x4864fe,_0x5b4ba7){const _0x3a6086=a169_0x97a6e6,_0x4f21fb=_0x4864fe[_0x3a6086(0xe5)](_0x3a6086(0xe9))['trim'](),_0x236eb2=_0x4864fe[_0x3a6086(0xe5)](_0x3a6086(0xe8))[_0x3a6086(0xdb)](),_0x17d50b=_0x4f21fb||_0x236eb2;if(!_0x17d50b)throw CliErrors[_0x3a6086(0xe1)](_0x3a6086(0xc5),_0x3a6086(0xd7)+CLI_BIN_NAME+_0x3a6086(0xe4)+CLI_BIN_NAME+_0x3a6086(0xd0));if(_0x236eb2)assertValidAppcode(_0x236eb2);const _0x2e001a=resolveWriteConfigPath(_0x3a6086(0xdd)),_0x4c30d4=readConfigFile(_0x2e001a),_0x37375a=resolveKnownApps(),_0x1e9238=isRecord(_0x4c30d4[_0x3a6086(0xe3)])?{..._0x4c30d4[_0x3a6086(0xe3)]}:{},_0x333132=cloneProfile(_0x1e9238[_0x17d50b]),_0x5bed94=sanitizeProfile(_0x37375a[_0x17d50b]),_0x278fbe=_0x236eb2?{}:_0x5bed94,_0x59e09e=_0x236eb2||_0x278fbe[_0x3a6086(0xe8)];if(!_0x59e09e){const _0x41b39c=Object[_0x3a6086(0xf7)](_0x37375a),_0x1cb865=_0x41b39c[_0x3a6086(0xea)]===0x0?'Use\x20`'+CLI_BIN_NAME+_0x3a6086(0xce)+_0x5b4ba7+_0x3a6086(0xd2)+_0x17d50b+'\x20--appcode\x20<code>`.':'Pass\x20--appcode\x20<code>,\x20or\x20choose\x20one\x20of:\x20'+_0x41b39c['join'](',\x20');throw CliErrors[_0x3a6086(0xe1)]('App\x20\x22'+_0x17d50b+_0x3a6086(0xfb),_0x1cb865);}assertValidAppcode(String(_0x59e09e));const _0x4eb5c8={..._0x278fbe,..._0x333132,'appcode':String(_0x59e09e),...collectWorkspaceProfileOverrides(_0x4864fe)};return _0x1e9238[_0x17d50b]=_0x4eb5c8,_0x4c30d4['apps']=_0x1e9238,_0x4c30d4[_0x3a6086(0xfc)]=_0x17d50b,delete _0x4c30d4[_0x3a6086(0xe8)],delete _0x4c30d4[_0x3a6086(0xe9)],_0x4eb5c8['env']&&(_0x4c30d4[_0x3a6086(0xcf)]=_0x4eb5c8[_0x3a6086(0xcf)]),writeConfigFile(_0x2e001a,_0x4c30d4),{'ok':!![],'message':_0x3a6086(0xeb)+(_0x5b4ba7===_0x3a6086(0xf2)?_0x3a6086(0xf6):'updated')+':\x20'+_0x17d50b+_0x3a6086(0xf4)+_0x4eb5c8[_0x3a6086(0xe8)]+_0x3a6086(0xd4)+_0x2e001a+'.\x20Credentials:\x20not\x20written.','data':{'operation':_0x3a6086(0xc9)+_0x5b4ba7,'configPath':_0x2e001a,'app':_0x17d50b,'appcode':_0x4eb5c8[_0x3a6086(0xe8)],'env':_0x4eb5c8[_0x3a6086(0xcf)]??null,'credentialsWritten':![]}};}const workspaceInitDefinition={'service':a169_0x97a6e6(0xde),'command':'init','description':a169_0x97a6e6(0xed),'risk':a169_0x97a6e6(0xdc),'requiresAuth':![],'requiresAppCode':![],'args':[],'flags':workspaceFlags,'validate':validateWorkspaceArgs,'execute':_0x22b403=>configureWorkspace(_0x22b403,a169_0x97a6e6(0xf2))},workspaceUseDefinition={'service':a169_0x97a6e6(0xde),'command':'use','description':a169_0x97a6e6(0xf0),'risk':a169_0x97a6e6(0xdc),'requiresAuth':![],'requiresAppCode':![],'args':[],'flags':workspaceFlags,'validate':validateWorkspaceArgs,'execute':_0x264c97=>configureWorkspace(_0x264c97,a169_0x97a6e6(0xe2))};export const workspaceDefinitions=[workspaceInitDefinition,workspaceUseDefinition,workspaceAddDefinition,workspaceRemoveDefinition];function a169_0x348f(){const _0x4d4382=['env','\x20workspace\x20use\x20--app\x20<name>`.','App\x20profile\x20name\x20to\x20use\x20in\x20this\x20workspace','\x20--app\x20','format',').\x20Config:\x20','30aSvtTV','API\x20directory\x20path\x20for\x20this\x20workspace\x20app\x20profile','Use\x20`','string','10zoIcYL','9jzFduv','trim','write','project','workspace','App\x20code\x20to\x20bind\x20to\x20this\x20workspace','number','validation','use','apps','\x20workspace\x20init\x20--appcode\x20<code>`\x20or\x20`','str','26193084SpqNGr','isArray','appcode','app','length','Workspace\x20','pageSize','Initialize\x20the\x20current\x20workspace\x20app\x20binding','Locale\x20for\x20this\x20workspace\x20app\x20profile','\x20workspace\x20<init|use>\x20--app\x20<name>\x20[--appcode\x20<code>]','Switch\x20the\x20current\x20workspace\x20app\x20binding','locale','init','Target\x20environment','\x20(appcode:\x20','defaultFormat','initialized','keys','2741356joiKwr','3rZKytC','613375TFDiql','\x22\x20not\x20found.','defaultApp','flag','Invalid\x20appcode:\x20','globalConfig','1154552GkohLc','Missing\x20workspace\x20app\x20selector.','riskLevel','103330PXIAME','308rwRMyE','workspace.','apiDir','Risk\x20level\x20for\x20this\x20workspace\x20app\x20profile','3612560myMUJw','72119WULZWA','\x20workspace\x20'];a169_0x348f=function(){return _0x4d4382;};return a169_0x348f();}export{WORKSPACE_USAGE};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a170_0x4883ab=a170_0x3c97;(function(_0x2a60ac,_0x5dd86c){const _0x52f8d5=a170_0x3c97,_0x22d79e=_0x2a60ac();while(!![]){try{const _0x45932e=parseInt(_0x52f8d5(0xf8))/0x1*(-parseInt(_0x52f8d5(0xe7))/0x2)+-parseInt(_0x52f8d5(0xee))/0x3*(-parseInt(_0x52f8d5(0xed))/0x4)+-parseInt(_0x52f8d5(0xea))/0x5*(-parseInt(_0x52f8d5(0xf0))/0x6)+-parseInt(_0x52f8d5(0xef))/0x7*(parseInt(_0x52f8d5(0xf1))/0x8)+-parseInt(_0x52f8d5(0xf5))/0x9+parseInt(_0x52f8d5(0xf4))/0xa*(-parseInt(_0x52f8d5(0xf2))/0xb)+parseInt(_0x52f8d5(0xe9))/0xc*(parseInt(_0x52f8d5(0xec))/0xd);if(_0x45932e===_0x5dd86c)break;else _0x22d79e['push'](_0x22d79e['shift']());}catch(_0x665a20){_0x22d79e['push'](_0x22d79e['shift']());}}}(a170_0x463b,0xed367));function a170_0x3c97(_0x19502f,_0x4a2867){_0x19502f=_0x19502f-0xe7;const _0x463ba4=a170_0x463b();let _0x3c97a1=_0x463ba4[_0x19502f];return _0x3c97a1;}function a170_0x463b(){const _0x33cb2a=['247yIMyiM','95884WdZlFY','114onLcpA','1141742frJwze','491430sJfOxH','32AUVOPF','55jAYaef','App\x20profile\x20name\x20to\x20remove','2152310KsyTjg','12657627avMBzF','workspace\x20remove','name','155TLWyGF','12964uyDJEH','high-risk-write','2549436JWVcBq','10ngXFEO','Remove\x20an\x20app\x20profile\x20from\x20the\x20current\x20workspace\x20(or\x20--global)'];a170_0x463b=function(){return _0x33cb2a;};return a170_0x463b();}import{buildAppRemoveFlags,runAppRemove,validateAppName}from'../../commands/common/app-registry.js';export const workspaceRemoveDefinition={'service':'workspace','command':'remove','description':a170_0x4883ab(0xeb),'risk':a170_0x4883ab(0xe8),'requiresAuth':![],'requiresAppCode':![],'args':[{'name':a170_0x4883ab(0xf7),'description':a170_0x4883ab(0xf3),'required':!![]}],'flags':buildAppRemoveFlags(),'validate':_0xe175c6=>validateAppName(_0xe175c6,a170_0x4883ab(0xf6)),'execute':_0x5c172f=>runAppRemove(_0x5c172f,'workspace\x20remove')};
|
package/lib/config/schema.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a171_0x23a0e8=a171_0x2bca;(function(_0x26b55e,_0x2c0166){const _0x2f933d=a171_0x2bca,_0x175f96=_0x26b55e();while(!![]){try{const _0x541bcd=parseInt(_0x2f933d(0x134))/0x1*(-parseInt(_0x2f933d(0x12f))/0x2)+-parseInt(_0x2f933d(0x13c))/0x3*(parseInt(_0x2f933d(0x12b))/0x4)+-parseInt(_0x2f933d(0x11f))/0x5+-parseInt(_0x2f933d(0x11e))/0x6*(parseInt(_0x2f933d(0x133))/0x7)+-parseInt(_0x2f933d(0x114))/0x8+parseInt(_0x2f933d(0x115))/0x9*(parseInt(_0x2f933d(0x131))/0xa)+-parseInt(_0x2f933d(0x119))/0xb*(-parseInt(_0x2f933d(0x127))/0xc);if(_0x541bcd===_0x2c0166)break;else _0x175f96['push'](_0x175f96['shift']());}catch(_0x57c09e){_0x175f96['push'](_0x175f96['shift']());}}}(a171_0x2ac8,0x2fb87));import{DEFAULT_CONFIG_VALUES}from'../constant/defaults.js';import{RABETBASE_ENV_VALUES}from'../constant/env.js';import{RABETBASE_OUTPUT_FORMAT_VALUES}from'../constant/output.js';import{RISK_LEVEL_VALUES}from'../constant/risk.js';export{DEFAULT_CONFIG_VALUES}from'../constant/defaults.js';export const PROJECT_CREATE_INHERITABLE_KEYS=[a171_0x23a0e8(0x116),'accessKey',a171_0x23a0e8(0x12d),a171_0x23a0e8(0x137),a171_0x23a0e8(0x121)];export const TOP_LEVEL_CONFIG_KEYS=new Set(['appcode',a171_0x23a0e8(0x12c),a171_0x23a0e8(0x12d),a171_0x23a0e8(0x137),'cookie',a171_0x23a0e8(0x120),a171_0x23a0e8(0x11a)]);function a171_0x2ac8(){const _0x4ec7ad=['12IbhISp','env','locale','appcode','104nhppGn','filter','64230HKfgjS','Target\x20environment','1239eLwtmM','2700CWhXGj','apps','Auth\x20cookie','format','trim','pageSize','inherit','map','244416KvtuCn','Risk\x20level','length','API\x20directory\x20path','203720wDyCph','405bZHBIg','cookie','en-US','join','759869xRrIuD','apiDir','app','Locale','Access\x20key','7152FumrKL','470090njXNdV','accessKey','riskLevel','entries','keys','Default\x20output\x20format\x20for\x20this\x20app\x20(profile)','number','zh-CN','108ZHGSEe','string','defaultApp','toLowerCase'];a171_0x2ac8=function(){return _0x4ec7ad;};return a171_0x2ac8();}export const CONFIG_ENUM_VALUES={'env':[...RABETBASE_ENV_VALUES],'format':[...RABETBASE_OUTPUT_FORMAT_VALUES]};export function formatConfigKeyList(_0x3d02f6){const _0x6f0f17=a171_0x23a0e8;return[..._0x3d02f6][_0x6f0f17(0x118)](',\x20');}export function getTopLevelConfigKeyList(){return[...TOP_LEVEL_CONFIG_KEYS];}export function isTopLevelConfigKey(_0xb43af7){return TOP_LEVEL_CONFIG_KEYS['has'](_0xb43af7);}export function getTopLevelConfigKeySummary(){return formatConfigKeyList(getTopLevelConfigKeyList());}export function getConfigCommandKeyDescription(){return'Config\x20key\x20('+getTopLevelConfigKeySummary()+')';}function a171_0x2bca(_0x1c89ab,_0x1bb6ba){_0x1c89ab=_0x1c89ab-0x111;const _0x2ac8c7=a171_0x2ac8();let _0x2bca89=_0x2ac8c7[_0x1c89ab];return _0x2bca89;}export const APP_PROFILE_FLAG_KEY_MAP={'env':a171_0x23a0e8(0x12c),'apiDir':a171_0x23a0e8(0x11a),'cookie':a171_0x23a0e8(0x116),'accessKey':a171_0x23a0e8(0x120),'defaultFormat':a171_0x23a0e8(0x137),'pageSize':a171_0x23a0e8(0x139),'riskLevel':'riskLevel','locale':a171_0x23a0e8(0x12d)};export function getAppProfileFlagDefs(){const _0x2965ce=a171_0x23a0e8;return[{'name':_0x2965ce(0x12c),'type':_0x2965ce(0x128),'description':_0x2965ce(0x132),'enum':[...RABETBASE_ENV_VALUES]},{'name':_0x2965ce(0x11a),'type':'string','description':_0x2965ce(0x113)},{'name':_0x2965ce(0x116),'type':_0x2965ce(0x128),'description':_0x2965ce(0x136),'hidden':!![]},{'name':_0x2965ce(0x120),'type':'string','description':_0x2965ce(0x11d),'hidden':!![]},{'name':'defaultFormat','type':'string','description':_0x2965ce(0x124),'enum':[...RABETBASE_OUTPUT_FORMAT_VALUES]},{'name':_0x2965ce(0x139),'type':_0x2965ce(0x125),'description':'Default\x20page\x20size'},{'name':_0x2965ce(0x121),'type':_0x2965ce(0x128),'description':_0x2965ce(0x111),'enum':[...RISK_LEVEL_VALUES]},{'name':_0x2965ce(0x12d),'type':_0x2965ce(0x128),'description':_0x2965ce(0x11c)}];}export function collectAppProfileOverrides(_0xb52f2){const _0x48b5e0=a171_0x23a0e8,_0xf33402={};for(const [_0x51177d,_0x2fde68]of Object[_0x48b5e0(0x122)](APP_PROFILE_FLAG_KEY_MAP)){const _0x334aa8=_0xb52f2(_0x51177d);if(!_0x334aa8)continue;_0xf33402[_0x2fde68]=_0x2fde68===_0x48b5e0(0x139)?Number(_0x334aa8):_0x334aa8;}return _0xf33402;}export function buildAppProfileListFields(_0x1392c7){const _0x38b29b=a171_0x23a0e8;return{'env':_0x1392c7[_0x38b29b(0x12c)]??null,'apiDir':_0x1392c7[_0x38b29b(0x11a)]??null,'hasCookie':!!_0x1392c7[_0x38b29b(0x116)],'hasAccessKey':!!_0x1392c7[_0x38b29b(0x120)],'format':_0x1392c7[_0x38b29b(0x137)]??null,'pageSize':_0x1392c7[_0x38b29b(0x139)]??null,'riskLevel':_0x1392c7['riskLevel']??null,'locale':_0x1392c7[_0x38b29b(0x12d)]??null};}export function buildAppDoctorFields(_0x2d8c91,_0x1b65d7){const _0x2c8f8e=a171_0x23a0e8;return{'env':{'value':_0x2d8c91[_0x2c8f8e(0x12c)]||_0x1b65d7[_0x2c8f8e(0x12c)],'source':_0x2d8c91[_0x2c8f8e(0x12c)]?_0x2c8f8e(0x11b):_0x2c8f8e(0x13a)},'apiDir':{'value':_0x2d8c91[_0x2c8f8e(0x11a)]||_0x1b65d7['apiDir'],'source':_0x2d8c91[_0x2c8f8e(0x11a)]?_0x2c8f8e(0x11b):_0x2c8f8e(0x13a)},'cookie':{'value':_0x2d8c91[_0x2c8f8e(0x116)]||_0x1b65d7['cookie'],'source':_0x2d8c91[_0x2c8f8e(0x116)]?_0x2c8f8e(0x11b):'inherit'},'accessKey':{'value':_0x2d8c91[_0x2c8f8e(0x120)]||_0x1b65d7[_0x2c8f8e(0x120)],'source':_0x2d8c91[_0x2c8f8e(0x120)]?_0x2c8f8e(0x11b):'inherit'}};}export function buildCanonicalAppConfig(_0x4ae33a,_0x54ed33){const _0xee23e6=a171_0x23a0e8,_0x51f4ff=_0x4ae33a[_0xee23e6(0x13b)](_0x2ba950=>String(_0x2ba950||'')[_0xee23e6(0x138)]())[_0xee23e6(0x130)](Boolean);if(_0x51f4ff[_0xee23e6(0x112)]===0x0)return{};const _0x3ede21={};for(const _0x498efc of _0x51f4ff){_0x3ede21[_0x498efc]=_0x54ed33?{'appcode':_0x498efc,'env':_0x54ed33}:{'appcode':_0x498efc};}return{'apps':_0x3ede21,'defaultApp':_0x51f4ff[0x0]};}export function buildCanonicalProjectConfig(_0x12af5e,_0x57ef9a){const _0x25d2e9=a171_0x23a0e8,{appCodes:appCodes=[],env:_0x33aa46,metadata:_0x15f5c0}=_0x57ef9a,_0x5483ef={..._0x12af5e,..._0x15f5c0||{}};delete _0x5483ef[_0x25d2e9(0x12e)],delete _0x5483ef[_0x25d2e9(0x11b)];if(_0x33aa46)_0x5483ef[_0x25d2e9(0x12c)]=_0x33aa46;else!_0x5483ef[_0x25d2e9(0x12c)]&&(_0x5483ef[_0x25d2e9(0x12c)]=DEFAULT_CONFIG_VALUES['env']);const _0x2fe1f7=buildCanonicalAppConfig(appCodes,_0x5483ef[_0x25d2e9(0x12c)]);return Object[_0x25d2e9(0x123)](_0x2fe1f7)[_0x25d2e9(0x112)]>0x0&&(_0x5483ef[_0x25d2e9(0x135)]=_0x2fe1f7[_0x25d2e9(0x135)],_0x5483ef[_0x25d2e9(0x129)]=_0x2fe1f7[_0x25d2e9(0x129)]),_0x5483ef;}const LOCALE_MAP={'zh':'zh-CN','zh-cn':a171_0x23a0e8(0x126),'zh_cn':a171_0x23a0e8(0x126),'en':a171_0x23a0e8(0x117),'en-us':a171_0x23a0e8(0x117),'en_us':a171_0x23a0e8(0x117)};export function normalizeLocale(_0x1f403d){const _0x222049=a171_0x23a0e8;if(!_0x1f403d)return null;return LOCALE_MAP[_0x1f403d[_0x222049(0x12a)]()]??null;}
|
package/lib/constant/cdn.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a172_0x279806=a172_0x311f;function a172_0x311f(_0x2ee45b,_0x13ddb6){_0x2ee45b=_0x2ee45b-0x150;const _0x517a7e=a172_0x517a();let _0x311fc0=_0x517a7e[_0x2ee45b];return _0x311fc0;}function a172_0x517a(){const _0x2fa681=['10wNhZhT','1053012FILEvV','1540tNUWku','2161570HGdFjB','8kwsxpT','2240792yzCxzK','236199hXnOQw','9bAJKUd','https://g.lovrabet.com/dist/rabetbase-cli/config/index.json','2408658kkEzdW','12504vtCpyd','6QCmtFz','2487144aobwqZ'];a172_0x517a=function(){return _0x2fa681;};return a172_0x517a();}(function(_0x53af68,_0x970cc5){const _0x21acb4=a172_0x311f,_0x5a0108=_0x53af68();while(!![]){try{const _0x396a12=parseInt(_0x21acb4(0x151))/0x1+parseInt(_0x21acb4(0x15b))/0x2*(parseInt(_0x21acb4(0x156))/0x3)+parseInt(_0x21acb4(0x155))/0x4*(-parseInt(_0x21acb4(0x150))/0x5)+parseInt(_0x21acb4(0x15c))/0x6+parseInt(_0x21acb4(0x159))/0x7*(parseInt(_0x21acb4(0x154))/0x8)+parseInt(_0x21acb4(0x157))/0x9*(-parseInt(_0x21acb4(0x153))/0xa)+parseInt(_0x21acb4(0x152))/0xb*(-parseInt(_0x21acb4(0x15a))/0xc);if(_0x396a12===_0x970cc5)break;else _0x5a0108['push'](_0x5a0108['shift']());}catch(_0x16846b){_0x5a0108['push'](_0x5a0108['shift']());}}}(a172_0x517a,0x8a094));export const CLI_VERSION_POLICY_URL=a172_0x279806(0x158);
|