@lovrabet/rabetbase-cli 2.3.7 → 2.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/api-doc.js +1 -1
- package/lib/api/fetch-model-list.js +1 -1
- package/lib/api/generate-api-file.js +1 -1
- package/lib/auth/auth-server-ui.js +1 -1
- package/lib/auth/auth-server.js +1 -1
- package/lib/auth/constant.js +1 -1
- package/lib/auth/get-cookie.js +1 -1
- package/lib/auth/get-session-user.js +1 -1
- package/lib/auth/is-session-valid.js +1 -1
- package/lib/auth/login-success-html.js +1 -1
- package/lib/auth/logout.js +1 -1
- package/lib/cli-flags.js +1 -1
- package/lib/cli.js +1 -1
- package/lib/commands/api/generate.js +1 -1
- package/lib/commands/api/index.js +1 -1
- package/lib/commands/api/list.js +1 -1
- package/lib/commands/api/pull.js +1 -1
- package/lib/commands/api/shared.js +1 -1
- package/lib/commands/app/add.js +1 -1
- package/lib/commands/app/index.js +1 -1
- package/lib/commands/app/list.js +1 -1
- package/lib/commands/app/remote-directory.js +1 -1
- package/lib/commands/app/remove.js +1 -1
- package/lib/commands/app/shared.js +1 -1
- package/lib/commands/app-config/delete.js +1 -1
- package/lib/commands/app-config/get.js +1 -1
- package/lib/commands/app-config/index.js +1 -1
- package/lib/commands/app-config/list.js +1 -1
- package/lib/commands/app-config/set.js +1 -1
- package/lib/commands/app-config/shared.js +1 -1
- package/lib/commands/auth/index.js +1 -1
- package/lib/commands/bff/create.js +1 -1
- package/lib/commands/bff/delete.js +1 -1
- package/lib/commands/bff/detail.js +1 -1
- package/lib/commands/bff/index.js +1 -1
- package/lib/commands/bff/list.js +1 -1
- package/lib/commands/bff/pull.js +1 -1
- package/lib/commands/bff/push.js +1 -1
- package/lib/commands/bff/status.js +1 -1
- package/lib/commands/cli-skill/index.js +1 -1
- package/lib/commands/cli-update.js +1 -1
- package/lib/commands/codegen/index.js +1 -1
- package/lib/commands/codegen/sdk.js +1 -1
- package/lib/commands/codegen/sql.js +1 -1
- package/lib/commands/common/app-registry.js +1 -1
- package/lib/commands/common/app-selector.js +1 -1
- package/lib/commands/common/dry-run.js +1 -1
- package/lib/commands/common/flags.js +1 -1
- package/lib/commands/common/local-file.js +1 -1
- package/lib/commands/common/validate.js +1 -1
- package/lib/commands/config/get.js +1 -1
- package/lib/commands/config/index.js +1 -1
- package/lib/commands/config/list.js +1 -1
- package/lib/commands/config/set.js +1 -1
- package/lib/commands/config/shared.js +1 -1
- package/lib/commands/data/filter.js +1 -1
- package/lib/commands/data/getOne.js +1 -1
- package/lib/commands/data/index.js +1 -1
- package/lib/commands/data/shared.js +1 -1
- package/lib/commands/dataset/business-group-update.js +1 -1
- package/lib/commands/dataset/capability.js +1 -1
- package/lib/commands/dataset/delete.js +1 -1
- package/lib/commands/dataset/detail.js +1 -1
- package/lib/commands/dataset/extend-update.js +1 -1
- package/lib/commands/dataset/field-update.js +1 -1
- package/lib/commands/dataset/generate.js +1 -1
- package/lib/commands/dataset/index.js +1 -1
- package/lib/commands/dataset/list.js +1 -1
- package/lib/commands/dataset/operations.js +1 -1
- package/lib/commands/dataset/relation-audit.js +1 -1
- package/lib/commands/dataset/relation-create.js +1 -1
- package/lib/commands/dataset/relation-delete.js +1 -1
- package/lib/commands/dataset/relation-shared.js +1 -1
- package/lib/commands/dataset/relation-update.js +1 -1
- package/lib/commands/dataset/relations.js +1 -1
- package/lib/commands/dataset/rename.js +1 -1
- package/lib/commands/dataset/restore.js +1 -1
- package/lib/commands/db/analysis-batching.js +1 -1
- package/lib/commands/db/analyze-batch-plan.js +1 -1
- package/lib/commands/db/analyze-cancel.js +1 -1
- package/lib/commands/db/analyze-start.js +1 -1
- package/lib/commands/db/analyze-status.js +1 -1
- package/lib/commands/db/create.js +1 -1
- package/lib/commands/db/delete.js +1 -1
- package/lib/commands/db/detail.js +1 -1
- package/lib/commands/db/diff.js +1 -1
- package/lib/commands/db/index.js +1 -1
- package/lib/commands/db/list.js +1 -1
- package/lib/commands/db/shared.js +1 -1
- package/lib/commands/db/tables.js +1 -1
- package/lib/commands/db/test.js +1 -1
- package/lib/commands/db/update.js +1 -1
- package/lib/commands/doctor.js +1 -1
- package/lib/commands/file/index.js +1 -1
- package/lib/commands/init/index.js +1 -1
- package/lib/commands/issue/index.js +1 -1
- package/lib/commands/issue/nudge.js +1 -1
- package/lib/commands/issue/report.js +1 -1
- package/lib/commands/issue/shared.js +1 -1
- package/lib/commands/logs/index.js +1 -1
- package/lib/commands/menu/index.js +1 -1
- package/lib/commands/menu/list.js +1 -1
- package/lib/commands/menu/shared/compare-table.js +1 -1
- package/lib/commands/menu/shared/index.js +1 -1
- package/lib/commands/menu/shared/inquirer.js +1 -1
- package/lib/commands/menu/shared/local-pages.js +1 -1
- package/lib/commands/menu/shared/logic.js +1 -1
- package/lib/commands/menu/shared/service.js +1 -1
- package/lib/commands/menu/shared/sync-core.js +1 -1
- package/lib/commands/menu/shared/update-core.js +1 -1
- package/lib/commands/menu/shared/valid-url.js +1 -1
- package/lib/commands/menu/sync.js +1 -1
- package/lib/commands/menu/update.js +1 -1
- package/lib/commands/notification/config-list.js +1 -1
- package/lib/commands/notification/index.js +1 -1
- package/lib/commands/page/generate-start.js +1 -1
- package/lib/commands/page/generate-status.js +1 -1
- package/lib/commands/page/index.js +1 -1
- package/lib/commands/page/pull.js +1 -1
- package/lib/commands/page/push.js +1 -1
- package/lib/commands/page/relation-audit.js +1 -1
- package/lib/commands/page/shared.js +1 -1
- package/lib/commands/page/standard-page-status.js +1 -1
- package/lib/commands/page/sync.js +1 -1
- package/lib/commands/permit/index.js +1 -1
- package/lib/commands/permit/page-get.js +1 -1
- package/lib/commands/permit/page-set.js +1 -1
- package/lib/commands/permit/role-apis-set.js +1 -1
- package/lib/commands/permit/role-menus-set.js +1 -1
- package/lib/commands/permit/role-menus.js +1 -1
- package/lib/commands/permit/shared.js +1 -1
- package/lib/commands/project/create/enhanced-guided-create.js +1 -1
- package/lib/commands/project/create/format-elapsed.js +1 -1
- package/lib/commands/project/create/main.js +1 -1
- package/lib/commands/project/create/non-interactive.js +1 -1
- package/lib/commands/project/create/project-template-path.js +1 -1
- package/lib/commands/project/create/use-copy-project-template.js +1 -1
- package/lib/commands/project/create/use-format-code.js +1 -1
- package/lib/commands/project/create/use-install-dependencies.js +1 -1
- package/lib/commands/project/index.js +1 -1
- package/lib/commands/project/init.js +1 -1
- package/lib/commands/project/upgrade.js +1 -1
- package/lib/commands/registry.js +1 -1
- package/lib/commands/role/create.js +1 -1
- package/lib/commands/role/delete.js +1 -1
- package/lib/commands/role/detail.js +1 -1
- package/lib/commands/role/index.js +1 -1
- package/lib/commands/role/list.js +1 -1
- package/lib/commands/role/shared.js +1 -1
- package/lib/commands/role/update.js +1 -1
- package/lib/commands/role/user-add.js +1 -1
- package/lib/commands/role/user-remove.js +1 -1
- package/lib/commands/role/user-resolve.js +1 -1
- package/lib/commands/run/index.js +1 -1
- package/lib/commands/schema.js +1 -1
- package/lib/commands/sql/create.js +1 -1
- package/lib/commands/sql/delete.js +1 -1
- package/lib/commands/sql/detail.js +1 -1
- package/lib/commands/sql/exec.js +1 -1
- package/lib/commands/sql/index.js +1 -1
- package/lib/commands/sql/list.js +1 -1
- package/lib/commands/sql/pull.js +1 -1
- package/lib/commands/sql/push.js +1 -1
- package/lib/commands/sql/save.js +1 -1
- package/lib/commands/sql/shared.js +1 -1
- package/lib/commands/sql/status.js +1 -1
- package/lib/commands/sql/validate.js +1 -1
- package/lib/commands/workspace/add.js +1 -1
- package/lib/commands/workspace/index.js +1 -1
- package/lib/commands/workspace/remove.js +1 -1
- package/lib/config/schema.js +1 -1
- package/lib/constant/cdn.js +1 -1
- package/lib/constant/cli.js +1 -1
- package/lib/constant/defaults.js +1 -1
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/constant/output.js +1 -1
- package/lib/constant/paths.js +1 -1
- package/lib/constant/risk.js +1 -1
- package/lib/context/app-resolver.js +1 -1
- package/lib/context/auth-resolver.js +1 -1
- package/lib/context/config-loader.js +1 -1
- package/lib/context.js +1 -1
- package/lib/core/alias-resolver.js +1 -1
- package/lib/core/api-client.js +1 -1
- package/lib/core/bff/config.js +1 -1
- package/lib/core/bff/file-system.js +1 -1
- package/lib/core/bff/hash.js +1 -1
- package/lib/core/bff/lock.js +1 -1
- package/lib/core/bff/utils.js +1 -1
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/page/file-system.js +1 -1
- package/lib/core/page/hash.js +1 -1
- package/lib/core/page/lock.js +1 -1
- package/lib/core/sql-sync/config.js +1 -1
- package/lib/core/sql-sync/file-system.js +1 -1
- package/lib/core/sql-sync/hash.js +1 -1
- package/lib/core/sql-sync/lock.js +1 -1
- package/lib/core/sql-sync/utils.js +1 -1
- package/lib/core/sql-validator.js +1 -1
- package/lib/errors.js +1 -1
- package/lib/framework/build-all-flags.js +1 -1
- package/lib/framework/flags.js +1 -1
- package/lib/framework/help.js +1 -1
- package/lib/framework/index.js +1 -1
- package/lib/framework/output.js +1 -1
- package/lib/framework/response.js +1 -1
- package/lib/framework/runner-alias.js +1 -1
- package/lib/framework/runner.js +1 -1
- package/lib/framework/schema-export.js +1 -1
- package/lib/framework/types.js +1 -1
- package/lib/generated/build-info.js +1 -1
- package/lib/help.js +1 -1
- package/lib/skills/main.js +1 -1
- package/lib/skills/npx-skills-add.js +1 -1
- package/lib/telemetry/cli-command-trace.js +1 -1
- package/lib/telemetry/cli-help-trace.js +1 -1
- package/lib/telemetry/ensure-cli-otel-config.js +1 -1
- package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
- package/lib/telemetry/send-cli-trace-log.js +1 -1
- package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
- package/lib/utils/ai_config.js +1 -1
- package/lib/utils/apply-jq-filter.js +1 -1
- package/lib/utils/cdn-config.js +1 -1
- package/lib/utils/check-sdk-version.js +1 -1
- package/lib/utils/cli-version-check.js +1 -1
- package/lib/utils/cli-version-policy.js +1 -1
- package/lib/utils/config.js +1 -1
- package/lib/utils/copy-directory.js +1 -1
- package/lib/utils/entity-with-id.js +1 -1
- package/lib/utils/file-utils.js +1 -1
- package/lib/utils/guides-cdn.js +1 -1
- package/lib/utils/http-client.js +1 -1
- package/lib/utils/is-non-interactive.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/params.js +1 -1
- package/lib/utils/platform.js +1 -1
- package/lib/utils/rules-cdn.js +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.js +1 -1
- package/lib/utils/update-notice.js +1 -1
- package/lib/utils/version.js +1 -1
- package/lib/utils/with-active-cookie.js +1 -1
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a158_0xc1465d=a158_0xf1a9;function a158_0xf1a9(_0x116924,_0x50400f){_0x116924=_0x116924-0x1d4;const _0x3b9d04=a158_0x3b9d();let _0xf1a9e4=_0x3b9d04[_0x116924];return _0xf1a9e4;}(function(_0x158c5a,_0xb759fc){const _0x3e6c0b=a158_0xf1a9,_0x2a371a=_0x158c5a();while(!![]){try{const _0x28b82a=-parseInt(_0x3e6c0b(0x1e6))/0x1*(parseInt(_0x3e6c0b(0x1d6))/0x2)+-parseInt(_0x3e6c0b(0x1d7))/0x3+-parseInt(_0x3e6c0b(0x1dd))/0x4*(-parseInt(_0x3e6c0b(0x1e4))/0x5)+parseInt(_0x3e6c0b(0x1db))/0x6+parseInt(_0x3e6c0b(0x1d4))/0x7+-parseInt(_0x3e6c0b(0x1e3))/0x8*(-parseInt(_0x3e6c0b(0x1dc))/0x9)+-parseInt(_0x3e6c0b(0x1e8))/0xa;if(_0x28b82a===_0xb759fc)break;else _0x2a371a['push'](_0x2a371a['shift']());}catch(_0x57ef67){_0x2a371a['push'](_0x2a371a['shift']());}}}(a158_0x3b9d,0x72c94));import{getSqlQueryInfo}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';function a158_0x3b9d(){const _0x34a03f=['sqlName','description','verbose','2711898iKDVIc','2142OXRnjD','4slKOUZ','sqlcode','Return\x20full\x20raw\x20SQL\x20query\x20object','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','appCode','detail','31072rAjcsf','4296215WrgXEC','bool','180657emUmKO','dbId','21202330oLgtPv','str','sqlCode','sql','4752706dXObQS','read','2zxeGSa','430566hLsVXp'];a158_0x3b9d=function(){return _0x34a03f;};return a158_0x3b9d();}export const sqlDetail={'service':a158_0xc1465d(0x1eb),'command':a158_0xc1465d(0x1e2),'description':a158_0xc1465d(0x1e0),'risk':a158_0xc1465d(0x1d5),'flags':[SQLCODE_FLAG,{'name':a158_0xc1465d(0x1da),'type':'boolean','description':a158_0xc1465d(0x1df)}],async 'execute'(_0x384177){const _0x388b03=a158_0xc1465d,_0x38f7e2=await getSqlQueryInfo(_0x384177['appCode'],_0x384177[_0x388b03(0x1e9)](_0x388b03(0x1de))),_0x147e78=_0x384177[_0x388b03(0x1e5)](_0x388b03(0x1da));if(_0x147e78)return{'ok':!![],'data':_0x38f7e2};const _0x33d55e=_0x38f7e2[_0x388b03(0x1e7)]?await getDbName(_0x384177[_0x388b03(0x1e1)],_0x38f7e2['dbId']):undefined;return{'ok':!![],'data':{'sqlCode':_0x38f7e2[_0x388b03(0x1ea)],'sqlName':_0x38f7e2[_0x388b03(0x1d8)],'db':_0x33d55e?_0x33d55e+'\x20('+_0x38f7e2['dbId']+')':_0x38f7e2[_0x388b03(0x1e7)]??'','description':_0x38f7e2[_0x388b03(0x1d9)]??'','sqlContent':_0x38f7e2['sqlContent']??''}};}};
|
package/lib/commands/sql/exec.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a159_0x4573b4=a159_0xa3ca;(function(_0x284e89,_0x56a011){const _0x4f43d5=a159_0xa3ca,_0x5ee32a=_0x284e89();while(!![]){try{const _0x5e27f9=parseInt(_0x4f43d5(0x1e2))/0x1*(parseInt(_0x4f43d5(0x1e6))/0x2)+-parseInt(_0x4f43d5(0x1dd))/0x3+parseInt(_0x4f43d5(0x1e1))/0x4+parseInt(_0x4f43d5(0x1d1))/0x5+-parseInt(_0x4f43d5(0x1d6))/0x6+parseInt(_0x4f43d5(0x1d2))/0x7*(parseInt(_0x4f43d5(0x1d4))/0x8)+-parseInt(_0x4f43d5(0x1d5))/0x9;if(_0x5e27f9===_0x56a011)break;else _0x5ee32a['push'](_0x5ee32a['shift']());}catch(_0x6f182f){_0x5ee32a['push'](_0x5ee32a['shift']());}}}(a159_0x1e55,0x74774));import{executeSql}from'../../core/api-client.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';function a159_0x1e55(){const _0x7bc9c7=['10bMDnVb','now','execResult','Returned\x20','92958kmPdIg','isArray','1953635NdgLyF','5068JQoSUC','execSuccess','4336TeCtpK','1020780hKHimw','2114682IRczCv','str','exec','string','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','read','params','2573472WHDkYj','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','execError','SQL\x20execution\x20failed','2211240akLHpt'];a159_0x1e55=function(){return _0x7bc9c7;};return a159_0x1e55();}import{parseJsonParams}from'../../utils/params.js';function a159_0xa3ca(_0x11a99b,_0x2b90c2){_0x11a99b=_0x11a99b-0x1d0;const _0x1e557a=a159_0x1e55();let _0xa3ca89=_0x1e557a[_0x11a99b];return _0xa3ca89;}export const sqlExec={'service':'sql','command':a159_0x4573b4(0x1d8),'description':a159_0x4573b4(0x1da),'risk':a159_0x4573b4(0x1db),'flags':[SQLCODE_FLAG,{'name':a159_0x4573b4(0x1dc),'type':a159_0x4573b4(0x1d9),'description':a159_0x4573b4(0x1de)}],async 'execute'(_0x2776a3){const _0x27f1b8=a159_0x4573b4,_0xcb37fb=parseJsonParams(_0x2776a3['str']('params')),_0x11b750=Date[_0x27f1b8(0x1e3)](),_0x2d527f=await executeSql(_0x2776a3['appCode'],_0x2776a3[_0x27f1b8(0x1d7)]('sqlcode'),_0xcb37fb),_0x2c10f7=Date[_0x27f1b8(0x1e3)]()-_0x11b750,_0x268eb6=_0x2d527f?.[_0x27f1b8(0x1e4)]??_0x2d527f,_0x4c712f=_0x2d527f?.[_0x27f1b8(0x1d3)]??!![];if(!_0x4c712f)return{'ok':![],'data':{'error':_0x2d527f?.[_0x27f1b8(0x1df)]||_0x27f1b8(0x1e0),'elapsed':_0x2c10f7},'message':_0x27f1b8(0x1e0)};const _0x448d2f=Array[_0x27f1b8(0x1d0)](_0x268eb6)?_0x268eb6:[];return{'ok':!![],'data':{'rows':_0x448d2f,'rowCount':_0x448d2f['length'],'elapsed':_0x2c10f7},'message':_0x27f1b8(0x1e5)+_0x448d2f['length']+'\x20row(s)\x20in\x20'+_0x2c10f7+'ms'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x3e83d3,_0x1b4c20){const _0x572f10=a160_0x4b52,_0x454fb5=_0x3e83d3();while(!![]){try{const _0x1485ea=parseInt(_0x572f10(0x91))/0x1+-parseInt(_0x572f10(0x89))/0x2*(-parseInt(_0x572f10(0x8c))/0x3)+parseInt(_0x572f10(0x8f))/0x4+parseInt(_0x572f10(0x90))/0x5*(parseInt(_0x572f10(0x8a))/0x6)+parseInt(_0x572f10(0x8d))/0x7*(-parseInt(_0x572f10(0x8e))/0x8)+-parseInt(_0x572f10(0x93))/0x9*(parseInt(_0x572f10(0x94))/0xa)+parseInt(_0x572f10(0x8b))/0xb*(-parseInt(_0x572f10(0x92))/0xc);if(_0x1485ea===_0x1b4c20)break;else _0x454fb5['push'](_0x454fb5['shift']());}catch(_0x131ee0){_0x454fb5['push'](_0x454fb5['shift']());}}}(a160_0x52fc,0x5b425));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_0x4b52(_0x412fcf,_0x13cba1){_0x412fcf=_0x412fcf-0x89;const _0x52fc70=a160_0x52fc();let _0x4b525c=_0x52fc70[_0x412fcf];return _0x4b525c;}import{sqlDelete}from'../../commands/sql/delete.js';function a160_0x52fc(){const _0x17c5f4=['525503ltpaop','4331340AeKtmv','9siIfPF','822340ewQHWV','2OfDfje','6mWmqob','22jbZwcY','1880979KbDChT','7WUZbYV','1691464qiUvUJ','883548MaaQeC','79855zWmGCj'];a160_0x52fc=function(){return _0x17c5f4;};return a160_0x52fc();}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_0x1bb048=a161_0x3995;(function(_0x3decd8,_0x160598){const _0x525985=a161_0x3995,_0xb88d3=_0x3decd8();while(!![]){try{const _0xc2bc86=parseInt(_0x525985(0x90))/0x1+-parseInt(_0x525985(0xa2))/0x2*(parseInt(_0x525985(0x95))/0x3)+parseInt(_0x525985(0x89))/0x4*(parseInt(_0x525985(0x8e))/0x5)+-parseInt(_0x525985(0x8a))/0x6*(-parseInt(_0x525985(0x8d))/0x7)+parseInt(_0x525985(0x92))/0x8*(-parseInt(_0x525985(0x9b))/0x9)+parseInt(_0x525985(0x8f))/0xa*(parseInt(_0x525985(0xa8))/0xb)+-parseInt(_0x525985(0xaa))/0xc;if(_0xc2bc86===_0x160598)break;else _0xb88d3['push'](_0xb88d3['shift']());}catch(_0x2972b3){_0xb88d3['push'](_0xb88d3['shift']());}}}(a161_0x25b2,0xdf592));function a161_0x25b2(){const _0x5d1cb7=['6824144DNsebR','length','page','4365147luiikd','paging','pagesize','sqlcode','boolean','str','9buycAi','bool','description','Page\x20size','verbose','list','num','2xhBeXh','appCode','Filter\x20by\x20SQL\x20name','sqlName','tableData','List\x20custom\x20SQL\x20queries','77737ZxFrQl','string','9319812LtsUzl','sql','Page\x20number','No\x20custom\x20SQL\x20queries\x20found.','all','dbId','4owvGtC','6hIIgXT','number','read','9995762wjJERf','6592385IPxGSj','1580EWYKIv','136523egQZSj','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content'];a161_0x25b2=function(){return _0x5d1cb7;};return a161_0x25b2();}import{listSqlQueries}from'../../core/api-client.js';function a161_0x3995(_0x6e1f12,_0x67fd2){_0x6e1f12=_0x6e1f12-0x85;const _0x25b293=a161_0x25b2();let _0x3995b0=_0x25b293[_0x6e1f12];return _0x3995b0;}import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':a161_0x1bb048(0xab),'command':a161_0x1bb048(0xa0),'description':a161_0x1bb048(0xa7),'risk':a161_0x1bb048(0x8c),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'name','type':a161_0x1bb048(0xa9),'description':a161_0x1bb048(0xa4)},{'name':a161_0x1bb048(0x94),'type':'number','description':a161_0x1bb048(0x85),'default':0x1},{'name':a161_0x1bb048(0x97),'type':a161_0x1bb048(0x8b),'description':a161_0x1bb048(0x9e)},{'name':a161_0x1bb048(0x9f),'type':a161_0x1bb048(0x99),'description':a161_0x1bb048(0x91)}],async 'execute'(_0x422c64){const _0x3e936c=a161_0x1bb048,_0x282a42=await listSqlQueries(_0x422c64[_0x3e936c(0xa3)],{'sqlCode':_0x422c64['str'](_0x3e936c(0x98))||undefined,'sqlName':_0x422c64[_0x3e936c(0x9a)]('name')||undefined,'currentPage':_0x422c64['num']('page'),'pageSize':_0x422c64[_0x3e936c(0xa1)](_0x3e936c(0x97),0x32)}),_0x321b3e=_0x422c64[_0x3e936c(0x9c)](_0x3e936c(0x9f)),_0x4843cc=_0x282a42[_0x3e936c(0xa6)]??[],_0x54bc42=_0x282a42[_0x3e936c(0x96)]?.['totalCount']??_0x4843cc[_0x3e936c(0x93)];let _0xc99e0c;return _0x321b3e?_0xc99e0c=_0x4843cc:_0xc99e0c=await Promise[_0x3e936c(0x87)](_0x4843cc['map'](async _0x238bc2=>{const _0x1d1f53=_0x3e936c;let _0xaa2255;try{_0xaa2255=_0x238bc2[_0x1d1f53(0x88)]?await getDbName(_0x422c64[_0x1d1f53(0xa3)],_0x238bc2[_0x1d1f53(0x88)]):undefined;}catch{}return{'sqlCode':_0x238bc2['sqlCode'],'sqlName':_0x238bc2[_0x1d1f53(0xa5)],'description':_0x238bc2[_0x1d1f53(0x9d)]??'','db':_0xaa2255?_0xaa2255+'\x20('+_0x238bc2[_0x1d1f53(0x88)]+')':_0x238bc2[_0x1d1f53(0x88)]??''};})),{'ok':!![],'data':_0xc99e0c,'message':_0x4843cc[_0x3e936c(0x93)]===0x0?_0x3e936c(0x86):'Found\x20'+_0x4843cc['length']+'\x20SQL\x20queries\x20(total:\x20'+_0x54bc42+').'};}};
|
package/lib/commands/sql/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function a162_0x40b0(){const _0x2e4ff0=['\x20written,\x20','trimStart','description','totalCount','utf8','sql','sqlRoot','unchanged','cancelled','replace','message','local\x20differs\x20from\x20remote','split','sqlContent','sqlCode','catch','Pull\x20complete:\x20','filter','2321532hApwOV','lockFilePath','would_pull','sqlName','boolean','774FVzsxl','force','join','\x20SQL\x20file(s)\x20into\x20','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','480XncwoF','test','sqlRootDir','tableData','8796276afsYhb','Would\x20pull\x20','2068336TRgBcy','sqlcode','skipped','pull','length','sqls','path','Force\x20pull\x20cancelled.','dbId','appCode','448104dnnAOF','push','853564GLSxEJ','bool','84MmleUd','str','6188390QUQUhj','No\x20remote\x20SQL\x20queries\x20matched.','name','paging','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','string','toISOString'];a162_0x40b0=function(){return _0x2e4ff0;};return a162_0x40b0();}const a162_0x565b13=a162_0x4845;(function(_0x221478,_0x348fc9){const _0x172735=a162_0x4845,_0x1a62b7=_0x221478();while(!![]){try{const _0x49d916=-parseInt(_0x172735(0x194))/0x1+parseInt(_0x172735(0x188))/0x2+-parseInt(_0x172735(0x17d))/0x3*(-parseInt(_0x172735(0x182))/0x4)+parseInt(_0x172735(0x198))/0x5+-parseInt(_0x172735(0x186))/0x6+-parseInt(_0x172735(0x196))/0x7*(-parseInt(_0x172735(0x192))/0x8)+parseInt(_0x172735(0x178))/0x9;if(_0x49d916===_0x348fc9)break;else _0x1a62b7['push'](_0x1a62b7['shift']());}catch(_0x8fc7fd){_0x1a62b7['push'](_0x1a62b7['shift']());}}}(a162_0x40b0,0xdef94));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';function a162_0x4845(_0x5371e7,_0x5969cf){_0x5371e7=_0x5371e7-0x170;const _0x40b00e=a162_0x40b0();let _0x484583=_0x40b00e[_0x5371e7];return _0x484583;}import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x2768d2,_0x291a40){const _0x514850=a162_0x4845,_0x31038c=[];let _0x358e41=0x1;while(!![]){const _0x2a54e1=await listSqlQueries(_0x2768d2,{'currentPage':_0x358e41,'pageSize':PAGE_SIZE,'sqlCode':_0x291a40[_0x514850(0x174)],'sqlName':_0x291a40[_0x514850(0x17b)]}),_0x433d2f=_0x2a54e1[_0x514850(0x185)]??[];_0x31038c[_0x514850(0x193)](..._0x433d2f);if(_0x433d2f[_0x514850(0x18c)]===0x0)break;const _0x4fbd18=_0x2a54e1[_0x514850(0x19b)]?.[_0x514850(0x1a2)];if(_0x4fbd18!=null?_0x31038c[_0x514850(0x18c)]>=_0x4fbd18:_0x433d2f[_0x514850(0x18c)]<PAGE_SIZE)break;_0x358e41++;}return _0x31038c;}async function ensureSqlContent(_0x494d0d){const _0x42657c=a162_0x4845;if(_0x494d0d[_0x42657c(0x173)]!=null&&String(_0x494d0d[_0x42657c(0x173)])[_0x42657c(0x18c)]>0x0)return _0x494d0d;return getSqlQueryDetail(_0x494d0d['sqlCode']);}export const sqlPull={'service':a162_0x565b13(0x1a4),'command':a162_0x565b13(0x18b),'description':a162_0x565b13(0x19c),'risk':'write','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a162_0x565b13(0x19a),'type':a162_0x565b13(0x19d),'description':'Filter\x20by\x20SQL\x20display\x20name'},{'name':a162_0x565b13(0x17e),'type':a162_0x565b13(0x17c),'description':'Force\x20overwrite\x20local\x20unsynced\x20changes'}],async 'dryRun'(_0x17f633){const _0x5db496=a162_0x565b13,_0x52bcec=loadSqlProjectConfig(_0x17f633['appCode']),_0x3ab4f3=await readSqlLockFile(_0x52bcec[_0x5db496(0x179)]),{appLock:_0x43cf21}=ensureSqlLockScope(_0x3ab4f3??createEmptySqlLock(),_0x52bcec[_0x5db496(0x191)],_0x52bcec[_0x5db496(0x1a5)],_0x5db496(0x18b)),_0x4a770d=await fetchAllSqlQueries(_0x17f633[_0x5db496(0x191)],{'sqlCode':_0x17f633['str'](_0x5db496(0x189))||undefined,'sqlName':_0x17f633[_0x5db496(0x197)](_0x5db496(0x19a))||undefined}),_0x18d35a=[];for(const _0x498f39 of _0x4a770d){const _0x16a54f=await ensureSqlContent(_0x498f39),_0xac6b26=ensureRemoteSqlContent(_0x16a54f),_0x531a48=detectModeFromSql(_0x16a54f),_0x73860d=_0x16a54f[_0x5db496(0x190)]?await getDbName(_0x17f633[_0x5db496(0x191)],Number(_0x16a54f[_0x5db496(0x190)]))['catch'](()=>undefined):undefined,_0xbf0306=buildLocalSqlFileContent({'sqlCode':_0x16a54f[_0x5db496(0x174)],'sqlName':_0x16a54f[_0x5db496(0x17b)],'dbId':_0x16a54f[_0x5db496(0x190)]},_0xac6b26,{'dbName':_0x73860d,'mode':_0x531a48,'syncedAt':new Date()[_0x5db496(0x19e)](),'description':_0x16a54f[_0x5db496(0x1a1)]}),_0x5a455a=buildSqlLockEntry(_0x16a54f,_0xac6b26,'',{'dbName':_0x73860d}),_0x249f23=resolveLocalSqlFilePath(_0x52bcec,_0x16a54f['sqlCode'],_0x5a455a);let _0x4fb9da=_0x5db496(0x17a),_0x468826;if(await fileExists(_0x249f23)){const _0x5a9bfe=await readFile(_0x249f23,_0x5db496(0x1a3));isEquivalentPulledSqlFile(_0x5a9bfe,_0xbf0306,_0x531a48)?(_0x4fb9da=_0x5db496(0x18a),_0x468826='unchanged'):(_0x4fb9da='conflict',_0x468826=_0x5db496(0x181));}_0x18d35a['push']({'sqlCode':_0x16a54f['sqlCode'],'sqlName':_0x16a54f[_0x5db496(0x17b)],'filePath':_0x249f23,'status':_0x4fb9da,'reason':_0x468826});}return{'method':'POST','url':'/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','body':{'appCode':_0x17f633[_0x5db496(0x191)],'sqlCode':_0x17f633['str'](_0x5db496(0x189))||null,'sqlName':_0x17f633[_0x5db496(0x197)](_0x5db496(0x19a))||null,'files':_0x18d35a},'description':_0x5db496(0x187)+_0x18d35a[_0x5db496(0x18c)]+_0x5db496(0x180)+_0x52bcec['sqlRootDir']};},async 'execute'(_0x2f8b61){const _0x29d70d=a162_0x565b13,_0x416ca2=loadSqlProjectConfig(_0x2f8b61[_0x29d70d(0x191)]),_0x42e514=await readSqlLockFile(_0x416ca2[_0x29d70d(0x179)]),{lockData:_0x446a40,appLock:_0x1be8b8}=ensureSqlLockScope(_0x42e514??createEmptySqlLock(),_0x416ca2[_0x29d70d(0x191)],_0x416ca2['sqlRoot'],'pull'),_0x1a6088=_0x2f8b61[_0x29d70d(0x195)](_0x29d70d(0x17e)),_0x52d51d=await fetchAllSqlQueries(_0x2f8b61[_0x29d70d(0x191)],{'sqlCode':_0x2f8b61[_0x29d70d(0x197)](_0x29d70d(0x189))||undefined,'sqlName':_0x2f8b61[_0x29d70d(0x197)]('name')||undefined});if(_0x52d51d[_0x29d70d(0x18c)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x29d70d(0x199)};const _0x6e05ea=[],_0xc3fdd=[];for(const _0x292e49 of _0x52d51d){try{_0x6e05ea[_0x29d70d(0x193)](await ensureSqlContent(_0x292e49));}catch(_0x4c877d){_0xc3fdd[_0x29d70d(0x193)]({'sqlCode':_0x292e49[_0x29d70d(0x174)],'error':_0x4c877d instanceof Error?_0x4c877d[_0x29d70d(0x170)]:String(_0x4c877d)});}}if(_0x1a6088&&!_0x2f8b61['nonInteractive']){let _0x23e915=![];for(const _0x3614f3 of _0x6e05ea){const _0x5c7066=detectModeFromSql(_0x3614f3),_0x5b8220=_0x3614f3[_0x29d70d(0x190)]?await getDbName(_0x2f8b61[_0x29d70d(0x191)],Number(_0x3614f3[_0x29d70d(0x190)]))['catch'](()=>undefined):undefined,_0x282e7c=buildLocalSqlFileContent({'sqlCode':_0x3614f3[_0x29d70d(0x174)],'sqlName':_0x3614f3[_0x29d70d(0x17b)],'dbId':_0x3614f3[_0x29d70d(0x190)]},ensureRemoteSqlContent(_0x3614f3),{'dbName':_0x5b8220,'mode':_0x5c7066,'syncedAt':new Date()[_0x29d70d(0x19e)](),'description':_0x3614f3[_0x29d70d(0x1a1)]}),_0x2d7e7f=resolveLocalSqlFilePath(_0x416ca2,_0x3614f3[_0x29d70d(0x174)],buildSqlLockEntry(_0x3614f3,ensureRemoteSqlContent(_0x3614f3),'',{'dbName':_0x5b8220}));if(await fileExists(_0x2d7e7f)){const _0x10c320=await readFile(_0x2d7e7f,_0x29d70d(0x1a3));if(!isEquivalentPulledSqlFile(_0x10c320,_0x282e7c,_0x5c7066)){_0x23e915=!![];break;}}}if(_0x23e915){const _0x2c6394=await confirmForceOverwrite('Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.');if(!_0x2c6394)throw CliErrors[_0x29d70d(0x1a7)](_0x29d70d(0x18f));}}const _0x7041da=cloneSqlLockData(_0x446a40),_0x2bcbdf=_0x7041da['apps'][_0x416ca2[_0x29d70d(0x191)]],_0x421aa8=[],_0x329c7f=[];for(const _0x5b76d2 of _0x6e05ea){const _0x49018f=_0x2bcbdf[_0x29d70d(0x18d)][_0x5b76d2[_0x29d70d(0x174)]],_0x7b41d=ensureRemoteSqlContent(_0x5b76d2),_0x9f8ac4=detectModeFromSql(_0x5b76d2),_0x2600a2=_0x5b76d2[_0x29d70d(0x190)]?await getDbName(_0x2f8b61['appCode'],Number(_0x5b76d2['dbId']))[_0x29d70d(0x175)](()=>undefined):undefined,_0x401eaf=buildLocalSqlFileContent({'sqlCode':_0x5b76d2['sqlCode'],'sqlName':_0x5b76d2[_0x29d70d(0x17b)],'dbId':_0x5b76d2[_0x29d70d(0x190)]},_0x7b41d,{'dbName':_0x2600a2,'mode':_0x9f8ac4,'syncedAt':new Date()[_0x29d70d(0x19e)](),'description':_0x5b76d2[_0x29d70d(0x1a1)]}),_0x312ac7=buildSqlLockEntry(_0x5b76d2,_0x7b41d,computeSqlContentHash(_0x401eaf),{'dbName':_0x2600a2}),_0x370f52=_0x312ac7[_0x29d70d(0x18e)],_0x38470d=join(_0x416ca2[_0x29d70d(0x184)],_0x370f52);try{if(await fileExists(_0x38470d)){const _0x2d6ad1=await readFile(_0x38470d,'utf8');if(isEquivalentPulledSqlFile(_0x2d6ad1,_0x401eaf,_0x9f8ac4)){_0x329c7f[_0x29d70d(0x193)]({'sqlCode':_0x5b76d2[_0x29d70d(0x174)],'reason':_0x29d70d(0x1a6)}),_0x2bcbdf['sqls'][_0x5b76d2['sqlCode']]={..._0x312ac7,'hash':computeSqlContentHash(_0x2d6ad1),'path':_0x370f52};continue;}if(!_0x1a6088){_0x329c7f['push']({'sqlCode':_0x5b76d2[_0x29d70d(0x174)],'reason':_0x29d70d(0x171)});continue;}}const _0x18ce59=_0x49018f?.[_0x29d70d(0x18e)]?join(_0x416ca2[_0x29d70d(0x184)],_0x49018f[_0x29d70d(0x18e)]):undefined;_0x18ce59&&_0x18ce59!==_0x38470d&&await fileExists(_0x18ce59)&&await rm(_0x18ce59,{'force':!![]}),await ensureParentDirectory(_0x38470d),await writeFile(_0x38470d,_0x401eaf,'utf8'),_0x2bcbdf['sqls'][_0x5b76d2[_0x29d70d(0x174)]]={..._0x312ac7,'path':_0x370f52},_0x421aa8[_0x29d70d(0x193)]({'sqlCode':_0x5b76d2['sqlCode'],'filePath':_0x38470d});}catch(_0x8ff8d7){_0xc3fdd[_0x29d70d(0x193)]({'sqlCode':_0x5b76d2[_0x29d70d(0x174)],'error':_0x8ff8d7 instanceof Error?_0x8ff8d7[_0x29d70d(0x170)]:String(_0x8ff8d7)});}}return _0x2bcbdf['lastSync']=new Date()[_0x29d70d(0x19e)](),await writeSqlLockFile(_0x416ca2[_0x29d70d(0x179)],_0x7041da),{'ok':_0xc3fdd[_0x29d70d(0x18c)]===0x0,'data':{'pulled':_0x421aa8,'skipped':_0x329c7f,'failed':_0xc3fdd},'message':_0x29d70d(0x176)+_0x421aa8[_0x29d70d(0x18c)]+_0x29d70d(0x19f)+_0x329c7f[_0x29d70d(0x18c)]+'\x20skipped,\x20'+_0xc3fdd[_0x29d70d(0x18c)]+'\x20failed'};}};function detectModeFromSql(_0x1eec3d){const _0x27d19e=a162_0x565b13,_0x3f2eaf=ensureRemoteSqlContent(_0x1eec3d),_0x51471b=stripLocalSqlMetadata(_0x3f2eaf,'mybatisXml')[_0x27d19e(0x1a0)]();if(/^<(select|insert|update|delete)\b/i[_0x27d19e(0x183)](_0x51471b))return'mybatisXml';return _0x27d19e(0x1a4);}function isEquivalentPulledSqlFile(_0x5010f9,_0x4a2f78,_0x1b401c){return normalizePullComparableContent(_0x5010f9,_0x1b401c)===normalizePullComparableContent(_0x4a2f78,_0x1b401c);}function normalizePullComparableContent(_0x19ae46,_0x18d0a4){const _0x30b728=a162_0x565b13,_0x4a143d=_0x19ae46[_0x30b728(0x1a8)](/\r\n/g,'\x0a')[_0x30b728(0x172)]('\x0a'),_0x960c4e=_0x4a143d[_0x30b728(0x177)](_0x4a31d5=>!isSyncedAtMetadataLine(_0x4a31d5,_0x18d0a4));return _0x960c4e[_0x30b728(0x17f)]('\x0a');}function isSyncedAtMetadataLine(_0x2c68fc,_0x1c3b23){if(_0x1c3b23==='mybatisXml')return/^\s*<!--\s*@lovrabet\.syncedAt:/['test'](_0x2c68fc);return/^\s*--\s*@lovrabet\.syncedAt:/['test'](_0x2c68fc);}
|
|
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);}
|
package/lib/commands/sql/push.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function a163_0x4360(){const _0x5e75de=['missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','5322888dUlhrJ','relativePath','force','\x22\x20for\x20sqlCode\x20','sql','1071987tMDWMt','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','12241880GzYzsF','hash','\x20SQL\x20file(s)','sqlConfig','get','map','sqlCode','sqlName','2985252eTAQhb','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','No\x20local\x20SQL\x20files\x20found.','46056900ImPWpi','trashDir','226028hhXvgu','appCode','sqlRoot','isFinite','str','catch','lastSync','171PqDrbT','mode','projectRoot','POST','length','Push\x20complete:\x20','lockFilePath','sqlRootDir','entries','bool','sqlcode','2WXsXEB','sqls','filePath','Local\x20SQL\x20not\x20found:\x20','No\x20database\x20matches\x20local\x20directory\x20\x22','boolean','dbName','utf8','replace','validation','/smartapi/custom/updateUserCustomSql','320824VQdvJo','20rXsoyL','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','version','toISOString','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','dbId','remoteId','Local\x20directory\x20\x22','push','filter','exec','path'];a163_0x4360=function(){return _0x5e75de;};return a163_0x4360();}const a163_0x52e78e=a163_0x4f44;(function(_0x12180f,_0x55422f){const _0x5dd124=a163_0x4f44,_0x49edd3=_0x12180f();while(!![]){try{const _0x6f57c1=-parseInt(_0x5dd124(0x144))/0x1*(parseInt(_0x5dd124(0x126))/0x2)+-parseInt(_0x5dd124(0x14e))/0x3+parseInt(_0x5dd124(0x153))/0x4*(parseInt(_0x5dd124(0x132))/0x5)+-parseInt(_0x5dd124(0x13f))/0x6+-parseInt(_0x5dd124(0x146))/0x7+-parseInt(_0x5dd124(0x131))/0x8*(-parseInt(_0x5dd124(0x15a))/0x9)+parseInt(_0x5dd124(0x151))/0xa;if(_0x6f57c1===_0x55422f)break;else _0x49edd3['push'](_0x49edd3['shift']());}catch(_0x4c0b39){_0x49edd3['push'](_0x49edd3['shift']());}}}(a163_0x4360,0xd96f8));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';function a163_0x4f44(_0x49a33a,_0x5cf343){_0x49a33a=_0x49a33a-0x123;const _0x43607e=a163_0x4360();let _0x4f44b8=_0x43607e[_0x49a33a];return _0x4f44b8;}import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';async function getTargetSqlQueries(_0x454033,_0x2f0e97,_0x590d5d){const _0x5b4de1=a163_0x4f44,_0x19e60c=await scanLocalSqlQueries(_0x454033),_0x20e324=new Map();for(const _0xd11e9d of _0x19e60c){if(_0x590d5d&&_0xd11e9d[_0x5b4de1(0x14c)]!==_0x590d5d)continue;const _0x4190bf=_0x20e324[_0x5b4de1(0x14a)](_0xd11e9d[_0x5b4de1(0x14c)])??[];_0x4190bf[_0x5b4de1(0x13a)](_0xd11e9d),_0x20e324['set'](_0xd11e9d[_0x5b4de1(0x14c)],_0x4190bf);}if(_0x590d5d&&!_0x20e324['has'](_0x590d5d))throw CliErrors[_0x5b4de1(0x12f)](_0x5b4de1(0x129)+_0x590d5d);const _0x55332b=[];for(const [_0x59ed18,_0x367855]of _0x20e324[_0x5b4de1(0x123)]()){if(_0x367855[_0x5b4de1(0x15e)]===0x1){_0x55332b[_0x5b4de1(0x13a)](_0x367855[0x0]);continue;}const _0x3e9610=_0x2f0e97[_0x5b4de1(0x127)][_0x59ed18],_0x26bd8f=_0x3e9610?.['path'],_0x164344=_0x26bd8f?_0x367855[_0x5b4de1(0x13b)](_0x58fb05=>_0x58fb05[_0x5b4de1(0x140)]!==_0x26bd8f):_0x367855;if(_0x3e9610&&_0x164344[_0x5b4de1(0x15e)]===0x1){_0x55332b[_0x5b4de1(0x13a)](_0x164344[0x0]);continue;}throw CliErrors[_0x5b4de1(0x12f)](_0x5b4de1(0x136)+_0x59ed18+_0x5b4de1(0x14f));}return _0x55332b;}export const sqlPush={'service':a163_0x52e78e(0x143),'command':a163_0x52e78e(0x13a),'description':'Push\x20local\x20SQL\x20files\x20to\x20remote','risk':'high-risk-write','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a163_0x52e78e(0x141),'type':a163_0x52e78e(0x12b),'description':a163_0x52e78e(0x145)}],async 'dryRun'(_0xe092e6){const _0x41f587=a163_0x52e78e,_0x5f4db9=loadSqlProjectConfig(_0xe092e6['appCode']),_0x14a766=await readSqlLockFile(_0x5f4db9[_0x41f587(0x160)]),{appLock:_0x3b77ff}=ensureSqlLockScope(_0x14a766??createEmptySqlLock(),_0xe092e6[_0x41f587(0x154)],_0x5f4db9['sqlRoot'],'push'),_0xb62d11=await getTargetSqlQueries(_0x5f4db9,_0x3b77ff,_0xe092e6[_0x41f587(0x157)](_0x41f587(0x125))||undefined),_0x4be18c=[];for(const _0x92b8f9 of _0xb62d11){const _0x26f263=await computeSqlFileHash(_0x92b8f9['filePath']),_0x169dd9=_0x3b77ff[_0x41f587(0x127)][_0x92b8f9[_0x41f587(0x14c)]],_0x2f7f13=!!_0x169dd9&&(_0x169dd9[_0x41f587(0x13d)]!==_0x92b8f9[_0x41f587(0x140)]||!!_0x92b8f9[_0x41f587(0x14d)]&&_0x169dd9[_0x41f587(0x14d)]!==_0x92b8f9[_0x41f587(0x14d)]);if(!_0xe092e6['bool'](_0x41f587(0x141))&&_0x169dd9&&_0x169dd9[_0x41f587(0x147)]===_0x26f263&&!_0x2f7f13)continue;_0x4be18c[_0x41f587(0x13a)](_0x92b8f9[_0x41f587(0x14c)]);}return{'method':_0x41f587(0x15d),'url':_0x41f587(0x130),'body':{'sqlCodes':_0x4be18c,'appCode':_0xe092e6[_0x41f587(0x154)]},'description':'Would\x20push\x20'+_0x4be18c[_0x41f587(0x15e)]+_0x41f587(0x148)};},async 'execute'(_0x5b547b){const _0x18b49a=a163_0x52e78e,_0x23e050=loadSqlProjectConfig(_0x5b547b[_0x18b49a(0x154)]),_0x44920c=await readSqlLockFile(_0x23e050[_0x18b49a(0x160)]),{lockData:_0x1f45cd,appLock:_0x39f090}=ensureSqlLockScope(_0x44920c??createEmptySqlLock(),_0x5b547b['appCode'],_0x23e050[_0x18b49a(0x155)],'push'),_0x3b26a=await getTargetSqlQueries(_0x23e050,_0x39f090,_0x5b547b[_0x18b49a(0x157)](_0x18b49a(0x125))||undefined);if(_0x3b26a[_0x18b49a(0x15e)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x18b49a(0x150)};const _0x45dc5e=[],_0x13fe35=[],_0x19479d=[];for(const _0x42a360 of _0x3b26a){const _0x56858c=_0x39f090[_0x18b49a(0x127)][_0x42a360[_0x18b49a(0x14c)]];if(!_0x56858c){_0x19479d[_0x18b49a(0x13a)]({'sqlCode':_0x42a360[_0x18b49a(0x14c)],'error':'local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first'});continue;}try{const _0x236771=await computeSqlFileHash(_0x42a360[_0x18b49a(0x128)]),_0x46e436=_0x56858c[_0x18b49a(0x13d)]!==_0x42a360[_0x18b49a(0x140)]||!!_0x42a360[_0x18b49a(0x14d)]&&_0x56858c[_0x18b49a(0x14d)]!==_0x42a360[_0x18b49a(0x14d)];if(!_0x5b547b[_0x18b49a(0x124)]('force')&&_0x56858c['hash']===_0x236771&&!_0x46e436){_0x13fe35[_0x18b49a(0x13a)]({'sqlCode':_0x42a360[_0x18b49a(0x14c)],'reason':'unchanged'});continue;}if(_0x56858c[_0x18b49a(0x134)]==null){_0x19479d[_0x18b49a(0x13a)]({'sqlCode':_0x42a360[_0x18b49a(0x14c)],'error':_0x18b49a(0x13e)});continue;}const _0x24d065=await readFile(_0x42a360[_0x18b49a(0x128)],_0x18b49a(0x12d)),_0x81fafc=stripLocalSqlMetadata(_0x24d065,_0x42a360[_0x18b49a(0x15b)]),_0x122729=_0x42a360[_0x18b49a(0x14d)]||_0x56858c[_0x18b49a(0x14d)],_0x9c18ec=await resolveTargetDbBinding(_0x5b547b[_0x18b49a(0x154)],_0x42a360,_0x56858c),_0x107374=await updateSqlQuery({'id':_0x56858c[_0x18b49a(0x138)],'appCode':_0x5b547b['appCode'],'sqlCode':_0x42a360['sqlCode'],'sqlName':_0x122729,'dbId':_0x9c18ec[_0x18b49a(0x137)],'version':_0x56858c[_0x18b49a(0x134)],'sqlContent':_0x81fafc,'sqlConfig':_0x56858c[_0x18b49a(0x149)]??undefined}),_0x3e275d=_0x107374[_0x18b49a(0x137)]?await getDbName(_0x5b547b[_0x18b49a(0x154)],Number(_0x107374[_0x18b49a(0x137)]))[_0x18b49a(0x158)](()=>_0x9c18ec['dbName']):_0x9c18ec[_0x18b49a(0x12c)];_0x39f090[_0x18b49a(0x127)][_0x42a360[_0x18b49a(0x14c)]]={...buildSqlLockEntry(_0x107374,_0x81fafc,_0x236771,{'dbName':_0x3e275d}),'path':_0x42a360['relativePath'],'mode':_0x56858c[_0x18b49a(0x15b)]},await archivePreviousSqlFileIfNeeded(_0x23e050,_0x56858c['path'],_0x42a360[_0x18b49a(0x140)]),_0x45dc5e[_0x18b49a(0x13a)]({'sqlCode':_0x42a360[_0x18b49a(0x14c)],'remoteId':_0x56858c[_0x18b49a(0x138)]});}catch(_0x1c57d3){_0x19479d[_0x18b49a(0x13a)]({'sqlCode':_0x42a360[_0x18b49a(0x14c)],'error':_0x1c57d3 instanceof Error?_0x1c57d3['message']:String(_0x1c57d3)});}}return _0x39f090[_0x18b49a(0x159)]=new Date()[_0x18b49a(0x135)](),await writeSqlLockFile(_0x23e050[_0x18b49a(0x160)],_0x1f45cd),{'ok':_0x19479d[_0x18b49a(0x15e)]===0x0,'data':{'pushed':_0x45dc5e,'skipped':_0x13fe35,'failed':_0x19479d},'message':_0x18b49a(0x15f)+_0x45dc5e[_0x18b49a(0x15e)]+'\x20pushed,\x20'+_0x13fe35['length']+'\x20skipped,\x20'+_0x19479d[_0x18b49a(0x15e)]+'\x20failed'};}};async function archivePreviousSqlFileIfNeeded(_0x5e7f70,_0xc9d7e6,_0x4ffe0e){const _0x3a997a=a163_0x52e78e;if(!_0xc9d7e6||_0xc9d7e6===_0x4ffe0e)return;const _0x43f4f7=join(_0x5e7f70[_0x3a997a(0x161)],_0xc9d7e6);if(!await fileExists(_0x43f4f7))return;const _0x48c77a=await moveToTrash(_0x5e7f70[_0x3a997a(0x15c)],_0x5e7f70[_0x3a997a(0x152)],_0x43f4f7);await cleanupEmptyDirectories(dirname(_0x43f4f7),_0x5e7f70[_0x3a997a(0x161)]),void _0x48c77a;}async function moveToTrash(_0x2538b4,_0x7442fc,_0x5453c0){const _0x5cd74c=a163_0x52e78e,_0x18de28=new Date()['toISOString']()[_0x5cd74c(0x12e)](/[:.]/g,'-'),_0x266135=relative(_0x2538b4,_0x5453c0),_0x44d42d=join(_0x7442fc,_0x18de28,_0x266135);return await mkdir(dirname(_0x44d42d),{'recursive':!![]}),await rename(_0x5453c0,_0x44d42d),_0x44d42d;}async function cleanupEmptyDirectories(_0x1e43f0,_0x28b5e6){const _0x128b24=a163_0x52e78e;let _0x56b0ae=resolve(_0x1e43f0);const _0x3a8535=resolve(_0x28b5e6);while(_0x56b0ae['startsWith'](''+_0x3a8535+sep)||_0x56b0ae===_0x3a8535){if(_0x56b0ae===_0x3a8535)return;try{const _0x265de4=await readdir(_0x56b0ae);if(_0x265de4[_0x128b24(0x15e)]>0x0)return;await rmdir(_0x56b0ae);}catch{return;}_0x56b0ae=dirname(_0x56b0ae);}}async function resolveTargetDbBinding(_0x3f0ebd,_0x32c5dd,_0xa6ff1){const _0x5b5cda=a163_0x52e78e,_0x45704e=_0x32c5dd['dbDirectory'];if(!_0x45704e)return{'dbId':_0xa6ff1['dbId'],'dbName':_0xa6ff1[_0x5b5cda(0x12c)]};const _0x5a1869=buildDbDirectoryName(_0xa6ff1[_0x5b5cda(0x12c)],_0xa6ff1[_0x5b5cda(0x137)]);if(_0x45704e===_0x5a1869)return{'dbId':_0xa6ff1[_0x5b5cda(0x137)],'dbName':_0xa6ff1[_0x5b5cda(0x12c)]};const _0x32a280=parseExplicitDbDirectory(_0x45704e);if(_0x32a280!=null)return{'dbId':_0x32a280,'dbName':await getDbName(_0x3f0ebd,_0x32a280)[_0x5b5cda(0x158)](()=>undefined)};const _0x36901a=await listDatabases(_0x3f0ebd),_0x2347f8=_0x36901a[_0x5b5cda(0x13b)](_0x59edf1=>buildDbDirectoryName(_0x59edf1[_0x5b5cda(0x12c)],_0x59edf1[_0x5b5cda(0x137)])===_0x45704e);if(_0x2347f8[_0x5b5cda(0x15e)]===0x1)return{'dbId':_0x2347f8[0x0]['dbId'],'dbName':_0x2347f8[0x0][_0x5b5cda(0x12c)]};if(_0x2347f8[_0x5b5cda(0x15e)]===0x0)throw CliErrors[_0x5b5cda(0x12f)](_0x5b5cda(0x12a)+_0x45704e+_0x5b5cda(0x142)+_0x32c5dd[_0x5b5cda(0x14c)]+'.');const _0x32b1a1=_0x2347f8[_0x5b5cda(0x14b)](_0x2cf1ed=>_0x2cf1ed[_0x5b5cda(0x12c)]+'\x20('+_0x2cf1ed[_0x5b5cda(0x137)]+')')['join'](',\x20');throw CliErrors[_0x5b5cda(0x12f)](_0x5b5cda(0x139)+_0x45704e+_0x5b5cda(0x133)+_0x32c5dd[_0x5b5cda(0x14c)]+':\x20'+_0x32b1a1);}function parseExplicitDbDirectory(_0x31f43e){const _0xaff803=a163_0x52e78e,_0x1976cd=/^db-(\d+)$/[_0xaff803(0x13c)](_0x31f43e);if(!_0x1976cd)return null;const _0x326614=Number(_0x1976cd[0x1]);return Number[_0xaff803(0x156)](_0x326614)&&_0x326614>0x0?_0x326614:null;}
|
|
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;}
|
package/lib/commands/sql/save.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a164_0x4bd030=a164_0xbdd5;(function(_0x1ec207,_0x3ceecc){const _0x25d345=a164_0xbdd5,_0x1f6bc5=_0x1ec207();while(!![]){try{const _0x1ccff6=-parseInt(_0x25d345(0xc3))/0x1+parseInt(_0x25d345(0xaf))/0x2+parseInt(_0x25d345(0xbb))/0x3*(parseInt(_0x25d345(0xbc))/0x4)+parseInt(_0x25d345(0xb3))/0x5+-parseInt(_0x25d345(0xb6))/0x6+parseInt(_0x25d345(0xb7))/0x7+parseInt(_0x25d345(0xbf))/0x8;if(_0x1ccff6===_0x3ceecc)break;else _0x1f6bc5['push'](_0x1f6bc5['shift']());}catch(_0x269ba6){_0x1f6bc5['push'](_0x1f6bc5['shift']());}}}(a164_0x5294,0xa1d88));import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a164_0x5294(){const _0x27e0e8=['Target\x20database\x20—\x20accepts\x20a\x20numeric\x20ID\x20or\x20database\x20name\x20(e.g.\x20ecommerce_db)','1861525PiEDzn','string','sqlname','1385274RQBDLg','2166122pVlUyE','Create\x20new\x20SQL\x20with\x20`rabetbase\x20sql\x20create\x20--name\x20<name>\x20--db-id\x20<id>\x20--mode\x20sql|mybatisXml`.','`rabetbase\x20sql\x20save`\x20has\x20been\x20deprecated.','write','489RaEjlN','22216DfGNcP','save','file','816664XjfSuE','description','Query\x20description','SQL\x20query\x20display\x20name','1261544HezgNy','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`.','Path\x20to\x20the\x20SQL\x20file','sql','932414LLVocy','Deprecated:\x20use\x20sql\x20create\x20to\x20create\x20and\x20sql\x20push\x20to\x20update','validation'];a164_0x5294=function(){return _0x27e0e8;};return a164_0x5294();}function a164_0xbdd5(_0x37b072,_0x46f868){_0x37b072=_0x37b072-0xae;const _0x52940c=a164_0x5294();let _0xbdd5e5=_0x52940c[_0x37b072];return _0xbdd5e5;}const SQL_SAVE_DEPRECATED_HINT=[a164_0x4bd030(0xb9),a164_0x4bd030(0xb8),a164_0x4bd030(0xc4)]['join']('\x0a');export const sqlSave={'service':a164_0x4bd030(0xae),'command':a164_0x4bd030(0xbd),'description':a164_0x4bd030(0xb0),'risk':a164_0x4bd030(0xba),'requiresAuth':![],'requiresAppCode':![],'flags':[{'name':a164_0x4bd030(0xbe),'type':a164_0x4bd030(0xb4),'required':!![],'description':a164_0x4bd030(0xc5)},SQLCODE_FLAG_OPTIONAL,{'name':a164_0x4bd030(0xb5),'type':a164_0x4bd030(0xb4),'description':a164_0x4bd030(0xc2)},{'name':'db','type':'string','description':a164_0x4bd030(0xb2)},{'name':a164_0x4bd030(0xc0),'type':a164_0x4bd030(0xb4),'description':a164_0x4bd030(0xc1)}],async 'validate'(){const _0x2b7844=a164_0x4bd030;throw CliErrors[_0x2b7844(0xb1)](SQL_SAVE_DEPRECATED_HINT);},async 'execute'(){const _0xf40096=a164_0x4bd030;throw CliErrors[_0xf40096(0xb1)](SQL_SAVE_DEPRECATED_HINT);}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x6b2caf,_0xeb9eae){const _0x3a83ba=a165_0x370d,_0x2c24af=_0x6b2caf();while(!![]){try{const _0x16c07d=-parseInt(_0x3a83ba(0x150))/0x1*(parseInt(_0x3a83ba(0x135))/0x2)+parseInt(_0x3a83ba(0x158))/0x3+-parseInt(_0x3a83ba(0x148))/0x4+-parseInt(_0x3a83ba(0x153))/0x5*(-parseInt(_0x3a83ba(0x147))/0x6)+parseInt(_0x3a83ba(0x13b))/0x7*(parseInt(_0x3a83ba(0x13a))/0x8)+-parseInt(_0x3a83ba(0x155))/0x9+parseInt(_0x3a83ba(0x15c))/0xa;if(_0x16c07d===_0xeb9eae)break;else _0x2c24af['push'](_0x2c24af['shift']());}catch(_0x4d66df){_0x2c24af['push'](_0x2c24af['shift']());}}}(a165_0x2ef6,0x28883));function a165_0x370d(_0x5d69f2,_0x5ac251){_0x5d69f2=_0x5d69f2-0x132;const _0x2ef683=a165_0x2ef6();let _0x370de1=_0x2ef683[_0x5d69f2];return _0x370de1;}import{createInterface}from'node:readline';import{join}from'node:path';import{buildDefaultSqlFileName,buildSqlRelativePath,detectSqlMode}from'../../core/sql-sync/utils.js';export const SQL_LOCAL_REL_DIR='.rabetbase/sql';export function buildSqlLockEntry(_0x555ea6,_0xd26951,_0x4788f8,_0x54ab01){const _0x57cf96=a165_0x370d,_0x55216a=detectSqlMode(_0xd26951);return{'path':buildSqlRelativePath(_0x555ea6[_0x57cf96(0x134)],_0x555ea6['sqlName'],_0x54ab01?.['dbName'],_0x55216a,_0x555ea6['dbId']),'hash':_0x4788f8,'remoteId':_0x555ea6['id'],'version':_0x555ea6[_0x57cf96(0x146)],'dbId':Number(_0x555ea6[_0x57cf96(0x140)]),'dbName':_0x54ab01?.[_0x57cf96(0x145)],'sqlName':_0x555ea6[_0x57cf96(0x13f)],'sqlConfig':_0x555ea6[_0x57cf96(0x138)]??undefined,'mode':_0x55216a};}export function cloneSqlLockData(_0x2ffc4a){const _0x57c1e5=a165_0x370d;return{'apps':Object[_0x57c1e5(0x14e)](Object['entries'](_0x2ffc4a[_0x57c1e5(0x151)])[_0x57c1e5(0x15a)](([_0x6407f8,_0x3df120])=>[_0x6407f8,{'sqlRoot':_0x3df120[_0x57c1e5(0x15d)],'lastSync':_0x3df120['lastSync'],'sqls':{..._0x3df120[_0x57c1e5(0x144)]}}]))};}export function ensureRemoteSqlContent(_0x283b76){const _0x4f0024=a165_0x370d;return _0x283b76[_0x4f0024(0x14b)]??'';}export function buildLocalSqlFileContent(_0x1d246d,_0x858c84,_0x3c938e){const _0x805f00=a165_0x370d,_0x377c4e=_0x3c938e?.[_0x805f00(0x157)]??detectSqlMode(_0x858c84),_0x48a57d=stripLocalSqlMetadata(_0x858c84,_0x377c4e)[_0x805f00(0x14d)](),_0x4a3e4b=[...buildMetadataHeaderLines({'sqlCode':_0x1d246d['sqlCode'],'sqlName':_0x1d246d[_0x805f00(0x13f)],'dbId':_0x1d246d['dbId'],'dbName':_0x3c938e?.[_0x805f00(0x145)],'mode':_0x377c4e,'syncedAt':_0x3c938e?.[_0x805f00(0x149)],'description':_0x3c938e?.[_0x805f00(0x137)]},_0x377c4e),'',_0x48a57d],_0x49788f=_0x4a3e4b[_0x805f00(0x156)]('\x0a');return _0x49788f[_0x805f00(0x143)]('\x0a')?_0x49788f:_0x49788f+'\x0a';}export function stripLocalSqlMetadata(_0x161685,_0x2a974a){const _0x5dcc3e=a165_0x370d,_0x155b6b=_0x161685[_0x5dcc3e(0x154)](/\r\n/g,'\x0a')[_0x5dcc3e(0x14a)]('\x0a'),_0x6c3e5e=[];let _0x3463c7=0x0;if(_0x2a974a===_0x5dcc3e(0x152))while(_0x3463c7<_0x155b6b[_0x5dcc3e(0x142)]){const _0x163759=_0x155b6b[_0x3463c7]??'';if(/^\s*<!--\s*@lovrabet\./['test'](_0x163759)){_0x3463c7++;continue;}if(_0x163759[_0x5dcc3e(0x14d)]()===''&&_0x3463c7>0x0){_0x3463c7++;continue;}break;}else while(_0x3463c7<_0x155b6b[_0x5dcc3e(0x142)]){const _0x1c4d9d=_0x155b6b[_0x3463c7]??'';if(/^\s*--\s*@lovrabet\./[_0x5dcc3e(0x136)](_0x1c4d9d)){_0x3463c7++;continue;}if(_0x1c4d9d[_0x5dcc3e(0x14d)]()===''&&_0x3463c7>0x0){_0x3463c7++;continue;}break;}for(;_0x3463c7<_0x155b6b[_0x5dcc3e(0x142)];_0x3463c7++){_0x6c3e5e[_0x5dcc3e(0x159)](_0x155b6b[_0x3463c7]);}return _0x6c3e5e[_0x5dcc3e(0x156)]('\x0a')[_0x5dcc3e(0x132)]();}export function resolveSqlMode(_0x320599,_0x2b595f){const _0x33ae2e=a165_0x370d;if(_0x2b595f?.[_0x33ae2e(0x157)])return _0x2b595f[_0x33ae2e(0x157)];return detectSqlMode(_0x320599);}export function resolveSqlFileName(_0x43f6c7,_0x276a89,_0x61ea57){const _0x199987=a165_0x370d;if(_0x61ea57?.[_0x199987(0x139)])return _0x61ea57[_0x199987(0x139)];if(_0x61ea57?.[_0x199987(0x13f)]||_0x61ea57?.[_0x199987(0x145)])return buildSqlRelativePath(_0x43f6c7,_0x61ea57?.['sqlName'],_0x61ea57?.['dbName'],resolveSqlMode(_0x276a89,_0x61ea57),_0x61ea57?.['dbId']);return buildDefaultSqlFileName(_0x43f6c7,resolveSqlMode(_0x276a89,_0x61ea57));}export function resolveSqlLocalDir(_0x5ffbea,_0x23d222){return join(_0x5ffbea,SQL_LOCAL_REL_DIR,_0x23d222);}export async function confirmForceOverwrite(_0x466368){const _0x87c227=a165_0x370d,_0x2d57a9=createInterface({'input':process[_0x87c227(0x14f)],'output':process[_0x87c227(0x13c)]}),_0x3f5179=await new Promise(_0x2f40fe=>{const _0x1948e8=_0x87c227;_0x2d57a9[_0x1948e8(0x141)](_0x466368+_0x1948e8(0x13e),_0x2f40fe);});return _0x2d57a9[_0x87c227(0x14c)](),['y',_0x87c227(0x15b)][_0x87c227(0x13d)](_0x3f5179[_0x87c227(0x14d)]()['toLowerCase']());}export function findSqlLockScope(_0xd67a4e,_0x3df3ee){const _0x1c7762=a165_0x370d;return _0xd67a4e[_0x1c7762(0x151)][_0x3df3ee];}function buildMetadataHeaderLines(_0xa323d5,_0xcb79ca){const _0x3d675e=a165_0x370d,_0xd58bb3=[[_0x3d675e(0x134),_0xa323d5[_0x3d675e(0x134)]],[_0x3d675e(0x13f),_0xa323d5['sqlName']],['dbId',_0xa323d5['dbId']],[_0x3d675e(0x145),_0xa323d5['dbName']],['mode',_0xa323d5['mode']],[_0x3d675e(0x149),_0xa323d5[_0x3d675e(0x149)]],[_0x3d675e(0x137),_0xa323d5[_0x3d675e(0x137)]]];if(_0xcb79ca==='mybatisXml')return _0xd58bb3[_0x3d675e(0x133)](([,_0x2b9558])=>_0x2b9558!==undefined&&_0x2b9558!==null&&String(_0x2b9558)[_0x3d675e(0x14d)]()!=='')[_0x3d675e(0x15a)](([_0x51db35,_0xd2a6d3])=>'<!--\x20@lovrabet.'+_0x51db35+':\x20'+String(_0xd2a6d3)+'\x20-->');return _0xd58bb3[_0x3d675e(0x133)](([,_0x120b95])=>_0x120b95!==undefined&&_0x120b95!==null&&String(_0x120b95)[_0x3d675e(0x14d)]()!=='')[_0x3d675e(0x15a)](([_0x29dd9b,_0x2a3fdd])=>'--\x20@lovrabet.'+_0x29dd9b+':\x20'+String(_0x2a3fdd));}function a165_0x2ef6(){const _0x5c196f=['split','sqlContent','close','trim','fromEntries','stdin','718VOGDMT','apps','mybatisXml','365725eGIixV','replace','1736712IfxFqZ','join','mode','717786leQBSn','push','map','yes','880880erkKHC','sqlRoot','trimStart','filter','sqlCode','606gzetcH','test','description','sqlConfig','path','111800cjyMvl','98ekmJdj','stderr','includes','\x20[y/N]\x20','sqlName','dbId','question','length','endsWith','sqls','dbName','version','18iygbcT','663576QEzndc','syncedAt'];a165_0x2ef6=function(){return _0x5c196f;};return a165_0x2ef6();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a166_0x3c9a4d=a166_0x266f;function a166_0x266f(_0x1e2322,_0x395d0c){_0x1e2322=_0x1e2322-0x1af;const _0x1a7b59=a166_0x1a7b();let _0x266f63=_0x1a7b59[_0x1e2322];return _0x266f63;}(function(_0x3aa6fc,_0x49a19c){const _0x32e710=a166_0x266f,_0x1604ac=_0x3aa6fc();while(!![]){try{const _0x16c715=-parseInt(_0x32e710(0x1b8))/0x1*(-parseInt(_0x32e710(0x1b2))/0x2)+parseInt(_0x32e710(0x1d1))/0x3*(parseInt(_0x32e710(0x1cd))/0x4)+parseInt(_0x32e710(0x1b6))/0x5+-parseInt(_0x32e710(0x1c1))/0x6*(-parseInt(_0x32e710(0x1c0))/0x7)+parseInt(_0x32e710(0x1d0))/0x8+parseInt(_0x32e710(0x1b0))/0x9+-parseInt(_0x32e710(0x1bc))/0xa;if(_0x16c715===_0x49a19c)break;else _0x1604ac['push'](_0x1604ac['shift']());}catch(_0x2f17d9){_0x1604ac['push'](_0x1604ac['shift']());}}}(a166_0x1a7b,0xe8de4));import{listSqlQueries}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile}from'../../core/sql-sync/lock.js';const PAGE_SIZE=0x64;async function fetchAllSqlCodes(_0xaf454b){const _0x1b68b2=a166_0x266f,_0x13f9f6=[];let _0x17d681=0x1;while(!![]){const _0x4f64b4=await listSqlQueries(_0xaf454b,{'currentPage':_0x17d681,'pageSize':PAGE_SIZE}),_0x29a261=_0x4f64b4[_0x1b68b2(0x1c2)]??[];_0x13f9f6[_0x1b68b2(0x1c7)](..._0x29a261[_0x1b68b2(0x1b1)](_0x1e018b=>_0x1e018b[_0x1b68b2(0x1bd)]));if(_0x29a261[_0x1b68b2(0x1c3)]===0x0)break;const _0x370065=_0x4f64b4[_0x1b68b2(0x1d5)]?.[_0x1b68b2(0x1af)];if(_0x370065!=null?_0x13f9f6[_0x1b68b2(0x1c3)]>=_0x370065:_0x29a261[_0x1b68b2(0x1c3)]<PAGE_SIZE)break;_0x17d681++;}return _0x13f9f6;}export const sqlStatus={'service':'sql','command':a166_0x3c9a4d(0x1c9),'description':a166_0x3c9a4d(0x1c8),'risk':'read','flags':[{'name':'remote','type':a166_0x3c9a4d(0x1b7),'description':'Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally'}],async 'execute'(_0xdc322d){const _0x5b88fe=a166_0x3c9a4d,_0x21e9fa=loadSqlProjectConfig(_0xdc322d[_0x5b88fe(0x1c5)]),_0x45b125=await readSqlLockFile(_0x21e9fa[_0x5b88fe(0x1be)]),{appLock:_0x287ba0}=ensureSqlLockScope(_0x45b125??createEmptySqlLock(),_0x21e9fa[_0x5b88fe(0x1c5)],_0x21e9fa['sqlRoot'],_0x5b88fe(0x1c9)),_0x10d025=await scanLocalSqlQueries(_0x21e9fa),_0x5aaf7e=[],_0x4df4d3=[],_0x4f39ff=[],_0x57fb62=[],_0x595b7e=new Set(_0x10d025[_0x5b88fe(0x1b1)](_0x5764fc=>_0x5764fc[_0x5b88fe(0x1b5)]));for(const _0xee9cfd of _0x10d025){const _0x34bd8a=await computeSqlFileHash(_0xee9cfd[_0x5b88fe(0x1d4)]),_0x3fd462=_0x287ba0[_0x5b88fe(0x1cc)][_0xee9cfd[_0x5b88fe(0x1b5)]],_0x5b53d6=!!_0x3fd462&&_0x3fd462[_0x5b88fe(0x1bb)]!==_0xee9cfd[_0x5b88fe(0x1ba)],_0x4ef307=!!_0x3fd462&&!!_0xee9cfd[_0x5b88fe(0x1d3)]&&_0x3fd462[_0x5b88fe(0x1d3)]!==_0xee9cfd['sqlName'];if(!_0x3fd462)_0x5aaf7e[_0x5b88fe(0x1c7)](_0xee9cfd[_0x5b88fe(0x1b5)]);else _0x3fd462[_0x5b88fe(0x1cf)]!==_0x34bd8a||_0x5b53d6||_0x4ef307?_0x4df4d3[_0x5b88fe(0x1c7)](_0xee9cfd[_0x5b88fe(0x1b5)]):_0x4f39ff[_0x5b88fe(0x1c7)](_0xee9cfd[_0x5b88fe(0x1b5)]);}for(const _0x433cf1 of Object[_0x5b88fe(0x1b4)](_0x287ba0[_0x5b88fe(0x1cc)])){!_0x595b7e['has'](_0x433cf1)&&_0x57fb62[_0x5b88fe(0x1c7)](_0x433cf1);}const _0xfac2c9=[];if(_0xdc322d[_0x5b88fe(0x1ca)](_0x5b88fe(0x1b3))){const _0x44a993=await fetchAllSqlCodes(_0xdc322d[_0x5b88fe(0x1c5)]);for(const _0x1e69b7 of _0x44a993){!_0x595b7e[_0x5b88fe(0x1cb)](_0x1e69b7)&&!_0x287ba0['sqls'][_0x1e69b7]&&_0xfac2c9[_0x5b88fe(0x1c7)](_0x1e69b7);}}const _0x554649=_0x5aaf7e['length']===0x0&&_0x4df4d3[_0x5b88fe(0x1c3)]===0x0&&_0x57fb62['length']===0x0&&_0xfac2c9[_0x5b88fe(0x1c3)]===0x0;return{'ok':!![],'data':{'added':_0x5aaf7e,'modified':_0x4df4d3,'missing':_0x57fb62,'unchanged':_0x4f39ff,'remoteOnly':_0xfac2c9},'message':_0x554649?_0x5b88fe(0x1bf):_0x5aaf7e[_0x5b88fe(0x1c3)]+_0x5b88fe(0x1d2)+_0x4df4d3[_0x5b88fe(0x1c3)]+_0x5b88fe(0x1ce)+_0x57fb62['length']+_0x5b88fe(0x1b9)+_0x4f39ff[_0x5b88fe(0x1c3)]+_0x5b88fe(0x1c4)+(_0xfac2c9[_0x5b88fe(0x1c3)]>0x0?',\x20'+_0xfac2c9[_0x5b88fe(0x1c3)]+_0x5b88fe(0x1c6):'')};}};function a166_0x1a7b(){const _0x17a9f9=['keys','lockKey','6357575mfwZxS','boolean','124211NWIkLT','\x20missing,\x20','relativePath','path','48352910BHMYyY','sqlCode','lockFilePath','All\x20SQL\x20queries\x20are\x20in\x20sync.','7sPFEOJ','3962928GyNBzW','tableData','length','\x20unchanged','appCode','\x20remote-only','push','Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','status','bool','has','sqls','340bAydJO','\x20modified,\x20','hash','9547696oLZLfO','18891tNlprh','\x20added,\x20','sqlName','filePath','paging','totalCount','4622994pTUpJG','map','26RTRAYT','remote'];a166_0x1a7b=function(){return _0x17a9f9;};return a166_0x1a7b();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a167_0x3d399e=a167_0x14d3;(function(_0x255eca,_0x55fe56){const _0x1fa720=a167_0x14d3,_0x92b4b2=_0x255eca();while(!![]){try{const _0x5fe0f8=parseInt(_0x1fa720(0x1e6))/0x1+parseInt(_0x1fa720(0x203))/0x2+-parseInt(_0x1fa720(0x1ea))/0x3*(-parseInt(_0x1fa720(0x1e2))/0x4)+-parseInt(_0x1fa720(0x1e3))/0x5+parseInt(_0x1fa720(0x209))/0x6*(parseInt(_0x1fa720(0x1e4))/0x7)+-parseInt(_0x1fa720(0x1dd))/0x8+parseInt(_0x1fa720(0x1fe))/0x9*(-parseInt(_0x1fa720(0x1f7))/0xa);if(_0x5fe0f8===_0x55fe56)break;else _0x92b4b2['push'](_0x92b4b2['shift']());}catch(_0x4736ec){_0x92b4b2['push'](_0x92b4b2['shift']());}}}(a167_0x1b93,0x6f831));import{readFileSync,existsSync}from'node:fs';function a167_0x14d3(_0x30fc95,_0x11127e){_0x30fc95=_0x30fc95-0x1da;const _0x1b9344=a167_0x1b93();let _0x14d34b=_0x1b9344[_0x30fc95];return _0x14d34b;}import{resolve}from'node:path';import{validateSql}from'../../core/sql-validator.js';import{getDatasetDetail,listDatasets}from'../../core/api-client.js';function a167_0x1b93(){const _0x2123b5=['7uxKrcB','name','732395XRTxVC','map','Validate\x20SQL\x20content\x20without\x20saving\x20(type\x20detection,\x20parameter\x20extraction,\x20optional\x20schema\x20check)','type','6hCOGTg','Comma-separated\x20dataset\x20codes\x20to\x20cross-check\x20table/column\x20names\x20against','toLowerCase','size','message','trim','File\x20not\x20found:\x20','schema:','sql','str','\x22\x20not\x20found\x20in\x20any\x20dataset','Inline\x20SQL\x20content\x20to\x20validate\x20(alternative\x20to\x20--file)','SQL\x20schema\x20validation','2330EaZhGx','tables','file','validation','string','dbtableConfig','appCode','18567xkRcFt','parameters','length','sqlType','split','6798Czcywm','\x22\x20not\x20found\x20or\x20not\x20accessible','fields','Table\x20\x22','reason','Path\x20to\x20the\x20SQL\x20file\x20to\x20validate','3507594hhLwVR','isSelectOnly','schemaWarnings','Provide\x20--file\x20or\x20--sql','push','isArray','isDangerous','valid','tableName','Dataset\x20\x22','validate','713120UrJZBp','flagMissing','schemas','read','cwd','776012xszZbY','3409135UbpBBg'];a167_0x1b93=function(){return _0x2123b5;};return a167_0x1b93();}import{CliErrors}from'../../errors.js';import{assertDatasetIsDbTableBacked,filterDbTableBackedDatasets}from'../../commands/dataset/capability.js';export const sqlValidate={'service':a167_0x3d399e(0x1f2),'command':a167_0x3d399e(0x1dc),'description':a167_0x3d399e(0x1e8),'risk':a167_0x3d399e(0x1e0),'flags':[{'name':a167_0x3d399e(0x1f9),'type':a167_0x3d399e(0x1fb),'description':a167_0x3d399e(0x208)},{'name':a167_0x3d399e(0x1f2),'type':'string','description':a167_0x3d399e(0x1f5)},{'name':a167_0x3d399e(0x1df),'type':a167_0x3d399e(0x1fb),'description':a167_0x3d399e(0x1eb)}],async 'execute'(_0x1ab7a0){const _0x1ae33c=a167_0x3d399e,_0xa9822a=_0x1ab7a0['str'](_0x1ae33c(0x1f9)),_0x47401e=_0x1ab7a0[_0x1ae33c(0x1f3)](_0x1ae33c(0x1f2));if(!_0xa9822a&&!_0x47401e)throw CliErrors[_0x1ae33c(0x1de)](_0x1ae33c(0x1f9),_0x1ae33c(0x20c));let _0x1947c2;if(_0xa9822a){const _0x148afc=resolve(process[_0x1ae33c(0x1e1)](),_0xa9822a);if(!existsSync(_0x148afc))throw CliErrors[_0x1ae33c(0x1fa)](_0x1ae33c(0x1f0)+_0x148afc);_0x1947c2=readFileSync(_0x148afc,'utf-8');}else _0x1947c2=_0x47401e;const _0x5aee14=validateSql(_0x1947c2),_0x2f4586={'valid':_0x5aee14['valid'],'sqlType':_0x5aee14[_0x1ae33c(0x201)][_0x1ae33c(0x1e9)],'isSelectOnly':_0x5aee14[_0x1ae33c(0x201)][_0x1ae33c(0x20a)],'isDangerous':_0x5aee14[_0x1ae33c(0x201)][_0x1ae33c(0x20f)],'tables':_0x5aee14[_0x1ae33c(0x1f8)],'parameters':_0x5aee14[_0x1ae33c(0x1ff)],'message':_0x5aee14[_0x1ae33c(0x1ee)]};_0x5aee14[_0x1ae33c(0x201)][_0x1ae33c(0x207)]&&(_0x2f4586[_0x1ae33c(0x207)]=_0x5aee14['sqlType'][_0x1ae33c(0x207)]);const _0x7896bb=_0x1ab7a0[_0x1ae33c(0x1f3)](_0x1ae33c(0x1df));if(_0x7896bb&&_0x5aee14[_0x1ae33c(0x210)]){const _0x493b20=_0x7896bb[_0x1ae33c(0x202)](',')[_0x1ae33c(0x1e7)](_0x176ad7=>_0x176ad7[_0x1ae33c(0x1ef)]())['filter'](Boolean),_0x5dc548=[],_0x2f1262=filterDbTableBackedDatasets(await listDatasets(_0x1ab7a0[_0x1ae33c(0x1fd)])),_0x47982f=new Map(_0x2f1262[_0x1ae33c(0x1e7)](_0x38210e=>[_0x38210e[_0x1ae33c(0x1fc)]?.[_0x1ae33c(0x1da)]?.[_0x1ae33c(0x1ec)](),_0x38210e]));for(const _0x5073c9 of _0x5aee14['tables']){const _0x4fe6f4=_0x47982f['get'](_0x5073c9[_0x1ae33c(0x1ec)]());!_0x4fe6f4&&_0x5dc548['push'](_0x1ae33c(0x206)+_0x5073c9+_0x1ae33c(0x1f4));}for(const _0x2e51e1 of _0x493b20){let _0x291205;try{_0x291205=await getDatasetDetail(_0x2e51e1);}catch{_0x5dc548[_0x1ae33c(0x20d)](_0x1ae33c(0x1db)+_0x2e51e1+_0x1ae33c(0x204));continue;}assertDatasetIsDbTableBacked(_0x291205,_0x1ae33c(0x1f6));const _0x436520=Array[_0x1ae33c(0x20e)](_0x291205[_0x1ae33c(0x205)])?_0x291205[_0x1ae33c(0x205)]:[],_0x4e0957=new Set(_0x436520[_0x1ae33c(0x1e7)](_0x30ff5d=>_0x30ff5d[_0x1ae33c(0x1e5)]?.[_0x1ae33c(0x1ec)]())),_0x592e0f=_0x291205[_0x1ae33c(0x1fc)]?.[_0x1ae33c(0x1da)]||_0x291205['tableName']||_0x2e51e1;_0x2f4586[_0x1ae33c(0x1f1)+_0x592e0f]={'code':_0x2e51e1,'tableName':_0x592e0f,'fieldCount':_0x4e0957[_0x1ae33c(0x1ed)],'fields':Array['from'](_0x4e0957)};}_0x5dc548[_0x1ae33c(0x200)]>0x0&&(_0x2f4586[_0x1ae33c(0x20b)]=_0x5dc548);}return{'ok':_0x5aee14['valid'],'data':_0x2f4586,'message':_0x5aee14[_0x1ae33c(0x1ee)]};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a168_0xb69c(){const _0x25613b=['7668207lIdCMj','Register\x20an\x20app\x20profile\x20in\x20the\x20current\x20workspace\x20(or\x20--global)','5962032DlPJOE','workspace','add','1773234TmyOFR','name','88774TuwEkD','App\x20profile\x20name','2876cCRBBb','5620DdzPgC','16PPoyct','workspace\x20add','204443waBmYD','2768652KXrsDU'];a168_0xb69c=function(){return _0x25613b;};return a168_0xb69c();}function a168_0x8a43(_0x457ef1,_0x402db2){_0x457ef1=_0x457ef1-0x18d;const _0xb69cd2=a168_0xb69c();let _0x8a43cf=_0xb69cd2[_0x457ef1];return _0x8a43cf;}const a168_0x17a2f0=a168_0x8a43;(function(_0x54eed4,_0x565537){const _0x21884a=a168_0x8a43,_0x526aa7=_0x54eed4();while(!![]){try{const _0x1626bf=parseInt(_0x21884a(0x195))/0x1+parseInt(_0x21884a(0x18d))/0x2+parseInt(_0x21884a(0x196))/0x3+-parseInt(_0x21884a(0x191))/0x4*(parseInt(_0x21884a(0x192))/0x5)+parseInt(_0x21884a(0x199))/0x6+parseInt(_0x21884a(0x18f))/0x7+parseInt(_0x21884a(0x193))/0x8*(-parseInt(_0x21884a(0x197))/0x9);if(_0x1626bf===_0x565537)break;else _0x526aa7['push'](_0x526aa7['shift']());}catch(_0x2dcdfd){_0x526aa7['push'](_0x526aa7['shift']());}}}(a168_0xb69c,0x7c0c0));import{buildAppAddFlags,runAppAdd,validateAppName}from'../../commands/common/app-registry.js';export const workspaceAddDefinition={'service':a168_0x17a2f0(0x19a),'command':a168_0x17a2f0(0x19b),'description':a168_0x17a2f0(0x198),'risk':'write','requiresAuth':![],'requiresAppCode':![],'args':[{'name':a168_0x17a2f0(0x18e),'description':a168_0x17a2f0(0x190),'required':!![]}],'flags':buildAppAddFlags(),'validate':_0x48de5c=>validateAppName(_0x48de5c,a168_0x17a2f0(0x194)),'execute':_0x26fa11=>runAppAdd(_0x26fa11,'workspace\x20add')};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a169_0x45528c=a169_0xc0a1;(function(_0x109362,_0x10a9f2){const _0x39eeca=a169_0xc0a1,_0x420bde=_0x109362();while(!![]){try{const _0x1a2694=-parseInt(_0x39eeca(0x186))/0x1+-parseInt(_0x39eeca(0x16c))/0x2*(parseInt(_0x39eeca(0x15e))/0x3)+-parseInt(_0x39eeca(0x188))/0x4*(-parseInt(_0x39eeca(0x17c))/0x5)+parseInt(_0x39eeca(0x189))/0x6*(-parseInt(_0x39eeca(0x17a))/0x7)+parseInt(_0x39eeca(0x159))/0x8+-parseInt(_0x39eeca(0x14f))/0x9*(parseInt(_0x39eeca(0x158))/0xa)+parseInt(_0x39eeca(0x176))/0xb*(parseInt(_0x39eeca(0x16b))/0xc);if(_0x1a2694===_0x10a9f2)break;else _0x420bde['push'](_0x420bde['shift']());}catch(_0x50bb77){_0x420bde['push'](_0x420bde['shift']());}}}(a169_0x3b4b,0xd8a3a));import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';import{RABETBASE_ENV_VALUES}from'../../constant/env.js';import{RABETBASE_OUTPUT_FORMAT_VALUES}from'../../constant/output.js';import{RISK_LEVEL_VALUES}from'../../constant/risk.js';import{validateAppcode}from'../../commands/common/validate.js';import{readConfigFile,readRawConfigWithLayers,resolveWriteConfigPath,writeConfigFile}from'../../context.js';import{workspaceAddDefinition}from'../../commands/workspace/add.js';import{workspaceRemoveDefinition}from'../../commands/workspace/remove.js';function a169_0xc0a1(_0x10dd0b,_0x56f31f){_0x10dd0b=_0x10dd0b-0x14d;const _0x3b4b43=a169_0x3b4b();let _0xc0a171=_0x3b4b43[_0x10dd0b];return _0xc0a171;}const WORKSPACE_USAGE=CLI_BIN_NAME+a169_0x45528c(0x166),SAFE_PROFILE_KEYS=['appcode',a169_0x45528c(0x185),a169_0x45528c(0x17b),a169_0x45528c(0x178),a169_0x45528c(0x187),a169_0x45528c(0x169),a169_0x45528c(0x15c)],workspaceFlags=[{'name':'app','type':'string','description':a169_0x45528c(0x183)},{'name':'appcode','type':a169_0x45528c(0x163),'description':a169_0x45528c(0x16f)},{'name':a169_0x45528c(0x185),'type':a169_0x45528c(0x163),'description':a169_0x45528c(0x150),'enum':[...RABETBASE_ENV_VALUES]},{'name':a169_0x45528c(0x17b),'type':a169_0x45528c(0x163),'description':a169_0x45528c(0x17f)},{'name':a169_0x45528c(0x16d),'type':a169_0x45528c(0x163),'description':'Default\x20output\x20format\x20for\x20this\x20workspace\x20app\x20profile','enum':[...RABETBASE_OUTPUT_FORMAT_VALUES]},{'name':a169_0x45528c(0x187),'type':'number','description':a169_0x45528c(0x17d)},{'name':a169_0x45528c(0x169),'type':a169_0x45528c(0x163),'description':'Risk\x20level\x20for\x20this\x20workspace\x20app\x20profile','enum':[...RISK_LEVEL_VALUES]},{'name':'locale','type':a169_0x45528c(0x163),'description':a169_0x45528c(0x153)}];function isRecord(_0xa04e0b){const _0x538944=a169_0x45528c;return!!_0xa04e0b&&typeof _0xa04e0b===_0x538944(0x182)&&!Array[_0x538944(0x173)](_0xa04e0b);}function assertValidAppcode(_0xda44a4){const _0x3693c6=a169_0x45528c,{valid:_0x30552d,message:_0x1593fc}=validateAppcode(_0xda44a4);if(!_0x30552d)throw CliErrors[_0x3693c6(0x157)](_0x3693c6(0x177)+_0xda44a4,_0x1593fc);}function a169_0x3b4b(){const _0x4b8c50=['Use\x20`','363762mNgliK','Target\x20environment','use','initialized','Locale\x20for\x20this\x20workspace\x20app\x20profile','appcode','\x20--app\x20','workspace','validation','430KQdySB','2964680daLkpL','join','\x22\x20not\x20found.','locale','keys','3006741wzEbcK','\x20(appcode:\x20','Initialize\x20the\x20current\x20workspace\x20app\x20binding','write','defaultApp','string','flag','Workspace\x20','\x20workspace\x20<init|use>\x20--app\x20<name>\x20[--appcode\x20<code>]','\x20workspace\x20use\x20--app\x20<name>`.','workspace.','riskLevel','init','9496248hyAozT','2JYiAbc','defaultFormat','globalConfig','App\x20code\x20to\x20bind\x20to\x20this\x20workspace','\x20workspace\x20','trim','length','isArray','str','apps','66Fjgmxy','Invalid\x20appcode:\x20','format','project','413mkmllT','apiDir','2052385VjPmTB','Default\x20page\x20size\x20for\x20this\x20workspace\x20app\x20profile','App\x20\x22','API\x20directory\x20path\x20for\x20this\x20workspace\x20app\x20profile',').\x20Config:\x20','app','object','App\x20profile\x20name\x20to\x20use\x20in\x20this\x20workspace','\x20workspace\x20init\x20--appcode\x20<code>`\x20or\x20`','env','1668030iALRYT','pageSize','4jTmcQv','23754yOvcMU','Missing\x20workspace\x20app\x20selector.'];a169_0x3b4b=function(){return _0x4b8c50;};return a169_0x3b4b();}function sanitizeProfile(_0x259bc6){if(!isRecord(_0x259bc6))return{};const _0x33b2d1={};for(const _0x2cb2bc of SAFE_PROFILE_KEYS){if(_0x259bc6[_0x2cb2bc]!==undefined)_0x33b2d1[_0x2cb2bc]=_0x259bc6[_0x2cb2bc];}return _0x33b2d1;}function cloneProfile(_0x5c50be){return isRecord(_0x5c50be)?{..._0x5c50be}:{};}function collectWorkspaceProfileOverrides(_0x563467){const _0x7a1c53=a169_0x45528c,_0xb5a717={},_0x4aa50d=_0x563467['str'](_0x7a1c53(0x185)),_0x250cd8=_0x563467[_0x7a1c53(0x174)](_0x7a1c53(0x17b)),_0x27ea86=_0x563467[_0x7a1c53(0x174)](_0x7a1c53(0x16d)),_0x5bdef2=_0x563467[_0x7a1c53(0x164)](_0x7a1c53(0x187)),_0x29610f=_0x563467['str'](_0x7a1c53(0x169)),_0x56e3f9=_0x563467['str']('locale');if(_0x4aa50d)_0xb5a717['env']=_0x4aa50d;if(_0x250cd8)_0xb5a717[_0x7a1c53(0x17b)]=_0x250cd8;if(_0x27ea86)_0xb5a717[_0x7a1c53(0x178)]=_0x27ea86;if(_0x5bdef2!==undefined&&_0x5bdef2!=='')_0xb5a717[_0x7a1c53(0x187)]=Number(_0x5bdef2);if(_0x29610f)_0xb5a717['riskLevel']=_0x29610f;if(_0x56e3f9)_0xb5a717[_0x7a1c53(0x15c)]=_0x56e3f9;return _0xb5a717;}async function validateWorkspaceArgs(_0x3e7e4e){const _0xcfec9b=a169_0x45528c,_0x142150=_0x3e7e4e[_0xcfec9b(0x174)](_0xcfec9b(0x181))[_0xcfec9b(0x171)](),_0x41d1a0=_0x3e7e4e[_0xcfec9b(0x174)](_0xcfec9b(0x154))[_0xcfec9b(0x171)]();if(!_0x142150&&!_0x41d1a0)throw CliErrors[_0xcfec9b(0x157)](_0xcfec9b(0x14d),'Use\x20`'+CLI_BIN_NAME+_0xcfec9b(0x184)+CLI_BIN_NAME+_0xcfec9b(0x167));if(_0x41d1a0)assertValidAppcode(_0x41d1a0);}function resolveKnownApps(){const _0x427bf2=a169_0x45528c,{config:_0x227054,layers:_0x18fadc}=readRawConfigWithLayers(),_0x4b66b2=isRecord(_0x227054[_0x427bf2(0x175)])?_0x227054[_0x427bf2(0x175)]:{},_0x34f1e1=isRecord(_0x18fadc[_0x427bf2(0x16e)][_0x427bf2(0x175)])?_0x18fadc[_0x427bf2(0x16e)][_0x427bf2(0x175)]:{};return{..._0x34f1e1,..._0x4b66b2};}async function configureWorkspace(_0x10dce5,_0xed809){const _0x11d414=a169_0x45528c,_0x9912d9=_0x10dce5[_0x11d414(0x174)]('app')['trim'](),_0x731d79=_0x10dce5[_0x11d414(0x174)](_0x11d414(0x154))[_0x11d414(0x171)](),_0x32115a=_0x9912d9||_0x731d79;if(!_0x32115a)throw CliErrors[_0x11d414(0x157)](_0x11d414(0x14d),_0x11d414(0x14e)+CLI_BIN_NAME+_0x11d414(0x184)+CLI_BIN_NAME+'\x20workspace\x20use\x20--app\x20<name>`.');if(_0x731d79)assertValidAppcode(_0x731d79);const _0x5596ff=resolveWriteConfigPath(_0x11d414(0x179)),_0x1af102=readConfigFile(_0x5596ff),_0x2d0151=resolveKnownApps(),_0x24e9f0=isRecord(_0x1af102[_0x11d414(0x175)])?{..._0x1af102['apps']}:{},_0x190c04=cloneProfile(_0x24e9f0[_0x32115a]),_0x439aa4=sanitizeProfile(_0x2d0151[_0x32115a]),_0x322ab3=_0x731d79?{}:_0x439aa4,_0x235cbe=_0x731d79||_0x322ab3[_0x11d414(0x154)];if(!_0x235cbe){const _0x5190a3=Object[_0x11d414(0x15d)](_0x2d0151),_0x94414=_0x5190a3[_0x11d414(0x172)]===0x0?_0x11d414(0x14e)+CLI_BIN_NAME+_0x11d414(0x170)+_0xed809+_0x11d414(0x155)+_0x32115a+'\x20--appcode\x20<code>`.':'Pass\x20--appcode\x20<code>,\x20or\x20choose\x20one\x20of:\x20'+_0x5190a3[_0x11d414(0x15a)](',\x20');throw CliErrors[_0x11d414(0x157)](_0x11d414(0x17e)+_0x32115a+_0x11d414(0x15b),_0x94414);}assertValidAppcode(String(_0x235cbe));const _0x3dcea8={..._0x322ab3,..._0x190c04,'appcode':String(_0x235cbe),...collectWorkspaceProfileOverrides(_0x10dce5)};return _0x24e9f0[_0x32115a]=_0x3dcea8,_0x1af102[_0x11d414(0x175)]=_0x24e9f0,_0x1af102[_0x11d414(0x162)]=_0x32115a,delete _0x1af102['appcode'],delete _0x1af102['app'],_0x3dcea8['env']&&(_0x1af102[_0x11d414(0x185)]=_0x3dcea8['env']),writeConfigFile(_0x5596ff,_0x1af102),{'ok':!![],'message':_0x11d414(0x165)+(_0xed809===_0x11d414(0x16a)?_0x11d414(0x152):'updated')+':\x20'+_0x32115a+_0x11d414(0x15f)+_0x3dcea8[_0x11d414(0x154)]+_0x11d414(0x180)+_0x5596ff+'.\x20Credentials:\x20not\x20written.','data':{'operation':_0x11d414(0x168)+_0xed809,'configPath':_0x5596ff,'app':_0x32115a,'appcode':_0x3dcea8[_0x11d414(0x154)],'env':_0x3dcea8[_0x11d414(0x185)]??null,'credentialsWritten':![]}};}const workspaceInitDefinition={'service':a169_0x45528c(0x156),'command':a169_0x45528c(0x16a),'description':a169_0x45528c(0x160),'risk':a169_0x45528c(0x161),'requiresAuth':![],'requiresAppCode':![],'args':[],'flags':workspaceFlags,'validate':validateWorkspaceArgs,'execute':_0x78b630=>configureWorkspace(_0x78b630,a169_0x45528c(0x16a))},workspaceUseDefinition={'service':a169_0x45528c(0x156),'command':'use','description':'Switch\x20the\x20current\x20workspace\x20app\x20binding','risk':'write','requiresAuth':![],'requiresAppCode':![],'args':[],'flags':workspaceFlags,'validate':validateWorkspaceArgs,'execute':_0x9ee670=>configureWorkspace(_0x9ee670,a169_0x45528c(0x151))};export const workspaceDefinitions=[workspaceInitDefinition,workspaceUseDefinition,workspaceAddDefinition,workspaceRemoveDefinition];export{WORKSPACE_USAGE};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a170_0x172a(_0x3d829e,_0x4d1e2f){_0x3d829e=_0x3d829e-0x1c0;const _0x2072ff=a170_0x2072();let _0x172a19=_0x2072ff[_0x3d829e];return _0x172a19;}const a170_0x235b3c=a170_0x172a;(function(_0x18cd7a,_0x46d49a){const _0x35dc77=a170_0x172a,_0x1a442f=_0x18cd7a();while(!![]){try{const _0x3a1ac8=-parseInt(_0x35dc77(0x1cb))/0x1+-parseInt(_0x35dc77(0x1c7))/0x2*(parseInt(_0x35dc77(0x1ca))/0x3)+-parseInt(_0x35dc77(0x1cc))/0x4+-parseInt(_0x35dc77(0x1c6))/0x5+-parseInt(_0x35dc77(0x1c2))/0x6*(parseInt(_0x35dc77(0x1c1))/0x7)+-parseInt(_0x35dc77(0x1cd))/0x8+-parseInt(_0x35dc77(0x1ce))/0x9*(-parseInt(_0x35dc77(0x1c8))/0xa);if(_0x3a1ac8===_0x46d49a)break;else _0x1a442f['push'](_0x1a442f['shift']());}catch(_0x426edf){_0x1a442f['push'](_0x1a442f['shift']());}}}(a170_0x2072,0xe4ea2));import{buildAppRemoveFlags,runAppRemove,validateAppName}from'../../commands/common/app-registry.js';export const workspaceRemoveDefinition={'service':a170_0x235b3c(0x1c3),'command':a170_0x235b3c(0x1c0),'description':a170_0x235b3c(0x1c9),'risk':a170_0x235b3c(0x1cf),'requiresAuth':![],'requiresAppCode':![],'args':[{'name':'name','description':a170_0x235b3c(0x1c4),'required':!![]}],'flags':buildAppRemoveFlags(),'validate':_0x8951e0=>validateAppName(_0x8951e0,'workspace\x20remove'),'execute':_0x2a1ee2=>runAppRemove(_0x2a1ee2,a170_0x235b3c(0x1c5))};function a170_0x2072(){const _0x5464f8=['remove','4683YOIeGA','10338KKEZLq','workspace','App\x20profile\x20name\x20to\x20remove','workspace\x20remove','9339380zucrjV','386806ZXqSkg','2830wLNsRM','Remove\x20an\x20app\x20profile\x20from\x20the\x20current\x20workspace\x20(or\x20--global)','12yMiXQc','1147694abluRO','6940988wwMZLB','4731208UNdehb','260973NGwwWg','high-risk-write'];a170_0x2072=function(){return _0x5464f8;};return a170_0x2072();}
|
package/lib/config/schema.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a171_0x5113a3=a171_0x17c5;(function(_0x1f37ab,_0x2fe302){const _0x3777f1=a171_0x17c5,_0x4ee277=_0x1f37ab();while(!![]){try{const _0x849d9=-parseInt(_0x3777f1(0x1c8))/0x1+parseInt(_0x3777f1(0x1c0))/0x2*(-parseInt(_0x3777f1(0x1b3))/0x3)+-parseInt(_0x3777f1(0x1bc))/0x4*(-parseInt(_0x3777f1(0x1c3))/0x5)+parseInt(_0x3777f1(0x1ad))/0x6+parseInt(_0x3777f1(0x1b2))/0x7+parseInt(_0x3777f1(0x1ae))/0x8+-parseInt(_0x3777f1(0x1bf))/0x9*(parseInt(_0x3777f1(0x1a8))/0xa);if(_0x849d9===_0x2fe302)break;else _0x4ee277['push'](_0x4ee277['shift']());}catch(_0x41d66a){_0x4ee277['push'](_0x4ee277['shift']());}}}(a171_0x5904,0xc989e));import{DEFAULT_CONFIG_VALUES}from'../constant/defaults.js';import{RABETBASE_ENV_VALUES}from'../constant/env.js';import{RABETBASE_OUTPUT_FORMAT_VALUES}from'../constant/output.js';import{RISK_LEVEL_VALUES}from'../constant/risk.js';export{DEFAULT_CONFIG_VALUES}from'../constant/defaults.js';export const PROJECT_CREATE_INHERITABLE_KEYS=[a171_0x5113a3(0x1ac),'accessKey',a171_0x5113a3(0x1bb),a171_0x5113a3(0x1ba),a171_0x5113a3(0x1c7)];export const TOP_LEVEL_CONFIG_KEYS=new Set([a171_0x5113a3(0x1ce),a171_0x5113a3(0x1b7),'locale',a171_0x5113a3(0x1ba),a171_0x5113a3(0x1ac),'accessKey',a171_0x5113a3(0x1b4)]);export const CONFIG_ENUM_VALUES={'env':[...RABETBASE_ENV_VALUES],'format':[...RABETBASE_OUTPUT_FORMAT_VALUES]};export function formatConfigKeyList(_0x474c9a){return[..._0x474c9a]['join'](',\x20');}export function getTopLevelConfigKeyList(){return[...TOP_LEVEL_CONFIG_KEYS];}export function isTopLevelConfigKey(_0x128b12){const _0x120d43=a171_0x5113a3;return TOP_LEVEL_CONFIG_KEYS[_0x120d43(0x1b8)](_0x128b12);}export function getTopLevelConfigKeySummary(){return formatConfigKeyList(getTopLevelConfigKeyList());}export function getConfigCommandKeyDescription(){return'Config\x20key\x20('+getTopLevelConfigKeySummary()+')';}export const APP_PROFILE_FLAG_KEY_MAP={'env':'env','apiDir':a171_0x5113a3(0x1b4),'cookie':'cookie','accessKey':a171_0x5113a3(0x1b5),'defaultFormat':a171_0x5113a3(0x1ba),'pageSize':'pageSize','riskLevel':a171_0x5113a3(0x1c7),'locale':'locale'};export function getAppProfileFlagDefs(){const _0x101fa3=a171_0x5113a3;return[{'name':_0x101fa3(0x1b7),'type':'string','description':_0x101fa3(0x1cb),'enum':[...RABETBASE_ENV_VALUES]},{'name':_0x101fa3(0x1b4),'type':'string','description':'API\x20directory\x20path'},{'name':_0x101fa3(0x1ac),'type':'string','description':_0x101fa3(0x1b0),'hidden':!![]},{'name':'accessKey','type':_0x101fa3(0x1a6),'description':_0x101fa3(0x1c2),'hidden':!![]},{'name':_0x101fa3(0x1b1),'type':_0x101fa3(0x1a6),'description':'Default\x20output\x20format\x20for\x20this\x20app\x20(profile)','enum':[...RABETBASE_OUTPUT_FORMAT_VALUES]},{'name':_0x101fa3(0x1cd),'type':_0x101fa3(0x1aa),'description':_0x101fa3(0x1b9)},{'name':'riskLevel','type':_0x101fa3(0x1a6),'description':_0x101fa3(0x1a7),'enum':[...RISK_LEVEL_VALUES]},{'name':_0x101fa3(0x1bb),'type':'string','description':_0x101fa3(0x1bd)}];}export function collectAppProfileOverrides(_0x4ec2b4){const _0x167139=a171_0x5113a3,_0x283cc5={};for(const [_0x3513f3,_0x2a2d16]of Object[_0x167139(0x1c6)](APP_PROFILE_FLAG_KEY_MAP)){const _0x1c0ce8=_0x4ec2b4(_0x3513f3);if(!_0x1c0ce8)continue;_0x283cc5[_0x2a2d16]=_0x2a2d16===_0x167139(0x1cd)?Number(_0x1c0ce8):_0x1c0ce8;}return _0x283cc5;}export function buildAppProfileListFields(_0x519ed2){const _0xa9da0c=a171_0x5113a3;return{'env':_0x519ed2[_0xa9da0c(0x1b7)]??null,'apiDir':_0x519ed2[_0xa9da0c(0x1b4)]??null,'hasCookie':!!_0x519ed2[_0xa9da0c(0x1ac)],'hasAccessKey':!!_0x519ed2[_0xa9da0c(0x1b5)],'format':_0x519ed2[_0xa9da0c(0x1ba)]??null,'pageSize':_0x519ed2[_0xa9da0c(0x1cd)]??null,'riskLevel':_0x519ed2['riskLevel']??null,'locale':_0x519ed2[_0xa9da0c(0x1bb)]??null};}export function buildAppDoctorFields(_0x222b79,_0x2daf4a){const _0x8ebf43=a171_0x5113a3;return{'env':{'value':_0x222b79[_0x8ebf43(0x1b7)]||_0x2daf4a[_0x8ebf43(0x1b7)],'source':_0x222b79['env']?_0x8ebf43(0x1b6):_0x8ebf43(0x1be)},'apiDir':{'value':_0x222b79['apiDir']||_0x2daf4a[_0x8ebf43(0x1b4)],'source':_0x222b79['apiDir']?_0x8ebf43(0x1b6):_0x8ebf43(0x1be)},'cookie':{'value':_0x222b79[_0x8ebf43(0x1ac)]||_0x2daf4a['cookie'],'source':_0x222b79[_0x8ebf43(0x1ac)]?'app':_0x8ebf43(0x1be)},'accessKey':{'value':_0x222b79['accessKey']||_0x2daf4a['accessKey'],'source':_0x222b79['accessKey']?_0x8ebf43(0x1b6):_0x8ebf43(0x1be)}};}function a171_0x17c5(_0x2e3a40,_0x310dfa){_0x2e3a40=_0x2e3a40-0x1a6;const _0x59042a=a171_0x5904();let _0x17c515=_0x59042a[_0x2e3a40];return _0x17c515;}export function buildCanonicalAppConfig(_0x249e71,_0x5aa076){const _0x23483a=a171_0x5113a3,_0x84076a=_0x249e71[_0x23483a(0x1c5)](_0x1824b7=>String(_0x1824b7||'')[_0x23483a(0x1c1)]())[_0x23483a(0x1ca)](Boolean);if(_0x84076a[_0x23483a(0x1c9)]===0x0)return{};const _0x7a90cc={};for(const _0x38e5eb of _0x84076a){_0x7a90cc[_0x38e5eb]=_0x5aa076?{'appcode':_0x38e5eb,'env':_0x5aa076}:{'appcode':_0x38e5eb};}return{'apps':_0x7a90cc,'defaultApp':_0x84076a[0x0]};}export function buildCanonicalProjectConfig(_0x134680,_0x48a972){const _0x465e3f=a171_0x5113a3,{appCodes:appCodes=[],env:_0x2f8ff0,metadata:_0x80f86a}=_0x48a972,_0x2dac79={..._0x134680,..._0x80f86a||{}};delete _0x2dac79[_0x465e3f(0x1ce)],delete _0x2dac79['app'];if(_0x2f8ff0)_0x2dac79['env']=_0x2f8ff0;else!_0x2dac79['env']&&(_0x2dac79[_0x465e3f(0x1b7)]=DEFAULT_CONFIG_VALUES[_0x465e3f(0x1b7)]);const _0x26db6e=buildCanonicalAppConfig(appCodes,_0x2dac79['env']);return Object[_0x465e3f(0x1a9)](_0x26db6e)[_0x465e3f(0x1c9)]>0x0&&(_0x2dac79[_0x465e3f(0x1af)]=_0x26db6e[_0x465e3f(0x1af)],_0x2dac79[_0x465e3f(0x1ab)]=_0x26db6e[_0x465e3f(0x1ab)]),_0x2dac79;}function a171_0x5904(){const _0xc7edb3=['appcode','string','Risk\x20level','4711310vmBmES','keys','number','defaultApp','cookie','437208LSkjaF','6172208wUiXjs','apps','Auth\x20cookie','defaultFormat','6241186CrFSAI','2343045VvHwCk','apiDir','accessKey','app','env','has','Default\x20page\x20size','format','locale','28tnLBVn','Locale','inherit','18oaiIfO','2bbPSTc','trim','Access\x20key','955865KrESkk','zh-CN','map','entries','riskLevel','525424TaZLUB','length','filter','Target\x20environment','en-US','pageSize'];a171_0x5904=function(){return _0xc7edb3;};return a171_0x5904();}const LOCALE_MAP={'zh':a171_0x5113a3(0x1c4),'zh-cn':a171_0x5113a3(0x1c4),'zh_cn':a171_0x5113a3(0x1c4),'en':a171_0x5113a3(0x1cc),'en-us':a171_0x5113a3(0x1cc),'en_us':a171_0x5113a3(0x1cc)};export function normalizeLocale(_0x4235aa){if(!_0x4235aa)return null;return LOCALE_MAP[_0x4235aa['toLowerCase']()]??null;}
|
package/lib/constant/cdn.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a172_0x4fddce=a172_0x57e7;function a172_0x10ba(){const _0x20a180=['6274768SWeYPX','259NUchrg','20nLIbIX','14956vjbEQI','190136GljRkp','3aGzMfy','https://g.lovrabet.com/dist/rabetbase-cli/config/index.json','179262PeSiYS','30aHGGQf','53662SoLKjl','8359GVhvNY','145nPnkSu','4590882AdXkRJ','957KnHbUq','161484ZIJaJI'];a172_0x10ba=function(){return _0x20a180;};return a172_0x10ba();}function a172_0x57e7(_0x5cd72a,_0x1f79d7){_0x5cd72a=_0x5cd72a-0xba;const _0x10baf9=a172_0x10ba();let _0x57e786=_0x10baf9[_0x5cd72a];return _0x57e786;}(function(_0x4ebcf4,_0x1d5e61){const _0x343dee=a172_0x57e7,_0x3dedc6=_0x4ebcf4();while(!![]){try{const _0x169b90=-parseInt(_0x343dee(0xc0))/0x1*(parseInt(_0x343dee(0xc5))/0x2)+-parseInt(_0x343dee(0xc2))/0x3*(parseInt(_0x343dee(0xbd))/0x4)+-parseInt(_0x343dee(0xc8))/0x5*(-parseInt(_0x343dee(0xc4))/0x6)+parseInt(_0x343dee(0xbe))/0x7*(-parseInt(_0x343dee(0xc1))/0x8)+-parseInt(_0x343dee(0xba))/0x9*(parseInt(_0x343dee(0xbf))/0xa)+-parseInt(_0x343dee(0xbb))/0xb*(-parseInt(_0x343dee(0xbc))/0xc)+-parseInt(_0x343dee(0xc7))/0xd*(-parseInt(_0x343dee(0xc6))/0xe);if(_0x169b90===_0x1d5e61)break;else _0x3dedc6['push'](_0x3dedc6['shift']());}catch(_0x1f797b){_0x3dedc6['push'](_0x3dedc6['shift']());}}}(a172_0x10ba,0xc58f4));export const CLI_VERSION_POLICY_URL=a172_0x4fddce(0xc3);
|