@lovrabet/rabetbase-cli 2.5.0 → 2.5.1-beta.1
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/api/generate-sdk-config-file.js +1 -1
- package/lib/auth/auth-server-ui.js +1 -1
- package/lib/auth/auth-server.d.ts +7 -0
- 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/delete.js +1 -1
- package/lib/commands/config/get.js +1 -1
- package/lib/commands/config/index.js +1 -1
- package/lib/commands/config/init.d.ts +1 -1
- package/lib/commands/config/init.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/dataset/business-group-update.js +1 -1
- package/lib/commands/dataset/business-groups.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-refresh-start.js +1 -1
- package/lib/commands/db/diff-refresh-status.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/table-diff-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/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/search.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/menu/visibility-update.js +1 -1
- package/lib/commands/notification/config-create.js +1 -1
- package/lib/commands/notification/config-delete.js +1 -1
- package/lib/commands/notification/config-list.js +1 -1
- package/lib/commands/notification/config-update.js +1 -1
- package/lib/commands/notification/index.js +1 -1
- package/lib/commands/notification/shared.js +1 -1
- package/lib/commands/ocr/index.js +1 -1
- package/lib/commands/page/create.js +1 -1
- package/lib/commands/page/custom/detail.js +1 -1
- package/lib/commands/page/custom/list.js +1 -1
- package/lib/commands/page/custom/publish.js +1 -1
- package/lib/commands/page/custom/shared.js +1 -1
- package/lib/commands/page/custom/syntax.js +1 -1
- package/lib/commands/page/custom/template.js +1 -1
- package/lib/commands/page/custom/update.js +1 -1
- package/lib/commands/page/data-list-status.js +1 -1
- package/lib/commands/page/generate-start.js +1 -1
- package/lib/commands/page/generate-status.js +1 -1
- package/lib/commands/page/index.js +1 -1
- package/lib/commands/page/pull.js +1 -1
- package/lib/commands/page/push.js +1 -1
- package/lib/commands/page/relation-audit.js +1 -1
- package/lib/commands/page/restore.js +1 -1
- package/lib/commands/page/shared.js +1 -1
- package/lib/commands/page/sync.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/materialize-project-template.js +1 -1
- package/lib/commands/project/create/project-name.js +1 -1
- package/lib/commands/project/create/project-template-archive.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/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/domain-config.d.ts +1 -1
- package/lib/config/domain-config.js +1 -1
- package/lib/config/project-routing.d.ts +30 -0
- package/lib/config/project-routing.js +1 -0
- package/lib/config/schema.d.ts +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.d.ts +7 -2
- 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/region.d.ts +2 -2
- package/lib/constant/region.js +1 -1
- package/lib/constant/risk.js +1 -1
- package/lib/constant/routing-profile.d.ts +115 -0
- package/lib/constant/routing-profile.js +1 -0
- 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/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/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 -2
- package/skills/rabetbase/SKILL.md +10 -5
- package/skills/rabetbase/guides/frontend-development.md +2 -0
- package/skills/rabetbase/guides/sdk-client-generation.md +3 -2
- package/skills/rabetbase/guides/typescript-sdk.md +42 -0
- package/skills/rabetbase/references/rabetbase-api-pull.md +5 -3
- package/skills/rabetbase/references/rabetbase-config.md +9 -5
- package/skills/rabetbase/references/rabetbase-init.md +11 -5
- package/skills/rabetbase/references/rabetbase-project-create.md +6 -5
- package/skills/rabetbase.manifest.json +3 -3
- package/templates/README.md +13 -17
package/lib/commands/sql/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a191_0x234989=a191_0x2817;(function(_0x33cee9,_0x524716){const _0x1f47f8=a191_0x2817,_0xcaff54=_0x33cee9();while(!![]){try{const _0x5efe69=-parseInt(_0x1f47f8(0x182))/0x1+parseInt(_0x1f47f8(0x189))/0x2*(parseInt(_0x1f47f8(0x1b4))/0x3)+parseInt(_0x1f47f8(0x191))/0x4+-parseInt(_0x1f47f8(0x1ae))/0x5*(parseInt(_0x1f47f8(0x193))/0x6)+parseInt(_0x1f47f8(0x18e))/0x7*(-parseInt(_0x1f47f8(0x1a8))/0x8)+-parseInt(_0x1f47f8(0x17b))/0x9+-parseInt(_0x1f47f8(0x185))/0xa*(-parseInt(_0x1f47f8(0x192))/0xb);if(_0x5efe69===_0x524716)break;else _0xcaff54['push'](_0xcaff54['shift']());}catch(_0x5aa001){_0xcaff54['push'](_0xcaff54['shift']());}}}(a191_0x59be,0xc9f1e));function a191_0x59be(){const _0xd13431=['lastSync','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','POST','description','Force\x20overwrite\x20local\x20unsynced\x20changes','Would\x20pull\x20','1294575MljbUm','tableData','length','2241380ErCSkJ','catch','string','No\x20remote\x20SQL\x20queries\x20matched.','8PSFTRS','sqlRoot','local\x20differs\x20from\x20remote','cancelled','pull','8799oHAdpn','sqls','read','3887380KIUWUh','209QhXMKs','18sguBLA','lockFilePath','dbId','unchanged','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','toISOString','join','mybatisXml','\x20SQL\x20file(s)\x20into\x20','name','bool','Pull\x20complete:\x20','nonInteractive','path','skipped','boolean','sqlcode','sqlRootDir','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','message','sqlCode','7272mTzfsB','sqlName','utf8','push','totalCount','str','2238525HiKtYG','filter','paging','appCode','sqlContent','Filter\x20by\x20SQL\x20display\x20name','228210mELais','apps','test','sql','8345502hgCFrB'];a191_0x59be=function(){return _0xd13431;};return a191_0x59be();}import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x48f8e0,_0x2986af){const _0xd12cbe=a191_0x2817,_0xec1332=[];let _0x187b43=0x1;while(!![]){const _0x61b273=await listSqlQueries(_0x48f8e0,{'currentPage':_0x187b43,'pageSize':PAGE_SIZE,'sqlCode':_0x2986af[_0xd12cbe(0x1a7)],'sqlName':_0x2986af[_0xd12cbe(0x1a9)]}),_0x56b383=_0x61b273[_0xd12cbe(0x183)]??[];_0xec1332['push'](..._0x56b383);if(_0x56b383[_0xd12cbe(0x184)]===0x0)break;const _0x365880=_0x61b273[_0xd12cbe(0x1b0)]?.[_0xd12cbe(0x1ac)];if(_0x365880!=null?_0xec1332[_0xd12cbe(0x184)]>=_0x365880:_0x56b383[_0xd12cbe(0x184)]<PAGE_SIZE)break;_0x187b43++;}return _0xec1332;}async function ensureSqlContent(_0xfad991){const _0x4eebd5=a191_0x2817;if(_0xfad991['sqlContent']!=null&&String(_0xfad991[_0x4eebd5(0x1b2)])[_0x4eebd5(0x184)]>0x0)return _0xfad991;return getSqlQueryDetail(_0xfad991[_0x4eebd5(0x1a7)]);}export const sqlPull={'service':a191_0x234989(0x1b7),'command':'pull','description':a191_0x234989(0x1a5),'risk':a191_0x234989(0x190),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'name','type':a191_0x234989(0x187),'description':a191_0x234989(0x1b3)},{'name':'force','type':a191_0x234989(0x1a2),'description':a191_0x234989(0x180)}],async 'dryRun'(_0x3eed74){const _0x37cb81=a191_0x234989,_0x21eeda=loadSqlProjectConfig(_0x3eed74[_0x37cb81(0x1b1)]),_0x112f46=await readSqlLockFile(_0x21eeda['lockFilePath']),{appLock:_0x3b037c}=ensureSqlLockScope(_0x112f46??createEmptySqlLock(),_0x21eeda[_0x37cb81(0x1b1)],_0x21eeda[_0x37cb81(0x18a)],_0x37cb81(0x18d)),_0x491105=await fetchAllSqlQueries(_0x3eed74[_0x37cb81(0x1b1)],{'sqlCode':_0x3eed74[_0x37cb81(0x1ad)](_0x37cb81(0x1a3))||undefined,'sqlName':_0x3eed74[_0x37cb81(0x1ad)](_0x37cb81(0x19c))||undefined}),_0x5e892c=[];for(const _0x345c59 of _0x491105){const _0x11c83a=await ensureSqlContent(_0x345c59),_0x142307=ensureRemoteSqlContent(_0x11c83a),_0x31fe7c=detectModeFromSql(_0x11c83a),_0x243eed=_0x11c83a[_0x37cb81(0x195)]?await getDbName(_0x3eed74['appCode'],Number(_0x11c83a[_0x37cb81(0x195)]))[_0x37cb81(0x186)](()=>undefined):undefined,_0x924240=buildLocalSqlFileContent({'sqlCode':_0x11c83a[_0x37cb81(0x1a7)],'sqlName':_0x11c83a['sqlName'],'dbId':_0x11c83a['dbId']},_0x142307,{'dbName':_0x243eed,'mode':_0x31fe7c,'syncedAt':new Date()[_0x37cb81(0x198)](),'description':_0x11c83a[_0x37cb81(0x17f)]}),_0x28e78b=buildSqlLockEntry(_0x11c83a,_0x142307,'',{'dbName':_0x243eed}),_0x18cff4=resolveLocalSqlFilePath(_0x21eeda,_0x11c83a[_0x37cb81(0x1a7)],_0x28e78b);let _0x3b1e12='would_pull',_0x1871f2;if(await fileExists(_0x18cff4)){const _0x11f8f3=await readFile(_0x18cff4,_0x37cb81(0x1aa));isEquivalentPulledSqlFile(_0x11f8f3,_0x924240,_0x31fe7c)?(_0x3b1e12=_0x37cb81(0x1a1),_0x1871f2=_0x37cb81(0x196)):(_0x3b1e12='conflict',_0x1871f2='local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)');}_0x5e892c[_0x37cb81(0x1ab)]({'sqlCode':_0x11c83a['sqlCode'],'sqlName':_0x11c83a['sqlName'],'filePath':_0x18cff4,'status':_0x3b1e12,'reason':_0x1871f2});}return{'method':_0x37cb81(0x17e),'url':_0x37cb81(0x17d),'body':{'appCode':_0x3eed74[_0x37cb81(0x1b1)],'sqlCode':_0x3eed74[_0x37cb81(0x1ad)](_0x37cb81(0x1a3))||null,'sqlName':_0x3eed74[_0x37cb81(0x1ad)](_0x37cb81(0x19c))||null,'files':_0x5e892c},'description':_0x37cb81(0x181)+_0x5e892c['length']+_0x37cb81(0x19b)+_0x21eeda[_0x37cb81(0x1a4)]};},async 'execute'(_0x4b4ef9){const _0x4682d7=a191_0x234989,_0x24da17=loadSqlProjectConfig(_0x4b4ef9[_0x4682d7(0x1b1)]),_0xde2060=await readSqlLockFile(_0x24da17['lockFilePath']),{lockData:_0x57ccaa,appLock:_0x79603f}=ensureSqlLockScope(_0xde2060??createEmptySqlLock(),_0x24da17['appCode'],_0x24da17['sqlRoot'],_0x4682d7(0x18d)),_0x550dba=_0x4b4ef9[_0x4682d7(0x19d)]('force'),_0x5b77e0=await fetchAllSqlQueries(_0x4b4ef9['appCode'],{'sqlCode':_0x4b4ef9['str'](_0x4682d7(0x1a3))||undefined,'sqlName':_0x4b4ef9[_0x4682d7(0x1ad)]('name')||undefined});if(_0x5b77e0[_0x4682d7(0x184)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x4682d7(0x188)};const _0x495ec8=[],_0x2662d7=[];for(const _0x21c3fd of _0x5b77e0){try{_0x495ec8[_0x4682d7(0x1ab)](await ensureSqlContent(_0x21c3fd));}catch(_0xf1c4c1){_0x2662d7[_0x4682d7(0x1ab)]({'sqlCode':_0x21c3fd[_0x4682d7(0x1a7)],'error':_0xf1c4c1 instanceof Error?_0xf1c4c1[_0x4682d7(0x1a6)]:String(_0xf1c4c1)});}}if(_0x550dba&&!_0x4b4ef9[_0x4682d7(0x19f)]){let _0x54af62=![];for(const _0x372be4 of _0x495ec8){const _0x26cb29=detectModeFromSql(_0x372be4),_0x5a03c1=_0x372be4['dbId']?await getDbName(_0x4b4ef9[_0x4682d7(0x1b1)],Number(_0x372be4[_0x4682d7(0x195)]))['catch'](()=>undefined):undefined,_0x222535=buildLocalSqlFileContent({'sqlCode':_0x372be4['sqlCode'],'sqlName':_0x372be4[_0x4682d7(0x1a9)],'dbId':_0x372be4['dbId']},ensureRemoteSqlContent(_0x372be4),{'dbName':_0x5a03c1,'mode':_0x26cb29,'syncedAt':new Date()[_0x4682d7(0x198)](),'description':_0x372be4[_0x4682d7(0x17f)]}),_0x3456e8=resolveLocalSqlFilePath(_0x24da17,_0x372be4[_0x4682d7(0x1a7)],buildSqlLockEntry(_0x372be4,ensureRemoteSqlContent(_0x372be4),'',{'dbName':_0x5a03c1}));if(await fileExists(_0x3456e8)){const _0x1448f3=await readFile(_0x3456e8,_0x4682d7(0x1aa));if(!isEquivalentPulledSqlFile(_0x1448f3,_0x222535,_0x26cb29)){_0x54af62=!![];break;}}}if(_0x54af62){const _0x3bc1f6=await confirmForceOverwrite(_0x4682d7(0x197));if(!_0x3bc1f6)throw CliErrors[_0x4682d7(0x18c)]('Force\x20pull\x20cancelled.');}}const _0x45d7e9=cloneSqlLockData(_0x57ccaa),_0x280503=_0x45d7e9[_0x4682d7(0x1b5)][_0x24da17['appCode']],_0x212cd0=[],_0x4fe3aa=[];for(const _0x2b26e8 of _0x495ec8){const _0x32e4dc=_0x280503[_0x4682d7(0x18f)][_0x2b26e8[_0x4682d7(0x1a7)]],_0x1344d7=ensureRemoteSqlContent(_0x2b26e8),_0x59d717=detectModeFromSql(_0x2b26e8),_0x22fe6b=_0x2b26e8['dbId']?await getDbName(_0x4b4ef9[_0x4682d7(0x1b1)],Number(_0x2b26e8['dbId']))[_0x4682d7(0x186)](()=>undefined):undefined,_0x44323b=buildLocalSqlFileContent({'sqlCode':_0x2b26e8[_0x4682d7(0x1a7)],'sqlName':_0x2b26e8[_0x4682d7(0x1a9)],'dbId':_0x2b26e8[_0x4682d7(0x195)]},_0x1344d7,{'dbName':_0x22fe6b,'mode':_0x59d717,'syncedAt':new Date()['toISOString'](),'description':_0x2b26e8[_0x4682d7(0x17f)]}),_0x1df3a0=buildSqlLockEntry(_0x2b26e8,_0x1344d7,computeSqlContentHash(_0x44323b),{'dbName':_0x22fe6b}),_0xe6a69b=_0x1df3a0['path'],_0x460151=join(_0x24da17[_0x4682d7(0x1a4)],_0xe6a69b);try{if(await fileExists(_0x460151)){const _0x59fd72=await readFile(_0x460151,'utf8');if(isEquivalentPulledSqlFile(_0x59fd72,_0x44323b,_0x59d717)){_0x4fe3aa[_0x4682d7(0x1ab)]({'sqlCode':_0x2b26e8[_0x4682d7(0x1a7)],'reason':_0x4682d7(0x196)}),_0x280503[_0x4682d7(0x18f)][_0x2b26e8[_0x4682d7(0x1a7)]]={..._0x1df3a0,'hash':computeSqlContentHash(_0x59fd72),'path':_0xe6a69b};continue;}if(!_0x550dba){_0x4fe3aa[_0x4682d7(0x1ab)]({'sqlCode':_0x2b26e8[_0x4682d7(0x1a7)],'reason':_0x4682d7(0x18b)});continue;}}const _0x5d80be=_0x32e4dc?.[_0x4682d7(0x1a0)]?join(_0x24da17[_0x4682d7(0x1a4)],_0x32e4dc[_0x4682d7(0x1a0)]):undefined;_0x5d80be&&_0x5d80be!==_0x460151&&await fileExists(_0x5d80be)&&await rm(_0x5d80be,{'force':!![]}),await ensureParentDirectory(_0x460151),await writeFile(_0x460151,_0x44323b,_0x4682d7(0x1aa)),_0x280503['sqls'][_0x2b26e8[_0x4682d7(0x1a7)]]={..._0x1df3a0,'path':_0xe6a69b},_0x212cd0[_0x4682d7(0x1ab)]({'sqlCode':_0x2b26e8[_0x4682d7(0x1a7)],'filePath':_0x460151});}catch(_0xe08b68){_0x2662d7[_0x4682d7(0x1ab)]({'sqlCode':_0x2b26e8[_0x4682d7(0x1a7)],'error':_0xe08b68 instanceof Error?_0xe08b68['message']:String(_0xe08b68)});}}return _0x280503[_0x4682d7(0x17c)]=new Date()[_0x4682d7(0x198)](),await writeSqlLockFile(_0x24da17[_0x4682d7(0x194)],_0x45d7e9),{'ok':_0x2662d7[_0x4682d7(0x184)]===0x0,'data':{'pulled':_0x212cd0,'skipped':_0x4fe3aa,'failed':_0x2662d7},'message':_0x4682d7(0x19e)+_0x212cd0[_0x4682d7(0x184)]+'\x20written,\x20'+_0x4fe3aa[_0x4682d7(0x184)]+'\x20skipped,\x20'+_0x2662d7[_0x4682d7(0x184)]+'\x20failed'};}};function a191_0x2817(_0x5b4b6e,_0x11a151){_0x5b4b6e=_0x5b4b6e-0x17b;const _0x59beab=a191_0x59be();let _0x2817f5=_0x59beab[_0x5b4b6e];return _0x2817f5;}function detectModeFromSql(_0x391ea0){const _0xf3b6a3=a191_0x234989,_0x54e0f5=ensureRemoteSqlContent(_0x391ea0),_0x246f4e=stripLocalSqlMetadata(_0x54e0f5,'mybatisXml')['trimStart']();if(/^<(select|insert|update|delete)\b/i[_0xf3b6a3(0x1b6)](_0x246f4e))return _0xf3b6a3(0x19a);return _0xf3b6a3(0x1b7);}function isEquivalentPulledSqlFile(_0x5e1251,_0x1f19f0,_0x240ae6){return normalizePullComparableContent(_0x5e1251,_0x240ae6)===normalizePullComparableContent(_0x1f19f0,_0x240ae6);}function normalizePullComparableContent(_0x521b0a,_0x293452){const _0x46fcbf=a191_0x234989,_0x6b0fbd=_0x521b0a['replace'](/\r\n/g,'\x0a')['split']('\x0a'),_0x5a2fc0=_0x6b0fbd[_0x46fcbf(0x1af)](_0x391959=>!isSyncedAtMetadataLine(_0x391959,_0x293452));return _0x5a2fc0[_0x46fcbf(0x199)]('\x0a');}function isSyncedAtMetadataLine(_0x112784,_0x1cec30){const _0x832cf6=a191_0x234989;if(_0x1cec30===_0x832cf6(0x19a))return/^\s*<!--\s*@lovrabet\.syncedAt:/['test'](_0x112784);return/^\s*--\s*@lovrabet\.syncedAt:/['test'](_0x112784);}
|
|
1
|
+
const a191_0x44e51d=a191_0xca86;(function(_0x18f892,_0x357557){const _0x5f009d=a191_0xca86,_0x1d8afb=_0x18f892();while(!![]){try{const _0x4b7121=-parseInt(_0x5f009d(0x116))/0x1+-parseInt(_0x5f009d(0x12d))/0x2+-parseInt(_0x5f009d(0x137))/0x3+-parseInt(_0x5f009d(0x150))/0x4*(parseInt(_0x5f009d(0x142))/0x5)+-parseInt(_0x5f009d(0x14a))/0x6*(-parseInt(_0x5f009d(0x13e))/0x7)+-parseInt(_0x5f009d(0x123))/0x8*(parseInt(_0x5f009d(0x138))/0x9)+parseInt(_0x5f009d(0x13f))/0xa;if(_0x4b7121===_0x357557)break;else _0x1d8afb['push'](_0x1d8afb['shift']());}catch(_0x28086f){_0x1d8afb['push'](_0x1d8afb['shift']());}}}(a191_0x422e,0x98ccf));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';function a191_0x422e(){const _0x3ed904=['6eXFPRT','string','str','split','sqlRootDir','Force\x20pull\x20cancelled.','43972NdJzyR','lastSync','local\x20differs\x20from\x20remote','Pull\x20complete:\x20','161204rnjMsy','nonInteractive','replace','length','skipped','description','cancelled','tableData','name','sqlContent','\x20SQL\x20file(s)\x20into\x20','pull','lockFilePath','8tGMueb','appCode','path','POST','sqlCode','push','sqls','sqlRoot','sql','No\x20remote\x20SQL\x20queries\x20matched.','76700ReoqpG','would_pull','bool','unchanged','test','\x20failed','force','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','\x20skipped,\x20','apps','392667yShVGZ','3100149geslQj','Force\x20overwrite\x20local\x20unsynced\x20changes','sqlName','paging','sqlcode','dbId','5428850NaYoEf','17234620gkrdSR','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','trimStart','545DhfHmb','utf8','Would\x20pull\x20','totalCount','mybatisXml','message','\x20written,\x20','toISOString'];a191_0x422e=function(){return _0x3ed904;};return a191_0x422e();}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(_0x293c49,_0x1651ad){const _0x300f86=a191_0xca86,_0x416b1f=[];let _0x1d1a25=0x1;while(!![]){const _0x12bf2e=await listSqlQueries(_0x293c49,{'currentPage':_0x1d1a25,'pageSize':PAGE_SIZE,'sqlCode':_0x1651ad['sqlCode'],'sqlName':_0x1651ad[_0x300f86(0x13a)]}),_0x347cc6=_0x12bf2e[_0x300f86(0x11d)]??[];_0x416b1f['push'](..._0x347cc6);if(_0x347cc6[_0x300f86(0x119)]===0x0)break;const _0x47a947=_0x12bf2e[_0x300f86(0x13b)]?.[_0x300f86(0x145)];if(_0x47a947!=null?_0x416b1f[_0x300f86(0x119)]>=_0x47a947:_0x347cc6[_0x300f86(0x119)]<PAGE_SIZE)break;_0x1d1a25++;}return _0x416b1f;}function a191_0xca86(_0x180b56,_0x5cac4b){_0x180b56=_0x180b56-0x116;const _0x422eb4=a191_0x422e();let _0xca86a8=_0x422eb4[_0x180b56];return _0xca86a8;}async function ensureSqlContent(_0x4cc500){const _0x3f323d=a191_0xca86;if(_0x4cc500[_0x3f323d(0x11f)]!=null&&String(_0x4cc500[_0x3f323d(0x11f)])[_0x3f323d(0x119)]>0x0)return _0x4cc500;return getSqlQueryDetail(_0x4cc500[_0x3f323d(0x127)]);}export const sqlPull={'service':a191_0x44e51d(0x12b),'command':a191_0x44e51d(0x121),'description':'Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','risk':'read','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a191_0x44e51d(0x11e),'type':a191_0x44e51d(0x14b),'description':'Filter\x20by\x20SQL\x20display\x20name'},{'name':'force','type':'boolean','description':a191_0x44e51d(0x139)}],async 'dryRun'(_0x4251e2){const _0x1f9495=a191_0x44e51d,_0x396026=loadSqlProjectConfig(_0x4251e2['appCode']),_0x2880d0=await readSqlLockFile(_0x396026['lockFilePath']),{appLock:_0x594334}=ensureSqlLockScope(_0x2880d0??createEmptySqlLock(),_0x396026['appCode'],_0x396026[_0x1f9495(0x12a)],_0x1f9495(0x121)),_0x513191=await fetchAllSqlQueries(_0x4251e2[_0x1f9495(0x124)],{'sqlCode':_0x4251e2['str'](_0x1f9495(0x13c))||undefined,'sqlName':_0x4251e2['str'](_0x1f9495(0x11e))||undefined}),_0x2fca68=[];for(const _0x1f0c80 of _0x513191){const _0x5c7688=await ensureSqlContent(_0x1f0c80),_0xc2b1fc=ensureRemoteSqlContent(_0x5c7688),_0x4a2945=detectModeFromSql(_0x5c7688),_0x4c09b0=_0x5c7688[_0x1f9495(0x13d)]?await getDbName(_0x4251e2['appCode'],Number(_0x5c7688['dbId']))['catch'](()=>undefined):undefined,_0x141f17=buildLocalSqlFileContent({'sqlCode':_0x5c7688[_0x1f9495(0x127)],'sqlName':_0x5c7688[_0x1f9495(0x13a)],'dbId':_0x5c7688[_0x1f9495(0x13d)]},_0xc2b1fc,{'dbName':_0x4c09b0,'mode':_0x4a2945,'syncedAt':new Date()[_0x1f9495(0x149)](),'description':_0x5c7688[_0x1f9495(0x11b)]}),_0x246c74=buildSqlLockEntry(_0x5c7688,_0xc2b1fc,'',{'dbName':_0x4c09b0}),_0x372678=resolveLocalSqlFilePath(_0x396026,_0x5c7688[_0x1f9495(0x127)],_0x246c74);let _0x436368=_0x1f9495(0x12e),_0x447086;if(await fileExists(_0x372678)){const _0x18f874=await readFile(_0x372678,'utf8');isEquivalentPulledSqlFile(_0x18f874,_0x141f17,_0x4a2945)?(_0x436368=_0x1f9495(0x11a),_0x447086='unchanged'):(_0x436368='conflict',_0x447086=_0x1f9495(0x134));}_0x2fca68['push']({'sqlCode':_0x5c7688['sqlCode'],'sqlName':_0x5c7688[_0x1f9495(0x13a)],'filePath':_0x372678,'status':_0x436368,'reason':_0x447086});}return{'method':_0x1f9495(0x126),'url':_0x1f9495(0x140),'body':{'appCode':_0x4251e2[_0x1f9495(0x124)],'sqlCode':_0x4251e2[_0x1f9495(0x14c)](_0x1f9495(0x13c))||null,'sqlName':_0x4251e2[_0x1f9495(0x14c)](_0x1f9495(0x11e))||null,'files':_0x2fca68},'description':_0x1f9495(0x144)+_0x2fca68[_0x1f9495(0x119)]+_0x1f9495(0x120)+_0x396026[_0x1f9495(0x14e)]};},async 'execute'(_0x12801f){const _0x59d690=a191_0x44e51d,_0x597e93=loadSqlProjectConfig(_0x12801f[_0x59d690(0x124)]),_0x5991cd=await readSqlLockFile(_0x597e93[_0x59d690(0x122)]),{lockData:_0x1c6916,appLock:_0x156d7c}=ensureSqlLockScope(_0x5991cd??createEmptySqlLock(),_0x597e93['appCode'],_0x597e93[_0x59d690(0x12a)],_0x59d690(0x121)),_0x8ac06=_0x12801f[_0x59d690(0x12f)](_0x59d690(0x133)),_0x371f3a=await fetchAllSqlQueries(_0x12801f['appCode'],{'sqlCode':_0x12801f[_0x59d690(0x14c)](_0x59d690(0x13c))||undefined,'sqlName':_0x12801f[_0x59d690(0x14c)](_0x59d690(0x11e))||undefined});if(_0x371f3a[_0x59d690(0x119)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x59d690(0x12c)};const _0x19b7fa=[],_0x2ac319=[];for(const _0x4c9862 of _0x371f3a){try{_0x19b7fa[_0x59d690(0x128)](await ensureSqlContent(_0x4c9862));}catch(_0x308bc2){_0x2ac319['push']({'sqlCode':_0x4c9862[_0x59d690(0x127)],'error':_0x308bc2 instanceof Error?_0x308bc2[_0x59d690(0x147)]:String(_0x308bc2)});}}if(_0x8ac06&&!_0x12801f[_0x59d690(0x117)]){let _0x50238b=![];for(const _0x4bf413 of _0x19b7fa){const _0x1becab=detectModeFromSql(_0x4bf413),_0xc79609=_0x4bf413['dbId']?await getDbName(_0x12801f[_0x59d690(0x124)],Number(_0x4bf413[_0x59d690(0x13d)]))['catch'](()=>undefined):undefined,_0x5d342d=buildLocalSqlFileContent({'sqlCode':_0x4bf413['sqlCode'],'sqlName':_0x4bf413[_0x59d690(0x13a)],'dbId':_0x4bf413['dbId']},ensureRemoteSqlContent(_0x4bf413),{'dbName':_0xc79609,'mode':_0x1becab,'syncedAt':new Date()[_0x59d690(0x149)](),'description':_0x4bf413[_0x59d690(0x11b)]}),_0x43c194=resolveLocalSqlFilePath(_0x597e93,_0x4bf413[_0x59d690(0x127)],buildSqlLockEntry(_0x4bf413,ensureRemoteSqlContent(_0x4bf413),'',{'dbName':_0xc79609}));if(await fileExists(_0x43c194)){const _0x5127fd=await readFile(_0x43c194,_0x59d690(0x143));if(!isEquivalentPulledSqlFile(_0x5127fd,_0x5d342d,_0x1becab)){_0x50238b=!![];break;}}}if(_0x50238b){const _0x1ff7a9=await confirmForceOverwrite('Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.');if(!_0x1ff7a9)throw CliErrors[_0x59d690(0x11c)](_0x59d690(0x14f));}}const _0x1abaf2=cloneSqlLockData(_0x1c6916),_0xe28760=_0x1abaf2[_0x59d690(0x136)][_0x597e93['appCode']],_0x329185=[],_0x55b992=[];for(const _0x2b4550 of _0x19b7fa){const _0x2638a4=_0xe28760[_0x59d690(0x129)][_0x2b4550[_0x59d690(0x127)]],_0xd8ed54=ensureRemoteSqlContent(_0x2b4550),_0x2c2558=detectModeFromSql(_0x2b4550),_0x8351c6=_0x2b4550[_0x59d690(0x13d)]?await getDbName(_0x12801f[_0x59d690(0x124)],Number(_0x2b4550[_0x59d690(0x13d)]))['catch'](()=>undefined):undefined,_0x532344=buildLocalSqlFileContent({'sqlCode':_0x2b4550['sqlCode'],'sqlName':_0x2b4550['sqlName'],'dbId':_0x2b4550['dbId']},_0xd8ed54,{'dbName':_0x8351c6,'mode':_0x2c2558,'syncedAt':new Date()[_0x59d690(0x149)](),'description':_0x2b4550[_0x59d690(0x11b)]}),_0x5853f5=buildSqlLockEntry(_0x2b4550,_0xd8ed54,computeSqlContentHash(_0x532344),{'dbName':_0x8351c6}),_0x8cbef9=_0x5853f5[_0x59d690(0x125)],_0x2dfe55=join(_0x597e93['sqlRootDir'],_0x8cbef9);try{if(await fileExists(_0x2dfe55)){const _0x4f3a34=await readFile(_0x2dfe55,_0x59d690(0x143));if(isEquivalentPulledSqlFile(_0x4f3a34,_0x532344,_0x2c2558)){_0x55b992[_0x59d690(0x128)]({'sqlCode':_0x2b4550['sqlCode'],'reason':_0x59d690(0x130)}),_0xe28760[_0x59d690(0x129)][_0x2b4550[_0x59d690(0x127)]]={..._0x5853f5,'hash':computeSqlContentHash(_0x4f3a34),'path':_0x8cbef9};continue;}if(!_0x8ac06){_0x55b992[_0x59d690(0x128)]({'sqlCode':_0x2b4550[_0x59d690(0x127)],'reason':_0x59d690(0x152)});continue;}}const _0x222ae9=_0x2638a4?.[_0x59d690(0x125)]?join(_0x597e93[_0x59d690(0x14e)],_0x2638a4[_0x59d690(0x125)]):undefined;_0x222ae9&&_0x222ae9!==_0x2dfe55&&await fileExists(_0x222ae9)&&await rm(_0x222ae9,{'force':!![]}),await ensureParentDirectory(_0x2dfe55),await writeFile(_0x2dfe55,_0x532344,_0x59d690(0x143)),_0xe28760[_0x59d690(0x129)][_0x2b4550[_0x59d690(0x127)]]={..._0x5853f5,'path':_0x8cbef9},_0x329185[_0x59d690(0x128)]({'sqlCode':_0x2b4550[_0x59d690(0x127)],'filePath':_0x2dfe55});}catch(_0x6fb4b7){_0x2ac319[_0x59d690(0x128)]({'sqlCode':_0x2b4550[_0x59d690(0x127)],'error':_0x6fb4b7 instanceof Error?_0x6fb4b7[_0x59d690(0x147)]:String(_0x6fb4b7)});}}return _0xe28760[_0x59d690(0x151)]=new Date()[_0x59d690(0x149)](),await writeSqlLockFile(_0x597e93[_0x59d690(0x122)],_0x1abaf2),{'ok':_0x2ac319[_0x59d690(0x119)]===0x0,'data':{'pulled':_0x329185,'skipped':_0x55b992,'failed':_0x2ac319},'message':_0x59d690(0x153)+_0x329185[_0x59d690(0x119)]+_0x59d690(0x148)+_0x55b992[_0x59d690(0x119)]+_0x59d690(0x135)+_0x2ac319['length']+_0x59d690(0x132)};}};function detectModeFromSql(_0x2e13ec){const _0x1585d0=a191_0x44e51d,_0x4855f0=ensureRemoteSqlContent(_0x2e13ec),_0x3dcadc=stripLocalSqlMetadata(_0x4855f0,_0x1585d0(0x146))[_0x1585d0(0x141)]();if(/^<(select|insert|update|delete)\b/i[_0x1585d0(0x131)](_0x3dcadc))return _0x1585d0(0x146);return _0x1585d0(0x12b);}function isEquivalentPulledSqlFile(_0x6671cd,_0x23de73,_0xfad5e8){return normalizePullComparableContent(_0x6671cd,_0xfad5e8)===normalizePullComparableContent(_0x23de73,_0xfad5e8);}function normalizePullComparableContent(_0x4ea976,_0x93a10){const _0x6588ea=a191_0x44e51d,_0x13aba5=_0x4ea976[_0x6588ea(0x118)](/\r\n/g,'\x0a')[_0x6588ea(0x14d)]('\x0a'),_0x380cc1=_0x13aba5['filter'](_0x4341b2=>!isSyncedAtMetadataLine(_0x4341b2,_0x93a10));return _0x380cc1['join']('\x0a');}function isSyncedAtMetadataLine(_0x274745,_0x408dc3){const _0x1a9091=a191_0x44e51d;if(_0x408dc3===_0x1a9091(0x146))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x1a9091(0x131)](_0x274745);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x1a9091(0x131)](_0x274745);}
|
package/lib/commands/sql/push.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a192_0x511c5b=a192_0x15ce;function a192_0x2cbb(){const _0x46714d=['\x20failed','mode','168JXbTpY','entries','7174377pFwrNU','boolean','utf8','Local\x20directory\x20\x22','projectRoot','startsWith','map','393318rDgyMS','str','sqlRoot','Would\x20push\x20','trashDir','unchanged','catch','sqlName','sqlRootDir','get','filter','\x20skipped,\x20','dbDirectory','Push\x20local\x20SQL\x20files\x20to\x20remote','validation','lockFilePath','\x22\x20for\x20sqlCode\x20','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','relativePath','sqlCode','hash','has','bool','175462lmJwgy','length','sqlcode','sql','4416762YrfRsx','15oAMGrL','remoteId','Push\x20complete:\x20','1248636BJaxFp','lastSync','sqlConfig','dbId','push','No\x20local\x20SQL\x20files\x20found.','toISOString','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','set','No\x20database\x20matches\x20local\x20directory\x20\x22','dbName','message','appCode','filePath','1187618GnFpIx','\x20SQL\x20file(s)','exec','join','version','/smartapi/custom/updateUserCustomSql','sqls','32298oyqOrQ','force','path','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock'];a192_0x2cbb=function(){return _0x46714d;};return a192_0x2cbb();}(function(_0x3cdfc4,_0x45fcc8){const _0x530bd1=a192_0x15ce,_0x287ab9=_0x3cdfc4();while(!![]){try{const _0x2e0441=parseInt(_0x530bd1(0x1c7))/0x1+parseInt(_0x530bd1(0x1b1))/0x2+-parseInt(_0x530bd1(0x1b8))/0x3+parseInt(_0x530bd1(0x1a3))/0x4*(-parseInt(_0x530bd1(0x1a0))/0x5)+parseInt(_0x530bd1(0x19f))/0x6+-parseInt(_0x530bd1(0x19b))/0x7*(-parseInt(_0x530bd1(0x1be))/0x8)+-parseInt(_0x530bd1(0x1c0))/0x9;if(_0x2e0441===_0x45fcc8)break;else _0x287ab9['push'](_0x287ab9['shift']());}catch(_0x32eaf1){_0x287ab9['push'](_0x287ab9['shift']());}}}(a192_0x2cbb,0x7b59c));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 a192_0x15ce(_0x33bac0,_0x4b31b9){_0x33bac0=_0x33bac0-0x19a;const _0x2cbbd6=a192_0x2cbb();let _0x15cec2=_0x2cbbd6[_0x33bac0];return _0x15cec2;}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(_0x4ecc6a,_0x158252,_0x51fe82){const _0x510ed4=a192_0x15ce,_0x1e7efc=await scanLocalSqlQueries(_0x4ecc6a),_0x111c70=new Map();for(const _0x5a5afa of _0x1e7efc){if(_0x51fe82&&_0x5a5afa[_0x510ed4(0x1da)]!==_0x51fe82)continue;const _0x2de29d=_0x111c70[_0x510ed4(0x1d0)](_0x5a5afa['sqlCode'])??[];_0x2de29d[_0x510ed4(0x1a7)](_0x5a5afa),_0x111c70[_0x510ed4(0x1ab)](_0x5a5afa['sqlCode'],_0x2de29d);}if(_0x51fe82&&!_0x111c70[_0x510ed4(0x1dc)](_0x51fe82))throw CliErrors[_0x510ed4(0x1d5)]('Local\x20SQL\x20not\x20found:\x20'+_0x51fe82);const _0x301f03=[];for(const [_0x562fe7,_0x1473a1]of _0x111c70[_0x510ed4(0x1bf)]()){if(_0x1473a1[_0x510ed4(0x19c)]===0x1){_0x301f03[_0x510ed4(0x1a7)](_0x1473a1[0x0]);continue;}const _0x15c990=_0x158252['sqls'][_0x562fe7],_0x2c0e62=_0x15c990?.[_0x510ed4(0x1ba)],_0x578862=_0x2c0e62?_0x1473a1[_0x510ed4(0x1d1)](_0x527c60=>_0x527c60[_0x510ed4(0x1d9)]!==_0x2c0e62):_0x1473a1;if(_0x15c990&&_0x578862[_0x510ed4(0x19c)]===0x1){_0x301f03[_0x510ed4(0x1a7)](_0x578862[0x0]);continue;}throw CliErrors['validation']('Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20'+_0x562fe7+_0x510ed4(0x1d8));}return _0x301f03;}export const sqlPush={'service':a192_0x511c5b(0x19e),'command':a192_0x511c5b(0x1a7),'description':a192_0x511c5b(0x1d4),'risk':'write','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a192_0x511c5b(0x1b9),'type':a192_0x511c5b(0x1c1),'description':a192_0x511c5b(0x1bb)}],async 'dryRun'(_0x5d2f23){const _0x289c8e=a192_0x511c5b,_0x2e9d60=loadSqlProjectConfig(_0x5d2f23[_0x289c8e(0x1af)]),_0x2df7d6=await readSqlLockFile(_0x2e9d60['lockFilePath']),{appLock:_0x2d261f}=ensureSqlLockScope(_0x2df7d6??createEmptySqlLock(),_0x5d2f23[_0x289c8e(0x1af)],_0x2e9d60['sqlRoot'],_0x289c8e(0x1a7)),_0xb9af12=await getTargetSqlQueries(_0x2e9d60,_0x2d261f,_0x5d2f23[_0x289c8e(0x1c8)](_0x289c8e(0x19d))||undefined),_0x1ce757=[];for(const _0x29a0b0 of _0xb9af12){const _0x1ed6fb=await computeSqlFileHash(_0x29a0b0[_0x289c8e(0x1b0)]),_0x4788e4=_0x2d261f['sqls'][_0x29a0b0['sqlCode']],_0x460adb=!!_0x4788e4&&(_0x4788e4['path']!==_0x29a0b0[_0x289c8e(0x1d9)]||!!_0x29a0b0['sqlName']&&_0x4788e4[_0x289c8e(0x1ce)]!==_0x29a0b0['sqlName']);if(!_0x5d2f23[_0x289c8e(0x19a)](_0x289c8e(0x1b9))&&_0x4788e4&&_0x4788e4[_0x289c8e(0x1db)]===_0x1ed6fb&&!_0x460adb)continue;_0x1ce757[_0x289c8e(0x1a7)](_0x29a0b0['sqlCode']);}return{'method':'POST','url':_0x289c8e(0x1b6),'body':{'sqlCodes':_0x1ce757,'appCode':_0x5d2f23[_0x289c8e(0x1af)]},'description':_0x289c8e(0x1ca)+_0x1ce757[_0x289c8e(0x19c)]+_0x289c8e(0x1b2)};},async 'execute'(_0x3a8a01){const _0xc895ed=a192_0x511c5b,_0x49cecd=loadSqlProjectConfig(_0x3a8a01[_0xc895ed(0x1af)]),_0x3ec8ec=await readSqlLockFile(_0x49cecd['lockFilePath']),{lockData:_0x77bc57,appLock:_0x25dd1f}=ensureSqlLockScope(_0x3ec8ec??createEmptySqlLock(),_0x3a8a01[_0xc895ed(0x1af)],_0x49cecd[_0xc895ed(0x1c9)],'push'),_0x8f2710=await getTargetSqlQueries(_0x49cecd,_0x25dd1f,_0x3a8a01[_0xc895ed(0x1c8)](_0xc895ed(0x19d))||undefined);if(_0x8f2710[_0xc895ed(0x19c)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0xc895ed(0x1a8)};const _0x2707f5=[],_0x439922=[],_0x109f52=[];for(const _0x229dff of _0x8f2710){const _0x262934=_0x25dd1f[_0xc895ed(0x1b7)][_0x229dff[_0xc895ed(0x1da)]];if(!_0x262934){_0x109f52[_0xc895ed(0x1a7)]({'sqlCode':_0x229dff[_0xc895ed(0x1da)],'error':_0xc895ed(0x1aa)});continue;}try{const _0x13d1ee=await computeSqlFileHash(_0x229dff['filePath']),_0x52f8e1=_0x262934['path']!==_0x229dff[_0xc895ed(0x1d9)]||!!_0x229dff[_0xc895ed(0x1ce)]&&_0x262934['sqlName']!==_0x229dff[_0xc895ed(0x1ce)];if(!_0x3a8a01[_0xc895ed(0x19a)](_0xc895ed(0x1b9))&&_0x262934[_0xc895ed(0x1db)]===_0x13d1ee&&!_0x52f8e1){_0x439922[_0xc895ed(0x1a7)]({'sqlCode':_0x229dff[_0xc895ed(0x1da)],'reason':_0xc895ed(0x1cc)});continue;}if(_0x262934[_0xc895ed(0x1b5)]==null){_0x109f52['push']({'sqlCode':_0x229dff[_0xc895ed(0x1da)],'error':'missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first'});continue;}const _0x2329ae=await readFile(_0x229dff[_0xc895ed(0x1b0)],_0xc895ed(0x1c2)),_0x1996f0=stripLocalSqlMetadata(_0x2329ae,_0x229dff[_0xc895ed(0x1bd)]),_0x39829e=_0x229dff[_0xc895ed(0x1ce)]||_0x262934['sqlName'],_0x5d947b=await resolveTargetDbBinding(_0x3a8a01[_0xc895ed(0x1af)],_0x229dff,_0x262934),_0x54a295=await updateSqlQuery({'id':_0x262934[_0xc895ed(0x1a1)],'appCode':_0x3a8a01[_0xc895ed(0x1af)],'sqlCode':_0x229dff[_0xc895ed(0x1da)],'sqlName':_0x39829e,'dbId':_0x5d947b['dbId'],'version':_0x262934[_0xc895ed(0x1b5)],'sqlContent':_0x1996f0,'sqlConfig':_0x262934[_0xc895ed(0x1a5)]??undefined}),_0x4c3ecc=_0x54a295['dbId']?await getDbName(_0x3a8a01[_0xc895ed(0x1af)],Number(_0x54a295[_0xc895ed(0x1a6)]))[_0xc895ed(0x1cd)](()=>_0x5d947b[_0xc895ed(0x1ad)]):_0x5d947b[_0xc895ed(0x1ad)];_0x25dd1f[_0xc895ed(0x1b7)][_0x229dff['sqlCode']]={...buildSqlLockEntry(_0x54a295,_0x1996f0,_0x13d1ee,{'dbName':_0x4c3ecc}),'path':_0x229dff[_0xc895ed(0x1d9)],'mode':_0x262934['mode']},await archivePreviousSqlFileIfNeeded(_0x49cecd,_0x262934[_0xc895ed(0x1ba)],_0x229dff[_0xc895ed(0x1d9)]),_0x2707f5[_0xc895ed(0x1a7)]({'sqlCode':_0x229dff['sqlCode'],'remoteId':_0x262934[_0xc895ed(0x1a1)]});}catch(_0x58e35b){_0x109f52[_0xc895ed(0x1a7)]({'sqlCode':_0x229dff[_0xc895ed(0x1da)],'error':_0x58e35b instanceof Error?_0x58e35b[_0xc895ed(0x1ae)]:String(_0x58e35b)});}}return _0x25dd1f[_0xc895ed(0x1a4)]=new Date()[_0xc895ed(0x1a9)](),await writeSqlLockFile(_0x49cecd[_0xc895ed(0x1d6)],_0x77bc57),{'ok':_0x109f52['length']===0x0,'data':{'pushed':_0x2707f5,'skipped':_0x439922,'failed':_0x109f52},'message':_0xc895ed(0x1a2)+_0x2707f5['length']+'\x20pushed,\x20'+_0x439922[_0xc895ed(0x19c)]+_0xc895ed(0x1d2)+_0x109f52['length']+_0xc895ed(0x1bc)};}};async function archivePreviousSqlFileIfNeeded(_0x1157a7,_0x1467c0,_0x11868a){const _0x10441a=a192_0x511c5b;if(!_0x1467c0||_0x1467c0===_0x11868a)return;const _0x51c57f=join(_0x1157a7[_0x10441a(0x1cf)],_0x1467c0);if(!await fileExists(_0x51c57f))return;const _0x5e4668=await moveToTrash(_0x1157a7[_0x10441a(0x1c4)],_0x1157a7[_0x10441a(0x1cb)],_0x51c57f);await cleanupEmptyDirectories(dirname(_0x51c57f),_0x1157a7[_0x10441a(0x1cf)]),void _0x5e4668;}async function moveToTrash(_0x4a398b,_0x3c51f3,_0x120fc8){const _0x2960cf=new Date()['toISOString']()['replace'](/[:.]/g,'-'),_0x1f8ad6=relative(_0x4a398b,_0x120fc8),_0x39cddb=join(_0x3c51f3,_0x2960cf,_0x1f8ad6);return await mkdir(dirname(_0x39cddb),{'recursive':!![]}),await rename(_0x120fc8,_0x39cddb),_0x39cddb;}async function cleanupEmptyDirectories(_0x1d75d1,_0x9f96cd){const _0x231059=a192_0x511c5b;let _0x327e2c=resolve(_0x1d75d1);const _0xc2e79f=resolve(_0x9f96cd);while(_0x327e2c[_0x231059(0x1c5)](''+_0xc2e79f+sep)||_0x327e2c===_0xc2e79f){if(_0x327e2c===_0xc2e79f)return;try{const _0x4c0211=await readdir(_0x327e2c);if(_0x4c0211[_0x231059(0x19c)]>0x0)return;await rmdir(_0x327e2c);}catch{return;}_0x327e2c=dirname(_0x327e2c);}}async function resolveTargetDbBinding(_0x34b2d0,_0x34d513,_0x388bce){const _0x1c5ba9=a192_0x511c5b,_0x295e3b=_0x34d513[_0x1c5ba9(0x1d3)];if(!_0x295e3b)return{'dbId':_0x388bce[_0x1c5ba9(0x1a6)],'dbName':_0x388bce[_0x1c5ba9(0x1ad)]};const _0x36b970=buildDbDirectoryName(_0x388bce[_0x1c5ba9(0x1ad)],_0x388bce[_0x1c5ba9(0x1a6)]);if(_0x295e3b===_0x36b970)return{'dbId':_0x388bce['dbId'],'dbName':_0x388bce[_0x1c5ba9(0x1ad)]};const _0x519ad1=parseExplicitDbDirectory(_0x295e3b);if(_0x519ad1!=null)return{'dbId':_0x519ad1,'dbName':await getDbName(_0x34b2d0,_0x519ad1)['catch'](()=>undefined)};const _0x1ee3cf=await listDatabases(_0x34b2d0),_0x29534c=_0x1ee3cf[_0x1c5ba9(0x1d1)](_0x1cb818=>buildDbDirectoryName(_0x1cb818['dbName'],_0x1cb818[_0x1c5ba9(0x1a6)])===_0x295e3b);if(_0x29534c[_0x1c5ba9(0x19c)]===0x1)return{'dbId':_0x29534c[0x0][_0x1c5ba9(0x1a6)],'dbName':_0x29534c[0x0][_0x1c5ba9(0x1ad)]};if(_0x29534c[_0x1c5ba9(0x19c)]===0x0)throw CliErrors[_0x1c5ba9(0x1d5)](_0x1c5ba9(0x1ac)+_0x295e3b+_0x1c5ba9(0x1d7)+_0x34d513[_0x1c5ba9(0x1da)]+'.');const _0x3ac511=_0x29534c[_0x1c5ba9(0x1c6)](_0x24d29d=>_0x24d29d[_0x1c5ba9(0x1ad)]+'\x20('+_0x24d29d[_0x1c5ba9(0x1a6)]+')')[_0x1c5ba9(0x1b4)](',\x20');throw CliErrors[_0x1c5ba9(0x1d5)](_0x1c5ba9(0x1c3)+_0x295e3b+'\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20'+_0x34d513[_0x1c5ba9(0x1da)]+':\x20'+_0x3ac511);}function parseExplicitDbDirectory(_0x38e37a){const _0x5862ca=a192_0x511c5b,_0x5bd3fd=/^db-(\d+)$/[_0x5862ca(0x1b3)](_0x38e37a);if(!_0x5bd3fd)return null;const _0x38bc31=Number(_0x5bd3fd[0x1]);return Number['isFinite'](_0x38bc31)&&_0x38bc31>0x0?_0x38bc31:null;}
|
|
1
|
+
const a192_0x1a8dd6=a192_0x4a29;(function(_0x38abc9,_0x22d732){const _0x2faca5=a192_0x4a29,_0x3a9ba0=_0x38abc9();while(!![]){try{const _0x146ca4=parseInt(_0x2faca5(0xd1))/0x1+-parseInt(_0x2faca5(0xb9))/0x2+parseInt(_0x2faca5(0xac))/0x3+parseInt(_0x2faca5(0xcb))/0x4*(parseInt(_0x2faca5(0xb2))/0x5)+-parseInt(_0x2faca5(0xd0))/0x6+parseInt(_0x2faca5(0xcf))/0x7+parseInt(_0x2faca5(0xcc))/0x8*(parseInt(_0x2faca5(0xbc))/0x9);if(_0x146ca4===_0x22d732)break;else _0x3a9ba0['push'](_0x3a9ba0['shift']());}catch(_0x17ecef){_0x3a9ba0['push'](_0x3a9ba0['shift']());}}}(a192_0x390a,0xa0ea7));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';function a192_0x390a(){const _0x1274d3=['set','\x20failed','Local\x20SQL\x20not\x20found:\x20','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','utf8','push','2366116CayoIq','remoteId','\x20skipped,\x20','81SHAyfA','entries','No\x20database\x20matches\x20local\x20directory\x20\x22','length','toISOString','lockFilePath','isFinite','has','sqlName','dbId','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','boolean','trashDir','POST','dbDirectory','313428XgOhbW','249696yEgVjA','Push\x20local\x20SQL\x20files\x20to\x20remote','projectRoot','8827315RtgkFf','7221474nNmPuu','1117351MlwxKQ','\x20pushed,\x20','filePath','sql','filter','sqlRoot','force','dbName','lastSync','sqlCode','sqlcode','catch','appCode','join','hash','startsWith','validation','sqlRootDir','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','/smartapi/custom/updateUserCustomSql','replace','version','relativePath','path','\x22\x20for\x20sqlCode\x20','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','924261fQTnOI','Local\x20directory\x20\x22','bool','\x20SQL\x20file(s)','str','sqls','5PldhQE'];a192_0x390a=function(){return _0x1274d3;};return a192_0x390a();}async function getTargetSqlQueries(_0x1735de,_0x26f6bf,_0x2c6147){const _0x5249f5=a192_0x4a29,_0x4459fb=await scanLocalSqlQueries(_0x1735de),_0x1d1699=new Map();for(const _0x1b3032 of _0x4459fb){if(_0x2c6147&&_0x1b3032['sqlCode']!==_0x2c6147)continue;const _0x1ced25=_0x1d1699['get'](_0x1b3032['sqlCode'])??[];_0x1ced25[_0x5249f5(0xb8)](_0x1b3032),_0x1d1699[_0x5249f5(0xb3)](_0x1b3032[_0x5249f5(0x9b)],_0x1ced25);}if(_0x2c6147&&!_0x1d1699[_0x5249f5(0xc3)](_0x2c6147))throw CliErrors[_0x5249f5(0xa2)](_0x5249f5(0xb5)+_0x2c6147);const _0x266a58=[];for(const [_0x25d486,_0x7b6c94]of _0x1d1699[_0x5249f5(0xbd)]()){if(_0x7b6c94[_0x5249f5(0xbf)]===0x1){_0x266a58['push'](_0x7b6c94[0x0]);continue;}const _0x55bd1d=_0x26f6bf[_0x5249f5(0xb1)][_0x25d486],_0x3674d0=_0x55bd1d?.['path'],_0x46b9e5=_0x3674d0?_0x7b6c94[_0x5249f5(0xd5)](_0x298178=>_0x298178[_0x5249f5(0xa8)]!==_0x3674d0):_0x7b6c94;if(_0x55bd1d&&_0x46b9e5[_0x5249f5(0xbf)]===0x1){_0x266a58['push'](_0x46b9e5[0x0]);continue;}throw CliErrors[_0x5249f5(0xa2)](_0x5249f5(0xab)+_0x25d486+'.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.');}return _0x266a58;}export const sqlPush={'service':a192_0x1a8dd6(0xd4),'command':a192_0x1a8dd6(0xb8),'description':a192_0x1a8dd6(0xcd),'risk':'write','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a192_0x1a8dd6(0xd7),'type':a192_0x1a8dd6(0xc7),'description':a192_0x1a8dd6(0xc6)}],async 'dryRun'(_0x1353c9){const _0x1ca0b4=a192_0x1a8dd6,_0x2bb05a=loadSqlProjectConfig(_0x1353c9[_0x1ca0b4(0x9e)]),_0x4e308b=await readSqlLockFile(_0x2bb05a[_0x1ca0b4(0xc1)]),{appLock:_0x7a65a5}=ensureSqlLockScope(_0x4e308b??createEmptySqlLock(),_0x1353c9['appCode'],_0x2bb05a[_0x1ca0b4(0xd6)],'push'),_0x1f5742=await getTargetSqlQueries(_0x2bb05a,_0x7a65a5,_0x1353c9[_0x1ca0b4(0xb0)](_0x1ca0b4(0x9c))||undefined),_0x22418a=[];for(const _0x5422c3 of _0x1f5742){const _0xe17c65=await computeSqlFileHash(_0x5422c3[_0x1ca0b4(0xd3)]),_0x338ea7=_0x7a65a5[_0x1ca0b4(0xb1)][_0x5422c3[_0x1ca0b4(0x9b)]],_0x2c9cfe=!!_0x338ea7&&(_0x338ea7['path']!==_0x5422c3[_0x1ca0b4(0xa8)]||!!_0x5422c3[_0x1ca0b4(0xc4)]&&_0x338ea7['sqlName']!==_0x5422c3[_0x1ca0b4(0xc4)]);if(!_0x1353c9[_0x1ca0b4(0xae)](_0x1ca0b4(0xd7))&&_0x338ea7&&_0x338ea7[_0x1ca0b4(0xa0)]===_0xe17c65&&!_0x2c9cfe)continue;_0x22418a[_0x1ca0b4(0xb8)](_0x5422c3[_0x1ca0b4(0x9b)]);}return{'method':_0x1ca0b4(0xc9),'url':_0x1ca0b4(0xa5),'body':{'sqlCodes':_0x22418a,'appCode':_0x1353c9[_0x1ca0b4(0x9e)]},'description':'Would\x20push\x20'+_0x22418a['length']+_0x1ca0b4(0xaf)};},async 'execute'(_0x18818a){const _0x1b3d25=a192_0x1a8dd6,_0x4fd967=loadSqlProjectConfig(_0x18818a[_0x1b3d25(0x9e)]),_0x18d550=await readSqlLockFile(_0x4fd967[_0x1b3d25(0xc1)]),{lockData:_0x460173,appLock:_0x413ac6}=ensureSqlLockScope(_0x18d550??createEmptySqlLock(),_0x18818a[_0x1b3d25(0x9e)],_0x4fd967[_0x1b3d25(0xd6)],'push'),_0x216f15=await getTargetSqlQueries(_0x4fd967,_0x413ac6,_0x18818a[_0x1b3d25(0xb0)](_0x1b3d25(0x9c))||undefined);if(_0x216f15[_0x1b3d25(0xbf)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':'No\x20local\x20SQL\x20files\x20found.'};const _0x317427=[],_0x1df13c=[],_0x2ba667=[];for(const _0xd4f1a1 of _0x216f15){const _0x38f33b=_0x413ac6[_0x1b3d25(0xb1)][_0xd4f1a1[_0x1b3d25(0x9b)]];if(!_0x38f33b){_0x2ba667[_0x1b3d25(0xb8)]({'sqlCode':_0xd4f1a1['sqlCode'],'error':'local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first'});continue;}try{const _0x139dd9=await computeSqlFileHash(_0xd4f1a1[_0x1b3d25(0xd3)]),_0x152314=_0x38f33b[_0x1b3d25(0xa9)]!==_0xd4f1a1[_0x1b3d25(0xa8)]||!!_0xd4f1a1['sqlName']&&_0x38f33b[_0x1b3d25(0xc4)]!==_0xd4f1a1[_0x1b3d25(0xc4)];if(!_0x18818a['bool'](_0x1b3d25(0xd7))&&_0x38f33b[_0x1b3d25(0xa0)]===_0x139dd9&&!_0x152314){_0x1df13c[_0x1b3d25(0xb8)]({'sqlCode':_0xd4f1a1[_0x1b3d25(0x9b)],'reason':'unchanged'});continue;}if(_0x38f33b['version']==null){_0x2ba667[_0x1b3d25(0xb8)]({'sqlCode':_0xd4f1a1[_0x1b3d25(0x9b)],'error':_0x1b3d25(0xb6)});continue;}const _0x32dd95=await readFile(_0xd4f1a1[_0x1b3d25(0xd3)],_0x1b3d25(0xb7)),_0x244f57=stripLocalSqlMetadata(_0x32dd95,_0xd4f1a1['mode']),_0xa1551f=_0xd4f1a1['sqlName']||_0x38f33b[_0x1b3d25(0xc4)],_0x6285a2=await resolveTargetDbBinding(_0x18818a[_0x1b3d25(0x9e)],_0xd4f1a1,_0x38f33b),_0x5522c5=await updateSqlQuery({'id':_0x38f33b[_0x1b3d25(0xba)],'appCode':_0x18818a[_0x1b3d25(0x9e)],'sqlCode':_0xd4f1a1[_0x1b3d25(0x9b)],'sqlName':_0xa1551f,'dbId':_0x6285a2[_0x1b3d25(0xc5)],'version':_0x38f33b[_0x1b3d25(0xa7)],'sqlContent':_0x244f57,'sqlConfig':_0x38f33b['sqlConfig']??undefined}),_0x16e86c=_0x5522c5[_0x1b3d25(0xc5)]?await getDbName(_0x18818a[_0x1b3d25(0x9e)],Number(_0x5522c5[_0x1b3d25(0xc5)]))[_0x1b3d25(0x9d)](()=>_0x6285a2[_0x1b3d25(0xd8)]):_0x6285a2[_0x1b3d25(0xd8)];_0x413ac6['sqls'][_0xd4f1a1[_0x1b3d25(0x9b)]]={...buildSqlLockEntry(_0x5522c5,_0x244f57,_0x139dd9,{'dbName':_0x16e86c}),'path':_0xd4f1a1[_0x1b3d25(0xa8)],'mode':_0x38f33b['mode']},await archivePreviousSqlFileIfNeeded(_0x4fd967,_0x38f33b[_0x1b3d25(0xa9)],_0xd4f1a1[_0x1b3d25(0xa8)]),_0x317427[_0x1b3d25(0xb8)]({'sqlCode':_0xd4f1a1[_0x1b3d25(0x9b)],'remoteId':_0x38f33b[_0x1b3d25(0xba)]});}catch(_0x1d8839){_0x2ba667[_0x1b3d25(0xb8)]({'sqlCode':_0xd4f1a1['sqlCode'],'error':_0x1d8839 instanceof Error?_0x1d8839['message']:String(_0x1d8839)});}}return _0x413ac6[_0x1b3d25(0x9a)]=new Date()['toISOString'](),await writeSqlLockFile(_0x4fd967[_0x1b3d25(0xc1)],_0x460173),{'ok':_0x2ba667[_0x1b3d25(0xbf)]===0x0,'data':{'pushed':_0x317427,'skipped':_0x1df13c,'failed':_0x2ba667},'message':'Push\x20complete:\x20'+_0x317427[_0x1b3d25(0xbf)]+_0x1b3d25(0xd2)+_0x1df13c[_0x1b3d25(0xbf)]+_0x1b3d25(0xbb)+_0x2ba667[_0x1b3d25(0xbf)]+_0x1b3d25(0xb4)};}};function a192_0x4a29(_0x191cdf,_0x2180aa){_0x191cdf=_0x191cdf-0x9a;const _0x390a17=a192_0x390a();let _0x4a29a4=_0x390a17[_0x191cdf];return _0x4a29a4;}async function archivePreviousSqlFileIfNeeded(_0x3bf7f8,_0x456c7e,_0x27b0da){const _0x59c4e1=a192_0x1a8dd6;if(!_0x456c7e||_0x456c7e===_0x27b0da)return;const _0x4590d4=join(_0x3bf7f8[_0x59c4e1(0xa3)],_0x456c7e);if(!await fileExists(_0x4590d4))return;const _0x4288b2=await moveToTrash(_0x3bf7f8[_0x59c4e1(0xce)],_0x3bf7f8[_0x59c4e1(0xc8)],_0x4590d4);await cleanupEmptyDirectories(dirname(_0x4590d4),_0x3bf7f8[_0x59c4e1(0xa3)]),void _0x4288b2;}async function moveToTrash(_0x5a9727,_0x1ac9cc,_0x20636e){const _0x4d305d=a192_0x1a8dd6,_0x449f54=new Date()[_0x4d305d(0xc0)]()[_0x4d305d(0xa6)](/[:.]/g,'-'),_0x460e93=relative(_0x5a9727,_0x20636e),_0x3ef3dd=join(_0x1ac9cc,_0x449f54,_0x460e93);return await mkdir(dirname(_0x3ef3dd),{'recursive':!![]}),await rename(_0x20636e,_0x3ef3dd),_0x3ef3dd;}async function cleanupEmptyDirectories(_0x12bd21,_0x40a24d){const _0x64d684=a192_0x1a8dd6;let _0x9472a7=resolve(_0x12bd21);const _0x321259=resolve(_0x40a24d);while(_0x9472a7[_0x64d684(0xa1)](''+_0x321259+sep)||_0x9472a7===_0x321259){if(_0x9472a7===_0x321259)return;try{const _0x1e2ced=await readdir(_0x9472a7);if(_0x1e2ced[_0x64d684(0xbf)]>0x0)return;await rmdir(_0x9472a7);}catch{return;}_0x9472a7=dirname(_0x9472a7);}}async function resolveTargetDbBinding(_0x17bf10,_0x2806cb,_0x1610b2){const _0x4963c2=a192_0x1a8dd6,_0x290f1d=_0x2806cb[_0x4963c2(0xca)];if(!_0x290f1d)return{'dbId':_0x1610b2[_0x4963c2(0xc5)],'dbName':_0x1610b2[_0x4963c2(0xd8)]};const _0x5dc8ff=buildDbDirectoryName(_0x1610b2[_0x4963c2(0xd8)],_0x1610b2[_0x4963c2(0xc5)]);if(_0x290f1d===_0x5dc8ff)return{'dbId':_0x1610b2[_0x4963c2(0xc5)],'dbName':_0x1610b2[_0x4963c2(0xd8)]};const _0x2496ad=parseExplicitDbDirectory(_0x290f1d);if(_0x2496ad!=null)return{'dbId':_0x2496ad,'dbName':await getDbName(_0x17bf10,_0x2496ad)[_0x4963c2(0x9d)](()=>undefined)};const _0x2f104a=await listDatabases(_0x17bf10),_0x1b34f3=_0x2f104a['filter'](_0x4a73f7=>buildDbDirectoryName(_0x4a73f7[_0x4963c2(0xd8)],_0x4a73f7['dbId'])===_0x290f1d);if(_0x1b34f3[_0x4963c2(0xbf)]===0x1)return{'dbId':_0x1b34f3[0x0][_0x4963c2(0xc5)],'dbName':_0x1b34f3[0x0][_0x4963c2(0xd8)]};if(_0x1b34f3[_0x4963c2(0xbf)]===0x0)throw CliErrors['validation'](_0x4963c2(0xbe)+_0x290f1d+_0x4963c2(0xaa)+_0x2806cb[_0x4963c2(0x9b)]+'.');const _0x206915=_0x1b34f3['map'](_0x50322f=>_0x50322f['dbName']+'\x20('+_0x50322f['dbId']+')')[_0x4963c2(0x9f)](',\x20');throw CliErrors[_0x4963c2(0xa2)](_0x4963c2(0xad)+_0x290f1d+_0x4963c2(0xa4)+_0x2806cb[_0x4963c2(0x9b)]+':\x20'+_0x206915);}function parseExplicitDbDirectory(_0x37d029){const _0x471c29=a192_0x1a8dd6,_0x1ee61a=/^db-(\d+)$/['exec'](_0x37d029);if(!_0x1ee61a)return null;const _0x917f7c=Number(_0x1ee61a[0x1]);return Number[_0x471c29(0xc2)](_0x917f7c)&&_0x917f7c>0x0?_0x917f7c:null;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a193_0x19fb25=a193_0x1293;(function(_0x1b943a,_0xd1f70f){const _0x4e9b9e=a193_0x1293,_0x4ea178=_0x1b943a();while(!![]){try{const _0x4de753=parseInt(_0x4e9b9e(0x1c1))/0x1*(-parseInt(_0x4e9b9e(0x1c0))/0x2)+parseInt(_0x4e9b9e(0x1c4))/0x3*(parseInt(_0x4e9b9e(0x1d7))/0x4)+parseInt(_0x4e9b9e(0x1da))/0x5+parseInt(_0x4e9b9e(0x1bf))/0x6+parseInt(_0x4e9b9e(0x1c2))/0x7+parseInt(_0x4e9b9e(0x1dc))/0x8+-parseInt(_0x4e9b9e(0x1c7))/0x9;if(_0x4de753===_0xd1f70f)break;else _0x4ea178['push'](_0x4ea178['shift']());}catch(_0x46d517){_0x4ea178['push'](_0x4ea178['shift']());}}}(a193_0x439d,0x4132c));function a193_0x1293(_0x2e7e4e,_0x2abb7d){_0x2e7e4e=_0x2e7e4e-0x1b6;const _0x439d82=a193_0x439d();let _0x129342=_0x439d82[_0x2e7e4e];return _0x129342;}function a193_0x439d(){const _0x418ffc=['sqlConfig','dbId','lastSync','map','sqlRoot','1928604MplspN','trim','filter','418035bMflzb','join','2078376FgLgWv','\x20[y/N]\x20','path','push','<!--\x20@lovrabet.','replace','fromEntries','sqlName','sqlCode','mybatisXml','entries','version','endsWith','.rabetbase/sql','length','3105408QuCqcz','2WamaNk','309517WKFgTf','2929346mgiihH','\x20-->','3mUPCPz','dbName','close','10665288ssskuy','mode','syncedAt','apps','toLowerCase','description','yes','stderr','test','--\x20@lovrabet.','question'];a193_0x439d=function(){return _0x418ffc;};return a193_0x439d();}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=a193_0x19fb25(0x1bd);export function buildSqlLockEntry(_0x28882c,_0x569f1a,_0x21e81d,_0x19f72f){const _0x31de26=a193_0x19fb25,_0x14685c=detectSqlMode(_0x569f1a);return{'path':buildSqlRelativePath(_0x28882c['sqlCode'],_0x28882c['sqlName'],_0x19f72f?.[_0x31de26(0x1c5)],_0x14685c,_0x28882c['dbId']),'hash':_0x21e81d,'remoteId':_0x28882c['id'],'version':_0x28882c[_0x31de26(0x1bb)],'dbId':Number(_0x28882c[_0x31de26(0x1d3)]),'dbName':_0x19f72f?.['dbName'],'sqlName':_0x28882c[_0x31de26(0x1b7)],'sqlConfig':_0x28882c[_0x31de26(0x1d2)]??undefined,'mode':_0x14685c};}export function cloneSqlLockData(_0xb7ea59){const _0xd5397e=a193_0x19fb25;return{'apps':Object[_0xd5397e(0x1b6)](Object[_0xd5397e(0x1ba)](_0xb7ea59[_0xd5397e(0x1ca)])[_0xd5397e(0x1d5)](([_0x298048,_0x40f985])=>[_0x298048,{'sqlRoot':_0x40f985[_0xd5397e(0x1d6)],'lastSync':_0x40f985[_0xd5397e(0x1d4)],'sqls':{..._0x40f985['sqls']}}]))};}export function ensureRemoteSqlContent(_0x2fc3df){return _0x2fc3df['sqlContent']??'';}export function buildLocalSqlFileContent(_0x2c8d18,_0x595dd4,_0x4b8fbc){const _0x4019df=a193_0x19fb25,_0x1d9a6d=_0x4b8fbc?.[_0x4019df(0x1c8)]??detectSqlMode(_0x595dd4),_0x4a076b=stripLocalSqlMetadata(_0x595dd4,_0x1d9a6d)[_0x4019df(0x1d8)](),_0x2be693=[...buildMetadataHeaderLines({'sqlCode':_0x2c8d18['sqlCode'],'sqlName':_0x2c8d18['sqlName'],'dbId':_0x2c8d18['dbId'],'dbName':_0x4b8fbc?.[_0x4019df(0x1c5)],'mode':_0x1d9a6d,'syncedAt':_0x4b8fbc?.[_0x4019df(0x1c9)],'description':_0x4b8fbc?.[_0x4019df(0x1cc)]},_0x1d9a6d),'',_0x4a076b],_0x5d49bf=_0x2be693[_0x4019df(0x1db)]('\x0a');return _0x5d49bf[_0x4019df(0x1bc)]('\x0a')?_0x5d49bf:_0x5d49bf+'\x0a';}export function stripLocalSqlMetadata(_0x1aa26c,_0xb12bb8){const _0xfc05f9=a193_0x19fb25,_0x46877a=_0x1aa26c[_0xfc05f9(0x1e1)](/\r\n/g,'\x0a')['split']('\x0a'),_0x52d3d1=[];let _0x3c2bb7=0x0;if(_0xb12bb8==='mybatisXml')while(_0x3c2bb7<_0x46877a[_0xfc05f9(0x1be)]){const _0x2674d6=_0x46877a[_0x3c2bb7]??'';if(/^\s*<!--\s*@lovrabet\./[_0xfc05f9(0x1cf)](_0x2674d6)){_0x3c2bb7++;continue;}if(_0x2674d6[_0xfc05f9(0x1d8)]()===''&&_0x3c2bb7>0x0){_0x3c2bb7++;continue;}break;}else while(_0x3c2bb7<_0x46877a['length']){const _0x4e29b8=_0x46877a[_0x3c2bb7]??'';if(/^\s*--\s*@lovrabet\./[_0xfc05f9(0x1cf)](_0x4e29b8)){_0x3c2bb7++;continue;}if(_0x4e29b8[_0xfc05f9(0x1d8)]()===''&&_0x3c2bb7>0x0){_0x3c2bb7++;continue;}break;}for(;_0x3c2bb7<_0x46877a[_0xfc05f9(0x1be)];_0x3c2bb7++){_0x52d3d1[_0xfc05f9(0x1df)](_0x46877a[_0x3c2bb7]);}return _0x52d3d1[_0xfc05f9(0x1db)]('\x0a')['trimStart']();}export function resolveSqlMode(_0x48e00c,_0x9a6820){if(_0x9a6820?.['mode'])return _0x9a6820['mode'];return detectSqlMode(_0x48e00c);}export function resolveSqlFileName(_0xe91673,_0x5861eb,_0x40f5db){const _0x3de8fa=a193_0x19fb25;if(_0x40f5db?.['path'])return _0x40f5db[_0x3de8fa(0x1de)];if(_0x40f5db?.[_0x3de8fa(0x1b7)]||_0x40f5db?.[_0x3de8fa(0x1c5)])return buildSqlRelativePath(_0xe91673,_0x40f5db?.['sqlName'],_0x40f5db?.[_0x3de8fa(0x1c5)],resolveSqlMode(_0x5861eb,_0x40f5db),_0x40f5db?.[_0x3de8fa(0x1d3)]);return buildDefaultSqlFileName(_0xe91673,resolveSqlMode(_0x5861eb,_0x40f5db));}export function resolveSqlLocalDir(_0x29fe92,_0x17a373){return join(_0x29fe92,SQL_LOCAL_REL_DIR,_0x17a373);}export async function confirmForceOverwrite(_0x17e7c8){const _0x316f65=a193_0x19fb25,_0x3de96d=createInterface({'input':process['stdin'],'output':process[_0x316f65(0x1ce)]}),_0x25af67=await new Promise(_0xc92090=>{const _0x1acb30=_0x316f65;_0x3de96d[_0x1acb30(0x1d1)](_0x17e7c8+_0x1acb30(0x1dd),_0xc92090);});return _0x3de96d[_0x316f65(0x1c6)](),['y',_0x316f65(0x1cd)]['includes'](_0x25af67[_0x316f65(0x1d8)]()[_0x316f65(0x1cb)]());}export function findSqlLockScope(_0x1e0ea4,_0x186978){const _0x348746=a193_0x19fb25;return _0x1e0ea4[_0x348746(0x1ca)][_0x186978];}function buildMetadataHeaderLines(_0x16412d,_0x467fc7){const _0x3d36dc=a193_0x19fb25,_0xcaa691=[['sqlCode',_0x16412d[_0x3d36dc(0x1b8)]],['sqlName',_0x16412d[_0x3d36dc(0x1b7)]],[_0x3d36dc(0x1d3),_0x16412d[_0x3d36dc(0x1d3)]],[_0x3d36dc(0x1c5),_0x16412d['dbName']],['mode',_0x16412d[_0x3d36dc(0x1c8)]],[_0x3d36dc(0x1c9),_0x16412d[_0x3d36dc(0x1c9)]],[_0x3d36dc(0x1cc),_0x16412d[_0x3d36dc(0x1cc)]]];if(_0x467fc7===_0x3d36dc(0x1b9))return _0xcaa691['filter'](([,_0x26ed98])=>_0x26ed98!==undefined&&_0x26ed98!==null&&String(_0x26ed98)[_0x3d36dc(0x1d8)]()!=='')[_0x3d36dc(0x1d5)](([_0x42eb0,_0x559f86])=>_0x3d36dc(0x1e0)+_0x42eb0+':\x20'+String(_0x559f86)+_0x3d36dc(0x1c3));return _0xcaa691[_0x3d36dc(0x1d9)](([,_0x48c84d])=>_0x48c84d!==undefined&&_0x48c84d!==null&&String(_0x48c84d)[_0x3d36dc(0x1d8)]()!=='')[_0x3d36dc(0x1d5)](([_0x57637f,_0x1922eb])=>_0x3d36dc(0x1d0)+_0x57637f+':\x20'+String(_0x1922eb));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a194_0x1f760a=a194_0x5ae8;function a194_0x1d6c(){const _0xc6753b=['\x20added,\x20','20mcoRnt','map','15109919IUfGAb','push','591094ofAULg','read','boolean','appCode','length','\x20modified,\x20','status','All\x20SQL\x20queries\x20are\x20in\x20sync.','1281116dLoJMK','filePath','remote','sqls','sqlName','sqlRoot','has','lockFilePath','keys','1284065QqTUsS','6IIeTZp','\x20missing,\x20','sqlCode','364724mSpTIl','\x20unchanged','653288KjAZer','relativePath','hash','lockKey','Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','bool','Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally','3AVycRy','8iQNYlB','12HcsQdT','1989675MIJkwI'];a194_0x1d6c=function(){return _0xc6753b;};return a194_0x1d6c();}(function(_0x190dd1,_0x2525e0){const _0x4aac51=a194_0x5ae8,_0x4c44ee=_0x190dd1();while(!![]){try{const _0x1c4fc1=parseInt(_0x4aac51(0x1d8))/0x1+parseInt(_0x4aac51(0x1cb))/0x2+-parseInt(_0x4aac51(0x1ba))/0x3*(-parseInt(_0x4aac51(0x1da))/0x4)+parseInt(_0x4aac51(0x1d4))/0x5*(parseInt(_0x4aac51(0x1d5))/0x6)+parseInt(_0x4aac51(0x1c3))/0x7*(-parseInt(_0x4aac51(0x1bb))/0x8)+parseInt(_0x4aac51(0x1bd))/0x9*(parseInt(_0x4aac51(0x1bf))/0xa)+parseInt(_0x4aac51(0x1c1))/0xb*(-parseInt(_0x4aac51(0x1bc))/0xc);if(_0x1c4fc1===_0x2525e0)break;else _0x4c44ee['push'](_0x4c44ee['shift']());}catch(_0x577922){_0x4c44ee['push'](_0x4c44ee['shift']());}}}(a194_0x1d6c,0x63f98));import{listSqlQueries}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';function a194_0x5ae8(_0x299dd7,_0x35ebe6){_0x299dd7=_0x299dd7-0x1b5;const _0x1d6c9d=a194_0x1d6c();let _0x5ae855=_0x1d6c9d[_0x299dd7];return _0x5ae855;}import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile}from'../../core/sql-sync/lock.js';const PAGE_SIZE=0x64;async function fetchAllSqlCodes(_0x2dfd9f){const _0x13dc18=a194_0x5ae8,_0x2975a9=[];let _0x39ac06=0x1;while(!![]){const _0x439873=await listSqlQueries(_0x2dfd9f,{'currentPage':_0x39ac06,'pageSize':PAGE_SIZE}),_0x22507b=_0x439873['tableData']??[];_0x2975a9[_0x13dc18(0x1c2)](..._0x22507b[_0x13dc18(0x1c0)](_0x4ca9f9=>_0x4ca9f9[_0x13dc18(0x1d7)]));if(_0x22507b[_0x13dc18(0x1c7)]===0x0)break;const _0x33cb29=_0x439873['paging']?.['totalCount'];if(_0x33cb29!=null?_0x2975a9[_0x13dc18(0x1c7)]>=_0x33cb29:_0x22507b['length']<PAGE_SIZE)break;_0x39ac06++;}return _0x2975a9;}export const sqlStatus={'service':'sql','command':a194_0x1f760a(0x1c9),'description':a194_0x1f760a(0x1b7),'risk':a194_0x1f760a(0x1c4),'flags':[{'name':'remote','type':a194_0x1f760a(0x1c5),'description':a194_0x1f760a(0x1b9)}],async 'execute'(_0x2bcba2){const _0x418986=a194_0x1f760a,_0x1df7f1=loadSqlProjectConfig(_0x2bcba2[_0x418986(0x1c6)]),_0x56004c=await readSqlLockFile(_0x1df7f1[_0x418986(0x1d2)]),{appLock:_0x44db1c}=ensureSqlLockScope(_0x56004c??createEmptySqlLock(),_0x1df7f1[_0x418986(0x1c6)],_0x1df7f1[_0x418986(0x1d0)],_0x418986(0x1c9)),_0x3fc69c=await scanLocalSqlQueries(_0x1df7f1),_0x1bb6f8=[],_0x440433=[],_0x1deb85=[],_0x53f9df=[],_0x4bbb4a=new Set(_0x3fc69c[_0x418986(0x1c0)](_0x5d59ba=>_0x5d59ba['lockKey']));for(const _0x4706e6 of _0x3fc69c){const _0x2f3b25=await computeSqlFileHash(_0x4706e6[_0x418986(0x1cc)]),_0x24dc18=_0x44db1c[_0x418986(0x1ce)][_0x4706e6[_0x418986(0x1b6)]],_0x258a7d=!!_0x24dc18&&_0x24dc18['path']!==_0x4706e6[_0x418986(0x1db)],_0x768d7d=!!_0x24dc18&&!!_0x4706e6['sqlName']&&_0x24dc18[_0x418986(0x1cf)]!==_0x4706e6[_0x418986(0x1cf)];if(!_0x24dc18)_0x1bb6f8[_0x418986(0x1c2)](_0x4706e6[_0x418986(0x1b6)]);else _0x24dc18[_0x418986(0x1b5)]!==_0x2f3b25||_0x258a7d||_0x768d7d?_0x440433[_0x418986(0x1c2)](_0x4706e6[_0x418986(0x1b6)]):_0x1deb85['push'](_0x4706e6[_0x418986(0x1b6)]);}for(const _0x3a8019 of Object[_0x418986(0x1d3)](_0x44db1c[_0x418986(0x1ce)])){!_0x4bbb4a[_0x418986(0x1d1)](_0x3a8019)&&_0x53f9df['push'](_0x3a8019);}const _0x363f5c=[];if(_0x2bcba2[_0x418986(0x1b8)](_0x418986(0x1cd))){const _0x333799=await fetchAllSqlCodes(_0x2bcba2['appCode']);for(const _0x2545e5 of _0x333799){!_0x4bbb4a[_0x418986(0x1d1)](_0x2545e5)&&!_0x44db1c[_0x418986(0x1ce)][_0x2545e5]&&_0x363f5c[_0x418986(0x1c2)](_0x2545e5);}}const _0x3ecd4e=_0x1bb6f8[_0x418986(0x1c7)]===0x0&&_0x440433['length']===0x0&&_0x53f9df['length']===0x0&&_0x363f5c[_0x418986(0x1c7)]===0x0;return{'ok':!![],'data':{'added':_0x1bb6f8,'modified':_0x440433,'missing':_0x53f9df,'unchanged':_0x1deb85,'remoteOnly':_0x363f5c},'message':_0x3ecd4e?_0x418986(0x1ca):_0x1bb6f8['length']+_0x418986(0x1be)+_0x440433[_0x418986(0x1c7)]+_0x418986(0x1c8)+_0x53f9df[_0x418986(0x1c7)]+_0x418986(0x1d6)+_0x1deb85[_0x418986(0x1c7)]+_0x418986(0x1d9)+(_0x363f5c['length']>0x0?',\x20'+_0x363f5c[_0x418986(0x1c7)]+'\x20remote-only':'')};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a195_0x387d6d=a195_0xb141;(function(_0x2ba2a4,_0x1735f1){const _0x38175d=a195_0xb141,_0x2247ba=_0x2ba2a4();while(!![]){try{const _0x275d10=parseInt(_0x38175d(0xd2))/0x1*(-parseInt(_0x38175d(0xef))/0x2)+-parseInt(_0x38175d(0x10c))/0x3*(-parseInt(_0x38175d(0xcf))/0x4)+parseInt(_0x38175d(0xea))/0x5+-parseInt(_0x38175d(0xfd))/0x6*(-parseInt(_0x38175d(0xe8))/0x7)+-parseInt(_0x38175d(0xe3))/0x8+parseInt(_0x38175d(0xf6))/0x9+parseInt(_0x38175d(0x105))/0xa*(parseInt(_0x38175d(0xda))/0xb);if(_0x275d10===_0x1735f1)break;else _0x2247ba['push'](_0x2247ba['shift']());}catch(_0xbd7fde){_0x2247ba['push'](_0x2247ba['shift']());}}}(a195_0x2a44,0xdfec5));import{readFileSync,existsSync}from'node:fs';import{resolve}from'node:path';import{validateSql}from'../../core/sql-validator.js';import{auditSqlJoinIndexes}from'../../core/sql-index-auditor.js';function a195_0x2a44(){const _0x2f6da6=['Audit\x20top-level\x20JOIN\x20equality\x20predicates\x20against\x20dataset\x20index\x20metadata','get','check-indexes','dbtableConfig','1210repilq','index_type','--check-indexes\x20requires\x20--schemas.','reason','cwd','length','isSelectOnly','find','parameters','12723928fxJMRp','validate','valid','pkField','dataset','537131tMREJD','schemas','4203185EfdRTy','str','type','sql','split','513914thjAHH','index_columns','File\x20not\x20found:\x20','fields','push','columns','filter','3268287dAPPbP','file','isArray','toLowerCase','Table\x20\x22','validation','SQL\x20schema\x20validation','12kcmLGi','boolean','flatMap','unshift','string','utf-8','map','bool','20010VEgmlz','from','flagMissing','tables','sqlType','columnNames','name','45NEbYBd','schemaWarnings','Provide\x20--file\x20or\x20--sql','Dataset\x20\x22','indexes','453652fkBIVW','primary','size','3tfuGDK','tableName','message','trim'];a195_0x2a44=function(){return _0x2f6da6;};return a195_0x2a44();}import{getDatasetDetail,listDatasets}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';function a195_0xb141(_0x1ae5f2,_0x145e8f){_0x1ae5f2=_0x1ae5f2-0xce;const _0x2a4475=a195_0x2a44();let _0xb1415b=_0x2a4475[_0x1ae5f2];return _0xb1415b;}import{assertDatasetIsDbTableBacked,filterDbTableBackedDatasets}from'../../commands/dataset/capability.js';export const sqlValidate={'service':a195_0x387d6d(0xed),'command':a195_0x387d6d(0xe4),'description':'Validate\x20SQL\x20content\x20without\x20saving\x20(type\x20detection,\x20parameter\x20extraction,\x20optional\x20schema\x20check)','risk':'read','flags':[{'name':'file','type':a195_0x387d6d(0x101),'description':'Path\x20to\x20the\x20SQL\x20file\x20to\x20validate'},{'name':a195_0x387d6d(0xed),'type':a195_0x387d6d(0x101),'description':'Inline\x20SQL\x20content\x20to\x20validate\x20(alternative\x20to\x20--file)'},{'name':a195_0x387d6d(0xe9),'type':a195_0x387d6d(0x101),'description':'Comma-separated\x20dataset\x20codes\x20to\x20cross-check\x20table/column\x20names\x20against'},{'name':a195_0x387d6d(0xd8),'type':a195_0x387d6d(0xfe),'description':a195_0x387d6d(0xd6)}],async 'execute'(_0x5b1517){const _0x4fa6b5=a195_0x387d6d,_0x3e4c5c=_0x5b1517[_0x4fa6b5(0xeb)]('file'),_0x47781c=_0x5b1517[_0x4fa6b5(0xeb)](_0x4fa6b5(0xed)),_0xed022b=_0x5b1517[_0x4fa6b5(0xeb)](_0x4fa6b5(0xe9)),_0x508356=_0x5b1517[_0x4fa6b5(0x104)](_0x4fa6b5(0xd8));if(!_0x3e4c5c&&!_0x47781c)throw CliErrors[_0x4fa6b5(0x107)](_0x4fa6b5(0xf7),_0x4fa6b5(0x10e));if(_0x508356&&!_0xed022b)throw CliErrors[_0x4fa6b5(0xfb)](_0x4fa6b5(0xdc));let _0x4af58f;if(_0x3e4c5c){const _0x27e96c=resolve(process[_0x4fa6b5(0xde)](),_0x3e4c5c);if(!existsSync(_0x27e96c))throw CliErrors[_0x4fa6b5(0xfb)](_0x4fa6b5(0xf1)+_0x27e96c);_0x4af58f=readFileSync(_0x27e96c,_0x4fa6b5(0x102));}else _0x4af58f=_0x47781c;const _0x35a97c=validateSql(_0x4af58f),_0x38ecfc={'valid':_0x35a97c[_0x4fa6b5(0xe5)],'sqlType':_0x35a97c[_0x4fa6b5(0x109)][_0x4fa6b5(0xec)],'isSelectOnly':_0x35a97c['sqlType'][_0x4fa6b5(0xe0)],'isDangerous':_0x35a97c['sqlType']['isDangerous'],'tables':_0x35a97c[_0x4fa6b5(0x108)],'parameters':_0x35a97c[_0x4fa6b5(0xe2)],'message':_0x35a97c['message']};_0x35a97c['sqlType'][_0x4fa6b5(0xdd)]&&(_0x38ecfc[_0x4fa6b5(0xdd)]=_0x35a97c[_0x4fa6b5(0x109)]['reason']);if(_0xed022b&&_0x35a97c[_0x4fa6b5(0xe5)]){const _0xa5daf=_0xed022b['split'](',')[_0x4fa6b5(0x103)](_0x3ffd54=>_0x3ffd54[_0x4fa6b5(0xd5)]())['filter'](Boolean),_0x551141=[],_0x5fc5eb=[],_0xd10c70=filterDbTableBackedDatasets(await listDatasets(_0x5b1517['appCode'])),_0x2b5a8a=new Map(_0xd10c70['map'](_0x1eeced=>[_0x1eeced[_0x4fa6b5(0xd9)]?.[_0x4fa6b5(0xd3)]?.['toLowerCase'](),_0x1eeced]));for(const _0x3f4ed5 of _0x35a97c['tables']){const _0x1a179a=_0x2b5a8a[_0x4fa6b5(0xd7)](_0x3f4ed5[_0x4fa6b5(0xf9)]());!_0x1a179a&&_0x551141[_0x4fa6b5(0xf3)](_0x4fa6b5(0xfa)+_0x3f4ed5+'\x22\x20not\x20found\x20in\x20any\x20dataset');}for(const _0x3bddbc of _0xa5daf){let _0x4c67f6;try{_0x4c67f6=await getDatasetDetail(_0x3bddbc);}catch{_0x551141['push'](_0x4fa6b5(0x10f)+_0x3bddbc+'\x22\x20not\x20found\x20or\x20not\x20accessible');continue;}assertDatasetIsDbTableBacked(_0x4c67f6,_0x4fa6b5(0xfc));const _0x18a0b2=Array[_0x4fa6b5(0xf8)](_0x4c67f6['fields'])?_0x4c67f6[_0x4fa6b5(0xf2)]:[],_0x73904b=new Set(_0x18a0b2[_0x4fa6b5(0x103)](_0x53b704=>_0x53b704['name']?.[_0x4fa6b5(0xf9)]())),_0x20693f=_0x4c67f6[_0x4fa6b5(0xd9)]?.['tableName']||_0x4c67f6['tableName']||_0x3bddbc;_0x38ecfc['schema:'+_0x20693f]={'code':_0x3bddbc,'tableName':_0x20693f,'fieldCount':_0x73904b[_0x4fa6b5(0xd1)],'fields':Array[_0x4fa6b5(0x106)](_0x73904b)};if(_0x508356){const _0x4c811c=normalizeDatasetIndexes(_0x4c67f6);_0x5fc5eb[_0x4fa6b5(0xf3)]({'tableName':_0x20693f,..._0x4c811c});}}_0x551141['length']>0x0&&(_0x38ecfc[_0x4fa6b5(0x10d)]=_0x551141),_0x508356&&(_0x38ecfc['joinAudit']=auditSqlJoinIndexes(_0x4af58f,_0x5fc5eb));}return{'ok':_0x35a97c[_0x4fa6b5(0xe5)],'data':_0x38ecfc,'message':_0x35a97c[_0x4fa6b5(0xd4)]};}};function normalizeDatasetIndexes(_0x61048c){const _0x302c0f=a195_0x387d6d,_0x335720=Array[_0x302c0f(0xf8)](_0x61048c?.['dataset']?.[_0x302c0f(0xce)])?_0x61048c[_0x302c0f(0xe7)][_0x302c0f(0xce)]:Array[_0x302c0f(0xf8)](_0x61048c?.[_0x302c0f(0xce)])?_0x61048c[_0x302c0f(0xce)]:[],_0xf7e5e0=_0x335720[_0x302c0f(0xff)](_0x1094ba=>{const _0x371fb7=_0x302c0f,_0x3b2c06=Array[_0x371fb7(0xf8)](_0x1094ba?.[_0x371fb7(0xf0)])?_0x1094ba[_0x371fb7(0xf0)]:Array[_0x371fb7(0xf8)](_0x1094ba?.[_0x371fb7(0x10a)])?_0x1094ba[_0x371fb7(0x10a)]:Array[_0x371fb7(0xf8)](_0x1094ba?.[_0x371fb7(0xf4)])?_0x1094ba['columns']:[],_0x528790=_0x3b2c06['filter'](_0x36461b=>typeof _0x36461b===_0x371fb7(0x101))[_0x371fb7(0x103)](_0x55b179=>_0x55b179['trim']())[_0x371fb7(0xf5)](Boolean);if(_0x528790[_0x371fb7(0xdf)]===0x0)return[];const _0x3b7e20=[_0x1094ba?.['indexName'],_0x1094ba?.['index_name'],_0x1094ba?.[_0x371fb7(0x10b)]][_0x371fb7(0xe1)](_0x404a7a=>typeof _0x404a7a===_0x371fb7(0x101)&&_0x404a7a['trim']()),_0x6c7d89=[_0x1094ba?.[_0x371fb7(0xdb)],_0x1094ba?.[_0x371fb7(0xec)]][_0x371fb7(0xe1)](_0x4c90c3=>typeof _0x4c90c3===_0x371fb7(0x101)&&_0x4c90c3[_0x371fb7(0xd5)]());return[{..._0x3b7e20?{'name':_0x3b7e20[_0x371fb7(0xd5)]()}:{},..._0x6c7d89?{'type':_0x6c7d89[_0x371fb7(0xd5)]()}:{},'columns':_0x528790}];}),_0xf19915=[..._0xf7e5e0],_0x17a57c=typeof _0x61048c?.[_0x302c0f(0xd9)]?.[_0x302c0f(0xe6)]===_0x302c0f(0x101)?_0x61048c[_0x302c0f(0xd9)][_0x302c0f(0xe6)][_0x302c0f(0xee)](',')['map'](_0x4aa645=>_0x4aa645[_0x302c0f(0xd5)]())[_0x302c0f(0xf5)](Boolean):[];return _0x17a57c[_0x302c0f(0xdf)]>0x0&&_0xf19915[_0x302c0f(0x100)]({'type':_0x302c0f(0xd0),'columns':_0x17a57c}),{'indexes':_0xf19915,'metadataAvailable':_0xf7e5e0['length']>0x0};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a196_0x12aa(){const _0x5e2e18=['1648240eERGbI','9xoEdvY','7900ZmxKAx','17iCjLjC','449885rKcZmo','6jGaZMe','10175869JORHhG','45928ZFmkmS','747WUXVfO','12filJlG','3229219uvCKNI','389096ckcCOt'];a196_0x12aa=function(){return _0x5e2e18;};return a196_0x12aa();}(function(_0x140926,_0x37bd85){const _0x49f4d1=a196_0x390d,_0x17ca91=_0x140926();while(!![]){try{const _0x5e81b1=parseInt(_0x49f4d1(0x7c))/0x1*(-parseInt(_0x49f4d1(0x80))/0x2)+parseInt(_0x49f4d1(0x81))/0x3*(parseInt(_0x49f4d1(0x7b))/0x4)+-parseInt(_0x49f4d1(0x7d))/0x5+-parseInt(_0x49f4d1(0x7e))/0x6*(parseInt(_0x49f4d1(0x77))/0x7)+parseInt(_0x49f4d1(0x78))/0x8*(-parseInt(_0x49f4d1(0x7a))/0x9)+-parseInt(_0x49f4d1(0x79))/0xa+-parseInt(_0x49f4d1(0x7f))/0xb*(-parseInt(_0x49f4d1(0x82))/0xc);if(_0x5e81b1===_0x37bd85)break;else _0x17ca91['push'](_0x17ca91['shift']());}catch(_0x8ed79d){_0x17ca91['push'](_0x17ca91['shift']());}}}(a196_0x12aa,0x3fe4f));import{taskStatus}from'../../commands/task/status.js';function a196_0x390d(_0x101174,_0xf8481e){_0x101174=_0x101174-0x77;const _0x12aa05=a196_0x12aa();let _0x390dde=_0x12aa05[_0x101174];return _0x390dde;}export const taskDefinitions=[taskStatus];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a197_0x3f54bd=a197_0x458f;(function(_0x2ef6e2,_0x3bb41e){const _0x4f3c4a=a197_0x458f,_0x3aa940=_0x2ef6e2();while(!![]){try{const _0x41f559=-parseInt(_0x4f3c4a(0x203))/0x1*(parseInt(_0x4f3c4a(0x204))/0x2)+parseInt(_0x4f3c4a(0x1fb))/0x3*(parseInt(_0x4f3c4a(0x1fe))/0x4)+parseInt(_0x4f3c4a(0x205))/0x5+parseInt(_0x4f3c4a(0x1f2))/0x6+parseInt(_0x4f3c4a(0x206))/0x7+-parseInt(_0x4f3c4a(0x1fa))/0x8+-parseInt(_0x4f3c4a(0x1f9))/0x9;if(_0x41f559===_0x3bb41e)break;else _0x3aa940['push'](_0x3aa940['shift']());}catch(_0x2e11a0){_0x3aa940['push'](_0x3aa940['shift']());}}}(a197_0x18a8,0x75bf8));import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asyncTaskMessage,buildAsyncTaskStatusCommand,normalizeAsyncTask}from'../../commands/common/async-task.js';function a197_0x458f(_0x42cd65,_0x214cd1){_0x42cd65=_0x42cd65-0x1f0;const _0x18a814=a197_0x18a8();let _0x458f14=_0x18a814[_0x42cd65];return _0x458f14;}import{getAsyncTaskStatus}from'../../core/api-client.js';function a197_0x18a8(){const _0xf938fc=['2716398OmKjPt','3342208JxXlcE','141UcjCMW','isTerminal','task-id','33716aIWuWt','Task\x20id\x20returned\x20by\x20an\x20asynchronous\x20platform\x20command','read','cookie','status','1sPaApc','1786662ENOspd','163695vnkKaZ','5742828xWMxJj','taskId','Task\x20status\x20response\x20id\x20mismatch:\x20requested\x20','5075514Otqyat','str','Query\x20an\x20asynchronous\x20task;\x20repeat\x20for\x20PENDING\x20or\x20PROCESSING\x20until\x20SUCCESS\x20or\x20FAILED','task','appCode','trim','flagMissing'];a197_0x18a8=function(){return _0xf938fc;};return a197_0x18a8();}import{CliErrors}from'../../errors.js';export const taskStatus={'service':a197_0x3f54bd(0x1f5),'command':a197_0x3f54bd(0x202),'description':a197_0x3f54bd(0x1f4),'risk':a197_0x3f54bd(0x200),'defaultOutputFormat':'compress','structuredErrors':!![],'flags':[{'name':a197_0x3f54bd(0x1fd),'type':'string','required':!![],'description':a197_0x3f54bd(0x1ff)},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x3e73e6){const _0x4283d0=a197_0x3f54bd;if(!_0x3e73e6[_0x4283d0(0x1f3)](_0x4283d0(0x1fd))[_0x4283d0(0x1f7)]())throw CliErrors[_0x4283d0(0x1f8)](_0x4283d0(0x1fd));},async 'execute'(_0x57788c){const _0x418664=a197_0x3f54bd,_0x9a4a=_0x57788c[_0x418664(0x1f3)](_0x418664(0x1fd))[_0x418664(0x1f7)](),_0x1dd6c8=normalizeAsyncTask(await getAsyncTaskStatus(_0x9a4a,_0x57788c[_0x418664(0x1f6)],_0x57788c[_0x418664(0x201)]));if(_0x1dd6c8['taskId']!==_0x9a4a)throw CliErrors['apiError'](_0x418664(0x1f1)+_0x9a4a+',\x20received\x20'+_0x1dd6c8[_0x418664(0x1f0)]+'.');const _0x1345c0=buildAsyncTaskStatusCommand(_0x1dd6c8['taskId'],_0x57788c['appCode']);return{'ok':!![],'message':asyncTaskMessage(_0x1dd6c8),'data':{'appCode':_0x57788c[_0x418664(0x1f6)],..._0x1dd6c8,'query':_0x1dd6c8[_0x418664(0x1fc)]?null:{'command':_0x1345c0}}};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x7d415f,_0xb5e466){const _0x40285b=a198_0x5151,_0x1ef74d=_0x7d415f();while(!![]){try{const _0x6805d9=parseInt(_0x40285b(0x110))/0x1*(parseInt(_0x40285b(0x10e))/0x2)+parseInt(_0x40285b(0x114))/0x3*(-parseInt(_0x40285b(0x113))/0x4)+parseInt(_0x40285b(0x10d))/0x5+parseInt(_0x40285b(0x10f))/0x6+parseInt(_0x40285b(0x10c))/0x7+parseInt(_0x40285b(0x116))/0x8*(parseInt(_0x40285b(0x115))/0x9)+-parseInt(_0x40285b(0x112))/0xa*(parseInt(_0x40285b(0x111))/0xb);if(_0x6805d9===_0xb5e466)break;else _0x1ef74d['push'](_0x1ef74d['shift']());}catch(_0x5d55f4){_0x1ef74d['push'](_0x1ef74d['shift']());}}}(a198_0x2a66,0xe5ca8));function a198_0x5151(_0x4e27b8,_0x49731b){_0x4e27b8=_0x4e27b8-0x10c;const _0x2a66ec=a198_0x2a66();let _0x5151cc=_0x2a66ec[_0x4e27b8];return _0x5151cc;}import{tenantMembersListDefinition}from'../../commands/tenant/members-list.js';export const tenantDefinitions=[tenantMembersListDefinition];function a198_0x2a66(){const _0x3bfe4a=['3431029qNsJqM','8898945oJxTJD','6IYlEJh','1175220PjozBe','216431LDmWRa','99ppoJDR','2175230ekxjHQ','28hgOXcm','182319frCmni','22689GKIYig','664QxiYNu'];a198_0x2a66=function(){return _0x3bfe4a;};return a198_0x2a66();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a199_0x58f594=a199_0x4780;(function(_0x30fec1,_0x11b467){const _0x563f5a=a199_0x4780,_0x379c94=_0x30fec1();while(!![]){try{const _0x4c472e=parseInt(_0x563f5a(0x12a))/0x1+-parseInt(_0x563f5a(0x12d))/0x2*(-parseInt(_0x563f5a(0x12c))/0x3)+-parseInt(_0x563f5a(0x130))/0x4+-parseInt(_0x563f5a(0x133))/0x5+parseInt(_0x563f5a(0x129))/0x6*(-parseInt(_0x563f5a(0x12f))/0x7)+-parseInt(_0x563f5a(0x126))/0x8+-parseInt(_0x563f5a(0x12b))/0x9*(-parseInt(_0x563f5a(0x137))/0xa);if(_0x4c472e===_0x11b467)break;else _0x379c94['push'](_0x379c94['shift']());}catch(_0xcfa9c7){_0x379c94['push'](_0x379c94['shift']());}}}(a199_0x896c,0xdf97e));import{listCurrentUserTenantMemberships,listTenantDirectoryMembers}from'../../core/api-client.js';function a199_0x896c(){const _0x11bd95=['4478148CvSIcs','length','string','5213940AZXmVV','tenant-code','Pass\x20--tenant-code\x20<code>.','read','10351540xerJzK','List\x20members\x20of\x20a\x20tenant\x20available\x20to\x20the\x20current\x20account','str','12667840OLQNuq','trim','members-list','6044478vEwkan','228248yrzVCC','36aFLUzg','121893wPSxFI','64GrkzCv','Found\x20','7AvWzmc'];a199_0x896c=function(){return _0x11bd95;};return a199_0x896c();}import{CliErrors}from'../../errors.js';import{assertTenantAccessible,projectTenantMembers}from'../../commands/tenant/shared.js';function a199_0x4780(_0x1c73ec,_0x3e7688){_0x1c73ec=_0x1c73ec-0x125;const _0x896c91=a199_0x896c();let _0x478062=_0x896c91[_0x1c73ec];return _0x478062;}export const tenantMembersListDefinition={'service':'tenant','command':a199_0x58f594(0x128),'description':a199_0x58f594(0x138),'risk':a199_0x58f594(0x136),'requiresAuth':!![],'requiresAppCode':![],'structuredErrors':!![],'flags':[{'name':'tenant-code','type':a199_0x58f594(0x132),'required':!![],'description':'Exact\x20tenant\x20code'}],async 'validate'(_0x3e0c01){const _0x45ec02=a199_0x58f594;if(!_0x3e0c01[_0x45ec02(0x125)]('tenant-code')[_0x45ec02(0x127)]())throw CliErrors['flagMissing'](_0x45ec02(0x134),_0x45ec02(0x135));},async 'execute'(_0x3a4dee){const _0x38be72=a199_0x58f594,_0x3073c3=_0x3a4dee[_0x38be72(0x125)](_0x38be72(0x134))[_0x38be72(0x127)](),_0x1c5d61=await listCurrentUserTenantMemberships();assertTenantAccessible(_0x3073c3,_0x1c5d61);const _0x108713=projectTenantMembers(await listTenantDirectoryMembers(_0x3073c3));return{'ok':!![],'data':{'tenantCode':_0x3073c3,'items':_0x108713,'totalCount':_0x108713[_0x38be72(0x131)]},'message':_0x38be72(0x12e)+_0x108713[_0x38be72(0x131)]+'\x20tenant\x20member(s)'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0xcb6cbf,_0xed26d5){const _0x5d1ecb=a200_0xafc6,_0x188bf0=_0xcb6cbf();while(!![]){try{const _0x3bb89c=-parseInt(_0x5d1ecb(0x9e))/0x1+-parseInt(_0x5d1ecb(0xa3))/0x2+-parseInt(_0x5d1ecb(0x8f))/0x3+parseInt(_0x5d1ecb(0x9d))/0x4+parseInt(_0x5d1ecb(0x95))/0x5*(parseInt(_0x5d1ecb(0x9a))/0x6)+parseInt(_0x5d1ecb(0xa0))/0x7*(-parseInt(_0x5d1ecb(0x8b))/0x8)+parseInt(_0x5d1ecb(0x96))/0x9*(parseInt(_0x5d1ecb(0x8d))/0xa);if(_0x3bb89c===_0xed26d5)break;else _0x188bf0['push'](_0x188bf0['shift']());}catch(_0x589b77){_0x188bf0['push'](_0x188bf0['shift']());}}}(a200_0x3cc1,0x74ad8));function a200_0x3cc1(){const _0x542521=['\x22\x20is\x20not\x20available\x20to\x20the\x20current\x20account.','12TAzaoq','set','some','2047572gXAdFd','723087bQVduo','validation','6162625SPXFhw','trim','userId','1209318rmCjPF','tenantCode','get','nickname','8PXSFNH','role','140890ehwxua','adminFlag','1506021ysLOSt','username','ADMIN','Check\x20--tenant-code\x20or\x20login\x20with\x20an\x20account\x20that\x20belongs\x20to\x20this\x20tenant.','status','displayName','2076220izFuHq','1179XvdizE','Tenant\x20\x22','isFinite'];a200_0x3cc1=function(){return _0x542521;};return a200_0x3cc1();}function a200_0xafc6(_0x28aaa3,_0x57e2ac){_0x28aaa3=_0x28aaa3-0x8a;const _0x3cc101=a200_0x3cc1();let _0xafc630=_0x3cc101[_0x28aaa3];return _0xafc630;}import{CliErrors}from'../../errors.js';function textOrNull(_0x26a45a){const _0x653b03=a200_0xafc6,_0x40c502=_0x26a45a?.[_0x653b03(0xa1)]();return _0x40c502?_0x40c502:null;}export function projectTenantMembers(_0x5d4a97){const _0x5913a3=a200_0xafc6,_0x117e5d=new Map();for(const _0xbbc34d of _0x5d4a97){const _0x283ea8=Number(_0xbbc34d[_0x5913a3(0xa2)]);if(!Number[_0x5913a3(0x98)](_0x283ea8)||_0x283ea8<=0x0)continue;const _0x3721a3={'userId':_0x283ea8,'username':textOrNull(_0xbbc34d[_0x5913a3(0x90)]),'displayName':textOrNull(_0xbbc34d[_0x5913a3(0x8a)]),'role':_0xbbc34d[_0x5913a3(0x8e)]===!![]?'ADMIN':'MEMBER','status':textOrNull(_0xbbc34d[_0x5913a3(0x93)])},_0x39c691=_0x117e5d[_0x5913a3(0xa5)](_0x283ea8);if(!_0x39c691){_0x117e5d[_0x5913a3(0x9b)](_0x283ea8,_0x3721a3);continue;}_0x39c691[_0x5913a3(0x90)]??=_0x3721a3[_0x5913a3(0x90)],_0x39c691[_0x5913a3(0x94)]??=_0x3721a3[_0x5913a3(0x94)],_0x39c691['status']??=_0x3721a3['status'];if(_0x3721a3[_0x5913a3(0x8c)]==='ADMIN')_0x39c691[_0x5913a3(0x8c)]=_0x5913a3(0x91);}return[..._0x117e5d['values']()]['sort']((_0x8d7b34,_0xdf11e)=>_0x8d7b34['userId']-_0xdf11e['userId']);}export function assertTenantAccessible(_0x404909,_0x5a2b43){const _0x3b1ebc=a200_0xafc6;if(_0x5a2b43[_0x3b1ebc(0x9c)](_0x570630=>_0x570630[_0x3b1ebc(0xa4)]===_0x404909))return;throw CliErrors[_0x3b1ebc(0x9f)](_0x3b1ebc(0x97)+_0x404909+_0x3b1ebc(0x99),_0x3b1ebc(0x92));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a201_0x22bf28=a201_0x7358;(function(_0x6f1d42,_0x35606d){const _0x1b00da=a201_0x7358,_0x191a12=_0x6f1d42();while(!![]){try{const _0x54dae8=-parseInt(_0x1b00da(0xbb))/0x1*(parseInt(_0x1b00da(0xb6))/0x2)+parseInt(_0x1b00da(0xaf))/0x3+-parseInt(_0x1b00da(0xb4))/0x4+parseInt(_0x1b00da(0xbe))/0x5*(parseInt(_0x1b00da(0xc6))/0x6)+parseInt(_0x1b00da(0xb0))/0x7+-parseInt(_0x1b00da(0xc4))/0x8*(-parseInt(_0x1b00da(0xb1))/0x9)+-parseInt(_0x1b00da(0xba))/0xa;if(_0x54dae8===_0x35606d)break;else _0x191a12['push'](_0x191a12['shift']());}catch(_0x211fa6){_0x191a12['push'](_0x191a12['shift']());}}}(a201_0x5870,0x93332));import{asDryRunResult}from'../../commands/common/dry-run.js';function a201_0x7358(_0x5603d8,_0xd70329){_0x5603d8=_0x5603d8-0xad;const _0x58700e=a201_0x5870();let _0x735884=_0x58700e[_0x5603d8];return _0x735884;}function a201_0x5870(){const _0x4a5ce1=['837204lvobMm','trim','Pass\x20the\x20DingTalk\x20user\x20id\x20returned\x20by\x20the\x20sandbox.','2021385ReEHgm','7564907TFshbV','9ShZXCZ','dingding-sandbox-bind','ding-talk-user-id','1686420ZbrYjR','Retry\x20with\x20the\x20same\x20--ding-talk-user-id\x20only\x20after\x20checking\x20the\x20current\x20platform\x20session.','236970ycOneB','--ding-talk-user-id\x20cannot\x20be\x20empty.','string','The\x20current\x20binding\x20is\x20not\x20exposed\x20by\x20the\x20server;\x20before\x20is\x20unavailable.','10249760KShAug','6aZYYCw','dingtalk','Bound\x20current\x20user\x20to\x20DingTalk\x20sandbox\x20account.','30xYVoNj','validation','Bind\x20the\x20current\x20platform\x20user\x20to\x20a\x20DingTalk\x20sandbox\x20account','DingTalk\x20user\x20id\x20returned\x20by\x20the\x20sandbox','DingTalk\x20sandbox\x20account\x20binding\x20was\x20not\x20confirmed.','POST','1349768xQoSsH','str'];a201_0x5870=function(){return _0x4a5ce1;};return a201_0x5870();}import{bindDingTalkSandboxAccount,DING_TALK_SANDBOX_BIND_PATH}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';const PROVIDER_ID=a201_0x22bf28(0xbc),CURRENT_BINDING_WARNING=a201_0x22bf28(0xb9);function readDingTalkUserId(_0x29aae5){const _0x3efc62=a201_0x22bf28,_0x2b5f7c=_0x29aae5[_0x3efc62(0xc5)]('ding-talk-user-id')[_0x3efc62(0xad)]();if(!_0x2b5f7c)throw CliErrors[_0x3efc62(0xbf)](_0x3efc62(0xb7),_0x3efc62(0xae));return _0x2b5f7c;}function buildBindingData(_0x4a0028,_0x3391da){const _0x5b39a1=a201_0x22bf28;return{'operation':'bind','selector':{'providerId':PROVIDER_ID,'dingTalkUserId':_0x4a0028},'before':null,'after':{'providerId':PROVIDER_ID,'dingTalkUserId':_0x4a0028,'bound':!![]},'dryRun':_0x3391da,'backend':{'method':_0x5b39a1(0xc3),'path':DING_TALK_SANDBOX_BIND_PATH},'warnings':[CURRENT_BINDING_WARNING]};}export const dingTalkSandboxBind={'service':'user-account','command':a201_0x22bf28(0xb2),'description':a201_0x22bf28(0xc0),'risk':'write','requiresAuth':!![],'requiresAppCode':![],'structuredErrors':!![],'flags':[{'name':a201_0x22bf28(0xb3),'type':a201_0x22bf28(0xb8),'required':!![],'description':a201_0x22bf28(0xc1)}],async 'validate'(_0xcf44c6){readDingTalkUserId(_0xcf44c6);},async 'dryRun'(_0x2c6a6d){const _0x46da3d=readDingTalkUserId(_0x2c6a6d);return asDryRunResult(buildBindingData(_0x46da3d,!![]),{'method':'POST','url':DING_TALK_SANDBOX_BIND_PATH});},async 'execute'(_0x235351){const _0x1e8f2e=a201_0x22bf28,_0x2f9dd0=readDingTalkUserId(_0x235351),_0x385ede=await bindDingTalkSandboxAccount(_0x2f9dd0);if(_0x385ede!==!![])throw CliErrors['apiError'](_0x1e8f2e(0xc2),_0x1e8f2e(0xb5));return{'ok':!![],'data':buildBindingData(_0x2f9dd0,![]),'message':_0x1e8f2e(0xbd)};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x41edb3,_0x5659e7){const _0x24cb16=a202_0x3eec,_0x58cc45=_0x41edb3();while(!![]){try{const _0x562e41=parseInt(_0x24cb16(0x15d))/0x1+-parseInt(_0x24cb16(0x15b))/0x2*(parseInt(_0x24cb16(0x15e))/0x3)+-parseInt(_0x24cb16(0x158))/0x4+parseInt(_0x24cb16(0x159))/0x5+parseInt(_0x24cb16(0x157))/0x6+-parseInt(_0x24cb16(0x15a))/0x7+parseInt(_0x24cb16(0x15c))/0x8;if(_0x562e41===_0x5659e7)break;else _0x58cc45['push'](_0x58cc45['shift']());}catch(_0x14c1a0){_0x58cc45['push'](_0x58cc45['shift']());}}}(a202_0x204c,0xdfe6c));import{dingTalkSandboxBind}from'../../commands/user-account/dingding-sandbox-bind.js';function a202_0x3eec(_0x333952,_0x412ef0){_0x333952=_0x333952-0x157;const _0x204c0b=a202_0x204c();let _0x3eecc8=_0x204c0b[_0x333952];return _0x3eecc8;}function a202_0x204c(){const _0x1b002b=['2700025lqyjxv','5026063MFXcCk','2078huWMLU','11070464zDrcaC','1045995ZJDDSy','3225EDGaAE','1328478rnmdnp','1756748QCqFVX'];a202_0x204c=function(){return _0x1b002b;};return a202_0x204c();}export const userAccountDefinitions=[dingTalkSandboxBind];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a203_0x1c34a1=a203_0x22d1;(function(_0x23a311,_0x2cafc1){const _0x33b8bf=a203_0x22d1,_0x55cebf=_0x23a311();while(!![]){try{const _0x3fb029=-parseInt(_0x33b8bf(0x116))/0x1+-parseInt(_0x33b8bf(0x118))/0x2*(-parseInt(_0x33b8bf(0x111))/0x3)+parseInt(_0x33b8bf(0x117))/0x4+-parseInt(_0x33b8bf(0x11b))/0x5+-parseInt(_0x33b8bf(0x11a))/0x6+parseInt(_0x33b8bf(0x113))/0x7+parseInt(_0x33b8bf(0x10d))/0x8*(-parseInt(_0x33b8bf(0x115))/0x9);if(_0x3fb029===_0x2cafc1)break;else _0x55cebf['push'](_0x55cebf['shift']());}catch(_0x563e84){_0x55cebf['push'](_0x55cebf['shift']());}}}(a203_0x323b,0xa9890));function a203_0x323b(){const _0x5f1023=['450689FeMlQN','3810000axYFrz','2GFvbFd','write','2519874PfBMgN','2674530hjwoRD','539584OSLyPO','add','name','workspace','3744531hoUWcv','App\x20profile\x20name','8737911tXQNDS','workspace\x20add','180SROszH'];a203_0x323b=function(){return _0x5f1023;};return a203_0x323b();}function a203_0x22d1(_0x2acb71,_0x2bd77f){_0x2acb71=_0x2acb71-0x10d;const _0x323b17=a203_0x323b();let _0x22d135=_0x323b17[_0x2acb71];return _0x22d135;}import{buildAppAddFlags,runAppAdd,validateAppName}from'../../commands/common/app-registry.js';export const workspaceAddDefinition={'service':a203_0x1c34a1(0x110),'command':a203_0x1c34a1(0x10e),'description':'Register\x20an\x20app\x20profile\x20in\x20the\x20current\x20workspace\x20(or\x20--global)','risk':a203_0x1c34a1(0x119),'requiresAuth':![],'requiresAppCode':![],'args':[{'name':a203_0x1c34a1(0x10f),'description':a203_0x1c34a1(0x112),'required':!![]}],'flags':buildAppAddFlags(),'validate':_0x3d93ff=>validateAppName(_0x3d93ff,a203_0x1c34a1(0x114)),'execute':_0x5467b2=>runAppAdd(_0x5467b2,a203_0x1c34a1(0x114))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a204_0x58ca5b=a204_0x43ca;(function(_0x314d09,_0x17b397){const _0x185a27=a204_0x43ca,_0x30a74c=_0x314d09();while(!![]){try{const _0x11bd16=-parseInt(_0x185a27(0xa7))/0x1*(parseInt(_0x185a27(0xaf))/0x2)+parseInt(_0x185a27(0x87))/0x3+parseInt(_0x185a27(0xa6))/0x4+-parseInt(_0x185a27(0x7d))/0x5+parseInt(_0x185a27(0xb0))/0x6*(parseInt(_0x185a27(0x88))/0x7)+parseInt(_0x185a27(0xab))/0x8*(parseInt(_0x185a27(0x9d))/0x9)+-parseInt(_0x185a27(0x93))/0xa*(parseInt(_0x185a27(0x85))/0xb);if(_0x11bd16===_0x17b397)break;else _0x30a74c['push'](_0x30a74c['shift']());}catch(_0x3f4a42){_0x30a74c['push'](_0x30a74c['shift']());}}}(a204_0x34ca,0x6bff2));import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';import{RABETBASE_ENV_VALUES}from'../../constant/env.js';import{RABETBASE_OUTPUT_FORMAT_VALUES}from'../../constant/output.js';import{RISK_LEVEL_VALUES}from'../../constant/risk.js';import{validateAppcode}from'../../commands/common/validate.js';function a204_0x34ca(){const _0x3ba0e8=['workspace','1024045jmSGrI','keys','app','defaultFormat','riskLevel','Pass\x20--appcode\x20<code>,\x20or\x20choose\x20one\x20of:\x20','pageSize','Default\x20output\x20format\x20for\x20this\x20workspace\x20app\x20profile','22nXFDyB','env','2299926fIEEOw','7noQEMk','API\x20directory\x20path\x20for\x20this\x20workspace\x20app\x20profile','Target\x20environment','flag','Missing\x20workspace\x20app\x20selector.','\x20--app\x20','appcode','join','\x20workspace\x20use\x20--app\x20<name>`.','updated','object','5401260xYLIZj','locale','Workspace\x20','\x20workspace\x20<init|use>\x20--app\x20<name>\x20[--appcode\x20<code>]','\x22\x20not\x20found.','\x20workspace\x20init\x20--appcode\x20<code>`\x20or\x20`','App\x20code\x20to\x20bind\x20to\x20this\x20workspace','apiDir','Invalid\x20appcode:\x20','Risk\x20level\x20for\x20this\x20workspace\x20app\x20profile','1539gxStXc','App\x20\x22','string','validation','length',').\x20Config:\x20','Use\x20`','Default\x20page\x20size\x20for\x20this\x20workspace\x20app\x20profile','format','3538360jdWTDd','19212faenhr','apps','\x20workspace\x20','str','14984NgfxJi','isArray','globalConfig','write','86Kgxjud','3492096ppnmqn','project','trim','init','App\x20locale\x20for\x20this\x20workspace\x20app\x20profile\x20(not\x20CLI\x20language;\x20reserved\x20for\x20later\x20app\x20use)'];a204_0x34ca=function(){return _0x3ba0e8;};return a204_0x34ca();}import{readConfigFile,readRawConfigWithLayers,resolveWriteConfigPath,writeConfigFile}from'../../context.js';import{workspaceAddDefinition}from'../../commands/workspace/add.js';import{workspaceRemoveDefinition}from'../../commands/workspace/remove.js';import{normalizeStoredDefaultApp}from'../../config/schema.js';const WORKSPACE_USAGE=CLI_BIN_NAME+a204_0x58ca5b(0x96),SAFE_PROFILE_KEYS=[a204_0x58ca5b(0x8e),a204_0x58ca5b(0x86),'apiDir',a204_0x58ca5b(0xa5),a204_0x58ca5b(0x83),a204_0x58ca5b(0x81),a204_0x58ca5b(0x94)],workspaceFlags=[{'name':a204_0x58ca5b(0x7f),'type':a204_0x58ca5b(0x9f),'description':'App\x20profile\x20name\x20to\x20use\x20in\x20this\x20workspace'},{'name':a204_0x58ca5b(0x8e),'type':a204_0x58ca5b(0x9f),'description':a204_0x58ca5b(0x99)},{'name':a204_0x58ca5b(0x86),'type':a204_0x58ca5b(0x9f),'description':a204_0x58ca5b(0x8a),'enum':[...RABETBASE_ENV_VALUES]},{'name':a204_0x58ca5b(0x9a),'type':a204_0x58ca5b(0x9f),'description':a204_0x58ca5b(0x89)},{'name':'defaultFormat','type':a204_0x58ca5b(0x9f),'description':a204_0x58ca5b(0x84),'enum':[...RABETBASE_OUTPUT_FORMAT_VALUES]},{'name':a204_0x58ca5b(0x83),'type':'number','description':a204_0x58ca5b(0xa4)},{'name':a204_0x58ca5b(0x81),'type':'string','description':a204_0x58ca5b(0x9c),'enum':[...RISK_LEVEL_VALUES]},{'name':a204_0x58ca5b(0x94),'type':'string','description':a204_0x58ca5b(0x7b)}];function a204_0x43ca(_0x408d70,_0x12e99b){_0x408d70=_0x408d70-0x79;const _0x34cacb=a204_0x34ca();let _0x43ca61=_0x34cacb[_0x408d70];return _0x43ca61;}function isRecord(_0x5903c2){const _0x44b46d=a204_0x58ca5b;return!!_0x5903c2&&typeof _0x5903c2===_0x44b46d(0x92)&&!Array[_0x44b46d(0xac)](_0x5903c2);}function assertValidAppcode(_0x424fb3){const _0x150be2=a204_0x58ca5b,{valid:_0x32a8b8,message:_0x4fe69d}=validateAppcode(_0x424fb3);if(!_0x32a8b8)throw CliErrors[_0x150be2(0xa0)](_0x150be2(0x9b)+_0x424fb3,_0x4fe69d);}function sanitizeProfile(_0xff2be6){if(!isRecord(_0xff2be6))return{};const _0x3b080e={};for(const _0x5233ba of SAFE_PROFILE_KEYS){if(_0xff2be6[_0x5233ba]!==undefined)_0x3b080e[_0x5233ba]=_0xff2be6[_0x5233ba];}return _0x3b080e;}function cloneProfile(_0x3fade8){return isRecord(_0x3fade8)?{..._0x3fade8}:{};}function collectWorkspaceProfileOverrides(_0x9baffa){const _0x24b2f7=a204_0x58ca5b,_0x46dfb4={},_0x404203=_0x9baffa['str']('env'),_0x77e80d=_0x9baffa[_0x24b2f7(0xaa)](_0x24b2f7(0x9a)),_0xde5cd=_0x9baffa[_0x24b2f7(0xaa)](_0x24b2f7(0x80)),_0x28da98=_0x9baffa[_0x24b2f7(0x8b)](_0x24b2f7(0x83)),_0x238238=_0x9baffa[_0x24b2f7(0xaa)](_0x24b2f7(0x81)),_0xd505d5=_0x9baffa[_0x24b2f7(0xaa)]('locale');if(_0x404203)_0x46dfb4[_0x24b2f7(0x86)]=_0x404203;if(_0x77e80d)_0x46dfb4[_0x24b2f7(0x9a)]=_0x77e80d;if(_0xde5cd)_0x46dfb4[_0x24b2f7(0xa5)]=_0xde5cd;if(_0x28da98!==undefined&&_0x28da98!=='')_0x46dfb4[_0x24b2f7(0x83)]=Number(_0x28da98);if(_0x238238)_0x46dfb4[_0x24b2f7(0x81)]=_0x238238;if(_0xd505d5)_0x46dfb4[_0x24b2f7(0x94)]=_0xd505d5;return _0x46dfb4;}async function validateWorkspaceArgs(_0x186d7d){const _0x5c6c60=a204_0x58ca5b,_0x53791d=_0x186d7d['str'](_0x5c6c60(0x7f))[_0x5c6c60(0x79)](),_0xed62af=_0x186d7d[_0x5c6c60(0xaa)](_0x5c6c60(0x8e))[_0x5c6c60(0x79)]();if(!_0x53791d&&!_0xed62af)throw CliErrors['validation'](_0x5c6c60(0x8c),_0x5c6c60(0xa3)+CLI_BIN_NAME+'\x20workspace\x20init\x20--appcode\x20<code>`\x20or\x20`'+CLI_BIN_NAME+'\x20workspace\x20use\x20--app\x20<name>`.');if(_0xed62af)assertValidAppcode(_0xed62af);}function resolveKnownApps(){const _0x40ca51=a204_0x58ca5b,{config:_0x3228f9,layers:_0x444e2e}=readRawConfigWithLayers(),_0x1a04d6=isRecord(_0x3228f9[_0x40ca51(0xa8)])?_0x3228f9[_0x40ca51(0xa8)]:{},_0x4133dd=isRecord(_0x444e2e['globalConfig'][_0x40ca51(0xa8)])?_0x444e2e[_0x40ca51(0xad)][_0x40ca51(0xa8)]:{};return{..._0x4133dd,..._0x1a04d6};}async function configureWorkspace(_0x321e63,_0x2513e0){const _0x273eac=a204_0x58ca5b,_0x49a7b8=_0x321e63[_0x273eac(0xaa)]('app')[_0x273eac(0x79)](),_0x551023=_0x321e63[_0x273eac(0xaa)]('appcode')[_0x273eac(0x79)](),_0x54ec93=_0x49a7b8||_0x551023;if(!_0x54ec93)throw CliErrors['validation'](_0x273eac(0x8c),'Use\x20`'+CLI_BIN_NAME+_0x273eac(0x98)+CLI_BIN_NAME+_0x273eac(0x90));if(_0x551023)assertValidAppcode(_0x551023);const _0x4cb1fd=resolveWriteConfigPath(_0x273eac(0xb1)),_0x14e320=readConfigFile(_0x4cb1fd),_0x4b4569=resolveKnownApps(),_0x36313d=isRecord(_0x14e320[_0x273eac(0xa8)])?{..._0x14e320[_0x273eac(0xa8)]}:{},_0x5bc63d=cloneProfile(_0x36313d[_0x54ec93]),_0x135929=sanitizeProfile(_0x4b4569[_0x54ec93]),_0x27c3c9=_0x551023?{}:_0x135929,_0x44b3c0=_0x551023||_0x27c3c9['appcode'];if(!_0x44b3c0){const _0xcdb82c=Object[_0x273eac(0x7e)](_0x4b4569),_0x350539=_0xcdb82c[_0x273eac(0xa1)]===0x0?_0x273eac(0xa3)+CLI_BIN_NAME+_0x273eac(0xa9)+_0x2513e0+_0x273eac(0x8d)+_0x54ec93+'\x20--appcode\x20<code>`.':_0x273eac(0x82)+_0xcdb82c[_0x273eac(0x8f)](',\x20');throw CliErrors['validation'](_0x273eac(0x9e)+_0x54ec93+_0x273eac(0x97),_0x350539);}assertValidAppcode(String(_0x44b3c0));const _0xe41043={..._0x27c3c9,..._0x5bc63d,'appcode':String(_0x44b3c0),...collectWorkspaceProfileOverrides(_0x321e63)};return _0x36313d[_0x54ec93]=_0xe41043,_0x14e320[_0x273eac(0xa8)]=_0x36313d,normalizeStoredDefaultApp(_0x14e320,_0x54ec93),delete _0x14e320[_0x273eac(0x8e)],delete _0x14e320[_0x273eac(0x7f)],_0xe41043[_0x273eac(0x86)]&&(_0x14e320['env']=_0xe41043['env']),writeConfigFile(_0x4cb1fd,_0x14e320),{'ok':!![],'message':_0x273eac(0x95)+(_0x2513e0===_0x273eac(0x7a)?'initialized':_0x273eac(0x91))+':\x20'+_0x54ec93+'\x20(appcode:\x20'+_0xe41043[_0x273eac(0x8e)]+_0x273eac(0xa2)+_0x4cb1fd+'.\x20Credentials:\x20not\x20written.','data':{'operation':'workspace.'+_0x2513e0,'configPath':_0x4cb1fd,'app':_0x54ec93,'appcode':_0xe41043['appcode'],'env':_0xe41043[_0x273eac(0x86)]??null,'credentialsWritten':![]}};}const workspaceInitDefinition={'service':a204_0x58ca5b(0x7c),'command':a204_0x58ca5b(0x7a),'description':'Initialize\x20the\x20current\x20workspace\x20app\x20binding','risk':a204_0x58ca5b(0xae),'requiresAuth':![],'requiresAppCode':![],'args':[],'flags':workspaceFlags,'validate':validateWorkspaceArgs,'execute':_0x89cf40=>configureWorkspace(_0x89cf40,'init')},workspaceUseDefinition={'service':'workspace','command':'use','description':'Switch\x20the\x20current\x20workspace\x20app\x20binding','risk':a204_0x58ca5b(0xae),'requiresAuth':![],'requiresAppCode':![],'args':[],'flags':workspaceFlags,'validate':validateWorkspaceArgs,'execute':_0x5e664c=>configureWorkspace(_0x5e664c,'use')};export const workspaceDefinitions=[workspaceInitDefinition,workspaceUseDefinition,workspaceAddDefinition,workspaceRemoveDefinition];export{WORKSPACE_USAGE};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a205_0x4152a2=a205_0x30eb;(function(_0x31c5c,_0x7712fa){const _0x4ee33a=a205_0x30eb,_0x52ae99=_0x31c5c();while(!![]){try{const _0x44e165=parseInt(_0x4ee33a(0x1ab))/0x1+parseInt(_0x4ee33a(0x1a2))/0x2+-parseInt(_0x4ee33a(0x1ad))/0x3*(parseInt(_0x4ee33a(0x1a7))/0x4)+parseInt(_0x4ee33a(0x1a4))/0x5+-parseInt(_0x4ee33a(0x1a3))/0x6*(-parseInt(_0x4ee33a(0x1ac))/0x7)+parseInt(_0x4ee33a(0x1aa))/0x8+-parseInt(_0x4ee33a(0x1a9))/0x9;if(_0x44e165===_0x7712fa)break;else _0x52ae99['push'](_0x52ae99['shift']());}catch(_0x354a38){_0x52ae99['push'](_0x52ae99['shift']());}}}(a205_0x2295,0x54184));function a205_0x2295(){const _0x1c0f19=['1304994fhfDUD','342ZrJNpJ','3214715WNVKgF','name','remove','436szIuOX','workspace\x20remove','15074163OiskbU','631408YauZMe','304075FLTMfK','76510ODIzSz','7764zCkGmw','workspace'];a205_0x2295=function(){return _0x1c0f19;};return a205_0x2295();}function a205_0x30eb(_0x13824,_0x3e50c0){_0x13824=_0x13824-0x1a1;const _0x22951b=a205_0x2295();let _0x30ebc7=_0x22951b[_0x13824];return _0x30ebc7;}import{buildAppRemoveFlags,runAppRemove,validateAppName}from'../../commands/common/app-registry.js';export const workspaceRemoveDefinition={'service':a205_0x4152a2(0x1a1),'command':a205_0x4152a2(0x1a6),'description':'Remove\x20an\x20app\x20profile\x20from\x20the\x20current\x20workspace\x20(or\x20--global)','risk':'write','requiresAuth':![],'requiresAppCode':![],'args':[{'name':a205_0x4152a2(0x1a5),'description':'App\x20profile\x20name\x20to\x20remove','required':!![]}],'flags':buildAppRemoveFlags(),'validate':_0x30b214=>validateAppName(_0x30b214,a205_0x4152a2(0x1a8)),'execute':_0x3bb83d=>runAppRemove(_0x3bb83d,'workspace\x20remove')};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const DOMAIN_CONFIG_FIELDS: readonly ["userDomain", "apiDomain", "runtimeDomain", "skillDomain", "kbDomain", "appDomain"];
|
|
1
|
+
export declare const DOMAIN_CONFIG_FIELDS: readonly ["userDomain", "apiDomain", "runtimeDomain", "skillDomain", "kbDomain", "appDomain", "localDomain", "certificateDomain"];
|
|
2
2
|
export type DomainConfigField = (typeof DOMAIN_CONFIG_FIELDS)[number];
|
|
3
3
|
export type DomainConfig = Partial<Record<DomainConfigField, string>>;
|
|
4
4
|
/** Old domain keys accepted only while reading existing configuration. */
|