@lovrabet/rabetbase-cli 2.3.7-beta.2 → 2.3.7-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/api-doc.js +1 -1
- package/lib/api/fetch-model-list.js +1 -1
- package/lib/api/generate-api-file.js +1 -1
- package/lib/auth/auth-server-ui.js +1 -1
- package/lib/auth/auth-server.js +1 -1
- package/lib/auth/constant.js +1 -1
- package/lib/auth/get-cookie.js +1 -1
- package/lib/auth/get-session-user.js +1 -1
- package/lib/auth/is-session-valid.js +1 -1
- package/lib/auth/login-success-html.js +1 -1
- package/lib/auth/logout.js +1 -1
- package/lib/cli-flags.js +1 -1
- package/lib/cli.js +1 -1
- package/lib/commands/api/generate.js +1 -1
- package/lib/commands/api/index.js +1 -1
- package/lib/commands/api/list.js +1 -1
- package/lib/commands/api/pull.js +1 -1
- package/lib/commands/api/shared.js +1 -1
- package/lib/commands/app/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/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/index.js +1 -1
- package/lib/commands/menu/list.js +1 -1
- package/lib/commands/menu/shared/compare-table.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/service.js +1 -1
- package/lib/commands/menu/shared/sync-core.js +1 -1
- package/lib/commands/menu/shared/update-core.js +1 -1
- package/lib/commands/menu/shared/valid-url.js +1 -1
- package/lib/commands/menu/sync.js +1 -1
- package/lib/commands/menu/update.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/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/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-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/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
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a156_0x2dd8(_0x31847a,_0x4eaa8a){_0x31847a=_0x31847a-0xeb;const _0x6e7b=a156_0x6e7b();let _0x2dd8f0=_0x6e7b[_0x31847a];return _0x2dd8f0;}const a156_0x321b9b=a156_0x2dd8;function a156_0x6e7b(){const _0x4ac191=['sqlcode','sqlCode','6gaOblP','8736539cNKsft','bool','5958603csWnba','966116kWoJhd','detail','appCode','4511416AyTLkq','dbId','Return\x20full\x20raw\x20SQL\x20query\x20object','3034465RmHhDI','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','boolean','472113vdOIlv','read','verbose','3981600LeOKBv','12vaQEHC','2LjsQCx'];a156_0x6e7b=function(){return _0x4ac191;};return a156_0x6e7b();}(function(_0x7f2bc8,_0x17e85e){const _0x3bf83e=a156_0x2dd8,_0x2c1692=_0x7f2bc8();while(!![]){try{const _0x4935c1=parseInt(_0x3bf83e(0xfa))/0x1*(parseInt(_0x3bf83e(0xec))/0x2)+parseInt(_0x3bf83e(0xf5))/0x3*(-parseInt(_0x3bf83e(0xf9))/0x4)+parseInt(_0x3bf83e(0xf2))/0x5+parseInt(_0x3bf83e(0xfd))/0x6*(-parseInt(_0x3bf83e(0xfe))/0x7)+parseInt(_0x3bf83e(0xef))/0x8+parseInt(_0x3bf83e(0xeb))/0x9+-parseInt(_0x3bf83e(0xf8))/0xa;if(_0x4935c1===_0x17e85e)break;else _0x2c1692['push'](_0x2c1692['shift']());}catch(_0x2309b5){_0x2c1692['push'](_0x2c1692['shift']());}}}(a156_0x6e7b,0xa62cd));import{getSqlQueryInfo}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':'sql','command':a156_0x321b9b(0xed),'description':a156_0x321b9b(0xf3),'risk':a156_0x321b9b(0xf6),'flags':[SQLCODE_FLAG,{'name':a156_0x321b9b(0xf7),'type':a156_0x321b9b(0xf4),'description':a156_0x321b9b(0xf1)}],async 'execute'(_0x117bd2){const _0x1bf492=a156_0x321b9b,_0xfde96c=await getSqlQueryInfo(_0x117bd2[_0x1bf492(0xee)],_0x117bd2['str'](_0x1bf492(0xfb))),_0x2906ca=_0x117bd2[_0x1bf492(0xff)](_0x1bf492(0xf7));if(_0x2906ca)return{'ok':!![],'data':_0xfde96c};const _0x2f51b5=_0xfde96c[_0x1bf492(0xf0)]?await getDbName(_0x117bd2['appCode'],_0xfde96c['dbId']):undefined;return{'ok':!![],'data':{'sqlCode':_0xfde96c[_0x1bf492(0xfc)],'sqlName':_0xfde96c['sqlName'],'db':_0x2f51b5?_0x2f51b5+'\x20('+_0xfde96c[_0x1bf492(0xf0)]+')':_0xfde96c['dbId']??'','description':_0xfde96c['description']??'','sqlContent':_0xfde96c['sqlContent']??''}};}};
|
package/lib/commands/sql/exec.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a157_0x34b5(_0x1c89ae,_0x43bd18){_0x1c89ae=_0x1c89ae-0x115;const _0x588a1f=a157_0x588a();let _0x34b531=_0x588a1f[_0x1c89ae];return _0x34b531;}const a157_0x4b99e4=a157_0x34b5;function a157_0x588a(){const _0x2ba749=['sql','14117949OZecQX','length','params','205mbzsOx','5394tJLlaN','3QIFYyR','1735168LOKRbx','11626818SdwxjE','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','3295yBAxep','execSuccess','Returned\x20','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','10567472ztSobK','26138920GPKQDB','SQL\x20execution\x20failed','str','now','isArray','execResult','read','execError','11338rzlsnx','sqlcode','exec'];a157_0x588a=function(){return _0x2ba749;};return a157_0x588a();}(function(_0x5ef81f,_0x381c19){const _0x40cc14=a157_0x34b5,_0x202ebb=_0x5ef81f();while(!![]){try{const _0x371db0=-parseInt(_0x40cc14(0x11d))/0x1*(-parseInt(_0x40cc14(0x116))/0x2)+-parseInt(_0x40cc14(0x11f))/0x3*(-parseInt(_0x40cc14(0x120))/0x4)+-parseInt(_0x40cc14(0x123))/0x5*(-parseInt(_0x40cc14(0x11e))/0x6)+parseInt(_0x40cc14(0x121))/0x7+parseInt(_0x40cc14(0x127))/0x8+-parseInt(_0x40cc14(0x11a))/0x9+-parseInt(_0x40cc14(0x128))/0xa;if(_0x371db0===_0x381c19)break;else _0x202ebb['push'](_0x202ebb['shift']());}catch(_0x2cb0dc){_0x202ebb['push'](_0x202ebb['shift']());}}}(a157_0x588a,0xf1255));import{executeSql}from'../../core/api-client.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';import{parseJsonParams}from'../../utils/params.js';export const sqlExec={'service':a157_0x4b99e4(0x119),'command':a157_0x4b99e4(0x118),'description':a157_0x4b99e4(0x126),'risk':a157_0x4b99e4(0x12e),'flags':[SQLCODE_FLAG,{'name':a157_0x4b99e4(0x11c),'type':'string','description':a157_0x4b99e4(0x122)}],async 'execute'(_0xb80be8){const _0x4fb4c0=a157_0x4b99e4,_0x4ab098=parseJsonParams(_0xb80be8[_0x4fb4c0(0x12a)](_0x4fb4c0(0x11c))),_0x440516=Date['now'](),_0x565a2b=await executeSql(_0xb80be8['appCode'],_0xb80be8['str'](_0x4fb4c0(0x117)),_0x4ab098),_0x2458b7=Date[_0x4fb4c0(0x12b)]()-_0x440516,_0x5f538b=_0x565a2b?.[_0x4fb4c0(0x12d)]??_0x565a2b,_0x454218=_0x565a2b?.[_0x4fb4c0(0x124)]??!![];if(!_0x454218)return{'ok':![],'data':{'error':_0x565a2b?.[_0x4fb4c0(0x115)]||_0x4fb4c0(0x129),'elapsed':_0x2458b7},'message':_0x4fb4c0(0x129)};const _0x40ecdd=Array[_0x4fb4c0(0x12c)](_0x5f538b)?_0x5f538b:[];return{'ok':!![],'data':{'rows':_0x40ecdd,'rowCount':_0x40ecdd[_0x4fb4c0(0x11b)],'elapsed':_0x2458b7},'message':_0x4fb4c0(0x125)+_0x40ecdd[_0x4fb4c0(0x11b)]+'\x20row(s)\x20in\x20'+_0x2458b7+'ms'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x900a59,_0x471632){const _0x3bc484=a158_0x480c,_0x337520=_0x900a59();while(!![]){try{const _0x38fcf3=parseInt(_0x3bc484(0xe3))/0x1+-parseInt(_0x3bc484(0xe4))/0x2+parseInt(_0x3bc484(0xe7))/0x3+-parseInt(_0x3bc484(0xe6))/0x4+-parseInt(_0x3bc484(0xea))/0x5+parseInt(_0x3bc484(0xe8))/0x6*(parseInt(_0x3bc484(0xe5))/0x7)+-parseInt(_0x3bc484(0xeb))/0x8*(-parseInt(_0x3bc484(0xe9))/0x9);if(_0x38fcf3===_0x471632)break;else _0x337520['push'](_0x337520['shift']());}catch(_0x4a80b0){_0x337520['push'](_0x337520['shift']());}}}(a158_0x3148,0xc30d3));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';function a158_0x480c(_0x2636d1,_0x1abcc2){_0x2636d1=_0x2636d1-0xe3;const _0x3148c2=a158_0x3148();let _0x480cc2=_0x3148c2[_0x2636d1];return _0x480cc2;}import{sqlPull}from'../../commands/sql/pull.js';import{sqlCreate}from'../../commands/sql/create.js';import{sqlStatus}from'../../commands/sql/status.js';import{sqlPush}from'../../commands/sql/push.js';function a158_0x3148(){const _0x4fe5be=['6360550RpzDUH','6184sRgeBf','1532922QRAAbm','1224828jgvZVA','705691fbQbjz','5769152XrUbtA','141027DJEwTX','6jKhset','28467MfupvS'];a158_0x3148=function(){return _0x4fe5be;};return a158_0x3148();}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
|
-
const
|
|
1
|
+
const a159_0x203d62=a159_0x1fce;(function(_0x582410,_0x17df07){const _0x1aa812=a159_0x1fce,_0x3cf03d=_0x582410();while(!![]){try{const _0x7c4035=-parseInt(_0x1aa812(0x14a))/0x1*(parseInt(_0x1aa812(0x131))/0x2)+-parseInt(_0x1aa812(0x132))/0x3*(-parseInt(_0x1aa812(0x13e))/0x4)+-parseInt(_0x1aa812(0x12a))/0x5+parseInt(_0x1aa812(0x12e))/0x6*(-parseInt(_0x1aa812(0x140))/0x7)+parseInt(_0x1aa812(0x126))/0x8*(-parseInt(_0x1aa812(0x147))/0x9)+-parseInt(_0x1aa812(0x13a))/0xa+parseInt(_0x1aa812(0x142))/0xb;if(_0x7c4035===_0x17df07)break;else _0x3cf03d['push'](_0x3cf03d['shift']());}catch(_0x4037ef){_0x3cf03d['push'](_0x3cf03d['shift']());}}}(a159_0x14a9,0x33d25));function a159_0x14a9(){const _0x5d7070=['str','sql','appCode','Found\x20','898060oBjwwB','boolean','Filter\x20by\x20SQL\x20name','pagesize','44bIIyZf','map','1603sKPxxy','tableData','8203250xcxOMO','List\x20custom\x20SQL\x20queries','name','string','bool','9ISTcyo','page','No\x20custom\x20SQL\x20queries\x20found.','16787pgOeKF','597832bjDqdE','sqlcode','list','num','1475320SMEyLl','Page\x20number','dbId','totalCount','3900JoEKmo','read','Page\x20size','10CQNrML','43335dPCpMQ','paging','length','sqlCode'];a159_0x14a9=function(){return _0x5d7070;};return a159_0x14a9();}import{listSqlQueries}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a159_0x1fce(_0x1829fb,_0x1d89c4){_0x1829fb=_0x1829fb-0x126;const _0x14a971=a159_0x14a9();let _0x1fce67=_0x14a971[_0x1829fb];return _0x1fce67;}export const sqlList={'service':a159_0x203d62(0x137),'command':a159_0x203d62(0x128),'description':a159_0x203d62(0x143),'risk':a159_0x203d62(0x12f),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a159_0x203d62(0x144),'type':a159_0x203d62(0x145),'description':a159_0x203d62(0x13c)},{'name':a159_0x203d62(0x148),'type':'number','description':a159_0x203d62(0x12b),'default':0x1},{'name':a159_0x203d62(0x13d),'type':'number','description':a159_0x203d62(0x130)},{'name':'verbose','type':a159_0x203d62(0x13b),'description':'Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content'}],async 'execute'(_0x25480b){const _0x3229d0=a159_0x203d62,_0x1e8cd7=await listSqlQueries(_0x25480b[_0x3229d0(0x138)],{'sqlCode':_0x25480b['str'](_0x3229d0(0x127))||undefined,'sqlName':_0x25480b[_0x3229d0(0x136)](_0x3229d0(0x144))||undefined,'currentPage':_0x25480b[_0x3229d0(0x129)](_0x3229d0(0x148)),'pageSize':_0x25480b[_0x3229d0(0x129)]('pagesize',0x32)}),_0x5b5ecc=_0x25480b[_0x3229d0(0x146)]('verbose'),_0x3b115e=_0x1e8cd7[_0x3229d0(0x141)]??[],_0x4326fb=_0x1e8cd7[_0x3229d0(0x133)]?.[_0x3229d0(0x12d)]??_0x3b115e[_0x3229d0(0x134)];let _0x434ef5;return _0x5b5ecc?_0x434ef5=_0x3b115e:_0x434ef5=await Promise['all'](_0x3b115e[_0x3229d0(0x13f)](async _0x15708a=>{const _0x192e65=_0x3229d0;let _0x56d280;try{_0x56d280=_0x15708a['dbId']?await getDbName(_0x25480b[_0x192e65(0x138)],_0x15708a[_0x192e65(0x12c)]):undefined;}catch{}return{'sqlCode':_0x15708a[_0x192e65(0x135)],'sqlName':_0x15708a['sqlName'],'description':_0x15708a['description']??'','db':_0x56d280?_0x56d280+'\x20('+_0x15708a['dbId']+')':_0x15708a['dbId']??''};})),{'ok':!![],'data':_0x434ef5,'message':_0x3b115e[_0x3229d0(0x134)]===0x0?_0x3229d0(0x149):_0x3229d0(0x139)+_0x3b115e[_0x3229d0(0x134)]+'\x20SQL\x20queries\x20(total:\x20'+_0x4326fb+').'};}};
|
package/lib/commands/sql/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function a160_0x447e(_0x6c9441,_0x6ef2a1){_0x6c9441=_0x6c9441-0xa4;const _0x2f5c49=a160_0x2f5c();let _0x447ee3=_0x2f5c49[_0x6c9441];return _0x447ee3;}const a160_0x537a4=a160_0x447e;(function(_0x1d085b,_0xfa8a3d){const _0x5d7956=a160_0x447e,_0x23f542=_0x1d085b();while(!![]){try{const _0xef4a72=-parseInt(_0x5d7956(0xa6))/0x1+-parseInt(_0x5d7956(0xb8))/0x2+parseInt(_0x5d7956(0xaf))/0x3+-parseInt(_0x5d7956(0xb9))/0x4+parseInt(_0x5d7956(0xae))/0x5+-parseInt(_0x5d7956(0xd2))/0x6*(-parseInt(_0x5d7956(0xd4))/0x7)+parseInt(_0x5d7956(0xd0))/0x8;if(_0xef4a72===_0xfa8a3d)break;else _0x23f542['push'](_0x23f542['shift']());}catch(_0x1ae473){_0x23f542['push'](_0x23f542['shift']());}}}(a160_0x2f5c,0xef095));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(_0x50cf63,_0x3ddece){const _0x3024e9=a160_0x447e,_0x1199cc=[];let _0x30e4ea=0x1;while(!![]){const _0x169d00=await listSqlQueries(_0x50cf63,{'currentPage':_0x30e4ea,'pageSize':PAGE_SIZE,'sqlCode':_0x3ddece[_0x3024e9(0xb2)],'sqlName':_0x3ddece[_0x3024e9(0xc1)]}),_0x29b061=_0x169d00[_0x3024e9(0xd9)]??[];_0x1199cc[_0x3024e9(0xdb)](..._0x29b061);if(_0x29b061[_0x3024e9(0xd7)]===0x0)break;const _0x2786f6=_0x169d00['paging']?.[_0x3024e9(0xc9)];if(_0x2786f6!=null?_0x1199cc['length']>=_0x2786f6:_0x29b061[_0x3024e9(0xd7)]<PAGE_SIZE)break;_0x30e4ea++;}return _0x1199cc;}async function ensureSqlContent(_0x388a6a){const _0x19f7cc=a160_0x447e;if(_0x388a6a[_0x19f7cc(0xbf)]!=null&&String(_0x388a6a[_0x19f7cc(0xbf)])[_0x19f7cc(0xd7)]>0x0)return _0x388a6a;return getSqlQueryDetail(_0x388a6a[_0x19f7cc(0xb2)]);}export const sqlPull={'service':a160_0x537a4(0xc8),'command':a160_0x537a4(0xad),'description':a160_0x537a4(0xbe),'risk':'write','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a160_0x537a4(0xb1),'type':a160_0x537a4(0xc7),'description':a160_0x537a4(0xab)},{'name':'force','type':a160_0x537a4(0xdc),'description':'Force\x20overwrite\x20local\x20unsynced\x20changes'}],async 'dryRun'(_0x10110f){const _0x4cd0ee=a160_0x537a4,_0x525c42=loadSqlProjectConfig(_0x10110f['appCode']),_0x34d5b7=await readSqlLockFile(_0x525c42[_0x4cd0ee(0xa8)]),{appLock:_0x438a75}=ensureSqlLockScope(_0x34d5b7??createEmptySqlLock(),_0x525c42[_0x4cd0ee(0xdd)],_0x525c42[_0x4cd0ee(0xa4)],_0x4cd0ee(0xad)),_0x490dcc=await fetchAllSqlQueries(_0x10110f[_0x4cd0ee(0xdd)],{'sqlCode':_0x10110f[_0x4cd0ee(0xbd)](_0x4cd0ee(0xc3))||undefined,'sqlName':_0x10110f[_0x4cd0ee(0xbd)](_0x4cd0ee(0xb1))||undefined}),_0x36e343=[];for(const _0x559e1c of _0x490dcc){const _0x4d5650=await ensureSqlContent(_0x559e1c),_0x16f177=ensureRemoteSqlContent(_0x4d5650),_0x3d32cf=detectModeFromSql(_0x4d5650),_0x55e48d=_0x4d5650[_0x4cd0ee(0xda)]?await getDbName(_0x10110f[_0x4cd0ee(0xdd)],Number(_0x4d5650[_0x4cd0ee(0xda)]))['catch'](()=>undefined):undefined,_0x1e5866=buildLocalSqlFileContent({'sqlCode':_0x4d5650['sqlCode'],'sqlName':_0x4d5650[_0x4cd0ee(0xc1)],'dbId':_0x4d5650[_0x4cd0ee(0xda)]},_0x16f177,{'dbName':_0x55e48d,'mode':_0x3d32cf,'syncedAt':new Date()[_0x4cd0ee(0xc0)](),'description':_0x4d5650[_0x4cd0ee(0xb5)]}),_0x88e7e9=buildSqlLockEntry(_0x4d5650,_0x16f177,'',{'dbName':_0x55e48d}),_0x524eb1=resolveLocalSqlFilePath(_0x525c42,_0x4d5650[_0x4cd0ee(0xb2)],_0x88e7e9);let _0x4aff64=_0x4cd0ee(0xa5),_0x37fed5;if(await fileExists(_0x524eb1)){const _0x18aa69=await readFile(_0x524eb1,_0x4cd0ee(0xca));isEquivalentPulledSqlFile(_0x18aa69,_0x1e5866,_0x3d32cf)?(_0x4aff64='skipped',_0x37fed5='unchanged'):(_0x4aff64=_0x4cd0ee(0xb6),_0x37fed5=_0x4cd0ee(0xb3));}_0x36e343[_0x4cd0ee(0xdb)]({'sqlCode':_0x4d5650[_0x4cd0ee(0xb2)],'sqlName':_0x4d5650[_0x4cd0ee(0xc1)],'filePath':_0x524eb1,'status':_0x4aff64,'reason':_0x37fed5});}return{'method':_0x4cd0ee(0xac),'url':'/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','body':{'appCode':_0x10110f[_0x4cd0ee(0xdd)],'sqlCode':_0x10110f[_0x4cd0ee(0xbd)](_0x4cd0ee(0xc3))||null,'sqlName':_0x10110f[_0x4cd0ee(0xbd)](_0x4cd0ee(0xb1))||null,'files':_0x36e343},'description':_0x4cd0ee(0xba)+_0x36e343[_0x4cd0ee(0xd7)]+_0x4cd0ee(0xcc)+_0x525c42[_0x4cd0ee(0xa7)]};},async 'execute'(_0x506607){const _0x4f9ccb=a160_0x537a4,_0x5a9f9f=loadSqlProjectConfig(_0x506607[_0x4f9ccb(0xdd)]),_0x1608a8=await readSqlLockFile(_0x5a9f9f[_0x4f9ccb(0xa8)]),{lockData:_0x132acc,appLock:_0x368c55}=ensureSqlLockScope(_0x1608a8??createEmptySqlLock(),_0x5a9f9f[_0x4f9ccb(0xdd)],_0x5a9f9f[_0x4f9ccb(0xa4)],_0x4f9ccb(0xad)),_0x26a74a=_0x506607[_0x4f9ccb(0xb4)](_0x4f9ccb(0xb7)),_0x2d50d9=await fetchAllSqlQueries(_0x506607[_0x4f9ccb(0xdd)],{'sqlCode':_0x506607['str'](_0x4f9ccb(0xc3))||undefined,'sqlName':_0x506607[_0x4f9ccb(0xbd)](_0x4f9ccb(0xb1))||undefined});if(_0x2d50d9[_0x4f9ccb(0xd7)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x4f9ccb(0xc5)};const _0x228164=[],_0xd729cf=[];for(const _0x399cc3 of _0x2d50d9){try{_0x228164[_0x4f9ccb(0xdb)](await ensureSqlContent(_0x399cc3));}catch(_0x4a4aa6){_0xd729cf['push']({'sqlCode':_0x399cc3['sqlCode'],'error':_0x4a4aa6 instanceof Error?_0x4a4aa6[_0x4f9ccb(0xaa)]:String(_0x4a4aa6)});}}if(_0x26a74a&&!_0x506607['nonInteractive']){let _0x18ad29=![];for(const _0x401f93 of _0x228164){const _0x28c45a=detectModeFromSql(_0x401f93),_0x979ab7=_0x401f93[_0x4f9ccb(0xda)]?await getDbName(_0x506607[_0x4f9ccb(0xdd)],Number(_0x401f93['dbId']))[_0x4f9ccb(0xde)](()=>undefined):undefined,_0x287c9d=buildLocalSqlFileContent({'sqlCode':_0x401f93['sqlCode'],'sqlName':_0x401f93['sqlName'],'dbId':_0x401f93[_0x4f9ccb(0xda)]},ensureRemoteSqlContent(_0x401f93),{'dbName':_0x979ab7,'mode':_0x28c45a,'syncedAt':new Date()[_0x4f9ccb(0xc0)](),'description':_0x401f93['description']}),_0x536e9d=resolveLocalSqlFilePath(_0x5a9f9f,_0x401f93[_0x4f9ccb(0xb2)],buildSqlLockEntry(_0x401f93,ensureRemoteSqlContent(_0x401f93),'',{'dbName':_0x979ab7}));if(await fileExists(_0x536e9d)){const _0x29c630=await readFile(_0x536e9d,_0x4f9ccb(0xca));if(!isEquivalentPulledSqlFile(_0x29c630,_0x287c9d,_0x28c45a)){_0x18ad29=!![];break;}}}if(_0x18ad29){const _0x366e6b=await confirmForceOverwrite('Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.');if(!_0x366e6b)throw CliErrors['cancelled'](_0x4f9ccb(0xcb));}}const _0x162691=cloneSqlLockData(_0x132acc),_0x5043a1=_0x162691[_0x4f9ccb(0xd6)][_0x5a9f9f[_0x4f9ccb(0xdd)]],_0x127c2b=[],_0x717e72=[];for(const _0x1fe994 of _0x228164){const _0x23a430=_0x5043a1[_0x4f9ccb(0xce)][_0x1fe994['sqlCode']],_0x10a2fd=ensureRemoteSqlContent(_0x1fe994),_0x4ff51a=detectModeFromSql(_0x1fe994),_0x2a0b78=_0x1fe994['dbId']?await getDbName(_0x506607['appCode'],Number(_0x1fe994[_0x4f9ccb(0xda)]))[_0x4f9ccb(0xde)](()=>undefined):undefined,_0x2c8d19=buildLocalSqlFileContent({'sqlCode':_0x1fe994[_0x4f9ccb(0xb2)],'sqlName':_0x1fe994[_0x4f9ccb(0xc1)],'dbId':_0x1fe994[_0x4f9ccb(0xda)]},_0x10a2fd,{'dbName':_0x2a0b78,'mode':_0x4ff51a,'syncedAt':new Date()['toISOString'](),'description':_0x1fe994[_0x4f9ccb(0xb5)]}),_0x2e9e0b=buildSqlLockEntry(_0x1fe994,_0x10a2fd,computeSqlContentHash(_0x2c8d19),{'dbName':_0x2a0b78}),_0x75fdbd=_0x2e9e0b[_0x4f9ccb(0xc6)],_0x27c0a8=join(_0x5a9f9f[_0x4f9ccb(0xa7)],_0x75fdbd);try{if(await fileExists(_0x27c0a8)){const _0x57a39c=await readFile(_0x27c0a8,_0x4f9ccb(0xca));if(isEquivalentPulledSqlFile(_0x57a39c,_0x2c8d19,_0x4ff51a)){_0x717e72['push']({'sqlCode':_0x1fe994[_0x4f9ccb(0xb2)],'reason':_0x4f9ccb(0xcf)}),_0x5043a1[_0x4f9ccb(0xce)][_0x1fe994['sqlCode']]={..._0x2e9e0b,'hash':computeSqlContentHash(_0x57a39c),'path':_0x75fdbd};continue;}if(!_0x26a74a){_0x717e72[_0x4f9ccb(0xdb)]({'sqlCode':_0x1fe994[_0x4f9ccb(0xb2)],'reason':_0x4f9ccb(0xc4)});continue;}}const _0x55396a=_0x23a430?.[_0x4f9ccb(0xc6)]?join(_0x5a9f9f[_0x4f9ccb(0xa7)],_0x23a430[_0x4f9ccb(0xc6)]):undefined;_0x55396a&&_0x55396a!==_0x27c0a8&&await fileExists(_0x55396a)&&await rm(_0x55396a,{'force':!![]}),await ensureParentDirectory(_0x27c0a8),await writeFile(_0x27c0a8,_0x2c8d19,'utf8'),_0x5043a1[_0x4f9ccb(0xce)][_0x1fe994[_0x4f9ccb(0xb2)]]={..._0x2e9e0b,'path':_0x75fdbd},_0x127c2b[_0x4f9ccb(0xdb)]({'sqlCode':_0x1fe994['sqlCode'],'filePath':_0x27c0a8});}catch(_0x2b2193){_0xd729cf[_0x4f9ccb(0xdb)]({'sqlCode':_0x1fe994[_0x4f9ccb(0xb2)],'error':_0x2b2193 instanceof Error?_0x2b2193[_0x4f9ccb(0xaa)]:String(_0x2b2193)});}}return _0x5043a1[_0x4f9ccb(0xd3)]=new Date()[_0x4f9ccb(0xc0)](),await writeSqlLockFile(_0x5a9f9f['lockFilePath'],_0x162691),{'ok':_0xd729cf['length']===0x0,'data':{'pulled':_0x127c2b,'skipped':_0x717e72,'failed':_0xd729cf},'message':_0x4f9ccb(0xb0)+_0x127c2b[_0x4f9ccb(0xd7)]+_0x4f9ccb(0xbc)+_0x717e72[_0x4f9ccb(0xd7)]+_0x4f9ccb(0xbb)+_0xd729cf[_0x4f9ccb(0xd7)]+'\x20failed'};}};function detectModeFromSql(_0x757116){const _0x3744ce=a160_0x537a4,_0x2f46d7=ensureRemoteSqlContent(_0x757116),_0x49b030=stripLocalSqlMetadata(_0x2f46d7,_0x3744ce(0xc2))[_0x3744ce(0xd5)]();if(/^<(select|insert|update|delete)\b/i[_0x3744ce(0xa9)](_0x49b030))return _0x3744ce(0xc2);return _0x3744ce(0xc8);}function isEquivalentPulledSqlFile(_0x3c0b87,_0x558ec3,_0x1779cc){return normalizePullComparableContent(_0x3c0b87,_0x1779cc)===normalizePullComparableContent(_0x558ec3,_0x1779cc);}function a160_0x2f5c(){const _0x20047d=['appCode','catch','sqlRoot','would_pull','893077UqhwVb','sqlRootDir','lockFilePath','test','message','Filter\x20by\x20SQL\x20display\x20name','POST','pull','4066750LyZaMN','2393337QYILGf','Pull\x20complete:\x20','name','sqlCode','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','bool','description','conflict','force','2440762iLPduJ','2423164zdvemd','Would\x20pull\x20','\x20skipped,\x20','\x20written,\x20','str','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','sqlContent','toISOString','sqlName','mybatisXml','sqlcode','local\x20differs\x20from\x20remote','No\x20remote\x20SQL\x20queries\x20matched.','path','string','sql','totalCount','utf8','Force\x20pull\x20cancelled.','\x20SQL\x20file(s)\x20into\x20','split','sqls','unchanged','2860496BSnqIV','filter','462FFFmEu','lastSync','157241bLUnRF','trimStart','apps','length','join','tableData','dbId','push','boolean'];a160_0x2f5c=function(){return _0x20047d;};return a160_0x2f5c();}function normalizePullComparableContent(_0x2259a4,_0x19f453){const _0x517f83=a160_0x537a4,_0x5b280f=_0x2259a4['replace'](/\r\n/g,'\x0a')[_0x517f83(0xcd)]('\x0a'),_0x53519f=_0x5b280f[_0x517f83(0xd1)](_0x1b54f2=>!isSyncedAtMetadataLine(_0x1b54f2,_0x19f453));return _0x53519f[_0x517f83(0xd8)]('\x0a');}function isSyncedAtMetadataLine(_0x82ee15,_0x5e039c){const _0x5567d8=a160_0x537a4;if(_0x5e039c===_0x5567d8(0xc2))return/^\s*<!--\s*@lovrabet\.syncedAt:/['test'](_0x82ee15);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x5567d8(0xa9)](_0x82ee15);}
|
|
1
|
+
const a160_0x468f71=a160_0x388d;function a160_0x388d(_0x116f08,_0x2ad546){_0x116f08=_0x116f08-0x12f;const _0x46dec1=a160_0x46de();let _0x388d33=_0x46dec1[_0x116f08];return _0x388d33;}(function(_0x26ce5e,_0x5c2ed1){const _0x5a1365=a160_0x388d,_0x145a13=_0x26ce5e();while(!![]){try{const _0x26f8a4=-parseInt(_0x5a1365(0x14d))/0x1*(-parseInt(_0x5a1365(0x158))/0x2)+-parseInt(_0x5a1365(0x13e))/0x3+parseInt(_0x5a1365(0x16b))/0x4+-parseInt(_0x5a1365(0x155))/0x5+parseInt(_0x5a1365(0x12f))/0x6+-parseInt(_0x5a1365(0x151))/0x7*(-parseInt(_0x5a1365(0x15b))/0x8)+parseInt(_0x5a1365(0x14e))/0x9*(-parseInt(_0x5a1365(0x132))/0xa);if(_0x26f8a4===_0x5c2ed1)break;else _0x145a13['push'](_0x145a13['shift']());}catch(_0x2dc1d1){_0x145a13['push'](_0x145a13['shift']());}}}(a160_0x46de,0x667dd));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(_0x1c8d01,_0x306f4c){const _0x4b26c9=a160_0x388d,_0x2b9d78=[];let _0x27502e=0x1;while(!![]){const _0xaf744f=await listSqlQueries(_0x1c8d01,{'currentPage':_0x27502e,'pageSize':PAGE_SIZE,'sqlCode':_0x306f4c[_0x4b26c9(0x13c)],'sqlName':_0x306f4c[_0x4b26c9(0x149)]}),_0x56907c=_0xaf744f[_0x4b26c9(0x142)]??[];_0x2b9d78['push'](..._0x56907c);if(_0x56907c[_0x4b26c9(0x13d)]===0x0)break;const _0x2c8286=_0xaf744f[_0x4b26c9(0x167)]?.[_0x4b26c9(0x168)];if(_0x2c8286!=null?_0x2b9d78['length']>=_0x2c8286:_0x56907c[_0x4b26c9(0x13d)]<PAGE_SIZE)break;_0x27502e++;}return _0x2b9d78;}async function ensureSqlContent(_0x1fde8d){const _0xa0e031=a160_0x388d;if(_0x1fde8d[_0xa0e031(0x156)]!=null&&String(_0x1fde8d[_0xa0e031(0x156)])['length']>0x0)return _0x1fde8d;return getSqlQueryDetail(_0x1fde8d['sqlCode']);}export const sqlPull={'service':a160_0x468f71(0x153),'command':a160_0x468f71(0x15c),'description':a160_0x468f71(0x16d),'risk':a160_0x468f71(0x16e),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a160_0x468f71(0x14b),'type':a160_0x468f71(0x148),'description':a160_0x468f71(0x143)},{'name':'force','type':a160_0x468f71(0x15e),'description':a160_0x468f71(0x14a)}],async 'dryRun'(_0x35ef00){const _0x1e0e63=a160_0x468f71,_0x3d2aa7=loadSqlProjectConfig(_0x35ef00['appCode']),_0x42ba2b=await readSqlLockFile(_0x3d2aa7['lockFilePath']),{appLock:_0x34c327}=ensureSqlLockScope(_0x42ba2b??createEmptySqlLock(),_0x3d2aa7[_0x1e0e63(0x16a)],_0x3d2aa7['sqlRoot'],_0x1e0e63(0x15c)),_0x416e05=await fetchAllSqlQueries(_0x35ef00[_0x1e0e63(0x16a)],{'sqlCode':_0x35ef00['str'](_0x1e0e63(0x165))||undefined,'sqlName':_0x35ef00[_0x1e0e63(0x152)](_0x1e0e63(0x14b))||undefined}),_0x58a453=[];for(const _0x5d3057 of _0x416e05){const _0x4748e2=await ensureSqlContent(_0x5d3057),_0x148958=ensureRemoteSqlContent(_0x4748e2),_0x316b1c=detectModeFromSql(_0x4748e2),_0x565a09=_0x4748e2['dbId']?await getDbName(_0x35ef00[_0x1e0e63(0x16a)],Number(_0x4748e2[_0x1e0e63(0x138)]))[_0x1e0e63(0x141)](()=>undefined):undefined,_0x1ead2c=buildLocalSqlFileContent({'sqlCode':_0x4748e2[_0x1e0e63(0x13c)],'sqlName':_0x4748e2[_0x1e0e63(0x149)],'dbId':_0x4748e2[_0x1e0e63(0x138)]},_0x148958,{'dbName':_0x565a09,'mode':_0x316b1c,'syncedAt':new Date()[_0x1e0e63(0x13f)](),'description':_0x4748e2[_0x1e0e63(0x164)]}),_0x1a2983=buildSqlLockEntry(_0x4748e2,_0x148958,'',{'dbName':_0x565a09}),_0x93a7fc=resolveLocalSqlFilePath(_0x3d2aa7,_0x4748e2[_0x1e0e63(0x13c)],_0x1a2983);let _0x3cda44=_0x1e0e63(0x133),_0x197b67;if(await fileExists(_0x93a7fc)){const _0x47e4ae=await readFile(_0x93a7fc,'utf8');isEquivalentPulledSqlFile(_0x47e4ae,_0x1ead2c,_0x316b1c)?(_0x3cda44='skipped',_0x197b67=_0x1e0e63(0x144)):(_0x3cda44=_0x1e0e63(0x14c),_0x197b67=_0x1e0e63(0x145));}_0x58a453[_0x1e0e63(0x15d)]({'sqlCode':_0x4748e2['sqlCode'],'sqlName':_0x4748e2[_0x1e0e63(0x149)],'filePath':_0x93a7fc,'status':_0x3cda44,'reason':_0x197b67});}return{'method':_0x1e0e63(0x157),'url':_0x1e0e63(0x136),'body':{'appCode':_0x35ef00[_0x1e0e63(0x16a)],'sqlCode':_0x35ef00[_0x1e0e63(0x152)]('sqlcode')||null,'sqlName':_0x35ef00[_0x1e0e63(0x152)](_0x1e0e63(0x14b))||null,'files':_0x58a453},'description':'Would\x20pull\x20'+_0x58a453[_0x1e0e63(0x13d)]+'\x20SQL\x20file(s)\x20into\x20'+_0x3d2aa7[_0x1e0e63(0x13b)]};},async 'execute'(_0x18572e){const _0x52f280=a160_0x468f71,_0x3c15da=loadSqlProjectConfig(_0x18572e[_0x52f280(0x16a)]),_0x54d4b9=await readSqlLockFile(_0x3c15da[_0x52f280(0x147)]),{lockData:_0x1231d1,appLock:_0x1b6d9a}=ensureSqlLockScope(_0x54d4b9??createEmptySqlLock(),_0x3c15da['appCode'],_0x3c15da[_0x52f280(0x14f)],_0x52f280(0x15c)),_0x21fd6f=_0x18572e['bool'](_0x52f280(0x140)),_0x398712=await fetchAllSqlQueries(_0x18572e[_0x52f280(0x16a)],{'sqlCode':_0x18572e[_0x52f280(0x152)](_0x52f280(0x165))||undefined,'sqlName':_0x18572e[_0x52f280(0x152)](_0x52f280(0x14b))||undefined});if(_0x398712[_0x52f280(0x13d)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':'No\x20remote\x20SQL\x20queries\x20matched.'};const _0x47ee01=[],_0xa60b7f=[];for(const _0xf47fc of _0x398712){try{_0x47ee01['push'](await ensureSqlContent(_0xf47fc));}catch(_0x5201fc){_0xa60b7f[_0x52f280(0x15d)]({'sqlCode':_0xf47fc[_0x52f280(0x13c)],'error':_0x5201fc instanceof Error?_0x5201fc['message']:String(_0x5201fc)});}}if(_0x21fd6f&&!_0x18572e[_0x52f280(0x150)]){let _0x5962c1=![];for(const _0xd8b38a of _0x47ee01){const _0x4aba01=detectModeFromSql(_0xd8b38a),_0x5a8af5=_0xd8b38a[_0x52f280(0x138)]?await getDbName(_0x18572e[_0x52f280(0x16a)],Number(_0xd8b38a[_0x52f280(0x138)]))[_0x52f280(0x141)](()=>undefined):undefined,_0x45c32b=buildLocalSqlFileContent({'sqlCode':_0xd8b38a[_0x52f280(0x13c)],'sqlName':_0xd8b38a[_0x52f280(0x149)],'dbId':_0xd8b38a[_0x52f280(0x138)]},ensureRemoteSqlContent(_0xd8b38a),{'dbName':_0x5a8af5,'mode':_0x4aba01,'syncedAt':new Date()[_0x52f280(0x13f)](),'description':_0xd8b38a[_0x52f280(0x164)]}),_0x3bdc23=resolveLocalSqlFilePath(_0x3c15da,_0xd8b38a['sqlCode'],buildSqlLockEntry(_0xd8b38a,ensureRemoteSqlContent(_0xd8b38a),'',{'dbName':_0x5a8af5}));if(await fileExists(_0x3bdc23)){const _0x4101ba=await readFile(_0x3bdc23,_0x52f280(0x131));if(!isEquivalentPulledSqlFile(_0x4101ba,_0x45c32b,_0x4aba01)){_0x5962c1=!![];break;}}}if(_0x5962c1){const _0x323602=await confirmForceOverwrite(_0x52f280(0x162));if(!_0x323602)throw CliErrors[_0x52f280(0x161)](_0x52f280(0x135));}}const _0x179587=cloneSqlLockData(_0x1231d1),_0x49f5d8=_0x179587[_0x52f280(0x16c)][_0x3c15da[_0x52f280(0x16a)]],_0xf63ea9=[],_0x25bcec=[];for(const _0x10d05a of _0x47ee01){const _0x1afc71=_0x49f5d8[_0x52f280(0x166)][_0x10d05a[_0x52f280(0x13c)]],_0x5f41f2=ensureRemoteSqlContent(_0x10d05a),_0x150055=detectModeFromSql(_0x10d05a),_0x162cc6=_0x10d05a[_0x52f280(0x138)]?await getDbName(_0x18572e['appCode'],Number(_0x10d05a['dbId']))[_0x52f280(0x141)](()=>undefined):undefined,_0x2d4529=buildLocalSqlFileContent({'sqlCode':_0x10d05a['sqlCode'],'sqlName':_0x10d05a['sqlName'],'dbId':_0x10d05a[_0x52f280(0x138)]},_0x5f41f2,{'dbName':_0x162cc6,'mode':_0x150055,'syncedAt':new Date()[_0x52f280(0x13f)](),'description':_0x10d05a[_0x52f280(0x164)]}),_0x441a72=buildSqlLockEntry(_0x10d05a,_0x5f41f2,computeSqlContentHash(_0x2d4529),{'dbName':_0x162cc6}),_0x5c7bff=_0x441a72[_0x52f280(0x154)],_0x1f01a6=join(_0x3c15da[_0x52f280(0x13b)],_0x5c7bff);try{if(await fileExists(_0x1f01a6)){const _0x171fa5=await readFile(_0x1f01a6,'utf8');if(isEquivalentPulledSqlFile(_0x171fa5,_0x2d4529,_0x150055)){_0x25bcec[_0x52f280(0x15d)]({'sqlCode':_0x10d05a[_0x52f280(0x13c)],'reason':'unchanged'}),_0x49f5d8[_0x52f280(0x166)][_0x10d05a['sqlCode']]={..._0x441a72,'hash':computeSqlContentHash(_0x171fa5),'path':_0x5c7bff};continue;}if(!_0x21fd6f){_0x25bcec[_0x52f280(0x15d)]({'sqlCode':_0x10d05a[_0x52f280(0x13c)],'reason':_0x52f280(0x159)});continue;}}const _0xe9ea77=_0x1afc71?.[_0x52f280(0x154)]?join(_0x3c15da['sqlRootDir'],_0x1afc71[_0x52f280(0x154)]):undefined;_0xe9ea77&&_0xe9ea77!==_0x1f01a6&&await fileExists(_0xe9ea77)&&await rm(_0xe9ea77,{'force':!![]}),await ensureParentDirectory(_0x1f01a6),await writeFile(_0x1f01a6,_0x2d4529,_0x52f280(0x131)),_0x49f5d8[_0x52f280(0x166)][_0x10d05a[_0x52f280(0x13c)]]={..._0x441a72,'path':_0x5c7bff},_0xf63ea9[_0x52f280(0x15d)]({'sqlCode':_0x10d05a[_0x52f280(0x13c)],'filePath':_0x1f01a6});}catch(_0x7a49f0){_0xa60b7f[_0x52f280(0x15d)]({'sqlCode':_0x10d05a[_0x52f280(0x13c)],'error':_0x7a49f0 instanceof Error?_0x7a49f0[_0x52f280(0x16f)]:String(_0x7a49f0)});}}return _0x49f5d8[_0x52f280(0x130)]=new Date()[_0x52f280(0x13f)](),await writeSqlLockFile(_0x3c15da[_0x52f280(0x147)],_0x179587),{'ok':_0xa60b7f[_0x52f280(0x13d)]===0x0,'data':{'pulled':_0xf63ea9,'skipped':_0x25bcec,'failed':_0xa60b7f},'message':_0x52f280(0x137)+_0xf63ea9[_0x52f280(0x13d)]+_0x52f280(0x15f)+_0x25bcec[_0x52f280(0x13d)]+_0x52f280(0x163)+_0xa60b7f[_0x52f280(0x13d)]+_0x52f280(0x13a)};}};function a160_0x46de(){const _0x475090=['write','message','4000182bPuaoo','lastSync','utf8','33910rYjTvh','would_pull','test','Force\x20pull\x20cancelled.','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','Pull\x20complete:\x20','dbId','mybatisXml','\x20failed','sqlRootDir','sqlCode','length','1999749uJQACx','toISOString','force','catch','tableData','Filter\x20by\x20SQL\x20display\x20name','unchanged','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','trimStart','lockFilePath','string','sqlName','Force\x20overwrite\x20local\x20unsynced\x20changes','name','conflict','755rKrsej','360hTgUkR','sqlRoot','nonInteractive','14eCQuWA','str','sql','path','2713580jCVXly','sqlContent','POST','1444bpByhI','local\x20differs\x20from\x20remote','split','234464JyDPOL','pull','push','boolean','\x20written,\x20','replace','cancelled','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','\x20skipped,\x20','description','sqlcode','sqls','paging','totalCount','filter','appCode','1977284zgpUZi','apps','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/'];a160_0x46de=function(){return _0x475090;};return a160_0x46de();}function detectModeFromSql(_0x19d731){const _0x5796a4=a160_0x468f71,_0x54befe=ensureRemoteSqlContent(_0x19d731),_0x2ebd55=stripLocalSqlMetadata(_0x54befe,_0x5796a4(0x139))[_0x5796a4(0x146)]();if(/^<(select|insert|update|delete)\b/i['test'](_0x2ebd55))return'mybatisXml';return _0x5796a4(0x153);}function isEquivalentPulledSqlFile(_0x228ffe,_0x6d7ded,_0x2b5129){return normalizePullComparableContent(_0x228ffe,_0x2b5129)===normalizePullComparableContent(_0x6d7ded,_0x2b5129);}function normalizePullComparableContent(_0x33bad6,_0x58cb5a){const _0x5ecb05=a160_0x468f71,_0x5bf37b=_0x33bad6[_0x5ecb05(0x160)](/\r\n/g,'\x0a')[_0x5ecb05(0x15a)]('\x0a'),_0x35befd=_0x5bf37b[_0x5ecb05(0x169)](_0x371c90=>!isSyncedAtMetadataLine(_0x371c90,_0x58cb5a));return _0x35befd['join']('\x0a');}function isSyncedAtMetadataLine(_0x3f529d,_0xe63565){const _0x50f012=a160_0x468f71;if(_0xe63565===_0x50f012(0x139))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x50f012(0x134)](_0x3f529d);return/^\s*--\s*@lovrabet\.syncedAt:/['test'](_0x3f529d);}
|
package/lib/commands/sql/push.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a161_0x428e6a=a161_0x73b8;(function(_0x292c80,_0x5ead11){const _0x476fc9=a161_0x73b8,_0x4a0ce=_0x292c80();while(!![]){try{const _0x43ad55=parseInt(_0x476fc9(0xe9))/0x1+parseInt(_0x476fc9(0xfc))/0x2+parseInt(_0x476fc9(0xd2))/0x3*(parseInt(_0x476fc9(0xf0))/0x4)+-parseInt(_0x476fc9(0x10c))/0x5+-parseInt(_0x476fc9(0x109))/0x6+parseInt(_0x476fc9(0xd5))/0x7*(parseInt(_0x476fc9(0xf5))/0x8)+-parseInt(_0x476fc9(0xd0))/0x9;if(_0x43ad55===_0x5ead11)break;else _0x4a0ce['push'](_0x4a0ce['shift']());}catch(_0x3e9c15){_0x4a0ce['push'](_0x4a0ce['shift']());}}}(a161_0x397e,0x24acb));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';async function getTargetSqlQueries(_0x24463a,_0x1f6b57,_0x1e6fff){const _0x1072d0=a161_0x73b8,_0x331005=await scanLocalSqlQueries(_0x24463a),_0x5481c8=new Map();for(const _0x362e86 of _0x331005){if(_0x1e6fff&&_0x362e86[_0x1072d0(0xd1)]!==_0x1e6fff)continue;const _0x494d8d=_0x5481c8[_0x1072d0(0x104)](_0x362e86[_0x1072d0(0xd1)])??[];_0x494d8d[_0x1072d0(0xd8)](_0x362e86),_0x5481c8[_0x1072d0(0x102)](_0x362e86['sqlCode'],_0x494d8d);}if(_0x1e6fff&&!_0x5481c8[_0x1072d0(0xef)](_0x1e6fff))throw CliErrors['validation'](_0x1072d0(0xda)+_0x1e6fff);const _0x6b6de7=[];for(const [_0x34d352,_0x2ed44b]of _0x5481c8['entries']()){if(_0x2ed44b['length']===0x1){_0x6b6de7[_0x1072d0(0xd8)](_0x2ed44b[0x0]);continue;}const _0xa8fe6f=_0x1f6b57[_0x1072d0(0x106)][_0x34d352],_0x585c41=_0xa8fe6f?.[_0x1072d0(0xe6)],_0x45c64e=_0x585c41?_0x2ed44b[_0x1072d0(0xf8)](_0x140e80=>_0x140e80[_0x1072d0(0xf4)]!==_0x585c41):_0x2ed44b;if(_0xa8fe6f&&_0x45c64e['length']===0x1){_0x6b6de7[_0x1072d0(0xd8)](_0x45c64e[0x0]);continue;}throw CliErrors[_0x1072d0(0xe2)](_0x1072d0(0xe8)+_0x34d352+_0x1072d0(0xed));}return _0x6b6de7;}export const sqlPush={'service':'sql','command':a161_0x428e6a(0xd8),'description':a161_0x428e6a(0xfa),'risk':a161_0x428e6a(0xfd),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a161_0x428e6a(0xdf),'type':a161_0x428e6a(0xf7),'description':'Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock'}],async 'dryRun'(_0x401101){const _0x116555=a161_0x428e6a,_0x5e5eb6=loadSqlProjectConfig(_0x401101[_0x116555(0xdc)]),_0x41a3e3=await readSqlLockFile(_0x5e5eb6[_0x116555(0x105)]),{appLock:_0x131822}=ensureSqlLockScope(_0x41a3e3??createEmptySqlLock(),_0x401101[_0x116555(0xdc)],_0x5e5eb6['sqlRoot'],_0x116555(0xd8)),_0x521aca=await getTargetSqlQueries(_0x5e5eb6,_0x131822,_0x401101[_0x116555(0xce)](_0x116555(0xcb))||undefined),_0x15d9f0=[];for(const _0x41558c of _0x521aca){const _0x3e3f7a=await computeSqlFileHash(_0x41558c[_0x116555(0xca)]),_0x5c2489=_0x131822[_0x116555(0x106)][_0x41558c[_0x116555(0xd1)]],_0x2439da=!!_0x5c2489&&(_0x5c2489['path']!==_0x41558c['relativePath']||!!_0x41558c['sqlName']&&_0x5c2489[_0x116555(0xfb)]!==_0x41558c[_0x116555(0xfb)]);if(!_0x401101[_0x116555(0xe1)](_0x116555(0xdf))&&_0x5c2489&&_0x5c2489[_0x116555(0xd7)]===_0x3e3f7a&&!_0x2439da)continue;_0x15d9f0[_0x116555(0xd8)](_0x41558c[_0x116555(0xd1)]);}return{'method':_0x116555(0xd9),'url':_0x116555(0x10a),'body':{'sqlCodes':_0x15d9f0,'appCode':_0x401101['appCode']},'description':_0x116555(0xf9)+_0x15d9f0[_0x116555(0xf3)]+_0x116555(0xcd)};},async 'execute'(_0x3eeaa2){const _0x2706a3=a161_0x428e6a,_0x28d4f8=loadSqlProjectConfig(_0x3eeaa2['appCode']),_0x3d46d8=await readSqlLockFile(_0x28d4f8[_0x2706a3(0x105)]),{lockData:_0x54d934,appLock:_0x326fb4}=ensureSqlLockScope(_0x3d46d8??createEmptySqlLock(),_0x3eeaa2['appCode'],_0x28d4f8[_0x2706a3(0xe0)],_0x2706a3(0xd8)),_0x2146c6=await getTargetSqlQueries(_0x28d4f8,_0x326fb4,_0x3eeaa2['str'](_0x2706a3(0xcb))||undefined);if(_0x2146c6[_0x2706a3(0xf3)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x2706a3(0xd3)};const _0x842a15=[],_0x324146=[],_0x2d6449=[];for(const _0x344291 of _0x2146c6){const _0x229f36=_0x326fb4[_0x2706a3(0x106)][_0x344291['sqlCode']];if(!_0x229f36){_0x2d6449['push']({'sqlCode':_0x344291[_0x2706a3(0xd1)],'error':_0x2706a3(0xff)});continue;}try{const _0x46a13e=await computeSqlFileHash(_0x344291[_0x2706a3(0xca)]),_0x45332f=_0x229f36[_0x2706a3(0xe6)]!==_0x344291[_0x2706a3(0xf4)]||!!_0x344291[_0x2706a3(0xfb)]&&_0x229f36[_0x2706a3(0xfb)]!==_0x344291['sqlName'];if(!_0x3eeaa2['bool'](_0x2706a3(0xdf))&&_0x229f36['hash']===_0x46a13e&&!_0x45332f){_0x324146[_0x2706a3(0xd8)]({'sqlCode':_0x344291['sqlCode'],'reason':_0x2706a3(0xee)});continue;}if(_0x229f36[_0x2706a3(0x101)]==null){_0x2d6449[_0x2706a3(0xd8)]({'sqlCode':_0x344291[_0x2706a3(0xd1)],'error':_0x2706a3(0x10d)});continue;}const _0x210d17=await readFile(_0x344291[_0x2706a3(0xca)],'utf8'),_0x5911b9=stripLocalSqlMetadata(_0x210d17,_0x344291['mode']),_0x4ac754=_0x344291[_0x2706a3(0xfb)]||_0x229f36[_0x2706a3(0xfb)],_0x41bee2=await resolveTargetDbBinding(_0x3eeaa2[_0x2706a3(0xdc)],_0x344291,_0x229f36),_0x233c3f=await updateSqlQuery({'id':_0x229f36[_0x2706a3(0xd6)],'appCode':_0x3eeaa2['appCode'],'sqlCode':_0x344291[_0x2706a3(0xd1)],'sqlName':_0x4ac754,'dbId':_0x41bee2[_0x2706a3(0xf2)],'version':_0x229f36['version'],'sqlContent':_0x5911b9,'sqlConfig':_0x229f36[_0x2706a3(0x10b)]??undefined}),_0x11ff48=_0x233c3f['dbId']?await getDbName(_0x3eeaa2[_0x2706a3(0xdc)],Number(_0x233c3f['dbId']))[_0x2706a3(0xe7)](()=>_0x41bee2[_0x2706a3(0xfe)]):_0x41bee2[_0x2706a3(0xfe)];_0x326fb4['sqls'][_0x344291['sqlCode']]={...buildSqlLockEntry(_0x233c3f,_0x5911b9,_0x46a13e,{'dbName':_0x11ff48}),'path':_0x344291['relativePath'],'mode':_0x229f36[_0x2706a3(0xde)]},await archivePreviousSqlFileIfNeeded(_0x28d4f8,_0x229f36[_0x2706a3(0xe6)],_0x344291[_0x2706a3(0xf4)]),_0x842a15[_0x2706a3(0xd8)]({'sqlCode':_0x344291[_0x2706a3(0xd1)],'remoteId':_0x229f36['remoteId']});}catch(_0x4d497c){_0x2d6449[_0x2706a3(0xd8)]({'sqlCode':_0x344291[_0x2706a3(0xd1)],'error':_0x4d497c instanceof Error?_0x4d497c[_0x2706a3(0xeb)]:String(_0x4d497c)});}}return _0x326fb4[_0x2706a3(0x108)]=new Date()[_0x2706a3(0xf6)](),await writeSqlLockFile(_0x28d4f8[_0x2706a3(0x105)],_0x54d934),{'ok':_0x2d6449[_0x2706a3(0xf3)]===0x0,'data':{'pushed':_0x842a15,'skipped':_0x324146,'failed':_0x2d6449},'message':_0x2706a3(0xdb)+_0x842a15[_0x2706a3(0xf3)]+_0x2706a3(0xe5)+_0x324146[_0x2706a3(0xf3)]+_0x2706a3(0xe4)+_0x2d6449[_0x2706a3(0xf3)]+_0x2706a3(0xcf)};}};async function archivePreviousSqlFileIfNeeded(_0xd6882,_0x42b77a,_0x497faa){const _0x58ba52=a161_0x428e6a;if(!_0x42b77a||_0x42b77a===_0x497faa)return;const _0x80f88d=join(_0xd6882[_0x58ba52(0xec)],_0x42b77a);if(!await fileExists(_0x80f88d))return;const _0x23eae6=await moveToTrash(_0xd6882[_0x58ba52(0xdd)],_0xd6882[_0x58ba52(0x103)],_0x80f88d);await cleanupEmptyDirectories(dirname(_0x80f88d),_0xd6882[_0x58ba52(0xec)]),void _0x23eae6;}function a161_0x397e(){const _0xa616c7=['sqlcode','map','\x20SQL\x20file(s)','str','\x20failed','373932NZCAbr','sqlCode','300POxCsJ','No\x20local\x20SQL\x20files\x20found.','\x22\x20for\x20sqlCode\x20','35lwsUNz','remoteId','hash','push','POST','Local\x20SQL\x20not\x20found:\x20','Push\x20complete:\x20','appCode','projectRoot','mode','force','sqlRoot','bool','validation','Local\x20directory\x20\x22','\x20skipped,\x20','\x20pushed,\x20','path','catch','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','291097xIhfdI','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','message','sqlRootDir','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','unchanged','has','4544UXyDJk','exec','dbId','length','relativePath','136ntKMLr','toISOString','boolean','filter','Would\x20push\x20','Push\x20local\x20SQL\x20files\x20to\x20remote','sqlName','48274jmcCOR','high-risk-write','dbName','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','dbDirectory','version','set','trashDir','get','lockFilePath','sqls','isFinite','lastSync','598632YizGAs','/smartapi/custom/updateUserCustomSql','sqlConfig','686900JQgmfG','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','filePath'];a161_0x397e=function(){return _0xa616c7;};return a161_0x397e();}async function moveToTrash(_0x3c450d,_0x73cab1,_0x2f53cc){const _0x4ac236=a161_0x428e6a,_0x3ae4cb=new Date()[_0x4ac236(0xf6)]()['replace'](/[:.]/g,'-'),_0x4cf546=relative(_0x3c450d,_0x2f53cc),_0x2cd00a=join(_0x73cab1,_0x3ae4cb,_0x4cf546);return await mkdir(dirname(_0x2cd00a),{'recursive':!![]}),await rename(_0x2f53cc,_0x2cd00a),_0x2cd00a;}async function cleanupEmptyDirectories(_0x3692be,_0x542ef9){let _0x295b7b=resolve(_0x3692be);const _0x5c835c=resolve(_0x542ef9);while(_0x295b7b['startsWith'](''+_0x5c835c+sep)||_0x295b7b===_0x5c835c){if(_0x295b7b===_0x5c835c)return;try{const _0x8ea353=await readdir(_0x295b7b);if(_0x8ea353['length']>0x0)return;await rmdir(_0x295b7b);}catch{return;}_0x295b7b=dirname(_0x295b7b);}}async function resolveTargetDbBinding(_0x6df8da,_0x3b216a,_0x212407){const _0x5e8b61=a161_0x428e6a,_0x332775=_0x3b216a[_0x5e8b61(0x100)];if(!_0x332775)return{'dbId':_0x212407[_0x5e8b61(0xf2)],'dbName':_0x212407[_0x5e8b61(0xfe)]};const _0x422952=buildDbDirectoryName(_0x212407[_0x5e8b61(0xfe)],_0x212407[_0x5e8b61(0xf2)]);if(_0x332775===_0x422952)return{'dbId':_0x212407[_0x5e8b61(0xf2)],'dbName':_0x212407[_0x5e8b61(0xfe)]};const _0x19f22f=parseExplicitDbDirectory(_0x332775);if(_0x19f22f!=null)return{'dbId':_0x19f22f,'dbName':await getDbName(_0x6df8da,_0x19f22f)['catch'](()=>undefined)};const _0x42517f=await listDatabases(_0x6df8da),_0x4a3cd5=_0x42517f[_0x5e8b61(0xf8)](_0x35e853=>buildDbDirectoryName(_0x35e853['dbName'],_0x35e853[_0x5e8b61(0xf2)])===_0x332775);if(_0x4a3cd5[_0x5e8b61(0xf3)]===0x1)return{'dbId':_0x4a3cd5[0x0][_0x5e8b61(0xf2)],'dbName':_0x4a3cd5[0x0][_0x5e8b61(0xfe)]};if(_0x4a3cd5['length']===0x0)throw CliErrors[_0x5e8b61(0xe2)]('No\x20database\x20matches\x20local\x20directory\x20\x22'+_0x332775+_0x5e8b61(0xd4)+_0x3b216a[_0x5e8b61(0xd1)]+'.');const _0x491fd8=_0x4a3cd5[_0x5e8b61(0xcc)](_0x4b5b0b=>_0x4b5b0b[_0x5e8b61(0xfe)]+'\x20('+_0x4b5b0b[_0x5e8b61(0xf2)]+')')['join'](',\x20');throw CliErrors[_0x5e8b61(0xe2)](_0x5e8b61(0xe3)+_0x332775+_0x5e8b61(0xea)+_0x3b216a[_0x5e8b61(0xd1)]+':\x20'+_0x491fd8);}function a161_0x73b8(_0x5bf747,_0x1395da){_0x5bf747=_0x5bf747-0xca;const _0x397e01=a161_0x397e();let _0x73b8a9=_0x397e01[_0x5bf747];return _0x73b8a9;}function parseExplicitDbDirectory(_0x1d1d48){const _0x357c46=a161_0x428e6a,_0x2e8523=/^db-(\d+)$/[_0x357c46(0xf1)](_0x1d1d48);if(!_0x2e8523)return null;const _0x10741f=Number(_0x2e8523[0x1]);return Number[_0x357c46(0x107)](_0x10741f)&&_0x10741f>0x0?_0x10741f:null;}
|
|
1
|
+
const a161_0x13e976=a161_0x396c;function a161_0x396c(_0x51d1c2,_0x1af4da){_0x51d1c2=_0x51d1c2-0x115;const _0x4eb99e=a161_0x4eb9();let _0x396cfe=_0x4eb99e[_0x51d1c2];return _0x396cfe;}(function(_0x32ec68,_0x401e70){const _0x182304=a161_0x396c,_0x3292ec=_0x32ec68();while(!![]){try{const _0x2ab1c1=-parseInt(_0x182304(0x12e))/0x1+parseInt(_0x182304(0x155))/0x2*(-parseInt(_0x182304(0x115))/0x3)+-parseInt(_0x182304(0x119))/0x4+-parseInt(_0x182304(0x151))/0x5+parseInt(_0x182304(0x134))/0x6+parseInt(_0x182304(0x14e))/0x7+parseInt(_0x182304(0x11b))/0x8;if(_0x2ab1c1===_0x401e70)break;else _0x3292ec['push'](_0x3292ec['shift']());}catch(_0x438454){_0x3292ec['push'](_0x3292ec['shift']());}}}(a161_0x4eb9,0x811a9));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';async function getTargetSqlQueries(_0x4d2487,_0x30547d,_0x4a2b80){const _0x519dd5=a161_0x396c,_0x3f31c2=await scanLocalSqlQueries(_0x4d2487),_0x306505=new Map();for(const _0x241067 of _0x3f31c2){if(_0x4a2b80&&_0x241067[_0x519dd5(0x140)]!==_0x4a2b80)continue;const _0x2c4b60=_0x306505[_0x519dd5(0x13f)](_0x241067[_0x519dd5(0x140)])??[];_0x2c4b60[_0x519dd5(0x157)](_0x241067),_0x306505[_0x519dd5(0x13b)](_0x241067[_0x519dd5(0x140)],_0x2c4b60);}if(_0x4a2b80&&!_0x306505[_0x519dd5(0x137)](_0x4a2b80))throw CliErrors['validation'](_0x519dd5(0x147)+_0x4a2b80);const _0x811500=[];for(const [_0x506fb5,_0x430315]of _0x306505['entries']()){if(_0x430315[_0x519dd5(0x13e)]===0x1){_0x811500[_0x519dd5(0x157)](_0x430315[0x0]);continue;}const _0x114b3f=_0x30547d[_0x519dd5(0x123)][_0x506fb5],_0x220cfb=_0x114b3f?.[_0x519dd5(0x118)],_0x171f55=_0x220cfb?_0x430315[_0x519dd5(0x13c)](_0x13c6f1=>_0x13c6f1[_0x519dd5(0x142)]!==_0x220cfb):_0x430315;if(_0x114b3f&&_0x171f55['length']===0x1){_0x811500['push'](_0x171f55[0x0]);continue;}throw CliErrors[_0x519dd5(0x122)](_0x519dd5(0x131)+_0x506fb5+_0x519dd5(0x14b));}return _0x811500;}export const sqlPush={'service':a161_0x13e976(0x11c),'command':a161_0x13e976(0x157),'description':a161_0x13e976(0x11f),'risk':a161_0x13e976(0x136),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'force','type':a161_0x13e976(0x124),'description':'Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock'}],async 'dryRun'(_0x7ce4a){const _0x420bed=a161_0x13e976,_0x5ab882=loadSqlProjectConfig(_0x7ce4a[_0x420bed(0x12d)]),_0x3c9e29=await readSqlLockFile(_0x5ab882['lockFilePath']),{appLock:_0x15713e}=ensureSqlLockScope(_0x3c9e29??createEmptySqlLock(),_0x7ce4a[_0x420bed(0x12d)],_0x5ab882[_0x420bed(0x143)],_0x420bed(0x157)),_0x521388=await getTargetSqlQueries(_0x5ab882,_0x15713e,_0x7ce4a[_0x420bed(0x128)](_0x420bed(0x150))||undefined),_0x511fa6=[];for(const _0x42abe0 of _0x521388){const _0x126075=await computeSqlFileHash(_0x42abe0[_0x420bed(0x125)]),_0x4f1abf=_0x15713e[_0x420bed(0x123)][_0x42abe0[_0x420bed(0x140)]],_0x4cd2e7=!!_0x4f1abf&&(_0x4f1abf[_0x420bed(0x118)]!==_0x42abe0[_0x420bed(0x142)]||!!_0x42abe0[_0x420bed(0x120)]&&_0x4f1abf[_0x420bed(0x120)]!==_0x42abe0[_0x420bed(0x120)]);if(!_0x7ce4a[_0x420bed(0x146)](_0x420bed(0x117))&&_0x4f1abf&&_0x4f1abf[_0x420bed(0x133)]===_0x126075&&!_0x4cd2e7)continue;_0x511fa6['push'](_0x42abe0[_0x420bed(0x140)]);}return{'method':_0x420bed(0x11a),'url':_0x420bed(0x11e),'body':{'sqlCodes':_0x511fa6,'appCode':_0x7ce4a['appCode']},'description':_0x420bed(0x138)+_0x511fa6[_0x420bed(0x13e)]+_0x420bed(0x149)};},async 'execute'(_0x3887bd){const _0xe8394d=a161_0x13e976,_0x11a2dc=loadSqlProjectConfig(_0x3887bd[_0xe8394d(0x12d)]),_0x552b78=await readSqlLockFile(_0x11a2dc[_0xe8394d(0x132)]),{lockData:_0x1dcc3f,appLock:_0x329194}=ensureSqlLockScope(_0x552b78??createEmptySqlLock(),_0x3887bd[_0xe8394d(0x12d)],_0x11a2dc[_0xe8394d(0x143)],_0xe8394d(0x157)),_0x232f8e=await getTargetSqlQueries(_0x11a2dc,_0x329194,_0x3887bd[_0xe8394d(0x128)](_0xe8394d(0x150))||undefined);if(_0x232f8e[_0xe8394d(0x13e)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0xe8394d(0x12f)};const _0x5a8bbf=[],_0x223dab=[],_0x4406c3=[];for(const _0x262221 of _0x232f8e){const _0x4a03a1=_0x329194[_0xe8394d(0x123)][_0x262221[_0xe8394d(0x140)]];if(!_0x4a03a1){_0x4406c3['push']({'sqlCode':_0x262221[_0xe8394d(0x140)],'error':_0xe8394d(0x13a)});continue;}try{const _0x180543=await computeSqlFileHash(_0x262221[_0xe8394d(0x125)]),_0x36718a=_0x4a03a1['path']!==_0x262221[_0xe8394d(0x142)]||!!_0x262221['sqlName']&&_0x4a03a1[_0xe8394d(0x120)]!==_0x262221[_0xe8394d(0x120)];if(!_0x3887bd[_0xe8394d(0x146)](_0xe8394d(0x117))&&_0x4a03a1[_0xe8394d(0x133)]===_0x180543&&!_0x36718a){_0x223dab[_0xe8394d(0x157)]({'sqlCode':_0x262221[_0xe8394d(0x140)],'reason':_0xe8394d(0x12c)});continue;}if(_0x4a03a1['version']==null){_0x4406c3[_0xe8394d(0x157)]({'sqlCode':_0x262221['sqlCode'],'error':_0xe8394d(0x12a)});continue;}const _0x5287f0=await readFile(_0x262221[_0xe8394d(0x125)],_0xe8394d(0x129)),_0x2d8b35=stripLocalSqlMetadata(_0x5287f0,_0x262221[_0xe8394d(0x141)]),_0x295199=_0x262221[_0xe8394d(0x120)]||_0x4a03a1['sqlName'],_0x1f888c=await resolveTargetDbBinding(_0x3887bd[_0xe8394d(0x12d)],_0x262221,_0x4a03a1),_0x111247=await updateSqlQuery({'id':_0x4a03a1[_0xe8394d(0x153)],'appCode':_0x3887bd[_0xe8394d(0x12d)],'sqlCode':_0x262221[_0xe8394d(0x140)],'sqlName':_0x295199,'dbId':_0x1f888c['dbId'],'version':_0x4a03a1[_0xe8394d(0x13d)],'sqlContent':_0x2d8b35,'sqlConfig':_0x4a03a1[_0xe8394d(0x152)]??undefined}),_0x573063=_0x111247[_0xe8394d(0x11d)]?await getDbName(_0x3887bd['appCode'],Number(_0x111247[_0xe8394d(0x11d)]))['catch'](()=>_0x1f888c['dbName']):_0x1f888c['dbName'];_0x329194[_0xe8394d(0x123)][_0x262221[_0xe8394d(0x140)]]={...buildSqlLockEntry(_0x111247,_0x2d8b35,_0x180543,{'dbName':_0x573063}),'path':_0x262221['relativePath'],'mode':_0x4a03a1[_0xe8394d(0x141)]},await archivePreviousSqlFileIfNeeded(_0x11a2dc,_0x4a03a1[_0xe8394d(0x118)],_0x262221[_0xe8394d(0x142)]),_0x5a8bbf['push']({'sqlCode':_0x262221['sqlCode'],'remoteId':_0x4a03a1[_0xe8394d(0x153)]});}catch(_0x5ea935){_0x4406c3[_0xe8394d(0x157)]({'sqlCode':_0x262221[_0xe8394d(0x140)],'error':_0x5ea935 instanceof Error?_0x5ea935[_0xe8394d(0x116)]:String(_0x5ea935)});}}return _0x329194[_0xe8394d(0x12b)]=new Date()[_0xe8394d(0x144)](),await writeSqlLockFile(_0x11a2dc[_0xe8394d(0x132)],_0x1dcc3f),{'ok':_0x4406c3['length']===0x0,'data':{'pushed':_0x5a8bbf,'skipped':_0x223dab,'failed':_0x4406c3},'message':_0xe8394d(0x145)+_0x5a8bbf[_0xe8394d(0x13e)]+_0xe8394d(0x135)+_0x223dab[_0xe8394d(0x13e)]+'\x20skipped,\x20'+_0x4406c3[_0xe8394d(0x13e)]+_0xe8394d(0x148)};}};async function archivePreviousSqlFileIfNeeded(_0x4546ef,_0x3f4094,_0x4ea82c){const _0x3078a7=a161_0x13e976;if(!_0x3f4094||_0x3f4094===_0x4ea82c)return;const _0x51ef1c=join(_0x4546ef['sqlRootDir'],_0x3f4094);if(!await fileExists(_0x51ef1c))return;const _0x222822=await moveToTrash(_0x4546ef['projectRoot'],_0x4546ef[_0x3078a7(0x14d)],_0x51ef1c);await cleanupEmptyDirectories(dirname(_0x51ef1c),_0x4546ef[_0x3078a7(0x121)]),void _0x222822;}async function moveToTrash(_0x4f1601,_0x1a8079,_0x5c8a8b){const _0x4700a5=a161_0x13e976,_0x35bc04=new Date()[_0x4700a5(0x144)]()['replace'](/[:.]/g,'-'),_0x2d7bb1=relative(_0x4f1601,_0x5c8a8b),_0x32e020=join(_0x1a8079,_0x35bc04,_0x2d7bb1);return await mkdir(dirname(_0x32e020),{'recursive':!![]}),await rename(_0x5c8a8b,_0x32e020),_0x32e020;}async function cleanupEmptyDirectories(_0x51cd64,_0x282eb4){const _0x583c44=a161_0x13e976;let _0x6759fe=resolve(_0x51cd64);const _0x558385=resolve(_0x282eb4);while(_0x6759fe[_0x583c44(0x139)](''+_0x558385+sep)||_0x6759fe===_0x558385){if(_0x6759fe===_0x558385)return;try{const _0x3ff3d8=await readdir(_0x6759fe);if(_0x3ff3d8['length']>0x0)return;await rmdir(_0x6759fe);}catch{return;}_0x6759fe=dirname(_0x6759fe);}}function a161_0x4eb9(){const _0x14d99f=['catch','str','utf8','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','lastSync','unchanged','appCode','452842uAnIBG','No\x20local\x20SQL\x20files\x20found.','No\x20database\x20matches\x20local\x20directory\x20\x22','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','lockFilePath','hash','5325714Qinfnv','\x20pushed,\x20','high-risk-write','has','Would\x20push\x20','startsWith','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','set','filter','version','length','get','sqlCode','mode','relativePath','sqlRoot','toISOString','Push\x20complete:\x20','bool','Local\x20SQL\x20not\x20found:\x20','\x20failed','\x20SQL\x20file(s)','\x22\x20for\x20sqlCode\x20','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','isFinite','trashDir','3248777rzndpo','join','sqlcode','926710QBEDCG','sqlConfig','remoteId','dbName','7526BgzESH','map','push','dbDirectory','699ecGcQX','message','force','path','1789788LZqBPh','POST','9115912XcUUvd','sql','dbId','/smartapi/custom/updateUserCustomSql','Push\x20local\x20SQL\x20files\x20to\x20remote','sqlName','sqlRootDir','validation','sqls','boolean','filePath','exec'];a161_0x4eb9=function(){return _0x14d99f;};return a161_0x4eb9();}async function resolveTargetDbBinding(_0xac1150,_0x47c1b6,_0x4338e2){const _0x57f44e=a161_0x13e976,_0x248220=_0x47c1b6[_0x57f44e(0x158)];if(!_0x248220)return{'dbId':_0x4338e2[_0x57f44e(0x11d)],'dbName':_0x4338e2[_0x57f44e(0x154)]};const _0x30604=buildDbDirectoryName(_0x4338e2[_0x57f44e(0x154)],_0x4338e2['dbId']);if(_0x248220===_0x30604)return{'dbId':_0x4338e2[_0x57f44e(0x11d)],'dbName':_0x4338e2['dbName']};const _0x4de272=parseExplicitDbDirectory(_0x248220);if(_0x4de272!=null)return{'dbId':_0x4de272,'dbName':await getDbName(_0xac1150,_0x4de272)[_0x57f44e(0x127)](()=>undefined)};const _0x1c7342=await listDatabases(_0xac1150),_0xe68b49=_0x1c7342[_0x57f44e(0x13c)](_0x1e24ed=>buildDbDirectoryName(_0x1e24ed[_0x57f44e(0x154)],_0x1e24ed[_0x57f44e(0x11d)])===_0x248220);if(_0xe68b49[_0x57f44e(0x13e)]===0x1)return{'dbId':_0xe68b49[0x0][_0x57f44e(0x11d)],'dbName':_0xe68b49[0x0][_0x57f44e(0x154)]};if(_0xe68b49[_0x57f44e(0x13e)]===0x0)throw CliErrors[_0x57f44e(0x122)](_0x57f44e(0x130)+_0x248220+_0x57f44e(0x14a)+_0x47c1b6['sqlCode']+'.');const _0x17f0c4=_0xe68b49[_0x57f44e(0x156)](_0x17856f=>_0x17856f['dbName']+'\x20('+_0x17856f[_0x57f44e(0x11d)]+')')[_0x57f44e(0x14f)](',\x20');throw CliErrors[_0x57f44e(0x122)]('Local\x20directory\x20\x22'+_0x248220+'\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20'+_0x47c1b6[_0x57f44e(0x140)]+':\x20'+_0x17f0c4);}function parseExplicitDbDirectory(_0x31e49f){const _0x4e629c=a161_0x13e976,_0x208261=/^db-(\d+)$/[_0x4e629c(0x126)](_0x31e49f);if(!_0x208261)return null;const _0x2ac872=Number(_0x208261[0x1]);return Number[_0x4e629c(0x14c)](_0x2ac872)&&_0x2ac872>0x0?_0x2ac872:null;}
|
package/lib/commands/sql/save.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a162_0x27ddac=a162_0x9277;function a162_0x9277(_0x5275d1,_0x3982dd){_0x5275d1=_0x5275d1-0x176;const _0x5d0bb2=a162_0x5d0b();let _0x927701=_0x5d0bb2[_0x5275d1];return _0x927701;}(function(_0x1b4ad5,_0x3a5705){const _0x54c21f=a162_0x9277,_0x18c70e=_0x1b4ad5();while(!![]){try{const _0x14fc9a=-parseInt(_0x54c21f(0x177))/0x1+parseInt(_0x54c21f(0x17f))/0x2*(-parseInt(_0x54c21f(0x184))/0x3)+-parseInt(_0x54c21f(0x176))/0x4+parseInt(_0x54c21f(0x17c))/0x5+-parseInt(_0x54c21f(0x180))/0x6*(parseInt(_0x54c21f(0x179))/0x7)+-parseInt(_0x54c21f(0x188))/0x8+-parseInt(_0x54c21f(0x186))/0x9*(-parseInt(_0x54c21f(0x17e))/0xa);if(_0x14fc9a===_0x3a5705)break;else _0x18c70e['push'](_0x18c70e['shift']());}catch(_0x21c3bd){_0x18c70e['push'](_0x18c70e['shift']());}}}(a162_0x5d0b,0x8edad));import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';const SQL_SAVE_DEPRECATED_HINT=['`rabetbase\x20sql\x20save`\x20has\x20been\x20deprecated.',a162_0x27ddac(0x178),a162_0x27ddac(0x17a)][a162_0x27ddac(0x17d)]('\x0a');function a162_0x5d0b(){const _0x51c7c3=['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`.','sqlname','2202030pEDPWG','join','300qRBFPS','1147574tvtuKr','6UJozvs','Deprecated:\x20use\x20sql\x20create\x20to\x20create\x20and\x20sql\x20push\x20to\x20update','string','description','3uqwgan','file','662049RKXXvd','validation','5339208qYAkuB','Path\x20to\x20the\x20SQL\x20file','save','sql','110872FsQLZv','341407IXgLBT','Create\x20new\x20SQL\x20with\x20`rabetbase\x20sql\x20create\x20--name\x20<name>\x20--db-id\x20<id>\x20--mode\x20sql|mybatisXml`.','3162530NnNoLw'];a162_0x5d0b=function(){return _0x51c7c3;};return a162_0x5d0b();}export const sqlSave={'service':a162_0x27ddac(0x18b),'command':a162_0x27ddac(0x18a),'description':a162_0x27ddac(0x181),'risk':'write','requiresAuth':![],'requiresAppCode':![],'flags':[{'name':a162_0x27ddac(0x185),'type':a162_0x27ddac(0x182),'required':!![],'description':a162_0x27ddac(0x189)},SQLCODE_FLAG_OPTIONAL,{'name':a162_0x27ddac(0x17b),'type':a162_0x27ddac(0x182),'description':'SQL\x20query\x20display\x20name'},{'name':'db','type':a162_0x27ddac(0x182),'description':'Target\x20database\x20—\x20accepts\x20a\x20numeric\x20ID\x20or\x20database\x20name\x20(e.g.\x20ecommerce_db)'},{'name':a162_0x27ddac(0x183),'type':a162_0x27ddac(0x182),'description':'Query\x20description'}],async 'validate'(){const _0x1bc6e7=a162_0x27ddac;throw CliErrors[_0x1bc6e7(0x187)](SQL_SAVE_DEPRECATED_HINT);},async 'execute'(){const _0x15ad7f=a162_0x27ddac;throw CliErrors[_0x15ad7f(0x187)](SQL_SAVE_DEPRECATED_HINT);}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a163_0x37e93d=a163_0x3d83;(function(_0x37d41e,_0x42544c){const _0x3774b1=a163_0x3d83,_0x5b4687=_0x37d41e();while(!![]){try{const _0x411ab6=parseInt(_0x3774b1(0x1cf))/0x1*(-parseInt(_0x3774b1(0x1e3))/0x2)+-parseInt(_0x3774b1(0x1e2))/0x3+-parseInt(_0x3774b1(0x1c4))/0x4+-parseInt(_0x3774b1(0x1ea))/0x5*(-parseInt(_0x3774b1(0x1dc))/0x6)+-parseInt(_0x3774b1(0x1d8))/0x7+parseInt(_0x3774b1(0x1df))/0x8*(-parseInt(_0x3774b1(0x1c6))/0x9)+-parseInt(_0x3774b1(0x1d6))/0xa*(-parseInt(_0x3774b1(0x1d0))/0xb);if(_0x411ab6===_0x42544c)break;else _0x5b4687['push'](_0x5b4687['shift']());}catch(_0x4cfecd){_0x5b4687['push'](_0x5b4687['shift']());}}}(a163_0x1963,0xb67b4));import{createInterface}from'node:readline';function a163_0x1963(){const _0x5b609e=['1033080JeFdaf','toLowerCase','sqlName','1887591FMbYGA','710FdRRAV','syncedAt','stderr','yes','entries','lastSync','dbId','5IsjtvS','sqlRoot','endsWith','mode','trimStart','2218724zFDbEc','question','81ZHVEPz','\x20-->','map','fromEntries','sqlConfig','sqlContent','--\x20@lovrabet.','description','length','2381ARanRf','11SyJOmF','.rabetbase/sql','\x20[y/N]\x20','push','filter','<!--\x20@lovrabet.','37759900ShYTnY','sqlCode','2383101ImFlEX','join','test','dbName','3019470gVzaBo','trim','apps'];a163_0x1963=function(){return _0x5b609e;};return a163_0x1963();}import{join}from'node:path';import{buildDefaultSqlFileName,buildSqlRelativePath,detectSqlMode}from'../../core/sql-sync/utils.js';export const SQL_LOCAL_REL_DIR=a163_0x37e93d(0x1d1);function a163_0x3d83(_0x5a1a71,_0x3b0c65){_0x5a1a71=_0x5a1a71-0x1c0;const _0x1963a0=a163_0x1963();let _0x3d833c=_0x1963a0[_0x5a1a71];return _0x3d833c;}export function buildSqlLockEntry(_0x2aafba,_0x35e382,_0xed269f,_0x5d88fd){const _0x232ab0=a163_0x37e93d,_0x2ef2ca=detectSqlMode(_0x35e382);return{'path':buildSqlRelativePath(_0x2aafba[_0x232ab0(0x1d7)],_0x2aafba[_0x232ab0(0x1e1)],_0x5d88fd?.[_0x232ab0(0x1db)],_0x2ef2ca,_0x2aafba[_0x232ab0(0x1e9)]),'hash':_0xed269f,'remoteId':_0x2aafba['id'],'version':_0x2aafba['version'],'dbId':Number(_0x2aafba[_0x232ab0(0x1e9)]),'dbName':_0x5d88fd?.['dbName'],'sqlName':_0x2aafba[_0x232ab0(0x1e1)],'sqlConfig':_0x2aafba[_0x232ab0(0x1ca)]??undefined,'mode':_0x2ef2ca};}export function cloneSqlLockData(_0x61d583){const _0x534c90=a163_0x37e93d;return{'apps':Object[_0x534c90(0x1c9)](Object[_0x534c90(0x1e7)](_0x61d583[_0x534c90(0x1de)])[_0x534c90(0x1c8)](([_0xe55046,_0x5ed09d])=>[_0xe55046,{'sqlRoot':_0x5ed09d[_0x534c90(0x1c0)],'lastSync':_0x5ed09d[_0x534c90(0x1e8)],'sqls':{..._0x5ed09d['sqls']}}]))};}export function ensureRemoteSqlContent(_0x4e1953){const _0x112658=a163_0x37e93d;return _0x4e1953[_0x112658(0x1cb)]??'';}export function buildLocalSqlFileContent(_0x16e422,_0x4f3fa9,_0x51f9b0){const _0x362710=a163_0x37e93d,_0x4c649c=_0x51f9b0?.[_0x362710(0x1c2)]??detectSqlMode(_0x4f3fa9),_0x13d198=stripLocalSqlMetadata(_0x4f3fa9,_0x4c649c)[_0x362710(0x1dd)](),_0x30d4b1=[...buildMetadataHeaderLines({'sqlCode':_0x16e422['sqlCode'],'sqlName':_0x16e422[_0x362710(0x1e1)],'dbId':_0x16e422[_0x362710(0x1e9)],'dbName':_0x51f9b0?.['dbName'],'mode':_0x4c649c,'syncedAt':_0x51f9b0?.[_0x362710(0x1e4)],'description':_0x51f9b0?.[_0x362710(0x1cd)]},_0x4c649c),'',_0x13d198],_0x1f9c2a=_0x30d4b1[_0x362710(0x1d9)]('\x0a');return _0x1f9c2a[_0x362710(0x1c1)]('\x0a')?_0x1f9c2a:_0x1f9c2a+'\x0a';}export function stripLocalSqlMetadata(_0x4b8f1b,_0x57992c){const _0x42ae57=a163_0x37e93d,_0x707214=_0x4b8f1b['replace'](/\r\n/g,'\x0a')['split']('\x0a'),_0x825bc=[];let _0x248797=0x0;if(_0x57992c==='mybatisXml')while(_0x248797<_0x707214['length']){const _0x3703d2=_0x707214[_0x248797]??'';if(/^\s*<!--\s*@lovrabet\./[_0x42ae57(0x1da)](_0x3703d2)){_0x248797++;continue;}if(_0x3703d2['trim']()===''&&_0x248797>0x0){_0x248797++;continue;}break;}else while(_0x248797<_0x707214[_0x42ae57(0x1ce)]){const _0x30083a=_0x707214[_0x248797]??'';if(/^\s*--\s*@lovrabet\./[_0x42ae57(0x1da)](_0x30083a)){_0x248797++;continue;}if(_0x30083a[_0x42ae57(0x1dd)]()===''&&_0x248797>0x0){_0x248797++;continue;}break;}for(;_0x248797<_0x707214[_0x42ae57(0x1ce)];_0x248797++){_0x825bc[_0x42ae57(0x1d3)](_0x707214[_0x248797]);}return _0x825bc[_0x42ae57(0x1d9)]('\x0a')[_0x42ae57(0x1c3)]();}export function resolveSqlMode(_0x4b6a7b,_0x28c096){const _0x1f2481=a163_0x37e93d;if(_0x28c096?.[_0x1f2481(0x1c2)])return _0x28c096[_0x1f2481(0x1c2)];return detectSqlMode(_0x4b6a7b);}export function resolveSqlFileName(_0x250987,_0x373128,_0x596f45){const _0x405a77=a163_0x37e93d;if(_0x596f45?.['path'])return _0x596f45['path'];if(_0x596f45?.[_0x405a77(0x1e1)]||_0x596f45?.[_0x405a77(0x1db)])return buildSqlRelativePath(_0x250987,_0x596f45?.['sqlName'],_0x596f45?.[_0x405a77(0x1db)],resolveSqlMode(_0x373128,_0x596f45),_0x596f45?.[_0x405a77(0x1e9)]);return buildDefaultSqlFileName(_0x250987,resolveSqlMode(_0x373128,_0x596f45));}export function resolveSqlLocalDir(_0x3ee810,_0x56b4ab){return join(_0x3ee810,SQL_LOCAL_REL_DIR,_0x56b4ab);}export async function confirmForceOverwrite(_0x1d85a3){const _0x4efb4e=a163_0x37e93d,_0x455b23=createInterface({'input':process['stdin'],'output':process[_0x4efb4e(0x1e5)]}),_0x313a5e=await new Promise(_0x315b4e=>{const _0x13be39=_0x4efb4e;_0x455b23[_0x13be39(0x1c5)](_0x1d85a3+_0x13be39(0x1d2),_0x315b4e);});return _0x455b23['close'](),['y',_0x4efb4e(0x1e6)]['includes'](_0x313a5e[_0x4efb4e(0x1dd)]()[_0x4efb4e(0x1e0)]());}export function findSqlLockScope(_0xbd5218,_0x2e8c76){const _0x36ef12=a163_0x37e93d;return _0xbd5218[_0x36ef12(0x1de)][_0x2e8c76];}function buildMetadataHeaderLines(_0x528cc6,_0x54a2c5){const _0x448277=a163_0x37e93d,_0x5e9445=[[_0x448277(0x1d7),_0x528cc6[_0x448277(0x1d7)]],[_0x448277(0x1e1),_0x528cc6['sqlName']],[_0x448277(0x1e9),_0x528cc6[_0x448277(0x1e9)]],[_0x448277(0x1db),_0x528cc6[_0x448277(0x1db)]],[_0x448277(0x1c2),_0x528cc6[_0x448277(0x1c2)]],[_0x448277(0x1e4),_0x528cc6['syncedAt']],[_0x448277(0x1cd),_0x528cc6['description']]];if(_0x54a2c5==='mybatisXml')return _0x5e9445[_0x448277(0x1d4)](([,_0x2548eb])=>_0x2548eb!==undefined&&_0x2548eb!==null&&String(_0x2548eb)['trim']()!=='')[_0x448277(0x1c8)](([_0x3dc3f6,_0x59f00b])=>_0x448277(0x1d5)+_0x3dc3f6+':\x20'+String(_0x59f00b)+_0x448277(0x1c7));return _0x5e9445['filter'](([,_0x1a16cf])=>_0x1a16cf!==undefined&&_0x1a16cf!==null&&String(_0x1a16cf)[_0x448277(0x1dd)]()!=='')[_0x448277(0x1c8)](([_0x5d189e,_0x2ef62f])=>_0x448277(0x1cc)+_0x5d189e+':\x20'+String(_0x2ef62f));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a164_0x30a0cd=a164_0x1866;(function(_0x2c39a4,_0x37faa4){const _0x1d3902=a164_0x1866,_0x771428=_0x2c39a4();while(!![]){try{const _0x16691b=parseInt(_0x1d3902(0x9b))/0x1+-parseInt(_0x1d3902(0x95))/0x2*(parseInt(_0x1d3902(0x7f))/0x3)+-parseInt(_0x1d3902(0x88))/0x4+-parseInt(_0x1d3902(0x9d))/0x5+parseInt(_0x1d3902(0x94))/0x6*(-parseInt(_0x1d3902(0x9c))/0x7)+-parseInt(_0x1d3902(0x92))/0x8+parseInt(_0x1d3902(0x89))/0x9;if(_0x16691b===_0x37faa4)break;else _0x771428['push'](_0x771428['shift']());}catch(_0x394353){_0x771428['push'](_0x771428['shift']());}}}(a164_0x4583,0x9827a));import{listSqlQueries}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile}from'../../core/sql-sync/lock.js';function a164_0x1866(_0x931e96,_0x1d173e){_0x931e96=_0x931e96-0x7d;const _0x4583ff=a164_0x4583();let _0x1866a6=_0x4583ff[_0x931e96];return _0x1866a6;}const PAGE_SIZE=0x64;function a164_0x4583(){const _0x498cd5=['8855288UrQkhz','totalCount','105654iezlhE','13926OTYraO','remote','Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','has','push','All\x20SQL\x20queries\x20are\x20in\x20sync.','107087dWrVDC','161oxekdy','5525145nUxVqu','map','sqlName','\x20added,\x20','18HPNahx','read','bool','filePath','status','path','sqls','sqlCode','paging','3460456mMRHYU','36359802zXkYxU','keys','length','appCode','boolean','\x20missing,\x20','lockKey','\x20modified,\x20','\x20remote-only'];a164_0x4583=function(){return _0x498cd5;};return a164_0x4583();}async function fetchAllSqlCodes(_0x399199){const _0x568304=a164_0x1866,_0x664acd=[];let _0x19da7e=0x1;while(!![]){const _0x2d1616=await listSqlQueries(_0x399199,{'currentPage':_0x19da7e,'pageSize':PAGE_SIZE}),_0x324b78=_0x2d1616['tableData']??[];_0x664acd['push'](..._0x324b78[_0x568304(0x9e)](_0x4acfb3=>_0x4acfb3[_0x568304(0x86)]));if(_0x324b78[_0x568304(0x8b)]===0x0)break;const _0x174487=_0x2d1616[_0x568304(0x87)]?.[_0x568304(0x93)];if(_0x174487!=null?_0x664acd[_0x568304(0x8b)]>=_0x174487:_0x324b78[_0x568304(0x8b)]<PAGE_SIZE)break;_0x19da7e++;}return _0x664acd;}export const sqlStatus={'service':'sql','command':a164_0x30a0cd(0x83),'description':a164_0x30a0cd(0x97),'risk':a164_0x30a0cd(0x80),'flags':[{'name':a164_0x30a0cd(0x96),'type':a164_0x30a0cd(0x8d),'description':'Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally'}],async 'execute'(_0x292f26){const _0x23df05=a164_0x30a0cd,_0x4ca636=loadSqlProjectConfig(_0x292f26[_0x23df05(0x8c)]),_0x270b1c=await readSqlLockFile(_0x4ca636['lockFilePath']),{appLock:_0x2bf102}=ensureSqlLockScope(_0x270b1c??createEmptySqlLock(),_0x4ca636[_0x23df05(0x8c)],_0x4ca636['sqlRoot'],_0x23df05(0x83)),_0x3705e0=await scanLocalSqlQueries(_0x4ca636),_0x4347fb=[],_0x14e48a=[],_0x5d6b95=[],_0x39da5d=[],_0x541053=new Set(_0x3705e0[_0x23df05(0x9e)](_0x3dad84=>_0x3dad84[_0x23df05(0x8f)]));for(const _0x437b1f of _0x3705e0){const _0x3ea90a=await computeSqlFileHash(_0x437b1f[_0x23df05(0x82)]),_0x4049f5=_0x2bf102[_0x23df05(0x85)][_0x437b1f[_0x23df05(0x8f)]],_0x44ee79=!!_0x4049f5&&_0x4049f5[_0x23df05(0x84)]!==_0x437b1f['relativePath'],_0x5c27c9=!!_0x4049f5&&!!_0x437b1f[_0x23df05(0x7d)]&&_0x4049f5[_0x23df05(0x7d)]!==_0x437b1f[_0x23df05(0x7d)];if(!_0x4049f5)_0x4347fb['push'](_0x437b1f['lockKey']);else _0x4049f5['hash']!==_0x3ea90a||_0x44ee79||_0x5c27c9?_0x14e48a['push'](_0x437b1f[_0x23df05(0x8f)]):_0x5d6b95[_0x23df05(0x99)](_0x437b1f['lockKey']);}for(const _0x36994e of Object[_0x23df05(0x8a)](_0x2bf102[_0x23df05(0x85)])){!_0x541053[_0x23df05(0x98)](_0x36994e)&&_0x39da5d[_0x23df05(0x99)](_0x36994e);}const _0x4d9f57=[];if(_0x292f26[_0x23df05(0x81)]('remote')){const _0xec20c1=await fetchAllSqlCodes(_0x292f26[_0x23df05(0x8c)]);for(const _0x2ab822 of _0xec20c1){!_0x541053['has'](_0x2ab822)&&!_0x2bf102[_0x23df05(0x85)][_0x2ab822]&&_0x4d9f57[_0x23df05(0x99)](_0x2ab822);}}const _0x246402=_0x4347fb['length']===0x0&&_0x14e48a['length']===0x0&&_0x39da5d[_0x23df05(0x8b)]===0x0&&_0x4d9f57[_0x23df05(0x8b)]===0x0;return{'ok':!![],'data':{'added':_0x4347fb,'modified':_0x14e48a,'missing':_0x39da5d,'unchanged':_0x5d6b95,'remoteOnly':_0x4d9f57},'message':_0x246402?_0x23df05(0x9a):_0x4347fb['length']+_0x23df05(0x7e)+_0x14e48a[_0x23df05(0x8b)]+_0x23df05(0x90)+_0x39da5d[_0x23df05(0x8b)]+_0x23df05(0x8e)+_0x5d6b95[_0x23df05(0x8b)]+'\x20unchanged'+(_0x4d9f57[_0x23df05(0x8b)]>0x0?',\x20'+_0x4d9f57[_0x23df05(0x8b)]+_0x23df05(0x91):'')};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a165_0x12e265=a165_0x223c;(function(_0x3d560a,_0x405cb6){const _0x34b2bd=a165_0x223c,_0x1c97c1=_0x3d560a();while(!![]){try{const _0x2eec6b=-parseInt(_0x34b2bd(0x12a))/0x1+-parseInt(_0x34b2bd(0x12c))/0x2+-parseInt(_0x34b2bd(0x132))/0x3*(parseInt(_0x34b2bd(0x13f))/0x4)+parseInt(_0x34b2bd(0x12b))/0x5+parseInt(_0x34b2bd(0x143))/0x6*(parseInt(_0x34b2bd(0x158))/0x7)+parseInt(_0x34b2bd(0x145))/0x8+parseInt(_0x34b2bd(0x140))/0x9;if(_0x2eec6b===_0x405cb6)break;else _0x1c97c1['push'](_0x1c97c1['shift']());}catch(_0x3671d2){_0x1c97c1['push'](_0x1c97c1['shift']());}}}(a165_0x1e48,0x45ad3));import{readFileSync,existsSync}from'node:fs';import{resolve}from'node:path';import{validateSql}from'../../core/sql-validator.js';function a165_0x1e48(){const _0x4b8749=['isDangerous','dbtableConfig','\x22\x20not\x20found\x20in\x20any\x20dataset','validate','Validate\x20SQL\x20content\x20without\x20saving\x20(type\x20detection,\x20parameter\x20extraction,\x20optional\x20schema\x20check)','SQL\x20schema\x20validation','tables','toLowerCase','Table\x20\x22','str','name','string','message','trim','sql','length','1026459xXgYvv','schemas','tableName','get','524724TAEsOp','1970745tYNAWV','803732hbykkt','map','isArray','filter','push','File\x20not\x20found:\x20','1292349ksOTHr','split','schemaWarnings','sqlType','valid','Provide\x20--file\x20or\x20--sql','schema:','cwd','parameters','read','file','validation','isSelectOnly','4lDpgda','6593913ewjexd','reason','utf-8','12sWqIeS','fields','1781504EWwgbd','Inline\x20SQL\x20content\x20to\x20validate\x20(alternative\x20to\x20--file)','type'];a165_0x1e48=function(){return _0x4b8749;};return a165_0x1e48();}function a165_0x223c(_0x6fa7b7,_0x468bb1){_0x6fa7b7=_0x6fa7b7-0x129;const _0x1e48f2=a165_0x1e48();let _0x223c7b=_0x1e48f2[_0x6fa7b7];return _0x223c7b;}import{getDatasetDetail,listDatasets}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{assertDatasetIsDbTableBacked,filterDbTableBackedDatasets}from'../../commands/dataset/capability.js';export const sqlValidate={'service':a165_0x12e265(0x156),'command':a165_0x12e265(0x14b),'description':a165_0x12e265(0x14c),'risk':a165_0x12e265(0x13b),'flags':[{'name':a165_0x12e265(0x13c),'type':a165_0x12e265(0x153),'description':'Path\x20to\x20the\x20SQL\x20file\x20to\x20validate'},{'name':'sql','type':a165_0x12e265(0x153),'description':a165_0x12e265(0x146)},{'name':a165_0x12e265(0x159),'type':a165_0x12e265(0x153),'description':'Comma-separated\x20dataset\x20codes\x20to\x20cross-check\x20table/column\x20names\x20against'}],async 'execute'(_0x2825c6){const _0x26951e=a165_0x12e265,_0x2967e7=_0x2825c6[_0x26951e(0x151)](_0x26951e(0x13c)),_0x2b86de=_0x2825c6[_0x26951e(0x151)](_0x26951e(0x156));if(!_0x2967e7&&!_0x2b86de)throw CliErrors['flagMissing'](_0x26951e(0x13c),_0x26951e(0x137));let _0x2fbd3f;if(_0x2967e7){const _0x16b529=resolve(process[_0x26951e(0x139)](),_0x2967e7);if(!existsSync(_0x16b529))throw CliErrors[_0x26951e(0x13d)](_0x26951e(0x131)+_0x16b529);_0x2fbd3f=readFileSync(_0x16b529,_0x26951e(0x142));}else _0x2fbd3f=_0x2b86de;const _0x36077b=validateSql(_0x2fbd3f),_0x35a417={'valid':_0x36077b['valid'],'sqlType':_0x36077b[_0x26951e(0x135)][_0x26951e(0x147)],'isSelectOnly':_0x36077b[_0x26951e(0x135)][_0x26951e(0x13e)],'isDangerous':_0x36077b[_0x26951e(0x135)][_0x26951e(0x148)],'tables':_0x36077b[_0x26951e(0x14e)],'parameters':_0x36077b[_0x26951e(0x13a)],'message':_0x36077b[_0x26951e(0x154)]};_0x36077b['sqlType'][_0x26951e(0x141)]&&(_0x35a417[_0x26951e(0x141)]=_0x36077b[_0x26951e(0x135)][_0x26951e(0x141)]);const _0x1bbdee=_0x2825c6[_0x26951e(0x151)](_0x26951e(0x159));if(_0x1bbdee&&_0x36077b[_0x26951e(0x136)]){const _0x44ee0d=_0x1bbdee[_0x26951e(0x133)](',')[_0x26951e(0x12d)](_0x1a382d=>_0x1a382d[_0x26951e(0x155)]())[_0x26951e(0x12f)](Boolean),_0x366be4=[],_0x517c5e=filterDbTableBackedDatasets(await listDatasets(_0x2825c6['appCode'])),_0x4dce86=new Map(_0x517c5e['map'](_0x4c8d92=>[_0x4c8d92[_0x26951e(0x149)]?.['tableName']?.[_0x26951e(0x14f)](),_0x4c8d92]));for(const _0x201c76 of _0x36077b[_0x26951e(0x14e)]){const _0x272e57=_0x4dce86[_0x26951e(0x129)](_0x201c76[_0x26951e(0x14f)]());!_0x272e57&&_0x366be4[_0x26951e(0x130)](_0x26951e(0x150)+_0x201c76+_0x26951e(0x14a));}for(const _0x2ed298 of _0x44ee0d){let _0x9916b9;try{_0x9916b9=await getDatasetDetail(_0x2ed298);}catch{_0x366be4[_0x26951e(0x130)]('Dataset\x20\x22'+_0x2ed298+'\x22\x20not\x20found\x20or\x20not\x20accessible');continue;}assertDatasetIsDbTableBacked(_0x9916b9,_0x26951e(0x14d));const _0x401908=Array[_0x26951e(0x12e)](_0x9916b9['fields'])?_0x9916b9[_0x26951e(0x144)]:[],_0x3c7e12=new Set(_0x401908[_0x26951e(0x12d)](_0x18a9dc=>_0x18a9dc[_0x26951e(0x152)]?.[_0x26951e(0x14f)]())),_0xb904e6=_0x9916b9['dbtableConfig']?.[_0x26951e(0x15a)]||_0x9916b9['tableName']||_0x2ed298;_0x35a417[_0x26951e(0x138)+_0xb904e6]={'code':_0x2ed298,'tableName':_0xb904e6,'fieldCount':_0x3c7e12['size'],'fields':Array['from'](_0x3c7e12)};}_0x366be4[_0x26951e(0x157)]>0x0&&(_0x35a417[_0x26951e(0x134)]=_0x366be4);}return{'ok':_0x36077b[_0x26951e(0x136)],'data':_0x35a417,'message':_0x36077b[_0x26951e(0x154)]};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a166_0x5d5a(_0x5a419c,_0x4e4f2f){_0x5a419c=_0x5a419c-0x1ab;const _0x1f8fbc=a166_0x1f8f();let _0x5d5a97=_0x1f8fbc[_0x5a419c];return _0x5d5a97;}function a166_0x1f8f(){const _0xf27e62=['27549zfIBiS','3612266GnyHva','workspace','2343000GFDkFE','100DjFmVb','2105420EWIcPo','workspace\x20add','1EvsGUS','12180879zRjdEn','322380vHTLlr','Register\x20an\x20app\x20profile\x20in\x20the\x20current\x20workspace\x20(or\x20--global)','add','784298OLepCf'];a166_0x1f8f=function(){return _0xf27e62;};return a166_0x1f8f();}const a166_0x3f4573=a166_0x5d5a;(function(_0x2bad48,_0xff6027){const _0x1cb478=a166_0x5d5a,_0x2bcc6c=_0x2bad48();while(!![]){try{const _0x446d69=-parseInt(_0x1cb478(0x1b6))/0x1*(parseInt(_0x1cb478(0x1ae))/0x2)+parseInt(_0x1cb478(0x1af))/0x3*(-parseInt(_0x1cb478(0x1b3))/0x4)+parseInt(_0x1cb478(0x1b4))/0x5+-parseInt(_0x1cb478(0x1ab))/0x6+-parseInt(_0x1cb478(0x1b0))/0x7+-parseInt(_0x1cb478(0x1b2))/0x8+parseInt(_0x1cb478(0x1b7))/0x9;if(_0x446d69===_0xff6027)break;else _0x2bcc6c['push'](_0x2bcc6c['shift']());}catch(_0xc9bd9){_0x2bcc6c['push'](_0x2bcc6c['shift']());}}}(a166_0x1f8f,0x46d64));import{buildAppAddFlags,runAppAdd,validateAppName}from'../../commands/common/app-registry.js';export const workspaceAddDefinition={'service':a166_0x3f4573(0x1b1),'command':a166_0x3f4573(0x1ad),'description':a166_0x3f4573(0x1ac),'risk':'write','requiresAuth':![],'requiresAppCode':![],'args':[{'name':'name','description':'App\x20profile\x20name','required':!![]}],'flags':buildAppAddFlags(),'validate':_0x31a926=>validateAppName(_0x31a926,a166_0x3f4573(0x1b5)),'execute':_0x2e1275=>runAppAdd(_0x2e1275,'workspace\x20add')};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a167_0x4cd2e6=a167_0x34e0;(function(_0x3b13eb,_0x5af733){const _0x2cbedb=a167_0x34e0,_0x245847=_0x3b13eb();while(!![]){try{const _0x4afba0=-parseInt(_0x2cbedb(0x1df))/0x1*(-parseInt(_0x2cbedb(0x1d6))/0x2)+parseInt(_0x2cbedb(0x200))/0x3+-parseInt(_0x2cbedb(0x1f3))/0x4*(parseInt(_0x2cbedb(0x210))/0x5)+-parseInt(_0x2cbedb(0x1ee))/0x6+-parseInt(_0x2cbedb(0x1f4))/0x7*(-parseInt(_0x2cbedb(0x1fe))/0x8)+-parseInt(_0x2cbedb(0x1e5))/0x9*(parseInt(_0x2cbedb(0x1f2))/0xa)+-parseInt(_0x2cbedb(0x1e2))/0xb*(parseInt(_0x2cbedb(0x1f5))/0xc);if(_0x4afba0===_0x5af733)break;else _0x245847['push'](_0x245847['shift']());}catch(_0x29786e){_0x245847['push'](_0x245847['shift']());}}}(a167_0x58d2,0xdaff1));import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';import{RABETBASE_ENV_VALUES}from'../../constant/env.js';import{RABETBASE_OUTPUT_FORMAT_VALUES}from'../../constant/output.js';import{RISK_LEVEL_VALUES}from'../../constant/risk.js';function a167_0x58d2(){const _0x37b818=['\x20workspace\x20<init|use>\x20--app\x20<name>\x20[--appcode\x20<code>]','str','format','flag','appcode','\x20--app\x20','length','2901882WPUKVX','\x20--appcode\x20<code>`.','string','object','70210WUxDqR','1019152CeTXdG','72863wafvnf','10344bfIDbj','defaultFormat','locale','project','globalConfig','Initialize\x20the\x20current\x20workspace\x20app\x20binding','initialized','use','Use\x20`','536hHcfGE','join','4144494IGozLc','Risk\x20level\x20for\x20this\x20workspace\x20app\x20profile','keys',').\x20Config:\x20','\x20workspace\x20use\x20--app\x20<name>`.','apps','App\x20profile\x20name\x20to\x20use\x20in\x20this\x20workspace','trim','Missing\x20workspace\x20app\x20selector.','workspace','Switch\x20the\x20current\x20workspace\x20app\x20binding','riskLevel','Workspace\x20','env','Pass\x20--appcode\x20<code>,\x20or\x20choose\x20one\x20of:\x20','updated','25TTHIpx','Target\x20environment','2UAihyI','Invalid\x20appcode:\x20','app','isArray','write','API\x20directory\x20path\x20for\x20this\x20workspace\x20app\x20profile','validation','Default\x20output\x20format\x20for\x20this\x20workspace\x20app\x20profile','Default\x20page\x20size\x20for\x20this\x20workspace\x20app\x20profile','912539JCIeDe','\x20workspace\x20init\x20--appcode\x20<code>`\x20or\x20`','apiDir','1969uxMMak','pageSize','init','234TizCCq','.\x20Credentials:\x20not\x20written.'];a167_0x58d2=function(){return _0x37b818;};return a167_0x58d2();}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+a167_0x4cd2e6(0x1e7),SAFE_PROFILE_KEYS=['appcode',a167_0x4cd2e6(0x20d),a167_0x4cd2e6(0x1e1),a167_0x4cd2e6(0x1e9),a167_0x4cd2e6(0x1e3),a167_0x4cd2e6(0x20b),a167_0x4cd2e6(0x1f7)],workspaceFlags=[{'name':a167_0x4cd2e6(0x1d8),'type':a167_0x4cd2e6(0x1f0),'description':a167_0x4cd2e6(0x206)},{'name':a167_0x4cd2e6(0x1eb),'type':'string','description':'App\x20code\x20to\x20bind\x20to\x20this\x20workspace'},{'name':a167_0x4cd2e6(0x20d),'type':a167_0x4cd2e6(0x1f0),'description':a167_0x4cd2e6(0x211),'enum':[...RABETBASE_ENV_VALUES]},{'name':a167_0x4cd2e6(0x1e1),'type':'string','description':a167_0x4cd2e6(0x1db)},{'name':'defaultFormat','type':'string','description':a167_0x4cd2e6(0x1dd),'enum':[...RABETBASE_OUTPUT_FORMAT_VALUES]},{'name':a167_0x4cd2e6(0x1e3),'type':'number','description':a167_0x4cd2e6(0x1de)},{'name':a167_0x4cd2e6(0x20b),'type':a167_0x4cd2e6(0x1f0),'description':a167_0x4cd2e6(0x201),'enum':[...RISK_LEVEL_VALUES]},{'name':'locale','type':'string','description':'Locale\x20for\x20this\x20workspace\x20app\x20profile'}];function a167_0x34e0(_0x308e0e,_0x26e3bf){_0x308e0e=_0x308e0e-0x1d6;const _0x58d248=a167_0x58d2();let _0x34e0cc=_0x58d248[_0x308e0e];return _0x34e0cc;}function isRecord(_0x42f02a){const _0x4c5bcc=a167_0x4cd2e6;return!!_0x42f02a&&typeof _0x42f02a===_0x4c5bcc(0x1f1)&&!Array[_0x4c5bcc(0x1d9)](_0x42f02a);}function assertValidAppcode(_0x3c5e10){const _0x5e8c05=a167_0x4cd2e6,{valid:_0x4a157a,message:_0x25bfa5}=validateAppcode(_0x3c5e10);if(!_0x4a157a)throw CliErrors['validation'](_0x5e8c05(0x1d7)+_0x3c5e10,_0x25bfa5);}function sanitizeProfile(_0x3cadab){if(!isRecord(_0x3cadab))return{};const _0x48275b={};for(const _0x2fe611 of SAFE_PROFILE_KEYS){if(_0x3cadab[_0x2fe611]!==undefined)_0x48275b[_0x2fe611]=_0x3cadab[_0x2fe611];}return _0x48275b;}function cloneProfile(_0x1e032a){return isRecord(_0x1e032a)?{..._0x1e032a}:{};}function collectWorkspaceProfileOverrides(_0x1ee6bd){const _0x49dbc6=a167_0x4cd2e6,_0x5883bc={},_0x11b486=_0x1ee6bd[_0x49dbc6(0x1e8)](_0x49dbc6(0x20d)),_0x10a4e6=_0x1ee6bd[_0x49dbc6(0x1e8)]('apiDir'),_0x1c383c=_0x1ee6bd[_0x49dbc6(0x1e8)](_0x49dbc6(0x1f6)),_0x301747=_0x1ee6bd[_0x49dbc6(0x1ea)]('pageSize'),_0x408cdc=_0x1ee6bd[_0x49dbc6(0x1e8)]('riskLevel'),_0x3d9bed=_0x1ee6bd[_0x49dbc6(0x1e8)](_0x49dbc6(0x1f7));if(_0x11b486)_0x5883bc[_0x49dbc6(0x20d)]=_0x11b486;if(_0x10a4e6)_0x5883bc['apiDir']=_0x10a4e6;if(_0x1c383c)_0x5883bc[_0x49dbc6(0x1e9)]=_0x1c383c;if(_0x301747!==undefined&&_0x301747!=='')_0x5883bc[_0x49dbc6(0x1e3)]=Number(_0x301747);if(_0x408cdc)_0x5883bc['riskLevel']=_0x408cdc;if(_0x3d9bed)_0x5883bc[_0x49dbc6(0x1f7)]=_0x3d9bed;return _0x5883bc;}async function validateWorkspaceArgs(_0x1c105d){const _0x191088=a167_0x4cd2e6,_0x506cf5=_0x1c105d[_0x191088(0x1e8)]('app')[_0x191088(0x207)](),_0x5ed580=_0x1c105d[_0x191088(0x1e8)](_0x191088(0x1eb))['trim']();if(!_0x506cf5&&!_0x5ed580)throw CliErrors['validation'](_0x191088(0x208),_0x191088(0x1fd)+CLI_BIN_NAME+_0x191088(0x1e0)+CLI_BIN_NAME+_0x191088(0x204));if(_0x5ed580)assertValidAppcode(_0x5ed580);}function resolveKnownApps(){const _0x2de669=a167_0x4cd2e6,{config:_0x4621b8,layers:_0x57fb61}=readRawConfigWithLayers(),_0x2f529a=isRecord(_0x4621b8[_0x2de669(0x205)])?_0x4621b8[_0x2de669(0x205)]:{},_0x4f285e=isRecord(_0x57fb61[_0x2de669(0x1f9)]['apps'])?_0x57fb61[_0x2de669(0x1f9)][_0x2de669(0x205)]:{};return{..._0x4f285e,..._0x2f529a};}async function configureWorkspace(_0x391920,_0xd8f10a){const _0x381682=a167_0x4cd2e6,_0x28a01b=_0x391920[_0x381682(0x1e8)](_0x381682(0x1d8))[_0x381682(0x207)](),_0x3c9e2d=_0x391920['str'](_0x381682(0x1eb))['trim'](),_0x582158=_0x28a01b||_0x3c9e2d;if(!_0x582158)throw CliErrors[_0x381682(0x1dc)](_0x381682(0x208),_0x381682(0x1fd)+CLI_BIN_NAME+_0x381682(0x1e0)+CLI_BIN_NAME+_0x381682(0x204));if(_0x3c9e2d)assertValidAppcode(_0x3c9e2d);const _0x144f3b=resolveWriteConfigPath(_0x381682(0x1f8)),_0x55b30c=readConfigFile(_0x144f3b),_0x12cdc9=resolveKnownApps(),_0xb3c19d=isRecord(_0x55b30c[_0x381682(0x205)])?{..._0x55b30c[_0x381682(0x205)]}:{},_0x2ab04d=cloneProfile(_0xb3c19d[_0x582158]),_0xa84a93=sanitizeProfile(_0x12cdc9[_0x582158]),_0x4be286=_0x3c9e2d?{}:_0xa84a93,_0x760f88=_0x3c9e2d||_0x4be286[_0x381682(0x1eb)];if(!_0x760f88){const _0x2c40b3=Object[_0x381682(0x202)](_0x12cdc9),_0x5a1d6a=_0x2c40b3[_0x381682(0x1ed)]===0x0?_0x381682(0x1fd)+CLI_BIN_NAME+'\x20workspace\x20'+_0xd8f10a+_0x381682(0x1ec)+_0x582158+_0x381682(0x1ef):_0x381682(0x20e)+_0x2c40b3[_0x381682(0x1ff)](',\x20');throw CliErrors[_0x381682(0x1dc)]('App\x20\x22'+_0x582158+'\x22\x20not\x20found.',_0x5a1d6a);}assertValidAppcode(String(_0x760f88));const _0x4c4d1a={..._0x4be286,..._0x2ab04d,'appcode':String(_0x760f88),...collectWorkspaceProfileOverrides(_0x391920)};return _0xb3c19d[_0x582158]=_0x4c4d1a,_0x55b30c[_0x381682(0x205)]=_0xb3c19d,_0x55b30c['defaultApp']=_0x582158,delete _0x55b30c[_0x381682(0x1eb)],delete _0x55b30c[_0x381682(0x1d8)],_0x4c4d1a['env']&&(_0x55b30c[_0x381682(0x20d)]=_0x4c4d1a[_0x381682(0x20d)]),writeConfigFile(_0x144f3b,_0x55b30c),{'ok':!![],'message':_0x381682(0x20c)+(_0xd8f10a===_0x381682(0x1e4)?_0x381682(0x1fb):_0x381682(0x20f))+':\x20'+_0x582158+'\x20(appcode:\x20'+_0x4c4d1a['appcode']+_0x381682(0x203)+_0x144f3b+_0x381682(0x1e6),'data':{'operation':'workspace.'+_0xd8f10a,'configPath':_0x144f3b,'app':_0x582158,'appcode':_0x4c4d1a[_0x381682(0x1eb)],'env':_0x4c4d1a[_0x381682(0x20d)]??null,'credentialsWritten':![]}};}const workspaceInitDefinition={'service':a167_0x4cd2e6(0x209),'command':a167_0x4cd2e6(0x1e4),'description':a167_0x4cd2e6(0x1fa),'risk':a167_0x4cd2e6(0x1da),'requiresAuth':![],'requiresAppCode':![],'args':[],'flags':workspaceFlags,'validate':validateWorkspaceArgs,'execute':_0x2a142f=>configureWorkspace(_0x2a142f,a167_0x4cd2e6(0x1e4))},workspaceUseDefinition={'service':a167_0x4cd2e6(0x209),'command':a167_0x4cd2e6(0x1fc),'description':a167_0x4cd2e6(0x20a),'risk':a167_0x4cd2e6(0x1da),'requiresAuth':![],'requiresAppCode':![],'args':[],'flags':workspaceFlags,'validate':validateWorkspaceArgs,'execute':_0xa4a2b4=>configureWorkspace(_0xa4a2b4,'use')};export const workspaceDefinitions=[workspaceInitDefinition,workspaceUseDefinition,workspaceAddDefinition,workspaceRemoveDefinition];export{WORKSPACE_USAGE};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a168_0x4079(_0x7022a4,_0x4bac11){_0x7022a4=_0x7022a4-0x75;const _0x3f3a17=a168_0x3f3a();let _0x40793b=_0x3f3a17[_0x7022a4];return _0x40793b;}const a168_0x4dce3b=a168_0x4079;(function(_0x4840c8,_0xe0c50a){const _0x59f9a2=a168_0x4079,_0x231a19=_0x4840c8();while(!![]){try{const _0x3ad7ff=parseInt(_0x59f9a2(0x7e))/0x1+-parseInt(_0x59f9a2(0x83))/0x2+-parseInt(_0x59f9a2(0x76))/0x3*(-parseInt(_0x59f9a2(0x82))/0x4)+-parseInt(_0x59f9a2(0x79))/0x5+-parseInt(_0x59f9a2(0x80))/0x6*(parseInt(_0x59f9a2(0x77))/0x7)+parseInt(_0x59f9a2(0x84))/0x8+-parseInt(_0x59f9a2(0x7c))/0x9*(-parseInt(_0x59f9a2(0x7d))/0xa);if(_0x3ad7ff===_0xe0c50a)break;else _0x231a19['push'](_0x231a19['shift']());}catch(_0x1c1071){_0x231a19['push'](_0x231a19['shift']());}}}(a168_0x3f3a,0xd873a));import{buildAppRemoveFlags,runAppRemove,validateAppName}from'../../commands/common/app-registry.js';export const workspaceRemoveDefinition={'service':'workspace','command':a168_0x4dce3b(0x7f),'description':a168_0x4dce3b(0x7a),'risk':a168_0x4dce3b(0x81),'requiresAuth':![],'requiresAppCode':![],'args':[{'name':a168_0x4dce3b(0x78),'description':a168_0x4dce3b(0x75),'required':!![]}],'flags':buildAppRemoveFlags(),'validate':_0x3f6d0f=>validateAppName(_0x3f6d0f,'workspace\x20remove'),'execute':_0x3e9f75=>runAppRemove(_0x3e9f75,a168_0x4dce3b(0x7b))};function a168_0x3f3a(){const _0x16412a=['workspace\x20remove','116514eVsfTR','730oozIwj','939472yVRcsL','remove','32034qEBCaI','high-risk-write','792xVOwaz','3073014YGTRJL','13216296zPTZvQ','App\x20profile\x20name\x20to\x20remove','1605BhcTWN','525BXzPAU','name','4094895ozgnlw','Remove\x20an\x20app\x20profile\x20from\x20the\x20current\x20workspace\x20(or\x20--global)'];a168_0x3f3a=function(){return _0x16412a;};return a168_0x3f3a();}
|
package/lib/config/schema.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a169_0x324d85=a169_0x300e;(function(_0x4b4537,_0x516bf7){const _0x346677=a169_0x300e,_0x201a3c=_0x4b4537();while(!![]){try{const _0x409bbf=-parseInt(_0x346677(0x14c))/0x1*(-parseInt(_0x346677(0x15b))/0x2)+-parseInt(_0x346677(0x14b))/0x3+parseInt(_0x346677(0x152))/0x4*(parseInt(_0x346677(0x145))/0x5)+parseInt(_0x346677(0x159))/0x6+-parseInt(_0x346677(0x158))/0x7*(-parseInt(_0x346677(0x157))/0x8)+-parseInt(_0x346677(0x14f))/0x9*(-parseInt(_0x346677(0x141))/0xa)+parseInt(_0x346677(0x151))/0xb*(-parseInt(_0x346677(0x14e))/0xc);if(_0x409bbf===_0x516bf7)break;else _0x201a3c['push'](_0x201a3c['shift']());}catch(_0x414968){_0x201a3c['push'](_0x201a3c['shift']());}}}(a169_0x27b9,0x6f43e));import{DEFAULT_CONFIG_VALUES}from'../constant/defaults.js';import{RABETBASE_ENV_VALUES}from'../constant/env.js';function a169_0x27b9(){const _0x117246=['format','pageSize','number','filter','trim','Default\x20output\x20format\x20for\x20this\x20app\x20(profile)','defaultFormat','Risk\x20level','map','cookie','2869540MyVtMZ','length','has','entries','915xIeQKu','apiDir','string','Locale','appcode','env','1829577wUgAXo','8IDmdvx','zh-CN','4161396SZKVuK','9LiChRv','apps','55jyDBJV','15316AjGoaW','accessKey','defaultApp','Auth\x20cookie','Default\x20page\x20size','72EnNUTk','589365qlPPzt','3425976CRJRfa','riskLevel','120776eXoPxH','API\x20directory\x20path','inherit','en-US','app','locale','Access\x20key'];a169_0x27b9=function(){return _0x117246;};return a169_0x27b9();}import{RABETBASE_OUTPUT_FORMAT_VALUES}from'../constant/output.js';import{RISK_LEVEL_VALUES}from'../constant/risk.js';export{DEFAULT_CONFIG_VALUES}from'../constant/defaults.js';export const PROJECT_CREATE_INHERITABLE_KEYS=[a169_0x324d85(0x140),a169_0x324d85(0x153),a169_0x324d85(0x135),'format',a169_0x324d85(0x15a)];export const TOP_LEVEL_CONFIG_KEYS=new Set([a169_0x324d85(0x149),a169_0x324d85(0x14a),a169_0x324d85(0x135),a169_0x324d85(0x137),a169_0x324d85(0x140),a169_0x324d85(0x153),a169_0x324d85(0x146)]);export const CONFIG_ENUM_VALUES={'env':[...RABETBASE_ENV_VALUES],'format':[...RABETBASE_OUTPUT_FORMAT_VALUES]};export function formatConfigKeyList(_0x5ef5a7){return[..._0x5ef5a7]['join'](',\x20');}export function getTopLevelConfigKeyList(){return[...TOP_LEVEL_CONFIG_KEYS];}export function isTopLevelConfigKey(_0x3fac13){const _0x281021=a169_0x324d85;return TOP_LEVEL_CONFIG_KEYS[_0x281021(0x143)](_0x3fac13);}export function getTopLevelConfigKeySummary(){return formatConfigKeyList(getTopLevelConfigKeyList());}export function getConfigCommandKeyDescription(){return'Config\x20key\x20('+getTopLevelConfigKeySummary()+')';}export const APP_PROFILE_FLAG_KEY_MAP={'env':a169_0x324d85(0x14a),'apiDir':a169_0x324d85(0x146),'cookie':a169_0x324d85(0x140),'accessKey':'accessKey','defaultFormat':a169_0x324d85(0x137),'pageSize':a169_0x324d85(0x138),'riskLevel':'riskLevel','locale':a169_0x324d85(0x135)};export function getAppProfileFlagDefs(){const _0xde9679=a169_0x324d85;return[{'name':_0xde9679(0x14a),'type':_0xde9679(0x147),'description':'Target\x20environment','enum':[...RABETBASE_ENV_VALUES]},{'name':_0xde9679(0x146),'type':_0xde9679(0x147),'description':_0xde9679(0x15c)},{'name':_0xde9679(0x140),'type':_0xde9679(0x147),'description':_0xde9679(0x155),'hidden':!![]},{'name':_0xde9679(0x153),'type':_0xde9679(0x147),'description':_0xde9679(0x136),'hidden':!![]},{'name':_0xde9679(0x13d),'type':_0xde9679(0x147),'description':_0xde9679(0x13c),'enum':[...RABETBASE_OUTPUT_FORMAT_VALUES]},{'name':_0xde9679(0x138),'type':_0xde9679(0x139),'description':_0xde9679(0x156)},{'name':_0xde9679(0x15a),'type':_0xde9679(0x147),'description':_0xde9679(0x13e),'enum':[...RISK_LEVEL_VALUES]},{'name':'locale','type':_0xde9679(0x147),'description':_0xde9679(0x148)}];}export function collectAppProfileOverrides(_0x4cb7e0){const _0x96ee5d=a169_0x324d85,_0x7fcb6d={};for(const [_0x9ee015,_0x17d858]of Object[_0x96ee5d(0x144)](APP_PROFILE_FLAG_KEY_MAP)){const _0x524bba=_0x4cb7e0(_0x9ee015);if(!_0x524bba)continue;_0x7fcb6d[_0x17d858]=_0x17d858==='pageSize'?Number(_0x524bba):_0x524bba;}return _0x7fcb6d;}export function buildAppProfileListFields(_0x3aa739){const _0x423012=a169_0x324d85;return{'env':_0x3aa739['env']??null,'apiDir':_0x3aa739[_0x423012(0x146)]??null,'hasCookie':!!_0x3aa739[_0x423012(0x140)],'hasAccessKey':!!_0x3aa739[_0x423012(0x153)],'format':_0x3aa739[_0x423012(0x137)]??null,'pageSize':_0x3aa739[_0x423012(0x138)]??null,'riskLevel':_0x3aa739[_0x423012(0x15a)]??null,'locale':_0x3aa739['locale']??null};}export function buildAppDoctorFields(_0x14278e,_0x586da1){const _0x49c6b3=a169_0x324d85;return{'env':{'value':_0x14278e[_0x49c6b3(0x14a)]||_0x586da1[_0x49c6b3(0x14a)],'source':_0x14278e[_0x49c6b3(0x14a)]?_0x49c6b3(0x15f):_0x49c6b3(0x15d)},'apiDir':{'value':_0x14278e[_0x49c6b3(0x146)]||_0x586da1[_0x49c6b3(0x146)],'source':_0x14278e['apiDir']?_0x49c6b3(0x15f):'inherit'},'cookie':{'value':_0x14278e[_0x49c6b3(0x140)]||_0x586da1[_0x49c6b3(0x140)],'source':_0x14278e[_0x49c6b3(0x140)]?'app':_0x49c6b3(0x15d)},'accessKey':{'value':_0x14278e[_0x49c6b3(0x153)]||_0x586da1[_0x49c6b3(0x153)],'source':_0x14278e[_0x49c6b3(0x153)]?_0x49c6b3(0x15f):_0x49c6b3(0x15d)}};}export function buildCanonicalAppConfig(_0x16e65b,_0xdbfad1){const _0x26f0bd=a169_0x324d85,_0x3e6674=_0x16e65b[_0x26f0bd(0x13f)](_0x4a40a4=>String(_0x4a40a4||'')[_0x26f0bd(0x13b)]())[_0x26f0bd(0x13a)](Boolean);if(_0x3e6674[_0x26f0bd(0x142)]===0x0)return{};const _0x30cebb={};for(const _0xc18efc of _0x3e6674){_0x30cebb[_0xc18efc]=_0xdbfad1?{'appcode':_0xc18efc,'env':_0xdbfad1}:{'appcode':_0xc18efc};}return{'apps':_0x30cebb,'defaultApp':_0x3e6674[0x0]};}export function buildCanonicalProjectConfig(_0x371c55,_0x4f6adb){const _0x3694dd=a169_0x324d85,{appCodes:appCodes=[],env:_0x44c4c9,metadata:_0x5adcab}=_0x4f6adb,_0x38da93={..._0x371c55,..._0x5adcab||{}};delete _0x38da93['appcode'],delete _0x38da93[_0x3694dd(0x15f)];if(_0x44c4c9)_0x38da93[_0x3694dd(0x14a)]=_0x44c4c9;else!_0x38da93['env']&&(_0x38da93[_0x3694dd(0x14a)]=DEFAULT_CONFIG_VALUES[_0x3694dd(0x14a)]);const _0x3bc9d5=buildCanonicalAppConfig(appCodes,_0x38da93[_0x3694dd(0x14a)]);return Object['keys'](_0x3bc9d5)[_0x3694dd(0x142)]>0x0&&(_0x38da93[_0x3694dd(0x150)]=_0x3bc9d5[_0x3694dd(0x150)],_0x38da93[_0x3694dd(0x154)]=_0x3bc9d5[_0x3694dd(0x154)]),_0x38da93;}const LOCALE_MAP={'zh':a169_0x324d85(0x14d),'zh-cn':'zh-CN','zh_cn':'zh-CN','en':a169_0x324d85(0x15e),'en-us':'en-US','en_us':a169_0x324d85(0x15e)};function a169_0x300e(_0x1ec621,_0x47e6a4){_0x1ec621=_0x1ec621-0x135;const _0x27b97b=a169_0x27b9();let _0x300ee3=_0x27b97b[_0x1ec621];return _0x300ee3;}export function normalizeLocale(_0x4f7b3c){if(!_0x4f7b3c)return null;return LOCALE_MAP[_0x4f7b3c['toLowerCase']()]??null;}
|
package/lib/constant/cdn.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x2fda86,_0x22e2e1){const _0x4b6c90=a170_0x55a0,_0x383f31=_0x2fda86();while(!![]){try{const _0x20b492=-parseInt(_0x4b6c90(0xb9))/0x1+-parseInt(_0x4b6c90(0xbf))/0x2*(parseInt(_0x4b6c90(0xbe))/0x3)+-parseInt(_0x4b6c90(0xc2))/0x4+parseInt(_0x4b6c90(0xc0))/0x5+parseInt(_0x4b6c90(0xbd))/0x6+-parseInt(_0x4b6c90(0xc1))/0x7*(parseInt(_0x4b6c90(0xbc))/0x8)+-parseInt(_0x4b6c90(0xbb))/0x9*(-parseInt(_0x4b6c90(0xba))/0xa);if(_0x20b492===_0x22e2e1)break;else _0x383f31['push'](_0x383f31['shift']());}catch(_0x35a42b){_0x383f31['push'](_0x383f31['shift']());}}}(a170_0x42e4,0x281a2));export const CLI_VERSION_POLICY_URL='https://g.lovrabet.com/dist/rabetbase-cli/config/index.json';function a170_0x55a0(_0x26209d,_0x338ba6){_0x26209d=_0x26209d-0xb9;const _0x42e4aa=a170_0x42e4();let _0x55a076=_0x42e4aa[_0x26209d];return _0x55a076;}function a170_0x42e4(){const _0x4e6185=['13533cWKOoJ','142XNgENQ','71080qtuHbR','14Pdyian','277964glkSqk','145279IVafHJ','8628820PUiLCB','9NLSxdn','1101496fcbSsm','585510uOaUfa'];a170_0x42e4=function(){return _0x4e6185;};return a170_0x42e4();}
|