@lovrabet/rabetbase-cli 2.4.2 → 2.4.3
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 +8 -4
- package/skills/rabetbase/SKILL.md +1 -1
- package/skills/rabetbase/guides/react-custom-page-workflow.md +9 -3
- package/skills/rabetbase/knowledge/react-page/generation-standards.md +13 -2
- package/skills/rabetbase.manifest.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
const a183_0x5858a8=a183_0xf945;(function(_0x466a1f,_0x34272a){const _0x243de1=a183_0xf945,_0x4c3aa6=_0x466a1f();while(!![]){try{const _0x247e5e=parseInt(_0x243de1(0x17f))/0x1*(parseInt(_0x243de1(0x15e))/0x2)+parseInt(_0x243de1(0x17b))/0x3*(-parseInt(_0x243de1(0x15a))/0x4)+-parseInt(_0x243de1(0x16e))/0x5*(-parseInt(_0x243de1(0x167))/0x6)+parseInt(_0x243de1(0x181))/0x7+-parseInt(_0x243de1(0x194))/0x8+parseInt(_0x243de1(0x170))/0x9*(parseInt(_0x243de1(0x19d))/0xa)+-parseInt(_0x243de1(0x197))/0xb*(parseInt(_0x243de1(0x189))/0xc);if(_0x247e5e===_0x34272a)break;else _0x4c3aa6['push'](_0x4c3aa6['shift']());}catch(_0xea3715){_0x4c3aa6['push'](_0x4c3aa6['shift']());}}}(a183_0x1bf3,0x6d150));function a183_0xf945(_0x312dd0,_0x4856a7){_0x312dd0=_0x312dd0-0x15a;const _0x1bf3b9=a183_0x1bf3();let _0xf94588=_0x1bf3b9[_0x312dd0];return _0xf94588;}import{writeFile}from'node:fs/promises';import{input,select}from'@inquirer/prompts';import{createSqlQuery}from'../../core/api-client.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{buildSqlRelativePath}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function generateSqlTemplate(_0x40148a){const _0x2d1e79=a183_0xf945;if(_0x40148a===_0x2d1e79(0x19b))return[_0x2d1e79(0x15b),_0x2d1e79(0x187),_0x2d1e79(0x168),''][_0x2d1e79(0x177)]('\x0a');return[_0x2d1e79(0x15c),''][_0x2d1e79(0x177)]('\x0a');}function a183_0x1bf3(){const _0x22959c=['string','sqlName','db-id','dbId','appCode','trim','flag','str','File\x20already\x20exists:\x20','4283760mGlaTv','mode','nonInteractive','242BOBGdr','map','lockFilePath','sqlCode','mybatisXml','请选择目标数据库:','110EItSZE','SQL\x20query\x20display\x20name','<server-generated-sqlCode>','/smartapi/custom/saveUserCustomSql','sqls','new','168voSHkt','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','SELECT\x201\x20AS\x20id;','lastSync','26LUccOd','dbId\x20必须为正整数','isInteger','toISOString','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','validation','length','Invalid\x20database\x20selection\x20payload:\x20','21570xmLksC','</select>','适合直接执行的普通\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20语句','description','适合带动态标签的\x20MyBatis\x20XML\x20SQL','isFinite','stringify','915mNlCvW','create','449892fYubga','请输入\x20SQL\x20名称:','普通\x20SQL(sql)','sqlRoot','flagMissing','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','✎\x20手动输入\x20dbId','join','请输入目标数据库\x20dbId:','dbName','POST','35571EOkQUE','sql','dbId\x20不能为空','sqlRootDir','44045FZrivY','Created\x20SQL\x20query\x20','3954300uieYJu','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','number','parse','name','catch','\x20\x20SELECT\x201\x20AS\x20id','__manual__','471804AIxeDK','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally'];a183_0x1bf3=function(){return _0x22959c;};return a183_0x1bf3();}export const sqlCreate={'service':'sql','command':a183_0x5858a8(0x16f),'description':a183_0x5858a8(0x18a),'risk':'write','flags':[{'name':a183_0x5858a8(0x185),'type':a183_0x5858a8(0x18b),'description':a183_0x5858a8(0x19e)},{'name':a183_0x5858a8(0x18d),'type':a183_0x5858a8(0x183),'description':'Target\x20database\x20ID'},{'name':a183_0x5858a8(0x195),'type':a183_0x5858a8(0x18b),'enum':[a183_0x5858a8(0x17c),a183_0x5858a8(0x19b)],'description':'Local\x20SQL\x20file\x20mode'}],async 'validate'(_0x1c3f09){const _0x364acd=a183_0x5858a8;if(!_0x1c3f09[_0x364acd(0x196)])return;if(!_0x1c3f09[_0x364acd(0x192)](_0x364acd(0x185))[_0x364acd(0x190)]())throw CliErrors[_0x364acd(0x174)](_0x364acd(0x185),_0x364acd(0x175));const _0x1979ff=resolveProvidedDbId(_0x1c3f09);if(typeof _0x1979ff!==_0x364acd(0x183)||!Number[_0x364acd(0x16c)](_0x1979ff)||_0x1979ff<=0x0)throw CliErrors['flagMissing'](_0x364acd(0x18d),'--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.');if(!_0x1c3f09['str'](_0x364acd(0x195))[_0x364acd(0x190)]())throw CliErrors['flagMissing'](_0x364acd(0x195),_0x364acd(0x163));},async 'dryRun'(_0x418b02){const _0x151112=a183_0x5858a8,_0x369ab1=loadSqlProjectConfig(_0x418b02[_0x151112(0x18f)]),{sqlName:_0x4b742c,dbId:_0x2afac9,dbName:_0x24c17c,mode:_0x104d05}=await resolveSqlNewInputs(_0x418b02),_0x5e80be=buildSqlRelativePath(_0x151112(0x19f),_0x4b742c,_0x24c17c,_0x104d05,_0x2afac9),_0x2514f9=_0x369ab1[_0x151112(0x17e)]+'/'+_0x5e80be;return{'method':_0x151112(0x17a),'url':_0x151112(0x1a0),'body':{'appCode':_0x418b02['appCode'],'sqlName':_0x4b742c,'dbId':_0x2afac9,'mode':_0x104d05,'localPath':_0x2514f9},'description':_0x151112(0x162)+_0x369ab1[_0x151112(0x17e)]};},async 'execute'(_0x27630a){const _0x5a3ab6=a183_0x5858a8,_0x1164f5=loadSqlProjectConfig(_0x27630a[_0x5a3ab6(0x18f)]),{sqlName:_0x175ba6,dbId:_0x513232,dbName:_0x4fc8b6,mode:_0x41cfbf}=await resolveSqlNewInputs(_0x27630a),_0x3fc8a5=generateSqlTemplate(_0x41cfbf),_0x2ab7b2=await createSqlQuery({'appCode':_0x27630a[_0x5a3ab6(0x18f)],'sqlName':_0x175ba6,'dbId':_0x513232,'sqlContent':_0x3fc8a5}),_0x490565=ensureRemoteSqlContent(_0x2ab7b2),_0x39d8fe=_0x4fc8b6||await getDbName(_0x27630a[_0x5a3ab6(0x18f)],_0x513232)[_0x5a3ab6(0x186)](()=>undefined),_0x2d70ba=buildSqlRelativePath(_0x2ab7b2[_0x5a3ab6(0x19a)],_0x2ab7b2[_0x5a3ab6(0x18c)],_0x39d8fe,_0x41cfbf,_0x513232),_0x282bcd=_0x1164f5[_0x5a3ab6(0x17e)]+'/'+_0x2d70ba,_0x2a0077=buildLocalSqlFileContent({'sqlCode':_0x2ab7b2['sqlCode'],'sqlName':_0x2ab7b2[_0x5a3ab6(0x18c)],'dbId':_0x2ab7b2[_0x5a3ab6(0x18e)]},_0x490565,{'dbName':_0x39d8fe,'mode':_0x41cfbf,'syncedAt':new Date()[_0x5a3ab6(0x161)](),'description':_0x2ab7b2[_0x5a3ab6(0x16a)]});if(await fileExists(_0x282bcd))throw CliErrors[_0x5a3ab6(0x164)](_0x5a3ab6(0x193)+_0x282bcd);await ensureParentDirectory(_0x282bcd),await writeFile(_0x282bcd,_0x2a0077,'utf8');const _0x4e7142=await readSqlLockFile(_0x1164f5[_0x5a3ab6(0x199)]),{lockData:_0x3bbed8,appLock:_0x5ac157}=ensureSqlLockScope(_0x4e7142??createEmptySqlLock(),_0x1164f5[_0x5a3ab6(0x18f)],_0x1164f5[_0x5a3ab6(0x173)],_0x5a3ab6(0x1a2));return _0x5ac157[_0x5a3ab6(0x1a1)][_0x2ab7b2[_0x5a3ab6(0x19a)]]={...buildSqlLockEntry(_0x2ab7b2,_0x490565,computeSqlContentHash(_0x2a0077),{'dbName':_0x39d8fe}),'path':_0x2d70ba,'mode':_0x41cfbf},_0x5ac157[_0x5a3ab6(0x15d)]=new Date()[_0x5a3ab6(0x161)](),await writeSqlLockFile(_0x1164f5['lockFilePath'],_0x3bbed8),{'ok':!![],'data':{'id':_0x2ab7b2['id'],'sqlCode':_0x2ab7b2[_0x5a3ab6(0x19a)],'sqlName':_0x2ab7b2[_0x5a3ab6(0x18c)],'dbId':_0x2ab7b2['dbId'],'path':_0x282bcd,'mode':_0x41cfbf},'message':_0x5a3ab6(0x180)+_0x2ab7b2[_0x5a3ab6(0x19a)]};}};async function resolveSqlNewInputs(_0x53a6c4){const _0x46bfa9=await resolveSqlNameInput(_0x53a6c4),{dbId:_0x2f8c6f,dbName:_0x4aa093}=await resolveDbSelection(_0x53a6c4),_0x233b98=await resolveSqlModeInput(_0x53a6c4);return{'sqlName':_0x46bfa9,'dbId':_0x2f8c6f,'dbName':_0x4aa093,'mode':_0x233b98};}async function resolveSqlNameInput(_0x46cbf8){const _0x305ce8=a183_0x5858a8,_0x4231ce=_0x46cbf8[_0x305ce8(0x192)](_0x305ce8(0x185))[_0x305ce8(0x190)]();if(_0x4231ce)return _0x4231ce;if(_0x46cbf8['nonInteractive'])throw CliErrors['flagMissing']('name',_0x305ce8(0x175));return(await input({'message':_0x305ce8(0x171),'validate':_0x3c5890=>_0x3c5890[_0x305ce8(0x190)]()?!![]:'SQL\x20名称不能为空'}))[_0x305ce8(0x190)]();}async function resolveDbSelection(_0x207435){const _0x300258=a183_0x5858a8,_0x4cebc2=resolveProvidedDbId(_0x207435);if(typeof _0x4cebc2===_0x300258(0x183)&&Number[_0x300258(0x16c)](_0x4cebc2)&&_0x4cebc2>0x0)return{'dbId':_0x4cebc2,'dbName':await getDbName(_0x207435[_0x300258(0x18f)],_0x4cebc2)[_0x300258(0x186)](()=>undefined)};if(_0x207435['nonInteractive'])throw CliErrors[_0x300258(0x174)](_0x300258(0x18d),_0x300258(0x182));const _0x4e036b=await listDatabases(_0x207435[_0x300258(0x18f)])['catch'](()=>[]);if(_0x4e036b[_0x300258(0x165)]===0x1)return{'dbId':_0x4e036b[0x0][_0x300258(0x18e)],'dbName':_0x4e036b[0x0][_0x300258(0x179)]};if(_0x4e036b['length']>0x1){const _0x510846=await select({'message':_0x300258(0x19c),'choices':[..._0x4e036b[_0x300258(0x198)](_0x57dab4=>({'name':_0x57dab4['dbName']+'\x20('+_0x57dab4['dbId']+')','value':serializeDbSelection(_0x57dab4)})),{'name':_0x300258(0x176),'value':'__manual__'}]});if(_0x510846!==_0x300258(0x188))return deserializeDbSelection(_0x510846);}const _0x37ffca=await input({'message':_0x300258(0x178),'validate':_0x242137=>{const _0x5b0e26=_0x300258,_0x58090b=_0x242137[_0x5b0e26(0x190)]();if(!_0x58090b)return _0x5b0e26(0x17d);const _0x2f6a55=Number(_0x58090b);if(!Number[_0x5b0e26(0x160)](_0x2f6a55)||_0x2f6a55<=0x0)return _0x5b0e26(0x15f);return!![];}});return{'dbId':Number(_0x37ffca['trim']())};}async function resolveSqlModeInput(_0x2436af){const _0x2f7580=a183_0x5858a8,_0x5c4413=_0x2436af['str'](_0x2f7580(0x195))[_0x2f7580(0x190)]();if(_0x5c4413===_0x2f7580(0x17c)||_0x5c4413===_0x2f7580(0x19b))return _0x5c4413;if(_0x2436af[_0x2f7580(0x196)])throw CliErrors[_0x2f7580(0x174)](_0x2f7580(0x195),_0x2f7580(0x163));return await select({'message':'请选择本地\x20SQL\x20模式:','choices':[{'name':_0x2f7580(0x172),'value':_0x2f7580(0x17c),'description':_0x2f7580(0x169)},{'name':'MyBatis\x20XML(mybatisXml)','value':'mybatisXml','description':_0x2f7580(0x16b)}]});}function serializeDbSelection(_0x286bd7){const _0xe69482=a183_0x5858a8;return JSON[_0xe69482(0x16d)]({'dbId':_0x286bd7[_0xe69482(0x18e)],'dbName':_0x286bd7[_0xe69482(0x179)]});}function deserializeDbSelection(_0x433106){const _0x27232f=a183_0x5858a8;try{const _0x5061f4=JSON[_0x27232f(0x184)](_0x433106);if(typeof _0x5061f4[_0x27232f(0x18e)]===_0x27232f(0x183)&&Number['isFinite'](_0x5061f4[_0x27232f(0x18e)]))return{'dbId':_0x5061f4[_0x27232f(0x18e)],'dbName':_0x5061f4['dbName']};}catch{}throw CliErrors[_0x27232f(0x164)](_0x27232f(0x166)+_0x433106);}function resolveProvidedDbId(_0x41005f){const _0x1f7f78=a183_0x5858a8,_0x58119b=_0x41005f[_0x1f7f78(0x191)](_0x1f7f78(0x18d));if(typeof _0x58119b===_0x1f7f78(0x183)&&Number['isFinite'](_0x58119b))return _0x58119b;return undefined;}
|
|
1
|
+
const a183_0x534c02=a183_0x1748;(function(_0x599a5b,_0x1a1755){const _0x2c67ee=a183_0x1748,_0x39224d=_0x599a5b();while(!![]){try{const _0x8737e6=parseInt(_0x2c67ee(0xc3))/0x1+-parseInt(_0x2c67ee(0xb5))/0x2+-parseInt(_0x2c67ee(0xc2))/0x3+-parseInt(_0x2c67ee(0x98))/0x4*(-parseInt(_0x2c67ee(0x99))/0x5)+parseInt(_0x2c67ee(0xbe))/0x6+-parseInt(_0x2c67ee(0xb1))/0x7*(parseInt(_0x2c67ee(0xc0))/0x8)+parseInt(_0x2c67ee(0xa2))/0x9;if(_0x8737e6===_0x1a1755)break;else _0x39224d['push'](_0x39224d['shift']());}catch(_0x441684){_0x39224d['push'](_0x39224d['shift']());}}}(a183_0x4453,0xb151a));import{writeFile}from'node:fs/promises';import{input,select}from'@inquirer/prompts';import{createSqlQuery}from'../../core/api-client.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';function a183_0x4453(){const _0x4333c1=['dbId','toISOString','3892752sJEpea','string','24iEpHei','Invalid\x20database\x20selection\x20payload:\x20','4356786xUbThG','64960sOZsuX','appCode','catch','trim','Created\x20SQL\x20query\x20','create','dbId\x20不能为空','适合直接执行的普通\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20语句','sqlCode','普通\x20SQL(sql)','validation','\x20\x20SELECT\x201\x20AS\x20id','__manual__','SELECT\x201\x20AS\x20id;','sqlRootDir','MyBatis\x20XML(mybatisXml)','flagMissing','stringify','mybatisXml','utf8','sqlRoot','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','join','请选择本地\x20SQL\x20模式:','nonInteractive','lastSync','376yrZeDg','17165sQiBsl','sqls','lockFilePath','POST','请输入目标数据库\x20dbId:','File\x20already\x20exists:\x20','sql','isFinite','Local\x20SQL\x20file\x20mode','27842094ygCxKp','map','/smartapi/custom/saveUserCustomSql','请输入\x20SQL\x20名称:','isInteger','length','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','sqlName','</select>','name','适合带动态标签的\x20MyBatis\x20XML\x20SQL','mode','parse','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','✎\x20手动输入\x20dbId','2000411NCXzAO','number','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','dbName','2188282quUbnY','db-id','dbId\x20必须为正整数','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','write','str','new'];a183_0x4453=function(){return _0x4333c1;};return a183_0x4453();}import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';function a183_0x1748(_0x44c3db,_0x292a28){_0x44c3db=_0x44c3db-0x8e;const _0x445308=a183_0x4453();let _0x1748ee=_0x445308[_0x44c3db];return _0x1748ee;}import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{buildSqlRelativePath}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function generateSqlTemplate(_0x2f83d5){const _0x3b6892=a183_0x1748;if(_0x2f83d5==='mybatisXml')return[_0x3b6892(0xb8),_0x3b6892(0xce),_0x3b6892(0xaa),''][_0x3b6892(0x94)]('\x0a');return[_0x3b6892(0xd0),''][_0x3b6892(0x94)]('\x0a');}export const sqlCreate={'service':'sql','command':a183_0x534c02(0xc8),'description':'Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','risk':a183_0x534c02(0xb9),'flags':[{'name':a183_0x534c02(0xab),'type':a183_0x534c02(0xbf),'description':'SQL\x20query\x20display\x20name'},{'name':a183_0x534c02(0xb6),'type':'number','description':'Target\x20database\x20ID'},{'name':a183_0x534c02(0xad),'type':a183_0x534c02(0xbf),'enum':[a183_0x534c02(0x9f),a183_0x534c02(0x90)],'description':a183_0x534c02(0xa1)}],async 'validate'(_0x58ae24){const _0x403afe=a183_0x534c02;if(!_0x58ae24['nonInteractive'])return;if(!_0x58ae24['str'](_0x403afe(0xab))['trim']())throw CliErrors['flagMissing']('name',_0x403afe(0xb3));const _0x1ab03d=resolveProvidedDbId(_0x58ae24);if(typeof _0x1ab03d!=='number'||!Number[_0x403afe(0xa0)](_0x1ab03d)||_0x1ab03d<=0x0)throw CliErrors[_0x403afe(0x8e)](_0x403afe(0xb6),_0x403afe(0xaf));if(!_0x58ae24[_0x403afe(0xba)]('mode')[_0x403afe(0xc6)]())throw CliErrors['flagMissing']('mode',_0x403afe(0xa8));},async 'dryRun'(_0x81ea5c){const _0x570bc9=a183_0x534c02,_0x114fd4=loadSqlProjectConfig(_0x81ea5c[_0x570bc9(0xc4)]),{sqlName:_0x3affbb,dbId:_0x28062e,dbName:_0x2212b8,mode:_0x740154}=await resolveSqlNewInputs(_0x81ea5c),_0x1255d9=buildSqlRelativePath('<server-generated-sqlCode>',_0x3affbb,_0x2212b8,_0x740154,_0x28062e),_0x3e41a2=_0x114fd4[_0x570bc9(0xd1)]+'/'+_0x1255d9;return{'method':_0x570bc9(0x9c),'url':_0x570bc9(0xa4),'body':{'appCode':_0x81ea5c[_0x570bc9(0xc4)],'sqlName':_0x3affbb,'dbId':_0x28062e,'mode':_0x740154,'localPath':_0x3e41a2},'description':_0x570bc9(0x93)+_0x114fd4['sqlRootDir']};},async 'execute'(_0x4c62e6){const _0x13e45f=a183_0x534c02,_0x3859e9=loadSqlProjectConfig(_0x4c62e6[_0x13e45f(0xc4)]),{sqlName:_0x180de9,dbId:_0xa96d5c,dbName:_0x5a7ef5,mode:_0x42df6f}=await resolveSqlNewInputs(_0x4c62e6),_0x4dd0b9=generateSqlTemplate(_0x42df6f),_0x56aec3=await createSqlQuery({'appCode':_0x4c62e6['appCode'],'sqlName':_0x180de9,'dbId':_0xa96d5c,'sqlContent':_0x4dd0b9}),_0x497a24=ensureRemoteSqlContent(_0x56aec3),_0x365451=_0x5a7ef5||await getDbName(_0x4c62e6['appCode'],_0xa96d5c)[_0x13e45f(0xc5)](()=>undefined),_0xf0cd90=buildSqlRelativePath(_0x56aec3['sqlCode'],_0x56aec3['sqlName'],_0x365451,_0x42df6f,_0xa96d5c),_0x274d90=_0x3859e9['sqlRootDir']+'/'+_0xf0cd90,_0x41300e=buildLocalSqlFileContent({'sqlCode':_0x56aec3[_0x13e45f(0xcb)],'sqlName':_0x56aec3['sqlName'],'dbId':_0x56aec3[_0x13e45f(0xbc)]},_0x497a24,{'dbName':_0x365451,'mode':_0x42df6f,'syncedAt':new Date()['toISOString'](),'description':_0x56aec3['description']});if(await fileExists(_0x274d90))throw CliErrors['validation'](_0x13e45f(0x9e)+_0x274d90);await ensureParentDirectory(_0x274d90),await writeFile(_0x274d90,_0x41300e,_0x13e45f(0x91));const _0x4131c2=await readSqlLockFile(_0x3859e9[_0x13e45f(0x9b)]),{lockData:_0x1cd5bf,appLock:_0x5e0399}=ensureSqlLockScope(_0x4131c2??createEmptySqlLock(),_0x3859e9[_0x13e45f(0xc4)],_0x3859e9[_0x13e45f(0x92)],_0x13e45f(0xbb));return _0x5e0399[_0x13e45f(0x9a)][_0x56aec3[_0x13e45f(0xcb)]]={...buildSqlLockEntry(_0x56aec3,_0x497a24,computeSqlContentHash(_0x41300e),{'dbName':_0x365451}),'path':_0xf0cd90,'mode':_0x42df6f},_0x5e0399[_0x13e45f(0x97)]=new Date()[_0x13e45f(0xbd)](),await writeSqlLockFile(_0x3859e9[_0x13e45f(0x9b)],_0x1cd5bf),{'ok':!![],'data':{'id':_0x56aec3['id'],'sqlCode':_0x56aec3[_0x13e45f(0xcb)],'sqlName':_0x56aec3[_0x13e45f(0xa9)],'dbId':_0x56aec3[_0x13e45f(0xbc)],'path':_0x274d90,'mode':_0x42df6f},'message':_0x13e45f(0xc7)+_0x56aec3[_0x13e45f(0xcb)]};}};async function resolveSqlNewInputs(_0x534451){const _0x5ca067=await resolveSqlNameInput(_0x534451),{dbId:_0x9b4cbd,dbName:_0x20b083}=await resolveDbSelection(_0x534451),_0x160ca9=await resolveSqlModeInput(_0x534451);return{'sqlName':_0x5ca067,'dbId':_0x9b4cbd,'dbName':_0x20b083,'mode':_0x160ca9};}async function resolveSqlNameInput(_0x4cc06b){const _0x87d4e3=a183_0x534c02,_0x1a2e2e=_0x4cc06b[_0x87d4e3(0xba)](_0x87d4e3(0xab))[_0x87d4e3(0xc6)]();if(_0x1a2e2e)return _0x1a2e2e;if(_0x4cc06b[_0x87d4e3(0x96)])throw CliErrors['flagMissing'](_0x87d4e3(0xab),_0x87d4e3(0xb3));return(await input({'message':_0x87d4e3(0xa5),'validate':_0x17e113=>_0x17e113['trim']()?!![]:'SQL\x20名称不能为空'}))['trim']();}async function resolveDbSelection(_0x3022eb){const _0x214af5=a183_0x534c02,_0x1127cc=resolveProvidedDbId(_0x3022eb);if(typeof _0x1127cc===_0x214af5(0xb2)&&Number[_0x214af5(0xa0)](_0x1127cc)&&_0x1127cc>0x0)return{'dbId':_0x1127cc,'dbName':await getDbName(_0x3022eb[_0x214af5(0xc4)],_0x1127cc)[_0x214af5(0xc5)](()=>undefined)};if(_0x3022eb[_0x214af5(0x96)])throw CliErrors['flagMissing'](_0x214af5(0xb6),'--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.');const _0x395801=await listDatabases(_0x3022eb[_0x214af5(0xc4)])[_0x214af5(0xc5)](()=>[]);if(_0x395801[_0x214af5(0xa7)]===0x1)return{'dbId':_0x395801[0x0][_0x214af5(0xbc)],'dbName':_0x395801[0x0][_0x214af5(0xb4)]};if(_0x395801[_0x214af5(0xa7)]>0x1){const _0x34989a=await select({'message':'请选择目标数据库:','choices':[..._0x395801[_0x214af5(0xa3)](_0x13b0d6=>({'name':_0x13b0d6[_0x214af5(0xb4)]+'\x20('+_0x13b0d6[_0x214af5(0xbc)]+')','value':serializeDbSelection(_0x13b0d6)})),{'name':_0x214af5(0xb0),'value':_0x214af5(0xcf)}]});if(_0x34989a!==_0x214af5(0xcf))return deserializeDbSelection(_0x34989a);}const _0x43c226=await input({'message':_0x214af5(0x9d),'validate':_0x257a08=>{const _0x1c69bb=_0x214af5,_0xa9a10=_0x257a08['trim']();if(!_0xa9a10)return _0x1c69bb(0xc9);const _0x2a3169=Number(_0xa9a10);if(!Number[_0x1c69bb(0xa6)](_0x2a3169)||_0x2a3169<=0x0)return _0x1c69bb(0xb7);return!![];}});return{'dbId':Number(_0x43c226[_0x214af5(0xc6)]())};}async function resolveSqlModeInput(_0x5a44ba){const _0x18a9a0=a183_0x534c02,_0x5dfaee=_0x5a44ba[_0x18a9a0(0xba)](_0x18a9a0(0xad))[_0x18a9a0(0xc6)]();if(_0x5dfaee==='sql'||_0x5dfaee===_0x18a9a0(0x90))return _0x5dfaee;if(_0x5a44ba[_0x18a9a0(0x96)])throw CliErrors[_0x18a9a0(0x8e)]('mode',_0x18a9a0(0xa8));return await select({'message':_0x18a9a0(0x95),'choices':[{'name':_0x18a9a0(0xcc),'value':_0x18a9a0(0x9f),'description':_0x18a9a0(0xca)},{'name':_0x18a9a0(0xd2),'value':_0x18a9a0(0x90),'description':_0x18a9a0(0xac)}]});}function serializeDbSelection(_0x12c73a){const _0x5c16df=a183_0x534c02;return JSON[_0x5c16df(0x8f)]({'dbId':_0x12c73a[_0x5c16df(0xbc)],'dbName':_0x12c73a[_0x5c16df(0xb4)]});}function deserializeDbSelection(_0x434567){const _0x2f06d0=a183_0x534c02;try{const _0x5a817f=JSON[_0x2f06d0(0xae)](_0x434567);if(typeof _0x5a817f[_0x2f06d0(0xbc)]===_0x2f06d0(0xb2)&&Number[_0x2f06d0(0xa0)](_0x5a817f[_0x2f06d0(0xbc)]))return{'dbId':_0x5a817f['dbId'],'dbName':_0x5a817f['dbName']};}catch{}throw CliErrors[_0x2f06d0(0xcd)](_0x2f06d0(0xc1)+_0x434567);}function resolveProvidedDbId(_0x35e718){const _0x2ce00f=a183_0x534c02,_0x23e080=_0x35e718['flag']('db-id');if(typeof _0x23e080===_0x2ce00f(0xb2)&&Number['isFinite'](_0x23e080))return _0x23e080;return undefined;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a184_0x339b(){const _0x49a994=['196440VMkiHg','33549399gFQxkv','sqlcode','Would\x20delete\x20SQL\x20','filter','replace','length','SQL\x20lock\x20file\x20not\x20found.','validation','toISOString','startsWith','appCode','sqlRootDir','str','\x20(local\x20file\x20moved\x20to\x20trash)','projectRoot','5340903UGKoYD','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','fromEntries','high-risk-write','lockFilePath','8533940SHbdPX','sqlRoot','lastSync','4940752KYFYKl','Deleted\x20','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','sql','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','94508DZxrNZ','6151240XTYCgY','37iGcoSt','trashDir','POST','delete','remoteId','sqls','147bTmQpN','/smartapi/custom/deleteUserCustomSql'];a184_0x339b=function(){return _0x49a994;};return a184_0x339b();}const a184_0x20f4fd=a184_0x1f8f;(function(_0x5d2ef5,_0x4e4620){const _0x25dc27=a184_0x1f8f,_0x6b9b43=_0x5d2ef5();while(!![]){try{const _0x3b35d6=parseInt(_0x25dc27(0x10b))/0x1*(parseInt(_0x25dc27(0x109))/0x2)+parseInt(_0x25dc27(0xfc))/0x3+parseInt(_0x25dc27(0x10a))/0x4+-parseInt(_0x25dc27(0x101))/0x5+parseInt(_0x25dc27(0xec))/0x6*(parseInt(_0x25dc27(0xea))/0x7)+parseInt(_0x25dc27(0x104))/0x8+-parseInt(_0x25dc27(0xed))/0x9;if(_0x3b35d6===_0x4e4620)break;else _0x6b9b43['push'](_0x6b9b43['shift']());}catch(_0x473f98){_0x6b9b43['push'](_0x6b9b43['shift']());}}}(a184_0x339b,0xe4cb8));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{deleteSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{fileExists}from'../../core/bff/file-system.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';function a184_0x1f8f(_0x1d2e2e,_0x5277e8){_0x1d2e2e=_0x1d2e2e-0xe9;const _0x339b82=a184_0x339b();let _0x1f8f89=_0x339b82[_0x1d2e2e];return _0x1f8f89;}export const sqlDelete={'service':a184_0x20f4fd(0x107),'command':a184_0x20f4fd(0x10e),'description':a184_0x20f4fd(0xfd),'risk':a184_0x20f4fd(0xff),'flags':[SQLCODE_FLAG],async 'validate'(_0x273f1f){const _0x3a65eb=a184_0x20f4fd,_0xd9fe96=loadSqlProjectConfig(_0x273f1f[_0x3a65eb(0xf7)]),_0x91ea15=await readSqlLockFile(_0xd9fe96['lockFilePath']);if(!_0x91ea15)throw CliErrors[_0x3a65eb(0xf4)](_0x3a65eb(0x106));},async 'dryRun'(_0x5e467f){const _0x54859f=a184_0x20f4fd,_0x51cd8a=loadSqlProjectConfig(_0x5e467f['appCode']),_0x74a039=await readSqlLockFile(_0x51cd8a['lockFilePath']);if(!_0x74a039)throw CliErrors[_0x54859f(0xf4)](_0x54859f(0x106));const {appLock:_0x53082b}=ensureSqlLockScope(_0x74a039,_0x5e467f[_0x54859f(0xf7)],_0x51cd8a[_0x54859f(0x102)],_0x54859f(0x10e)),_0x28fd22=_0x5e467f[_0x54859f(0xf9)](_0x54859f(0xee)),_0x1ef681=_0x53082b[_0x54859f(0xe9)][_0x28fd22];if(!_0x1ef681)throw CliErrors['validation'](_0x54859f(0x108)+_0x28fd22+'\x22.');return{'method':_0x54859f(0x10d),'url':_0x54859f(0xeb),'body':{'sqlCode':_0x28fd22,'id':_0x1ef681[_0x54859f(0x10f)],'localPath':resolveLocalSqlFilePath(_0x51cd8a,_0x28fd22,_0x1ef681)},'description':_0x54859f(0xef)+_0x28fd22+'\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20'+_0x51cd8a[_0x54859f(0x10c)]};},async 'execute'(_0x193d9a){const _0x341c60=a184_0x20f4fd,_0x18deda=loadSqlProjectConfig(_0x193d9a[_0x341c60(0xf7)]),_0x2029f5=await readSqlLockFile(_0x18deda[_0x341c60(0x100)]);if(!_0x2029f5)throw CliErrors[_0x341c60(0xf4)](_0x341c60(0xf3));const {lockData:_0xf287e6,appLock:_0x381107}=ensureSqlLockScope(_0x2029f5,_0x193d9a[_0x341c60(0xf7)],_0x18deda[_0x341c60(0x102)],'delete'),_0x282d4f=_0x193d9a['str'](_0x341c60(0xee)),_0x388c91=_0x381107[_0x341c60(0xe9)][_0x282d4f];if(!_0x388c91)throw CliErrors[_0x341c60(0xf4)](_0x341c60(0x108)+_0x282d4f+'\x22.');await deleteSqlQuery({'id':_0x388c91[_0x341c60(0x10f)],'sqlCode':_0x282d4f}),_0x381107[_0x341c60(0xe9)]=Object[_0x341c60(0xfe)](Object['entries'](_0x381107['sqls'])[_0x341c60(0xf0)](([_0x1cff79])=>_0x1cff79!==_0x282d4f)),_0x381107[_0x341c60(0x103)]=new Date()['toISOString'](),await writeSqlLockFile(_0x18deda[_0x341c60(0x100)],_0xf287e6);const _0x82e52e=resolveLocalSqlFilePath(_0x18deda,_0x282d4f,_0x388c91);let _0x3cfc25;await fileExists(_0x82e52e)&&(_0x3cfc25=await moveToTrash(_0x18deda[_0x341c60(0xfb)],_0x18deda['trashDir'],_0x82e52e),await cleanupEmptyDirectories(dirname(_0x82e52e),_0x18deda[_0x341c60(0xf8)]));const _0x34d360={'deleted':_0x282d4f,'remoteId':_0x388c91['remoteId']};if(_0x3cfc25)_0x34d360['trashedTo']=_0x3cfc25;return{'ok':!![],'data':_0x34d360,'message':_0x341c60(0x105)+_0x282d4f+(_0x3cfc25?_0x341c60(0xfa):'')};}};async function moveToTrash(_0x461e83,_0x5b9cf6,_0x202568){const _0x5d4ec1=a184_0x20f4fd,_0x534112=new Date()[_0x5d4ec1(0xf5)]()[_0x5d4ec1(0xf1)](/[:.]/g,'-'),_0x3197a2=relative(_0x461e83,_0x202568),_0xc5827f=join(_0x5b9cf6,_0x534112,_0x3197a2);return await mkdir(dirname(_0xc5827f),{'recursive':!![]}),await rename(_0x202568,_0xc5827f),_0xc5827f;}async function cleanupEmptyDirectories(_0x3aa6c5,_0x831bb1){const _0x54e930=a184_0x20f4fd;let _0x5a72d2=resolve(_0x3aa6c5);const _0x353038=resolve(_0x831bb1);while(_0x5a72d2[_0x54e930(0xf6)](''+_0x353038+sep)||_0x5a72d2===_0x353038){if(_0x5a72d2===_0x353038)return;try{const _0x3902da=await readdir(_0x5a72d2);if(_0x3902da[_0x54e930(0xf2)]>0x0)return;await rmdir(_0x5a72d2);}catch{return;}_0x5a72d2=dirname(_0x5a72d2);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a185_0x2347(_0x2e0234,_0x29224e){_0x2e0234=_0x2e0234-0xbc;const _0x55000c=a185_0x5500();let _0x234723=_0x55000c[_0x2e0234];return _0x234723;}const a185_0x4cc823=a185_0x2347;(function(_0x5a35e1,_0x24b467){const _0x227fd6=a185_0x2347,_0x3d9050=_0x5a35e1();while(!![]){try{const _0x462ba0=parseInt(_0x227fd6(0xc4))/0x1*(-parseInt(_0x227fd6(0xc1))/0x2)+parseInt(_0x227fd6(0xcb))/0x3*(parseInt(_0x227fd6(0xc6))/0x4)+parseInt(_0x227fd6(0xd1))/0x5+-parseInt(_0x227fd6(0xbd))/0x6+-parseInt(_0x227fd6(0xce))/0x7+-parseInt(_0x227fd6(0xc9))/0x8*(parseInt(_0x227fd6(0xbf))/0x9)+parseInt(_0x227fd6(0xca))/0xa*(parseInt(_0x227fd6(0xc8))/0xb);if(_0x462ba0===_0x24b467)break;else _0x3d9050['push'](_0x3d9050['shift']());}catch(_0x42486a){_0x3d9050['push'](_0x3d9050['shift']());}}}(a185_0x5500,0x3bb12));function a185_0x5500(){const _0x2906f4=['7519980tvfcWK','234774XrSaKd','appCode','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','478730MRTpgb','detail','verbose','1208220WcFNTn','sql','sqlName','738252ihLpjB','boolean','1722141nPanRV','dbId','2yjFzkp','bool','sqlcode','444621yZRqOG','Return\x20full\x20raw\x20SQL\x20query\x20object','4nkzuyj','sqlCode','11dumUjJ','8qVisNc'];a185_0x5500=function(){return _0x2906f4;};return a185_0x5500();}import{getSqlQueryInfo}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':a185_0x4cc823(0xd2),'command':a185_0x4cc823(0xcf),'description':a185_0x4cc823(0xcd),'risk':'read','flags':[SQLCODE_FLAG,{'name':'verbose','type':a185_0x4cc823(0xbe),'description':a185_0x4cc823(0xc5)}],async 'execute'(_0x240cbe){const _0x5af163=a185_0x4cc823,_0x58903a=await getSqlQueryInfo(_0x240cbe[_0x5af163(0xcc)],_0x240cbe['str'](_0x5af163(0xc3))),_0x1f9083=_0x240cbe[_0x5af163(0xc2)](_0x5af163(0xd0));if(_0x1f9083)return{'ok':!![],'data':_0x58903a};const _0x2fc7a8=_0x58903a[_0x5af163(0xc0)]?await getDbName(_0x240cbe[_0x5af163(0xcc)],_0x58903a[_0x5af163(0xc0)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x58903a[_0x5af163(0xc7)],'sqlName':_0x58903a[_0x5af163(0xbc)],'db':_0x2fc7a8?_0x2fc7a8+'\x20('+_0x58903a[_0x5af163(0xc0)]+')':_0x58903a[_0x5af163(0xc0)]??'','description':_0x58903a['description']??'','sqlContent':_0x58903a['sqlContent']??''}};}};
|
package/lib/commands/sql/exec.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a186_0x39c1(_0x200e16,_0x3794a7){_0x200e16=_0x200e16-0x9b;const _0x863fa0=a186_0x863f();let _0x39c190=_0x863fa0[_0x200e16];return _0x39c190;}function a186_0x863f(){const _0x565250=['execResult','read','now','124476JpIvEz','6730934VZeQnb','SQL\x20execution\x20failed','4547466TRhwwS','1420arqqai','125609wxsQkM','Returned\x20','8DgFaha','sql','isArray','exec','str','13404ZlwPkj','20mKGkUg','appCode','33018izvmDE','execSuccess','1518246GJRZNy','params','105xmgXdk'];a186_0x863f=function(){return _0x565250;};return a186_0x863f();}const a186_0x1883a8=a186_0x39c1;(function(_0x1d8628,_0x4b358d){const _0x30a42e=a186_0x39c1,_0x20d552=_0x1d8628();while(!![]){try{const _0x2256aa=parseInt(_0x30a42e(0xa1))/0x1+-parseInt(_0x30a42e(0xb0))/0x2*(parseInt(_0x30a42e(0x9d))/0x3)+-parseInt(_0x30a42e(0xad))/0x4*(-parseInt(_0x30a42e(0xa5))/0x5)+-parseInt(_0x30a42e(0xa4))/0x6+parseInt(_0x30a42e(0xa2))/0x7+-parseInt(_0x30a42e(0xa8))/0x8*(parseInt(_0x30a42e(0x9b))/0x9)+parseInt(_0x30a42e(0xae))/0xa*(parseInt(_0x30a42e(0xa6))/0xb);if(_0x2256aa===_0x4b358d)break;else _0x20d552['push'](_0x20d552['shift']());}catch(_0x15b874){_0x20d552['push'](_0x20d552['shift']());}}}(a186_0x863f,0x87c6c));import{executeSql}from'../../core/api-client.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';import{parseJsonParams}from'../../utils/params.js';export const sqlExec={'service':a186_0x1883a8(0xa9),'command':a186_0x1883a8(0xab),'description':'Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','risk':a186_0x1883a8(0x9f),'flags':[SQLCODE_FLAG,{'name':a186_0x1883a8(0x9c),'type':'string','description':'SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)'}],async 'execute'(_0xbbf80c){const _0x20addf=a186_0x1883a8,_0x21efb1=parseJsonParams(_0xbbf80c[_0x20addf(0xac)](_0x20addf(0x9c))),_0x969584=Date[_0x20addf(0xa0)](),_0x504281=await executeSql(_0xbbf80c[_0x20addf(0xaf)],_0xbbf80c[_0x20addf(0xac)]('sqlcode'),_0x21efb1),_0x117d18=Date[_0x20addf(0xa0)]()-_0x969584,_0x54f3e6=_0x504281?.[_0x20addf(0x9e)]??_0x504281,_0x530558=_0x504281?.[_0x20addf(0xb1)]??!![];if(!_0x530558)return{'ok':![],'data':{'error':_0x504281?.['execError']||_0x20addf(0xa3),'elapsed':_0x117d18},'message':_0x20addf(0xa3)};const _0x5e4ef6=Array[_0x20addf(0xaa)](_0x54f3e6)?_0x54f3e6:[];return{'ok':!![],'data':{'rows':_0x5e4ef6,'rowCount':_0x5e4ef6['length'],'elapsed':_0x117d18},'message':_0x20addf(0xa7)+_0x5e4ef6['length']+'\x20row(s)\x20in\x20'+_0x117d18+'ms'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x3a745f,_0x8a5dbb){const _0x560719=a187_0x57e8,_0x1e88b8=_0x3a745f();while(!![]){try{const _0x83a2c1=parseInt(_0x560719(0xed))/0x1+-parseInt(_0x560719(0xf1))/0x2+parseInt(_0x560719(0xee))/0x3+parseInt(_0x560719(0xeb))/0x4+parseInt(_0x560719(0xef))/0x5*(-parseInt(_0x560719(0xf0))/0x6)+parseInt(_0x560719(0xec))/0x7+-parseInt(_0x560719(0xf3))/0x8*(parseInt(_0x560719(0xf2))/0x9);if(_0x83a2c1===_0x8a5dbb)break;else _0x1e88b8['push'](_0x1e88b8['shift']());}catch(_0x50f6c6){_0x1e88b8['push'](_0x1e88b8['shift']());}}}(a187_0x94c8,0xc03b6));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';import{sqlPull}from'../../commands/sql/pull.js';import{sqlCreate}from'../../commands/sql/create.js';import{sqlStatus}from'../../commands/sql/status.js';import{sqlPush}from'../../commands/sql/push.js';function a187_0x94c8(){const _0x4d617d=['2043096MoExJm','9365909rdJuSj','552672tXQdYx','2647188rKDxNm','220RuIiRx','31278SJRJfy','540522vzBpJv','108261oJSyfY','1328OgEnhw'];a187_0x94c8=function(){return _0x4d617d;};return a187_0x94c8();}function a187_0x57e8(_0xe396d,_0x14cb7f){_0xe396d=_0xe396d-0xeb;const _0x94c8d4=a187_0x94c8();let _0x57e8ac=_0x94c8d4[_0xe396d];return _0x57e8ac;}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_0x30ee07=a188_0x5058;(function(_0x4a7d6a,_0x10a1ba){const _0x4cce29=a188_0x5058,_0x54db91=_0x4a7d6a();while(!![]){try{const _0x119453=parseInt(_0x4cce29(0x1a8))/0x1*(-parseInt(_0x4cce29(0x1aa))/0x2)+parseInt(_0x4cce29(0x1ad))/0x3*(parseInt(_0x4cce29(0x1ae))/0x4)+parseInt(_0x4cce29(0x1b1))/0x5*(parseInt(_0x4cce29(0x1ab))/0x6)+-parseInt(_0x4cce29(0x1a4))/0x7+parseInt(_0x4cce29(0x1ac))/0x8+parseInt(_0x4cce29(0x1bf))/0x9+parseInt(_0x4cce29(0x1c2))/0xa*(-parseInt(_0x4cce29(0x1c0))/0xb);if(_0x119453===_0x10a1ba)break;else _0x54db91['push'](_0x54db91['shift']());}catch(_0x1e9826){_0x54db91['push'](_0x54db91['shift']());}}}(a188_0x1a83,0x4dccc));import{listSqlQueries}from'../../core/api-client.js';function a188_0x5058(_0x575e0a,_0x1fed5f){_0x575e0a=_0x575e0a-0x1a2;const _0x1a83bd=a188_0x1a83();let _0x505865=_0x1a83bd[_0x575e0a];return _0x505865;}import{getDbName}from'../../core/db-resolver.js';function a188_0x1a83(){const _0x12379f=['No\x20custom\x20SQL\x20queries\x20found.','list','Page\x20size','2uCejSz','List\x20custom\x20SQL\x20queries','444502UkRtuF','162978JzsOKw','3116896KcwvAC','3swrTnt','2004156uMaxLj','all','appCode','60ExUBqg','str','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','description','dbId','string','totalCount','\x20SQL\x20queries\x20(total:\x20','name','pagesize','Filter\x20by\x20SQL\x20name','number','map','read','628083ZZnfHs','472109NkzvRs','length','50OwFqPS','sql','num','sqlName','Page\x20number','page','boolean','verbose','2160403xnAbWz'];a188_0x1a83=function(){return _0x12379f;};return a188_0x1a83();}import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':a188_0x30ee07(0x1c3),'command':a188_0x30ee07(0x1a6),'description':a188_0x30ee07(0x1a9),'risk':a188_0x30ee07(0x1be),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a188_0x30ee07(0x1b9),'type':a188_0x30ee07(0x1b6),'description':a188_0x30ee07(0x1bb)},{'name':a188_0x30ee07(0x1c7),'type':a188_0x30ee07(0x1bc),'description':a188_0x30ee07(0x1c6),'default':0x1},{'name':a188_0x30ee07(0x1ba),'type':'number','description':a188_0x30ee07(0x1a7)},{'name':a188_0x30ee07(0x1a3),'type':a188_0x30ee07(0x1a2),'description':a188_0x30ee07(0x1b3)}],async 'execute'(_0x4de189){const _0x4affec=a188_0x30ee07,_0x21950d=await listSqlQueries(_0x4de189[_0x4affec(0x1b0)],{'sqlCode':_0x4de189[_0x4affec(0x1b2)]('sqlcode')||undefined,'sqlName':_0x4de189[_0x4affec(0x1b2)](_0x4affec(0x1b9))||undefined,'currentPage':_0x4de189[_0x4affec(0x1c4)](_0x4affec(0x1c7)),'pageSize':_0x4de189[_0x4affec(0x1c4)](_0x4affec(0x1ba),0x32)}),_0x28e2b8=_0x4de189['bool'](_0x4affec(0x1a3)),_0x29d677=_0x21950d['tableData']??[],_0x3ecceb=_0x21950d['paging']?.[_0x4affec(0x1b7)]??_0x29d677['length'];let _0x11fea2;return _0x28e2b8?_0x11fea2=_0x29d677:_0x11fea2=await Promise[_0x4affec(0x1af)](_0x29d677[_0x4affec(0x1bd)](async _0x4151cd=>{const _0x21ed22=_0x4affec;let _0x2066c2;try{_0x2066c2=_0x4151cd[_0x21ed22(0x1b5)]?await getDbName(_0x4de189[_0x21ed22(0x1b0)],_0x4151cd[_0x21ed22(0x1b5)]):undefined;}catch{}return{'sqlCode':_0x4151cd['sqlCode'],'sqlName':_0x4151cd[_0x21ed22(0x1c5)],'description':_0x4151cd[_0x21ed22(0x1b4)]??'','db':_0x2066c2?_0x2066c2+'\x20('+_0x4151cd['dbId']+')':_0x4151cd[_0x21ed22(0x1b5)]??''};})),{'ok':!![],'data':_0x11fea2,'message':_0x29d677[_0x4affec(0x1c1)]===0x0?_0x4affec(0x1a5):'Found\x20'+_0x29d677[_0x4affec(0x1c1)]+_0x4affec(0x1b8)+_0x3ecceb+').'};}};
|
package/lib/commands/sql/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
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);}
|
|
1
|
+
const a189_0x3817b5=a189_0x2d14;(function(_0x1b0ccb,_0xba7479){const _0x566a67=a189_0x2d14,_0x564c3d=_0x1b0ccb();while(!![]){try{const _0x4cd3f6=parseInt(_0x566a67(0xb4))/0x1*(parseInt(_0x566a67(0x7b))/0x2)+parseInt(_0x566a67(0x7c))/0x3+parseInt(_0x566a67(0x86))/0x4+parseInt(_0x566a67(0x8b))/0x5*(-parseInt(_0x566a67(0x9d))/0x6)+-parseInt(_0x566a67(0x9b))/0x7*(-parseInt(_0x566a67(0xb2))/0x8)+-parseInt(_0x566a67(0xb3))/0x9+-parseInt(_0x566a67(0x95))/0xa*(parseInt(_0x566a67(0xa0))/0xb);if(_0x4cd3f6===_0xba7479)break;else _0x564c3d['push'](_0x564c3d['shift']());}catch(_0x374caf){_0x564c3d['push'](_0x564c3d['shift']());}}}(a189_0x5360,0x32547));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';function a189_0x5360(){const _0x47e93d=['split','mybatisXml','boolean','paging','name','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','string','sqlRoot','Force\x20pull\x20cancelled.','Would\x20pull\x20','push','\x20SQL\x20file(s)\x20into\x20','bool','test','str','\x20written,\x20','join','192iJXoTp','818451OLowoT','52mskPUF','apps','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','appCode','sqlCode','force','9172avDcyt','1018038zSBYAy','unchanged','trimStart','sqlName','POST','catch','\x20failed','sqlRootDir','Filter\x20by\x20SQL\x20display\x20name','skipped','283568qyBYNf','cancelled','filter','utf8','lockFilePath','3385lcrPxE','totalCount','nonInteractive','Pull\x20complete:\x20','conflict','pull','local\x20differs\x20from\x20remote','read','sqlContent','toISOString','950HdtVsV','would_pull','length','replace','description','message','112399iWYOqH','dbId','2934iVIxvm','path','sqls','47003EWDJiO'];a189_0x5360=function(){return _0x47e93d;};return a189_0x5360();}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(_0x41b95f,_0x2d7290){const _0x3efa2a=a189_0x2d14,_0x16d225=[];let _0x2b68b0=0x1;while(!![]){const _0x4be1a1=await listSqlQueries(_0x41b95f,{'currentPage':_0x2b68b0,'pageSize':PAGE_SIZE,'sqlCode':_0x2d7290['sqlCode'],'sqlName':_0x2d7290[_0x3efa2a(0x7f)]}),_0x3cc440=_0x4be1a1['tableData']??[];_0x16d225[_0x3efa2a(0xab)](..._0x3cc440);if(_0x3cc440[_0x3efa2a(0x97)]===0x0)break;const _0x59c7c0=_0x4be1a1[_0x3efa2a(0xa4)]?.[_0x3efa2a(0x8c)];if(_0x59c7c0!=null?_0x16d225[_0x3efa2a(0x97)]>=_0x59c7c0:_0x3cc440[_0x3efa2a(0x97)]<PAGE_SIZE)break;_0x2b68b0++;}return _0x16d225;}async function ensureSqlContent(_0x4c8dc3){const _0x43f32e=a189_0x2d14;if(_0x4c8dc3[_0x43f32e(0x93)]!=null&&String(_0x4c8dc3[_0x43f32e(0x93)])['length']>0x0)return _0x4c8dc3;return getSqlQueryDetail(_0x4c8dc3['sqlCode']);}export const sqlPull={'service':'sql','command':a189_0x3817b5(0x90),'description':'Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','risk':a189_0x3817b5(0x92),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a189_0x3817b5(0xa5),'type':a189_0x3817b5(0xa7),'description':a189_0x3817b5(0x84)},{'name':'force','type':a189_0x3817b5(0xa3),'description':'Force\x20overwrite\x20local\x20unsynced\x20changes'}],async 'dryRun'(_0x3fdeea){const _0x244d0a=a189_0x3817b5,_0x50d758=loadSqlProjectConfig(_0x3fdeea['appCode']),_0x38558c=await readSqlLockFile(_0x50d758['lockFilePath']),{appLock:_0x58bfb1}=ensureSqlLockScope(_0x38558c??createEmptySqlLock(),_0x50d758['appCode'],_0x50d758[_0x244d0a(0xa8)],'pull'),_0x50eb3b=await fetchAllSqlQueries(_0x3fdeea[_0x244d0a(0x78)],{'sqlCode':_0x3fdeea[_0x244d0a(0xaf)]('sqlcode')||undefined,'sqlName':_0x3fdeea[_0x244d0a(0xaf)](_0x244d0a(0xa5))||undefined}),_0x111300=[];for(const _0x2544fb of _0x50eb3b){const _0x51617b=await ensureSqlContent(_0x2544fb),_0x1c1723=ensureRemoteSqlContent(_0x51617b),_0x3f2fb7=detectModeFromSql(_0x51617b),_0x441094=_0x51617b['dbId']?await getDbName(_0x3fdeea['appCode'],Number(_0x51617b[_0x244d0a(0x9c)]))[_0x244d0a(0x81)](()=>undefined):undefined,_0x56631c=buildLocalSqlFileContent({'sqlCode':_0x51617b[_0x244d0a(0x79)],'sqlName':_0x51617b[_0x244d0a(0x7f)],'dbId':_0x51617b[_0x244d0a(0x9c)]},_0x1c1723,{'dbName':_0x441094,'mode':_0x3f2fb7,'syncedAt':new Date()[_0x244d0a(0x94)](),'description':_0x51617b[_0x244d0a(0x99)]}),_0x58c309=buildSqlLockEntry(_0x51617b,_0x1c1723,'',{'dbName':_0x441094}),_0xea7cee=resolveLocalSqlFilePath(_0x50d758,_0x51617b[_0x244d0a(0x79)],_0x58c309);let _0x5a32da=_0x244d0a(0x96),_0xef72ba;if(await fileExists(_0xea7cee)){const _0x1d3422=await readFile(_0xea7cee,_0x244d0a(0x89));isEquivalentPulledSqlFile(_0x1d3422,_0x56631c,_0x3f2fb7)?(_0x5a32da=_0x244d0a(0x85),_0xef72ba='unchanged'):(_0x5a32da=_0x244d0a(0x8f),_0xef72ba=_0x244d0a(0x77));}_0x111300[_0x244d0a(0xab)]({'sqlCode':_0x51617b[_0x244d0a(0x79)],'sqlName':_0x51617b['sqlName'],'filePath':_0xea7cee,'status':_0x5a32da,'reason':_0xef72ba});}return{'method':_0x244d0a(0x80),'url':_0x244d0a(0xa6),'body':{'appCode':_0x3fdeea[_0x244d0a(0x78)],'sqlCode':_0x3fdeea['str']('sqlcode')||null,'sqlName':_0x3fdeea['str']('name')||null,'files':_0x111300},'description':_0x244d0a(0xaa)+_0x111300[_0x244d0a(0x97)]+_0x244d0a(0xac)+_0x50d758[_0x244d0a(0x83)]};},async 'execute'(_0x999262){const _0xb59bad=a189_0x3817b5,_0x52172b=loadSqlProjectConfig(_0x999262[_0xb59bad(0x78)]),_0x4c4d20=await readSqlLockFile(_0x52172b[_0xb59bad(0x8a)]),{lockData:_0x24eb95,appLock:_0x4f9143}=ensureSqlLockScope(_0x4c4d20??createEmptySqlLock(),_0x52172b[_0xb59bad(0x78)],_0x52172b[_0xb59bad(0xa8)],_0xb59bad(0x90)),_0x8050=_0x999262[_0xb59bad(0xad)](_0xb59bad(0x7a)),_0x33bf34=await fetchAllSqlQueries(_0x999262[_0xb59bad(0x78)],{'sqlCode':_0x999262[_0xb59bad(0xaf)]('sqlcode')||undefined,'sqlName':_0x999262[_0xb59bad(0xaf)](_0xb59bad(0xa5))||undefined});if(_0x33bf34['length']===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':'No\x20remote\x20SQL\x20queries\x20matched.'};const _0x1b6d9c=[],_0x35610a=[];for(const _0xdcf157 of _0x33bf34){try{_0x1b6d9c['push'](await ensureSqlContent(_0xdcf157));}catch(_0x42f72a){_0x35610a['push']({'sqlCode':_0xdcf157[_0xb59bad(0x79)],'error':_0x42f72a instanceof Error?_0x42f72a[_0xb59bad(0x9a)]:String(_0x42f72a)});}}if(_0x8050&&!_0x999262[_0xb59bad(0x8d)]){let _0x4ac9a1=![];for(const _0x1cb8d of _0x1b6d9c){const _0x241cf0=detectModeFromSql(_0x1cb8d),_0x22a491=_0x1cb8d['dbId']?await getDbName(_0x999262[_0xb59bad(0x78)],Number(_0x1cb8d[_0xb59bad(0x9c)]))[_0xb59bad(0x81)](()=>undefined):undefined,_0x5760fc=buildLocalSqlFileContent({'sqlCode':_0x1cb8d['sqlCode'],'sqlName':_0x1cb8d[_0xb59bad(0x7f)],'dbId':_0x1cb8d['dbId']},ensureRemoteSqlContent(_0x1cb8d),{'dbName':_0x22a491,'mode':_0x241cf0,'syncedAt':new Date()['toISOString'](),'description':_0x1cb8d[_0xb59bad(0x99)]}),_0x55e512=resolveLocalSqlFilePath(_0x52172b,_0x1cb8d[_0xb59bad(0x79)],buildSqlLockEntry(_0x1cb8d,ensureRemoteSqlContent(_0x1cb8d),'',{'dbName':_0x22a491}));if(await fileExists(_0x55e512)){const _0x4fdf77=await readFile(_0x55e512,'utf8');if(!isEquivalentPulledSqlFile(_0x4fdf77,_0x5760fc,_0x241cf0)){_0x4ac9a1=!![];break;}}}if(_0x4ac9a1){const _0x3d1891=await confirmForceOverwrite('Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.');if(!_0x3d1891)throw CliErrors[_0xb59bad(0x87)](_0xb59bad(0xa9));}}const _0xbc54e4=cloneSqlLockData(_0x24eb95),_0x346909=_0xbc54e4[_0xb59bad(0x76)][_0x52172b[_0xb59bad(0x78)]],_0x1a6394=[],_0x3aae3c=[];for(const _0xe0cf2 of _0x1b6d9c){const _0x4bdb3a=_0x346909['sqls'][_0xe0cf2[_0xb59bad(0x79)]],_0x49a883=ensureRemoteSqlContent(_0xe0cf2),_0x43be2f=detectModeFromSql(_0xe0cf2),_0x58629c=_0xe0cf2[_0xb59bad(0x9c)]?await getDbName(_0x999262['appCode'],Number(_0xe0cf2['dbId']))[_0xb59bad(0x81)](()=>undefined):undefined,_0x4912f1=buildLocalSqlFileContent({'sqlCode':_0xe0cf2['sqlCode'],'sqlName':_0xe0cf2[_0xb59bad(0x7f)],'dbId':_0xe0cf2[_0xb59bad(0x9c)]},_0x49a883,{'dbName':_0x58629c,'mode':_0x43be2f,'syncedAt':new Date()['toISOString'](),'description':_0xe0cf2[_0xb59bad(0x99)]}),_0x1e3483=buildSqlLockEntry(_0xe0cf2,_0x49a883,computeSqlContentHash(_0x4912f1),{'dbName':_0x58629c}),_0xc99d70=_0x1e3483[_0xb59bad(0x9e)],_0x39cc47=join(_0x52172b['sqlRootDir'],_0xc99d70);try{if(await fileExists(_0x39cc47)){const _0x24826d=await readFile(_0x39cc47,_0xb59bad(0x89));if(isEquivalentPulledSqlFile(_0x24826d,_0x4912f1,_0x43be2f)){_0x3aae3c['push']({'sqlCode':_0xe0cf2['sqlCode'],'reason':_0xb59bad(0x7d)}),_0x346909['sqls'][_0xe0cf2[_0xb59bad(0x79)]]={..._0x1e3483,'hash':computeSqlContentHash(_0x24826d),'path':_0xc99d70};continue;}if(!_0x8050){_0x3aae3c[_0xb59bad(0xab)]({'sqlCode':_0xe0cf2[_0xb59bad(0x79)],'reason':_0xb59bad(0x91)});continue;}}const _0xb537fc=_0x4bdb3a?.['path']?join(_0x52172b[_0xb59bad(0x83)],_0x4bdb3a[_0xb59bad(0x9e)]):undefined;_0xb537fc&&_0xb537fc!==_0x39cc47&&await fileExists(_0xb537fc)&&await rm(_0xb537fc,{'force':!![]}),await ensureParentDirectory(_0x39cc47),await writeFile(_0x39cc47,_0x4912f1,_0xb59bad(0x89)),_0x346909[_0xb59bad(0x9f)][_0xe0cf2[_0xb59bad(0x79)]]={..._0x1e3483,'path':_0xc99d70},_0x1a6394[_0xb59bad(0xab)]({'sqlCode':_0xe0cf2[_0xb59bad(0x79)],'filePath':_0x39cc47});}catch(_0x48a5ee){_0x35610a[_0xb59bad(0xab)]({'sqlCode':_0xe0cf2[_0xb59bad(0x79)],'error':_0x48a5ee instanceof Error?_0x48a5ee[_0xb59bad(0x9a)]:String(_0x48a5ee)});}}return _0x346909['lastSync']=new Date()[_0xb59bad(0x94)](),await writeSqlLockFile(_0x52172b[_0xb59bad(0x8a)],_0xbc54e4),{'ok':_0x35610a['length']===0x0,'data':{'pulled':_0x1a6394,'skipped':_0x3aae3c,'failed':_0x35610a},'message':_0xb59bad(0x8e)+_0x1a6394[_0xb59bad(0x97)]+_0xb59bad(0xb0)+_0x3aae3c['length']+'\x20skipped,\x20'+_0x35610a[_0xb59bad(0x97)]+_0xb59bad(0x82)};}};function detectModeFromSql(_0x374432){const _0x5d50f3=a189_0x3817b5,_0x133dfa=ensureRemoteSqlContent(_0x374432),_0x40f005=stripLocalSqlMetadata(_0x133dfa,_0x5d50f3(0xa2))[_0x5d50f3(0x7e)]();if(/^<(select|insert|update|delete)\b/i[_0x5d50f3(0xae)](_0x40f005))return _0x5d50f3(0xa2);return'sql';}function isEquivalentPulledSqlFile(_0x2cd888,_0x17b8af,_0x312604){return normalizePullComparableContent(_0x2cd888,_0x312604)===normalizePullComparableContent(_0x17b8af,_0x312604);}function normalizePullComparableContent(_0x4e2efe,_0x42b9ac){const _0x593523=a189_0x3817b5,_0x135a52=_0x4e2efe[_0x593523(0x98)](/\r\n/g,'\x0a')[_0x593523(0xa1)]('\x0a'),_0x34f281=_0x135a52[_0x593523(0x88)](_0x5554f3=>!isSyncedAtMetadataLine(_0x5554f3,_0x42b9ac));return _0x34f281[_0x593523(0xb1)]('\x0a');}function a189_0x2d14(_0x4ca641,_0xa5e0e2){_0x4ca641=_0x4ca641-0x76;const _0x536015=a189_0x5360();let _0x2d145e=_0x536015[_0x4ca641];return _0x2d145e;}function isSyncedAtMetadataLine(_0x43017e,_0x3a2e68){const _0xabf420=a189_0x3817b5;if(_0x3a2e68===_0xabf420(0xa2))return/^\s*<!--\s*@lovrabet\.syncedAt:/['test'](_0x43017e);return/^\s*--\s*@lovrabet\.syncedAt:/[_0xabf420(0xae)](_0x43017e);}
|
package/lib/commands/sql/push.js
CHANGED
|
@@ -1 +1 @@
|
|
|
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
|
+
const a190_0x3690d3=a190_0x1a79;(function(_0x3aa9bb,_0x100d16){const _0x29668d=a190_0x1a79,_0x4969f2=_0x3aa9bb();while(!![]){try{const _0x1d5a37=-parseInt(_0x29668d(0x97))/0x1+-parseInt(_0x29668d(0xb1))/0x2*(parseInt(_0x29668d(0xbb))/0x3)+-parseInt(_0x29668d(0xa7))/0x4+parseInt(_0x29668d(0x96))/0x5*(-parseInt(_0x29668d(0x90))/0x6)+parseInt(_0x29668d(0x9d))/0x7+parseInt(_0x29668d(0xa4))/0x8*(parseInt(_0x29668d(0x94))/0x9)+parseInt(_0x29668d(0x86))/0xa;if(_0x1d5a37===_0x100d16)break;else _0x4969f2['push'](_0x4969f2['shift']());}catch(_0x5e9da6){_0x4969f2['push'](_0x4969f2['shift']());}}}(a190_0x5dba,0x62101));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_0x1a79(_0x435128,_0x2bd0bc){_0x435128=_0x435128-0x79;const _0x5dba67=a190_0x5dba();let _0x1a7935=_0x5dba67[_0x435128];return _0x1a7935;}import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';function a190_0x5dba(){const _0x4d8aa5=['get','743487IGgHII','catch','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','lastSync','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','appCode','str','message','unchanged','has','length','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','force','dbName','19208180gLOJAM','set','toISOString','trashDir','sql','sqlCode','sqls','replace','startsWith','sqlRoot','4347132fqvOaf','dbId','entries','Local\x20directory\x20\x22','38268TTYTvL','version','5qMPZnt','472214HaSQNs','path','boolean','hash','remoteId','No\x20database\x20matches\x20local\x20directory\x20\x22','1910895DhqScv','Push\x20local\x20SQL\x20files\x20to\x20remote','validation','sqlRootDir','join','sqlName','utf8','136DwhMgs','Push\x20complete:\x20','filter','688112smAUjO','map','dbDirectory','filePath','Would\x20push\x20','\x20failed','lockFilePath','isFinite','No\x20local\x20SQL\x20files\x20found.','Local\x20SQL\x20not\x20found:\x20','4fdLKDN','sqlConfig','push','relativePath','POST','mode','bool','high-risk-write','\x20skipped,\x20'];a190_0x5dba=function(){return _0x4d8aa5;};return a190_0x5dba();}async function getTargetSqlQueries(_0x3aee6f,_0x2319d0,_0x41ece2){const _0x15dec3=a190_0x1a79,_0x474a73=await scanLocalSqlQueries(_0x3aee6f),_0x7d56f8=new Map();for(const _0x45d59f of _0x474a73){if(_0x41ece2&&_0x45d59f[_0x15dec3(0x8b)]!==_0x41ece2)continue;const _0x9639ad=_0x7d56f8[_0x15dec3(0xba)](_0x45d59f['sqlCode'])??[];_0x9639ad[_0x15dec3(0xb3)](_0x45d59f),_0x7d56f8[_0x15dec3(0x87)](_0x45d59f['sqlCode'],_0x9639ad);}if(_0x41ece2&&!_0x7d56f8[_0x15dec3(0x81)](_0x41ece2))throw CliErrors[_0x15dec3(0x9f)](_0x15dec3(0xb0)+_0x41ece2);const _0x9bf974=[];for(const [_0x5c6b85,_0x1f4707]of _0x7d56f8[_0x15dec3(0x92)]()){if(_0x1f4707[_0x15dec3(0x82)]===0x1){_0x9bf974[_0x15dec3(0xb3)](_0x1f4707[0x0]);continue;}const _0x4c1a7e=_0x2319d0[_0x15dec3(0x8c)][_0x5c6b85],_0x43e473=_0x4c1a7e?.[_0x15dec3(0x98)],_0x4ae965=_0x43e473?_0x1f4707[_0x15dec3(0xa6)](_0x168d0d=>_0x168d0d[_0x15dec3(0xb4)]!==_0x43e473):_0x1f4707;if(_0x4c1a7e&&_0x4ae965[_0x15dec3(0x82)]===0x1){_0x9bf974['push'](_0x4ae965[0x0]);continue;}throw CliErrors[_0x15dec3(0x9f)](_0x15dec3(0x7c)+_0x5c6b85+'.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.');}return _0x9bf974;}export const sqlPush={'service':a190_0x3690d3(0x8a),'command':a190_0x3690d3(0xb3),'description':a190_0x3690d3(0x9e),'risk':a190_0x3690d3(0xb8),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a190_0x3690d3(0x84),'type':a190_0x3690d3(0x99),'description':'Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock'}],async 'dryRun'(_0x499b77){const _0x4ae603=a190_0x3690d3,_0x37cfe9=loadSqlProjectConfig(_0x499b77['appCode']),_0x4485e5=await readSqlLockFile(_0x37cfe9['lockFilePath']),{appLock:_0x1cdb73}=ensureSqlLockScope(_0x4485e5??createEmptySqlLock(),_0x499b77[_0x4ae603(0x7d)],_0x37cfe9[_0x4ae603(0x8f)],_0x4ae603(0xb3)),_0x5d7d84=await getTargetSqlQueries(_0x37cfe9,_0x1cdb73,_0x499b77[_0x4ae603(0x7e)]('sqlcode')||undefined),_0x2cb1e4=[];for(const _0x3d0a01 of _0x5d7d84){const _0x2e2d0a=await computeSqlFileHash(_0x3d0a01[_0x4ae603(0xaa)]),_0x3b5495=_0x1cdb73[_0x4ae603(0x8c)][_0x3d0a01[_0x4ae603(0x8b)]],_0x1047e5=!!_0x3b5495&&(_0x3b5495[_0x4ae603(0x98)]!==_0x3d0a01[_0x4ae603(0xb4)]||!!_0x3d0a01[_0x4ae603(0xa2)]&&_0x3b5495[_0x4ae603(0xa2)]!==_0x3d0a01[_0x4ae603(0xa2)]);if(!_0x499b77[_0x4ae603(0xb7)](_0x4ae603(0x84))&&_0x3b5495&&_0x3b5495[_0x4ae603(0x9a)]===_0x2e2d0a&&!_0x1047e5)continue;_0x2cb1e4[_0x4ae603(0xb3)](_0x3d0a01[_0x4ae603(0x8b)]);}return{'method':_0x4ae603(0xb5),'url':'/smartapi/custom/updateUserCustomSql','body':{'sqlCodes':_0x2cb1e4,'appCode':_0x499b77[_0x4ae603(0x7d)]},'description':_0x4ae603(0xab)+_0x2cb1e4[_0x4ae603(0x82)]+'\x20SQL\x20file(s)'};},async 'execute'(_0x28df56){const _0x598427=a190_0x3690d3,_0x3a7931=loadSqlProjectConfig(_0x28df56[_0x598427(0x7d)]),_0x377313=await readSqlLockFile(_0x3a7931[_0x598427(0xad)]),{lockData:_0xe9389e,appLock:_0x248ac0}=ensureSqlLockScope(_0x377313??createEmptySqlLock(),_0x28df56['appCode'],_0x3a7931[_0x598427(0x8f)],'push'),_0x5e63e9=await getTargetSqlQueries(_0x3a7931,_0x248ac0,_0x28df56[_0x598427(0x7e)]('sqlcode')||undefined);if(_0x5e63e9[_0x598427(0x82)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x598427(0xaf)};const _0x5b98c6=[],_0x2d963c=[],_0x47f8d8=[];for(const _0x128713 of _0x5e63e9){const _0x223eec=_0x248ac0[_0x598427(0x8c)][_0x128713[_0x598427(0x8b)]];if(!_0x223eec){_0x47f8d8[_0x598427(0xb3)]({'sqlCode':_0x128713[_0x598427(0x8b)],'error':_0x598427(0x7a)});continue;}try{const _0x441c51=await computeSqlFileHash(_0x128713[_0x598427(0xaa)]),_0x5d9a58=_0x223eec[_0x598427(0x98)]!==_0x128713[_0x598427(0xb4)]||!!_0x128713[_0x598427(0xa2)]&&_0x223eec[_0x598427(0xa2)]!==_0x128713['sqlName'];if(!_0x28df56[_0x598427(0xb7)](_0x598427(0x84))&&_0x223eec['hash']===_0x441c51&&!_0x5d9a58){_0x2d963c[_0x598427(0xb3)]({'sqlCode':_0x128713[_0x598427(0x8b)],'reason':_0x598427(0x80)});continue;}if(_0x223eec[_0x598427(0x95)]==null){_0x47f8d8[_0x598427(0xb3)]({'sqlCode':_0x128713[_0x598427(0x8b)],'error':_0x598427(0x83)});continue;}const _0x75dff4=await readFile(_0x128713['filePath'],_0x598427(0xa3)),_0x463816=stripLocalSqlMetadata(_0x75dff4,_0x128713[_0x598427(0xb6)]),_0x382db2=_0x128713['sqlName']||_0x223eec[_0x598427(0xa2)],_0x5c5f8d=await resolveTargetDbBinding(_0x28df56['appCode'],_0x128713,_0x223eec),_0x477509=await updateSqlQuery({'id':_0x223eec[_0x598427(0x9b)],'appCode':_0x28df56['appCode'],'sqlCode':_0x128713[_0x598427(0x8b)],'sqlName':_0x382db2,'dbId':_0x5c5f8d[_0x598427(0x91)],'version':_0x223eec[_0x598427(0x95)],'sqlContent':_0x463816,'sqlConfig':_0x223eec[_0x598427(0xb2)]??undefined}),_0x1e431a=_0x477509[_0x598427(0x91)]?await getDbName(_0x28df56['appCode'],Number(_0x477509[_0x598427(0x91)]))['catch'](()=>_0x5c5f8d[_0x598427(0x85)]):_0x5c5f8d['dbName'];_0x248ac0['sqls'][_0x128713[_0x598427(0x8b)]]={...buildSqlLockEntry(_0x477509,_0x463816,_0x441c51,{'dbName':_0x1e431a}),'path':_0x128713['relativePath'],'mode':_0x223eec['mode']},await archivePreviousSqlFileIfNeeded(_0x3a7931,_0x223eec[_0x598427(0x98)],_0x128713[_0x598427(0xb4)]),_0x5b98c6[_0x598427(0xb3)]({'sqlCode':_0x128713['sqlCode'],'remoteId':_0x223eec[_0x598427(0x9b)]});}catch(_0x26e3de){_0x47f8d8[_0x598427(0xb3)]({'sqlCode':_0x128713[_0x598427(0x8b)],'error':_0x26e3de instanceof Error?_0x26e3de[_0x598427(0x7f)]:String(_0x26e3de)});}}return _0x248ac0[_0x598427(0x7b)]=new Date()[_0x598427(0x88)](),await writeSqlLockFile(_0x3a7931['lockFilePath'],_0xe9389e),{'ok':_0x47f8d8[_0x598427(0x82)]===0x0,'data':{'pushed':_0x5b98c6,'skipped':_0x2d963c,'failed':_0x47f8d8},'message':_0x598427(0xa5)+_0x5b98c6['length']+'\x20pushed,\x20'+_0x2d963c[_0x598427(0x82)]+_0x598427(0xb9)+_0x47f8d8[_0x598427(0x82)]+_0x598427(0xac)};}};async function archivePreviousSqlFileIfNeeded(_0x9fcb30,_0x511bf6,_0x1a46c8){const _0x1687e1=a190_0x3690d3;if(!_0x511bf6||_0x511bf6===_0x1a46c8)return;const _0x49cb03=join(_0x9fcb30[_0x1687e1(0xa0)],_0x511bf6);if(!await fileExists(_0x49cb03))return;const _0x3a4d9e=await moveToTrash(_0x9fcb30['projectRoot'],_0x9fcb30[_0x1687e1(0x89)],_0x49cb03);await cleanupEmptyDirectories(dirname(_0x49cb03),_0x9fcb30['sqlRootDir']),void _0x3a4d9e;}async function moveToTrash(_0x57cafa,_0x57b50e,_0x2db67e){const _0xff9fc5=a190_0x3690d3,_0x314905=new Date()[_0xff9fc5(0x88)]()[_0xff9fc5(0x8d)](/[:.]/g,'-'),_0x1d285a=relative(_0x57cafa,_0x2db67e),_0x4d3afc=join(_0x57b50e,_0x314905,_0x1d285a);return await mkdir(dirname(_0x4d3afc),{'recursive':!![]}),await rename(_0x2db67e,_0x4d3afc),_0x4d3afc;}async function cleanupEmptyDirectories(_0x1b0a09,_0x5bdc36){const _0x1e9c91=a190_0x3690d3;let _0x67194=resolve(_0x1b0a09);const _0x28588b=resolve(_0x5bdc36);while(_0x67194[_0x1e9c91(0x8e)](''+_0x28588b+sep)||_0x67194===_0x28588b){if(_0x67194===_0x28588b)return;try{const _0x42e6c5=await readdir(_0x67194);if(_0x42e6c5['length']>0x0)return;await rmdir(_0x67194);}catch{return;}_0x67194=dirname(_0x67194);}}async function resolveTargetDbBinding(_0x8c3d03,_0x19eb65,_0xb5170e){const _0x586396=a190_0x3690d3,_0x90a812=_0x19eb65[_0x586396(0xa9)];if(!_0x90a812)return{'dbId':_0xb5170e[_0x586396(0x91)],'dbName':_0xb5170e[_0x586396(0x85)]};const _0x4c7d99=buildDbDirectoryName(_0xb5170e[_0x586396(0x85)],_0xb5170e[_0x586396(0x91)]);if(_0x90a812===_0x4c7d99)return{'dbId':_0xb5170e[_0x586396(0x91)],'dbName':_0xb5170e['dbName']};const _0x271159=parseExplicitDbDirectory(_0x90a812);if(_0x271159!=null)return{'dbId':_0x271159,'dbName':await getDbName(_0x8c3d03,_0x271159)[_0x586396(0x79)](()=>undefined)};const _0xb52d94=await listDatabases(_0x8c3d03),_0x2193f1=_0xb52d94['filter'](_0x235b46=>buildDbDirectoryName(_0x235b46[_0x586396(0x85)],_0x235b46[_0x586396(0x91)])===_0x90a812);if(_0x2193f1['length']===0x1)return{'dbId':_0x2193f1[0x0][_0x586396(0x91)],'dbName':_0x2193f1[0x0][_0x586396(0x85)]};if(_0x2193f1[_0x586396(0x82)]===0x0)throw CliErrors[_0x586396(0x9f)](_0x586396(0x9c)+_0x90a812+'\x22\x20for\x20sqlCode\x20'+_0x19eb65['sqlCode']+'.');const _0x3a1f1c=_0x2193f1[_0x586396(0xa8)](_0x32ba66=>_0x32ba66[_0x586396(0x85)]+'\x20('+_0x32ba66[_0x586396(0x91)]+')')[_0x586396(0xa1)](',\x20');throw CliErrors['validation'](_0x586396(0x93)+_0x90a812+'\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20'+_0x19eb65[_0x586396(0x8b)]+':\x20'+_0x3a1f1c);}function parseExplicitDbDirectory(_0x4c56d2){const _0x3d13cd=a190_0x3690d3,_0x30bec4=/^db-(\d+)$/['exec'](_0x4c56d2);if(!_0x30bec4)return null;const _0x3a13e0=Number(_0x30bec4[0x1]);return Number[_0x3d13cd(0xae)](_0x3a13e0)&&_0x3a13e0>0x0?_0x3a13e0:null;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a191_0x47a8bf=a191_0x46a7;(function(_0x4e350c,_0x249e3f){const _0x30495e=a191_0x46a7,_0xd791c1=_0x4e350c();while(!![]){try{const _0x20d4ce=parseInt(_0x30495e(0x1c7))/0x1+-parseInt(_0x30495e(0x1c2))/0x2*(-parseInt(_0x30495e(0x1b8))/0x3)+parseInt(_0x30495e(0x1b1))/0x4*(parseInt(_0x30495e(0x1d5))/0x5)+parseInt(_0x30495e(0x1ca))/0x6+-parseInt(_0x30495e(0x1ce))/0x7+parseInt(_0x30495e(0x1bb))/0x8+-parseInt(_0x30495e(0x1c3))/0x9;if(_0x20d4ce===_0x249e3f)break;else _0xd791c1['push'](_0xd791c1['shift']());}catch(_0x2b53e4){_0xd791c1['push'](_0xd791c1['shift']());}}}(a191_0x270b,0x47f77));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_0x47a8bf(0x1b7);function a191_0x270b(){const _0x23d32e=['sqlName','stdin','stderr','length','path','19828jURCOj','trim','mode','dbId','close','apps','.rabetbase/sql','6222sNwUTt','trimStart','mybatisXml','3028192MbHrcI','sqlRoot','sqlCode','lastSync','fromEntries','description','split','22XNyNcA','3221046QHUlvV','dbName','<!--\x20@lovrabet.','join','232252tbCUab','filter','endsWith','758340PeiRIz','\x20[y/N]\x20','sqlContent','map','3839388yIpFcd','--\x20@lovrabet.','\x20-->','toLowerCase','syncedAt','sqlConfig','version','445DLZuhu'];a191_0x270b=function(){return _0x23d32e;};return a191_0x270b();}export function buildSqlLockEntry(_0x4c3c36,_0x44bea7,_0x460da2,_0x13cbab){const _0x215f98=a191_0x47a8bf,_0x48c55b=detectSqlMode(_0x44bea7);return{'path':buildSqlRelativePath(_0x4c3c36[_0x215f98(0x1bd)],_0x4c3c36[_0x215f98(0x1ac)],_0x13cbab?.[_0x215f98(0x1c4)],_0x48c55b,_0x4c3c36[_0x215f98(0x1b4)]),'hash':_0x460da2,'remoteId':_0x4c3c36['id'],'version':_0x4c3c36[_0x215f98(0x1d4)],'dbId':Number(_0x4c3c36[_0x215f98(0x1b4)]),'dbName':_0x13cbab?.[_0x215f98(0x1c4)],'sqlName':_0x4c3c36[_0x215f98(0x1ac)],'sqlConfig':_0x4c3c36[_0x215f98(0x1d3)]??undefined,'mode':_0x48c55b};}export function cloneSqlLockData(_0x4ded65){const _0x2acd0d=a191_0x47a8bf;return{'apps':Object[_0x2acd0d(0x1bf)](Object['entries'](_0x4ded65[_0x2acd0d(0x1b6)])['map'](([_0x33c85a,_0x9d8519])=>[_0x33c85a,{'sqlRoot':_0x9d8519[_0x2acd0d(0x1bc)],'lastSync':_0x9d8519[_0x2acd0d(0x1be)],'sqls':{..._0x9d8519['sqls']}}]))};}export function ensureRemoteSqlContent(_0x1ed33e){const _0x4fa387=a191_0x47a8bf;return _0x1ed33e[_0x4fa387(0x1cc)]??'';}export function buildLocalSqlFileContent(_0x395069,_0x13af12,_0x30b352){const _0x4522ab=a191_0x47a8bf,_0x317b9b=_0x30b352?.[_0x4522ab(0x1b3)]??detectSqlMode(_0x13af12),_0x6f79e1=stripLocalSqlMetadata(_0x13af12,_0x317b9b)[_0x4522ab(0x1b2)](),_0x5f132d=[...buildMetadataHeaderLines({'sqlCode':_0x395069[_0x4522ab(0x1bd)],'sqlName':_0x395069[_0x4522ab(0x1ac)],'dbId':_0x395069[_0x4522ab(0x1b4)],'dbName':_0x30b352?.[_0x4522ab(0x1c4)],'mode':_0x317b9b,'syncedAt':_0x30b352?.[_0x4522ab(0x1d2)],'description':_0x30b352?.['description']},_0x317b9b),'',_0x6f79e1],_0x23875f=_0x5f132d['join']('\x0a');return _0x23875f[_0x4522ab(0x1c9)]('\x0a')?_0x23875f:_0x23875f+'\x0a';}export function stripLocalSqlMetadata(_0x37c671,_0x53c4ee){const _0x33854f=a191_0x47a8bf,_0x1d0ace=_0x37c671['replace'](/\r\n/g,'\x0a')[_0x33854f(0x1c1)]('\x0a'),_0x53abef=[];let _0x2c6fc9=0x0;if(_0x53c4ee==='mybatisXml')while(_0x2c6fc9<_0x1d0ace[_0x33854f(0x1af)]){const _0x4dd2ed=_0x1d0ace[_0x2c6fc9]??'';if(/^\s*<!--\s*@lovrabet\./['test'](_0x4dd2ed)){_0x2c6fc9++;continue;}if(_0x4dd2ed['trim']()===''&&_0x2c6fc9>0x0){_0x2c6fc9++;continue;}break;}else while(_0x2c6fc9<_0x1d0ace[_0x33854f(0x1af)]){const _0x2a1fcd=_0x1d0ace[_0x2c6fc9]??'';if(/^\s*--\s*@lovrabet\./['test'](_0x2a1fcd)){_0x2c6fc9++;continue;}if(_0x2a1fcd[_0x33854f(0x1b2)]()===''&&_0x2c6fc9>0x0){_0x2c6fc9++;continue;}break;}for(;_0x2c6fc9<_0x1d0ace['length'];_0x2c6fc9++){_0x53abef['push'](_0x1d0ace[_0x2c6fc9]);}return _0x53abef[_0x33854f(0x1c6)]('\x0a')[_0x33854f(0x1b9)]();}export function resolveSqlMode(_0x344658,_0x7187dc){const _0x18e275=a191_0x47a8bf;if(_0x7187dc?.[_0x18e275(0x1b3)])return _0x7187dc['mode'];return detectSqlMode(_0x344658);}export function resolveSqlFileName(_0x3ebbf6,_0x4e6a3b,_0x34a72d){const _0x55ceb3=a191_0x47a8bf;if(_0x34a72d?.[_0x55ceb3(0x1b0)])return _0x34a72d['path'];if(_0x34a72d?.['sqlName']||_0x34a72d?.['dbName'])return buildSqlRelativePath(_0x3ebbf6,_0x34a72d?.['sqlName'],_0x34a72d?.[_0x55ceb3(0x1c4)],resolveSqlMode(_0x4e6a3b,_0x34a72d),_0x34a72d?.[_0x55ceb3(0x1b4)]);return buildDefaultSqlFileName(_0x3ebbf6,resolveSqlMode(_0x4e6a3b,_0x34a72d));}export function resolveSqlLocalDir(_0x240b70,_0x548f9c){return join(_0x240b70,SQL_LOCAL_REL_DIR,_0x548f9c);}function a191_0x46a7(_0x47922d,_0x4cbdea){_0x47922d=_0x47922d-0x1ac;const _0x270b10=a191_0x270b();let _0x46a744=_0x270b10[_0x47922d];return _0x46a744;}export async function confirmForceOverwrite(_0x252fec){const _0x2e14cb=a191_0x47a8bf,_0x435ad3=createInterface({'input':process[_0x2e14cb(0x1ad)],'output':process[_0x2e14cb(0x1ae)]}),_0x441898=await new Promise(_0x56a9fd=>{const _0x2d4064=_0x2e14cb;_0x435ad3['question'](_0x252fec+_0x2d4064(0x1cb),_0x56a9fd);});return _0x435ad3[_0x2e14cb(0x1b5)](),['y','yes']['includes'](_0x441898[_0x2e14cb(0x1b2)]()[_0x2e14cb(0x1d1)]());}export function findSqlLockScope(_0x221a09,_0x1f50a0){const _0x16af0a=a191_0x47a8bf;return _0x221a09[_0x16af0a(0x1b6)][_0x1f50a0];}function buildMetadataHeaderLines(_0x35c015,_0x51dc82){const _0x2c43c6=a191_0x47a8bf,_0x375b65=[[_0x2c43c6(0x1bd),_0x35c015[_0x2c43c6(0x1bd)]],[_0x2c43c6(0x1ac),_0x35c015['sqlName']],[_0x2c43c6(0x1b4),_0x35c015[_0x2c43c6(0x1b4)]],[_0x2c43c6(0x1c4),_0x35c015[_0x2c43c6(0x1c4)]],['mode',_0x35c015[_0x2c43c6(0x1b3)]],[_0x2c43c6(0x1d2),_0x35c015[_0x2c43c6(0x1d2)]],['description',_0x35c015[_0x2c43c6(0x1c0)]]];if(_0x51dc82===_0x2c43c6(0x1ba))return _0x375b65[_0x2c43c6(0x1c8)](([,_0x4b9c77])=>_0x4b9c77!==undefined&&_0x4b9c77!==null&&String(_0x4b9c77)[_0x2c43c6(0x1b2)]()!=='')[_0x2c43c6(0x1cd)](([_0x10564a,_0x12d74c])=>_0x2c43c6(0x1c5)+_0x10564a+':\x20'+String(_0x12d74c)+_0x2c43c6(0x1d0));return _0x375b65[_0x2c43c6(0x1c8)](([,_0x2cea0d])=>_0x2cea0d!==undefined&&_0x2cea0d!==null&&String(_0x2cea0d)['trim']()!=='')[_0x2c43c6(0x1cd)](([_0x146169,_0x4a062d])=>_0x2c43c6(0x1cf)+_0x146169+':\x20'+String(_0x4a062d));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a192_0x409f62=a192_0x582d;(function(_0x18a3dd,_0x702461){const _0x396532=a192_0x582d,_0x3cd1b0=_0x18a3dd();while(!![]){try{const _0x2c978f=parseInt(_0x396532(0x125))/0x1+-parseInt(_0x396532(0x11b))/0x2+parseInt(_0x396532(0x120))/0x3*(-parseInt(_0x396532(0x122))/0x4)+-parseInt(_0x396532(0x114))/0x5+-parseInt(_0x396532(0x126))/0x6*(parseInt(_0x396532(0x11e))/0x7)+parseInt(_0x396532(0x10a))/0x8*(-parseInt(_0x396532(0x115))/0x9)+parseInt(_0x396532(0x11d))/0xa*(parseInt(_0x396532(0x118))/0xb);if(_0x2c978f===_0x702461)break;else _0x3cd1b0['push'](_0x3cd1b0['shift']());}catch(_0x41aae7){_0x3cd1b0['push'](_0x3cd1b0['shift']());}}}(a192_0x222e,0xe58f5));import{listSqlQueries}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';function a192_0x222e(){const _0x2e7ab6=['sqlRoot','filePath','456456giVLwo','690onGkln','path','read','map','has','bool','sqlCode','keys','length','\x20unchanged','169712ZgXNrT','\x20modified,\x20','relativePath','lockKey','\x20missing,\x20','totalCount','boolean','\x20added,\x20','status','appCode','8118185MYwicY','630RELbUd','push','lockFilePath','169598AZQtBL','sqlName','sqls','1201286wIxqPD','Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally','3730ZBnOSl','53620WnOxqm','sql','13449rJtvXL','All\x20SQL\x20queries\x20are\x20in\x20sync.','604wpVAoQ'];a192_0x222e=function(){return _0x2e7ab6;};return a192_0x222e();}import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile}from'../../core/sql-sync/lock.js';const PAGE_SIZE=0x64;async function fetchAllSqlCodes(_0xedffb){const _0x160817=a192_0x582d,_0xa5b4b4=[];let _0x27d0d7=0x1;while(!![]){const _0x4b7f61=await listSqlQueries(_0xedffb,{'currentPage':_0x27d0d7,'pageSize':PAGE_SIZE}),_0x17254f=_0x4b7f61['tableData']??[];_0xa5b4b4[_0x160817(0x116)](..._0x17254f[_0x160817(0x129)](_0x10f8a2=>_0x10f8a2[_0x160817(0x12c)]));if(_0x17254f[_0x160817(0x108)]===0x0)break;const _0x236fb1=_0x4b7f61['paging']?.[_0x160817(0x10f)];if(_0x236fb1!=null?_0xa5b4b4[_0x160817(0x108)]>=_0x236fb1:_0x17254f[_0x160817(0x108)]<PAGE_SIZE)break;_0x27d0d7++;}return _0xa5b4b4;}function a192_0x582d(_0x398b2f,_0x29607e){_0x398b2f=_0x398b2f-0x108;const _0x222e6c=a192_0x222e();let _0x582d7b=_0x222e6c[_0x398b2f];return _0x582d7b;}export const sqlStatus={'service':a192_0x409f62(0x11f),'command':'status','description':'Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','risk':a192_0x409f62(0x128),'flags':[{'name':'remote','type':a192_0x409f62(0x110),'description':a192_0x409f62(0x11c)}],async 'execute'(_0x22ef6){const _0x2b43ef=a192_0x409f62,_0x592f7c=loadSqlProjectConfig(_0x22ef6[_0x2b43ef(0x113)]),_0x58f9e5=await readSqlLockFile(_0x592f7c[_0x2b43ef(0x117)]),{appLock:_0x5dbe36}=ensureSqlLockScope(_0x58f9e5??createEmptySqlLock(),_0x592f7c[_0x2b43ef(0x113)],_0x592f7c[_0x2b43ef(0x123)],_0x2b43ef(0x112)),_0x241d05=await scanLocalSqlQueries(_0x592f7c),_0x5ec908=[],_0x2eb507=[],_0x494419=[],_0x1451c4=[],_0x11cfc8=new Set(_0x241d05['map'](_0x266023=>_0x266023[_0x2b43ef(0x10d)]));for(const _0x23de79 of _0x241d05){const _0x1db43=await computeSqlFileHash(_0x23de79[_0x2b43ef(0x124)]),_0x4bdf83=_0x5dbe36['sqls'][_0x23de79['lockKey']],_0x104613=!!_0x4bdf83&&_0x4bdf83[_0x2b43ef(0x127)]!==_0x23de79[_0x2b43ef(0x10c)],_0x271da6=!!_0x4bdf83&&!!_0x23de79['sqlName']&&_0x4bdf83[_0x2b43ef(0x119)]!==_0x23de79['sqlName'];if(!_0x4bdf83)_0x5ec908['push'](_0x23de79[_0x2b43ef(0x10d)]);else _0x4bdf83['hash']!==_0x1db43||_0x104613||_0x271da6?_0x2eb507[_0x2b43ef(0x116)](_0x23de79[_0x2b43ef(0x10d)]):_0x494419[_0x2b43ef(0x116)](_0x23de79['lockKey']);}for(const _0x8442cb of Object[_0x2b43ef(0x12d)](_0x5dbe36[_0x2b43ef(0x11a)])){!_0x11cfc8[_0x2b43ef(0x12a)](_0x8442cb)&&_0x1451c4[_0x2b43ef(0x116)](_0x8442cb);}const _0xf44187=[];if(_0x22ef6[_0x2b43ef(0x12b)]('remote')){const _0x1d56db=await fetchAllSqlCodes(_0x22ef6['appCode']);for(const _0x4c42f1 of _0x1d56db){!_0x11cfc8['has'](_0x4c42f1)&&!_0x5dbe36[_0x2b43ef(0x11a)][_0x4c42f1]&&_0xf44187['push'](_0x4c42f1);}}const _0x5e71e0=_0x5ec908[_0x2b43ef(0x108)]===0x0&&_0x2eb507[_0x2b43ef(0x108)]===0x0&&_0x1451c4[_0x2b43ef(0x108)]===0x0&&_0xf44187[_0x2b43ef(0x108)]===0x0;return{'ok':!![],'data':{'added':_0x5ec908,'modified':_0x2eb507,'missing':_0x1451c4,'unchanged':_0x494419,'remoteOnly':_0xf44187},'message':_0x5e71e0?_0x2b43ef(0x121):_0x5ec908[_0x2b43ef(0x108)]+_0x2b43ef(0x111)+_0x2eb507[_0x2b43ef(0x108)]+_0x2b43ef(0x10b)+_0x1451c4[_0x2b43ef(0x108)]+_0x2b43ef(0x10e)+_0x494419[_0x2b43ef(0x108)]+_0x2b43ef(0x109)+(_0xf44187[_0x2b43ef(0x108)]>0x0?',\x20'+_0xf44187[_0x2b43ef(0x108)]+'\x20remote-only':'')};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a193_0x3875a9=a193_0x227b;(function(_0x478dc8,_0x210e2a){const _0x47e982=a193_0x227b,_0x3f283b=_0x478dc8();while(!![]){try{const _0xa8ddcd=-parseInt(_0x47e982(0x227))/0x1*(parseInt(_0x47e982(0x1fd))/0x2)+parseInt(_0x47e982(0x1f0))/0x3*(parseInt(_0x47e982(0x1f2))/0x4)+parseInt(_0x47e982(0x211))/0x5+-parseInt(_0x47e982(0x209))/0x6+-parseInt(_0x47e982(0x232))/0x7+parseInt(_0x47e982(0x1ff))/0x8*(parseInt(_0x47e982(0x205))/0x9)+parseInt(_0x47e982(0x1f9))/0xa;if(_0xa8ddcd===_0x210e2a)break;else _0x3f283b['push'](_0x3f283b['shift']());}catch(_0x208f3a){_0x3f283b['push'](_0x3f283b['shift']());}}}(a193_0x340e,0xb12a2));import{readFileSync,existsSync}from'node:fs';import{resolve}from'node:path';import{validateSql}from'../../core/sql-validator.js';function a193_0x340e(){const _0x59b9b4=['isArray','schema:','1355065WBMNHd','fields','sql','boolean','tableName','str','pkField','index_type','toLowerCase','Table\x20\x22','push','length','indexName','read','primary','schemaWarnings','reason','Provide\x20--file\x20or\x20--sql','\x22\x20not\x20found\x20in\x20any\x20dataset','find','valid','isSelectOnly','1OWeiwL','parameters','isDangerous','message','Inline\x20SQL\x20content\x20to\x20validate\x20(alternative\x20to\x20--file)','columnNames','schemas','Path\x20to\x20the\x20SQL\x20file\x20to\x20validate','name','size','split','5070226sEJQyV','dataset','check-indexes','File\x20not\x20found:\x20','from','6peSFfb','trim','2113964MTrfGx','dbtableConfig','SQL\x20schema\x20validation','index_name','Comma-separated\x20dataset\x20codes\x20to\x20cross-check\x20table/column\x20names\x20against','indexes','type','11489330BqIJEE','validate','unshift','tables','2088986cJRrQH','--check-indexes\x20requires\x20--schemas.','16kAaaXe','bool','columns','map','file','flagMissing','874521UrPPuX','validation','flatMap','get','1060734QOtRCv','string','sqlType','filter','\x22\x20not\x20found\x20or\x20not\x20accessible','index_columns'];a193_0x340e=function(){return _0x59b9b4;};return a193_0x340e();}import{auditSqlJoinIndexes}from'../../core/sql-index-auditor.js';import{getDatasetDetail,listDatasets}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{assertDatasetIsDbTableBacked,filterDbTableBackedDatasets}from'../../commands/dataset/capability.js';function a193_0x227b(_0x550ad6,_0xfaf8a7){_0x550ad6=_0x550ad6-0x1f0;const _0x340e1f=a193_0x340e();let _0x227b68=_0x340e1f[_0x550ad6];return _0x227b68;}export const sqlValidate={'service':a193_0x3875a9(0x213),'command':a193_0x3875a9(0x1fa),'description':'Validate\x20SQL\x20content\x20without\x20saving\x20(type\x20detection,\x20parameter\x20extraction,\x20optional\x20schema\x20check)','risk':a193_0x3875a9(0x21e),'flags':[{'name':a193_0x3875a9(0x203),'type':'string','description':a193_0x3875a9(0x22e)},{'name':a193_0x3875a9(0x213),'type':a193_0x3875a9(0x20a),'description':a193_0x3875a9(0x22b)},{'name':a193_0x3875a9(0x22d),'type':a193_0x3875a9(0x20a),'description':a193_0x3875a9(0x1f6)},{'name':a193_0x3875a9(0x234),'type':a193_0x3875a9(0x214),'description':'Audit\x20top-level\x20JOIN\x20equality\x20predicates\x20against\x20dataset\x20index\x20metadata'}],async 'execute'(_0x4def2f){const _0x21f42=a193_0x3875a9,_0x164bd9=_0x4def2f[_0x21f42(0x216)]('file'),_0x13379b=_0x4def2f[_0x21f42(0x216)]('sql'),_0x592543=_0x4def2f[_0x21f42(0x216)](_0x21f42(0x22d)),_0xcda6fe=_0x4def2f[_0x21f42(0x200)](_0x21f42(0x234));if(!_0x164bd9&&!_0x13379b)throw CliErrors[_0x21f42(0x204)](_0x21f42(0x203),_0x21f42(0x222));if(_0xcda6fe&&!_0x592543)throw CliErrors[_0x21f42(0x206)](_0x21f42(0x1fe));let _0x3226c8;if(_0x164bd9){const _0x463e32=resolve(process['cwd'](),_0x164bd9);if(!existsSync(_0x463e32))throw CliErrors[_0x21f42(0x206)](_0x21f42(0x235)+_0x463e32);_0x3226c8=readFileSync(_0x463e32,'utf-8');}else _0x3226c8=_0x13379b;const _0x576e3c=validateSql(_0x3226c8),_0x195d60={'valid':_0x576e3c[_0x21f42(0x225)],'sqlType':_0x576e3c[_0x21f42(0x20b)][_0x21f42(0x1f8)],'isSelectOnly':_0x576e3c[_0x21f42(0x20b)][_0x21f42(0x226)],'isDangerous':_0x576e3c[_0x21f42(0x20b)][_0x21f42(0x229)],'tables':_0x576e3c[_0x21f42(0x1fc)],'parameters':_0x576e3c[_0x21f42(0x228)],'message':_0x576e3c[_0x21f42(0x22a)]};_0x576e3c[_0x21f42(0x20b)][_0x21f42(0x221)]&&(_0x195d60['reason']=_0x576e3c['sqlType'][_0x21f42(0x221)]);if(_0x592543&&_0x576e3c[_0x21f42(0x225)]){const _0x59421b=_0x592543[_0x21f42(0x231)](',')['map'](_0x3f90a3=>_0x3f90a3[_0x21f42(0x1f1)]())[_0x21f42(0x20c)](Boolean),_0x32760e=[],_0x3e8f6b=[],_0x52c054=filterDbTableBackedDatasets(await listDatasets(_0x4def2f['appCode'])),_0x2968a8=new Map(_0x52c054[_0x21f42(0x202)](_0x28cfbf=>[_0x28cfbf[_0x21f42(0x1f3)]?.[_0x21f42(0x215)]?.['toLowerCase'](),_0x28cfbf]));for(const _0x169b71 of _0x576e3c[_0x21f42(0x1fc)]){const _0x11eb69=_0x2968a8[_0x21f42(0x208)](_0x169b71[_0x21f42(0x219)]());!_0x11eb69&&_0x32760e[_0x21f42(0x21b)](_0x21f42(0x21a)+_0x169b71+_0x21f42(0x223));}for(const _0x354b08 of _0x59421b){let _0xd6d89e;try{_0xd6d89e=await getDatasetDetail(_0x354b08);}catch{_0x32760e[_0x21f42(0x21b)]('Dataset\x20\x22'+_0x354b08+_0x21f42(0x20d));continue;}assertDatasetIsDbTableBacked(_0xd6d89e,_0x21f42(0x1f4));const _0x59a763=Array['isArray'](_0xd6d89e[_0x21f42(0x212)])?_0xd6d89e[_0x21f42(0x212)]:[],_0x484599=new Set(_0x59a763[_0x21f42(0x202)](_0x69a3d3=>_0x69a3d3[_0x21f42(0x22f)]?.[_0x21f42(0x219)]())),_0x427987=_0xd6d89e['dbtableConfig']?.[_0x21f42(0x215)]||_0xd6d89e[_0x21f42(0x215)]||_0x354b08;_0x195d60[_0x21f42(0x210)+_0x427987]={'code':_0x354b08,'tableName':_0x427987,'fieldCount':_0x484599[_0x21f42(0x230)],'fields':Array[_0x21f42(0x236)](_0x484599)};if(_0xcda6fe){const _0x50a3a4=normalizeDatasetIndexes(_0xd6d89e);_0x3e8f6b['push']({'tableName':_0x427987,..._0x50a3a4});}}_0x32760e[_0x21f42(0x21c)]>0x0&&(_0x195d60[_0x21f42(0x220)]=_0x32760e),_0xcda6fe&&(_0x195d60['joinAudit']=auditSqlJoinIndexes(_0x3226c8,_0x3e8f6b));}return{'ok':_0x576e3c[_0x21f42(0x225)],'data':_0x195d60,'message':_0x576e3c[_0x21f42(0x22a)]};}};function normalizeDatasetIndexes(_0x2b2230){const _0x393f68=a193_0x3875a9,_0xd6c8cf=Array[_0x393f68(0x20f)](_0x2b2230?.[_0x393f68(0x233)]?.['indexes'])?_0x2b2230[_0x393f68(0x233)][_0x393f68(0x1f7)]:Array[_0x393f68(0x20f)](_0x2b2230?.['indexes'])?_0x2b2230[_0x393f68(0x1f7)]:[],_0x320fb2=_0xd6c8cf[_0x393f68(0x207)](_0x4ac45d=>{const _0x3662c1=_0x393f68,_0xc5b308=Array[_0x3662c1(0x20f)](_0x4ac45d?.[_0x3662c1(0x20e)])?_0x4ac45d[_0x3662c1(0x20e)]:Array[_0x3662c1(0x20f)](_0x4ac45d?.['columnNames'])?_0x4ac45d[_0x3662c1(0x22c)]:Array[_0x3662c1(0x20f)](_0x4ac45d?.[_0x3662c1(0x201)])?_0x4ac45d[_0x3662c1(0x201)]:[],_0x333b65=_0xc5b308[_0x3662c1(0x20c)](_0x54b178=>typeof _0x54b178===_0x3662c1(0x20a))['map'](_0x2139b0=>_0x2139b0['trim']())[_0x3662c1(0x20c)](Boolean);if(_0x333b65[_0x3662c1(0x21c)]===0x0)return[];const _0x3cd92d=[_0x4ac45d?.[_0x3662c1(0x21d)],_0x4ac45d?.[_0x3662c1(0x1f5)],_0x4ac45d?.['name']][_0x3662c1(0x224)](_0x27769c=>typeof _0x27769c==='string'&&_0x27769c['trim']()),_0x35abd9=[_0x4ac45d?.[_0x3662c1(0x218)],_0x4ac45d?.['type']][_0x3662c1(0x224)](_0x53c18b=>typeof _0x53c18b===_0x3662c1(0x20a)&&_0x53c18b[_0x3662c1(0x1f1)]());return[{..._0x3cd92d?{'name':_0x3cd92d[_0x3662c1(0x1f1)]()}:{},..._0x35abd9?{'type':_0x35abd9[_0x3662c1(0x1f1)]()}:{},'columns':_0x333b65}];}),_0x282a75=[..._0x320fb2],_0x5e658a=typeof _0x2b2230?.[_0x393f68(0x1f3)]?.[_0x393f68(0x217)]===_0x393f68(0x20a)?_0x2b2230[_0x393f68(0x1f3)][_0x393f68(0x217)]['split'](',')['map'](_0xa4f353=>_0xa4f353['trim']())[_0x393f68(0x20c)](Boolean):[];return _0x5e658a[_0x393f68(0x21c)]>0x0&&_0x282a75[_0x393f68(0x1fb)]({'type':_0x393f68(0x21f),'columns':_0x5e658a}),{'indexes':_0x282a75,'metadataAvailable':_0x320fb2['length']>0x0};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a194_0x48a4(_0x37f70b,_0x2848d2){_0x37f70b=_0x37f70b-0x17b;const _0x5551c7=a194_0x5551();let _0x48a49b=_0x5551c7[_0x37f70b];return _0x48a49b;}function a194_0x5551(){const _0x469860=['5619411mTsqKx','529242EjNVHp','3720GgvnMT','22923yyrYsU','4pObApx','300WbnCAS','1207317QVIVZf','1200524jmJafy','11450HDrnAw','6210008PDEgpS'];a194_0x5551=function(){return _0x469860;};return a194_0x5551();}(function(_0x52c4ff,_0x569df5){const _0x252d39=a194_0x48a4,_0x48decf=_0x52c4ff();while(!![]){try{const _0x960413=-parseInt(_0x252d39(0x184))/0x1+parseInt(_0x252d39(0x180))/0x2+-parseInt(_0x252d39(0x17f))/0x3*(parseInt(_0x252d39(0x17d))/0x4)+-parseInt(_0x252d39(0x181))/0x5*(-parseInt(_0x252d39(0x17e))/0x6)+parseInt(_0x252d39(0x183))/0x7+parseInt(_0x252d39(0x182))/0x8+parseInt(_0x252d39(0x17c))/0x9*(-parseInt(_0x252d39(0x17b))/0xa);if(_0x960413===_0x569df5)break;else _0x48decf['push'](_0x48decf['shift']());}catch(_0x1112b7){_0x48decf['push'](_0x48decf['shift']());}}}(a194_0x5551,0x6539d));import{taskStatus}from'../../commands/task/status.js';export const taskDefinitions=[taskStatus];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a195_0x38d749=a195_0x4cc5;function a195_0x1b51(){const _0x3f8b95=['taskId','flagMissing','appCode','Task\x20status\x20response\x20id\x20mismatch:\x20requested\x20','compress','apiError','2877624LheamF','task-id','str','isTerminal','cookie','1895208okZLOK','status','368202hOCiHo','4968250EmSkAT','string','task','trim','887621sWKpwD','1067350fkHTww','2587628qfdWjP'];a195_0x1b51=function(){return _0x3f8b95;};return a195_0x1b51();}(function(_0x265b4a,_0x432346){const _0x52854d=a195_0x4cc5,_0x2bbd79=_0x265b4a();while(!![]){try{const _0x1147c1=parseInt(_0x52854d(0xc8))/0x1+-parseInt(_0x52854d(0xc0))/0x2+parseInt(_0x52854d(0xbb))/0x3+parseInt(_0x52854d(0xc9))/0x4+-parseInt(_0x52854d(0xc3))/0x5+-parseInt(_0x52854d(0xc2))/0x6+-parseInt(_0x52854d(0xc7))/0x7;if(_0x1147c1===_0x432346)break;else _0x2bbd79['push'](_0x2bbd79['shift']());}catch(_0x4ecb7d){_0x2bbd79['push'](_0x2bbd79['shift']());}}}(a195_0x1b51,0x84d29));function a195_0x4cc5(_0x2d1cf2,_0x6ceb76){_0x2d1cf2=_0x2d1cf2-0xb8;const _0x1b511b=a195_0x1b51();let _0x4cc56d=_0x1b511b[_0x2d1cf2];return _0x4cc56d;}import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asyncTaskMessage,buildAsyncTaskStatusCommand,normalizeAsyncTask}from'../../commands/common/async-task.js';import{getAsyncTaskStatus}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';export const taskStatus={'service':a195_0x38d749(0xc5),'command':a195_0x38d749(0xc1),'description':'Query\x20an\x20asynchronous\x20task;\x20repeat\x20for\x20PENDING\x20or\x20PROCESSING\x20until\x20SUCCESS\x20or\x20FAILED','risk':'read','defaultOutputFormat':a195_0x38d749(0xb9),'structuredErrors':!![],'flags':[{'name':'task-id','type':a195_0x38d749(0xc4),'required':!![],'description':'Task\x20id\x20returned\x20by\x20an\x20asynchronous\x20platform\x20command'},APPCODE_FLAG_OPTIONAL],async 'validate'(_0xbf1a9a){const _0x1f72e2=a195_0x38d749;if(!_0xbf1a9a[_0x1f72e2(0xbd)](_0x1f72e2(0xbc))[_0x1f72e2(0xc6)]())throw CliErrors[_0x1f72e2(0xcb)](_0x1f72e2(0xbc));},async 'execute'(_0x100bb6){const _0x2d6219=a195_0x38d749,_0x1a1795=_0x100bb6[_0x2d6219(0xbd)](_0x2d6219(0xbc))['trim'](),_0x81f8fc=normalizeAsyncTask(await getAsyncTaskStatus(_0x1a1795,_0x100bb6['appCode'],_0x100bb6[_0x2d6219(0xbf)]));if(_0x81f8fc[_0x2d6219(0xca)]!==_0x1a1795)throw CliErrors[_0x2d6219(0xba)](_0x2d6219(0xb8)+_0x1a1795+',\x20received\x20'+_0x81f8fc['taskId']+'.');const _0x2fefa7=buildAsyncTaskStatusCommand(_0x81f8fc[_0x2d6219(0xca)],_0x100bb6[_0x2d6219(0xcc)]);return{'ok':!![],'message':asyncTaskMessage(_0x81f8fc),'data':{'appCode':_0x100bb6[_0x2d6219(0xcc)],..._0x81f8fc,'query':_0x81f8fc[_0x2d6219(0xbe)]?null:{'command':_0x2fefa7}}};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a196_0x2989(_0x465c2b,_0x1c5230){_0x465c2b=_0x465c2b-0x15d;const _0x1d3ec5=a196_0x1d3e();let _0x298901=_0x1d3ec5[_0x465c2b];return _0x298901;}(function(_0x1a78e1,_0x2fbaed){const _0x917ff2=a196_0x2989,_0x2c20d6=_0x1a78e1();while(!![]){try{const _0x111bd7=-parseInt(_0x917ff2(0x165))/0x1*(parseInt(_0x917ff2(0x15f))/0x2)+-parseInt(_0x917ff2(0x161))/0x3+parseInt(_0x917ff2(0x15d))/0x4+-parseInt(_0x917ff2(0x160))/0x5*(parseInt(_0x917ff2(0x166))/0x6)+-parseInt(_0x917ff2(0x167))/0x7*(parseInt(_0x917ff2(0x164))/0x8)+-parseInt(_0x917ff2(0x163))/0x9+-parseInt(_0x917ff2(0x162))/0xa*(-parseInt(_0x917ff2(0x15e))/0xb);if(_0x111bd7===_0x2fbaed)break;else _0x2c20d6['push'](_0x2c20d6['shift']());}catch(_0x289650){_0x2c20d6['push'](_0x2c20d6['shift']());}}}(a196_0x1d3e,0xf0c6f));function a196_0x1d3e(){const _0x47f34b=['11wyuFnd','34988IjfuGK','325bzhGHT','5872905FvhhQB','80484220rHbUHC','11969082yBZuzD','176DRDAJb','91uQQGYv','179190gCZOFm','415639iytKZq','4259228NqNsBR'];a196_0x1d3e=function(){return _0x47f34b;};return a196_0x1d3e();}import{tenantMembersListDefinition}from'../../commands/tenant/members-list.js';export const tenantDefinitions=[tenantMembersListDefinition];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a197_0x54549f=a197_0x3e23;function a197_0x3e23(_0xb24196,_0x3af9e){_0xb24196=_0xb24196-0x88;const _0x546fe5=a197_0x546f();let _0x3e232e=_0x546fe5[_0xb24196];return _0x3e232e;}(function(_0x36b59a,_0xc8ded9){const _0x2f2bb0=a197_0x3e23,_0xfcde1f=_0x36b59a();while(!![]){try{const _0x643902=parseInt(_0x2f2bb0(0x95))/0x1*(parseInt(_0x2f2bb0(0x8d))/0x2)+-parseInt(_0x2f2bb0(0x91))/0x3*(parseInt(_0x2f2bb0(0x9a))/0x4)+parseInt(_0x2f2bb0(0x89))/0x5+-parseInt(_0x2f2bb0(0x93))/0x6*(-parseInt(_0x2f2bb0(0x8c))/0x7)+parseInt(_0x2f2bb0(0x96))/0x8+parseInt(_0x2f2bb0(0x9e))/0x9*(parseInt(_0x2f2bb0(0x9b))/0xa)+-parseInt(_0x2f2bb0(0x8b))/0xb*(parseInt(_0x2f2bb0(0x9d))/0xc);if(_0x643902===_0xc8ded9)break;else _0xfcde1f['push'](_0xfcde1f['shift']());}catch(_0x33c38c){_0xfcde1f['push'](_0xfcde1f['shift']());}}}(a197_0x546f,0xc6eb4));import{listCurrentUserTenantMemberships,listTenantDirectoryMembers}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';function a197_0x546f(){const _0xe8fd4a=['113771ExuPBc','34666AAJMrJ','string','Exact\x20tenant\x20code','List\x20members\x20of\x20a\x20tenant\x20available\x20to\x20the\x20current\x20account','2323911HwERmc','read','42NBKwwr','Pass\x20--tenant-code\x20<code>.','46mQYgfj','153048HjnSkA','flagMissing','Found\x20','tenant','4KvlcPp','67650CnHhKo','trim','1730568GJZYMu','1332CaKzvw','tenant-code','length','6942685dAZTax','str','132RTpwBU'];a197_0x546f=function(){return _0xe8fd4a;};return a197_0x546f();}import{assertTenantAccessible,projectTenantMembers}from'../../commands/tenant/shared.js';export const tenantMembersListDefinition={'service':a197_0x54549f(0x99),'command':'members-list','description':a197_0x54549f(0x90),'risk':a197_0x54549f(0x92),'requiresAuth':!![],'requiresAppCode':![],'structuredErrors':!![],'flags':[{'name':a197_0x54549f(0x9f),'type':a197_0x54549f(0x8e),'required':!![],'description':a197_0x54549f(0x8f)}],async 'validate'(_0x3bfde4){const _0x24d94e=a197_0x54549f;if(!_0x3bfde4[_0x24d94e(0x8a)]('tenant-code')[_0x24d94e(0x9c)]())throw CliErrors[_0x24d94e(0x97)](_0x24d94e(0x9f),_0x24d94e(0x94));},async 'execute'(_0x236469){const _0x350bda=a197_0x54549f,_0x29524d=_0x236469[_0x350bda(0x8a)]('tenant-code')[_0x350bda(0x9c)](),_0x48a0e0=await listCurrentUserTenantMemberships();assertTenantAccessible(_0x29524d,_0x48a0e0);const _0x1a9dad=projectTenantMembers(await listTenantDirectoryMembers(_0x29524d));return{'ok':!![],'data':{'tenantCode':_0x29524d,'items':_0x1a9dad,'totalCount':_0x1a9dad[_0x350bda(0x88)]},'message':_0x350bda(0x98)+_0x1a9dad['length']+'\x20tenant\x20member(s)'};}};
|