@lovrabet/rabetbase-cli 2.3.4 → 2.3.5
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/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/analyze-cancel.js +1 -1
- package/lib/commands/db/analyze-start.js +1 -1
- package/lib/commands/db/analyze-status.js +1 -1
- package/lib/commands/db/create.js +1 -1
- package/lib/commands/db/delete.js +1 -1
- package/lib/commands/db/detail.js +1 -1
- package/lib/commands/db/diff.js +1 -1
- package/lib/commands/db/index.js +1 -1
- package/lib/commands/db/list.js +1 -1
- package/lib/commands/db/shared.js +1 -1
- package/lib/commands/db/tables.js +1 -1
- package/lib/commands/db/test.js +1 -1
- package/lib/commands/db/update.js +1 -1
- package/lib/commands/doctor.js +1 -1
- package/lib/commands/init/index.js +1 -1
- package/lib/commands/issue/index.js +1 -1
- package/lib/commands/issue/nudge.js +1 -1
- package/lib/commands/issue/report.js +1 -1
- package/lib/commands/issue/shared.js +1 -1
- package/lib/commands/logs/index.js +1 -1
- package/lib/commands/menu/index.js +1 -1
- package/lib/commands/menu/list.js +1 -1
- package/lib/commands/menu/shared/compare-table.js +1 -1
- package/lib/commands/menu/shared/index.js +1 -1
- package/lib/commands/menu/shared/inquirer.js +1 -1
- package/lib/commands/menu/shared/local-pages.js +1 -1
- package/lib/commands/menu/shared/logic.js +1 -1
- package/lib/commands/menu/shared/service.js +1 -1
- package/lib/commands/menu/shared/sync-core.js +1 -1
- package/lib/commands/menu/shared/update-core.js +1 -1
- package/lib/commands/menu/shared/valid-url.js +1 -1
- package/lib/commands/menu/sync.js +1 -1
- package/lib/commands/menu/update.js +1 -1
- package/lib/commands/page/generate-start.js +1 -1
- package/lib/commands/page/generate-status.js +1 -1
- package/lib/commands/page/index.js +1 -1
- package/lib/commands/page/pull.js +1 -1
- package/lib/commands/page/push.js +1 -1
- package/lib/commands/page/relation-audit.js +1 -1
- package/lib/commands/page/shared.js +1 -1
- package/lib/commands/page/standard-page-status.js +1 -1
- package/lib/commands/page/sync.js +1 -1
- package/lib/commands/permit/index.js +1 -1
- package/lib/commands/permit/page-get.js +1 -1
- package/lib/commands/permit/page-set.js +1 -1
- package/lib/commands/permit/role-apis-set.js +1 -1
- package/lib/commands/permit/role-menus-set.js +1 -1
- package/lib/commands/permit/role-menus.js +1 -1
- package/lib/commands/permit/shared.js +1 -1
- package/lib/commands/project/create/enhanced-guided-create.js +1 -1
- package/lib/commands/project/create/format-elapsed.js +1 -1
- package/lib/commands/project/create/main.js +1 -1
- package/lib/commands/project/create/non-interactive.js +1 -1
- package/lib/commands/project/create/project-template-path.js +1 -1
- package/lib/commands/project/create/use-copy-project-template.js +1 -1
- package/lib/commands/project/create/use-format-code.js +1 -1
- package/lib/commands/project/create/use-install-dependencies.js +1 -1
- package/lib/commands/project/index.js +1 -1
- package/lib/commands/project/init.js +1 -1
- package/lib/commands/project/upgrade.js +1 -1
- package/lib/commands/registry.js +1 -1
- package/lib/commands/role/create.js +1 -1
- package/lib/commands/role/delete.js +1 -1
- package/lib/commands/role/detail.js +1 -1
- package/lib/commands/role/index.js +1 -1
- package/lib/commands/role/list.js +1 -1
- package/lib/commands/role/shared.js +1 -1
- package/lib/commands/role/update.js +1 -1
- package/lib/commands/role/user-add.js +1 -1
- package/lib/commands/role/user-remove.js +1 -1
- package/lib/commands/role/user-resolve.js +1 -1
- package/lib/commands/run/index.js +1 -1
- package/lib/commands/schema.js +1 -1
- package/lib/commands/sql/create.js +1 -1
- package/lib/commands/sql/delete.js +1 -1
- package/lib/commands/sql/detail.js +1 -1
- package/lib/commands/sql/exec.js +1 -1
- package/lib/commands/sql/index.js +1 -1
- package/lib/commands/sql/list.js +1 -1
- package/lib/commands/sql/pull.js +1 -1
- package/lib/commands/sql/push.js +1 -1
- package/lib/commands/sql/save.js +1 -1
- package/lib/commands/sql/shared.js +1 -1
- package/lib/commands/sql/status.js +1 -1
- package/lib/commands/sql/validate.js +1 -1
- package/lib/commands/workspace/add.js +1 -1
- package/lib/commands/workspace/index.js +1 -1
- package/lib/commands/workspace/remove.js +1 -1
- package/lib/config/schema.js +1 -1
- package/lib/constant/cdn.js +1 -1
- package/lib/constant/cli.js +1 -1
- package/lib/constant/defaults.js +1 -1
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/constant/output.js +1 -1
- package/lib/constant/paths.js +1 -1
- package/lib/constant/risk.js +1 -1
- package/lib/context/app-resolver.js +1 -1
- package/lib/context/auth-resolver.js +1 -1
- package/lib/context/config-loader.js +1 -1
- package/lib/context.js +1 -1
- package/lib/core/alias-resolver.js +1 -1
- package/lib/core/api-client.js +1 -1
- package/lib/core/bff/config.js +1 -1
- package/lib/core/bff/file-system.js +1 -1
- package/lib/core/bff/hash.js +1 -1
- package/lib/core/bff/lock.js +1 -1
- package/lib/core/bff/utils.js +1 -1
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/page/file-system.js +1 -1
- package/lib/core/page/hash.js +1 -1
- package/lib/core/page/lock.js +1 -1
- package/lib/core/sql-sync/config.js +1 -1
- package/lib/core/sql-sync/file-system.js +1 -1
- package/lib/core/sql-sync/hash.js +1 -1
- package/lib/core/sql-sync/lock.js +1 -1
- package/lib/core/sql-sync/utils.js +1 -1
- package/lib/core/sql-validator.js +1 -1
- package/lib/errors.js +1 -1
- package/lib/framework/build-all-flags.js +1 -1
- package/lib/framework/flags.js +1 -1
- package/lib/framework/help.js +1 -1
- package/lib/framework/index.js +1 -1
- package/lib/framework/output.js +1 -1
- package/lib/framework/response.js +1 -1
- package/lib/framework/runner-alias.js +1 -1
- package/lib/framework/runner.js +1 -1
- package/lib/framework/schema-export.js +1 -1
- package/lib/framework/types.js +1 -1
- package/lib/generated/build-info.js +1 -1
- package/lib/help.js +1 -1
- package/lib/skills/main.js +1 -1
- package/lib/skills/npx-skills-add.js +1 -1
- package/lib/telemetry/cli-command-trace.js +1 -1
- package/lib/telemetry/cli-help-trace.js +1 -1
- package/lib/telemetry/ensure-cli-otel-config.js +1 -1
- package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
- package/lib/telemetry/send-cli-trace-log.js +1 -1
- package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
- package/lib/utils/ai_config.js +1 -1
- package/lib/utils/apply-jq-filter.js +1 -1
- package/lib/utils/cdn-config.js +1 -1
- package/lib/utils/check-sdk-version.js +1 -1
- package/lib/utils/cli-version-check.js +1 -1
- package/lib/utils/cli-version-policy.js +1 -1
- package/lib/utils/config.js +1 -1
- package/lib/utils/copy-directory.js +1 -1
- package/lib/utils/entity-with-id.js +1 -1
- package/lib/utils/file-utils.js +1 -1
- package/lib/utils/guides-cdn.js +1 -1
- package/lib/utils/http-client.js +1 -1
- package/lib/utils/is-non-interactive.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/params.js +1 -1
- package/lib/utils/platform.js +1 -1
- package/lib/utils/rules-cdn.js +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.js +1 -1
- package/lib/utils/update-notice.js +1 -1
- package/lib/utils/version.js +1 -1
- package/lib/utils/with-active-cookie.js +1 -1
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a152_0x3f55(_0x4c8759,_0x371165){_0x4c8759=_0x4c8759-0x1dd;const _0x1abf52=a152_0x1abf();let _0x3f557a=_0x1abf52[_0x4c8759];return _0x3f557a;}const a152_0x4d38d3=a152_0x3f55;(function(_0x3b3e2d,_0x54f6e9){const _0x2fd395=a152_0x3f55,_0x4c1dfa=_0x3b3e2d();while(!![]){try{const _0x2429a3=-parseInt(_0x2fd395(0x1dd))/0x1*(parseInt(_0x2fd395(0x1e5))/0x2)+parseInt(_0x2fd395(0x1ef))/0x3+-parseInt(_0x2fd395(0x1e1))/0x4+parseInt(_0x2fd395(0x1e4))/0x5+parseInt(_0x2fd395(0x1e0))/0x6+parseInt(_0x2fd395(0x1e7))/0x7+parseInt(_0x2fd395(0x1eb))/0x8;if(_0x2429a3===_0x54f6e9)break;else _0x4c1dfa['push'](_0x4c1dfa['shift']());}catch(_0x400510){_0x4c1dfa['push'](_0x4c1dfa['shift']());}}}(a152_0x1abf,0x559f8));function a152_0x1abf(){const _0x11a3ef=['dbId','958125ikxNjG','Return\x20full\x20raw\x20SQL\x20query\x20object','36573PVktKW','detail','sql','1608156jVbpOv','2762480GkpSUg','sqlCode','verbose','3325985ZgHNWK','34LidfgV','sqlContent','551208ixdyqE','read','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','appCode','2653848RJLjJM','sqlcode','sqlName'];a152_0x1abf=function(){return _0x11a3ef;};return a152_0x1abf();}import{getSqlQueryInfo}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':a152_0x4d38d3(0x1df),'command':a152_0x4d38d3(0x1de),'description':a152_0x4d38d3(0x1e9),'risk':a152_0x4d38d3(0x1e8),'flags':[SQLCODE_FLAG,{'name':'verbose','type':'boolean','description':a152_0x4d38d3(0x1f0)}],async 'execute'(_0x3bd715){const _0x38997e=a152_0x4d38d3,_0x3e7c40=await getSqlQueryInfo(_0x3bd715[_0x38997e(0x1ea)],_0x3bd715['str'](_0x38997e(0x1ec))),_0x5bd049=_0x3bd715['bool'](_0x38997e(0x1e3));if(_0x5bd049)return{'ok':!![],'data':_0x3e7c40};const _0x13aa23=_0x3e7c40[_0x38997e(0x1ee)]?await getDbName(_0x3bd715[_0x38997e(0x1ea)],_0x3e7c40[_0x38997e(0x1ee)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x3e7c40[_0x38997e(0x1e2)],'sqlName':_0x3e7c40[_0x38997e(0x1ed)],'db':_0x13aa23?_0x13aa23+'\x20('+_0x3e7c40['dbId']+')':_0x3e7c40[_0x38997e(0x1ee)]??'','description':_0x3e7c40['description']??'','sqlContent':_0x3e7c40[_0x38997e(0x1e6)]??''}};}};
|
package/lib/commands/sql/exec.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a153_0x13e9f6=a153_0x4ca3;function a153_0x4ca3(_0x321ac3,_0x11a5f3){_0x321ac3=_0x321ac3-0x95;const _0x37b5db=a153_0x37b5();let _0x4ca312=_0x37b5db[_0x321ac3];return _0x4ca312;}(function(_0x5d0c4d,_0x13c584){const _0x5dd577=a153_0x4ca3,_0x4147ae=_0x5d0c4d();while(!![]){try{const _0x3216c1=-parseInt(_0x5dd577(0xa4))/0x1*(-parseInt(_0x5dd577(0x9d))/0x2)+-parseInt(_0x5dd577(0xa2))/0x3+parseInt(_0x5dd577(0xa1))/0x4*(parseInt(_0x5dd577(0xac))/0x5)+parseInt(_0x5dd577(0xab))/0x6+parseInt(_0x5dd577(0x97))/0x7*(parseInt(_0x5dd577(0xa9))/0x8)+-parseInt(_0x5dd577(0xad))/0x9*(parseInt(_0x5dd577(0x9f))/0xa)+-parseInt(_0x5dd577(0xa6))/0xb*(parseInt(_0x5dd577(0x95))/0xc);if(_0x3216c1===_0x13c584)break;else _0x4147ae['push'](_0x4147ae['shift']());}catch(_0x5fefa5){_0x4147ae['push'](_0x4147ae['shift']());}}}(a153_0x37b5,0x32622));import{executeSql}from'../../core/api-client.js';function a153_0x37b5(){const _0xa3d296=['Returned\x20','6UVIPwg','sqlcode','792580ccKzQH','execResult','182916kbiIKb','567393rrCyPv','length','74265fjsElV','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','4279nAeNwJ','SQL\x20execution\x20failed','execError','2523704RPNvhw','appCode','1569906yhmczU','35kqbqaN','18vxaaIM','execSuccess','\x20row(s)\x20in\x20','now','17460oXQdUy','read','7AozcMW','str','string','params','isArray'];a153_0x37b5=function(){return _0xa3d296;};return a153_0x37b5();}import{SQLCODE_FLAG}from'../../commands/common/flags.js';import{parseJsonParams}from'../../utils/params.js';export const sqlExec={'service':'sql','command':'exec','description':'Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','risk':a153_0x13e9f6(0x96),'flags':[SQLCODE_FLAG,{'name':a153_0x13e9f6(0x9a),'type':a153_0x13e9f6(0x99),'description':a153_0x13e9f6(0xa5)}],async 'execute'(_0x56046f){const _0x3d8537=a153_0x13e9f6,_0x102885=parseJsonParams(_0x56046f[_0x3d8537(0x98)]('params')),_0x42e587=Date[_0x3d8537(0xb0)](),_0x3dfc9a=await executeSql(_0x56046f[_0x3d8537(0xaa)],_0x56046f[_0x3d8537(0x98)](_0x3d8537(0x9e)),_0x102885),_0x1ad85f=Date['now']()-_0x42e587,_0x4ab687=_0x3dfc9a?.[_0x3d8537(0xa0)]??_0x3dfc9a,_0x15e69a=_0x3dfc9a?.[_0x3d8537(0xae)]??!![];if(!_0x15e69a)return{'ok':![],'data':{'error':_0x3dfc9a?.[_0x3d8537(0xa8)]||'SQL\x20execution\x20failed','elapsed':_0x1ad85f},'message':_0x3d8537(0xa7)};const _0x2d5232=Array[_0x3d8537(0x9b)](_0x4ab687)?_0x4ab687:[];return{'ok':!![],'data':{'rows':_0x2d5232,'rowCount':_0x2d5232[_0x3d8537(0xa3)],'elapsed':_0x1ad85f},'message':_0x3d8537(0x9c)+_0x2d5232[_0x3d8537(0xa3)]+_0x3d8537(0xaf)+_0x1ad85f+'ms'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0xace369,_0x3a22b2){const _0x1752c0=a154_0x578d,_0x2bf586=_0xace369();while(!![]){try{const _0xe9d3c3=-parseInt(_0x1752c0(0x17c))/0x1+-parseInt(_0x1752c0(0x180))/0x2*(-parseInt(_0x1752c0(0x184))/0x3)+parseInt(_0x1752c0(0x185))/0x4*(parseInt(_0x1752c0(0x17e))/0x5)+-parseInt(_0x1752c0(0x183))/0x6+-parseInt(_0x1752c0(0x17d))/0x7*(-parseInt(_0x1752c0(0x181))/0x8)+parseInt(_0x1752c0(0x17f))/0x9+-parseInt(_0x1752c0(0x182))/0xa;if(_0xe9d3c3===_0x3a22b2)break;else _0x2bf586['push'](_0x2bf586['shift']());}catch(_0x50c61d){_0x2bf586['push'](_0x2bf586['shift']());}}}(a154_0x3fa6,0xbd149));import{sqlList}from'../../commands/sql/list.js';function a154_0x578d(_0x3a78b6,_0x27f443){_0x3a78b6=_0x3a78b6-0x17c;const _0x3fa648=a154_0x3fa6();let _0x578dd5=_0x3fa648[_0x3a78b6];return _0x578dd5;}import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';import{sqlSave}from'../../commands/sql/save.js';function a154_0x3fa6(){const _0x2aeaef=['58SkMFJN','16TaqXAL','20086340uEfZlH','5410110AuAkrO','117309EaZyWL','35200okHyfC','1017691VLZpUi','3335990shonWQ','670AoxGrO','12925404nSDSsE'];a154_0x3fa6=function(){return _0x2aeaef;};return a154_0x3fa6();}import{sqlExec}from'../../commands/sql/exec.js';import{sqlPull}from'../../commands/sql/pull.js';import{sqlCreate}from'../../commands/sql/create.js';import{sqlStatus}from'../../commands/sql/status.js';import{sqlPush}from'../../commands/sql/push.js';import{sqlDelete}from'../../commands/sql/delete.js';export const sqlDefinitions=[sqlList,sqlDetail,sqlStatus,sqlCreate,sqlPush,sqlValidate,sqlSave,sqlExec,sqlPull,sqlDelete];
|
package/lib/commands/sql/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a155_0x260bbe=a155_0x404e;(function(_0x33e35,_0x45f043){const _0x207610=a155_0x404e,_0x1d8090=_0x33e35();while(!![]){try{const _0x38ba9c=parseInt(_0x207610(0x19e))/0x1*(-parseInt(_0x207610(0x1a7))/0x2)+-parseInt(_0x207610(0x1ae))/0x3+parseInt(_0x207610(0x19d))/0x4+parseInt(_0x207610(0x197))/0x5*(parseInt(_0x207610(0x195))/0x6)+parseInt(_0x207610(0x19a))/0x7*(-parseInt(_0x207610(0x1b3))/0x8)+parseInt(_0x207610(0x1a8))/0x9+parseInt(_0x207610(0x198))/0xa*(parseInt(_0x207610(0x1ac))/0xb);if(_0x38ba9c===_0x45f043)break;else _0x1d8090['push'](_0x1d8090['shift']());}catch(_0x498093){_0x1d8090['push'](_0x1d8090['shift']());}}}(a155_0x1c68,0xdd99b));import{listSqlQueries}from'../../core/api-client.js';function a155_0x404e(_0xd43c8a,_0x487fb5){_0xd43c8a=_0xd43c8a-0x194;const _0x1c68e8=a155_0x1c68();let _0x404eaf=_0x1c68e8[_0xd43c8a];return _0x404eaf;}import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':'sql','command':'list','description':a155_0x260bbe(0x1a2),'risk':'read','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a155_0x260bbe(0x1a4),'type':'string','description':'Filter\x20by\x20SQL\x20name'},{'name':a155_0x260bbe(0x1a9),'type':a155_0x260bbe(0x19c),'description':a155_0x260bbe(0x1ad),'default':0x1},{'name':'pagesize','type':'number','description':'Page\x20size'},{'name':'verbose','type':a155_0x260bbe(0x1a1),'description':'Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content'}],async 'execute'(_0x3d7d7d){const _0xa6c37b=a155_0x260bbe,_0x143073=await listSqlQueries(_0x3d7d7d[_0xa6c37b(0x1a3)],{'sqlCode':_0x3d7d7d[_0xa6c37b(0x1af)](_0xa6c37b(0x19f))||undefined,'sqlName':_0x3d7d7d[_0xa6c37b(0x1af)](_0xa6c37b(0x1a4))||undefined,'currentPage':_0x3d7d7d[_0xa6c37b(0x1a0)](_0xa6c37b(0x1a9)),'pageSize':_0x3d7d7d[_0xa6c37b(0x1a0)](_0xa6c37b(0x194),0x32)}),_0x4187b7=_0x3d7d7d[_0xa6c37b(0x1b2)]('verbose'),_0x5a2d20=_0x143073['tableData']??[],_0x45cc6f=_0x143073[_0xa6c37b(0x1b5)]?.[_0xa6c37b(0x1aa)]??_0x5a2d20['length'];let _0x5b93d5;return _0x4187b7?_0x5b93d5=_0x5a2d20:_0x5b93d5=await Promise[_0xa6c37b(0x19b)](_0x5a2d20[_0xa6c37b(0x1ab)](async _0x430fb6=>{const _0xad1802=_0xa6c37b;let _0x524a33;try{_0x524a33=_0x430fb6[_0xad1802(0x196)]?await getDbName(_0x3d7d7d[_0xad1802(0x1a3)],_0x430fb6[_0xad1802(0x196)]):undefined;}catch{}return{'sqlCode':_0x430fb6[_0xad1802(0x199)],'sqlName':_0x430fb6[_0xad1802(0x1b1)],'description':_0x430fb6[_0xad1802(0x1a6)]??'','db':_0x524a33?_0x524a33+'\x20('+_0x430fb6[_0xad1802(0x196)]+')':_0x430fb6['dbId']??''};})),{'ok':!![],'data':_0x5b93d5,'message':_0x5a2d20[_0xa6c37b(0x1b4)]===0x0?_0xa6c37b(0x1b0):_0xa6c37b(0x1a5)+_0x5a2d20[_0xa6c37b(0x1b4)]+_0xa6c37b(0x1b6)+_0x45cc6f+').'};}};function a155_0x1c68(){const _0x11d208=['bool','2816epccXs','length','paging','\x20SQL\x20queries\x20(total:\x20','pagesize','32118ZAsTyr','dbId','455Yolntu','3175390lrCTaD','sqlCode','14931cgPaqt','all','number','4854936Pddbte','31499ORANuB','sqlcode','num','boolean','List\x20custom\x20SQL\x20queries','appCode','name','Found\x20','description','36HQYQgK','7352775QIeMSm','page','totalCount','map','11skCuAf','Page\x20number','1829694wJgAQE','str','No\x20custom\x20SQL\x20queries\x20found.','sqlName'];a155_0x1c68=function(){return _0x11d208;};return a155_0x1c68();}
|
package/lib/commands/sql/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a156_0x22638b=a156_0x23d2;(function(_0x2c6b69,_0x20727c){const _0x49c3fb=a156_0x23d2,_0x215a97=_0x2c6b69();while(!![]){try{const _0x208709=-parseInt(_0x49c3fb(0x144))/0x1*(-parseInt(_0x49c3fb(0x12c))/0x2)+parseInt(_0x49c3fb(0x124))/0x3*(parseInt(_0x49c3fb(0x153))/0x4)+-parseInt(_0x49c3fb(0x12a))/0x5+parseInt(_0x49c3fb(0x154))/0x6*(-parseInt(_0x49c3fb(0x137))/0x7)+parseInt(_0x49c3fb(0x134))/0x8*(-parseInt(_0x49c3fb(0x132))/0x9)+parseInt(_0x49c3fb(0x13d))/0xa*(parseInt(_0x49c3fb(0x13c))/0xb)+-parseInt(_0x49c3fb(0x138))/0xc*(-parseInt(_0x49c3fb(0x128))/0xd);if(_0x208709===_0x20727c)break;else _0x215a97['push'](_0x215a97['shift']());}catch(_0x1d0c16){_0x215a97['push'](_0x215a97['shift']());}}}(a156_0x1b54,0x6c9e2));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';function a156_0x1b54(){const _0xb0480c=['30643YcuTxX','boolean','message','trimStart','pull','skipped','cancelled','join','bool','sql','appCode','utf8','No\x20remote\x20SQL\x20queries\x20matched.','catch','mybatisXml','92bdRpCp','78kCkiqe','paging','Force\x20overwrite\x20local\x20unsynced\x20changes','sqlCode','local\x20differs\x20from\x20remote','totalCount','POST','string','push','replace','sqlContent','name','toISOString','unchanged','description','length','\x20skipped,\x20','str','71751OPmmJj','path','nonInteractive','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','91TXGkTN','\x20written,\x20','3982745kFeozd','would_pull','30mLOBVq','sqlRoot','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','\x20failed','Would\x20pull\x20','force','1105002aiQiQL','sqlRootDir','8AohNKC','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','sqlName','457338PtXWrC','1928676MtWoHt','lockFilePath','filter','conflict','173294twxVqL','50vwbsMB','apps','sqls','test','dbId','sqlcode','lastSync'];a156_0x1b54=function(){return _0xb0480c;};return a156_0x1b54();}function a156_0x23d2(_0x2b11fc,_0x14f889){_0x2b11fc=_0x2b11fc-0x11a;const _0x1b54f7=a156_0x1b54();let _0x23d25c=_0x1b54f7[_0x2b11fc];return _0x23d25c;}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(_0x5b0585,_0x46c845){const _0x5c95d1=a156_0x23d2,_0x394647=[];let _0x329990=0x1;while(!![]){const _0x3dc9e5=await listSqlQueries(_0x5b0585,{'currentPage':_0x329990,'pageSize':PAGE_SIZE,'sqlCode':_0x46c845['sqlCode'],'sqlName':_0x46c845[_0x5c95d1(0x136)]}),_0x3662a6=_0x3dc9e5['tableData']??[];_0x394647['push'](..._0x3662a6);if(_0x3662a6[_0x5c95d1(0x121)]===0x0)break;const _0x2360c8=_0x3dc9e5[_0x5c95d1(0x155)]?.[_0x5c95d1(0x159)];if(_0x2360c8!=null?_0x394647['length']>=_0x2360c8:_0x3662a6[_0x5c95d1(0x121)]<PAGE_SIZE)break;_0x329990++;}return _0x394647;}async function ensureSqlContent(_0x501626){const _0x4259e5=a156_0x23d2;if(_0x501626[_0x4259e5(0x11c)]!=null&&String(_0x501626[_0x4259e5(0x11c)])[_0x4259e5(0x121)]>0x0)return _0x501626;return getSqlQueryDetail(_0x501626['sqlCode']);}export const sqlPull={'service':a156_0x22638b(0x14d),'command':a156_0x22638b(0x148),'description':a156_0x22638b(0x135),'risk':'write','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a156_0x22638b(0x11d),'type':a156_0x22638b(0x15b),'description':'Filter\x20by\x20SQL\x20display\x20name'},{'name':a156_0x22638b(0x131),'type':a156_0x22638b(0x145),'description':a156_0x22638b(0x156)}],async 'dryRun'(_0x30fd5d){const _0xa96160=a156_0x22638b,_0x31eef7=loadSqlProjectConfig(_0x30fd5d[_0xa96160(0x14e)]),_0x323135=await readSqlLockFile(_0x31eef7[_0xa96160(0x139)]),{appLock:_0x286c6d}=ensureSqlLockScope(_0x323135??createEmptySqlLock(),_0x31eef7[_0xa96160(0x14e)],_0x31eef7[_0xa96160(0x12d)],_0xa96160(0x148)),_0x4d32fb=await fetchAllSqlQueries(_0x30fd5d['appCode'],{'sqlCode':_0x30fd5d[_0xa96160(0x123)](_0xa96160(0x142))||undefined,'sqlName':_0x30fd5d['str'](_0xa96160(0x11d))||undefined}),_0x47b136=[];for(const _0x292ccf of _0x4d32fb){const _0x4c84b3=await ensureSqlContent(_0x292ccf),_0x8c6e94=ensureRemoteSqlContent(_0x4c84b3),_0x56d873=detectModeFromSql(_0x4c84b3),_0x42fa9c=_0x4c84b3[_0xa96160(0x141)]?await getDbName(_0x30fd5d['appCode'],Number(_0x4c84b3[_0xa96160(0x141)]))[_0xa96160(0x151)](()=>undefined):undefined,_0x5b8e87=buildLocalSqlFileContent({'sqlCode':_0x4c84b3['sqlCode'],'sqlName':_0x4c84b3['sqlName'],'dbId':_0x4c84b3[_0xa96160(0x141)]},_0x8c6e94,{'dbName':_0x42fa9c,'mode':_0x56d873,'syncedAt':new Date()[_0xa96160(0x11e)](),'description':_0x4c84b3['description']}),_0x4e500c=buildSqlLockEntry(_0x4c84b3,_0x8c6e94,'',{'dbName':_0x42fa9c}),_0x3c7022=resolveLocalSqlFilePath(_0x31eef7,_0x4c84b3['sqlCode'],_0x4e500c);let _0x1a74bb=_0xa96160(0x12b),_0x570f52;if(await fileExists(_0x3c7022)){const _0x46308f=await readFile(_0x3c7022,_0xa96160(0x14f));isEquivalentPulledSqlFile(_0x46308f,_0x5b8e87,_0x56d873)?(_0x1a74bb=_0xa96160(0x149),_0x570f52='unchanged'):(_0x1a74bb=_0xa96160(0x13b),_0x570f52=_0xa96160(0x12e));}_0x47b136[_0xa96160(0x11a)]({'sqlCode':_0x4c84b3[_0xa96160(0x157)],'sqlName':_0x4c84b3[_0xa96160(0x136)],'filePath':_0x3c7022,'status':_0x1a74bb,'reason':_0x570f52});}return{'method':_0xa96160(0x15a),'url':_0xa96160(0x127),'body':{'appCode':_0x30fd5d[_0xa96160(0x14e)],'sqlCode':_0x30fd5d[_0xa96160(0x123)](_0xa96160(0x142))||null,'sqlName':_0x30fd5d['str']('name')||null,'files':_0x47b136},'description':_0xa96160(0x130)+_0x47b136['length']+'\x20SQL\x20file(s)\x20into\x20'+_0x31eef7[_0xa96160(0x133)]};},async 'execute'(_0x237c60){const _0x247a9a=a156_0x22638b,_0x5dcfdd=loadSqlProjectConfig(_0x237c60[_0x247a9a(0x14e)]),_0x58f65b=await readSqlLockFile(_0x5dcfdd[_0x247a9a(0x139)]),{lockData:_0x4bcd06,appLock:_0x33e479}=ensureSqlLockScope(_0x58f65b??createEmptySqlLock(),_0x5dcfdd['appCode'],_0x5dcfdd['sqlRoot'],_0x247a9a(0x148)),_0x44a4a5=_0x237c60[_0x247a9a(0x14c)](_0x247a9a(0x131)),_0x384cae=await fetchAllSqlQueries(_0x237c60[_0x247a9a(0x14e)],{'sqlCode':_0x237c60[_0x247a9a(0x123)]('sqlcode')||undefined,'sqlName':_0x237c60[_0x247a9a(0x123)](_0x247a9a(0x11d))||undefined});if(_0x384cae[_0x247a9a(0x121)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x247a9a(0x150)};const _0x4a8560=[],_0x4feac5=[];for(const _0x5591c1 of _0x384cae){try{_0x4a8560[_0x247a9a(0x11a)](await ensureSqlContent(_0x5591c1));}catch(_0x633e3f){_0x4feac5[_0x247a9a(0x11a)]({'sqlCode':_0x5591c1[_0x247a9a(0x157)],'error':_0x633e3f instanceof Error?_0x633e3f[_0x247a9a(0x146)]:String(_0x633e3f)});}}if(_0x44a4a5&&!_0x237c60[_0x247a9a(0x126)]){let _0x5c4a0a=![];for(const _0x417771 of _0x4a8560){const _0x845858=detectModeFromSql(_0x417771),_0xdc3495=_0x417771['dbId']?await getDbName(_0x237c60[_0x247a9a(0x14e)],Number(_0x417771['dbId']))[_0x247a9a(0x151)](()=>undefined):undefined,_0x1775df=buildLocalSqlFileContent({'sqlCode':_0x417771[_0x247a9a(0x157)],'sqlName':_0x417771[_0x247a9a(0x136)],'dbId':_0x417771[_0x247a9a(0x141)]},ensureRemoteSqlContent(_0x417771),{'dbName':_0xdc3495,'mode':_0x845858,'syncedAt':new Date()[_0x247a9a(0x11e)](),'description':_0x417771[_0x247a9a(0x120)]}),_0x361b53=resolveLocalSqlFilePath(_0x5dcfdd,_0x417771[_0x247a9a(0x157)],buildSqlLockEntry(_0x417771,ensureRemoteSqlContent(_0x417771),'',{'dbName':_0xdc3495}));if(await fileExists(_0x361b53)){const _0x485029=await readFile(_0x361b53,_0x247a9a(0x14f));if(!isEquivalentPulledSqlFile(_0x485029,_0x1775df,_0x845858)){_0x5c4a0a=!![];break;}}}if(_0x5c4a0a){const _0x3c5374=await confirmForceOverwrite('Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.');if(!_0x3c5374)throw CliErrors[_0x247a9a(0x14a)]('Force\x20pull\x20cancelled.');}}const _0x19a134=cloneSqlLockData(_0x4bcd06),_0x75d743=_0x19a134[_0x247a9a(0x13e)][_0x5dcfdd[_0x247a9a(0x14e)]],_0x303ac2=[],_0x2b5e4f=[];for(const _0x4472f1 of _0x4a8560){const _0x171e39=_0x75d743['sqls'][_0x4472f1['sqlCode']],_0x2a491a=ensureRemoteSqlContent(_0x4472f1),_0x317a1f=detectModeFromSql(_0x4472f1),_0x1b891e=_0x4472f1[_0x247a9a(0x141)]?await getDbName(_0x237c60[_0x247a9a(0x14e)],Number(_0x4472f1['dbId']))[_0x247a9a(0x151)](()=>undefined):undefined,_0x3f736c=buildLocalSqlFileContent({'sqlCode':_0x4472f1[_0x247a9a(0x157)],'sqlName':_0x4472f1[_0x247a9a(0x136)],'dbId':_0x4472f1[_0x247a9a(0x141)]},_0x2a491a,{'dbName':_0x1b891e,'mode':_0x317a1f,'syncedAt':new Date()[_0x247a9a(0x11e)](),'description':_0x4472f1[_0x247a9a(0x120)]}),_0x330689=buildSqlLockEntry(_0x4472f1,_0x2a491a,computeSqlContentHash(_0x3f736c),{'dbName':_0x1b891e}),_0x3413ad=_0x330689['path'],_0x2f23b9=join(_0x5dcfdd[_0x247a9a(0x133)],_0x3413ad);try{if(await fileExists(_0x2f23b9)){const _0x310424=await readFile(_0x2f23b9,_0x247a9a(0x14f));if(isEquivalentPulledSqlFile(_0x310424,_0x3f736c,_0x317a1f)){_0x2b5e4f[_0x247a9a(0x11a)]({'sqlCode':_0x4472f1[_0x247a9a(0x157)],'reason':_0x247a9a(0x11f)}),_0x75d743['sqls'][_0x4472f1[_0x247a9a(0x157)]]={..._0x330689,'hash':computeSqlContentHash(_0x310424),'path':_0x3413ad};continue;}if(!_0x44a4a5){_0x2b5e4f[_0x247a9a(0x11a)]({'sqlCode':_0x4472f1[_0x247a9a(0x157)],'reason':_0x247a9a(0x158)});continue;}}const _0x381a31=_0x171e39?.[_0x247a9a(0x125)]?join(_0x5dcfdd['sqlRootDir'],_0x171e39[_0x247a9a(0x125)]):undefined;_0x381a31&&_0x381a31!==_0x2f23b9&&await fileExists(_0x381a31)&&await rm(_0x381a31,{'force':!![]}),await ensureParentDirectory(_0x2f23b9),await writeFile(_0x2f23b9,_0x3f736c,_0x247a9a(0x14f)),_0x75d743[_0x247a9a(0x13f)][_0x4472f1['sqlCode']]={..._0x330689,'path':_0x3413ad},_0x303ac2['push']({'sqlCode':_0x4472f1[_0x247a9a(0x157)],'filePath':_0x2f23b9});}catch(_0x552c38){_0x4feac5[_0x247a9a(0x11a)]({'sqlCode':_0x4472f1[_0x247a9a(0x157)],'error':_0x552c38 instanceof Error?_0x552c38['message']:String(_0x552c38)});}}return _0x75d743[_0x247a9a(0x143)]=new Date()[_0x247a9a(0x11e)](),await writeSqlLockFile(_0x5dcfdd[_0x247a9a(0x139)],_0x19a134),{'ok':_0x4feac5['length']===0x0,'data':{'pulled':_0x303ac2,'skipped':_0x2b5e4f,'failed':_0x4feac5},'message':'Pull\x20complete:\x20'+_0x303ac2[_0x247a9a(0x121)]+_0x247a9a(0x129)+_0x2b5e4f[_0x247a9a(0x121)]+_0x247a9a(0x122)+_0x4feac5[_0x247a9a(0x121)]+_0x247a9a(0x12f)};}};function detectModeFromSql(_0x414884){const _0x59a891=a156_0x22638b,_0x59540b=ensureRemoteSqlContent(_0x414884),_0x2e347e=stripLocalSqlMetadata(_0x59540b,_0x59a891(0x152))[_0x59a891(0x147)]();if(/^<(select|insert|update|delete)\b/i['test'](_0x2e347e))return _0x59a891(0x152);return _0x59a891(0x14d);}function isEquivalentPulledSqlFile(_0x54c83e,_0x1e343c,_0x3877e1){return normalizePullComparableContent(_0x54c83e,_0x3877e1)===normalizePullComparableContent(_0x1e343c,_0x3877e1);}function normalizePullComparableContent(_0x184fb5,_0x3f6639){const _0x267f68=a156_0x22638b,_0x11899e=_0x184fb5[_0x267f68(0x11b)](/\r\n/g,'\x0a')['split']('\x0a'),_0x29b2e2=_0x11899e[_0x267f68(0x13a)](_0x3860af=>!isSyncedAtMetadataLine(_0x3860af,_0x3f6639));return _0x29b2e2[_0x267f68(0x14b)]('\x0a');}function isSyncedAtMetadataLine(_0x564200,_0x3fe7bf){const _0x88a489=a156_0x22638b;if(_0x3fe7bf==='mybatisXml')return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x88a489(0x140)](_0x564200);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x88a489(0x140)](_0x564200);}
|
|
1
|
+
const a156_0x25f5f9=a156_0x4e7e;(function(_0x235f48,_0x5e89e0){const _0x734e8=a156_0x4e7e,_0x110f60=_0x235f48();while(!![]){try{const _0x373a57=parseInt(_0x734e8(0x1e2))/0x1+-parseInt(_0x734e8(0x1cf))/0x2+-parseInt(_0x734e8(0x1bb))/0x3+-parseInt(_0x734e8(0x1e5))/0x4+-parseInt(_0x734e8(0x1e9))/0x5+parseInt(_0x734e8(0x1e7))/0x6*(parseInt(_0x734e8(0x1c8))/0x7)+-parseInt(_0x734e8(0x1d2))/0x8*(-parseInt(_0x734e8(0x1c9))/0x9);if(_0x373a57===_0x5e89e0)break;else _0x110f60['push'](_0x110f60['shift']());}catch(_0x493e2f){_0x110f60['push'](_0x110f60['shift']());}}}(a156_0x3123,0x78a4c));import{readFile,rm,writeFile}from'node:fs/promises';function a156_0x4e7e(_0x46c395,_0x5803f5){_0x46c395=_0x46c395-0x1b8;const _0x3123e9=a156_0x3123();let _0x4e7e24=_0x3123e9[_0x46c395];return _0x4e7e24;}import{join}from'node:path';function a156_0x3123(){const _0x36e808=['local\x20differs\x20from\x20remote','description','boolean','replace','Pull\x20complete:\x20','trimStart','\x20skipped,\x20','force','1041372jYialV','unchanged','name','test','appCode','nonInteractive','catch','dbId','write','push','utf8','lockFilePath','toISOString','294EYUZod','9mEGnDb','bool','Would\x20pull\x20','No\x20remote\x20SQL\x20queries\x20matched.','totalCount','paging','1315064iYJPcX','sqlcode','tableData','14849632DJUHOa','path','apps','Filter\x20by\x20SQL\x20display\x20name','POST','mybatisXml','length','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','pull','message','sqlContent','\x20SQL\x20file(s)\x20into\x20','Force\x20pull\x20cancelled.','sqlRoot','sqlCode','split','515772hATBEv','sqlName','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','3236416ZFEpci','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','92802JzfVjw','sqls','3568370jUMtqc','str','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql'];a156_0x3123=function(){return _0x36e808;};return a156_0x3123();}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(_0x1d293e,_0x2e2acd){const _0x2cecce=a156_0x4e7e,_0x58138e=[];let _0x3bb689=0x1;while(!![]){const _0x5cdfbe=await listSqlQueries(_0x1d293e,{'currentPage':_0x3bb689,'pageSize':PAGE_SIZE,'sqlCode':_0x2e2acd[_0x2cecce(0x1e0)],'sqlName':_0x2e2acd['sqlName']}),_0x31d915=_0x5cdfbe[_0x2cecce(0x1d1)]??[];_0x58138e[_0x2cecce(0x1c4)](..._0x31d915);if(_0x31d915[_0x2cecce(0x1d8)]===0x0)break;const _0x56d4ff=_0x5cdfbe[_0x2cecce(0x1ce)]?.[_0x2cecce(0x1cd)];if(_0x56d4ff!=null?_0x58138e[_0x2cecce(0x1d8)]>=_0x56d4ff:_0x31d915[_0x2cecce(0x1d8)]<PAGE_SIZE)break;_0x3bb689++;}return _0x58138e;}async function ensureSqlContent(_0x12b1d2){const _0x11ed34=a156_0x4e7e;if(_0x12b1d2[_0x11ed34(0x1dc)]!=null&&String(_0x12b1d2[_0x11ed34(0x1dc)])[_0x11ed34(0x1d8)]>0x0)return _0x12b1d2;return getSqlQueryDetail(_0x12b1d2['sqlCode']);}export const sqlPull={'service':'sql','command':a156_0x25f5f9(0x1da),'description':a156_0x25f5f9(0x1d9),'risk':a156_0x25f5f9(0x1c3),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'name','type':'string','description':a156_0x25f5f9(0x1d5)},{'name':a156_0x25f5f9(0x1ba),'type':a156_0x25f5f9(0x1ee),'description':'Force\x20overwrite\x20local\x20unsynced\x20changes'}],async 'dryRun'(_0x537232){const _0x3f7b12=a156_0x25f5f9,_0x171579=loadSqlProjectConfig(_0x537232[_0x3f7b12(0x1bf)]),_0x1e4e97=await readSqlLockFile(_0x171579[_0x3f7b12(0x1c6)]),{appLock:_0x93748e}=ensureSqlLockScope(_0x1e4e97??createEmptySqlLock(),_0x171579['appCode'],_0x171579[_0x3f7b12(0x1df)],_0x3f7b12(0x1da)),_0x56b94f=await fetchAllSqlQueries(_0x537232[_0x3f7b12(0x1bf)],{'sqlCode':_0x537232[_0x3f7b12(0x1ea)](_0x3f7b12(0x1d0))||undefined,'sqlName':_0x537232[_0x3f7b12(0x1ea)](_0x3f7b12(0x1bd))||undefined}),_0x57e00b=[];for(const _0x126162 of _0x56b94f){const _0x1df58a=await ensureSqlContent(_0x126162),_0x312837=ensureRemoteSqlContent(_0x1df58a),_0x18abd8=detectModeFromSql(_0x1df58a),_0x4f1a30=_0x1df58a[_0x3f7b12(0x1c2)]?await getDbName(_0x537232[_0x3f7b12(0x1bf)],Number(_0x1df58a[_0x3f7b12(0x1c2)]))[_0x3f7b12(0x1c1)](()=>undefined):undefined,_0x127a29=buildLocalSqlFileContent({'sqlCode':_0x1df58a[_0x3f7b12(0x1e0)],'sqlName':_0x1df58a[_0x3f7b12(0x1e3)],'dbId':_0x1df58a[_0x3f7b12(0x1c2)]},_0x312837,{'dbName':_0x4f1a30,'mode':_0x18abd8,'syncedAt':new Date()[_0x3f7b12(0x1c7)](),'description':_0x1df58a['description']}),_0x29bad2=buildSqlLockEntry(_0x1df58a,_0x312837,'',{'dbName':_0x4f1a30}),_0x2960e2=resolveLocalSqlFilePath(_0x171579,_0x1df58a['sqlCode'],_0x29bad2);let _0x1bccbf='would_pull',_0x2c3f40;if(await fileExists(_0x2960e2)){const _0x861c5a=await readFile(_0x2960e2,_0x3f7b12(0x1c5));isEquivalentPulledSqlFile(_0x861c5a,_0x127a29,_0x18abd8)?(_0x1bccbf='skipped',_0x2c3f40='unchanged'):(_0x1bccbf='conflict',_0x2c3f40=_0x3f7b12(0x1e4));}_0x57e00b[_0x3f7b12(0x1c4)]({'sqlCode':_0x1df58a[_0x3f7b12(0x1e0)],'sqlName':_0x1df58a[_0x3f7b12(0x1e3)],'filePath':_0x2960e2,'status':_0x1bccbf,'reason':_0x2c3f40});}return{'method':_0x3f7b12(0x1d6),'url':_0x3f7b12(0x1eb),'body':{'appCode':_0x537232[_0x3f7b12(0x1bf)],'sqlCode':_0x537232[_0x3f7b12(0x1ea)](_0x3f7b12(0x1d0))||null,'sqlName':_0x537232[_0x3f7b12(0x1ea)](_0x3f7b12(0x1bd))||null,'files':_0x57e00b},'description':_0x3f7b12(0x1cb)+_0x57e00b[_0x3f7b12(0x1d8)]+_0x3f7b12(0x1dd)+_0x171579['sqlRootDir']};},async 'execute'(_0x2e2a12){const _0x43a1f4=a156_0x25f5f9,_0xbd9006=loadSqlProjectConfig(_0x2e2a12[_0x43a1f4(0x1bf)]),_0x55dabb=await readSqlLockFile(_0xbd9006[_0x43a1f4(0x1c6)]),{lockData:_0x32d304,appLock:_0x1ff840}=ensureSqlLockScope(_0x55dabb??createEmptySqlLock(),_0xbd9006[_0x43a1f4(0x1bf)],_0xbd9006['sqlRoot'],_0x43a1f4(0x1da)),_0x20f74c=_0x2e2a12[_0x43a1f4(0x1ca)]('force'),_0xe6c0a6=await fetchAllSqlQueries(_0x2e2a12[_0x43a1f4(0x1bf)],{'sqlCode':_0x2e2a12[_0x43a1f4(0x1ea)](_0x43a1f4(0x1d0))||undefined,'sqlName':_0x2e2a12['str'](_0x43a1f4(0x1bd))||undefined});if(_0xe6c0a6[_0x43a1f4(0x1d8)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x43a1f4(0x1cc)};const _0x2ca76e=[],_0x3b4eb1=[];for(const _0x27e5fe of _0xe6c0a6){try{_0x2ca76e['push'](await ensureSqlContent(_0x27e5fe));}catch(_0x43497c){_0x3b4eb1['push']({'sqlCode':_0x27e5fe[_0x43a1f4(0x1e0)],'error':_0x43497c instanceof Error?_0x43497c[_0x43a1f4(0x1db)]:String(_0x43497c)});}}if(_0x20f74c&&!_0x2e2a12[_0x43a1f4(0x1c0)]){let _0x406cd5=![];for(const _0x1186d9 of _0x2ca76e){const _0x2e85c1=detectModeFromSql(_0x1186d9),_0x425048=_0x1186d9[_0x43a1f4(0x1c2)]?await getDbName(_0x2e2a12[_0x43a1f4(0x1bf)],Number(_0x1186d9[_0x43a1f4(0x1c2)]))[_0x43a1f4(0x1c1)](()=>undefined):undefined,_0x530045=buildLocalSqlFileContent({'sqlCode':_0x1186d9[_0x43a1f4(0x1e0)],'sqlName':_0x1186d9[_0x43a1f4(0x1e3)],'dbId':_0x1186d9[_0x43a1f4(0x1c2)]},ensureRemoteSqlContent(_0x1186d9),{'dbName':_0x425048,'mode':_0x2e85c1,'syncedAt':new Date()['toISOString'](),'description':_0x1186d9[_0x43a1f4(0x1ed)]}),_0x565137=resolveLocalSqlFilePath(_0xbd9006,_0x1186d9[_0x43a1f4(0x1e0)],buildSqlLockEntry(_0x1186d9,ensureRemoteSqlContent(_0x1186d9),'',{'dbName':_0x425048}));if(await fileExists(_0x565137)){const _0x4d8500=await readFile(_0x565137,'utf8');if(!isEquivalentPulledSqlFile(_0x4d8500,_0x530045,_0x2e85c1)){_0x406cd5=!![];break;}}}if(_0x406cd5){const _0x2b9325=await confirmForceOverwrite(_0x43a1f4(0x1e6));if(!_0x2b9325)throw CliErrors['cancelled'](_0x43a1f4(0x1de));}}const _0x53ea1a=cloneSqlLockData(_0x32d304),_0x1c46a7=_0x53ea1a[_0x43a1f4(0x1d4)][_0xbd9006[_0x43a1f4(0x1bf)]],_0x2efa7c=[],_0x1edcf9=[];for(const _0x5963e2 of _0x2ca76e){const _0x3cf6d7=_0x1c46a7[_0x43a1f4(0x1e8)][_0x5963e2[_0x43a1f4(0x1e0)]],_0x22f4c2=ensureRemoteSqlContent(_0x5963e2),_0x1edad6=detectModeFromSql(_0x5963e2),_0x4f0092=_0x5963e2[_0x43a1f4(0x1c2)]?await getDbName(_0x2e2a12[_0x43a1f4(0x1bf)],Number(_0x5963e2[_0x43a1f4(0x1c2)]))['catch'](()=>undefined):undefined,_0x2c6069=buildLocalSqlFileContent({'sqlCode':_0x5963e2['sqlCode'],'sqlName':_0x5963e2[_0x43a1f4(0x1e3)],'dbId':_0x5963e2[_0x43a1f4(0x1c2)]},_0x22f4c2,{'dbName':_0x4f0092,'mode':_0x1edad6,'syncedAt':new Date()[_0x43a1f4(0x1c7)](),'description':_0x5963e2[_0x43a1f4(0x1ed)]}),_0x3dbe3c=buildSqlLockEntry(_0x5963e2,_0x22f4c2,computeSqlContentHash(_0x2c6069),{'dbName':_0x4f0092}),_0x2cfa7a=_0x3dbe3c['path'],_0x2b907b=join(_0xbd9006['sqlRootDir'],_0x2cfa7a);try{if(await fileExists(_0x2b907b)){const _0x2e382f=await readFile(_0x2b907b,_0x43a1f4(0x1c5));if(isEquivalentPulledSqlFile(_0x2e382f,_0x2c6069,_0x1edad6)){_0x1edcf9['push']({'sqlCode':_0x5963e2[_0x43a1f4(0x1e0)],'reason':_0x43a1f4(0x1bc)}),_0x1c46a7[_0x43a1f4(0x1e8)][_0x5963e2[_0x43a1f4(0x1e0)]]={..._0x3dbe3c,'hash':computeSqlContentHash(_0x2e382f),'path':_0x2cfa7a};continue;}if(!_0x20f74c){_0x1edcf9['push']({'sqlCode':_0x5963e2[_0x43a1f4(0x1e0)],'reason':_0x43a1f4(0x1ec)});continue;}}const _0x59a856=_0x3cf6d7?.[_0x43a1f4(0x1d3)]?join(_0xbd9006['sqlRootDir'],_0x3cf6d7[_0x43a1f4(0x1d3)]):undefined;_0x59a856&&_0x59a856!==_0x2b907b&&await fileExists(_0x59a856)&&await rm(_0x59a856,{'force':!![]}),await ensureParentDirectory(_0x2b907b),await writeFile(_0x2b907b,_0x2c6069,_0x43a1f4(0x1c5)),_0x1c46a7[_0x43a1f4(0x1e8)][_0x5963e2[_0x43a1f4(0x1e0)]]={..._0x3dbe3c,'path':_0x2cfa7a},_0x2efa7c[_0x43a1f4(0x1c4)]({'sqlCode':_0x5963e2['sqlCode'],'filePath':_0x2b907b});}catch(_0x57060e){_0x3b4eb1[_0x43a1f4(0x1c4)]({'sqlCode':_0x5963e2[_0x43a1f4(0x1e0)],'error':_0x57060e instanceof Error?_0x57060e['message']:String(_0x57060e)});}}return _0x1c46a7['lastSync']=new Date()[_0x43a1f4(0x1c7)](),await writeSqlLockFile(_0xbd9006[_0x43a1f4(0x1c6)],_0x53ea1a),{'ok':_0x3b4eb1[_0x43a1f4(0x1d8)]===0x0,'data':{'pulled':_0x2efa7c,'skipped':_0x1edcf9,'failed':_0x3b4eb1},'message':_0x43a1f4(0x1f0)+_0x2efa7c[_0x43a1f4(0x1d8)]+'\x20written,\x20'+_0x1edcf9['length']+_0x43a1f4(0x1b9)+_0x3b4eb1['length']+'\x20failed'};}};function detectModeFromSql(_0x19650c){const _0x312911=a156_0x25f5f9,_0x5c82c4=ensureRemoteSqlContent(_0x19650c),_0x5644a3=stripLocalSqlMetadata(_0x5c82c4,_0x312911(0x1d7))[_0x312911(0x1b8)]();if(/^<(select|insert|update|delete)\b/i[_0x312911(0x1be)](_0x5644a3))return _0x312911(0x1d7);return'sql';}function isEquivalentPulledSqlFile(_0x4ed7e2,_0x5bfdb4,_0x105ce8){return normalizePullComparableContent(_0x4ed7e2,_0x105ce8)===normalizePullComparableContent(_0x5bfdb4,_0x105ce8);}function normalizePullComparableContent(_0xf8f982,_0x25dd2d){const _0x2226ff=a156_0x25f5f9,_0x3209c8=_0xf8f982[_0x2226ff(0x1ef)](/\r\n/g,'\x0a')[_0x2226ff(0x1e1)]('\x0a'),_0x421035=_0x3209c8['filter'](_0x1c396d=>!isSyncedAtMetadataLine(_0x1c396d,_0x25dd2d));return _0x421035['join']('\x0a');}function isSyncedAtMetadataLine(_0x3df622,_0x18d24b){const _0x5077e0=a156_0x25f5f9;if(_0x18d24b==='mybatisXml')return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x5077e0(0x1be)](_0x3df622);return/^\s*--\s*@lovrabet\.syncedAt:/['test'](_0x3df622);}
|
package/lib/commands/sql/push.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function a157_0x341d(){const _0x50ca40=['entries','get','Local\x20SQL\x20not\x20found:\x20','8726630Qcdekf','\x20skipped,\x20','Push\x20local\x20SQL\x20files\x20to\x20remote','utf8','mode','validation','sqlConfig','sql','boolean','dbDirectory','sqlcode','6TZsIRm','push','force','2294704qJkDSI','startsWith','path','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','trashDir','1223568NRqahh','\x20pushed,\x20','1532LfqNIZ','18PaOAHz','filePath','sqlName','unchanged','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','2039742iojxcz','Would\x20push\x20','hash','\x20failed','length','has','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','replace','6795vHUpyz','27021sVMXHg','No\x20local\x20SQL\x20files\x20found.','POST','sqls','lastSync','version','exec','\x22\x20for\x20sqlCode\x20','isFinite','sqlCode','dbId','bool','lockFilePath','sqlRootDir','relativePath','dbName','toISOString','127715lybpoH','str','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','appCode','catch','remoteId','filter'];a157_0x341d=function(){return _0x50ca40;};return a157_0x341d();}const a157_0x803951=a157_0x4783;(function(_0x4ca230,_0xbcf76b){const _0x2661fd=a157_0x4783,_0x4a8c91=_0x4ca230();while(!![]){try{const _0x4a8ee0=parseInt(_0x2661fd(0xef))/0x1*(parseInt(_0x2661fd(0x120))/0x2)+parseInt(_0x2661fd(0x125))/0x3+-parseInt(_0x2661fd(0x11f))/0x4*(-parseInt(_0x2661fd(0xee))/0x5)+-parseInt(_0x2661fd(0x115))/0x6*(parseInt(_0x2661fd(0x100))/0x7)+-parseInt(_0x2661fd(0x118))/0x8+parseInt(_0x2661fd(0x11d))/0x9+-parseInt(_0x2661fd(0x10a))/0xa;if(_0x4a8ee0===_0xbcf76b)break;else _0x4a8c91['push'](_0x4a8c91['shift']());}catch(_0x572fe5){_0x4a8c91['push'](_0x4a8c91['shift']());}}}(a157_0x341d,0x6218e));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';function a157_0x4783(_0x1f8b23,_0xcfea5b){_0x1f8b23=_0x1f8b23-0xea;const _0x341dc9=a157_0x341d();let _0x4783b9=_0x341dc9[_0x1f8b23];return _0x4783b9;}import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';async function getTargetSqlQueries(_0x2ec631,_0x2af120,_0x768741){const _0xd964ee=a157_0x4783,_0x197152=await scanLocalSqlQueries(_0x2ec631),_0x1a3b41=new Map();for(const _0x20b5a4 of _0x197152){if(_0x768741&&_0x20b5a4[_0xd964ee(0xf8)]!==_0x768741)continue;const _0x4665d2=_0x1a3b41[_0xd964ee(0x108)](_0x20b5a4[_0xd964ee(0xf8)])??[];_0x4665d2['push'](_0x20b5a4),_0x1a3b41['set'](_0x20b5a4[_0xd964ee(0xf8)],_0x4665d2);}if(_0x768741&&!_0x1a3b41[_0xd964ee(0xeb)](_0x768741))throw CliErrors[_0xd964ee(0x10f)](_0xd964ee(0x109)+_0x768741);const _0x26a798=[];for(const [_0x51a2e1,_0x4452d6]of _0x1a3b41[_0xd964ee(0x107)]()){if(_0x4452d6[_0xd964ee(0xea)]===0x1){_0x26a798[_0xd964ee(0x116)](_0x4452d6[0x0]);continue;}const _0x27bf27=_0x2af120[_0xd964ee(0xf2)][_0x51a2e1],_0x37845f=_0x27bf27?.[_0xd964ee(0x11a)],_0x4ce0d3=_0x37845f?_0x4452d6[_0xd964ee(0x106)](_0x3ca31c=>_0x3ca31c[_0xd964ee(0xfd)]!==_0x37845f):_0x4452d6;if(_0x27bf27&&_0x4ce0d3[_0xd964ee(0xea)]===0x1){_0x26a798[_0xd964ee(0x116)](_0x4ce0d3[0x0]);continue;}throw CliErrors[_0xd964ee(0x10f)](_0xd964ee(0x11b)+_0x51a2e1+_0xd964ee(0x102));}return _0x26a798;}export const sqlPush={'service':a157_0x803951(0x111),'command':a157_0x803951(0x116),'description':a157_0x803951(0x10c),'risk':'high-risk-write','flags':[SQLCODE_FLAG_OPTIONAL,{'name':'force','type':a157_0x803951(0x112),'description':'Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock'}],async 'dryRun'(_0x181c53){const _0x198e4f=a157_0x803951,_0x368d16=loadSqlProjectConfig(_0x181c53[_0x198e4f(0x103)]),_0x433a68=await readSqlLockFile(_0x368d16[_0x198e4f(0xfb)]),{appLock:_0x5f40ea}=ensureSqlLockScope(_0x433a68??createEmptySqlLock(),_0x181c53[_0x198e4f(0x103)],_0x368d16['sqlRoot'],_0x198e4f(0x116)),_0x28aa0f=await getTargetSqlQueries(_0x368d16,_0x5f40ea,_0x181c53[_0x198e4f(0x101)](_0x198e4f(0x114))||undefined),_0x2002c6=[];for(const _0x2a82f0 of _0x28aa0f){const _0x516143=await computeSqlFileHash(_0x2a82f0[_0x198e4f(0x121)]),_0xe1b803=_0x5f40ea[_0x198e4f(0xf2)][_0x2a82f0['sqlCode']],_0x2b5fe3=!!_0xe1b803&&(_0xe1b803['path']!==_0x2a82f0[_0x198e4f(0xfd)]||!!_0x2a82f0['sqlName']&&_0xe1b803['sqlName']!==_0x2a82f0['sqlName']);if(!_0x181c53[_0x198e4f(0xfa)](_0x198e4f(0x117))&&_0xe1b803&&_0xe1b803[_0x198e4f(0x127)]===_0x516143&&!_0x2b5fe3)continue;_0x2002c6[_0x198e4f(0x116)](_0x2a82f0[_0x198e4f(0xf8)]);}return{'method':_0x198e4f(0xf1),'url':'/smartapi/custom/updateUserCustomSql','body':{'sqlCodes':_0x2002c6,'appCode':_0x181c53['appCode']},'description':_0x198e4f(0x126)+_0x2002c6['length']+'\x20SQL\x20file(s)'};},async 'execute'(_0x26f335){const _0x4b6a82=a157_0x803951,_0xdd62d3=loadSqlProjectConfig(_0x26f335[_0x4b6a82(0x103)]),_0x3d64ec=await readSqlLockFile(_0xdd62d3[_0x4b6a82(0xfb)]),{lockData:_0x2c707d,appLock:_0x539c86}=ensureSqlLockScope(_0x3d64ec??createEmptySqlLock(),_0x26f335['appCode'],_0xdd62d3['sqlRoot'],_0x4b6a82(0x116)),_0x2b4e8e=await getTargetSqlQueries(_0xdd62d3,_0x539c86,_0x26f335['str'](_0x4b6a82(0x114))||undefined);if(_0x2b4e8e[_0x4b6a82(0xea)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x4b6a82(0xf0)};const _0x2459a0=[],_0xdc36c7=[],_0x4a3655=[];for(const _0x423c85 of _0x2b4e8e){const _0x594b25=_0x539c86['sqls'][_0x423c85[_0x4b6a82(0xf8)]];if(!_0x594b25){_0x4a3655[_0x4b6a82(0x116)]({'sqlCode':_0x423c85[_0x4b6a82(0xf8)],'error':'local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first'});continue;}try{const _0x56b612=await computeSqlFileHash(_0x423c85['filePath']),_0x25a819=_0x594b25['path']!==_0x423c85[_0x4b6a82(0xfd)]||!!_0x423c85[_0x4b6a82(0x122)]&&_0x594b25[_0x4b6a82(0x122)]!==_0x423c85[_0x4b6a82(0x122)];if(!_0x26f335[_0x4b6a82(0xfa)](_0x4b6a82(0x117))&&_0x594b25[_0x4b6a82(0x127)]===_0x56b612&&!_0x25a819){_0xdc36c7[_0x4b6a82(0x116)]({'sqlCode':_0x423c85[_0x4b6a82(0xf8)],'reason':_0x4b6a82(0x123)});continue;}if(_0x594b25[_0x4b6a82(0xf4)]==null){_0x4a3655['push']({'sqlCode':_0x423c85[_0x4b6a82(0xf8)],'error':_0x4b6a82(0x124)});continue;}const _0x3a9b5c=await readFile(_0x423c85[_0x4b6a82(0x121)],_0x4b6a82(0x10d)),_0x513e3=stripLocalSqlMetadata(_0x3a9b5c,_0x423c85[_0x4b6a82(0x10e)]),_0x448955=_0x423c85['sqlName']||_0x594b25[_0x4b6a82(0x122)],_0x2c0a2b=await resolveTargetDbBinding(_0x26f335['appCode'],_0x423c85,_0x594b25),_0x16165b=await updateSqlQuery({'id':_0x594b25['remoteId'],'appCode':_0x26f335[_0x4b6a82(0x103)],'sqlCode':_0x423c85[_0x4b6a82(0xf8)],'sqlName':_0x448955,'dbId':_0x2c0a2b[_0x4b6a82(0xf9)],'version':_0x594b25[_0x4b6a82(0xf4)],'sqlContent':_0x513e3,'sqlConfig':_0x594b25[_0x4b6a82(0x110)]??undefined}),_0x5a4d3b=_0x16165b['dbId']?await getDbName(_0x26f335[_0x4b6a82(0x103)],Number(_0x16165b['dbId']))[_0x4b6a82(0x104)](()=>_0x2c0a2b[_0x4b6a82(0xfe)]):_0x2c0a2b[_0x4b6a82(0xfe)];_0x539c86[_0x4b6a82(0xf2)][_0x423c85[_0x4b6a82(0xf8)]]={...buildSqlLockEntry(_0x16165b,_0x513e3,_0x56b612,{'dbName':_0x5a4d3b}),'path':_0x423c85[_0x4b6a82(0xfd)],'mode':_0x594b25[_0x4b6a82(0x10e)]},await archivePreviousSqlFileIfNeeded(_0xdd62d3,_0x594b25[_0x4b6a82(0x11a)],_0x423c85[_0x4b6a82(0xfd)]),_0x2459a0['push']({'sqlCode':_0x423c85[_0x4b6a82(0xf8)],'remoteId':_0x594b25[_0x4b6a82(0x105)]});}catch(_0x2dc9b5){_0x4a3655[_0x4b6a82(0x116)]({'sqlCode':_0x423c85[_0x4b6a82(0xf8)],'error':_0x2dc9b5 instanceof Error?_0x2dc9b5['message']:String(_0x2dc9b5)});}}return _0x539c86[_0x4b6a82(0xf3)]=new Date()[_0x4b6a82(0xff)](),await writeSqlLockFile(_0xdd62d3['lockFilePath'],_0x2c707d),{'ok':_0x4a3655[_0x4b6a82(0xea)]===0x0,'data':{'pushed':_0x2459a0,'skipped':_0xdc36c7,'failed':_0x4a3655},'message':'Push\x20complete:\x20'+_0x2459a0[_0x4b6a82(0xea)]+_0x4b6a82(0x11e)+_0xdc36c7['length']+_0x4b6a82(0x10b)+_0x4a3655[_0x4b6a82(0xea)]+_0x4b6a82(0x128)};}};async function archivePreviousSqlFileIfNeeded(_0x58c81d,_0x3f111c,_0x43ca8f){const _0x29784d=a157_0x803951;if(!_0x3f111c||_0x3f111c===_0x43ca8f)return;const _0x42f507=join(_0x58c81d[_0x29784d(0xfc)],_0x3f111c);if(!await fileExists(_0x42f507))return;const _0x40b1bb=await moveToTrash(_0x58c81d['projectRoot'],_0x58c81d[_0x29784d(0x11c)],_0x42f507);await cleanupEmptyDirectories(dirname(_0x42f507),_0x58c81d[_0x29784d(0xfc)]),void _0x40b1bb;}async function moveToTrash(_0x14c7fa,_0x36acd8,_0x3afcec){const _0x3dba6a=a157_0x803951,_0x178583=new Date()[_0x3dba6a(0xff)]()[_0x3dba6a(0xed)](/[:.]/g,'-'),_0x3a2a53=relative(_0x14c7fa,_0x3afcec),_0x52c774=join(_0x36acd8,_0x178583,_0x3a2a53);return await mkdir(dirname(_0x52c774),{'recursive':!![]}),await rename(_0x3afcec,_0x52c774),_0x52c774;}async function cleanupEmptyDirectories(_0x51de28,_0x1f95b3){const _0x1903e6=a157_0x803951;let _0x3c65ba=resolve(_0x51de28);const _0x307f0e=resolve(_0x1f95b3);while(_0x3c65ba[_0x1903e6(0x119)](''+_0x307f0e+sep)||_0x3c65ba===_0x307f0e){if(_0x3c65ba===_0x307f0e)return;try{const _0x38d96d=await readdir(_0x3c65ba);if(_0x38d96d[_0x1903e6(0xea)]>0x0)return;await rmdir(_0x3c65ba);}catch{return;}_0x3c65ba=dirname(_0x3c65ba);}}async function resolveTargetDbBinding(_0x108088,_0x10dc88,_0x2e24ce){const _0x59168e=a157_0x803951,_0xa6ca9a=_0x10dc88[_0x59168e(0x113)];if(!_0xa6ca9a)return{'dbId':_0x2e24ce[_0x59168e(0xf9)],'dbName':_0x2e24ce[_0x59168e(0xfe)]};const _0x21701e=buildDbDirectoryName(_0x2e24ce[_0x59168e(0xfe)],_0x2e24ce[_0x59168e(0xf9)]);if(_0xa6ca9a===_0x21701e)return{'dbId':_0x2e24ce[_0x59168e(0xf9)],'dbName':_0x2e24ce[_0x59168e(0xfe)]};const _0x4518c3=parseExplicitDbDirectory(_0xa6ca9a);if(_0x4518c3!=null)return{'dbId':_0x4518c3,'dbName':await getDbName(_0x108088,_0x4518c3)[_0x59168e(0x104)](()=>undefined)};const _0x2b99ea=await listDatabases(_0x108088),_0x41fb13=_0x2b99ea[_0x59168e(0x106)](_0x9973fe=>buildDbDirectoryName(_0x9973fe['dbName'],_0x9973fe['dbId'])===_0xa6ca9a);if(_0x41fb13[_0x59168e(0xea)]===0x1)return{'dbId':_0x41fb13[0x0]['dbId'],'dbName':_0x41fb13[0x0][_0x59168e(0xfe)]};if(_0x41fb13['length']===0x0)throw CliErrors[_0x59168e(0x10f)]('No\x20database\x20matches\x20local\x20directory\x20\x22'+_0xa6ca9a+_0x59168e(0xf6)+_0x10dc88['sqlCode']+'.');const _0x997a07=_0x41fb13['map'](_0x9cc867=>_0x9cc867[_0x59168e(0xfe)]+'\x20('+_0x9cc867[_0x59168e(0xf9)]+')')['join'](',\x20');throw CliErrors[_0x59168e(0x10f)]('Local\x20directory\x20\x22'+_0xa6ca9a+_0x59168e(0xec)+_0x10dc88[_0x59168e(0xf8)]+':\x20'+_0x997a07);}function parseExplicitDbDirectory(_0x1df7ee){const _0x1d1006=a157_0x803951,_0x5a1e7f=/^db-(\d+)$/[_0x1d1006(0xf5)](_0x1df7ee);if(!_0x5a1e7f)return null;const _0x3f6625=Number(_0x5a1e7f[0x1]);return Number[_0x1d1006(0xf7)](_0x3f6625)&&_0x3f6625>0x0?_0x3f6625:null;}
|
|
1
|
+
const a157_0x58b92b=a157_0x2e17;(function(_0xd9cfa6,_0x37b2d9){const _0x29cb59=a157_0x2e17,_0x440f04=_0xd9cfa6();while(!![]){try{const _0x5b81ec=-parseInt(_0x29cb59(0xdb))/0x1*(parseInt(_0x29cb59(0xfc))/0x2)+parseInt(_0x29cb59(0xff))/0x3+-parseInt(_0x29cb59(0xfe))/0x4*(-parseInt(_0x29cb59(0xef))/0x5)+parseInt(_0x29cb59(0xe8))/0x6+-parseInt(_0x29cb59(0xe9))/0x7+-parseInt(_0x29cb59(0x106))/0x8*(-parseInt(_0x29cb59(0x101))/0x9)+parseInt(_0x29cb59(0x115))/0xa*(-parseInt(_0x29cb59(0xf2))/0xb);if(_0x5b81ec===_0x37b2d9)break;else _0x440f04['push'](_0x440f04['shift']());}catch(_0x375223){_0x440f04['push'](_0x440f04['shift']());}}}(a157_0x15ba,0x62cd1));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';async function getTargetSqlQueries(_0x141c0b,_0x41ced9,_0x440519){const _0x2b5a5c=a157_0x2e17,_0x32022b=await scanLocalSqlQueries(_0x141c0b),_0x5addb5=new Map();for(const _0x1ce246 of _0x32022b){if(_0x440519&&_0x1ce246[_0x2b5a5c(0xe7)]!==_0x440519)continue;const _0x5d325b=_0x5addb5['get'](_0x1ce246[_0x2b5a5c(0xe7)])??[];_0x5d325b[_0x2b5a5c(0xec)](_0x1ce246),_0x5addb5[_0x2b5a5c(0x10d)](_0x1ce246['sqlCode'],_0x5d325b);}if(_0x440519&&!_0x5addb5[_0x2b5a5c(0xe4)](_0x440519))throw CliErrors[_0x2b5a5c(0xdd)](_0x2b5a5c(0xe1)+_0x440519);const _0x4bf22a=[];for(const [_0x19e4a4,_0x52e3ca]of _0x5addb5[_0x2b5a5c(0x10b)]()){if(_0x52e3ca[_0x2b5a5c(0x110)]===0x1){_0x4bf22a[_0x2b5a5c(0xec)](_0x52e3ca[0x0]);continue;}const _0xefa5bd=_0x41ced9[_0x2b5a5c(0xf8)][_0x19e4a4],_0xbc4c46=_0xefa5bd?.[_0x2b5a5c(0xd5)],_0x4deb23=_0xbc4c46?_0x52e3ca[_0x2b5a5c(0x104)](_0x4e64b3=>_0x4e64b3[_0x2b5a5c(0xed)]!==_0xbc4c46):_0x52e3ca;if(_0xefa5bd&&_0x4deb23[_0x2b5a5c(0x110)]===0x1){_0x4bf22a[_0x2b5a5c(0xec)](_0x4deb23[0x0]);continue;}throw CliErrors[_0x2b5a5c(0xdd)](_0x2b5a5c(0xe2)+_0x19e4a4+'.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.');}return _0x4bf22a;}export const sqlPush={'service':a157_0x58b92b(0xd9),'command':a157_0x58b92b(0xec),'description':a157_0x58b92b(0xe0),'risk':a157_0x58b92b(0xf9),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a157_0x58b92b(0x109),'type':a157_0x58b92b(0xda),'description':a157_0x58b92b(0xf7)}],async 'dryRun'(_0x283483){const _0x1ecd8e=a157_0x58b92b,_0x26506d=loadSqlProjectConfig(_0x283483[_0x1ecd8e(0xfa)]),_0x3a3055=await readSqlLockFile(_0x26506d['lockFilePath']),{appLock:_0x54c362}=ensureSqlLockScope(_0x3a3055??createEmptySqlLock(),_0x283483[_0x1ecd8e(0xfa)],_0x26506d[_0x1ecd8e(0x108)],_0x1ecd8e(0xec)),_0x3509f4=await getTargetSqlQueries(_0x26506d,_0x54c362,_0x283483['str']('sqlcode')||undefined),_0x1b3428=[];for(const _0x5bf54c of _0x3509f4){const _0x464e19=await computeSqlFileHash(_0x5bf54c[_0x1ecd8e(0xe6)]),_0x474271=_0x54c362[_0x1ecd8e(0xf8)][_0x5bf54c[_0x1ecd8e(0xe7)]],_0x29fa01=!!_0x474271&&(_0x474271[_0x1ecd8e(0xd5)]!==_0x5bf54c['relativePath']||!!_0x5bf54c[_0x1ecd8e(0x100)]&&_0x474271['sqlName']!==_0x5bf54c[_0x1ecd8e(0x100)]);if(!_0x283483[_0x1ecd8e(0x111)]('force')&&_0x474271&&_0x474271[_0x1ecd8e(0x113)]===_0x464e19&&!_0x29fa01)continue;_0x1b3428[_0x1ecd8e(0xec)](_0x5bf54c['sqlCode']);}return{'method':'POST','url':'/smartapi/custom/updateUserCustomSql','body':{'sqlCodes':_0x1b3428,'appCode':_0x283483[_0x1ecd8e(0xfa)]},'description':_0x1ecd8e(0xdc)+_0x1b3428[_0x1ecd8e(0x110)]+'\x20SQL\x20file(s)'};},async 'execute'(_0x2adbff){const _0x2b19f6=a157_0x58b92b,_0x6084ee=loadSqlProjectConfig(_0x2adbff[_0x2b19f6(0xfa)]),_0x256791=await readSqlLockFile(_0x6084ee[_0x2b19f6(0xd1)]),{lockData:_0x26c127,appLock:_0x98fbcf}=ensureSqlLockScope(_0x256791??createEmptySqlLock(),_0x2adbff[_0x2b19f6(0xfa)],_0x6084ee[_0x2b19f6(0x108)],_0x2b19f6(0xec)),_0x471f80=await getTargetSqlQueries(_0x6084ee,_0x98fbcf,_0x2adbff['str']('sqlcode')||undefined);if(_0x471f80[_0x2b19f6(0x110)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x2b19f6(0x105)};const _0x247b73=[],_0x1372a2=[],_0x1dd6f3=[];for(const _0x563460 of _0x471f80){const _0x353a77=_0x98fbcf[_0x2b19f6(0xf8)][_0x563460[_0x2b19f6(0xe7)]];if(!_0x353a77){_0x1dd6f3[_0x2b19f6(0xec)]({'sqlCode':_0x563460[_0x2b19f6(0xe7)],'error':_0x2b19f6(0x107)});continue;}try{const _0x25e1aa=await computeSqlFileHash(_0x563460[_0x2b19f6(0xe6)]),_0x2af8ae=_0x353a77[_0x2b19f6(0xd5)]!==_0x563460[_0x2b19f6(0xed)]||!!_0x563460[_0x2b19f6(0x100)]&&_0x353a77[_0x2b19f6(0x100)]!==_0x563460[_0x2b19f6(0x100)];if(!_0x2adbff['bool'](_0x2b19f6(0x109))&&_0x353a77['hash']===_0x25e1aa&&!_0x2af8ae){_0x1372a2[_0x2b19f6(0xec)]({'sqlCode':_0x563460[_0x2b19f6(0xe7)],'reason':_0x2b19f6(0xf5)});continue;}if(_0x353a77[_0x2b19f6(0xf6)]==null){_0x1dd6f3[_0x2b19f6(0xec)]({'sqlCode':_0x563460['sqlCode'],'error':_0x2b19f6(0xea)});continue;}const _0x1f516c=await readFile(_0x563460[_0x2b19f6(0xe6)],_0x2b19f6(0x10c)),_0x4a2d31=stripLocalSqlMetadata(_0x1f516c,_0x563460[_0x2b19f6(0xee)]),_0x58f3eb=_0x563460[_0x2b19f6(0x100)]||_0x353a77['sqlName'],_0x4f068a=await resolveTargetDbBinding(_0x2adbff[_0x2b19f6(0xfa)],_0x563460,_0x353a77),_0x4d05cc=await updateSqlQuery({'id':_0x353a77[_0x2b19f6(0xe5)],'appCode':_0x2adbff['appCode'],'sqlCode':_0x563460[_0x2b19f6(0xe7)],'sqlName':_0x58f3eb,'dbId':_0x4f068a[_0x2b19f6(0xd3)],'version':_0x353a77[_0x2b19f6(0xf6)],'sqlContent':_0x4a2d31,'sqlConfig':_0x353a77[_0x2b19f6(0x112)]??undefined}),_0x243e6b=_0x4d05cc[_0x2b19f6(0xd3)]?await getDbName(_0x2adbff[_0x2b19f6(0xfa)],Number(_0x4d05cc[_0x2b19f6(0xd3)]))[_0x2b19f6(0xd7)](()=>_0x4f068a[_0x2b19f6(0xd2)]):_0x4f068a[_0x2b19f6(0xd2)];_0x98fbcf[_0x2b19f6(0xf8)][_0x563460['sqlCode']]={...buildSqlLockEntry(_0x4d05cc,_0x4a2d31,_0x25e1aa,{'dbName':_0x243e6b}),'path':_0x563460[_0x2b19f6(0xed)],'mode':_0x353a77[_0x2b19f6(0xee)]},await archivePreviousSqlFileIfNeeded(_0x6084ee,_0x353a77[_0x2b19f6(0xd5)],_0x563460[_0x2b19f6(0xed)]),_0x247b73[_0x2b19f6(0xec)]({'sqlCode':_0x563460['sqlCode'],'remoteId':_0x353a77[_0x2b19f6(0xe5)]});}catch(_0x3a1d10){_0x1dd6f3[_0x2b19f6(0xec)]({'sqlCode':_0x563460['sqlCode'],'error':_0x3a1d10 instanceof Error?_0x3a1d10[_0x2b19f6(0x102)]:String(_0x3a1d10)});}}return _0x98fbcf[_0x2b19f6(0x10f)]=new Date()[_0x2b19f6(0x10e)](),await writeSqlLockFile(_0x6084ee[_0x2b19f6(0xd1)],_0x26c127),{'ok':_0x1dd6f3[_0x2b19f6(0x110)]===0x0,'data':{'pushed':_0x247b73,'skipped':_0x1372a2,'failed':_0x1dd6f3},'message':_0x2b19f6(0x114)+_0x247b73['length']+_0x2b19f6(0xde)+_0x1372a2[_0x2b19f6(0x110)]+_0x2b19f6(0xdf)+_0x1dd6f3[_0x2b19f6(0x110)]+_0x2b19f6(0xf4)};}};async function archivePreviousSqlFileIfNeeded(_0x5da45b,_0xac6fa5,_0x2c2832){const _0x50fc11=a157_0x58b92b;if(!_0xac6fa5||_0xac6fa5===_0x2c2832)return;const _0xd7f849=join(_0x5da45b['sqlRootDir'],_0xac6fa5);if(!await fileExists(_0xd7f849))return;const _0x455547=await moveToTrash(_0x5da45b[_0x50fc11(0x116)],_0x5da45b[_0x50fc11(0xeb)],_0xd7f849);await cleanupEmptyDirectories(dirname(_0xd7f849),_0x5da45b[_0x50fc11(0xe3)]),void _0x455547;}async function moveToTrash(_0x1b3a2b,_0x17956c,_0x4d75c9){const _0x34d5c4=a157_0x58b92b,_0x40aa82=new Date()[_0x34d5c4(0x10e)]()[_0x34d5c4(0xf3)](/[:.]/g,'-'),_0x4a6c90=relative(_0x1b3a2b,_0x4d75c9),_0x44354a=join(_0x17956c,_0x40aa82,_0x4a6c90);return await mkdir(dirname(_0x44354a),{'recursive':!![]}),await rename(_0x4d75c9,_0x44354a),_0x44354a;}async function cleanupEmptyDirectories(_0x492fd1,_0x336f5c){const _0x446e3c=a157_0x58b92b;let _0x2286c7=resolve(_0x492fd1);const _0x3cd2bb=resolve(_0x336f5c);while(_0x2286c7[_0x446e3c(0xf0)](''+_0x3cd2bb+sep)||_0x2286c7===_0x3cd2bb){if(_0x2286c7===_0x3cd2bb)return;try{const _0x22c95b=await readdir(_0x2286c7);if(_0x22c95b[_0x446e3c(0x110)]>0x0)return;await rmdir(_0x2286c7);}catch{return;}_0x2286c7=dirname(_0x2286c7);}}function a157_0x2e17(_0x37cc9c,_0x55cce2){_0x37cc9c=_0x37cc9c-0xd1;const _0x15baa2=a157_0x15ba();let _0x2e17e6=_0x15baa2[_0x37cc9c];return _0x2e17e6;}function a157_0x15ba(){const _0x288b68=['57HXiMVX','Would\x20push\x20','validation','\x20pushed,\x20','\x20skipped,\x20','Push\x20local\x20SQL\x20files\x20to\x20remote','Local\x20SQL\x20not\x20found:\x20','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','sqlRootDir','has','remoteId','filePath','sqlCode','3034740sdewdr','1306893IuGqvl','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','trashDir','push','relativePath','mode','1941275ITvEkW','startsWith','Local\x20directory\x20\x22','1833502WpdAGO','replace','\x20failed','unchanged','version','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','sqls','high-risk-write','appCode','isFinite','21918iBSWwd','\x22\x20for\x20sqlCode\x20','4okGxzo','1541580ZwwKsd','sqlName','7155PsmNuq','message','join','filter','No\x20local\x20SQL\x20files\x20found.','1424tqNSUh','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','sqlRoot','force','dbDirectory','entries','utf8','set','toISOString','lastSync','length','bool','sqlConfig','hash','Push\x20complete:\x20','20bpXBQk','projectRoot','lockFilePath','dbName','dbId','exec','path','No\x20database\x20matches\x20local\x20directory\x20\x22','catch','map','sql','boolean'];a157_0x15ba=function(){return _0x288b68;};return a157_0x15ba();}async function resolveTargetDbBinding(_0x4c60ce,_0x2d6e91,_0x2c80e5){const _0xffeba4=a157_0x58b92b,_0x49beb7=_0x2d6e91[_0xffeba4(0x10a)];if(!_0x49beb7)return{'dbId':_0x2c80e5[_0xffeba4(0xd3)],'dbName':_0x2c80e5[_0xffeba4(0xd2)]};const _0x19879e=buildDbDirectoryName(_0x2c80e5[_0xffeba4(0xd2)],_0x2c80e5['dbId']);if(_0x49beb7===_0x19879e)return{'dbId':_0x2c80e5['dbId'],'dbName':_0x2c80e5['dbName']};const _0x1801ab=parseExplicitDbDirectory(_0x49beb7);if(_0x1801ab!=null)return{'dbId':_0x1801ab,'dbName':await getDbName(_0x4c60ce,_0x1801ab)[_0xffeba4(0xd7)](()=>undefined)};const _0x3c5d6f=await listDatabases(_0x4c60ce),_0xba45af=_0x3c5d6f[_0xffeba4(0x104)](_0x562c4a=>buildDbDirectoryName(_0x562c4a['dbName'],_0x562c4a['dbId'])===_0x49beb7);if(_0xba45af[_0xffeba4(0x110)]===0x1)return{'dbId':_0xba45af[0x0]['dbId'],'dbName':_0xba45af[0x0][_0xffeba4(0xd2)]};if(_0xba45af['length']===0x0)throw CliErrors[_0xffeba4(0xdd)](_0xffeba4(0xd6)+_0x49beb7+_0xffeba4(0xfd)+_0x2d6e91['sqlCode']+'.');const _0x4e9190=_0xba45af[_0xffeba4(0xd8)](_0x510ba7=>_0x510ba7[_0xffeba4(0xd2)]+'\x20('+_0x510ba7['dbId']+')')[_0xffeba4(0x103)](',\x20');throw CliErrors['validation'](_0xffeba4(0xf1)+_0x49beb7+'\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20'+_0x2d6e91[_0xffeba4(0xe7)]+':\x20'+_0x4e9190);}function parseExplicitDbDirectory(_0x4e1799){const _0x29cf83=a157_0x58b92b,_0x3a907e=/^db-(\d+)$/[_0x29cf83(0xd4)](_0x4e1799);if(!_0x3a907e)return null;const _0x568adc=Number(_0x3a907e[0x1]);return Number[_0x29cf83(0xfb)](_0x568adc)&&_0x568adc>0x0?_0x568adc:null;}
|
package/lib/commands/sql/save.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a158_0x1fe889=a158_0x490a;function a158_0x490a(_0x399eac,_0x28aac8){_0x399eac=_0x399eac-0x16c;const _0x1d74f5=a158_0x1d74();let _0x490afb=_0x1d74f5[_0x399eac];return _0x490afb;}(function(_0x363d43,_0x211ec){const _0x9ba1d6=a158_0x490a,_0x3c5a24=_0x363d43();while(!![]){try{const _0x4d2a17=-parseInt(_0x9ba1d6(0x180))/0x1+parseInt(_0x9ba1d6(0x17e))/0x2+parseInt(_0x9ba1d6(0x171))/0x3+-parseInt(_0x9ba1d6(0x176))/0x4+parseInt(_0x9ba1d6(0x17b))/0x5+parseInt(_0x9ba1d6(0x17a))/0x6*(-parseInt(_0x9ba1d6(0x181))/0x7)+parseInt(_0x9ba1d6(0x173))/0x8*(parseInt(_0x9ba1d6(0x175))/0x9);if(_0x4d2a17===_0x211ec)break;else _0x3c5a24['push'](_0x3c5a24['shift']());}catch(_0x3957ce){_0x3c5a24['push'](_0x3c5a24['shift']());}}}(a158_0x1d74,0x21b64));function a158_0x1d74(){const _0x1982a3=['118805EsvtVZ','Create\x20new\x20SQL\x20with\x20`rabetbase\x20sql\x20create\x20--name\x20<name>\x20--db-id\x20<id>\x20--mode\x20sql|mybatisXml`.','Query\x20description','137640CGZJFq','file','216420qTUBIs','217qHDAeq','Path\x20to\x20the\x20SQL\x20file','Deprecated:\x20use\x20sql\x20create\x20to\x20create\x20and\x20sql\x20push\x20to\x20update','Target\x20database\x20—\x20accepts\x20a\x20numeric\x20ID\x20or\x20database\x20name\x20(e.g.\x20ecommerce_db)','save','SQL\x20query\x20display\x20name','95823MJIwkP','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`.','16kxylgV','write','1536993OhJIHT','408220VcjAuF','string','sqlname','validation','1842RESysZ'];a158_0x1d74=function(){return _0x1982a3;};return a158_0x1d74();}import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';const SQL_SAVE_DEPRECATED_HINT=['`rabetbase\x20sql\x20save`\x20has\x20been\x20deprecated.',a158_0x1fe889(0x17c),a158_0x1fe889(0x172)]['join']('\x0a');export const sqlSave={'service':'sql','command':a158_0x1fe889(0x16f),'description':a158_0x1fe889(0x16d),'risk':a158_0x1fe889(0x174),'requiresAuth':![],'requiresAppCode':![],'flags':[{'name':a158_0x1fe889(0x17f),'type':a158_0x1fe889(0x177),'required':!![],'description':a158_0x1fe889(0x16c)},SQLCODE_FLAG_OPTIONAL,{'name':a158_0x1fe889(0x178),'type':a158_0x1fe889(0x177),'description':a158_0x1fe889(0x170)},{'name':'db','type':a158_0x1fe889(0x177),'description':a158_0x1fe889(0x16e)},{'name':'description','type':a158_0x1fe889(0x177),'description':a158_0x1fe889(0x17d)}],async 'validate'(){throw CliErrors['validation'](SQL_SAVE_DEPRECATED_HINT);},async 'execute'(){const _0xcf2381=a158_0x1fe889;throw CliErrors[_0xcf2381(0x179)](SQL_SAVE_DEPRECATED_HINT);}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a159_0x4cc746=a159_0x2015;(function(_0x496d60,_0x288727){const _0x577478=a159_0x2015,_0x330551=_0x496d60();while(!![]){try{const _0x2dcc0a=-parseInt(_0x577478(0x151))/0x1*(-parseInt(_0x577478(0x153))/0x2)+-parseInt(_0x577478(0x136))/0x3*(-parseInt(_0x577478(0x13c))/0x4)+parseInt(_0x577478(0x144))/0x5+parseInt(_0x577478(0x139))/0x6+-parseInt(_0x577478(0x15b))/0x7*(-parseInt(_0x577478(0x130))/0x8)+parseInt(_0x577478(0x14f))/0x9*(-parseInt(_0x577478(0x135))/0xa)+-parseInt(_0x577478(0x14a))/0xb;if(_0x2dcc0a===_0x288727)break;else _0x330551['push'](_0x330551['shift']());}catch(_0x1465b9){_0x330551['push'](_0x330551['shift']());}}}(a159_0x5aea,0xd11af));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=a159_0x4cc746(0x134);export function buildSqlLockEntry(_0x531adb,_0x2c87ba,_0x4bdc59,_0x5314d9){const _0x143d89=a159_0x4cc746,_0xa82993=detectSqlMode(_0x2c87ba);return{'path':buildSqlRelativePath(_0x531adb['sqlCode'],_0x531adb[_0x143d89(0x149)],_0x5314d9?.[_0x143d89(0x131)],_0xa82993,_0x531adb[_0x143d89(0x146)]),'hash':_0x4bdc59,'remoteId':_0x531adb['id'],'version':_0x531adb['version'],'dbId':Number(_0x531adb['dbId']),'dbName':_0x5314d9?.['dbName'],'sqlName':_0x531adb['sqlName'],'sqlConfig':_0x531adb[_0x143d89(0x14d)]??undefined,'mode':_0xa82993};}export function cloneSqlLockData(_0x12f302){const _0x5ab176=a159_0x4cc746;return{'apps':Object[_0x5ab176(0x14c)](Object[_0x5ab176(0x132)](_0x12f302[_0x5ab176(0x13a)])['map'](([_0x3049cb,_0x49f8e7])=>[_0x3049cb,{'sqlRoot':_0x49f8e7['sqlRoot'],'lastSync':_0x49f8e7[_0x5ab176(0x159)],'sqls':{..._0x49f8e7[_0x5ab176(0x13d)]}}]))};}export function ensureRemoteSqlContent(_0x39fb03){const _0x51707d=a159_0x4cc746;return _0x39fb03[_0x51707d(0x155)]??'';}export function buildLocalSqlFileContent(_0x4c7cd8,_0x5423a5,_0x56285b){const _0x5a44d1=a159_0x4cc746,_0x5f42e8=_0x56285b?.['mode']??detectSqlMode(_0x5423a5),_0x21fac3=stripLocalSqlMetadata(_0x5423a5,_0x5f42e8)[_0x5a44d1(0x14e)](),_0x43388b=[...buildMetadataHeaderLines({'sqlCode':_0x4c7cd8[_0x5a44d1(0x141)],'sqlName':_0x4c7cd8['sqlName'],'dbId':_0x4c7cd8[_0x5a44d1(0x146)],'dbName':_0x56285b?.[_0x5a44d1(0x131)],'mode':_0x5f42e8,'syncedAt':_0x56285b?.['syncedAt'],'description':_0x56285b?.[_0x5a44d1(0x158)]},_0x5f42e8),'',_0x21fac3],_0x4d8649=_0x43388b[_0x5a44d1(0x13b)]('\x0a');return _0x4d8649[_0x5a44d1(0x133)]('\x0a')?_0x4d8649:_0x4d8649+'\x0a';}export function stripLocalSqlMetadata(_0x50b200,_0x4caa6b){const _0x4a4234=a159_0x4cc746,_0x42dd1a=_0x50b200[_0x4a4234(0x150)](/\r\n/g,'\x0a')[_0x4a4234(0x145)]('\x0a'),_0x2bed8d=[];let _0xa5953a=0x0;if(_0x4caa6b===_0x4a4234(0x15c))while(_0xa5953a<_0x42dd1a[_0x4a4234(0x156)]){const _0x7a46ad=_0x42dd1a[_0xa5953a]??'';if(/^\s*<!--\s*@lovrabet\./[_0x4a4234(0x15a)](_0x7a46ad)){_0xa5953a++;continue;}if(_0x7a46ad[_0x4a4234(0x14e)]()===''&&_0xa5953a>0x0){_0xa5953a++;continue;}break;}else while(_0xa5953a<_0x42dd1a[_0x4a4234(0x156)]){const _0x330449=_0x42dd1a[_0xa5953a]??'';if(/^\s*--\s*@lovrabet\./[_0x4a4234(0x15a)](_0x330449)){_0xa5953a++;continue;}if(_0x330449[_0x4a4234(0x14e)]()===''&&_0xa5953a>0x0){_0xa5953a++;continue;}break;}for(;_0xa5953a<_0x42dd1a[_0x4a4234(0x156)];_0xa5953a++){_0x2bed8d['push'](_0x42dd1a[_0xa5953a]);}return _0x2bed8d[_0x4a4234(0x13b)]('\x0a')[_0x4a4234(0x137)]();}export function resolveSqlMode(_0x3677d1,_0x56a600){const _0xbf8fbc=a159_0x4cc746;if(_0x56a600?.[_0xbf8fbc(0x13e)])return _0x56a600[_0xbf8fbc(0x13e)];return detectSqlMode(_0x3677d1);}export function resolveSqlFileName(_0x2b59e3,_0x24c0e1,_0x5c41da){const _0x2c1978=a159_0x4cc746;if(_0x5c41da?.[_0x2c1978(0x147)])return _0x5c41da[_0x2c1978(0x147)];if(_0x5c41da?.[_0x2c1978(0x149)]||_0x5c41da?.['dbName'])return buildSqlRelativePath(_0x2b59e3,_0x5c41da?.[_0x2c1978(0x149)],_0x5c41da?.[_0x2c1978(0x131)],resolveSqlMode(_0x24c0e1,_0x5c41da),_0x5c41da?.[_0x2c1978(0x146)]);return buildDefaultSqlFileName(_0x2b59e3,resolveSqlMode(_0x24c0e1,_0x5c41da));}export function resolveSqlLocalDir(_0x3f5045,_0x403c3e){return join(_0x3f5045,SQL_LOCAL_REL_DIR,_0x403c3e);}export async function confirmForceOverwrite(_0x242f9e){const _0x2b34fb=a159_0x4cc746,_0x1aae31=createInterface({'input':process['stdin'],'output':process[_0x2b34fb(0x157)]}),_0x352e91=await new Promise(_0x3085dc=>{const _0x5698d5=_0x2b34fb;_0x1aae31[_0x5698d5(0x138)](_0x242f9e+_0x5698d5(0x148),_0x3085dc);});return _0x1aae31['close'](),['y',_0x2b34fb(0x152)]['includes'](_0x352e91[_0x2b34fb(0x14e)]()[_0x2b34fb(0x13f)]());}function a159_0x2015(_0x5a0d1d,_0x19f870){_0x5a0d1d=_0x5a0d1d-0x130;const _0x5aea4e=a159_0x5aea();let _0x20154=_0x5aea4e[_0x5a0d1d];return _0x20154;}function a159_0x5aea(){const _0x51aa12=['.rabetbase/sql','30JjAeMf','15sDObLp','trimStart','question','5860050BOsmgs','apps','join','1167340WHNsOk','sqls','mode','toLowerCase','\x20-->','sqlCode','filter','syncedAt','4378085DpQVDC','split','dbId','path','\x20[y/N]\x20','sqlName','37418612tclTDp','<!--\x20@lovrabet.','fromEntries','sqlConfig','trim','3548007LFKEFG','replace','301066YGbEoC','yes','4oMXsym','map','sqlContent','length','stderr','description','lastSync','test','10690799ERWXhi','mybatisXml','8FtQleA','dbName','entries','endsWith'];a159_0x5aea=function(){return _0x51aa12;};return a159_0x5aea();}export function findSqlLockScope(_0x2e7525,_0x1204b6){const _0x1e9f21=a159_0x4cc746;return _0x2e7525[_0x1e9f21(0x13a)][_0x1204b6];}function buildMetadataHeaderLines(_0x2c2a75,_0x43dd35){const _0x575cfe=a159_0x4cc746,_0x117a16=[['sqlCode',_0x2c2a75[_0x575cfe(0x141)]],['sqlName',_0x2c2a75[_0x575cfe(0x149)]],['dbId',_0x2c2a75[_0x575cfe(0x146)]],[_0x575cfe(0x131),_0x2c2a75['dbName']],[_0x575cfe(0x13e),_0x2c2a75[_0x575cfe(0x13e)]],['syncedAt',_0x2c2a75[_0x575cfe(0x143)]],[_0x575cfe(0x158),_0x2c2a75[_0x575cfe(0x158)]]];if(_0x43dd35===_0x575cfe(0x15c))return _0x117a16[_0x575cfe(0x142)](([,_0x52acf3])=>_0x52acf3!==undefined&&_0x52acf3!==null&&String(_0x52acf3)[_0x575cfe(0x14e)]()!=='')[_0x575cfe(0x154)](([_0x4c4946,_0x52fc87])=>_0x575cfe(0x14b)+_0x4c4946+':\x20'+String(_0x52fc87)+_0x575cfe(0x140));return _0x117a16[_0x575cfe(0x142)](([,_0x588889])=>_0x588889!==undefined&&_0x588889!==null&&String(_0x588889)[_0x575cfe(0x14e)]()!=='')[_0x575cfe(0x154)](([_0x4ce1b9,_0x430334])=>'--\x20@lovrabet.'+_0x4ce1b9+':\x20'+String(_0x430334));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a160_0x3ff90b=a160_0x929f;(function(_0xb2f12,_0x3b9641){const _0xd8f84e=a160_0x929f,_0xabfb9c=_0xb2f12();while(!![]){try{const _0x416f86=parseInt(_0xd8f84e(0xa8))/0x1+-parseInt(_0xd8f84e(0xbb))/0x2*(parseInt(_0xd8f84e(0xba))/0x3)+-parseInt(_0xd8f84e(0xb1))/0x4+parseInt(_0xd8f84e(0xac))/0x5*(-parseInt(_0xd8f84e(0xa1))/0x6)+parseInt(_0xd8f84e(0x9f))/0x7*(parseInt(_0xd8f84e(0x9e))/0x8)+-parseInt(_0xd8f84e(0xab))/0x9+-parseInt(_0xd8f84e(0x9d))/0xa*(-parseInt(_0xd8f84e(0xad))/0xb);if(_0x416f86===_0x3b9641)break;else _0xabfb9c['push'](_0xabfb9c['shift']());}catch(_0x38f7a4){_0xabfb9c['push'](_0xabfb9c['shift']());}}}(a160_0x469a,0xa76a7));import{listSqlQueries}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';function a160_0x469a(){const _0x43abbf=['remote','sqlName','hash','\x20remote-only','push','relativePath','tableData','Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','1924662NzIZkd','4PIzIlG','has','length','sqls','\x20added,\x20','lockKey','\x20unchanged','70UeCEkC','8ZwnNqe','3956078IYGlkN','sqlCode','18gsMKLR','All\x20SQL\x20queries\x20are\x20in\x20sync.','paging','status','keys','\x20missing,\x20','path','1153144SdeJmB','bool','map','11819034bCQoqt','265125sweZkO','3367507COxOLk','Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally','sqlRoot','appCode','1680452waaoCZ'];a160_0x469a=function(){return _0x43abbf;};return a160_0x469a();}import{computeSqlFileHash}from'../../core/sql-sync/hash.js';function a160_0x929f(_0x41821f,_0x1dfec6){_0x41821f=_0x41821f-0x99;const _0x469a80=a160_0x469a();let _0x929fc4=_0x469a80[_0x41821f];return _0x929fc4;}import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile}from'../../core/sql-sync/lock.js';const PAGE_SIZE=0x64;async function fetchAllSqlCodes(_0x31aa3d){const _0x4429c6=a160_0x929f,_0x57630a=[];let _0x5347a0=0x1;while(!![]){const _0x2ee63b=await listSqlQueries(_0x31aa3d,{'currentPage':_0x5347a0,'pageSize':PAGE_SIZE}),_0x9ac81a=_0x2ee63b[_0x4429c6(0xb8)]??[];_0x57630a[_0x4429c6(0xb6)](..._0x9ac81a[_0x4429c6(0xaa)](_0x12927a=>_0x12927a[_0x4429c6(0xa0)]));if(_0x9ac81a['length']===0x0)break;const _0x50c9ba=_0x2ee63b[_0x4429c6(0xa3)]?.['totalCount'];if(_0x50c9ba!=null?_0x57630a['length']>=_0x50c9ba:_0x9ac81a[_0x4429c6(0xbd)]<PAGE_SIZE)break;_0x5347a0++;}return _0x57630a;}export const sqlStatus={'service':'sql','command':a160_0x3ff90b(0xa4),'description':a160_0x3ff90b(0xb9),'risk':'read','flags':[{'name':'remote','type':'boolean','description':a160_0x3ff90b(0xae)}],async 'execute'(_0x14f0f0){const _0x338892=a160_0x3ff90b,_0x55d542=loadSqlProjectConfig(_0x14f0f0[_0x338892(0xb0)]),_0x3c6ee6=await readSqlLockFile(_0x55d542['lockFilePath']),{appLock:_0x527d3c}=ensureSqlLockScope(_0x3c6ee6??createEmptySqlLock(),_0x55d542[_0x338892(0xb0)],_0x55d542[_0x338892(0xaf)],_0x338892(0xa4)),_0x528827=await scanLocalSqlQueries(_0x55d542),_0x13d0a3=[],_0x416a5f=[],_0x2a8b88=[],_0x52bde5=[],_0x1050b6=new Set(_0x528827[_0x338892(0xaa)](_0x2e5e24=>_0x2e5e24[_0x338892(0x9b)]));for(const _0x1ca730 of _0x528827){const _0x3aeba9=await computeSqlFileHash(_0x1ca730['filePath']),_0x57d74b=_0x527d3c[_0x338892(0x99)][_0x1ca730[_0x338892(0x9b)]],_0x404d8d=!!_0x57d74b&&_0x57d74b[_0x338892(0xa7)]!==_0x1ca730[_0x338892(0xb7)],_0x54e68f=!!_0x57d74b&&!!_0x1ca730[_0x338892(0xb3)]&&_0x57d74b[_0x338892(0xb3)]!==_0x1ca730[_0x338892(0xb3)];if(!_0x57d74b)_0x13d0a3['push'](_0x1ca730[_0x338892(0x9b)]);else _0x57d74b[_0x338892(0xb4)]!==_0x3aeba9||_0x404d8d||_0x54e68f?_0x416a5f[_0x338892(0xb6)](_0x1ca730['lockKey']):_0x2a8b88[_0x338892(0xb6)](_0x1ca730[_0x338892(0x9b)]);}for(const _0xc58186 of Object[_0x338892(0xa5)](_0x527d3c[_0x338892(0x99)])){!_0x1050b6[_0x338892(0xbc)](_0xc58186)&&_0x52bde5[_0x338892(0xb6)](_0xc58186);}const _0x58ae64=[];if(_0x14f0f0[_0x338892(0xa9)](_0x338892(0xb2))){const _0x2f8350=await fetchAllSqlCodes(_0x14f0f0[_0x338892(0xb0)]);for(const _0x2039ab of _0x2f8350){!_0x1050b6[_0x338892(0xbc)](_0x2039ab)&&!_0x527d3c[_0x338892(0x99)][_0x2039ab]&&_0x58ae64['push'](_0x2039ab);}}const _0x4c86c5=_0x13d0a3['length']===0x0&&_0x416a5f[_0x338892(0xbd)]===0x0&&_0x52bde5[_0x338892(0xbd)]===0x0&&_0x58ae64[_0x338892(0xbd)]===0x0;return{'ok':!![],'data':{'added':_0x13d0a3,'modified':_0x416a5f,'missing':_0x52bde5,'unchanged':_0x2a8b88,'remoteOnly':_0x58ae64},'message':_0x4c86c5?_0x338892(0xa2):_0x13d0a3[_0x338892(0xbd)]+_0x338892(0x9a)+_0x416a5f['length']+'\x20modified,\x20'+_0x52bde5[_0x338892(0xbd)]+_0x338892(0xa6)+_0x2a8b88['length']+_0x338892(0x9c)+(_0x58ae64[_0x338892(0xbd)]>0x0?',\x20'+_0x58ae64[_0x338892(0xbd)]+_0x338892(0xb5):'')};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a161_0x56a312=a161_0x337e;(function(_0x57b261,_0x43a7e5){const _0x4b9367=a161_0x337e,_0x540342=_0x57b261();while(!![]){try{const _0x103fea=-parseInt(_0x4b9367(0xbb))/0x1*(-parseInt(_0x4b9367(0xa3))/0x2)+parseInt(_0x4b9367(0x9c))/0x3*(-parseInt(_0x4b9367(0xae))/0x4)+-parseInt(_0x4b9367(0xbf))/0x5*(-parseInt(_0x4b9367(0xb4))/0x6)+parseInt(_0x4b9367(0x93))/0x7*(parseInt(_0x4b9367(0xb5))/0x8)+parseInt(_0x4b9367(0xa7))/0x9+-parseInt(_0x4b9367(0xc1))/0xa*(parseInt(_0x4b9367(0xa8))/0xb)+-parseInt(_0x4b9367(0xb3))/0xc;if(_0x103fea===_0x43a7e5)break;else _0x540342['push'](_0x540342['shift']());}catch(_0x3e03b){_0x540342['push'](_0x540342['shift']());}}}(a161_0x23d3,0x95c13));import{readFileSync,existsSync}from'node:fs';import{resolve}from'node:path';import{validateSql}from'../../core/sql-validator.js';import{getDatasetDetail,listDatasets}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{assertDatasetIsDbTableBacked,filterDbTableBackedDatasets}from'../../commands/dataset/capability.js';export const sqlValidate={'service':a161_0x56a312(0xac),'command':a161_0x56a312(0x98),'description':a161_0x56a312(0xba),'risk':a161_0x56a312(0x8f),'flags':[{'name':a161_0x56a312(0xa2),'type':'string','description':a161_0x56a312(0x8e)},{'name':a161_0x56a312(0xac),'type':'string','description':a161_0x56a312(0xaa)},{'name':'schemas','type':'string','description':a161_0x56a312(0xbe)}],async 'execute'(_0x502576){const _0x45f7e5=a161_0x56a312,_0x458a98=_0x502576['str'](_0x45f7e5(0xa2)),_0x56fa95=_0x502576[_0x45f7e5(0xa0)](_0x45f7e5(0xac));if(!_0x458a98&&!_0x56fa95)throw CliErrors[_0x45f7e5(0xaf)](_0x45f7e5(0xa2),_0x45f7e5(0x91));let _0x205daa;if(_0x458a98){const _0x16face=resolve(process[_0x45f7e5(0x97)](),_0x458a98);if(!existsSync(_0x16face))throw CliErrors[_0x45f7e5(0xa5)](_0x45f7e5(0xab)+_0x16face);_0x205daa=readFileSync(_0x16face,_0x45f7e5(0xb1));}else _0x205daa=_0x56fa95;const _0x4d5088=validateSql(_0x205daa),_0x2f1035={'valid':_0x4d5088[_0x45f7e5(0xb7)],'sqlType':_0x4d5088['sqlType'][_0x45f7e5(0xb9)],'isSelectOnly':_0x4d5088[_0x45f7e5(0x9f)][_0x45f7e5(0x94)],'isDangerous':_0x4d5088[_0x45f7e5(0x9f)][_0x45f7e5(0xad)],'tables':_0x4d5088[_0x45f7e5(0xb0)],'parameters':_0x4d5088[_0x45f7e5(0xc2)],'message':_0x4d5088[_0x45f7e5(0x99)]};_0x4d5088[_0x45f7e5(0x9f)][_0x45f7e5(0x95)]&&(_0x2f1035[_0x45f7e5(0x95)]=_0x4d5088[_0x45f7e5(0x9f)]['reason']);const _0x44a68b=_0x502576[_0x45f7e5(0xa0)](_0x45f7e5(0x90));if(_0x44a68b&&_0x4d5088['valid']){const _0x4ede37=_0x44a68b[_0x45f7e5(0xb6)](',')[_0x45f7e5(0x9a)](_0x32aa6c=>_0x32aa6c['trim']())['filter'](Boolean),_0x4637bd=[],_0x4d1574=filterDbTableBackedDatasets(await listDatasets(_0x502576[_0x45f7e5(0x8d)])),_0x31d62b=new Map(_0x4d1574[_0x45f7e5(0x9a)](_0x269bb8=>[_0x269bb8[_0x45f7e5(0xa1)]?.[_0x45f7e5(0xa6)]?.['toLowerCase'](),_0x269bb8]));for(const _0x3b582d of _0x4d5088[_0x45f7e5(0xb0)]){const _0x215395=_0x31d62b['get'](_0x3b582d[_0x45f7e5(0xbd)]());!_0x215395&&_0x4637bd[_0x45f7e5(0xb2)](_0x45f7e5(0x96)+_0x3b582d+_0x45f7e5(0xbc));}for(const _0xccb8a9 of _0x4ede37){let _0x33c330;try{_0x33c330=await getDatasetDetail(_0xccb8a9);}catch{_0x4637bd[_0x45f7e5(0xb2)](_0x45f7e5(0x9b)+_0xccb8a9+'\x22\x20not\x20found\x20or\x20not\x20accessible');continue;}assertDatasetIsDbTableBacked(_0x33c330,_0x45f7e5(0xa4));const _0x11ba37=Array[_0x45f7e5(0x9e)](_0x33c330[_0x45f7e5(0x92)])?_0x33c330[_0x45f7e5(0x92)]:[],_0xb78961=new Set(_0x11ba37[_0x45f7e5(0x9a)](_0x3eff78=>_0x3eff78[_0x45f7e5(0x8c)]?.['toLowerCase']())),_0x22196a=_0x33c330['dbtableConfig']?.[_0x45f7e5(0xa6)]||_0x33c330[_0x45f7e5(0xa6)]||_0xccb8a9;_0x2f1035[_0x45f7e5(0x9d)+_0x22196a]={'code':_0xccb8a9,'tableName':_0x22196a,'fieldCount':_0xb78961[_0x45f7e5(0xb8)],'fields':Array[_0x45f7e5(0xc0)](_0xb78961)};}_0x4637bd[_0x45f7e5(0xa9)]>0x0&&(_0x2f1035['schemaWarnings']=_0x4637bd);}return{'ok':_0x4d5088['valid'],'data':_0x2f1035,'message':_0x4d5088[_0x45f7e5(0x99)]};}};function a161_0x337e(_0x47dab1,_0x48f823){_0x47dab1=_0x47dab1-0x8c;const _0x23d399=a161_0x23d3();let _0x337ed2=_0x23d399[_0x47dab1];return _0x337ed2;}function a161_0x23d3(){const _0x320fa8=['isDangerous','20BIiADw','flagMissing','tables','utf-8','push','19732476sxadhd','6748746qWaxMy','9816YHdQpL','split','valid','size','type','Validate\x20SQL\x20content\x20without\x20saving\x20(type\x20detection,\x20parameter\x20extraction,\x20optional\x20schema\x20check)','468qahYbw','\x22\x20not\x20found\x20in\x20any\x20dataset','toLowerCase','Comma-separated\x20dataset\x20codes\x20to\x20cross-check\x20table/column\x20names\x20against','5otfAPZ','from','1869850sSXQVB','parameters','name','appCode','Path\x20to\x20the\x20SQL\x20file\x20to\x20validate','read','schemas','Provide\x20--file\x20or\x20--sql','fields','1169EOaIJh','isSelectOnly','reason','Table\x20\x22','cwd','validate','message','map','Dataset\x20\x22','199947fYZWaI','schema:','isArray','sqlType','str','dbtableConfig','file','1882BNGicb','SQL\x20schema\x20validation','validation','tableName','9071190TaRKuB','11srPlIp','length','Inline\x20SQL\x20content\x20to\x20validate\x20(alternative\x20to\x20--file)','File\x20not\x20found:\x20','sql'];a161_0x23d3=function(){return _0x320fa8;};return a161_0x23d3();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a162_0x78e0cf=a162_0x45b7;function a162_0x45b7(_0x136b18,_0x3e3c48){_0x136b18=_0x136b18-0xf4;const _0x175667=a162_0x1756();let _0x45b76c=_0x175667[_0x136b18];return _0x45b76c;}(function(_0x2456bc,_0x44c489){const _0xb43cc1=a162_0x45b7,_0x5c5d07=_0x2456bc();while(!![]){try{const _0x28cfcf=parseInt(_0xb43cc1(0xfa))/0x1*(-parseInt(_0xb43cc1(0xf5))/0x2)+parseInt(_0xb43cc1(0x105))/0x3+-parseInt(_0xb43cc1(0xf9))/0x4*(parseInt(_0xb43cc1(0xff))/0x5)+-parseInt(_0xb43cc1(0x102))/0x6*(parseInt(_0xb43cc1(0xfd))/0x7)+-parseInt(_0xb43cc1(0xf6))/0x8*(parseInt(_0xb43cc1(0x103))/0x9)+-parseInt(_0xb43cc1(0xf4))/0xa+parseInt(_0xb43cc1(0xfc))/0xb;if(_0x28cfcf===_0x44c489)break;else _0x5c5d07['push'](_0x5c5d07['shift']());}catch(_0x1fdf45){_0x5c5d07['push'](_0x5c5d07['shift']());}}}(a162_0x1756,0x724e1));function a162_0x1756(){const _0x11234f=['name','Register\x20an\x20app\x20profile\x20in\x20the\x20current\x20workspace\x20(or\x20--global)','6yEjMEJ','1687167TSRanf','add','2252988MEheUS','9090650FktAKe','14MPUAJS','8ADvLdy','write','workspace\x20add','24504dHrjGq','102367UBYAAv','App\x20profile\x20name','27908859COnIpg','3145863GHwmfi','workspace','455aJTFiH'];a162_0x1756=function(){return _0x11234f;};return a162_0x1756();}import{buildAppAddFlags,runAppAdd,validateAppName}from'../../commands/common/app-registry.js';export const workspaceAddDefinition={'service':a162_0x78e0cf(0xfe),'command':a162_0x78e0cf(0x104),'description':a162_0x78e0cf(0x101),'risk':a162_0x78e0cf(0xf7),'requiresAuth':![],'requiresAppCode':![],'args':[{'name':a162_0x78e0cf(0x100),'description':a162_0x78e0cf(0xfb),'required':!![]}],'flags':buildAppAddFlags(),'validate':_0x1255d=>validateAppName(_0x1255d,a162_0x78e0cf(0xf8)),'execute':_0x586c54=>runAppAdd(_0x586c54,a162_0x78e0cf(0xf8))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a163_0x576ad4=a163_0x428a;(function(_0x5a3c17,_0x4ab4f2){const _0x202dd8=a163_0x428a,_0x3491c6=_0x5a3c17();while(!![]){try{const _0x49c704=parseInt(_0x202dd8(0x172))/0x1+parseInt(_0x202dd8(0x165))/0x2*(parseInt(_0x202dd8(0x158))/0x3)+-parseInt(_0x202dd8(0x15e))/0x4+-parseInt(_0x202dd8(0x16e))/0x5*(-parseInt(_0x202dd8(0x16c))/0x6)+-parseInt(_0x202dd8(0x145))/0x7+parseInt(_0x202dd8(0x155))/0x8*(parseInt(_0x202dd8(0x156))/0x9)+-parseInt(_0x202dd8(0x14a))/0xa;if(_0x49c704===_0x4ab4f2)break;else _0x3491c6['push'](_0x3491c6['shift']());}catch(_0x34cad9){_0x3491c6['push'](_0x3491c6['shift']());}}}(a163_0x5ef7,0x4fa4b));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';const WORKSPACE_USAGE=CLI_BIN_NAME+a163_0x576ad4(0x15f),SAFE_PROFILE_KEYS=[a163_0x576ad4(0x152),a163_0x576ad4(0x160),a163_0x576ad4(0x153),a163_0x576ad4(0x15a),a163_0x576ad4(0x179),'riskLevel',a163_0x576ad4(0x157)],workspaceFlags=[{'name':a163_0x576ad4(0x168),'type':a163_0x576ad4(0x162),'description':a163_0x576ad4(0x148)},{'name':'appcode','type':a163_0x576ad4(0x162),'description':a163_0x576ad4(0x15b)},{'name':'env','type':a163_0x576ad4(0x162),'description':'Target\x20environment','enum':[...RABETBASE_ENV_VALUES]},{'name':a163_0x576ad4(0x153),'type':a163_0x576ad4(0x162),'description':a163_0x576ad4(0x14b)},{'name':a163_0x576ad4(0x166),'type':a163_0x576ad4(0x162),'description':a163_0x576ad4(0x144),'enum':[...RABETBASE_OUTPUT_FORMAT_VALUES]},{'name':'pageSize','type':'number','description':'Default\x20page\x20size\x20for\x20this\x20workspace\x20app\x20profile'},{'name':a163_0x576ad4(0x14c),'type':'string','description':a163_0x576ad4(0x161),'enum':[...RISK_LEVEL_VALUES]},{'name':a163_0x576ad4(0x157),'type':a163_0x576ad4(0x162),'description':a163_0x576ad4(0x147)}];function isRecord(_0x35b7cd){const _0x930749=a163_0x576ad4;return!!_0x35b7cd&&typeof _0x35b7cd==='object'&&!Array[_0x930749(0x150)](_0x35b7cd);}function assertValidAppcode(_0x56cb9f){const _0x3d4655=a163_0x576ad4,{valid:_0x4093d7,message:_0x70ed57}=validateAppcode(_0x56cb9f);if(!_0x4093d7)throw CliErrors['validation'](_0x3d4655(0x174)+_0x56cb9f,_0x70ed57);}function sanitizeProfile(_0x534416){if(!isRecord(_0x534416))return{};const _0x41209e={};for(const _0x3c6e0d of SAFE_PROFILE_KEYS){if(_0x534416[_0x3c6e0d]!==undefined)_0x41209e[_0x3c6e0d]=_0x534416[_0x3c6e0d];}return _0x41209e;}function a163_0x5ef7(){const _0x1e33ed=['429499IgzVvb','Pass\x20--appcode\x20<code>,\x20or\x20choose\x20one\x20of:\x20','Invalid\x20appcode:\x20','write','validation','\x20--appcode\x20<code>`.','Missing\x20workspace\x20app\x20selector.','pageSize',').\x20Config:\x20','initialized','Workspace\x20','Default\x20output\x20format\x20for\x20this\x20workspace\x20app\x20profile','3585162DyBoiF','keys','Locale\x20for\x20this\x20workspace\x20app\x20profile','App\x20profile\x20name\x20to\x20use\x20in\x20this\x20workspace','\x22\x20not\x20found.','523310DxtDOL','API\x20directory\x20path\x20for\x20this\x20workspace\x20app\x20profile','riskLevel','project','workspace','workspace.','isArray','trim','appcode','apiDir','Use\x20`','24ePYYcH','1117179tpJelu','locale','153552ZmZFOL','Switch\x20the\x20current\x20workspace\x20app\x20binding','format','App\x20code\x20to\x20bind\x20to\x20this\x20workspace','flag','str','2421364kHmZnB','\x20workspace\x20<init|use>\x20--app\x20<name>\x20[--appcode\x20<code>]','env','Risk\x20level\x20for\x20this\x20workspace\x20app\x20profile','string','apps','\x20workspace\x20use\x20--app\x20<name>`.','22zPcnPF','defaultFormat','defaultApp','app','init','.\x20Credentials:\x20not\x20written.','use','1194YHWYbo','updated','3295ShngKs','globalConfig','\x20workspace\x20init\x20--appcode\x20<code>`\x20or\x20`','\x20(appcode:\x20'];a163_0x5ef7=function(){return _0x1e33ed;};return a163_0x5ef7();}function cloneProfile(_0x3aa957){return isRecord(_0x3aa957)?{..._0x3aa957}:{};}function a163_0x428a(_0x4276ff,_0x262577){_0x4276ff=_0x4276ff-0x142;const _0x5ef722=a163_0x5ef7();let _0x428a41=_0x5ef722[_0x4276ff];return _0x428a41;}function collectWorkspaceProfileOverrides(_0x14227a){const _0xa31753=a163_0x576ad4,_0x436fb3={},_0xb3f71=_0x14227a[_0xa31753(0x15d)](_0xa31753(0x160)),_0x54c849=_0x14227a[_0xa31753(0x15d)](_0xa31753(0x153)),_0x13c392=_0x14227a[_0xa31753(0x15d)](_0xa31753(0x166)),_0x1d4841=_0x14227a[_0xa31753(0x15c)](_0xa31753(0x179)),_0x2467d6=_0x14227a[_0xa31753(0x15d)]('riskLevel'),_0x351e0b=_0x14227a['str']('locale');if(_0xb3f71)_0x436fb3[_0xa31753(0x160)]=_0xb3f71;if(_0x54c849)_0x436fb3[_0xa31753(0x153)]=_0x54c849;if(_0x13c392)_0x436fb3[_0xa31753(0x15a)]=_0x13c392;if(_0x1d4841!==undefined&&_0x1d4841!=='')_0x436fb3['pageSize']=Number(_0x1d4841);if(_0x2467d6)_0x436fb3[_0xa31753(0x14c)]=_0x2467d6;if(_0x351e0b)_0x436fb3[_0xa31753(0x157)]=_0x351e0b;return _0x436fb3;}async function validateWorkspaceArgs(_0x17f2a3){const _0x5e493b=a163_0x576ad4,_0x570db4=_0x17f2a3[_0x5e493b(0x15d)](_0x5e493b(0x168))[_0x5e493b(0x151)](),_0x1db4f2=_0x17f2a3[_0x5e493b(0x15d)](_0x5e493b(0x152))[_0x5e493b(0x151)]();if(!_0x570db4&&!_0x1db4f2)throw CliErrors[_0x5e493b(0x176)](_0x5e493b(0x178),_0x5e493b(0x154)+CLI_BIN_NAME+_0x5e493b(0x170)+CLI_BIN_NAME+_0x5e493b(0x164));if(_0x1db4f2)assertValidAppcode(_0x1db4f2);}function resolveKnownApps(){const _0x2f5521=a163_0x576ad4,{config:_0x56bf70,layers:_0x52d66a}=readRawConfigWithLayers(),_0xfbb323=isRecord(_0x56bf70[_0x2f5521(0x163)])?_0x56bf70[_0x2f5521(0x163)]:{},_0x3fc369=isRecord(_0x52d66a[_0x2f5521(0x16f)]['apps'])?_0x52d66a[_0x2f5521(0x16f)][_0x2f5521(0x163)]:{};return{..._0x3fc369,..._0xfbb323};}async function configureWorkspace(_0x1f8d0e,_0x3753e1){const _0x2146e0=a163_0x576ad4,_0x4bd885=_0x1f8d0e[_0x2146e0(0x15d)](_0x2146e0(0x168))['trim'](),_0x38b0b6=_0x1f8d0e[_0x2146e0(0x15d)]('appcode')[_0x2146e0(0x151)](),_0x262b01=_0x4bd885||_0x38b0b6;if(!_0x262b01)throw CliErrors[_0x2146e0(0x176)](_0x2146e0(0x178),_0x2146e0(0x154)+CLI_BIN_NAME+_0x2146e0(0x170)+CLI_BIN_NAME+_0x2146e0(0x164));if(_0x38b0b6)assertValidAppcode(_0x38b0b6);const _0xf95568=resolveWriteConfigPath(_0x2146e0(0x14d)),_0x2b90cf=readConfigFile(_0xf95568),_0x36e3c3=resolveKnownApps(),_0x232574=isRecord(_0x2b90cf[_0x2146e0(0x163)])?{..._0x2b90cf['apps']}:{},_0x5c3b4d=cloneProfile(_0x232574[_0x262b01]),_0x3c100=sanitizeProfile(_0x36e3c3[_0x262b01]),_0x71b86d=_0x38b0b6?{}:_0x3c100,_0x89037f=_0x38b0b6||_0x71b86d[_0x2146e0(0x152)];if(!_0x89037f){const _0x307335=Object[_0x2146e0(0x146)](_0x36e3c3),_0x19461d=_0x307335['length']===0x0?_0x2146e0(0x154)+CLI_BIN_NAME+'\x20workspace\x20'+_0x3753e1+'\x20--app\x20'+_0x262b01+_0x2146e0(0x177):_0x2146e0(0x173)+_0x307335['join'](',\x20');throw CliErrors['validation']('App\x20\x22'+_0x262b01+_0x2146e0(0x149),_0x19461d);}assertValidAppcode(String(_0x89037f));const _0x1c4589={..._0x71b86d,..._0x5c3b4d,'appcode':String(_0x89037f),...collectWorkspaceProfileOverrides(_0x1f8d0e)};return _0x232574[_0x262b01]=_0x1c4589,_0x2b90cf[_0x2146e0(0x163)]=_0x232574,_0x2b90cf[_0x2146e0(0x167)]=_0x262b01,delete _0x2b90cf['appcode'],delete _0x2b90cf[_0x2146e0(0x168)],_0x1c4589[_0x2146e0(0x160)]&&(_0x2b90cf[_0x2146e0(0x160)]=_0x1c4589['env']),writeConfigFile(_0xf95568,_0x2b90cf),{'ok':!![],'message':_0x2146e0(0x143)+(_0x3753e1===_0x2146e0(0x169)?_0x2146e0(0x142):_0x2146e0(0x16d))+':\x20'+_0x262b01+_0x2146e0(0x171)+_0x1c4589[_0x2146e0(0x152)]+_0x2146e0(0x17a)+_0xf95568+_0x2146e0(0x16a),'data':{'operation':_0x2146e0(0x14f)+_0x3753e1,'configPath':_0xf95568,'app':_0x262b01,'appcode':_0x1c4589[_0x2146e0(0x152)],'env':_0x1c4589[_0x2146e0(0x160)]??null,'credentialsWritten':![]}};}const workspaceInitDefinition={'service':a163_0x576ad4(0x14e),'command':a163_0x576ad4(0x169),'description':'Initialize\x20the\x20current\x20workspace\x20app\x20binding','risk':a163_0x576ad4(0x175),'requiresAuth':![],'requiresAppCode':![],'args':[],'flags':workspaceFlags,'validate':validateWorkspaceArgs,'execute':_0x1dfdee=>configureWorkspace(_0x1dfdee,a163_0x576ad4(0x169))},workspaceUseDefinition={'service':a163_0x576ad4(0x14e),'command':'use','description':a163_0x576ad4(0x159),'risk':a163_0x576ad4(0x175),'requiresAuth':![],'requiresAppCode':![],'args':[],'flags':workspaceFlags,'validate':validateWorkspaceArgs,'execute':_0x1040d3=>configureWorkspace(_0x1040d3,a163_0x576ad4(0x16b))};export const workspaceDefinitions=[workspaceInitDefinition,workspaceUseDefinition,workspaceAddDefinition,workspaceRemoveDefinition];export{WORKSPACE_USAGE};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a164_0x511a(_0x33b9be,_0x3319bf){_0x33b9be=_0x33b9be-0xd7;const _0x341968=a164_0x3419();let _0x511a85=_0x341968[_0x33b9be];return _0x511a85;}const a164_0x320af0=a164_0x511a;(function(_0x4144d1,_0x2f23fc){const _0x48ac6b=a164_0x511a,_0x5c96c6=_0x4144d1();while(!![]){try{const _0x94d0b3=parseInt(_0x48ac6b(0xe3))/0x1*(-parseInt(_0x48ac6b(0xdc))/0x2)+-parseInt(_0x48ac6b(0xdf))/0x3+parseInt(_0x48ac6b(0xe0))/0x4+-parseInt(_0x48ac6b(0xde))/0x5+-parseInt(_0x48ac6b(0xe1))/0x6+parseInt(_0x48ac6b(0xdb))/0x7+-parseInt(_0x48ac6b(0xe2))/0x8*(-parseInt(_0x48ac6b(0xd7))/0x9);if(_0x94d0b3===_0x2f23fc)break;else _0x5c96c6['push'](_0x5c96c6['shift']());}catch(_0x3d19cf){_0x5c96c6['push'](_0x5c96c6['shift']());}}}(a164_0x3419,0xa66cb));function a164_0x3419(){const _0x175cfd=['3975710NvPsCH','3152355YXtvdA','2707900HrXTTU','2137224SIJKKN','23720768QFQaUN','1REjENQ','name','9xnDMps','Remove\x20an\x20app\x20profile\x20from\x20the\x20current\x20workspace\x20(or\x20--global)','workspace\x20remove','remove','3716538pNcUPy','2578398CjLtGE','workspace'];a164_0x3419=function(){return _0x175cfd;};return a164_0x3419();}import{buildAppRemoveFlags,runAppRemove,validateAppName}from'../../commands/common/app-registry.js';export const workspaceRemoveDefinition={'service':a164_0x320af0(0xdd),'command':a164_0x320af0(0xda),'description':a164_0x320af0(0xd8),'risk':'high-risk-write','requiresAuth':![],'requiresAppCode':![],'args':[{'name':a164_0x320af0(0xe4),'description':'App\x20profile\x20name\x20to\x20remove','required':!![]}],'flags':buildAppRemoveFlags(),'validate':_0x776a4d=>validateAppName(_0x776a4d,a164_0x320af0(0xd9)),'execute':_0x404e0d=>runAppRemove(_0x404e0d,a164_0x320af0(0xd9))};
|
package/lib/config/schema.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a165_0x15935e=a165_0x5aa7;(function(_0x1083c4,_0x18a4bc){const _0x2cc202=a165_0x5aa7,_0x270090=_0x1083c4();while(!![]){try{const _0x56d979=parseInt(_0x2cc202(0x187))/0x1*(parseInt(_0x2cc202(0x172))/0x2)+parseInt(_0x2cc202(0x17b))/0x3+parseInt(_0x2cc202(0x18a))/0x4*(-parseInt(_0x2cc202(0x16c))/0x5)+parseInt(_0x2cc202(0x179))/0x6+parseInt(_0x2cc202(0x176))/0x7+parseInt(_0x2cc202(0x190))/0x8*(-parseInt(_0x2cc202(0x18b))/0x9)+-parseInt(_0x2cc202(0x180))/0xa*(parseInt(_0x2cc202(0x18c))/0xb);if(_0x56d979===_0x18a4bc)break;else _0x270090['push'](_0x270090['shift']());}catch(_0x2a84dc){_0x270090['push'](_0x270090['shift']());}}}(a165_0x269c,0x4b0b5));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=[a165_0x15935e(0x185),a165_0x15935e(0x17a),'locale',a165_0x15935e(0x178),a165_0x15935e(0x17f)];export const TOP_LEVEL_CONFIG_KEYS=new Set([a165_0x15935e(0x16a),'env',a165_0x15935e(0x16e),a165_0x15935e(0x178),a165_0x15935e(0x185),a165_0x15935e(0x17a),'apiDir']);export const CONFIG_ENUM_VALUES={'env':[...RABETBASE_ENV_VALUES],'format':[...RABETBASE_OUTPUT_FORMAT_VALUES]};export function formatConfigKeyList(_0x14914c){const _0x3906a0=a165_0x15935e;return[..._0x14914c][_0x3906a0(0x182)](',\x20');}export function getTopLevelConfigKeyList(){return[...TOP_LEVEL_CONFIG_KEYS];}export function isTopLevelConfigKey(_0x3d7490){const _0x218e4c=a165_0x15935e;return TOP_LEVEL_CONFIG_KEYS[_0x218e4c(0x171)](_0x3d7490);}export function getTopLevelConfigKeySummary(){return formatConfigKeyList(getTopLevelConfigKeyList());}function a165_0x5aa7(_0x4b04c1,_0x54abfa){_0x4b04c1=_0x4b04c1-0x16a;const _0x269cd5=a165_0x269c();let _0x5aa793=_0x269cd5[_0x4b04c1];return _0x5aa793;}export function getConfigCommandKeyDescription(){return'Config\x20key\x20('+getTopLevelConfigKeySummary()+')';}export const APP_PROFILE_FLAG_KEY_MAP={'env':'env','apiDir':'apiDir','cookie':a165_0x15935e(0x185),'accessKey':a165_0x15935e(0x17a),'defaultFormat':a165_0x15935e(0x178),'pageSize':a165_0x15935e(0x16d),'riskLevel':a165_0x15935e(0x17f),'locale':a165_0x15935e(0x16e)};export function getAppProfileFlagDefs(){const _0x5d6797=a165_0x15935e;return[{'name':_0x5d6797(0x183),'type':_0x5d6797(0x17c),'description':'Target\x20environment','enum':[...RABETBASE_ENV_VALUES]},{'name':_0x5d6797(0x188),'type':_0x5d6797(0x17c),'description':_0x5d6797(0x18e)},{'name':'cookie','type':_0x5d6797(0x17c),'description':_0x5d6797(0x16f),'hidden':!![]},{'name':'accessKey','type':_0x5d6797(0x17c),'description':'Access\x20key','hidden':!![]},{'name':'defaultFormat','type':'string','description':'Default\x20output\x20format\x20for\x20this\x20app\x20(profile)','enum':[...RABETBASE_OUTPUT_FORMAT_VALUES]},{'name':_0x5d6797(0x16d),'type':_0x5d6797(0x16b),'description':'Default\x20page\x20size'},{'name':_0x5d6797(0x17f),'type':_0x5d6797(0x17c),'description':_0x5d6797(0x18d),'enum':[...RISK_LEVEL_VALUES]},{'name':_0x5d6797(0x16e),'type':'string','description':_0x5d6797(0x181)}];}export function collectAppProfileOverrides(_0x203d2a){const _0x3c225c=a165_0x15935e,_0x93e724={};for(const [_0x54f700,_0xbb5861]of Object[_0x3c225c(0x174)](APP_PROFILE_FLAG_KEY_MAP)){const _0x13435e=_0x203d2a(_0x54f700);if(!_0x13435e)continue;_0x93e724[_0xbb5861]=_0xbb5861==='pageSize'?Number(_0x13435e):_0x13435e;}return _0x93e724;}function a165_0x269c(){const _0x305d03=['inherit','has','75918jtnlGH','trim','entries','zh-CN','2212098XBoajW','toLowerCase','format','1080006hdrMfj','accessKey','1777347nqcDLa','string','en-US','keys','riskLevel','82990vKmNNu','Locale','join','env','apps','cookie','app','11XEYMxz','apiDir','map','8204QcNfMv','158913DcldZQ','561qCgHrU','Risk\x20level','API\x20directory\x20path','defaultApp','224pSfmzS','appcode','number','685pfKbhr','pageSize','locale','Auth\x20cookie'];a165_0x269c=function(){return _0x305d03;};return a165_0x269c();}export function buildAppProfileListFields(_0x3fb317){const _0x46c46e=a165_0x15935e;return{'env':_0x3fb317[_0x46c46e(0x183)]??null,'apiDir':_0x3fb317[_0x46c46e(0x188)]??null,'hasCookie':!!_0x3fb317[_0x46c46e(0x185)],'hasAccessKey':!!_0x3fb317['accessKey'],'format':_0x3fb317['format']??null,'pageSize':_0x3fb317[_0x46c46e(0x16d)]??null,'riskLevel':_0x3fb317[_0x46c46e(0x17f)]??null,'locale':_0x3fb317[_0x46c46e(0x16e)]??null};}export function buildAppDoctorFields(_0x4a5b4a,_0x456b8b){const _0xee1c5e=a165_0x15935e;return{'env':{'value':_0x4a5b4a[_0xee1c5e(0x183)]||_0x456b8b[_0xee1c5e(0x183)],'source':_0x4a5b4a['env']?_0xee1c5e(0x186):_0xee1c5e(0x170)},'apiDir':{'value':_0x4a5b4a[_0xee1c5e(0x188)]||_0x456b8b[_0xee1c5e(0x188)],'source':_0x4a5b4a[_0xee1c5e(0x188)]?_0xee1c5e(0x186):_0xee1c5e(0x170)},'cookie':{'value':_0x4a5b4a[_0xee1c5e(0x185)]||_0x456b8b['cookie'],'source':_0x4a5b4a['cookie']?'app':_0xee1c5e(0x170)},'accessKey':{'value':_0x4a5b4a['accessKey']||_0x456b8b['accessKey'],'source':_0x4a5b4a[_0xee1c5e(0x17a)]?_0xee1c5e(0x186):_0xee1c5e(0x170)}};}export function buildCanonicalAppConfig(_0xd5011f,_0x4423fd){const _0x437941=a165_0x15935e,_0x1d243e=_0xd5011f[_0x437941(0x189)](_0x3aa27e=>String(_0x3aa27e||'')[_0x437941(0x173)]())['filter'](Boolean);if(_0x1d243e['length']===0x0)return{};const _0x197325={};for(const _0x1de1a5 of _0x1d243e){_0x197325[_0x1de1a5]=_0x4423fd?{'appcode':_0x1de1a5,'env':_0x4423fd}:{'appcode':_0x1de1a5};}return{'apps':_0x197325,'defaultApp':_0x1d243e[0x0]};}export function buildCanonicalProjectConfig(_0x165e85,_0x581242){const _0x19f64c=a165_0x15935e,{appCodes:appCodes=[],env:_0x3629b2,metadata:_0x17b770}=_0x581242,_0x223da1={..._0x165e85,..._0x17b770||{}};delete _0x223da1[_0x19f64c(0x16a)],delete _0x223da1[_0x19f64c(0x186)];if(_0x3629b2)_0x223da1[_0x19f64c(0x183)]=_0x3629b2;else!_0x223da1[_0x19f64c(0x183)]&&(_0x223da1[_0x19f64c(0x183)]=DEFAULT_CONFIG_VALUES[_0x19f64c(0x183)]);const _0x459061=buildCanonicalAppConfig(appCodes,_0x223da1[_0x19f64c(0x183)]);return Object[_0x19f64c(0x17e)](_0x459061)['length']>0x0&&(_0x223da1[_0x19f64c(0x184)]=_0x459061['apps'],_0x223da1['defaultApp']=_0x459061[_0x19f64c(0x18f)]),_0x223da1;}const LOCALE_MAP={'zh':'zh-CN','zh-cn':a165_0x15935e(0x175),'zh_cn':'zh-CN','en':'en-US','en-us':a165_0x15935e(0x17d),'en_us':a165_0x15935e(0x17d)};export function normalizeLocale(_0x4eeea9){const _0x41a3e9=a165_0x15935e;if(!_0x4eeea9)return null;return LOCALE_MAP[_0x4eeea9[_0x41a3e9(0x177)]()]??null;}
|
package/lib/constant/cdn.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a166_0x2dd3(_0x3f7111,_0x419456){_0x3f7111=_0x3f7111-0x17d;const _0x5483bf=a166_0x5483();let _0x2dd318=_0x5483bf[_0x3f7111];return _0x2dd318;}const a166_0x37e199=a166_0x2dd3;(function(_0x47d920,_0x2d4e54){const _0x3f321b=a166_0x2dd3,_0x32091b=_0x47d920();while(!![]){try{const _0x24a74e=parseInt(_0x3f321b(0x17d))/0x1*(-parseInt(_0x3f321b(0x17f))/0x2)+-parseInt(_0x3f321b(0x185))/0x3+-parseInt(_0x3f321b(0x183))/0x4+-parseInt(_0x3f321b(0x180))/0x5+parseInt(_0x3f321b(0x184))/0x6+-parseInt(_0x3f321b(0x17e))/0x7+-parseInt(_0x3f321b(0x181))/0x8*(-parseInt(_0x3f321b(0x182))/0x9);if(_0x24a74e===_0x2d4e54)break;else _0x32091b['push'](_0x32091b['shift']());}catch(_0x559e2b){_0x32091b['push'](_0x32091b['shift']());}}}(a166_0x5483,0x19463));function a166_0x5483(){const _0x50ef78=['54eXvgQI','796360aQakid','137244LgxYQN','354684ETqjhE','https://g.lovrabet.com/dist/rabetbase-cli/config/index.json','58cBQyqg','1344504TVQSXm','1924LsdZiU','1034845lQdjaj','1137072nyQgBZ'];a166_0x5483=function(){return _0x50ef78;};return a166_0x5483();}export const CLI_VERSION_POLICY_URL=a166_0x37e199(0x186);
|