@lovrabet/rabetbase-cli 2.3.8 → 2.3.9-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/api-doc.js +1 -1
- package/lib/api/fetch-model-list.js +1 -1
- package/lib/api/generate-api-file.js +1 -1
- package/lib/auth/auth-server-ui.js +1 -1
- package/lib/auth/auth-server.js +1 -1
- package/lib/auth/constant.js +1 -1
- package/lib/auth/get-cookie.js +1 -1
- package/lib/auth/get-session-user.js +1 -1
- package/lib/auth/is-session-valid.js +1 -1
- package/lib/auth/login-success-html.js +1 -1
- package/lib/auth/logout.js +1 -1
- package/lib/cli-flags.js +1 -1
- package/lib/cli.js +1 -1
- package/lib/commands/api/generate.js +1 -1
- package/lib/commands/api/index.js +1 -1
- package/lib/commands/api/list.js +1 -1
- package/lib/commands/api/pull.js +1 -1
- package/lib/commands/api/shared.js +1 -1
- package/lib/commands/app/add.js +1 -1
- package/lib/commands/app/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
|
-
const
|
|
1
|
+
const a158_0x655f9a=a158_0x545f;(function(_0x25f8a6,_0x218b7a){const _0x27ecab=a158_0x545f,_0xdce7ea=_0x25f8a6();while(!![]){try{const _0x428bf7=-parseInt(_0x27ecab(0x1e7))/0x1*(parseInt(_0x27ecab(0x1ea))/0x2)+parseInt(_0x27ecab(0x1e9))/0x3*(-parseInt(_0x27ecab(0x1ef))/0x4)+-parseInt(_0x27ecab(0x1f1))/0x5*(-parseInt(_0x27ecab(0x1fe))/0x6)+parseInt(_0x27ecab(0x1f5))/0x7+parseInt(_0x27ecab(0x1fb))/0x8+-parseInt(_0x27ecab(0x1fa))/0x9+-parseInt(_0x27ecab(0x1f2))/0xa*(parseInt(_0x27ecab(0x1f0))/0xb);if(_0x428bf7===_0x218b7a)break;else _0xdce7ea['push'](_0xdce7ea['shift']());}catch(_0x4409d7){_0xdce7ea['push'](_0xdce7ea['shift']());}}}(a158_0x57aa,0x6eaa1));import{getSqlQueryInfo}from'../../core/api-client.js';function a158_0x545f(_0x3b7b52,_0xe9f9d4){_0x3b7b52=_0x3b7b52-0x1e7;const _0x57aad6=a158_0x57aa();let _0x545f44=_0x57aad6[_0x3b7b52];return _0x545f44;}import{getDbName}from'../../core/db-resolver.js';function a158_0x57aa(){const _0x42efa4=['88gdWfWf','appCode','679845hdkDKG','492lmEnFo','sqlName','sqlContent','sql','sqlCode','4qQrHoV','3597418ZMMhxp','235vKzPsf','40WlAzZd','boolean','read','4375049sjaedK','dbId','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','bool','Return\x20full\x20raw\x20SQL\x20query\x20object','220491pSjCav','5252616GBqKth','sqlcode','str','96078TYYvGT'];a158_0x57aa=function(){return _0x42efa4;};return a158_0x57aa();}import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':a158_0x655f9a(0x1ed),'command':'detail','description':a158_0x655f9a(0x1f7),'risk':a158_0x655f9a(0x1f4),'flags':[SQLCODE_FLAG,{'name':'verbose','type':a158_0x655f9a(0x1f3),'description':a158_0x655f9a(0x1f9)}],async 'execute'(_0xe88f5f){const _0x335c22=a158_0x655f9a,_0x4bc64b=await getSqlQueryInfo(_0xe88f5f[_0x335c22(0x1e8)],_0xe88f5f[_0x335c22(0x1fd)](_0x335c22(0x1fc))),_0x1d275f=_0xe88f5f[_0x335c22(0x1f8)]('verbose');if(_0x1d275f)return{'ok':!![],'data':_0x4bc64b};const _0x3b71c2=_0x4bc64b[_0x335c22(0x1f6)]?await getDbName(_0xe88f5f[_0x335c22(0x1e8)],_0x4bc64b[_0x335c22(0x1f6)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x4bc64b[_0x335c22(0x1ee)],'sqlName':_0x4bc64b[_0x335c22(0x1eb)],'db':_0x3b71c2?_0x3b71c2+'\x20('+_0x4bc64b[_0x335c22(0x1f6)]+')':_0x4bc64b['dbId']??'','description':_0x4bc64b['description']??'','sqlContent':_0x4bc64b[_0x335c22(0x1ec)]??''}};}};
|
package/lib/commands/sql/exec.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a159_0x4fd2(){const _0x41e75e=['Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','693TASPQH','appCode','exec','2446446FSFaPv','168590kPnUmR','20hmavBn','params','str','2lfkzfL','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','execSuccess','456975zTXisB','now','execResult','658180hrQVlk','12624eqeBQl','512073MiIXZP','SQL\x20execution\x20failed','sql','string','sqlcode','167022ccQgeN','read','Returned\x20','1246vLfzri'];a159_0x4fd2=function(){return _0x41e75e;};return a159_0x4fd2();}const a159_0x5031d3=a159_0x2a21;function a159_0x2a21(_0x2b2062,_0x5638cf){_0x2b2062=_0x2b2062-0xc8;const _0x4fd20b=a159_0x4fd2();let _0x2a2169=_0x4fd20b[_0x2b2062];return _0x2a2169;}(function(_0xa4a427,_0x7f3ebf){const _0xbcd4cd=a159_0x2a21,_0x5031da=_0xa4a427();while(!![]){try{const _0x1486b2=parseInt(_0xbcd4cd(0xcf))/0x1*(parseInt(_0xbcd4cd(0xe1))/0x2)+parseInt(_0xbcd4cd(0xca))/0x3+-parseInt(_0xbcd4cd(0xde))/0x4*(parseInt(_0xbcd4cd(0xcd))/0x5)+-parseInt(_0xbcd4cd(0xdc))/0x6+parseInt(_0xbcd4cd(0xd7))/0x7*(-parseInt(_0xbcd4cd(0xce))/0x8)+-parseInt(_0xbcd4cd(0xd4))/0x9+parseInt(_0xbcd4cd(0xdd))/0xa*(parseInt(_0xbcd4cd(0xd9))/0xb);if(_0x1486b2===_0x7f3ebf)break;else _0x5031da['push'](_0x5031da['shift']());}catch(_0xfbd674){_0x5031da['push'](_0x5031da['shift']());}}}(a159_0x4fd2,0x582c0));import{executeSql}from'../../core/api-client.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';import{parseJsonParams}from'../../utils/params.js';export const sqlExec={'service':a159_0x5031d3(0xd1),'command':a159_0x5031d3(0xdb),'description':a159_0x5031d3(0xd8),'risk':a159_0x5031d3(0xd5),'flags':[SQLCODE_FLAG,{'name':'params','type':a159_0x5031d3(0xd2),'description':a159_0x5031d3(0xc8)}],async 'execute'(_0x4829f6){const _0x20e200=a159_0x5031d3,_0x4aa09a=parseJsonParams(_0x4829f6[_0x20e200(0xe0)](_0x20e200(0xdf))),_0x3dd180=Date[_0x20e200(0xcb)](),_0x540db9=await executeSql(_0x4829f6[_0x20e200(0xda)],_0x4829f6['str'](_0x20e200(0xd3)),_0x4aa09a),_0x37621c=Date[_0x20e200(0xcb)]()-_0x3dd180,_0x32069c=_0x540db9?.[_0x20e200(0xcc)]??_0x540db9,_0x35f37c=_0x540db9?.[_0x20e200(0xc9)]??!![];if(!_0x35f37c)return{'ok':![],'data':{'error':_0x540db9?.['execError']||_0x20e200(0xd0),'elapsed':_0x37621c},'message':_0x20e200(0xd0)};const _0x438faf=Array['isArray'](_0x32069c)?_0x32069c:[];return{'ok':!![],'data':{'rows':_0x438faf,'rowCount':_0x438faf['length'],'elapsed':_0x37621c},'message':_0x20e200(0xd6)+_0x438faf['length']+'\x20row(s)\x20in\x20'+_0x37621c+'ms'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x525047,_0x20d1aa){const _0x4078e9=a160_0x42d6,_0x1dac95=_0x525047();while(!![]){try{const _0x4d21fb=parseInt(_0x4078e9(0xce))/0x1*(-parseInt(_0x4078e9(0xca))/0x2)+parseInt(_0x4078e9(0xc8))/0x3*(parseInt(_0x4078e9(0xc4))/0x4)+-parseInt(_0x4078e9(0xcd))/0x5*(parseInt(_0x4078e9(0xc9))/0x6)+-parseInt(_0x4078e9(0xcb))/0x7*(-parseInt(_0x4078e9(0xcc))/0x8)+parseInt(_0x4078e9(0xc6))/0x9*(-parseInt(_0x4078e9(0xc7))/0xa)+parseInt(_0x4078e9(0xc2))/0xb+parseInt(_0x4078e9(0xc5))/0xc*(parseInt(_0x4078e9(0xc3))/0xd);if(_0x4d21fb===_0x20d1aa)break;else _0x1dac95['push'](_0x1dac95['shift']());}catch(_0x97fdaa){_0x1dac95['push'](_0x1dac95['shift']());}}}(a160_0x5846,0xac2fa));import{sqlList}from'../../commands/sql/list.js';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';function a160_0x42d6(_0x14d6d2,_0x25aa39){_0x14d6d2=_0x14d6d2-0xc2;const _0x584690=a160_0x5846();let _0x42d6ff=_0x584690[_0x14d6d2];return _0x42d6ff;}import{sqlDelete}from'../../commands/sql/delete.js';function a160_0x5846(){const _0xc448f1=['4997484XUDoVZ','5580531oPpOPo','10GQQxkk','2043NmDKxc','6wHohrf','6YoMYZe','7WXZxZC','8658536dciIec','4555015vdvigg','398901socJyQ','1455168OnouIz','39MbyhnH','5692odETfZ'];a160_0x5846=function(){return _0xc448f1;};return a160_0x5846();}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_0x1c4230=a161_0x38b5;(function(_0x153008,_0x1a48dd){const _0x3dd33d=a161_0x38b5,_0x30d89f=_0x153008();while(!![]){try{const _0x4d6009=-parseInt(_0x3dd33d(0x1d5))/0x1*(-parseInt(_0x3dd33d(0x1cd))/0x2)+parseInt(_0x3dd33d(0x1c9))/0x3+-parseInt(_0x3dd33d(0x1da))/0x4*(-parseInt(_0x3dd33d(0x1c6))/0x5)+-parseInt(_0x3dd33d(0x1dd))/0x6+-parseInt(_0x3dd33d(0x1df))/0x7+-parseInt(_0x3dd33d(0x1ce))/0x8*(parseInt(_0x3dd33d(0x1cb))/0x9)+parseInt(_0x3dd33d(0x1de))/0xa;if(_0x4d6009===_0x1a48dd)break;else _0x30d89f['push'](_0x30d89f['shift']());}catch(_0x2af48d){_0x30d89f['push'](_0x30d89f['shift']());}}}(a161_0x4295,0x9ac26));import{listSqlQueries}from'../../core/api-client.js';function a161_0x38b5(_0x2b0f44,_0x3b86af){_0x2b0f44=_0x2b0f44-0x1c6;const _0x4295be=a161_0x4295();let _0x38b5aa=_0x4295be[_0x2b0f44];return _0x38b5aa;}import{getDbName}from'../../core/db-resolver.js';function a161_0x4295(){const _0x274508=['tableData','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','verbose','name','description','read','Filter\x20by\x20SQL\x20name','List\x20custom\x20SQL\x20queries','165JeHvrA','num','boolean','1537578KKFWav','str','249273TETTkY','sqlcode','4704bDVcjy','80MLwTZk','totalCount','appCode','Found\x20','sqlCode','string','sql','139LFuuNn','length','all','pagesize','dbId','101128iQniic','page','paging','5857410yPIwmk','8209850ZQAunJ','4253522zenpQe'];a161_0x4295=function(){return _0x274508;};return a161_0x4295();}import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':a161_0x1c4230(0x1d4),'command':'list','description':a161_0x1c4230(0x1e7),'risk':a161_0x1c4230(0x1e5),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a161_0x1c4230(0x1e3),'type':a161_0x1c4230(0x1d3),'description':a161_0x1c4230(0x1e6)},{'name':a161_0x1c4230(0x1db),'type':'number','description':'Page\x20number','default':0x1},{'name':a161_0x1c4230(0x1d8),'type':'number','description':'Page\x20size'},{'name':a161_0x1c4230(0x1e2),'type':a161_0x1c4230(0x1c8),'description':a161_0x1c4230(0x1e1)}],async 'execute'(_0x1b8fb1){const _0xd19b74=a161_0x1c4230,_0x2f0997=await listSqlQueries(_0x1b8fb1[_0xd19b74(0x1d0)],{'sqlCode':_0x1b8fb1[_0xd19b74(0x1ca)](_0xd19b74(0x1cc))||undefined,'sqlName':_0x1b8fb1[_0xd19b74(0x1ca)](_0xd19b74(0x1e3))||undefined,'currentPage':_0x1b8fb1[_0xd19b74(0x1c7)](_0xd19b74(0x1db)),'pageSize':_0x1b8fb1[_0xd19b74(0x1c7)](_0xd19b74(0x1d8),0x32)}),_0x5a5cdf=_0x1b8fb1['bool']('verbose'),_0x3cb29b=_0x2f0997[_0xd19b74(0x1e0)]??[],_0x2628b1=_0x2f0997[_0xd19b74(0x1dc)]?.[_0xd19b74(0x1cf)]??_0x3cb29b[_0xd19b74(0x1d6)];let _0x32a160;return _0x5a5cdf?_0x32a160=_0x3cb29b:_0x32a160=await Promise[_0xd19b74(0x1d7)](_0x3cb29b['map'](async _0x53de65=>{const _0x493e26=_0xd19b74;let _0x4747ea;try{_0x4747ea=_0x53de65[_0x493e26(0x1d9)]?await getDbName(_0x1b8fb1[_0x493e26(0x1d0)],_0x53de65['dbId']):undefined;}catch{}return{'sqlCode':_0x53de65[_0x493e26(0x1d2)],'sqlName':_0x53de65['sqlName'],'description':_0x53de65[_0x493e26(0x1e4)]??'','db':_0x4747ea?_0x4747ea+'\x20('+_0x53de65[_0x493e26(0x1d9)]+')':_0x53de65[_0x493e26(0x1d9)]??''};})),{'ok':!![],'data':_0x32a160,'message':_0x3cb29b[_0xd19b74(0x1d6)]===0x0?'No\x20custom\x20SQL\x20queries\x20found.':_0xd19b74(0x1d1)+_0x3cb29b[_0xd19b74(0x1d6)]+'\x20SQL\x20queries\x20(total:\x20'+_0x2628b1+').'};}};
|
package/lib/commands/sql/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a162_0x10d41e=a162_0x5ece;(function(_0x426bce,_0x2c2cd9){const _0x47836b=a162_0x5ece,_0x195df2=_0x426bce();while(!![]){try{const _0x338955=parseInt(_0x47836b(0x131))/0x1+-parseInt(_0x47836b(0x126))/0x2+-parseInt(_0x47836b(0x120))/0x3*(parseInt(_0x47836b(0x136))/0x4)+parseInt(_0x47836b(0x138))/0x5+parseInt(_0x47836b(0x134))/0x6+-parseInt(_0x47836b(0x146))/0x7+-parseInt(_0x47836b(0x114))/0x8*(-parseInt(_0x47836b(0x113))/0x9);if(_0x338955===_0x2c2cd9)break;else _0x195df2['push'](_0x195df2['shift']());}catch(_0x3d231f){_0x195df2['push'](_0x195df2['shift']());}}}(a162_0x3124,0x6a639));import{readFile,rm,writeFile}from'node:fs/promises';function a162_0x3124(){const _0x5a8efa=['sqls','lastSync','18798apYYBr','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','filter','2282628EiWmgq','sqlRoot','12076mPwdcl','trimStart','4088715ckQNGf','str','nonInteractive','join','force','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','replace','Force\x20pull\x20cancelled.','sqlContent','sql','\x20skipped,\x20','would_pull','sqlRootDir','5917681fHbblK','No\x20remote\x20SQL\x20queries\x20matched.','length','sqlCode','sqlcode','sqlName','toISOString','Filter\x20by\x20SQL\x20display\x20name','9kBNaeE','4296752ieBcZZ','push','mybatisXml','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','tableData','test','bool','\x20SQL\x20file(s)\x20into\x20','description','local\x20differs\x20from\x20remote','utf8','appCode','264oLwNid','skipped','path','Would\x20pull\x20','POST','unchanged','414498YHYcIS','message','name','catch','string','dbId','apps','pull','lockFilePath'];a162_0x3124=function(){return _0x5a8efa;};return a162_0x3124();}import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x5beabb,_0x506b81){const _0x39e5ce=a162_0x5ece,_0x43382a=[];let _0x558f37=0x1;while(!![]){const _0x2feed1=await listSqlQueries(_0x5beabb,{'currentPage':_0x558f37,'pageSize':PAGE_SIZE,'sqlCode':_0x506b81[_0x39e5ce(0x10e)],'sqlName':_0x506b81['sqlName']}),_0x282bb4=_0x2feed1[_0x39e5ce(0x118)]??[];_0x43382a[_0x39e5ce(0x115)](..._0x282bb4);if(_0x282bb4['length']===0x0)break;const _0x17c501=_0x2feed1['paging']?.['totalCount'];if(_0x17c501!=null?_0x43382a[_0x39e5ce(0x10d)]>=_0x17c501:_0x282bb4['length']<PAGE_SIZE)break;_0x558f37++;}return _0x43382a;}function a162_0x5ece(_0x241a77,_0x5d9c5a){_0x241a77=_0x241a77-0x10d;const _0x3124f5=a162_0x3124();let _0x5ece62=_0x3124f5[_0x241a77];return _0x5ece62;}async function ensureSqlContent(_0x454b5f){const _0x36452a=a162_0x5ece;if(_0x454b5f[_0x36452a(0x141)]!=null&&String(_0x454b5f[_0x36452a(0x141)])['length']>0x0)return _0x454b5f;return getSqlQueryDetail(_0x454b5f[_0x36452a(0x10e)]);}export const sqlPull={'service':a162_0x10d41e(0x142),'command':a162_0x10d41e(0x12d),'description':a162_0x10d41e(0x13e),'risk':'write','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a162_0x10d41e(0x128),'type':a162_0x10d41e(0x12a),'description':a162_0x10d41e(0x112)},{'name':a162_0x10d41e(0x13c),'type':'boolean','description':'Force\x20overwrite\x20local\x20unsynced\x20changes'}],async 'dryRun'(_0x185a77){const _0x124de8=a162_0x10d41e,_0x213e04=loadSqlProjectConfig(_0x185a77[_0x124de8(0x11f)]),_0x3e9507=await readSqlLockFile(_0x213e04[_0x124de8(0x12e)]),{appLock:_0x50125f}=ensureSqlLockScope(_0x3e9507??createEmptySqlLock(),_0x213e04[_0x124de8(0x11f)],_0x213e04[_0x124de8(0x135)],_0x124de8(0x12d)),_0x3ced3f=await fetchAllSqlQueries(_0x185a77[_0x124de8(0x11f)],{'sqlCode':_0x185a77['str']('sqlcode')||undefined,'sqlName':_0x185a77[_0x124de8(0x139)](_0x124de8(0x128))||undefined}),_0x16b2d5=[];for(const _0x4c207a of _0x3ced3f){const _0x38cfde=await ensureSqlContent(_0x4c207a),_0x31f782=ensureRemoteSqlContent(_0x38cfde),_0x247d9a=detectModeFromSql(_0x38cfde),_0x1818f8=_0x38cfde[_0x124de8(0x12b)]?await getDbName(_0x185a77[_0x124de8(0x11f)],Number(_0x38cfde[_0x124de8(0x12b)]))[_0x124de8(0x129)](()=>undefined):undefined,_0x3c9a74=buildLocalSqlFileContent({'sqlCode':_0x38cfde['sqlCode'],'sqlName':_0x38cfde[_0x124de8(0x110)],'dbId':_0x38cfde[_0x124de8(0x12b)]},_0x31f782,{'dbName':_0x1818f8,'mode':_0x247d9a,'syncedAt':new Date()['toISOString'](),'description':_0x38cfde[_0x124de8(0x11c)]}),_0x166a08=buildSqlLockEntry(_0x38cfde,_0x31f782,'',{'dbName':_0x1818f8}),_0x542278=resolveLocalSqlFilePath(_0x213e04,_0x38cfde['sqlCode'],_0x166a08);let _0x3c55a7=_0x124de8(0x144),_0x28c33d;if(await fileExists(_0x542278)){const _0x4a0985=await readFile(_0x542278,_0x124de8(0x11e));isEquivalentPulledSqlFile(_0x4a0985,_0x3c9a74,_0x247d9a)?(_0x3c55a7=_0x124de8(0x121),_0x28c33d=_0x124de8(0x125)):(_0x3c55a7='conflict',_0x28c33d=_0x124de8(0x13d));}_0x16b2d5['push']({'sqlCode':_0x38cfde[_0x124de8(0x10e)],'sqlName':_0x38cfde[_0x124de8(0x110)],'filePath':_0x542278,'status':_0x3c55a7,'reason':_0x28c33d});}return{'method':_0x124de8(0x124),'url':_0x124de8(0x132),'body':{'appCode':_0x185a77['appCode'],'sqlCode':_0x185a77[_0x124de8(0x139)](_0x124de8(0x10f))||null,'sqlName':_0x185a77[_0x124de8(0x139)](_0x124de8(0x128))||null,'files':_0x16b2d5},'description':_0x124de8(0x123)+_0x16b2d5[_0x124de8(0x10d)]+_0x124de8(0x11b)+_0x213e04[_0x124de8(0x145)]};},async 'execute'(_0x621c2f){const _0x2b6ffb=a162_0x10d41e,_0x5f0674=loadSqlProjectConfig(_0x621c2f[_0x2b6ffb(0x11f)]),_0x44c603=await readSqlLockFile(_0x5f0674[_0x2b6ffb(0x12e)]),{lockData:_0x485788,appLock:_0x56a66e}=ensureSqlLockScope(_0x44c603??createEmptySqlLock(),_0x5f0674[_0x2b6ffb(0x11f)],_0x5f0674[_0x2b6ffb(0x135)],_0x2b6ffb(0x12d)),_0x2b3dfb=_0x621c2f[_0x2b6ffb(0x11a)](_0x2b6ffb(0x13c)),_0x50b5fa=await fetchAllSqlQueries(_0x621c2f[_0x2b6ffb(0x11f)],{'sqlCode':_0x621c2f[_0x2b6ffb(0x139)]('sqlcode')||undefined,'sqlName':_0x621c2f[_0x2b6ffb(0x139)](_0x2b6ffb(0x128))||undefined});if(_0x50b5fa[_0x2b6ffb(0x10d)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x2b6ffb(0x147)};const _0x15992f=[],_0x3155d7=[];for(const _0x5988e0 of _0x50b5fa){try{_0x15992f[_0x2b6ffb(0x115)](await ensureSqlContent(_0x5988e0));}catch(_0x413f59){_0x3155d7[_0x2b6ffb(0x115)]({'sqlCode':_0x5988e0[_0x2b6ffb(0x10e)],'error':_0x413f59 instanceof Error?_0x413f59[_0x2b6ffb(0x127)]:String(_0x413f59)});}}if(_0x2b3dfb&&!_0x621c2f[_0x2b6ffb(0x13a)]){let _0x94c450=![];for(const _0x586e5d of _0x15992f){const _0x18a249=detectModeFromSql(_0x586e5d),_0x5108fb=_0x586e5d[_0x2b6ffb(0x12b)]?await getDbName(_0x621c2f[_0x2b6ffb(0x11f)],Number(_0x586e5d[_0x2b6ffb(0x12b)]))[_0x2b6ffb(0x129)](()=>undefined):undefined,_0x38118d=buildLocalSqlFileContent({'sqlCode':_0x586e5d['sqlCode'],'sqlName':_0x586e5d[_0x2b6ffb(0x110)],'dbId':_0x586e5d[_0x2b6ffb(0x12b)]},ensureRemoteSqlContent(_0x586e5d),{'dbName':_0x5108fb,'mode':_0x18a249,'syncedAt':new Date()[_0x2b6ffb(0x111)](),'description':_0x586e5d[_0x2b6ffb(0x11c)]}),_0x45c5d1=resolveLocalSqlFilePath(_0x5f0674,_0x586e5d[_0x2b6ffb(0x10e)],buildSqlLockEntry(_0x586e5d,ensureRemoteSqlContent(_0x586e5d),'',{'dbName':_0x5108fb}));if(await fileExists(_0x45c5d1)){const _0x5adb96=await readFile(_0x45c5d1,_0x2b6ffb(0x11e));if(!isEquivalentPulledSqlFile(_0x5adb96,_0x38118d,_0x18a249)){_0x94c450=!![];break;}}}if(_0x94c450){const _0x5a7e6b=await confirmForceOverwrite(_0x2b6ffb(0x117));if(!_0x5a7e6b)throw CliErrors['cancelled'](_0x2b6ffb(0x140));}}const _0x4e54f4=cloneSqlLockData(_0x485788),_0x58565c=_0x4e54f4[_0x2b6ffb(0x12c)][_0x5f0674[_0x2b6ffb(0x11f)]],_0x37d820=[],_0x1e840d=[];for(const _0x930450 of _0x15992f){const _0x21e7e5=_0x58565c[_0x2b6ffb(0x12f)][_0x930450[_0x2b6ffb(0x10e)]],_0x5923a7=ensureRemoteSqlContent(_0x930450),_0x20752b=detectModeFromSql(_0x930450),_0x4fac42=_0x930450[_0x2b6ffb(0x12b)]?await getDbName(_0x621c2f[_0x2b6ffb(0x11f)],Number(_0x930450[_0x2b6ffb(0x12b)]))['catch'](()=>undefined):undefined,_0x3078ad=buildLocalSqlFileContent({'sqlCode':_0x930450[_0x2b6ffb(0x10e)],'sqlName':_0x930450[_0x2b6ffb(0x110)],'dbId':_0x930450[_0x2b6ffb(0x12b)]},_0x5923a7,{'dbName':_0x4fac42,'mode':_0x20752b,'syncedAt':new Date()['toISOString'](),'description':_0x930450[_0x2b6ffb(0x11c)]}),_0x1e9f2d=buildSqlLockEntry(_0x930450,_0x5923a7,computeSqlContentHash(_0x3078ad),{'dbName':_0x4fac42}),_0x585c0c=_0x1e9f2d[_0x2b6ffb(0x122)],_0x1d3496=join(_0x5f0674[_0x2b6ffb(0x145)],_0x585c0c);try{if(await fileExists(_0x1d3496)){const _0xbb2d75=await readFile(_0x1d3496,_0x2b6ffb(0x11e));if(isEquivalentPulledSqlFile(_0xbb2d75,_0x3078ad,_0x20752b)){_0x1e840d['push']({'sqlCode':_0x930450[_0x2b6ffb(0x10e)],'reason':_0x2b6ffb(0x125)}),_0x58565c['sqls'][_0x930450['sqlCode']]={..._0x1e9f2d,'hash':computeSqlContentHash(_0xbb2d75),'path':_0x585c0c};continue;}if(!_0x2b3dfb){_0x1e840d['push']({'sqlCode':_0x930450[_0x2b6ffb(0x10e)],'reason':_0x2b6ffb(0x11d)});continue;}}const _0x509b1a=_0x21e7e5?.[_0x2b6ffb(0x122)]?join(_0x5f0674[_0x2b6ffb(0x145)],_0x21e7e5[_0x2b6ffb(0x122)]):undefined;_0x509b1a&&_0x509b1a!==_0x1d3496&&await fileExists(_0x509b1a)&&await rm(_0x509b1a,{'force':!![]}),await ensureParentDirectory(_0x1d3496),await writeFile(_0x1d3496,_0x3078ad,_0x2b6ffb(0x11e)),_0x58565c[_0x2b6ffb(0x12f)][_0x930450[_0x2b6ffb(0x10e)]]={..._0x1e9f2d,'path':_0x585c0c},_0x37d820[_0x2b6ffb(0x115)]({'sqlCode':_0x930450[_0x2b6ffb(0x10e)],'filePath':_0x1d3496});}catch(_0x5d9de1){_0x3155d7[_0x2b6ffb(0x115)]({'sqlCode':_0x930450[_0x2b6ffb(0x10e)],'error':_0x5d9de1 instanceof Error?_0x5d9de1['message']:String(_0x5d9de1)});}}return _0x58565c[_0x2b6ffb(0x130)]=new Date()[_0x2b6ffb(0x111)](),await writeSqlLockFile(_0x5f0674['lockFilePath'],_0x4e54f4),{'ok':_0x3155d7[_0x2b6ffb(0x10d)]===0x0,'data':{'pulled':_0x37d820,'skipped':_0x1e840d,'failed':_0x3155d7},'message':'Pull\x20complete:\x20'+_0x37d820['length']+'\x20written,\x20'+_0x1e840d['length']+_0x2b6ffb(0x143)+_0x3155d7[_0x2b6ffb(0x10d)]+'\x20failed'};}};function detectModeFromSql(_0x419646){const _0x7b7deb=a162_0x10d41e,_0x127ee7=ensureRemoteSqlContent(_0x419646),_0x14cc31=stripLocalSqlMetadata(_0x127ee7,_0x7b7deb(0x116))[_0x7b7deb(0x137)]();if(/^<(select|insert|update|delete)\b/i[_0x7b7deb(0x119)](_0x14cc31))return _0x7b7deb(0x116);return _0x7b7deb(0x142);}function isEquivalentPulledSqlFile(_0x39f4b1,_0x27d94d,_0x4270e3){return normalizePullComparableContent(_0x39f4b1,_0x4270e3)===normalizePullComparableContent(_0x27d94d,_0x4270e3);}function normalizePullComparableContent(_0x3ed0f4,_0x9f82a0){const _0x39f92d=a162_0x10d41e,_0x5dc99d=_0x3ed0f4[_0x39f92d(0x13f)](/\r\n/g,'\x0a')['split']('\x0a'),_0x3d8c67=_0x5dc99d[_0x39f92d(0x133)](_0xc09799=>!isSyncedAtMetadataLine(_0xc09799,_0x9f82a0));return _0x3d8c67[_0x39f92d(0x13b)]('\x0a');}function isSyncedAtMetadataLine(_0x67061f,_0x79e188){const _0x59d6a9=a162_0x10d41e;if(_0x79e188===_0x59d6a9(0x116))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x59d6a9(0x119)](_0x67061f);return/^\s*--\s*@lovrabet\.syncedAt:/['test'](_0x67061f);}
|
|
1
|
+
const a162_0x2a547e=a162_0x35e3;(function(_0x1b0447,_0x16df77){const _0xb85dd9=a162_0x35e3,_0x5cd78d=_0x1b0447();while(!![]){try{const _0x478b88=-parseInt(_0xb85dd9(0xb7))/0x1+-parseInt(_0xb85dd9(0xa9))/0x2+parseInt(_0xb85dd9(0xb0))/0x3+-parseInt(_0xb85dd9(0xc6))/0x4*(-parseInt(_0xb85dd9(0xaf))/0x5)+parseInt(_0xb85dd9(0xcf))/0x6+parseInt(_0xb85dd9(0x9a))/0x7*(parseInt(_0xb85dd9(0xb9))/0x8)+parseInt(_0xb85dd9(0xc3))/0x9*(-parseInt(_0xb85dd9(0xb2))/0xa);if(_0x478b88===_0x16df77)break;else _0x5cd78d['push'](_0x5cd78d['shift']());}catch(_0x21ee17){_0x5cd78d['push'](_0x5cd78d['shift']());}}}(a162_0x19a7,0x89e68));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';function a162_0x19a7(){const _0x373475=['str','appCode','length','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','1389438HAvyKe','tableData','nonInteractive','utf8','sql','\x20skipped,\x20','\x20SQL\x20file(s)\x20into\x20','560RVoOOV','lockFilePath','totalCount','\x20failed','conflict','message','push','trimStart','pull','catch','local\x20differs\x20from\x20remote','sqlCode','sqls','dbId','sqlRoot','324850oyibXs','mybatisXml','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','unchanged','force','skipped','170245SMPjmh','2415345XlNEXM','sqlcode','47930SSYTkt','test','write','No\x20remote\x20SQL\x20queries\x20matched.','Pull\x20complete:\x20','216095PZJfQH','\x20written,\x20','27704CjVzyO','string','cancelled','split','filter','sqlName','toISOString','description','sqlRootDir','path','1143RdXLaO','Filter\x20by\x20SQL\x20display\x20name','POST','28gyUOgH','name','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','lastSync','apps'];a162_0x19a7=function(){return _0x373475;};return a162_0x19a7();}const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x59e07f,_0x561fa8){const _0x111093=a162_0x35e3,_0x365a66=[];let _0x82c8df=0x1;while(!![]){const _0x1c1fbf=await listSqlQueries(_0x59e07f,{'currentPage':_0x82c8df,'pageSize':PAGE_SIZE,'sqlCode':_0x561fa8[_0x111093(0xa5)],'sqlName':_0x561fa8[_0x111093(0xbe)]}),_0x130591=_0x1c1fbf[_0x111093(0xd0)]??[];_0x365a66['push'](..._0x130591);if(_0x130591[_0x111093(0xcd)]===0x0)break;const _0x3d86bd=_0x1c1fbf['paging']?.[_0x111093(0x9c)];if(_0x3d86bd!=null?_0x365a66[_0x111093(0xcd)]>=_0x3d86bd:_0x130591[_0x111093(0xcd)]<PAGE_SIZE)break;_0x82c8df++;}return _0x365a66;}async function ensureSqlContent(_0x5a156b){const _0x371331=a162_0x35e3;if(_0x5a156b['sqlContent']!=null&&String(_0x5a156b['sqlContent'])[_0x371331(0xcd)]>0x0)return _0x5a156b;return getSqlQueryDetail(_0x5a156b[_0x371331(0xa5)]);}export const sqlPull={'service':a162_0x2a547e(0xd3),'command':a162_0x2a547e(0xa2),'description':a162_0x2a547e(0xab),'risk':a162_0x2a547e(0xb4),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a162_0x2a547e(0xc7),'type':a162_0x2a547e(0xba),'description':a162_0x2a547e(0xc4)},{'name':a162_0x2a547e(0xad),'type':'boolean','description':'Force\x20overwrite\x20local\x20unsynced\x20changes'}],async 'dryRun'(_0x308b49){const _0x4fe9a7=a162_0x2a547e,_0x24d759=loadSqlProjectConfig(_0x308b49[_0x4fe9a7(0xcc)]),_0x27653b=await readSqlLockFile(_0x24d759[_0x4fe9a7(0x9b)]),{appLock:_0x42c38b}=ensureSqlLockScope(_0x27653b??createEmptySqlLock(),_0x24d759[_0x4fe9a7(0xcc)],_0x24d759[_0x4fe9a7(0xa8)],_0x4fe9a7(0xa2)),_0x44722a=await fetchAllSqlQueries(_0x308b49[_0x4fe9a7(0xcc)],{'sqlCode':_0x308b49['str'](_0x4fe9a7(0xb1))||undefined,'sqlName':_0x308b49['str'](_0x4fe9a7(0xc7))||undefined}),_0x3867b7=[];for(const _0x4b374f of _0x44722a){const _0x5e7665=await ensureSqlContent(_0x4b374f),_0x503fa1=ensureRemoteSqlContent(_0x5e7665),_0xfef6f5=detectModeFromSql(_0x5e7665),_0xddff76=_0x5e7665[_0x4fe9a7(0xa7)]?await getDbName(_0x308b49[_0x4fe9a7(0xcc)],Number(_0x5e7665['dbId']))[_0x4fe9a7(0xa3)](()=>undefined):undefined,_0x28d050=buildLocalSqlFileContent({'sqlCode':_0x5e7665[_0x4fe9a7(0xa5)],'sqlName':_0x5e7665[_0x4fe9a7(0xbe)],'dbId':_0x5e7665['dbId']},_0x503fa1,{'dbName':_0xddff76,'mode':_0xfef6f5,'syncedAt':new Date()[_0x4fe9a7(0xbf)](),'description':_0x5e7665[_0x4fe9a7(0xc0)]}),_0x23fbd1=buildSqlLockEntry(_0x5e7665,_0x503fa1,'',{'dbName':_0xddff76}),_0x1a3e9b=resolveLocalSqlFilePath(_0x24d759,_0x5e7665[_0x4fe9a7(0xa5)],_0x23fbd1);let _0x19fb40='would_pull',_0x362d20;if(await fileExists(_0x1a3e9b)){const _0x26d5d4=await readFile(_0x1a3e9b,_0x4fe9a7(0xd2));isEquivalentPulledSqlFile(_0x26d5d4,_0x28d050,_0xfef6f5)?(_0x19fb40=_0x4fe9a7(0xae),_0x362d20=_0x4fe9a7(0xac)):(_0x19fb40=_0x4fe9a7(0x9e),_0x362d20='local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)');}_0x3867b7[_0x4fe9a7(0xa0)]({'sqlCode':_0x5e7665[_0x4fe9a7(0xa5)],'sqlName':_0x5e7665['sqlName'],'filePath':_0x1a3e9b,'status':_0x19fb40,'reason':_0x362d20});}return{'method':_0x4fe9a7(0xc5),'url':_0x4fe9a7(0xce),'body':{'appCode':_0x308b49[_0x4fe9a7(0xcc)],'sqlCode':_0x308b49[_0x4fe9a7(0xcb)](_0x4fe9a7(0xb1))||null,'sqlName':_0x308b49[_0x4fe9a7(0xcb)](_0x4fe9a7(0xc7))||null,'files':_0x3867b7},'description':'Would\x20pull\x20'+_0x3867b7[_0x4fe9a7(0xcd)]+_0x4fe9a7(0xd5)+_0x24d759[_0x4fe9a7(0xc1)]};},async 'execute'(_0x5eb5cc){const _0x25a10a=a162_0x2a547e,_0x4b1aa9=loadSqlProjectConfig(_0x5eb5cc['appCode']),_0x5e93b1=await readSqlLockFile(_0x4b1aa9[_0x25a10a(0x9b)]),{lockData:_0x35ef6e,appLock:_0x527ced}=ensureSqlLockScope(_0x5e93b1??createEmptySqlLock(),_0x4b1aa9[_0x25a10a(0xcc)],_0x4b1aa9[_0x25a10a(0xa8)],_0x25a10a(0xa2)),_0x383e3e=_0x5eb5cc['bool']('force'),_0x430aba=await fetchAllSqlQueries(_0x5eb5cc[_0x25a10a(0xcc)],{'sqlCode':_0x5eb5cc[_0x25a10a(0xcb)](_0x25a10a(0xb1))||undefined,'sqlName':_0x5eb5cc['str'](_0x25a10a(0xc7))||undefined});if(_0x430aba[_0x25a10a(0xcd)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x25a10a(0xb5)};const _0x5b0780=[],_0x25d772=[];for(const _0x4ce917 of _0x430aba){try{_0x5b0780['push'](await ensureSqlContent(_0x4ce917));}catch(_0x7644a2){_0x25d772['push']({'sqlCode':_0x4ce917[_0x25a10a(0xa5)],'error':_0x7644a2 instanceof Error?_0x7644a2['message']:String(_0x7644a2)});}}if(_0x383e3e&&!_0x5eb5cc[_0x25a10a(0xd1)]){let _0xb8a486=![];for(const _0x5cc3d3 of _0x5b0780){const _0x8d2924=detectModeFromSql(_0x5cc3d3),_0x4483c3=_0x5cc3d3[_0x25a10a(0xa7)]?await getDbName(_0x5eb5cc[_0x25a10a(0xcc)],Number(_0x5cc3d3[_0x25a10a(0xa7)]))[_0x25a10a(0xa3)](()=>undefined):undefined,_0x5624f2=buildLocalSqlFileContent({'sqlCode':_0x5cc3d3[_0x25a10a(0xa5)],'sqlName':_0x5cc3d3[_0x25a10a(0xbe)],'dbId':_0x5cc3d3['dbId']},ensureRemoteSqlContent(_0x5cc3d3),{'dbName':_0x4483c3,'mode':_0x8d2924,'syncedAt':new Date()['toISOString'](),'description':_0x5cc3d3['description']}),_0x1b7aeb=resolveLocalSqlFilePath(_0x4b1aa9,_0x5cc3d3[_0x25a10a(0xa5)],buildSqlLockEntry(_0x5cc3d3,ensureRemoteSqlContent(_0x5cc3d3),'',{'dbName':_0x4483c3}));if(await fileExists(_0x1b7aeb)){const _0x19b9f1=await readFile(_0x1b7aeb,_0x25a10a(0xd2));if(!isEquivalentPulledSqlFile(_0x19b9f1,_0x5624f2,_0x8d2924)){_0xb8a486=!![];break;}}}if(_0xb8a486){const _0x142955=await confirmForceOverwrite(_0x25a10a(0xc8));if(!_0x142955)throw CliErrors[_0x25a10a(0xbb)]('Force\x20pull\x20cancelled.');}}const _0x385563=cloneSqlLockData(_0x35ef6e),_0x1f05d6=_0x385563[_0x25a10a(0xca)][_0x4b1aa9['appCode']],_0x11c9cf=[],_0x3d48bb=[];for(const _0x1ae8c3 of _0x5b0780){const _0x5f42c4=_0x1f05d6[_0x25a10a(0xa6)][_0x1ae8c3[_0x25a10a(0xa5)]],_0x214c90=ensureRemoteSqlContent(_0x1ae8c3),_0x2f9c4a=detectModeFromSql(_0x1ae8c3),_0x2836ac=_0x1ae8c3[_0x25a10a(0xa7)]?await getDbName(_0x5eb5cc[_0x25a10a(0xcc)],Number(_0x1ae8c3['dbId']))[_0x25a10a(0xa3)](()=>undefined):undefined,_0x2d54fd=buildLocalSqlFileContent({'sqlCode':_0x1ae8c3[_0x25a10a(0xa5)],'sqlName':_0x1ae8c3[_0x25a10a(0xbe)],'dbId':_0x1ae8c3['dbId']},_0x214c90,{'dbName':_0x2836ac,'mode':_0x2f9c4a,'syncedAt':new Date()[_0x25a10a(0xbf)](),'description':_0x1ae8c3[_0x25a10a(0xc0)]}),_0x3daf6a=buildSqlLockEntry(_0x1ae8c3,_0x214c90,computeSqlContentHash(_0x2d54fd),{'dbName':_0x2836ac}),_0x4eca34=_0x3daf6a['path'],_0x59f5a7=join(_0x4b1aa9['sqlRootDir'],_0x4eca34);try{if(await fileExists(_0x59f5a7)){const _0x58f8ac=await readFile(_0x59f5a7,_0x25a10a(0xd2));if(isEquivalentPulledSqlFile(_0x58f8ac,_0x2d54fd,_0x2f9c4a)){_0x3d48bb[_0x25a10a(0xa0)]({'sqlCode':_0x1ae8c3[_0x25a10a(0xa5)],'reason':'unchanged'}),_0x1f05d6[_0x25a10a(0xa6)][_0x1ae8c3[_0x25a10a(0xa5)]]={..._0x3daf6a,'hash':computeSqlContentHash(_0x58f8ac),'path':_0x4eca34};continue;}if(!_0x383e3e){_0x3d48bb[_0x25a10a(0xa0)]({'sqlCode':_0x1ae8c3[_0x25a10a(0xa5)],'reason':_0x25a10a(0xa4)});continue;}}const _0x1fd97b=_0x5f42c4?.[_0x25a10a(0xc2)]?join(_0x4b1aa9[_0x25a10a(0xc1)],_0x5f42c4[_0x25a10a(0xc2)]):undefined;_0x1fd97b&&_0x1fd97b!==_0x59f5a7&&await fileExists(_0x1fd97b)&&await rm(_0x1fd97b,{'force':!![]}),await ensureParentDirectory(_0x59f5a7),await writeFile(_0x59f5a7,_0x2d54fd,_0x25a10a(0xd2)),_0x1f05d6[_0x25a10a(0xa6)][_0x1ae8c3[_0x25a10a(0xa5)]]={..._0x3daf6a,'path':_0x4eca34},_0x11c9cf['push']({'sqlCode':_0x1ae8c3[_0x25a10a(0xa5)],'filePath':_0x59f5a7});}catch(_0x40d628){_0x25d772[_0x25a10a(0xa0)]({'sqlCode':_0x1ae8c3[_0x25a10a(0xa5)],'error':_0x40d628 instanceof Error?_0x40d628[_0x25a10a(0x9f)]:String(_0x40d628)});}}return _0x1f05d6[_0x25a10a(0xc9)]=new Date()[_0x25a10a(0xbf)](),await writeSqlLockFile(_0x4b1aa9['lockFilePath'],_0x385563),{'ok':_0x25d772[_0x25a10a(0xcd)]===0x0,'data':{'pulled':_0x11c9cf,'skipped':_0x3d48bb,'failed':_0x25d772},'message':_0x25a10a(0xb6)+_0x11c9cf[_0x25a10a(0xcd)]+_0x25a10a(0xb8)+_0x3d48bb[_0x25a10a(0xcd)]+_0x25a10a(0xd4)+_0x25d772[_0x25a10a(0xcd)]+_0x25a10a(0x9d)};}};function a162_0x35e3(_0x513578,_0x40dcdc){_0x513578=_0x513578-0x9a;const _0x19a780=a162_0x19a7();let _0x35e319=_0x19a780[_0x513578];return _0x35e319;}function detectModeFromSql(_0x5b0a36){const _0x3e6847=a162_0x2a547e,_0x3f10c9=ensureRemoteSqlContent(_0x5b0a36),_0x5e5655=stripLocalSqlMetadata(_0x3f10c9,_0x3e6847(0xaa))[_0x3e6847(0xa1)]();if(/^<(select|insert|update|delete)\b/i[_0x3e6847(0xb3)](_0x5e5655))return'mybatisXml';return _0x3e6847(0xd3);}function isEquivalentPulledSqlFile(_0xd9e965,_0x455b91,_0x6b2b14){return normalizePullComparableContent(_0xd9e965,_0x6b2b14)===normalizePullComparableContent(_0x455b91,_0x6b2b14);}function normalizePullComparableContent(_0x96d904,_0x1dd9a0){const _0x573244=a162_0x2a547e,_0x33bcbf=_0x96d904['replace'](/\r\n/g,'\x0a')[_0x573244(0xbc)]('\x0a'),_0x4b9987=_0x33bcbf[_0x573244(0xbd)](_0x196110=>!isSyncedAtMetadataLine(_0x196110,_0x1dd9a0));return _0x4b9987['join']('\x0a');}function isSyncedAtMetadataLine(_0x5db16c,_0x1496dd){const _0x4a7ddc=a162_0x2a547e;if(_0x1496dd===_0x4a7ddc(0xaa))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x4a7ddc(0xb3)](_0x5db16c);return/^\s*--\s*@lovrabet\.syncedAt:/['test'](_0x5db16c);}
|
package/lib/commands/sql/push.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a163_0x1f400b=a163_0x277a;function a163_0x277a(_0xeba244,_0x2e0c29){_0xeba244=_0xeba244-0x120;const _0x2b9a57=a163_0x2b9a();let _0x277a1c=_0x2b9a57[_0xeba244];return _0x277a1c;}(function(_0x1241c8,_0x9d7df1){const _0x1115e3=a163_0x277a,_0x95f146=_0x1241c8();while(!![]){try{const _0x980668=parseInt(_0x1115e3(0x13a))/0x1*(parseInt(_0x1115e3(0x13c))/0x2)+parseInt(_0x1115e3(0x148))/0x3*(parseInt(_0x1115e3(0x121))/0x4)+parseInt(_0x1115e3(0x156))/0x5*(parseInt(_0x1115e3(0x135))/0x6)+-parseInt(_0x1115e3(0x138))/0x7+-parseInt(_0x1115e3(0x139))/0x8*(parseInt(_0x1115e3(0x129))/0x9)+-parseInt(_0x1115e3(0x123))/0xa*(parseInt(_0x1115e3(0x12a))/0xb)+parseInt(_0x1115e3(0x12b))/0xc;if(_0x980668===_0x9d7df1)break;else _0x95f146['push'](_0x95f146['shift']());}catch(_0x26ebc3){_0x95f146['push'](_0x95f146['shift']());}}}(a163_0x2b9a,0x4f6d9));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';function a163_0x2b9a(){const _0xb5fe9b=['\x20pushed,\x20','has','validation','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','Would\x20push\x20','\x22\x20for\x20sqlCode\x20','utf8','catch','sqlCode','153762POHzjp','\x20SQL\x20file(s)','sqlcode','path','remoteId','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','hash','isFinite','unchanged','lastSync','sqlRoot','trashDir','str','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','3029315mfWeJt','set','force','projectRoot','/smartapi/custom/updateUserCustomSql','Local\x20directory\x20\x22','dbDirectory','filePath','28SrdxOt','toISOString','10WdUxeB','relativePath','mode','version','sqlName','lockFilePath','4186899Sydtdx','613866MepIIA','986220bsPVHt','dbName','No\x20local\x20SQL\x20files\x20found.','high-risk-write','Push\x20local\x20SQL\x20files\x20to\x20remote','dbId','length','sqls','startsWith','sqlConfig','6TblXAN','sqlRootDir','push','2869769JOvJJJ','8DiRjPz','5hWLLTI','filter','83798nqmxoQ','appCode','get'];a163_0x2b9a=function(){return _0xb5fe9b;};return a163_0x2b9a();}import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';async function getTargetSqlQueries(_0x34cc9c,_0x4972e9,_0x38a3fb){const _0x1e5301=a163_0x277a,_0x3cf456=await scanLocalSqlQueries(_0x34cc9c),_0x3cc07d=new Map();for(const _0x5d074a of _0x3cf456){if(_0x38a3fb&&_0x5d074a['sqlCode']!==_0x38a3fb)continue;const _0x5481ca=_0x3cc07d[_0x1e5301(0x13e)](_0x5d074a[_0x1e5301(0x147)])??[];_0x5481ca[_0x1e5301(0x137)](_0x5d074a),_0x3cc07d[_0x1e5301(0x157)](_0x5d074a[_0x1e5301(0x147)],_0x5481ca);}if(_0x38a3fb&&!_0x3cc07d[_0x1e5301(0x140)](_0x38a3fb))throw CliErrors[_0x1e5301(0x141)]('Local\x20SQL\x20not\x20found:\x20'+_0x38a3fb);const _0xf94ff=[];for(const [_0x2dfe5f,_0x302e3b]of _0x3cc07d['entries']()){if(_0x302e3b[_0x1e5301(0x131)]===0x1){_0xf94ff[_0x1e5301(0x137)](_0x302e3b[0x0]);continue;}const _0x1b1e97=_0x4972e9[_0x1e5301(0x132)][_0x2dfe5f],_0x38de36=_0x1b1e97?.[_0x1e5301(0x14b)],_0x2e6fff=_0x38de36?_0x302e3b[_0x1e5301(0x13b)](_0x85a05f=>_0x85a05f[_0x1e5301(0x124)]!==_0x38de36):_0x302e3b;if(_0x1b1e97&&_0x2e6fff[_0x1e5301(0x131)]===0x1){_0xf94ff[_0x1e5301(0x137)](_0x2e6fff[0x0]);continue;}throw CliErrors[_0x1e5301(0x141)]('Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20'+_0x2dfe5f+'.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.');}return _0xf94ff;}export const sqlPush={'service':'sql','command':a163_0x1f400b(0x137),'description':a163_0x1f400b(0x12f),'risk':a163_0x1f400b(0x12e),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a163_0x1f400b(0x158),'type':'boolean','description':'Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock'}],async 'dryRun'(_0x35bee3){const _0x1ab2cf=a163_0x1f400b,_0x53f2a8=loadSqlProjectConfig(_0x35bee3['appCode']),_0x46f6a1=await readSqlLockFile(_0x53f2a8[_0x1ab2cf(0x128)]),{appLock:_0x385fa6}=ensureSqlLockScope(_0x46f6a1??createEmptySqlLock(),_0x35bee3[_0x1ab2cf(0x13d)],_0x53f2a8[_0x1ab2cf(0x152)],_0x1ab2cf(0x137)),_0x44ab36=await getTargetSqlQueries(_0x53f2a8,_0x385fa6,_0x35bee3[_0x1ab2cf(0x154)](_0x1ab2cf(0x14a))||undefined),_0x6e5591=[];for(const _0x36c2a3 of _0x44ab36){const _0x69cccc=await computeSqlFileHash(_0x36c2a3['filePath']),_0x14cc23=_0x385fa6['sqls'][_0x36c2a3[_0x1ab2cf(0x147)]],_0x469597=!!_0x14cc23&&(_0x14cc23[_0x1ab2cf(0x14b)]!==_0x36c2a3[_0x1ab2cf(0x124)]||!!_0x36c2a3[_0x1ab2cf(0x127)]&&_0x14cc23[_0x1ab2cf(0x127)]!==_0x36c2a3['sqlName']);if(!_0x35bee3['bool'](_0x1ab2cf(0x158))&&_0x14cc23&&_0x14cc23[_0x1ab2cf(0x14e)]===_0x69cccc&&!_0x469597)continue;_0x6e5591[_0x1ab2cf(0x137)](_0x36c2a3[_0x1ab2cf(0x147)]);}return{'method':'POST','url':_0x1ab2cf(0x15a),'body':{'sqlCodes':_0x6e5591,'appCode':_0x35bee3[_0x1ab2cf(0x13d)]},'description':_0x1ab2cf(0x143)+_0x6e5591['length']+_0x1ab2cf(0x149)};},async 'execute'(_0xff2e8b){const _0x589099=a163_0x1f400b,_0x4db81d=loadSqlProjectConfig(_0xff2e8b[_0x589099(0x13d)]),_0x59679e=await readSqlLockFile(_0x4db81d[_0x589099(0x128)]),{lockData:_0x3ab2b7,appLock:_0x2952a3}=ensureSqlLockScope(_0x59679e??createEmptySqlLock(),_0xff2e8b[_0x589099(0x13d)],_0x4db81d[_0x589099(0x152)],_0x589099(0x137)),_0x1783b8=await getTargetSqlQueries(_0x4db81d,_0x2952a3,_0xff2e8b['str'](_0x589099(0x14a))||undefined);if(_0x1783b8[_0x589099(0x131)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x589099(0x12d)};const _0x27d947=[],_0x57b3f5=[],_0x28e5e2=[];for(const _0xda8e9e of _0x1783b8){const _0x145b51=_0x2952a3['sqls'][_0xda8e9e[_0x589099(0x147)]];if(!_0x145b51){_0x28e5e2['push']({'sqlCode':_0xda8e9e['sqlCode'],'error':_0x589099(0x14d)});continue;}try{const _0x4af408=await computeSqlFileHash(_0xda8e9e[_0x589099(0x120)]),_0x33453b=_0x145b51[_0x589099(0x14b)]!==_0xda8e9e[_0x589099(0x124)]||!!_0xda8e9e['sqlName']&&_0x145b51[_0x589099(0x127)]!==_0xda8e9e[_0x589099(0x127)];if(!_0xff2e8b['bool'](_0x589099(0x158))&&_0x145b51['hash']===_0x4af408&&!_0x33453b){_0x57b3f5[_0x589099(0x137)]({'sqlCode':_0xda8e9e['sqlCode'],'reason':_0x589099(0x150)});continue;}if(_0x145b51[_0x589099(0x126)]==null){_0x28e5e2[_0x589099(0x137)]({'sqlCode':_0xda8e9e[_0x589099(0x147)],'error':_0x589099(0x142)});continue;}const _0x370b07=await readFile(_0xda8e9e[_0x589099(0x120)],_0x589099(0x145)),_0x43d009=stripLocalSqlMetadata(_0x370b07,_0xda8e9e['mode']),_0x37a444=_0xda8e9e['sqlName']||_0x145b51['sqlName'],_0x30fe97=await resolveTargetDbBinding(_0xff2e8b['appCode'],_0xda8e9e,_0x145b51),_0x45c739=await updateSqlQuery({'id':_0x145b51[_0x589099(0x14c)],'appCode':_0xff2e8b[_0x589099(0x13d)],'sqlCode':_0xda8e9e[_0x589099(0x147)],'sqlName':_0x37a444,'dbId':_0x30fe97[_0x589099(0x130)],'version':_0x145b51[_0x589099(0x126)],'sqlContent':_0x43d009,'sqlConfig':_0x145b51[_0x589099(0x134)]??undefined}),_0x301f61=_0x45c739['dbId']?await getDbName(_0xff2e8b[_0x589099(0x13d)],Number(_0x45c739['dbId']))[_0x589099(0x146)](()=>_0x30fe97[_0x589099(0x12c)]):_0x30fe97[_0x589099(0x12c)];_0x2952a3[_0x589099(0x132)][_0xda8e9e[_0x589099(0x147)]]={...buildSqlLockEntry(_0x45c739,_0x43d009,_0x4af408,{'dbName':_0x301f61}),'path':_0xda8e9e['relativePath'],'mode':_0x145b51[_0x589099(0x125)]},await archivePreviousSqlFileIfNeeded(_0x4db81d,_0x145b51[_0x589099(0x14b)],_0xda8e9e['relativePath']),_0x27d947[_0x589099(0x137)]({'sqlCode':_0xda8e9e['sqlCode'],'remoteId':_0x145b51[_0x589099(0x14c)]});}catch(_0x259c34){_0x28e5e2['push']({'sqlCode':_0xda8e9e[_0x589099(0x147)],'error':_0x259c34 instanceof Error?_0x259c34['message']:String(_0x259c34)});}}return _0x2952a3[_0x589099(0x151)]=new Date()['toISOString'](),await writeSqlLockFile(_0x4db81d[_0x589099(0x128)],_0x3ab2b7),{'ok':_0x28e5e2['length']===0x0,'data':{'pushed':_0x27d947,'skipped':_0x57b3f5,'failed':_0x28e5e2},'message':'Push\x20complete:\x20'+_0x27d947[_0x589099(0x131)]+_0x589099(0x13f)+_0x57b3f5['length']+'\x20skipped,\x20'+_0x28e5e2['length']+'\x20failed'};}};async function archivePreviousSqlFileIfNeeded(_0x351833,_0x35124b,_0x32011c){const _0x15be62=a163_0x1f400b;if(!_0x35124b||_0x35124b===_0x32011c)return;const _0x58b7fa=join(_0x351833[_0x15be62(0x136)],_0x35124b);if(!await fileExists(_0x58b7fa))return;const _0x43a4c7=await moveToTrash(_0x351833[_0x15be62(0x159)],_0x351833[_0x15be62(0x153)],_0x58b7fa);await cleanupEmptyDirectories(dirname(_0x58b7fa),_0x351833[_0x15be62(0x136)]),void _0x43a4c7;}async function moveToTrash(_0x3ab3bf,_0x1abe0d,_0x12f28b){const _0x3d20f2=a163_0x1f400b,_0x3d3f6e=new Date()[_0x3d20f2(0x122)]()['replace'](/[:.]/g,'-'),_0x286fd8=relative(_0x3ab3bf,_0x12f28b),_0x3d263f=join(_0x1abe0d,_0x3d3f6e,_0x286fd8);return await mkdir(dirname(_0x3d263f),{'recursive':!![]}),await rename(_0x12f28b,_0x3d263f),_0x3d263f;}async function cleanupEmptyDirectories(_0x1b5a95,_0x568f98){const _0x51a150=a163_0x1f400b;let _0x2e786e=resolve(_0x1b5a95);const _0x45fe92=resolve(_0x568f98);while(_0x2e786e[_0x51a150(0x133)](''+_0x45fe92+sep)||_0x2e786e===_0x45fe92){if(_0x2e786e===_0x45fe92)return;try{const _0x3f8818=await readdir(_0x2e786e);if(_0x3f8818[_0x51a150(0x131)]>0x0)return;await rmdir(_0x2e786e);}catch{return;}_0x2e786e=dirname(_0x2e786e);}}async function resolveTargetDbBinding(_0x1927e1,_0x48ea24,_0x1d59ba){const _0x9a66db=a163_0x1f400b,_0x506cb3=_0x48ea24[_0x9a66db(0x15c)];if(!_0x506cb3)return{'dbId':_0x1d59ba['dbId'],'dbName':_0x1d59ba['dbName']};const _0x2c780a=buildDbDirectoryName(_0x1d59ba[_0x9a66db(0x12c)],_0x1d59ba['dbId']);if(_0x506cb3===_0x2c780a)return{'dbId':_0x1d59ba['dbId'],'dbName':_0x1d59ba[_0x9a66db(0x12c)]};const _0x4203cc=parseExplicitDbDirectory(_0x506cb3);if(_0x4203cc!=null)return{'dbId':_0x4203cc,'dbName':await getDbName(_0x1927e1,_0x4203cc)['catch'](()=>undefined)};const _0x4652cc=await listDatabases(_0x1927e1),_0x1f273d=_0x4652cc[_0x9a66db(0x13b)](_0x121df8=>buildDbDirectoryName(_0x121df8[_0x9a66db(0x12c)],_0x121df8[_0x9a66db(0x130)])===_0x506cb3);if(_0x1f273d[_0x9a66db(0x131)]===0x1)return{'dbId':_0x1f273d[0x0]['dbId'],'dbName':_0x1f273d[0x0][_0x9a66db(0x12c)]};if(_0x1f273d['length']===0x0)throw CliErrors[_0x9a66db(0x141)]('No\x20database\x20matches\x20local\x20directory\x20\x22'+_0x506cb3+_0x9a66db(0x144)+_0x48ea24['sqlCode']+'.');const _0x185da4=_0x1f273d['map'](_0x9487e1=>_0x9487e1[_0x9a66db(0x12c)]+'\x20('+_0x9487e1['dbId']+')')['join'](',\x20');throw CliErrors[_0x9a66db(0x141)](_0x9a66db(0x15b)+_0x506cb3+_0x9a66db(0x155)+_0x48ea24['sqlCode']+':\x20'+_0x185da4);}function parseExplicitDbDirectory(_0x5bed02){const _0x310d29=a163_0x1f400b,_0x39a6af=/^db-(\d+)$/['exec'](_0x5bed02);if(!_0x39a6af)return null;const _0x4d54c2=Number(_0x39a6af[0x1]);return Number[_0x310d29(0x14f)](_0x4d54c2)&&_0x4d54c2>0x0?_0x4d54c2:null;}
|
|
1
|
+
const a163_0x4fcb02=a163_0x2602;(function(_0x133872,_0x2af96a){const _0x42f86a=a163_0x2602,_0xd5f45a=_0x133872();while(!![]){try{const _0x5aa851=parseInt(_0x42f86a(0xd7))/0x1*(-parseInt(_0x42f86a(0xbc))/0x2)+parseInt(_0x42f86a(0xda))/0x3+parseInt(_0x42f86a(0xca))/0x4*(parseInt(_0x42f86a(0xe8))/0x5)+-parseInt(_0x42f86a(0xf5))/0x6*(-parseInt(_0x42f86a(0xd8))/0x7)+-parseInt(_0x42f86a(0xdd))/0x8*(-parseInt(_0x42f86a(0xe9))/0x9)+parseInt(_0x42f86a(0xee))/0xa*(parseInt(_0x42f86a(0xbb))/0xb)+-parseInt(_0x42f86a(0xeb))/0xc;if(_0x5aa851===_0x2af96a)break;else _0xd5f45a['push'](_0xd5f45a['shift']());}catch(_0x2368c1){_0xd5f45a['push'](_0xd5f45a['shift']());}}}(a163_0x44a6,0x72254));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';function a163_0x2602(_0x251ad2,_0x2c51af){_0x251ad2=_0x251ad2-0xb9;const _0x44a615=a163_0x44a6();let _0x260226=_0x44a615[_0x251ad2];return _0x260226;}import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';function a163_0x44a6(){const _0x3cfff3=['Push\x20local\x20SQL\x20files\x20to\x20remote','Push\x20complete:\x20','validation','projectRoot','relativePath','sqlConfig','unchanged','replace','bool','force','sqlRootDir','\x20failed','1316624aTpuXK','dbDirectory','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','No\x20database\x20matches\x20local\x20directory\x20\x22','sqls','lockFilePath','push','dbName','sqlName','has','sql','Local\x20SQL\x20not\x20found:\x20','417406fOJnZv','352422wxWIjL','catch','2487723RPmtHB','str','filter','3352yNEfDq','toISOString','Would\x20push\x20','sqlCode','lastSync','trashDir','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','length','high-risk-write','sqlcode','hash','5GJCQil','11259qzLkbL','mode','16840260UnsuPE','dbId','remoteId','8217570DThhtW','path','version','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','get','exec','24GdZEhl','boolean','Local\x20directory\x20\x22','filePath','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','map','utf8','appCode','/smartapi/custom/updateUserCustomSql','join','11inpxWu','4bbNPev','isFinite'];a163_0x44a6=function(){return _0x3cfff3;};return a163_0x44a6();}import{fileExists}from'../../core/bff/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';async function getTargetSqlQueries(_0x19dfd5,_0x47c83c,_0x484e8d){const _0x5c7e04=a163_0x2602,_0x2fe03a=await scanLocalSqlQueries(_0x19dfd5),_0x136324=new Map();for(const _0x49b014 of _0x2fe03a){if(_0x484e8d&&_0x49b014['sqlCode']!==_0x484e8d)continue;const _0x2d2cc9=_0x136324[_0x5c7e04(0xf3)](_0x49b014[_0x5c7e04(0xe0)])??[];_0x2d2cc9[_0x5c7e04(0xd1)](_0x49b014),_0x136324['set'](_0x49b014['sqlCode'],_0x2d2cc9);}if(_0x484e8d&&!_0x136324[_0x5c7e04(0xd4)](_0x484e8d))throw CliErrors[_0x5c7e04(0xc0)](_0x5c7e04(0xd6)+_0x484e8d);const _0x23250b=[];for(const [_0xe4a954,_0x13ba36]of _0x136324['entries']()){if(_0x13ba36[_0x5c7e04(0xe4)]===0x1){_0x23250b[_0x5c7e04(0xd1)](_0x13ba36[0x0]);continue;}const _0x49d652=_0x47c83c[_0x5c7e04(0xcf)][_0xe4a954],_0x1accd4=_0x49d652?.[_0x5c7e04(0xef)],_0x75453c=_0x1accd4?_0x13ba36['filter'](_0x365c49=>_0x365c49[_0x5c7e04(0xc2)]!==_0x1accd4):_0x13ba36;if(_0x49d652&&_0x75453c[_0x5c7e04(0xe4)]===0x1){_0x23250b[_0x5c7e04(0xd1)](_0x75453c[0x0]);continue;}throw CliErrors[_0x5c7e04(0xc0)](_0x5c7e04(0xf9)+_0xe4a954+_0x5c7e04(0xcd));}return _0x23250b;}export const sqlPush={'service':a163_0x4fcb02(0xd5),'command':'push','description':a163_0x4fcb02(0xbe),'risk':a163_0x4fcb02(0xe5),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a163_0x4fcb02(0xc7),'type':a163_0x4fcb02(0xf6),'description':a163_0x4fcb02(0xcc)}],async 'dryRun'(_0x254499){const _0x72bc74=a163_0x4fcb02,_0xa1e0fb=loadSqlProjectConfig(_0x254499[_0x72bc74(0xfc)]),_0x5b0dfa=await readSqlLockFile(_0xa1e0fb[_0x72bc74(0xd0)]),{appLock:_0x17eaac}=ensureSqlLockScope(_0x5b0dfa??createEmptySqlLock(),_0x254499[_0x72bc74(0xfc)],_0xa1e0fb['sqlRoot'],_0x72bc74(0xd1)),_0x2ceecc=await getTargetSqlQueries(_0xa1e0fb,_0x17eaac,_0x254499[_0x72bc74(0xdb)](_0x72bc74(0xe6))||undefined),_0x2bca84=[];for(const _0x4949a8 of _0x2ceecc){const _0x339de8=await computeSqlFileHash(_0x4949a8[_0x72bc74(0xf8)]),_0x191d00=_0x17eaac[_0x72bc74(0xcf)][_0x4949a8[_0x72bc74(0xe0)]],_0xfdce85=!!_0x191d00&&(_0x191d00[_0x72bc74(0xef)]!==_0x4949a8[_0x72bc74(0xc2)]||!!_0x4949a8[_0x72bc74(0xd3)]&&_0x191d00[_0x72bc74(0xd3)]!==_0x4949a8['sqlName']);if(!_0x254499[_0x72bc74(0xc6)](_0x72bc74(0xc7))&&_0x191d00&&_0x191d00[_0x72bc74(0xe7)]===_0x339de8&&!_0xfdce85)continue;_0x2bca84[_0x72bc74(0xd1)](_0x4949a8[_0x72bc74(0xe0)]);}return{'method':'POST','url':_0x72bc74(0xb9),'body':{'sqlCodes':_0x2bca84,'appCode':_0x254499[_0x72bc74(0xfc)]},'description':_0x72bc74(0xdf)+_0x2bca84[_0x72bc74(0xe4)]+'\x20SQL\x20file(s)'};},async 'execute'(_0x549bff){const _0x3cde4a=a163_0x4fcb02,_0x30bad7=loadSqlProjectConfig(_0x549bff[_0x3cde4a(0xfc)]),_0x4b70a3=await readSqlLockFile(_0x30bad7[_0x3cde4a(0xd0)]),{lockData:_0x4d765c,appLock:_0x2a0103}=ensureSqlLockScope(_0x4b70a3??createEmptySqlLock(),_0x549bff['appCode'],_0x30bad7['sqlRoot'],'push'),_0xfb7219=await getTargetSqlQueries(_0x30bad7,_0x2a0103,_0x549bff[_0x3cde4a(0xdb)](_0x3cde4a(0xe6))||undefined);if(_0xfb7219[_0x3cde4a(0xe4)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':'No\x20local\x20SQL\x20files\x20found.'};const _0x3374c1=[],_0xa7a657=[],_0x2a2ecb=[];for(const _0x1bc7bf of _0xfb7219){const _0x3a4555=_0x2a0103['sqls'][_0x1bc7bf[_0x3cde4a(0xe0)]];if(!_0x3a4555){_0x2a2ecb[_0x3cde4a(0xd1)]({'sqlCode':_0x1bc7bf[_0x3cde4a(0xe0)],'error':_0x3cde4a(0xe3)});continue;}try{const _0x157b1d=await computeSqlFileHash(_0x1bc7bf['filePath']),_0x1f0e66=_0x3a4555[_0x3cde4a(0xef)]!==_0x1bc7bf[_0x3cde4a(0xc2)]||!!_0x1bc7bf[_0x3cde4a(0xd3)]&&_0x3a4555[_0x3cde4a(0xd3)]!==_0x1bc7bf[_0x3cde4a(0xd3)];if(!_0x549bff[_0x3cde4a(0xc6)](_0x3cde4a(0xc7))&&_0x3a4555['hash']===_0x157b1d&&!_0x1f0e66){_0xa7a657[_0x3cde4a(0xd1)]({'sqlCode':_0x1bc7bf[_0x3cde4a(0xe0)],'reason':_0x3cde4a(0xc4)});continue;}if(_0x3a4555['version']==null){_0x2a2ecb[_0x3cde4a(0xd1)]({'sqlCode':_0x1bc7bf[_0x3cde4a(0xe0)],'error':_0x3cde4a(0xf1)});continue;}const _0x4f7c38=await readFile(_0x1bc7bf[_0x3cde4a(0xf8)],_0x3cde4a(0xfb)),_0x411c1a=stripLocalSqlMetadata(_0x4f7c38,_0x1bc7bf[_0x3cde4a(0xea)]),_0x366988=_0x1bc7bf[_0x3cde4a(0xd3)]||_0x3a4555[_0x3cde4a(0xd3)],_0x9316d3=await resolveTargetDbBinding(_0x549bff[_0x3cde4a(0xfc)],_0x1bc7bf,_0x3a4555),_0x3d0ee5=await updateSqlQuery({'id':_0x3a4555[_0x3cde4a(0xed)],'appCode':_0x549bff[_0x3cde4a(0xfc)],'sqlCode':_0x1bc7bf[_0x3cde4a(0xe0)],'sqlName':_0x366988,'dbId':_0x9316d3[_0x3cde4a(0xec)],'version':_0x3a4555[_0x3cde4a(0xf0)],'sqlContent':_0x411c1a,'sqlConfig':_0x3a4555[_0x3cde4a(0xc3)]??undefined}),_0x3c6184=_0x3d0ee5[_0x3cde4a(0xec)]?await getDbName(_0x549bff[_0x3cde4a(0xfc)],Number(_0x3d0ee5[_0x3cde4a(0xec)]))['catch'](()=>_0x9316d3[_0x3cde4a(0xd2)]):_0x9316d3[_0x3cde4a(0xd2)];_0x2a0103[_0x3cde4a(0xcf)][_0x1bc7bf[_0x3cde4a(0xe0)]]={...buildSqlLockEntry(_0x3d0ee5,_0x411c1a,_0x157b1d,{'dbName':_0x3c6184}),'path':_0x1bc7bf['relativePath'],'mode':_0x3a4555['mode']},await archivePreviousSqlFileIfNeeded(_0x30bad7,_0x3a4555['path'],_0x1bc7bf['relativePath']),_0x3374c1['push']({'sqlCode':_0x1bc7bf[_0x3cde4a(0xe0)],'remoteId':_0x3a4555[_0x3cde4a(0xed)]});}catch(_0x3e61d9){_0x2a2ecb[_0x3cde4a(0xd1)]({'sqlCode':_0x1bc7bf[_0x3cde4a(0xe0)],'error':_0x3e61d9 instanceof Error?_0x3e61d9['message']:String(_0x3e61d9)});}}return _0x2a0103[_0x3cde4a(0xe1)]=new Date()[_0x3cde4a(0xde)](),await writeSqlLockFile(_0x30bad7['lockFilePath'],_0x4d765c),{'ok':_0x2a2ecb[_0x3cde4a(0xe4)]===0x0,'data':{'pushed':_0x3374c1,'skipped':_0xa7a657,'failed':_0x2a2ecb},'message':_0x3cde4a(0xbf)+_0x3374c1[_0x3cde4a(0xe4)]+'\x20pushed,\x20'+_0xa7a657[_0x3cde4a(0xe4)]+'\x20skipped,\x20'+_0x2a2ecb[_0x3cde4a(0xe4)]+_0x3cde4a(0xc9)};}};async function archivePreviousSqlFileIfNeeded(_0x3fdb63,_0x291e21,_0xa809c6){const _0x928827=a163_0x4fcb02;if(!_0x291e21||_0x291e21===_0xa809c6)return;const _0x161f6e=join(_0x3fdb63['sqlRootDir'],_0x291e21);if(!await fileExists(_0x161f6e))return;const _0x5c078e=await moveToTrash(_0x3fdb63[_0x928827(0xc1)],_0x3fdb63[_0x928827(0xe2)],_0x161f6e);await cleanupEmptyDirectories(dirname(_0x161f6e),_0x3fdb63[_0x928827(0xc8)]),void _0x5c078e;}async function moveToTrash(_0x55650c,_0xbb6a2d,_0x116648){const _0x2e8c70=a163_0x4fcb02,_0x6b2cef=new Date()['toISOString']()[_0x2e8c70(0xc5)](/[:.]/g,'-'),_0x5a322d=relative(_0x55650c,_0x116648),_0x3ec852=join(_0xbb6a2d,_0x6b2cef,_0x5a322d);return await mkdir(dirname(_0x3ec852),{'recursive':!![]}),await rename(_0x116648,_0x3ec852),_0x3ec852;}async function cleanupEmptyDirectories(_0x5a5a76,_0x576707){let _0x2c08c3=resolve(_0x5a5a76);const _0x3802d4=resolve(_0x576707);while(_0x2c08c3['startsWith'](''+_0x3802d4+sep)||_0x2c08c3===_0x3802d4){if(_0x2c08c3===_0x3802d4)return;try{const _0x35498a=await readdir(_0x2c08c3);if(_0x35498a['length']>0x0)return;await rmdir(_0x2c08c3);}catch{return;}_0x2c08c3=dirname(_0x2c08c3);}}async function resolveTargetDbBinding(_0x5c60fa,_0x2f846d,_0x16a94b){const _0x22afbc=a163_0x4fcb02,_0x5d5f03=_0x2f846d[_0x22afbc(0xcb)];if(!_0x5d5f03)return{'dbId':_0x16a94b['dbId'],'dbName':_0x16a94b['dbName']};const _0x19c723=buildDbDirectoryName(_0x16a94b[_0x22afbc(0xd2)],_0x16a94b[_0x22afbc(0xec)]);if(_0x5d5f03===_0x19c723)return{'dbId':_0x16a94b[_0x22afbc(0xec)],'dbName':_0x16a94b[_0x22afbc(0xd2)]};const _0x465d99=parseExplicitDbDirectory(_0x5d5f03);if(_0x465d99!=null)return{'dbId':_0x465d99,'dbName':await getDbName(_0x5c60fa,_0x465d99)[_0x22afbc(0xd9)](()=>undefined)};const _0x46d888=await listDatabases(_0x5c60fa),_0x35c957=_0x46d888[_0x22afbc(0xdc)](_0x153eda=>buildDbDirectoryName(_0x153eda[_0x22afbc(0xd2)],_0x153eda['dbId'])===_0x5d5f03);if(_0x35c957[_0x22afbc(0xe4)]===0x1)return{'dbId':_0x35c957[0x0][_0x22afbc(0xec)],'dbName':_0x35c957[0x0]['dbName']};if(_0x35c957['length']===0x0)throw CliErrors['validation'](_0x22afbc(0xce)+_0x5d5f03+'\x22\x20for\x20sqlCode\x20'+_0x2f846d[_0x22afbc(0xe0)]+'.');const _0x1876aa=_0x35c957[_0x22afbc(0xfa)](_0x3337a6=>_0x3337a6['dbName']+'\x20('+_0x3337a6[_0x22afbc(0xec)]+')')[_0x22afbc(0xba)](',\x20');throw CliErrors[_0x22afbc(0xc0)](_0x22afbc(0xf7)+_0x5d5f03+_0x22afbc(0xf2)+_0x2f846d['sqlCode']+':\x20'+_0x1876aa);}function parseExplicitDbDirectory(_0x4a9e2b){const _0x86548f=a163_0x4fcb02,_0xc9edbe=/^db-(\d+)$/[_0x86548f(0xf4)](_0x4a9e2b);if(!_0xc9edbe)return null;const _0x44c1ce=Number(_0xc9edbe[0x1]);return Number[_0x86548f(0xbd)](_0x44c1ce)&&_0x44c1ce>0x0?_0x44c1ce:null;}
|
package/lib/commands/sql/save.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a164_0x1300b7=a164_0x4260;(function(_0x39d2f7,_0x271860){const _0x47e23e=a164_0x4260,_0x555d65=_0x39d2f7();while(!![]){try{const _0x5b7d11=parseInt(_0x47e23e(0x174))/0x1*(-parseInt(_0x47e23e(0x179))/0x2)+-parseInt(_0x47e23e(0x178))/0x3*(-parseInt(_0x47e23e(0x17a))/0x4)+parseInt(_0x47e23e(0x172))/0x5+parseInt(_0x47e23e(0x176))/0x6+parseInt(_0x47e23e(0x16a))/0x7+parseInt(_0x47e23e(0x16e))/0x8*(-parseInt(_0x47e23e(0x175))/0x9)+-parseInt(_0x47e23e(0x173))/0xa;if(_0x5b7d11===_0x271860)break;else _0x555d65['push'](_0x555d65['shift']());}catch(_0x15c287){_0x555d65['push'](_0x555d65['shift']());}}}(a164_0x3cb9,0xb8a8c));import{CliErrors}from'../../errors.js';function a164_0x4260(_0x3b6480,_0x4f7c59){_0x3b6480=_0x3b6480-0x16a;const _0x3cb957=a164_0x3cb9();let _0x4260e4=_0x3cb957[_0x3b6480];return _0x4260e4;}import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';const SQL_SAVE_DEPRECATED_HINT=[a164_0x1300b7(0x170),a164_0x1300b7(0x17c),a164_0x1300b7(0x180)][a164_0x1300b7(0x16f)]('\x0a');function a164_0x3cb9(){const _0x446755=['116999dvsJQP','2996235XymIMb','8272716vqJiXc','file','153921kvwvkr','8XjbuKg','104cUHHVv','sqlname','Create\x20new\x20SQL\x20with\x20`rabetbase\x20sql\x20create\x20--name\x20<name>\x20--db-id\x20<id>\x20--mode\x20sql|mybatisXml`.','Deprecated:\x20use\x20sql\x20create\x20to\x20create\x20and\x20sql\x20push\x20to\x20update','string','Path\x20to\x20the\x20SQL\x20file','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`.','5324291HKSSPO','write','sql','validation','8bERkQX','join','`rabetbase\x20sql\x20save`\x20has\x20been\x20deprecated.','save','6459285KnBAyM','32079630VuwzWE'];a164_0x3cb9=function(){return _0x446755;};return a164_0x3cb9();}export const sqlSave={'service':a164_0x1300b7(0x16c),'command':a164_0x1300b7(0x171),'description':a164_0x1300b7(0x17d),'risk':a164_0x1300b7(0x16b),'requiresAuth':![],'requiresAppCode':![],'flags':[{'name':a164_0x1300b7(0x177),'type':a164_0x1300b7(0x17e),'required':!![],'description':a164_0x1300b7(0x17f)},SQLCODE_FLAG_OPTIONAL,{'name':a164_0x1300b7(0x17b),'type':a164_0x1300b7(0x17e),'description':'SQL\x20query\x20display\x20name'},{'name':'db','type':a164_0x1300b7(0x17e),'description':'Target\x20database\x20—\x20accepts\x20a\x20numeric\x20ID\x20or\x20database\x20name\x20(e.g.\x20ecommerce_db)'},{'name':'description','type':'string','description':'Query\x20description'}],async 'validate'(){const _0x45d6c0=a164_0x1300b7;throw CliErrors[_0x45d6c0(0x16d)](SQL_SAVE_DEPRECATED_HINT);},async 'execute'(){throw CliErrors['validation'](SQL_SAVE_DEPRECATED_HINT);}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
const a165_0x17a4bc=a165_0x48c4;(function(_0x584429,_0x39f5b7){const _0x2e73b2=a165_0x48c4,_0x5e9c63=_0x584429();while(!![]){try{const _0x39ad2f=parseInt(_0x2e73b2(0xf2))/0x1+parseInt(_0x2e73b2(0x115))/0x2*(parseInt(_0x2e73b2(0x10e))/0x3)+-parseInt(_0x2e73b2(0xf5))/0x4+parseInt(_0x2e73b2(0x113))/0x5*(-parseInt(_0x2e73b2(0xf8))/0x6)+-parseInt(_0x2e73b2(0x108))/0x7*(parseInt(_0x2e73b2(0x100))/0x8)+parseInt(_0x2e73b2(0x106))/0x9+-parseInt(_0x2e73b2(0xe8))/0xa*(-parseInt(_0x2e73b2(0xf4))/0xb);if(_0x39ad2f===_0x39f5b7)break;else _0x5e9c63['push'](_0x5e9c63['shift']());}catch(_0x55a8f1){_0x5e9c63['push'](_0x5e9c63['shift']());}}}(a165_0x13e1,0x41f98));import{createInterface}from'node:readline';function a165_0x48c4(_0x11a2da,_0x49ad77){_0x11a2da=_0x11a2da-0xe8;const _0x13e1c3=a165_0x13e1();let _0x48c4f8=_0x13e1c3[_0x11a2da];return _0x48c4f8;}import{join}from'node:path';import{buildDefaultSqlFileName,buildSqlRelativePath,detectSqlMode}from'../../core/sql-sync/utils.js';export const SQL_LOCAL_REL_DIR=a165_0x17a4bc(0xfe);export function buildSqlLockEntry(_0x15adae,_0x248b0a,_0x477103,_0x1fb956){const _0x318078=a165_0x17a4bc,_0xf8f53a=detectSqlMode(_0x248b0a);return{'path':buildSqlRelativePath(_0x15adae['sqlCode'],_0x15adae[_0x318078(0xf6)],_0x1fb956?.['dbName'],_0xf8f53a,_0x15adae[_0x318078(0xff)]),'hash':_0x477103,'remoteId':_0x15adae['id'],'version':_0x15adae[_0x318078(0x112)],'dbId':Number(_0x15adae['dbId']),'dbName':_0x1fb956?.['dbName'],'sqlName':_0x15adae[_0x318078(0xf6)],'sqlConfig':_0x15adae['sqlConfig']??undefined,'mode':_0xf8f53a};}export function cloneSqlLockData(_0x4baa6f){const _0x1ca22b=a165_0x17a4bc;return{'apps':Object[_0x1ca22b(0x103)](Object[_0x1ca22b(0xfd)](_0x4baa6f[_0x1ca22b(0xfc)])[_0x1ca22b(0x104)](([_0x451973,_0x303c50])=>[_0x451973,{'sqlRoot':_0x303c50['sqlRoot'],'lastSync':_0x303c50[_0x1ca22b(0x10f)],'sqls':{..._0x303c50['sqls']}}]))};}export function ensureRemoteSqlContent(_0x58baef){const _0x30d799=a165_0x17a4bc;return _0x58baef[_0x30d799(0xea)]??'';}export function buildLocalSqlFileContent(_0x2e355e,_0x13f355,_0x220418){const _0x3dd1f8=a165_0x17a4bc,_0x3d2eb9=_0x220418?.[_0x3dd1f8(0xf0)]??detectSqlMode(_0x13f355),_0xbc0931=stripLocalSqlMetadata(_0x13f355,_0x3d2eb9)[_0x3dd1f8(0x105)](),_0x5cc791=[...buildMetadataHeaderLines({'sqlCode':_0x2e355e['sqlCode'],'sqlName':_0x2e355e['sqlName'],'dbId':_0x2e355e['dbId'],'dbName':_0x220418?.[_0x3dd1f8(0xed)],'mode':_0x3d2eb9,'syncedAt':_0x220418?.['syncedAt'],'description':_0x220418?.[_0x3dd1f8(0xf7)]},_0x3d2eb9),'',_0xbc0931],_0x10662c=_0x5cc791[_0x3dd1f8(0xfb)]('\x0a');return _0x10662c[_0x3dd1f8(0xf3)]('\x0a')?_0x10662c:_0x10662c+'\x0a';}export function stripLocalSqlMetadata(_0xeff373,_0x20df7f){const _0x557070=a165_0x17a4bc,_0x510006=_0xeff373[_0x557070(0x10a)](/\r\n/g,'\x0a')[_0x557070(0x10d)]('\x0a'),_0x39c703=[];let _0x22c4df=0x0;if(_0x20df7f===_0x557070(0xf1))while(_0x22c4df<_0x510006[_0x557070(0x114)]){const _0x280d6b=_0x510006[_0x22c4df]??'';if(/^\s*<!--\s*@lovrabet\./['test'](_0x280d6b)){_0x22c4df++;continue;}if(_0x280d6b[_0x557070(0x105)]()===''&&_0x22c4df>0x0){_0x22c4df++;continue;}break;}else while(_0x22c4df<_0x510006[_0x557070(0x114)]){const _0x4605bd=_0x510006[_0x22c4df]??'';if(/^\s*--\s*@lovrabet\./[_0x557070(0xf9)](_0x4605bd)){_0x22c4df++;continue;}if(_0x4605bd[_0x557070(0x105)]()===''&&_0x22c4df>0x0){_0x22c4df++;continue;}break;}for(;_0x22c4df<_0x510006[_0x557070(0x114)];_0x22c4df++){_0x39c703[_0x557070(0x111)](_0x510006[_0x22c4df]);}return _0x39c703[_0x557070(0xfb)]('\x0a')[_0x557070(0xec)]();}export function resolveSqlMode(_0x1412df,_0x1cd9fe){const _0x7a3f40=a165_0x17a4bc;if(_0x1cd9fe?.[_0x7a3f40(0xf0)])return _0x1cd9fe[_0x7a3f40(0xf0)];return detectSqlMode(_0x1412df);}export function resolveSqlFileName(_0xbc10dc,_0x3a1d42,_0x14e159){const _0x1ec154=a165_0x17a4bc;if(_0x14e159?.['path'])return _0x14e159['path'];if(_0x14e159?.[_0x1ec154(0xf6)]||_0x14e159?.['dbName'])return buildSqlRelativePath(_0xbc10dc,_0x14e159?.[_0x1ec154(0xf6)],_0x14e159?.['dbName'],resolveSqlMode(_0x3a1d42,_0x14e159),_0x14e159?.['dbId']);return buildDefaultSqlFileName(_0xbc10dc,resolveSqlMode(_0x3a1d42,_0x14e159));}export function resolveSqlLocalDir(_0x3403a1,_0x9e6b43){return join(_0x3403a1,SQL_LOCAL_REL_DIR,_0x9e6b43);}function a165_0x13e1(){const _0x4370b2=['55PmHVUr','983880zQpoWq','sqlName','description','33162WsaWyJ','test','sqlCode','join','apps','entries','.rabetbase/sql','dbId','1346848KgHHjJ','--\x20@lovrabet.','yes','fromEntries','map','trim','3140856MvsFvr','filter','7aVNdeB','\x20-->','replace','stderr','close','split','522711iCJlOx','lastSync','includes','push','version','485ajvQfD','length','4MawUrg','705230gBIJax','<!--\x20@lovrabet.','sqlContent','\x20[y/N]\x20','trimStart','dbName','syncedAt','question','mode','mybatisXml','170604FUbeOE','endsWith'];a165_0x13e1=function(){return _0x4370b2;};return a165_0x13e1();}export async function confirmForceOverwrite(_0x147bd1){const _0x4c9942=a165_0x17a4bc,_0x1fa38b=createInterface({'input':process['stdin'],'output':process[_0x4c9942(0x10b)]}),_0x2ae0bd=await new Promise(_0x1d274f=>{const _0x56584b=_0x4c9942;_0x1fa38b[_0x56584b(0xef)](_0x147bd1+_0x56584b(0xeb),_0x1d274f);});return _0x1fa38b[_0x4c9942(0x10c)](),['y',_0x4c9942(0x102)][_0x4c9942(0x110)](_0x2ae0bd[_0x4c9942(0x105)]()['toLowerCase']());}export function findSqlLockScope(_0x5e35de,_0x35e069){const _0x304c63=a165_0x17a4bc;return _0x5e35de[_0x304c63(0xfc)][_0x35e069];}function buildMetadataHeaderLines(_0x3efc01,_0x435b43){const _0x49314d=a165_0x17a4bc,_0x31818d=[[_0x49314d(0xfa),_0x3efc01[_0x49314d(0xfa)]],[_0x49314d(0xf6),_0x3efc01[_0x49314d(0xf6)]],[_0x49314d(0xff),_0x3efc01[_0x49314d(0xff)]],[_0x49314d(0xed),_0x3efc01['dbName']],[_0x49314d(0xf0),_0x3efc01[_0x49314d(0xf0)]],['syncedAt',_0x3efc01[_0x49314d(0xee)]],[_0x49314d(0xf7),_0x3efc01[_0x49314d(0xf7)]]];if(_0x435b43==='mybatisXml')return _0x31818d[_0x49314d(0x107)](([,_0x5b6050])=>_0x5b6050!==undefined&&_0x5b6050!==null&&String(_0x5b6050)['trim']()!=='')[_0x49314d(0x104)](([_0x43e377,_0x323af2])=>_0x49314d(0xe9)+_0x43e377+':\x20'+String(_0x323af2)+_0x49314d(0x109));return _0x31818d['filter'](([,_0x2b2906])=>_0x2b2906!==undefined&&_0x2b2906!==null&&String(_0x2b2906)[_0x49314d(0x105)]()!=='')[_0x49314d(0x104)](([_0x2500b7,_0x3b38dd])=>_0x49314d(0x101)+_0x2500b7+':\x20'+String(_0x3b38dd));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a166_0x5bf413=a166_0x1f89;(function(_0x4650a6,_0x10b7bb){const _0x4883a1=a166_0x1f89,_0x53a054=_0x4650a6();while(!![]){try{const _0x5eda36=-parseInt(_0x4883a1(0xa1))/0x1*(parseInt(_0x4883a1(0x83))/0x2)+parseInt(_0x4883a1(0x8e))/0x3*(parseInt(_0x4883a1(0x80))/0x4)+parseInt(_0x4883a1(0x87))/0x5+parseInt(_0x4883a1(0x82))/0x6*(-parseInt(_0x4883a1(0x9c))/0x7)+parseInt(_0x4883a1(0x8d))/0x8*(parseInt(_0x4883a1(0x93))/0x9)+-parseInt(_0x4883a1(0x98))/0xa*(parseInt(_0x4883a1(0x81))/0xb)+parseInt(_0x4883a1(0x9a))/0xc*(parseInt(_0x4883a1(0x85))/0xd);if(_0x5eda36===_0x10b7bb)break;else _0x53a054['push'](_0x53a054['shift']());}catch(_0x2e66db){_0x53a054['push'](_0x53a054['shift']());}}}(a166_0x2493,0x46b23));import{listSqlQueries}from'../../core/api-client.js';function a166_0x2493(){const _0x88a400=['951HAPHYt','sqlCode','\x20modified,\x20','remote','bool','251388YRfpek','sqlName','read','has','boolean','57400tgxPDX','filePath','12OhtKMa','length','547687dTNRAR','\x20added,\x20','lockKey','Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally','sql','8623Mxmmpd','sqlRoot','All\x20SQL\x20queries\x20are\x20in\x20sync.','status','relativePath','push','tableData','path','6124XNseTL','1001VnvpRV','18SsbYuY','38bfCums','sqls','3763864RKmtMD','hash','362500kQfxAc','keys','appCode','map','\x20missing,\x20','paging','104LkRLmk'];a166_0x2493=function(){return _0x88a400;};return a166_0x2493();}import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';function a166_0x1f89(_0x36a403,_0x28928f){_0x36a403=_0x36a403-0x7c;const _0x249390=a166_0x2493();let _0x1f89cb=_0x249390[_0x36a403];return _0x1f89cb;}import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile}from'../../core/sql-sync/lock.js';const PAGE_SIZE=0x64;async function fetchAllSqlCodes(_0x2ff3c7){const _0x666628=a166_0x1f89,_0x6f0386=[];let _0x10794b=0x1;while(!![]){const _0x36ddb6=await listSqlQueries(_0x2ff3c7,{'currentPage':_0x10794b,'pageSize':PAGE_SIZE}),_0x69697f=_0x36ddb6[_0x666628(0x7e)]??[];_0x6f0386[_0x666628(0x7d)](..._0x69697f[_0x666628(0x8a)](_0x4a6f0f=>_0x4a6f0f[_0x666628(0x8f)]));if(_0x69697f[_0x666628(0x9b)]===0x0)break;const _0x55e51b=_0x36ddb6[_0x666628(0x8c)]?.['totalCount'];if(_0x55e51b!=null?_0x6f0386[_0x666628(0x9b)]>=_0x55e51b:_0x69697f[_0x666628(0x9b)]<PAGE_SIZE)break;_0x10794b++;}return _0x6f0386;}export const sqlStatus={'service':a166_0x5bf413(0xa0),'command':a166_0x5bf413(0xa4),'description':'Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','risk':a166_0x5bf413(0x95),'flags':[{'name':a166_0x5bf413(0x91),'type':a166_0x5bf413(0x97),'description':a166_0x5bf413(0x9f)}],async 'execute'(_0x3eef01){const _0x318a15=a166_0x5bf413,_0x463275=loadSqlProjectConfig(_0x3eef01[_0x318a15(0x89)]),_0x4b9910=await readSqlLockFile(_0x463275['lockFilePath']),{appLock:_0x4569f6}=ensureSqlLockScope(_0x4b9910??createEmptySqlLock(),_0x463275['appCode'],_0x463275[_0x318a15(0xa2)],_0x318a15(0xa4)),_0x5c3277=await scanLocalSqlQueries(_0x463275),_0xb8f6c=[],_0x13e470=[],_0x196c92=[],_0x44d276=[],_0x1c48d1=new Set(_0x5c3277[_0x318a15(0x8a)](_0x5905a9=>_0x5905a9[_0x318a15(0x9e)]));for(const _0x471a82 of _0x5c3277){const _0x58cc52=await computeSqlFileHash(_0x471a82[_0x318a15(0x99)]),_0x1833eb=_0x4569f6[_0x318a15(0x84)][_0x471a82[_0x318a15(0x9e)]],_0x1d539d=!!_0x1833eb&&_0x1833eb[_0x318a15(0x7f)]!==_0x471a82[_0x318a15(0x7c)],_0x19dd39=!!_0x1833eb&&!!_0x471a82[_0x318a15(0x94)]&&_0x1833eb['sqlName']!==_0x471a82[_0x318a15(0x94)];if(!_0x1833eb)_0xb8f6c[_0x318a15(0x7d)](_0x471a82['lockKey']);else _0x1833eb[_0x318a15(0x86)]!==_0x58cc52||_0x1d539d||_0x19dd39?_0x13e470[_0x318a15(0x7d)](_0x471a82[_0x318a15(0x9e)]):_0x196c92[_0x318a15(0x7d)](_0x471a82['lockKey']);}for(const _0x34328b of Object[_0x318a15(0x88)](_0x4569f6[_0x318a15(0x84)])){!_0x1c48d1[_0x318a15(0x96)](_0x34328b)&&_0x44d276['push'](_0x34328b);}const _0x14e88f=[];if(_0x3eef01[_0x318a15(0x92)]('remote')){const _0x2d657d=await fetchAllSqlCodes(_0x3eef01[_0x318a15(0x89)]);for(const _0x1e0b1b of _0x2d657d){!_0x1c48d1['has'](_0x1e0b1b)&&!_0x4569f6[_0x318a15(0x84)][_0x1e0b1b]&&_0x14e88f[_0x318a15(0x7d)](_0x1e0b1b);}}const _0x4554ea=_0xb8f6c[_0x318a15(0x9b)]===0x0&&_0x13e470['length']===0x0&&_0x44d276['length']===0x0&&_0x14e88f[_0x318a15(0x9b)]===0x0;return{'ok':!![],'data':{'added':_0xb8f6c,'modified':_0x13e470,'missing':_0x44d276,'unchanged':_0x196c92,'remoteOnly':_0x14e88f},'message':_0x4554ea?_0x318a15(0xa3):_0xb8f6c[_0x318a15(0x9b)]+_0x318a15(0x9d)+_0x13e470['length']+_0x318a15(0x90)+_0x44d276[_0x318a15(0x9b)]+_0x318a15(0x8b)+_0x196c92['length']+'\x20unchanged'+(_0x14e88f[_0x318a15(0x9b)]>0x0?',\x20'+_0x14e88f[_0x318a15(0x9b)]+'\x20remote-only':'')};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a167_0x4d82bb=a167_0x29e7;(function(_0x33d41c,_0x3b8963){const _0x1df530=a167_0x29e7,_0x51aa7f=_0x33d41c();while(!![]){try{const _0x52a6c6=parseInt(_0x1df530(0xc7))/0x1+-parseInt(_0x1df530(0xcf))/0x2*(-parseInt(_0x1df530(0xc2))/0x3)+parseInt(_0x1df530(0xda))/0x4+parseInt(_0x1df530(0xc8))/0x5*(parseInt(_0x1df530(0xc0))/0x6)+parseInt(_0x1df530(0xd4))/0x7*(-parseInt(_0x1df530(0xbb))/0x8)+parseInt(_0x1df530(0xa8))/0x9*(-parseInt(_0x1df530(0xce))/0xa)+-parseInt(_0x1df530(0xdc))/0xb;if(_0x52a6c6===_0x3b8963)break;else _0x51aa7f['push'](_0x51aa7f['shift']());}catch(_0x2106e6){_0x51aa7f['push'](_0x51aa7f['shift']());}}}(a167_0x4d9e,0x52003));import{readFileSync,existsSync}from'node:fs';import{resolve}from'node:path';function a167_0x4d9e(){const _0x3204f3=['isDangerous','1454992spREMV','type','9866417GwFxZo','Provide\x20--file\x20or\x20--sql','push','9DNJKDX','message','SQL\x20schema\x20validation','from','trim','validation','Table\x20\x22','isArray','File\x20not\x20found:\x20','tableName','sql','map','valid','file','schema:','get','size','name','tables','10448VwkmKK','read','fields','appCode','split','18iLvAeL','schemaWarnings','1988274WovEeL','Path\x20to\x20the\x20SQL\x20file\x20to\x20validate','toLowerCase','Inline\x20SQL\x20content\x20to\x20validate\x20(alternative\x20to\x20--file)','Dataset\x20\x22','295848rumvXb','840815AJwLmC','validate','str','parameters','Comma-separated\x20dataset\x20codes\x20to\x20cross-check\x20table/column\x20names\x20against','flagMissing','5809610Osbrqf','2Bvtcew','sqlType','\x22\x20not\x20found\x20in\x20any\x20dataset','filter','dbtableConfig','70KpXEFr','Validate\x20SQL\x20content\x20without\x20saving\x20(type\x20detection,\x20parameter\x20extraction,\x20optional\x20schema\x20check)','isSelectOnly','reason','cwd'];a167_0x4d9e=function(){return _0x3204f3;};return a167_0x4d9e();}import{validateSql}from'../../core/sql-validator.js';import{getDatasetDetail,listDatasets}from'../../core/api-client.js';function a167_0x29e7(_0x295fbc,_0x192595){_0x295fbc=_0x295fbc-0xa8;const _0x4d9ec0=a167_0x4d9e();let _0x29e75a=_0x4d9ec0[_0x295fbc];return _0x29e75a;}import{CliErrors}from'../../errors.js';import{assertDatasetIsDbTableBacked,filterDbTableBackedDatasets}from'../../commands/dataset/capability.js';export const sqlValidate={'service':a167_0x4d82bb(0xb2),'command':a167_0x4d82bb(0xc9),'description':a167_0x4d82bb(0xd5),'risk':a167_0x4d82bb(0xbc),'flags':[{'name':a167_0x4d82bb(0xb5),'type':'string','description':a167_0x4d82bb(0xc3)},{'name':a167_0x4d82bb(0xb2),'type':'string','description':a167_0x4d82bb(0xc5)},{'name':'schemas','type':'string','description':a167_0x4d82bb(0xcc)}],async 'execute'(_0x174640){const _0x63820b=a167_0x4d82bb,_0x10dddc=_0x174640['str'](_0x63820b(0xb5)),_0x5b9c89=_0x174640[_0x63820b(0xca)](_0x63820b(0xb2));if(!_0x10dddc&&!_0x5b9c89)throw CliErrors[_0x63820b(0xcd)](_0x63820b(0xb5),_0x63820b(0xdd));let _0x34b087;if(_0x10dddc){const _0x4e2f40=resolve(process[_0x63820b(0xd8)](),_0x10dddc);if(!existsSync(_0x4e2f40))throw CliErrors[_0x63820b(0xad)](_0x63820b(0xb0)+_0x4e2f40);_0x34b087=readFileSync(_0x4e2f40,'utf-8');}else _0x34b087=_0x5b9c89;const _0x5aaf55=validateSql(_0x34b087),_0x450272={'valid':_0x5aaf55['valid'],'sqlType':_0x5aaf55[_0x63820b(0xd0)][_0x63820b(0xdb)],'isSelectOnly':_0x5aaf55[_0x63820b(0xd0)][_0x63820b(0xd6)],'isDangerous':_0x5aaf55[_0x63820b(0xd0)][_0x63820b(0xd9)],'tables':_0x5aaf55[_0x63820b(0xba)],'parameters':_0x5aaf55[_0x63820b(0xcb)],'message':_0x5aaf55[_0x63820b(0xa9)]};_0x5aaf55[_0x63820b(0xd0)][_0x63820b(0xd7)]&&(_0x450272[_0x63820b(0xd7)]=_0x5aaf55[_0x63820b(0xd0)][_0x63820b(0xd7)]);const _0x4ef85d=_0x174640['str']('schemas');if(_0x4ef85d&&_0x5aaf55[_0x63820b(0xb4)]){const _0x2a3312=_0x4ef85d[_0x63820b(0xbf)](',')[_0x63820b(0xb3)](_0x2d3045=>_0x2d3045[_0x63820b(0xac)]())[_0x63820b(0xd2)](Boolean),_0x3a4b3a=[],_0x48aa55=filterDbTableBackedDatasets(await listDatasets(_0x174640[_0x63820b(0xbe)])),_0x21017a=new Map(_0x48aa55[_0x63820b(0xb3)](_0x1ddea1=>[_0x1ddea1[_0x63820b(0xd3)]?.[_0x63820b(0xb1)]?.[_0x63820b(0xc4)](),_0x1ddea1]));for(const _0x2de5b4 of _0x5aaf55[_0x63820b(0xba)]){const _0x43291c=_0x21017a[_0x63820b(0xb7)](_0x2de5b4['toLowerCase']());!_0x43291c&&_0x3a4b3a['push'](_0x63820b(0xae)+_0x2de5b4+_0x63820b(0xd1));}for(const _0x1a9ee6 of _0x2a3312){let _0x4cba05;try{_0x4cba05=await getDatasetDetail(_0x1a9ee6);}catch{_0x3a4b3a[_0x63820b(0xde)](_0x63820b(0xc6)+_0x1a9ee6+'\x22\x20not\x20found\x20or\x20not\x20accessible');continue;}assertDatasetIsDbTableBacked(_0x4cba05,_0x63820b(0xaa));const _0x2e3135=Array[_0x63820b(0xaf)](_0x4cba05[_0x63820b(0xbd)])?_0x4cba05[_0x63820b(0xbd)]:[],_0x322e5a=new Set(_0x2e3135['map'](_0x155cbc=>_0x155cbc[_0x63820b(0xb9)]?.[_0x63820b(0xc4)]())),_0x20266a=_0x4cba05[_0x63820b(0xd3)]?.[_0x63820b(0xb1)]||_0x4cba05[_0x63820b(0xb1)]||_0x1a9ee6;_0x450272[_0x63820b(0xb6)+_0x20266a]={'code':_0x1a9ee6,'tableName':_0x20266a,'fieldCount':_0x322e5a[_0x63820b(0xb8)],'fields':Array[_0x63820b(0xab)](_0x322e5a)};}_0x3a4b3a['length']>0x0&&(_0x450272[_0x63820b(0xc1)]=_0x3a4b3a);}return{'ok':_0x5aaf55[_0x63820b(0xb4)],'data':_0x450272,'message':_0x5aaf55[_0x63820b(0xa9)]};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a168_0x186b1d=a168_0x1fb2;function a168_0x1fb2(_0x5b5f17,_0x6b02a2){_0x5b5f17=_0x5b5f17-0x1c2;const _0x501d99=a168_0x501d();let _0x1fb2a2=_0x501d99[_0x5b5f17];return _0x1fb2a2;}function a168_0x501d(){const _0x25a9f4=['883832YbqaEA','workspace\x20add','4556898ZMXBRT','write','8411328xuoBSC','App\x20profile\x20name','Register\x20an\x20app\x20profile\x20in\x20the\x20current\x20workspace\x20(or\x20--global)','28750477kFmtyY','8463330VlOLpS','2297742WbpApx','552570CYBJnR'];a168_0x501d=function(){return _0x25a9f4;};return a168_0x501d();}(function(_0x1442a8,_0x3ff160){const _0x148745=a168_0x1fb2,_0x262d70=_0x1442a8();while(!![]){try{const _0x38b689=-parseInt(_0x148745(0x1cb))/0x1+parseInt(_0x148745(0x1ca))/0x2+parseInt(_0x148745(0x1c3))/0x3+-parseInt(_0x148745(0x1cc))/0x4+parseInt(_0x148745(0x1c9))/0x5+parseInt(_0x148745(0x1c5))/0x6+-parseInt(_0x148745(0x1c8))/0x7;if(_0x38b689===_0x3ff160)break;else _0x262d70['push'](_0x262d70['shift']());}catch(_0xcb3ef6){_0x262d70['push'](_0x262d70['shift']());}}}(a168_0x501d,0xd73f4));import{buildAppAddFlags,runAppAdd,validateAppName}from'../../commands/common/app-registry.js';export const workspaceAddDefinition={'service':'workspace','command':'add','description':a168_0x186b1d(0x1c7),'risk':a168_0x186b1d(0x1c4),'requiresAuth':![],'requiresAppCode':![],'args':[{'name':'name','description':a168_0x186b1d(0x1c6),'required':!![]}],'flags':buildAppAddFlags(),'validate':_0x3537f4=>validateAppName(_0x3537f4,a168_0x186b1d(0x1c2)),'execute':_0x1b884a=>runAppAdd(_0x1b884a,a168_0x186b1d(0x1c2))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a169_0x11316a=a169_0x4ee7;(function(_0x1368c5,_0x38256a){const _0x4f4a03=a169_0x4ee7,_0x23deff=_0x1368c5();while(!![]){try{const _0x9e026=parseInt(_0x4f4a03(0x117))/0x1*(-parseInt(_0x4f4a03(0x108))/0x2)+parseInt(_0x4f4a03(0x132))/0x3*(parseInt(_0x4f4a03(0x12c))/0x4)+-parseInt(_0x4f4a03(0x115))/0x5*(parseInt(_0x4f4a03(0x116))/0x6)+parseInt(_0x4f4a03(0x110))/0x7+-parseInt(_0x4f4a03(0x10b))/0x8+parseInt(_0x4f4a03(0x124))/0x9*(parseInt(_0x4f4a03(0x12f))/0xa)+parseInt(_0x4f4a03(0x104))/0xb;if(_0x9e026===_0x38256a)break;else _0x23deff['push'](_0x23deff['shift']());}catch(_0x11b6ea){_0x23deff['push'](_0x23deff['shift']());}}}(a169_0x24ba,0x6e71e));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';function a169_0x24ba(){const _0x32b7d6=['\x20(appcode:\x20','defaultFormat','.\x20Credentials:\x20not\x20written.','workspace.','Locale\x20for\x20this\x20workspace\x20app\x20profile','Default\x20page\x20size\x20for\x20this\x20workspace\x20app\x20profile','isArray','200iyFmYo','Target\x20environment','Use\x20`','10GUoSmA','Invalid\x20appcode:\x20','format','18861csOKWY','riskLevel','updated','trim','\x20workspace\x20init\x20--appcode\x20<code>`\x20or\x20`','str','defaultApp','pageSize',').\x20Config:\x20','write','Missing\x20workspace\x20app\x20selector.','1689831cmyPaU','env','locale','\x20workspace\x20','4prnbDo','App\x20code\x20to\x20bind\x20to\x20this\x20workspace','flag','1041864SvaFQf','number','Switch\x20the\x20current\x20workspace\x20app\x20binding','join','apiDir','3666852VRaqSA','object','appcode','workspace','validation','4241135jbAcfp','6niukyY','226843IlMyPE','\x20--app\x20','use','init','string','app','Workspace\x20','length','Risk\x20level\x20for\x20this\x20workspace\x20app\x20profile','apps','\x20workspace\x20<init|use>\x20--app\x20<name>\x20[--appcode\x20<code>]','\x20workspace\x20use\x20--app\x20<name>`.','Default\x20output\x20format\x20for\x20this\x20workspace\x20app\x20profile','8034489wlHMJW'];a169_0x24ba=function(){return _0x32b7d6;};return a169_0x24ba();}import{RISK_LEVEL_VALUES}from'../../constant/risk.js';import{validateAppcode}from'../../commands/common/validate.js';import{readConfigFile,readRawConfigWithLayers,resolveWriteConfigPath,writeConfigFile}from'../../context.js';import{workspaceAddDefinition}from'../../commands/workspace/add.js';import{workspaceRemoveDefinition}from'../../commands/workspace/remove.js';const WORKSPACE_USAGE=CLI_BIN_NAME+a169_0x11316a(0x121),SAFE_PROFILE_KEYS=[a169_0x11316a(0x112),a169_0x11316a(0x105),a169_0x11316a(0x10f),a169_0x11316a(0x131),a169_0x11316a(0x139),a169_0x11316a(0x133),a169_0x11316a(0x106)],workspaceFlags=[{'name':'app','type':a169_0x11316a(0x11b),'description':'App\x20profile\x20name\x20to\x20use\x20in\x20this\x20workspace'},{'name':a169_0x11316a(0x112),'type':'string','description':a169_0x11316a(0x109)},{'name':'env','type':'string','description':a169_0x11316a(0x12d),'enum':[...RABETBASE_ENV_VALUES]},{'name':a169_0x11316a(0x10f),'type':a169_0x11316a(0x11b),'description':'API\x20directory\x20path\x20for\x20this\x20workspace\x20app\x20profile'},{'name':a169_0x11316a(0x126),'type':'string','description':a169_0x11316a(0x123),'enum':[...RABETBASE_OUTPUT_FORMAT_VALUES]},{'name':a169_0x11316a(0x139),'type':a169_0x11316a(0x10c),'description':a169_0x11316a(0x12a)},{'name':a169_0x11316a(0x133),'type':a169_0x11316a(0x11b),'description':a169_0x11316a(0x11f),'enum':[...RISK_LEVEL_VALUES]},{'name':a169_0x11316a(0x106),'type':'string','description':a169_0x11316a(0x129)}];function isRecord(_0xc885fa){const _0x1869da=a169_0x11316a;return!!_0xc885fa&&typeof _0xc885fa===_0x1869da(0x111)&&!Array[_0x1869da(0x12b)](_0xc885fa);}function a169_0x4ee7(_0x2da235,_0x46bf80){_0x2da235=_0x2da235-0x101;const _0x24baef=a169_0x24ba();let _0x4ee711=_0x24baef[_0x2da235];return _0x4ee711;}function assertValidAppcode(_0x58da16){const _0x39010a=a169_0x11316a,{valid:_0x4ce5f7,message:_0x12c852}=validateAppcode(_0x58da16);if(!_0x4ce5f7)throw CliErrors[_0x39010a(0x114)](_0x39010a(0x130)+_0x58da16,_0x12c852);}function sanitizeProfile(_0x4e2415){if(!isRecord(_0x4e2415))return{};const _0x5b5dde={};for(const _0xc81412 of SAFE_PROFILE_KEYS){if(_0x4e2415[_0xc81412]!==undefined)_0x5b5dde[_0xc81412]=_0x4e2415[_0xc81412];}return _0x5b5dde;}function cloneProfile(_0x353e6e){return isRecord(_0x353e6e)?{..._0x353e6e}:{};}function collectWorkspaceProfileOverrides(_0xb7bec0){const _0x45487f=a169_0x11316a,_0x2b1bfd={},_0x470d98=_0xb7bec0[_0x45487f(0x137)](_0x45487f(0x105)),_0x471895=_0xb7bec0['str']('apiDir'),_0x4c6d07=_0xb7bec0[_0x45487f(0x137)]('defaultFormat'),_0x59dfab=_0xb7bec0[_0x45487f(0x10a)](_0x45487f(0x139)),_0x396d74=_0xb7bec0[_0x45487f(0x137)](_0x45487f(0x133)),_0x5e7f0b=_0xb7bec0['str'](_0x45487f(0x106));if(_0x470d98)_0x2b1bfd[_0x45487f(0x105)]=_0x470d98;if(_0x471895)_0x2b1bfd[_0x45487f(0x10f)]=_0x471895;if(_0x4c6d07)_0x2b1bfd[_0x45487f(0x131)]=_0x4c6d07;if(_0x59dfab!==undefined&&_0x59dfab!=='')_0x2b1bfd['pageSize']=Number(_0x59dfab);if(_0x396d74)_0x2b1bfd['riskLevel']=_0x396d74;if(_0x5e7f0b)_0x2b1bfd[_0x45487f(0x106)]=_0x5e7f0b;return _0x2b1bfd;}async function validateWorkspaceArgs(_0x58f6a4){const _0xa1b99b=a169_0x11316a,_0x3a35d7=_0x58f6a4[_0xa1b99b(0x137)](_0xa1b99b(0x11c))[_0xa1b99b(0x135)](),_0x45739e=_0x58f6a4['str'](_0xa1b99b(0x112))[_0xa1b99b(0x135)]();if(!_0x3a35d7&&!_0x45739e)throw CliErrors[_0xa1b99b(0x114)](_0xa1b99b(0x103),'Use\x20`'+CLI_BIN_NAME+_0xa1b99b(0x136)+CLI_BIN_NAME+_0xa1b99b(0x122));if(_0x45739e)assertValidAppcode(_0x45739e);}function resolveKnownApps(){const _0x26039f=a169_0x11316a,{config:_0x1667fd,layers:_0x4b1a9a}=readRawConfigWithLayers(),_0x3a3266=isRecord(_0x1667fd[_0x26039f(0x120)])?_0x1667fd['apps']:{},_0x32a818=isRecord(_0x4b1a9a['globalConfig'][_0x26039f(0x120)])?_0x4b1a9a['globalConfig'][_0x26039f(0x120)]:{};return{..._0x32a818,..._0x3a3266};}async function configureWorkspace(_0x312ae8,_0x20236a){const _0x586cf1=a169_0x11316a,_0x532f04=_0x312ae8['str']('app')[_0x586cf1(0x135)](),_0xb25ba1=_0x312ae8[_0x586cf1(0x137)](_0x586cf1(0x112))[_0x586cf1(0x135)](),_0x22c3a5=_0x532f04||_0xb25ba1;if(!_0x22c3a5)throw CliErrors[_0x586cf1(0x114)](_0x586cf1(0x103),_0x586cf1(0x12e)+CLI_BIN_NAME+_0x586cf1(0x136)+CLI_BIN_NAME+_0x586cf1(0x122));if(_0xb25ba1)assertValidAppcode(_0xb25ba1);const _0x4802b0=resolveWriteConfigPath('project'),_0x15e36a=readConfigFile(_0x4802b0),_0x531f3b=resolveKnownApps(),_0x372681=isRecord(_0x15e36a[_0x586cf1(0x120)])?{..._0x15e36a[_0x586cf1(0x120)]}:{},_0xe94338=cloneProfile(_0x372681[_0x22c3a5]),_0x9c1d36=sanitizeProfile(_0x531f3b[_0x22c3a5]),_0x59374a=_0xb25ba1?{}:_0x9c1d36,_0x15ab9b=_0xb25ba1||_0x59374a[_0x586cf1(0x112)];if(!_0x15ab9b){const _0x2251f3=Object['keys'](_0x531f3b),_0x3ef8e6=_0x2251f3[_0x586cf1(0x11e)]===0x0?_0x586cf1(0x12e)+CLI_BIN_NAME+_0x586cf1(0x107)+_0x20236a+_0x586cf1(0x118)+_0x22c3a5+'\x20--appcode\x20<code>`.':'Pass\x20--appcode\x20<code>,\x20or\x20choose\x20one\x20of:\x20'+_0x2251f3[_0x586cf1(0x10e)](',\x20');throw CliErrors[_0x586cf1(0x114)]('App\x20\x22'+_0x22c3a5+'\x22\x20not\x20found.',_0x3ef8e6);}assertValidAppcode(String(_0x15ab9b));const _0x3b06b5={..._0x59374a,..._0xe94338,'appcode':String(_0x15ab9b),...collectWorkspaceProfileOverrides(_0x312ae8)};return _0x372681[_0x22c3a5]=_0x3b06b5,_0x15e36a[_0x586cf1(0x120)]=_0x372681,_0x15e36a[_0x586cf1(0x138)]=_0x22c3a5,delete _0x15e36a['appcode'],delete _0x15e36a[_0x586cf1(0x11c)],_0x3b06b5['env']&&(_0x15e36a['env']=_0x3b06b5[_0x586cf1(0x105)]),writeConfigFile(_0x4802b0,_0x15e36a),{'ok':!![],'message':_0x586cf1(0x11d)+(_0x20236a===_0x586cf1(0x11a)?'initialized':_0x586cf1(0x134))+':\x20'+_0x22c3a5+_0x586cf1(0x125)+_0x3b06b5['appcode']+_0x586cf1(0x101)+_0x4802b0+_0x586cf1(0x127),'data':{'operation':_0x586cf1(0x128)+_0x20236a,'configPath':_0x4802b0,'app':_0x22c3a5,'appcode':_0x3b06b5['appcode'],'env':_0x3b06b5[_0x586cf1(0x105)]??null,'credentialsWritten':![]}};}const workspaceInitDefinition={'service':a169_0x11316a(0x113),'command':a169_0x11316a(0x11a),'description':'Initialize\x20the\x20current\x20workspace\x20app\x20binding','risk':a169_0x11316a(0x102),'requiresAuth':![],'requiresAppCode':![],'args':[],'flags':workspaceFlags,'validate':validateWorkspaceArgs,'execute':_0x5edf45=>configureWorkspace(_0x5edf45,a169_0x11316a(0x11a))},workspaceUseDefinition={'service':a169_0x11316a(0x113),'command':'use','description':a169_0x11316a(0x10d),'risk':a169_0x11316a(0x102),'requiresAuth':![],'requiresAppCode':![],'args':[],'flags':workspaceFlags,'validate':validateWorkspaceArgs,'execute':_0x213f49=>configureWorkspace(_0x213f49,a169_0x11316a(0x119))};export const workspaceDefinitions=[workspaceInitDefinition,workspaceUseDefinition,workspaceAddDefinition,workspaceRemoveDefinition];export{WORKSPACE_USAGE};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a170_0x5627(){const _0x104960=['9763328ZpJcyD','1280936sMXURQ','13201191TwvskK','3414vXkryg','2825380wGfIPP','16471kwLodC','name','workspace','3JPzcbY','App\x20profile\x20name\x20to\x20remove','174806ZUQzff','remove','3503280fKkFJV'];a170_0x5627=function(){return _0x104960;};return a170_0x5627();}const a170_0xe6358f=a170_0x4ff4;(function(_0xdffe56,_0x355ecc){const _0x463014=a170_0x4ff4,_0x4df74d=_0xdffe56();while(!![]){try{const _0x4f51e1=-parseInt(_0x463014(0xaf))/0x1*(-parseInt(_0x463014(0xb1))/0x2)+parseInt(_0x463014(0xb3))/0x3+parseInt(_0x463014(0xb5))/0x4+parseInt(_0x463014(0xb8))/0x5+parseInt(_0x463014(0xb7))/0x6*(-parseInt(_0x463014(0xb9))/0x7)+parseInt(_0x463014(0xb4))/0x8+-parseInt(_0x463014(0xb6))/0x9;if(_0x4f51e1===_0x355ecc)break;else _0x4df74d['push'](_0x4df74d['shift']());}catch(_0x13526c){_0x4df74d['push'](_0x4df74d['shift']());}}}(a170_0x5627,0xb23b7));function a170_0x4ff4(_0x3cf311,_0x30657c){_0x3cf311=_0x3cf311-0xaf;const _0x56276c=a170_0x5627();let _0x4ff4a9=_0x56276c[_0x3cf311];return _0x4ff4a9;}import{buildAppRemoveFlags,runAppRemove,validateAppName}from'../../commands/common/app-registry.js';export const workspaceRemoveDefinition={'service':a170_0xe6358f(0xbb),'command':a170_0xe6358f(0xb2),'description':'Remove\x20an\x20app\x20profile\x20from\x20the\x20current\x20workspace\x20(or\x20--global)','risk':'high-risk-write','requiresAuth':![],'requiresAppCode':![],'args':[{'name':a170_0xe6358f(0xba),'description':a170_0xe6358f(0xb0),'required':!![]}],'flags':buildAppRemoveFlags(),'validate':_0x5e7ae6=>validateAppName(_0x5e7ae6,'workspace\x20remove'),'execute':_0x32531e=>runAppRemove(_0x32531e,'workspace\x20remove')};
|
package/lib/config/schema.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a171_0x37caf0=a171_0x3542;(function(_0x13a925,_0x9ad161){const _0x14df3f=a171_0x3542,_0x352c00=_0x13a925();while(!![]){try{const _0x543322=-parseInt(_0x14df3f(0x20d))/0x1*(-parseInt(_0x14df3f(0x219))/0x2)+parseInt(_0x14df3f(0x207))/0x3*(parseInt(_0x14df3f(0x21c))/0x4)+parseInt(_0x14df3f(0x218))/0x5*(parseInt(_0x14df3f(0x1fc))/0x6)+-parseInt(_0x14df3f(0x1f8))/0x7+parseInt(_0x14df3f(0x21e))/0x8*(-parseInt(_0x14df3f(0x1f7))/0x9)+-parseInt(_0x14df3f(0x213))/0xa+-parseInt(_0x14df3f(0x209))/0xb*(parseInt(_0x14df3f(0x212))/0xc);if(_0x543322===_0x9ad161)break;else _0x352c00['push'](_0x352c00['shift']());}catch(_0x17c6f8){_0x352c00['push'](_0x352c00['shift']());}}}(a171_0xead8,0xcfbbc));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';function a171_0x3542(_0x45312f,_0x528926){_0x45312f=_0x45312f-0x1f4;const _0xead886=a171_0xead8();let _0x354221=_0xead886[_0x45312f];return _0x354221;}export const PROJECT_CREATE_INHERITABLE_KEYS=[a171_0x37caf0(0x1f4),a171_0x37caf0(0x200),'locale',a171_0x37caf0(0x211),'riskLevel'];export const TOP_LEVEL_CONFIG_KEYS=new Set([a171_0x37caf0(0x220),a171_0x37caf0(0x1fb),'locale','format',a171_0x37caf0(0x1f4),a171_0x37caf0(0x200),a171_0x37caf0(0x210)]);export const CONFIG_ENUM_VALUES={'env':[...RABETBASE_ENV_VALUES],'format':[...RABETBASE_OUTPUT_FORMAT_VALUES]};export function formatConfigKeyList(_0x2b5c7b){const _0x3f503c=a171_0x37caf0;return[..._0x2b5c7b][_0x3f503c(0x1fa)](',\x20');}export function getTopLevelConfigKeyList(){return[...TOP_LEVEL_CONFIG_KEYS];}function a171_0xead8(){const _0x2ff896=['defaultFormat','join','env','2188194zUZUTD','locale','length','map','accessKey','defaultApp','string','Auth\x20cookie','Access\x20key','apps','number','375NqIAPl','en-US','36773ExxgcH','zh-CN','toLowerCase','Locale','1twkzEM','app','Target\x20environment','apiDir','format','1644PERHxI','4719470AdbpSa','Default\x20page\x20size','riskLevel','pageSize','keys','20JDvMOd','1380586pwdMAq','filter','Risk\x20level','33952oHAlpv','inherit','8vEkawy','Default\x20output\x20format\x20for\x20this\x20app\x20(profile)','appcode','API\x20directory\x20path','cookie','entries','Config\x20key\x20(','10750347CkkzIX','1643544qawonx'];a171_0xead8=function(){return _0x2ff896;};return a171_0xead8();}export function isTopLevelConfigKey(_0x3091eb){return TOP_LEVEL_CONFIG_KEYS['has'](_0x3091eb);}export function getTopLevelConfigKeySummary(){return formatConfigKeyList(getTopLevelConfigKeyList());}export function getConfigCommandKeyDescription(){const _0x524939=a171_0x37caf0;return _0x524939(0x1f6)+getTopLevelConfigKeySummary()+')';}export const APP_PROFILE_FLAG_KEY_MAP={'env':a171_0x37caf0(0x1fb),'apiDir':a171_0x37caf0(0x210),'cookie':a171_0x37caf0(0x1f4),'accessKey':a171_0x37caf0(0x200),'defaultFormat':a171_0x37caf0(0x211),'pageSize':'pageSize','riskLevel':a171_0x37caf0(0x215),'locale':'locale'};export function getAppProfileFlagDefs(){const _0xd49eca=a171_0x37caf0;return[{'name':'env','type':'string','description':_0xd49eca(0x20f),'enum':[...RABETBASE_ENV_VALUES]},{'name':_0xd49eca(0x210),'type':_0xd49eca(0x202),'description':_0xd49eca(0x221)},{'name':_0xd49eca(0x1f4),'type':_0xd49eca(0x202),'description':_0xd49eca(0x203),'hidden':!![]},{'name':_0xd49eca(0x200),'type':_0xd49eca(0x202),'description':_0xd49eca(0x204),'hidden':!![]},{'name':_0xd49eca(0x1f9),'type':'string','description':_0xd49eca(0x21f),'enum':[...RABETBASE_OUTPUT_FORMAT_VALUES]},{'name':_0xd49eca(0x216),'type':_0xd49eca(0x206),'description':_0xd49eca(0x214)},{'name':_0xd49eca(0x215),'type':'string','description':_0xd49eca(0x21b),'enum':[...RISK_LEVEL_VALUES]},{'name':_0xd49eca(0x1fd),'type':'string','description':_0xd49eca(0x20c)}];}export function collectAppProfileOverrides(_0x4eb39d){const _0x42f56a=a171_0x37caf0,_0x3a0ea6={};for(const [_0x3674d7,_0x294765]of Object[_0x42f56a(0x1f5)](APP_PROFILE_FLAG_KEY_MAP)){const _0x43b11a=_0x4eb39d(_0x3674d7);if(!_0x43b11a)continue;_0x3a0ea6[_0x294765]=_0x294765===_0x42f56a(0x216)?Number(_0x43b11a):_0x43b11a;}return _0x3a0ea6;}export function buildAppProfileListFields(_0x566f0e){const _0x40da0c=a171_0x37caf0;return{'env':_0x566f0e[_0x40da0c(0x1fb)]??null,'apiDir':_0x566f0e[_0x40da0c(0x210)]??null,'hasCookie':!!_0x566f0e[_0x40da0c(0x1f4)],'hasAccessKey':!!_0x566f0e[_0x40da0c(0x200)],'format':_0x566f0e['format']??null,'pageSize':_0x566f0e[_0x40da0c(0x216)]??null,'riskLevel':_0x566f0e['riskLevel']??null,'locale':_0x566f0e[_0x40da0c(0x1fd)]??null};}export function buildAppDoctorFields(_0x45c0af,_0x57daa5){const _0x5c863c=a171_0x37caf0;return{'env':{'value':_0x45c0af['env']||_0x57daa5[_0x5c863c(0x1fb)],'source':_0x45c0af[_0x5c863c(0x1fb)]?_0x5c863c(0x20e):'inherit'},'apiDir':{'value':_0x45c0af[_0x5c863c(0x210)]||_0x57daa5[_0x5c863c(0x210)],'source':_0x45c0af[_0x5c863c(0x210)]?'app':_0x5c863c(0x21d)},'cookie':{'value':_0x45c0af[_0x5c863c(0x1f4)]||_0x57daa5[_0x5c863c(0x1f4)],'source':_0x45c0af['cookie']?_0x5c863c(0x20e):_0x5c863c(0x21d)},'accessKey':{'value':_0x45c0af['accessKey']||_0x57daa5[_0x5c863c(0x200)],'source':_0x45c0af[_0x5c863c(0x200)]?_0x5c863c(0x20e):_0x5c863c(0x21d)}};}export function buildCanonicalAppConfig(_0x86fff5,_0x1ae522){const _0x1a7a3b=a171_0x37caf0,_0x138207=_0x86fff5[_0x1a7a3b(0x1ff)](_0x1260dc=>String(_0x1260dc||'')['trim']())[_0x1a7a3b(0x21a)](Boolean);if(_0x138207[_0x1a7a3b(0x1fe)]===0x0)return{};const _0x2a4e31={};for(const _0x98052f of _0x138207){_0x2a4e31[_0x98052f]=_0x1ae522?{'appcode':_0x98052f,'env':_0x1ae522}:{'appcode':_0x98052f};}return{'apps':_0x2a4e31,'defaultApp':_0x138207[0x0]};}export function buildCanonicalProjectConfig(_0x5e1a34,_0x44d105){const _0x47c9c0=a171_0x37caf0,{appCodes:appCodes=[],env:_0x321b28,metadata:_0x11cc6b}=_0x44d105,_0x59c754={..._0x5e1a34,..._0x11cc6b||{}};delete _0x59c754[_0x47c9c0(0x220)],delete _0x59c754['app'];if(_0x321b28)_0x59c754[_0x47c9c0(0x1fb)]=_0x321b28;else!_0x59c754[_0x47c9c0(0x1fb)]&&(_0x59c754['env']=DEFAULT_CONFIG_VALUES['env']);const _0x1e3652=buildCanonicalAppConfig(appCodes,_0x59c754['env']);return Object[_0x47c9c0(0x217)](_0x1e3652)[_0x47c9c0(0x1fe)]>0x0&&(_0x59c754[_0x47c9c0(0x205)]=_0x1e3652[_0x47c9c0(0x205)],_0x59c754['defaultApp']=_0x1e3652[_0x47c9c0(0x201)]),_0x59c754;}const LOCALE_MAP={'zh':a171_0x37caf0(0x20a),'zh-cn':a171_0x37caf0(0x20a),'zh_cn':a171_0x37caf0(0x20a),'en':a171_0x37caf0(0x208),'en-us':a171_0x37caf0(0x208),'en_us':'en-US'};export function normalizeLocale(_0x399836){const _0x86ba80=a171_0x37caf0;if(!_0x399836)return null;return LOCALE_MAP[_0x399836[_0x86ba80(0x20b)]()]??null;}
|
package/lib/constant/cdn.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a172_0x2151(){const _0x56b799=['1634414bqtrzt','52JNFgkU','750018OYBGjy','9VjTCCL','11381700drgFED','3425124PghuBC','7xtlPqf','401819mztWHT','12290364YtOChf','435905CVloXu','8VdbLDE','180mNqeSz','https://g.lovrabet.com/dist/rabetbase-cli/config/index.json'];a172_0x2151=function(){return _0x56b799;};return a172_0x2151();}function a172_0x4bf1(_0x1c7fba,_0x303b93){_0x1c7fba=_0x1c7fba-0x1ba;const _0x215103=a172_0x2151();let _0x4bf133=_0x215103[_0x1c7fba];return _0x4bf133;}const a172_0x164431=a172_0x4bf1;(function(_0x3dec52,_0x52666c){const _0x5ee2a8=a172_0x4bf1,_0x3e90d6=_0x3dec52();while(!![]){try{const _0x2ccfcf=-parseInt(_0x5ee2a8(0x1c1))/0x1+parseInt(_0x5ee2a8(0x1c3))/0x2*(parseInt(_0x5ee2a8(0x1c4))/0x3)+parseInt(_0x5ee2a8(0x1c2))/0x4*(-parseInt(_0x5ee2a8(0x1bd))/0x5)+parseInt(_0x5ee2a8(0x1c6))/0x6*(parseInt(_0x5ee2a8(0x1ba))/0x7)+parseInt(_0x5ee2a8(0x1be))/0x8*(parseInt(_0x5ee2a8(0x1bc))/0x9)+parseInt(_0x5ee2a8(0x1c5))/0xa+parseInt(_0x5ee2a8(0x1bb))/0xb*(-parseInt(_0x5ee2a8(0x1bf))/0xc);if(_0x2ccfcf===_0x52666c)break;else _0x3e90d6['push'](_0x3e90d6['shift']());}catch(_0x5d337c){_0x3e90d6['push'](_0x3e90d6['shift']());}}}(a172_0x2151,0xd7ce9));export const CLI_VERSION_POLICY_URL=a172_0x164431(0x1c0);
|