@lovrabet/rabetbase-cli 2.4.1 → 2.4.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/index.js +1 -1
- package/lib/commands/app/list.js +1 -1
- package/lib/commands/app/members-list.js +1 -1
- package/lib/commands/app/remote-directory.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/kb/create.js +1 -1
- package/lib/commands/kb/delete.js +1 -1
- package/lib/commands/kb/detail.js +1 -1
- package/lib/commands/kb/index.js +1 -1
- package/lib/commands/kb/list.js +1 -1
- package/lib/commands/kb/shared.js +1 -1
- package/lib/commands/kb/update.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 -1
- 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/react/create.js +1 -1
- package/lib/commands/page/react/detail.js +1 -1
- package/lib/commands/page/react/list.js +1 -1
- package/lib/commands/page/react/publish.js +1 -1
- package/lib/commands/page/react/shared.js +1 -1
- package/lib/commands/page/react/syntax.js +1 -1
- package/lib/commands/page/react/template.js +1 -1
- package/lib/commands/page/react/update.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/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/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/tenant/index.js +1 -1
- package/lib/commands/tenant/members-list.js +1 -1
- package/lib/commands/tenant/shared.js +1 -1
- package/lib/commands/user-account/dingding-sandbox-bind.js +1 -1
- package/lib/commands/user-account/index.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.d.ts +4 -4
- package/lib/generated/build-info.js +1 -1
- package/lib/help.js +1 -1
- package/lib/postinstall.js +1 -1
- package/lib/runtime/confirmation.js +1 -1
- package/lib/runtime/event.js +1 -1
- package/lib/runtime/index.js +1 -1
- package/lib/runtime/queue.js +1 -1
- package/lib/runtime/resolve.js +1 -1
- package/lib/skills/builtin-skill.js +1 -1
- package/lib/skills/main.js +1 -1
- package/lib/skills/npx-skills-add.js +1 -1
- package/lib/skills/skill-presence.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/skills/rabetbase/SKILL.md +1 -1
- package/skills/rabetbase/references/rabetbase-page-react-detail.md +1 -1
- package/skills/rabetbase.manifest.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a185_0x1905dd=a185_0x5a77;function a185_0x1e86(){const _0x1de9ec=['5874516FCtlMD','sqlcode','1786405hFSGZm','14CSvIhE','dbId','516356xMWfeT','boolean','1961406kTkAts','str','Return\x20full\x20raw\x20SQL\x20query\x20object','read','sql','2891972HAHJeE','6332528fBMSpV','1ggruXk','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','verbose','detail','1465794deWZBP','description','appCode','bool'];a185_0x1e86=function(){return _0x1de9ec;};return a185_0x1e86();}(function(_0x50fbe3,_0x18e50b){const _0x5e3c6f=a185_0x5a77,_0x15863e=_0x50fbe3();while(!![]){try{const _0x3ce062=parseInt(_0x5e3c6f(0xf6))/0x1*(parseInt(_0x5e3c6f(0xed))/0x2)+parseInt(_0x5e3c6f(0xfa))/0x3+-parseInt(_0x5e3c6f(0xf4))/0x4+-parseInt(_0x5e3c6f(0xea))/0x5+parseInt(_0x5e3c6f(0xef))/0x6*(-parseInt(_0x5e3c6f(0xeb))/0x7)+parseInt(_0x5e3c6f(0xf5))/0x8+parseInt(_0x5e3c6f(0xfe))/0x9;if(_0x3ce062===_0x18e50b)break;else _0x15863e['push'](_0x15863e['shift']());}catch(_0x236f41){_0x15863e['push'](_0x15863e['shift']());}}}(a185_0x1e86,0x6f91e));import{getSqlQueryInfo}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';function a185_0x5a77(_0x3e7da0,_0x45cce0){_0x3e7da0=_0x3e7da0-0xe9;const _0x1e86c3=a185_0x1e86();let _0x5a772d=_0x1e86c3[_0x3e7da0];return _0x5a772d;}import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':a185_0x1905dd(0xf3),'command':a185_0x1905dd(0xf9),'description':a185_0x1905dd(0xf7),'risk':a185_0x1905dd(0xf2),'flags':[SQLCODE_FLAG,{'name':a185_0x1905dd(0xf8),'type':a185_0x1905dd(0xee),'description':a185_0x1905dd(0xf1)}],async 'execute'(_0x438dec){const _0x51b3b1=a185_0x1905dd,_0x3ff43b=await getSqlQueryInfo(_0x438dec[_0x51b3b1(0xfc)],_0x438dec[_0x51b3b1(0xf0)](_0x51b3b1(0xe9))),_0x129948=_0x438dec[_0x51b3b1(0xfd)]('verbose');if(_0x129948)return{'ok':!![],'data':_0x3ff43b};const _0x25c3d1=_0x3ff43b['dbId']?await getDbName(_0x438dec[_0x51b3b1(0xfc)],_0x3ff43b['dbId']):undefined;return{'ok':!![],'data':{'sqlCode':_0x3ff43b['sqlCode'],'sqlName':_0x3ff43b['sqlName'],'db':_0x25c3d1?_0x25c3d1+'\x20('+_0x3ff43b['dbId']+')':_0x3ff43b[_0x51b3b1(0xec)]??'','description':_0x3ff43b[_0x51b3b1(0xfb)]??'','sqlContent':_0x3ff43b['sqlContent']??''}};}};
|
package/lib/commands/sql/exec.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a186_0x4596(){const _0x6dab85=['1896fHlPPm','SQL\x20execution\x20failed','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','5657650BiArXf','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','params','1706120PPBBNG','now','26880ygOjUn','\x20row(s)\x20in\x20','55158chXLLt','string','3rlaRtQ','execError','read','sql','isArray','2159832oeYuvH','str','length','appCode','8533035prlqtW','Returned\x20','2696328YQfLjL','exec'];a186_0x4596=function(){return _0x6dab85;};return a186_0x4596();}const a186_0x394570=a186_0x4a18;(function(_0x4dc8ee,_0x2dbf4d){const _0x1aae6c=a186_0x4a18,_0x1783be=_0x4dc8ee();while(!![]){try{const _0x2d6ffe=parseInt(_0x1aae6c(0x18d))/0x1+parseInt(_0x1aae6c(0x181))/0x2*(parseInt(_0x1aae6c(0x18f))/0x3)+parseInt(_0x1aae6c(0x189))/0x4+-parseInt(_0x1aae6c(0x186))/0x5+parseInt(_0x1aae6c(0x183))/0x6*(parseInt(_0x1aae6c(0x18b))/0x7)+-parseInt(_0x1aae6c(0x17b))/0x8+-parseInt(_0x1aae6c(0x17f))/0x9;if(_0x2d6ffe===_0x2dbf4d)break;else _0x1783be['push'](_0x1783be['shift']());}catch(_0x4a3521){_0x1783be['push'](_0x1783be['shift']());}}}(a186_0x4596,0xa95a4));import{executeSql}from'../../core/api-client.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';import{parseJsonParams}from'../../utils/params.js';function a186_0x4a18(_0x14897e,_0x4a0421){_0x14897e=_0x14897e-0x179;const _0x4596d9=a186_0x4596();let _0x4a187e=_0x4596d9[_0x14897e];return _0x4a187e;}export const sqlExec={'service':a186_0x394570(0x179),'command':a186_0x394570(0x182),'description':a186_0x394570(0x187),'risk':a186_0x394570(0x191),'flags':[SQLCODE_FLAG,{'name':a186_0x394570(0x188),'type':a186_0x394570(0x18e),'description':a186_0x394570(0x185)}],async 'execute'(_0x2f978e){const _0x1bd3a3=a186_0x394570,_0x445376=parseJsonParams(_0x2f978e[_0x1bd3a3(0x17c)]('params')),_0x4b91dc=Date[_0x1bd3a3(0x18a)](),_0x2f7d1e=await executeSql(_0x2f978e[_0x1bd3a3(0x17e)],_0x2f978e[_0x1bd3a3(0x17c)]('sqlcode'),_0x445376),_0x8279e7=Date[_0x1bd3a3(0x18a)]()-_0x4b91dc,_0x27bd28=_0x2f7d1e?.['execResult']??_0x2f7d1e,_0x3cc394=_0x2f7d1e?.['execSuccess']??!![];if(!_0x3cc394)return{'ok':![],'data':{'error':_0x2f7d1e?.[_0x1bd3a3(0x190)]||'SQL\x20execution\x20failed','elapsed':_0x8279e7},'message':_0x1bd3a3(0x184)};const _0x16388c=Array[_0x1bd3a3(0x17a)](_0x27bd28)?_0x27bd28:[];return{'ok':!![],'data':{'rows':_0x16388c,'rowCount':_0x16388c[_0x1bd3a3(0x17d)],'elapsed':_0x8279e7},'message':_0x1bd3a3(0x180)+_0x16388c[_0x1bd3a3(0x17d)]+_0x1bd3a3(0x18c)+_0x8279e7+'ms'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a187_0x1336(_0x420ee6,_0x240f71){_0x420ee6=_0x420ee6-0x1be;const _0x10f74c=a187_0x10f7();let _0x13367b=_0x10f74c[_0x420ee6];return _0x13367b;}(function(_0x1ba492,_0x14ce92){const _0x1378a8=a187_0x1336,_0x29378a=_0x1ba492();while(!![]){try{const _0x550f20=-parseInt(_0x1378a8(0x1c5))/0x1+parseInt(_0x1378a8(0x1bf))/0x2+-parseInt(_0x1378a8(0x1c4))/0x3*(parseInt(_0x1378a8(0x1c1))/0x4)+parseInt(_0x1378a8(0x1c2))/0x5+-parseInt(_0x1378a8(0x1c3))/0x6*(-parseInt(_0x1378a8(0x1c0))/0x7)+parseInt(_0x1378a8(0x1c7))/0x8*(parseInt(_0x1378a8(0x1be))/0x9)+parseInt(_0x1378a8(0x1c6))/0xa;if(_0x550f20===_0x14ce92)break;else _0x29378a['push'](_0x29378a['shift']());}catch(_0x3b94a2){_0x29378a['push'](_0x29378a['shift']());}}}(a187_0x10f7,0xeb13a));import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';import{sqlExec}from'../../commands/sql/exec.js';function a187_0x10f7(){const _0x5ca778=['51810EXxHMl','232734IwbbMA','1646747qjBOAX','26497380wkYHah','70760itXqGM','180vxbVBw','681754afhLRN','903iarIOf','96DGxcUp','950315XLOaWL'];a187_0x10f7=function(){return _0x5ca778;};return a187_0x10f7();}import{sqlPull}from'../../commands/sql/pull.js';import{sqlCreate}from'../../commands/sql/create.js';import{sqlStatus}from'../../commands/sql/status.js';import{sqlPush}from'../../commands/sql/push.js';import{sqlDelete}from'../../commands/sql/delete.js';export const sqlDefinitions=[sqlList,sqlDetail,sqlStatus,sqlCreate,sqlPush,sqlValidate,sqlExec,sqlPull,sqlDelete];
|
package/lib/commands/sql/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a188_0x54a8c7=a188_0x30d9;(function(_0x46e65f,_0xb3ff9a){const _0x5d4c8b=a188_0x30d9,_0x72d532=_0x46e65f();while(!![]){try{const _0x2331fc=parseInt(_0x5d4c8b(0x149))/0x1*(-parseInt(_0x5d4c8b(0x13d))/0x2)+parseInt(_0x5d4c8b(0x14e))/0x3*(-parseInt(_0x5d4c8b(0x143))/0x4)+parseInt(_0x5d4c8b(0x14d))/0x5+parseInt(_0x5d4c8b(0x140))/0x6+parseInt(_0x5d4c8b(0x13c))/0x7*(parseInt(_0x5d4c8b(0x145))/0x8)+-parseInt(_0x5d4c8b(0x139))/0x9*(parseInt(_0x5d4c8b(0x136))/0xa)+parseInt(_0x5d4c8b(0x134))/0xb;if(_0x2331fc===_0xb3ff9a)break;else _0x72d532['push'](_0x72d532['shift']());}catch(_0x478750){_0x72d532['push'](_0x72d532['shift']());}}}(a188_0xcdc6,0xe491f));function a188_0x30d9(_0x5e3b4f,_0x24d690){_0x5e3b4f=_0x5e3b4f-0x132;const _0xcdc644=a188_0xcdc6();let _0x30d9c9=_0xcdc644[_0x5e3b4f];return _0x30d9c9;}import{listSqlQueries}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a188_0xcdc6(){const _0x350d6c=['sqlCode','10mlGAEg','dbId','tableData','5720283mHvIPB','length','list','35AJfHwi','8IeEeuN','totalCount','bool','8197950tvihSW','List\x20custom\x20SQL\x20queries','No\x20custom\x20SQL\x20queries\x20found.','7050068eXvNYs','Page\x20size','2366216pDOZOE','pagesize','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','sqlcode','78093wQGzvp','verbose','appCode','string','224980gmdokR','3MIlcNa','Page\x20number','str','paging','page','description','name','8321423SDYxXU'];a188_0xcdc6=function(){return _0x350d6c;};return a188_0xcdc6();}export const sqlList={'service':'sql','command':a188_0x54a8c7(0x13b),'description':a188_0x54a8c7(0x141),'risk':'read','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a188_0x54a8c7(0x133),'type':a188_0x54a8c7(0x14c),'description':'Filter\x20by\x20SQL\x20name'},{'name':a188_0x54a8c7(0x152),'type':'number','description':a188_0x54a8c7(0x14f),'default':0x1},{'name':a188_0x54a8c7(0x146),'type':'number','description':a188_0x54a8c7(0x144)},{'name':a188_0x54a8c7(0x14a),'type':'boolean','description':a188_0x54a8c7(0x147)}],async 'execute'(_0x249c50){const _0x35e828=a188_0x54a8c7,_0x3170d2=await listSqlQueries(_0x249c50[_0x35e828(0x14b)],{'sqlCode':_0x249c50['str'](_0x35e828(0x148))||undefined,'sqlName':_0x249c50[_0x35e828(0x150)](_0x35e828(0x133))||undefined,'currentPage':_0x249c50['num'](_0x35e828(0x152)),'pageSize':_0x249c50['num'](_0x35e828(0x146),0x32)}),_0x5ccbe7=_0x249c50[_0x35e828(0x13f)]('verbose'),_0x3dc9bb=_0x3170d2[_0x35e828(0x138)]??[],_0x4f6f1c=_0x3170d2[_0x35e828(0x151)]?.[_0x35e828(0x13e)]??_0x3dc9bb['length'];let _0xf12681;return _0x5ccbe7?_0xf12681=_0x3dc9bb:_0xf12681=await Promise['all'](_0x3dc9bb['map'](async _0x11c3bd=>{const _0x1d0acc=_0x35e828;let _0xf02ac8;try{_0xf02ac8=_0x11c3bd[_0x1d0acc(0x137)]?await getDbName(_0x249c50[_0x1d0acc(0x14b)],_0x11c3bd['dbId']):undefined;}catch{}return{'sqlCode':_0x11c3bd[_0x1d0acc(0x135)],'sqlName':_0x11c3bd['sqlName'],'description':_0x11c3bd[_0x1d0acc(0x132)]??'','db':_0xf02ac8?_0xf02ac8+'\x20('+_0x11c3bd['dbId']+')':_0x11c3bd['dbId']??''};})),{'ok':!![],'data':_0xf12681,'message':_0x3dc9bb[_0x35e828(0x13a)]===0x0?_0x35e828(0x142):'Found\x20'+_0x3dc9bb[_0x35e828(0x13a)]+'\x20SQL\x20queries\x20(total:\x20'+_0x4f6f1c+').'};}};
|
package/lib/commands/sql/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a189_0x4427b0=a189_0x2ed8;(function(_0xa3816f,_0x27fc0b){const _0x19bc50=a189_0x2ed8,_0x3fc498=_0xa3816f();while(!![]){try{const _0x36c9ab=parseInt(_0x19bc50(0x14d))/0x1*(parseInt(_0x19bc50(0x154))/0x2)+-parseInt(_0x19bc50(0x17a))/0x3+parseInt(_0x19bc50(0x16d))/0x4+-parseInt(_0x19bc50(0x17f))/0x5*(-parseInt(_0x19bc50(0x15b))/0x6)+parseInt(_0x19bc50(0x179))/0x7*(-parseInt(_0x19bc50(0x14f))/0x8)+-parseInt(_0x19bc50(0x15a))/0x9+-parseInt(_0x19bc50(0x146))/0xa*(-parseInt(_0x19bc50(0x14b))/0xb);if(_0x36c9ab===_0x27fc0b)break;else _0x3fc498['push'](_0x3fc498['shift']());}catch(_0x4f0c5a){_0x3fc498['push'](_0x3fc498['shift']());}}}(a189_0xaaa6,0xa0f60));function a189_0x2ed8(_0x328a93,_0x54d1e6){_0x328a93=_0x328a93-0x142;const _0xaaa6d0=a189_0xaaa6();let _0x2ed8b4=_0xaaa6d0[_0x328a93];return _0x2ed8b4;}import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x26af05,_0x2d1382){const _0x534103=a189_0x2ed8,_0x58ab2c=[];let _0x47eccb=0x1;while(!![]){const _0x282893=await listSqlQueries(_0x26af05,{'currentPage':_0x47eccb,'pageSize':PAGE_SIZE,'sqlCode':_0x2d1382[_0x534103(0x173)],'sqlName':_0x2d1382['sqlName']}),_0x3e32cc=_0x282893[_0x534103(0x14e)]??[];_0x58ab2c['push'](..._0x3e32cc);if(_0x3e32cc[_0x534103(0x145)]===0x0)break;const _0xcb5484=_0x282893[_0x534103(0x163)]?.['totalCount'];if(_0xcb5484!=null?_0x58ab2c[_0x534103(0x145)]>=_0xcb5484:_0x3e32cc['length']<PAGE_SIZE)break;_0x47eccb++;}return _0x58ab2c;}async function ensureSqlContent(_0x4c0840){const _0x502462=a189_0x2ed8;if(_0x4c0840[_0x502462(0x178)]!=null&&String(_0x4c0840['sqlContent'])['length']>0x0)return _0x4c0840;return getSqlQueryDetail(_0x4c0840[_0x502462(0x173)]);}export const sqlPull={'service':'sql','command':a189_0x4427b0(0x149),'description':a189_0x4427b0(0x161),'risk':a189_0x4427b0(0x155),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'name','type':a189_0x4427b0(0x15e),'description':a189_0x4427b0(0x160)},{'name':a189_0x4427b0(0x16f),'type':a189_0x4427b0(0x17b),'description':'Force\x20overwrite\x20local\x20unsynced\x20changes'}],async 'dryRun'(_0x432637){const _0x326401=a189_0x4427b0,_0x1194d7=loadSqlProjectConfig(_0x432637[_0x326401(0x150)]),_0x2a9d7f=await readSqlLockFile(_0x1194d7[_0x326401(0x14a)]),{appLock:_0x202cdd}=ensureSqlLockScope(_0x2a9d7f??createEmptySqlLock(),_0x1194d7[_0x326401(0x150)],_0x1194d7[_0x326401(0x168)],_0x326401(0x149)),_0x4a69e2=await fetchAllSqlQueries(_0x432637[_0x326401(0x150)],{'sqlCode':_0x432637[_0x326401(0x167)](_0x326401(0x180))||undefined,'sqlName':_0x432637['str'](_0x326401(0x16c))||undefined}),_0x20da93=[];for(const _0x2c2d0e of _0x4a69e2){const _0x1cf0d1=await ensureSqlContent(_0x2c2d0e),_0x59d23a=ensureRemoteSqlContent(_0x1cf0d1),_0x36eb14=detectModeFromSql(_0x1cf0d1),_0x1eb232=_0x1cf0d1[_0x326401(0x165)]?await getDbName(_0x432637[_0x326401(0x150)],Number(_0x1cf0d1['dbId']))[_0x326401(0x174)](()=>undefined):undefined,_0x579abc=buildLocalSqlFileContent({'sqlCode':_0x1cf0d1['sqlCode'],'sqlName':_0x1cf0d1[_0x326401(0x169)],'dbId':_0x1cf0d1[_0x326401(0x165)]},_0x59d23a,{'dbName':_0x1eb232,'mode':_0x36eb14,'syncedAt':new Date()[_0x326401(0x15d)](),'description':_0x1cf0d1[_0x326401(0x166)]}),_0x4ae13c=buildSqlLockEntry(_0x1cf0d1,_0x59d23a,'',{'dbName':_0x1eb232}),_0x2a3dbc=resolveLocalSqlFilePath(_0x1194d7,_0x1cf0d1[_0x326401(0x173)],_0x4ae13c);let _0x17e32b=_0x326401(0x162),_0x4ef49f;if(await fileExists(_0x2a3dbc)){const _0x620562=await readFile(_0x2a3dbc,_0x326401(0x152));isEquivalentPulledSqlFile(_0x620562,_0x579abc,_0x36eb14)?(_0x17e32b=_0x326401(0x170),_0x4ef49f=_0x326401(0x181)):(_0x17e32b=_0x326401(0x148),_0x4ef49f=_0x326401(0x17d));}_0x20da93[_0x326401(0x175)]({'sqlCode':_0x1cf0d1[_0x326401(0x173)],'sqlName':_0x1cf0d1[_0x326401(0x169)],'filePath':_0x2a3dbc,'status':_0x17e32b,'reason':_0x4ef49f});}return{'method':_0x326401(0x143),'url':_0x326401(0x159),'body':{'appCode':_0x432637[_0x326401(0x150)],'sqlCode':_0x432637[_0x326401(0x167)](_0x326401(0x180))||null,'sqlName':_0x432637[_0x326401(0x167)](_0x326401(0x16c))||null,'files':_0x20da93},'description':_0x326401(0x17e)+_0x20da93[_0x326401(0x145)]+_0x326401(0x176)+_0x1194d7[_0x326401(0x142)]};},async 'execute'(_0x5e42c5){const _0x2a166d=a189_0x4427b0,_0x5852d1=loadSqlProjectConfig(_0x5e42c5[_0x2a166d(0x150)]),_0x329520=await readSqlLockFile(_0x5852d1['lockFilePath']),{lockData:_0x302971,appLock:_0x4670d3}=ensureSqlLockScope(_0x329520??createEmptySqlLock(),_0x5852d1[_0x2a166d(0x150)],_0x5852d1[_0x2a166d(0x168)],'pull'),_0x18e579=_0x5e42c5['bool'](_0x2a166d(0x16f)),_0x32966c=await fetchAllSqlQueries(_0x5e42c5['appCode'],{'sqlCode':_0x5e42c5['str']('sqlcode')||undefined,'sqlName':_0x5e42c5[_0x2a166d(0x167)](_0x2a166d(0x16c))||undefined});if(_0x32966c[_0x2a166d(0x145)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x2a166d(0x15c)};const _0x5eefe6=[],_0x3a97e7=[];for(const _0x2bb338 of _0x32966c){try{_0x5eefe6[_0x2a166d(0x175)](await ensureSqlContent(_0x2bb338));}catch(_0x30cf9e){_0x3a97e7['push']({'sqlCode':_0x2bb338[_0x2a166d(0x173)],'error':_0x30cf9e instanceof Error?_0x30cf9e['message']:String(_0x30cf9e)});}}if(_0x18e579&&!_0x5e42c5[_0x2a166d(0x15f)]){let _0x52c42b=![];for(const _0x3aecc6 of _0x5eefe6){const _0x169615=detectModeFromSql(_0x3aecc6),_0x2ebaad=_0x3aecc6[_0x2a166d(0x165)]?await getDbName(_0x5e42c5[_0x2a166d(0x150)],Number(_0x3aecc6[_0x2a166d(0x165)]))['catch'](()=>undefined):undefined,_0x5bd6a7=buildLocalSqlFileContent({'sqlCode':_0x3aecc6[_0x2a166d(0x173)],'sqlName':_0x3aecc6[_0x2a166d(0x169)],'dbId':_0x3aecc6[_0x2a166d(0x165)]},ensureRemoteSqlContent(_0x3aecc6),{'dbName':_0x2ebaad,'mode':_0x169615,'syncedAt':new Date()[_0x2a166d(0x15d)](),'description':_0x3aecc6[_0x2a166d(0x166)]}),_0xd8d89c=resolveLocalSqlFilePath(_0x5852d1,_0x3aecc6[_0x2a166d(0x173)],buildSqlLockEntry(_0x3aecc6,ensureRemoteSqlContent(_0x3aecc6),'',{'dbName':_0x2ebaad}));if(await fileExists(_0xd8d89c)){const _0x2e75a3=await readFile(_0xd8d89c,_0x2a166d(0x152));if(!isEquivalentPulledSqlFile(_0x2e75a3,_0x5bd6a7,_0x169615)){_0x52c42b=!![];break;}}}if(_0x52c42b){const _0x683302=await confirmForceOverwrite('Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.');if(!_0x683302)throw CliErrors[_0x2a166d(0x151)](_0x2a166d(0x16e));}}const _0x3d9a59=cloneSqlLockData(_0x302971),_0x2ba0d9=_0x3d9a59['apps'][_0x5852d1['appCode']],_0x553432=[],_0x351427=[];for(const _0x469d06 of _0x5eefe6){const _0x28ec0d=_0x2ba0d9[_0x2a166d(0x17c)][_0x469d06[_0x2a166d(0x173)]],_0x3334e3=ensureRemoteSqlContent(_0x469d06),_0x55bc31=detectModeFromSql(_0x469d06),_0x2efeeb=_0x469d06[_0x2a166d(0x165)]?await getDbName(_0x5e42c5[_0x2a166d(0x150)],Number(_0x469d06['dbId']))['catch'](()=>undefined):undefined,_0x5e1a90=buildLocalSqlFileContent({'sqlCode':_0x469d06[_0x2a166d(0x173)],'sqlName':_0x469d06['sqlName'],'dbId':_0x469d06['dbId']},_0x3334e3,{'dbName':_0x2efeeb,'mode':_0x55bc31,'syncedAt':new Date()[_0x2a166d(0x15d)](),'description':_0x469d06[_0x2a166d(0x166)]}),_0x8b2b95=buildSqlLockEntry(_0x469d06,_0x3334e3,computeSqlContentHash(_0x5e1a90),{'dbName':_0x2efeeb}),_0x37d7d7=_0x8b2b95[_0x2a166d(0x164)],_0x323efd=join(_0x5852d1['sqlRootDir'],_0x37d7d7);try{if(await fileExists(_0x323efd)){const _0x45c38f=await readFile(_0x323efd,_0x2a166d(0x152));if(isEquivalentPulledSqlFile(_0x45c38f,_0x5e1a90,_0x55bc31)){_0x351427[_0x2a166d(0x175)]({'sqlCode':_0x469d06[_0x2a166d(0x173)],'reason':_0x2a166d(0x181)}),_0x2ba0d9['sqls'][_0x469d06['sqlCode']]={..._0x8b2b95,'hash':computeSqlContentHash(_0x45c38f),'path':_0x37d7d7};continue;}if(!_0x18e579){_0x351427[_0x2a166d(0x175)]({'sqlCode':_0x469d06[_0x2a166d(0x173)],'reason':_0x2a166d(0x156)});continue;}}const _0xa0190c=_0x28ec0d?.[_0x2a166d(0x164)]?join(_0x5852d1['sqlRootDir'],_0x28ec0d['path']):undefined;_0xa0190c&&_0xa0190c!==_0x323efd&&await fileExists(_0xa0190c)&&await rm(_0xa0190c,{'force':!![]}),await ensureParentDirectory(_0x323efd),await writeFile(_0x323efd,_0x5e1a90,'utf8'),_0x2ba0d9[_0x2a166d(0x17c)][_0x469d06[_0x2a166d(0x173)]]={..._0x8b2b95,'path':_0x37d7d7},_0x553432[_0x2a166d(0x175)]({'sqlCode':_0x469d06[_0x2a166d(0x173)],'filePath':_0x323efd});}catch(_0x7562d9){_0x3a97e7[_0x2a166d(0x175)]({'sqlCode':_0x469d06[_0x2a166d(0x173)],'error':_0x7562d9 instanceof Error?_0x7562d9[_0x2a166d(0x14c)]:String(_0x7562d9)});}}return _0x2ba0d9['lastSync']=new Date()['toISOString'](),await writeSqlLockFile(_0x5852d1[_0x2a166d(0x14a)],_0x3d9a59),{'ok':_0x3a97e7[_0x2a166d(0x145)]===0x0,'data':{'pulled':_0x553432,'skipped':_0x351427,'failed':_0x3a97e7},'message':_0x2a166d(0x16a)+_0x553432['length']+_0x2a166d(0x16b)+_0x351427[_0x2a166d(0x145)]+_0x2a166d(0x157)+_0x3a97e7[_0x2a166d(0x145)]+_0x2a166d(0x158)};}};function detectModeFromSql(_0x63e41d){const _0x10d5c1=a189_0x4427b0,_0x3ecbd4=ensureRemoteSqlContent(_0x63e41d),_0x1f1af0=stripLocalSqlMetadata(_0x3ecbd4,'mybatisXml')['trimStart']();if(/^<(select|insert|update|delete)\b/i[_0x10d5c1(0x177)](_0x1f1af0))return _0x10d5c1(0x171);return'sql';}function a189_0xaaa6(){const _0x244c69=['Pull\x20complete:\x20','\x20written,\x20','name','4504280CUcimv','Force\x20pull\x20cancelled.','force','skipped','mybatisXml','split','sqlCode','catch','push','\x20SQL\x20file(s)\x20into\x20','test','sqlContent','135422mqsfVU','2056656WecFdJ','boolean','sqls','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','Would\x20pull\x20','5tAUORb','sqlcode','unchanged','sqlRootDir','POST','join','length','4754310ePMerX','filter','conflict','pull','lockFilePath','33rAJzBb','message','202XpECql','tableData','448avvJzA','appCode','cancelled','utf8','replace','3986lpHSaJ','read','local\x20differs\x20from\x20remote','\x20skipped,\x20','\x20failed','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','8129934jZxbJe','2259606nYyhRa','No\x20remote\x20SQL\x20queries\x20matched.','toISOString','string','nonInteractive','Filter\x20by\x20SQL\x20display\x20name','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','would_pull','paging','path','dbId','description','str','sqlRoot','sqlName'];a189_0xaaa6=function(){return _0x244c69;};return a189_0xaaa6();}function isEquivalentPulledSqlFile(_0x34580b,_0x45541f,_0x1f28e0){return normalizePullComparableContent(_0x34580b,_0x1f28e0)===normalizePullComparableContent(_0x45541f,_0x1f28e0);}function normalizePullComparableContent(_0x2abddd,_0x38a332){const _0x166942=a189_0x4427b0,_0x550df0=_0x2abddd[_0x166942(0x153)](/\r\n/g,'\x0a')[_0x166942(0x172)]('\x0a'),_0x1a7d75=_0x550df0[_0x166942(0x147)](_0x44854b=>!isSyncedAtMetadataLine(_0x44854b,_0x38a332));return _0x1a7d75[_0x166942(0x144)]('\x0a');}function isSyncedAtMetadataLine(_0x298515,_0x34aae1){const _0xe0b4ab=a189_0x4427b0;if(_0x34aae1===_0xe0b4ab(0x171))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0xe0b4ab(0x177)](_0x298515);return/^\s*--\s*@lovrabet\.syncedAt:/[_0xe0b4ab(0x177)](_0x298515);}
|
|
1
|
+
const a189_0x5a526f=a189_0x56c7;(function(_0x2204cd,_0x122cbc){const _0x43188a=a189_0x56c7,_0x25eed2=_0x2204cd();while(!![]){try{const _0x25669d=-parseInt(_0x43188a(0x84))/0x1+-parseInt(_0x43188a(0x97))/0x2+-parseInt(_0x43188a(0xa0))/0x3+parseInt(_0x43188a(0x9d))/0x4+parseInt(_0x43188a(0x90))/0x5*(-parseInt(_0x43188a(0x94))/0x6)+parseInt(_0x43188a(0x91))/0x7+parseInt(_0x43188a(0xa3))/0x8*(parseInt(_0x43188a(0xa8))/0x9);if(_0x25669d===_0x122cbc)break;else _0x25eed2['push'](_0x25eed2['shift']());}catch(_0x2d4a02){_0x25eed2['push'](_0x25eed2['shift']());}}}(a189_0x25c8,0x39a08));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a189_0x25c8(){const _0x2bc6a5=['name','read','message','Pull\x20complete:\x20','unchanged','skipped','POST','string','\x20SQL\x20file(s)\x20into\x20','paging','\x20failed','would_pull','sql','replace','lastSync','lockFilePath','sqlRoot','sqlName','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','14692gPqDrG','path','catch','toISOString','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','cancelled','length','split','local\x20differs\x20from\x20remote','description','appCode','sqls','95SsAkfU','626871HTWlXG','test','str','123738ISchsS','sqlContent','trimStart','741076RSinMo','\x20skipped,\x20','conflict','Would\x20pull\x20','sqlCode','sqlcode','1649928ckeUFL','pull','Force\x20overwrite\x20local\x20unsynced\x20changes','1107339YdazAc','utf8','tableData','469432gOCUja','dbId','boolean','push','sqlRootDir','135oEtXDY','join','mybatisXml','totalCount'];a189_0x25c8=function(){return _0x2bc6a5;};return a189_0x25c8();}import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x389808,_0x2a019b){const _0x23489f=a189_0x56c7,_0x3e81a6=[];let _0x2c89cf=0x1;while(!![]){const _0x4c4f51=await listSqlQueries(_0x389808,{'currentPage':_0x2c89cf,'pageSize':PAGE_SIZE,'sqlCode':_0x2a019b[_0x23489f(0x9b)],'sqlName':_0x2a019b[_0x23489f(0x82)]}),_0x1b12a5=_0x4c4f51[_0x23489f(0xa2)]??[];_0x3e81a6[_0x23489f(0xa6)](..._0x1b12a5);if(_0x1b12a5['length']===0x0)break;const _0x2ff895=_0x4c4f51[_0x23489f(0x7a)]?.[_0x23489f(0xab)];if(_0x2ff895!=null?_0x3e81a6[_0x23489f(0x8a)]>=_0x2ff895:_0x1b12a5[_0x23489f(0x8a)]<PAGE_SIZE)break;_0x2c89cf++;}return _0x3e81a6;}async function ensureSqlContent(_0x51cac6){const _0xe69cf3=a189_0x56c7;if(_0x51cac6[_0xe69cf3(0x95)]!=null&&String(_0x51cac6['sqlContent'])[_0xe69cf3(0x8a)]>0x0)return _0x51cac6;return getSqlQueryDetail(_0x51cac6[_0xe69cf3(0x9b)]);}export const sqlPull={'service':a189_0x5a526f(0x7d),'command':a189_0x5a526f(0x9e),'description':'Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','risk':a189_0x5a526f(0xad),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a189_0x5a526f(0xac),'type':a189_0x5a526f(0x78),'description':'Filter\x20by\x20SQL\x20display\x20name'},{'name':'force','type':a189_0x5a526f(0xa5),'description':a189_0x5a526f(0x9f)}],async 'dryRun'(_0x15d796){const _0x4e027b=a189_0x5a526f,_0xc45e0e=loadSqlProjectConfig(_0x15d796[_0x4e027b(0x8e)]),_0x1ba307=await readSqlLockFile(_0xc45e0e[_0x4e027b(0x80)]),{appLock:_0x3e3c2a}=ensureSqlLockScope(_0x1ba307??createEmptySqlLock(),_0xc45e0e[_0x4e027b(0x8e)],_0xc45e0e[_0x4e027b(0x81)],'pull'),_0x2ae1e8=await fetchAllSqlQueries(_0x15d796['appCode'],{'sqlCode':_0x15d796['str'](_0x4e027b(0x9c))||undefined,'sqlName':_0x15d796[_0x4e027b(0x93)](_0x4e027b(0xac))||undefined}),_0x2d3e78=[];for(const _0x48b3ff of _0x2ae1e8){const _0xaef5f5=await ensureSqlContent(_0x48b3ff),_0x8f3a32=ensureRemoteSqlContent(_0xaef5f5),_0x27cb13=detectModeFromSql(_0xaef5f5),_0x4c4dfe=_0xaef5f5[_0x4e027b(0xa4)]?await getDbName(_0x15d796[_0x4e027b(0x8e)],Number(_0xaef5f5[_0x4e027b(0xa4)]))[_0x4e027b(0x86)](()=>undefined):undefined,_0x4cdb45=buildLocalSqlFileContent({'sqlCode':_0xaef5f5[_0x4e027b(0x9b)],'sqlName':_0xaef5f5[_0x4e027b(0x82)],'dbId':_0xaef5f5[_0x4e027b(0xa4)]},_0x8f3a32,{'dbName':_0x4c4dfe,'mode':_0x27cb13,'syncedAt':new Date()['toISOString'](),'description':_0xaef5f5[_0x4e027b(0x8d)]}),_0x49d635=buildSqlLockEntry(_0xaef5f5,_0x8f3a32,'',{'dbName':_0x4c4dfe}),_0x10f571=resolveLocalSqlFilePath(_0xc45e0e,_0xaef5f5['sqlCode'],_0x49d635);let _0x28bff3=_0x4e027b(0x7c),_0x1a7089;if(await fileExists(_0x10f571)){const _0x586a85=await readFile(_0x10f571,_0x4e027b(0xa1));isEquivalentPulledSqlFile(_0x586a85,_0x4cdb45,_0x27cb13)?(_0x28bff3=_0x4e027b(0x76),_0x1a7089=_0x4e027b(0xb0)):(_0x28bff3=_0x4e027b(0x99),_0x1a7089=_0x4e027b(0x88));}_0x2d3e78[_0x4e027b(0xa6)]({'sqlCode':_0xaef5f5[_0x4e027b(0x9b)],'sqlName':_0xaef5f5[_0x4e027b(0x82)],'filePath':_0x10f571,'status':_0x28bff3,'reason':_0x1a7089});}return{'method':_0x4e027b(0x77),'url':'/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','body':{'appCode':_0x15d796[_0x4e027b(0x8e)],'sqlCode':_0x15d796['str'](_0x4e027b(0x9c))||null,'sqlName':_0x15d796[_0x4e027b(0x93)](_0x4e027b(0xac))||null,'files':_0x2d3e78},'description':_0x4e027b(0x9a)+_0x2d3e78['length']+_0x4e027b(0x79)+_0xc45e0e[_0x4e027b(0xa7)]};},async 'execute'(_0xf35ee0){const _0x18005e=a189_0x5a526f,_0x5e9cdd=loadSqlProjectConfig(_0xf35ee0[_0x18005e(0x8e)]),_0x29474a=await readSqlLockFile(_0x5e9cdd['lockFilePath']),{lockData:_0x34ea68,appLock:_0x54c44b}=ensureSqlLockScope(_0x29474a??createEmptySqlLock(),_0x5e9cdd[_0x18005e(0x8e)],_0x5e9cdd[_0x18005e(0x81)],'pull'),_0x5b7280=_0xf35ee0['bool']('force'),_0x46126b=await fetchAllSqlQueries(_0xf35ee0[_0x18005e(0x8e)],{'sqlCode':_0xf35ee0['str'](_0x18005e(0x9c))||undefined,'sqlName':_0xf35ee0['str'](_0x18005e(0xac))||undefined});if(_0x46126b[_0x18005e(0x8a)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':'No\x20remote\x20SQL\x20queries\x20matched.'};const _0x35983f=[],_0x562bb8=[];for(const _0x4fa205 of _0x46126b){try{_0x35983f[_0x18005e(0xa6)](await ensureSqlContent(_0x4fa205));}catch(_0x12c06e){_0x562bb8[_0x18005e(0xa6)]({'sqlCode':_0x4fa205[_0x18005e(0x9b)],'error':_0x12c06e instanceof Error?_0x12c06e[_0x18005e(0xae)]:String(_0x12c06e)});}}if(_0x5b7280&&!_0xf35ee0['nonInteractive']){let _0x72c731=![];for(const _0x46ae8d of _0x35983f){const _0x107abd=detectModeFromSql(_0x46ae8d),_0x3bee33=_0x46ae8d['dbId']?await getDbName(_0xf35ee0[_0x18005e(0x8e)],Number(_0x46ae8d['dbId']))[_0x18005e(0x86)](()=>undefined):undefined,_0x312bb0=buildLocalSqlFileContent({'sqlCode':_0x46ae8d[_0x18005e(0x9b)],'sqlName':_0x46ae8d[_0x18005e(0x82)],'dbId':_0x46ae8d[_0x18005e(0xa4)]},ensureRemoteSqlContent(_0x46ae8d),{'dbName':_0x3bee33,'mode':_0x107abd,'syncedAt':new Date()[_0x18005e(0x87)](),'description':_0x46ae8d['description']}),_0x989eae=resolveLocalSqlFilePath(_0x5e9cdd,_0x46ae8d['sqlCode'],buildSqlLockEntry(_0x46ae8d,ensureRemoteSqlContent(_0x46ae8d),'',{'dbName':_0x3bee33}));if(await fileExists(_0x989eae)){const _0xfdacf0=await readFile(_0x989eae,'utf8');if(!isEquivalentPulledSqlFile(_0xfdacf0,_0x312bb0,_0x107abd)){_0x72c731=!![];break;}}}if(_0x72c731){const _0x3fd3f8=await confirmForceOverwrite(_0x18005e(0x83));if(!_0x3fd3f8)throw CliErrors[_0x18005e(0x89)]('Force\x20pull\x20cancelled.');}}const _0x27314c=cloneSqlLockData(_0x34ea68),_0x215fdc=_0x27314c['apps'][_0x5e9cdd[_0x18005e(0x8e)]],_0x4f22ed=[],_0x59ebe5=[];for(const _0x489e6c of _0x35983f){const _0x3b5367=_0x215fdc[_0x18005e(0x8f)][_0x489e6c[_0x18005e(0x9b)]],_0x27ba83=ensureRemoteSqlContent(_0x489e6c),_0x388f8a=detectModeFromSql(_0x489e6c),_0x1a6943=_0x489e6c[_0x18005e(0xa4)]?await getDbName(_0xf35ee0[_0x18005e(0x8e)],Number(_0x489e6c[_0x18005e(0xa4)]))['catch'](()=>undefined):undefined,_0x5c4c00=buildLocalSqlFileContent({'sqlCode':_0x489e6c['sqlCode'],'sqlName':_0x489e6c[_0x18005e(0x82)],'dbId':_0x489e6c[_0x18005e(0xa4)]},_0x27ba83,{'dbName':_0x1a6943,'mode':_0x388f8a,'syncedAt':new Date()[_0x18005e(0x87)](),'description':_0x489e6c['description']}),_0x29eea9=buildSqlLockEntry(_0x489e6c,_0x27ba83,computeSqlContentHash(_0x5c4c00),{'dbName':_0x1a6943}),_0x127bde=_0x29eea9[_0x18005e(0x85)],_0x47dae4=join(_0x5e9cdd['sqlRootDir'],_0x127bde);try{if(await fileExists(_0x47dae4)){const _0x5add14=await readFile(_0x47dae4,'utf8');if(isEquivalentPulledSqlFile(_0x5add14,_0x5c4c00,_0x388f8a)){_0x59ebe5['push']({'sqlCode':_0x489e6c[_0x18005e(0x9b)],'reason':_0x18005e(0xb0)}),_0x215fdc[_0x18005e(0x8f)][_0x489e6c[_0x18005e(0x9b)]]={..._0x29eea9,'hash':computeSqlContentHash(_0x5add14),'path':_0x127bde};continue;}if(!_0x5b7280){_0x59ebe5[_0x18005e(0xa6)]({'sqlCode':_0x489e6c['sqlCode'],'reason':_0x18005e(0x8c)});continue;}}const _0x20e6c9=_0x3b5367?.[_0x18005e(0x85)]?join(_0x5e9cdd['sqlRootDir'],_0x3b5367[_0x18005e(0x85)]):undefined;_0x20e6c9&&_0x20e6c9!==_0x47dae4&&await fileExists(_0x20e6c9)&&await rm(_0x20e6c9,{'force':!![]}),await ensureParentDirectory(_0x47dae4),await writeFile(_0x47dae4,_0x5c4c00,_0x18005e(0xa1)),_0x215fdc[_0x18005e(0x8f)][_0x489e6c[_0x18005e(0x9b)]]={..._0x29eea9,'path':_0x127bde},_0x4f22ed['push']({'sqlCode':_0x489e6c[_0x18005e(0x9b)],'filePath':_0x47dae4});}catch(_0x564b89){_0x562bb8['push']({'sqlCode':_0x489e6c[_0x18005e(0x9b)],'error':_0x564b89 instanceof Error?_0x564b89[_0x18005e(0xae)]:String(_0x564b89)});}}return _0x215fdc[_0x18005e(0x7f)]=new Date()[_0x18005e(0x87)](),await writeSqlLockFile(_0x5e9cdd['lockFilePath'],_0x27314c),{'ok':_0x562bb8[_0x18005e(0x8a)]===0x0,'data':{'pulled':_0x4f22ed,'skipped':_0x59ebe5,'failed':_0x562bb8},'message':_0x18005e(0xaf)+_0x4f22ed[_0x18005e(0x8a)]+'\x20written,\x20'+_0x59ebe5[_0x18005e(0x8a)]+_0x18005e(0x98)+_0x562bb8[_0x18005e(0x8a)]+_0x18005e(0x7b)};}};function detectModeFromSql(_0x52607d){const _0x3794ec=a189_0x5a526f,_0x4f69d2=ensureRemoteSqlContent(_0x52607d),_0x99e887=stripLocalSqlMetadata(_0x4f69d2,'mybatisXml')[_0x3794ec(0x96)]();if(/^<(select|insert|update|delete)\b/i[_0x3794ec(0x92)](_0x99e887))return _0x3794ec(0xaa);return _0x3794ec(0x7d);}function isEquivalentPulledSqlFile(_0x5bf75f,_0x40fb30,_0x13a358){return normalizePullComparableContent(_0x5bf75f,_0x13a358)===normalizePullComparableContent(_0x40fb30,_0x13a358);}function normalizePullComparableContent(_0x283b3f,_0x3d41cb){const _0xa08912=a189_0x5a526f,_0x37024c=_0x283b3f[_0xa08912(0x7e)](/\r\n/g,'\x0a')[_0xa08912(0x8b)]('\x0a'),_0x141aa2=_0x37024c['filter'](_0x6ba3ff=>!isSyncedAtMetadataLine(_0x6ba3ff,_0x3d41cb));return _0x141aa2[_0xa08912(0xa9)]('\x0a');}function a189_0x56c7(_0x161423,_0x2ba6d0){_0x161423=_0x161423-0x76;const _0x25c88a=a189_0x25c8();let _0x56c7ec=_0x25c88a[_0x161423];return _0x56c7ec;}function isSyncedAtMetadataLine(_0x5162a2,_0x5a0113){if(_0x5a0113==='mybatisXml')return/^\s*<!--\s*@lovrabet\.syncedAt:/['test'](_0x5162a2);return/^\s*--\s*@lovrabet\.syncedAt:/['test'](_0x5162a2);}
|
package/lib/commands/sql/push.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function a190_0x2770(){const _0x33e404=['Would\x20push\x20','map','startsWith','projectRoot','unchanged','str','filePath','relativePath','filter','bool','get','catch','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','entries','set','appCode','replace','push','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','6FowupE','boolean','length','sqlRootDir','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','toISOString','\x20SQL\x20file(s)','sqlRoot','/smartapi/custom/updateUserCustomSql','hash','isFinite','sql','high-risk-write','Local\x20SQL\x20not\x20found:\x20','version','3487940vjUJKc','dbDirectory','Local\x20directory\x20\x22','dbId','dbName','path','utf8','join','17522946sZnDwS','3230344YLoAVi','force','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','mode','message','5390546igTQBJ','sqlcode','lastSync','POST','1254572hIckPq','No\x20database\x20matches\x20local\x20directory\x20\x22','\x20pushed,\x20','32GScQUh','remoteId','trashDir','validation','\x22\x20for\x20sqlCode\x20','sqls','82062zwYbhV','sqlName','sqlCode','\x20skipped,\x20','570545wHYAHF'];a190_0x2770=function(){return _0x33e404;};return a190_0x2770();}const a190_0x1e1511=a190_0x21eb;(function(_0x41223d,_0x2dec2b){const _0x5ef2e1=a190_0x21eb,_0x3f132c=_0x41223d();while(!![]){try{const _0x75b15=parseInt(_0x5ef2e1(0x1e0))/0x1+parseInt(_0x5ef2e1(0x1d3))/0x2+-parseInt(_0x5ef2e1(0x1dc))/0x3*(-parseInt(_0x5ef2e1(0x1d6))/0x4)+parseInt(_0x5ef2e1(0x1c1))/0x5+parseInt(_0x5ef2e1(0x1b2))/0x6*(parseInt(_0x5ef2e1(0x1cf))/0x7)+-parseInt(_0x5ef2e1(0x1ca))/0x8+-parseInt(_0x5ef2e1(0x1c9))/0x9;if(_0x75b15===_0x2dec2b)break;else _0x3f132c['push'](_0x3f132c['shift']());}catch(_0x18d322){_0x3f132c['push'](_0x3f132c['shift']());}}}(a190_0x2770,0x82426));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';import{CliErrors}from'../../errors.js';function a190_0x21eb(_0x4689d5,_0x1d2730){_0x4689d5=_0x4689d5-0x1a0;const _0x277034=a190_0x2770();let _0x21eb5a=_0x277034[_0x4689d5];return _0x21eb5a;}import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';async function getTargetSqlQueries(_0x1b2513,_0x4059d4,_0x57b32d){const _0x1174d5=a190_0x21eb,_0x296447=await scanLocalSqlQueries(_0x1b2513),_0x364724=new Map();for(const _0x4a5ed6 of _0x296447){if(_0x57b32d&&_0x4a5ed6[_0x1174d5(0x1de)]!==_0x57b32d)continue;const _0x3524ce=_0x364724[_0x1174d5(0x1a9)](_0x4a5ed6[_0x1174d5(0x1de)])??[];_0x3524ce['push'](_0x4a5ed6),_0x364724[_0x1174d5(0x1ad)](_0x4a5ed6['sqlCode'],_0x3524ce);}if(_0x57b32d&&!_0x364724['has'](_0x57b32d))throw CliErrors[_0x1174d5(0x1d9)](_0x1174d5(0x1bf)+_0x57b32d);const _0x5c87cb=[];for(const [_0x361d42,_0x428000]of _0x364724[_0x1174d5(0x1ac)]()){if(_0x428000[_0x1174d5(0x1b4)]===0x1){_0x5c87cb[_0x1174d5(0x1b0)](_0x428000[0x0]);continue;}const _0x3a4026=_0x4059d4[_0x1174d5(0x1db)][_0x361d42],_0x1fbd0f=_0x3a4026?.[_0x1174d5(0x1c6)],_0x5afb98=_0x1fbd0f?_0x428000[_0x1174d5(0x1a7)](_0x1b7323=>_0x1b7323[_0x1174d5(0x1a6)]!==_0x1fbd0f):_0x428000;if(_0x3a4026&&_0x5afb98[_0x1174d5(0x1b4)]===0x1){_0x5c87cb['push'](_0x5afb98[0x0]);continue;}throw CliErrors[_0x1174d5(0x1d9)]('Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20'+_0x361d42+_0x1174d5(0x1b1));}return _0x5c87cb;}export const sqlPush={'service':a190_0x1e1511(0x1bd),'command':a190_0x1e1511(0x1b0),'description':'Push\x20local\x20SQL\x20files\x20to\x20remote','risk':a190_0x1e1511(0x1be),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'force','type':a190_0x1e1511(0x1b3),'description':a190_0x1e1511(0x1b6)}],async 'dryRun'(_0x2365ff){const _0x5c27bb=a190_0x1e1511,_0x544f1f=loadSqlProjectConfig(_0x2365ff[_0x5c27bb(0x1ae)]),_0x5c01e6=await readSqlLockFile(_0x544f1f['lockFilePath']),{appLock:_0x2fad7d}=ensureSqlLockScope(_0x5c01e6??createEmptySqlLock(),_0x2365ff[_0x5c27bb(0x1ae)],_0x544f1f[_0x5c27bb(0x1b9)],'push'),_0xe2af3d=await getTargetSqlQueries(_0x544f1f,_0x2fad7d,_0x2365ff[_0x5c27bb(0x1a4)](_0x5c27bb(0x1d0))||undefined),_0x30687b=[];for(const _0x5ed3e0 of _0xe2af3d){const _0x318cc6=await computeSqlFileHash(_0x5ed3e0[_0x5c27bb(0x1a5)]),_0x44a87a=_0x2fad7d[_0x5c27bb(0x1db)][_0x5ed3e0[_0x5c27bb(0x1de)]],_0x27b98b=!!_0x44a87a&&(_0x44a87a[_0x5c27bb(0x1c6)]!==_0x5ed3e0[_0x5c27bb(0x1a6)]||!!_0x5ed3e0['sqlName']&&_0x44a87a['sqlName']!==_0x5ed3e0[_0x5c27bb(0x1dd)]);if(!_0x2365ff[_0x5c27bb(0x1a8)](_0x5c27bb(0x1cb))&&_0x44a87a&&_0x44a87a[_0x5c27bb(0x1bb)]===_0x318cc6&&!_0x27b98b)continue;_0x30687b['push'](_0x5ed3e0[_0x5c27bb(0x1de)]);}return{'method':_0x5c27bb(0x1d2),'url':_0x5c27bb(0x1ba),'body':{'sqlCodes':_0x30687b,'appCode':_0x2365ff[_0x5c27bb(0x1ae)]},'description':_0x5c27bb(0x1e1)+_0x30687b['length']+_0x5c27bb(0x1b8)};},async 'execute'(_0xd407d3){const _0x148285=a190_0x1e1511,_0x5635e1=loadSqlProjectConfig(_0xd407d3[_0x148285(0x1ae)]),_0x476d4b=await readSqlLockFile(_0x5635e1['lockFilePath']),{lockData:_0x4514b2,appLock:_0x27ef7d}=ensureSqlLockScope(_0x476d4b??createEmptySqlLock(),_0xd407d3[_0x148285(0x1ae)],_0x5635e1[_0x148285(0x1b9)],_0x148285(0x1b0)),_0x5eebc1=await getTargetSqlQueries(_0x5635e1,_0x27ef7d,_0xd407d3[_0x148285(0x1a4)](_0x148285(0x1d0))||undefined);if(_0x5eebc1['length']===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':'No\x20local\x20SQL\x20files\x20found.'};const _0x44f27a=[],_0x30070d=[],_0x5c8028=[];for(const _0x11738d of _0x5eebc1){const _0x4388fb=_0x27ef7d['sqls'][_0x11738d[_0x148285(0x1de)]];if(!_0x4388fb){_0x5c8028[_0x148285(0x1b0)]({'sqlCode':_0x11738d[_0x148285(0x1de)],'error':_0x148285(0x1ab)});continue;}try{const _0x2c2b22=await computeSqlFileHash(_0x11738d['filePath']),_0x36f12f=_0x4388fb['path']!==_0x11738d[_0x148285(0x1a6)]||!!_0x11738d[_0x148285(0x1dd)]&&_0x4388fb['sqlName']!==_0x11738d[_0x148285(0x1dd)];if(!_0xd407d3[_0x148285(0x1a8)]('force')&&_0x4388fb[_0x148285(0x1bb)]===_0x2c2b22&&!_0x36f12f){_0x30070d['push']({'sqlCode':_0x11738d[_0x148285(0x1de)],'reason':_0x148285(0x1a3)});continue;}if(_0x4388fb[_0x148285(0x1c0)]==null){_0x5c8028['push']({'sqlCode':_0x11738d[_0x148285(0x1de)],'error':_0x148285(0x1cc)});continue;}const _0x10fb12=await readFile(_0x11738d[_0x148285(0x1a5)],_0x148285(0x1c7)),_0x1c3a98=stripLocalSqlMetadata(_0x10fb12,_0x11738d['mode']),_0x28a1ff=_0x11738d[_0x148285(0x1dd)]||_0x4388fb['sqlName'],_0xcf708f=await resolveTargetDbBinding(_0xd407d3[_0x148285(0x1ae)],_0x11738d,_0x4388fb),_0x5a0e8d=await updateSqlQuery({'id':_0x4388fb['remoteId'],'appCode':_0xd407d3['appCode'],'sqlCode':_0x11738d[_0x148285(0x1de)],'sqlName':_0x28a1ff,'dbId':_0xcf708f[_0x148285(0x1c4)],'version':_0x4388fb[_0x148285(0x1c0)],'sqlContent':_0x1c3a98,'sqlConfig':_0x4388fb['sqlConfig']??undefined}),_0x506338=_0x5a0e8d[_0x148285(0x1c4)]?await getDbName(_0xd407d3[_0x148285(0x1ae)],Number(_0x5a0e8d[_0x148285(0x1c4)]))[_0x148285(0x1aa)](()=>_0xcf708f['dbName']):_0xcf708f[_0x148285(0x1c5)];_0x27ef7d[_0x148285(0x1db)][_0x11738d[_0x148285(0x1de)]]={...buildSqlLockEntry(_0x5a0e8d,_0x1c3a98,_0x2c2b22,{'dbName':_0x506338}),'path':_0x11738d['relativePath'],'mode':_0x4388fb[_0x148285(0x1cd)]},await archivePreviousSqlFileIfNeeded(_0x5635e1,_0x4388fb[_0x148285(0x1c6)],_0x11738d[_0x148285(0x1a6)]),_0x44f27a[_0x148285(0x1b0)]({'sqlCode':_0x11738d['sqlCode'],'remoteId':_0x4388fb[_0x148285(0x1d7)]});}catch(_0x358005){_0x5c8028['push']({'sqlCode':_0x11738d[_0x148285(0x1de)],'error':_0x358005 instanceof Error?_0x358005[_0x148285(0x1ce)]:String(_0x358005)});}}return _0x27ef7d[_0x148285(0x1d1)]=new Date()[_0x148285(0x1b7)](),await writeSqlLockFile(_0x5635e1['lockFilePath'],_0x4514b2),{'ok':_0x5c8028['length']===0x0,'data':{'pushed':_0x44f27a,'skipped':_0x30070d,'failed':_0x5c8028},'message':'Push\x20complete:\x20'+_0x44f27a[_0x148285(0x1b4)]+_0x148285(0x1d5)+_0x30070d[_0x148285(0x1b4)]+_0x148285(0x1df)+_0x5c8028[_0x148285(0x1b4)]+'\x20failed'};}};async function archivePreviousSqlFileIfNeeded(_0x3c0b26,_0x4815a5,_0xb98a41){const _0xd92776=a190_0x1e1511;if(!_0x4815a5||_0x4815a5===_0xb98a41)return;const _0x2e5829=join(_0x3c0b26[_0xd92776(0x1b5)],_0x4815a5);if(!await fileExists(_0x2e5829))return;const _0x36e42b=await moveToTrash(_0x3c0b26[_0xd92776(0x1a2)],_0x3c0b26[_0xd92776(0x1d8)],_0x2e5829);await cleanupEmptyDirectories(dirname(_0x2e5829),_0x3c0b26[_0xd92776(0x1b5)]),void _0x36e42b;}async function moveToTrash(_0x1b3c57,_0x15c524,_0x3c96d6){const _0x370ef0=a190_0x1e1511,_0x124dd9=new Date()[_0x370ef0(0x1b7)]()[_0x370ef0(0x1af)](/[:.]/g,'-'),_0x5b5495=relative(_0x1b3c57,_0x3c96d6),_0x18f90f=join(_0x15c524,_0x124dd9,_0x5b5495);return await mkdir(dirname(_0x18f90f),{'recursive':!![]}),await rename(_0x3c96d6,_0x18f90f),_0x18f90f;}async function cleanupEmptyDirectories(_0x4b7830,_0x52ac50){const _0x2f0f73=a190_0x1e1511;let _0x45a344=resolve(_0x4b7830);const _0x1d02d1=resolve(_0x52ac50);while(_0x45a344[_0x2f0f73(0x1a1)](''+_0x1d02d1+sep)||_0x45a344===_0x1d02d1){if(_0x45a344===_0x1d02d1)return;try{const _0x570621=await readdir(_0x45a344);if(_0x570621['length']>0x0)return;await rmdir(_0x45a344);}catch{return;}_0x45a344=dirname(_0x45a344);}}async function resolveTargetDbBinding(_0x2c53e2,_0x34ae8b,_0x21dca5){const _0x3b0d8c=a190_0x1e1511,_0x581917=_0x34ae8b[_0x3b0d8c(0x1c2)];if(!_0x581917)return{'dbId':_0x21dca5[_0x3b0d8c(0x1c4)],'dbName':_0x21dca5[_0x3b0d8c(0x1c5)]};const _0x48c2e9=buildDbDirectoryName(_0x21dca5[_0x3b0d8c(0x1c5)],_0x21dca5[_0x3b0d8c(0x1c4)]);if(_0x581917===_0x48c2e9)return{'dbId':_0x21dca5[_0x3b0d8c(0x1c4)],'dbName':_0x21dca5[_0x3b0d8c(0x1c5)]};const _0x523e89=parseExplicitDbDirectory(_0x581917);if(_0x523e89!=null)return{'dbId':_0x523e89,'dbName':await getDbName(_0x2c53e2,_0x523e89)[_0x3b0d8c(0x1aa)](()=>undefined)};const _0x2b1e67=await listDatabases(_0x2c53e2),_0x4d314a=_0x2b1e67[_0x3b0d8c(0x1a7)](_0x5eeb27=>buildDbDirectoryName(_0x5eeb27['dbName'],_0x5eeb27[_0x3b0d8c(0x1c4)])===_0x581917);if(_0x4d314a[_0x3b0d8c(0x1b4)]===0x1)return{'dbId':_0x4d314a[0x0][_0x3b0d8c(0x1c4)],'dbName':_0x4d314a[0x0][_0x3b0d8c(0x1c5)]};if(_0x4d314a[_0x3b0d8c(0x1b4)]===0x0)throw CliErrors[_0x3b0d8c(0x1d9)](_0x3b0d8c(0x1d4)+_0x581917+_0x3b0d8c(0x1da)+_0x34ae8b['sqlCode']+'.');const _0x6057e6=_0x4d314a[_0x3b0d8c(0x1a0)](_0x1491e1=>_0x1491e1[_0x3b0d8c(0x1c5)]+'\x20('+_0x1491e1['dbId']+')')[_0x3b0d8c(0x1c8)](',\x20');throw CliErrors[_0x3b0d8c(0x1d9)](_0x3b0d8c(0x1c3)+_0x581917+'\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20'+_0x34ae8b[_0x3b0d8c(0x1de)]+':\x20'+_0x6057e6);}function parseExplicitDbDirectory(_0x59712a){const _0x276da7=a190_0x1e1511,_0x11ad78=/^db-(\d+)$/['exec'](_0x59712a);if(!_0x11ad78)return null;const _0x4c1851=Number(_0x11ad78[0x1]);return Number[_0x276da7(0x1bc)](_0x4c1851)&&_0x4c1851>0x0?_0x4c1851:null;}
|
|
1
|
+
const a190_0x69f56d=a190_0x1cf2;function a190_0x3f07(){const _0x358721=['sqlCode','join','high-risk-write','startsWith','No\x20database\x20matches\x20local\x20directory\x20\x22','mode','57388140dfpUGN','hash','version','\x20SQL\x20file(s)','exec','2008958YtxWhA','filter','852mqRvkB','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','dbDirectory','appCode','21768IeWqEX','bool','No\x20local\x20SQL\x20files\x20found.','POST','message','lastSync','unchanged','remoteId','sqlName','validation','filePath','dbId','push','str','force','\x20pushed,\x20','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','sqlConfig','relativePath','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','7684369gJPidm','13428aGlToL','has','Local\x20directory\x20\x22','528232mDqFXt','entries','toISOString','sqls','sqlcode','\x20skipped,\x20','path','Push\x20complete:\x20','Local\x20SQL\x20not\x20found:\x20','dbName','length','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','set','sql','lockFilePath','/smartapi/custom/updateUserCustomSql','11931720TRYzVS','4005kwtore','catch','sqlRoot','sqlRootDir','\x20failed','utf8','Push\x20local\x20SQL\x20files\x20to\x20remote'];a190_0x3f07=function(){return _0x358721;};return a190_0x3f07();}(function(_0x4665e4,_0x8a43cf){const _0x220971=a190_0x1cf2,_0x598d9d=_0x4665e4();while(!![]){try{const _0x4dcfae=-parseInt(_0x220971(0x1d4))/0x1+parseInt(_0x220971(0x1b6))/0x2+-parseInt(_0x220971(0x1b8))/0x3*(parseInt(_0x220971(0x1bc))/0x4)+-parseInt(_0x220971(0x1a4))/0x5*(parseInt(_0x220971(0x1d1))/0x6)+-parseInt(_0x220971(0x1d0))/0x7+-parseInt(_0x220971(0x1a3))/0x8+parseInt(_0x220971(0x1b1))/0x9;if(_0x4dcfae===_0x8a43cf)break;else _0x598d9d['push'](_0x598d9d['shift']());}catch(_0x21843b){_0x598d9d['push'](_0x598d9d['shift']());}}}(a190_0x3f07,0xe1e7d));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';async function getTargetSqlQueries(_0x706902,_0x36929f,_0x2ff77b){const _0x5ec1ae=a190_0x1cf2,_0x5ac2a2=await scanLocalSqlQueries(_0x706902),_0x2a76e3=new Map();for(const _0x28d26b of _0x5ac2a2){if(_0x2ff77b&&_0x28d26b['sqlCode']!==_0x2ff77b)continue;const _0x1641d4=_0x2a76e3['get'](_0x28d26b[_0x5ec1ae(0x1ab)])??[];_0x1641d4[_0x5ec1ae(0x1c8)](_0x28d26b),_0x2a76e3[_0x5ec1ae(0x19f)](_0x28d26b[_0x5ec1ae(0x1ab)],_0x1641d4);}if(_0x2ff77b&&!_0x2a76e3[_0x5ec1ae(0x1d2)](_0x2ff77b))throw CliErrors[_0x5ec1ae(0x1c5)](_0x5ec1ae(0x19b)+_0x2ff77b);const _0x5bbbaa=[];for(const [_0x454ff4,_0x122582]of _0x2a76e3[_0x5ec1ae(0x1d5)]()){if(_0x122582['length']===0x1){_0x5bbbaa['push'](_0x122582[0x0]);continue;}const _0x5f0c56=_0x36929f[_0x5ec1ae(0x196)][_0x454ff4],_0x515390=_0x5f0c56?.['path'],_0x3c7975=_0x515390?_0x122582[_0x5ec1ae(0x1b7)](_0x293fd4=>_0x293fd4['relativePath']!==_0x515390):_0x122582;if(_0x5f0c56&&_0x3c7975[_0x5ec1ae(0x19d)]===0x1){_0x5bbbaa[_0x5ec1ae(0x1c8)](_0x3c7975[0x0]);continue;}throw CliErrors['validation'](_0x5ec1ae(0x1cf)+_0x454ff4+'.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.');}return _0x5bbbaa;}export const sqlPush={'service':a190_0x69f56d(0x1a0),'command':a190_0x69f56d(0x1c8),'description':a190_0x69f56d(0x1aa),'risk':a190_0x69f56d(0x1ad),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a190_0x69f56d(0x1ca),'type':'boolean','description':a190_0x69f56d(0x1cc)}],async 'dryRun'(_0x11eef2){const _0x498fac=a190_0x69f56d,_0x675a09=loadSqlProjectConfig(_0x11eef2['appCode']),_0x8139f=await readSqlLockFile(_0x675a09[_0x498fac(0x1a1)]),{appLock:_0x441ae4}=ensureSqlLockScope(_0x8139f??createEmptySqlLock(),_0x11eef2[_0x498fac(0x1bb)],_0x675a09[_0x498fac(0x1a6)],_0x498fac(0x1c8)),_0x47e03a=await getTargetSqlQueries(_0x675a09,_0x441ae4,_0x11eef2[_0x498fac(0x1c9)]('sqlcode')||undefined),_0x5d65cb=[];for(const _0x1a4274 of _0x47e03a){const _0x360668=await computeSqlFileHash(_0x1a4274['filePath']),_0x1d4b56=_0x441ae4[_0x498fac(0x196)][_0x1a4274[_0x498fac(0x1ab)]],_0x500d98=!!_0x1d4b56&&(_0x1d4b56[_0x498fac(0x199)]!==_0x1a4274[_0x498fac(0x1ce)]||!!_0x1a4274[_0x498fac(0x1c4)]&&_0x1d4b56[_0x498fac(0x1c4)]!==_0x1a4274[_0x498fac(0x1c4)]);if(!_0x11eef2[_0x498fac(0x1bd)]('force')&&_0x1d4b56&&_0x1d4b56['hash']===_0x360668&&!_0x500d98)continue;_0x5d65cb['push'](_0x1a4274['sqlCode']);}return{'method':_0x498fac(0x1bf),'url':_0x498fac(0x1a2),'body':{'sqlCodes':_0x5d65cb,'appCode':_0x11eef2[_0x498fac(0x1bb)]},'description':'Would\x20push\x20'+_0x5d65cb[_0x498fac(0x19d)]+_0x498fac(0x1b4)};},async 'execute'(_0x3665ba){const _0x4119a2=a190_0x69f56d,_0x177558=loadSqlProjectConfig(_0x3665ba[_0x4119a2(0x1bb)]),_0x48f427=await readSqlLockFile(_0x177558[_0x4119a2(0x1a1)]),{lockData:_0x3baa87,appLock:_0x22a95d}=ensureSqlLockScope(_0x48f427??createEmptySqlLock(),_0x3665ba[_0x4119a2(0x1bb)],_0x177558[_0x4119a2(0x1a6)],'push'),_0x363ffa=await getTargetSqlQueries(_0x177558,_0x22a95d,_0x3665ba['str'](_0x4119a2(0x197))||undefined);if(_0x363ffa[_0x4119a2(0x19d)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x4119a2(0x1be)};const _0x5afc1b=[],_0x505e84=[],_0x487e58=[];for(const _0xd8d8ab of _0x363ffa){const _0x759f61=_0x22a95d[_0x4119a2(0x196)][_0xd8d8ab[_0x4119a2(0x1ab)]];if(!_0x759f61){_0x487e58[_0x4119a2(0x1c8)]({'sqlCode':_0xd8d8ab['sqlCode'],'error':_0x4119a2(0x1b9)});continue;}try{const _0x36c501=await computeSqlFileHash(_0xd8d8ab[_0x4119a2(0x1c6)]),_0x3a989d=_0x759f61[_0x4119a2(0x199)]!==_0xd8d8ab[_0x4119a2(0x1ce)]||!!_0xd8d8ab['sqlName']&&_0x759f61[_0x4119a2(0x1c4)]!==_0xd8d8ab[_0x4119a2(0x1c4)];if(!_0x3665ba[_0x4119a2(0x1bd)](_0x4119a2(0x1ca))&&_0x759f61[_0x4119a2(0x1b2)]===_0x36c501&&!_0x3a989d){_0x505e84[_0x4119a2(0x1c8)]({'sqlCode':_0xd8d8ab['sqlCode'],'reason':_0x4119a2(0x1c2)});continue;}if(_0x759f61[_0x4119a2(0x1b3)]==null){_0x487e58['push']({'sqlCode':_0xd8d8ab[_0x4119a2(0x1ab)],'error':_0x4119a2(0x19e)});continue;}const _0x53551c=await readFile(_0xd8d8ab[_0x4119a2(0x1c6)],_0x4119a2(0x1a9)),_0x1b8121=stripLocalSqlMetadata(_0x53551c,_0xd8d8ab[_0x4119a2(0x1b0)]),_0x38b87f=_0xd8d8ab[_0x4119a2(0x1c4)]||_0x759f61['sqlName'],_0x1de4d6=await resolveTargetDbBinding(_0x3665ba[_0x4119a2(0x1bb)],_0xd8d8ab,_0x759f61),_0x432ac2=await updateSqlQuery({'id':_0x759f61[_0x4119a2(0x1c3)],'appCode':_0x3665ba['appCode'],'sqlCode':_0xd8d8ab[_0x4119a2(0x1ab)],'sqlName':_0x38b87f,'dbId':_0x1de4d6[_0x4119a2(0x1c7)],'version':_0x759f61[_0x4119a2(0x1b3)],'sqlContent':_0x1b8121,'sqlConfig':_0x759f61[_0x4119a2(0x1cd)]??undefined}),_0x5e78e7=_0x432ac2[_0x4119a2(0x1c7)]?await getDbName(_0x3665ba['appCode'],Number(_0x432ac2[_0x4119a2(0x1c7)]))['catch'](()=>_0x1de4d6[_0x4119a2(0x19c)]):_0x1de4d6[_0x4119a2(0x19c)];_0x22a95d['sqls'][_0xd8d8ab[_0x4119a2(0x1ab)]]={...buildSqlLockEntry(_0x432ac2,_0x1b8121,_0x36c501,{'dbName':_0x5e78e7}),'path':_0xd8d8ab[_0x4119a2(0x1ce)],'mode':_0x759f61[_0x4119a2(0x1b0)]},await archivePreviousSqlFileIfNeeded(_0x177558,_0x759f61[_0x4119a2(0x199)],_0xd8d8ab[_0x4119a2(0x1ce)]),_0x5afc1b['push']({'sqlCode':_0xd8d8ab['sqlCode'],'remoteId':_0x759f61[_0x4119a2(0x1c3)]});}catch(_0x2bedc2){_0x487e58['push']({'sqlCode':_0xd8d8ab['sqlCode'],'error':_0x2bedc2 instanceof Error?_0x2bedc2[_0x4119a2(0x1c0)]:String(_0x2bedc2)});}}return _0x22a95d[_0x4119a2(0x1c1)]=new Date()['toISOString'](),await writeSqlLockFile(_0x177558[_0x4119a2(0x1a1)],_0x3baa87),{'ok':_0x487e58[_0x4119a2(0x19d)]===0x0,'data':{'pushed':_0x5afc1b,'skipped':_0x505e84,'failed':_0x487e58},'message':_0x4119a2(0x19a)+_0x5afc1b['length']+_0x4119a2(0x1cb)+_0x505e84[_0x4119a2(0x19d)]+_0x4119a2(0x198)+_0x487e58[_0x4119a2(0x19d)]+_0x4119a2(0x1a8)};}};async function archivePreviousSqlFileIfNeeded(_0x46f1ef,_0x2b4503,_0x5f22a5){const _0x307ea0=a190_0x69f56d;if(!_0x2b4503||_0x2b4503===_0x5f22a5)return;const _0x2db7b4=join(_0x46f1ef['sqlRootDir'],_0x2b4503);if(!await fileExists(_0x2db7b4))return;const _0x3c6374=await moveToTrash(_0x46f1ef['projectRoot'],_0x46f1ef['trashDir'],_0x2db7b4);await cleanupEmptyDirectories(dirname(_0x2db7b4),_0x46f1ef[_0x307ea0(0x1a7)]),void _0x3c6374;}async function moveToTrash(_0x13fbf9,_0x3f9321,_0x4dd0e1){const _0x36924a=a190_0x69f56d,_0x21ce07=new Date()[_0x36924a(0x1d6)]()['replace'](/[:.]/g,'-'),_0x2445d7=relative(_0x13fbf9,_0x4dd0e1),_0x5b58fb=join(_0x3f9321,_0x21ce07,_0x2445d7);return await mkdir(dirname(_0x5b58fb),{'recursive':!![]}),await rename(_0x4dd0e1,_0x5b58fb),_0x5b58fb;}async function cleanupEmptyDirectories(_0xa92f4,_0xee37f5){const _0x1170f7=a190_0x69f56d;let _0x3ace83=resolve(_0xa92f4);const _0x58575b=resolve(_0xee37f5);while(_0x3ace83[_0x1170f7(0x1ae)](''+_0x58575b+sep)||_0x3ace83===_0x58575b){if(_0x3ace83===_0x58575b)return;try{const _0x59a222=await readdir(_0x3ace83);if(_0x59a222[_0x1170f7(0x19d)]>0x0)return;await rmdir(_0x3ace83);}catch{return;}_0x3ace83=dirname(_0x3ace83);}}function a190_0x1cf2(_0x1b04db,_0x5a35d0){_0x1b04db=_0x1b04db-0x196;const _0x3f0705=a190_0x3f07();let _0x1cf256=_0x3f0705[_0x1b04db];return _0x1cf256;}async function resolveTargetDbBinding(_0x13a3ce,_0x562056,_0x3607cf){const _0x3f56e8=a190_0x69f56d,_0x4d0c9a=_0x562056[_0x3f56e8(0x1ba)];if(!_0x4d0c9a)return{'dbId':_0x3607cf['dbId'],'dbName':_0x3607cf[_0x3f56e8(0x19c)]};const _0x4ac3ea=buildDbDirectoryName(_0x3607cf[_0x3f56e8(0x19c)],_0x3607cf[_0x3f56e8(0x1c7)]);if(_0x4d0c9a===_0x4ac3ea)return{'dbId':_0x3607cf[_0x3f56e8(0x1c7)],'dbName':_0x3607cf[_0x3f56e8(0x19c)]};const _0x5a6ed2=parseExplicitDbDirectory(_0x4d0c9a);if(_0x5a6ed2!=null)return{'dbId':_0x5a6ed2,'dbName':await getDbName(_0x13a3ce,_0x5a6ed2)[_0x3f56e8(0x1a5)](()=>undefined)};const _0x53e566=await listDatabases(_0x13a3ce),_0x3d0576=_0x53e566['filter'](_0x5bc972=>buildDbDirectoryName(_0x5bc972[_0x3f56e8(0x19c)],_0x5bc972[_0x3f56e8(0x1c7)])===_0x4d0c9a);if(_0x3d0576[_0x3f56e8(0x19d)]===0x1)return{'dbId':_0x3d0576[0x0][_0x3f56e8(0x1c7)],'dbName':_0x3d0576[0x0][_0x3f56e8(0x19c)]};if(_0x3d0576[_0x3f56e8(0x19d)]===0x0)throw CliErrors[_0x3f56e8(0x1c5)](_0x3f56e8(0x1af)+_0x4d0c9a+'\x22\x20for\x20sqlCode\x20'+_0x562056['sqlCode']+'.');const _0x46a4d0=_0x3d0576['map'](_0x13068a=>_0x13068a['dbName']+'\x20('+_0x13068a[_0x3f56e8(0x1c7)]+')')[_0x3f56e8(0x1ac)](',\x20');throw CliErrors[_0x3f56e8(0x1c5)](_0x3f56e8(0x1d3)+_0x4d0c9a+'\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20'+_0x562056['sqlCode']+':\x20'+_0x46a4d0);}function parseExplicitDbDirectory(_0xff6392){const _0x1bb810=a190_0x69f56d,_0x330ca7=/^db-(\d+)$/[_0x1bb810(0x1b5)](_0xff6392);if(!_0x330ca7)return null;const _0x181ad3=Number(_0x330ca7[0x1]);return Number['isFinite'](_0x181ad3)&&_0x181ad3>0x0?_0x181ad3:null;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a191_0x56adec=a191_0x47c7;function a191_0x47c7(_0x2bd04b,_0x5071a8){_0x2bd04b=_0x2bd04b-0xdb;const _0x3d303a=a191_0x3d30();let _0x47c7d7=_0x3d303a[_0x2bd04b];return _0x47c7d7;}(function(_0xf3e302,_0x35b85e){const _0x478bc9=a191_0x47c7,_0x59213d=_0xf3e302();while(!![]){try{const _0x50a900=-parseInt(_0x478bc9(0xf6))/0x1*(parseInt(_0x478bc9(0xf2))/0x2)+-parseInt(_0x478bc9(0xf3))/0x3+-parseInt(_0x478bc9(0xe1))/0x4+-parseInt(_0x478bc9(0xfa))/0x5+-parseInt(_0x478bc9(0xe5))/0x6*(-parseInt(_0x478bc9(0xdb))/0x7)+parseInt(_0x478bc9(0xf9))/0x8+-parseInt(_0x478bc9(0xfe))/0x9*(-parseInt(_0x478bc9(0xe3))/0xa);if(_0x50a900===_0x35b85e)break;else _0x59213d['push'](_0x59213d['shift']());}catch(_0x2f0067){_0x59213d['push'](_0x59213d['shift']());}}}(a191_0x3d30,0x6fb98));import{createInterface}from'node:readline';import{join}from'node:path';import{buildDefaultSqlFileName,buildSqlRelativePath,detectSqlMode}from'../../core/sql-sync/utils.js';export const SQL_LOCAL_REL_DIR=a191_0x56adec(0xf8);export function buildSqlLockEntry(_0x51898d,_0x5d289d,_0x2e8af8,_0x357325){const _0x1b1834=a191_0x56adec,_0x590f55=detectSqlMode(_0x5d289d);return{'path':buildSqlRelativePath(_0x51898d['sqlCode'],_0x51898d['sqlName'],_0x357325?.[_0x1b1834(0xf1)],_0x590f55,_0x51898d['dbId']),'hash':_0x2e8af8,'remoteId':_0x51898d['id'],'version':_0x51898d[_0x1b1834(0xe9)],'dbId':Number(_0x51898d[_0x1b1834(0xfd)]),'dbName':_0x357325?.[_0x1b1834(0xf1)],'sqlName':_0x51898d[_0x1b1834(0xde)],'sqlConfig':_0x51898d[_0x1b1834(0xfb)]??undefined,'mode':_0x590f55};}export function cloneSqlLockData(_0xa15dd9){const _0x265cb8=a191_0x56adec;return{'apps':Object['fromEntries'](Object[_0x265cb8(0x101)](_0xa15dd9['apps'])['map'](([_0x2e5909,_0x59d5af])=>[_0x2e5909,{'sqlRoot':_0x59d5af[_0x265cb8(0xdc)],'lastSync':_0x59d5af[_0x265cb8(0xef)],'sqls':{..._0x59d5af[_0x265cb8(0xf0)]}}]))};}export function ensureRemoteSqlContent(_0x52cafb){const _0x5a4f39=a191_0x56adec;return _0x52cafb[_0x5a4f39(0xeb)]??'';}export function buildLocalSqlFileContent(_0x9fa827,_0x558d34,_0x1c4243){const _0x5d2067=a191_0x56adec,_0x609ebb=_0x1c4243?.[_0x5d2067(0xf5)]??detectSqlMode(_0x558d34),_0x3763c4=stripLocalSqlMetadata(_0x558d34,_0x609ebb)[_0x5d2067(0xe8)](),_0x297e4d=[...buildMetadataHeaderLines({'sqlCode':_0x9fa827['sqlCode'],'sqlName':_0x9fa827[_0x5d2067(0xde)],'dbId':_0x9fa827[_0x5d2067(0xfd)],'dbName':_0x1c4243?.['dbName'],'mode':_0x609ebb,'syncedAt':_0x1c4243?.[_0x5d2067(0xf4)],'description':_0x1c4243?.['description']},_0x609ebb),'',_0x3763c4],_0x35fce9=_0x297e4d[_0x5d2067(0xe7)]('\x0a');return _0x35fce9[_0x5d2067(0xe0)]('\x0a')?_0x35fce9:_0x35fce9+'\x0a';}export function stripLocalSqlMetadata(_0x2c8705,_0x1d15b2){const _0x4f8e12=a191_0x56adec,_0x4f6eb3=_0x2c8705[_0x4f8e12(0x105)](/\r\n/g,'\x0a')[_0x4f8e12(0x102)]('\x0a'),_0x5dd42c=[];let _0x28c90d=0x0;if(_0x1d15b2===_0x4f8e12(0xed))while(_0x28c90d<_0x4f6eb3[_0x4f8e12(0xe6)]){const _0x2ea150=_0x4f6eb3[_0x28c90d]??'';if(/^\s*<!--\s*@lovrabet\./[_0x4f8e12(0x106)](_0x2ea150)){_0x28c90d++;continue;}if(_0x2ea150[_0x4f8e12(0xe8)]()===''&&_0x28c90d>0x0){_0x28c90d++;continue;}break;}else while(_0x28c90d<_0x4f6eb3[_0x4f8e12(0xe6)]){const _0x493414=_0x4f6eb3[_0x28c90d]??'';if(/^\s*--\s*@lovrabet\./[_0x4f8e12(0x106)](_0x493414)){_0x28c90d++;continue;}if(_0x493414['trim']()===''&&_0x28c90d>0x0){_0x28c90d++;continue;}break;}for(;_0x28c90d<_0x4f6eb3[_0x4f8e12(0xe6)];_0x28c90d++){_0x5dd42c['push'](_0x4f6eb3[_0x28c90d]);}return _0x5dd42c[_0x4f8e12(0xe7)]('\x0a')[_0x4f8e12(0xea)]();}export function resolveSqlMode(_0xf004f7,_0x560123){const _0x7afff9=a191_0x56adec;if(_0x560123?.['mode'])return _0x560123[_0x7afff9(0xf5)];return detectSqlMode(_0xf004f7);}export function resolveSqlFileName(_0x30a81f,_0xd2a20a,_0x4f2ff2){const _0x24662d=a191_0x56adec;if(_0x4f2ff2?.['path'])return _0x4f2ff2[_0x24662d(0x100)];if(_0x4f2ff2?.[_0x24662d(0xde)]||_0x4f2ff2?.[_0x24662d(0xf1)])return buildSqlRelativePath(_0x30a81f,_0x4f2ff2?.['sqlName'],_0x4f2ff2?.[_0x24662d(0xf1)],resolveSqlMode(_0xd2a20a,_0x4f2ff2),_0x4f2ff2?.[_0x24662d(0xfd)]);return buildDefaultSqlFileName(_0x30a81f,resolveSqlMode(_0xd2a20a,_0x4f2ff2));}export function resolveSqlLocalDir(_0x2ecdd0,_0xec5368){return join(_0x2ecdd0,SQL_LOCAL_REL_DIR,_0xec5368);}export async function confirmForceOverwrite(_0x3e7576){const _0x377f12=a191_0x56adec,_0x1ae9be=createInterface({'input':process['stdin'],'output':process[_0x377f12(0xee)]}),_0x17225b=await new Promise(_0x1405e9=>{const _0x2aa3d7=_0x377f12;_0x1ae9be[_0x2aa3d7(0xe2)](_0x3e7576+'\x20[y/N]\x20',_0x1405e9);});return _0x1ae9be[_0x377f12(0x104)](),['y',_0x377f12(0xfc)]['includes'](_0x17225b[_0x377f12(0xe8)]()['toLowerCase']());}function a191_0x3d30(){const _0x4e6cc4=['trim','version','trimStart','sqlContent','sqlCode','mybatisXml','stderr','lastSync','sqls','dbName','238428SamVpM','1660215JARsBH','syncedAt','mode','1qBkXKL','description','.rabetbase/sql','5647880KKCYUq','2083515fzOsue','sqlConfig','yes','dbId','931977JRUykD','map','path','entries','split','\x20-->','close','replace','test','184408MCMMKZ','sqlRoot','apps','sqlName','filter','endsWith','3300008fjXTqn','question','110ybtBsN','<!--\x20@lovrabet.','120jSlCgN','length','join'];a191_0x3d30=function(){return _0x4e6cc4;};return a191_0x3d30();}export function findSqlLockScope(_0x5c451d,_0x285a17){const _0x24def4=a191_0x56adec;return _0x5c451d[_0x24def4(0xdd)][_0x285a17];}function buildMetadataHeaderLines(_0x57ac80,_0x16695a){const _0x441025=a191_0x56adec,_0x560fbb=[[_0x441025(0xec),_0x57ac80['sqlCode']],['sqlName',_0x57ac80[_0x441025(0xde)]],[_0x441025(0xfd),_0x57ac80[_0x441025(0xfd)]],[_0x441025(0xf1),_0x57ac80[_0x441025(0xf1)]],[_0x441025(0xf5),_0x57ac80[_0x441025(0xf5)]],[_0x441025(0xf4),_0x57ac80[_0x441025(0xf4)]],[_0x441025(0xf7),_0x57ac80[_0x441025(0xf7)]]];if(_0x16695a===_0x441025(0xed))return _0x560fbb[_0x441025(0xdf)](([,_0x25dcd3])=>_0x25dcd3!==undefined&&_0x25dcd3!==null&&String(_0x25dcd3)['trim']()!=='')[_0x441025(0xff)](([_0x16ee72,_0x1ff20])=>_0x441025(0xe4)+_0x16ee72+':\x20'+String(_0x1ff20)+_0x441025(0x103));return _0x560fbb[_0x441025(0xdf)](([,_0x9c350e])=>_0x9c350e!==undefined&&_0x9c350e!==null&&String(_0x9c350e)[_0x441025(0xe8)]()!=='')[_0x441025(0xff)](([_0x3b091c,_0x351eb1])=>'--\x20@lovrabet.'+_0x3b091c+':\x20'+String(_0x351eb1));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a192_0x41d37c=a192_0x3113;function a192_0xf370(){const _0x3f28a0=['701345NmVdHf','\x20modified,\x20','remote','11733UHgnUj','bool','path','2251290rLOkdp','map','keys','Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally','18fqqUYp','length','sql','1259461XquJqK','12290982vYSSns','sqlName','push','tableData','appCode','filePath','boolean','lockKey','All\x20SQL\x20queries\x20are\x20in\x20sync.','8562cBzJIq','7353BGJBIx','sqlCode','Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','4152ZnhWoT','\x20missing,\x20','128dokFbh','\x20added,\x20','hash','sqls','19YPPIph','totalCount','relativePath','has'];a192_0xf370=function(){return _0x3f28a0;};return a192_0xf370();}(function(_0x14f0f1,_0x393f42){const _0x95f068=a192_0x3113,_0x34297a=_0x14f0f1();while(!![]){try{const _0x5d7e5c=-parseInt(_0x95f068(0x175))/0x1*(-parseInt(_0x95f068(0x16b))/0x2)+parseInt(_0x95f068(0x157))/0x3*(parseInt(_0x95f068(0x171))/0x4)+parseInt(_0x95f068(0x154))/0x5+-parseInt(_0x95f068(0x15e))/0x6*(-parseInt(_0x95f068(0x161))/0x7)+-parseInt(_0x95f068(0x16f))/0x8*(-parseInt(_0x95f068(0x16c))/0x9)+parseInt(_0x95f068(0x15a))/0xa+-parseInt(_0x95f068(0x162))/0xb;if(_0x5d7e5c===_0x393f42)break;else _0x34297a['push'](_0x34297a['shift']());}catch(_0x24ac20){_0x34297a['push'](_0x34297a['shift']());}}}(a192_0xf370,0x6620f));import{listSqlQueries}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile}from'../../core/sql-sync/lock.js';const PAGE_SIZE=0x64;function a192_0x3113(_0x3917d5,_0x3a62bf){_0x3917d5=_0x3917d5-0x151;const _0xf3701a=a192_0xf370();let _0x311358=_0xf3701a[_0x3917d5];return _0x311358;}async function fetchAllSqlCodes(_0x303994){const _0x545fbb=a192_0x3113,_0x57b4db=[];let _0x5a9e1e=0x1;while(!![]){const _0x2c1948=await listSqlQueries(_0x303994,{'currentPage':_0x5a9e1e,'pageSize':PAGE_SIZE}),_0x139f97=_0x2c1948[_0x545fbb(0x165)]??[];_0x57b4db['push'](..._0x139f97['map'](_0x5f4845=>_0x5f4845[_0x545fbb(0x16d)]));if(_0x139f97[_0x545fbb(0x15f)]===0x0)break;const _0x1da8fc=_0x2c1948['paging']?.[_0x545fbb(0x151)];if(_0x1da8fc!=null?_0x57b4db['length']>=_0x1da8fc:_0x139f97[_0x545fbb(0x15f)]<PAGE_SIZE)break;_0x5a9e1e++;}return _0x57b4db;}export const sqlStatus={'service':a192_0x41d37c(0x160),'command':'status','description':a192_0x41d37c(0x16e),'risk':'read','flags':[{'name':a192_0x41d37c(0x156),'type':a192_0x41d37c(0x168),'description':a192_0x41d37c(0x15d)}],async 'execute'(_0x28f9c3){const _0x56370e=a192_0x41d37c,_0x1f6ef3=loadSqlProjectConfig(_0x28f9c3[_0x56370e(0x166)]),_0x32710a=await readSqlLockFile(_0x1f6ef3['lockFilePath']),{appLock:_0x1a92e5}=ensureSqlLockScope(_0x32710a??createEmptySqlLock(),_0x1f6ef3['appCode'],_0x1f6ef3['sqlRoot'],'status'),_0x5f181f=await scanLocalSqlQueries(_0x1f6ef3),_0x3b51d2=[],_0x242247=[],_0x431a78=[],_0x19bfb3=[],_0x244175=new Set(_0x5f181f[_0x56370e(0x15b)](_0x3aef58=>_0x3aef58[_0x56370e(0x169)]));for(const _0x30fd82 of _0x5f181f){const _0x2367cb=await computeSqlFileHash(_0x30fd82[_0x56370e(0x167)]),_0x3aefb0=_0x1a92e5[_0x56370e(0x174)][_0x30fd82[_0x56370e(0x169)]],_0x4c40eb=!!_0x3aefb0&&_0x3aefb0[_0x56370e(0x159)]!==_0x30fd82[_0x56370e(0x152)],_0x471195=!!_0x3aefb0&&!!_0x30fd82[_0x56370e(0x163)]&&_0x3aefb0['sqlName']!==_0x30fd82[_0x56370e(0x163)];if(!_0x3aefb0)_0x3b51d2['push'](_0x30fd82[_0x56370e(0x169)]);else _0x3aefb0[_0x56370e(0x173)]!==_0x2367cb||_0x4c40eb||_0x471195?_0x242247[_0x56370e(0x164)](_0x30fd82['lockKey']):_0x431a78[_0x56370e(0x164)](_0x30fd82['lockKey']);}for(const _0xb9ec5a of Object[_0x56370e(0x15c)](_0x1a92e5[_0x56370e(0x174)])){!_0x244175[_0x56370e(0x153)](_0xb9ec5a)&&_0x19bfb3[_0x56370e(0x164)](_0xb9ec5a);}const _0x14caea=[];if(_0x28f9c3[_0x56370e(0x158)](_0x56370e(0x156))){const _0x555d69=await fetchAllSqlCodes(_0x28f9c3[_0x56370e(0x166)]);for(const _0x37414d of _0x555d69){!_0x244175[_0x56370e(0x153)](_0x37414d)&&!_0x1a92e5[_0x56370e(0x174)][_0x37414d]&&_0x14caea[_0x56370e(0x164)](_0x37414d);}}const _0x25c374=_0x3b51d2[_0x56370e(0x15f)]===0x0&&_0x242247[_0x56370e(0x15f)]===0x0&&_0x19bfb3[_0x56370e(0x15f)]===0x0&&_0x14caea[_0x56370e(0x15f)]===0x0;return{'ok':!![],'data':{'added':_0x3b51d2,'modified':_0x242247,'missing':_0x19bfb3,'unchanged':_0x431a78,'remoteOnly':_0x14caea},'message':_0x25c374?_0x56370e(0x16a):_0x3b51d2[_0x56370e(0x15f)]+_0x56370e(0x172)+_0x242247[_0x56370e(0x15f)]+_0x56370e(0x155)+_0x19bfb3[_0x56370e(0x15f)]+_0x56370e(0x170)+_0x431a78['length']+'\x20unchanged'+(_0x14caea[_0x56370e(0x15f)]>0x0?',\x20'+_0x14caea[_0x56370e(0x15f)]+'\x20remote-only':'')};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a193_0x1f8229=a193_0x1f2a;(function(_0x3835c0,_0x5a91ad){const _0x249122=a193_0x1f2a,_0x20fd8d=_0x3835c0();while(!![]){try{const _0x56d0d9=parseInt(_0x249122(0x155))/0x1+-parseInt(_0x249122(0x149))/0x2*(-parseInt(_0x249122(0x14c))/0x3)+-parseInt(_0x249122(0x187))/0x4+-parseInt(_0x249122(0x18c))/0x5*(parseInt(_0x249122(0x162))/0x6)+parseInt(_0x249122(0x17e))/0x7*(parseInt(_0x249122(0x16f))/0x8)+parseInt(_0x249122(0x17a))/0x9+-parseInt(_0x249122(0x15a))/0xa;if(_0x56d0d9===_0x5a91ad)break;else _0x20fd8d['push'](_0x20fd8d['shift']());}catch(_0x170607){_0x20fd8d['push'](_0x20fd8d['shift']());}}}(a193_0xa391,0xb7ad1));import{readFileSync,existsSync}from'node:fs';import{resolve}from'node:path';function a193_0xa391(){const _0x5396bf=['File\x20not\x20found:\x20','columnNames','name','map','type','isArray','file','\x22\x20not\x20found\x20in\x20any\x20dataset','10582047esoykd','toLowerCase','appCode','cwd','1537977gKXoXK','check-indexes','indexName','string','from','tables','schemas','message','Dataset\x20\x22','6007348AdRMPT','size','Path\x20to\x20the\x20SQL\x20file\x20to\x20validate','push','unshift','7895PPhZYN','find','31594kjXCeJ','flagMissing','trim','207DlSEeJ','validate','index_columns','utf-8','sql','Comma-separated\x20dataset\x20codes\x20to\x20cross-check\x20table/column\x20names\x20against','dbtableConfig','tableName','Audit\x20top-level\x20JOIN\x20equality\x20predicates\x20against\x20dataset\x20index\x20metadata','727865gWaoQB','indexes','\x22\x20not\x20found\x20or\x20not\x20accessible','dataset','primary','8172980EtiOXK','Validate\x20SQL\x20content\x20without\x20saving\x20(type\x20detection,\x20parameter\x20extraction,\x20optional\x20schema\x20check)','parameters','filter','index_name','flatMap','length','fields','1374tXQZZY','str','columns','pkField','isSelectOnly','boolean','split','index_type','Table\x20\x22','read','sqlType','validation','reason','16geiTHc','--check-indexes\x20requires\x20--schemas.','Provide\x20--file\x20or\x20--sql'];a193_0xa391=function(){return _0x5396bf;};return a193_0xa391();}import{validateSql}from'../../core/sql-validator.js';import{auditSqlJoinIndexes}from'../../core/sql-index-auditor.js';import{getDatasetDetail,listDatasets}from'../../core/api-client.js';function a193_0x1f2a(_0x147173,_0x481491){_0x147173=_0x147173-0x149;const _0xa39165=a193_0xa391();let _0x1f2a4c=_0xa39165[_0x147173];return _0x1f2a4c;}import{CliErrors}from'../../errors.js';import{assertDatasetIsDbTableBacked,filterDbTableBackedDatasets}from'../../commands/dataset/capability.js';export const sqlValidate={'service':a193_0x1f8229(0x150),'command':a193_0x1f8229(0x14d),'description':a193_0x1f8229(0x15b),'risk':a193_0x1f8229(0x16b),'flags':[{'name':a193_0x1f8229(0x178),'type':a193_0x1f8229(0x181),'description':a193_0x1f8229(0x189)},{'name':a193_0x1f8229(0x150),'type':'string','description':'Inline\x20SQL\x20content\x20to\x20validate\x20(alternative\x20to\x20--file)'},{'name':a193_0x1f8229(0x184),'type':a193_0x1f8229(0x181),'description':a193_0x1f8229(0x151)},{'name':a193_0x1f8229(0x17f),'type':a193_0x1f8229(0x167),'description':a193_0x1f8229(0x154)}],async 'execute'(_0x5a4157){const _0x527ac5=a193_0x1f8229,_0xbec7ad=_0x5a4157[_0x527ac5(0x163)](_0x527ac5(0x178)),_0x2b483d=_0x5a4157[_0x527ac5(0x163)](_0x527ac5(0x150)),_0x45fbf6=_0x5a4157[_0x527ac5(0x163)]('schemas'),_0x298ff5=_0x5a4157['bool'](_0x527ac5(0x17f));if(!_0xbec7ad&&!_0x2b483d)throw CliErrors[_0x527ac5(0x14a)](_0x527ac5(0x178),_0x527ac5(0x171));if(_0x298ff5&&!_0x45fbf6)throw CliErrors[_0x527ac5(0x16d)](_0x527ac5(0x170));let _0x4f0091;if(_0xbec7ad){const _0x4ca1b8=resolve(process[_0x527ac5(0x17d)](),_0xbec7ad);if(!existsSync(_0x4ca1b8))throw CliErrors['validation'](_0x527ac5(0x172)+_0x4ca1b8);_0x4f0091=readFileSync(_0x4ca1b8,_0x527ac5(0x14f));}else _0x4f0091=_0x2b483d;const _0x52531f=validateSql(_0x4f0091),_0x1c441a={'valid':_0x52531f['valid'],'sqlType':_0x52531f[_0x527ac5(0x16c)]['type'],'isSelectOnly':_0x52531f[_0x527ac5(0x16c)][_0x527ac5(0x166)],'isDangerous':_0x52531f[_0x527ac5(0x16c)]['isDangerous'],'tables':_0x52531f[_0x527ac5(0x183)],'parameters':_0x52531f[_0x527ac5(0x15c)],'message':_0x52531f[_0x527ac5(0x185)]};_0x52531f['sqlType']['reason']&&(_0x1c441a[_0x527ac5(0x16e)]=_0x52531f[_0x527ac5(0x16c)]['reason']);if(_0x45fbf6&&_0x52531f['valid']){const _0x1d5f3e=_0x45fbf6[_0x527ac5(0x168)](',')[_0x527ac5(0x175)](_0x364cb1=>_0x364cb1[_0x527ac5(0x14b)]())[_0x527ac5(0x15d)](Boolean),_0x276249=[],_0x585f47=[],_0x3c0474=filterDbTableBackedDatasets(await listDatasets(_0x5a4157[_0x527ac5(0x17c)])),_0x16a2d4=new Map(_0x3c0474[_0x527ac5(0x175)](_0x5a0774=>[_0x5a0774[_0x527ac5(0x152)]?.['tableName']?.['toLowerCase'](),_0x5a0774]));for(const _0x49437f of _0x52531f['tables']){const _0x94fa42=_0x16a2d4['get'](_0x49437f[_0x527ac5(0x17b)]());!_0x94fa42&&_0x276249[_0x527ac5(0x18a)](_0x527ac5(0x16a)+_0x49437f+_0x527ac5(0x179));}for(const _0x270d7a of _0x1d5f3e){let _0x3d26a3;try{_0x3d26a3=await getDatasetDetail(_0x270d7a);}catch{_0x276249[_0x527ac5(0x18a)](_0x527ac5(0x186)+_0x270d7a+_0x527ac5(0x157));continue;}assertDatasetIsDbTableBacked(_0x3d26a3,'SQL\x20schema\x20validation');const _0x224d1f=Array[_0x527ac5(0x177)](_0x3d26a3[_0x527ac5(0x161)])?_0x3d26a3['fields']:[],_0x3d563d=new Set(_0x224d1f['map'](_0x393d2d=>_0x393d2d[_0x527ac5(0x174)]?.[_0x527ac5(0x17b)]())),_0xdb9d44=_0x3d26a3['dbtableConfig']?.[_0x527ac5(0x153)]||_0x3d26a3['tableName']||_0x270d7a;_0x1c441a['schema:'+_0xdb9d44]={'code':_0x270d7a,'tableName':_0xdb9d44,'fieldCount':_0x3d563d[_0x527ac5(0x188)],'fields':Array[_0x527ac5(0x182)](_0x3d563d)};if(_0x298ff5){const _0x583584=normalizeDatasetIndexes(_0x3d26a3);_0x585f47[_0x527ac5(0x18a)]({'tableName':_0xdb9d44,..._0x583584});}}_0x276249[_0x527ac5(0x160)]>0x0&&(_0x1c441a['schemaWarnings']=_0x276249),_0x298ff5&&(_0x1c441a['joinAudit']=auditSqlJoinIndexes(_0x4f0091,_0x585f47));}return{'ok':_0x52531f['valid'],'data':_0x1c441a,'message':_0x52531f[_0x527ac5(0x185)]};}};function normalizeDatasetIndexes(_0x1a2c7c){const _0x2af711=a193_0x1f8229,_0x4e3d5c=Array[_0x2af711(0x177)](_0x1a2c7c?.['dataset']?.['indexes'])?_0x1a2c7c[_0x2af711(0x158)][_0x2af711(0x156)]:Array[_0x2af711(0x177)](_0x1a2c7c?.[_0x2af711(0x156)])?_0x1a2c7c['indexes']:[],_0x1ded78=_0x4e3d5c[_0x2af711(0x15f)](_0x36ac30=>{const _0xd04a26=_0x2af711,_0x5d9fd1=Array[_0xd04a26(0x177)](_0x36ac30?.[_0xd04a26(0x14e)])?_0x36ac30[_0xd04a26(0x14e)]:Array[_0xd04a26(0x177)](_0x36ac30?.[_0xd04a26(0x173)])?_0x36ac30[_0xd04a26(0x173)]:Array[_0xd04a26(0x177)](_0x36ac30?.['columns'])?_0x36ac30[_0xd04a26(0x164)]:[],_0x500f1e=_0x5d9fd1[_0xd04a26(0x15d)](_0x2490d3=>typeof _0x2490d3===_0xd04a26(0x181))[_0xd04a26(0x175)](_0x4d2e03=>_0x4d2e03[_0xd04a26(0x14b)]())[_0xd04a26(0x15d)](Boolean);if(_0x500f1e[_0xd04a26(0x160)]===0x0)return[];const _0x20b303=[_0x36ac30?.[_0xd04a26(0x180)],_0x36ac30?.[_0xd04a26(0x15e)],_0x36ac30?.[_0xd04a26(0x174)]][_0xd04a26(0x18d)](_0x7652da=>typeof _0x7652da===_0xd04a26(0x181)&&_0x7652da[_0xd04a26(0x14b)]()),_0xd29e2e=[_0x36ac30?.[_0xd04a26(0x169)],_0x36ac30?.[_0xd04a26(0x176)]]['find'](_0x307f08=>typeof _0x307f08===_0xd04a26(0x181)&&_0x307f08['trim']());return[{..._0x20b303?{'name':_0x20b303[_0xd04a26(0x14b)]()}:{},..._0xd29e2e?{'type':_0xd29e2e['trim']()}:{},'columns':_0x500f1e}];}),_0x4ee62d=[..._0x1ded78],_0x227d24=typeof _0x1a2c7c?.[_0x2af711(0x152)]?.[_0x2af711(0x165)]===_0x2af711(0x181)?_0x1a2c7c[_0x2af711(0x152)][_0x2af711(0x165)][_0x2af711(0x168)](',')['map'](_0xee1546=>_0xee1546[_0x2af711(0x14b)]())[_0x2af711(0x15d)](Boolean):[];return _0x227d24[_0x2af711(0x160)]>0x0&&_0x4ee62d[_0x2af711(0x18b)]({'type':_0x2af711(0x159),'columns':_0x227d24}),{'indexes':_0x4ee62d,'metadataAvailable':_0x1ded78['length']>0x0};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x26d2c7,_0x3295b1){const _0xa64ebe=a194_0x5d13,_0x60dc99=_0x26d2c7();while(!![]){try{const _0x2ee3aa=-parseInt(_0xa64ebe(0x170))/0x1+parseInt(_0xa64ebe(0x171))/0x2+-parseInt(_0xa64ebe(0x176))/0x3+-parseInt(_0xa64ebe(0x173))/0x4+parseInt(_0xa64ebe(0x16e))/0x5*(parseInt(_0xa64ebe(0x174))/0x6)+parseInt(_0xa64ebe(0x172))/0x7+-parseInt(_0xa64ebe(0x16f))/0x8*(-parseInt(_0xa64ebe(0x175))/0x9);if(_0x2ee3aa===_0x3295b1)break;else _0x60dc99['push'](_0x60dc99['shift']());}catch(_0xcbbb84){_0x60dc99['push'](_0x60dc99['shift']());}}}(a194_0x1d08,0x7d60e));function a194_0x5d13(_0x4576ea,_0x5021c6){_0x4576ea=_0x4576ea-0x16e;const _0x1d0884=a194_0x1d08();let _0x5d1386=_0x1d0884[_0x4576ea];return _0x5d1386;}import{taskStatus}from'../../commands/task/status.js';export const taskDefinitions=[taskStatus];function a194_0x1d08(){const _0x17cbe1=['956335TyOEom','763900PsfvRR','5800921qipRXo','3608704YSRaBc','6UEhfUV','9HmatNT','2955723FLGohh','4253555lGZIzn','10367504lJVicv'];a194_0x1d08=function(){return _0x17cbe1;};return a194_0x1d08();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a195_0x4d293a=a195_0x5070;(function(_0x5de371,_0x2a17cb){const _0x1bbc21=a195_0x5070,_0xa77b18=_0x5de371();while(!![]){try{const _0x100c53=-parseInt(_0x1bbc21(0xf5))/0x1+parseInt(_0x1bbc21(0xe4))/0x2*(-parseInt(_0x1bbc21(0xf9))/0x3)+parseInt(_0x1bbc21(0xe7))/0x4+parseInt(_0x1bbc21(0xed))/0x5*(-parseInt(_0x1bbc21(0xf8))/0x6)+parseInt(_0x1bbc21(0xee))/0x7*(-parseInt(_0x1bbc21(0xf6))/0x8)+-parseInt(_0x1bbc21(0xf0))/0x9*(parseInt(_0x1bbc21(0xf1))/0xa)+parseInt(_0x1bbc21(0xe6))/0xb;if(_0x100c53===_0x2a17cb)break;else _0xa77b18['push'](_0xa77b18['shift']());}catch(_0x326ced){_0xa77b18['push'](_0xa77b18['shift']());}}}(a195_0x7d9d,0xca86d));import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asyncTaskMessage,buildAsyncTaskStatusCommand,normalizeAsyncTask}from'../../commands/common/async-task.js';function a195_0x5070(_0x53147c,_0x147633){_0x53147c=_0x53147c-0xe4;const _0x7d9d7f=a195_0x7d9d();let _0x5070cc=_0x7d9d7f[_0x53147c];return _0x5070cc;}import{getAsyncTaskStatus}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';export const taskStatus={'service':a195_0x4d293a(0xea),'command':a195_0x4d293a(0xef),'description':a195_0x4d293a(0xf2),'risk':a195_0x4d293a(0xec),'defaultOutputFormat':a195_0x4d293a(0xf7),'structuredErrors':!![],'flags':[{'name':a195_0x4d293a(0xfa),'type':a195_0x4d293a(0xe8),'required':!![],'description':'Task\x20id\x20returned\x20by\x20an\x20asynchronous\x20platform\x20command'},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x506b37){const _0x15b503=a195_0x4d293a;if(!_0x506b37[_0x15b503(0xf3)](_0x15b503(0xfa))[_0x15b503(0xe9)]())throw CliErrors['flagMissing'](_0x15b503(0xfa));},async 'execute'(_0x3adad4){const _0x8f104e=a195_0x4d293a,_0x5e23d9=_0x3adad4['str'](_0x8f104e(0xfa))[_0x8f104e(0xe9)](),_0x2143d3=normalizeAsyncTask(await getAsyncTaskStatus(_0x5e23d9,_0x3adad4['appCode'],_0x3adad4['cookie']));if(_0x2143d3['taskId']!==_0x5e23d9)throw CliErrors[_0x8f104e(0xf4)]('Task\x20status\x20response\x20id\x20mismatch:\x20requested\x20'+_0x5e23d9+',\x20received\x20'+_0x2143d3[_0x8f104e(0xe5)]+'.');const _0x31ac4f=buildAsyncTaskStatusCommand(_0x2143d3[_0x8f104e(0xe5)],_0x3adad4[_0x8f104e(0xeb)]);return{'ok':!![],'message':asyncTaskMessage(_0x2143d3),'data':{'appCode':_0x3adad4[_0x8f104e(0xeb)],..._0x2143d3,'query':_0x2143d3['isTerminal']?null:{'command':_0x31ac4f}}};}};function a195_0x7d9d(){const _0x28d2ec=['status','6131331kYjLxl','10wSxEDO','Query\x20an\x20asynchronous\x20task;\x20repeat\x20for\x20PENDING\x20or\x20PROCESSING\x20until\x20SUCCESS\x20or\x20FAILED','str','apiError','1436292BQbnyj','506936camDWZ','compress','1409262dYmnLL','109689JpEVPI','task-id','34KXyaxb','taskId','36250621jiMwVz','2539084TJAHcb','string','trim','task','appCode','read','5DlRzJD','14OCieeN'];a195_0x7d9d=function(){return _0x28d2ec;};return a195_0x7d9d();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a196_0x5588(_0xf79802,_0x834031){_0xf79802=_0xf79802-0xc5;const _0x5e9302=a196_0x5e93();let _0x558821=_0x5e9302[_0xf79802];return _0x558821;}(function(_0x1e93e5,_0x144faa){const _0x42f459=a196_0x5588,_0x2001d4=_0x1e93e5();while(!![]){try{const _0xa4cdf8=parseInt(_0x42f459(0xd0))/0x1+parseInt(_0x42f459(0xc9))/0x2+parseInt(_0x42f459(0xc7))/0x3*(parseInt(_0x42f459(0xc8))/0x4)+parseInt(_0x42f459(0xce))/0x5*(-parseInt(_0x42f459(0xc5))/0x6)+parseInt(_0x42f459(0xcf))/0x7*(-parseInt(_0x42f459(0xcb))/0x8)+parseInt(_0x42f459(0xcd))/0x9*(parseInt(_0x42f459(0xca))/0xa)+parseInt(_0x42f459(0xc6))/0xb*(-parseInt(_0x42f459(0xcc))/0xc);if(_0xa4cdf8===_0x144faa)break;else _0x2001d4['push'](_0x2001d4['shift']());}catch(_0x18611e){_0x2001d4['push'](_0x2001d4['shift']());}}}(a196_0x5e93,0x789a3));function a196_0x5e93(){const _0x1aec64=['115512wlJkLm','373848uXluUX','5949333KcewHm','302465LaKxVy','35tcQWYi','861599OTvlbe','18SrytBN','517ulYlzu','3kySAto','1696956zKIPzu','530048EmDtGM','10uVKYlx'];a196_0x5e93=function(){return _0x1aec64;};return a196_0x5e93();}import{tenantMembersListDefinition}from'../../commands/tenant/members-list.js';export const tenantDefinitions=[tenantMembersListDefinition];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a197_0x4105(_0x515a7a,_0x4ec032){_0x515a7a=_0x515a7a-0xf9;const _0x21b955=a197_0x21b9();let _0x410585=_0x21b955[_0x515a7a];return _0x410585;}const a197_0x4cd2ae=a197_0x4105;(function(_0x56f4af,_0x367cdd){const _0x18751b=a197_0x4105,_0x30e96a=_0x56f4af();while(!![]){try{const _0x4cf0e4=parseInt(_0x18751b(0xff))/0x1+-parseInt(_0x18751b(0xfd))/0x2+-parseInt(_0x18751b(0x108))/0x3+parseInt(_0x18751b(0x106))/0x4+-parseInt(_0x18751b(0xf9))/0x5+parseInt(_0x18751b(0x100))/0x6*(-parseInt(_0x18751b(0x109))/0x7)+-parseInt(_0x18751b(0xfc))/0x8*(-parseInt(_0x18751b(0x105))/0x9);if(_0x4cf0e4===_0x367cdd)break;else _0x30e96a['push'](_0x30e96a['shift']());}catch(_0x555fb0){_0x30e96a['push'](_0x30e96a['shift']());}}}(a197_0x21b9,0x9056a));import{listCurrentUserTenantMemberships,listTenantDirectoryMembers}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{assertTenantAccessible,projectTenantMembers}from'../../commands/tenant/shared.js';function a197_0x21b9(){const _0x1c5bd1=['tenant','List\x20members\x20of\x20a\x20tenant\x20available\x20to\x20the\x20current\x20account','Found\x20','4942455PPcrft','members-list','string','572776IiETlp','1170756BNNSev','Exact\x20tenant\x20code','995814PTwqiK','22320AFTPqU','Pass\x20--tenant-code\x20<code>.','tenant-code','trim','length','99vTOlLk','2168460OHFLdM','flagMissing','112971fklKHY','231dZIsvu','str','\x20tenant\x20member(s)'];a197_0x21b9=function(){return _0x1c5bd1;};return a197_0x21b9();}export const tenantMembersListDefinition={'service':a197_0x4cd2ae(0x10c),'command':a197_0x4cd2ae(0xfa),'description':a197_0x4cd2ae(0x10d),'risk':'read','requiresAuth':!![],'requiresAppCode':![],'structuredErrors':!![],'flags':[{'name':a197_0x4cd2ae(0x102),'type':a197_0x4cd2ae(0xfb),'required':!![],'description':a197_0x4cd2ae(0xfe)}],async 'validate'(_0x2e1643){const _0x5aabf6=a197_0x4cd2ae;if(!_0x2e1643[_0x5aabf6(0x10a)]('tenant-code')[_0x5aabf6(0x103)]())throw CliErrors[_0x5aabf6(0x107)](_0x5aabf6(0x102),_0x5aabf6(0x101));},async 'execute'(_0x9bafdb){const _0x5aaf41=a197_0x4cd2ae,_0x4bf985=_0x9bafdb[_0x5aaf41(0x10a)](_0x5aaf41(0x102))[_0x5aaf41(0x103)](),_0x15ad8d=await listCurrentUserTenantMemberships();assertTenantAccessible(_0x4bf985,_0x15ad8d);const _0x1949ff=projectTenantMembers(await listTenantDirectoryMembers(_0x4bf985));return{'ok':!![],'data':{'tenantCode':_0x4bf985,'items':_0x1949ff,'totalCount':_0x1949ff[_0x5aaf41(0x104)]},'message':_0x5aaf41(0x10e)+_0x1949ff['length']+_0x5aaf41(0x10b)};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x1f1fea,_0x5d94f7){const _0x315183=a198_0x6835,_0x2ca78a=_0x1f1fea();while(!![]){try{const _0x1273aa=parseInt(_0x315183(0x1d4))/0x1*(parseInt(_0x315183(0x1d1))/0x2)+parseInt(_0x315183(0x1c4))/0x3*(-parseInt(_0x315183(0x1de))/0x4)+-parseInt(_0x315183(0x1d9))/0x5*(parseInt(_0x315183(0x1cf))/0x6)+-parseInt(_0x315183(0x1c9))/0x7+-parseInt(_0x315183(0x1c6))/0x8*(-parseInt(_0x315183(0x1cc))/0x9)+-parseInt(_0x315183(0x1d3))/0xa*(-parseInt(_0x315183(0x1d0))/0xb)+parseInt(_0x315183(0x1d2))/0xc;if(_0x1273aa===_0x5d94f7)break;else _0x2ca78a['push'](_0x2ca78a['shift']());}catch(_0x2971dc){_0x2ca78a['push'](_0x2ca78a['shift']());}}}(a198_0x177a,0x32ed1));function a198_0x177a(){const _0x13acfe=['status','trim','18vyJAFW','nickname','17648wEgpQU','MEMBER','set','1343482zNJVtg','values','\x22\x20is\x20not\x20available\x20to\x20the\x20current\x20account.','387dzfwjQ','Tenant\x20\x22','some','3390HvuBSz','249689iNWSOO','8aTmdAz','2843004GFHhsy','90LchNHn','10164LTxpBy','displayName','username','userId','Check\x20--tenant-code\x20or\x20login\x20with\x20an\x20account\x20that\x20belongs\x20to\x20this\x20tenant.','1505iPAvUu','tenantCode','ADMIN','role','sort','4092YofLlJ'];a198_0x177a=function(){return _0x13acfe;};return a198_0x177a();}import{CliErrors}from'../../errors.js';function a198_0x6835(_0x171f67,_0x3e397d){_0x171f67=_0x171f67-0x1c3;const _0x177ae7=a198_0x177a();let _0x6835e0=_0x177ae7[_0x171f67];return _0x6835e0;}function textOrNull(_0x37a43b){const _0x35a57f=a198_0x6835,_0x563605=_0x37a43b?.[_0x35a57f(0x1c3)]();return _0x563605?_0x563605:null;}export function projectTenantMembers(_0xf8ff90){const _0x3cfaad=a198_0x6835,_0x36c377=new Map();for(const _0x450c73 of _0xf8ff90){const _0x209a79=Number(_0x450c73[_0x3cfaad(0x1d7)]);if(!Number['isFinite'](_0x209a79)||_0x209a79<=0x0)continue;const _0x2cc501={'userId':_0x209a79,'username':textOrNull(_0x450c73[_0x3cfaad(0x1d6)]),'displayName':textOrNull(_0x450c73[_0x3cfaad(0x1c5)]),'role':_0x450c73['adminFlag']===!![]?_0x3cfaad(0x1db):_0x3cfaad(0x1c7),'status':textOrNull(_0x450c73[_0x3cfaad(0x1df)])},_0x35dcb9=_0x36c377['get'](_0x209a79);if(!_0x35dcb9){_0x36c377[_0x3cfaad(0x1c8)](_0x209a79,_0x2cc501);continue;}_0x35dcb9[_0x3cfaad(0x1d6)]??=_0x2cc501[_0x3cfaad(0x1d6)],_0x35dcb9[_0x3cfaad(0x1d5)]??=_0x2cc501[_0x3cfaad(0x1d5)],_0x35dcb9[_0x3cfaad(0x1df)]??=_0x2cc501[_0x3cfaad(0x1df)];if(_0x2cc501[_0x3cfaad(0x1dc)]==='ADMIN')_0x35dcb9[_0x3cfaad(0x1dc)]=_0x3cfaad(0x1db);}return[..._0x36c377[_0x3cfaad(0x1ca)]()][_0x3cfaad(0x1dd)]((_0x441b27,_0x3336ac)=>_0x441b27[_0x3cfaad(0x1d7)]-_0x3336ac['userId']);}export function assertTenantAccessible(_0x12dcd7,_0x279541){const _0x1b2abd=a198_0x6835;if(_0x279541[_0x1b2abd(0x1ce)](_0x4ed400=>_0x4ed400[_0x1b2abd(0x1da)]===_0x12dcd7))return;throw CliErrors['validation'](_0x1b2abd(0x1cd)+_0x12dcd7+_0x1b2abd(0x1cb),_0x1b2abd(0x1d8));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a199_0x5199(){const _0x1a7011=['8GoDEwG','The\x20current\x20binding\x20is\x20not\x20exposed\x20by\x20the\x20server;\x20before\x20is\x20unavailable.','POST','Retry\x20with\x20the\x20same\x20--ding-talk-user-id\x20only\x20after\x20checking\x20the\x20current\x20platform\x20session.','user-account','Bind\x20the\x20current\x20platform\x20user\x20to\x20a\x20DingTalk\x20sandbox\x20account','657500qHscye','string','6157338fDRUXC','1386347QhWsCt','bind','124aStvzV','Bound\x20current\x20user\x20to\x20DingTalk\x20sandbox\x20account.','--ding-talk-user-id\x20cannot\x20be\x20empty.','DingTalk\x20sandbox\x20account\x20binding\x20was\x20not\x20confirmed.','DingTalk\x20user\x20id\x20returned\x20by\x20the\x20sandbox','5055218Puvdft','trim','ding-talk-user-id','58860LdGLdO','high-risk-write','27830511braOWM','344856iZGlhD','dingding-sandbox-bind'];a199_0x5199=function(){return _0x1a7011;};return a199_0x5199();}const a199_0x3db5a6=a199_0x3b15;(function(_0x31e53f,_0x143877){const _0x1657b3=a199_0x3b15,_0x4566c2=_0x31e53f();while(!![]){try{const _0x180136=-parseInt(_0x1657b3(0x164))/0x1+parseInt(_0x1657b3(0x159))/0x2+-parseInt(_0x1657b3(0x156))/0x3*(parseInt(_0x1657b3(0x166))/0x4)+-parseInt(_0x1657b3(0x161))/0x5+-parseInt(_0x1657b3(0x163))/0x6+parseInt(_0x1657b3(0x153))/0x7+parseInt(_0x1657b3(0x15b))/0x8*(parseInt(_0x1657b3(0x158))/0x9);if(_0x180136===_0x143877)break;else _0x4566c2['push'](_0x4566c2['shift']());}catch(_0xe12445){_0x4566c2['push'](_0x4566c2['shift']());}}}(a199_0x5199,0xcbc1f));function a199_0x3b15(_0x3ce261,_0x1eea23){_0x3ce261=_0x3ce261-0x152;const _0x519915=a199_0x5199();let _0x3b15ca=_0x519915[_0x3ce261];return _0x3b15ca;}import{asDryRunResult}from'../../commands/common/dry-run.js';import{bindDingTalkSandboxAccount,DING_TALK_SANDBOX_BIND_PATH}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';const PROVIDER_ID='dingding-sandbox',CURRENT_BINDING_WARNING=a199_0x3db5a6(0x15c);function readDingTalkUserId(_0x50b514){const _0x561a31=a199_0x3db5a6,_0x41560b=_0x50b514['str'](_0x561a31(0x155))[_0x561a31(0x154)]();if(!_0x41560b)throw CliErrors['validation'](_0x561a31(0x168),'Pass\x20the\x20DingTalk\x20user\x20id\x20returned\x20by\x20the\x20sandbox.');return _0x41560b;}function buildBindingData(_0x509e80,_0x5f4c17){const _0x5697d0=a199_0x3db5a6;return{'operation':_0x5697d0(0x165),'selector':{'providerId':PROVIDER_ID,'dingTalkUserId':_0x509e80},'before':null,'after':{'providerId':PROVIDER_ID,'dingTalkUserId':_0x509e80,'bound':!![]},'dryRun':_0x5f4c17,'backend':{'method':'POST','path':DING_TALK_SANDBOX_BIND_PATH},'warnings':[CURRENT_BINDING_WARNING]};}export const dingTalkSandboxBind={'service':a199_0x3db5a6(0x15f),'command':a199_0x3db5a6(0x15a),'description':a199_0x3db5a6(0x160),'risk':a199_0x3db5a6(0x157),'requiresAuth':!![],'requiresAppCode':![],'structuredErrors':!![],'flags':[{'name':'ding-talk-user-id','type':a199_0x3db5a6(0x162),'required':!![],'description':a199_0x3db5a6(0x152)}],async 'validate'(_0x21523c){readDingTalkUserId(_0x21523c);},async 'dryRun'(_0x543e97){const _0x1121f4=a199_0x3db5a6,_0x27207b=readDingTalkUserId(_0x543e97);return asDryRunResult(buildBindingData(_0x27207b,!![]),{'method':_0x1121f4(0x15d),'url':DING_TALK_SANDBOX_BIND_PATH});},async 'execute'(_0x5cc058){const _0xa3d2be=a199_0x3db5a6,_0x5db83e=readDingTalkUserId(_0x5cc058),_0x1d5193=await bindDingTalkSandboxAccount(_0x5db83e);if(_0x1d5193!==!![])throw CliErrors['apiError'](_0xa3d2be(0x169),_0xa3d2be(0x15e));return{'ok':!![],'data':buildBindingData(_0x5db83e,![]),'message':_0xa3d2be(0x167)};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a200_0x149d(_0x4cdb98,_0xd16fe8){_0x4cdb98=_0x4cdb98-0x94;const _0x43b9e7=a200_0x43b9();let _0x149d5a=_0x43b9e7[_0x4cdb98];return _0x149d5a;}(function(_0x351be8,_0x4fedd1){const _0xc3b0f9=a200_0x149d,_0x5a1181=_0x351be8();while(!![]){try{const _0x11c533=parseInt(_0xc3b0f9(0x9b))/0x1*(parseInt(_0xc3b0f9(0x96))/0x2)+-parseInt(_0xc3b0f9(0x95))/0x3+parseInt(_0xc3b0f9(0x98))/0x4+parseInt(_0xc3b0f9(0x97))/0x5+parseInt(_0xc3b0f9(0x99))/0x6+parseInt(_0xc3b0f9(0x9a))/0x7+-parseInt(_0xc3b0f9(0x94))/0x8;if(_0x11c533===_0x4fedd1)break;else _0x5a1181['push'](_0x5a1181['shift']());}catch(_0x583d72){_0x5a1181['push'](_0x5a1181['shift']());}}}(a200_0x43b9,0xf124e));function a200_0x43b9(){const _0x5cc3d4=['3613416dSSPrg','1120342Bkpprh','915740WtbpvZ','6779056EPphEG','9264858pVtyhE','13079864PfSHfv','1MHvFXm','29268640dKIGER'];a200_0x43b9=function(){return _0x5cc3d4;};return a200_0x43b9();}import{dingTalkSandboxBind}from'../../commands/user-account/dingding-sandbox-bind.js';export const userAccountDefinitions=[dingTalkSandboxBind];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a201_0x4c6b(){const _0x1f6fb2=['name','Register\x20an\x20app\x20profile\x20in\x20the\x20current\x20workspace\x20(or\x20--global)','1132JSBBQG','11114684HiGgfI','add','5955UFGNtb','6123500ZLJLKZ','App\x20profile\x20name','write','65zRUoZs','277710ZYpoeG','11702700hlQZnJ','1775309QpxQYx','2904003MBFTmE','24epEmoY','workspace\x20add','workspace'];a201_0x4c6b=function(){return _0x1f6fb2;};return a201_0x4c6b();}const a201_0x25ae71=a201_0x87bd;(function(_0x3e487b,_0x39e1ee){const _0x4230d0=a201_0x87bd,_0x3164d4=_0x3e487b();while(!![]){try{const _0x37c825=-parseInt(_0x4230d0(0x1fe))/0x1+parseInt(_0x4230d0(0x1f4))/0x2*(parseInt(_0x4230d0(0x1f7))/0x3)+-parseInt(_0x4230d0(0x1f8))/0x4+parseInt(_0x4230d0(0x1fb))/0x5*(-parseInt(_0x4230d0(0x1fc))/0x6)+parseInt(_0x4230d0(0x1f5))/0x7+parseInt(_0x4230d0(0x1ef))/0x8*(parseInt(_0x4230d0(0x1ee))/0x9)+parseInt(_0x4230d0(0x1fd))/0xa;if(_0x37c825===_0x39e1ee)break;else _0x3164d4['push'](_0x3164d4['shift']());}catch(_0x4b7a0b){_0x3164d4['push'](_0x3164d4['shift']());}}}(a201_0x4c6b,0xe5e88));import{buildAppAddFlags,runAppAdd,validateAppName}from'../../commands/common/app-registry.js';function a201_0x87bd(_0x3f6563,_0x2599b4){_0x3f6563=_0x3f6563-0x1ee;const _0x4c6bce=a201_0x4c6b();let _0x87bd22=_0x4c6bce[_0x3f6563];return _0x87bd22;}export const workspaceAddDefinition={'service':a201_0x25ae71(0x1f1),'command':a201_0x25ae71(0x1f6),'description':a201_0x25ae71(0x1f3),'risk':a201_0x25ae71(0x1fa),'requiresAuth':![],'requiresAppCode':![],'args':[{'name':a201_0x25ae71(0x1f2),'description':a201_0x25ae71(0x1f9),'required':!![]}],'flags':buildAppAddFlags(),'validate':_0x51a381=>validateAppName(_0x51a381,a201_0x25ae71(0x1f0)),'execute':_0x1c769c=>runAppAdd(_0x1c769c,a201_0x25ae71(0x1f0))};
|