@lovrabet/rabetbase-cli 2.4.6-beta.2 → 2.4.6-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/api-doc.js +1 -1
- package/lib/api/fetch-model-list.js +1 -1
- package/lib/api/generate-api-file.js +1 -1
- package/lib/auth/auth-server-ui.js +1 -1
- package/lib/auth/auth-server.js +1 -1
- package/lib/auth/constant.js +1 -1
- package/lib/auth/get-cookie.js +1 -1
- package/lib/auth/get-session-user.js +1 -1
- package/lib/auth/is-session-valid.js +1 -1
- package/lib/auth/login-success-html.js +1 -1
- package/lib/auth/logout.js +1 -1
- package/lib/cli-flags.js +1 -1
- package/lib/cli.js +1 -1
- package/lib/commands/api/generate.js +1 -1
- package/lib/commands/api/index.js +1 -1
- package/lib/commands/api/list.js +1 -1
- package/lib/commands/api/pull.js +1 -1
- package/lib/commands/api/shared.js +1 -1
- package/lib/commands/app/index.js +1 -1
- package/lib/commands/app/list.js +1 -1
- package/lib/commands/app/members-list.js +1 -1
- package/lib/commands/app/remote-directory.js +1 -1
- package/lib/commands/app/shared.js +1 -1
- package/lib/commands/app-config/delete.js +1 -1
- package/lib/commands/app-config/get.js +1 -1
- package/lib/commands/app-config/index.js +1 -1
- package/lib/commands/app-config/list.js +1 -1
- package/lib/commands/app-config/set.js +1 -1
- package/lib/commands/app-config/shared.js +1 -1
- package/lib/commands/auth/index.js +1 -1
- package/lib/commands/bff/create.js +1 -1
- package/lib/commands/bff/delete.js +1 -1
- package/lib/commands/bff/detail.js +1 -1
- package/lib/commands/bff/index.js +1 -1
- package/lib/commands/bff/list.js +1 -1
- package/lib/commands/bff/pull.js +1 -1
- package/lib/commands/bff/push.js +1 -1
- package/lib/commands/bff/status.js +1 -1
- package/lib/commands/cli-skill/index.js +1 -1
- package/lib/commands/cli-update.js +1 -1
- package/lib/commands/codegen/index.js +1 -1
- package/lib/commands/codegen/sdk.js +1 -1
- package/lib/commands/codegen/sql.js +1 -1
- package/lib/commands/common/app-registry.js +1 -1
- package/lib/commands/common/app-selector.js +1 -1
- package/lib/commands/common/async-task.js +1 -1
- package/lib/commands/common/dry-run.js +1 -1
- package/lib/commands/common/flags.js +1 -1
- package/lib/commands/common/local-file.js +1 -1
- package/lib/commands/common/validate.js +1 -1
- package/lib/commands/config/get.js +1 -1
- package/lib/commands/config/index.js +1 -1
- package/lib/commands/config/list.js +1 -1
- package/lib/commands/config/set.js +1 -1
- package/lib/commands/config/shared.js +1 -1
- package/lib/commands/data/filter.js +1 -1
- package/lib/commands/data/getOne.js +1 -1
- package/lib/commands/data/index.js +1 -1
- package/lib/commands/data/shared.js +1 -1
- package/lib/commands/dataset/business-group-update.js +1 -1
- package/lib/commands/dataset/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/tables.js +1 -1
- package/lib/commands/db/test.js +1 -1
- package/lib/commands/db/update.js +1 -1
- package/lib/commands/doctor.js +1 -1
- package/lib/commands/file/index.js +1 -1
- package/lib/commands/init/index.js +1 -1
- package/lib/commands/issue/index.js +1 -1
- package/lib/commands/issue/nudge.js +1 -1
- package/lib/commands/issue/report.js +1 -1
- package/lib/commands/issue/shared.js +1 -1
- package/lib/commands/kb/create.js +1 -1
- package/lib/commands/kb/delete.js +1 -1
- package/lib/commands/kb/detail.js +1 -1
- package/lib/commands/kb/index.js +1 -1
- package/lib/commands/kb/list.js +1 -1
- package/lib/commands/kb/shared.js +1 -1
- package/lib/commands/kb/update.js +1 -1
- package/lib/commands/logs/index.js +1 -1
- package/lib/commands/menu/asset-update.js +1 -1
- package/lib/commands/menu/delete.js +1 -1
- package/lib/commands/menu/external-link-create.js +1 -1
- package/lib/commands/menu/external-link-update.js +1 -1
- package/lib/commands/menu/group-create.js +1 -1
- package/lib/commands/menu/group-update.js +1 -1
- package/lib/commands/menu/index.js +1 -1
- package/lib/commands/menu/list.js +1 -1
- package/lib/commands/menu/move.js +1 -1
- package/lib/commands/menu/regroup-start.js +1 -1
- package/lib/commands/menu/rename.js +1 -1
- package/lib/commands/menu/shared/compare-table.js +1 -1
- package/lib/commands/menu/shared/delete-plan.js +1 -1
- package/lib/commands/menu/shared/facts.js +1 -1
- package/lib/commands/menu/shared/index.js +1 -1
- package/lib/commands/menu/shared/inquirer.js +1 -1
- package/lib/commands/menu/shared/local-pages.js +1 -1
- package/lib/commands/menu/shared/logic.js +1 -1
- package/lib/commands/menu/shared/mutations.js +1 -1
- package/lib/commands/menu/shared/service.js +1 -1
- package/lib/commands/menu/shared/sync-core.js +1 -1
- package/lib/commands/menu/shared/update-core.js +1 -1
- package/lib/commands/menu/shared/valid-url.js +1 -1
- package/lib/commands/menu/sync.js +1 -1
- package/lib/commands/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/schema.js +1 -1
- package/lib/constant/cdn.js +1 -1
- package/lib/constant/cli.js +1 -1
- package/lib/constant/defaults.js +1 -1
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/constant/output.js +1 -1
- package/lib/constant/paths.js +1 -1
- package/lib/constant/risk.js +1 -1
- package/lib/context/app-resolver.js +1 -1
- package/lib/context/auth-resolver.js +1 -1
- package/lib/context/config-loader.js +1 -1
- package/lib/context.js +1 -1
- package/lib/core/alias-resolver.js +1 -1
- package/lib/core/api-client.js +1 -1
- package/lib/core/bff/config.js +1 -1
- package/lib/core/bff/file-system.js +1 -1
- package/lib/core/bff/hash.js +1 -1
- package/lib/core/bff/lock.js +1 -1
- package/lib/core/bff/utils.js +1 -1
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/page/file-system.js +1 -1
- package/lib/core/page/hash.js +1 -1
- package/lib/core/page/lock.js +1 -1
- package/lib/core/sql-index-auditor.js +1 -1
- package/lib/core/sql-sync/config.js +1 -1
- package/lib/core/sql-sync/file-system.js +1 -1
- package/lib/core/sql-sync/hash.js +1 -1
- package/lib/core/sql-sync/lock.js +1 -1
- package/lib/core/sql-sync/utils.js +1 -1
- package/lib/core/sql-validator.js +1 -1
- package/lib/errors.js +1 -1
- package/lib/framework/build-all-flags.js +1 -1
- package/lib/framework/error-output.js +1 -1
- package/lib/framework/explicit-yes.js +1 -1
- package/lib/framework/flags.js +1 -1
- package/lib/framework/help.js +1 -1
- package/lib/framework/index.js +1 -1
- package/lib/framework/output.js +1 -1
- package/lib/framework/response.js +1 -1
- package/lib/framework/runner-alias.js +1 -1
- package/lib/framework/runner.js +1 -1
- package/lib/framework/schema-export.js +1 -1
- package/lib/framework/types.js +1 -1
- package/lib/generated/build-info.d.ts +4 -4
- package/lib/generated/build-info.js +1 -1
- package/lib/help.js +1 -1
- package/lib/postinstall.js +1 -1
- package/lib/runtime/confirmation.js +1 -1
- package/lib/runtime/event.js +1 -1
- package/lib/runtime/index.js +1 -1
- package/lib/runtime/queue.js +1 -1
- package/lib/runtime/resolve.js +1 -1
- package/lib/skills/builtin-skill.js +1 -1
- package/lib/skills/main.js +1 -1
- package/lib/skills/npx-skills-add.js +1 -1
- package/lib/skills/skill-presence.js +1 -1
- package/lib/telemetry/cli-command-trace.js +1 -1
- package/lib/telemetry/cli-help-trace.js +1 -1
- package/lib/telemetry/ensure-cli-otel-config.js +1 -1
- package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
- package/lib/telemetry/send-cli-trace-log.js +1 -1
- package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
- package/lib/utils/ai_config.js +1 -1
- package/lib/utils/apply-jq-filter.js +1 -1
- package/lib/utils/cdn-config.js +1 -1
- package/lib/utils/check-sdk-version.js +1 -1
- package/lib/utils/cli-version-check.js +1 -1
- package/lib/utils/cli-version-policy.js +1 -1
- package/lib/utils/config.js +1 -1
- package/lib/utils/entity-with-id.js +1 -1
- package/lib/utils/file-utils.js +1 -1
- package/lib/utils/guides-cdn.js +1 -1
- package/lib/utils/http-client.js +1 -1
- package/lib/utils/is-non-interactive.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/params.js +1 -1
- package/lib/utils/platform.js +1 -1
- package/lib/utils/rules-cdn.js +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.js +1 -1
- package/lib/utils/update-notice.js +1 -1
- package/lib/utils/version.js +1 -1
- package/lib/utils/with-active-cookie.js +1 -1
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +1 -1
- package/skills/rabetbase/SKILL.md +3 -3
- package/skills/rabetbase/references/rabetbase-ocr.md +17 -2
- package/skills/rabetbase.manifest.json +3 -3
package/lib/commands/sql/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a191_0x149c13=a191_0x3b48;(function(_0x5f5993,_0x30eba3){const _0x466b9e=a191_0x3b48,_0x4a69b8=_0x5f5993();while(!![]){try{const _0x30affc=-parseInt(_0x466b9e(0xcf))/0x1+parseInt(_0x466b9e(0xee))/0x2*(-parseInt(_0x466b9e(0xcb))/0x3)+-parseInt(_0x466b9e(0xda))/0x4+-parseInt(_0x466b9e(0xd0))/0x5*(parseInt(_0x466b9e(0xfa))/0x6)+-parseInt(_0x466b9e(0xd2))/0x7*(parseInt(_0x466b9e(0xe1))/0x8)+-parseInt(_0x466b9e(0xe5))/0x9+parseInt(_0x466b9e(0xf2))/0xa;if(_0x30affc===_0x30eba3)break;else _0x4a69b8['push'](_0x4a69b8['shift']());}catch(_0x40ce3b){_0x4a69b8['push'](_0x4a69b8['shift']());}}}(a191_0x6475,0x82362));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';function a191_0x6475(){const _0x28103e=['sqlRootDir','lockFilePath','sqlCode','3373320zZvHrf','Would\x20pull\x20','string','\x20written,\x20','sqlName','split','paging','131976QFUpxL','\x20failed','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','boolean','9008658cGXmqq','sql','read','push','join','path','conflict','No\x20remote\x20SQL\x20queries\x20matched.','toISOString','178cArBbN','skipped','name','trimStart','41173030mmVYSI','sqls','message','apps','totalCount','sqlRoot','mybatisXml','nonInteractive','84LcmKvV','dbId','test','catch','filter','replace','POST','lastSync','utf8','length','\x20skipped,\x20','bool','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','local\x20differs\x20from\x20remote','pull','sqlcode','unchanged','force','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','cancelled','7836EBrciq','str','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','sqlContent','331258VPjDVk','260900QDlmEw','Force\x20pull\x20cancelled.','189TFQfty','description','Force\x20overwrite\x20local\x20unsynced\x20changes','Filter\x20by\x20SQL\x20display\x20name','appCode'];a191_0x6475=function(){return _0x28103e;};return a191_0x6475();}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(_0x79b2d8,_0x5a2288){const _0x505ff6=a191_0x3b48,_0x4bf279=[];let _0x14d5c2=0x1;while(!![]){const _0x48f5dc=await listSqlQueries(_0x79b2d8,{'currentPage':_0x14d5c2,'pageSize':PAGE_SIZE,'sqlCode':_0x5a2288[_0x505ff6(0xd9)],'sqlName':_0x5a2288[_0x505ff6(0xde)]}),_0x229a14=_0x48f5dc['tableData']??[];_0x4bf279[_0x505ff6(0xe8)](..._0x229a14);if(_0x229a14[_0x505ff6(0xc0)]===0x0)break;const _0x3971d8=_0x48f5dc[_0x505ff6(0xe0)]?.[_0x505ff6(0xf6)];if(_0x3971d8!=null?_0x4bf279[_0x505ff6(0xc0)]>=_0x3971d8:_0x229a14[_0x505ff6(0xc0)]<PAGE_SIZE)break;_0x14d5c2++;}return _0x4bf279;}async function ensureSqlContent(_0x27b225){const _0x5144a3=a191_0x3b48;if(_0x27b225[_0x5144a3(0xce)]!=null&&String(_0x27b225['sqlContent'])[_0x5144a3(0xc0)]>0x0)return _0x27b225;return getSqlQueryDetail(_0x27b225[_0x5144a3(0xd9)]);}export const sqlPull={'service':'sql','command':a191_0x149c13(0xc5),'description':a191_0x149c13(0xe3),'risk':a191_0x149c13(0xe7),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a191_0x149c13(0xf0),'type':a191_0x149c13(0xdc),'description':a191_0x149c13(0xd5)},{'name':a191_0x149c13(0xc8),'type':a191_0x149c13(0xe4),'description':a191_0x149c13(0xd4)}],async 'dryRun'(_0x2cc865){const _0x4bfe60=a191_0x149c13,_0x294b71=loadSqlProjectConfig(_0x2cc865[_0x4bfe60(0xd6)]),_0x1a7983=await readSqlLockFile(_0x294b71['lockFilePath']),{appLock:_0x17df4a}=ensureSqlLockScope(_0x1a7983??createEmptySqlLock(),_0x294b71[_0x4bfe60(0xd6)],_0x294b71[_0x4bfe60(0xf7)],_0x4bfe60(0xc5)),_0x378e46=await fetchAllSqlQueries(_0x2cc865[_0x4bfe60(0xd6)],{'sqlCode':_0x2cc865[_0x4bfe60(0xcc)](_0x4bfe60(0xc6))||undefined,'sqlName':_0x2cc865[_0x4bfe60(0xcc)](_0x4bfe60(0xf0))||undefined}),_0x4cae1b=[];for(const _0x3dfa35 of _0x378e46){const _0x2a6816=await ensureSqlContent(_0x3dfa35),_0x1f7fa3=ensureRemoteSqlContent(_0x2a6816),_0x109100=detectModeFromSql(_0x2a6816),_0x1fc111=_0x2a6816[_0x4bfe60(0xfb)]?await getDbName(_0x2cc865[_0x4bfe60(0xd6)],Number(_0x2a6816[_0x4bfe60(0xfb)]))[_0x4bfe60(0xfd)](()=>undefined):undefined,_0x5810d5=buildLocalSqlFileContent({'sqlCode':_0x2a6816[_0x4bfe60(0xd9)],'sqlName':_0x2a6816[_0x4bfe60(0xde)],'dbId':_0x2a6816[_0x4bfe60(0xfb)]},_0x1f7fa3,{'dbName':_0x1fc111,'mode':_0x109100,'syncedAt':new Date()[_0x4bfe60(0xed)](),'description':_0x2a6816[_0x4bfe60(0xd3)]}),_0x2e4fa6=buildSqlLockEntry(_0x2a6816,_0x1f7fa3,'',{'dbName':_0x1fc111}),_0x2194ba=resolveLocalSqlFilePath(_0x294b71,_0x2a6816['sqlCode'],_0x2e4fa6);let _0x2d817b='would_pull',_0x4ca4f3;if(await fileExists(_0x2194ba)){const _0x57576a=await readFile(_0x2194ba,_0x4bfe60(0xbf));isEquivalentPulledSqlFile(_0x57576a,_0x5810d5,_0x109100)?(_0x2d817b=_0x4bfe60(0xef),_0x4ca4f3=_0x4bfe60(0xc7)):(_0x2d817b=_0x4bfe60(0xeb),_0x4ca4f3=_0x4bfe60(0xcd));}_0x4cae1b['push']({'sqlCode':_0x2a6816[_0x4bfe60(0xd9)],'sqlName':_0x2a6816['sqlName'],'filePath':_0x2194ba,'status':_0x2d817b,'reason':_0x4ca4f3});}return{'method':_0x4bfe60(0x100),'url':_0x4bfe60(0xc9),'body':{'appCode':_0x2cc865[_0x4bfe60(0xd6)],'sqlCode':_0x2cc865[_0x4bfe60(0xcc)]('sqlcode')||null,'sqlName':_0x2cc865[_0x4bfe60(0xcc)](_0x4bfe60(0xf0))||null,'files':_0x4cae1b},'description':_0x4bfe60(0xdb)+_0x4cae1b[_0x4bfe60(0xc0)]+'\x20SQL\x20file(s)\x20into\x20'+_0x294b71['sqlRootDir']};},async 'execute'(_0x547548){const _0x397448=a191_0x149c13,_0x3e7589=loadSqlProjectConfig(_0x547548[_0x397448(0xd6)]),_0x5921c5=await readSqlLockFile(_0x3e7589['lockFilePath']),{lockData:_0x597ce0,appLock:_0x2406ed}=ensureSqlLockScope(_0x5921c5??createEmptySqlLock(),_0x3e7589[_0x397448(0xd6)],_0x3e7589[_0x397448(0xf7)],_0x397448(0xc5)),_0x4ab0df=_0x547548[_0x397448(0xc2)](_0x397448(0xc8)),_0xbdfb53=await fetchAllSqlQueries(_0x547548[_0x397448(0xd6)],{'sqlCode':_0x547548[_0x397448(0xcc)](_0x397448(0xc6))||undefined,'sqlName':_0x547548[_0x397448(0xcc)](_0x397448(0xf0))||undefined});if(_0xbdfb53[_0x397448(0xc0)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x397448(0xec)};const _0xea739f=[],_0x4152f9=[];for(const _0x3d63a7 of _0xbdfb53){try{_0xea739f[_0x397448(0xe8)](await ensureSqlContent(_0x3d63a7));}catch(_0x80c850){_0x4152f9[_0x397448(0xe8)]({'sqlCode':_0x3d63a7[_0x397448(0xd9)],'error':_0x80c850 instanceof Error?_0x80c850[_0x397448(0xf4)]:String(_0x80c850)});}}if(_0x4ab0df&&!_0x547548[_0x397448(0xf9)]){let _0x4e0e4f=![];for(const _0x5047b8 of _0xea739f){const _0x2a22e7=detectModeFromSql(_0x5047b8),_0x1ab5d0=_0x5047b8['dbId']?await getDbName(_0x547548[_0x397448(0xd6)],Number(_0x5047b8['dbId']))[_0x397448(0xfd)](()=>undefined):undefined,_0x513447=buildLocalSqlFileContent({'sqlCode':_0x5047b8[_0x397448(0xd9)],'sqlName':_0x5047b8[_0x397448(0xde)],'dbId':_0x5047b8[_0x397448(0xfb)]},ensureRemoteSqlContent(_0x5047b8),{'dbName':_0x1ab5d0,'mode':_0x2a22e7,'syncedAt':new Date()[_0x397448(0xed)](),'description':_0x5047b8[_0x397448(0xd3)]}),_0x415cb8=resolveLocalSqlFilePath(_0x3e7589,_0x5047b8['sqlCode'],buildSqlLockEntry(_0x5047b8,ensureRemoteSqlContent(_0x5047b8),'',{'dbName':_0x1ab5d0}));if(await fileExists(_0x415cb8)){const _0x55518f=await readFile(_0x415cb8,_0x397448(0xbf));if(!isEquivalentPulledSqlFile(_0x55518f,_0x513447,_0x2a22e7)){_0x4e0e4f=!![];break;}}}if(_0x4e0e4f){const _0x5ded31=await confirmForceOverwrite(_0x397448(0xc3));if(!_0x5ded31)throw CliErrors[_0x397448(0xca)](_0x397448(0xd1));}}const _0x39716b=cloneSqlLockData(_0x597ce0),_0x28b88e=_0x39716b[_0x397448(0xf5)][_0x3e7589[_0x397448(0xd6)]],_0xc6e1d5=[],_0xac8bc6=[];for(const _0x4662e3 of _0xea739f){const _0x567f79=_0x28b88e[_0x397448(0xf3)][_0x4662e3[_0x397448(0xd9)]],_0x15cb3a=ensureRemoteSqlContent(_0x4662e3),_0x1f817d=detectModeFromSql(_0x4662e3),_0x478431=_0x4662e3[_0x397448(0xfb)]?await getDbName(_0x547548['appCode'],Number(_0x4662e3['dbId']))['catch'](()=>undefined):undefined,_0x3e5703=buildLocalSqlFileContent({'sqlCode':_0x4662e3[_0x397448(0xd9)],'sqlName':_0x4662e3[_0x397448(0xde)],'dbId':_0x4662e3[_0x397448(0xfb)]},_0x15cb3a,{'dbName':_0x478431,'mode':_0x1f817d,'syncedAt':new Date()[_0x397448(0xed)](),'description':_0x4662e3[_0x397448(0xd3)]}),_0x5bf15d=buildSqlLockEntry(_0x4662e3,_0x15cb3a,computeSqlContentHash(_0x3e5703),{'dbName':_0x478431}),_0x4c7c9e=_0x5bf15d['path'],_0x3f0457=join(_0x3e7589['sqlRootDir'],_0x4c7c9e);try{if(await fileExists(_0x3f0457)){const _0x4b4579=await readFile(_0x3f0457,_0x397448(0xbf));if(isEquivalentPulledSqlFile(_0x4b4579,_0x3e5703,_0x1f817d)){_0xac8bc6['push']({'sqlCode':_0x4662e3[_0x397448(0xd9)],'reason':_0x397448(0xc7)}),_0x28b88e[_0x397448(0xf3)][_0x4662e3[_0x397448(0xd9)]]={..._0x5bf15d,'hash':computeSqlContentHash(_0x4b4579),'path':_0x4c7c9e};continue;}if(!_0x4ab0df){_0xac8bc6[_0x397448(0xe8)]({'sqlCode':_0x4662e3[_0x397448(0xd9)],'reason':_0x397448(0xc4)});continue;}}const _0x3edee9=_0x567f79?.[_0x397448(0xea)]?join(_0x3e7589[_0x397448(0xd7)],_0x567f79[_0x397448(0xea)]):undefined;_0x3edee9&&_0x3edee9!==_0x3f0457&&await fileExists(_0x3edee9)&&await rm(_0x3edee9,{'force':!![]}),await ensureParentDirectory(_0x3f0457),await writeFile(_0x3f0457,_0x3e5703,_0x397448(0xbf)),_0x28b88e[_0x397448(0xf3)][_0x4662e3[_0x397448(0xd9)]]={..._0x5bf15d,'path':_0x4c7c9e},_0xc6e1d5['push']({'sqlCode':_0x4662e3[_0x397448(0xd9)],'filePath':_0x3f0457});}catch(_0x86d948){_0x4152f9[_0x397448(0xe8)]({'sqlCode':_0x4662e3['sqlCode'],'error':_0x86d948 instanceof Error?_0x86d948[_0x397448(0xf4)]:String(_0x86d948)});}}return _0x28b88e[_0x397448(0x101)]=new Date()[_0x397448(0xed)](),await writeSqlLockFile(_0x3e7589[_0x397448(0xd8)],_0x39716b),{'ok':_0x4152f9['length']===0x0,'data':{'pulled':_0xc6e1d5,'skipped':_0xac8bc6,'failed':_0x4152f9},'message':'Pull\x20complete:\x20'+_0xc6e1d5['length']+_0x397448(0xdd)+_0xac8bc6[_0x397448(0xc0)]+_0x397448(0xc1)+_0x4152f9[_0x397448(0xc0)]+_0x397448(0xe2)};}};function detectModeFromSql(_0xe30de7){const _0x5b8261=a191_0x149c13,_0x46c86c=ensureRemoteSqlContent(_0xe30de7),_0x291e7d=stripLocalSqlMetadata(_0x46c86c,_0x5b8261(0xf8))[_0x5b8261(0xf1)]();if(/^<(select|insert|update|delete)\b/i['test'](_0x291e7d))return _0x5b8261(0xf8);return _0x5b8261(0xe6);}function a191_0x3b48(_0x890c8e,_0x1a6329){_0x890c8e=_0x890c8e-0xbf;const _0x64751f=a191_0x6475();let _0x3b48f1=_0x64751f[_0x890c8e];return _0x3b48f1;}function isEquivalentPulledSqlFile(_0x5a508c,_0x435e39,_0x2baff0){return normalizePullComparableContent(_0x5a508c,_0x2baff0)===normalizePullComparableContent(_0x435e39,_0x2baff0);}function normalizePullComparableContent(_0xf82a33,_0x5dbed1){const _0x52cac2=a191_0x149c13,_0x3f9991=_0xf82a33[_0x52cac2(0xff)](/\r\n/g,'\x0a')[_0x52cac2(0xdf)]('\x0a'),_0x26825f=_0x3f9991[_0x52cac2(0xfe)](_0xf3fe35=>!isSyncedAtMetadataLine(_0xf3fe35,_0x5dbed1));return _0x26825f[_0x52cac2(0xe9)]('\x0a');}function isSyncedAtMetadataLine(_0x51fed0,_0x491e7b){const _0x371111=a191_0x149c13;if(_0x491e7b===_0x371111(0xf8))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x371111(0xfc)](_0x51fed0);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x371111(0xfc)](_0x51fed0);}
|
|
1
|
+
const a191_0x297d7a=a191_0x34c2;(function(_0x409495,_0x14c66e){const _0x46cc48=a191_0x34c2,_0x2ed9be=_0x409495();while(!![]){try{const _0x918a82=parseInt(_0x46cc48(0x105))/0x1+-parseInt(_0x46cc48(0x11c))/0x2+-parseInt(_0x46cc48(0xe6))/0x3+parseInt(_0x46cc48(0x11d))/0x4+parseInt(_0x46cc48(0x115))/0x5+parseInt(_0x46cc48(0xec))/0x6+parseInt(_0x46cc48(0x101))/0x7*(parseInt(_0x46cc48(0x116))/0x8);if(_0x918a82===_0x14c66e)break;else _0x2ed9be['push'](_0x2ed9be['shift']());}catch(_0x2aa11d){_0x2ed9be['push'](_0x2ed9be['shift']());}}}(a191_0xb44d,0xe645d));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';function a191_0xb44d(){const _0x4ebc17=['local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','string','70HbMVsQ','tableData','lastSync','nonInteractive','10327qGLDrs','apps','unchanged','sqlcode','description','trimStart','toISOString','\x20written,\x20','test','sqlRootDir','Filter\x20by\x20SQL\x20display\x20name','path','\x20failed','sqls','Force\x20overwrite\x20local\x20unsynced\x20changes','skipped','2267475WoCUUc','995128WWKbuI','mybatisXml','would_pull','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','bool','sqlContent','3505130BAZyFD','3932812CaPlJf','push','totalCount','sqlRoot','5190387DEQwIf','sqlName','cancelled','POST','utf8','No\x20remote\x20SQL\x20queries\x20matched.','10409736mYUmpa','length','force','pull','dbId','\x20skipped,\x20','lockFilePath','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','conflict','str','replace','name','sql','appCode','join','sqlCode','Force\x20pull\x20cancelled.','catch'];a191_0xb44d=function(){return _0x4ebc17;};return a191_0xb44d();}import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';function a191_0x34c2(_0x46a97d,_0x56969c){_0x46a97d=_0x46a97d-0xe4;const _0xb44dca=a191_0xb44d();let _0x34c224=_0xb44dca[_0x46a97d];return _0x34c224;}const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x249313,_0x57f2b4){const _0x1980d4=a191_0x34c2,_0x3e6e62=[];let _0x1091ca=0x1;while(!![]){const _0x59ac6b=await listSqlQueries(_0x249313,{'currentPage':_0x1091ca,'pageSize':PAGE_SIZE,'sqlCode':_0x57f2b4[_0x1980d4(0xfc)],'sqlName':_0x57f2b4[_0x1980d4(0xe7)]}),_0x445c80=_0x59ac6b[_0x1980d4(0x102)]??[];_0x3e6e62['push'](..._0x445c80);if(_0x445c80['length']===0x0)break;const _0xcf6417=_0x59ac6b['paging']?.[_0x1980d4(0xe4)];if(_0xcf6417!=null?_0x3e6e62[_0x1980d4(0xed)]>=_0xcf6417:_0x445c80[_0x1980d4(0xed)]<PAGE_SIZE)break;_0x1091ca++;}return _0x3e6e62;}async function ensureSqlContent(_0x5288fd){const _0x29affe=a191_0x34c2;if(_0x5288fd['sqlContent']!=null&&String(_0x5288fd[_0x29affe(0x11b)])[_0x29affe(0xed)]>0x0)return _0x5288fd;return getSqlQueryDetail(_0x5288fd[_0x29affe(0xfc)]);}export const sqlPull={'service':a191_0x297d7a(0xf9),'command':a191_0x297d7a(0xef),'description':a191_0x297d7a(0xf4),'risk':'read','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a191_0x297d7a(0xf8),'type':a191_0x297d7a(0x100),'description':a191_0x297d7a(0x10f)},{'name':a191_0x297d7a(0xee),'type':'boolean','description':a191_0x297d7a(0x113)}],async 'dryRun'(_0x1f93a1){const _0x5be0ba=a191_0x297d7a,_0x2a9930=loadSqlProjectConfig(_0x1f93a1['appCode']),_0x9bf481=await readSqlLockFile(_0x2a9930[_0x5be0ba(0xf2)]),{appLock:_0x565ece}=ensureSqlLockScope(_0x9bf481??createEmptySqlLock(),_0x2a9930[_0x5be0ba(0xfa)],_0x2a9930[_0x5be0ba(0xe5)],'pull'),_0x105ad0=await fetchAllSqlQueries(_0x1f93a1[_0x5be0ba(0xfa)],{'sqlCode':_0x1f93a1[_0x5be0ba(0xf6)](_0x5be0ba(0x108))||undefined,'sqlName':_0x1f93a1[_0x5be0ba(0xf6)](_0x5be0ba(0xf8))||undefined}),_0x2821fe=[];for(const _0x335560 of _0x105ad0){const _0x35ab63=await ensureSqlContent(_0x335560),_0x679d48=ensureRemoteSqlContent(_0x35ab63),_0x2db8a6=detectModeFromSql(_0x35ab63),_0x3dcb5f=_0x35ab63[_0x5be0ba(0xf0)]?await getDbName(_0x1f93a1[_0x5be0ba(0xfa)],Number(_0x35ab63['dbId']))[_0x5be0ba(0xfe)](()=>undefined):undefined,_0x22fc5c=buildLocalSqlFileContent({'sqlCode':_0x35ab63[_0x5be0ba(0xfc)],'sqlName':_0x35ab63[_0x5be0ba(0xe7)],'dbId':_0x35ab63[_0x5be0ba(0xf0)]},_0x679d48,{'dbName':_0x3dcb5f,'mode':_0x2db8a6,'syncedAt':new Date()[_0x5be0ba(0x10b)](),'description':_0x35ab63[_0x5be0ba(0x109)]}),_0x1a6e0d=buildSqlLockEntry(_0x35ab63,_0x679d48,'',{'dbName':_0x3dcb5f}),_0x5d43d0=resolveLocalSqlFilePath(_0x2a9930,_0x35ab63[_0x5be0ba(0xfc)],_0x1a6e0d);let _0x87d915=_0x5be0ba(0x118),_0x5eec86;if(await fileExists(_0x5d43d0)){const _0x5ed15d=await readFile(_0x5d43d0,_0x5be0ba(0xea));isEquivalentPulledSqlFile(_0x5ed15d,_0x22fc5c,_0x2db8a6)?(_0x87d915=_0x5be0ba(0x114),_0x5eec86='unchanged'):(_0x87d915=_0x5be0ba(0xf5),_0x5eec86=_0x5be0ba(0xff));}_0x2821fe[_0x5be0ba(0x11e)]({'sqlCode':_0x35ab63['sqlCode'],'sqlName':_0x35ab63[_0x5be0ba(0xe7)],'filePath':_0x5d43d0,'status':_0x87d915,'reason':_0x5eec86});}return{'method':_0x5be0ba(0xe9),'url':_0x5be0ba(0x119),'body':{'appCode':_0x1f93a1[_0x5be0ba(0xfa)],'sqlCode':_0x1f93a1[_0x5be0ba(0xf6)](_0x5be0ba(0x108))||null,'sqlName':_0x1f93a1[_0x5be0ba(0xf6)](_0x5be0ba(0xf8))||null,'files':_0x2821fe},'description':'Would\x20pull\x20'+_0x2821fe[_0x5be0ba(0xed)]+'\x20SQL\x20file(s)\x20into\x20'+_0x2a9930[_0x5be0ba(0x10e)]};},async 'execute'(_0x50c6d9){const _0x570c58=a191_0x297d7a,_0xca3c47=loadSqlProjectConfig(_0x50c6d9[_0x570c58(0xfa)]),_0x340e57=await readSqlLockFile(_0xca3c47['lockFilePath']),{lockData:_0x5610ae,appLock:_0x2e9ff3}=ensureSqlLockScope(_0x340e57??createEmptySqlLock(),_0xca3c47[_0x570c58(0xfa)],_0xca3c47[_0x570c58(0xe5)],_0x570c58(0xef)),_0x40e8f6=_0x50c6d9[_0x570c58(0x11a)](_0x570c58(0xee)),_0x2b8a83=await fetchAllSqlQueries(_0x50c6d9[_0x570c58(0xfa)],{'sqlCode':_0x50c6d9[_0x570c58(0xf6)]('sqlcode')||undefined,'sqlName':_0x50c6d9['str'](_0x570c58(0xf8))||undefined});if(_0x2b8a83[_0x570c58(0xed)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x570c58(0xeb)};const _0x366281=[],_0x3d8c8b=[];for(const _0x4f04f1 of _0x2b8a83){try{_0x366281[_0x570c58(0x11e)](await ensureSqlContent(_0x4f04f1));}catch(_0x5552e5){_0x3d8c8b[_0x570c58(0x11e)]({'sqlCode':_0x4f04f1[_0x570c58(0xfc)],'error':_0x5552e5 instanceof Error?_0x5552e5['message']:String(_0x5552e5)});}}if(_0x40e8f6&&!_0x50c6d9[_0x570c58(0x104)]){let _0x4d45a9=![];for(const _0x3728cd of _0x366281){const _0x12c098=detectModeFromSql(_0x3728cd),_0x21fe31=_0x3728cd[_0x570c58(0xf0)]?await getDbName(_0x50c6d9[_0x570c58(0xfa)],Number(_0x3728cd[_0x570c58(0xf0)]))[_0x570c58(0xfe)](()=>undefined):undefined,_0x32d0d4=buildLocalSqlFileContent({'sqlCode':_0x3728cd[_0x570c58(0xfc)],'sqlName':_0x3728cd[_0x570c58(0xe7)],'dbId':_0x3728cd[_0x570c58(0xf0)]},ensureRemoteSqlContent(_0x3728cd),{'dbName':_0x21fe31,'mode':_0x12c098,'syncedAt':new Date()['toISOString'](),'description':_0x3728cd[_0x570c58(0x109)]}),_0x3dd6a0=resolveLocalSqlFilePath(_0xca3c47,_0x3728cd[_0x570c58(0xfc)],buildSqlLockEntry(_0x3728cd,ensureRemoteSqlContent(_0x3728cd),'',{'dbName':_0x21fe31}));if(await fileExists(_0x3dd6a0)){const _0x486e31=await readFile(_0x3dd6a0,_0x570c58(0xea));if(!isEquivalentPulledSqlFile(_0x486e31,_0x32d0d4,_0x12c098)){_0x4d45a9=!![];break;}}}if(_0x4d45a9){const _0x4d2da8=await confirmForceOverwrite(_0x570c58(0xf3));if(!_0x4d2da8)throw CliErrors[_0x570c58(0xe8)](_0x570c58(0xfd));}}const _0x1c058e=cloneSqlLockData(_0x5610ae),_0x1d0ca9=_0x1c058e[_0x570c58(0x106)][_0xca3c47[_0x570c58(0xfa)]],_0x4af78e=[],_0x13ec67=[];for(const _0xd70035 of _0x366281){const _0x464995=_0x1d0ca9[_0x570c58(0x112)][_0xd70035[_0x570c58(0xfc)]],_0x47ae90=ensureRemoteSqlContent(_0xd70035),_0x4f93c6=detectModeFromSql(_0xd70035),_0x2ea821=_0xd70035[_0x570c58(0xf0)]?await getDbName(_0x50c6d9[_0x570c58(0xfa)],Number(_0xd70035[_0x570c58(0xf0)]))['catch'](()=>undefined):undefined,_0xbfbc2d=buildLocalSqlFileContent({'sqlCode':_0xd70035['sqlCode'],'sqlName':_0xd70035['sqlName'],'dbId':_0xd70035[_0x570c58(0xf0)]},_0x47ae90,{'dbName':_0x2ea821,'mode':_0x4f93c6,'syncedAt':new Date()[_0x570c58(0x10b)](),'description':_0xd70035[_0x570c58(0x109)]}),_0x4158b8=buildSqlLockEntry(_0xd70035,_0x47ae90,computeSqlContentHash(_0xbfbc2d),{'dbName':_0x2ea821}),_0x1b8fe5=_0x4158b8['path'],_0xffaf04=join(_0xca3c47[_0x570c58(0x10e)],_0x1b8fe5);try{if(await fileExists(_0xffaf04)){const _0x34483f=await readFile(_0xffaf04,_0x570c58(0xea));if(isEquivalentPulledSqlFile(_0x34483f,_0xbfbc2d,_0x4f93c6)){_0x13ec67[_0x570c58(0x11e)]({'sqlCode':_0xd70035['sqlCode'],'reason':_0x570c58(0x107)}),_0x1d0ca9['sqls'][_0xd70035[_0x570c58(0xfc)]]={..._0x4158b8,'hash':computeSqlContentHash(_0x34483f),'path':_0x1b8fe5};continue;}if(!_0x40e8f6){_0x13ec67[_0x570c58(0x11e)]({'sqlCode':_0xd70035[_0x570c58(0xfc)],'reason':'local\x20differs\x20from\x20remote'});continue;}}const _0x3a7c44=_0x464995?.[_0x570c58(0x110)]?join(_0xca3c47[_0x570c58(0x10e)],_0x464995[_0x570c58(0x110)]):undefined;_0x3a7c44&&_0x3a7c44!==_0xffaf04&&await fileExists(_0x3a7c44)&&await rm(_0x3a7c44,{'force':!![]}),await ensureParentDirectory(_0xffaf04),await writeFile(_0xffaf04,_0xbfbc2d,_0x570c58(0xea)),_0x1d0ca9[_0x570c58(0x112)][_0xd70035[_0x570c58(0xfc)]]={..._0x4158b8,'path':_0x1b8fe5},_0x4af78e['push']({'sqlCode':_0xd70035['sqlCode'],'filePath':_0xffaf04});}catch(_0x1b238a){_0x3d8c8b['push']({'sqlCode':_0xd70035['sqlCode'],'error':_0x1b238a instanceof Error?_0x1b238a['message']:String(_0x1b238a)});}}return _0x1d0ca9[_0x570c58(0x103)]=new Date()['toISOString'](),await writeSqlLockFile(_0xca3c47[_0x570c58(0xf2)],_0x1c058e),{'ok':_0x3d8c8b[_0x570c58(0xed)]===0x0,'data':{'pulled':_0x4af78e,'skipped':_0x13ec67,'failed':_0x3d8c8b},'message':'Pull\x20complete:\x20'+_0x4af78e[_0x570c58(0xed)]+_0x570c58(0x10c)+_0x13ec67[_0x570c58(0xed)]+_0x570c58(0xf1)+_0x3d8c8b[_0x570c58(0xed)]+_0x570c58(0x111)};}};function detectModeFromSql(_0x5dc8dd){const _0x1d11b6=a191_0x297d7a,_0x20df5c=ensureRemoteSqlContent(_0x5dc8dd),_0x193049=stripLocalSqlMetadata(_0x20df5c,_0x1d11b6(0x117))[_0x1d11b6(0x10a)]();if(/^<(select|insert|update|delete)\b/i[_0x1d11b6(0x10d)](_0x193049))return _0x1d11b6(0x117);return _0x1d11b6(0xf9);}function isEquivalentPulledSqlFile(_0x363fb1,_0x5d3930,_0x4ca5db){return normalizePullComparableContent(_0x363fb1,_0x4ca5db)===normalizePullComparableContent(_0x5d3930,_0x4ca5db);}function normalizePullComparableContent(_0x40fff3,_0x584003){const _0x5e1a74=a191_0x297d7a,_0x243b1b=_0x40fff3[_0x5e1a74(0xf7)](/\r\n/g,'\x0a')['split']('\x0a'),_0x297c20=_0x243b1b['filter'](_0x1ae71e=>!isSyncedAtMetadataLine(_0x1ae71e,_0x584003));return _0x297c20[_0x5e1a74(0xfb)]('\x0a');}function isSyncedAtMetadataLine(_0x5d0a59,_0x466e40){const _0x2c5d09=a191_0x297d7a;if(_0x466e40===_0x2c5d09(0x117))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x2c5d09(0x10d)](_0x5d0a59);return/^\s*--\s*@lovrabet\.syncedAt:/['test'](_0x5d0a59);}
|
package/lib/commands/sql/push.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a192_0x501d36=a192_0x1e6b;(function(_0x179296,_0x2ef53e){const _0xb28350=a192_0x1e6b,_0x40640=_0x179296();while(!![]){try{const _0x2394af=parseInt(_0xb28350(0xb3))/0x1*(parseInt(_0xb28350(0xcb))/0x2)+parseInt(_0xb28350(0xa7))/0x3+parseInt(_0xb28350(0xa8))/0x4*(-parseInt(_0xb28350(0xe7))/0x5)+-parseInt(_0xb28350(0xb2))/0x6+parseInt(_0xb28350(0xbf))/0x7*(parseInt(_0xb28350(0xb1))/0x8)+-parseInt(_0xb28350(0xbe))/0x9*(parseInt(_0xb28350(0xd6))/0xa)+parseInt(_0xb28350(0xb6))/0xb;if(_0x2394af===_0x2ef53e)break;else _0x40640['push'](_0x40640['shift']());}catch(_0x331d1e){_0x40640['push'](_0x40640['shift']());}}}(a192_0x50f2,0xaa271));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_0x1e6b(_0x32cad4,_0x661931){_0x32cad4=_0x32cad4-0xa7;const _0x50f2d3=a192_0x50f2();let _0x1e6b64=_0x50f2d3[_0x32cad4];return _0x1e6b64;}async function getTargetSqlQueries(_0x3e681a,_0x5a3cb8,_0x2fd942){const _0x47e830=a192_0x1e6b,_0x583e27=await scanLocalSqlQueries(_0x3e681a),_0x83fda4=new Map();for(const _0xc5bf30 of _0x583e27){if(_0x2fd942&&_0xc5bf30[_0x47e830(0xb5)]!==_0x2fd942)continue;const _0x2bc4a0=_0x83fda4[_0x47e830(0xb8)](_0xc5bf30[_0x47e830(0xb5)])??[];_0x2bc4a0[_0x47e830(0xc3)](_0xc5bf30),_0x83fda4[_0x47e830(0xdc)](_0xc5bf30[_0x47e830(0xb5)],_0x2bc4a0);}if(_0x2fd942&&!_0x83fda4[_0x47e830(0xc1)](_0x2fd942))throw CliErrors['validation'](_0x47e830(0xc9)+_0x2fd942);const _0x3866e4=[];for(const [_0x567c6a,_0x288b53]of _0x83fda4[_0x47e830(0xcd)]()){if(_0x288b53[_0x47e830(0xe5)]===0x1){_0x3866e4['push'](_0x288b53[0x0]);continue;}const _0x164eeb=_0x5a3cb8['sqls'][_0x567c6a],_0x3b4e5f=_0x164eeb?.['path'],_0x4c9ce7=_0x3b4e5f?_0x288b53['filter'](_0x64aeda=>_0x64aeda[_0x47e830(0xe4)]!==_0x3b4e5f):_0x288b53;if(_0x164eeb&&_0x4c9ce7[_0x47e830(0xe5)]===0x1){_0x3866e4[_0x47e830(0xc3)](_0x4c9ce7[0x0]);continue;}throw CliErrors[_0x47e830(0xc4)]('Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20'+_0x567c6a+_0x47e830(0xdf));}return _0x3866e4;}function a192_0x50f2(){const _0x490d62=['write','sqlcode','\x20pushed,\x20','\x20skipped,\x20','toISOString','10CQcsSp','bool','Local\x20directory\x20\x22','catch','sqlName','sqlRootDir','set','force','str','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','\x20SQL\x20file(s)','dbName','sqlRoot','join','relativePath','length','trashDir','6700535yWzqcL','40389PDBsaC','4LHKtYt','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','Would\x20push\x20','sqls','Push\x20complete:\x20','filePath','/smartapi/custom/updateUserCustomSql','unchanged','utf8','8lfJPbu','2995386WHAoFo','12229SCTUpw','sqlConfig','sqlCode','29949480WSpyEG','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','get','appCode','lockFilePath','remoteId','startsWith','filter','3347559OcFSMA','6195ZsWNqE','sql','has','boolean','push','validation','hash','dbDirectory','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','Push\x20local\x20SQL\x20files\x20to\x20remote','Local\x20SQL\x20not\x20found:\x20','exec','28BuhGgJ','path','entries','map','lastSync','dbId'];a192_0x50f2=function(){return _0x490d62;};return a192_0x50f2();}export const sqlPush={'service':a192_0x501d36(0xc0),'command':a192_0x501d36(0xc3),'description':a192_0x501d36(0xc8),'risk':a192_0x501d36(0xd1),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'force','type':a192_0x501d36(0xc2),'description':'Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock'}],async 'dryRun'(_0x533d18){const _0x1a692d=a192_0x501d36,_0x4aad4a=loadSqlProjectConfig(_0x533d18[_0x1a692d(0xb9)]),_0x4eb888=await readSqlLockFile(_0x4aad4a[_0x1a692d(0xba)]),{appLock:_0xda6e81}=ensureSqlLockScope(_0x4eb888??createEmptySqlLock(),_0x533d18[_0x1a692d(0xb9)],_0x4aad4a[_0x1a692d(0xe2)],_0x1a692d(0xc3)),_0x3680ca=await getTargetSqlQueries(_0x4aad4a,_0xda6e81,_0x533d18[_0x1a692d(0xde)](_0x1a692d(0xd2))||undefined),_0x59c6ac=[];for(const _0x1c8f84 of _0x3680ca){const _0x206598=await computeSqlFileHash(_0x1c8f84[_0x1a692d(0xad)]),_0x46bd0f=_0xda6e81[_0x1a692d(0xab)][_0x1c8f84[_0x1a692d(0xb5)]],_0x479b8a=!!_0x46bd0f&&(_0x46bd0f[_0x1a692d(0xcc)]!==_0x1c8f84[_0x1a692d(0xe4)]||!!_0x1c8f84[_0x1a692d(0xda)]&&_0x46bd0f[_0x1a692d(0xda)]!==_0x1c8f84[_0x1a692d(0xda)]);if(!_0x533d18[_0x1a692d(0xd7)](_0x1a692d(0xdd))&&_0x46bd0f&&_0x46bd0f[_0x1a692d(0xc5)]===_0x206598&&!_0x479b8a)continue;_0x59c6ac[_0x1a692d(0xc3)](_0x1c8f84[_0x1a692d(0xb5)]);}return{'method':'POST','url':_0x1a692d(0xae),'body':{'sqlCodes':_0x59c6ac,'appCode':_0x533d18[_0x1a692d(0xb9)]},'description':_0x1a692d(0xaa)+_0x59c6ac[_0x1a692d(0xe5)]+_0x1a692d(0xe0)};},async 'execute'(_0x44407a){const _0x2e1250=a192_0x501d36,_0x582991=loadSqlProjectConfig(_0x44407a['appCode']),_0x1e28e6=await readSqlLockFile(_0x582991['lockFilePath']),{lockData:_0x37e9a5,appLock:_0x382d44}=ensureSqlLockScope(_0x1e28e6??createEmptySqlLock(),_0x44407a[_0x2e1250(0xb9)],_0x582991[_0x2e1250(0xe2)],_0x2e1250(0xc3)),_0x226331=await getTargetSqlQueries(_0x582991,_0x382d44,_0x44407a[_0x2e1250(0xde)](_0x2e1250(0xd2))||undefined);if(_0x226331['length']===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':'No\x20local\x20SQL\x20files\x20found.'};const _0x40e5d9=[],_0x26ea1b=[],_0x2d53a6=[];for(const _0x435678 of _0x226331){const _0x3dba4b=_0x382d44[_0x2e1250(0xab)][_0x435678[_0x2e1250(0xb5)]];if(!_0x3dba4b){_0x2d53a6[_0x2e1250(0xc3)]({'sqlCode':_0x435678[_0x2e1250(0xb5)],'error':_0x2e1250(0xc7)});continue;}try{const _0x2fc3e9=await computeSqlFileHash(_0x435678[_0x2e1250(0xad)]),_0x4fce33=_0x3dba4b[_0x2e1250(0xcc)]!==_0x435678[_0x2e1250(0xe4)]||!!_0x435678[_0x2e1250(0xda)]&&_0x3dba4b[_0x2e1250(0xda)]!==_0x435678[_0x2e1250(0xda)];if(!_0x44407a[_0x2e1250(0xd7)](_0x2e1250(0xdd))&&_0x3dba4b[_0x2e1250(0xc5)]===_0x2fc3e9&&!_0x4fce33){_0x26ea1b[_0x2e1250(0xc3)]({'sqlCode':_0x435678[_0x2e1250(0xb5)],'reason':_0x2e1250(0xaf)});continue;}if(_0x3dba4b['version']==null){_0x2d53a6[_0x2e1250(0xc3)]({'sqlCode':_0x435678['sqlCode'],'error':_0x2e1250(0xa9)});continue;}const _0x55357d=await readFile(_0x435678[_0x2e1250(0xad)],_0x2e1250(0xb0)),_0x3373c0=stripLocalSqlMetadata(_0x55357d,_0x435678['mode']),_0x58ecfa=_0x435678['sqlName']||_0x3dba4b[_0x2e1250(0xda)],_0x39fc12=await resolveTargetDbBinding(_0x44407a['appCode'],_0x435678,_0x3dba4b),_0x233054=await updateSqlQuery({'id':_0x3dba4b[_0x2e1250(0xbb)],'appCode':_0x44407a[_0x2e1250(0xb9)],'sqlCode':_0x435678[_0x2e1250(0xb5)],'sqlName':_0x58ecfa,'dbId':_0x39fc12[_0x2e1250(0xd0)],'version':_0x3dba4b['version'],'sqlContent':_0x3373c0,'sqlConfig':_0x3dba4b[_0x2e1250(0xb4)]??undefined}),_0x26752a=_0x233054[_0x2e1250(0xd0)]?await getDbName(_0x44407a[_0x2e1250(0xb9)],Number(_0x233054['dbId']))['catch'](()=>_0x39fc12['dbName']):_0x39fc12['dbName'];_0x382d44['sqls'][_0x435678[_0x2e1250(0xb5)]]={...buildSqlLockEntry(_0x233054,_0x3373c0,_0x2fc3e9,{'dbName':_0x26752a}),'path':_0x435678[_0x2e1250(0xe4)],'mode':_0x3dba4b['mode']},await archivePreviousSqlFileIfNeeded(_0x582991,_0x3dba4b['path'],_0x435678['relativePath']),_0x40e5d9[_0x2e1250(0xc3)]({'sqlCode':_0x435678[_0x2e1250(0xb5)],'remoteId':_0x3dba4b[_0x2e1250(0xbb)]});}catch(_0x177b6b){_0x2d53a6[_0x2e1250(0xc3)]({'sqlCode':_0x435678['sqlCode'],'error':_0x177b6b instanceof Error?_0x177b6b['message']:String(_0x177b6b)});}}return _0x382d44[_0x2e1250(0xcf)]=new Date()[_0x2e1250(0xd5)](),await writeSqlLockFile(_0x582991[_0x2e1250(0xba)],_0x37e9a5),{'ok':_0x2d53a6[_0x2e1250(0xe5)]===0x0,'data':{'pushed':_0x40e5d9,'skipped':_0x26ea1b,'failed':_0x2d53a6},'message':_0x2e1250(0xac)+_0x40e5d9['length']+_0x2e1250(0xd3)+_0x26ea1b[_0x2e1250(0xe5)]+_0x2e1250(0xd4)+_0x2d53a6[_0x2e1250(0xe5)]+'\x20failed'};}};async function archivePreviousSqlFileIfNeeded(_0x410866,_0x127bcd,_0x40b137){const _0x48daec=a192_0x501d36;if(!_0x127bcd||_0x127bcd===_0x40b137)return;const _0x29d25c=join(_0x410866[_0x48daec(0xdb)],_0x127bcd);if(!await fileExists(_0x29d25c))return;const _0xccc711=await moveToTrash(_0x410866['projectRoot'],_0x410866[_0x48daec(0xe6)],_0x29d25c);await cleanupEmptyDirectories(dirname(_0x29d25c),_0x410866[_0x48daec(0xdb)]),void _0xccc711;}async function moveToTrash(_0x325356,_0x91ee55,_0x5d8509){const _0x340e19=a192_0x501d36,_0x361431=new Date()[_0x340e19(0xd5)]()['replace'](/[:.]/g,'-'),_0x2ed06e=relative(_0x325356,_0x5d8509),_0x2661d6=join(_0x91ee55,_0x361431,_0x2ed06e);return await mkdir(dirname(_0x2661d6),{'recursive':!![]}),await rename(_0x5d8509,_0x2661d6),_0x2661d6;}async function cleanupEmptyDirectories(_0x514122,_0x33c6b7){const _0x16f139=a192_0x501d36;let _0x114123=resolve(_0x514122);const _0x492b82=resolve(_0x33c6b7);while(_0x114123[_0x16f139(0xbc)](''+_0x492b82+sep)||_0x114123===_0x492b82){if(_0x114123===_0x492b82)return;try{const _0x3af981=await readdir(_0x114123);if(_0x3af981[_0x16f139(0xe5)]>0x0)return;await rmdir(_0x114123);}catch{return;}_0x114123=dirname(_0x114123);}}async function resolveTargetDbBinding(_0x33328a,_0x3055ea,_0x1f79db){const _0x588168=a192_0x501d36,_0x249d8d=_0x3055ea[_0x588168(0xc6)];if(!_0x249d8d)return{'dbId':_0x1f79db['dbId'],'dbName':_0x1f79db[_0x588168(0xe1)]};const _0x626a9d=buildDbDirectoryName(_0x1f79db[_0x588168(0xe1)],_0x1f79db[_0x588168(0xd0)]);if(_0x249d8d===_0x626a9d)return{'dbId':_0x1f79db[_0x588168(0xd0)],'dbName':_0x1f79db[_0x588168(0xe1)]};const _0x3d0fb4=parseExplicitDbDirectory(_0x249d8d);if(_0x3d0fb4!=null)return{'dbId':_0x3d0fb4,'dbName':await getDbName(_0x33328a,_0x3d0fb4)[_0x588168(0xd9)](()=>undefined)};const _0x5104fb=await listDatabases(_0x33328a),_0x1862d2=_0x5104fb[_0x588168(0xbd)](_0xfd2f8a=>buildDbDirectoryName(_0xfd2f8a['dbName'],_0xfd2f8a[_0x588168(0xd0)])===_0x249d8d);if(_0x1862d2[_0x588168(0xe5)]===0x1)return{'dbId':_0x1862d2[0x0][_0x588168(0xd0)],'dbName':_0x1862d2[0x0][_0x588168(0xe1)]};if(_0x1862d2[_0x588168(0xe5)]===0x0)throw CliErrors['validation']('No\x20database\x20matches\x20local\x20directory\x20\x22'+_0x249d8d+'\x22\x20for\x20sqlCode\x20'+_0x3055ea['sqlCode']+'.');const _0x2aae0a=_0x1862d2[_0x588168(0xce)](_0x46e865=>_0x46e865[_0x588168(0xe1)]+'\x20('+_0x46e865[_0x588168(0xd0)]+')')[_0x588168(0xe3)](',\x20');throw CliErrors[_0x588168(0xc4)](_0x588168(0xd8)+_0x249d8d+_0x588168(0xb7)+_0x3055ea[_0x588168(0xb5)]+':\x20'+_0x2aae0a);}function parseExplicitDbDirectory(_0x4f11bb){const _0x101b0e=a192_0x501d36,_0x543d07=/^db-(\d+)$/[_0x101b0e(0xca)](_0x4f11bb);if(!_0x543d07)return null;const _0x3d575b=Number(_0x543d07[0x1]);return Number['isFinite'](_0x3d575b)&&_0x3d575b>0x0?_0x3d575b:null;}
|
|
1
|
+
const a192_0x505e00=a192_0x3516;(function(_0x5486d4,_0x341325){const _0x5d53cd=a192_0x3516,_0x4345c1=_0x5486d4();while(!![]){try{const _0x5ed684=-parseInt(_0x5d53cd(0xc7))/0x1+parseInt(_0x5d53cd(0xf9))/0x2+parseInt(_0x5d53cd(0xc3))/0x3+-parseInt(_0x5d53cd(0xd4))/0x4*(parseInt(_0x5d53cd(0xbb))/0x5)+-parseInt(_0x5d53cd(0xbe))/0x6+-parseInt(_0x5d53cd(0xe0))/0x7*(-parseInt(_0x5d53cd(0xc4))/0x8)+-parseInt(_0x5d53cd(0xcb))/0x9*(-parseInt(_0x5d53cd(0xdb))/0xa);if(_0x5ed684===_0x341325)break;else _0x4345c1['push'](_0x4345c1['shift']());}catch(_0x3e8b7c){_0x4345c1['push'](_0x4345c1['shift']());}}}(a192_0x29b8,0x20c30));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';async function getTargetSqlQueries(_0x3d0039,_0x2d1e5e,_0xd21e){const _0x4fb05c=a192_0x3516,_0x24b99c=await scanLocalSqlQueries(_0x3d0039),_0x5f0080=new Map();for(const _0x477a46 of _0x24b99c){if(_0xd21e&&_0x477a46[_0x4fb05c(0xf4)]!==_0xd21e)continue;const _0x433af4=_0x5f0080['get'](_0x477a46[_0x4fb05c(0xf4)])??[];_0x433af4['push'](_0x477a46),_0x5f0080['set'](_0x477a46[_0x4fb05c(0xf4)],_0x433af4);}if(_0xd21e&&!_0x5f0080[_0x4fb05c(0xf2)](_0xd21e))throw CliErrors[_0x4fb05c(0xce)](_0x4fb05c(0xe8)+_0xd21e);const _0x12f5d3=[];for(const [_0x37c0d6,_0x1729ce]of _0x5f0080[_0x4fb05c(0xf1)]()){if(_0x1729ce[_0x4fb05c(0xc1)]===0x1){_0x12f5d3[_0x4fb05c(0xb7)](_0x1729ce[0x0]);continue;}const _0x10d089=_0x2d1e5e[_0x4fb05c(0xe4)][_0x37c0d6],_0x68bf3a=_0x10d089?.[_0x4fb05c(0xca)],_0x250bbc=_0x68bf3a?_0x1729ce[_0x4fb05c(0xc6)](_0x2bc689=>_0x2bc689[_0x4fb05c(0xd7)]!==_0x68bf3a):_0x1729ce;if(_0x10d089&&_0x250bbc[_0x4fb05c(0xc1)]===0x1){_0x12f5d3[_0x4fb05c(0xb7)](_0x250bbc[0x0]);continue;}throw CliErrors[_0x4fb05c(0xce)](_0x4fb05c(0xf6)+_0x37c0d6+_0x4fb05c(0xdc));}return _0x12f5d3;}function a192_0x29b8(){const _0x42e7bf=['filePath','50636cQhkAt','Push\x20complete:\x20','dbName','sqlRoot','push','dbDirectory','message','sql','215zxgipB','str','No\x20database\x20matches\x20local\x20directory\x20\x22','216774bLIwGM','replace','/smartapi/custom/updateUserCustomSql','length','appCode','60930wYVJlO','70568gRPqSP','projectRoot','filter','210671hnynxt','trashDir','Local\x20directory\x20\x22','path','9QWaiuV','\x20pushed,\x20','hash','validation','dbId','write','version','map','startsWith','14572cJOrIB','join','boolean','relativePath','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','No\x20local\x20SQL\x20files\x20found.','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','4655500HRgnuQ','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','utf8','Push\x20local\x20SQL\x20files\x20to\x20remote','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','21XhovMp','mode','toISOString','sqlConfig','sqls','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','force','lastSync','Local\x20SQL\x20not\x20found:\x20','remoteId','\x20skipped,\x20','catch','sqlcode','\x20SQL\x20file(s)','sqlName','bool','\x20failed','entries','has','sqlRootDir','sqlCode','lockFilePath','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','exec'];a192_0x29b8=function(){return _0x42e7bf;};return a192_0x29b8();}function a192_0x3516(_0x4ee4cf,_0x2f1a8a){_0x4ee4cf=_0x4ee4cf-0xb5;const _0x29b8f5=a192_0x29b8();let _0x351622=_0x29b8f5[_0x4ee4cf];return _0x351622;}export const sqlPush={'service':a192_0x505e00(0xba),'command':a192_0x505e00(0xb7),'description':a192_0x505e00(0xde),'risk':a192_0x505e00(0xd0),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'force','type':a192_0x505e00(0xd6),'description':a192_0x505e00(0xda)}],async 'dryRun'(_0x44974a){const _0x4120f2=a192_0x505e00,_0x17f5a5=loadSqlProjectConfig(_0x44974a[_0x4120f2(0xc2)]),_0x24904b=await readSqlLockFile(_0x17f5a5[_0x4120f2(0xf5)]),{appLock:_0x5d0770}=ensureSqlLockScope(_0x24904b??createEmptySqlLock(),_0x44974a[_0x4120f2(0xc2)],_0x17f5a5[_0x4120f2(0xb6)],_0x4120f2(0xb7)),_0x582576=await getTargetSqlQueries(_0x17f5a5,_0x5d0770,_0x44974a[_0x4120f2(0xbc)]('sqlcode')||undefined),_0x8500ee=[];for(const _0x50745c of _0x582576){const _0x4cbc17=await computeSqlFileHash(_0x50745c[_0x4120f2(0xf8)]),_0x2bdee9=_0x5d0770['sqls'][_0x50745c[_0x4120f2(0xf4)]],_0x5c5e50=!!_0x2bdee9&&(_0x2bdee9[_0x4120f2(0xca)]!==_0x50745c[_0x4120f2(0xd7)]||!!_0x50745c[_0x4120f2(0xee)]&&_0x2bdee9[_0x4120f2(0xee)]!==_0x50745c[_0x4120f2(0xee)]);if(!_0x44974a[_0x4120f2(0xef)](_0x4120f2(0xe6))&&_0x2bdee9&&_0x2bdee9[_0x4120f2(0xcd)]===_0x4cbc17&&!_0x5c5e50)continue;_0x8500ee['push'](_0x50745c['sqlCode']);}return{'method':'POST','url':_0x4120f2(0xc0),'body':{'sqlCodes':_0x8500ee,'appCode':_0x44974a[_0x4120f2(0xc2)]},'description':'Would\x20push\x20'+_0x8500ee[_0x4120f2(0xc1)]+_0x4120f2(0xed)};},async 'execute'(_0x2fce2c){const _0x5734cf=a192_0x505e00,_0x3c733d=loadSqlProjectConfig(_0x2fce2c['appCode']),_0x4068d6=await readSqlLockFile(_0x3c733d[_0x5734cf(0xf5)]),{lockData:_0x3275e3,appLock:_0x9cb87b}=ensureSqlLockScope(_0x4068d6??createEmptySqlLock(),_0x2fce2c['appCode'],_0x3c733d[_0x5734cf(0xb6)],_0x5734cf(0xb7)),_0x20dee2=await getTargetSqlQueries(_0x3c733d,_0x9cb87b,_0x2fce2c[_0x5734cf(0xbc)](_0x5734cf(0xec))||undefined);if(_0x20dee2[_0x5734cf(0xc1)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x5734cf(0xd9)};const _0x21cfa9=[],_0x253d88=[],_0x369d63=[];for(const _0x1b58e4 of _0x20dee2){const _0x17bf82=_0x9cb87b[_0x5734cf(0xe4)][_0x1b58e4[_0x5734cf(0xf4)]];if(!_0x17bf82){_0x369d63[_0x5734cf(0xb7)]({'sqlCode':_0x1b58e4[_0x5734cf(0xf4)],'error':_0x5734cf(0xe5)});continue;}try{const _0x4a55f3=await computeSqlFileHash(_0x1b58e4[_0x5734cf(0xf8)]),_0x3cc1ff=_0x17bf82[_0x5734cf(0xca)]!==_0x1b58e4['relativePath']||!!_0x1b58e4['sqlName']&&_0x17bf82[_0x5734cf(0xee)]!==_0x1b58e4[_0x5734cf(0xee)];if(!_0x2fce2c[_0x5734cf(0xef)](_0x5734cf(0xe6))&&_0x17bf82['hash']===_0x4a55f3&&!_0x3cc1ff){_0x253d88[_0x5734cf(0xb7)]({'sqlCode':_0x1b58e4[_0x5734cf(0xf4)],'reason':'unchanged'});continue;}if(_0x17bf82[_0x5734cf(0xd1)]==null){_0x369d63[_0x5734cf(0xb7)]({'sqlCode':_0x1b58e4[_0x5734cf(0xf4)],'error':_0x5734cf(0xd8)});continue;}const _0x4cc4b8=await readFile(_0x1b58e4[_0x5734cf(0xf8)],_0x5734cf(0xdd)),_0x431a8f=stripLocalSqlMetadata(_0x4cc4b8,_0x1b58e4['mode']),_0x1ad328=_0x1b58e4[_0x5734cf(0xee)]||_0x17bf82['sqlName'],_0x3baec6=await resolveTargetDbBinding(_0x2fce2c[_0x5734cf(0xc2)],_0x1b58e4,_0x17bf82),_0x4b2a6c=await updateSqlQuery({'id':_0x17bf82[_0x5734cf(0xe9)],'appCode':_0x2fce2c['appCode'],'sqlCode':_0x1b58e4[_0x5734cf(0xf4)],'sqlName':_0x1ad328,'dbId':_0x3baec6[_0x5734cf(0xcf)],'version':_0x17bf82[_0x5734cf(0xd1)],'sqlContent':_0x431a8f,'sqlConfig':_0x17bf82[_0x5734cf(0xe3)]??undefined}),_0x32b7f4=_0x4b2a6c[_0x5734cf(0xcf)]?await getDbName(_0x2fce2c[_0x5734cf(0xc2)],Number(_0x4b2a6c[_0x5734cf(0xcf)]))[_0x5734cf(0xeb)](()=>_0x3baec6[_0x5734cf(0xb5)]):_0x3baec6[_0x5734cf(0xb5)];_0x9cb87b[_0x5734cf(0xe4)][_0x1b58e4[_0x5734cf(0xf4)]]={...buildSqlLockEntry(_0x4b2a6c,_0x431a8f,_0x4a55f3,{'dbName':_0x32b7f4}),'path':_0x1b58e4[_0x5734cf(0xd7)],'mode':_0x17bf82[_0x5734cf(0xe1)]},await archivePreviousSqlFileIfNeeded(_0x3c733d,_0x17bf82[_0x5734cf(0xca)],_0x1b58e4[_0x5734cf(0xd7)]),_0x21cfa9[_0x5734cf(0xb7)]({'sqlCode':_0x1b58e4[_0x5734cf(0xf4)],'remoteId':_0x17bf82[_0x5734cf(0xe9)]});}catch(_0xbe9877){_0x369d63[_0x5734cf(0xb7)]({'sqlCode':_0x1b58e4['sqlCode'],'error':_0xbe9877 instanceof Error?_0xbe9877[_0x5734cf(0xb9)]:String(_0xbe9877)});}}return _0x9cb87b[_0x5734cf(0xe7)]=new Date()[_0x5734cf(0xe2)](),await writeSqlLockFile(_0x3c733d[_0x5734cf(0xf5)],_0x3275e3),{'ok':_0x369d63[_0x5734cf(0xc1)]===0x0,'data':{'pushed':_0x21cfa9,'skipped':_0x253d88,'failed':_0x369d63},'message':_0x5734cf(0xfa)+_0x21cfa9[_0x5734cf(0xc1)]+_0x5734cf(0xcc)+_0x253d88[_0x5734cf(0xc1)]+_0x5734cf(0xea)+_0x369d63[_0x5734cf(0xc1)]+_0x5734cf(0xf0)};}};async function archivePreviousSqlFileIfNeeded(_0x1219f7,_0x29f344,_0x4faec9){const _0x586c4e=a192_0x505e00;if(!_0x29f344||_0x29f344===_0x4faec9)return;const _0x2c85f4=join(_0x1219f7['sqlRootDir'],_0x29f344);if(!await fileExists(_0x2c85f4))return;const _0x47ee66=await moveToTrash(_0x1219f7[_0x586c4e(0xc5)],_0x1219f7[_0x586c4e(0xc8)],_0x2c85f4);await cleanupEmptyDirectories(dirname(_0x2c85f4),_0x1219f7[_0x586c4e(0xf3)]),void _0x47ee66;}async function moveToTrash(_0x417293,_0x4b80f0,_0x496e32){const _0x2be85c=a192_0x505e00,_0x1271a5=new Date()[_0x2be85c(0xe2)]()[_0x2be85c(0xbf)](/[:.]/g,'-'),_0x403040=relative(_0x417293,_0x496e32),_0x495a97=join(_0x4b80f0,_0x1271a5,_0x403040);return await mkdir(dirname(_0x495a97),{'recursive':!![]}),await rename(_0x496e32,_0x495a97),_0x495a97;}async function cleanupEmptyDirectories(_0x49c1b5,_0x37081e){const _0xb08540=a192_0x505e00;let _0xe21f86=resolve(_0x49c1b5);const _0x4cca2f=resolve(_0x37081e);while(_0xe21f86[_0xb08540(0xd3)](''+_0x4cca2f+sep)||_0xe21f86===_0x4cca2f){if(_0xe21f86===_0x4cca2f)return;try{const _0xf7f3a3=await readdir(_0xe21f86);if(_0xf7f3a3[_0xb08540(0xc1)]>0x0)return;await rmdir(_0xe21f86);}catch{return;}_0xe21f86=dirname(_0xe21f86);}}async function resolveTargetDbBinding(_0x5f0e00,_0x36c84,_0x4a3d52){const _0x6e4c72=a192_0x505e00,_0xf5eea2=_0x36c84[_0x6e4c72(0xb8)];if(!_0xf5eea2)return{'dbId':_0x4a3d52['dbId'],'dbName':_0x4a3d52[_0x6e4c72(0xb5)]};const _0x3bd2ed=buildDbDirectoryName(_0x4a3d52[_0x6e4c72(0xb5)],_0x4a3d52[_0x6e4c72(0xcf)]);if(_0xf5eea2===_0x3bd2ed)return{'dbId':_0x4a3d52[_0x6e4c72(0xcf)],'dbName':_0x4a3d52[_0x6e4c72(0xb5)]};const _0x5c5183=parseExplicitDbDirectory(_0xf5eea2);if(_0x5c5183!=null)return{'dbId':_0x5c5183,'dbName':await getDbName(_0x5f0e00,_0x5c5183)[_0x6e4c72(0xeb)](()=>undefined)};const _0x52eff6=await listDatabases(_0x5f0e00),_0x26d8fc=_0x52eff6[_0x6e4c72(0xc6)](_0xc03141=>buildDbDirectoryName(_0xc03141['dbName'],_0xc03141[_0x6e4c72(0xcf)])===_0xf5eea2);if(_0x26d8fc[_0x6e4c72(0xc1)]===0x1)return{'dbId':_0x26d8fc[0x0][_0x6e4c72(0xcf)],'dbName':_0x26d8fc[0x0][_0x6e4c72(0xb5)]};if(_0x26d8fc['length']===0x0)throw CliErrors[_0x6e4c72(0xce)](_0x6e4c72(0xbd)+_0xf5eea2+'\x22\x20for\x20sqlCode\x20'+_0x36c84['sqlCode']+'.');const _0x3d3053=_0x26d8fc[_0x6e4c72(0xd2)](_0x37fea4=>_0x37fea4[_0x6e4c72(0xb5)]+'\x20('+_0x37fea4[_0x6e4c72(0xcf)]+')')[_0x6e4c72(0xd5)](',\x20');throw CliErrors[_0x6e4c72(0xce)](_0x6e4c72(0xc9)+_0xf5eea2+_0x6e4c72(0xdf)+_0x36c84[_0x6e4c72(0xf4)]+':\x20'+_0x3d3053);}function parseExplicitDbDirectory(_0x51ef9f){const _0x4255f6=a192_0x505e00,_0x242e04=/^db-(\d+)$/[_0x4255f6(0xf7)](_0x51ef9f);if(!_0x242e04)return null;const _0x39b119=Number(_0x242e04[0x1]);return Number['isFinite'](_0x39b119)&&_0x39b119>0x0?_0x39b119:null;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
const a193_0x572957=a193_0x478f;(function(_0x483112,_0x3c8aac){const _0x1daa1e=a193_0x478f,_0x58783f=_0x483112();while(!![]){try{const _0x4f425c=-parseInt(_0x1daa1e(0x91))/0x1*(parseInt(_0x1daa1e(0x96))/0x2)+-parseInt(_0x1daa1e(0x9b))/0x3+parseInt(_0x1daa1e(0x8e))/0x4+parseInt(_0x1daa1e(0x9c))/0x5+-parseInt(_0x1daa1e(0xb4))/0x6*(-parseInt(_0x1daa1e(0x98))/0x7)+parseInt(_0x1daa1e(0xaa))/0x8*(parseInt(_0x1daa1e(0xa6))/0x9)+-parseInt(_0x1daa1e(0x97))/0xa;if(_0x4f425c===_0x3c8aac)break;else _0x58783f['push'](_0x58783f['shift']());}catch(_0x20d359){_0x58783f['push'](_0x58783f['shift']());}}}(a193_0x3c81,0x3649d));import{createInterface}from'node:readline';function a193_0x478f(_0x161df3,_0xaab0a9){_0x161df3=_0x161df3-0x8e;const _0x3c81dd=a193_0x3c81();let _0x478f8c=_0x3c81dd[_0x161df3];return _0x478f8c;}import{join}from'node:path';import{buildDefaultSqlFileName,buildSqlRelativePath,detectSqlMode}from'../../core/sql-sync/utils.js';export const SQL_LOCAL_REL_DIR=a193_0x572957(0x8f);export function buildSqlLockEntry(_0x5d4a2b,_0x2eab23,_0x46393a,_0x53396e){const _0x33f9b5=a193_0x572957,_0x25056b=detectSqlMode(_0x2eab23);return{'path':buildSqlRelativePath(_0x5d4a2b[_0x33f9b5(0xb1)],_0x5d4a2b['sqlName'],_0x53396e?.['dbName'],_0x25056b,_0x5d4a2b[_0x33f9b5(0x93)]),'hash':_0x46393a,'remoteId':_0x5d4a2b['id'],'version':_0x5d4a2b[_0x33f9b5(0x94)],'dbId':Number(_0x5d4a2b[_0x33f9b5(0x93)]),'dbName':_0x53396e?.['dbName'],'sqlName':_0x5d4a2b[_0x33f9b5(0xbd)],'sqlConfig':_0x5d4a2b[_0x33f9b5(0xb6)]??undefined,'mode':_0x25056b};}export function cloneSqlLockData(_0x4a5b02){const _0x7c6837=a193_0x572957;return{'apps':Object[_0x7c6837(0x9f)](Object[_0x7c6837(0xa9)](_0x4a5b02[_0x7c6837(0xa7)])[_0x7c6837(0xaf)](([_0x923030,_0x4c3759])=>[_0x923030,{'sqlRoot':_0x4c3759[_0x7c6837(0xba)],'lastSync':_0x4c3759[_0x7c6837(0x9a)],'sqls':{..._0x4c3759[_0x7c6837(0xbb)]}}]))};}export function ensureRemoteSqlContent(_0x20baf8){const _0x3410e0=a193_0x572957;return _0x20baf8[_0x3410e0(0x9e)]??'';}export function buildLocalSqlFileContent(_0x34ab28,_0x21e80e,_0x2a51d3){const _0x52c59e=a193_0x572957,_0x12ea1f=_0x2a51d3?.['mode']??detectSqlMode(_0x21e80e),_0x3fb35d=stripLocalSqlMetadata(_0x21e80e,_0x12ea1f)[_0x52c59e(0xad)](),_0x47573d=[...buildMetadataHeaderLines({'sqlCode':_0x34ab28['sqlCode'],'sqlName':_0x34ab28[_0x52c59e(0xbd)],'dbId':_0x34ab28[_0x52c59e(0x93)],'dbName':_0x2a51d3?.[_0x52c59e(0xb2)],'mode':_0x12ea1f,'syncedAt':_0x2a51d3?.[_0x52c59e(0xb8)],'description':_0x2a51d3?.[_0x52c59e(0xa3)]},_0x12ea1f),'',_0x3fb35d],_0x31f7d1=_0x47573d[_0x52c59e(0xae)]('\x0a');return _0x31f7d1[_0x52c59e(0xb9)]('\x0a')?_0x31f7d1:_0x31f7d1+'\x0a';}export function stripLocalSqlMetadata(_0x3daf5d,_0xbbbcb2){const _0x44199e=a193_0x572957,_0x464708=_0x3daf5d[_0x44199e(0xb7)](/\r\n/g,'\x0a')[_0x44199e(0x99)]('\x0a'),_0x410d66=[];let _0x4cff2d=0x0;if(_0xbbbcb2===_0x44199e(0xa2))while(_0x4cff2d<_0x464708[_0x44199e(0xa4)]){const _0x57f612=_0x464708[_0x4cff2d]??'';if(/^\s*<!--\s*@lovrabet\./[_0x44199e(0xa8)](_0x57f612)){_0x4cff2d++;continue;}if(_0x57f612[_0x44199e(0xad)]()===''&&_0x4cff2d>0x0){_0x4cff2d++;continue;}break;}else while(_0x4cff2d<_0x464708[_0x44199e(0xa4)]){const _0x1d9aca=_0x464708[_0x4cff2d]??'';if(/^\s*--\s*@lovrabet\./[_0x44199e(0xa8)](_0x1d9aca)){_0x4cff2d++;continue;}if(_0x1d9aca['trim']()===''&&_0x4cff2d>0x0){_0x4cff2d++;continue;}break;}for(;_0x4cff2d<_0x464708[_0x44199e(0xa4)];_0x4cff2d++){_0x410d66[_0x44199e(0xb0)](_0x464708[_0x4cff2d]);}return _0x410d66[_0x44199e(0xae)]('\x0a')[_0x44199e(0xac)]();}export function resolveSqlMode(_0x53e0b1,_0x51b08b){const _0x33b7fd=a193_0x572957;if(_0x51b08b?.[_0x33b7fd(0xa5)])return _0x51b08b['mode'];return detectSqlMode(_0x53e0b1);}export function resolveSqlFileName(_0x1df3bd,_0x318917,_0x58941c){const _0x1e778b=a193_0x572957;if(_0x58941c?.[_0x1e778b(0xa1)])return _0x58941c['path'];if(_0x58941c?.[_0x1e778b(0xbd)]||_0x58941c?.[_0x1e778b(0xb2)])return buildSqlRelativePath(_0x1df3bd,_0x58941c?.['sqlName'],_0x58941c?.['dbName'],resolveSqlMode(_0x318917,_0x58941c),_0x58941c?.[_0x1e778b(0x93)]);return buildDefaultSqlFileName(_0x1df3bd,resolveSqlMode(_0x318917,_0x58941c));}export function resolveSqlLocalDir(_0x30dee7,_0x4e6e07){return join(_0x30dee7,SQL_LOCAL_REL_DIR,_0x4e6e07);}export async function confirmForceOverwrite(_0x1fdcae){const _0x38ef1e=a193_0x572957,_0x474273=createInterface({'input':process['stdin'],'output':process['stderr']}),_0x5c4cdf=await new Promise(_0x5058b6=>{const _0x492b53=a193_0x478f;_0x474273[_0x492b53(0x9d)](_0x1fdcae+_0x492b53(0xa0),_0x5058b6);});return _0x474273[_0x38ef1e(0xbc)](),['y',_0x38ef1e(0x90)][_0x38ef1e(0xb5)](_0x5c4cdf['trim']()[_0x38ef1e(0x95)]());}export function findSqlLockScope(_0x40f5cf,_0xf02f50){const _0x273876=a193_0x572957;return _0x40f5cf[_0x273876(0xa7)][_0xf02f50];}function buildMetadataHeaderLines(_0x4cdae4,_0x6873a3){const _0x49c8b7=a193_0x572957,_0x624cc4=[[_0x49c8b7(0xb1),_0x4cdae4[_0x49c8b7(0xb1)]],[_0x49c8b7(0xbd),_0x4cdae4[_0x49c8b7(0xbd)]],[_0x49c8b7(0x93),_0x4cdae4['dbId']],[_0x49c8b7(0xb2),_0x4cdae4[_0x49c8b7(0xb2)]],[_0x49c8b7(0xa5),_0x4cdae4[_0x49c8b7(0xa5)]],[_0x49c8b7(0xb8),_0x4cdae4[_0x49c8b7(0xb8)]],[_0x49c8b7(0xa3),_0x4cdae4['description']]];if(_0x6873a3===_0x49c8b7(0xa2))return _0x624cc4['filter'](([,_0x3f0c3d])=>_0x3f0c3d!==undefined&&_0x3f0c3d!==null&&String(_0x3f0c3d)[_0x49c8b7(0xad)]()!=='')[_0x49c8b7(0xaf)](([_0x1cf438,_0x420376])=>_0x49c8b7(0xab)+_0x1cf438+':\x20'+String(_0x420376)+_0x49c8b7(0x92));return _0x624cc4[_0x49c8b7(0xb3)](([,_0x239830])=>_0x239830!==undefined&&_0x239830!==null&&String(_0x239830)[_0x49c8b7(0xad)]()!=='')[_0x49c8b7(0xaf)](([_0x58645c,_0x5f3aa0])=>'--\x20@lovrabet.'+_0x58645c+':\x20'+String(_0x5f3aa0));}function a193_0x3c81(){const _0x5b5fed=['1iIRfJQ','\x20-->','dbId','version','toLowerCase','496670ephDeX','302880jsbXEO','77DfKNpS','split','lastSync','301953ZEcUum','199585IRtrAl','question','sqlContent','fromEntries','\x20[y/N]\x20','path','mybatisXml','description','length','mode','333NULsiT','apps','test','entries','45168BpmxzD','<!--\x20@lovrabet.','trimStart','trim','join','map','push','sqlCode','dbName','filter','115248YsMnvk','includes','sqlConfig','replace','syncedAt','endsWith','sqlRoot','sqls','close','sqlName','566128amvNBl','.rabetbase/sql','yes'];a193_0x3c81=function(){return _0x5b5fed;};return a193_0x3c81();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a194_0x205dc2=a194_0x426a;function a194_0x2d6a(){const _0x40095a=['6030702ewstgQ','230008sZCWtu','appCode','4332376ISRsBv','bool','has','sqlName','Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally','tableData','push','sqlRoot','All\x20SQL\x20queries\x20are\x20in\x20sync.','\x20missing,\x20','74901purHJQ','length','remote','totalCount','filePath','6103944reiBBH','133itsyOe','path','2671098JMiyHX','sqls','paging','sqlCode','914728AgrbgS','read','boolean','\x20remote-only','20ASAuHj','sql','map','\x20added,\x20','lockFilePath','\x20unchanged','5yeFyLd','\x20modified,\x20','lockKey'];a194_0x2d6a=function(){return _0x40095a;};return a194_0x2d6a();}(function(_0x5d0ee0,_0x43bcff){const _0xbb012b=a194_0x426a,_0x312b5e=_0x5d0ee0();while(!![]){try{const _0x39b00b=-parseInt(_0xbb012b(0x19b))/0x1+-parseInt(_0xbb012b(0x1a7))/0x2+parseInt(_0xbb012b(0x1a3))/0x3+parseInt(_0xbb012b(0x1b7))/0x4+parseInt(_0xbb012b(0x1b1))/0x5*(parseInt(_0xbb012b(0x1a0))/0x6)+parseInt(_0xbb012b(0x1a1))/0x7*(-parseInt(_0xbb012b(0x1b5))/0x8)+parseInt(_0xbb012b(0x1b4))/0x9*(-parseInt(_0xbb012b(0x1ab))/0xa);if(_0x39b00b===_0x43bcff)break;else _0x312b5e['push'](_0x312b5e['shift']());}catch(_0x1b5d3a){_0x312b5e['push'](_0x312b5e['shift']());}}}(a194_0x2d6a,0x8babe));import{listSqlQueries}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile}from'../../core/sql-sync/lock.js';const PAGE_SIZE=0x64;function a194_0x426a(_0x253ed5,_0x122329){_0x253ed5=_0x253ed5-0x194;const _0x2d6aec=a194_0x2d6a();let _0x426abe=_0x2d6aec[_0x253ed5];return _0x426abe;}async function fetchAllSqlCodes(_0x412ac0){const _0x17e65e=a194_0x426a,_0x5ac8cd=[];let _0x115696=0x1;while(!![]){const _0x3219a3=await listSqlQueries(_0x412ac0,{'currentPage':_0x115696,'pageSize':PAGE_SIZE}),_0x323a63=_0x3219a3[_0x17e65e(0x196)]??[];_0x5ac8cd[_0x17e65e(0x197)](..._0x323a63[_0x17e65e(0x1ad)](_0x25cf74=>_0x25cf74[_0x17e65e(0x1a6)]));if(_0x323a63[_0x17e65e(0x19c)]===0x0)break;const _0x132b35=_0x3219a3[_0x17e65e(0x1a5)]?.[_0x17e65e(0x19e)];if(_0x132b35!=null?_0x5ac8cd[_0x17e65e(0x19c)]>=_0x132b35:_0x323a63['length']<PAGE_SIZE)break;_0x115696++;}return _0x5ac8cd;}export const sqlStatus={'service':a194_0x205dc2(0x1ac),'command':'status','description':'Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','risk':a194_0x205dc2(0x1a8),'flags':[{'name':a194_0x205dc2(0x19d),'type':a194_0x205dc2(0x1a9),'description':a194_0x205dc2(0x195)}],async 'execute'(_0x5d4c89){const _0x2594a9=a194_0x205dc2,_0x529772=loadSqlProjectConfig(_0x5d4c89[_0x2594a9(0x1b6)]),_0x5d21f0=await readSqlLockFile(_0x529772[_0x2594a9(0x1af)]),{appLock:_0x597204}=ensureSqlLockScope(_0x5d21f0??createEmptySqlLock(),_0x529772[_0x2594a9(0x1b6)],_0x529772[_0x2594a9(0x198)],'status'),_0xc8eb40=await scanLocalSqlQueries(_0x529772),_0xbe63ef=[],_0x6bfc1b=[],_0x35ce2c=[],_0x529189=[],_0x26d4df=new Set(_0xc8eb40['map'](_0xf275ea=>_0xf275ea[_0x2594a9(0x1b3)]));for(const _0x1f6e26 of _0xc8eb40){const _0x3f6919=await computeSqlFileHash(_0x1f6e26[_0x2594a9(0x19f)]),_0x1e6133=_0x597204['sqls'][_0x1f6e26[_0x2594a9(0x1b3)]],_0x5661a6=!!_0x1e6133&&_0x1e6133[_0x2594a9(0x1a2)]!==_0x1f6e26['relativePath'],_0x45c946=!!_0x1e6133&&!!_0x1f6e26[_0x2594a9(0x194)]&&_0x1e6133[_0x2594a9(0x194)]!==_0x1f6e26[_0x2594a9(0x194)];if(!_0x1e6133)_0xbe63ef['push'](_0x1f6e26[_0x2594a9(0x1b3)]);else _0x1e6133['hash']!==_0x3f6919||_0x5661a6||_0x45c946?_0x6bfc1b[_0x2594a9(0x197)](_0x1f6e26[_0x2594a9(0x1b3)]):_0x35ce2c[_0x2594a9(0x197)](_0x1f6e26[_0x2594a9(0x1b3)]);}for(const _0x556f67 of Object['keys'](_0x597204[_0x2594a9(0x1a4)])){!_0x26d4df['has'](_0x556f67)&&_0x529189[_0x2594a9(0x197)](_0x556f67);}const _0x4355ff=[];if(_0x5d4c89[_0x2594a9(0x1b8)]('remote')){const _0x2c82f8=await fetchAllSqlCodes(_0x5d4c89[_0x2594a9(0x1b6)]);for(const _0x22956c of _0x2c82f8){!_0x26d4df[_0x2594a9(0x1b9)](_0x22956c)&&!_0x597204[_0x2594a9(0x1a4)][_0x22956c]&&_0x4355ff['push'](_0x22956c);}}const _0x4a98bb=_0xbe63ef[_0x2594a9(0x19c)]===0x0&&_0x6bfc1b[_0x2594a9(0x19c)]===0x0&&_0x529189[_0x2594a9(0x19c)]===0x0&&_0x4355ff['length']===0x0;return{'ok':!![],'data':{'added':_0xbe63ef,'modified':_0x6bfc1b,'missing':_0x529189,'unchanged':_0x35ce2c,'remoteOnly':_0x4355ff},'message':_0x4a98bb?_0x2594a9(0x199):_0xbe63ef[_0x2594a9(0x19c)]+_0x2594a9(0x1ae)+_0x6bfc1b['length']+_0x2594a9(0x1b2)+_0x529189['length']+_0x2594a9(0x19a)+_0x35ce2c[_0x2594a9(0x19c)]+_0x2594a9(0x1b0)+(_0x4355ff[_0x2594a9(0x19c)]>0x0?',\x20'+_0x4355ff[_0x2594a9(0x19c)]+_0x2594a9(0x1aa):'')};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a195_0x5c00a5=a195_0x2ae1;(function(_0x4d32ae,_0x152154){const _0x376f8f=a195_0x2ae1,_0x1d3454=_0x4d32ae();while(!![]){try{const _0x3b7662=parseInt(_0x376f8f(0x80))/0x1+parseInt(_0x376f8f(0x9a))/0x2+-parseInt(_0x376f8f(0x83))/0x3*(-parseInt(_0x376f8f(0x89))/0x4)+-parseInt(_0x376f8f(0x7f))/0x5+parseInt(_0x376f8f(0x82))/0x6*(parseInt(_0x376f8f(0x9d))/0x7)+-parseInt(_0x376f8f(0xa6))/0x8*(-parseInt(_0x376f8f(0x95))/0x9)+-parseInt(_0x376f8f(0xa7))/0xa;if(_0x3b7662===_0x152154)break;else _0x1d3454['push'](_0x1d3454['shift']());}catch(_0x4e8a43){_0x1d3454['push'](_0x1d3454['shift']());}}}(a195_0x42b1,0x6bcaa));import{readFileSync,existsSync}from'node:fs';function a195_0x2ae1(_0x443caf,_0x3ca331){_0x443caf=_0x443caf-0x7e;const _0x42b108=a195_0x42b1();let _0x2ae1db=_0x42b108[_0x443caf];return _0x2ae1db;}function a195_0x42b1(){const _0x45185b=['read','401972tXyFtK','schemas','isDangerous','valid','index_type','validate','index_name','indexes','check-indexes','dataset','reason','from','9kZFbDf','primary','message','dbtableConfig','index_columns','510992NzDmmm','tables','length','28eKVOGQ','sql','file','map','pkField','find','isArray','SQL\x20schema\x20validation','\x22\x20not\x20found\x20in\x20any\x20dataset','6060584SgOczc','16541830JaqKdX','trim','tableName','type','boolean','indexName','toLowerCase','\x22\x20not\x20found\x20or\x20not\x20accessible','name','filter','string','columns','Path\x20to\x20the\x20SQL\x20file\x20to\x20validate','push','cwd','Comma-separated\x20dataset\x20codes\x20to\x20cross-check\x20table/column\x20names\x20against','Inline\x20SQL\x20content\x20to\x20validate\x20(alternative\x20to\x20--file)','flagMissing','File\x20not\x20found:\x20','Provide\x20--file\x20or\x20--sql','str','fields','get','validation','1780010wjXlnp','128648CnEHLB','isSelectOnly','1060536LbZGsM','18FoKXUY','utf-8','columnNames','Validate\x20SQL\x20content\x20without\x20saving\x20(type\x20detection,\x20parameter\x20extraction,\x20optional\x20schema\x20check)','sqlType'];a195_0x42b1=function(){return _0x45185b;};return a195_0x42b1();}import{resolve}from'node:path';import{validateSql}from'../../core/sql-validator.js';import{auditSqlJoinIndexes}from'../../core/sql-index-auditor.js';import{getDatasetDetail,listDatasets}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{assertDatasetIsDbTableBacked,filterDbTableBackedDatasets}from'../../commands/dataset/capability.js';export const sqlValidate={'service':a195_0x5c00a5(0x9e),'command':a195_0x5c00a5(0x8e),'description':a195_0x5c00a5(0x86),'risk':a195_0x5c00a5(0x88),'flags':[{'name':a195_0x5c00a5(0x9f),'type':a195_0x5c00a5(0xb1),'description':a195_0x5c00a5(0xb3)},{'name':a195_0x5c00a5(0x9e),'type':a195_0x5c00a5(0xb1),'description':a195_0x5c00a5(0xb7)},{'name':a195_0x5c00a5(0x8a),'type':'string','description':a195_0x5c00a5(0xb6)},{'name':a195_0x5c00a5(0x91),'type':a195_0x5c00a5(0xab),'description':'Audit\x20top-level\x20JOIN\x20equality\x20predicates\x20against\x20dataset\x20index\x20metadata'}],async 'execute'(_0x3401a8){const _0x2c7e3f=a195_0x5c00a5,_0x15d572=_0x3401a8[_0x2c7e3f(0xbb)](_0x2c7e3f(0x9f)),_0x42e242=_0x3401a8['str'](_0x2c7e3f(0x9e)),_0x3d02c1=_0x3401a8['str'](_0x2c7e3f(0x8a)),_0xe99d1a=_0x3401a8['bool'](_0x2c7e3f(0x91));if(!_0x15d572&&!_0x42e242)throw CliErrors[_0x2c7e3f(0xb8)](_0x2c7e3f(0x9f),_0x2c7e3f(0xba));if(_0xe99d1a&&!_0x3d02c1)throw CliErrors['validation']('--check-indexes\x20requires\x20--schemas.');let _0xb0eeea;if(_0x15d572){const _0x363171=resolve(process[_0x2c7e3f(0xb5)](),_0x15d572);if(!existsSync(_0x363171))throw CliErrors[_0x2c7e3f(0x7e)](_0x2c7e3f(0xb9)+_0x363171);_0xb0eeea=readFileSync(_0x363171,_0x2c7e3f(0x84));}else _0xb0eeea=_0x42e242;const _0x24cf5f=validateSql(_0xb0eeea),_0x2961ef={'valid':_0x24cf5f[_0x2c7e3f(0x8c)],'sqlType':_0x24cf5f[_0x2c7e3f(0x87)][_0x2c7e3f(0xaa)],'isSelectOnly':_0x24cf5f[_0x2c7e3f(0x87)][_0x2c7e3f(0x81)],'isDangerous':_0x24cf5f[_0x2c7e3f(0x87)][_0x2c7e3f(0x8b)],'tables':_0x24cf5f[_0x2c7e3f(0x9b)],'parameters':_0x24cf5f['parameters'],'message':_0x24cf5f[_0x2c7e3f(0x97)]};_0x24cf5f[_0x2c7e3f(0x87)][_0x2c7e3f(0x93)]&&(_0x2961ef[_0x2c7e3f(0x93)]=_0x24cf5f[_0x2c7e3f(0x87)][_0x2c7e3f(0x93)]);if(_0x3d02c1&&_0x24cf5f[_0x2c7e3f(0x8c)]){const _0xfe5970=_0x3d02c1['split'](',')[_0x2c7e3f(0xa0)](_0x2b0b40=>_0x2b0b40[_0x2c7e3f(0xa8)]())['filter'](Boolean),_0x114aad=[],_0x158897=[],_0x4d497e=filterDbTableBackedDatasets(await listDatasets(_0x3401a8['appCode'])),_0x1994a3=new Map(_0x4d497e[_0x2c7e3f(0xa0)](_0x20beea=>[_0x20beea[_0x2c7e3f(0x98)]?.[_0x2c7e3f(0xa9)]?.[_0x2c7e3f(0xad)](),_0x20beea]));for(const _0x36cd9f of _0x24cf5f['tables']){const _0x8a2ed6=_0x1994a3[_0x2c7e3f(0xbd)](_0x36cd9f['toLowerCase']());!_0x8a2ed6&&_0x114aad['push']('Table\x20\x22'+_0x36cd9f+_0x2c7e3f(0xa5));}for(const _0x16d195 of _0xfe5970){let _0x2fabb8;try{_0x2fabb8=await getDatasetDetail(_0x16d195);}catch{_0x114aad['push']('Dataset\x20\x22'+_0x16d195+_0x2c7e3f(0xae));continue;}assertDatasetIsDbTableBacked(_0x2fabb8,_0x2c7e3f(0xa4));const _0x5049e9=Array[_0x2c7e3f(0xa3)](_0x2fabb8[_0x2c7e3f(0xbc)])?_0x2fabb8['fields']:[],_0x2b39be=new Set(_0x5049e9[_0x2c7e3f(0xa0)](_0x196a5f=>_0x196a5f['name']?.[_0x2c7e3f(0xad)]())),_0x1e8935=_0x2fabb8[_0x2c7e3f(0x98)]?.[_0x2c7e3f(0xa9)]||_0x2fabb8['tableName']||_0x16d195;_0x2961ef['schema:'+_0x1e8935]={'code':_0x16d195,'tableName':_0x1e8935,'fieldCount':_0x2b39be['size'],'fields':Array[_0x2c7e3f(0x94)](_0x2b39be)};if(_0xe99d1a){const _0x311c85=normalizeDatasetIndexes(_0x2fabb8);_0x158897[_0x2c7e3f(0xb4)]({'tableName':_0x1e8935,..._0x311c85});}}_0x114aad['length']>0x0&&(_0x2961ef['schemaWarnings']=_0x114aad),_0xe99d1a&&(_0x2961ef['joinAudit']=auditSqlJoinIndexes(_0xb0eeea,_0x158897));}return{'ok':_0x24cf5f[_0x2c7e3f(0x8c)],'data':_0x2961ef,'message':_0x24cf5f[_0x2c7e3f(0x97)]};}};function normalizeDatasetIndexes(_0x452a4e){const _0x29aa7c=a195_0x5c00a5,_0x2d854c=Array[_0x29aa7c(0xa3)](_0x452a4e?.[_0x29aa7c(0x92)]?.[_0x29aa7c(0x90)])?_0x452a4e[_0x29aa7c(0x92)][_0x29aa7c(0x90)]:Array['isArray'](_0x452a4e?.[_0x29aa7c(0x90)])?_0x452a4e[_0x29aa7c(0x90)]:[],_0x204135=_0x2d854c['flatMap'](_0x53fccd=>{const _0x1b5386=_0x29aa7c,_0x25d245=Array['isArray'](_0x53fccd?.[_0x1b5386(0x99)])?_0x53fccd['index_columns']:Array['isArray'](_0x53fccd?.[_0x1b5386(0x85)])?_0x53fccd['columnNames']:Array[_0x1b5386(0xa3)](_0x53fccd?.['columns'])?_0x53fccd[_0x1b5386(0xb2)]:[],_0x39fd55=_0x25d245[_0x1b5386(0xb0)](_0xb97bb0=>typeof _0xb97bb0==='string')[_0x1b5386(0xa0)](_0x90a5e4=>_0x90a5e4[_0x1b5386(0xa8)]())[_0x1b5386(0xb0)](Boolean);if(_0x39fd55['length']===0x0)return[];const _0x36f86d=[_0x53fccd?.[_0x1b5386(0xac)],_0x53fccd?.[_0x1b5386(0x8f)],_0x53fccd?.[_0x1b5386(0xaf)]]['find'](_0x4f40a0=>typeof _0x4f40a0===_0x1b5386(0xb1)&&_0x4f40a0['trim']()),_0x2343a0=[_0x53fccd?.[_0x1b5386(0x8d)],_0x53fccd?.[_0x1b5386(0xaa)]][_0x1b5386(0xa2)](_0x4a7fe4=>typeof _0x4a7fe4==='string'&&_0x4a7fe4[_0x1b5386(0xa8)]());return[{..._0x36f86d?{'name':_0x36f86d['trim']()}:{},..._0x2343a0?{'type':_0x2343a0[_0x1b5386(0xa8)]()}:{},'columns':_0x39fd55}];}),_0x3a6518=[..._0x204135],_0x49c81f=typeof _0x452a4e?.[_0x29aa7c(0x98)]?.[_0x29aa7c(0xa1)]===_0x29aa7c(0xb1)?_0x452a4e[_0x29aa7c(0x98)][_0x29aa7c(0xa1)]['split'](',')['map'](_0x2bb489=>_0x2bb489['trim']())['filter'](Boolean):[];return _0x49c81f[_0x29aa7c(0x9c)]>0x0&&_0x3a6518['unshift']({'type':_0x29aa7c(0x96),'columns':_0x49c81f}),{'indexes':_0x3a6518,'metadataAvailable':_0x204135[_0x29aa7c(0x9c)]>0x0};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a196_0x2a2d(){const _0x10928d=['9aqPiUf','12ciVAcE','38553053LuKmCc','1110XTIMLB','8289528GTahUr','108609CvLGZv','9507860nRHZMI','1106156DDbRyV','1270lNJWjM','8534589KUbskR','9ntlDnl'];a196_0x2a2d=function(){return _0x10928d;};return a196_0x2a2d();}function a196_0x3fba(_0x11da4c,_0xf27f92){_0x11da4c=_0x11da4c-0xe8;const _0x2a2dcf=a196_0x2a2d();let _0x3fbaef=_0x2a2dcf[_0x11da4c];return _0x3fbaef;}(function(_0x57d380,_0x41d627){const _0x46ab85=a196_0x3fba,_0x33c62d=_0x57d380();while(!![]){try{const _0x106c40=parseInt(_0x46ab85(0xec))/0x1*(-parseInt(_0x46ab85(0xe8))/0x2)+-parseInt(_0x46ab85(0xf1))/0x3*(parseInt(_0x46ab85(0xee))/0x4)+parseInt(_0x46ab85(0xef))/0x5*(-parseInt(_0x46ab85(0xea))/0x6)+-parseInt(_0x46ab85(0xf0))/0x7+-parseInt(_0x46ab85(0xeb))/0x8+-parseInt(_0x46ab85(0xf2))/0x9*(-parseInt(_0x46ab85(0xed))/0xa)+parseInt(_0x46ab85(0xe9))/0xb;if(_0x106c40===_0x41d627)break;else _0x33c62d['push'](_0x33c62d['shift']());}catch(_0x3034cd){_0x33c62d['push'](_0x33c62d['shift']());}}}(a196_0x2a2d,0xa40ba));import{taskStatus}from'../../commands/task/status.js';export const taskDefinitions=[taskStatus];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a197_0x179f(_0x564da8,_0x570385){_0x564da8=_0x564da8-0x154;const _0xa003c4=a197_0xa003();let _0x179f1b=_0xa003c4[_0x564da8];return _0x179f1b;}const a197_0x2c1fc1=a197_0x179f;(function(_0x51c4c0,_0x454ea7){const _0x47c416=a197_0x179f,_0x19613f=_0x51c4c0();while(!![]){try{const _0x417d3f=parseInt(_0x47c416(0x15c))/0x1+-parseInt(_0x47c416(0x15e))/0x2+-parseInt(_0x47c416(0x167))/0x3*(-parseInt(_0x47c416(0x15b))/0x4)+-parseInt(_0x47c416(0x154))/0x5*(parseInt(_0x47c416(0x161))/0x6)+-parseInt(_0x47c416(0x159))/0x7+-parseInt(_0x47c416(0x156))/0x8+-parseInt(_0x47c416(0x16a))/0x9*(-parseInt(_0x47c416(0x158))/0xa);if(_0x417d3f===_0x454ea7)break;else _0x19613f['push'](_0x19613f['shift']());}catch(_0x2b744b){_0x19613f['push'](_0x19613f['shift']());}}}(a197_0xa003,0x432ef));import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asyncTaskMessage,buildAsyncTaskStatusCommand,normalizeAsyncTask}from'../../commands/common/async-task.js';import{getAsyncTaskStatus}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';function a197_0xa003(){const _0x569628=['606894SIbrOF','trim','apiError','Query\x20an\x20asynchronous\x20task;\x20repeat\x20for\x20PENDING\x20or\x20PROCESSING\x20until\x20SUCCESS\x20or\x20FAILED','status','compress','24zYYeYG','task-id','str','5250978dVyMhl','20CilhZc','read','3854144HPEeKd','Task\x20id\x20returned\x20by\x20an\x20asynchronous\x20platform\x20command','10npRdAO','1065743AyeaxS','isTerminal','127956PyxCZW','504127VIYkvQ','taskId','59370AwCxVl','cookie','appCode'];a197_0xa003=function(){return _0x569628;};return a197_0xa003();}export const taskStatus={'service':'task','command':a197_0x2c1fc1(0x165),'description':a197_0x2c1fc1(0x164),'risk':a197_0x2c1fc1(0x155),'defaultOutputFormat':a197_0x2c1fc1(0x166),'structuredErrors':!![],'flags':[{'name':'task-id','type':'string','required':!![],'description':a197_0x2c1fc1(0x157)},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x35275b){const _0x582bc4=a197_0x2c1fc1;if(!_0x35275b[_0x582bc4(0x169)](_0x582bc4(0x168))[_0x582bc4(0x162)]())throw CliErrors['flagMissing'](_0x582bc4(0x168));},async 'execute'(_0x20b132){const _0x19d98a=a197_0x2c1fc1,_0x88eac0=_0x20b132['str'](_0x19d98a(0x168))['trim'](),_0x391367=normalizeAsyncTask(await getAsyncTaskStatus(_0x88eac0,_0x20b132['appCode'],_0x20b132[_0x19d98a(0x15f)]));if(_0x391367[_0x19d98a(0x15d)]!==_0x88eac0)throw CliErrors[_0x19d98a(0x163)]('Task\x20status\x20response\x20id\x20mismatch:\x20requested\x20'+_0x88eac0+',\x20received\x20'+_0x391367[_0x19d98a(0x15d)]+'.');const _0x33f129=buildAsyncTaskStatusCommand(_0x391367[_0x19d98a(0x15d)],_0x20b132[_0x19d98a(0x160)]);return{'ok':!![],'message':asyncTaskMessage(_0x391367),'data':{'appCode':_0x20b132[_0x19d98a(0x160)],..._0x391367,'query':_0x391367[_0x19d98a(0x15a)]?null:{'command':_0x33f129}}};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x4902c1,_0x568bf3){const _0xd91742=a198_0xf194,_0x4ddb87=_0x4902c1();while(!![]){try{const _0x26bd06=parseInt(_0xd91742(0xcc))/0x1+parseInt(_0xd91742(0xce))/0x2*(-parseInt(_0xd91742(0xd2))/0x3)+-parseInt(_0xd91742(0xcd))/0x4*(-parseInt(_0xd91742(0xcb))/0x5)+parseInt(_0xd91742(0xd1))/0x6*(-parseInt(_0xd91742(0xcf))/0x7)+parseInt(_0xd91742(0xc9))/0x8*(parseInt(_0xd91742(0xd0))/0x9)+parseInt(_0xd91742(0xd4))/0xa*(parseInt(_0xd91742(0xd3))/0xb)+parseInt(_0xd91742(0xd5))/0xc*(-parseInt(_0xd91742(0xca))/0xd);if(_0x26bd06===_0x568bf3)break;else _0x4ddb87['push'](_0x4ddb87['shift']());}catch(_0x3d67c0){_0x4ddb87['push'](_0x4ddb87['shift']());}}}(a198_0x61b5,0x21036));import{tenantMembersListDefinition}from'../../commands/tenant/members-list.js';function a198_0xf194(_0x2612d6,_0x526ef4){_0x2612d6=_0x2612d6-0xc9;const _0x61b5b3=a198_0x61b5();let _0xf194e9=_0x61b5b3[_0x2612d6];return _0xf194e9;}function a198_0x61b5(){const _0x5816bd=['65594rAugnO','1414dsctne','18ToAawQ','1344VXMoXX','15YIzkxz','152284hSVtKG','40HwpbyV','253320AOkZIC','868576aAyLQm','26YQbexM','60hijIUU','78359pjRgaG','11932UiSJqe'];a198_0x61b5=function(){return _0x5816bd;};return a198_0x61b5();}export const tenantDefinitions=[tenantMembersListDefinition];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a199_0x1eff5d=a199_0x72c3;(function(_0x2839f1,_0x37cfa5){const _0x137258=a199_0x72c3,_0x534ae9=_0x2839f1();while(!![]){try{const _0x266d81=parseInt(_0x137258(0x19c))/0x1+parseInt(_0x137258(0x197))/0x2+-parseInt(_0x137258(0x1a3))/0x3*(parseInt(_0x137258(0x198))/0x4)+parseInt(_0x137258(0x196))/0x5+-parseInt(_0x137258(0x195))/0x6+-parseInt(_0x137258(0x19e))/0x7+parseInt(_0x137258(0x19d))/0x8;if(_0x266d81===_0x37cfa5)break;else _0x534ae9['push'](_0x534ae9['shift']());}catch(_0x44ad22){_0x534ae9['push'](_0x534ae9['shift']());}}}(a199_0x25bf,0x8589c));import{listCurrentUserTenantMemberships,listTenantDirectoryMembers}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{assertTenantAccessible,projectTenantMembers}from'../../commands/tenant/shared.js';function a199_0x72c3(_0x2409f0,_0x4fe3d9){_0x2409f0=_0x2409f0-0x195;const _0x25bf79=a199_0x25bf();let _0x72c345=_0x25bf79[_0x2409f0];return _0x72c345;}export const tenantMembersListDefinition={'service':a199_0x1eff5d(0x1a0),'command':a199_0x1eff5d(0x1a1),'description':'List\x20members\x20of\x20a\x20tenant\x20available\x20to\x20the\x20current\x20account','risk':a199_0x1eff5d(0x1a8),'requiresAuth':!![],'requiresAppCode':![],'structuredErrors':!![],'flags':[{'name':'tenant-code','type':a199_0x1eff5d(0x1a4),'required':!![],'description':a199_0x1eff5d(0x19a)}],async 'validate'(_0x13bc7c){const _0x24a154=a199_0x1eff5d;if(!_0x13bc7c[_0x24a154(0x19b)](_0x24a154(0x1a6))[_0x24a154(0x1a5)]())throw CliErrors[_0x24a154(0x1a7)](_0x24a154(0x1a6),_0x24a154(0x199));},async 'execute'(_0x3447b2){const _0x53679f=a199_0x1eff5d,_0x5ae336=_0x3447b2[_0x53679f(0x19b)]('tenant-code')[_0x53679f(0x1a5)](),_0x5a954b=await listCurrentUserTenantMemberships();assertTenantAccessible(_0x5ae336,_0x5a954b);const _0x7577d=projectTenantMembers(await listTenantDirectoryMembers(_0x5ae336));return{'ok':!![],'data':{'tenantCode':_0x5ae336,'items':_0x7577d,'totalCount':_0x7577d[_0x53679f(0x19f)]},'message':'Found\x20'+_0x7577d[_0x53679f(0x19f)]+_0x53679f(0x1a2)};}};function a199_0x25bf(){const _0x2f3efb=['724104viKrEL','4568151tvxOAU','length','tenant','members-list','\x20tenant\x20member(s)','3UBZwsC','string','trim','tenant-code','flagMissing','read','1315692DNRrru','531115aQjWxK','848938yhYWEU','494752abwkoN','Pass\x20--tenant-code\x20<code>.','Exact\x20tenant\x20code','str','921330FRSwrP'];a199_0x25bf=function(){return _0x2f3efb;};return a199_0x25bf();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a200_0x198f(){const _0x15c5fd=['222837EkfnHC','330sQoRBJ','set','trim','16ENwUaA','2330885yOvIgv','values','Tenant\x20\x22','4tZPQmb','52860JCZqOE','Check\x20--tenant-code\x20or\x20login\x20with\x20an\x20account\x20that\x20belongs\x20to\x20this\x20tenant.','get','1645530tFBhni','983032URjCOn','displayName','nickname','adminFlag','43644gssfJu','MEMBER','role','status','\x22\x20is\x20not\x20available\x20to\x20the\x20current\x20account.','some','1166214RpSPeQ','isFinite','sort','userId','9ayZBEO','ADMIN','username','tenantCode'];a200_0x198f=function(){return _0x15c5fd;};return a200_0x198f();}(function(_0x3d34af,_0xabf5ff){const _0x1e91b8=a200_0x2167,_0x1b6aeb=_0x3d34af();while(!![]){try{const _0x1a61ef=parseInt(_0x1e91b8(0xee))/0x1*(parseInt(_0x1e91b8(0xe5))/0x2)+-parseInt(_0x1e91b8(0xdd))/0x3*(parseInt(_0x1e91b8(0xe1))/0x4)+parseInt(_0x1e91b8(0xe2))/0x5+parseInt(_0x1e91b8(0xe9))/0x6+parseInt(_0x1e91b8(0xf4))/0x7+parseInt(_0x1e91b8(0xea))/0x8*(-parseInt(_0x1e91b8(0xf8))/0x9)+parseInt(_0x1e91b8(0xe6))/0xa*(-parseInt(_0x1e91b8(0xde))/0xb);if(_0x1a61ef===_0xabf5ff)break;else _0x1b6aeb['push'](_0x1b6aeb['shift']());}catch(_0x52b94a){_0x1b6aeb['push'](_0x1b6aeb['shift']());}}}(a200_0x198f,0x65803));import{CliErrors}from'../../errors.js';function textOrNull(_0x4dedf4){const _0x4a84fb=a200_0x2167,_0x44fd74=_0x4dedf4?.[_0x4a84fb(0xe0)]();return _0x44fd74?_0x44fd74:null;}export function projectTenantMembers(_0x21db8c){const _0x465aa8=a200_0x2167,_0x1e25df=new Map();for(const _0x4b454a of _0x21db8c){const _0x3387e1=Number(_0x4b454a[_0x465aa8(0xf7)]);if(!Number[_0x465aa8(0xf5)](_0x3387e1)||_0x3387e1<=0x0)continue;const _0x1815e2={'userId':_0x3387e1,'username':textOrNull(_0x4b454a['username']),'displayName':textOrNull(_0x4b454a[_0x465aa8(0xec)]),'role':_0x4b454a[_0x465aa8(0xed)]===!![]?_0x465aa8(0xf9):_0x465aa8(0xef),'status':textOrNull(_0x4b454a[_0x465aa8(0xf1)])},_0x439dd4=_0x1e25df[_0x465aa8(0xe8)](_0x3387e1);if(!_0x439dd4){_0x1e25df[_0x465aa8(0xdf)](_0x3387e1,_0x1815e2);continue;}_0x439dd4['username']??=_0x1815e2[_0x465aa8(0xfa)],_0x439dd4['displayName']??=_0x1815e2[_0x465aa8(0xeb)],_0x439dd4[_0x465aa8(0xf1)]??=_0x1815e2[_0x465aa8(0xf1)];if(_0x1815e2[_0x465aa8(0xf0)]===_0x465aa8(0xf9))_0x439dd4[_0x465aa8(0xf0)]=_0x465aa8(0xf9);}return[..._0x1e25df[_0x465aa8(0xe3)]()][_0x465aa8(0xf6)]((_0x5c50e2,_0x5e6b7b)=>_0x5c50e2[_0x465aa8(0xf7)]-_0x5e6b7b[_0x465aa8(0xf7)]);}function a200_0x2167(_0x558d23,_0x130aa6){_0x558d23=_0x558d23-0xdd;const _0x198f39=a200_0x198f();let _0x216700=_0x198f39[_0x558d23];return _0x216700;}export function assertTenantAccessible(_0x554144,_0xb694d5){const _0x3619d0=a200_0x2167;if(_0xb694d5[_0x3619d0(0xf3)](_0x123aa9=>_0x123aa9[_0x3619d0(0xfb)]===_0x554144))return;throw CliErrors['validation'](_0x3619d0(0xe4)+_0x554144+_0x3619d0(0xf2),_0x3619d0(0xe7));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a201_0x3c605b=a201_0x13e2;(function(_0x2fa002,_0x2a9747){const _0x3f2cde=a201_0x13e2,_0x3837ab=_0x2fa002();while(!![]){try{const _0x3a45b4=-parseInt(_0x3f2cde(0x1c5))/0x1+parseInt(_0x3f2cde(0x1d9))/0x2+-parseInt(_0x3f2cde(0x1d5))/0x3*(-parseInt(_0x3f2cde(0x1c9))/0x4)+parseInt(_0x3f2cde(0x1d7))/0x5*(-parseInt(_0x3f2cde(0x1c8))/0x6)+-parseInt(_0x3f2cde(0x1ca))/0x7*(parseInt(_0x3f2cde(0x1dd))/0x8)+parseInt(_0x3f2cde(0x1c3))/0x9*(parseInt(_0x3f2cde(0x1cb))/0xa)+-parseInt(_0x3f2cde(0x1d2))/0xb*(-parseInt(_0x3f2cde(0x1d4))/0xc);if(_0x3a45b4===_0x2a9747)break;else _0x3837ab['push'](_0x3837ab['shift']());}catch(_0x3fdd34){_0x3837ab['push'](_0x3837ab['shift']());}}}(a201_0x1bca,0x91c50));import{asDryRunResult}from'../../commands/common/dry-run.js';import{bindDingTalkSandboxAccount,DING_TALK_SANDBOX_BIND_PATH}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';function a201_0x1bca(){const _0x3d91ec=['Retry\x20with\x20the\x20same\x20--ding-talk-user-id\x20only\x20after\x20checking\x20the\x20current\x20platform\x20session.','DingTalk\x20sandbox\x20account\x20binding\x20was\x20not\x20confirmed.','DingTalk\x20user\x20id\x20returned\x20by\x20the\x20sandbox','ding-talk-user-id','dingding-sandbox-bind','The\x20current\x20binding\x20is\x20not\x20exposed\x20by\x20the\x20server;\x20before\x20is\x20unavailable.','15453262hZxDxv','str','12EcjOXc','183pVtpgj','string','30qSIqqw','Bound\x20current\x20user\x20to\x20DingTalk\x20sandbox\x20account.','86068gkuhrq','validation','POST','Pass\x20the\x20DingTalk\x20user\x20id\x20returned\x20by\x20the\x20sandbox.','442840HkTveJ','write','9aUoGjt','bind','614934SddBYv','dingding-sandbox','apiError','648966FHHqpF','47184JtzHQC','77hCCKUF','3024450FZdNJG'];a201_0x1bca=function(){return _0x3d91ec;};return a201_0x1bca();}const PROVIDER_ID=a201_0x3c605b(0x1c6),CURRENT_BINDING_WARNING=a201_0x3c605b(0x1d1);function readDingTalkUserId(_0x2bd270){const _0x53f7d0=a201_0x3c605b,_0x4dbe64=_0x2bd270[_0x53f7d0(0x1d3)](_0x53f7d0(0x1cf))['trim']();if(!_0x4dbe64)throw CliErrors[_0x53f7d0(0x1da)]('--ding-talk-user-id\x20cannot\x20be\x20empty.',_0x53f7d0(0x1dc));return _0x4dbe64;}function buildBindingData(_0x2f7f5f,_0x2e3735){const _0x32ccbf=a201_0x3c605b;return{'operation':_0x32ccbf(0x1c4),'selector':{'providerId':PROVIDER_ID,'dingTalkUserId':_0x2f7f5f},'before':null,'after':{'providerId':PROVIDER_ID,'dingTalkUserId':_0x2f7f5f,'bound':!![]},'dryRun':_0x2e3735,'backend':{'method':'POST','path':DING_TALK_SANDBOX_BIND_PATH},'warnings':[CURRENT_BINDING_WARNING]};}function a201_0x13e2(_0x4ec640,_0x4e1e99){_0x4ec640=_0x4ec640-0x1c3;const _0x1bca0=a201_0x1bca();let _0x13e279=_0x1bca0[_0x4ec640];return _0x13e279;}export const dingTalkSandboxBind={'service':'user-account','command':a201_0x3c605b(0x1d0),'description':'Bind\x20the\x20current\x20platform\x20user\x20to\x20a\x20DingTalk\x20sandbox\x20account','risk':a201_0x3c605b(0x1de),'requiresAuth':!![],'requiresAppCode':![],'structuredErrors':!![],'flags':[{'name':a201_0x3c605b(0x1cf),'type':a201_0x3c605b(0x1d6),'required':!![],'description':a201_0x3c605b(0x1ce)}],async 'validate'(_0x70f0ad){readDingTalkUserId(_0x70f0ad);},async 'dryRun'(_0x2fd126){const _0x58b1ed=a201_0x3c605b,_0x24ddac=readDingTalkUserId(_0x2fd126);return asDryRunResult(buildBindingData(_0x24ddac,!![]),{'method':_0x58b1ed(0x1db),'url':DING_TALK_SANDBOX_BIND_PATH});},async 'execute'(_0x552c7a){const _0x5af6c9=a201_0x3c605b,_0x40734e=readDingTalkUserId(_0x552c7a),_0x524be2=await bindDingTalkSandboxAccount(_0x40734e);if(_0x524be2!==!![])throw CliErrors[_0x5af6c9(0x1c7)](_0x5af6c9(0x1cd),_0x5af6c9(0x1cc));return{'ok':!![],'data':buildBindingData(_0x40734e,![]),'message':_0x5af6c9(0x1d8)};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a202_0x2794(_0x5786c1,_0x52c4a7){_0x5786c1=_0x5786c1-0x162;const _0x17348b=a202_0x1734();let _0x27943c=_0x17348b[_0x5786c1];return _0x27943c;}(function(_0x18e915,_0x344602){const _0x3c9d69=a202_0x2794,_0x2649be=_0x18e915();while(!![]){try{const _0x78c406=parseInt(_0x3c9d69(0x164))/0x1+-parseInt(_0x3c9d69(0x166))/0x2+-parseInt(_0x3c9d69(0x165))/0x3*(parseInt(_0x3c9d69(0x168))/0x4)+parseInt(_0x3c9d69(0x163))/0x5*(parseInt(_0x3c9d69(0x169))/0x6)+parseInt(_0x3c9d69(0x16a))/0x7+parseInt(_0x3c9d69(0x16b))/0x8*(-parseInt(_0x3c9d69(0x167))/0x9)+parseInt(_0x3c9d69(0x162))/0xa;if(_0x78c406===_0x344602)break;else _0x2649be['push'](_0x2649be['shift']());}catch(_0x191693){_0x2649be['push'](_0x2649be['shift']());}}}(a202_0x1734,0xc5999));import{dingTalkSandboxBind}from'../../commands/user-account/dingding-sandbox-bind.js';export const userAccountDefinitions=[dingTalkSandboxBind];function a202_0x1734(){const _0xdaba4c=['8wjzdpY','42126780sRIUAR','26395AJmRgU','187029QKXwBS','4308321doaQEf','2515374hBLexg','14001219tQkxFc','4GlaPBc','102DBeTVC','3985828tbihcv'];a202_0x1734=function(){return _0xdaba4c;};return a202_0x1734();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a203_0x9eb03c=a203_0x4b92;(function(_0x2320e9,_0x14d3c5){const _0x356d67=a203_0x4b92,_0x58c91e=_0x2320e9();while(!![]){try{const _0x13cb00=parseInt(_0x356d67(0xba))/0x1+parseInt(_0x356d67(0xbd))/0x2*(parseInt(_0x356d67(0xb8))/0x3)+-parseInt(_0x356d67(0xb7))/0x4+parseInt(_0x356d67(0xb2))/0x5*(-parseInt(_0x356d67(0xb9))/0x6)+parseInt(_0x356d67(0xbc))/0x7*(parseInt(_0x356d67(0xb5))/0x8)+parseInt(_0x356d67(0xb3))/0x9+-parseInt(_0x356d67(0xbe))/0xa;if(_0x13cb00===_0x14d3c5)break;else _0x58c91e['push'](_0x58c91e['shift']());}catch(_0x30c0fb){_0x58c91e['push'](_0x58c91e['shift']());}}}(a203_0x5727,0x5794f));function a203_0x5727(){const _0x46acec=['1223946yMihra','9785620GATyRN','2665TtktTR','959949dSmXeK','workspace\x20add','8iodIxP','workspace','565904cPnvQF','3NtLvvR','318TlNHbo','621318CmvITa','name','1169490sbFmcZ'];a203_0x5727=function(){return _0x46acec;};return a203_0x5727();}import{buildAppAddFlags,runAppAdd,validateAppName}from'../../commands/common/app-registry.js';function a203_0x4b92(_0x3b8419,_0x53ea6c){_0x3b8419=_0x3b8419-0xb2;const _0x5727c4=a203_0x5727();let _0x4b926b=_0x5727c4[_0x3b8419];return _0x4b926b;}export const workspaceAddDefinition={'service':a203_0x9eb03c(0xb6),'command':'add','description':'Register\x20an\x20app\x20profile\x20in\x20the\x20current\x20workspace\x20(or\x20--global)','risk':'write','requiresAuth':![],'requiresAppCode':![],'args':[{'name':a203_0x9eb03c(0xbb),'description':'App\x20profile\x20name','required':!![]}],'flags':buildAppAddFlags(),'validate':_0x4b43ac=>validateAppName(_0x4b43ac,a203_0x9eb03c(0xb4)),'execute':_0x433754=>runAppAdd(_0x433754,a203_0x9eb03c(0xb4))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a204_0x31281a=a204_0x5c7e;(function(_0x39bc17,_0x4ed9ab){const _0x4364f0=a204_0x5c7e,_0x11eafc=_0x39bc17();while(!![]){try{const _0x194a68=-parseInt(_0x4364f0(0x193))/0x1+-parseInt(_0x4364f0(0x194))/0x2+parseInt(_0x4364f0(0x195))/0x3*(parseInt(_0x4364f0(0x1ae))/0x4)+-parseInt(_0x4364f0(0x1a3))/0x5+parseInt(_0x4364f0(0x181))/0x6*(parseInt(_0x4364f0(0x1a1))/0x7)+parseInt(_0x4364f0(0x198))/0x8*(-parseInt(_0x4364f0(0x1b0))/0x9)+-parseInt(_0x4364f0(0x1af))/0xa*(-parseInt(_0x4364f0(0x1b5))/0xb);if(_0x194a68===_0x4ed9ab)break;else _0x11eafc['push'](_0x11eafc['shift']());}catch(_0x240d25){_0x11eafc['push'](_0x11eafc['shift']());}}}(a204_0x5a0c,0x7d5b4));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';function a204_0x5a0c(){const _0x11129e=['Target\x20environment','object','defaultFormat','env','flag','97796tPpTXw','16780cuxZyt','1771641cJTkvj','Workspace\x20','riskLevel','workspace.','Pass\x20--appcode\x20<code>,\x20or\x20choose\x20one\x20of:\x20','8206BTUmsN','\x20--appcode\x20<code>`.',').\x20Config:\x20','\x20workspace\x20use\x20--app\x20<name>`.','958836qIVaxr','pageSize','Use\x20`','string','Missing\x20workspace\x20app\x20selector.','\x22\x20not\x20found.','Locale\x20for\x20this\x20workspace\x20app\x20profile','API\x20directory\x20path\x20for\x20this\x20workspace\x20app\x20profile','app','\x20--app\x20','appcode','keys','App\x20\x22','.\x20Credentials:\x20not\x20written.','str','use','workspace','initialized','599479uuPORl','112472HvQijp','93nenmgT','trim','write','32FkMbLq','Default\x20output\x20format\x20for\x20this\x20workspace\x20app\x20profile','project','App\x20profile\x20name\x20to\x20use\x20in\x20this\x20workspace','Initialize\x20the\x20current\x20workspace\x20app\x20binding','init','format','length','App\x20code\x20to\x20bind\x20to\x20this\x20workspace','14WBUBNU','apiDir','1863740FuCnLd','Default\x20page\x20size\x20for\x20this\x20workspace\x20app\x20profile','locale','validation','join','apps'];a204_0x5a0c=function(){return _0x11129e;};return a204_0x5a0c();}import{validateAppcode}from'../../commands/common/validate.js';import{readConfigFile,readRawConfigWithLayers,resolveWriteConfigPath,writeConfigFile}from'../../context.js';import{workspaceAddDefinition}from'../../commands/workspace/add.js';function a204_0x5c7e(_0x1309c7,_0x382fd7){_0x1309c7=_0x1309c7-0x181;const _0x5a0c1a=a204_0x5a0c();let _0x5c7eae=_0x5a0c1a[_0x1309c7];return _0x5c7eae;}import{workspaceRemoveDefinition}from'../../commands/workspace/remove.js';const WORKSPACE_USAGE=CLI_BIN_NAME+'\x20workspace\x20<init|use>\x20--app\x20<name>\x20[--appcode\x20<code>]',SAFE_PROFILE_KEYS=['appcode',a204_0x31281a(0x1ac),a204_0x31281a(0x1a2),a204_0x31281a(0x19e),a204_0x31281a(0x182),a204_0x31281a(0x1b2),a204_0x31281a(0x1a5)],workspaceFlags=[{'name':a204_0x31281a(0x189),'type':a204_0x31281a(0x184),'description':a204_0x31281a(0x19b)},{'name':a204_0x31281a(0x18b),'type':a204_0x31281a(0x184),'description':a204_0x31281a(0x1a0)},{'name':a204_0x31281a(0x1ac),'type':'string','description':a204_0x31281a(0x1a9),'enum':[...RABETBASE_ENV_VALUES]},{'name':a204_0x31281a(0x1a2),'type':a204_0x31281a(0x184),'description':a204_0x31281a(0x188)},{'name':a204_0x31281a(0x1ab),'type':'string','description':a204_0x31281a(0x199),'enum':[...RABETBASE_OUTPUT_FORMAT_VALUES]},{'name':a204_0x31281a(0x182),'type':'number','description':a204_0x31281a(0x1a4)},{'name':'riskLevel','type':'string','description':'Risk\x20level\x20for\x20this\x20workspace\x20app\x20profile','enum':[...RISK_LEVEL_VALUES]},{'name':a204_0x31281a(0x1a5),'type':a204_0x31281a(0x184),'description':a204_0x31281a(0x187)}];function isRecord(_0x73d3ef){const _0x2691d3=a204_0x31281a;return!!_0x73d3ef&&typeof _0x73d3ef===_0x2691d3(0x1aa)&&!Array['isArray'](_0x73d3ef);}function assertValidAppcode(_0x27f9f7){const {valid:_0x286dc9,message:_0xab44a5}=validateAppcode(_0x27f9f7);if(!_0x286dc9)throw CliErrors['validation']('Invalid\x20appcode:\x20'+_0x27f9f7,_0xab44a5);}function sanitizeProfile(_0x42ab34){if(!isRecord(_0x42ab34))return{};const _0x101294={};for(const _0x885dba of SAFE_PROFILE_KEYS){if(_0x42ab34[_0x885dba]!==undefined)_0x101294[_0x885dba]=_0x42ab34[_0x885dba];}return _0x101294;}function cloneProfile(_0x49b142){return isRecord(_0x49b142)?{..._0x49b142}:{};}function collectWorkspaceProfileOverrides(_0x6ed256){const _0x512b5d=a204_0x31281a,_0x4ec82e={},_0x353442=_0x6ed256['str'](_0x512b5d(0x1ac)),_0x2dc277=_0x6ed256[_0x512b5d(0x18f)]('apiDir'),_0x159a2f=_0x6ed256[_0x512b5d(0x18f)](_0x512b5d(0x1ab)),_0x45436e=_0x6ed256[_0x512b5d(0x1ad)](_0x512b5d(0x182)),_0x1b134a=_0x6ed256[_0x512b5d(0x18f)]('riskLevel'),_0x434bb0=_0x6ed256[_0x512b5d(0x18f)](_0x512b5d(0x1a5));if(_0x353442)_0x4ec82e[_0x512b5d(0x1ac)]=_0x353442;if(_0x2dc277)_0x4ec82e[_0x512b5d(0x1a2)]=_0x2dc277;if(_0x159a2f)_0x4ec82e[_0x512b5d(0x19e)]=_0x159a2f;if(_0x45436e!==undefined&&_0x45436e!=='')_0x4ec82e[_0x512b5d(0x182)]=Number(_0x45436e);if(_0x1b134a)_0x4ec82e[_0x512b5d(0x1b2)]=_0x1b134a;if(_0x434bb0)_0x4ec82e[_0x512b5d(0x1a5)]=_0x434bb0;return _0x4ec82e;}async function validateWorkspaceArgs(_0x2c1bd3){const _0x195181=a204_0x31281a,_0x56cf79=_0x2c1bd3[_0x195181(0x18f)](_0x195181(0x189))[_0x195181(0x196)](),_0x1d6944=_0x2c1bd3[_0x195181(0x18f)](_0x195181(0x18b))['trim']();if(!_0x56cf79&&!_0x1d6944)throw CliErrors[_0x195181(0x1a6)](_0x195181(0x185),'Use\x20`'+CLI_BIN_NAME+'\x20workspace\x20init\x20--appcode\x20<code>`\x20or\x20`'+CLI_BIN_NAME+_0x195181(0x1b8));if(_0x1d6944)assertValidAppcode(_0x1d6944);}function resolveKnownApps(){const _0x10d330=a204_0x31281a,{config:_0x1f1ad7,layers:_0x3a7368}=readRawConfigWithLayers(),_0x1b35e3=isRecord(_0x1f1ad7['apps'])?_0x1f1ad7['apps']:{},_0x545d4b=isRecord(_0x3a7368['globalConfig'][_0x10d330(0x1a8)])?_0x3a7368['globalConfig'][_0x10d330(0x1a8)]:{};return{..._0x545d4b,..._0x1b35e3};}async function configureWorkspace(_0x3e96e7,_0x4c05ab){const _0x116510=a204_0x31281a,_0x3623f6=_0x3e96e7['str'](_0x116510(0x189))[_0x116510(0x196)](),_0x2f057b=_0x3e96e7[_0x116510(0x18f)](_0x116510(0x18b))['trim'](),_0x14b36e=_0x3623f6||_0x2f057b;if(!_0x14b36e)throw CliErrors[_0x116510(0x1a6)]('Missing\x20workspace\x20app\x20selector.',_0x116510(0x183)+CLI_BIN_NAME+'\x20workspace\x20init\x20--appcode\x20<code>`\x20or\x20`'+CLI_BIN_NAME+'\x20workspace\x20use\x20--app\x20<name>`.');if(_0x2f057b)assertValidAppcode(_0x2f057b);const _0x5c110d=resolveWriteConfigPath(_0x116510(0x19a)),_0x4b129d=readConfigFile(_0x5c110d),_0x42741f=resolveKnownApps(),_0x3c257e=isRecord(_0x4b129d['apps'])?{..._0x4b129d['apps']}:{},_0x314083=cloneProfile(_0x3c257e[_0x14b36e]),_0x5c49f1=sanitizeProfile(_0x42741f[_0x14b36e]),_0x68dac8=_0x2f057b?{}:_0x5c49f1,_0x30c8d5=_0x2f057b||_0x68dac8[_0x116510(0x18b)];if(!_0x30c8d5){const _0x3db033=Object[_0x116510(0x18c)](_0x42741f),_0x2061de=_0x3db033[_0x116510(0x19f)]===0x0?'Use\x20`'+CLI_BIN_NAME+'\x20workspace\x20'+_0x4c05ab+_0x116510(0x18a)+_0x14b36e+_0x116510(0x1b6):_0x116510(0x1b4)+_0x3db033[_0x116510(0x1a7)](',\x20');throw CliErrors[_0x116510(0x1a6)](_0x116510(0x18d)+_0x14b36e+_0x116510(0x186),_0x2061de);}assertValidAppcode(String(_0x30c8d5));const _0x551165={..._0x68dac8,..._0x314083,'appcode':String(_0x30c8d5),...collectWorkspaceProfileOverrides(_0x3e96e7)};return _0x3c257e[_0x14b36e]=_0x551165,_0x4b129d[_0x116510(0x1a8)]=_0x3c257e,_0x4b129d['defaultApp']=_0x14b36e,delete _0x4b129d[_0x116510(0x18b)],delete _0x4b129d[_0x116510(0x189)],_0x551165[_0x116510(0x1ac)]&&(_0x4b129d[_0x116510(0x1ac)]=_0x551165[_0x116510(0x1ac)]),writeConfigFile(_0x5c110d,_0x4b129d),{'ok':!![],'message':_0x116510(0x1b1)+(_0x4c05ab===_0x116510(0x19d)?_0x116510(0x192):'updated')+':\x20'+_0x14b36e+'\x20(appcode:\x20'+_0x551165[_0x116510(0x18b)]+_0x116510(0x1b7)+_0x5c110d+_0x116510(0x18e),'data':{'operation':_0x116510(0x1b3)+_0x4c05ab,'configPath':_0x5c110d,'app':_0x14b36e,'appcode':_0x551165['appcode'],'env':_0x551165['env']??null,'credentialsWritten':![]}};}const workspaceInitDefinition={'service':a204_0x31281a(0x191),'command':a204_0x31281a(0x19d),'description':a204_0x31281a(0x19c),'risk':a204_0x31281a(0x197),'requiresAuth':![],'requiresAppCode':![],'args':[],'flags':workspaceFlags,'validate':validateWorkspaceArgs,'execute':_0x23df61=>configureWorkspace(_0x23df61,a204_0x31281a(0x19d))},workspaceUseDefinition={'service':a204_0x31281a(0x191),'command':a204_0x31281a(0x190),'description':'Switch\x20the\x20current\x20workspace\x20app\x20binding','risk':'write','requiresAuth':![],'requiresAppCode':![],'args':[],'flags':workspaceFlags,'validate':validateWorkspaceArgs,'execute':_0x3fe536=>configureWorkspace(_0x3fe536,a204_0x31281a(0x190))};export const workspaceDefinitions=[workspaceInitDefinition,workspaceUseDefinition,workspaceAddDefinition,workspaceRemoveDefinition];export{WORKSPACE_USAGE};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a205_0x3b46c0=a205_0xaa33;(function(_0x3b31cb,_0x4a204a){const _0x53a7f1=a205_0xaa33,_0x56870b=_0x3b31cb();while(!![]){try{const _0x475536=parseInt(_0x53a7f1(0x1cf))/0x1*(-parseInt(_0x53a7f1(0x1c6))/0x2)+-parseInt(_0x53a7f1(0x1c1))/0x3*(-parseInt(_0x53a7f1(0x1cc))/0x4)+parseInt(_0x53a7f1(0x1cb))/0x5+parseInt(_0x53a7f1(0x1ce))/0x6*(parseInt(_0x53a7f1(0x1c2))/0x7)+parseInt(_0x53a7f1(0x1c4))/0x8+-parseInt(_0x53a7f1(0x1c5))/0x9*(-parseInt(_0x53a7f1(0x1d0))/0xa)+-parseInt(_0x53a7f1(0x1c0))/0xb*(parseInt(_0x53a7f1(0x1ca))/0xc);if(_0x475536===_0x4a204a)break;else _0x56870b['push'](_0x56870b['shift']());}catch(_0xd6fc70){_0x56870b['push'](_0x56870b['shift']());}}}(a205_0x4390,0x98655));function a205_0xaa33(_0x67614d,_0x3e539e){_0x67614d=_0x67614d-0x1c0;const _0x439059=a205_0x4390();let _0xaa33ed=_0x439059[_0x67614d];return _0xaa33ed;}import{buildAppRemoveFlags,runAppRemove,validateAppName}from'../../commands/common/app-registry.js';export const workspaceRemoveDefinition={'service':'workspace','command':a205_0x3b46c0(0x1c3),'description':a205_0x3b46c0(0x1c9),'risk':a205_0x3b46c0(0x1c8),'requiresAuth':![],'requiresAppCode':![],'args':[{'name':a205_0x3b46c0(0x1c7),'description':a205_0x3b46c0(0x1cd),'required':!![]}],'flags':buildAppRemoveFlags(),'validate':_0xd5ea46=>validateAppName(_0xd5ea46,'workspace\x20remove'),'execute':_0x4c4108=>runAppRemove(_0x4c4108,'workspace\x20remove')};function a205_0x4390(){const _0x2f92dc=['11731LWUjcW','10kgErWx','10230286iKootg','61923ldsrRC','189LbFgUz','remove','4305608bSQBjD','3366054tCrRTg','152aPKlGI','name','write','Remove\x20an\x20app\x20profile\x20from\x20the\x20current\x20workspace\x20(or\x20--global)','12vdJbrL','1480760RKzEiP','116AUmUjr','App\x20profile\x20name\x20to\x20remove','141966vAwNtU'];a205_0x4390=function(){return _0x2f92dc;};return a205_0x4390();}
|