@lovrabet/rabetbase-cli 2.4.3-beta.1 → 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 +1 -1
- 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_0x2d4931=a183_0x5729;(function(_0x11da34,_0x2cb730){const _0x2d22c8=a183_0x5729,_0x498f7f=_0x11da34();while(!![]){try{const _0x439e07=-parseInt(_0x2d22c8(0x1dc))/0x1*(parseInt(_0x2d22c8(0x1fd))/0x2)+parseInt(_0x2d22c8(0x1cb))/0x3*(-parseInt(_0x2d22c8(0x1f4))/0x4)+parseInt(_0x2d22c8(0x208))/0x5*(-parseInt(_0x2d22c8(0x205))/0x6)+-parseInt(_0x2d22c8(0x206))/0x7+parseInt(_0x2d22c8(0x1da))/0x8*(parseInt(_0x2d22c8(0x1e7))/0x9)+parseInt(_0x2d22c8(0x1e2))/0xa*(-parseInt(_0x2d22c8(0x1cf))/0xb)+parseInt(_0x2d22c8(0x1d3))/0xc;if(_0x439e07===_0x2cb730)break;else _0x498f7f['push'](_0x498f7f['shift']());}catch(_0x3aaf04){_0x498f7f['push'](_0x498f7f['shift']());}}}(a183_0x2f1b,0xa61d6));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(_0x697af1){const _0x1bb9fd=a183_0x5729;if(_0x697af1===_0x1bb9fd(0x204))return['<select\x20id=\x22query\x22\x20resultType=\x22map\x22>',_0x1bb9fd(0x1ef),_0x1bb9fd(0x20b),''][_0x1bb9fd(0x1f7)]('\x0a');return[_0x1bb9fd(0x1d0),''][_0x1bb9fd(0x1f7)]('\x0a');}function a183_0x5729(_0x1d04c5,_0x1585c5){_0x1d04c5=_0x1d04c5-0x1c8;const _0x2f1bfe=a183_0x2f1b();let _0x572938=_0x2f1bfe[_0x1d04c5];return _0x572938;}export const sqlCreate={'service':a183_0x2d4931(0x1cc),'command':a183_0x2d4931(0x1fe),'description':a183_0x2d4931(0x1d2),'risk':a183_0x2d4931(0x1d5),'flags':[{'name':a183_0x2d4931(0x20a),'type':a183_0x2d4931(0x1c8),'description':a183_0x2d4931(0x200)},{'name':a183_0x2d4931(0x1e0),'type':'number','description':a183_0x2d4931(0x1dd)},{'name':a183_0x2d4931(0x201),'type':'string','enum':[a183_0x2d4931(0x1cc),a183_0x2d4931(0x204)],'description':a183_0x2d4931(0x1d6)}],async 'validate'(_0x5e07eb){const _0x37499e=a183_0x2d4931;if(!_0x5e07eb[_0x37499e(0x1de)])return;if(!_0x5e07eb['str']('name')[_0x37499e(0x1e8)]())throw CliErrors[_0x37499e(0x1fa)](_0x37499e(0x20a),_0x37499e(0x1f5));const _0x18ae13=resolveProvidedDbId(_0x5e07eb);if(typeof _0x18ae13!==_0x37499e(0x1d7)||!Number[_0x37499e(0x1e4)](_0x18ae13)||_0x18ae13<=0x0)throw CliErrors[_0x37499e(0x1fa)](_0x37499e(0x1e0),_0x37499e(0x1f8));if(!_0x5e07eb[_0x37499e(0x1f6)]('mode')[_0x37499e(0x1e8)]())throw CliErrors['flagMissing']('mode',_0x37499e(0x1cd));},async 'dryRun'(_0x488fa6){const _0x4a2192=a183_0x2d4931,_0x5272ad=loadSqlProjectConfig(_0x488fa6[_0x4a2192(0x1d9)]),{sqlName:_0xb3a4d0,dbId:_0x107a54,dbName:_0x2afa2e,mode:_0x306d2f}=await resolveSqlNewInputs(_0x488fa6),_0xc860b8=buildSqlRelativePath('<server-generated-sqlCode>',_0xb3a4d0,_0x2afa2e,_0x306d2f,_0x107a54),_0x3cf391=_0x5272ad[_0x4a2192(0x1f1)]+'/'+_0xc860b8;return{'method':_0x4a2192(0x1ea),'url':_0x4a2192(0x1ee),'body':{'appCode':_0x488fa6[_0x4a2192(0x1d9)],'sqlName':_0xb3a4d0,'dbId':_0x107a54,'mode':_0x306d2f,'localPath':_0x3cf391},'description':'Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20'+_0x5272ad['sqlRootDir']};},async 'execute'(_0x21fda9){const _0x19c420=a183_0x2d4931,_0x14b17c=loadSqlProjectConfig(_0x21fda9['appCode']),{sqlName:_0x4de795,dbId:_0x196554,dbName:_0x52debb,mode:_0x1051ea}=await resolveSqlNewInputs(_0x21fda9),_0xb208a9=generateSqlTemplate(_0x1051ea),_0x2f4723=await createSqlQuery({'appCode':_0x21fda9['appCode'],'sqlName':_0x4de795,'dbId':_0x196554,'sqlContent':_0xb208a9}),_0x573e20=ensureRemoteSqlContent(_0x2f4723),_0x4715ea=_0x52debb||await getDbName(_0x21fda9[_0x19c420(0x1d9)],_0x196554)[_0x19c420(0x1ed)](()=>undefined),_0x4628ff=buildSqlRelativePath(_0x2f4723[_0x19c420(0x1d4)],_0x2f4723['sqlName'],_0x4715ea,_0x1051ea,_0x196554),_0x4f458c=_0x14b17c[_0x19c420(0x1f1)]+'/'+_0x4628ff,_0xfa1a7e=buildLocalSqlFileContent({'sqlCode':_0x2f4723['sqlCode'],'sqlName':_0x2f4723[_0x19c420(0x1c9)],'dbId':_0x2f4723['dbId']},_0x573e20,{'dbName':_0x4715ea,'mode':_0x1051ea,'syncedAt':new Date()[_0x19c420(0x1eb)](),'description':_0x2f4723[_0x19c420(0x1f2)]});if(await fileExists(_0x4f458c))throw CliErrors[_0x19c420(0x1e3)](_0x19c420(0x1e5)+_0x4f458c);await ensureParentDirectory(_0x4f458c),await writeFile(_0x4f458c,_0xfa1a7e,_0x19c420(0x1f0));const _0x41b81a=await readSqlLockFile(_0x14b17c['lockFilePath']),{lockData:_0x1318e4,appLock:_0x14ea85}=ensureSqlLockScope(_0x41b81a??createEmptySqlLock(),_0x14b17c[_0x19c420(0x1d9)],_0x14b17c[_0x19c420(0x207)],_0x19c420(0x20d));return _0x14ea85['sqls'][_0x2f4723[_0x19c420(0x1d4)]]={...buildSqlLockEntry(_0x2f4723,_0x573e20,computeSqlContentHash(_0xfa1a7e),{'dbName':_0x4715ea}),'path':_0x4628ff,'mode':_0x1051ea},_0x14ea85[_0x19c420(0x1e1)]=new Date()['toISOString'](),await writeSqlLockFile(_0x14b17c[_0x19c420(0x1f9)],_0x1318e4),{'ok':!![],'data':{'id':_0x2f4723['id'],'sqlCode':_0x2f4723[_0x19c420(0x1d4)],'sqlName':_0x2f4723[_0x19c420(0x1c9)],'dbId':_0x2f4723[_0x19c420(0x1fb)],'path':_0x4f458c,'mode':_0x1051ea},'message':'Created\x20SQL\x20query\x20'+_0x2f4723[_0x19c420(0x1d4)]};}};async function resolveSqlNewInputs(_0x5ec232){const _0x22309c=await resolveSqlNameInput(_0x5ec232),{dbId:_0x28287c,dbName:_0x3af80a}=await resolveDbSelection(_0x5ec232),_0x11fbaf=await resolveSqlModeInput(_0x5ec232);return{'sqlName':_0x22309c,'dbId':_0x28287c,'dbName':_0x3af80a,'mode':_0x11fbaf};}async function resolveSqlNameInput(_0x14fb02){const _0x4afec5=a183_0x2d4931,_0x590705=_0x14fb02[_0x4afec5(0x1f6)](_0x4afec5(0x20a))[_0x4afec5(0x1e8)]();if(_0x590705)return _0x590705;if(_0x14fb02['nonInteractive'])throw CliErrors[_0x4afec5(0x1fa)](_0x4afec5(0x20a),_0x4afec5(0x1f5));return(await input({'message':'请输入\x20SQL\x20名称:','validate':_0x4eb17d=>_0x4eb17d[_0x4afec5(0x1e8)]()?!![]:_0x4afec5(0x1ec)}))[_0x4afec5(0x1e8)]();}async function resolveDbSelection(_0x1a0636){const _0x187050=a183_0x2d4931,_0x2da4a4=resolveProvidedDbId(_0x1a0636);if(typeof _0x2da4a4==='number'&&Number[_0x187050(0x1e4)](_0x2da4a4)&&_0x2da4a4>0x0)return{'dbId':_0x2da4a4,'dbName':await getDbName(_0x1a0636[_0x187050(0x1d9)],_0x2da4a4)[_0x187050(0x1ed)](()=>undefined)};if(_0x1a0636[_0x187050(0x1de)])throw CliErrors[_0x187050(0x1fa)]('db-id',_0x187050(0x1f8));const _0x36b377=await listDatabases(_0x1a0636[_0x187050(0x1d9)])[_0x187050(0x1ed)](()=>[]);if(_0x36b377[_0x187050(0x1f3)]===0x1)return{'dbId':_0x36b377[0x0][_0x187050(0x1fb)],'dbName':_0x36b377[0x0][_0x187050(0x1d8)]};if(_0x36b377[_0x187050(0x1f3)]>0x1){const _0x1760f4=await select({'message':_0x187050(0x1fc),'choices':[..._0x36b377['map'](_0x599e0b=>({'name':_0x599e0b[_0x187050(0x1d8)]+'\x20('+_0x599e0b[_0x187050(0x1fb)]+')','value':serializeDbSelection(_0x599e0b)})),{'name':_0x187050(0x1db),'value':_0x187050(0x203)}]});if(_0x1760f4!==_0x187050(0x203))return deserializeDbSelection(_0x1760f4);}const _0x4ceff6=await input({'message':_0x187050(0x1ff),'validate':_0x3929ec=>{const _0x4d624e=_0x187050,_0x2aa335=_0x3929ec[_0x4d624e(0x1e8)]();if(!_0x2aa335)return _0x4d624e(0x209);const _0x72114f=Number(_0x2aa335);if(!Number[_0x4d624e(0x1e9)](_0x72114f)||_0x72114f<=0x0)return _0x4d624e(0x1df);return!![];}});return{'dbId':Number(_0x4ceff6['trim']())};}async function resolveSqlModeInput(_0x388420){const _0x1e4423=a183_0x2d4931,_0x4e87d5=_0x388420['str'](_0x1e4423(0x201))[_0x1e4423(0x1e8)]();if(_0x4e87d5===_0x1e4423(0x1cc)||_0x4e87d5===_0x1e4423(0x204))return _0x4e87d5;if(_0x388420[_0x1e4423(0x1de)])throw CliErrors[_0x1e4423(0x1fa)](_0x1e4423(0x201),'--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');return await select({'message':'请选择本地\x20SQL\x20模式:','choices':[{'name':_0x1e4423(0x20c),'value':_0x1e4423(0x1cc),'description':_0x1e4423(0x202)},{'name':_0x1e4423(0x1e6),'value':'mybatisXml','description':'适合带动态标签的\x20MyBatis\x20XML\x20SQL'}]});}function serializeDbSelection(_0x19df51){const _0x3f5222=a183_0x2d4931;return JSON[_0x3f5222(0x1d1)]({'dbId':_0x19df51[_0x3f5222(0x1fb)],'dbName':_0x19df51[_0x3f5222(0x1d8)]});}function deserializeDbSelection(_0x357409){const _0x57b0be=a183_0x2d4931;try{const _0x331433=JSON[_0x57b0be(0x1ce)](_0x357409);if(typeof _0x331433[_0x57b0be(0x1fb)]===_0x57b0be(0x1d7)&&Number[_0x57b0be(0x1e4)](_0x331433['dbId']))return{'dbId':_0x331433['dbId'],'dbName':_0x331433[_0x57b0be(0x1d8)]};}catch{}throw CliErrors[_0x57b0be(0x1e3)](_0x57b0be(0x1ca)+_0x357409);}function resolveProvidedDbId(_0x425f96){const _0x286aba=a183_0x2d4931,_0x58b893=_0x425f96['flag'](_0x286aba(0x1e0));if(typeof _0x58b893==='number'&&Number[_0x286aba(0x1e4)](_0x58b893))return _0x58b893;return undefined;}function a183_0x2f1b(){const _0xddcbeb=['普通\x20SQL(sql)','new','string','sqlName','Invalid\x20database\x20selection\x20payload:\x20','1083252eozMXl','sql','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','parse','9611481CNEAeK','SELECT\x201\x20AS\x20id;','stringify','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','45325296OzAByB','sqlCode','write','Local\x20SQL\x20file\x20mode','number','dbName','appCode','416YQZRtV','✎\x20手动输入\x20dbId','5433QUPfWB','Target\x20database\x20ID','nonInteractive','dbId\x20必须为正整数','db-id','lastSync','10dnBFZp','validation','isFinite','File\x20already\x20exists:\x20','MyBatis\x20XML(mybatisXml)','216CgaBwd','trim','isInteger','POST','toISOString','SQL\x20名称不能为空','catch','/smartapi/custom/saveUserCustomSql','\x20\x20SELECT\x201\x20AS\x20id','utf8','sqlRootDir','description','length','4pziBDO','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','str','join','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','lockFilePath','flagMissing','dbId','请选择目标数据库:','54HdnLqR','create','请输入目标数据库\x20dbId:','SQL\x20query\x20display\x20name','mode','适合直接执行的普通\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20语句','__manual__','mybatisXml','1726242JRqMnV','5972981JDveWK','sqlRoot','15uiLwMo','dbId\x20不能为空','name','</select>'];a183_0x2f1b=function(){return _0xddcbeb;};return a183_0x2f1b();}
|
|
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
|
-
function
|
|
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
|
-
|
|
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
|
-
|
|
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_0x1a1019=a189_0x12f1;(function(_0x5c60fe,_0x200308){const _0x5393ec=a189_0x12f1,_0x55d3b5=_0x5c60fe();while(!![]){try{const _0x4b04ea=-parseInt(_0x5393ec(0xbd))/0x1*(parseInt(_0x5393ec(0xdd))/0x2)+parseInt(_0x5393ec(0xe6))/0x3*(parseInt(_0x5393ec(0xaf))/0x4)+-parseInt(_0x5393ec(0xb6))/0x5*(parseInt(_0x5393ec(0xae))/0x6)+-parseInt(_0x5393ec(0xbf))/0x7+-parseInt(_0x5393ec(0xe1))/0x8*(-parseInt(_0x5393ec(0xad))/0x9)+-parseInt(_0x5393ec(0xd2))/0xa*(-parseInt(_0x5393ec(0xb9))/0xb)+-parseInt(_0x5393ec(0xc4))/0xc;if(_0x4b04ea===_0x200308)break;else _0x55d3b5['push'](_0x55d3b5['shift']());}catch(_0x1509cf){_0x55d3b5['push'](_0x55d3b5['shift']());}}}(a189_0x5333,0x513ad));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';function a189_0x12f1(_0x26f9dc,_0x2bdea5){_0x26f9dc=_0x26f9dc-0xa6;const _0x533323=a189_0x5333();let _0x12f1f6=_0x533323[_0x26f9dc];return _0x12f1f6;}import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x1c4ff8,_0x1d6a9d){const _0x770298=a189_0x12f1,_0x670080=[];let _0x307981=0x1;while(!![]){const _0x367daa=await listSqlQueries(_0x1c4ff8,{'currentPage':_0x307981,'pageSize':PAGE_SIZE,'sqlCode':_0x1d6a9d[_0x770298(0xe3)],'sqlName':_0x1d6a9d['sqlName']}),_0x4cd6b4=_0x367daa['tableData']??[];_0x670080[_0x770298(0xac)](..._0x4cd6b4);if(_0x4cd6b4[_0x770298(0xcb)]===0x0)break;const _0x2ac123=_0x367daa[_0x770298(0xdf)]?.[_0x770298(0xc2)];if(_0x2ac123!=null?_0x670080['length']>=_0x2ac123:_0x4cd6b4['length']<PAGE_SIZE)break;_0x307981++;}return _0x670080;}async function ensureSqlContent(_0x138fae){const _0x4dca8b=a189_0x12f1;if(_0x138fae[_0x4dca8b(0xc5)]!=null&&String(_0x138fae[_0x4dca8b(0xc5)])['length']>0x0)return _0x138fae;return getSqlQueryDetail(_0x138fae[_0x4dca8b(0xe3)]);}function a189_0x5333(){const _0xb2e13a=['sqlContent','Force\x20pull\x20cancelled.','skipped','would_pull','sqlRootDir','Filter\x20by\x20SQL\x20display\x20name','length','description','sqlName','Would\x20pull\x20','catch','path','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','5104930dazPXa','mybatisXml','apps','cancelled','name','dbId','sqls','sql','filter','str','replace','106696KzbtXs','trimStart','paging','sqlRoot','231992PrMgnT','nonInteractive','sqlCode','force','string','3XznXfT','\x20failed','unchanged','conflict','read','sqlcode','utf8','Force\x20overwrite\x20local\x20unsynced\x20changes','push','99NoERjo','30eTPqSE','1993836CvAWTa','toISOString','\x20written,\x20','\x20skipped,\x20','POST','appCode','pull','507700CDagMW','message','Pull\x20complete:\x20','11nvsnSC','boolean','test','lockFilePath','5urEcyz','local\x20differs\x20from\x20remote','1206261bOSKxB','No\x20remote\x20SQL\x20queries\x20matched.','bool','totalCount','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','581532MvfYEH'];a189_0x5333=function(){return _0xb2e13a;};return a189_0x5333();}export const sqlPull={'service':a189_0x1a1019(0xd9),'command':a189_0x1a1019(0xb5),'description':a189_0x1a1019(0xd1),'risk':a189_0x1a1019(0xa8),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a189_0x1a1019(0xd6),'type':a189_0x1a1019(0xe5),'description':a189_0x1a1019(0xca)},{'name':a189_0x1a1019(0xe4),'type':a189_0x1a1019(0xba),'description':a189_0x1a1019(0xab)}],async 'dryRun'(_0x1ea0b7){const _0x16d6a7=a189_0x1a1019,_0x59b108=loadSqlProjectConfig(_0x1ea0b7['appCode']),_0x40589a=await readSqlLockFile(_0x59b108[_0x16d6a7(0xbc)]),{appLock:_0xd89660}=ensureSqlLockScope(_0x40589a??createEmptySqlLock(),_0x59b108[_0x16d6a7(0xb4)],_0x59b108[_0x16d6a7(0xe0)],_0x16d6a7(0xb5)),_0x3cd0d1=await fetchAllSqlQueries(_0x1ea0b7[_0x16d6a7(0xb4)],{'sqlCode':_0x1ea0b7[_0x16d6a7(0xdb)](_0x16d6a7(0xa9))||undefined,'sqlName':_0x1ea0b7['str'](_0x16d6a7(0xd6))||undefined}),_0x46fce7=[];for(const _0x22da70 of _0x3cd0d1){const _0x3ee99a=await ensureSqlContent(_0x22da70),_0x43e1d9=ensureRemoteSqlContent(_0x3ee99a),_0x845285=detectModeFromSql(_0x3ee99a),_0x2e20fe=_0x3ee99a[_0x16d6a7(0xd7)]?await getDbName(_0x1ea0b7[_0x16d6a7(0xb4)],Number(_0x3ee99a[_0x16d6a7(0xd7)]))['catch'](()=>undefined):undefined,_0x1208cb=buildLocalSqlFileContent({'sqlCode':_0x3ee99a[_0x16d6a7(0xe3)],'sqlName':_0x3ee99a[_0x16d6a7(0xcd)],'dbId':_0x3ee99a['dbId']},_0x43e1d9,{'dbName':_0x2e20fe,'mode':_0x845285,'syncedAt':new Date()[_0x16d6a7(0xb0)](),'description':_0x3ee99a['description']}),_0x2ee1c5=buildSqlLockEntry(_0x3ee99a,_0x43e1d9,'',{'dbName':_0x2e20fe}),_0x5cb3b7=resolveLocalSqlFilePath(_0x59b108,_0x3ee99a[_0x16d6a7(0xe3)],_0x2ee1c5);let _0x3dba38=_0x16d6a7(0xc8),_0x454f32;if(await fileExists(_0x5cb3b7)){const _0x37dc0d=await readFile(_0x5cb3b7,_0x16d6a7(0xaa));isEquivalentPulledSqlFile(_0x37dc0d,_0x1208cb,_0x845285)?(_0x3dba38=_0x16d6a7(0xc7),_0x454f32=_0x16d6a7(0xa6)):(_0x3dba38=_0x16d6a7(0xa7),_0x454f32=_0x16d6a7(0xc3));}_0x46fce7['push']({'sqlCode':_0x3ee99a['sqlCode'],'sqlName':_0x3ee99a[_0x16d6a7(0xcd)],'filePath':_0x5cb3b7,'status':_0x3dba38,'reason':_0x454f32});}return{'method':_0x16d6a7(0xb3),'url':'/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','body':{'appCode':_0x1ea0b7['appCode'],'sqlCode':_0x1ea0b7[_0x16d6a7(0xdb)](_0x16d6a7(0xa9))||null,'sqlName':_0x1ea0b7[_0x16d6a7(0xdb)](_0x16d6a7(0xd6))||null,'files':_0x46fce7},'description':_0x16d6a7(0xce)+_0x46fce7['length']+'\x20SQL\x20file(s)\x20into\x20'+_0x59b108[_0x16d6a7(0xc9)]};},async 'execute'(_0x289dbc){const _0x336617=a189_0x1a1019,_0x16e27c=loadSqlProjectConfig(_0x289dbc[_0x336617(0xb4)]),_0x25cfed=await readSqlLockFile(_0x16e27c[_0x336617(0xbc)]),{lockData:_0x266846,appLock:_0x4a951c}=ensureSqlLockScope(_0x25cfed??createEmptySqlLock(),_0x16e27c[_0x336617(0xb4)],_0x16e27c['sqlRoot'],'pull'),_0x33638b=_0x289dbc[_0x336617(0xc1)](_0x336617(0xe4)),_0x2c6c73=await fetchAllSqlQueries(_0x289dbc[_0x336617(0xb4)],{'sqlCode':_0x289dbc[_0x336617(0xdb)](_0x336617(0xa9))||undefined,'sqlName':_0x289dbc[_0x336617(0xdb)]('name')||undefined});if(_0x2c6c73[_0x336617(0xcb)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x336617(0xc0)};const _0x51ff3c=[],_0x5aaaab=[];for(const _0x27de5d of _0x2c6c73){try{_0x51ff3c['push'](await ensureSqlContent(_0x27de5d));}catch(_0x15a110){_0x5aaaab[_0x336617(0xac)]({'sqlCode':_0x27de5d['sqlCode'],'error':_0x15a110 instanceof Error?_0x15a110[_0x336617(0xb7)]:String(_0x15a110)});}}if(_0x33638b&&!_0x289dbc[_0x336617(0xe2)]){let _0x53084a=![];for(const _0x42a228 of _0x51ff3c){const _0x67686b=detectModeFromSql(_0x42a228),_0x4862ad=_0x42a228[_0x336617(0xd7)]?await getDbName(_0x289dbc[_0x336617(0xb4)],Number(_0x42a228[_0x336617(0xd7)]))[_0x336617(0xcf)](()=>undefined):undefined,_0x1bc3a3=buildLocalSqlFileContent({'sqlCode':_0x42a228['sqlCode'],'sqlName':_0x42a228[_0x336617(0xcd)],'dbId':_0x42a228['dbId']},ensureRemoteSqlContent(_0x42a228),{'dbName':_0x4862ad,'mode':_0x67686b,'syncedAt':new Date()['toISOString'](),'description':_0x42a228[_0x336617(0xcc)]}),_0x51268e=resolveLocalSqlFilePath(_0x16e27c,_0x42a228[_0x336617(0xe3)],buildSqlLockEntry(_0x42a228,ensureRemoteSqlContent(_0x42a228),'',{'dbName':_0x4862ad}));if(await fileExists(_0x51268e)){const _0x563699=await readFile(_0x51268e,_0x336617(0xaa));if(!isEquivalentPulledSqlFile(_0x563699,_0x1bc3a3,_0x67686b)){_0x53084a=!![];break;}}}if(_0x53084a){const _0x3a11fd=await confirmForceOverwrite('Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.');if(!_0x3a11fd)throw CliErrors[_0x336617(0xd5)](_0x336617(0xc6));}}const _0xa75508=cloneSqlLockData(_0x266846),_0x5a7687=_0xa75508[_0x336617(0xd4)][_0x16e27c[_0x336617(0xb4)]],_0x41c2c6=[],_0x341717=[];for(const _0xa24623 of _0x51ff3c){const _0x3c762f=_0x5a7687[_0x336617(0xd8)][_0xa24623[_0x336617(0xe3)]],_0x3912c8=ensureRemoteSqlContent(_0xa24623),_0x2818e1=detectModeFromSql(_0xa24623),_0x6329d4=_0xa24623[_0x336617(0xd7)]?await getDbName(_0x289dbc['appCode'],Number(_0xa24623[_0x336617(0xd7)]))[_0x336617(0xcf)](()=>undefined):undefined,_0x2ef1c1=buildLocalSqlFileContent({'sqlCode':_0xa24623['sqlCode'],'sqlName':_0xa24623[_0x336617(0xcd)],'dbId':_0xa24623[_0x336617(0xd7)]},_0x3912c8,{'dbName':_0x6329d4,'mode':_0x2818e1,'syncedAt':new Date()[_0x336617(0xb0)](),'description':_0xa24623['description']}),_0x5a3f19=buildSqlLockEntry(_0xa24623,_0x3912c8,computeSqlContentHash(_0x2ef1c1),{'dbName':_0x6329d4}),_0x2cdd6a=_0x5a3f19['path'],_0x3ea91a=join(_0x16e27c[_0x336617(0xc9)],_0x2cdd6a);try{if(await fileExists(_0x3ea91a)){const _0x30fd18=await readFile(_0x3ea91a,_0x336617(0xaa));if(isEquivalentPulledSqlFile(_0x30fd18,_0x2ef1c1,_0x2818e1)){_0x341717[_0x336617(0xac)]({'sqlCode':_0xa24623[_0x336617(0xe3)],'reason':_0x336617(0xa6)}),_0x5a7687[_0x336617(0xd8)][_0xa24623[_0x336617(0xe3)]]={..._0x5a3f19,'hash':computeSqlContentHash(_0x30fd18),'path':_0x2cdd6a};continue;}if(!_0x33638b){_0x341717[_0x336617(0xac)]({'sqlCode':_0xa24623[_0x336617(0xe3)],'reason':_0x336617(0xbe)});continue;}}const _0x22c027=_0x3c762f?.[_0x336617(0xd0)]?join(_0x16e27c['sqlRootDir'],_0x3c762f['path']):undefined;_0x22c027&&_0x22c027!==_0x3ea91a&&await fileExists(_0x22c027)&&await rm(_0x22c027,{'force':!![]}),await ensureParentDirectory(_0x3ea91a),await writeFile(_0x3ea91a,_0x2ef1c1,'utf8'),_0x5a7687[_0x336617(0xd8)][_0xa24623['sqlCode']]={..._0x5a3f19,'path':_0x2cdd6a},_0x41c2c6['push']({'sqlCode':_0xa24623[_0x336617(0xe3)],'filePath':_0x3ea91a});}catch(_0x4b8c0a){_0x5aaaab[_0x336617(0xac)]({'sqlCode':_0xa24623[_0x336617(0xe3)],'error':_0x4b8c0a instanceof Error?_0x4b8c0a['message']:String(_0x4b8c0a)});}}return _0x5a7687['lastSync']=new Date()[_0x336617(0xb0)](),await writeSqlLockFile(_0x16e27c[_0x336617(0xbc)],_0xa75508),{'ok':_0x5aaaab[_0x336617(0xcb)]===0x0,'data':{'pulled':_0x41c2c6,'skipped':_0x341717,'failed':_0x5aaaab},'message':_0x336617(0xb8)+_0x41c2c6['length']+_0x336617(0xb1)+_0x341717['length']+_0x336617(0xb2)+_0x5aaaab[_0x336617(0xcb)]+_0x336617(0xe7)};}};function detectModeFromSql(_0x369ff3){const _0x3ce116=a189_0x1a1019,_0x3c7e00=ensureRemoteSqlContent(_0x369ff3),_0x3d9602=stripLocalSqlMetadata(_0x3c7e00,_0x3ce116(0xd3))[_0x3ce116(0xde)]();if(/^<(select|insert|update|delete)\b/i[_0x3ce116(0xbb)](_0x3d9602))return _0x3ce116(0xd3);return _0x3ce116(0xd9);}function isEquivalentPulledSqlFile(_0x5e8650,_0x5ce28d,_0x5d07cd){return normalizePullComparableContent(_0x5e8650,_0x5d07cd)===normalizePullComparableContent(_0x5ce28d,_0x5d07cd);}function normalizePullComparableContent(_0x26966a,_0x9186ba){const _0x12b117=a189_0x1a1019,_0x383550=_0x26966a[_0x12b117(0xdc)](/\r\n/g,'\x0a')['split']('\x0a'),_0x55acaa=_0x383550[_0x12b117(0xda)](_0x52e4e2=>!isSyncedAtMetadataLine(_0x52e4e2,_0x9186ba));return _0x55acaa['join']('\x0a');}function isSyncedAtMetadataLine(_0x5985c7,_0x3093cd){const _0x2b2664=a189_0x1a1019;if(_0x3093cd===_0x2b2664(0xd3))return/^\s*<!--\s*@lovrabet\.syncedAt:/['test'](_0x5985c7);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x2b2664(0xbb)](_0x5985c7);}
|
|
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_0xd762b3=a190_0x542c;(function(_0x16b404,_0x4a207b){const _0x28d724=a190_0x542c,_0x106c10=_0x16b404();while(!![]){try{const _0x5afb65=-parseInt(_0x28d724(0x9c))/0x1*(parseInt(_0x28d724(0xbd))/0x2)+-parseInt(_0x28d724(0xb6))/0x3+-parseInt(_0x28d724(0xd3))/0x4*(parseInt(_0x28d724(0xbe))/0x5)+-parseInt(_0x28d724(0xd0))/0x6+parseInt(_0x28d724(0xcf))/0x7+parseInt(_0x28d724(0x9d))/0x8+parseInt(_0x28d724(0xbb))/0x9;if(_0x5afb65===_0x4a207b)break;else _0x106c10['push'](_0x106c10['shift']());}catch(_0x1bc91b){_0x106c10['push'](_0x106c10['shift']());}}}(a190_0x11a0,0x73bb6));function a190_0x11a0(){const _0x2267a7=['remoteId','filter','catch','86585bJkNLG','2633304qhyDkm','get','dbName','force','dbDirectory','has','lockFilePath','No\x20local\x20SQL\x20files\x20found.','mode','\x20failed','sqls','appCode','bool','Local\x20directory\x20\x22','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','validation','sqlRootDir','str','hash','isFinite','exec','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','Push\x20local\x20SQL\x20files\x20to\x20remote','POST','2214276WzHrKw','push','Local\x20SQL\x20not\x20found:\x20','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','\x20SQL\x20file(s)','21525390azZHAU','high-risk-write','8RWmkww','35tRaVnH','sqlConfig','dbId','message','sqlName','version','length','filePath','sqlCode','trashDir','sqlRoot','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','unchanged','projectRoot','relativePath','sqlcode','Push\x20complete:\x20','537138VusDUf','2808480JDbgMV','path','join','440604wAFiBt','\x20skipped,\x20','/smartapi/custom/updateUserCustomSql','set','sql','toISOString','map','boolean','replace','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first'];a190_0x11a0=function(){return _0x2267a7;};return a190_0x11a0();}import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';function a190_0x542c(_0x5dc49b,_0x3830a8){_0x5dc49b=_0x5dc49b-0x91;const _0x11a0f0=a190_0x11a0();let _0x542cce=_0x11a0f0[_0x5dc49b];return _0x542cce;}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(_0x5a0f5b,_0x300377,_0x20481f){const _0x8ed3fa=a190_0x542c,_0x264d5c=await scanLocalSqlQueries(_0x5a0f5b),_0x22097d=new Map();for(const _0xa9798b of _0x264d5c){if(_0x20481f&&_0xa9798b[_0x8ed3fa(0xc6)]!==_0x20481f)continue;const _0x2205b1=_0x22097d[_0x8ed3fa(0x9e)](_0xa9798b[_0x8ed3fa(0xc6)])??[];_0x2205b1['push'](_0xa9798b),_0x22097d[_0x8ed3fa(0x92)](_0xa9798b['sqlCode'],_0x2205b1);}if(_0x20481f&&!_0x22097d[_0x8ed3fa(0xa2)](_0x20481f))throw CliErrors[_0x8ed3fa(0xad)](_0x8ed3fa(0xb8)+_0x20481f);const _0x3619b3=[];for(const [_0x15a87b,_0x5292db]of _0x22097d['entries']()){if(_0x5292db[_0x8ed3fa(0xc4)]===0x1){_0x3619b3[_0x8ed3fa(0xb7)](_0x5292db[0x0]);continue;}const _0x400ba4=_0x300377[_0x8ed3fa(0xa7)][_0x15a87b],_0xe5a91=_0x400ba4?.[_0x8ed3fa(0xd1)],_0x58cb86=_0xe5a91?_0x5292db[_0x8ed3fa(0x9a)](_0x15d6ba=>_0x15d6ba['relativePath']!==_0xe5a91):_0x5292db;if(_0x400ba4&&_0x58cb86[_0x8ed3fa(0xc4)]===0x1){_0x3619b3[_0x8ed3fa(0xb7)](_0x58cb86[0x0]);continue;}throw CliErrors['validation'](_0x8ed3fa(0xb3)+_0x15a87b+_0x8ed3fa(0xb9));}return _0x3619b3;}export const sqlPush={'service':a190_0xd762b3(0x93),'command':'push','description':a190_0xd762b3(0xb4),'risk':a190_0xd762b3(0xbc),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a190_0xd762b3(0xa0),'type':a190_0xd762b3(0x96),'description':a190_0xd762b3(0xc9)}],async 'dryRun'(_0xbb2831){const _0x574b9c=a190_0xd762b3,_0x3b9da7=loadSqlProjectConfig(_0xbb2831[_0x574b9c(0xa8)]),_0x4d01d9=await readSqlLockFile(_0x3b9da7[_0x574b9c(0xa3)]),{appLock:_0x5155c6}=ensureSqlLockScope(_0x4d01d9??createEmptySqlLock(),_0xbb2831['appCode'],_0x3b9da7['sqlRoot'],_0x574b9c(0xb7)),_0x20cb52=await getTargetSqlQueries(_0x3b9da7,_0x5155c6,_0xbb2831[_0x574b9c(0xaf)](_0x574b9c(0xcd))||undefined),_0xc2d414=[];for(const _0x4667a7 of _0x20cb52){const _0x57beab=await computeSqlFileHash(_0x4667a7[_0x574b9c(0xc5)]),_0x7db53c=_0x5155c6[_0x574b9c(0xa7)][_0x4667a7['sqlCode']],_0x153b0a=!!_0x7db53c&&(_0x7db53c[_0x574b9c(0xd1)]!==_0x4667a7[_0x574b9c(0xcc)]||!!_0x4667a7['sqlName']&&_0x7db53c[_0x574b9c(0xc2)]!==_0x4667a7[_0x574b9c(0xc2)]);if(!_0xbb2831[_0x574b9c(0xa9)](_0x574b9c(0xa0))&&_0x7db53c&&_0x7db53c[_0x574b9c(0xb0)]===_0x57beab&&!_0x153b0a)continue;_0xc2d414[_0x574b9c(0xb7)](_0x4667a7[_0x574b9c(0xc6)]);}return{'method':_0x574b9c(0xb5),'url':_0x574b9c(0x91),'body':{'sqlCodes':_0xc2d414,'appCode':_0xbb2831[_0x574b9c(0xa8)]},'description':'Would\x20push\x20'+_0xc2d414[_0x574b9c(0xc4)]+_0x574b9c(0xba)};},async 'execute'(_0x298a69){const _0x219dd8=a190_0xd762b3,_0x2a3168=loadSqlProjectConfig(_0x298a69[_0x219dd8(0xa8)]),_0x4a3309=await readSqlLockFile(_0x2a3168[_0x219dd8(0xa3)]),{lockData:_0x1b538c,appLock:_0x414c84}=ensureSqlLockScope(_0x4a3309??createEmptySqlLock(),_0x298a69[_0x219dd8(0xa8)],_0x2a3168[_0x219dd8(0xc8)],_0x219dd8(0xb7)),_0x24ff3a=await getTargetSqlQueries(_0x2a3168,_0x414c84,_0x298a69[_0x219dd8(0xaf)](_0x219dd8(0xcd))||undefined);if(_0x24ff3a[_0x219dd8(0xc4)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x219dd8(0xa4)};const _0x137453=[],_0x2d5d5e=[],_0x42e154=[];for(const _0x530248 of _0x24ff3a){const _0x23e1c4=_0x414c84['sqls'][_0x530248['sqlCode']];if(!_0x23e1c4){_0x42e154[_0x219dd8(0xb7)]({'sqlCode':_0x530248[_0x219dd8(0xc6)],'error':_0x219dd8(0x98)});continue;}try{const _0x10ecf0=await computeSqlFileHash(_0x530248[_0x219dd8(0xc5)]),_0xfa05a0=_0x23e1c4['path']!==_0x530248[_0x219dd8(0xcc)]||!!_0x530248[_0x219dd8(0xc2)]&&_0x23e1c4[_0x219dd8(0xc2)]!==_0x530248[_0x219dd8(0xc2)];if(!_0x298a69[_0x219dd8(0xa9)](_0x219dd8(0xa0))&&_0x23e1c4[_0x219dd8(0xb0)]===_0x10ecf0&&!_0xfa05a0){_0x2d5d5e['push']({'sqlCode':_0x530248[_0x219dd8(0xc6)],'reason':_0x219dd8(0xca)});continue;}if(_0x23e1c4[_0x219dd8(0xc3)]==null){_0x42e154['push']({'sqlCode':_0x530248['sqlCode'],'error':_0x219dd8(0xab)});continue;}const _0x4d32ba=await readFile(_0x530248[_0x219dd8(0xc5)],'utf8'),_0x1176b4=stripLocalSqlMetadata(_0x4d32ba,_0x530248[_0x219dd8(0xa5)]),_0x478cd5=_0x530248[_0x219dd8(0xc2)]||_0x23e1c4[_0x219dd8(0xc2)],_0xd15489=await resolveTargetDbBinding(_0x298a69[_0x219dd8(0xa8)],_0x530248,_0x23e1c4),_0x568b85=await updateSqlQuery({'id':_0x23e1c4[_0x219dd8(0x99)],'appCode':_0x298a69['appCode'],'sqlCode':_0x530248[_0x219dd8(0xc6)],'sqlName':_0x478cd5,'dbId':_0xd15489[_0x219dd8(0xc0)],'version':_0x23e1c4[_0x219dd8(0xc3)],'sqlContent':_0x1176b4,'sqlConfig':_0x23e1c4[_0x219dd8(0xbf)]??undefined}),_0xd6b118=_0x568b85[_0x219dd8(0xc0)]?await getDbName(_0x298a69['appCode'],Number(_0x568b85['dbId']))[_0x219dd8(0x9b)](()=>_0xd15489[_0x219dd8(0x9f)]):_0xd15489['dbName'];_0x414c84['sqls'][_0x530248[_0x219dd8(0xc6)]]={...buildSqlLockEntry(_0x568b85,_0x1176b4,_0x10ecf0,{'dbName':_0xd6b118}),'path':_0x530248[_0x219dd8(0xcc)],'mode':_0x23e1c4[_0x219dd8(0xa5)]},await archivePreviousSqlFileIfNeeded(_0x2a3168,_0x23e1c4['path'],_0x530248[_0x219dd8(0xcc)]),_0x137453[_0x219dd8(0xb7)]({'sqlCode':_0x530248['sqlCode'],'remoteId':_0x23e1c4[_0x219dd8(0x99)]});}catch(_0x21d1e2){_0x42e154['push']({'sqlCode':_0x530248[_0x219dd8(0xc6)],'error':_0x21d1e2 instanceof Error?_0x21d1e2[_0x219dd8(0xc1)]:String(_0x21d1e2)});}}return _0x414c84['lastSync']=new Date()[_0x219dd8(0x94)](),await writeSqlLockFile(_0x2a3168[_0x219dd8(0xa3)],_0x1b538c),{'ok':_0x42e154[_0x219dd8(0xc4)]===0x0,'data':{'pushed':_0x137453,'skipped':_0x2d5d5e,'failed':_0x42e154},'message':_0x219dd8(0xce)+_0x137453[_0x219dd8(0xc4)]+'\x20pushed,\x20'+_0x2d5d5e[_0x219dd8(0xc4)]+_0x219dd8(0xd4)+_0x42e154[_0x219dd8(0xc4)]+_0x219dd8(0xa6)};}};async function archivePreviousSqlFileIfNeeded(_0x3cd53d,_0x557eb2,_0x4cca88){const _0x26e2f7=a190_0xd762b3;if(!_0x557eb2||_0x557eb2===_0x4cca88)return;const _0x3fde4e=join(_0x3cd53d['sqlRootDir'],_0x557eb2);if(!await fileExists(_0x3fde4e))return;const _0x54082b=await moveToTrash(_0x3cd53d[_0x26e2f7(0xcb)],_0x3cd53d[_0x26e2f7(0xc7)],_0x3fde4e);await cleanupEmptyDirectories(dirname(_0x3fde4e),_0x3cd53d[_0x26e2f7(0xae)]),void _0x54082b;}async function moveToTrash(_0x6d2806,_0x3e30ff,_0x598337){const _0x50c5ea=a190_0xd762b3,_0x279d73=new Date()[_0x50c5ea(0x94)]()[_0x50c5ea(0x97)](/[:.]/g,'-'),_0x15f5dd=relative(_0x6d2806,_0x598337),_0x1985a7=join(_0x3e30ff,_0x279d73,_0x15f5dd);return await mkdir(dirname(_0x1985a7),{'recursive':!![]}),await rename(_0x598337,_0x1985a7),_0x1985a7;}async function cleanupEmptyDirectories(_0x44f9c4,_0x3e0b6a){const _0x478d6e=a190_0xd762b3;let _0x43caed=resolve(_0x44f9c4);const _0x29d620=resolve(_0x3e0b6a);while(_0x43caed['startsWith'](''+_0x29d620+sep)||_0x43caed===_0x29d620){if(_0x43caed===_0x29d620)return;try{const _0x5eafee=await readdir(_0x43caed);if(_0x5eafee[_0x478d6e(0xc4)]>0x0)return;await rmdir(_0x43caed);}catch{return;}_0x43caed=dirname(_0x43caed);}}async function resolveTargetDbBinding(_0x515a9a,_0x577de5,_0x5a9003){const _0x5a1dcc=a190_0xd762b3,_0x406fa1=_0x577de5[_0x5a1dcc(0xa1)];if(!_0x406fa1)return{'dbId':_0x5a9003[_0x5a1dcc(0xc0)],'dbName':_0x5a9003[_0x5a1dcc(0x9f)]};const _0x3fee55=buildDbDirectoryName(_0x5a9003[_0x5a1dcc(0x9f)],_0x5a9003[_0x5a1dcc(0xc0)]);if(_0x406fa1===_0x3fee55)return{'dbId':_0x5a9003[_0x5a1dcc(0xc0)],'dbName':_0x5a9003[_0x5a1dcc(0x9f)]};const _0x54fe62=parseExplicitDbDirectory(_0x406fa1);if(_0x54fe62!=null)return{'dbId':_0x54fe62,'dbName':await getDbName(_0x515a9a,_0x54fe62)[_0x5a1dcc(0x9b)](()=>undefined)};const _0x1f77db=await listDatabases(_0x515a9a),_0x1e71b5=_0x1f77db['filter'](_0x681517=>buildDbDirectoryName(_0x681517[_0x5a1dcc(0x9f)],_0x681517[_0x5a1dcc(0xc0)])===_0x406fa1);if(_0x1e71b5['length']===0x1)return{'dbId':_0x1e71b5[0x0]['dbId'],'dbName':_0x1e71b5[0x0]['dbName']};if(_0x1e71b5[_0x5a1dcc(0xc4)]===0x0)throw CliErrors[_0x5a1dcc(0xad)]('No\x20database\x20matches\x20local\x20directory\x20\x22'+_0x406fa1+'\x22\x20for\x20sqlCode\x20'+_0x577de5[_0x5a1dcc(0xc6)]+'.');const _0x3df86a=_0x1e71b5[_0x5a1dcc(0x95)](_0x3ce5f4=>_0x3ce5f4[_0x5a1dcc(0x9f)]+'\x20('+_0x3ce5f4[_0x5a1dcc(0xc0)]+')')[_0x5a1dcc(0xd2)](',\x20');throw CliErrors[_0x5a1dcc(0xad)](_0x5a1dcc(0xaa)+_0x406fa1+_0x5a1dcc(0xac)+_0x577de5[_0x5a1dcc(0xc6)]+':\x20'+_0x3df86a);}function parseExplicitDbDirectory(_0x266f38){const _0x3ffe94=a190_0xd762b3,_0x240d47=/^db-(\d+)$/[_0x3ffe94(0xb2)](_0x266f38);if(!_0x240d47)return null;const _0x52d28a=Number(_0x240d47[0x1]);return Number[_0x3ffe94(0xb1)](_0x52d28a)&&_0x52d28a>0x0?_0x52d28a: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
|
-
|
|
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
|
-
const
|
|
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)'};}};
|