@lovrabet/rabetbase-cli 2.3.15-beta.1 → 2.3.15
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/add.js +1 -1
- package/lib/commands/app/index.js +1 -1
- package/lib/commands/app/list.js +1 -1
- package/lib/commands/app/remote-directory.js +1 -1
- package/lib/commands/app/remove.js +1 -1
- package/lib/commands/app/shared.js +1 -1
- package/lib/commands/app-config/delete.js +1 -1
- package/lib/commands/app-config/get.js +1 -1
- package/lib/commands/app-config/index.js +1 -1
- package/lib/commands/app-config/list.js +1 -1
- package/lib/commands/app-config/set.js +1 -1
- package/lib/commands/app-config/shared.js +1 -1
- package/lib/commands/auth/index.js +1 -1
- package/lib/commands/bff/create.js +1 -1
- package/lib/commands/bff/delete.js +1 -1
- package/lib/commands/bff/detail.js +1 -1
- package/lib/commands/bff/index.js +1 -1
- package/lib/commands/bff/list.js +1 -1
- package/lib/commands/bff/pull.js +1 -1
- package/lib/commands/bff/push.js +1 -1
- package/lib/commands/bff/status.js +1 -1
- package/lib/commands/cli-skill/index.js +1 -1
- package/lib/commands/cli-update.js +1 -1
- package/lib/commands/codegen/index.js +1 -1
- package/lib/commands/codegen/sdk.js +1 -1
- package/lib/commands/codegen/sql.js +1 -1
- package/lib/commands/common/app-registry.js +1 -1
- package/lib/commands/common/app-selector.js +1 -1
- package/lib/commands/common/async-task.js +1 -1
- package/lib/commands/common/dry-run.js +1 -1
- package/lib/commands/common/flags.js +1 -1
- package/lib/commands/common/local-file.js +1 -1
- package/lib/commands/common/validate.js +1 -1
- package/lib/commands/config/get.js +1 -1
- package/lib/commands/config/index.js +1 -1
- package/lib/commands/config/list.js +1 -1
- package/lib/commands/config/set.js +1 -1
- package/lib/commands/config/shared.js +1 -1
- package/lib/commands/data/filter.js +1 -1
- package/lib/commands/data/getOne.js +1 -1
- package/lib/commands/data/index.js +1 -1
- package/lib/commands/data/shared.js +1 -1
- package/lib/commands/dataset/business-group-update.js +1 -1
- package/lib/commands/dataset/capability.js +1 -1
- package/lib/commands/dataset/delete.js +1 -1
- package/lib/commands/dataset/detail.js +1 -1
- package/lib/commands/dataset/extend-update.js +1 -1
- package/lib/commands/dataset/field-update.js +1 -1
- package/lib/commands/dataset/generate.js +1 -1
- package/lib/commands/dataset/index.js +1 -1
- package/lib/commands/dataset/list.js +1 -1
- package/lib/commands/dataset/operations.js +1 -1
- package/lib/commands/dataset/relation-audit.js +1 -1
- package/lib/commands/dataset/relation-create.js +1 -1
- package/lib/commands/dataset/relation-delete.js +1 -1
- package/lib/commands/dataset/relation-shared.js +1 -1
- package/lib/commands/dataset/relation-update.js +1 -1
- package/lib/commands/dataset/relations.js +1 -1
- package/lib/commands/dataset/rename.js +1 -1
- package/lib/commands/dataset/restore.js +1 -1
- package/lib/commands/db/analysis-batching.js +1 -1
- package/lib/commands/db/analyze-batch-plan.js +1 -1
- package/lib/commands/db/analyze-cancel.js +1 -1
- package/lib/commands/db/analyze-start.js +1 -1
- package/lib/commands/db/analyze-status.js +1 -1
- package/lib/commands/db/create.js +1 -1
- package/lib/commands/db/delete.js +1 -1
- package/lib/commands/db/detail.js +1 -1
- package/lib/commands/db/diff.js +1 -1
- package/lib/commands/db/index.js +1 -1
- package/lib/commands/db/list.js +1 -1
- package/lib/commands/db/shared.js +1 -1
- package/lib/commands/db/tables.js +1 -1
- package/lib/commands/db/test.js +1 -1
- package/lib/commands/db/update.js +1 -1
- package/lib/commands/doctor.js +1 -1
- package/lib/commands/file/index.js +1 -1
- package/lib/commands/init/index.js +1 -1
- package/lib/commands/issue/index.js +1 -1
- package/lib/commands/issue/nudge.js +1 -1
- package/lib/commands/issue/report.js +1 -1
- package/lib/commands/issue/shared.js +1 -1
- package/lib/commands/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 -0
- package/lib/commands/menu/shared/compare-table.js +1 -1
- package/lib/commands/menu/shared/delete-plan.js +1 -1
- package/lib/commands/menu/shared/facts.js +1 -1
- package/lib/commands/menu/shared/index.js +1 -1
- package/lib/commands/menu/shared/inquirer.js +1 -1
- package/lib/commands/menu/shared/local-pages.js +1 -1
- package/lib/commands/menu/shared/logic.js +1 -1
- package/lib/commands/menu/shared/mutations.js +1 -1
- package/lib/commands/menu/shared/service.js +1 -1
- package/lib/commands/menu/shared/sync-core.js +1 -1
- package/lib/commands/menu/shared/update-core.js +1 -1
- package/lib/commands/menu/shared/valid-url.js +1 -1
- package/lib/commands/menu/sync.js +1 -1
- package/lib/commands/notification/config-list.js +1 -1
- package/lib/commands/notification/index.js +1 -1
- package/lib/commands/ocr/index.js +1 -1
- package/lib/commands/page/generate-start.js +1 -1
- package/lib/commands/page/generate-status.js +1 -1
- package/lib/commands/page/index.js +1 -1
- package/lib/commands/page/pull.js +1 -1
- package/lib/commands/page/push.js +1 -1
- package/lib/commands/page/relation-audit.js +1 -1
- package/lib/commands/page/restore.js +1 -1
- package/lib/commands/page/shared.js +1 -1
- package/lib/commands/page/standard-page-status.js +1 -1
- package/lib/commands/page/sync.js +1 -1
- package/lib/commands/permit/index.js +1 -1
- package/lib/commands/permit/page-get.js +1 -1
- package/lib/commands/permit/page-set.js +1 -1
- package/lib/commands/permit/role-apis-set.js +1 -1
- package/lib/commands/permit/role-menus-set.js +1 -1
- package/lib/commands/permit/role-menus.js +1 -1
- package/lib/commands/permit/shared.js +1 -1
- package/lib/commands/project/create/enhanced-guided-create.js +1 -1
- package/lib/commands/project/create/format-elapsed.js +1 -1
- package/lib/commands/project/create/main.js +1 -1
- package/lib/commands/project/create/non-interactive.js +1 -1
- package/lib/commands/project/create/project-template-path.js +1 -1
- package/lib/commands/project/create/use-copy-project-template.js +1 -1
- package/lib/commands/project/create/use-format-code.js +1 -1
- package/lib/commands/project/create/use-install-dependencies.js +1 -1
- package/lib/commands/project/index.js +1 -1
- package/lib/commands/project/init.js +1 -1
- package/lib/commands/project/upgrade.js +1 -1
- package/lib/commands/registry.js +1 -1
- package/lib/commands/role/create.js +1 -1
- package/lib/commands/role/delete.js +1 -1
- package/lib/commands/role/detail.js +1 -1
- package/lib/commands/role/index.js +1 -1
- package/lib/commands/role/list.js +1 -1
- package/lib/commands/role/shared.js +1 -1
- package/lib/commands/role/update.js +1 -1
- package/lib/commands/role/user-add.js +1 -1
- package/lib/commands/role/user-remove.js +1 -1
- package/lib/commands/role/user-resolve.js +1 -1
- package/lib/commands/run/index.js +1 -1
- package/lib/commands/schema.js +1 -1
- package/lib/commands/sql/create.js +1 -1
- package/lib/commands/sql/delete.js +1 -1
- package/lib/commands/sql/detail.js +1 -1
- package/lib/commands/sql/exec.js +1 -1
- package/lib/commands/sql/index.js +1 -1
- package/lib/commands/sql/list.js +1 -1
- package/lib/commands/sql/pull.js +1 -1
- package/lib/commands/sql/push.js +1 -1
- package/lib/commands/sql/save.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/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.js +1 -1
- package/lib/help.js +1 -1
- package/lib/skills/main.js +1 -1
- package/lib/skills/npx-skills-add.js +1 -1
- package/lib/telemetry/cli-command-trace.js +1 -1
- package/lib/telemetry/cli-help-trace.js +1 -1
- package/lib/telemetry/ensure-cli-otel-config.js +1 -1
- package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
- package/lib/telemetry/send-cli-trace-log.js +1 -1
- package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
- package/lib/utils/ai_config.js +1 -1
- package/lib/utils/apply-jq-filter.js +1 -1
- package/lib/utils/cdn-config.js +1 -1
- package/lib/utils/check-sdk-version.js +1 -1
- package/lib/utils/cli-version-check.js +1 -1
- package/lib/utils/cli-version-policy.js +1 -1
- package/lib/utils/config.js +1 -1
- package/lib/utils/copy-directory.js +1 -1
- package/lib/utils/entity-with-id.js +1 -1
- package/lib/utils/file-utils.js +1 -1
- package/lib/utils/guides-cdn.js +1 -1
- package/lib/utils/http-client.js +1 -1
- package/lib/utils/is-non-interactive.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/params.js +1 -1
- package/lib/utils/platform.js +1 -1
- package/lib/utils/rules-cdn.js +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.js +1 -1
- package/lib/utils/update-notice.js +1 -1
- package/lib/utils/version.js +1 -1
- package/lib/utils/with-active-cookie.js +1 -1
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +1 -1
package/lib/commands/sql/exec.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a173_0x5a1f8b=a173_0x4f20;(function(_0x422aea,_0x4ee3d2){const _0xa102fb=a173_0x4f20,_0x33c1f0=_0x422aea();while(!![]){try{const _0x579957=parseInt(_0xa102fb(0xb9))/0x1*(-parseInt(_0xa102fb(0xba))/0x2)+parseInt(_0xa102fb(0xc4))/0x3*(-parseInt(_0xa102fb(0xbe))/0x4)+parseInt(_0xa102fb(0xb8))/0x5*(-parseInt(_0xa102fb(0xc2))/0x6)+-parseInt(_0xa102fb(0xc0))/0x7+-parseInt(_0xa102fb(0xb1))/0x8*(-parseInt(_0xa102fb(0xc3))/0x9)+parseInt(_0xa102fb(0xab))/0xa*(parseInt(_0xa102fb(0xbb))/0xb)+parseInt(_0xa102fb(0xc1))/0xc;if(_0x579957===_0x4ee3d2)break;else _0x33c1f0['push'](_0x33c1f0['shift']());}catch(_0x4eab4b){_0x33c1f0['push'](_0x33c1f0['shift']());}}}(a173_0x52e1,0xf285a));function a173_0x52e1(){const _0x20f0d9=['\x20row(s)\x20in\x20','read','20yEjzsz','66GaClyl','1230yqWcoz','15689938HensaE','sqlcode','isArray','8JFDoOT','sql','8171079bJgdjT','38519148TAsxvN','2618496DqEjzR','942579iolLOo','1662435cyIoFc','execSuccess','10nErRvF','params','Returned\x20','now','appCode','length','32ytYagR','SQL\x20execution\x20failed','execResult','str','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)'];a173_0x52e1=function(){return _0x20f0d9;};return a173_0x52e1();}import{executeSql}from'../../core/api-client.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';function a173_0x4f20(_0x101056,_0x4a5d71){_0x101056=_0x101056-0xaa;const _0x52e164=a173_0x52e1();let _0x4f209a=_0x52e164[_0x101056];return _0x4f209a;}import{parseJsonParams}from'../../utils/params.js';export const sqlExec={'service':a173_0x5a1f8b(0xbf),'command':'exec','description':'Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','risk':a173_0x5a1f8b(0xb7),'flags':[SQLCODE_FLAG,{'name':a173_0x5a1f8b(0xac),'type':'string','description':a173_0x5a1f8b(0xb5)}],async 'execute'(_0x59aa8b){const _0xb15ab5=a173_0x5a1f8b,_0x1ca466=parseJsonParams(_0x59aa8b[_0xb15ab5(0xb4)](_0xb15ab5(0xac))),_0x496f84=Date['now'](),_0x16ecf4=await executeSql(_0x59aa8b[_0xb15ab5(0xaf)],_0x59aa8b['str'](_0xb15ab5(0xbc)),_0x1ca466),_0x2e68f5=Date[_0xb15ab5(0xae)]()-_0x496f84,_0x533b23=_0x16ecf4?.[_0xb15ab5(0xb3)]??_0x16ecf4,_0x400a6c=_0x16ecf4?.[_0xb15ab5(0xaa)]??!![];if(!_0x400a6c)return{'ok':![],'data':{'error':_0x16ecf4?.['execError']||_0xb15ab5(0xb2),'elapsed':_0x2e68f5},'message':_0xb15ab5(0xb2)};const _0x40ec6f=Array[_0xb15ab5(0xbd)](_0x533b23)?_0x533b23:[];return{'ok':!![],'data':{'rows':_0x40ec6f,'rowCount':_0x40ec6f[_0xb15ab5(0xb0)],'elapsed':_0x2e68f5},'message':_0xb15ab5(0xad)+_0x40ec6f[_0xb15ab5(0xb0)]+_0xb15ab5(0xb6)+_0x2e68f5+'ms'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x3ac828,_0x48f789){const _0x3351ae=a174_0x21b1,_0x915b28=_0x3ac828();while(!![]){try{const _0x5c0eb1=parseInt(_0x3351ae(0x146))/0x1+-parseInt(_0x3351ae(0x13f))/0x2+-parseInt(_0x3351ae(0x145))/0x3+-parseInt(_0x3351ae(0x144))/0x4*(parseInt(_0x3351ae(0x140))/0x5)+parseInt(_0x3351ae(0x148))/0x6+-parseInt(_0x3351ae(0x143))/0x7*(parseInt(_0x3351ae(0x142))/0x8)+-parseInt(_0x3351ae(0x141))/0x9*(-parseInt(_0x3351ae(0x147))/0xa);if(_0x5c0eb1===_0x48f789)break;else _0x915b28['push'](_0x915b28['shift']());}catch(_0x4a3d76){_0x915b28['push'](_0x915b28['shift']());}}}(a174_0x16a2,0x33c62));function a174_0x16a2(){const _0x4e8f2b=['2447670boBgey','209480kKDhrM','5dXNlCW','110961EopedD','17880WloEYe','616yvMTBm','1113788MzNmJe','76158QHKtgm','323071QGYuKW','70LaGNCa'];a174_0x16a2=function(){return _0x4e8f2b;};return a174_0x16a2();}import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';import{sqlSave}from'../../commands/sql/save.js';import{sqlExec}from'../../commands/sql/exec.js';import{sqlPull}from'../../commands/sql/pull.js';import{sqlCreate}from'../../commands/sql/create.js';import{sqlStatus}from'../../commands/sql/status.js';function a174_0x21b1(_0x4ab504,_0xd0467){_0x4ab504=_0x4ab504-0x13f;const _0x16a291=a174_0x16a2();let _0x21b1c1=_0x16a291[_0x4ab504];return _0x21b1c1;}import{sqlPush}from'../../commands/sql/push.js';import{sqlDelete}from'../../commands/sql/delete.js';export const sqlDefinitions=[sqlList,sqlDetail,sqlStatus,sqlCreate,sqlPush,sqlValidate,sqlSave,sqlExec,sqlPull,sqlDelete];
|
package/lib/commands/sql/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a175_0x267e(_0x842fd6,_0x17d860){_0x842fd6=_0x842fd6-0xba;const _0x1c2d92=a175_0x1c2d();let _0x267ec7=_0x1c2d92[_0x842fd6];return _0x267ec7;}const a175_0x3ee43d=a175_0x267e;(function(_0x464a9c,_0x53b475){const _0x460fcd=a175_0x267e,_0x18ec2c=_0x464a9c();while(!![]){try{const _0x4a75e3=-parseInt(_0x460fcd(0xca))/0x1*(parseInt(_0x460fcd(0xcd))/0x2)+-parseInt(_0x460fcd(0xd6))/0x3*(-parseInt(_0x460fcd(0xba))/0x4)+parseInt(_0x460fcd(0xc1))/0x5+-parseInt(_0x460fcd(0xc8))/0x6+-parseInt(_0x460fcd(0xc2))/0x7+parseInt(_0x460fcd(0xc7))/0x8+parseInt(_0x460fcd(0xc0))/0x9;if(_0x4a75e3===_0x53b475)break;else _0x18ec2c['push'](_0x18ec2c['shift']());}catch(_0x3dcece){_0x18ec2c['push'](_0x18ec2c['shift']());}}}(a175_0x1c2d,0x5fb62));import{listSqlQueries}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':'sql','command':a175_0x3ee43d(0xd9),'description':a175_0x3ee43d(0xcb),'risk':'read','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a175_0x3ee43d(0xdb),'type':a175_0x3ee43d(0xd2),'description':'Filter\x20by\x20SQL\x20name'},{'name':a175_0x3ee43d(0xc4),'type':a175_0x3ee43d(0xd0),'description':a175_0x3ee43d(0xce),'default':0x1},{'name':'pagesize','type':'number','description':a175_0x3ee43d(0xc3)},{'name':'verbose','type':'boolean','description':a175_0x3ee43d(0xcf)}],async 'execute'(_0x1387bb){const _0x202fc2=a175_0x3ee43d,_0x28770f=await listSqlQueries(_0x1387bb[_0x202fc2(0xd8)],{'sqlCode':_0x1387bb[_0x202fc2(0xc6)](_0x202fc2(0xd7))||undefined,'sqlName':_0x1387bb[_0x202fc2(0xc6)](_0x202fc2(0xdb))||undefined,'currentPage':_0x1387bb['num'](_0x202fc2(0xc4)),'pageSize':_0x1387bb[_0x202fc2(0xc5)](_0x202fc2(0xc9),0x32)}),_0x2b594c=_0x1387bb[_0x202fc2(0xbd)](_0x202fc2(0xd3)),_0x1c74c4=_0x28770f['tableData']??[],_0x5e5370=_0x28770f[_0x202fc2(0xbc)]?.[_0x202fc2(0xda)]??_0x1c74c4[_0x202fc2(0xdc)];let _0x1dffd7;return _0x2b594c?_0x1dffd7=_0x1c74c4:_0x1dffd7=await Promise[_0x202fc2(0xcc)](_0x1c74c4[_0x202fc2(0xbe)](async _0x3c0e57=>{const _0x3053a8=_0x202fc2;let _0x2eb2c3;try{_0x2eb2c3=_0x3c0e57[_0x3053a8(0xbb)]?await getDbName(_0x1387bb[_0x3053a8(0xd8)],_0x3c0e57[_0x3053a8(0xbb)]):undefined;}catch{}return{'sqlCode':_0x3c0e57[_0x3053a8(0xd5)],'sqlName':_0x3c0e57[_0x3053a8(0xd1)],'description':_0x3c0e57[_0x3053a8(0xbf)]??'','db':_0x2eb2c3?_0x2eb2c3+'\x20('+_0x3c0e57[_0x3053a8(0xbb)]+')':_0x3c0e57[_0x3053a8(0xbb)]??''};})),{'ok':!![],'data':_0x1dffd7,'message':_0x1c74c4[_0x202fc2(0xdc)]===0x0?'No\x20custom\x20SQL\x20queries\x20found.':_0x202fc2(0xd4)+_0x1c74c4[_0x202fc2(0xdc)]+'\x20SQL\x20queries\x20(total:\x20'+_0x5e5370+').'};}};function a175_0x1c2d(){const _0xf807c2=['string','verbose','Found\x20','sqlCode','1701186Mjtmny','sqlcode','appCode','list','totalCount','name','length','4VBFFyH','dbId','paging','bool','map','description','4344336AVZfmx','537170Xejhew','3227245JdUnIg','Page\x20size','page','num','str','3066560aHTkLN','620634Lqvaal','pagesize','2BOfhZU','List\x20custom\x20SQL\x20queries','all','584012kAHIVh','Page\x20number','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','number','sqlName'];a175_0x1c2d=function(){return _0xf807c2;};return a175_0x1c2d();}
|
package/lib/commands/sql/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a175_0x46eef8=a175_0x26d4;(function(_0x5cd3aa,_0x4ebd3f){const _0x3972c1=a175_0x26d4,_0x5ae150=_0x5cd3aa();while(!![]){try{const _0x3f1b99=parseInt(_0x3972c1(0x1ff))/0x1*(parseInt(_0x3972c1(0x1f7))/0x2)+parseInt(_0x3972c1(0x202))/0x3+-parseInt(_0x3972c1(0x223))/0x4*(-parseInt(_0x3972c1(0x1f2))/0x5)+parseInt(_0x3972c1(0x22e))/0x6+-parseInt(_0x3972c1(0x22c))/0x7*(-parseInt(_0x3972c1(0x1fe))/0x8)+parseInt(_0x3972c1(0x227))/0x9+-parseInt(_0x3972c1(0x229))/0xa;if(_0x3f1b99===_0x4ebd3f)break;else _0x5ae150['push'](_0x5ae150['shift']());}catch(_0x3fbd44){_0x5ae150['push'](_0x5ae150['shift']());}}}(a175_0x1003,0x73057));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x10cd9a,_0x29afdd){const _0x9d9b6=a175_0x26d4,_0x193084=[];let _0x7e4b7e=0x1;while(!![]){const _0x49ba29=await listSqlQueries(_0x10cd9a,{'currentPage':_0x7e4b7e,'pageSize':PAGE_SIZE,'sqlCode':_0x29afdd[_0x9d9b6(0x211)],'sqlName':_0x29afdd[_0x9d9b6(0x1f3)]}),_0x5dd0c3=_0x49ba29[_0x9d9b6(0x208)]??[];_0x193084['push'](..._0x5dd0c3);if(_0x5dd0c3[_0x9d9b6(0x1fb)]===0x0)break;const _0x58f967=_0x49ba29[_0x9d9b6(0x224)]?.[_0x9d9b6(0x20d)];if(_0x58f967!=null?_0x193084[_0x9d9b6(0x1fb)]>=_0x58f967:_0x5dd0c3[_0x9d9b6(0x1fb)]<PAGE_SIZE)break;_0x7e4b7e++;}return _0x193084;}async function ensureSqlContent(_0x5ddd91){const _0x2415aa=a175_0x26d4;if(_0x5ddd91[_0x2415aa(0x218)]!=null&&String(_0x5ddd91[_0x2415aa(0x218)])['length']>0x0)return _0x5ddd91;return getSqlQueryDetail(_0x5ddd91['sqlCode']);}export const sqlPull={'service':a175_0x46eef8(0x1f5),'command':'pull','description':a175_0x46eef8(0x22f),'risk':a175_0x46eef8(0x206),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a175_0x46eef8(0x217),'type':a175_0x46eef8(0x222),'description':a175_0x46eef8(0x20b)},{'name':a175_0x46eef8(0x205),'type':a175_0x46eef8(0x21d),'description':'Force\x20overwrite\x20local\x20unsynced\x20changes'}],async 'dryRun'(_0x52a697){const _0xd70f81=a175_0x46eef8,_0x11dc18=loadSqlProjectConfig(_0x52a697[_0xd70f81(0x221)]),_0xeb9830=await readSqlLockFile(_0x11dc18[_0xd70f81(0x200)]),{appLock:_0x4777e0}=ensureSqlLockScope(_0xeb9830??createEmptySqlLock(),_0x11dc18['appCode'],_0x11dc18[_0xd70f81(0x204)],'pull'),_0x13c016=await fetchAllSqlQueries(_0x52a697[_0xd70f81(0x221)],{'sqlCode':_0x52a697[_0xd70f81(0x21e)]('sqlcode')||undefined,'sqlName':_0x52a697[_0xd70f81(0x21e)]('name')||undefined}),_0x27c97e=[];for(const _0x5d8308 of _0x13c016){const _0xba5457=await ensureSqlContent(_0x5d8308),_0x1e41e7=ensureRemoteSqlContent(_0xba5457),_0x3b26ad=detectModeFromSql(_0xba5457),_0x135b62=_0xba5457[_0xd70f81(0x1f8)]?await getDbName(_0x52a697[_0xd70f81(0x221)],Number(_0xba5457[_0xd70f81(0x1f8)]))[_0xd70f81(0x21c)](()=>undefined):undefined,_0x3a5ef8=buildLocalSqlFileContent({'sqlCode':_0xba5457[_0xd70f81(0x211)],'sqlName':_0xba5457[_0xd70f81(0x1f3)],'dbId':_0xba5457['dbId']},_0x1e41e7,{'dbName':_0x135b62,'mode':_0x3b26ad,'syncedAt':new Date()['toISOString'](),'description':_0xba5457['description']}),_0x468ca7=buildSqlLockEntry(_0xba5457,_0x1e41e7,'',{'dbName':_0x135b62}),_0x123de2=resolveLocalSqlFilePath(_0x11dc18,_0xba5457[_0xd70f81(0x211)],_0x468ca7);let _0x573870='would_pull',_0x57446b;if(await fileExists(_0x123de2)){const _0x3435e7=await readFile(_0x123de2,_0xd70f81(0x22b));isEquivalentPulledSqlFile(_0x3435e7,_0x3a5ef8,_0x3b26ad)?(_0x573870=_0xd70f81(0x230),_0x57446b=_0xd70f81(0x1fd)):(_0x573870=_0xd70f81(0x212),_0x57446b=_0xd70f81(0x210));}_0x27c97e[_0xd70f81(0x21b)]({'sqlCode':_0xba5457['sqlCode'],'sqlName':_0xba5457[_0xd70f81(0x1f3)],'filePath':_0x123de2,'status':_0x573870,'reason':_0x57446b});}return{'method':'POST','url':_0xd70f81(0x21f),'body':{'appCode':_0x52a697[_0xd70f81(0x221)],'sqlCode':_0x52a697[_0xd70f81(0x21e)](_0xd70f81(0x20a))||null,'sqlName':_0x52a697[_0xd70f81(0x21e)](_0xd70f81(0x217))||null,'files':_0x27c97e},'description':_0xd70f81(0x1f9)+_0x27c97e[_0xd70f81(0x1fb)]+'\x20SQL\x20file(s)\x20into\x20'+_0x11dc18[_0xd70f81(0x220)]};},async 'execute'(_0x4d2efa){const _0xe3e0e8=a175_0x46eef8,_0x4d08d0=loadSqlProjectConfig(_0x4d2efa[_0xe3e0e8(0x221)]),_0x51afe8=await readSqlLockFile(_0x4d08d0[_0xe3e0e8(0x200)]),{lockData:_0x58f94a,appLock:_0x4a4d5e}=ensureSqlLockScope(_0x51afe8??createEmptySqlLock(),_0x4d08d0[_0xe3e0e8(0x221)],_0x4d08d0[_0xe3e0e8(0x204)],'pull'),_0x19d822=_0x4d2efa[_0xe3e0e8(0x219)](_0xe3e0e8(0x205)),_0x3795bc=await fetchAllSqlQueries(_0x4d2efa[_0xe3e0e8(0x221)],{'sqlCode':_0x4d2efa[_0xe3e0e8(0x21e)](_0xe3e0e8(0x20a))||undefined,'sqlName':_0x4d2efa[_0xe3e0e8(0x21e)]('name')||undefined});if(_0x3795bc[_0xe3e0e8(0x1fb)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0xe3e0e8(0x226)};const _0x254f49=[],_0x34ae4a=[];for(const _0x59d323 of _0x3795bc){try{_0x254f49['push'](await ensureSqlContent(_0x59d323));}catch(_0x18a886){_0x34ae4a[_0xe3e0e8(0x21b)]({'sqlCode':_0x59d323['sqlCode'],'error':_0x18a886 instanceof Error?_0x18a886[_0xe3e0e8(0x213)]:String(_0x18a886)});}}if(_0x19d822&&!_0x4d2efa[_0xe3e0e8(0x20e)]){let _0x233abf=![];for(const _0x25e9b3 of _0x254f49){const _0x1c853e=detectModeFromSql(_0x25e9b3),_0x23ccc8=_0x25e9b3[_0xe3e0e8(0x1f8)]?await getDbName(_0x4d2efa['appCode'],Number(_0x25e9b3[_0xe3e0e8(0x1f8)]))[_0xe3e0e8(0x21c)](()=>undefined):undefined,_0x4084d5=buildLocalSqlFileContent({'sqlCode':_0x25e9b3[_0xe3e0e8(0x211)],'sqlName':_0x25e9b3[_0xe3e0e8(0x1f3)],'dbId':_0x25e9b3[_0xe3e0e8(0x1f8)]},ensureRemoteSqlContent(_0x25e9b3),{'dbName':_0x23ccc8,'mode':_0x1c853e,'syncedAt':new Date()['toISOString'](),'description':_0x25e9b3['description']}),_0x56c7c5=resolveLocalSqlFilePath(_0x4d08d0,_0x25e9b3['sqlCode'],buildSqlLockEntry(_0x25e9b3,ensureRemoteSqlContent(_0x25e9b3),'',{'dbName':_0x23ccc8}));if(await fileExists(_0x56c7c5)){const _0x2969c9=await readFile(_0x56c7c5,_0xe3e0e8(0x22b));if(!isEquivalentPulledSqlFile(_0x2969c9,_0x4084d5,_0x1c853e)){_0x233abf=!![];break;}}}if(_0x233abf){const _0x72ed3e=await confirmForceOverwrite(_0xe3e0e8(0x20f));if(!_0x72ed3e)throw CliErrors['cancelled'](_0xe3e0e8(0x214));}}const _0x49e663=cloneSqlLockData(_0x58f94a),_0x533b36=_0x49e663[_0xe3e0e8(0x22a)][_0x4d08d0[_0xe3e0e8(0x221)]],_0x871cb1=[],_0x4f506f=[];for(const _0x2d467a of _0x254f49){const _0xc8f1e4=_0x533b36[_0xe3e0e8(0x1fc)][_0x2d467a[_0xe3e0e8(0x211)]],_0x35a0e5=ensureRemoteSqlContent(_0x2d467a),_0x4b0970=detectModeFromSql(_0x2d467a),_0x50ffb8=_0x2d467a[_0xe3e0e8(0x1f8)]?await getDbName(_0x4d2efa[_0xe3e0e8(0x221)],Number(_0x2d467a[_0xe3e0e8(0x1f8)]))[_0xe3e0e8(0x21c)](()=>undefined):undefined,_0x5b95ac=buildLocalSqlFileContent({'sqlCode':_0x2d467a[_0xe3e0e8(0x211)],'sqlName':_0x2d467a['sqlName'],'dbId':_0x2d467a[_0xe3e0e8(0x1f8)]},_0x35a0e5,{'dbName':_0x50ffb8,'mode':_0x4b0970,'syncedAt':new Date()[_0xe3e0e8(0x1f4)](),'description':_0x2d467a[_0xe3e0e8(0x22d)]}),_0x557e12=buildSqlLockEntry(_0x2d467a,_0x35a0e5,computeSqlContentHash(_0x5b95ac),{'dbName':_0x50ffb8}),_0x477a2f=_0x557e12[_0xe3e0e8(0x21a)],_0x1d633e=join(_0x4d08d0[_0xe3e0e8(0x220)],_0x477a2f);try{if(await fileExists(_0x1d633e)){const _0x28827a=await readFile(_0x1d633e,_0xe3e0e8(0x22b));if(isEquivalentPulledSqlFile(_0x28827a,_0x5b95ac,_0x4b0970)){_0x4f506f[_0xe3e0e8(0x21b)]({'sqlCode':_0x2d467a['sqlCode'],'reason':'unchanged'}),_0x533b36[_0xe3e0e8(0x1fc)][_0x2d467a['sqlCode']]={..._0x557e12,'hash':computeSqlContentHash(_0x28827a),'path':_0x477a2f};continue;}if(!_0x19d822){_0x4f506f[_0xe3e0e8(0x21b)]({'sqlCode':_0x2d467a['sqlCode'],'reason':_0xe3e0e8(0x228)});continue;}}const _0x10741f=_0xc8f1e4?.[_0xe3e0e8(0x21a)]?join(_0x4d08d0[_0xe3e0e8(0x220)],_0xc8f1e4[_0xe3e0e8(0x21a)]):undefined;_0x10741f&&_0x10741f!==_0x1d633e&&await fileExists(_0x10741f)&&await rm(_0x10741f,{'force':!![]}),await ensureParentDirectory(_0x1d633e),await writeFile(_0x1d633e,_0x5b95ac,'utf8'),_0x533b36[_0xe3e0e8(0x1fc)][_0x2d467a[_0xe3e0e8(0x211)]]={..._0x557e12,'path':_0x477a2f},_0x871cb1[_0xe3e0e8(0x21b)]({'sqlCode':_0x2d467a[_0xe3e0e8(0x211)],'filePath':_0x1d633e});}catch(_0x264350){_0x34ae4a['push']({'sqlCode':_0x2d467a[_0xe3e0e8(0x211)],'error':_0x264350 instanceof Error?_0x264350[_0xe3e0e8(0x213)]:String(_0x264350)});}}return _0x533b36[_0xe3e0e8(0x1f6)]=new Date()['toISOString'](),await writeSqlLockFile(_0x4d08d0['lockFilePath'],_0x49e663),{'ok':_0x34ae4a[_0xe3e0e8(0x1fb)]===0x0,'data':{'pulled':_0x871cb1,'skipped':_0x4f506f,'failed':_0x34ae4a},'message':_0xe3e0e8(0x207)+_0x871cb1[_0xe3e0e8(0x1fb)]+'\x20written,\x20'+_0x4f506f[_0xe3e0e8(0x1fb)]+_0xe3e0e8(0x203)+_0x34ae4a[_0xe3e0e8(0x1fb)]+_0xe3e0e8(0x225)};}};function a175_0x1003(){const _0x34f150=['\x20skipped,\x20','sqlRoot','force','write','Pull\x20complete:\x20','tableData','replace','sqlcode','Filter\x20by\x20SQL\x20display\x20name','mybatisXml','totalCount','nonInteractive','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','sqlCode','conflict','message','Force\x20pull\x20cancelled.','trimStart','split','name','sqlContent','bool','path','push','catch','boolean','str','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','sqlRootDir','appCode','string','28leFZUW','paging','\x20failed','No\x20remote\x20SQL\x20queries\x20matched.','791127wyLXUs','local\x20differs\x20from\x20remote','23513940bljjXB','apps','utf8','7qntdlA','description','5501316OmBqca','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','skipped','425775cedYri','sqlName','toISOString','sql','lastSync','424898bGTuga','dbId','Would\x20pull\x20','test','length','sqls','unchanged','5632072saHHOy','1HiQkuB','lockFilePath','join','915567zmXHPG'];a175_0x1003=function(){return _0x34f150;};return a175_0x1003();}function detectModeFromSql(_0x34dc18){const _0x35fc22=a175_0x46eef8,_0x5b941b=ensureRemoteSqlContent(_0x34dc18),_0x352373=stripLocalSqlMetadata(_0x5b941b,_0x35fc22(0x20c))[_0x35fc22(0x215)]();if(/^<(select|insert|update|delete)\b/i['test'](_0x352373))return _0x35fc22(0x20c);return _0x35fc22(0x1f5);}function isEquivalentPulledSqlFile(_0x1e5186,_0x26f45f,_0x4f3c6b){return normalizePullComparableContent(_0x1e5186,_0x4f3c6b)===normalizePullComparableContent(_0x26f45f,_0x4f3c6b);}function a175_0x26d4(_0x1fbf0e,_0x3a2dd8){_0x1fbf0e=_0x1fbf0e-0x1f2;const _0x10035b=a175_0x1003();let _0x26d45a=_0x10035b[_0x1fbf0e];return _0x26d45a;}function normalizePullComparableContent(_0x35bcc,_0x4aeace){const _0x2c86cd=a175_0x46eef8,_0xcf6b78=_0x35bcc[_0x2c86cd(0x209)](/\r\n/g,'\x0a')[_0x2c86cd(0x216)]('\x0a'),_0x2375d8=_0xcf6b78['filter'](_0x1544ac=>!isSyncedAtMetadataLine(_0x1544ac,_0x4aeace));return _0x2375d8[_0x2c86cd(0x201)]('\x0a');}function isSyncedAtMetadataLine(_0xd5664f,_0x13b6c2){const _0x2ad93e=a175_0x46eef8;if(_0x13b6c2===_0x2ad93e(0x20c))return/^\s*<!--\s*@lovrabet\.syncedAt:/['test'](_0xd5664f);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x2ad93e(0x1fa)](_0xd5664f);}
|
|
1
|
+
const a176_0x3c2e27=a176_0x4f17;(function(_0x5ef697,_0x413325){const _0x32f187=a176_0x4f17,_0x13c3bc=_0x5ef697();while(!![]){try{const _0x3c3db8=parseInt(_0x32f187(0x19c))/0x1+parseInt(_0x32f187(0x1a8))/0x2*(-parseInt(_0x32f187(0x1b3))/0x3)+parseInt(_0x32f187(0x1aa))/0x4*(-parseInt(_0x32f187(0x18e))/0x5)+parseInt(_0x32f187(0x188))/0x6+parseInt(_0x32f187(0x1ae))/0x7+parseInt(_0x32f187(0x191))/0x8+-parseInt(_0x32f187(0x185))/0x9*(parseInt(_0x32f187(0x1a0))/0xa);if(_0x3c3db8===_0x413325)break;else _0x13c3bc['push'](_0x13c3bc['shift']());}catch(_0x5ef0ff){_0x13c3bc['push'](_0x13c3bc['shift']());}}}(a176_0x4333,0x1a693));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';function a176_0x4f17(_0x499b18,_0x338b16){_0x499b18=_0x499b18-0x181;const _0x43337d=a176_0x4333();let _0x4f178a=_0x43337d[_0x499b18];return _0x4f178a;}import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';function a176_0x4333(){const _0x514bab=['string','887936WmHgMy','mybatisXml','description','name','message','force','test','dbId','trimStart','\x20SQL\x20file(s)\x20into\x20','totalCount','8897ADoNgt','No\x20remote\x20SQL\x20queries\x20matched.','pull','write','458580VBgEAV','conflict','utf8','appCode','sqls','local\x20differs\x20from\x20remote','sqlName','unchanged','25094uSmxnh','Would\x20pull\x20','108952ZkAXSx','str','catch','toISOString','1444114NzYZaj','bool','\x20written,\x20','sql','Force\x20pull\x20cancelled.','33LHcyQd','nonInteractive','filter','sqlContent','tableData','Pull\x20complete:\x20','sqlRoot','join','sqlRootDir','push','Force\x20overwrite\x20local\x20unsynced\x20changes','Filter\x20by\x20SQL\x20display\x20name','\x20skipped,\x20','lockFilePath','POST','18sehsBk','paging','length','560610CphRtE','sqlCode','sqlcode','boolean','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','15xmdnYX','path'];a176_0x4333=function(){return _0x514bab;};return a176_0x4333();}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(_0x335447,_0x436c7b){const _0x4a8c44=a176_0x4f17,_0x26f264=[];let _0x4a6d1c=0x1;while(!![]){const _0x2e01b4=await listSqlQueries(_0x335447,{'currentPage':_0x4a6d1c,'pageSize':PAGE_SIZE,'sqlCode':_0x436c7b[_0x4a8c44(0x189)],'sqlName':_0x436c7b[_0x4a8c44(0x1a6)]}),_0x38d7fc=_0x2e01b4[_0x4a8c44(0x1b7)]??[];_0x26f264[_0x4a8c44(0x1bc)](..._0x38d7fc);if(_0x38d7fc[_0x4a8c44(0x187)]===0x0)break;const _0x5e7da6=_0x2e01b4[_0x4a8c44(0x186)]?.[_0x4a8c44(0x19b)];if(_0x5e7da6!=null?_0x26f264['length']>=_0x5e7da6:_0x38d7fc[_0x4a8c44(0x187)]<PAGE_SIZE)break;_0x4a6d1c++;}return _0x26f264;}async function ensureSqlContent(_0x460ab8){const _0x281c02=a176_0x4f17;if(_0x460ab8[_0x281c02(0x1b6)]!=null&&String(_0x460ab8['sqlContent'])[_0x281c02(0x187)]>0x0)return _0x460ab8;return getSqlQueryDetail(_0x460ab8[_0x281c02(0x189)]);}export const sqlPull={'service':a176_0x3c2e27(0x1b1),'command':a176_0x3c2e27(0x19e),'description':'Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','risk':a176_0x3c2e27(0x19f),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a176_0x3c2e27(0x194),'type':a176_0x3c2e27(0x190),'description':a176_0x3c2e27(0x181)},{'name':a176_0x3c2e27(0x196),'type':a176_0x3c2e27(0x18b),'description':a176_0x3c2e27(0x1bd)}],async 'dryRun'(_0x45b08a){const _0x1c11c1=a176_0x3c2e27,_0x44a286=loadSqlProjectConfig(_0x45b08a[_0x1c11c1(0x1a3)]),_0x18ab45=await readSqlLockFile(_0x44a286[_0x1c11c1(0x183)]),{appLock:_0x274e2a}=ensureSqlLockScope(_0x18ab45??createEmptySqlLock(),_0x44a286['appCode'],_0x44a286['sqlRoot'],_0x1c11c1(0x19e)),_0x260082=await fetchAllSqlQueries(_0x45b08a[_0x1c11c1(0x1a3)],{'sqlCode':_0x45b08a['str'](_0x1c11c1(0x18a))||undefined,'sqlName':_0x45b08a['str'](_0x1c11c1(0x194))||undefined}),_0x114881=[];for(const _0x221e42 of _0x260082){const _0x1d25ab=await ensureSqlContent(_0x221e42),_0x431128=ensureRemoteSqlContent(_0x1d25ab),_0x74a5c5=detectModeFromSql(_0x1d25ab),_0x51c757=_0x1d25ab[_0x1c11c1(0x198)]?await getDbName(_0x45b08a[_0x1c11c1(0x1a3)],Number(_0x1d25ab[_0x1c11c1(0x198)]))[_0x1c11c1(0x1ac)](()=>undefined):undefined,_0x3f5546=buildLocalSqlFileContent({'sqlCode':_0x1d25ab[_0x1c11c1(0x189)],'sqlName':_0x1d25ab[_0x1c11c1(0x1a6)],'dbId':_0x1d25ab[_0x1c11c1(0x198)]},_0x431128,{'dbName':_0x51c757,'mode':_0x74a5c5,'syncedAt':new Date()[_0x1c11c1(0x1ad)](),'description':_0x1d25ab[_0x1c11c1(0x193)]}),_0x55ab45=buildSqlLockEntry(_0x1d25ab,_0x431128,'',{'dbName':_0x51c757}),_0x2c78e8=resolveLocalSqlFilePath(_0x44a286,_0x1d25ab['sqlCode'],_0x55ab45);let _0x35d6ba='would_pull',_0x489a52;if(await fileExists(_0x2c78e8)){const _0x4c28ae=await readFile(_0x2c78e8,_0x1c11c1(0x1a2));isEquivalentPulledSqlFile(_0x4c28ae,_0x3f5546,_0x74a5c5)?(_0x35d6ba='skipped',_0x489a52='unchanged'):(_0x35d6ba=_0x1c11c1(0x1a1),_0x489a52=_0x1c11c1(0x18d));}_0x114881[_0x1c11c1(0x1bc)]({'sqlCode':_0x1d25ab[_0x1c11c1(0x189)],'sqlName':_0x1d25ab[_0x1c11c1(0x1a6)],'filePath':_0x2c78e8,'status':_0x35d6ba,'reason':_0x489a52});}return{'method':_0x1c11c1(0x184),'url':'/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','body':{'appCode':_0x45b08a[_0x1c11c1(0x1a3)],'sqlCode':_0x45b08a[_0x1c11c1(0x1ab)](_0x1c11c1(0x18a))||null,'sqlName':_0x45b08a[_0x1c11c1(0x1ab)](_0x1c11c1(0x194))||null,'files':_0x114881},'description':_0x1c11c1(0x1a9)+_0x114881[_0x1c11c1(0x187)]+_0x1c11c1(0x19a)+_0x44a286[_0x1c11c1(0x1bb)]};},async 'execute'(_0x1dc846){const _0x3ffb8f=a176_0x3c2e27,_0x382162=loadSqlProjectConfig(_0x1dc846[_0x3ffb8f(0x1a3)]),_0x23ae56=await readSqlLockFile(_0x382162[_0x3ffb8f(0x183)]),{lockData:_0x522dc5,appLock:_0x170303}=ensureSqlLockScope(_0x23ae56??createEmptySqlLock(),_0x382162[_0x3ffb8f(0x1a3)],_0x382162[_0x3ffb8f(0x1b9)],_0x3ffb8f(0x19e)),_0xdef228=_0x1dc846[_0x3ffb8f(0x1af)]('force'),_0x906e22=await fetchAllSqlQueries(_0x1dc846[_0x3ffb8f(0x1a3)],{'sqlCode':_0x1dc846[_0x3ffb8f(0x1ab)]('sqlcode')||undefined,'sqlName':_0x1dc846[_0x3ffb8f(0x1ab)](_0x3ffb8f(0x194))||undefined});if(_0x906e22[_0x3ffb8f(0x187)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x3ffb8f(0x19d)};const _0x5ae3ae=[],_0x2eefd4=[];for(const _0x398937 of _0x906e22){try{_0x5ae3ae['push'](await ensureSqlContent(_0x398937));}catch(_0x4f8886){_0x2eefd4['push']({'sqlCode':_0x398937[_0x3ffb8f(0x189)],'error':_0x4f8886 instanceof Error?_0x4f8886['message']:String(_0x4f8886)});}}if(_0xdef228&&!_0x1dc846[_0x3ffb8f(0x1b4)]){let _0x1e270d=![];for(const _0xd97b54 of _0x5ae3ae){const _0x39c9fe=detectModeFromSql(_0xd97b54),_0x131611=_0xd97b54[_0x3ffb8f(0x198)]?await getDbName(_0x1dc846[_0x3ffb8f(0x1a3)],Number(_0xd97b54[_0x3ffb8f(0x198)]))['catch'](()=>undefined):undefined,_0x27f136=buildLocalSqlFileContent({'sqlCode':_0xd97b54[_0x3ffb8f(0x189)],'sqlName':_0xd97b54[_0x3ffb8f(0x1a6)],'dbId':_0xd97b54['dbId']},ensureRemoteSqlContent(_0xd97b54),{'dbName':_0x131611,'mode':_0x39c9fe,'syncedAt':new Date()[_0x3ffb8f(0x1ad)](),'description':_0xd97b54[_0x3ffb8f(0x193)]}),_0x2a9ab3=resolveLocalSqlFilePath(_0x382162,_0xd97b54[_0x3ffb8f(0x189)],buildSqlLockEntry(_0xd97b54,ensureRemoteSqlContent(_0xd97b54),'',{'dbName':_0x131611}));if(await fileExists(_0x2a9ab3)){const _0x30f988=await readFile(_0x2a9ab3,_0x3ffb8f(0x1a2));if(!isEquivalentPulledSqlFile(_0x30f988,_0x27f136,_0x39c9fe)){_0x1e270d=!![];break;}}}if(_0x1e270d){const _0x7b07cc=await confirmForceOverwrite(_0x3ffb8f(0x18c));if(!_0x7b07cc)throw CliErrors['cancelled'](_0x3ffb8f(0x1b2));}}const _0x5dd235=cloneSqlLockData(_0x522dc5),_0x1874ab=_0x5dd235['apps'][_0x382162[_0x3ffb8f(0x1a3)]],_0x596075=[],_0x5a0568=[];for(const _0x3ec058 of _0x5ae3ae){const _0x52d333=_0x1874ab['sqls'][_0x3ec058[_0x3ffb8f(0x189)]],_0x4f3292=ensureRemoteSqlContent(_0x3ec058),_0x50f1d5=detectModeFromSql(_0x3ec058),_0x169b81=_0x3ec058[_0x3ffb8f(0x198)]?await getDbName(_0x1dc846[_0x3ffb8f(0x1a3)],Number(_0x3ec058[_0x3ffb8f(0x198)]))[_0x3ffb8f(0x1ac)](()=>undefined):undefined,_0x589d99=buildLocalSqlFileContent({'sqlCode':_0x3ec058['sqlCode'],'sqlName':_0x3ec058['sqlName'],'dbId':_0x3ec058['dbId']},_0x4f3292,{'dbName':_0x169b81,'mode':_0x50f1d5,'syncedAt':new Date()[_0x3ffb8f(0x1ad)](),'description':_0x3ec058['description']}),_0xcc9ee9=buildSqlLockEntry(_0x3ec058,_0x4f3292,computeSqlContentHash(_0x589d99),{'dbName':_0x169b81}),_0x15efdf=_0xcc9ee9[_0x3ffb8f(0x18f)],_0x35b4ed=join(_0x382162[_0x3ffb8f(0x1bb)],_0x15efdf);try{if(await fileExists(_0x35b4ed)){const _0x279f33=await readFile(_0x35b4ed,_0x3ffb8f(0x1a2));if(isEquivalentPulledSqlFile(_0x279f33,_0x589d99,_0x50f1d5)){_0x5a0568[_0x3ffb8f(0x1bc)]({'sqlCode':_0x3ec058[_0x3ffb8f(0x189)],'reason':_0x3ffb8f(0x1a7)}),_0x1874ab[_0x3ffb8f(0x1a4)][_0x3ec058['sqlCode']]={..._0xcc9ee9,'hash':computeSqlContentHash(_0x279f33),'path':_0x15efdf};continue;}if(!_0xdef228){_0x5a0568[_0x3ffb8f(0x1bc)]({'sqlCode':_0x3ec058[_0x3ffb8f(0x189)],'reason':_0x3ffb8f(0x1a5)});continue;}}const _0x21aa0e=_0x52d333?.[_0x3ffb8f(0x18f)]?join(_0x382162['sqlRootDir'],_0x52d333[_0x3ffb8f(0x18f)]):undefined;_0x21aa0e&&_0x21aa0e!==_0x35b4ed&&await fileExists(_0x21aa0e)&&await rm(_0x21aa0e,{'force':!![]}),await ensureParentDirectory(_0x35b4ed),await writeFile(_0x35b4ed,_0x589d99,_0x3ffb8f(0x1a2)),_0x1874ab['sqls'][_0x3ec058['sqlCode']]={..._0xcc9ee9,'path':_0x15efdf},_0x596075[_0x3ffb8f(0x1bc)]({'sqlCode':_0x3ec058[_0x3ffb8f(0x189)],'filePath':_0x35b4ed});}catch(_0x21855a){_0x2eefd4['push']({'sqlCode':_0x3ec058[_0x3ffb8f(0x189)],'error':_0x21855a instanceof Error?_0x21855a[_0x3ffb8f(0x195)]:String(_0x21855a)});}}return _0x1874ab['lastSync']=new Date()['toISOString'](),await writeSqlLockFile(_0x382162[_0x3ffb8f(0x183)],_0x5dd235),{'ok':_0x2eefd4[_0x3ffb8f(0x187)]===0x0,'data':{'pulled':_0x596075,'skipped':_0x5a0568,'failed':_0x2eefd4},'message':_0x3ffb8f(0x1b8)+_0x596075['length']+_0x3ffb8f(0x1b0)+_0x5a0568[_0x3ffb8f(0x187)]+_0x3ffb8f(0x182)+_0x2eefd4[_0x3ffb8f(0x187)]+'\x20failed'};}};function detectModeFromSql(_0xaee7fd){const _0xf0038e=a176_0x3c2e27,_0x5636c5=ensureRemoteSqlContent(_0xaee7fd),_0xd11f52=stripLocalSqlMetadata(_0x5636c5,_0xf0038e(0x192))[_0xf0038e(0x199)]();if(/^<(select|insert|update|delete)\b/i[_0xf0038e(0x197)](_0xd11f52))return _0xf0038e(0x192);return _0xf0038e(0x1b1);}function isEquivalentPulledSqlFile(_0x200024,_0x19f7e8,_0x7e08c7){return normalizePullComparableContent(_0x200024,_0x7e08c7)===normalizePullComparableContent(_0x19f7e8,_0x7e08c7);}function normalizePullComparableContent(_0x4ed8f7,_0x1136d1){const _0xe715b3=a176_0x3c2e27,_0x3fa5da=_0x4ed8f7['replace'](/\r\n/g,'\x0a')['split']('\x0a'),_0x3a3a1b=_0x3fa5da[_0xe715b3(0x1b5)](_0x166797=>!isSyncedAtMetadataLine(_0x166797,_0x1136d1));return _0x3a3a1b[_0xe715b3(0x1ba)]('\x0a');}function isSyncedAtMetadataLine(_0x3f5600,_0xbce9f6){const _0x29fc97=a176_0x3c2e27;if(_0xbce9f6===_0x29fc97(0x192))return/^\s*<!--\s*@lovrabet\.syncedAt:/['test'](_0x3f5600);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x29fc97(0x197)](_0x3f5600);}
|
package/lib/commands/sql/push.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a176_0x34404f=a176_0x4f09;(function(_0x4d41f7,_0x1cc348){const _0x532d39=a176_0x4f09,_0x10dca0=_0x4d41f7();while(!![]){try{const _0x4acc7a=parseInt(_0x532d39(0x14f))/0x1+-parseInt(_0x532d39(0x164))/0x2*(parseInt(_0x532d39(0x157))/0x3)+-parseInt(_0x532d39(0x148))/0x4*(-parseInt(_0x532d39(0x147))/0x5)+parseInt(_0x532d39(0x183))/0x6+parseInt(_0x532d39(0x149))/0x7+parseInt(_0x532d39(0x175))/0x8*(-parseInt(_0x532d39(0x185))/0x9)+-parseInt(_0x532d39(0x182))/0xa*(parseInt(_0x532d39(0x16a))/0xb);if(_0x4acc7a===_0x1cc348)break;else _0x10dca0['push'](_0x10dca0['shift']());}catch(_0x217247){_0x10dca0['push'](_0x10dca0['shift']());}}}(a176_0x3fd7,0x3e2a6));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';import{CliErrors}from'../../errors.js';function a176_0x4f09(_0x4e020c,_0x1e7c02){_0x4e020c=_0x4e020c-0x144;const _0x3fd78d=a176_0x3fd7();let _0x4f097e=_0x3fd78d[_0x4e020c];return _0x4f097e;}import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';function a176_0x3fd7(){const _0x49ee4d=['61587TPOQpr','sqlRoot','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','remoteId','85YIonLl','11932znpadW','636692BnHNZa','isFinite','lockFilePath','No\x20local\x20SQL\x20files\x20found.','filePath','sqlcode','246854jqImYj','mode','trashDir','dbId','\x20SQL\x20file(s)','Would\x20push\x20','push','relativePath','6VRbtUh','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','sqls','boolean','bool','exec','validation','Push\x20complete:\x20','force','set','path','sql','unchanged','143508rTYZWE','appCode','dbName','str','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','Push\x20local\x20SQL\x20files\x20to\x20remote','361680PHkJJT','hash','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','version','sqlConfig','utf8','has','join','sqlRootDir','sqlName','startsWith','496LNxTpQ','lastSync','filter','entries','/smartapi/custom/updateUserCustomSql','Local\x20directory\x20\x22','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','catch','message','sqlCode','replace','length','map','10lzafWt','2800578whiLvG','\x20skipped,\x20'];a176_0x3fd7=function(){return _0x49ee4d;};return a176_0x3fd7();}import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';async function getTargetSqlQueries(_0x4a36df,_0x34f4aa,_0x48f674){const _0x49b234=a176_0x4f09,_0x37af29=await scanLocalSqlQueries(_0x4a36df),_0x46bac6=new Map();for(const _0x51a043 of _0x37af29){if(_0x48f674&&_0x51a043['sqlCode']!==_0x48f674)continue;const _0x4fa177=_0x46bac6['get'](_0x51a043['sqlCode'])??[];_0x4fa177[_0x49b234(0x155)](_0x51a043),_0x46bac6[_0x49b234(0x160)](_0x51a043['sqlCode'],_0x4fa177);}if(_0x48f674&&!_0x46bac6[_0x49b234(0x170)](_0x48f674))throw CliErrors[_0x49b234(0x15d)]('Local\x20SQL\x20not\x20found:\x20'+_0x48f674);const _0x29b96f=[];for(const [_0x46c1d6,_0x8827af]of _0x46bac6[_0x49b234(0x178)]()){if(_0x8827af[_0x49b234(0x180)]===0x1){_0x29b96f['push'](_0x8827af[0x0]);continue;}const _0x1faa4a=_0x34f4aa[_0x49b234(0x159)][_0x46c1d6],_0x7ab372=_0x1faa4a?.[_0x49b234(0x161)],_0x18e426=_0x7ab372?_0x8827af[_0x49b234(0x177)](_0x403ac4=>_0x403ac4[_0x49b234(0x156)]!==_0x7ab372):_0x8827af;if(_0x1faa4a&&_0x18e426[_0x49b234(0x180)]===0x1){_0x29b96f[_0x49b234(0x155)](_0x18e426[0x0]);continue;}throw CliErrors[_0x49b234(0x15d)](_0x49b234(0x168)+_0x46c1d6+'.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.');}return _0x29b96f;}export const sqlPush={'service':a176_0x34404f(0x162),'command':a176_0x34404f(0x155),'description':a176_0x34404f(0x169),'risk':'high-risk-write','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a176_0x34404f(0x15f),'type':a176_0x34404f(0x15a),'description':a176_0x34404f(0x158)}],async 'dryRun'(_0x5842b0){const _0x3cde6d=a176_0x34404f,_0x9f56a3=loadSqlProjectConfig(_0x5842b0[_0x3cde6d(0x165)]),_0x3b4283=await readSqlLockFile(_0x9f56a3['lockFilePath']),{appLock:_0x146c8a}=ensureSqlLockScope(_0x3b4283??createEmptySqlLock(),_0x5842b0['appCode'],_0x9f56a3[_0x3cde6d(0x144)],_0x3cde6d(0x155)),_0x1d6126=await getTargetSqlQueries(_0x9f56a3,_0x146c8a,_0x5842b0[_0x3cde6d(0x167)]('sqlcode')||undefined),_0x596054=[];for(const _0xb76020 of _0x1d6126){const _0x562513=await computeSqlFileHash(_0xb76020[_0x3cde6d(0x14d)]),_0x51e937=_0x146c8a[_0x3cde6d(0x159)][_0xb76020[_0x3cde6d(0x17e)]],_0x1f81fd=!!_0x51e937&&(_0x51e937[_0x3cde6d(0x161)]!==_0xb76020[_0x3cde6d(0x156)]||!!_0xb76020[_0x3cde6d(0x173)]&&_0x51e937[_0x3cde6d(0x173)]!==_0xb76020[_0x3cde6d(0x173)]);if(!_0x5842b0[_0x3cde6d(0x15b)](_0x3cde6d(0x15f))&&_0x51e937&&_0x51e937['hash']===_0x562513&&!_0x1f81fd)continue;_0x596054['push'](_0xb76020[_0x3cde6d(0x17e)]);}return{'method':'POST','url':_0x3cde6d(0x179),'body':{'sqlCodes':_0x596054,'appCode':_0x5842b0[_0x3cde6d(0x165)]},'description':_0x3cde6d(0x154)+_0x596054['length']+_0x3cde6d(0x153)};},async 'execute'(_0x5d9c72){const _0x3fcf13=a176_0x34404f,_0xda5cc8=loadSqlProjectConfig(_0x5d9c72[_0x3fcf13(0x165)]),_0x472b71=await readSqlLockFile(_0xda5cc8['lockFilePath']),{lockData:_0x59f037,appLock:_0x10ced8}=ensureSqlLockScope(_0x472b71??createEmptySqlLock(),_0x5d9c72[_0x3fcf13(0x165)],_0xda5cc8['sqlRoot'],_0x3fcf13(0x155)),_0x15edba=await getTargetSqlQueries(_0xda5cc8,_0x10ced8,_0x5d9c72[_0x3fcf13(0x167)](_0x3fcf13(0x14e))||undefined);if(_0x15edba[_0x3fcf13(0x180)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x3fcf13(0x14c)};const _0x54eb35=[],_0x1738be=[],_0x185005=[];for(const _0x496e3c of _0x15edba){const _0x4911fb=_0x10ced8[_0x3fcf13(0x159)][_0x496e3c[_0x3fcf13(0x17e)]];if(!_0x4911fb){_0x185005[_0x3fcf13(0x155)]({'sqlCode':_0x496e3c[_0x3fcf13(0x17e)],'error':_0x3fcf13(0x145)});continue;}try{const _0x536e4b=await computeSqlFileHash(_0x496e3c[_0x3fcf13(0x14d)]),_0x337054=_0x4911fb['path']!==_0x496e3c[_0x3fcf13(0x156)]||!!_0x496e3c[_0x3fcf13(0x173)]&&_0x4911fb[_0x3fcf13(0x173)]!==_0x496e3c[_0x3fcf13(0x173)];if(!_0x5d9c72[_0x3fcf13(0x15b)](_0x3fcf13(0x15f))&&_0x4911fb[_0x3fcf13(0x16b)]===_0x536e4b&&!_0x337054){_0x1738be[_0x3fcf13(0x155)]({'sqlCode':_0x496e3c[_0x3fcf13(0x17e)],'reason':_0x3fcf13(0x163)});continue;}if(_0x4911fb['version']==null){_0x185005[_0x3fcf13(0x155)]({'sqlCode':_0x496e3c['sqlCode'],'error':_0x3fcf13(0x16c)});continue;}const _0x23b352=await readFile(_0x496e3c[_0x3fcf13(0x14d)],_0x3fcf13(0x16f)),_0x47dcac=stripLocalSqlMetadata(_0x23b352,_0x496e3c['mode']),_0x4dc4e3=_0x496e3c['sqlName']||_0x4911fb[_0x3fcf13(0x173)],_0x4e2b50=await resolveTargetDbBinding(_0x5d9c72[_0x3fcf13(0x165)],_0x496e3c,_0x4911fb),_0x2402a8=await updateSqlQuery({'id':_0x4911fb[_0x3fcf13(0x146)],'appCode':_0x5d9c72[_0x3fcf13(0x165)],'sqlCode':_0x496e3c['sqlCode'],'sqlName':_0x4dc4e3,'dbId':_0x4e2b50[_0x3fcf13(0x152)],'version':_0x4911fb[_0x3fcf13(0x16d)],'sqlContent':_0x47dcac,'sqlConfig':_0x4911fb[_0x3fcf13(0x16e)]??undefined}),_0x373984=_0x2402a8[_0x3fcf13(0x152)]?await getDbName(_0x5d9c72[_0x3fcf13(0x165)],Number(_0x2402a8[_0x3fcf13(0x152)]))['catch'](()=>_0x4e2b50[_0x3fcf13(0x166)]):_0x4e2b50['dbName'];_0x10ced8[_0x3fcf13(0x159)][_0x496e3c[_0x3fcf13(0x17e)]]={...buildSqlLockEntry(_0x2402a8,_0x47dcac,_0x536e4b,{'dbName':_0x373984}),'path':_0x496e3c[_0x3fcf13(0x156)],'mode':_0x4911fb[_0x3fcf13(0x150)]},await archivePreviousSqlFileIfNeeded(_0xda5cc8,_0x4911fb['path'],_0x496e3c['relativePath']),_0x54eb35[_0x3fcf13(0x155)]({'sqlCode':_0x496e3c['sqlCode'],'remoteId':_0x4911fb[_0x3fcf13(0x146)]});}catch(_0x1fbc7c){_0x185005['push']({'sqlCode':_0x496e3c[_0x3fcf13(0x17e)],'error':_0x1fbc7c instanceof Error?_0x1fbc7c[_0x3fcf13(0x17d)]:String(_0x1fbc7c)});}}return _0x10ced8[_0x3fcf13(0x176)]=new Date()['toISOString'](),await writeSqlLockFile(_0xda5cc8[_0x3fcf13(0x14b)],_0x59f037),{'ok':_0x185005[_0x3fcf13(0x180)]===0x0,'data':{'pushed':_0x54eb35,'skipped':_0x1738be,'failed':_0x185005},'message':_0x3fcf13(0x15e)+_0x54eb35[_0x3fcf13(0x180)]+'\x20pushed,\x20'+_0x1738be[_0x3fcf13(0x180)]+_0x3fcf13(0x184)+_0x185005[_0x3fcf13(0x180)]+'\x20failed'};}};async function archivePreviousSqlFileIfNeeded(_0x379fe2,_0x5f0845,_0x37b4f0){const _0x3eb492=a176_0x34404f;if(!_0x5f0845||_0x5f0845===_0x37b4f0)return;const _0x1ad543=join(_0x379fe2['sqlRootDir'],_0x5f0845);if(!await fileExists(_0x1ad543))return;const _0x27d07c=await moveToTrash(_0x379fe2['projectRoot'],_0x379fe2[_0x3eb492(0x151)],_0x1ad543);await cleanupEmptyDirectories(dirname(_0x1ad543),_0x379fe2[_0x3eb492(0x172)]),void _0x27d07c;}async function moveToTrash(_0x957c49,_0x40bd99,_0x22f87e){const _0x1ecbc3=a176_0x34404f,_0x3fff24=new Date()['toISOString']()[_0x1ecbc3(0x17f)](/[:.]/g,'-'),_0x5b9b24=relative(_0x957c49,_0x22f87e),_0x11dd43=join(_0x40bd99,_0x3fff24,_0x5b9b24);return await mkdir(dirname(_0x11dd43),{'recursive':!![]}),await rename(_0x22f87e,_0x11dd43),_0x11dd43;}async function cleanupEmptyDirectories(_0x125f16,_0x516dbd){const _0x2831e8=a176_0x34404f;let _0x24236a=resolve(_0x125f16);const _0x342a89=resolve(_0x516dbd);while(_0x24236a[_0x2831e8(0x174)](''+_0x342a89+sep)||_0x24236a===_0x342a89){if(_0x24236a===_0x342a89)return;try{const _0xe8c8b5=await readdir(_0x24236a);if(_0xe8c8b5[_0x2831e8(0x180)]>0x0)return;await rmdir(_0x24236a);}catch{return;}_0x24236a=dirname(_0x24236a);}}async function resolveTargetDbBinding(_0xe9a658,_0x1ed5ea,_0x426e2d){const _0x3ce4fa=a176_0x34404f,_0x23af5d=_0x1ed5ea['dbDirectory'];if(!_0x23af5d)return{'dbId':_0x426e2d[_0x3ce4fa(0x152)],'dbName':_0x426e2d[_0x3ce4fa(0x166)]};const _0x4208d9=buildDbDirectoryName(_0x426e2d['dbName'],_0x426e2d['dbId']);if(_0x23af5d===_0x4208d9)return{'dbId':_0x426e2d[_0x3ce4fa(0x152)],'dbName':_0x426e2d[_0x3ce4fa(0x166)]};const _0x1da198=parseExplicitDbDirectory(_0x23af5d);if(_0x1da198!=null)return{'dbId':_0x1da198,'dbName':await getDbName(_0xe9a658,_0x1da198)[_0x3ce4fa(0x17c)](()=>undefined)};const _0x2aea3c=await listDatabases(_0xe9a658),_0x4de116=_0x2aea3c['filter'](_0x540373=>buildDbDirectoryName(_0x540373[_0x3ce4fa(0x166)],_0x540373[_0x3ce4fa(0x152)])===_0x23af5d);if(_0x4de116[_0x3ce4fa(0x180)]===0x1)return{'dbId':_0x4de116[0x0]['dbId'],'dbName':_0x4de116[0x0][_0x3ce4fa(0x166)]};if(_0x4de116[_0x3ce4fa(0x180)]===0x0)throw CliErrors['validation']('No\x20database\x20matches\x20local\x20directory\x20\x22'+_0x23af5d+'\x22\x20for\x20sqlCode\x20'+_0x1ed5ea['sqlCode']+'.');const _0x27d4cc=_0x4de116[_0x3ce4fa(0x181)](_0x33799f=>_0x33799f[_0x3ce4fa(0x166)]+'\x20('+_0x33799f[_0x3ce4fa(0x152)]+')')[_0x3ce4fa(0x171)](',\x20');throw CliErrors['validation'](_0x3ce4fa(0x17a)+_0x23af5d+_0x3ce4fa(0x17b)+_0x1ed5ea[_0x3ce4fa(0x17e)]+':\x20'+_0x27d4cc);}function parseExplicitDbDirectory(_0x210b3d){const _0x50d27b=a176_0x34404f,_0xef8691=/^db-(\d+)$/[_0x50d27b(0x15c)](_0x210b3d);if(!_0xef8691)return null;const _0x943557=Number(_0xef8691[0x1]);return Number[_0x50d27b(0x14a)](_0x943557)&&_0x943557>0x0?_0x943557:null;}
|
|
1
|
+
const a177_0x44466a=a177_0x5eef;(function(_0x1e2690,_0x4455d1){const _0x53d366=a177_0x5eef,_0x149689=_0x1e2690();while(!![]){try{const _0x28ae3b=parseInt(_0x53d366(0x17d))/0x1+parseInt(_0x53d366(0x1a7))/0x2+-parseInt(_0x53d366(0x199))/0x3*(-parseInt(_0x53d366(0x189))/0x4)+-parseInt(_0x53d366(0x19d))/0x5*(parseInt(_0x53d366(0x18d))/0x6)+-parseInt(_0x53d366(0x1ae))/0x7+-parseInt(_0x53d366(0x187))/0x8+-parseInt(_0x53d366(0x1b3))/0x9;if(_0x28ae3b===_0x4455d1)break;else _0x149689['push'](_0x149689['shift']());}catch(_0x33d7d6){_0x149689['push'](_0x149689['shift']());}}}(a177_0x3083,0x30f71));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';function a177_0x5eef(_0x473bf6,_0x3f56af){_0x473bf6=_0x473bf6-0x179;const _0x308331=a177_0x3083();let _0x5eef2e=_0x308331[_0x473bf6];return _0x5eef2e;}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';function a177_0x3083(){const _0x60b8fc=['relativePath','version','330696ydHILk','boolean','\x22\x20for\x20sqlCode\x20','sqlcode','dbDirectory','toISOString','Push\x20local\x20SQL\x20files\x20to\x20remote','1175804nVfJTK','sqlRoot','dbName','projectRoot','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','2108556gqbvoq','sqlCode','\x20SQL\x20file(s)','sqlConfig','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','No\x20local\x20SQL\x20files\x20found.','331407tGhzdN','Local\x20SQL\x20not\x20found:\x20','catch','path','sqlName','replace','dbId','message','\x20failed','sql','2115472GColHs','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','297892lIrBHA','join','appCode','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','534aOEkeu','length','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','hash','No\x20database\x20matches\x20local\x20directory\x20\x22','mode','utf8','push','map','has','filter','\x20pushed,\x20','15QFgDcG','force','unchanged','sqls','105QRFXLz','exec','filePath','validation','set','startsWith','sqlRootDir','remoteId'];a177_0x3083=function(){return _0x60b8fc;};return a177_0x3083();}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(_0x2b10e6,_0xfa4e5f,_0x364297){const _0x34dd54=a177_0x5eef,_0x599509=await scanLocalSqlQueries(_0x2b10e6),_0x420aa1=new Map();for(const _0x411a53 of _0x599509){if(_0x364297&&_0x411a53[_0x34dd54(0x1b4)]!==_0x364297)continue;const _0x40c1b5=_0x420aa1['get'](_0x411a53[_0x34dd54(0x1b4)])??[];_0x40c1b5[_0x34dd54(0x194)](_0x411a53),_0x420aa1[_0x34dd54(0x1a1)](_0x411a53['sqlCode'],_0x40c1b5);}if(_0x364297&&!_0x420aa1[_0x34dd54(0x196)](_0x364297))throw CliErrors['validation'](_0x34dd54(0x17e)+_0x364297);const _0x349f4f=[];for(const [_0x36915c,_0x335a7a]of _0x420aa1['entries']()){if(_0x335a7a[_0x34dd54(0x18e)]===0x1){_0x349f4f['push'](_0x335a7a[0x0]);continue;}const _0x1e6b10=_0xfa4e5f[_0x34dd54(0x19c)][_0x36915c],_0x1b610e=_0x1e6b10?.[_0x34dd54(0x180)],_0x5b6fea=_0x1b610e?_0x335a7a['filter'](_0x4c28ca=>_0x4c28ca[_0x34dd54(0x1a5)]!==_0x1b610e):_0x335a7a;if(_0x1e6b10&&_0x5b6fea[_0x34dd54(0x18e)]===0x1){_0x349f4f[_0x34dd54(0x194)](_0x5b6fea[0x0]);continue;}throw CliErrors[_0x34dd54(0x1a0)](_0x34dd54(0x188)+_0x36915c+_0x34dd54(0x18c));}return _0x349f4f;}export const sqlPush={'service':a177_0x44466a(0x186),'command':a177_0x44466a(0x194),'description':a177_0x44466a(0x1ad),'risk':'high-risk-write','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a177_0x44466a(0x19a),'type':a177_0x44466a(0x1a8),'description':a177_0x44466a(0x18f)}],async 'dryRun'(_0x5d733e){const _0x58cbe1=a177_0x44466a,_0x37890c=loadSqlProjectConfig(_0x5d733e['appCode']),_0x412b54=await readSqlLockFile(_0x37890c['lockFilePath']),{appLock:_0x55467d}=ensureSqlLockScope(_0x412b54??createEmptySqlLock(),_0x5d733e[_0x58cbe1(0x18b)],_0x37890c[_0x58cbe1(0x1af)],'push'),_0x38ea24=await getTargetSqlQueries(_0x37890c,_0x55467d,_0x5d733e['str'](_0x58cbe1(0x1aa))||undefined),_0x36b66e=[];for(const _0x9d270f of _0x38ea24){const _0xa00ffb=await computeSqlFileHash(_0x9d270f[_0x58cbe1(0x19f)]),_0x17f971=_0x55467d[_0x58cbe1(0x19c)][_0x9d270f['sqlCode']],_0x15bd15=!!_0x17f971&&(_0x17f971['path']!==_0x9d270f[_0x58cbe1(0x1a5)]||!!_0x9d270f[_0x58cbe1(0x181)]&&_0x17f971[_0x58cbe1(0x181)]!==_0x9d270f[_0x58cbe1(0x181)]);if(!_0x5d733e['bool'](_0x58cbe1(0x19a))&&_0x17f971&&_0x17f971[_0x58cbe1(0x190)]===_0xa00ffb&&!_0x15bd15)continue;_0x36b66e[_0x58cbe1(0x194)](_0x9d270f['sqlCode']);}return{'method':'POST','url':'/smartapi/custom/updateUserCustomSql','body':{'sqlCodes':_0x36b66e,'appCode':_0x5d733e[_0x58cbe1(0x18b)]},'description':'Would\x20push\x20'+_0x36b66e['length']+_0x58cbe1(0x179)};},async 'execute'(_0x1fa592){const _0x402ae7=a177_0x44466a,_0xbeb829=loadSqlProjectConfig(_0x1fa592[_0x402ae7(0x18b)]),_0xffe08f=await readSqlLockFile(_0xbeb829['lockFilePath']),{lockData:_0x4712db,appLock:_0x5d25b2}=ensureSqlLockScope(_0xffe08f??createEmptySqlLock(),_0x1fa592['appCode'],_0xbeb829[_0x402ae7(0x1af)],_0x402ae7(0x194)),_0x411a40=await getTargetSqlQueries(_0xbeb829,_0x5d25b2,_0x1fa592['str'](_0x402ae7(0x1aa))||undefined);if(_0x411a40[_0x402ae7(0x18e)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x402ae7(0x17c)};const _0x271868=[],_0x5177a6=[],_0x120ff9=[];for(const _0x1cde17 of _0x411a40){const _0x5c8cb6=_0x5d25b2[_0x402ae7(0x19c)][_0x1cde17['sqlCode']];if(!_0x5c8cb6){_0x120ff9['push']({'sqlCode':_0x1cde17[_0x402ae7(0x1b4)],'error':_0x402ae7(0x1b2)});continue;}try{const _0x4212c7=await computeSqlFileHash(_0x1cde17[_0x402ae7(0x19f)]),_0x83cb35=_0x5c8cb6[_0x402ae7(0x180)]!==_0x1cde17[_0x402ae7(0x1a5)]||!!_0x1cde17['sqlName']&&_0x5c8cb6[_0x402ae7(0x181)]!==_0x1cde17[_0x402ae7(0x181)];if(!_0x1fa592['bool'](_0x402ae7(0x19a))&&_0x5c8cb6[_0x402ae7(0x190)]===_0x4212c7&&!_0x83cb35){_0x5177a6[_0x402ae7(0x194)]({'sqlCode':_0x1cde17[_0x402ae7(0x1b4)],'reason':_0x402ae7(0x19b)});continue;}if(_0x5c8cb6[_0x402ae7(0x1a6)]==null){_0x120ff9[_0x402ae7(0x194)]({'sqlCode':_0x1cde17[_0x402ae7(0x1b4)],'error':_0x402ae7(0x17b)});continue;}const _0x206d86=await readFile(_0x1cde17[_0x402ae7(0x19f)],_0x402ae7(0x193)),_0x14f958=stripLocalSqlMetadata(_0x206d86,_0x1cde17[_0x402ae7(0x192)]),_0x409e1c=_0x1cde17[_0x402ae7(0x181)]||_0x5c8cb6[_0x402ae7(0x181)],_0x49fe3f=await resolveTargetDbBinding(_0x1fa592[_0x402ae7(0x18b)],_0x1cde17,_0x5c8cb6),_0x2e1ff9=await updateSqlQuery({'id':_0x5c8cb6[_0x402ae7(0x1a4)],'appCode':_0x1fa592[_0x402ae7(0x18b)],'sqlCode':_0x1cde17[_0x402ae7(0x1b4)],'sqlName':_0x409e1c,'dbId':_0x49fe3f[_0x402ae7(0x183)],'version':_0x5c8cb6[_0x402ae7(0x1a6)],'sqlContent':_0x14f958,'sqlConfig':_0x5c8cb6[_0x402ae7(0x17a)]??undefined}),_0x367913=_0x2e1ff9[_0x402ae7(0x183)]?await getDbName(_0x1fa592[_0x402ae7(0x18b)],Number(_0x2e1ff9[_0x402ae7(0x183)]))[_0x402ae7(0x17f)](()=>_0x49fe3f[_0x402ae7(0x1b0)]):_0x49fe3f[_0x402ae7(0x1b0)];_0x5d25b2[_0x402ae7(0x19c)][_0x1cde17['sqlCode']]={...buildSqlLockEntry(_0x2e1ff9,_0x14f958,_0x4212c7,{'dbName':_0x367913}),'path':_0x1cde17['relativePath'],'mode':_0x5c8cb6['mode']},await archivePreviousSqlFileIfNeeded(_0xbeb829,_0x5c8cb6['path'],_0x1cde17[_0x402ae7(0x1a5)]),_0x271868['push']({'sqlCode':_0x1cde17[_0x402ae7(0x1b4)],'remoteId':_0x5c8cb6['remoteId']});}catch(_0x457fec){_0x120ff9[_0x402ae7(0x194)]({'sqlCode':_0x1cde17['sqlCode'],'error':_0x457fec instanceof Error?_0x457fec[_0x402ae7(0x184)]:String(_0x457fec)});}}return _0x5d25b2['lastSync']=new Date()['toISOString'](),await writeSqlLockFile(_0xbeb829['lockFilePath'],_0x4712db),{'ok':_0x120ff9['length']===0x0,'data':{'pushed':_0x271868,'skipped':_0x5177a6,'failed':_0x120ff9},'message':'Push\x20complete:\x20'+_0x271868[_0x402ae7(0x18e)]+_0x402ae7(0x198)+_0x5177a6['length']+'\x20skipped,\x20'+_0x120ff9['length']+_0x402ae7(0x185)};}};async function archivePreviousSqlFileIfNeeded(_0x2ee7eb,_0xa577bd,_0x3cde76){const _0x2fc753=a177_0x44466a;if(!_0xa577bd||_0xa577bd===_0x3cde76)return;const _0x17843e=join(_0x2ee7eb['sqlRootDir'],_0xa577bd);if(!await fileExists(_0x17843e))return;const _0x4dd00f=await moveToTrash(_0x2ee7eb[_0x2fc753(0x1b1)],_0x2ee7eb['trashDir'],_0x17843e);await cleanupEmptyDirectories(dirname(_0x17843e),_0x2ee7eb[_0x2fc753(0x1a3)]),void _0x4dd00f;}async function moveToTrash(_0x568977,_0x291f3a,_0x49a051){const _0x48911b=a177_0x44466a,_0xcc28c7=new Date()[_0x48911b(0x1ac)]()[_0x48911b(0x182)](/[:.]/g,'-'),_0x1c5b8b=relative(_0x568977,_0x49a051),_0x3cc007=join(_0x291f3a,_0xcc28c7,_0x1c5b8b);return await mkdir(dirname(_0x3cc007),{'recursive':!![]}),await rename(_0x49a051,_0x3cc007),_0x3cc007;}async function cleanupEmptyDirectories(_0x5ef314,_0x168da1){const _0xc91aaf=a177_0x44466a;let _0x1697c8=resolve(_0x5ef314);const _0x1e285c=resolve(_0x168da1);while(_0x1697c8[_0xc91aaf(0x1a2)](''+_0x1e285c+sep)||_0x1697c8===_0x1e285c){if(_0x1697c8===_0x1e285c)return;try{const _0x26648d=await readdir(_0x1697c8);if(_0x26648d[_0xc91aaf(0x18e)]>0x0)return;await rmdir(_0x1697c8);}catch{return;}_0x1697c8=dirname(_0x1697c8);}}async function resolveTargetDbBinding(_0xe5a241,_0x5ae420,_0x4d1fa0){const _0x486c5c=a177_0x44466a,_0x551d6f=_0x5ae420[_0x486c5c(0x1ab)];if(!_0x551d6f)return{'dbId':_0x4d1fa0[_0x486c5c(0x183)],'dbName':_0x4d1fa0[_0x486c5c(0x1b0)]};const _0x5967d5=buildDbDirectoryName(_0x4d1fa0[_0x486c5c(0x1b0)],_0x4d1fa0['dbId']);if(_0x551d6f===_0x5967d5)return{'dbId':_0x4d1fa0['dbId'],'dbName':_0x4d1fa0[_0x486c5c(0x1b0)]};const _0x1f0046=parseExplicitDbDirectory(_0x551d6f);if(_0x1f0046!=null)return{'dbId':_0x1f0046,'dbName':await getDbName(_0xe5a241,_0x1f0046)['catch'](()=>undefined)};const _0x4de14a=await listDatabases(_0xe5a241),_0x2b37db=_0x4de14a[_0x486c5c(0x197)](_0x4db486=>buildDbDirectoryName(_0x4db486['dbName'],_0x4db486[_0x486c5c(0x183)])===_0x551d6f);if(_0x2b37db[_0x486c5c(0x18e)]===0x1)return{'dbId':_0x2b37db[0x0][_0x486c5c(0x183)],'dbName':_0x2b37db[0x0][_0x486c5c(0x1b0)]};if(_0x2b37db['length']===0x0)throw CliErrors[_0x486c5c(0x1a0)](_0x486c5c(0x191)+_0x551d6f+_0x486c5c(0x1a9)+_0x5ae420['sqlCode']+'.');const _0x59297c=_0x2b37db[_0x486c5c(0x195)](_0x2f7802=>_0x2f7802[_0x486c5c(0x1b0)]+'\x20('+_0x2f7802['dbId']+')')[_0x486c5c(0x18a)](',\x20');throw CliErrors[_0x486c5c(0x1a0)]('Local\x20directory\x20\x22'+_0x551d6f+'\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20'+_0x5ae420['sqlCode']+':\x20'+_0x59297c);}function parseExplicitDbDirectory(_0x5d8b3c){const _0x5d52a2=a177_0x44466a,_0x3c49a9=/^db-(\d+)$/[_0x5d52a2(0x19e)](_0x5d8b3c);if(!_0x3c49a9)return null;const _0x159452=Number(_0x3c49a9[0x1]);return Number['isFinite'](_0x159452)&&_0x159452>0x0?_0x159452:null;}
|
package/lib/commands/sql/save.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a178_0x424f65=a178_0x365e;(function(_0x4dc063,_0xe5d824){const _0x3db889=a178_0x365e,_0x4c863e=_0x4dc063();while(!![]){try{const _0x3179fc=-parseInt(_0x3db889(0x1d9))/0x1*(-parseInt(_0x3db889(0x1d3))/0x2)+-parseInt(_0x3db889(0x1dd))/0x3*(-parseInt(_0x3db889(0x1d0))/0x4)+parseInt(_0x3db889(0x1e0))/0x5*(-parseInt(_0x3db889(0x1d7))/0x6)+-parseInt(_0x3db889(0x1dc))/0x7*(parseInt(_0x3db889(0x1d2))/0x8)+parseInt(_0x3db889(0x1df))/0x9+parseInt(_0x3db889(0x1d6))/0xa*(-parseInt(_0x3db889(0x1d8))/0xb)+parseInt(_0x3db889(0x1d4))/0xc;if(_0x3179fc===_0xe5d824)break;else _0x4c863e['push'](_0x4c863e['shift']());}catch(_0x2f4874){_0x4c863e['push'](_0x4c863e['shift']());}}}(a178_0x25c8,0x50c69));import{CliErrors}from'../../errors.js';function a178_0x365e(_0x25839a,_0x4f34a2){_0x25839a=_0x25839a-0x1ca;const _0x25c858=a178_0x25c8();let _0x365e49=_0x25c858[_0x25839a];return _0x365e49;}import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a178_0x25c8(){const _0x397d26=['12xlTIWg','Update\x20existing\x20SQL\x20by\x20editing\x20the\x20synced\x20file\x20under\x20`.rabetbase/sql/<appCode>/<dbName|db-<id>>/`\x20and\x20then\x20running\x20`rabetbase\x20sql\x20push\x20--sqlcode\x20<code>\x20--yes`.','40nOyjAP','7080UFgsHa','7981596hyBSai','validation','1790ZjCfSS','6WPugsN','36619ApOiUg','1WlsmnN','Target\x20database\x20—\x20accepts\x20a\x20numeric\x20ID\x20or\x20database\x20name\x20(e.g.\x20ecommerce_db)','string','870121opZaGU','410853jZhCRf','sqlname','5188230dvCLmN','538665wZQlSZ','Query\x20description','Create\x20new\x20SQL\x20with\x20`rabetbase\x20sql\x20create\x20--name\x20<name>\x20--db-id\x20<id>\x20--mode\x20sql|mybatisXml`.','`rabetbase\x20sql\x20save`\x20has\x20been\x20deprecated.','Path\x20to\x20the\x20SQL\x20file','save','Deprecated:\x20use\x20sql\x20create\x20to\x20create\x20and\x20sql\x20push\x20to\x20update'];a178_0x25c8=function(){return _0x397d26;};return a178_0x25c8();}const SQL_SAVE_DEPRECATED_HINT=[a178_0x424f65(0x1cc),a178_0x424f65(0x1cb),a178_0x424f65(0x1d1)]['join']('\x0a');export const sqlSave={'service':'sql','command':a178_0x424f65(0x1ce),'description':a178_0x424f65(0x1cf),'risk':'write','requiresAuth':![],'requiresAppCode':![],'flags':[{'name':'file','type':'string','required':!![],'description':a178_0x424f65(0x1cd)},SQLCODE_FLAG_OPTIONAL,{'name':a178_0x424f65(0x1de),'type':a178_0x424f65(0x1db),'description':'SQL\x20query\x20display\x20name'},{'name':'db','type':'string','description':a178_0x424f65(0x1da)},{'name':'description','type':a178_0x424f65(0x1db),'description':a178_0x424f65(0x1ca)}],async 'validate'(){const _0x3d86c3=a178_0x424f65;throw CliErrors[_0x3d86c3(0x1d5)](SQL_SAVE_DEPRECATED_HINT);},async 'execute'(){const _0x1a370c=a178_0x424f65;throw CliErrors[_0x1a370c(0x1d5)](SQL_SAVE_DEPRECATED_HINT);}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a179_0x2ec01c=a179_0x4881;(function(_0x105271,_0x4c001f){const _0x4f158a=a179_0x4881,_0x4c5470=_0x105271();while(!![]){try{const _0x17f4aa=parseInt(_0x4f158a(0x174))/0x1+parseInt(_0x4f158a(0x182))/0x2+parseInt(_0x4f158a(0x17b))/0x3*(-parseInt(_0x4f158a(0x190))/0x4)+parseInt(_0x4f158a(0x175))/0x5*(parseInt(_0x4f158a(0x16f))/0x6)+-parseInt(_0x4f158a(0x183))/0x7*(-parseInt(_0x4f158a(0x194))/0x8)+parseInt(_0x4f158a(0x177))/0x9+parseInt(_0x4f158a(0x169))/0xa*(-parseInt(_0x4f158a(0x195))/0xb);if(_0x17f4aa===_0x4c001f)break;else _0x4c5470['push'](_0x4c5470['shift']());}catch(_0x58f9f3){_0x4c5470['push'](_0x4c5470['shift']());}}}(a179_0x406c,0xd6d35));import{createInterface}from'node:readline';import{join}from'node:path';import{buildDefaultSqlFileName,buildSqlRelativePath,detectSqlMode}from'../../core/sql-sync/utils.js';export const SQL_LOCAL_REL_DIR=a179_0x2ec01c(0x18a);export function buildSqlLockEntry(_0x962f29,_0xe33208,_0x3e5dc2,_0x59625b){const _0xe0e1f4=a179_0x2ec01c,_0x2894fe=detectSqlMode(_0xe33208);return{'path':buildSqlRelativePath(_0x962f29['sqlCode'],_0x962f29['sqlName'],_0x59625b?.[_0xe0e1f4(0x18d)],_0x2894fe,_0x962f29['dbId']),'hash':_0x3e5dc2,'remoteId':_0x962f29['id'],'version':_0x962f29[_0xe0e1f4(0x18c)],'dbId':Number(_0x962f29[_0xe0e1f4(0x178)]),'dbName':_0x59625b?.[_0xe0e1f4(0x18d)],'sqlName':_0x962f29[_0xe0e1f4(0x184)],'sqlConfig':_0x962f29['sqlConfig']??undefined,'mode':_0x2894fe};}function a179_0x406c(){const _0x5763dd=['990198QboOrt','dbId','sqls','join','147RSVqap','filter','stderr','apps','test','trim','syncedAt','986428qnwUyg','7kjrVIr','sqlName','sqlCode','fromEntries','split','entries','description','.rabetbase/sql','mode','version','dbName','sqlRoot','trimStart','96688Ahacua','length','close','question','11520176eIEjMJ','66hYUaDO','toLowerCase','endsWith','3164810mrInMx','<!--\x20@lovrabet.','mybatisXml','yes','stdin','lastSync','24Qxyfia','map','path','\x20-->','replace','1127029ZrmQSg','991190zoypmS','sqlContent'];a179_0x406c=function(){return _0x5763dd;};return a179_0x406c();}export function cloneSqlLockData(_0x444631){const _0x1bea1b=a179_0x2ec01c;return{'apps':Object[_0x1bea1b(0x186)](Object[_0x1bea1b(0x188)](_0x444631['apps'])[_0x1bea1b(0x170)](([_0x472d88,_0x52799c])=>[_0x472d88,{'sqlRoot':_0x52799c[_0x1bea1b(0x18e)],'lastSync':_0x52799c[_0x1bea1b(0x16e)],'sqls':{..._0x52799c[_0x1bea1b(0x179)]}}]))};}export function ensureRemoteSqlContent(_0x1e23b4){const _0x57f5c8=a179_0x2ec01c;return _0x1e23b4[_0x57f5c8(0x176)]??'';}export function buildLocalSqlFileContent(_0x24639f,_0x2808ae,_0x7c33ea){const _0x62b700=a179_0x2ec01c,_0x8fa226=_0x7c33ea?.[_0x62b700(0x18b)]??detectSqlMode(_0x2808ae),_0x12d634=stripLocalSqlMetadata(_0x2808ae,_0x8fa226)[_0x62b700(0x180)](),_0x4ae56d=[...buildMetadataHeaderLines({'sqlCode':_0x24639f[_0x62b700(0x185)],'sqlName':_0x24639f[_0x62b700(0x184)],'dbId':_0x24639f[_0x62b700(0x178)],'dbName':_0x7c33ea?.[_0x62b700(0x18d)],'mode':_0x8fa226,'syncedAt':_0x7c33ea?.[_0x62b700(0x181)],'description':_0x7c33ea?.[_0x62b700(0x189)]},_0x8fa226),'',_0x12d634],_0x337b49=_0x4ae56d[_0x62b700(0x17a)]('\x0a');return _0x337b49[_0x62b700(0x168)]('\x0a')?_0x337b49:_0x337b49+'\x0a';}export function stripLocalSqlMetadata(_0x2ea4a2,_0x1b775a){const _0x199eca=a179_0x2ec01c,_0x3486d5=_0x2ea4a2[_0x199eca(0x173)](/\r\n/g,'\x0a')[_0x199eca(0x187)]('\x0a'),_0x278549=[];let _0x5e268c=0x0;if(_0x1b775a===_0x199eca(0x16b))while(_0x5e268c<_0x3486d5[_0x199eca(0x191)]){const _0x3768c0=_0x3486d5[_0x5e268c]??'';if(/^\s*<!--\s*@lovrabet\./[_0x199eca(0x17f)](_0x3768c0)){_0x5e268c++;continue;}if(_0x3768c0['trim']()===''&&_0x5e268c>0x0){_0x5e268c++;continue;}break;}else while(_0x5e268c<_0x3486d5[_0x199eca(0x191)]){const _0x49c8c8=_0x3486d5[_0x5e268c]??'';if(/^\s*--\s*@lovrabet\./[_0x199eca(0x17f)](_0x49c8c8)){_0x5e268c++;continue;}if(_0x49c8c8[_0x199eca(0x180)]()===''&&_0x5e268c>0x0){_0x5e268c++;continue;}break;}for(;_0x5e268c<_0x3486d5['length'];_0x5e268c++){_0x278549['push'](_0x3486d5[_0x5e268c]);}return _0x278549[_0x199eca(0x17a)]('\x0a')[_0x199eca(0x18f)]();}export function resolveSqlMode(_0x37717b,_0x1f2864){const _0x1fb0e3=a179_0x2ec01c;if(_0x1f2864?.[_0x1fb0e3(0x18b)])return _0x1f2864[_0x1fb0e3(0x18b)];return detectSqlMode(_0x37717b);}export function resolveSqlFileName(_0x567dde,_0x55790f,_0x6915fe){const _0x1a6d13=a179_0x2ec01c;if(_0x6915fe?.[_0x1a6d13(0x171)])return _0x6915fe[_0x1a6d13(0x171)];if(_0x6915fe?.[_0x1a6d13(0x184)]||_0x6915fe?.[_0x1a6d13(0x18d)])return buildSqlRelativePath(_0x567dde,_0x6915fe?.[_0x1a6d13(0x184)],_0x6915fe?.['dbName'],resolveSqlMode(_0x55790f,_0x6915fe),_0x6915fe?.[_0x1a6d13(0x178)]);return buildDefaultSqlFileName(_0x567dde,resolveSqlMode(_0x55790f,_0x6915fe));}export function resolveSqlLocalDir(_0x2cc73e,_0x5ec47f){return join(_0x2cc73e,SQL_LOCAL_REL_DIR,_0x5ec47f);}export async function confirmForceOverwrite(_0xe898c2){const _0x13cf31=a179_0x2ec01c,_0x492dbd=createInterface({'input':process[_0x13cf31(0x16d)],'output':process[_0x13cf31(0x17d)]}),_0x48b395=await new Promise(_0x4c1ea=>{const _0x242903=_0x13cf31;_0x492dbd[_0x242903(0x193)](_0xe898c2+'\x20[y/N]\x20',_0x4c1ea);});return _0x492dbd[_0x13cf31(0x192)](),['y',_0x13cf31(0x16c)]['includes'](_0x48b395['trim']()[_0x13cf31(0x167)]());}export function findSqlLockScope(_0x5f3aac,_0x1091fb){const _0x36d5be=a179_0x2ec01c;return _0x5f3aac[_0x36d5be(0x17e)][_0x1091fb];}function a179_0x4881(_0x40d595,_0x45ffc6){_0x40d595=_0x40d595-0x167;const _0x406ca2=a179_0x406c();let _0x4881eb=_0x406ca2[_0x40d595];return _0x4881eb;}function buildMetadataHeaderLines(_0x2f50e5,_0x4dc543){const _0x5800b3=a179_0x2ec01c,_0x1ec598=[[_0x5800b3(0x185),_0x2f50e5[_0x5800b3(0x185)]],[_0x5800b3(0x184),_0x2f50e5[_0x5800b3(0x184)]],['dbId',_0x2f50e5[_0x5800b3(0x178)]],[_0x5800b3(0x18d),_0x2f50e5[_0x5800b3(0x18d)]],[_0x5800b3(0x18b),_0x2f50e5[_0x5800b3(0x18b)]],[_0x5800b3(0x181),_0x2f50e5['syncedAt']],[_0x5800b3(0x189),_0x2f50e5['description']]];if(_0x4dc543===_0x5800b3(0x16b))return _0x1ec598[_0x5800b3(0x17c)](([,_0x4de893])=>_0x4de893!==undefined&&_0x4de893!==null&&String(_0x4de893)['trim']()!=='')[_0x5800b3(0x170)](([_0xf3f70d,_0x264e05])=>_0x5800b3(0x16a)+_0xf3f70d+':\x20'+String(_0x264e05)+_0x5800b3(0x172));return _0x1ec598[_0x5800b3(0x17c)](([,_0x4f3b62])=>_0x4f3b62!==undefined&&_0x4f3b62!==null&&String(_0x4f3b62)['trim']()!=='')['map'](([_0x454860,_0x6a6454])=>'--\x20@lovrabet.'+_0x454860+':\x20'+String(_0x6a6454));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a180_0x281a(){const _0x17bfab=['12080TqZppm','status','paging','sql','has','805dUmNTS','keys','\x20missing,\x20','sqlName','sqlCode','relativePath','push','10490HTzzah','appCode','length','574249NWjXsk','4RFqWcP','remote','map','\x20remote-only','1836882LzzlzC','boolean','lockKey','331490UIejiW','2cbrInw','Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally','sqls','Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','sqlRoot','2196303SdpVIv','bool','\x20added,\x20','read','tableData','118593jZxdMM','\x20unchanged','18106hPSnRO','totalCount','path'];a180_0x281a=function(){return _0x17bfab;};return a180_0x281a();}const a180_0x247759=a180_0x5a8f;(function(_0x338817,_0x2dc045){const _0x254f6d=a180_0x5a8f,_0x4a56b7=_0x338817();while(!![]){try{const _0x5d61ee=-parseInt(_0x254f6d(0x112))/0x1+parseInt(_0x254f6d(0x11b))/0x2*(-parseInt(_0x254f6d(0xf9))/0x3)+parseInt(_0x254f6d(0x113))/0x4*(parseInt(_0x254f6d(0x11a))/0x5)+-parseInt(_0x254f6d(0x117))/0x6+parseInt(_0x254f6d(0x108))/0x7*(parseInt(_0x254f6d(0x103))/0x8)+parseInt(_0x254f6d(0xfe))/0x9+parseInt(_0x254f6d(0x10f))/0xa*(parseInt(_0x254f6d(0x100))/0xb);if(_0x5d61ee===_0x2dc045)break;else _0x4a56b7['push'](_0x4a56b7['shift']());}catch(_0x487d49){_0x4a56b7['push'](_0x4a56b7['shift']());}}}(a180_0x281a,0x59ab2));import{listSqlQueries}from'../../core/api-client.js';function a180_0x5a8f(_0x49a2f4,_0x1b195b){_0x49a2f4=_0x49a2f4-0xf6;const _0x281adf=a180_0x281a();let _0x5a8f06=_0x281adf[_0x49a2f4];return _0x5a8f06;}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;async function fetchAllSqlCodes(_0x19c596){const _0x2bd336=a180_0x5a8f,_0x4f157e=[];let _0x1470b1=0x1;while(!![]){const _0x1be39f=await listSqlQueries(_0x19c596,{'currentPage':_0x1470b1,'pageSize':PAGE_SIZE}),_0x5d929d=_0x1be39f[_0x2bd336(0xfd)]??[];_0x4f157e['push'](..._0x5d929d['map'](_0x2df89c=>_0x2df89c[_0x2bd336(0x10c)]));if(_0x5d929d['length']===0x0)break;const _0x206fa7=_0x1be39f[_0x2bd336(0x105)]?.[_0x2bd336(0x101)];if(_0x206fa7!=null?_0x4f157e[_0x2bd336(0x111)]>=_0x206fa7:_0x5d929d[_0x2bd336(0x111)]<PAGE_SIZE)break;_0x1470b1++;}return _0x4f157e;}export const sqlStatus={'service':a180_0x247759(0x106),'command':a180_0x247759(0x104),'description':a180_0x247759(0xf7),'risk':a180_0x247759(0xfc),'flags':[{'name':a180_0x247759(0x114),'type':a180_0x247759(0x118),'description':a180_0x247759(0x11c)}],async 'execute'(_0x536091){const _0x1cc470=a180_0x247759,_0x3253d7=loadSqlProjectConfig(_0x536091[_0x1cc470(0x110)]),_0x2ccdf0=await readSqlLockFile(_0x3253d7['lockFilePath']),{appLock:_0x5c67ec}=ensureSqlLockScope(_0x2ccdf0??createEmptySqlLock(),_0x3253d7[_0x1cc470(0x110)],_0x3253d7[_0x1cc470(0xf8)],_0x1cc470(0x104)),_0x104b3b=await scanLocalSqlQueries(_0x3253d7),_0x3d422d=[],_0x3d89e3=[],_0x3ad76a=[],_0x12a0aa=[],_0x2a92dc=new Set(_0x104b3b[_0x1cc470(0x115)](_0x18ebcf=>_0x18ebcf[_0x1cc470(0x119)]));for(const _0x45dbe1 of _0x104b3b){const _0x331db3=await computeSqlFileHash(_0x45dbe1['filePath']),_0x4e882e=_0x5c67ec['sqls'][_0x45dbe1['lockKey']],_0x131058=!!_0x4e882e&&_0x4e882e[_0x1cc470(0x102)]!==_0x45dbe1[_0x1cc470(0x10d)],_0x535d9d=!!_0x4e882e&&!!_0x45dbe1[_0x1cc470(0x10b)]&&_0x4e882e[_0x1cc470(0x10b)]!==_0x45dbe1[_0x1cc470(0x10b)];if(!_0x4e882e)_0x3d422d[_0x1cc470(0x10e)](_0x45dbe1[_0x1cc470(0x119)]);else _0x4e882e['hash']!==_0x331db3||_0x131058||_0x535d9d?_0x3d89e3['push'](_0x45dbe1['lockKey']):_0x3ad76a['push'](_0x45dbe1[_0x1cc470(0x119)]);}for(const _0x25667d of Object[_0x1cc470(0x109)](_0x5c67ec[_0x1cc470(0xf6)])){!_0x2a92dc[_0x1cc470(0x107)](_0x25667d)&&_0x12a0aa[_0x1cc470(0x10e)](_0x25667d);}const _0x23d12c=[];if(_0x536091[_0x1cc470(0xfa)]('remote')){const _0x452fe7=await fetchAllSqlCodes(_0x536091[_0x1cc470(0x110)]);for(const _0x16c79f of _0x452fe7){!_0x2a92dc[_0x1cc470(0x107)](_0x16c79f)&&!_0x5c67ec[_0x1cc470(0xf6)][_0x16c79f]&&_0x23d12c[_0x1cc470(0x10e)](_0x16c79f);}}const _0x3807c8=_0x3d422d['length']===0x0&&_0x3d89e3[_0x1cc470(0x111)]===0x0&&_0x12a0aa[_0x1cc470(0x111)]===0x0&&_0x23d12c[_0x1cc470(0x111)]===0x0;return{'ok':!![],'data':{'added':_0x3d422d,'modified':_0x3d89e3,'missing':_0x12a0aa,'unchanged':_0x3ad76a,'remoteOnly':_0x23d12c},'message':_0x3807c8?'All\x20SQL\x20queries\x20are\x20in\x20sync.':_0x3d422d[_0x1cc470(0x111)]+_0x1cc470(0xfb)+_0x3d89e3[_0x1cc470(0x111)]+'\x20modified,\x20'+_0x12a0aa['length']+_0x1cc470(0x10a)+_0x3ad76a[_0x1cc470(0x111)]+_0x1cc470(0xff)+(_0x23d12c[_0x1cc470(0x111)]>0x0?',\x20'+_0x23d12c[_0x1cc470(0x111)]+_0x1cc470(0x116):'')};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a181_0x4a50cf=a181_0x1920;(function(_0x37a84f,_0x14ef2d){const _0x53682c=a181_0x1920,_0xb87618=_0x37a84f();while(!![]){try{const _0x1fa0d3=-parseInt(_0x53682c(0x1e3))/0x1*(-parseInt(_0x53682c(0x1e9))/0x2)+parseInt(_0x53682c(0x1cb))/0x3+-parseInt(_0x53682c(0x1e1))/0x4*(parseInt(_0x53682c(0x1d3))/0x5)+parseInt(_0x53682c(0x1eb))/0x6+-parseInt(_0x53682c(0x200))/0x7*(parseInt(_0x53682c(0x1f3))/0x8)+parseInt(_0x53682c(0x1c2))/0x9+parseInt(_0x53682c(0x1c4))/0xa*(-parseInt(_0x53682c(0x1da))/0xb);if(_0x1fa0d3===_0x14ef2d)break;else _0xb87618['push'](_0xb87618['shift']());}catch(_0x5ec402){_0xb87618['push'](_0xb87618['shift']());}}}(a181_0x5acf,0xa6e7e));import{readFileSync,existsSync}from'node:fs';import{resolve}from'node:path';import{validateSql}from'../../core/sql-validator.js';function a181_0x5acf(){const _0x195ed7=['map','sql','tableName','joinAudit','cwd','Audit\x20top-level\x20JOIN\x20equality\x20predicates\x20against\x20dataset\x20index\x20metadata','File\x20not\x20found:\x20','8982057ScgetZ','index_columns','appCode','flagMissing','validation','reason','length','boolean','7252758euePpx','toLowerCase','10ZGxnCW','str','name','primary','tables','\x22\x20not\x20found\x20in\x20any\x20dataset','dataset','1464123SXZKRX','read','trim','valid','pkField','utf-8','Inline\x20SQL\x20content\x20to\x20validate\x20(alternative\x20to\x20--file)','check-indexes','140NFuBwb','Comma-separated\x20dataset\x20codes\x20to\x20cross-check\x20table/column\x20names\x20against','file','dbtableConfig','split','index_type','schema:','10068729BRDHzO','validate','Provide\x20--file\x20or\x20--sql','bool','indexes','SQL\x20schema\x20validation','sqlType','9304jMpnrg','parameters','466171BjEOaI','push','Table\x20\x22','flatMap','--check-indexes\x20requires\x20--schemas.','Validate\x20SQL\x20content\x20without\x20saving\x20(type\x20detection,\x20parameter\x20extraction,\x20optional\x20schema\x20check)','2EkvXDt','string','7123140fHDnWi','fields','columnNames','isSelectOnly','\x22\x20not\x20found\x20or\x20not\x20accessible','schemaWarnings','isArray','schemas','8dKUfRO','find','filter','type','unshift','columns'];a181_0x5acf=function(){return _0x195ed7;};return a181_0x5acf();}import{auditSqlJoinIndexes}from'../../core/sql-index-auditor.js';import{getDatasetDetail,listDatasets}from'../../core/api-client.js';function a181_0x1920(_0x4f6e46,_0x35541d){_0x4f6e46=_0x4f6e46-0x1bc;const _0x5acfa9=a181_0x5acf();let _0x1920a2=_0x5acfa9[_0x4f6e46];return _0x1920a2;}import{CliErrors}from'../../errors.js';import{assertDatasetIsDbTableBacked,filterDbTableBackedDatasets}from'../../commands/dataset/capability.js';export const sqlValidate={'service':a181_0x4a50cf(0x1fa),'command':a181_0x4a50cf(0x1db),'description':a181_0x4a50cf(0x1e8),'risk':a181_0x4a50cf(0x1cc),'flags':[{'name':a181_0x4a50cf(0x1d5),'type':a181_0x4a50cf(0x1ea),'description':'Path\x20to\x20the\x20SQL\x20file\x20to\x20validate'},{'name':a181_0x4a50cf(0x1fa),'type':'string','description':a181_0x4a50cf(0x1d1)},{'name':a181_0x4a50cf(0x1f2),'type':a181_0x4a50cf(0x1ea),'description':a181_0x4a50cf(0x1d4)},{'name':'check-indexes','type':a181_0x4a50cf(0x1c1),'description':a181_0x4a50cf(0x1fe)}],async 'execute'(_0x2538a0){const _0x5b6f55=a181_0x4a50cf,_0x48dd89=_0x2538a0[_0x5b6f55(0x1c5)](_0x5b6f55(0x1d5)),_0x4b722c=_0x2538a0['str'](_0x5b6f55(0x1fa)),_0x3de422=_0x2538a0[_0x5b6f55(0x1c5)](_0x5b6f55(0x1f2)),_0x5ccc85=_0x2538a0[_0x5b6f55(0x1dd)](_0x5b6f55(0x1d2));if(!_0x48dd89&&!_0x4b722c)throw CliErrors[_0x5b6f55(0x1bd)](_0x5b6f55(0x1d5),_0x5b6f55(0x1dc));if(_0x5ccc85&&!_0x3de422)throw CliErrors['validation'](_0x5b6f55(0x1e7));let _0x2a6f25;if(_0x48dd89){const _0x1faadd=resolve(process[_0x5b6f55(0x1fd)](),_0x48dd89);if(!existsSync(_0x1faadd))throw CliErrors[_0x5b6f55(0x1be)](_0x5b6f55(0x1ff)+_0x1faadd);_0x2a6f25=readFileSync(_0x1faadd,_0x5b6f55(0x1d0));}else _0x2a6f25=_0x4b722c;const _0xaa079f=validateSql(_0x2a6f25),_0x47010d={'valid':_0xaa079f[_0x5b6f55(0x1ce)],'sqlType':_0xaa079f[_0x5b6f55(0x1e0)][_0x5b6f55(0x1f6)],'isSelectOnly':_0xaa079f[_0x5b6f55(0x1e0)][_0x5b6f55(0x1ee)],'isDangerous':_0xaa079f[_0x5b6f55(0x1e0)]['isDangerous'],'tables':_0xaa079f[_0x5b6f55(0x1c8)],'parameters':_0xaa079f[_0x5b6f55(0x1e2)],'message':_0xaa079f['message']};_0xaa079f['sqlType'][_0x5b6f55(0x1bf)]&&(_0x47010d[_0x5b6f55(0x1bf)]=_0xaa079f[_0x5b6f55(0x1e0)][_0x5b6f55(0x1bf)]);if(_0x3de422&&_0xaa079f[_0x5b6f55(0x1ce)]){const _0x1d4b2d=_0x3de422['split'](',')[_0x5b6f55(0x1f9)](_0x408105=>_0x408105[_0x5b6f55(0x1cd)]())[_0x5b6f55(0x1f5)](Boolean),_0x3f10e4=[],_0x46bb28=[],_0x246038=filterDbTableBackedDatasets(await listDatasets(_0x2538a0[_0x5b6f55(0x1bc)])),_0x3ac533=new Map(_0x246038[_0x5b6f55(0x1f9)](_0x5b176d=>[_0x5b176d[_0x5b6f55(0x1d6)]?.[_0x5b6f55(0x1fb)]?.[_0x5b6f55(0x1c3)](),_0x5b176d]));for(const _0x2001d8 of _0xaa079f[_0x5b6f55(0x1c8)]){const _0x202af9=_0x3ac533['get'](_0x2001d8[_0x5b6f55(0x1c3)]());!_0x202af9&&_0x3f10e4[_0x5b6f55(0x1e4)](_0x5b6f55(0x1e5)+_0x2001d8+_0x5b6f55(0x1c9));}for(const _0x9c2d18 of _0x1d4b2d){let _0x5a8b7b;try{_0x5a8b7b=await getDatasetDetail(_0x9c2d18);}catch{_0x3f10e4[_0x5b6f55(0x1e4)]('Dataset\x20\x22'+_0x9c2d18+_0x5b6f55(0x1ef));continue;}assertDatasetIsDbTableBacked(_0x5a8b7b,_0x5b6f55(0x1df));const _0x16adce=Array['isArray'](_0x5a8b7b[_0x5b6f55(0x1ec)])?_0x5a8b7b[_0x5b6f55(0x1ec)]:[],_0x4e392f=new Set(_0x16adce[_0x5b6f55(0x1f9)](_0x54ab40=>_0x54ab40[_0x5b6f55(0x1c6)]?.[_0x5b6f55(0x1c3)]())),_0x1440d9=_0x5a8b7b[_0x5b6f55(0x1d6)]?.[_0x5b6f55(0x1fb)]||_0x5a8b7b[_0x5b6f55(0x1fb)]||_0x9c2d18;_0x47010d[_0x5b6f55(0x1d9)+_0x1440d9]={'code':_0x9c2d18,'tableName':_0x1440d9,'fieldCount':_0x4e392f['size'],'fields':Array['from'](_0x4e392f)};if(_0x5ccc85){const _0x30b59e=normalizeDatasetIndexes(_0x5a8b7b);_0x46bb28[_0x5b6f55(0x1e4)]({'tableName':_0x1440d9,..._0x30b59e});}}_0x3f10e4[_0x5b6f55(0x1c0)]>0x0&&(_0x47010d[_0x5b6f55(0x1f0)]=_0x3f10e4),_0x5ccc85&&(_0x47010d[_0x5b6f55(0x1fc)]=auditSqlJoinIndexes(_0x2a6f25,_0x46bb28));}return{'ok':_0xaa079f['valid'],'data':_0x47010d,'message':_0xaa079f['message']};}};function normalizeDatasetIndexes(_0x5cdec7){const _0x414113=a181_0x4a50cf,_0x1596e0=Array[_0x414113(0x1f1)](_0x5cdec7?.[_0x414113(0x1ca)]?.[_0x414113(0x1de)])?_0x5cdec7[_0x414113(0x1ca)][_0x414113(0x1de)]:Array['isArray'](_0x5cdec7?.[_0x414113(0x1de)])?_0x5cdec7['indexes']:[],_0x29e3ef=_0x1596e0[_0x414113(0x1e6)](_0x29c0fb=>{const _0xcc637e=_0x414113,_0x669925=Array[_0xcc637e(0x1f1)](_0x29c0fb?.['index_columns'])?_0x29c0fb[_0xcc637e(0x201)]:Array[_0xcc637e(0x1f1)](_0x29c0fb?.[_0xcc637e(0x1ed)])?_0x29c0fb[_0xcc637e(0x1ed)]:Array[_0xcc637e(0x1f1)](_0x29c0fb?.[_0xcc637e(0x1f8)])?_0x29c0fb[_0xcc637e(0x1f8)]:[],_0x130518=_0x669925[_0xcc637e(0x1f5)](_0x25b9d6=>typeof _0x25b9d6===_0xcc637e(0x1ea))[_0xcc637e(0x1f9)](_0x179bb5=>_0x179bb5[_0xcc637e(0x1cd)]())[_0xcc637e(0x1f5)](Boolean);if(_0x130518['length']===0x0)return[];const _0x22f2e0=[_0x29c0fb?.['indexName'],_0x29c0fb?.['index_name'],_0x29c0fb?.[_0xcc637e(0x1c6)]][_0xcc637e(0x1f4)](_0x439c23=>typeof _0x439c23===_0xcc637e(0x1ea)&&_0x439c23[_0xcc637e(0x1cd)]()),_0x53d396=[_0x29c0fb?.[_0xcc637e(0x1d8)],_0x29c0fb?.[_0xcc637e(0x1f6)]]['find'](_0x37bebb=>typeof _0x37bebb===_0xcc637e(0x1ea)&&_0x37bebb['trim']());return[{..._0x22f2e0?{'name':_0x22f2e0[_0xcc637e(0x1cd)]()}:{},..._0x53d396?{'type':_0x53d396[_0xcc637e(0x1cd)]()}:{},'columns':_0x130518}];}),_0x2cb583=[..._0x29e3ef],_0x5a738b=typeof _0x5cdec7?.['dbtableConfig']?.[_0x414113(0x1cf)]===_0x414113(0x1ea)?_0x5cdec7['dbtableConfig'][_0x414113(0x1cf)][_0x414113(0x1d7)](',')['map'](_0xa74597=>_0xa74597['trim']())[_0x414113(0x1f5)](Boolean):[];return _0x5a738b[_0x414113(0x1c0)]>0x0&&_0x2cb583[_0x414113(0x1f7)]({'type':_0x414113(0x1c7),'columns':_0x5a738b}),{'indexes':_0x2cb583,'metadataAvailable':_0x29e3ef[_0x414113(0x1c0)]>0x0};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x3da21e,_0x28b358){const _0x5d2f6a=a182_0x46ea,_0x1e0db8=_0x3da21e();while(!![]){try{const _0x479cba=parseInt(_0x5d2f6a(0xdd))/0x1+parseInt(_0x5d2f6a(0xda))/0x2+-parseInt(_0x5d2f6a(0xd5))/0x3+parseInt(_0x5d2f6a(0xdb))/0x4+-parseInt(_0x5d2f6a(0xd9))/0x5*(-parseInt(_0x5d2f6a(0xdc))/0x6)+parseInt(_0x5d2f6a(0xd6))/0x7+-parseInt(_0x5d2f6a(0xd7))/0x8*(parseInt(_0x5d2f6a(0xd8))/0x9);if(_0x479cba===_0x28b358)break;else _0x1e0db8['push'](_0x1e0db8['shift']());}catch(_0xe1eb3d){_0x1e0db8['push'](_0x1e0db8['shift']());}}}(a182_0x5ade,0xa3f86));import{taskStatus}from'../../commands/task/status.js';function a182_0x46ea(_0x528449,_0x3f1c48){_0x528449=_0x528449-0xd5;const _0x5ade4c=a182_0x5ade();let _0x46eac7=_0x5ade4c[_0x528449];return _0x46eac7;}function a182_0x5ade(){const _0x286829=['94082vSXLNx','2196600OqoDMl','3272668WWwIFC','601416EPtvPh','270IAkmwV','13185iZmpSg','1428828KvqHYf','4226804oMxftJ','3018pnmpEy'];a182_0x5ade=function(){return _0x286829;};return a182_0x5ade();}export const taskDefinitions=[taskStatus];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a183_0x20535d=a183_0x6a80;(function(_0x5e8a5a,_0x2c0334){const _0xe7747d=a183_0x6a80,_0x37fa4e=_0x5e8a5a();while(!![]){try{const _0xa042b8=parseInt(_0xe7747d(0x186))/0x1+-parseInt(_0xe7747d(0x18c))/0x2*(parseInt(_0xe7747d(0x18b))/0x3)+parseInt(_0xe7747d(0x199))/0x4+parseInt(_0xe7747d(0x195))/0x5*(parseInt(_0xe7747d(0x19c))/0x6)+parseInt(_0xe7747d(0x19b))/0x7*(parseInt(_0xe7747d(0x18a))/0x8)+-parseInt(_0xe7747d(0x198))/0x9+-parseInt(_0xe7747d(0x18e))/0xa;if(_0xa042b8===_0x2c0334)break;else _0x37fa4e['push'](_0x37fa4e['shift']());}catch(_0x17a271){_0x37fa4e['push'](_0x37fa4e['shift']());}}}(a183_0x2e14,0xb028a));import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asyncTaskMessage,buildAsyncTaskStatusCommand,normalizeAsyncTask}from'../../commands/common/async-task.js';function a183_0x2e14(){const _0x97e3d5=['7qWtHtO','3552852zCLRFW','apiError','task','934130rPCKsS','taskId','task-id','isTerminal','10287696yDcLvn','450090iPDkmT','2nvMOuS','read','24472250UbIYMC','Task\x20id\x20returned\x20by\x20an\x20asynchronous\x20platform\x20command','appCode',',\x20received\x20','trim','flagMissing','string','10ObnDWO','str','Task\x20status\x20response\x20id\x20mismatch:\x20requested\x20','3976488TdJwaI','1425028uofXKU','cookie'];a183_0x2e14=function(){return _0x97e3d5;};return a183_0x2e14();}import{getAsyncTaskStatus}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';function a183_0x6a80(_0x200192,_0x3b18c5){_0x200192=_0x200192-0x184;const _0x2e1407=a183_0x2e14();let _0x6a8095=_0x2e1407[_0x200192];return _0x6a8095;}export const taskStatus={'service':a183_0x20535d(0x185),'command':'status','description':'Query\x20an\x20asynchronous\x20task;\x20repeat\x20for\x20PENDING\x20or\x20PROCESSING\x20until\x20SUCCESS\x20or\x20FAILED','risk':a183_0x20535d(0x18d),'defaultOutputFormat':'compress','structuredErrors':!![],'flags':[{'name':a183_0x20535d(0x188),'type':a183_0x20535d(0x194),'required':!![],'description':a183_0x20535d(0x18f)},APPCODE_FLAG_OPTIONAL],async 'validate'(_0x4696a0){const _0x551982=a183_0x20535d;if(!_0x4696a0['str']('task-id')[_0x551982(0x192)]())throw CliErrors[_0x551982(0x193)](_0x551982(0x188));},async 'execute'(_0x1c12ee){const _0x28e1af=a183_0x20535d,_0x101b12=_0x1c12ee[_0x28e1af(0x196)]('task-id')[_0x28e1af(0x192)](),_0x436517=normalizeAsyncTask(await getAsyncTaskStatus(_0x101b12,_0x1c12ee[_0x28e1af(0x190)],_0x1c12ee[_0x28e1af(0x19a)]));if(_0x436517[_0x28e1af(0x187)]!==_0x101b12)throw CliErrors[_0x28e1af(0x184)](_0x28e1af(0x197)+_0x101b12+_0x28e1af(0x191)+_0x436517[_0x28e1af(0x187)]+'.');const _0x53f49a=buildAsyncTaskStatusCommand(_0x436517[_0x28e1af(0x187)],_0x1c12ee[_0x28e1af(0x190)]);return{'ok':!![],'message':asyncTaskMessage(_0x436517),'data':{'appCode':_0x1c12ee[_0x28e1af(0x190)],..._0x436517,'query':_0x436517[_0x28e1af(0x189)]?null:{'command':_0x53f49a}}};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a184_0x4388f2=a184_0x505c;(function(_0x8ab59f,_0x1f1c15){const _0x3401db=a184_0x505c,_0x4c1cc2=_0x8ab59f();while(!![]){try{const _0x49a570=parseInt(_0x3401db(0x1af))/0x1*(-parseInt(_0x3401db(0x1b4))/0x2)+-parseInt(_0x3401db(0x1b8))/0x3+parseInt(_0x3401db(0x1b3))/0x4*(-parseInt(_0x3401db(0x1b2))/0x5)+-parseInt(_0x3401db(0x1b0))/0x6+-parseInt(_0x3401db(0x1b1))/0x7+parseInt(_0x3401db(0x1ad))/0x8+-parseInt(_0x3401db(0x1b5))/0x9*(-parseInt(_0x3401db(0x1b6))/0xa);if(_0x49a570===_0x1f1c15)break;else _0x4c1cc2['push'](_0x4c1cc2['shift']());}catch(_0x9cb4ae){_0x4c1cc2['push'](_0x4c1cc2['shift']());}}}(a184_0x1892,0xa508e));import{buildAppAddFlags,runAppAdd,validateAppName}from'../../commands/common/app-registry.js';function a184_0x505c(_0x2613ee,_0x299954){_0x2613ee=_0x2613ee-0x1ac;const _0x189290=a184_0x1892();let _0x505c76=_0x189290[_0x2613ee];return _0x505c76;}export const workspaceAddDefinition={'service':'workspace','command':'add','description':a184_0x4388f2(0x1b7),'risk':a184_0x4388f2(0x1b9),'requiresAuth':![],'requiresAppCode':![],'args':[{'name':a184_0x4388f2(0x1ac),'description':a184_0x4388f2(0x1ba),'required':!![]}],'flags':buildAppAddFlags(),'validate':_0xe13baf=>validateAppName(_0xe13baf,a184_0x4388f2(0x1ae)),'execute':_0x13767d=>runAppAdd(_0x13767d,a184_0x4388f2(0x1ae))};function a184_0x1892(){const _0x30ec7e=['4745384WRtiYk','35RZCNwz','24116WtPrUx','70320hubfDV','867591enQCdb','170OZbBxS','Register\x20an\x20app\x20profile\x20in\x20the\x20current\x20workspace\x20(or\x20--global)','2401617sZANvk','write','App\x20profile\x20name','name','10509864JHtLXS','workspace\x20add','1LhBMaO','4324320tmuvLO'];a184_0x1892=function(){return _0x30ec7e;};return a184_0x1892();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a185_0x57e65f=a185_0x1f9d;(function(_0x537416,_0x2df960){const _0x7c48f5=a185_0x1f9d,_0x5c6c78=_0x537416();while(!![]){try{const _0x1d14d5=parseInt(_0x7c48f5(0x1ed))/0x1+parseInt(_0x7c48f5(0x1bf))/0x2*(parseInt(_0x7c48f5(0x1ef))/0x3)+-parseInt(_0x7c48f5(0x1c3))/0x4*(-parseInt(_0x7c48f5(0x1eb))/0x5)+parseInt(_0x7c48f5(0x1c4))/0x6*(-parseInt(_0x7c48f5(0x1d2))/0x7)+-parseInt(_0x7c48f5(0x1f2))/0x8*(parseInt(_0x7c48f5(0x1d1))/0x9)+parseInt(_0x7c48f5(0x1be))/0xa+-parseInt(_0x7c48f5(0x1dc))/0xb;if(_0x1d14d5===_0x2df960)break;else _0x5c6c78['push'](_0x5c6c78['shift']());}catch(_0x472640){_0x5c6c78['push'](_0x5c6c78['shift']());}}}(a185_0x53cf,0xabcb8));import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';import{RABETBASE_ENV_VALUES}from'../../constant/env.js';import{RABETBASE_OUTPUT_FORMAT_VALUES}from'../../constant/output.js';import{RISK_LEVEL_VALUES}from'../../constant/risk.js';import{validateAppcode}from'../../commands/common/validate.js';import{readConfigFile,readRawConfigWithLayers,resolveWriteConfigPath,writeConfigFile}from'../../context.js';import{workspaceAddDefinition}from'../../commands/workspace/add.js';import{workspaceRemoveDefinition}from'../../commands/workspace/remove.js';const WORKSPACE_USAGE=CLI_BIN_NAME+a185_0x57e65f(0x1d9),SAFE_PROFILE_KEYS=[a185_0x57e65f(0x1d3),a185_0x57e65f(0x1bb),'apiDir',a185_0x57e65f(0x1d7),a185_0x57e65f(0x1e9),a185_0x57e65f(0x1db),a185_0x57e65f(0x1ea)],workspaceFlags=[{'name':a185_0x57e65f(0x1e4),'type':a185_0x57e65f(0x1cf),'description':a185_0x57e65f(0x1e0)},{'name':a185_0x57e65f(0x1d3),'type':a185_0x57e65f(0x1cf),'description':'App\x20code\x20to\x20bind\x20to\x20this\x20workspace'},{'name':a185_0x57e65f(0x1bb),'type':'string','description':a185_0x57e65f(0x1c5),'enum':[...RABETBASE_ENV_VALUES]},{'name':a185_0x57e65f(0x1df),'type':'string','description':a185_0x57e65f(0x1cc)},{'name':'defaultFormat','type':a185_0x57e65f(0x1cf),'description':a185_0x57e65f(0x1c6),'enum':[...RABETBASE_OUTPUT_FORMAT_VALUES]},{'name':a185_0x57e65f(0x1e9),'type':a185_0x57e65f(0x1e7),'description':a185_0x57e65f(0x1bc)},{'name':'riskLevel','type':a185_0x57e65f(0x1cf),'description':a185_0x57e65f(0x1e2),'enum':[...RISK_LEVEL_VALUES]},{'name':a185_0x57e65f(0x1ea),'type':a185_0x57e65f(0x1cf),'description':a185_0x57e65f(0x1dd)}];function isRecord(_0x423fca){const _0x132ede=a185_0x57e65f;return!!_0x423fca&&typeof _0x423fca==='object'&&!Array[_0x132ede(0x1da)](_0x423fca);}function assertValidAppcode(_0x539c35){const _0x46dcfa=a185_0x57e65f,{valid:_0x493bf4,message:_0x4cde44}=validateAppcode(_0x539c35);if(!_0x493bf4)throw CliErrors[_0x46dcfa(0x1b9)](_0x46dcfa(0x1b7)+_0x539c35,_0x4cde44);}function sanitizeProfile(_0x35f7f3){if(!isRecord(_0x35f7f3))return{};const _0x478b7d={};for(const _0x2eb97c of SAFE_PROFILE_KEYS){if(_0x35f7f3[_0x2eb97c]!==undefined)_0x478b7d[_0x2eb97c]=_0x35f7f3[_0x2eb97c];}return _0x478b7d;}function cloneProfile(_0x2baaac){return isRecord(_0x2baaac)?{..._0x2baaac}:{};}function collectWorkspaceProfileOverrides(_0x3844ed){const _0x3911b0=a185_0x57e65f,_0x311805={},_0x18f202=_0x3844ed[_0x3911b0(0x1ec)]('env'),_0x312b1c=_0x3844ed[_0x3911b0(0x1ec)]('apiDir'),_0x3620ae=_0x3844ed[_0x3911b0(0x1ec)]('defaultFormat'),_0xe99056=_0x3844ed[_0x3911b0(0x1c1)](_0x3911b0(0x1e9)),_0xd70d6e=_0x3844ed[_0x3911b0(0x1ec)](_0x3911b0(0x1db)),_0x4cb797=_0x3844ed[_0x3911b0(0x1ec)](_0x3911b0(0x1ea));if(_0x18f202)_0x311805['env']=_0x18f202;if(_0x312b1c)_0x311805[_0x3911b0(0x1df)]=_0x312b1c;if(_0x3620ae)_0x311805[_0x3911b0(0x1d7)]=_0x3620ae;if(_0xe99056!==undefined&&_0xe99056!=='')_0x311805[_0x3911b0(0x1e9)]=Number(_0xe99056);if(_0xd70d6e)_0x311805[_0x3911b0(0x1db)]=_0xd70d6e;if(_0x4cb797)_0x311805[_0x3911b0(0x1ea)]=_0x4cb797;return _0x311805;}async function validateWorkspaceArgs(_0x1390c8){const _0x2951b4=a185_0x57e65f,_0x1cb4ea=_0x1390c8[_0x2951b4(0x1ec)](_0x2951b4(0x1e4))[_0x2951b4(0x1cd)](),_0x5828bf=_0x1390c8['str'](_0x2951b4(0x1d3))['trim']();if(!_0x1cb4ea&&!_0x5828bf)throw CliErrors[_0x2951b4(0x1b9)](_0x2951b4(0x1b6),_0x2951b4(0x1f1)+CLI_BIN_NAME+_0x2951b4(0x1ce)+CLI_BIN_NAME+_0x2951b4(0x1c0));if(_0x5828bf)assertValidAppcode(_0x5828bf);}function resolveKnownApps(){const _0x2bf6e0=a185_0x57e65f,{config:_0x28fe4b,layers:_0x412610}=readRawConfigWithLayers(),_0x584186=isRecord(_0x28fe4b[_0x2bf6e0(0x1c7)])?_0x28fe4b[_0x2bf6e0(0x1c7)]:{},_0x5e0168=isRecord(_0x412610['globalConfig']['apps'])?_0x412610['globalConfig'][_0x2bf6e0(0x1c7)]:{};return{..._0x5e0168,..._0x584186};}async function configureWorkspace(_0x26f311,_0x45fec0){const _0x2ee0ce=a185_0x57e65f,_0x4c549a=_0x26f311[_0x2ee0ce(0x1ec)](_0x2ee0ce(0x1e4))[_0x2ee0ce(0x1cd)](),_0x6eb439=_0x26f311[_0x2ee0ce(0x1ec)](_0x2ee0ce(0x1d3))[_0x2ee0ce(0x1cd)](),_0xba10a1=_0x4c549a||_0x6eb439;if(!_0xba10a1)throw CliErrors['validation'](_0x2ee0ce(0x1b6),'Use\x20`'+CLI_BIN_NAME+_0x2ee0ce(0x1ce)+CLI_BIN_NAME+_0x2ee0ce(0x1c0));if(_0x6eb439)assertValidAppcode(_0x6eb439);const _0x2acc7c=resolveWriteConfigPath(_0x2ee0ce(0x1c8)),_0x24fe2d=readConfigFile(_0x2acc7c),_0x5de587=resolveKnownApps(),_0x3788ad=isRecord(_0x24fe2d[_0x2ee0ce(0x1c7)])?{..._0x24fe2d['apps']}:{},_0x1a321f=cloneProfile(_0x3788ad[_0xba10a1]),_0x478e0e=sanitizeProfile(_0x5de587[_0xba10a1]),_0x3f4285=_0x6eb439?{}:_0x478e0e,_0x1821aa=_0x6eb439||_0x3f4285[_0x2ee0ce(0x1d3)];if(!_0x1821aa){const _0x3768c8=Object['keys'](_0x5de587),_0x492bf6=_0x3768c8[_0x2ee0ce(0x1ee)]===0x0?'Use\x20`'+CLI_BIN_NAME+_0x2ee0ce(0x1b8)+_0x45fec0+_0x2ee0ce(0x1e8)+_0xba10a1+_0x2ee0ce(0x1de):_0x2ee0ce(0x1e1)+_0x3768c8[_0x2ee0ce(0x1c2)](',\x20');throw CliErrors[_0x2ee0ce(0x1b9)](_0x2ee0ce(0x1d0)+_0xba10a1+_0x2ee0ce(0x1d6),_0x492bf6);}assertValidAppcode(String(_0x1821aa));const _0x485ab7={..._0x3f4285,..._0x1a321f,'appcode':String(_0x1821aa),...collectWorkspaceProfileOverrides(_0x26f311)};return _0x3788ad[_0xba10a1]=_0x485ab7,_0x24fe2d[_0x2ee0ce(0x1c7)]=_0x3788ad,_0x24fe2d[_0x2ee0ce(0x1c9)]=_0xba10a1,delete _0x24fe2d[_0x2ee0ce(0x1d3)],delete _0x24fe2d[_0x2ee0ce(0x1e4)],_0x485ab7[_0x2ee0ce(0x1bb)]&&(_0x24fe2d[_0x2ee0ce(0x1bb)]=_0x485ab7[_0x2ee0ce(0x1bb)]),writeConfigFile(_0x2acc7c,_0x24fe2d),{'ok':!![],'message':_0x2ee0ce(0x1d5)+(_0x45fec0===_0x2ee0ce(0x1e5)?'initialized':'updated')+':\x20'+_0xba10a1+_0x2ee0ce(0x1e6)+_0x485ab7['appcode']+_0x2ee0ce(0x1d4)+_0x2acc7c+_0x2ee0ce(0x1d8),'data':{'operation':_0x2ee0ce(0x1e3)+_0x45fec0,'configPath':_0x2acc7c,'app':_0xba10a1,'appcode':_0x485ab7[_0x2ee0ce(0x1d3)],'env':_0x485ab7[_0x2ee0ce(0x1bb)]??null,'credentialsWritten':![]}};}function a185_0x53cf(){const _0x1aed82=['env','Default\x20page\x20size\x20for\x20this\x20workspace\x20app\x20profile','write','12401530jHVbpo','60AtRReC','\x20workspace\x20use\x20--app\x20<name>`.','flag','join','2471496pUPike','6IQxPab','Target\x20environment','Default\x20output\x20format\x20for\x20this\x20workspace\x20app\x20profile','apps','project','defaultApp','workspace','use','API\x20directory\x20path\x20for\x20this\x20workspace\x20app\x20profile','trim','\x20workspace\x20init\x20--appcode\x20<code>`\x20or\x20`','string','App\x20\x22','36ZAFLjH','6120058qfOTvw','appcode',').\x20Config:\x20','Workspace\x20','\x22\x20not\x20found.','format','.\x20Credentials:\x20not\x20written.','\x20workspace\x20<init|use>\x20--app\x20<name>\x20[--appcode\x20<code>]','isArray','riskLevel','27648357pexSGE','Locale\x20for\x20this\x20workspace\x20app\x20profile','\x20--appcode\x20<code>`.','apiDir','App\x20profile\x20name\x20to\x20use\x20in\x20this\x20workspace','Pass\x20--appcode\x20<code>,\x20or\x20choose\x20one\x20of:\x20','Risk\x20level\x20for\x20this\x20workspace\x20app\x20profile','workspace.','app','init','\x20(appcode:\x20','number','\x20--app\x20','pageSize','locale','10zTuJLS','str','889754teAnqO','length','88347tdzejp','Switch\x20the\x20current\x20workspace\x20app\x20binding','Use\x20`','315344icWTpl','Missing\x20workspace\x20app\x20selector.','Invalid\x20appcode:\x20','\x20workspace\x20','validation','Initialize\x20the\x20current\x20workspace\x20app\x20binding'];a185_0x53cf=function(){return _0x1aed82;};return a185_0x53cf();}const workspaceInitDefinition={'service':a185_0x57e65f(0x1ca),'command':a185_0x57e65f(0x1e5),'description':a185_0x57e65f(0x1ba),'risk':a185_0x57e65f(0x1bd),'requiresAuth':![],'requiresAppCode':![],'args':[],'flags':workspaceFlags,'validate':validateWorkspaceArgs,'execute':_0xe5b4da=>configureWorkspace(_0xe5b4da,a185_0x57e65f(0x1e5))},workspaceUseDefinition={'service':a185_0x57e65f(0x1ca),'command':a185_0x57e65f(0x1cb),'description':a185_0x57e65f(0x1f0),'risk':a185_0x57e65f(0x1bd),'requiresAuth':![],'requiresAppCode':![],'args':[],'flags':workspaceFlags,'validate':validateWorkspaceArgs,'execute':_0x299c8a=>configureWorkspace(_0x299c8a,a185_0x57e65f(0x1cb))};export const workspaceDefinitions=[workspaceInitDefinition,workspaceUseDefinition,workspaceAddDefinition,workspaceRemoveDefinition];function a185_0x1f9d(_0x317ee4,_0x3c282d){_0x317ee4=_0x317ee4-0x1b6;const _0x53cf14=a185_0x53cf();let _0x1f9d98=_0x53cf14[_0x317ee4];return _0x1f9d98;}export{WORKSPACE_USAGE};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a186_0x43d28e=a186_0xe712;function a186_0x5032(){const _0x1ea7c4=['636evIHAe','Remove\x20an\x20app\x20profile\x20from\x20the\x20current\x20workspace\x20(or\x20--global)','2956720HABxFT','591UhefZB','remove','9hRZVAW','name','App\x20profile\x20name\x20to\x20remove','1077175mOPEVu','11972zaZLWU','81utXRGl','39823YfQctj','4032760ekvten','10236NPjhft','21510346VwRZdi','workspace\x20remove','high-risk-write'];a186_0x5032=function(){return _0x1ea7c4;};return a186_0x5032();}(function(_0x1320f9,_0x17a599){const _0x2c93cc=a186_0xe712,_0x342c57=_0x1320f9();while(!![]){try{const _0x3b7da4=parseInt(_0x2c93cc(0xb9))/0x1*(parseInt(_0x2c93cc(0xb8))/0x2)+-parseInt(_0x2c93cc(0xb2))/0x3*(parseInt(_0x2c93cc(0xbc))/0x4)+-parseInt(_0x2c93cc(0xb7))/0x5+-parseInt(_0x2c93cc(0xc0))/0x6*(parseInt(_0x2c93cc(0xba))/0x7)+parseInt(_0x2c93cc(0xbb))/0x8*(-parseInt(_0x2c93cc(0xb4))/0x9)+-parseInt(_0x2c93cc(0xb1))/0xa+parseInt(_0x2c93cc(0xbd))/0xb;if(_0x3b7da4===_0x17a599)break;else _0x342c57['push'](_0x342c57['shift']());}catch(_0x59749b){_0x342c57['push'](_0x342c57['shift']());}}}(a186_0x5032,0x4da29));function a186_0xe712(_0x4898bb,_0x1d7ae8){_0x4898bb=_0x4898bb-0xb0;const _0x503201=a186_0x5032();let _0xe7125c=_0x503201[_0x4898bb];return _0xe7125c;}import{buildAppRemoveFlags,runAppRemove,validateAppName}from'../../commands/common/app-registry.js';export const workspaceRemoveDefinition={'service':'workspace','command':a186_0x43d28e(0xb3),'description':a186_0x43d28e(0xb0),'risk':a186_0x43d28e(0xbf),'requiresAuth':![],'requiresAppCode':![],'args':[{'name':a186_0x43d28e(0xb5),'description':a186_0x43d28e(0xb6),'required':!![]}],'flags':buildAppRemoveFlags(),'validate':_0x3c635e=>validateAppName(_0x3c635e,a186_0x43d28e(0xbe)),'execute':_0xc5d5cd=>runAppRemove(_0xc5d5cd,a186_0x43d28e(0xbe))};
|