@lovrabet/rabetbase-cli 2.3.14 → 2.3.15-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/api-doc.js +1 -1
- package/lib/api/fetch-model-list.js +1 -1
- package/lib/api/generate-api-file.js +1 -1
- package/lib/auth/auth-server-ui.js +1 -1
- package/lib/auth/auth-server.js +1 -1
- package/lib/auth/constant.js +1 -1
- package/lib/auth/get-cookie.js +1 -1
- package/lib/auth/get-session-user.js +1 -1
- package/lib/auth/is-session-valid.js +1 -1
- package/lib/auth/login-success-html.js +1 -1
- package/lib/auth/logout.js +1 -1
- package/lib/cli-flags.js +1 -1
- package/lib/cli.js +1 -1
- package/lib/commands/api/generate.js +1 -1
- package/lib/commands/api/index.js +1 -1
- package/lib/commands/api/list.js +1 -1
- package/lib/commands/api/pull.js +1 -1
- package/lib/commands/api/shared.js +1 -1
- package/lib/commands/app/add.js +1 -1
- package/lib/commands/app/index.js +1 -1
- package/lib/commands/app/list.js +1 -1
- package/lib/commands/app/remote-directory.js +1 -1
- package/lib/commands/app/remove.js +1 -1
- package/lib/commands/app/shared.js +1 -1
- package/lib/commands/app-config/delete.js +1 -1
- package/lib/commands/app-config/get.js +1 -1
- package/lib/commands/app-config/index.js +1 -1
- package/lib/commands/app-config/list.js +1 -1
- package/lib/commands/app-config/set.js +1 -1
- package/lib/commands/app-config/shared.js +1 -1
- package/lib/commands/auth/index.js +1 -1
- package/lib/commands/bff/create.js +1 -1
- package/lib/commands/bff/delete.js +1 -1
- package/lib/commands/bff/detail.js +1 -1
- package/lib/commands/bff/index.js +1 -1
- package/lib/commands/bff/list.js +1 -1
- package/lib/commands/bff/pull.js +1 -1
- package/lib/commands/bff/push.js +1 -1
- package/lib/commands/bff/status.js +1 -1
- package/lib/commands/cli-skill/index.js +1 -1
- package/lib/commands/cli-update.js +1 -1
- package/lib/commands/codegen/index.js +1 -1
- package/lib/commands/codegen/sdk.js +1 -1
- package/lib/commands/codegen/sql.js +1 -1
- package/lib/commands/common/app-registry.js +1 -1
- package/lib/commands/common/app-selector.js +1 -1
- package/lib/commands/common/async-task.js +1 -1
- package/lib/commands/common/dry-run.js +1 -1
- package/lib/commands/common/flags.js +1 -1
- package/lib/commands/common/local-file.js +1 -1
- package/lib/commands/common/validate.js +1 -1
- package/lib/commands/config/get.js +1 -1
- package/lib/commands/config/index.js +1 -1
- package/lib/commands/config/list.js +1 -1
- package/lib/commands/config/set.js +1 -1
- package/lib/commands/config/shared.js +1 -1
- package/lib/commands/data/filter.js +1 -1
- package/lib/commands/data/getOne.js +1 -1
- package/lib/commands/data/index.js +1 -1
- package/lib/commands/data/shared.js +1 -1
- package/lib/commands/dataset/business-group-update.js +1 -1
- package/lib/commands/dataset/capability.js +1 -1
- package/lib/commands/dataset/delete.js +1 -1
- package/lib/commands/dataset/detail.js +1 -1
- package/lib/commands/dataset/extend-update.js +1 -1
- package/lib/commands/dataset/field-update.js +1 -1
- package/lib/commands/dataset/generate.js +1 -1
- package/lib/commands/dataset/index.js +1 -1
- package/lib/commands/dataset/list.js +1 -1
- package/lib/commands/dataset/operations.js +1 -1
- package/lib/commands/dataset/relation-audit.js +1 -1
- package/lib/commands/dataset/relation-create.js +1 -1
- package/lib/commands/dataset/relation-delete.js +1 -1
- package/lib/commands/dataset/relation-shared.js +1 -1
- package/lib/commands/dataset/relation-update.js +1 -1
- package/lib/commands/dataset/relations.js +1 -1
- package/lib/commands/dataset/rename.js +1 -1
- package/lib/commands/dataset/restore.js +1 -1
- package/lib/commands/db/analysis-batching.js +1 -1
- package/lib/commands/db/analyze-batch-plan.js +1 -1
- package/lib/commands/db/analyze-cancel.js +1 -1
- package/lib/commands/db/analyze-start.js +1 -1
- package/lib/commands/db/analyze-status.js +1 -1
- package/lib/commands/db/create.js +1 -1
- package/lib/commands/db/delete.js +1 -1
- package/lib/commands/db/detail.js +1 -1
- package/lib/commands/db/diff.js +1 -1
- package/lib/commands/db/index.js +1 -1
- package/lib/commands/db/list.js +1 -1
- package/lib/commands/db/shared.js +1 -1
- package/lib/commands/db/tables.js +1 -1
- package/lib/commands/db/test.js +1 -1
- package/lib/commands/db/update.js +1 -1
- package/lib/commands/doctor.js +1 -1
- package/lib/commands/file/index.js +1 -1
- package/lib/commands/init/index.js +1 -1
- package/lib/commands/issue/index.js +1 -1
- package/lib/commands/issue/nudge.js +1 -1
- package/lib/commands/issue/report.js +1 -1
- package/lib/commands/issue/shared.js +1 -1
- package/lib/commands/logs/index.js +1 -1
- package/lib/commands/menu/asset-update.js +1 -1
- package/lib/commands/menu/delete.js +1 -1
- package/lib/commands/menu/external-link-create.js +1 -1
- package/lib/commands/menu/external-link-update.js +1 -1
- package/lib/commands/menu/group-create.js +1 -1
- package/lib/commands/menu/group-update.js +1 -1
- package/lib/commands/menu/index.js +1 -1
- package/lib/commands/menu/list.js +1 -1
- package/lib/commands/menu/move.js +1 -1
- package/lib/commands/menu/regroup-start.js +1 -1
- package/lib/commands/menu/rename.js +1 -0
- package/lib/commands/menu/shared/compare-table.js +1 -1
- package/lib/commands/menu/shared/delete-plan.js +1 -1
- package/lib/commands/menu/shared/facts.js +1 -1
- package/lib/commands/menu/shared/index.js +1 -1
- package/lib/commands/menu/shared/inquirer.js +1 -1
- package/lib/commands/menu/shared/local-pages.js +1 -1
- package/lib/commands/menu/shared/logic.js +1 -1
- package/lib/commands/menu/shared/mutations.js +1 -1
- package/lib/commands/menu/shared/service.js +1 -1
- package/lib/commands/menu/shared/sync-core.js +1 -1
- package/lib/commands/menu/shared/update-core.js +1 -1
- package/lib/commands/menu/shared/valid-url.js +1 -1
- package/lib/commands/menu/sync.js +1 -1
- package/lib/commands/notification/config-list.js +1 -1
- package/lib/commands/notification/index.js +1 -1
- package/lib/commands/ocr/index.js +1 -1
- package/lib/commands/page/generate-start.js +1 -1
- package/lib/commands/page/generate-status.js +1 -1
- package/lib/commands/page/index.js +1 -1
- package/lib/commands/page/pull.js +1 -1
- package/lib/commands/page/push.js +1 -1
- package/lib/commands/page/relation-audit.js +1 -1
- package/lib/commands/page/restore.js +1 -1
- package/lib/commands/page/shared.js +1 -1
- package/lib/commands/page/standard-page-status.js +1 -1
- package/lib/commands/page/sync.js +1 -1
- package/lib/commands/permit/index.js +1 -1
- package/lib/commands/permit/page-get.js +1 -1
- package/lib/commands/permit/page-set.js +1 -1
- package/lib/commands/permit/role-apis-set.js +1 -1
- package/lib/commands/permit/role-menus-set.js +1 -1
- package/lib/commands/permit/role-menus.js +1 -1
- package/lib/commands/permit/shared.js +1 -1
- package/lib/commands/project/create/enhanced-guided-create.js +1 -1
- package/lib/commands/project/create/format-elapsed.js +1 -1
- package/lib/commands/project/create/main.js +1 -1
- package/lib/commands/project/create/non-interactive.js +1 -1
- package/lib/commands/project/create/project-template-path.js +1 -1
- package/lib/commands/project/create/use-copy-project-template.js +1 -1
- package/lib/commands/project/create/use-format-code.js +1 -1
- package/lib/commands/project/create/use-install-dependencies.js +1 -1
- package/lib/commands/project/index.js +1 -1
- package/lib/commands/project/init.js +1 -1
- package/lib/commands/project/upgrade.js +1 -1
- package/lib/commands/registry.js +1 -1
- package/lib/commands/role/create.js +1 -1
- package/lib/commands/role/delete.js +1 -1
- package/lib/commands/role/detail.js +1 -1
- package/lib/commands/role/index.js +1 -1
- package/lib/commands/role/list.js +1 -1
- package/lib/commands/role/shared.js +1 -1
- package/lib/commands/role/update.js +1 -1
- package/lib/commands/role/user-add.js +1 -1
- package/lib/commands/role/user-remove.js +1 -1
- package/lib/commands/role/user-resolve.js +1 -1
- package/lib/commands/run/index.js +1 -1
- package/lib/commands/schema.js +1 -1
- package/lib/commands/sql/create.js +1 -1
- package/lib/commands/sql/delete.js +1 -1
- package/lib/commands/sql/detail.js +1 -1
- package/lib/commands/sql/exec.js +1 -1
- package/lib/commands/sql/index.js +1 -1
- package/lib/commands/sql/list.js +1 -1
- package/lib/commands/sql/pull.js +1 -1
- package/lib/commands/sql/push.js +1 -1
- package/lib/commands/sql/save.js +1 -1
- package/lib/commands/sql/shared.js +1 -1
- package/lib/commands/sql/status.js +1 -1
- package/lib/commands/sql/validate.js +1 -1
- package/lib/commands/task/index.js +1 -1
- package/lib/commands/task/status.js +1 -1
- package/lib/commands/workspace/add.js +1 -1
- package/lib/commands/workspace/index.js +1 -1
- package/lib/commands/workspace/remove.js +1 -1
- package/lib/config/schema.js +1 -1
- package/lib/constant/cdn.js +1 -1
- package/lib/constant/cli.js +1 -1
- package/lib/constant/defaults.js +1 -1
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/constant/output.js +1 -1
- package/lib/constant/paths.js +1 -1
- package/lib/constant/risk.js +1 -1
- package/lib/context/app-resolver.js +1 -1
- package/lib/context/auth-resolver.js +1 -1
- package/lib/context/config-loader.js +1 -1
- package/lib/context.js +1 -1
- package/lib/core/alias-resolver.js +1 -1
- package/lib/core/api-client.js +1 -1
- package/lib/core/bff/config.js +1 -1
- package/lib/core/bff/file-system.js +1 -1
- package/lib/core/bff/hash.js +1 -1
- package/lib/core/bff/lock.js +1 -1
- package/lib/core/bff/utils.js +1 -1
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/page/file-system.js +1 -1
- package/lib/core/page/hash.js +1 -1
- package/lib/core/page/lock.js +1 -1
- package/lib/core/sql-index-auditor.js +1 -1
- package/lib/core/sql-sync/config.js +1 -1
- package/lib/core/sql-sync/file-system.js +1 -1
- package/lib/core/sql-sync/hash.js +1 -1
- package/lib/core/sql-sync/lock.js +1 -1
- package/lib/core/sql-sync/utils.js +1 -1
- package/lib/core/sql-validator.js +1 -1
- package/lib/errors.js +1 -1
- package/lib/framework/build-all-flags.js +1 -1
- package/lib/framework/error-output.js +1 -1
- package/lib/framework/explicit-yes.js +1 -1
- package/lib/framework/flags.js +1 -1
- package/lib/framework/help.js +1 -1
- package/lib/framework/index.js +1 -1
- package/lib/framework/output.js +1 -1
- package/lib/framework/response.js +1 -1
- package/lib/framework/runner-alias.js +1 -1
- package/lib/framework/runner.js +1 -1
- package/lib/framework/schema-export.js +1 -1
- package/lib/framework/types.js +1 -1
- package/lib/generated/build-info.js +1 -1
- package/lib/help.js +1 -1
- package/lib/skills/main.js +1 -1
- package/lib/skills/npx-skills-add.js +1 -1
- package/lib/telemetry/cli-command-trace.js +1 -1
- package/lib/telemetry/cli-help-trace.js +1 -1
- package/lib/telemetry/ensure-cli-otel-config.js +1 -1
- package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
- package/lib/telemetry/send-cli-trace-log.js +1 -1
- package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
- package/lib/utils/ai_config.js +1 -1
- package/lib/utils/apply-jq-filter.js +1 -1
- package/lib/utils/cdn-config.js +1 -1
- package/lib/utils/check-sdk-version.js +1 -1
- package/lib/utils/cli-version-check.js +1 -1
- package/lib/utils/cli-version-policy.js +1 -1
- package/lib/utils/config.js +1 -1
- package/lib/utils/copy-directory.js +1 -1
- package/lib/utils/entity-with-id.js +1 -1
- package/lib/utils/file-utils.js +1 -1
- package/lib/utils/guides-cdn.js +1 -1
- package/lib/utils/http-client.js +1 -1
- package/lib/utils/is-non-interactive.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/params.js +1 -1
- package/lib/utils/platform.js +1 -1
- package/lib/utils/rules-cdn.js +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.js +1 -1
- package/lib/utils/update-notice.js +1 -1
- package/lib/utils/version.js +1 -1
- package/lib/utils/with-active-cookie.js +1 -1
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +1 -1
package/lib/commands/sql/exec.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a173_0x2f5841=a173_0x1ec8;(function(_0x1ba0f9,_0x200ad5){const _0x5762a7=a173_0x1ec8,_0x3997d6=_0x1ba0f9();while(!![]){try{const _0x4039ed=-parseInt(_0x5762a7(0xe1))/0x1+-parseInt(_0x5762a7(0xe7))/0x2+-parseInt(_0x5762a7(0xdc))/0x3+parseInt(_0x5762a7(0xe9))/0x4*(parseInt(_0x5762a7(0xe5))/0x5)+-parseInt(_0x5762a7(0xe4))/0x6+-parseInt(_0x5762a7(0xda))/0x7*(parseInt(_0x5762a7(0xf1))/0x8)+parseInt(_0x5762a7(0xea))/0x9;if(_0x4039ed===_0x200ad5)break;else _0x3997d6['push'](_0x3997d6['shift']());}catch(_0x4dc7aa){_0x3997d6['push'](_0x3997d6['shift']());}}}(a173_0x1cb7,0x5d5a1));import{executeSql}from'../../core/api-client.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';function a173_0x1ec8(_0xe5aa7e,_0x237499){_0xe5aa7e=_0xe5aa7e-0xda;const _0x1cb74f=a173_0x1cb7();let _0x1ec8da=_0x1cb74f[_0xe5aa7e];return _0x1ec8da;}function a173_0x1cb7(){const _0x321311=['3294120CfsIxr','10VxzZPk','execResult','454264ASAdTf','length','247716kFtLIi','19585593DoNerz','str','now','execError','read','sql','\x20row(s)\x20in\x20','8yPBSyR','2016511cMrwWl','execSuccess','802653MVdcZG','appCode','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','isArray','exec','585890QonjkT','sqlcode','params'];a173_0x1cb7=function(){return _0x321311;};return a173_0x1cb7();}import{parseJsonParams}from'../../utils/params.js';export const sqlExec={'service':a173_0x2f5841(0xef),'command':a173_0x2f5841(0xe0),'description':'Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','risk':a173_0x2f5841(0xee),'flags':[SQLCODE_FLAG,{'name':a173_0x2f5841(0xe3),'type':'string','description':a173_0x2f5841(0xde)}],async 'execute'(_0x10c379){const _0x2a4d0e=a173_0x2f5841,_0x558a37=parseJsonParams(_0x10c379[_0x2a4d0e(0xeb)](_0x2a4d0e(0xe3))),_0x16561d=Date[_0x2a4d0e(0xec)](),_0x50f7a3=await executeSql(_0x10c379[_0x2a4d0e(0xdd)],_0x10c379[_0x2a4d0e(0xeb)](_0x2a4d0e(0xe2)),_0x558a37),_0x3f2ad3=Date['now']()-_0x16561d,_0x2d5c88=_0x50f7a3?.[_0x2a4d0e(0xe6)]??_0x50f7a3,_0x51afed=_0x50f7a3?.[_0x2a4d0e(0xdb)]??!![];if(!_0x51afed)return{'ok':![],'data':{'error':_0x50f7a3?.[_0x2a4d0e(0xed)]||'SQL\x20execution\x20failed','elapsed':_0x3f2ad3},'message':'SQL\x20execution\x20failed'};const _0x3a1b63=Array[_0x2a4d0e(0xdf)](_0x2d5c88)?_0x2d5c88:[];return{'ok':!![],'data':{'rows':_0x3a1b63,'rowCount':_0x3a1b63[_0x2a4d0e(0xe8)],'elapsed':_0x3f2ad3},'message':'Returned\x20'+_0x3a1b63['length']+_0x2a4d0e(0xf0)+_0x3f2ad3+'ms'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x38c1b1,_0x440b9f){const _0x4bcdab=a174_0x3219,_0x3a2acb=_0x38c1b1();while(!![]){try{const _0x23b36a=parseInt(_0x4bcdab(0x1df))/0x1*(parseInt(_0x4bcdab(0x1d7))/0x2)+-parseInt(_0x4bcdab(0x1dc))/0x3*(parseInt(_0x4bcdab(0x1db))/0x4)+parseInt(_0x4bcdab(0x1dd))/0x5*(parseInt(_0x4bcdab(0x1de))/0x6)+-parseInt(_0x4bcdab(0x1e2))/0x7*(-parseInt(_0x4bcdab(0x1e1))/0x8)+-parseInt(_0x4bcdab(0x1d9))/0x9+-parseInt(_0x4bcdab(0x1d8))/0xa*(-parseInt(_0x4bcdab(0x1da))/0xb)+-parseInt(_0x4bcdab(0x1e0))/0xc;if(_0x23b36a===_0x440b9f)break;else _0x3a2acb['push'](_0x3a2acb['shift']());}catch(_0x18e960){_0x3a2acb['push'](_0x3a2acb['shift']());}}}(a174_0x5953,0x58332));import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';import{sqlSave}from'../../commands/sql/save.js';import{sqlExec}from'../../commands/sql/exec.js';import{sqlPull}from'../../commands/sql/pull.js';function a174_0x5953(){const _0x1dffd8=['4dLlLbX','392556oCtFNn','185wOaDWK','35844qLDNRP','117dyQNJd','11875080EQNMME','16dVETFE','2081947xyTzdm','5010hzzeyf','39820bLGRtR','766683FxTABt','1265CQAvqd'];a174_0x5953=function(){return _0x1dffd8;};return a174_0x5953();}import{sqlCreate}from'../../commands/sql/create.js';import{sqlStatus}from'../../commands/sql/status.js';import{sqlPush}from'../../commands/sql/push.js';function a174_0x3219(_0xda8ba5,_0x3d184b){_0xda8ba5=_0xda8ba5-0x1d7;const _0x59532b=a174_0x5953();let _0x321952=_0x59532b[_0xda8ba5];return _0x321952;}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
|
-
function
|
|
1
|
+
function a175_0x2a29(_0x6f5b72,_0x48c74a){_0x6f5b72=_0x6f5b72-0xcc;const _0x1c0555=a175_0x1c05();let _0x2a299e=_0x1c0555[_0x6f5b72];return _0x2a299e;}const a175_0x16cad4=a175_0x2a29;function a175_0x1c05(){const _0x4b6852=['bool','568572upzjiw','Found\x20','10CgHkZk','128IhkDMs','No\x20custom\x20SQL\x20queries\x20found.','sqlcode','463836hvzKSD','boolean','all','328372yxbCfy','number','pagesize','sqlCode','string','length','22054Uodfxa','sql','appCode','Filter\x20by\x20SQL\x20name','Page\x20number','7zZPHYG','dbId','map','page','verbose','read','num','27693AqRTsO','77046KYlGNy','paging','Page\x20size','\x20SQL\x20queries\x20(total:\x20','str','1AiifaP','name','348705yDYCfB','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','description'];a175_0x1c05=function(){return _0x4b6852;};return a175_0x1c05();}(function(_0x543209,_0x2e6d8e){const _0x46c576=a175_0x2a29,_0x308129=_0x543209();while(!![]){try{const _0x402560=parseInt(_0x46c576(0xf1))/0x1*(parseInt(_0x46c576(0xdf))/0x2)+parseInt(_0x46c576(0xec))/0x3+parseInt(_0x46c576(0xd0))/0x4+-parseInt(_0x46c576(0xcc))/0x5+parseInt(_0x46c576(0xd6))/0x6*(-parseInt(_0x46c576(0xe4))/0x7)+-parseInt(_0x46c576(0xd3))/0x8*(-parseInt(_0x46c576(0xeb))/0x9)+-parseInt(_0x46c576(0xd2))/0xa*(-parseInt(_0x46c576(0xd9))/0xb);if(_0x402560===_0x2e6d8e)break;else _0x308129['push'](_0x308129['shift']());}catch(_0x2b9ec2){_0x308129['push'](_0x308129['shift']());}}}(a175_0x1c05,0x1b129));import{listSqlQueries}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':a175_0x16cad4(0xe0),'command':'list','description':'List\x20custom\x20SQL\x20queries','risk':a175_0x16cad4(0xe9),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a175_0x16cad4(0xf2),'type':a175_0x16cad4(0xdd),'description':a175_0x16cad4(0xe2)},{'name':a175_0x16cad4(0xe7),'type':'number','description':a175_0x16cad4(0xe3),'default':0x1},{'name':a175_0x16cad4(0xdb),'type':a175_0x16cad4(0xda),'description':a175_0x16cad4(0xee)},{'name':a175_0x16cad4(0xe8),'type':a175_0x16cad4(0xd7),'description':a175_0x16cad4(0xcd)}],async 'execute'(_0x1aecf7){const _0x3ac529=a175_0x16cad4,_0x56039a=await listSqlQueries(_0x1aecf7['appCode'],{'sqlCode':_0x1aecf7[_0x3ac529(0xf0)](_0x3ac529(0xd5))||undefined,'sqlName':_0x1aecf7['str']('name')||undefined,'currentPage':_0x1aecf7[_0x3ac529(0xea)](_0x3ac529(0xe7)),'pageSize':_0x1aecf7['num'](_0x3ac529(0xdb),0x32)}),_0x6baa56=_0x1aecf7[_0x3ac529(0xcf)](_0x3ac529(0xe8)),_0x3c9768=_0x56039a['tableData']??[],_0x2c95e6=_0x56039a[_0x3ac529(0xed)]?.['totalCount']??_0x3c9768[_0x3ac529(0xde)];let _0x51f608;return _0x6baa56?_0x51f608=_0x3c9768:_0x51f608=await Promise[_0x3ac529(0xd8)](_0x3c9768[_0x3ac529(0xe6)](async _0x5e1064=>{const _0x2547cf=_0x3ac529;let _0x37789c;try{_0x37789c=_0x5e1064['dbId']?await getDbName(_0x1aecf7[_0x2547cf(0xe1)],_0x5e1064['dbId']):undefined;}catch{}return{'sqlCode':_0x5e1064[_0x2547cf(0xdc)],'sqlName':_0x5e1064['sqlName'],'description':_0x5e1064[_0x2547cf(0xce)]??'','db':_0x37789c?_0x37789c+'\x20('+_0x5e1064[_0x2547cf(0xe5)]+')':_0x5e1064['dbId']??''};})),{'ok':!![],'data':_0x51f608,'message':_0x3c9768['length']===0x0?_0x3ac529(0xd4):_0x3ac529(0xd1)+_0x3c9768[_0x3ac529(0xde)]+_0x3ac529(0xef)+_0x2c95e6+').'};}};
|
package/lib/commands/sql/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a175_0x5c0b10=a175_0x1283;(function(_0x5532e7,_0x84a1cd){const _0x526418=a175_0x1283,_0x324f7e=_0x5532e7();while(!![]){try{const _0x3df6e4=parseInt(_0x526418(0xf3))/0x1*(-parseInt(_0x526418(0x112))/0x2)+-parseInt(_0x526418(0xf7))/0x3+-parseInt(_0x526418(0x127))/0x4*(parseInt(_0x526418(0xeb))/0x5)+parseInt(_0x526418(0xf6))/0x6+parseInt(_0x526418(0x128))/0x7*(parseInt(_0x526418(0x122))/0x8)+parseInt(_0x526418(0x120))/0x9*(-parseInt(_0x526418(0xfd))/0xa)+parseInt(_0x526418(0x104))/0xb;if(_0x3df6e4===_0x84a1cd)break;else _0x324f7e['push'](_0x324f7e['shift']());}catch(_0x4719ca){_0x324f7e['push'](_0x324f7e['shift']());}}}(a175_0x338a,0x7bac1));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{CliErrors}from'../../errors.js';function a175_0x1283(_0x20a4cb,_0xcab31b){_0x20a4cb=_0x20a4cb-0xeb;const _0x338a73=a175_0x338a();let _0x128365=_0x338a73[_0x20a4cb];return _0x128365;}function a175_0x338a(){const _0xb6d3cc=['description','length','Pull\x20complete:\x20','split','local\x20differs\x20from\x20remote','appCode','Filter\x20by\x20SQL\x20display\x20name','703146UzcyBD','boolean','paging','\x20SQL\x20file(s)\x20into\x20','apps','totalCount','conflict','sqls','filter','mybatisXml','force','sqlCode','sqlContent','utf8','99YBIwDl','test','8CdsCPj','str','No\x20remote\x20SQL\x20queries\x20matched.','nonInteractive','lastSync','320hkktEJ','2103423dfaRbw','28010WZWKRJ','skipped','dbId','Would\x20pull\x20','sqlRootDir','cancelled','\x20skipped,\x20','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','2boEOdt','message','toISOString','2132910tfTPzg','2552235uyqlxo','unchanged','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','\x20written,\x20','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','sql','255160zVkJrC','join','lockFilePath','push','catch','sqlcode','name','23466454oBdmbT','string','Force\x20pull\x20cancelled.','path','bool','tableData','sqlName'];a175_0x338a=function(){return _0xb6d3cc;};return a175_0x338a();}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(_0x4db385,_0x4ef990){const _0xd73da2=a175_0x1283,_0x3e0e6e=[];let _0x44f58a=0x1;while(!![]){const _0x5291b1=await listSqlQueries(_0x4db385,{'currentPage':_0x44f58a,'pageSize':PAGE_SIZE,'sqlCode':_0x4ef990[_0xd73da2(0x11d)],'sqlName':_0x4ef990[_0xd73da2(0x10a)]}),_0x2cddf3=_0x5291b1[_0xd73da2(0x109)]??[];_0x3e0e6e['push'](..._0x2cddf3);if(_0x2cddf3[_0xd73da2(0x10c)]===0x0)break;const _0x10ae12=_0x5291b1[_0xd73da2(0x114)]?.[_0xd73da2(0x117)];if(_0x10ae12!=null?_0x3e0e6e['length']>=_0x10ae12:_0x2cddf3[_0xd73da2(0x10c)]<PAGE_SIZE)break;_0x44f58a++;}return _0x3e0e6e;}async function ensureSqlContent(_0xe32b0b){const _0x162b70=a175_0x1283;if(_0xe32b0b[_0x162b70(0x11e)]!=null&&String(_0xe32b0b['sqlContent'])[_0x162b70(0x10c)]>0x0)return _0xe32b0b;return getSqlQueryDetail(_0xe32b0b[_0x162b70(0x11d)]);}export const sqlPull={'service':a175_0x5c0b10(0xfc),'command':'pull','description':a175_0x5c0b10(0xf2),'risk':'write','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a175_0x5c0b10(0x103),'type':a175_0x5c0b10(0x105),'description':a175_0x5c0b10(0x111)},{'name':a175_0x5c0b10(0x11c),'type':a175_0x5c0b10(0x113),'description':'Force\x20overwrite\x20local\x20unsynced\x20changes'}],async 'dryRun'(_0xeec843){const _0x40feed=a175_0x5c0b10,_0x1082d0=loadSqlProjectConfig(_0xeec843[_0x40feed(0x110)]),_0x19b0fe=await readSqlLockFile(_0x1082d0[_0x40feed(0xff)]),{appLock:_0x4312b3}=ensureSqlLockScope(_0x19b0fe??createEmptySqlLock(),_0x1082d0['appCode'],_0x1082d0['sqlRoot'],'pull'),_0x1183a1=await fetchAllSqlQueries(_0xeec843[_0x40feed(0x110)],{'sqlCode':_0xeec843[_0x40feed(0x123)](_0x40feed(0x102))||undefined,'sqlName':_0xeec843['str'](_0x40feed(0x103))||undefined}),_0x44887c=[];for(const _0x24dc82 of _0x1183a1){const _0x51a2f1=await ensureSqlContent(_0x24dc82),_0x44a1e4=ensureRemoteSqlContent(_0x51a2f1),_0x91f493=detectModeFromSql(_0x51a2f1),_0x793a7=_0x51a2f1[_0x40feed(0xed)]?await getDbName(_0xeec843[_0x40feed(0x110)],Number(_0x51a2f1[_0x40feed(0xed)]))[_0x40feed(0x101)](()=>undefined):undefined,_0x583803=buildLocalSqlFileContent({'sqlCode':_0x51a2f1['sqlCode'],'sqlName':_0x51a2f1[_0x40feed(0x10a)],'dbId':_0x51a2f1[_0x40feed(0xed)]},_0x44a1e4,{'dbName':_0x793a7,'mode':_0x91f493,'syncedAt':new Date()[_0x40feed(0xf5)](),'description':_0x51a2f1[_0x40feed(0x10b)]}),_0x281501=buildSqlLockEntry(_0x51a2f1,_0x44a1e4,'',{'dbName':_0x793a7}),_0x5be078=resolveLocalSqlFilePath(_0x1082d0,_0x51a2f1[_0x40feed(0x11d)],_0x281501);let _0x4c4a56='would_pull',_0x56bda4;if(await fileExists(_0x5be078)){const _0x1e8b44=await readFile(_0x5be078,'utf8');isEquivalentPulledSqlFile(_0x1e8b44,_0x583803,_0x91f493)?(_0x4c4a56=_0x40feed(0xec),_0x56bda4=_0x40feed(0xf8)):(_0x4c4a56=_0x40feed(0x118),_0x56bda4=_0x40feed(0xf9));}_0x44887c[_0x40feed(0x100)]({'sqlCode':_0x51a2f1['sqlCode'],'sqlName':_0x51a2f1[_0x40feed(0x10a)],'filePath':_0x5be078,'status':_0x4c4a56,'reason':_0x56bda4});}return{'method':'POST','url':'/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','body':{'appCode':_0xeec843[_0x40feed(0x110)],'sqlCode':_0xeec843[_0x40feed(0x123)](_0x40feed(0x102))||null,'sqlName':_0xeec843[_0x40feed(0x123)](_0x40feed(0x103))||null,'files':_0x44887c},'description':_0x40feed(0xee)+_0x44887c['length']+_0x40feed(0x115)+_0x1082d0['sqlRootDir']};},async 'execute'(_0x1ff1d0){const _0x1bdd0c=a175_0x5c0b10,_0x15784c=loadSqlProjectConfig(_0x1ff1d0[_0x1bdd0c(0x110)]),_0x44c1af=await readSqlLockFile(_0x15784c[_0x1bdd0c(0xff)]),{lockData:_0x5b7790,appLock:_0x472984}=ensureSqlLockScope(_0x44c1af??createEmptySqlLock(),_0x15784c[_0x1bdd0c(0x110)],_0x15784c['sqlRoot'],'pull'),_0x23e534=_0x1ff1d0[_0x1bdd0c(0x108)](_0x1bdd0c(0x11c)),_0x2a3e28=await fetchAllSqlQueries(_0x1ff1d0[_0x1bdd0c(0x110)],{'sqlCode':_0x1ff1d0[_0x1bdd0c(0x123)](_0x1bdd0c(0x102))||undefined,'sqlName':_0x1ff1d0[_0x1bdd0c(0x123)](_0x1bdd0c(0x103))||undefined});if(_0x2a3e28[_0x1bdd0c(0x10c)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x1bdd0c(0x124)};const _0x3eec4e=[],_0xd5f6aa=[];for(const _0x3d5958 of _0x2a3e28){try{_0x3eec4e[_0x1bdd0c(0x100)](await ensureSqlContent(_0x3d5958));}catch(_0x106153){_0xd5f6aa[_0x1bdd0c(0x100)]({'sqlCode':_0x3d5958[_0x1bdd0c(0x11d)],'error':_0x106153 instanceof Error?_0x106153['message']:String(_0x106153)});}}if(_0x23e534&&!_0x1ff1d0[_0x1bdd0c(0x125)]){let _0x2fc35c=![];for(const _0x3db350 of _0x3eec4e){const _0x4a9449=detectModeFromSql(_0x3db350),_0x44c01c=_0x3db350[_0x1bdd0c(0xed)]?await getDbName(_0x1ff1d0[_0x1bdd0c(0x110)],Number(_0x3db350[_0x1bdd0c(0xed)]))[_0x1bdd0c(0x101)](()=>undefined):undefined,_0x23a0b7=buildLocalSqlFileContent({'sqlCode':_0x3db350[_0x1bdd0c(0x11d)],'sqlName':_0x3db350[_0x1bdd0c(0x10a)],'dbId':_0x3db350['dbId']},ensureRemoteSqlContent(_0x3db350),{'dbName':_0x44c01c,'mode':_0x4a9449,'syncedAt':new Date()[_0x1bdd0c(0xf5)](),'description':_0x3db350['description']}),_0x68e232=resolveLocalSqlFilePath(_0x15784c,_0x3db350['sqlCode'],buildSqlLockEntry(_0x3db350,ensureRemoteSqlContent(_0x3db350),'',{'dbName':_0x44c01c}));if(await fileExists(_0x68e232)){const _0x8810ec=await readFile(_0x68e232,_0x1bdd0c(0x11f));if(!isEquivalentPulledSqlFile(_0x8810ec,_0x23a0b7,_0x4a9449)){_0x2fc35c=!![];break;}}}if(_0x2fc35c){const _0x480994=await confirmForceOverwrite(_0x1bdd0c(0xfb));if(!_0x480994)throw CliErrors[_0x1bdd0c(0xf0)](_0x1bdd0c(0x106));}}const _0x5e83d2=cloneSqlLockData(_0x5b7790),_0x1be192=_0x5e83d2[_0x1bdd0c(0x116)][_0x15784c['appCode']],_0x2e35a8=[],_0x4842a1=[];for(const _0x51668a of _0x3eec4e){const _0x56701b=_0x1be192['sqls'][_0x51668a[_0x1bdd0c(0x11d)]],_0x26d4b8=ensureRemoteSqlContent(_0x51668a),_0x31439f=detectModeFromSql(_0x51668a),_0x4aa7a7=_0x51668a['dbId']?await getDbName(_0x1ff1d0[_0x1bdd0c(0x110)],Number(_0x51668a[_0x1bdd0c(0xed)]))[_0x1bdd0c(0x101)](()=>undefined):undefined,_0x5b8f83=buildLocalSqlFileContent({'sqlCode':_0x51668a[_0x1bdd0c(0x11d)],'sqlName':_0x51668a[_0x1bdd0c(0x10a)],'dbId':_0x51668a['dbId']},_0x26d4b8,{'dbName':_0x4aa7a7,'mode':_0x31439f,'syncedAt':new Date()['toISOString'](),'description':_0x51668a['description']}),_0x19a3da=buildSqlLockEntry(_0x51668a,_0x26d4b8,computeSqlContentHash(_0x5b8f83),{'dbName':_0x4aa7a7}),_0xa14dfe=_0x19a3da[_0x1bdd0c(0x107)],_0x21f153=join(_0x15784c[_0x1bdd0c(0xef)],_0xa14dfe);try{if(await fileExists(_0x21f153)){const _0x3a1e2d=await readFile(_0x21f153,'utf8');if(isEquivalentPulledSqlFile(_0x3a1e2d,_0x5b8f83,_0x31439f)){_0x4842a1[_0x1bdd0c(0x100)]({'sqlCode':_0x51668a['sqlCode'],'reason':'unchanged'}),_0x1be192[_0x1bdd0c(0x119)][_0x51668a[_0x1bdd0c(0x11d)]]={..._0x19a3da,'hash':computeSqlContentHash(_0x3a1e2d),'path':_0xa14dfe};continue;}if(!_0x23e534){_0x4842a1[_0x1bdd0c(0x100)]({'sqlCode':_0x51668a[_0x1bdd0c(0x11d)],'reason':_0x1bdd0c(0x10f)});continue;}}const _0x22adaa=_0x56701b?.[_0x1bdd0c(0x107)]?join(_0x15784c[_0x1bdd0c(0xef)],_0x56701b[_0x1bdd0c(0x107)]):undefined;_0x22adaa&&_0x22adaa!==_0x21f153&&await fileExists(_0x22adaa)&&await rm(_0x22adaa,{'force':!![]}),await ensureParentDirectory(_0x21f153),await writeFile(_0x21f153,_0x5b8f83,_0x1bdd0c(0x11f)),_0x1be192[_0x1bdd0c(0x119)][_0x51668a[_0x1bdd0c(0x11d)]]={..._0x19a3da,'path':_0xa14dfe},_0x2e35a8['push']({'sqlCode':_0x51668a['sqlCode'],'filePath':_0x21f153});}catch(_0x36d9de){_0xd5f6aa[_0x1bdd0c(0x100)]({'sqlCode':_0x51668a['sqlCode'],'error':_0x36d9de instanceof Error?_0x36d9de[_0x1bdd0c(0xf4)]:String(_0x36d9de)});}}return _0x1be192[_0x1bdd0c(0x126)]=new Date()['toISOString'](),await writeSqlLockFile(_0x15784c['lockFilePath'],_0x5e83d2),{'ok':_0xd5f6aa[_0x1bdd0c(0x10c)]===0x0,'data':{'pulled':_0x2e35a8,'skipped':_0x4842a1,'failed':_0xd5f6aa},'message':_0x1bdd0c(0x10d)+_0x2e35a8[_0x1bdd0c(0x10c)]+_0x1bdd0c(0xfa)+_0x4842a1[_0x1bdd0c(0x10c)]+_0x1bdd0c(0xf1)+_0xd5f6aa[_0x1bdd0c(0x10c)]+'\x20failed'};}};function detectModeFromSql(_0x2d0ffd){const _0x3dbc9f=a175_0x5c0b10,_0x136cbf=ensureRemoteSqlContent(_0x2d0ffd),_0x56fe60=stripLocalSqlMetadata(_0x136cbf,'mybatisXml')['trimStart']();if(/^<(select|insert|update|delete)\b/i[_0x3dbc9f(0x121)](_0x56fe60))return _0x3dbc9f(0x11b);return _0x3dbc9f(0xfc);}function isEquivalentPulledSqlFile(_0x27bb11,_0x1ffcea,_0x47b95e){return normalizePullComparableContent(_0x27bb11,_0x47b95e)===normalizePullComparableContent(_0x1ffcea,_0x47b95e);}function normalizePullComparableContent(_0x27a438,_0x51de48){const _0x5eea73=a175_0x5c0b10,_0x125674=_0x27a438['replace'](/\r\n/g,'\x0a')[_0x5eea73(0x10e)]('\x0a'),_0x326207=_0x125674[_0x5eea73(0x11a)](_0x3b67dc=>!isSyncedAtMetadataLine(_0x3b67dc,_0x51de48));return _0x326207[_0x5eea73(0xfe)]('\x0a');}function isSyncedAtMetadataLine(_0x304878,_0xf38e1a){const _0x51e5a9=a175_0x5c0b10;if(_0xf38e1a===_0x51e5a9(0x11b))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x51e5a9(0x121)](_0x304878);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x51e5a9(0x121)](_0x304878);}
|
|
1
|
+
const a176_0x2f54b9=a176_0x5852;(function(_0x1cde32,_0x43e159){const _0x44c50a=a176_0x5852,_0x5c9ce6=_0x1cde32();while(!![]){try{const _0x2b368f=-parseInt(_0x44c50a(0x168))/0x1+-parseInt(_0x44c50a(0x147))/0x2*(parseInt(_0x44c50a(0x165))/0x3)+-parseInt(_0x44c50a(0x174))/0x4*(-parseInt(_0x44c50a(0x167))/0x5)+-parseInt(_0x44c50a(0x173))/0x6*(-parseInt(_0x44c50a(0x171))/0x7)+-parseInt(_0x44c50a(0x14f))/0x8+-parseInt(_0x44c50a(0x153))/0x9*(-parseInt(_0x44c50a(0x157))/0xa)+parseInt(_0x44c50a(0x149))/0xb;if(_0x2b368f===_0x43e159)break;else _0x5c9ce6['push'](_0x5c9ce6['shift']());}catch(_0x37e0a8){_0x5c9ce6['push'](_0x5c9ce6['shift']());}}}(a176_0x46e0,0xda4a2));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';function a176_0x5852(_0x37be70,_0x596aa4){_0x37be70=_0x37be70-0x13b;const _0x46e020=a176_0x46e0();let _0x5852b7=_0x46e020[_0x37be70];return _0x5852b7;}import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';function a176_0x46e0(){const _0x28f5be=['split','appCode','\x20SQL\x20file(s)\x20into\x20','description','unchanged','58MyLDsB','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','8410303wsvNiT','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','POST','Force\x20pull\x20cancelled.','str','test','1277960uuTlbI','bool','No\x20remote\x20SQL\x20queries\x20matched.','mybatisXml','36XHRKsh','sqlRoot','totalCount','Filter\x20by\x20SQL\x20display\x20name','2123340ZrFWku','force','sqlContent','length','lockFilePath','sqlRootDir','toISOString','utf8','sqlcode','path','sqls','pull','paging','catch','170673DRpmcQ','apps','5ALpjHx','195527zPEMob','write','name','tableData','lastSync','dbId','sqlName','replace','string','3724GNzhQs','trimStart','11046naFmdg','1223616BWMqte','Pull\x20complete:\x20','\x20failed','push','Force\x20overwrite\x20local\x20unsynced\x20changes','sqlCode','message','cancelled','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','sql'];a176_0x46e0=function(){return _0x28f5be;};return a176_0x46e0();}const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x1d82ea,_0x5a0a26){const _0x48d45a=a176_0x5852,_0x2ad502=[];let _0x237f43=0x1;while(!![]){const _0x3be9f0=await listSqlQueries(_0x1d82ea,{'currentPage':_0x237f43,'pageSize':PAGE_SIZE,'sqlCode':_0x5a0a26[_0x48d45a(0x13d)],'sqlName':_0x5a0a26[_0x48d45a(0x16e)]}),_0x170dbb=_0x3be9f0[_0x48d45a(0x16b)]??[];_0x2ad502['push'](..._0x170dbb);if(_0x170dbb['length']===0x0)break;const _0x4f98ae=_0x3be9f0[_0x48d45a(0x163)]?.[_0x48d45a(0x155)];if(_0x4f98ae!=null?_0x2ad502['length']>=_0x4f98ae:_0x170dbb[_0x48d45a(0x15a)]<PAGE_SIZE)break;_0x237f43++;}return _0x2ad502;}async function ensureSqlContent(_0x44118f){const _0x1b259a=a176_0x5852;if(_0x44118f[_0x1b259a(0x159)]!=null&&String(_0x44118f['sqlContent'])[_0x1b259a(0x15a)]>0x0)return _0x44118f;return getSqlQueryDetail(_0x44118f['sqlCode']);}export const sqlPull={'service':a176_0x2f54b9(0x141),'command':a176_0x2f54b9(0x162),'description':a176_0x2f54b9(0x148),'risk':a176_0x2f54b9(0x169),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a176_0x2f54b9(0x16a),'type':a176_0x2f54b9(0x170),'description':a176_0x2f54b9(0x156)},{'name':a176_0x2f54b9(0x158),'type':'boolean','description':a176_0x2f54b9(0x13c)}],async 'dryRun'(_0x503e2e){const _0x435655=a176_0x2f54b9,_0x1509c5=loadSqlProjectConfig(_0x503e2e[_0x435655(0x143)]),_0x2f1b13=await readSqlLockFile(_0x1509c5[_0x435655(0x15b)]),{appLock:_0x168f0b}=ensureSqlLockScope(_0x2f1b13??createEmptySqlLock(),_0x1509c5[_0x435655(0x143)],_0x1509c5['sqlRoot'],_0x435655(0x162)),_0x267e65=await fetchAllSqlQueries(_0x503e2e['appCode'],{'sqlCode':_0x503e2e['str']('sqlcode')||undefined,'sqlName':_0x503e2e[_0x435655(0x14d)]('name')||undefined}),_0x265c12=[];for(const _0x174255 of _0x267e65){const _0x27cfb4=await ensureSqlContent(_0x174255),_0x5b27e0=ensureRemoteSqlContent(_0x27cfb4),_0x24ec06=detectModeFromSql(_0x27cfb4),_0x184dbd=_0x27cfb4[_0x435655(0x16d)]?await getDbName(_0x503e2e[_0x435655(0x143)],Number(_0x27cfb4[_0x435655(0x16d)]))[_0x435655(0x164)](()=>undefined):undefined,_0x21d160=buildLocalSqlFileContent({'sqlCode':_0x27cfb4[_0x435655(0x13d)],'sqlName':_0x27cfb4['sqlName'],'dbId':_0x27cfb4['dbId']},_0x5b27e0,{'dbName':_0x184dbd,'mode':_0x24ec06,'syncedAt':new Date()[_0x435655(0x15d)](),'description':_0x27cfb4[_0x435655(0x145)]}),_0x4d012c=buildSqlLockEntry(_0x27cfb4,_0x5b27e0,'',{'dbName':_0x184dbd}),_0x2902f9=resolveLocalSqlFilePath(_0x1509c5,_0x27cfb4[_0x435655(0x13d)],_0x4d012c);let _0x4d6d73='would_pull',_0x572b56;if(await fileExists(_0x2902f9)){const _0x1daa4f=await readFile(_0x2902f9,'utf8');isEquivalentPulledSqlFile(_0x1daa4f,_0x21d160,_0x24ec06)?(_0x4d6d73='skipped',_0x572b56='unchanged'):(_0x4d6d73='conflict',_0x572b56=_0x435655(0x140));}_0x265c12[_0x435655(0x13b)]({'sqlCode':_0x27cfb4[_0x435655(0x13d)],'sqlName':_0x27cfb4[_0x435655(0x16e)],'filePath':_0x2902f9,'status':_0x4d6d73,'reason':_0x572b56});}return{'method':_0x435655(0x14b),'url':_0x435655(0x14a),'body':{'appCode':_0x503e2e[_0x435655(0x143)],'sqlCode':_0x503e2e[_0x435655(0x14d)](_0x435655(0x15f))||null,'sqlName':_0x503e2e[_0x435655(0x14d)](_0x435655(0x16a))||null,'files':_0x265c12},'description':'Would\x20pull\x20'+_0x265c12[_0x435655(0x15a)]+_0x435655(0x144)+_0x1509c5[_0x435655(0x15c)]};},async 'execute'(_0x4d928c){const _0x34443f=a176_0x2f54b9,_0x3dea2e=loadSqlProjectConfig(_0x4d928c[_0x34443f(0x143)]),_0x341232=await readSqlLockFile(_0x3dea2e[_0x34443f(0x15b)]),{lockData:_0x1c8bff,appLock:_0x5cd14e}=ensureSqlLockScope(_0x341232??createEmptySqlLock(),_0x3dea2e[_0x34443f(0x143)],_0x3dea2e[_0x34443f(0x154)],_0x34443f(0x162)),_0x1f78ea=_0x4d928c[_0x34443f(0x150)]('force'),_0x19b2eb=await fetchAllSqlQueries(_0x4d928c[_0x34443f(0x143)],{'sqlCode':_0x4d928c[_0x34443f(0x14d)](_0x34443f(0x15f))||undefined,'sqlName':_0x4d928c[_0x34443f(0x14d)](_0x34443f(0x16a))||undefined});if(_0x19b2eb[_0x34443f(0x15a)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x34443f(0x151)};const _0x290bb8=[],_0x3a0161=[];for(const _0xa7116e of _0x19b2eb){try{_0x290bb8[_0x34443f(0x13b)](await ensureSqlContent(_0xa7116e));}catch(_0xdec0e3){_0x3a0161['push']({'sqlCode':_0xa7116e[_0x34443f(0x13d)],'error':_0xdec0e3 instanceof Error?_0xdec0e3[_0x34443f(0x13e)]:String(_0xdec0e3)});}}if(_0x1f78ea&&!_0x4d928c['nonInteractive']){let _0x3185db=![];for(const _0x53acb4 of _0x290bb8){const _0x3bb733=detectModeFromSql(_0x53acb4),_0x4f5261=_0x53acb4[_0x34443f(0x16d)]?await getDbName(_0x4d928c[_0x34443f(0x143)],Number(_0x53acb4[_0x34443f(0x16d)]))[_0x34443f(0x164)](()=>undefined):undefined,_0x45ae34=buildLocalSqlFileContent({'sqlCode':_0x53acb4[_0x34443f(0x13d)],'sqlName':_0x53acb4[_0x34443f(0x16e)],'dbId':_0x53acb4['dbId']},ensureRemoteSqlContent(_0x53acb4),{'dbName':_0x4f5261,'mode':_0x3bb733,'syncedAt':new Date()[_0x34443f(0x15d)](),'description':_0x53acb4[_0x34443f(0x145)]}),_0x5ebd29=resolveLocalSqlFilePath(_0x3dea2e,_0x53acb4[_0x34443f(0x13d)],buildSqlLockEntry(_0x53acb4,ensureRemoteSqlContent(_0x53acb4),'',{'dbName':_0x4f5261}));if(await fileExists(_0x5ebd29)){const _0x5c6080=await readFile(_0x5ebd29,_0x34443f(0x15e));if(!isEquivalentPulledSqlFile(_0x5c6080,_0x45ae34,_0x3bb733)){_0x3185db=!![];break;}}}if(_0x3185db){const _0x4e8e09=await confirmForceOverwrite('Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.');if(!_0x4e8e09)throw CliErrors[_0x34443f(0x13f)](_0x34443f(0x14c));}}const _0x228273=cloneSqlLockData(_0x1c8bff),_0x2be0ee=_0x228273[_0x34443f(0x166)][_0x3dea2e['appCode']],_0x5e8a8f=[],_0x2666be=[];for(const _0x104d21 of _0x290bb8){const _0x5d136f=_0x2be0ee['sqls'][_0x104d21[_0x34443f(0x13d)]],_0x166cb1=ensureRemoteSqlContent(_0x104d21),_0x3be0b1=detectModeFromSql(_0x104d21),_0x1ac2a0=_0x104d21[_0x34443f(0x16d)]?await getDbName(_0x4d928c[_0x34443f(0x143)],Number(_0x104d21[_0x34443f(0x16d)]))['catch'](()=>undefined):undefined,_0x50278d=buildLocalSqlFileContent({'sqlCode':_0x104d21['sqlCode'],'sqlName':_0x104d21['sqlName'],'dbId':_0x104d21[_0x34443f(0x16d)]},_0x166cb1,{'dbName':_0x1ac2a0,'mode':_0x3be0b1,'syncedAt':new Date()['toISOString'](),'description':_0x104d21[_0x34443f(0x145)]}),_0x40525e=buildSqlLockEntry(_0x104d21,_0x166cb1,computeSqlContentHash(_0x50278d),{'dbName':_0x1ac2a0}),_0x5bb207=_0x40525e['path'],_0x197643=join(_0x3dea2e['sqlRootDir'],_0x5bb207);try{if(await fileExists(_0x197643)){const _0x31c5a8=await readFile(_0x197643,_0x34443f(0x15e));if(isEquivalentPulledSqlFile(_0x31c5a8,_0x50278d,_0x3be0b1)){_0x2666be[_0x34443f(0x13b)]({'sqlCode':_0x104d21[_0x34443f(0x13d)],'reason':_0x34443f(0x146)}),_0x2be0ee[_0x34443f(0x161)][_0x104d21[_0x34443f(0x13d)]]={..._0x40525e,'hash':computeSqlContentHash(_0x31c5a8),'path':_0x5bb207};continue;}if(!_0x1f78ea){_0x2666be[_0x34443f(0x13b)]({'sqlCode':_0x104d21[_0x34443f(0x13d)],'reason':'local\x20differs\x20from\x20remote'});continue;}}const _0x58e272=_0x5d136f?.[_0x34443f(0x160)]?join(_0x3dea2e[_0x34443f(0x15c)],_0x5d136f[_0x34443f(0x160)]):undefined;_0x58e272&&_0x58e272!==_0x197643&&await fileExists(_0x58e272)&&await rm(_0x58e272,{'force':!![]}),await ensureParentDirectory(_0x197643),await writeFile(_0x197643,_0x50278d,_0x34443f(0x15e)),_0x2be0ee[_0x34443f(0x161)][_0x104d21['sqlCode']]={..._0x40525e,'path':_0x5bb207},_0x5e8a8f[_0x34443f(0x13b)]({'sqlCode':_0x104d21['sqlCode'],'filePath':_0x197643});}catch(_0xb820ff){_0x3a0161[_0x34443f(0x13b)]({'sqlCode':_0x104d21[_0x34443f(0x13d)],'error':_0xb820ff instanceof Error?_0xb820ff[_0x34443f(0x13e)]:String(_0xb820ff)});}}return _0x2be0ee[_0x34443f(0x16c)]=new Date()[_0x34443f(0x15d)](),await writeSqlLockFile(_0x3dea2e['lockFilePath'],_0x228273),{'ok':_0x3a0161[_0x34443f(0x15a)]===0x0,'data':{'pulled':_0x5e8a8f,'skipped':_0x2666be,'failed':_0x3a0161},'message':_0x34443f(0x175)+_0x5e8a8f['length']+'\x20written,\x20'+_0x2666be[_0x34443f(0x15a)]+'\x20skipped,\x20'+_0x3a0161[_0x34443f(0x15a)]+_0x34443f(0x176)};}};function detectModeFromSql(_0x363ca6){const _0x10520d=a176_0x2f54b9,_0xe63b5a=ensureRemoteSqlContent(_0x363ca6),_0x23e8b1=stripLocalSqlMetadata(_0xe63b5a,_0x10520d(0x152))[_0x10520d(0x172)]();if(/^<(select|insert|update|delete)\b/i[_0x10520d(0x14e)](_0x23e8b1))return _0x10520d(0x152);return'sql';}function isEquivalentPulledSqlFile(_0x3c69ec,_0x404c73,_0xef6a4b){return normalizePullComparableContent(_0x3c69ec,_0xef6a4b)===normalizePullComparableContent(_0x404c73,_0xef6a4b);}function normalizePullComparableContent(_0x45adac,_0x356616){const _0x56e9e3=a176_0x2f54b9,_0x47cbcb=_0x45adac[_0x56e9e3(0x16f)](/\r\n/g,'\x0a')[_0x56e9e3(0x142)]('\x0a'),_0x5dbe74=_0x47cbcb['filter'](_0xbe51e4=>!isSyncedAtMetadataLine(_0xbe51e4,_0x356616));return _0x5dbe74['join']('\x0a');}function isSyncedAtMetadataLine(_0x2c143f,_0x5a7c42){const _0x392dcf=a176_0x2f54b9;if(_0x5a7c42==='mybatisXml')return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x392dcf(0x14e)](_0x2c143f);return/^\s*--\s*@lovrabet\.syncedAt:/['test'](_0x2c143f);}
|
package/lib/commands/sql/push.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a176_0x2db0bc=a176_0x26e1;(function(_0x908a49,_0x960252){const _0x2b9eac=a176_0x26e1,_0x4bc2d0=_0x908a49();while(!![]){try{const _0x259ca5=-parseInt(_0x2b9eac(0xe5))/0x1+parseInt(_0x2b9eac(0xf9))/0x2*(-parseInt(_0x2b9eac(0xf6))/0x3)+-parseInt(_0x2b9eac(0xf4))/0x4*(-parseInt(_0x2b9eac(0x102))/0x5)+parseInt(_0x2b9eac(0xed))/0x6*(-parseInt(_0x2b9eac(0xe3))/0x7)+-parseInt(_0x2b9eac(0x10e))/0x8+parseInt(_0x2b9eac(0xf1))/0x9*(parseInt(_0x2b9eac(0x112))/0xa)+-parseInt(_0x2b9eac(0xeb))/0xb*(-parseInt(_0x2b9eac(0xff))/0xc);if(_0x259ca5===_0x960252)break;else _0x4bc2d0['push'](_0x4bc2d0['shift']());}catch(_0x1d28ae){_0x4bc2d0['push'](_0x4bc2d0['shift']());}}}(a176_0x4bb8,0x50a00));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 a176_0x26e1(_0x2d2276,_0x1756b9){_0x2d2276=_0x2d2276-0xdd;const _0x4bb80b=a176_0x4bb8();let _0x26e1be=_0x4bb80b[_0x2d2276];return _0x26e1be;}import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';async function getTargetSqlQueries(_0x5b096d,_0x3400a0,_0x3755d8){const _0x1352a1=a176_0x26e1,_0x20bb0a=await scanLocalSqlQueries(_0x5b096d),_0x4d5310=new Map();for(const _0x50b693 of _0x20bb0a){if(_0x3755d8&&_0x50b693[_0x1352a1(0xee)]!==_0x3755d8)continue;const _0xd799ee=_0x4d5310[_0x1352a1(0xde)](_0x50b693[_0x1352a1(0xee)])??[];_0xd799ee['push'](_0x50b693),_0x4d5310[_0x1352a1(0x11c)](_0x50b693[_0x1352a1(0xee)],_0xd799ee);}if(_0x3755d8&&!_0x4d5310[_0x1352a1(0xea)](_0x3755d8))throw CliErrors[_0x1352a1(0x114)](_0x1352a1(0x119)+_0x3755d8);const _0x4086ce=[];for(const [_0x14c973,_0x2b2981]of _0x4d5310[_0x1352a1(0x10d)]()){if(_0x2b2981[_0x1352a1(0x107)]===0x1){_0x4086ce[_0x1352a1(0x106)](_0x2b2981[0x0]);continue;}const _0x30d222=_0x3400a0['sqls'][_0x14c973],_0x5b3230=_0x30d222?.[_0x1352a1(0xf8)],_0x45d184=_0x5b3230?_0x2b2981[_0x1352a1(0xdd)](_0x3bad10=>_0x3bad10[_0x1352a1(0xfe)]!==_0x5b3230):_0x2b2981;if(_0x30d222&&_0x45d184[_0x1352a1(0x107)]===0x1){_0x4086ce['push'](_0x45d184[0x0]);continue;}throw CliErrors[_0x1352a1(0x114)]('Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20'+_0x14c973+_0x1352a1(0x11e));}return _0x4086ce;}export const sqlPush={'service':'sql','command':a176_0x2db0bc(0x106),'description':a176_0x2db0bc(0xef),'risk':a176_0x2db0bc(0x120),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a176_0x2db0bc(0x11a),'type':a176_0x2db0bc(0x100),'description':a176_0x2db0bc(0x108)}],async 'dryRun'(_0x46374d){const _0x382eb4=a176_0x2db0bc,_0x160056=loadSqlProjectConfig(_0x46374d[_0x382eb4(0xf7)]),_0xc98bf=await readSqlLockFile(_0x160056['lockFilePath']),{appLock:_0x5ef940}=ensureSqlLockScope(_0xc98bf??createEmptySqlLock(),_0x46374d[_0x382eb4(0xf7)],_0x160056['sqlRoot'],'push'),_0x33489f=await getTargetSqlQueries(_0x160056,_0x5ef940,_0x46374d[_0x382eb4(0xe9)](_0x382eb4(0x101))||undefined),_0x4bd9b9=[];for(const _0x25673b of _0x33489f){const _0x5eb5f2=await computeSqlFileHash(_0x25673b[_0x382eb4(0x109)]),_0x11644f=_0x5ef940['sqls'][_0x25673b['sqlCode']],_0x3385a1=!!_0x11644f&&(_0x11644f[_0x382eb4(0xf8)]!==_0x25673b[_0x382eb4(0xfe)]||!!_0x25673b[_0x382eb4(0x117)]&&_0x11644f[_0x382eb4(0x117)]!==_0x25673b['sqlName']);if(!_0x46374d['bool'](_0x382eb4(0x11a))&&_0x11644f&&_0x11644f[_0x382eb4(0x10a)]===_0x5eb5f2&&!_0x3385a1)continue;_0x4bd9b9[_0x382eb4(0x106)](_0x25673b[_0x382eb4(0xee)]);}return{'method':'POST','url':_0x382eb4(0xe7),'body':{'sqlCodes':_0x4bd9b9,'appCode':_0x46374d[_0x382eb4(0xf7)]},'description':'Would\x20push\x20'+_0x4bd9b9['length']+_0x382eb4(0x10c)};},async 'execute'(_0x1d747d){const _0x2ad211=a176_0x2db0bc,_0x1d23f6=loadSqlProjectConfig(_0x1d747d[_0x2ad211(0xf7)]),_0x4b09d9=await readSqlLockFile(_0x1d23f6['lockFilePath']),{lockData:_0x4ee694,appLock:_0x607f1a}=ensureSqlLockScope(_0x4b09d9??createEmptySqlLock(),_0x1d747d[_0x2ad211(0xf7)],_0x1d23f6[_0x2ad211(0xe1)],_0x2ad211(0x106)),_0x18b6b4=await getTargetSqlQueries(_0x1d23f6,_0x607f1a,_0x1d747d[_0x2ad211(0xe9)](_0x2ad211(0x101))||undefined);if(_0x18b6b4[_0x2ad211(0x107)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x2ad211(0x11f)};const _0x5753ac=[],_0x5722d8=[],_0x5be53c=[];for(const _0x1e9fce of _0x18b6b4){const _0x3a8be2=_0x607f1a['sqls'][_0x1e9fce[_0x2ad211(0xee)]];if(!_0x3a8be2){_0x5be53c[_0x2ad211(0x106)]({'sqlCode':_0x1e9fce[_0x2ad211(0xee)],'error':'local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first'});continue;}try{const _0x326fa1=await computeSqlFileHash(_0x1e9fce[_0x2ad211(0x109)]),_0x3227f6=_0x3a8be2['path']!==_0x1e9fce[_0x2ad211(0xfe)]||!!_0x1e9fce['sqlName']&&_0x3a8be2[_0x2ad211(0x117)]!==_0x1e9fce[_0x2ad211(0x117)];if(!_0x1d747d[_0x2ad211(0xdf)](_0x2ad211(0x11a))&&_0x3a8be2[_0x2ad211(0x10a)]===_0x326fa1&&!_0x3227f6){_0x5722d8[_0x2ad211(0x106)]({'sqlCode':_0x1e9fce['sqlCode'],'reason':_0x2ad211(0x118)});continue;}if(_0x3a8be2[_0x2ad211(0x111)]==null){_0x5be53c['push']({'sqlCode':_0x1e9fce[_0x2ad211(0xee)],'error':'missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first'});continue;}const _0x961c19=await readFile(_0x1e9fce[_0x2ad211(0x109)],_0x2ad211(0x103)),_0x2345fa=stripLocalSqlMetadata(_0x961c19,_0x1e9fce[_0x2ad211(0x115)]),_0x54d528=_0x1e9fce['sqlName']||_0x3a8be2[_0x2ad211(0x117)],_0x4e198a=await resolveTargetDbBinding(_0x1d747d[_0x2ad211(0xf7)],_0x1e9fce,_0x3a8be2),_0x39789a=await updateSqlQuery({'id':_0x3a8be2['remoteId'],'appCode':_0x1d747d[_0x2ad211(0xf7)],'sqlCode':_0x1e9fce[_0x2ad211(0xee)],'sqlName':_0x54d528,'dbId':_0x4e198a[_0x2ad211(0xf3)],'version':_0x3a8be2[_0x2ad211(0x111)],'sqlContent':_0x2345fa,'sqlConfig':_0x3a8be2[_0x2ad211(0xfd)]??undefined}),_0x3437b7=_0x39789a[_0x2ad211(0xf3)]?await getDbName(_0x1d747d[_0x2ad211(0xf7)],Number(_0x39789a[_0x2ad211(0xf3)]))[_0x2ad211(0xf0)](()=>_0x4e198a[_0x2ad211(0xfb)]):_0x4e198a[_0x2ad211(0xfb)];_0x607f1a[_0x2ad211(0x10b)][_0x1e9fce['sqlCode']]={...buildSqlLockEntry(_0x39789a,_0x2345fa,_0x326fa1,{'dbName':_0x3437b7}),'path':_0x1e9fce[_0x2ad211(0xfe)],'mode':_0x3a8be2[_0x2ad211(0x115)]},await archivePreviousSqlFileIfNeeded(_0x1d23f6,_0x3a8be2[_0x2ad211(0xf8)],_0x1e9fce['relativePath']),_0x5753ac['push']({'sqlCode':_0x1e9fce['sqlCode'],'remoteId':_0x3a8be2[_0x2ad211(0x116)]});}catch(_0x6e3c4f){_0x5be53c[_0x2ad211(0x106)]({'sqlCode':_0x1e9fce[_0x2ad211(0xee)],'error':_0x6e3c4f instanceof Error?_0x6e3c4f[_0x2ad211(0xe6)]:String(_0x6e3c4f)});}}return _0x607f1a[_0x2ad211(0x11b)]=new Date()['toISOString'](),await writeSqlLockFile(_0x1d23f6[_0x2ad211(0x105)],_0x4ee694),{'ok':_0x5be53c[_0x2ad211(0x107)]===0x0,'data':{'pushed':_0x5753ac,'skipped':_0x5722d8,'failed':_0x5be53c},'message':_0x2ad211(0xf2)+_0x5753ac[_0x2ad211(0x107)]+'\x20pushed,\x20'+_0x5722d8[_0x2ad211(0x107)]+_0x2ad211(0x113)+_0x5be53c[_0x2ad211(0x107)]+_0x2ad211(0xf5)};}};function a176_0x4bb8(){const _0x210b50=['path','2282BKPxss','join','dbName','projectRoot','sqlConfig','relativePath','51252iYXigS','boolean','sqlcode','1135tLQANu','utf8','isFinite','lockFilePath','push','length','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','filePath','hash','sqls','\x20SQL\x20file(s)','entries','2097920DXfphM','exec','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','version','911560NDUSjC','\x20skipped,\x20','validation','mode','remoteId','sqlName','unchanged','Local\x20SQL\x20not\x20found:\x20','force','lastSync','set','No\x20database\x20matches\x20local\x20directory\x20\x22','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','No\x20local\x20SQL\x20files\x20found.','high-risk-write','filter','get','bool','replace','sqlRoot','map','7QCUmLQ','trashDir','593252UGrhFQ','message','/smartapi/custom/updateUserCustomSql','sqlRootDir','str','has','2167LSVwEg','Local\x20directory\x20\x22','1530294ILeqds','sqlCode','Push\x20local\x20SQL\x20files\x20to\x20remote','catch','63yllaQU','Push\x20complete:\x20','dbId','8808WzJOKa','\x20failed','1416tBJTYE','appCode'];a176_0x4bb8=function(){return _0x210b50;};return a176_0x4bb8();}async function archivePreviousSqlFileIfNeeded(_0x418873,_0x111e15,_0x3ca672){const _0x56647f=a176_0x2db0bc;if(!_0x111e15||_0x111e15===_0x3ca672)return;const _0xda3c23=join(_0x418873['sqlRootDir'],_0x111e15);if(!await fileExists(_0xda3c23))return;const _0x3c4259=await moveToTrash(_0x418873[_0x56647f(0xfc)],_0x418873[_0x56647f(0xe4)],_0xda3c23);await cleanupEmptyDirectories(dirname(_0xda3c23),_0x418873[_0x56647f(0xe8)]),void _0x3c4259;}async function moveToTrash(_0x46f759,_0x11e721,_0x163843){const _0x4cf627=a176_0x2db0bc,_0x320902=new Date()['toISOString']()[_0x4cf627(0xe0)](/[:.]/g,'-'),_0x1db5d7=relative(_0x46f759,_0x163843),_0x2a8639=join(_0x11e721,_0x320902,_0x1db5d7);return await mkdir(dirname(_0x2a8639),{'recursive':!![]}),await rename(_0x163843,_0x2a8639),_0x2a8639;}async function cleanupEmptyDirectories(_0x45f551,_0x51e220){const _0x122b37=a176_0x2db0bc;let _0x125083=resolve(_0x45f551);const _0x2648c2=resolve(_0x51e220);while(_0x125083['startsWith'](''+_0x2648c2+sep)||_0x125083===_0x2648c2){if(_0x125083===_0x2648c2)return;try{const _0xcaef0f=await readdir(_0x125083);if(_0xcaef0f[_0x122b37(0x107)]>0x0)return;await rmdir(_0x125083);}catch{return;}_0x125083=dirname(_0x125083);}}async function resolveTargetDbBinding(_0x68ae57,_0x14c8a1,_0x4f0f90){const _0x45ab89=a176_0x2db0bc,_0x500c80=_0x14c8a1['dbDirectory'];if(!_0x500c80)return{'dbId':_0x4f0f90[_0x45ab89(0xf3)],'dbName':_0x4f0f90[_0x45ab89(0xfb)]};const _0x2dcd71=buildDbDirectoryName(_0x4f0f90[_0x45ab89(0xfb)],_0x4f0f90[_0x45ab89(0xf3)]);if(_0x500c80===_0x2dcd71)return{'dbId':_0x4f0f90[_0x45ab89(0xf3)],'dbName':_0x4f0f90[_0x45ab89(0xfb)]};const _0x2e9d05=parseExplicitDbDirectory(_0x500c80);if(_0x2e9d05!=null)return{'dbId':_0x2e9d05,'dbName':await getDbName(_0x68ae57,_0x2e9d05)[_0x45ab89(0xf0)](()=>undefined)};const _0x268b0b=await listDatabases(_0x68ae57),_0x5b1cb0=_0x268b0b[_0x45ab89(0xdd)](_0x31f2c5=>buildDbDirectoryName(_0x31f2c5[_0x45ab89(0xfb)],_0x31f2c5[_0x45ab89(0xf3)])===_0x500c80);if(_0x5b1cb0[_0x45ab89(0x107)]===0x1)return{'dbId':_0x5b1cb0[0x0][_0x45ab89(0xf3)],'dbName':_0x5b1cb0[0x0][_0x45ab89(0xfb)]};if(_0x5b1cb0[_0x45ab89(0x107)]===0x0)throw CliErrors[_0x45ab89(0x114)](_0x45ab89(0x11d)+_0x500c80+'\x22\x20for\x20sqlCode\x20'+_0x14c8a1[_0x45ab89(0xee)]+'.');const _0x1b5ce9=_0x5b1cb0[_0x45ab89(0xe2)](_0x3d13f5=>_0x3d13f5[_0x45ab89(0xfb)]+'\x20('+_0x3d13f5[_0x45ab89(0xf3)]+')')[_0x45ab89(0xfa)](',\x20');throw CliErrors[_0x45ab89(0x114)](_0x45ab89(0xec)+_0x500c80+_0x45ab89(0x110)+_0x14c8a1['sqlCode']+':\x20'+_0x1b5ce9);}function parseExplicitDbDirectory(_0x593b1d){const _0x183de9=a176_0x2db0bc,_0x757e10=/^db-(\d+)$/[_0x183de9(0x10f)](_0x593b1d);if(!_0x757e10)return null;const _0x135d5b=Number(_0x757e10[0x1]);return Number[_0x183de9(0x104)](_0x135d5b)&&_0x135d5b>0x0?_0x135d5b:null;}
|
|
1
|
+
const a177_0x16cc7b=a177_0x1b71;(function(_0x192c95,_0x588b85){const _0x297b33=a177_0x1b71,_0x325a21=_0x192c95();while(!![]){try{const _0x54c69b=-parseInt(_0x297b33(0x18c))/0x1*(parseInt(_0x297b33(0x188))/0x2)+parseInt(_0x297b33(0x181))/0x3*(parseInt(_0x297b33(0x18e))/0x4)+-parseInt(_0x297b33(0x187))/0x5+parseInt(_0x297b33(0x1aa))/0x6+parseInt(_0x297b33(0x18a))/0x7*(-parseInt(_0x297b33(0x1bd))/0x8)+parseInt(_0x297b33(0x1be))/0x9+parseInt(_0x297b33(0x1b3))/0xa*(-parseInt(_0x297b33(0x185))/0xb);if(_0x54c69b===_0x588b85)break;else _0x325a21['push'](_0x325a21['shift']());}catch(_0x32f151){_0x325a21['push'](_0x325a21['shift']());}}}(a177_0x196f,0x90e3e));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 a177_0x1b71(_0x5c461c,_0x323ecb){_0x5c461c=_0x5c461c-0x17d;const _0x196f58=a177_0x196f();let _0x1b7118=_0x196f58[_0x5c461c];return _0x1b7118;}import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';async function getTargetSqlQueries(_0x14a5f2,_0x304fe9,_0x372126){const _0x12f85b=a177_0x1b71,_0x47a205=await scanLocalSqlQueries(_0x14a5f2),_0x28a9fc=new Map();for(const _0x63ca64 of _0x47a205){if(_0x372126&&_0x63ca64[_0x12f85b(0x183)]!==_0x372126)continue;const _0xe71bb0=_0x28a9fc[_0x12f85b(0x17e)](_0x63ca64[_0x12f85b(0x183)])??[];_0xe71bb0[_0x12f85b(0x1b6)](_0x63ca64),_0x28a9fc[_0x12f85b(0x17f)](_0x63ca64[_0x12f85b(0x183)],_0xe71bb0);}if(_0x372126&&!_0x28a9fc[_0x12f85b(0x180)](_0x372126))throw CliErrors['validation'](_0x12f85b(0x19f)+_0x372126);const _0x1d0445=[];for(const [_0xf77b8a,_0x4628da]of _0x28a9fc[_0x12f85b(0x1bc)]()){if(_0x4628da[_0x12f85b(0x1a6)]===0x1){_0x1d0445[_0x12f85b(0x1b6)](_0x4628da[0x0]);continue;}const _0xcfa773=_0x304fe9[_0x12f85b(0x1c1)][_0xf77b8a],_0x42353f=_0xcfa773?.[_0x12f85b(0x19b)],_0x369360=_0x42353f?_0x4628da[_0x12f85b(0x1b5)](_0x4ca03b=>_0x4ca03b['relativePath']!==_0x42353f):_0x4628da;if(_0xcfa773&&_0x369360[_0x12f85b(0x1a6)]===0x1){_0x1d0445[_0x12f85b(0x1b6)](_0x369360[0x0]);continue;}throw CliErrors[_0x12f85b(0x1b1)](_0x12f85b(0x184)+_0xf77b8a+_0x12f85b(0x18b));}return _0x1d0445;}export const sqlPush={'service':'sql','command':'push','description':'Push\x20local\x20SQL\x20files\x20to\x20remote','risk':a177_0x16cc7b(0x195),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a177_0x16cc7b(0x18d),'type':a177_0x16cc7b(0x1b2),'description':a177_0x16cc7b(0x1a8)}],async 'dryRun'(_0x27b7f0){const _0x5de01d=a177_0x16cc7b,_0xbe9497=loadSqlProjectConfig(_0x27b7f0[_0x5de01d(0x186)]),_0x21e1c1=await readSqlLockFile(_0xbe9497[_0x5de01d(0x1ad)]),{appLock:_0x3ae1eb}=ensureSqlLockScope(_0x21e1c1??createEmptySqlLock(),_0x27b7f0[_0x5de01d(0x186)],_0xbe9497[_0x5de01d(0x1af)],'push'),_0x3469c3=await getTargetSqlQueries(_0xbe9497,_0x3ae1eb,_0x27b7f0['str'](_0x5de01d(0x190))||undefined),_0xac091b=[];for(const _0x4d2f96 of _0x3469c3){const _0x40a828=await computeSqlFileHash(_0x4d2f96[_0x5de01d(0x1a7)]),_0x532fb5=_0x3ae1eb[_0x5de01d(0x1c1)][_0x4d2f96[_0x5de01d(0x183)]],_0x373bba=!!_0x532fb5&&(_0x532fb5[_0x5de01d(0x19b)]!==_0x4d2f96[_0x5de01d(0x1ac)]||!!_0x4d2f96['sqlName']&&_0x532fb5[_0x5de01d(0x199)]!==_0x4d2f96[_0x5de01d(0x199)]);if(!_0x27b7f0[_0x5de01d(0x194)]('force')&&_0x532fb5&&_0x532fb5[_0x5de01d(0x1b8)]===_0x40a828&&!_0x373bba)continue;_0xac091b[_0x5de01d(0x1b6)](_0x4d2f96['sqlCode']);}return{'method':_0x5de01d(0x1b4),'url':_0x5de01d(0x1a4),'body':{'sqlCodes':_0xac091b,'appCode':_0x27b7f0[_0x5de01d(0x186)]},'description':_0x5de01d(0x189)+_0xac091b[_0x5de01d(0x1a6)]+_0x5de01d(0x17d)};},async 'execute'(_0x9052c7){const _0x7e8377=a177_0x16cc7b,_0x39c4bd=loadSqlProjectConfig(_0x9052c7[_0x7e8377(0x186)]),_0x292178=await readSqlLockFile(_0x39c4bd[_0x7e8377(0x1ad)]),{lockData:_0x4e6409,appLock:_0x599480}=ensureSqlLockScope(_0x292178??createEmptySqlLock(),_0x9052c7[_0x7e8377(0x186)],_0x39c4bd[_0x7e8377(0x1af)],_0x7e8377(0x1b6)),_0x46fca6=await getTargetSqlQueries(_0x39c4bd,_0x599480,_0x9052c7['str'](_0x7e8377(0x190))||undefined);if(_0x46fca6[_0x7e8377(0x1a6)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x7e8377(0x1a1)};const _0x7768ef=[],_0x142f72=[],_0x3da50f=[];for(const _0x3841b9 of _0x46fca6){const _0x1e76e0=_0x599480[_0x7e8377(0x1c1)][_0x3841b9[_0x7e8377(0x183)]];if(!_0x1e76e0){_0x3da50f[_0x7e8377(0x1b6)]({'sqlCode':_0x3841b9[_0x7e8377(0x183)],'error':_0x7e8377(0x1ba)});continue;}try{const _0x54b6c9=await computeSqlFileHash(_0x3841b9[_0x7e8377(0x1a7)]),_0x440636=_0x1e76e0['path']!==_0x3841b9[_0x7e8377(0x1ac)]||!!_0x3841b9[_0x7e8377(0x199)]&&_0x1e76e0[_0x7e8377(0x199)]!==_0x3841b9['sqlName'];if(!_0x9052c7[_0x7e8377(0x194)]('force')&&_0x1e76e0[_0x7e8377(0x1b8)]===_0x54b6c9&&!_0x440636){_0x142f72[_0x7e8377(0x1b6)]({'sqlCode':_0x3841b9[_0x7e8377(0x183)],'reason':'unchanged'});continue;}if(_0x1e76e0[_0x7e8377(0x196)]==null){_0x3da50f[_0x7e8377(0x1b6)]({'sqlCode':_0x3841b9[_0x7e8377(0x183)],'error':_0x7e8377(0x1a9)});continue;}const _0x59b8c7=await readFile(_0x3841b9['filePath'],_0x7e8377(0x182)),_0x40021d=stripLocalSqlMetadata(_0x59b8c7,_0x3841b9[_0x7e8377(0x1b0)]),_0xb8efbc=_0x3841b9[_0x7e8377(0x199)]||_0x1e76e0[_0x7e8377(0x199)],_0x1f3190=await resolveTargetDbBinding(_0x9052c7[_0x7e8377(0x186)],_0x3841b9,_0x1e76e0),_0x130742=await updateSqlQuery({'id':_0x1e76e0['remoteId'],'appCode':_0x9052c7[_0x7e8377(0x186)],'sqlCode':_0x3841b9[_0x7e8377(0x183)],'sqlName':_0xb8efbc,'dbId':_0x1f3190['dbId'],'version':_0x1e76e0[_0x7e8377(0x196)],'sqlContent':_0x40021d,'sqlConfig':_0x1e76e0['sqlConfig']??undefined}),_0x2e65dc=_0x130742[_0x7e8377(0x198)]?await getDbName(_0x9052c7[_0x7e8377(0x186)],Number(_0x130742[_0x7e8377(0x198)]))[_0x7e8377(0x1c0)](()=>_0x1f3190[_0x7e8377(0x1b7)]):_0x1f3190[_0x7e8377(0x1b7)];_0x599480[_0x7e8377(0x1c1)][_0x3841b9['sqlCode']]={...buildSqlLockEntry(_0x130742,_0x40021d,_0x54b6c9,{'dbName':_0x2e65dc}),'path':_0x3841b9['relativePath'],'mode':_0x1e76e0[_0x7e8377(0x1b0)]},await archivePreviousSqlFileIfNeeded(_0x39c4bd,_0x1e76e0['path'],_0x3841b9[_0x7e8377(0x1ac)]),_0x7768ef[_0x7e8377(0x1b6)]({'sqlCode':_0x3841b9[_0x7e8377(0x183)],'remoteId':_0x1e76e0[_0x7e8377(0x19e)]});}catch(_0x572123){_0x3da50f[_0x7e8377(0x1b6)]({'sqlCode':_0x3841b9[_0x7e8377(0x183)],'error':_0x572123 instanceof Error?_0x572123[_0x7e8377(0x1ab)]:String(_0x572123)});}}return _0x599480[_0x7e8377(0x1ae)]=new Date()[_0x7e8377(0x18f)](),await writeSqlLockFile(_0x39c4bd[_0x7e8377(0x1ad)],_0x4e6409),{'ok':_0x3da50f['length']===0x0,'data':{'pushed':_0x7768ef,'skipped':_0x142f72,'failed':_0x3da50f},'message':_0x7e8377(0x19a)+_0x7768ef[_0x7e8377(0x1a6)]+_0x7e8377(0x19d)+_0x142f72['length']+_0x7e8377(0x1a5)+_0x3da50f[_0x7e8377(0x1a6)]+_0x7e8377(0x1a2)};}};async function archivePreviousSqlFileIfNeeded(_0x43aabb,_0x5ecd73,_0x1be57b){const _0x2a5f3e=a177_0x16cc7b;if(!_0x5ecd73||_0x5ecd73===_0x1be57b)return;const _0x22c109=join(_0x43aabb[_0x2a5f3e(0x192)],_0x5ecd73);if(!await fileExists(_0x22c109))return;const _0x21441e=await moveToTrash(_0x43aabb[_0x2a5f3e(0x1b9)],_0x43aabb['trashDir'],_0x22c109);await cleanupEmptyDirectories(dirname(_0x22c109),_0x43aabb[_0x2a5f3e(0x192)]),void _0x21441e;}function a177_0x196f(){const _0x1c11a1=['replace','dbId','sqlName','Push\x20complete:\x20','path','startsWith','\x20pushed,\x20','remoteId','Local\x20SQL\x20not\x20found:\x20','No\x20database\x20matches\x20local\x20directory\x20\x22','No\x20local\x20SQL\x20files\x20found.','\x20failed','\x22\x20for\x20sqlCode\x20','/smartapi/custom/updateUserCustomSql','\x20skipped,\x20','length','filePath','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','6998016ZUBhYw','message','relativePath','lockFilePath','lastSync','sqlRoot','mode','validation','boolean','7353090OptyXP','POST','filter','push','dbName','hash','projectRoot','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','map','entries','28400ViHIsQ','336159fjlXvC','join','catch','sqls','\x20SQL\x20file(s)','get','set','has','930GJSyWG','utf8','sqlCode','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','11AEnnsQ','appCode','1897395VVRXvf','13754ONnNjr','Would\x20push\x20','140unzwOf','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','67ApvGOU','force','13372myCiXC','toISOString','sqlcode','Local\x20directory\x20\x22','sqlRootDir','isFinite','bool','high-risk-write','version'];a177_0x196f=function(){return _0x1c11a1;};return a177_0x196f();}async function moveToTrash(_0x2d3760,_0x237f2a,_0x30d902){const _0x1f2f84=a177_0x16cc7b,_0x3c6178=new Date()['toISOString']()[_0x1f2f84(0x197)](/[:.]/g,'-'),_0x439c83=relative(_0x2d3760,_0x30d902),_0x215d36=join(_0x237f2a,_0x3c6178,_0x439c83);return await mkdir(dirname(_0x215d36),{'recursive':!![]}),await rename(_0x30d902,_0x215d36),_0x215d36;}async function cleanupEmptyDirectories(_0x5b83a3,_0x458460){const _0x2bed2e=a177_0x16cc7b;let _0x3e89f0=resolve(_0x5b83a3);const _0x15b247=resolve(_0x458460);while(_0x3e89f0[_0x2bed2e(0x19c)](''+_0x15b247+sep)||_0x3e89f0===_0x15b247){if(_0x3e89f0===_0x15b247)return;try{const _0x2221dc=await readdir(_0x3e89f0);if(_0x2221dc[_0x2bed2e(0x1a6)]>0x0)return;await rmdir(_0x3e89f0);}catch{return;}_0x3e89f0=dirname(_0x3e89f0);}}async function resolveTargetDbBinding(_0x113a7c,_0x3f51e3,_0x5a6e2b){const _0x2a7b4e=a177_0x16cc7b,_0x55a3a0=_0x3f51e3['dbDirectory'];if(!_0x55a3a0)return{'dbId':_0x5a6e2b[_0x2a7b4e(0x198)],'dbName':_0x5a6e2b['dbName']};const _0x230684=buildDbDirectoryName(_0x5a6e2b['dbName'],_0x5a6e2b[_0x2a7b4e(0x198)]);if(_0x55a3a0===_0x230684)return{'dbId':_0x5a6e2b['dbId'],'dbName':_0x5a6e2b[_0x2a7b4e(0x1b7)]};const _0x5800f0=parseExplicitDbDirectory(_0x55a3a0);if(_0x5800f0!=null)return{'dbId':_0x5800f0,'dbName':await getDbName(_0x113a7c,_0x5800f0)[_0x2a7b4e(0x1c0)](()=>undefined)};const _0x5960b2=await listDatabases(_0x113a7c),_0xe5b878=_0x5960b2[_0x2a7b4e(0x1b5)](_0x4c810b=>buildDbDirectoryName(_0x4c810b[_0x2a7b4e(0x1b7)],_0x4c810b[_0x2a7b4e(0x198)])===_0x55a3a0);if(_0xe5b878[_0x2a7b4e(0x1a6)]===0x1)return{'dbId':_0xe5b878[0x0][_0x2a7b4e(0x198)],'dbName':_0xe5b878[0x0][_0x2a7b4e(0x1b7)]};if(_0xe5b878[_0x2a7b4e(0x1a6)]===0x0)throw CliErrors[_0x2a7b4e(0x1b1)](_0x2a7b4e(0x1a0)+_0x55a3a0+_0x2a7b4e(0x1a3)+_0x3f51e3['sqlCode']+'.');const _0x286e43=_0xe5b878[_0x2a7b4e(0x1bb)](_0x2c3fc6=>_0x2c3fc6[_0x2a7b4e(0x1b7)]+'\x20('+_0x2c3fc6['dbId']+')')[_0x2a7b4e(0x1bf)](',\x20');throw CliErrors[_0x2a7b4e(0x1b1)](_0x2a7b4e(0x191)+_0x55a3a0+'\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20'+_0x3f51e3[_0x2a7b4e(0x183)]+':\x20'+_0x286e43);}function parseExplicitDbDirectory(_0x1ea97a){const _0x3991c6=a177_0x16cc7b,_0x7f8871=/^db-(\d+)$/['exec'](_0x1ea97a);if(!_0x7f8871)return null;const _0x2c7649=Number(_0x7f8871[0x1]);return Number[_0x3991c6(0x193)](_0x2c7649)&&_0x2c7649>0x0?_0x2c7649:null;}
|
package/lib/commands/sql/save.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a178_0x362c(){const _0x1b17f5=['Create\x20new\x20SQL\x20with\x20`rabetbase\x20sql\x20create\x20--name\x20<name>\x20--db-id\x20<id>\x20--mode\x20sql|mybatisXml`.','Deprecated:\x20use\x20sql\x20create\x20to\x20create\x20and\x20sql\x20push\x20to\x20update','1588413NXWsaK','Query\x20description','write','`rabetbase\x20sql\x20save`\x20has\x20been\x20deprecated.','file','2660lNjzJo','9ipWwhK','11142490oSmKRf','save','description','string','sql','8410296JMgQOH','839Enqrlt','Target\x20database\x20—\x20accepts\x20a\x20numeric\x20ID\x20or\x20database\x20name\x20(e.g.\x20ecommerce_db)','validation','SQL\x20query\x20display\x20name','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`.','26928BBVhpI','21541949RelSCQ','3122upNdAh','1581700bVjcMC','5HNMqes'];a178_0x362c=function(){return _0x1b17f5;};return a178_0x362c();}const a178_0x21ccad=a178_0x3780;(function(_0x26edae,_0x25d142){const _0x4b7aa7=a178_0x3780,_0x27416a=_0x26edae();while(!![]){try{const _0x20a7b3=parseInt(_0x4b7aa7(0x12e))/0x1*(parseInt(_0x4b7aa7(0x135))/0x2)+parseInt(_0x4b7aa7(0x13a))/0x3+-parseInt(_0x4b7aa7(0x136))/0x4+parseInt(_0x4b7aa7(0x137))/0x5*(parseInt(_0x4b7aa7(0x12d))/0x6)+parseInt(_0x4b7aa7(0x13f))/0x7*(-parseInt(_0x4b7aa7(0x133))/0x8)+parseInt(_0x4b7aa7(0x127))/0x9*(parseInt(_0x4b7aa7(0x128))/0xa)+-parseInt(_0x4b7aa7(0x134))/0xb;if(_0x20a7b3===_0x25d142)break;else _0x27416a['push'](_0x27416a['shift']());}catch(_0xe23ff5){_0x27416a['push'](_0x27416a['shift']());}}}(a178_0x362c,0xb054b));import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';const SQL_SAVE_DEPRECATED_HINT=[a178_0x21ccad(0x13d),a178_0x21ccad(0x138),a178_0x21ccad(0x132)]['join']('\x0a');function a178_0x3780(_0x161d8b,_0x4b7e04){_0x161d8b=_0x161d8b-0x127;const _0x362cbd=a178_0x362c();let _0x3780dd=_0x362cbd[_0x161d8b];return _0x3780dd;}export const sqlSave={'service':a178_0x21ccad(0x12c),'command':a178_0x21ccad(0x129),'description':a178_0x21ccad(0x139),'risk':a178_0x21ccad(0x13c),'requiresAuth':![],'requiresAppCode':![],'flags':[{'name':a178_0x21ccad(0x13e),'type':a178_0x21ccad(0x12b),'required':!![],'description':'Path\x20to\x20the\x20SQL\x20file'},SQLCODE_FLAG_OPTIONAL,{'name':'sqlname','type':a178_0x21ccad(0x12b),'description':a178_0x21ccad(0x131)},{'name':'db','type':a178_0x21ccad(0x12b),'description':a178_0x21ccad(0x12f)},{'name':a178_0x21ccad(0x12a),'type':'string','description':a178_0x21ccad(0x13b)}],async 'validate'(){const _0xf22cec=a178_0x21ccad;throw CliErrors[_0xf22cec(0x130)](SQL_SAVE_DEPRECATED_HINT);},async 'execute'(){const _0x27f39a=a178_0x21ccad;throw CliErrors[_0x27f39a(0x130)](SQL_SAVE_DEPRECATED_HINT);}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x1abe96,_0x35f6da){const _0x71ac57=a179_0x44a9,_0x2aba6f=_0x1abe96();while(!![]){try{const _0xfe66fb=-parseInt(_0x71ac57(0xb9))/0x1+parseInt(_0x71ac57(0xa8))/0x2*(parseInt(_0x71ac57(0xb5))/0x3)+-parseInt(_0x71ac57(0xb3))/0x4+parseInt(_0x71ac57(0xa4))/0x5+-parseInt(_0x71ac57(0xb1))/0x6+parseInt(_0x71ac57(0xc1))/0x7*(-parseInt(_0x71ac57(0xaf))/0x8)+-parseInt(_0x71ac57(0xb2))/0x9*(-parseInt(_0x71ac57(0xa5))/0xa);if(_0xfe66fb===_0x35f6da)break;else _0x2aba6f['push'](_0x2aba6f['shift']());}catch(_0x13b998){_0x2aba6f['push'](_0x2aba6f['shift']());}}}(a179_0x4efb,0x3f540));import{createInterface}from'node:readline';import{join}from'node:path';function a179_0x4efb(){const _0x23e7d6=['sqlConfig','toLowerCase','test','\x20-->','lastSync','map','trimStart','question','stdin','yes','sqlRoot','dbId','897025xuSZkF','9530cMuGoo','close','syncedAt','269678LxJjhK','split','mybatisXml','mode','sqlName','length','filter','720PLuegY','join','2820180hPShXA','10269BaxDaR','1173608RYrAXK','version','3SzgyeT','replace','description','trim','310573arinWZ','endsWith','sqlCode','includes','\x20[y/N]\x20','path','stderr','dbName','5306CEtxeP'];a179_0x4efb=function(){return _0x23e7d6;};return a179_0x4efb();}import{buildDefaultSqlFileName,buildSqlRelativePath,detectSqlMode}from'../../core/sql-sync/utils.js';function a179_0x44a9(_0x241193,_0x52b407){_0x241193=_0x241193-0xa4;const _0x4efb03=a179_0x4efb();let _0x44a959=_0x4efb03[_0x241193];return _0x44a959;}export const SQL_LOCAL_REL_DIR='.rabetbase/sql';export function buildSqlLockEntry(_0x4c6d0f,_0x193e8b,_0x30bcac,_0x4c5633){const _0x1ca8ac=a179_0x44a9,_0x16b7ce=detectSqlMode(_0x193e8b);return{'path':buildSqlRelativePath(_0x4c6d0f[_0x1ca8ac(0xbb)],_0x4c6d0f['sqlName'],_0x4c5633?.['dbName'],_0x16b7ce,_0x4c6d0f[_0x1ca8ac(0xcd)]),'hash':_0x30bcac,'remoteId':_0x4c6d0f['id'],'version':_0x4c6d0f[_0x1ca8ac(0xb4)],'dbId':Number(_0x4c6d0f[_0x1ca8ac(0xcd)]),'dbName':_0x4c5633?.[_0x1ca8ac(0xc0)],'sqlName':_0x4c6d0f[_0x1ca8ac(0xac)],'sqlConfig':_0x4c6d0f[_0x1ca8ac(0xc2)]??undefined,'mode':_0x16b7ce};}export function cloneSqlLockData(_0x40ac0d){const _0x1bfc02=a179_0x44a9;return{'apps':Object['fromEntries'](Object['entries'](_0x40ac0d['apps'])[_0x1bfc02(0xc7)](([_0x3c3314,_0x3d2a78])=>[_0x3c3314,{'sqlRoot':_0x3d2a78[_0x1bfc02(0xcc)],'lastSync':_0x3d2a78[_0x1bfc02(0xc6)],'sqls':{..._0x3d2a78['sqls']}}]))};}export function ensureRemoteSqlContent(_0x549524){return _0x549524['sqlContent']??'';}export function buildLocalSqlFileContent(_0x240aef,_0x194852,_0x218c6b){const _0x3eb9a2=a179_0x44a9,_0xd24ecd=_0x218c6b?.['mode']??detectSqlMode(_0x194852),_0x3a2897=stripLocalSqlMetadata(_0x194852,_0xd24ecd)[_0x3eb9a2(0xb8)](),_0x5aff38=[...buildMetadataHeaderLines({'sqlCode':_0x240aef['sqlCode'],'sqlName':_0x240aef[_0x3eb9a2(0xac)],'dbId':_0x240aef[_0x3eb9a2(0xcd)],'dbName':_0x218c6b?.[_0x3eb9a2(0xc0)],'mode':_0xd24ecd,'syncedAt':_0x218c6b?.[_0x3eb9a2(0xa7)],'description':_0x218c6b?.[_0x3eb9a2(0xb7)]},_0xd24ecd),'',_0x3a2897],_0x42efc5=_0x5aff38[_0x3eb9a2(0xb0)]('\x0a');return _0x42efc5[_0x3eb9a2(0xba)]('\x0a')?_0x42efc5:_0x42efc5+'\x0a';}export function stripLocalSqlMetadata(_0x2253ca,_0x4de9a1){const _0x250b42=a179_0x44a9,_0xe0fd9e=_0x2253ca[_0x250b42(0xb6)](/\r\n/g,'\x0a')[_0x250b42(0xa9)]('\x0a'),_0x521b14=[];let _0x5e6eb0=0x0;if(_0x4de9a1===_0x250b42(0xaa))while(_0x5e6eb0<_0xe0fd9e[_0x250b42(0xad)]){const _0x1a376c=_0xe0fd9e[_0x5e6eb0]??'';if(/^\s*<!--\s*@lovrabet\./[_0x250b42(0xc4)](_0x1a376c)){_0x5e6eb0++;continue;}if(_0x1a376c[_0x250b42(0xb8)]()===''&&_0x5e6eb0>0x0){_0x5e6eb0++;continue;}break;}else while(_0x5e6eb0<_0xe0fd9e[_0x250b42(0xad)]){const _0x3a9b05=_0xe0fd9e[_0x5e6eb0]??'';if(/^\s*--\s*@lovrabet\./[_0x250b42(0xc4)](_0x3a9b05)){_0x5e6eb0++;continue;}if(_0x3a9b05[_0x250b42(0xb8)]()===''&&_0x5e6eb0>0x0){_0x5e6eb0++;continue;}break;}for(;_0x5e6eb0<_0xe0fd9e[_0x250b42(0xad)];_0x5e6eb0++){_0x521b14['push'](_0xe0fd9e[_0x5e6eb0]);}return _0x521b14[_0x250b42(0xb0)]('\x0a')[_0x250b42(0xc8)]();}export function resolveSqlMode(_0x41ef4b,_0x209b12){const _0x263302=a179_0x44a9;if(_0x209b12?.['mode'])return _0x209b12[_0x263302(0xab)];return detectSqlMode(_0x41ef4b);}export function resolveSqlFileName(_0x5dcc2b,_0x9d6333,_0x10afc0){const _0x1a9691=a179_0x44a9;if(_0x10afc0?.[_0x1a9691(0xbe)])return _0x10afc0['path'];if(_0x10afc0?.[_0x1a9691(0xac)]||_0x10afc0?.[_0x1a9691(0xc0)])return buildSqlRelativePath(_0x5dcc2b,_0x10afc0?.['sqlName'],_0x10afc0?.[_0x1a9691(0xc0)],resolveSqlMode(_0x9d6333,_0x10afc0),_0x10afc0?.[_0x1a9691(0xcd)]);return buildDefaultSqlFileName(_0x5dcc2b,resolveSqlMode(_0x9d6333,_0x10afc0));}export function resolveSqlLocalDir(_0x176ba7,_0x52c350){return join(_0x176ba7,SQL_LOCAL_REL_DIR,_0x52c350);}export async function confirmForceOverwrite(_0x4a143c){const _0x18727f=a179_0x44a9,_0x35c9bf=createInterface({'input':process[_0x18727f(0xca)],'output':process[_0x18727f(0xbf)]}),_0x44e3bb=await new Promise(_0x2ab878=>{const _0x7adfd1=_0x18727f;_0x35c9bf[_0x7adfd1(0xc9)](_0x4a143c+_0x7adfd1(0xbd),_0x2ab878);});return _0x35c9bf[_0x18727f(0xa6)](),['y',_0x18727f(0xcb)][_0x18727f(0xbc)](_0x44e3bb['trim']()[_0x18727f(0xc3)]());}export function findSqlLockScope(_0x117ae3,_0x5148ee){return _0x117ae3['apps'][_0x5148ee];}function buildMetadataHeaderLines(_0x48d98b,_0x2a75fc){const _0x1566a0=a179_0x44a9,_0x2c96c5=[[_0x1566a0(0xbb),_0x48d98b[_0x1566a0(0xbb)]],[_0x1566a0(0xac),_0x48d98b['sqlName']],[_0x1566a0(0xcd),_0x48d98b[_0x1566a0(0xcd)]],[_0x1566a0(0xc0),_0x48d98b[_0x1566a0(0xc0)]],[_0x1566a0(0xab),_0x48d98b[_0x1566a0(0xab)]],[_0x1566a0(0xa7),_0x48d98b['syncedAt']],['description',_0x48d98b[_0x1566a0(0xb7)]]];if(_0x2a75fc===_0x1566a0(0xaa))return _0x2c96c5['filter'](([,_0x4d3fe9])=>_0x4d3fe9!==undefined&&_0x4d3fe9!==null&&String(_0x4d3fe9)['trim']()!=='')[_0x1566a0(0xc7)](([_0x3b6131,_0x38cbff])=>'<!--\x20@lovrabet.'+_0x3b6131+':\x20'+String(_0x38cbff)+_0x1566a0(0xc5));return _0x2c96c5[_0x1566a0(0xae)](([,_0x1911cc])=>_0x1911cc!==undefined&&_0x1911cc!==null&&String(_0x1911cc)[_0x1566a0(0xb8)]()!=='')[_0x1566a0(0xc7)](([_0x5116b1,_0x4b5566])=>'--\x20@lovrabet.'+_0x5116b1+':\x20'+String(_0x4b5566));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a180_0x1cb147=a180_0x3c63;(function(_0x2d113e,_0x4996ba){const _0x283400=a180_0x3c63,_0xcca602=_0x2d113e();while(!![]){try{const _0x2186ff=-parseInt(_0x283400(0x1a1))/0x1+parseInt(_0x283400(0x1a4))/0x2+-parseInt(_0x283400(0x1a6))/0x3+-parseInt(_0x283400(0x1b4))/0x4+-parseInt(_0x283400(0x1bb))/0x5+-parseInt(_0x283400(0x1a0))/0x6*(-parseInt(_0x283400(0x1b5))/0x7)+parseInt(_0x283400(0x1ac))/0x8;if(_0x2186ff===_0x4996ba)break;else _0xcca602['push'](_0xcca602['shift']());}catch(_0x198b51){_0xcca602['push'](_0xcca602['shift']());}}}(a180_0x2c67,0xd041e));import{listSqlQueries}from'../../core/api-client.js';function a180_0x2c67(){const _0xc3a499=['hash','bool','\x20remote-only','keys','All\x20SQL\x20queries\x20are\x20in\x20sync.','\x20modified,\x20','2110974qCdqcu','1083285OVlkMI','length','path','416334afkRfc','lockKey','2115363ZdjHRr','\x20unchanged','tableData','sqlName','sqlRoot','status','32280392rCzaIe','appCode','lockFilePath','push','Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','relativePath','remote','has','4327892WMMNuN','7eIbGOQ','filePath','sql','Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally','boolean','\x20missing,\x20','4358220bVWuoe','map','read'];a180_0x2c67=function(){return _0xc3a499;};return a180_0x2c67();}import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile}from'../../core/sql-sync/lock.js';const PAGE_SIZE=0x64;function a180_0x3c63(_0x25760f,_0x5a8c40){_0x25760f=_0x25760f-0x19b;const _0x2c671e=a180_0x2c67();let _0x3c63d2=_0x2c671e[_0x25760f];return _0x3c63d2;}async function fetchAllSqlCodes(_0x29d106){const _0x1219d7=a180_0x3c63,_0x202701=[];let _0x5a3a2e=0x1;while(!![]){const _0x27ac2d=await listSqlQueries(_0x29d106,{'currentPage':_0x5a3a2e,'pageSize':PAGE_SIZE}),_0x1b8bcb=_0x27ac2d[_0x1219d7(0x1a8)]??[];_0x202701[_0x1219d7(0x1af)](..._0x1b8bcb[_0x1219d7(0x1bc)](_0x943b53=>_0x943b53['sqlCode']));if(_0x1b8bcb[_0x1219d7(0x1a2)]===0x0)break;const _0x51a1db=_0x27ac2d['paging']?.['totalCount'];if(_0x51a1db!=null?_0x202701[_0x1219d7(0x1a2)]>=_0x51a1db:_0x1b8bcb[_0x1219d7(0x1a2)]<PAGE_SIZE)break;_0x5a3a2e++;}return _0x202701;}export const sqlStatus={'service':a180_0x1cb147(0x1b7),'command':a180_0x1cb147(0x1ab),'description':a180_0x1cb147(0x1b0),'risk':a180_0x1cb147(0x1bd),'flags':[{'name':a180_0x1cb147(0x1b2),'type':a180_0x1cb147(0x1b9),'description':a180_0x1cb147(0x1b8)}],async 'execute'(_0x31413c){const _0x17d3a2=a180_0x1cb147,_0xc3ba1c=loadSqlProjectConfig(_0x31413c['appCode']),_0x14d4bd=await readSqlLockFile(_0xc3ba1c[_0x17d3a2(0x1ae)]),{appLock:_0x1e8674}=ensureSqlLockScope(_0x14d4bd??createEmptySqlLock(),_0xc3ba1c[_0x17d3a2(0x1ad)],_0xc3ba1c[_0x17d3a2(0x1aa)],_0x17d3a2(0x1ab)),_0x366ef7=await scanLocalSqlQueries(_0xc3ba1c),_0x5c95d1=[],_0x17ad81=[],_0xfd577=[],_0x342c86=[],_0x129e4e=new Set(_0x366ef7[_0x17d3a2(0x1bc)](_0x525688=>_0x525688[_0x17d3a2(0x1a5)]));for(const _0x52dde7 of _0x366ef7){const _0x41b056=await computeSqlFileHash(_0x52dde7[_0x17d3a2(0x1b6)]),_0x3517b4=_0x1e8674['sqls'][_0x52dde7[_0x17d3a2(0x1a5)]],_0x3c3bb2=!!_0x3517b4&&_0x3517b4[_0x17d3a2(0x1a3)]!==_0x52dde7[_0x17d3a2(0x1b1)],_0x4f3ec3=!!_0x3517b4&&!!_0x52dde7[_0x17d3a2(0x1a9)]&&_0x3517b4[_0x17d3a2(0x1a9)]!==_0x52dde7[_0x17d3a2(0x1a9)];if(!_0x3517b4)_0x5c95d1[_0x17d3a2(0x1af)](_0x52dde7['lockKey']);else _0x3517b4[_0x17d3a2(0x1be)]!==_0x41b056||_0x3c3bb2||_0x4f3ec3?_0x17ad81[_0x17d3a2(0x1af)](_0x52dde7['lockKey']):_0xfd577[_0x17d3a2(0x1af)](_0x52dde7[_0x17d3a2(0x1a5)]);}for(const _0x5e50b2 of Object[_0x17d3a2(0x19d)](_0x1e8674['sqls'])){!_0x129e4e['has'](_0x5e50b2)&&_0x342c86[_0x17d3a2(0x1af)](_0x5e50b2);}const _0x3a51cf=[];if(_0x31413c[_0x17d3a2(0x19b)](_0x17d3a2(0x1b2))){const _0x39bb2e=await fetchAllSqlCodes(_0x31413c[_0x17d3a2(0x1ad)]);for(const _0x5bd99b of _0x39bb2e){!_0x129e4e[_0x17d3a2(0x1b3)](_0x5bd99b)&&!_0x1e8674['sqls'][_0x5bd99b]&&_0x3a51cf[_0x17d3a2(0x1af)](_0x5bd99b);}}const _0x5f3470=_0x5c95d1[_0x17d3a2(0x1a2)]===0x0&&_0x17ad81[_0x17d3a2(0x1a2)]===0x0&&_0x342c86[_0x17d3a2(0x1a2)]===0x0&&_0x3a51cf[_0x17d3a2(0x1a2)]===0x0;return{'ok':!![],'data':{'added':_0x5c95d1,'modified':_0x17ad81,'missing':_0x342c86,'unchanged':_0xfd577,'remoteOnly':_0x3a51cf},'message':_0x5f3470?_0x17d3a2(0x19e):_0x5c95d1[_0x17d3a2(0x1a2)]+'\x20added,\x20'+_0x17ad81[_0x17d3a2(0x1a2)]+_0x17d3a2(0x19f)+_0x342c86['length']+_0x17d3a2(0x1ba)+_0xfd577[_0x17d3a2(0x1a2)]+_0x17d3a2(0x1a7)+(_0x3a51cf[_0x17d3a2(0x1a2)]>0x0?',\x20'+_0x3a51cf[_0x17d3a2(0x1a2)]+_0x17d3a2(0x19c):'')};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a181_0x309f13=a181_0x4ec5;(function(_0x3d32ea,_0x1a28c5){const _0x4d1281=a181_0x4ec5,_0x8ae6bf=_0x3d32ea();while(!![]){try{const _0x4c0beb=parseInt(_0x4d1281(0x178))/0x1*(parseInt(_0x4d1281(0x154))/0x2)+parseInt(_0x4d1281(0x175))/0x3*(parseInt(_0x4d1281(0x139))/0x4)+parseInt(_0x4d1281(0x174))/0x5+-parseInt(_0x4d1281(0x146))/0x6+parseInt(_0x4d1281(0x161))/0x7+parseInt(_0x4d1281(0x165))/0x8*(parseInt(_0x4d1281(0x172))/0x9)+-parseInt(_0x4d1281(0x149))/0xa*(parseInt(_0x4d1281(0x151))/0xb);if(_0x4c0beb===_0x1a28c5)break;else _0x8ae6bf['push'](_0x8ae6bf['shift']());}catch(_0x62ed9a){_0x8ae6bf['push'](_0x8ae6bf['shift']());}}}(a181_0x5292,0x85269));import{readFileSync,existsSync}from'node:fs';import{resolve}from'node:path';import{validateSql}from'../../core/sql-validator.js';import{auditSqlJoinIndexes}from'../../core/sql-index-auditor.js';import{getDatasetDetail,listDatasets}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{assertDatasetIsDbTableBacked,filterDbTableBackedDatasets}from'../../commands/dataset/capability.js';export const sqlValidate={'service':a181_0x309f13(0x147),'command':'validate','description':a181_0x309f13(0x16c),'risk':'read','flags':[{'name':a181_0x309f13(0x145),'type':'string','description':a181_0x309f13(0x143)},{'name':'sql','type':a181_0x309f13(0x152),'description':a181_0x309f13(0x148)},{'name':a181_0x309f13(0x16d),'type':a181_0x309f13(0x152),'description':a181_0x309f13(0x16f)},{'name':a181_0x309f13(0x16e),'type':a181_0x309f13(0x169),'description':a181_0x309f13(0x137)}],async 'execute'(_0x5d4373){const _0x49f3fc=a181_0x309f13,_0x35b581=_0x5d4373[_0x49f3fc(0x166)](_0x49f3fc(0x145)),_0x53102d=_0x5d4373[_0x49f3fc(0x166)](_0x49f3fc(0x147)),_0x241858=_0x5d4373[_0x49f3fc(0x166)](_0x49f3fc(0x16d)),_0x15e759=_0x5d4373['bool']('check-indexes');if(!_0x35b581&&!_0x53102d)throw CliErrors[_0x49f3fc(0x15d)](_0x49f3fc(0x145),_0x49f3fc(0x142));if(_0x15e759&&!_0x241858)throw CliErrors['validation'](_0x49f3fc(0x14f));let _0x17074c;if(_0x35b581){const _0x2c7053=resolve(process[_0x49f3fc(0x13b)](),_0x35b581);if(!existsSync(_0x2c7053))throw CliErrors[_0x49f3fc(0x14b)](_0x49f3fc(0x17a)+_0x2c7053);_0x17074c=readFileSync(_0x2c7053,_0x49f3fc(0x16b));}else _0x17074c=_0x53102d;const _0x40fc02=validateSql(_0x17074c),_0x4b1e84={'valid':_0x40fc02['valid'],'sqlType':_0x40fc02['sqlType'][_0x49f3fc(0x144)],'isSelectOnly':_0x40fc02['sqlType'][_0x49f3fc(0x173)],'isDangerous':_0x40fc02[_0x49f3fc(0x15e)][_0x49f3fc(0x160)],'tables':_0x40fc02[_0x49f3fc(0x136)],'parameters':_0x40fc02[_0x49f3fc(0x164)],'message':_0x40fc02['message']};_0x40fc02[_0x49f3fc(0x15e)][_0x49f3fc(0x168)]&&(_0x4b1e84[_0x49f3fc(0x168)]=_0x40fc02[_0x49f3fc(0x15e)]['reason']);if(_0x241858&&_0x40fc02[_0x49f3fc(0x159)]){const _0x525922=_0x241858['split'](',')[_0x49f3fc(0x138)](_0x7735a7=>_0x7735a7[_0x49f3fc(0x14e)]())[_0x49f3fc(0x171)](Boolean),_0x3a4dc3=[],_0x4c5a7a=[],_0x4ebd27=filterDbTableBackedDatasets(await listDatasets(_0x5d4373[_0x49f3fc(0x14c)])),_0x396f38=new Map(_0x4ebd27[_0x49f3fc(0x138)](_0x3f0f78=>[_0x3f0f78[_0x49f3fc(0x153)]?.[_0x49f3fc(0x14a)]?.[_0x49f3fc(0x13f)](),_0x3f0f78]));for(const _0xc5b56d of _0x40fc02['tables']){const _0x105222=_0x396f38[_0x49f3fc(0x13d)](_0xc5b56d['toLowerCase']());!_0x105222&&_0x3a4dc3[_0x49f3fc(0x170)](_0x49f3fc(0x14d)+_0xc5b56d+'\x22\x20not\x20found\x20in\x20any\x20dataset');}for(const _0x2072de of _0x525922){let _0x2b6e3f;try{_0x2b6e3f=await getDatasetDetail(_0x2072de);}catch{_0x3a4dc3['push'](_0x49f3fc(0x17b)+_0x2072de+_0x49f3fc(0x155));continue;}assertDatasetIsDbTableBacked(_0x2b6e3f,_0x49f3fc(0x176));const _0x519d19=Array[_0x49f3fc(0x167)](_0x2b6e3f[_0x49f3fc(0x157)])?_0x2b6e3f[_0x49f3fc(0x157)]:[],_0xb1eb05=new Set(_0x519d19['map'](_0x49aa22=>_0x49aa22[_0x49f3fc(0x15c)]?.[_0x49f3fc(0x13f)]())),_0x12c3e9=_0x2b6e3f['dbtableConfig']?.['tableName']||_0x2b6e3f[_0x49f3fc(0x14a)]||_0x2072de;_0x4b1e84[_0x49f3fc(0x13c)+_0x12c3e9]={'code':_0x2072de,'tableName':_0x12c3e9,'fieldCount':_0xb1eb05[_0x49f3fc(0x156)],'fields':Array['from'](_0xb1eb05)};if(_0x15e759){const _0x2ff6ab=normalizeDatasetIndexes(_0x2b6e3f);_0x4c5a7a[_0x49f3fc(0x170)]({'tableName':_0x12c3e9,..._0x2ff6ab});}}_0x3a4dc3[_0x49f3fc(0x15b)]>0x0&&(_0x4b1e84[_0x49f3fc(0x163)]=_0x3a4dc3),_0x15e759&&(_0x4b1e84[_0x49f3fc(0x16a)]=auditSqlJoinIndexes(_0x17074c,_0x4c5a7a));}return{'ok':_0x40fc02['valid'],'data':_0x4b1e84,'message':_0x40fc02['message']};}};function a181_0x4ec5(_0x4893a9,_0x2d10e4){_0x4893a9=_0x4893a9-0x136;const _0x529241=a181_0x5292();let _0x4ec5a4=_0x529241[_0x4893a9];return _0x4ec5a4;}function a181_0x5292(){const _0x20faa2=['get','index_name','toLowerCase','unshift','flatMap','Provide\x20--file\x20or\x20--sql','Path\x20to\x20the\x20SQL\x20file\x20to\x20validate','type','file','6003096vtOqVc','sql','Inline\x20SQL\x20content\x20to\x20validate\x20(alternative\x20to\x20--file)','3645490xYxGmy','tableName','validation','appCode','Table\x20\x22','trim','--check-indexes\x20requires\x20--schemas.','index_columns','55rdmByD','string','dbtableConfig','10tLIRRR','\x22\x20not\x20found\x20or\x20not\x20accessible','size','fields','columns','valid','indexName','length','name','flagMissing','sqlType','pkField','isDangerous','6641355fhZLJv','columnNames','schemaWarnings','parameters','1032GzPyVz','str','isArray','reason','boolean','joinAudit','utf-8','Validate\x20SQL\x20content\x20without\x20saving\x20(type\x20detection,\x20parameter\x20extraction,\x20optional\x20schema\x20check)','schemas','check-indexes','Comma-separated\x20dataset\x20codes\x20to\x20cross-check\x20table/column\x20names\x20against','push','filter','26379DiIwpR','isSelectOnly','3322770bwlSAp','407082ulGQxa','SQL\x20schema\x20validation','dataset','85474SHeRhB','find','File\x20not\x20found:\x20','Dataset\x20\x22','tables','Audit\x20top-level\x20JOIN\x20equality\x20predicates\x20against\x20dataset\x20index\x20metadata','map','28saorUR','indexes','cwd','schema:'];a181_0x5292=function(){return _0x20faa2;};return a181_0x5292();}function normalizeDatasetIndexes(_0x5a0173){const _0x5b1a10=a181_0x309f13,_0x3472ea=Array['isArray'](_0x5a0173?.[_0x5b1a10(0x177)]?.['indexes'])?_0x5a0173[_0x5b1a10(0x177)][_0x5b1a10(0x13a)]:Array['isArray'](_0x5a0173?.[_0x5b1a10(0x13a)])?_0x5a0173[_0x5b1a10(0x13a)]:[],_0x3de94a=_0x3472ea[_0x5b1a10(0x141)](_0x26c253=>{const _0xf6dbc3=_0x5b1a10,_0x5b4877=Array[_0xf6dbc3(0x167)](_0x26c253?.[_0xf6dbc3(0x150)])?_0x26c253[_0xf6dbc3(0x150)]:Array[_0xf6dbc3(0x167)](_0x26c253?.[_0xf6dbc3(0x162)])?_0x26c253[_0xf6dbc3(0x162)]:Array[_0xf6dbc3(0x167)](_0x26c253?.[_0xf6dbc3(0x158)])?_0x26c253[_0xf6dbc3(0x158)]:[],_0x2ed0c9=_0x5b4877['filter'](_0x3d2f36=>typeof _0x3d2f36===_0xf6dbc3(0x152))[_0xf6dbc3(0x138)](_0x1c3602=>_0x1c3602[_0xf6dbc3(0x14e)]())[_0xf6dbc3(0x171)](Boolean);if(_0x2ed0c9[_0xf6dbc3(0x15b)]===0x0)return[];const _0x321ac6=[_0x26c253?.[_0xf6dbc3(0x15a)],_0x26c253?.[_0xf6dbc3(0x13e)],_0x26c253?.[_0xf6dbc3(0x15c)]][_0xf6dbc3(0x179)](_0x4d85d6=>typeof _0x4d85d6===_0xf6dbc3(0x152)&&_0x4d85d6[_0xf6dbc3(0x14e)]()),_0x4f8edb=[_0x26c253?.['index_type'],_0x26c253?.['type']][_0xf6dbc3(0x179)](_0x50a5d1=>typeof _0x50a5d1===_0xf6dbc3(0x152)&&_0x50a5d1[_0xf6dbc3(0x14e)]());return[{..._0x321ac6?{'name':_0x321ac6[_0xf6dbc3(0x14e)]()}:{},..._0x4f8edb?{'type':_0x4f8edb[_0xf6dbc3(0x14e)]()}:{},'columns':_0x2ed0c9}];}),_0xcd5a49=[..._0x3de94a],_0x4c262f=typeof _0x5a0173?.['dbtableConfig']?.[_0x5b1a10(0x15f)]===_0x5b1a10(0x152)?_0x5a0173[_0x5b1a10(0x153)]['pkField']['split'](',')['map'](_0x5cc6b4=>_0x5cc6b4[_0x5b1a10(0x14e)]())[_0x5b1a10(0x171)](Boolean):[];return _0x4c262f[_0x5b1a10(0x15b)]>0x0&&_0xcd5a49[_0x5b1a10(0x140)]({'type':'primary','columns':_0x4c262f}),{'indexes':_0xcd5a49,'metadataAvailable':_0x3de94a['length']>0x0};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x5a2d2b,_0x2cbe36){const _0x92b84c=a182_0x3491,_0x47a5d8=_0x5a2d2b();while(!![]){try{const _0x3ce3b=parseInt(_0x92b84c(0x1dc))/0x1*(parseInt(_0x92b84c(0x1e0))/0x2)+-parseInt(_0x92b84c(0x1e2))/0x3*(parseInt(_0x92b84c(0x1e3))/0x4)+-parseInt(_0x92b84c(0x1d9))/0x5*(parseInt(_0x92b84c(0x1da))/0x6)+parseInt(_0x92b84c(0x1db))/0x7*(-parseInt(_0x92b84c(0x1e5))/0x8)+-parseInt(_0x92b84c(0x1dd))/0x9*(parseInt(_0x92b84c(0x1e6))/0xa)+-parseInt(_0x92b84c(0x1de))/0xb*(-parseInt(_0x92b84c(0x1e4))/0xc)+-parseInt(_0x92b84c(0x1df))/0xd*(-parseInt(_0x92b84c(0x1e1))/0xe);if(_0x3ce3b===_0x2cbe36)break;else _0x47a5d8['push'](_0x47a5d8['shift']());}catch(_0x2fa868){_0x47a5d8['push'](_0x47a5d8['shift']());}}}(a182_0x2692,0x91fe9));function a182_0x3491(_0x5cd4ea,_0x5caeff){_0x5cd4ea=_0x5cd4ea-0x1d9;const _0x269203=a182_0x2692();let _0x3491ca=_0x269203[_0x5cd4ea];return _0x3491ca;}import{taskStatus}from'../../commands/task/status.js';export const taskDefinitions=[taskStatus];function a182_0x2692(){const _0x3e4f57=['7OQHNQM','17oihIHE','9utmYKD','110lnIQQd','2193061WmcAUh','84174nPQUcu','252cjEgoT','2793954bKdgaL','4MwrMWJ','108672YySvPY','8346328WpttoU','8883670IlLgbO','230dvfDTK','49776LpZkTF'];a182_0x2692=function(){return _0x3e4f57;};return a182_0x2692();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a183_0x443961=a183_0xb92f;(function(_0x476b05,_0x55a604){const _0x44ec2a=a183_0xb92f,_0x91a233=_0x476b05();while(!![]){try{const _0xee52ff=parseInt(_0x44ec2a(0x17f))/0x1*(parseInt(_0x44ec2a(0x177))/0x2)+-parseInt(_0x44ec2a(0x176))/0x3+parseInt(_0x44ec2a(0x16c))/0x4+-parseInt(_0x44ec2a(0x17b))/0x5*(parseInt(_0x44ec2a(0x169))/0x6)+-parseInt(_0x44ec2a(0x17c))/0x7+parseInt(_0x44ec2a(0x17a))/0x8+parseInt(_0x44ec2a(0x16d))/0x9*(parseInt(_0x44ec2a(0x17d))/0xa);if(_0xee52ff===_0x55a604)break;else _0x91a233['push'](_0x91a233['shift']());}catch(_0x29895e){_0x91a233['push'](_0x91a233['shift']());}}}(a183_0x2b96,0x72293));import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asyncTaskMessage,buildAsyncTaskStatusCommand,normalizeAsyncTask}from'../../commands/common/async-task.js';function a183_0x2b96(){const _0x129451=['read','task',',\x20received\x20','appCode','trim','str','task-id','1844067zrNaXG','86hkmjdc','cookie','flagMissing','1982504YELdEA','5WbrICn','2776305KdGrAO','150mzjbIX','compress','10942PdChAh','status','string','apiError','taskId','Query\x20an\x20asynchronous\x20task;\x20repeat\x20for\x20PENDING\x20or\x20PROCESSING\x20until\x20SUCCESS\x20or\x20FAILED','3734202JUmRoD','Task\x20status\x20response\x20id\x20mismatch:\x20requested\x20','isTerminal','1127160ZRSYLp','660699KVZLxX','Task\x20id\x20returned\x20by\x20an\x20asynchronous\x20platform\x20command'];a183_0x2b96=function(){return _0x129451;};return a183_0x2b96();}function a183_0xb92f(_0x287b18,_0x4dd519){_0x287b18=_0x287b18-0x169;const _0x2b96de=a183_0x2b96();let _0xb92f27=_0x2b96de[_0x287b18];return _0xb92f27;}import{getAsyncTaskStatus}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';export const taskStatus={'service':a183_0x443961(0x170),'command':a183_0x443961(0x180),'description':a183_0x443961(0x184),'risk':a183_0x443961(0x16f),'defaultOutputFormat':a183_0x443961(0x17e),'structuredErrors':!![],'flags':[{'name':a183_0x443961(0x175),'type':a183_0x443961(0x181),'required':!![],'description':a183_0x443961(0x16e)},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x21c0c6){const _0x4a6c12=a183_0x443961;if(!_0x21c0c6[_0x4a6c12(0x174)](_0x4a6c12(0x175))[_0x4a6c12(0x173)]())throw CliErrors[_0x4a6c12(0x179)](_0x4a6c12(0x175));},async 'execute'(_0x3270f4){const _0x375c4a=a183_0x443961,_0x5a0cc6=_0x3270f4[_0x375c4a(0x174)]('task-id')[_0x375c4a(0x173)](),_0x4c03cc=normalizeAsyncTask(await getAsyncTaskStatus(_0x5a0cc6,_0x3270f4['appCode'],_0x3270f4[_0x375c4a(0x178)]));if(_0x4c03cc[_0x375c4a(0x183)]!==_0x5a0cc6)throw CliErrors[_0x375c4a(0x182)](_0x375c4a(0x16a)+_0x5a0cc6+_0x375c4a(0x171)+_0x4c03cc[_0x375c4a(0x183)]+'.');const _0x8b0246=buildAsyncTaskStatusCommand(_0x4c03cc[_0x375c4a(0x183)],_0x3270f4[_0x375c4a(0x172)]);return{'ok':!![],'message':asyncTaskMessage(_0x4c03cc),'data':{'appCode':_0x3270f4['appCode'],..._0x4c03cc,'query':_0x4c03cc[_0x375c4a(0x16b)]?null:{'command':_0x8b0246}}};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a184_0x344f5d=a184_0x2f9b;function a184_0x2f9b(_0x3be3dc,_0x54ebf2){_0x3be3dc=_0x3be3dc-0x89;const _0x5881b0=a184_0x5881();let _0x2f9b66=_0x5881b0[_0x3be3dc];return _0x2f9b66;}function a184_0x5881(){const _0x498e15=['add','workspace\x20add','91WblLbS','395JJwrHs','1FwAYUq','518510goxiIz','292dmSZgd','9TvarOn','1189226gniSmr','7601664eqArmw','6383223ohJmUf','32646CyIOkh','5733EwUVhP','write','Register\x20an\x20app\x20profile\x20in\x20the\x20current\x20workspace\x20(or\x20--global)','12632QOsvfk'];a184_0x5881=function(){return _0x498e15;};return a184_0x5881();}(function(_0x37fc3f,_0x1634fb){const _0x2ad3aa=a184_0x2f9b,_0x2b29fa=_0x37fc3f();while(!![]){try{const _0xb690bb=-parseInt(_0x2ad3aa(0x98))/0x1*(-parseInt(_0x2ad3aa(0x8c))/0x2)+-parseInt(_0x2ad3aa(0x90))/0x3*(-parseInt(_0x2ad3aa(0x8a))/0x4)+parseInt(_0x2ad3aa(0x97))/0x5*(-parseInt(_0x2ad3aa(0x8f))/0x6)+-parseInt(_0x2ad3aa(0x96))/0x7*(-parseInt(_0x2ad3aa(0x93))/0x8)+parseInt(_0x2ad3aa(0x8b))/0x9*(parseInt(_0x2ad3aa(0x89))/0xa)+parseInt(_0x2ad3aa(0x8e))/0xb+-parseInt(_0x2ad3aa(0x8d))/0xc;if(_0xb690bb===_0x1634fb)break;else _0x2b29fa['push'](_0x2b29fa['shift']());}catch(_0x170f4a){_0x2b29fa['push'](_0x2b29fa['shift']());}}}(a184_0x5881,0x4ef94));import{buildAppAddFlags,runAppAdd,validateAppName}from'../../commands/common/app-registry.js';export const workspaceAddDefinition={'service':'workspace','command':a184_0x344f5d(0x94),'description':a184_0x344f5d(0x92),'risk':a184_0x344f5d(0x91),'requiresAuth':![],'requiresAppCode':![],'args':[{'name':'name','description':'App\x20profile\x20name','required':!![]}],'flags':buildAppAddFlags(),'validate':_0x110488=>validateAppName(_0x110488,a184_0x344f5d(0x95)),'execute':_0x1124fd=>runAppAdd(_0x1124fd,'workspace\x20add')};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a185_0x17faa9=a185_0x3123;(function(_0x23c22d,_0x2e7a7d){const _0x4ef892=a185_0x3123,_0x29768c=_0x23c22d();while(!![]){try{const _0x3a7b6b=parseInt(_0x4ef892(0xe3))/0x1+parseInt(_0x4ef892(0xfa))/0x2*(-parseInt(_0x4ef892(0x102))/0x3)+parseInt(_0x4ef892(0xf8))/0x4+parseInt(_0x4ef892(0xf6))/0x5*(-parseInt(_0x4ef892(0xea))/0x6)+parseInt(_0x4ef892(0xfb))/0x7*(-parseInt(_0x4ef892(0x110))/0x8)+-parseInt(_0x4ef892(0xe9))/0x9*(parseInt(_0x4ef892(0xf4))/0xa)+parseInt(_0x4ef892(0x115))/0xb*(parseInt(_0x4ef892(0xf2))/0xc);if(_0x3a7b6b===_0x2e7a7d)break;else _0x29768c['push'](_0x29768c['shift']());}catch(_0x273fe0){_0x29768c['push'](_0x29768c['shift']());}}}(a185_0x3660,0x4a965));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+a185_0x17faa9(0x113),SAFE_PROFILE_KEYS=['appcode',a185_0x17faa9(0x10d),'apiDir',a185_0x17faa9(0x107),a185_0x17faa9(0xed),a185_0x17faa9(0x101),a185_0x17faa9(0xe6)],workspaceFlags=[{'name':'app','type':a185_0x17faa9(0xef),'description':a185_0x17faa9(0x10b)},{'name':'appcode','type':a185_0x17faa9(0xef),'description':a185_0x17faa9(0xe5)},{'name':'env','type':a185_0x17faa9(0xef),'description':'Target\x20environment','enum':[...RABETBASE_ENV_VALUES]},{'name':a185_0x17faa9(0xee),'type':a185_0x17faa9(0xef),'description':a185_0x17faa9(0xfe)},{'name':a185_0x17faa9(0x11b),'type':a185_0x17faa9(0xef),'description':a185_0x17faa9(0x10a),'enum':[...RABETBASE_OUTPUT_FORMAT_VALUES]},{'name':'pageSize','type':'number','description':'Default\x20page\x20size\x20for\x20this\x20workspace\x20app\x20profile'},{'name':'riskLevel','type':a185_0x17faa9(0xef),'description':a185_0x17faa9(0xe8),'enum':[...RISK_LEVEL_VALUES]},{'name':'locale','type':a185_0x17faa9(0xef),'description':a185_0x17faa9(0xe7)}];function a185_0x3123(_0x2dd26a,_0x846acd){_0x2dd26a=_0x2dd26a-0xe3;const _0x3660af=a185_0x3660();let _0x312356=_0x3660af[_0x2dd26a];return _0x312356;}function isRecord(_0x53945d){const _0x29f0ea=a185_0x17faa9;return!!_0x53945d&&typeof _0x53945d===_0x29f0ea(0x11c)&&!Array['isArray'](_0x53945d);}function a185_0x3660(){const _0x357aa8=['1043VhUGvk','\x20workspace\x20','workspace.','API\x20directory\x20path\x20for\x20this\x20workspace\x20app\x20profile','\x20--appcode\x20<code>`.','project','riskLevel','3chBpzX','workspace','length','app','.\x20Credentials:\x20not\x20written.','format','write',').\x20Config:\x20','Default\x20output\x20format\x20for\x20this\x20workspace\x20app\x20profile','App\x20profile\x20name\x20to\x20use\x20in\x20this\x20workspace','\x20workspace\x20use\x20--app\x20<name>`.','env','\x20--app\x20','Missing\x20workspace\x20app\x20selector.','13720ZFjSAZ','trim','\x22\x20not\x20found.','\x20workspace\x20<init|use>\x20--app\x20<name>\x20[--appcode\x20<code>]','Use\x20`','6589YTAfro','validation','apps','initialized','globalConfig','defaultApp','defaultFormat','object','208872NfJPLg','str','App\x20code\x20to\x20bind\x20to\x20this\x20workspace','locale','Locale\x20for\x20this\x20workspace\x20app\x20profile','Risk\x20level\x20for\x20this\x20workspace\x20app\x20profile','171twxOWU','30kXCDIz','Switch\x20the\x20current\x20workspace\x20app\x20binding','\x20(appcode:\x20','pageSize','apiDir','string','appcode','Invalid\x20appcode:\x20','18708fNyYHt','\x20workspace\x20init\x20--appcode\x20<code>`\x20or\x20`','225070frserp','use','58245cAtlbq','init','1857472cCwAth','keys','1120318gdMdhY'];a185_0x3660=function(){return _0x357aa8;};return a185_0x3660();}function assertValidAppcode(_0x3f5184){const _0x4f5105=a185_0x17faa9,{valid:_0x345b35,message:_0x10488e}=validateAppcode(_0x3f5184);if(!_0x345b35)throw CliErrors[_0x4f5105(0x116)](_0x4f5105(0xf1)+_0x3f5184,_0x10488e);}function sanitizeProfile(_0x7c1756){if(!isRecord(_0x7c1756))return{};const _0x2631a4={};for(const _0x1aa981 of SAFE_PROFILE_KEYS){if(_0x7c1756[_0x1aa981]!==undefined)_0x2631a4[_0x1aa981]=_0x7c1756[_0x1aa981];}return _0x2631a4;}function cloneProfile(_0x298c62){return isRecord(_0x298c62)?{..._0x298c62}:{};}function collectWorkspaceProfileOverrides(_0x2043bb){const _0x30a784=a185_0x17faa9,_0x41865b={},_0x333ebb=_0x2043bb[_0x30a784(0xe4)](_0x30a784(0x10d)),_0xf73f0a=_0x2043bb[_0x30a784(0xe4)](_0x30a784(0xee)),_0x500e2e=_0x2043bb['str'](_0x30a784(0x11b)),_0xbabd42=_0x2043bb['flag'](_0x30a784(0xed)),_0x5c44f4=_0x2043bb['str']('riskLevel'),_0x37131f=_0x2043bb[_0x30a784(0xe4)](_0x30a784(0xe6));if(_0x333ebb)_0x41865b[_0x30a784(0x10d)]=_0x333ebb;if(_0xf73f0a)_0x41865b[_0x30a784(0xee)]=_0xf73f0a;if(_0x500e2e)_0x41865b[_0x30a784(0x107)]=_0x500e2e;if(_0xbabd42!==undefined&&_0xbabd42!=='')_0x41865b[_0x30a784(0xed)]=Number(_0xbabd42);if(_0x5c44f4)_0x41865b[_0x30a784(0x101)]=_0x5c44f4;if(_0x37131f)_0x41865b[_0x30a784(0xe6)]=_0x37131f;return _0x41865b;}async function validateWorkspaceArgs(_0x15583c){const _0x3a02df=a185_0x17faa9,_0x355d43=_0x15583c['str'](_0x3a02df(0x105))['trim'](),_0x4223c8=_0x15583c[_0x3a02df(0xe4)](_0x3a02df(0xf0))[_0x3a02df(0x111)]();if(!_0x355d43&&!_0x4223c8)throw CliErrors[_0x3a02df(0x116)](_0x3a02df(0x10f),_0x3a02df(0x114)+CLI_BIN_NAME+_0x3a02df(0xf3)+CLI_BIN_NAME+_0x3a02df(0x10c));if(_0x4223c8)assertValidAppcode(_0x4223c8);}function resolveKnownApps(){const _0x5fff7f=a185_0x17faa9,{config:_0x531616,layers:_0x3af07c}=readRawConfigWithLayers(),_0xfd23cb=isRecord(_0x531616['apps'])?_0x531616[_0x5fff7f(0x117)]:{},_0x3101d6=isRecord(_0x3af07c[_0x5fff7f(0x119)][_0x5fff7f(0x117)])?_0x3af07c[_0x5fff7f(0x119)]['apps']:{};return{..._0x3101d6,..._0xfd23cb};}async function configureWorkspace(_0x29bffe,_0x3756a2){const _0x11b1ce=a185_0x17faa9,_0x385ef6=_0x29bffe[_0x11b1ce(0xe4)](_0x11b1ce(0x105))[_0x11b1ce(0x111)](),_0x147378=_0x29bffe[_0x11b1ce(0xe4)](_0x11b1ce(0xf0))[_0x11b1ce(0x111)](),_0x318820=_0x385ef6||_0x147378;if(!_0x318820)throw CliErrors[_0x11b1ce(0x116)](_0x11b1ce(0x10f),_0x11b1ce(0x114)+CLI_BIN_NAME+_0x11b1ce(0xf3)+CLI_BIN_NAME+'\x20workspace\x20use\x20--app\x20<name>`.');if(_0x147378)assertValidAppcode(_0x147378);const _0x2b7309=resolveWriteConfigPath(_0x11b1ce(0x100)),_0x199dbf=readConfigFile(_0x2b7309),_0x43613a=resolveKnownApps(),_0x11e99f=isRecord(_0x199dbf[_0x11b1ce(0x117)])?{..._0x199dbf[_0x11b1ce(0x117)]}:{},_0x1ec031=cloneProfile(_0x11e99f[_0x318820]),_0x51b9fe=sanitizeProfile(_0x43613a[_0x318820]),_0x4e9a1b=_0x147378?{}:_0x51b9fe,_0x36c399=_0x147378||_0x4e9a1b[_0x11b1ce(0xf0)];if(!_0x36c399){const _0x165050=Object[_0x11b1ce(0xf9)](_0x43613a),_0x20813a=_0x165050[_0x11b1ce(0x104)]===0x0?_0x11b1ce(0x114)+CLI_BIN_NAME+_0x11b1ce(0xfc)+_0x3756a2+_0x11b1ce(0x10e)+_0x318820+_0x11b1ce(0xff):'Pass\x20--appcode\x20<code>,\x20or\x20choose\x20one\x20of:\x20'+_0x165050['join'](',\x20');throw CliErrors['validation']('App\x20\x22'+_0x318820+_0x11b1ce(0x112),_0x20813a);}assertValidAppcode(String(_0x36c399));const _0x2ef2f7={..._0x4e9a1b,..._0x1ec031,'appcode':String(_0x36c399),...collectWorkspaceProfileOverrides(_0x29bffe)};return _0x11e99f[_0x318820]=_0x2ef2f7,_0x199dbf[_0x11b1ce(0x117)]=_0x11e99f,_0x199dbf[_0x11b1ce(0x11a)]=_0x318820,delete _0x199dbf[_0x11b1ce(0xf0)],delete _0x199dbf[_0x11b1ce(0x105)],_0x2ef2f7['env']&&(_0x199dbf['env']=_0x2ef2f7[_0x11b1ce(0x10d)]),writeConfigFile(_0x2b7309,_0x199dbf),{'ok':!![],'message':'Workspace\x20'+(_0x3756a2==='init'?_0x11b1ce(0x118):'updated')+':\x20'+_0x318820+_0x11b1ce(0xec)+_0x2ef2f7[_0x11b1ce(0xf0)]+_0x11b1ce(0x109)+_0x2b7309+_0x11b1ce(0x106),'data':{'operation':_0x11b1ce(0xfd)+_0x3756a2,'configPath':_0x2b7309,'app':_0x318820,'appcode':_0x2ef2f7[_0x11b1ce(0xf0)],'env':_0x2ef2f7[_0x11b1ce(0x10d)]??null,'credentialsWritten':![]}};}const workspaceInitDefinition={'service':a185_0x17faa9(0x103),'command':a185_0x17faa9(0xf7),'description':'Initialize\x20the\x20current\x20workspace\x20app\x20binding','risk':'write','requiresAuth':![],'requiresAppCode':![],'args':[],'flags':workspaceFlags,'validate':validateWorkspaceArgs,'execute':_0x4cce39=>configureWorkspace(_0x4cce39,'init')},workspaceUseDefinition={'service':a185_0x17faa9(0x103),'command':a185_0x17faa9(0xf5),'description':a185_0x17faa9(0xeb),'risk':a185_0x17faa9(0x108),'requiresAuth':![],'requiresAppCode':![],'args':[],'flags':workspaceFlags,'validate':validateWorkspaceArgs,'execute':_0x10f43d=>configureWorkspace(_0x10f43d,'use')};export const workspaceDefinitions=[workspaceInitDefinition,workspaceUseDefinition,workspaceAddDefinition,workspaceRemoveDefinition];export{WORKSPACE_USAGE};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a186_0x5beca5=a186_0x481f;(function(_0x166ddc,_0x427299){const _0x44809b=a186_0x481f,_0x1b9c52=_0x166ddc();while(!![]){try{const _0x42ce18=-parseInt(_0x44809b(0x78))/0x1*(parseInt(_0x44809b(0x74))/0x2)+parseInt(_0x44809b(0x76))/0x3+-parseInt(_0x44809b(0x75))/0x4*(parseInt(_0x44809b(0x7b))/0x5)+parseInt(_0x44809b(0x80))/0x6+parseInt(_0x44809b(0x7a))/0x7+parseInt(_0x44809b(0x7d))/0x8+-parseInt(_0x44809b(0x79))/0x9;if(_0x42ce18===_0x427299)break;else _0x1b9c52['push'](_0x1b9c52['shift']());}catch(_0x3df782){_0x1b9c52['push'](_0x1b9c52['shift']());}}}(a186_0x4144,0xe9161));import{buildAppRemoveFlags,runAppRemove,validateAppName}from'../../commands/common/app-registry.js';function a186_0x481f(_0x17a679,_0x4a0a33){_0x17a679=_0x17a679-0x74;const _0x41446e=a186_0x4144();let _0x481f07=_0x41446e[_0x17a679];return _0x481f07;}export const workspaceRemoveDefinition={'service':a186_0x5beca5(0x82),'command':a186_0x5beca5(0x81),'description':'Remove\x20an\x20app\x20profile\x20from\x20the\x20current\x20workspace\x20(or\x20--global)','risk':a186_0x5beca5(0x7c),'requiresAuth':![],'requiresAppCode':![],'args':[{'name':a186_0x5beca5(0x77),'description':a186_0x5beca5(0x7e),'required':!![]}],'flags':buildAppRemoveFlags(),'validate':_0x2f8c4e=>validateAppName(_0x2f8c4e,a186_0x5beca5(0x7f)),'execute':_0x1aabb6=>runAppRemove(_0x1aabb6,'workspace\x20remove')};function a186_0x4144(){const _0x4373a1=['8683150wtmFyS','26695GHjDEf','high-risk-write','14687936rCXHmt','App\x20profile\x20name\x20to\x20remove','workspace\x20remove','3012624FdLiCe','remove','workspace','1210HGLGpJ','172ImhqSw','4122894AXSuZg','name','498psLMzw','31205304wAjKHy'];a186_0x4144=function(){return _0x4373a1;};return a186_0x4144();}
|