@lovrabet/rabetbase-cli 2.3.7-beta.2 → 2.3.7-beta.4
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/notification/config-list.js +1 -0
- package/lib/commands/notification/index.js +1 -0
- 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 a158_0x3eb5(_0x30fb50,_0x13c545){_0x30fb50=_0x30fb50-0xcd;const _0x1c042e=a158_0x1c04();let _0x3eb561=_0x1c042e[_0x30fb50];return _0x3eb561;}const a158_0x4c8494=a158_0x3eb5;(function(_0x152560,_0x5c6127){const _0x20b0e4=a158_0x3eb5,_0x3b5496=_0x152560();while(!![]){try{const _0x5d9f7c=parseInt(_0x20b0e4(0xd9))/0x1+-parseInt(_0x20b0e4(0xd4))/0x2+parseInt(_0x20b0e4(0xcd))/0x3*(parseInt(_0x20b0e4(0xce))/0x4)+parseInt(_0x20b0e4(0xd3))/0x5*(parseInt(_0x20b0e4(0xd8))/0x6)+-parseInt(_0x20b0e4(0xd7))/0x7+parseInt(_0x20b0e4(0xd0))/0x8*(parseInt(_0x20b0e4(0xdb))/0x9)+parseInt(_0x20b0e4(0xe1))/0xa*(-parseInt(_0x20b0e4(0xdc))/0xb);if(_0x5d9f7c===_0x5c6127)break;else _0x3b5496['push'](_0x3b5496['shift']());}catch(_0xc5e30e){_0x3b5496['push'](_0x3b5496['shift']());}}}(a158_0x1c04,0x3b787));import{getSqlQueryInfo}from'../../core/api-client.js';function a158_0x1c04(){const _0x434c43=['str','sqlcode','70XJGYGW','732500GUOzOq','sqlContent','dbId','3197131rlNHmO','132438vsDRkE','131876HvdUUo','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','4013622kEHLBT','46871cirmMJ','boolean','read','verbose','detail','320TEWWFl','94821fltzkx','40vUkHMd','appCode','8GrGriI'];a158_0x1c04=function(){return _0x434c43;};return a158_0x1c04();}import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':'sql','command':a158_0x4c8494(0xe0),'description':a158_0x4c8494(0xda),'risk':a158_0x4c8494(0xde),'flags':[SQLCODE_FLAG,{'name':a158_0x4c8494(0xdf),'type':a158_0x4c8494(0xdd),'description':'Return\x20full\x20raw\x20SQL\x20query\x20object'}],async 'execute'(_0x24e90e){const _0x177bdd=a158_0x4c8494,_0x24efc9=await getSqlQueryInfo(_0x24e90e[_0x177bdd(0xcf)],_0x24e90e[_0x177bdd(0xd1)](_0x177bdd(0xd2))),_0x5002d8=_0x24e90e['bool'](_0x177bdd(0xdf));if(_0x5002d8)return{'ok':!![],'data':_0x24efc9};const _0x3bacf3=_0x24efc9[_0x177bdd(0xd6)]?await getDbName(_0x24e90e[_0x177bdd(0xcf)],_0x24efc9[_0x177bdd(0xd6)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x24efc9['sqlCode'],'sqlName':_0x24efc9['sqlName'],'db':_0x3bacf3?_0x3bacf3+'\x20('+_0x24efc9[_0x177bdd(0xd6)]+')':_0x24efc9[_0x177bdd(0xd6)]??'','description':_0x24efc9['description']??'','sqlContent':_0x24efc9[_0x177bdd(0xd5)]??''}};}};
|
package/lib/commands/sql/exec.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a159_0x5ca664=a159_0x2231;(function(_0x35933d,_0xf3f00b){const _0x3926a2=a159_0x2231,_0x3ce49d=_0x35933d();while(!![]){try{const _0x54eb51=parseInt(_0x3926a2(0x176))/0x1*(parseInt(_0x3926a2(0x17e))/0x2)+-parseInt(_0x3926a2(0x17b))/0x3*(-parseInt(_0x3926a2(0x18c))/0x4)+parseInt(_0x3926a2(0x182))/0x5+parseInt(_0x3926a2(0x18b))/0x6+-parseInt(_0x3926a2(0x181))/0x7*(parseInt(_0x3926a2(0x183))/0x8)+-parseInt(_0x3926a2(0x18f))/0x9+-parseInt(_0x3926a2(0x18d))/0xa;if(_0x54eb51===_0xf3f00b)break;else _0x3ce49d['push'](_0x3ce49d['shift']());}catch(_0x4e0f38){_0x3ce49d['push'](_0x3ce49d['shift']());}}}(a159_0x480e,0x1d070));function a159_0x2231(_0x3772a6,_0x55de40){_0x3772a6=_0x3772a6-0x176;const _0x480e3b=a159_0x480e();let _0x223164=_0x480e3b[_0x3772a6];return _0x223164;}function a159_0x480e(){const _0x1d75a5=['SQL\x20execution\x20failed','params','string','1126806yUsHGp','8IuXVKc','2024780EygxyJ','execError','2067561wvxACJ','3707lyyelC','isArray','sqlcode','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','execResult','287787dckKrH','length','str','82TFFIYH','\x20row(s)\x20in\x20','read','273BFRdFf','915310XtkGBi','33560SbttvL','sql','execSuccess','now','appCode'];a159_0x480e=function(){return _0x1d75a5;};return a159_0x480e();}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':a159_0x5ca664(0x184),'command':'exec','description':a159_0x5ca664(0x179),'risk':a159_0x5ca664(0x180),'flags':[SQLCODE_FLAG,{'name':a159_0x5ca664(0x189),'type':a159_0x5ca664(0x18a),'description':'SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)'}],async 'execute'(_0x180d1){const _0x53b7bc=a159_0x5ca664,_0x308185=parseJsonParams(_0x180d1[_0x53b7bc(0x17d)](_0x53b7bc(0x189))),_0x1e267b=Date[_0x53b7bc(0x186)](),_0xdf04e4=await executeSql(_0x180d1[_0x53b7bc(0x187)],_0x180d1[_0x53b7bc(0x17d)](_0x53b7bc(0x178)),_0x308185),_0x441d96=Date[_0x53b7bc(0x186)]()-_0x1e267b,_0xa09978=_0xdf04e4?.[_0x53b7bc(0x17a)]??_0xdf04e4,_0x375d29=_0xdf04e4?.[_0x53b7bc(0x185)]??!![];if(!_0x375d29)return{'ok':![],'data':{'error':_0xdf04e4?.[_0x53b7bc(0x18e)]||_0x53b7bc(0x188),'elapsed':_0x441d96},'message':_0x53b7bc(0x188)};const _0x5b0350=Array[_0x53b7bc(0x177)](_0xa09978)?_0xa09978:[];return{'ok':!![],'data':{'rows':_0x5b0350,'rowCount':_0x5b0350[_0x53b7bc(0x17c)],'elapsed':_0x441d96},'message':'Returned\x20'+_0x5b0350[_0x53b7bc(0x17c)]+_0x53b7bc(0x17f)+_0x441d96+'ms'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x472d69,_0x187e52){const _0x3aaa3e=a160_0x2dc8,_0x4c599b=_0x472d69();while(!![]){try{const _0x5b4f83=parseInt(_0x3aaa3e(0x95))/0x1+parseInt(_0x3aaa3e(0x97))/0x2+parseInt(_0x3aaa3e(0x91))/0x3*(parseInt(_0x3aaa3e(0x99))/0x4)+-parseInt(_0x3aaa3e(0x96))/0x5+parseInt(_0x3aaa3e(0x93))/0x6*(-parseInt(_0x3aaa3e(0x94))/0x7)+-parseInt(_0x3aaa3e(0x90))/0x8+-parseInt(_0x3aaa3e(0x92))/0x9*(-parseInt(_0x3aaa3e(0x98))/0xa);if(_0x5b4f83===_0x187e52)break;else _0x4c599b['push'](_0x4c599b['shift']());}catch(_0x17976d){_0x4c599b['push'](_0x4c599b['shift']());}}}(a160_0x29b6,0xdf49b));import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';function a160_0x2dc8(_0x1a9a1c,_0x41bbcb){_0x1a9a1c=_0x1a9a1c-0x90;const _0x29b655=a160_0x29b6();let _0x2dc880=_0x29b655[_0x1a9a1c];return _0x2dc880;}import{sqlValidate}from'../../commands/sql/validate.js';function a160_0x29b6(){const _0x552709=['4126040QkXwhY','667140vPBWvT','21456360UrUqAg','3557396JSKDrO','11075000bwRFry','3ybuiUh','9haBIVN','3858nKiney','13825qBAlFR','1025540OZqvUK'];a160_0x29b6=function(){return _0x552709;};return a160_0x29b6();}import{sqlSave}from'../../commands/sql/save.js';import{sqlExec}from'../../commands/sql/exec.js';import{sqlPull}from'../../commands/sql/pull.js';import{sqlCreate}from'../../commands/sql/create.js';import{sqlStatus}from'../../commands/sql/status.js';import{sqlPush}from'../../commands/sql/push.js';import{sqlDelete}from'../../commands/sql/delete.js';export const sqlDefinitions=[sqlList,sqlDetail,sqlStatus,sqlCreate,sqlPush,sqlValidate,sqlSave,sqlExec,sqlPull,sqlDelete];
|
package/lib/commands/sql/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a161_0x193e4a=a161_0x39f8;(function(_0x146f55,_0x3f9c47){const _0x6f57b3=a161_0x39f8,_0x280116=_0x146f55();while(!![]){try{const _0x436bbe=-parseInt(_0x6f57b3(0x90))/0x1*(-parseInt(_0x6f57b3(0x8b))/0x2)+-parseInt(_0x6f57b3(0x8c))/0x3+parseInt(_0x6f57b3(0x7f))/0x4+-parseInt(_0x6f57b3(0x98))/0x5+parseInt(_0x6f57b3(0x94))/0x6*(-parseInt(_0x6f57b3(0x86))/0x7)+-parseInt(_0x6f57b3(0x97))/0x8+parseInt(_0x6f57b3(0x83))/0x9*(parseInt(_0x6f57b3(0x92))/0xa);if(_0x436bbe===_0x3f9c47)break;else _0x280116['push'](_0x280116['shift']());}catch(_0x682488){_0x280116['push'](_0x280116['shift']());}}}(a161_0x4758,0xbdf33));function a161_0x39f8(_0x4905fb,_0x243155){_0x4905fb=_0x4905fb-0x7a;const _0x4758de=a161_0x4758();let _0x39f832=_0x4758de[_0x4905fb];return _0x39f832;}import{listSqlQueries}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a161_0x4758(){const _0x217f0d=['Found\x20','sqlcode','tableData','\x20SQL\x20queries\x20(total:\x20','name','dbId','page','all','map','description','length','list','447176EUPRtf','boolean','read','sqlCode','31376106IeWWMV','str','totalCount','7icACOA','string','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','Page\x20number','num','2722990vyhrRP','3549828wRWhGI','sql','Page\x20size','verbose','1ayFfBX','appCode','10ShQxhW','bool','9106170ruwpnZ','List\x20custom\x20SQL\x20queries','pagesize','2877472fIRGjE','5604165WvIYQw','number'];a161_0x4758=function(){return _0x217f0d;};return a161_0x4758();}export const sqlList={'service':a161_0x193e4a(0x8d),'command':a161_0x193e4a(0x7e),'description':a161_0x193e4a(0x95),'risk':a161_0x193e4a(0x81),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a161_0x193e4a(0x9e),'type':a161_0x193e4a(0x87),'description':'Filter\x20by\x20SQL\x20name'},{'name':a161_0x193e4a(0xa0),'type':a161_0x193e4a(0x99),'description':a161_0x193e4a(0x89),'default':0x1},{'name':a161_0x193e4a(0x96),'type':'number','description':a161_0x193e4a(0x8e)},{'name':a161_0x193e4a(0x8f),'type':a161_0x193e4a(0x80),'description':a161_0x193e4a(0x88)}],async 'execute'(_0x564490){const _0x4a48ec=a161_0x193e4a,_0x2343fd=await listSqlQueries(_0x564490[_0x4a48ec(0x91)],{'sqlCode':_0x564490[_0x4a48ec(0x84)](_0x4a48ec(0x9b))||undefined,'sqlName':_0x564490[_0x4a48ec(0x84)](_0x4a48ec(0x9e))||undefined,'currentPage':_0x564490[_0x4a48ec(0x8a)](_0x4a48ec(0xa0)),'pageSize':_0x564490['num'](_0x4a48ec(0x96),0x32)}),_0xb004da=_0x564490[_0x4a48ec(0x93)](_0x4a48ec(0x8f)),_0x224c9b=_0x2343fd[_0x4a48ec(0x9c)]??[],_0x368291=_0x2343fd['paging']?.[_0x4a48ec(0x85)]??_0x224c9b[_0x4a48ec(0x7d)];let _0x447bd7;return _0xb004da?_0x447bd7=_0x224c9b:_0x447bd7=await Promise[_0x4a48ec(0x7a)](_0x224c9b[_0x4a48ec(0x7b)](async _0x579604=>{const _0x1e3d53=_0x4a48ec;let _0x470617;try{_0x470617=_0x579604[_0x1e3d53(0x9f)]?await getDbName(_0x564490[_0x1e3d53(0x91)],_0x579604['dbId']):undefined;}catch{}return{'sqlCode':_0x579604[_0x1e3d53(0x82)],'sqlName':_0x579604['sqlName'],'description':_0x579604[_0x1e3d53(0x7c)]??'','db':_0x470617?_0x470617+'\x20('+_0x579604['dbId']+')':_0x579604['dbId']??''};})),{'ok':!![],'data':_0x447bd7,'message':_0x224c9b[_0x4a48ec(0x7d)]===0x0?'No\x20custom\x20SQL\x20queries\x20found.':_0x4a48ec(0x9a)+_0x224c9b['length']+_0x4a48ec(0x9d)+_0x368291+').'};}};
|
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 a162_0xb4b5f4=a162_0x56c7;(function(_0x549bfd,_0x1f6711){const _0x5a6f01=a162_0x56c7,_0x4a1892=_0x549bfd();while(!![]){try{const _0x591042=parseInt(_0x5a6f01(0x107))/0x1+parseInt(_0x5a6f01(0x101))/0x2+parseInt(_0x5a6f01(0x118))/0x3*(parseInt(_0x5a6f01(0xfc))/0x4)+-parseInt(_0x5a6f01(0x110))/0x5+-parseInt(_0x5a6f01(0x111))/0x6*(parseInt(_0x5a6f01(0xdb))/0x7)+parseInt(_0x5a6f01(0x102))/0x8*(parseInt(_0x5a6f01(0xdd))/0x9)+parseInt(_0x5a6f01(0x10a))/0xa*(-parseInt(_0x5a6f01(0xf2))/0xb);if(_0x591042===_0x1f6711)break;else _0x4a1892['push'](_0x4a1892['shift']());}catch(_0x497d56){_0x4a1892['push'](_0x4a1892['shift']());}}}(a162_0x2a7c,0x63538));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';function a162_0x56c7(_0x2ec007,_0x3b94b9){_0x2ec007=_0x2ec007-0xda;const _0x2a7c6c=a162_0x2a7c();let _0x56c70e=_0x2a7c6c[_0x2ec007];return _0x56c70e;}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(_0x5e9a15,_0x325d3d){const _0x449e35=a162_0x56c7,_0x4db8c4=[];let _0x3a2788=0x1;while(!![]){const _0x5b4562=await listSqlQueries(_0x5e9a15,{'currentPage':_0x3a2788,'pageSize':PAGE_SIZE,'sqlCode':_0x325d3d[_0x449e35(0xea)],'sqlName':_0x325d3d[_0x449e35(0xdc)]}),_0x156e8e=_0x5b4562[_0x449e35(0xda)]??[];_0x4db8c4[_0x449e35(0xef)](..._0x156e8e);if(_0x156e8e[_0x449e35(0xf4)]===0x0)break;const _0x4bdc9c=_0x5b4562[_0x449e35(0xe0)]?.[_0x449e35(0x10d)];if(_0x4bdc9c!=null?_0x4db8c4['length']>=_0x4bdc9c:_0x156e8e['length']<PAGE_SIZE)break;_0x3a2788++;}return _0x4db8c4;}async function ensureSqlContent(_0x1836d3){const _0x34d132=a162_0x56c7;if(_0x1836d3['sqlContent']!=null&&String(_0x1836d3[_0x34d132(0xe5)])[_0x34d132(0xf4)]>0x0)return _0x1836d3;return getSqlQueryDetail(_0x1836d3[_0x34d132(0xea)]);}function a162_0x2a7c(){const _0x5a8532=['1350XLvfyy','path','pull','totalCount','cancelled','string','1108845odpmPO','714Xirdrv','message','Pull\x20complete:\x20','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','split','sqlRootDir','trimStart','1623UzMtrs','tableData','4151YCCiFp','sqlName','9ilKwBI','\x20failed','unchanged','paging','Would\x20pull\x20','replace','lockFilePath','bool','sqlContent','skipped','local\x20differs\x20from\x20remote','name','str','sqlCode','boolean','force','toISOString','nonInteractive','push','sqlRoot','join','87868uDOATh','Force\x20pull\x20cancelled.','length','appCode','POST','conflict','utf8','sqls','\x20written,\x20','sqlcode','3212lRvhhp','Filter\x20by\x20SQL\x20display\x20name','description','\x20skipped,\x20','test','1507710hJqgJc','4713608WpBZmD','would_pull','mybatisXml','catch','dbId','77yJVrhD','\x20SQL\x20file(s)\x20into\x20','apps'];a162_0x2a7c=function(){return _0x5a8532;};return a162_0x2a7c();}export const sqlPull={'service':'sql','command':a162_0xb4b5f4(0x10c),'description':'Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','risk':'write','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a162_0xb4b5f4(0xe8),'type':a162_0xb4b5f4(0x10f),'description':a162_0xb4b5f4(0xfd)},{'name':a162_0xb4b5f4(0xec),'type':a162_0xb4b5f4(0xeb),'description':'Force\x20overwrite\x20local\x20unsynced\x20changes'}],async 'dryRun'(_0x376a56){const _0x2f1991=a162_0xb4b5f4,_0x269870=loadSqlProjectConfig(_0x376a56[_0x2f1991(0xf5)]),_0x2acd7d=await readSqlLockFile(_0x269870['lockFilePath']),{appLock:_0x5b8f96}=ensureSqlLockScope(_0x2acd7d??createEmptySqlLock(),_0x269870['appCode'],_0x269870[_0x2f1991(0xf0)],'pull'),_0x15bd15=await fetchAllSqlQueries(_0x376a56[_0x2f1991(0xf5)],{'sqlCode':_0x376a56[_0x2f1991(0xe9)](_0x2f1991(0xfb))||undefined,'sqlName':_0x376a56[_0x2f1991(0xe9)](_0x2f1991(0xe8))||undefined}),_0x6306fb=[];for(const _0x243c4a of _0x15bd15){const _0x4e6fd3=await ensureSqlContent(_0x243c4a),_0x221566=ensureRemoteSqlContent(_0x4e6fd3),_0x1e12e8=detectModeFromSql(_0x4e6fd3),_0x3d56d9=_0x4e6fd3[_0x2f1991(0x106)]?await getDbName(_0x376a56['appCode'],Number(_0x4e6fd3['dbId']))[_0x2f1991(0x105)](()=>undefined):undefined,_0x527f4e=buildLocalSqlFileContent({'sqlCode':_0x4e6fd3['sqlCode'],'sqlName':_0x4e6fd3[_0x2f1991(0xdc)],'dbId':_0x4e6fd3[_0x2f1991(0x106)]},_0x221566,{'dbName':_0x3d56d9,'mode':_0x1e12e8,'syncedAt':new Date()[_0x2f1991(0xed)](),'description':_0x4e6fd3[_0x2f1991(0xfe)]}),_0x1d3b4e=buildSqlLockEntry(_0x4e6fd3,_0x221566,'',{'dbName':_0x3d56d9}),_0x3772a5=resolveLocalSqlFilePath(_0x269870,_0x4e6fd3[_0x2f1991(0xea)],_0x1d3b4e);let _0x46e559=_0x2f1991(0x103),_0x3b81f3;if(await fileExists(_0x3772a5)){const _0xd08d44=await readFile(_0x3772a5,_0x2f1991(0xf8));isEquivalentPulledSqlFile(_0xd08d44,_0x527f4e,_0x1e12e8)?(_0x46e559=_0x2f1991(0xe6),_0x3b81f3=_0x2f1991(0xdf)):(_0x46e559=_0x2f1991(0xf7),_0x3b81f3='local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)');}_0x6306fb['push']({'sqlCode':_0x4e6fd3['sqlCode'],'sqlName':_0x4e6fd3[_0x2f1991(0xdc)],'filePath':_0x3772a5,'status':_0x46e559,'reason':_0x3b81f3});}return{'method':_0x2f1991(0xf6),'url':_0x2f1991(0x114),'body':{'appCode':_0x376a56['appCode'],'sqlCode':_0x376a56[_0x2f1991(0xe9)](_0x2f1991(0xfb))||null,'sqlName':_0x376a56[_0x2f1991(0xe9)](_0x2f1991(0xe8))||null,'files':_0x6306fb},'description':_0x2f1991(0xe1)+_0x6306fb[_0x2f1991(0xf4)]+_0x2f1991(0x108)+_0x269870[_0x2f1991(0x116)]};},async 'execute'(_0x4a434d){const _0x1293f2=a162_0xb4b5f4,_0x578932=loadSqlProjectConfig(_0x4a434d[_0x1293f2(0xf5)]),_0x5a66db=await readSqlLockFile(_0x578932[_0x1293f2(0xe3)]),{lockData:_0x5e9b9c,appLock:_0x14a88c}=ensureSqlLockScope(_0x5a66db??createEmptySqlLock(),_0x578932['appCode'],_0x578932[_0x1293f2(0xf0)],_0x1293f2(0x10c)),_0xa67f27=_0x4a434d[_0x1293f2(0xe4)](_0x1293f2(0xec)),_0x29505b=await fetchAllSqlQueries(_0x4a434d[_0x1293f2(0xf5)],{'sqlCode':_0x4a434d[_0x1293f2(0xe9)](_0x1293f2(0xfb))||undefined,'sqlName':_0x4a434d[_0x1293f2(0xe9)](_0x1293f2(0xe8))||undefined});if(_0x29505b[_0x1293f2(0xf4)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':'No\x20remote\x20SQL\x20queries\x20matched.'};const _0xa6b2bf=[],_0x544179=[];for(const _0x11b499 of _0x29505b){try{_0xa6b2bf[_0x1293f2(0xef)](await ensureSqlContent(_0x11b499));}catch(_0x2a8374){_0x544179[_0x1293f2(0xef)]({'sqlCode':_0x11b499['sqlCode'],'error':_0x2a8374 instanceof Error?_0x2a8374[_0x1293f2(0x112)]:String(_0x2a8374)});}}if(_0xa67f27&&!_0x4a434d[_0x1293f2(0xee)]){let _0x147a92=![];for(const _0x542c0f of _0xa6b2bf){const _0x589487=detectModeFromSql(_0x542c0f),_0x5a21d8=_0x542c0f['dbId']?await getDbName(_0x4a434d['appCode'],Number(_0x542c0f[_0x1293f2(0x106)]))['catch'](()=>undefined):undefined,_0xe1ac3=buildLocalSqlFileContent({'sqlCode':_0x542c0f[_0x1293f2(0xea)],'sqlName':_0x542c0f[_0x1293f2(0xdc)],'dbId':_0x542c0f[_0x1293f2(0x106)]},ensureRemoteSqlContent(_0x542c0f),{'dbName':_0x5a21d8,'mode':_0x589487,'syncedAt':new Date()['toISOString'](),'description':_0x542c0f[_0x1293f2(0xfe)]}),_0x219c5d=resolveLocalSqlFilePath(_0x578932,_0x542c0f[_0x1293f2(0xea)],buildSqlLockEntry(_0x542c0f,ensureRemoteSqlContent(_0x542c0f),'',{'dbName':_0x5a21d8}));if(await fileExists(_0x219c5d)){const _0x59a334=await readFile(_0x219c5d,_0x1293f2(0xf8));if(!isEquivalentPulledSqlFile(_0x59a334,_0xe1ac3,_0x589487)){_0x147a92=!![];break;}}}if(_0x147a92){const _0x1d0121=await confirmForceOverwrite('Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.');if(!_0x1d0121)throw CliErrors[_0x1293f2(0x10e)](_0x1293f2(0xf3));}}const _0x29007a=cloneSqlLockData(_0x5e9b9c),_0x4baa21=_0x29007a[_0x1293f2(0x109)][_0x578932[_0x1293f2(0xf5)]],_0x1a47af=[],_0x45f15f=[];for(const _0x26e6b3 of _0xa6b2bf){const _0x1d6ef1=_0x4baa21[_0x1293f2(0xf9)][_0x26e6b3['sqlCode']],_0xaa1276=ensureRemoteSqlContent(_0x26e6b3),_0xdf3dc9=detectModeFromSql(_0x26e6b3),_0x3af37b=_0x26e6b3[_0x1293f2(0x106)]?await getDbName(_0x4a434d[_0x1293f2(0xf5)],Number(_0x26e6b3[_0x1293f2(0x106)]))['catch'](()=>undefined):undefined,_0x3103d8=buildLocalSqlFileContent({'sqlCode':_0x26e6b3['sqlCode'],'sqlName':_0x26e6b3[_0x1293f2(0xdc)],'dbId':_0x26e6b3[_0x1293f2(0x106)]},_0xaa1276,{'dbName':_0x3af37b,'mode':_0xdf3dc9,'syncedAt':new Date()[_0x1293f2(0xed)](),'description':_0x26e6b3[_0x1293f2(0xfe)]}),_0xe56cb1=buildSqlLockEntry(_0x26e6b3,_0xaa1276,computeSqlContentHash(_0x3103d8),{'dbName':_0x3af37b}),_0x37048e=_0xe56cb1[_0x1293f2(0x10b)],_0x2e1367=join(_0x578932[_0x1293f2(0x116)],_0x37048e);try{if(await fileExists(_0x2e1367)){const _0x4e3a92=await readFile(_0x2e1367,_0x1293f2(0xf8));if(isEquivalentPulledSqlFile(_0x4e3a92,_0x3103d8,_0xdf3dc9)){_0x45f15f[_0x1293f2(0xef)]({'sqlCode':_0x26e6b3[_0x1293f2(0xea)],'reason':_0x1293f2(0xdf)}),_0x4baa21['sqls'][_0x26e6b3[_0x1293f2(0xea)]]={..._0xe56cb1,'hash':computeSqlContentHash(_0x4e3a92),'path':_0x37048e};continue;}if(!_0xa67f27){_0x45f15f[_0x1293f2(0xef)]({'sqlCode':_0x26e6b3[_0x1293f2(0xea)],'reason':_0x1293f2(0xe7)});continue;}}const _0x50c711=_0x1d6ef1?.[_0x1293f2(0x10b)]?join(_0x578932[_0x1293f2(0x116)],_0x1d6ef1[_0x1293f2(0x10b)]):undefined;_0x50c711&&_0x50c711!==_0x2e1367&&await fileExists(_0x50c711)&&await rm(_0x50c711,{'force':!![]}),await ensureParentDirectory(_0x2e1367),await writeFile(_0x2e1367,_0x3103d8,_0x1293f2(0xf8)),_0x4baa21['sqls'][_0x26e6b3['sqlCode']]={..._0xe56cb1,'path':_0x37048e},_0x1a47af[_0x1293f2(0xef)]({'sqlCode':_0x26e6b3[_0x1293f2(0xea)],'filePath':_0x2e1367});}catch(_0xfed035){_0x544179[_0x1293f2(0xef)]({'sqlCode':_0x26e6b3[_0x1293f2(0xea)],'error':_0xfed035 instanceof Error?_0xfed035['message']:String(_0xfed035)});}}return _0x4baa21['lastSync']=new Date()[_0x1293f2(0xed)](),await writeSqlLockFile(_0x578932['lockFilePath'],_0x29007a),{'ok':_0x544179[_0x1293f2(0xf4)]===0x0,'data':{'pulled':_0x1a47af,'skipped':_0x45f15f,'failed':_0x544179},'message':_0x1293f2(0x113)+_0x1a47af[_0x1293f2(0xf4)]+_0x1293f2(0xfa)+_0x45f15f[_0x1293f2(0xf4)]+_0x1293f2(0xff)+_0x544179[_0x1293f2(0xf4)]+_0x1293f2(0xde)};}};function detectModeFromSql(_0x3dcadb){const _0x5db8a8=a162_0xb4b5f4,_0x5075b7=ensureRemoteSqlContent(_0x3dcadb),_0x4e804c=stripLocalSqlMetadata(_0x5075b7,_0x5db8a8(0x104))[_0x5db8a8(0x117)]();if(/^<(select|insert|update|delete)\b/i[_0x5db8a8(0x100)](_0x4e804c))return _0x5db8a8(0x104);return'sql';}function isEquivalentPulledSqlFile(_0x43ca67,_0x3713bb,_0x2e5b7a){return normalizePullComparableContent(_0x43ca67,_0x2e5b7a)===normalizePullComparableContent(_0x3713bb,_0x2e5b7a);}function normalizePullComparableContent(_0x506998,_0x531915){const _0x1c7aa5=a162_0xb4b5f4,_0x46bd83=_0x506998[_0x1c7aa5(0xe2)](/\r\n/g,'\x0a')[_0x1c7aa5(0x115)]('\x0a'),_0x4a529e=_0x46bd83['filter'](_0x51c8f8=>!isSyncedAtMetadataLine(_0x51c8f8,_0x531915));return _0x4a529e[_0x1c7aa5(0xf1)]('\x0a');}function isSyncedAtMetadataLine(_0x56b447,_0x56c31c){const _0x2b0880=a162_0xb4b5f4;if(_0x56c31c===_0x2b0880(0x104))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x2b0880(0x100)](_0x56b447);return/^\s*--\s*@lovrabet\.syncedAt:/['test'](_0x56b447);}
|
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 a163_0x13e4d0=a163_0x14a6;(function(_0x5e123b,_0x597442){const _0x4bbdaa=a163_0x14a6,_0x136132=_0x5e123b();while(!![]){try{const _0x246ea4=-parseInt(_0x4bbdaa(0x19f))/0x1*(parseInt(_0x4bbdaa(0x18f))/0x2)+parseInt(_0x4bbdaa(0x19d))/0x3*(-parseInt(_0x4bbdaa(0x178))/0x4)+parseInt(_0x4bbdaa(0x1a7))/0x5+-parseInt(_0x4bbdaa(0x187))/0x6+-parseInt(_0x4bbdaa(0x185))/0x7*(parseInt(_0x4bbdaa(0x19c))/0x8)+parseInt(_0x4bbdaa(0x167))/0x9+parseInt(_0x4bbdaa(0x1a4))/0xa;if(_0x246ea4===_0x597442)break;else _0x136132['push'](_0x136132['shift']());}catch(_0x28fb48){_0x136132['push'](_0x136132['shift']());}}}(a163_0x2e89,0xb1d81));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';import{CliErrors}from'../../errors.js';function a163_0x14a6(_0x5d7cac,_0x2cf83a){_0x5d7cac=_0x5d7cac-0x166;const _0x2e8923=a163_0x2e89();let _0x14a6d4=_0x2e8923[_0x5d7cac];return _0x14a6d4;}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(_0x3e5dc5,_0x3c4244,_0x2813ed){const _0xf3cf41=a163_0x14a6,_0x52260e=await scanLocalSqlQueries(_0x3e5dc5),_0x33ff18=new Map();for(const _0x32f6ff of _0x52260e){if(_0x2813ed&&_0x32f6ff['sqlCode']!==_0x2813ed)continue;const _0x294dec=_0x33ff18[_0xf3cf41(0x16c)](_0x32f6ff[_0xf3cf41(0x17a)])??[];_0x294dec['push'](_0x32f6ff),_0x33ff18[_0xf3cf41(0x183)](_0x32f6ff[_0xf3cf41(0x17a)],_0x294dec);}if(_0x2813ed&&!_0x33ff18[_0xf3cf41(0x191)](_0x2813ed))throw CliErrors[_0xf3cf41(0x1a6)](_0xf3cf41(0x173)+_0x2813ed);const _0x427afe=[];for(const [_0x2027d6,_0x209ad4]of _0x33ff18[_0xf3cf41(0x166)]()){if(_0x209ad4['length']===0x1){_0x427afe[_0xf3cf41(0x195)](_0x209ad4[0x0]);continue;}const _0x3a18ca=_0x3c4244['sqls'][_0x2027d6],_0x5780a7=_0x3a18ca?.[_0xf3cf41(0x1a5)],_0x1610e6=_0x5780a7?_0x209ad4[_0xf3cf41(0x16d)](_0x50d693=>_0x50d693[_0xf3cf41(0x193)]!==_0x5780a7):_0x209ad4;if(_0x3a18ca&&_0x1610e6[_0xf3cf41(0x177)]===0x1){_0x427afe[_0xf3cf41(0x195)](_0x1610e6[0x0]);continue;}throw CliErrors['validation'](_0xf3cf41(0x17d)+_0x2027d6+'.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.');}return _0x427afe;}function a163_0x2e89(){const _0x1ca8c4=['appCode','sqls','get','filter','/smartapi/custom/updateUserCustomSql','sqlRootDir','force','utf8','lastSync','Local\x20SQL\x20not\x20found:\x20','dbDirectory','lockFilePath','\x20failed','length','723368wuWNBz','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','sqlCode','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','sqlConfig','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','POST','mode','sqlName','dbId','dbName','set','Push\x20complete:\x20','5775007VDoaYv','bool','5478012SvocBx','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','startsWith','exec','version','Push\x20local\x20SQL\x20files\x20to\x20remote','sqlcode','map','458OtLqRm','str','has','filePath','relativePath','No\x20database\x20matches\x20local\x20directory\x20\x22','push','trashDir','hash','join','catch','\x20pushed,\x20','No\x20local\x20SQL\x20files\x20found.','8GHoQeC','18NAnsZp','toISOString','2977sWVGZT','Local\x20directory\x20\x22','replace','boolean','remoteId','32396690iKJLXX','path','validation','2678310jvblGJ','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','entries','4121154oMtYsc','\x20skipped,\x20','message'];a163_0x2e89=function(){return _0x1ca8c4;};return a163_0x2e89();}export const sqlPush={'service':'sql','command':'push','description':a163_0x13e4d0(0x18c),'risk':'high-risk-write','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a163_0x13e4d0(0x170),'type':a163_0x13e4d0(0x1a2),'description':a163_0x13e4d0(0x179)}],async 'dryRun'(_0x5cb1bb){const _0x5bf669=a163_0x13e4d0,_0x5e2ce3=loadSqlProjectConfig(_0x5cb1bb[_0x5bf669(0x16a)]),_0x6d4a84=await readSqlLockFile(_0x5e2ce3['lockFilePath']),{appLock:_0x3c1c14}=ensureSqlLockScope(_0x6d4a84??createEmptySqlLock(),_0x5cb1bb[_0x5bf669(0x16a)],_0x5e2ce3['sqlRoot'],_0x5bf669(0x195)),_0x3b7f74=await getTargetSqlQueries(_0x5e2ce3,_0x3c1c14,_0x5cb1bb[_0x5bf669(0x190)]('sqlcode')||undefined),_0x194861=[];for(const _0x251ef9 of _0x3b7f74){const _0xb289ce=await computeSqlFileHash(_0x251ef9[_0x5bf669(0x192)]),_0xf572d8=_0x3c1c14[_0x5bf669(0x16b)][_0x251ef9[_0x5bf669(0x17a)]],_0x5c2c14=!!_0xf572d8&&(_0xf572d8[_0x5bf669(0x1a5)]!==_0x251ef9[_0x5bf669(0x193)]||!!_0x251ef9['sqlName']&&_0xf572d8[_0x5bf669(0x180)]!==_0x251ef9[_0x5bf669(0x180)]);if(!_0x5cb1bb['bool']('force')&&_0xf572d8&&_0xf572d8[_0x5bf669(0x197)]===_0xb289ce&&!_0x5c2c14)continue;_0x194861['push'](_0x251ef9[_0x5bf669(0x17a)]);}return{'method':_0x5bf669(0x17e),'url':_0x5bf669(0x16e),'body':{'sqlCodes':_0x194861,'appCode':_0x5cb1bb[_0x5bf669(0x16a)]},'description':'Would\x20push\x20'+_0x194861['length']+'\x20SQL\x20file(s)'};},async 'execute'(_0x12036e){const _0x469e67=a163_0x13e4d0,_0x43013c=loadSqlProjectConfig(_0x12036e['appCode']),_0x5de111=await readSqlLockFile(_0x43013c[_0x469e67(0x175)]),{lockData:_0x21d693,appLock:_0x1121ee}=ensureSqlLockScope(_0x5de111??createEmptySqlLock(),_0x12036e['appCode'],_0x43013c['sqlRoot'],_0x469e67(0x195)),_0x51209d=await getTargetSqlQueries(_0x43013c,_0x1121ee,_0x12036e['str'](_0x469e67(0x18d))||undefined);if(_0x51209d['length']===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x469e67(0x19b)};const _0x4ca662=[],_0x4a441e=[],_0x13c00f=[];for(const _0x1c7357 of _0x51209d){const _0x3b9273=_0x1121ee[_0x469e67(0x16b)][_0x1c7357[_0x469e67(0x17a)]];if(!_0x3b9273){_0x13c00f['push']({'sqlCode':_0x1c7357[_0x469e67(0x17a)],'error':_0x469e67(0x188)});continue;}try{const _0x3093dd=await computeSqlFileHash(_0x1c7357[_0x469e67(0x192)]),_0x581882=_0x3b9273[_0x469e67(0x1a5)]!==_0x1c7357[_0x469e67(0x193)]||!!_0x1c7357['sqlName']&&_0x3b9273[_0x469e67(0x180)]!==_0x1c7357[_0x469e67(0x180)];if(!_0x12036e[_0x469e67(0x186)](_0x469e67(0x170))&&_0x3b9273['hash']===_0x3093dd&&!_0x581882){_0x4a441e[_0x469e67(0x195)]({'sqlCode':_0x1c7357[_0x469e67(0x17a)],'reason':'unchanged'});continue;}if(_0x3b9273[_0x469e67(0x18b)]==null){_0x13c00f[_0x469e67(0x195)]({'sqlCode':_0x1c7357[_0x469e67(0x17a)],'error':_0x469e67(0x17b)});continue;}const _0x591ca5=await readFile(_0x1c7357[_0x469e67(0x192)],_0x469e67(0x171)),_0xa067b4=stripLocalSqlMetadata(_0x591ca5,_0x1c7357[_0x469e67(0x17f)]),_0x11c4d2=_0x1c7357[_0x469e67(0x180)]||_0x3b9273[_0x469e67(0x180)],_0x3a4051=await resolveTargetDbBinding(_0x12036e[_0x469e67(0x16a)],_0x1c7357,_0x3b9273),_0x26f2f4=await updateSqlQuery({'id':_0x3b9273[_0x469e67(0x1a3)],'appCode':_0x12036e['appCode'],'sqlCode':_0x1c7357['sqlCode'],'sqlName':_0x11c4d2,'dbId':_0x3a4051[_0x469e67(0x181)],'version':_0x3b9273['version'],'sqlContent':_0xa067b4,'sqlConfig':_0x3b9273[_0x469e67(0x17c)]??undefined}),_0x44e413=_0x26f2f4[_0x469e67(0x181)]?await getDbName(_0x12036e['appCode'],Number(_0x26f2f4[_0x469e67(0x181)]))[_0x469e67(0x199)](()=>_0x3a4051[_0x469e67(0x182)]):_0x3a4051[_0x469e67(0x182)];_0x1121ee[_0x469e67(0x16b)][_0x1c7357[_0x469e67(0x17a)]]={...buildSqlLockEntry(_0x26f2f4,_0xa067b4,_0x3093dd,{'dbName':_0x44e413}),'path':_0x1c7357[_0x469e67(0x193)],'mode':_0x3b9273[_0x469e67(0x17f)]},await archivePreviousSqlFileIfNeeded(_0x43013c,_0x3b9273[_0x469e67(0x1a5)],_0x1c7357['relativePath']),_0x4ca662[_0x469e67(0x195)]({'sqlCode':_0x1c7357[_0x469e67(0x17a)],'remoteId':_0x3b9273[_0x469e67(0x1a3)]});}catch(_0x36c030){_0x13c00f[_0x469e67(0x195)]({'sqlCode':_0x1c7357[_0x469e67(0x17a)],'error':_0x36c030 instanceof Error?_0x36c030[_0x469e67(0x169)]:String(_0x36c030)});}}return _0x1121ee[_0x469e67(0x172)]=new Date()[_0x469e67(0x19e)](),await writeSqlLockFile(_0x43013c[_0x469e67(0x175)],_0x21d693),{'ok':_0x13c00f['length']===0x0,'data':{'pushed':_0x4ca662,'skipped':_0x4a441e,'failed':_0x13c00f},'message':_0x469e67(0x184)+_0x4ca662['length']+_0x469e67(0x19a)+_0x4a441e[_0x469e67(0x177)]+_0x469e67(0x168)+_0x13c00f[_0x469e67(0x177)]+_0x469e67(0x176)};}};async function archivePreviousSqlFileIfNeeded(_0x6f3bc7,_0x2fed95,_0x53c680){const _0x1c3a39=a163_0x13e4d0;if(!_0x2fed95||_0x2fed95===_0x53c680)return;const _0x6b9664=join(_0x6f3bc7[_0x1c3a39(0x16f)],_0x2fed95);if(!await fileExists(_0x6b9664))return;const _0x2306c0=await moveToTrash(_0x6f3bc7['projectRoot'],_0x6f3bc7[_0x1c3a39(0x196)],_0x6b9664);await cleanupEmptyDirectories(dirname(_0x6b9664),_0x6f3bc7[_0x1c3a39(0x16f)]),void _0x2306c0;}async function moveToTrash(_0x31d9b2,_0x58e3c9,_0x18aea1){const _0x4640bd=a163_0x13e4d0,_0x5137f7=new Date()['toISOString']()[_0x4640bd(0x1a1)](/[:.]/g,'-'),_0xa8f30c=relative(_0x31d9b2,_0x18aea1),_0x256089=join(_0x58e3c9,_0x5137f7,_0xa8f30c);return await mkdir(dirname(_0x256089),{'recursive':!![]}),await rename(_0x18aea1,_0x256089),_0x256089;}async function cleanupEmptyDirectories(_0x11df67,_0x13bbfa){const _0xfd47e1=a163_0x13e4d0;let _0x44a6f7=resolve(_0x11df67);const _0x979410=resolve(_0x13bbfa);while(_0x44a6f7[_0xfd47e1(0x189)](''+_0x979410+sep)||_0x44a6f7===_0x979410){if(_0x44a6f7===_0x979410)return;try{const _0x9598c6=await readdir(_0x44a6f7);if(_0x9598c6[_0xfd47e1(0x177)]>0x0)return;await rmdir(_0x44a6f7);}catch{return;}_0x44a6f7=dirname(_0x44a6f7);}}async function resolveTargetDbBinding(_0x269eb7,_0x237b69,_0x315615){const _0x4f06c9=a163_0x13e4d0,_0x34e774=_0x237b69[_0x4f06c9(0x174)];if(!_0x34e774)return{'dbId':_0x315615[_0x4f06c9(0x181)],'dbName':_0x315615[_0x4f06c9(0x182)]};const _0x2adfbd=buildDbDirectoryName(_0x315615['dbName'],_0x315615['dbId']);if(_0x34e774===_0x2adfbd)return{'dbId':_0x315615[_0x4f06c9(0x181)],'dbName':_0x315615['dbName']};const _0x25c460=parseExplicitDbDirectory(_0x34e774);if(_0x25c460!=null)return{'dbId':_0x25c460,'dbName':await getDbName(_0x269eb7,_0x25c460)[_0x4f06c9(0x199)](()=>undefined)};const _0x38babe=await listDatabases(_0x269eb7),_0x19d331=_0x38babe['filter'](_0x29ff7a=>buildDbDirectoryName(_0x29ff7a[_0x4f06c9(0x182)],_0x29ff7a[_0x4f06c9(0x181)])===_0x34e774);if(_0x19d331[_0x4f06c9(0x177)]===0x1)return{'dbId':_0x19d331[0x0][_0x4f06c9(0x181)],'dbName':_0x19d331[0x0][_0x4f06c9(0x182)]};if(_0x19d331[_0x4f06c9(0x177)]===0x0)throw CliErrors[_0x4f06c9(0x1a6)](_0x4f06c9(0x194)+_0x34e774+'\x22\x20for\x20sqlCode\x20'+_0x237b69[_0x4f06c9(0x17a)]+'.');const _0x368fcf=_0x19d331[_0x4f06c9(0x18e)](_0x11ce13=>_0x11ce13[_0x4f06c9(0x182)]+'\x20('+_0x11ce13[_0x4f06c9(0x181)]+')')[_0x4f06c9(0x198)](',\x20');throw CliErrors[_0x4f06c9(0x1a6)](_0x4f06c9(0x1a0)+_0x34e774+_0x4f06c9(0x1a8)+_0x237b69[_0x4f06c9(0x17a)]+':\x20'+_0x368fcf);}function parseExplicitDbDirectory(_0x18cf87){const _0xda2e7f=a163_0x13e4d0,_0xd3691a=/^db-(\d+)$/[_0xda2e7f(0x18a)](_0x18cf87);if(!_0xd3691a)return null;const _0x172e92=Number(_0xd3691a[0x1]);return Number['isFinite'](_0x172e92)&&_0x172e92>0x0?_0x172e92:null;}
|
package/lib/commands/sql/save.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a164_0x5b9bbd=a164_0xc130;function a164_0xc130(_0x586ec5,_0xc8c6fc){_0x586ec5=_0x586ec5-0x17a;const _0x14c1e5=a164_0x14c1();let _0xc13015=_0x14c1e5[_0x586ec5];return _0xc13015;}(function(_0x441dd6,_0x1eff71){const _0x4454f9=a164_0xc130,_0x522509=_0x441dd6();while(!![]){try{const _0x47084d=parseInt(_0x4454f9(0x186))/0x1+parseInt(_0x4454f9(0x187))/0x2+-parseInt(_0x4454f9(0x17b))/0x3*(parseInt(_0x4454f9(0x18c))/0x4)+-parseInt(_0x4454f9(0x188))/0x5*(parseInt(_0x4454f9(0x17a))/0x6)+parseInt(_0x4454f9(0x17c))/0x7*(parseInt(_0x4454f9(0x184))/0x8)+-parseInt(_0x4454f9(0x181))/0x9*(-parseInt(_0x4454f9(0x18a))/0xa)+-parseInt(_0x4454f9(0x17f))/0xb;if(_0x47084d===_0x1eff71)break;else _0x522509['push'](_0x522509['shift']());}catch(_0x2e516b){_0x522509['push'](_0x522509['shift']());}}}(a164_0x14c1,0x56ad4));import{CliErrors}from'../../errors.js';function a164_0x14c1(){const _0x45da9a=['`rabetbase\x20sql\x20save`\x20has\x20been\x20deprecated.','235336rWxZjF','sql','585634vctaQf','869616opmaQo','373355ikROLp','description','1250840bkfnOk','validation','23448wkCnxy','SQL\x20query\x20display\x20name','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`.','Deprecated:\x20use\x20sql\x20create\x20to\x20create\x20and\x20sql\x20push\x20to\x20update','Query\x20description','6HRXoyS','300gMhigG','105qeyQMM','string','write','6279702cLYsSq','Target\x20database\x20—\x20accepts\x20a\x20numeric\x20ID\x20or\x20database\x20name\x20(e.g.\x20ecommerce_db)','9iZXkMg','Path\x20to\x20the\x20SQL\x20file'];a164_0x14c1=function(){return _0x45da9a;};return a164_0x14c1();}import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';const SQL_SAVE_DEPRECATED_HINT=[a164_0x5b9bbd(0x183),'Create\x20new\x20SQL\x20with\x20`rabetbase\x20sql\x20create\x20--name\x20<name>\x20--db-id\x20<id>\x20--mode\x20sql|mybatisXml`.',a164_0x5b9bbd(0x18e)]['join']('\x0a');export const sqlSave={'service':a164_0x5b9bbd(0x185),'command':'save','description':a164_0x5b9bbd(0x18f),'risk':a164_0x5b9bbd(0x17e),'requiresAuth':![],'requiresAppCode':![],'flags':[{'name':'file','type':a164_0x5b9bbd(0x17d),'required':!![],'description':a164_0x5b9bbd(0x182)},SQLCODE_FLAG_OPTIONAL,{'name':'sqlname','type':'string','description':a164_0x5b9bbd(0x18d)},{'name':'db','type':a164_0x5b9bbd(0x17d),'description':a164_0x5b9bbd(0x180)},{'name':a164_0x5b9bbd(0x189),'type':a164_0x5b9bbd(0x17d),'description':a164_0x5b9bbd(0x190)}],async 'validate'(){const _0x5f3aca=a164_0x5b9bbd;throw CliErrors[_0x5f3aca(0x18b)](SQL_SAVE_DEPRECATED_HINT);},async 'execute'(){const _0x1713d9=a164_0x5b9bbd;throw CliErrors[_0x1713d9(0x18b)](SQL_SAVE_DEPRECATED_HINT);}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x215aa0,_0x5169fd){const _0x24cce5=a165_0x3654,_0x4f6440=_0x215aa0();while(!![]){try{const _0x4d4926=parseInt(_0x24cce5(0x75))/0x1+parseInt(_0x24cce5(0x67))/0x2+parseInt(_0x24cce5(0x73))/0x3+-parseInt(_0x24cce5(0x90))/0x4*(parseInt(_0x24cce5(0x79))/0x5)+-parseInt(_0x24cce5(0x7f))/0x6+parseInt(_0x24cce5(0x88))/0x7*(-parseInt(_0x24cce5(0x82))/0x8)+parseInt(_0x24cce5(0x83))/0x9;if(_0x4d4926===_0x5169fd)break;else _0x4f6440['push'](_0x4f6440['shift']());}catch(_0x4791a5){_0x4f6440['push'](_0x4f6440['shift']());}}}(a165_0x4c61,0x49fbd));import{createInterface}from'node:readline';import{join}from'node:path';import{buildDefaultSqlFileName,buildSqlRelativePath,detectSqlMode}from'../../core/sql-sync/utils.js';export const SQL_LOCAL_REL_DIR='.rabetbase/sql';export function buildSqlLockEntry(_0x35adbf,_0x4b456,_0x5ee8f6,_0x68bf90){const _0x2b2f75=a165_0x3654,_0x16f64f=detectSqlMode(_0x4b456);return{'path':buildSqlRelativePath(_0x35adbf[_0x2b2f75(0x85)],_0x35adbf[_0x2b2f75(0x7d)],_0x68bf90?.['dbName'],_0x16f64f,_0x35adbf[_0x2b2f75(0x7c)]),'hash':_0x5ee8f6,'remoteId':_0x35adbf['id'],'version':_0x35adbf[_0x2b2f75(0x68)],'dbId':Number(_0x35adbf['dbId']),'dbName':_0x68bf90?.[_0x2b2f75(0x93)],'sqlName':_0x35adbf[_0x2b2f75(0x7d)],'sqlConfig':_0x35adbf[_0x2b2f75(0x7a)]??undefined,'mode':_0x16f64f};}export function cloneSqlLockData(_0x2d2f85){const _0x17da0f=a165_0x3654;return{'apps':Object[_0x17da0f(0x77)](Object[_0x17da0f(0x70)](_0x2d2f85['apps'])[_0x17da0f(0x8f)](([_0x1e54aa,_0x259cf8])=>[_0x1e54aa,{'sqlRoot':_0x259cf8[_0x17da0f(0x8c)],'lastSync':_0x259cf8[_0x17da0f(0x71)],'sqls':{..._0x259cf8[_0x17da0f(0x7b)]}}]))};}export function ensureRemoteSqlContent(_0x373448){const _0x5e0a25=a165_0x3654;return _0x373448[_0x5e0a25(0x6f)]??'';}export function buildLocalSqlFileContent(_0xdbbe25,_0x2cfa5d,_0x56b677){const _0x5fc62a=a165_0x3654,_0x343c04=_0x56b677?.[_0x5fc62a(0x87)]??detectSqlMode(_0x2cfa5d),_0x3de068=stripLocalSqlMetadata(_0x2cfa5d,_0x343c04)[_0x5fc62a(0x81)](),_0x513970=[...buildMetadataHeaderLines({'sqlCode':_0xdbbe25[_0x5fc62a(0x85)],'sqlName':_0xdbbe25['sqlName'],'dbId':_0xdbbe25[_0x5fc62a(0x7c)],'dbName':_0x56b677?.[_0x5fc62a(0x93)],'mode':_0x343c04,'syncedAt':_0x56b677?.[_0x5fc62a(0x78)],'description':_0x56b677?.[_0x5fc62a(0x89)]},_0x343c04),'',_0x3de068],_0x4fe02b=_0x513970[_0x5fc62a(0x76)]('\x0a');return _0x4fe02b[_0x5fc62a(0x6a)]('\x0a')?_0x4fe02b:_0x4fe02b+'\x0a';}export function stripLocalSqlMetadata(_0x31e980,_0xb303c8){const _0x216503=a165_0x3654,_0x496141=_0x31e980[_0x216503(0x8e)](/\r\n/g,'\x0a')[_0x216503(0x8b)]('\x0a'),_0x398c05=[];let _0x35b7d1=0x0;if(_0xb303c8===_0x216503(0x8d))while(_0x35b7d1<_0x496141[_0x216503(0x80)]){const _0x109454=_0x496141[_0x35b7d1]??'';if(/^\s*<!--\s*@lovrabet\./['test'](_0x109454)){_0x35b7d1++;continue;}if(_0x109454[_0x216503(0x81)]()===''&&_0x35b7d1>0x0){_0x35b7d1++;continue;}break;}else while(_0x35b7d1<_0x496141[_0x216503(0x80)]){const _0x6160dc=_0x496141[_0x35b7d1]??'';if(/^\s*--\s*@lovrabet\./['test'](_0x6160dc)){_0x35b7d1++;continue;}if(_0x6160dc[_0x216503(0x81)]()===''&&_0x35b7d1>0x0){_0x35b7d1++;continue;}break;}for(;_0x35b7d1<_0x496141['length'];_0x35b7d1++){_0x398c05[_0x216503(0x6c)](_0x496141[_0x35b7d1]);}return _0x398c05[_0x216503(0x76)]('\x0a')['trimStart']();}export function resolveSqlMode(_0x31108e,_0x2f8e2c){const _0x3ee4cb=a165_0x3654;if(_0x2f8e2c?.[_0x3ee4cb(0x87)])return _0x2f8e2c[_0x3ee4cb(0x87)];return detectSqlMode(_0x31108e);}export function resolveSqlFileName(_0x3dd17f,_0x4a82ed,_0x14e124){const _0x328fd0=a165_0x3654;if(_0x14e124?.[_0x328fd0(0x6d)])return _0x14e124[_0x328fd0(0x6d)];if(_0x14e124?.['sqlName']||_0x14e124?.[_0x328fd0(0x93)])return buildSqlRelativePath(_0x3dd17f,_0x14e124?.[_0x328fd0(0x7d)],_0x14e124?.[_0x328fd0(0x93)],resolveSqlMode(_0x4a82ed,_0x14e124),_0x14e124?.[_0x328fd0(0x7c)]);return buildDefaultSqlFileName(_0x3dd17f,resolveSqlMode(_0x4a82ed,_0x14e124));}export function resolveSqlLocalDir(_0x495dfa,_0x36b9fb){return join(_0x495dfa,SQL_LOCAL_REL_DIR,_0x36b9fb);}function a165_0x3654(_0x2d7103,_0x5b9d86){_0x2d7103=_0x2d7103-0x67;const _0x4c6156=a165_0x4c61();let _0x3654b5=_0x4c6156[_0x2d7103];return _0x3654b5;}function a165_0x4c61(){const _0x21ef9b=['question','split','sqlRoot','mybatisXml','replace','map','100132JqTQCW','close','toLowerCase','dbName','53686dCjpDd','version','stdin','endsWith','--\x20@lovrabet.','push','path','filter','sqlContent','entries','lastSync','stderr','985215wKWPWa','<!--\x20@lovrabet.','506716cwxqss','join','fromEntries','syncedAt','30RmjtTy','sqlConfig','sqls','dbId','sqlName','\x20[y/N]\x20','3385398mWKLGD','length','trim','81480gHYOEW','1674531aRXXxH','apps','sqlCode','\x20-->','mode','21lxQXWm','description'];a165_0x4c61=function(){return _0x21ef9b;};return a165_0x4c61();}export async function confirmForceOverwrite(_0xb1f5ff){const _0x2dfe9d=a165_0x3654,_0x5788e8=createInterface({'input':process[_0x2dfe9d(0x69)],'output':process[_0x2dfe9d(0x72)]}),_0x153165=await new Promise(_0x4c682c=>{const _0x1fe76f=_0x2dfe9d;_0x5788e8[_0x1fe76f(0x8a)](_0xb1f5ff+_0x1fe76f(0x7e),_0x4c682c);});return _0x5788e8[_0x2dfe9d(0x91)](),['y','yes']['includes'](_0x153165[_0x2dfe9d(0x81)]()[_0x2dfe9d(0x92)]());}export function findSqlLockScope(_0x5341bf,_0x10bb33){const _0xd38bc7=a165_0x3654;return _0x5341bf[_0xd38bc7(0x84)][_0x10bb33];}function buildMetadataHeaderLines(_0x505bd4,_0x2f00a3){const _0x1a2fc7=a165_0x3654,_0x5da5d1=[['sqlCode',_0x505bd4[_0x1a2fc7(0x85)]],['sqlName',_0x505bd4[_0x1a2fc7(0x7d)]],[_0x1a2fc7(0x7c),_0x505bd4['dbId']],['dbName',_0x505bd4[_0x1a2fc7(0x93)]],['mode',_0x505bd4[_0x1a2fc7(0x87)]],[_0x1a2fc7(0x78),_0x505bd4[_0x1a2fc7(0x78)]],[_0x1a2fc7(0x89),_0x505bd4['description']]];if(_0x2f00a3===_0x1a2fc7(0x8d))return _0x5da5d1[_0x1a2fc7(0x6e)](([,_0x55fe8f])=>_0x55fe8f!==undefined&&_0x55fe8f!==null&&String(_0x55fe8f)['trim']()!=='')[_0x1a2fc7(0x8f)](([_0x4100a9,_0x1582c9])=>_0x1a2fc7(0x74)+_0x4100a9+':\x20'+String(_0x1582c9)+_0x1a2fc7(0x86));return _0x5da5d1[_0x1a2fc7(0x6e)](([,_0x417c24])=>_0x417c24!==undefined&&_0x417c24!==null&&String(_0x417c24)[_0x1a2fc7(0x81)]()!=='')['map'](([_0xf14636,_0x2eb7b1])=>_0x1a2fc7(0x6b)+_0xf14636+':\x20'+String(_0x2eb7b1));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a166_0xcd1c(){const _0x10259c=['Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally','59022SimjZJ','sqlRoot','3590037PEpSOD','sqlName','length','20603vKDVje','1072aJCxXD','status','5520WvJnRA','3832KsMiqs','10oHWqZL','Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','80WnbeMr','read','sql','\x20remote-only','appCode','5574439XQTDio','totalCount','hash','boolean','lockFilePath','has','10178oGoisO','218396EcVbAE','\x20unchanged','bool','1324KoBKxc','filePath','sqls','\x20added,\x20','sqlCode','path','relativePath','map','remote','51SYmNab','push','\x20modified,\x20','lockKey'];a166_0xcd1c=function(){return _0x10259c;};return a166_0xcd1c();}const a166_0x76a886=a166_0x365d;(function(_0x1bc00a,_0x513792){const _0x136dcd=a166_0x365d,_0xd234c6=_0x1bc00a();while(!![]){try{const _0x117f61=parseInt(_0x136dcd(0x17c))/0x1*(-parseInt(_0x136dcd(0x191))/0x2)+-parseInt(_0x136dcd(0x171))/0x3*(-parseInt(_0x136dcd(0x18e))/0x4)+parseInt(_0x136dcd(0x182))/0x5*(parseInt(_0x136dcd(0x176))/0x6)+-parseInt(_0x136dcd(0x18d))/0x7*(parseInt(_0x136dcd(0x17f))/0x8)+parseInt(_0x136dcd(0x178))/0x9*(-parseInt(_0x136dcd(0x180))/0xa)+-parseInt(_0x136dcd(0x17b))/0xb*(-parseInt(_0x136dcd(0x17e))/0xc)+parseInt(_0x136dcd(0x187))/0xd;if(_0x117f61===_0x513792)break;else _0xd234c6['push'](_0xd234c6['shift']());}catch(_0x182865){_0xd234c6['push'](_0xd234c6['shift']());}}}(a166_0xcd1c,0x8b637));import{listSqlQueries}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';function a166_0x365d(_0x1f910a,_0x5cdce3){_0x1f910a=_0x1f910a-0x16f;const _0xcd1cde=a166_0xcd1c();let _0x365d5b=_0xcd1cde[_0x1f910a];return _0x365d5b;}import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile}from'../../core/sql-sync/lock.js';const PAGE_SIZE=0x64;async function fetchAllSqlCodes(_0x381da8){const _0x31079b=a166_0x365d,_0x4f39be=[];let _0x5cad86=0x1;while(!![]){const _0x509c8b=await listSqlQueries(_0x381da8,{'currentPage':_0x5cad86,'pageSize':PAGE_SIZE}),_0x33de16=_0x509c8b['tableData']??[];_0x4f39be[_0x31079b(0x172)](..._0x33de16[_0x31079b(0x16f)](_0x57db1c=>_0x57db1c[_0x31079b(0x195)]));if(_0x33de16[_0x31079b(0x17a)]===0x0)break;const _0x599fbb=_0x509c8b['paging']?.[_0x31079b(0x188)];if(_0x599fbb!=null?_0x4f39be[_0x31079b(0x17a)]>=_0x599fbb:_0x33de16[_0x31079b(0x17a)]<PAGE_SIZE)break;_0x5cad86++;}return _0x4f39be;}export const sqlStatus={'service':a166_0x76a886(0x184),'command':a166_0x76a886(0x17d),'description':a166_0x76a886(0x181),'risk':a166_0x76a886(0x183),'flags':[{'name':a166_0x76a886(0x170),'type':a166_0x76a886(0x18a),'description':a166_0x76a886(0x175)}],async 'execute'(_0x9189df){const _0x535f1a=a166_0x76a886,_0x1f648f=loadSqlProjectConfig(_0x9189df[_0x535f1a(0x186)]),_0x24757f=await readSqlLockFile(_0x1f648f[_0x535f1a(0x18b)]),{appLock:_0x18f36c}=ensureSqlLockScope(_0x24757f??createEmptySqlLock(),_0x1f648f['appCode'],_0x1f648f[_0x535f1a(0x177)],'status'),_0x23bac5=await scanLocalSqlQueries(_0x1f648f),_0x18adef=[],_0x2fa727=[],_0x3ba2d2=[],_0x3f6bae=[],_0x2d478f=new Set(_0x23bac5[_0x535f1a(0x16f)](_0x3aaae9=>_0x3aaae9[_0x535f1a(0x174)]));for(const _0x324170 of _0x23bac5){const _0x37e278=await computeSqlFileHash(_0x324170[_0x535f1a(0x192)]),_0x1ac43d=_0x18f36c['sqls'][_0x324170['lockKey']],_0xac8c0e=!!_0x1ac43d&&_0x1ac43d[_0x535f1a(0x196)]!==_0x324170[_0x535f1a(0x197)],_0x25ecfa=!!_0x1ac43d&&!!_0x324170[_0x535f1a(0x179)]&&_0x1ac43d['sqlName']!==_0x324170[_0x535f1a(0x179)];if(!_0x1ac43d)_0x18adef[_0x535f1a(0x172)](_0x324170[_0x535f1a(0x174)]);else _0x1ac43d[_0x535f1a(0x189)]!==_0x37e278||_0xac8c0e||_0x25ecfa?_0x2fa727[_0x535f1a(0x172)](_0x324170['lockKey']):_0x3ba2d2[_0x535f1a(0x172)](_0x324170[_0x535f1a(0x174)]);}for(const _0x1aea1e of Object['keys'](_0x18f36c[_0x535f1a(0x193)])){!_0x2d478f[_0x535f1a(0x18c)](_0x1aea1e)&&_0x3f6bae[_0x535f1a(0x172)](_0x1aea1e);}const _0x340d79=[];if(_0x9189df[_0x535f1a(0x190)](_0x535f1a(0x170))){const _0x9d23d2=await fetchAllSqlCodes(_0x9189df[_0x535f1a(0x186)]);for(const _0x3736ce of _0x9d23d2){!_0x2d478f[_0x535f1a(0x18c)](_0x3736ce)&&!_0x18f36c['sqls'][_0x3736ce]&&_0x340d79['push'](_0x3736ce);}}const _0x178ca5=_0x18adef[_0x535f1a(0x17a)]===0x0&&_0x2fa727[_0x535f1a(0x17a)]===0x0&&_0x3f6bae['length']===0x0&&_0x340d79[_0x535f1a(0x17a)]===0x0;return{'ok':!![],'data':{'added':_0x18adef,'modified':_0x2fa727,'missing':_0x3f6bae,'unchanged':_0x3ba2d2,'remoteOnly':_0x340d79},'message':_0x178ca5?'All\x20SQL\x20queries\x20are\x20in\x20sync.':_0x18adef[_0x535f1a(0x17a)]+_0x535f1a(0x194)+_0x2fa727['length']+_0x535f1a(0x173)+_0x3f6bae[_0x535f1a(0x17a)]+'\x20missing,\x20'+_0x3ba2d2['length']+_0x535f1a(0x18f)+(_0x340d79[_0x535f1a(0x17a)]>0x0?',\x20'+_0x340d79[_0x535f1a(0x17a)]+_0x535f1a(0x185):'')};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a167_0x366081=a167_0x4be0;(function(_0x112846,_0x2ef6a5){const _0x56db90=a167_0x4be0,_0x118513=_0x112846();while(!![]){try{const _0x3b9e27=parseInt(_0x56db90(0x186))/0x1*(parseInt(_0x56db90(0x18c))/0x2)+parseInt(_0x56db90(0x193))/0x3*(-parseInt(_0x56db90(0x1a3))/0x4)+parseInt(_0x56db90(0x18f))/0x5+-parseInt(_0x56db90(0x1ba))/0x6*(parseInt(_0x56db90(0x1b3))/0x7)+-parseInt(_0x56db90(0x18e))/0x8*(parseInt(_0x56db90(0x19c))/0x9)+parseInt(_0x56db90(0x19a))/0xa*(parseInt(_0x56db90(0x192))/0xb)+-parseInt(_0x56db90(0x1a7))/0xc*(-parseInt(_0x56db90(0x1a0))/0xd);if(_0x3b9e27===_0x2ef6a5)break;else _0x118513['push'](_0x118513['shift']());}catch(_0x57c37a){_0x118513['push'](_0x118513['shift']());}}}(a167_0x5734,0xe2283));import{readFileSync,existsSync}from'node:fs';import{resolve}from'node:path';import{validateSql}from'../../core/sql-validator.js';import{getDatasetDetail,listDatasets}from'../../core/api-client.js';function a167_0x4be0(_0x560b46,_0x8ea308){_0x560b46=_0x560b46-0x184;const _0x57341e=a167_0x5734();let _0x4be0a7=_0x57341e[_0x560b46];return _0x4be0a7;}import{CliErrors}from'../../errors.js';import{assertDatasetIsDbTableBacked,filterDbTableBackedDatasets}from'../../commands/dataset/capability.js';export const sqlValidate={'service':a167_0x366081(0x1a6),'command':a167_0x366081(0x196),'description':a167_0x366081(0x1a9),'risk':a167_0x366081(0x19b),'flags':[{'name':a167_0x366081(0x1a4),'type':a167_0x366081(0x1b5),'description':'Path\x20to\x20the\x20SQL\x20file\x20to\x20validate'},{'name':a167_0x366081(0x1a6),'type':'string','description':a167_0x366081(0x1af)},{'name':a167_0x366081(0x1bb),'type':'string','description':a167_0x366081(0x19d)}],async 'execute'(_0x3cb998){const _0x431035=a167_0x366081,_0x4dbf01=_0x3cb998[_0x431035(0x198)](_0x431035(0x1a4)),_0x54a19b=_0x3cb998[_0x431035(0x198)](_0x431035(0x1a6));if(!_0x4dbf01&&!_0x54a19b)throw CliErrors[_0x431035(0x1b4)](_0x431035(0x1a4),_0x431035(0x1b7));let _0x370688;if(_0x4dbf01){const _0x2f6ada=resolve(process[_0x431035(0x194)](),_0x4dbf01);if(!existsSync(_0x2f6ada))throw CliErrors[_0x431035(0x197)](_0x431035(0x1aa)+_0x2f6ada);_0x370688=readFileSync(_0x2f6ada,_0x431035(0x184));}else _0x370688=_0x54a19b;const _0x5d36c9=validateSql(_0x370688),_0x122cc3={'valid':_0x5d36c9[_0x431035(0x18b)],'sqlType':_0x5d36c9[_0x431035(0x190)][_0x431035(0x1a5)],'isSelectOnly':_0x5d36c9[_0x431035(0x190)][_0x431035(0x18a)],'isDangerous':_0x5d36c9[_0x431035(0x190)][_0x431035(0x1b0)],'tables':_0x5d36c9[_0x431035(0x1ad)],'parameters':_0x5d36c9[_0x431035(0x188)],'message':_0x5d36c9['message']};_0x5d36c9[_0x431035(0x190)][_0x431035(0x187)]&&(_0x122cc3[_0x431035(0x187)]=_0x5d36c9[_0x431035(0x190)][_0x431035(0x187)]);const _0x54741a=_0x3cb998[_0x431035(0x198)](_0x431035(0x1bb));if(_0x54741a&&_0x5d36c9[_0x431035(0x18b)]){const _0x43f140=_0x54741a[_0x431035(0x1ac)](',')['map'](_0x478983=>_0x478983[_0x431035(0x1b6)]())[_0x431035(0x1ae)](Boolean),_0x9d8b94=[],_0xf0328f=filterDbTableBackedDatasets(await listDatasets(_0x3cb998[_0x431035(0x1a1)])),_0x567010=new Map(_0xf0328f[_0x431035(0x19e)](_0x106213=>[_0x106213[_0x431035(0x1b2)]?.[_0x431035(0x1ab)]?.['toLowerCase'](),_0x106213]));for(const _0x2ce671 of _0x5d36c9[_0x431035(0x1ad)]){const _0x45f727=_0x567010[_0x431035(0x1b1)](_0x2ce671[_0x431035(0x1b8)]());!_0x45f727&&_0x9d8b94[_0x431035(0x1a8)](_0x431035(0x199)+_0x2ce671+_0x431035(0x19f));}for(const _0x18e075 of _0x43f140){let _0x433d3b;try{_0x433d3b=await getDatasetDetail(_0x18e075);}catch{_0x9d8b94[_0x431035(0x1a8)]('Dataset\x20\x22'+_0x18e075+_0x431035(0x191));continue;}assertDatasetIsDbTableBacked(_0x433d3b,'SQL\x20schema\x20validation');const _0x3757c4=Array[_0x431035(0x18d)](_0x433d3b[_0x431035(0x1b9)])?_0x433d3b[_0x431035(0x1b9)]:[],_0x177c0=new Set(_0x3757c4[_0x431035(0x19e)](_0x36e5f5=>_0x36e5f5[_0x431035(0x1bc)]?.[_0x431035(0x1b8)]())),_0x200a88=_0x433d3b['dbtableConfig']?.[_0x431035(0x1ab)]||_0x433d3b[_0x431035(0x1ab)]||_0x18e075;_0x122cc3[_0x431035(0x195)+_0x200a88]={'code':_0x18e075,'tableName':_0x200a88,'fieldCount':_0x177c0[_0x431035(0x1a2)],'fields':Array['from'](_0x177c0)};}_0x9d8b94[_0x431035(0x189)]>0x0&&(_0x122cc3['schemaWarnings']=_0x9d8b94);}return{'ok':_0x5d36c9['valid'],'data':_0x122cc3,'message':_0x5d36c9[_0x431035(0x185)]};}};function a167_0x5734(){const _0x3cb0c3=['schema:','validate','validation','str','Table\x20\x22','8175670BLBgSM','read','29718IqzRyo','Comma-separated\x20dataset\x20codes\x20to\x20cross-check\x20table/column\x20names\x20against','map','\x22\x20not\x20found\x20in\x20any\x20dataset','8303581WGYmte','appCode','size','60JaKOpE','file','type','sql','12pzkjgx','push','Validate\x20SQL\x20content\x20without\x20saving\x20(type\x20detection,\x20parameter\x20extraction,\x20optional\x20schema\x20check)','File\x20not\x20found:\x20','tableName','split','tables','filter','Inline\x20SQL\x20content\x20to\x20validate\x20(alternative\x20to\x20--file)','isDangerous','get','dbtableConfig','111678WNQMuV','flagMissing','string','trim','Provide\x20--file\x20or\x20--sql','toLowerCase','fields','18lvUECw','schemas','name','utf-8','message','23WgNbJr','reason','parameters','length','isSelectOnly','valid','39642ZqeAGB','isArray','4184agWTeC','6979900pwZnxk','sqlType','\x22\x20not\x20found\x20or\x20not\x20accessible','11SlcMtd','121404awkBFl','cwd'];a167_0x5734=function(){return _0x3cb0c3;};return a167_0x5734();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a168_0xf07df3=a168_0x2979;(function(_0x16e258,_0x120f56){const _0x1ecaa9=a168_0x2979,_0xab612b=_0x16e258();while(!![]){try{const _0x4ae999=-parseInt(_0x1ecaa9(0xa1))/0x1+-parseInt(_0x1ecaa9(0xa4))/0x2+-parseInt(_0x1ecaa9(0x9b))/0x3+parseInt(_0x1ecaa9(0x9d))/0x4+-parseInt(_0x1ecaa9(0x9a))/0x5*(parseInt(_0x1ecaa9(0xa0))/0x6)+-parseInt(_0x1ecaa9(0xa2))/0x7+parseInt(_0x1ecaa9(0x9f))/0x8*(parseInt(_0x1ecaa9(0x9c))/0x9);if(_0x4ae999===_0x120f56)break;else _0xab612b['push'](_0xab612b['shift']());}catch(_0x4ce4af){_0xab612b['push'](_0xab612b['shift']());}}}(a168_0x1f86,0x4f587));function a168_0x2979(_0x5e9b09,_0x3569eb){_0x5e9b09=_0x5e9b09-0x9a;const _0x1f86dd=a168_0x1f86();let _0x297905=_0x1f86dd[_0x5e9b09];return _0x297905;}import{buildAppAddFlags,runAppAdd,validateAppName}from'../../commands/common/app-registry.js';function a168_0x1f86(){const _0x4af738=['workspace','workspace\x20add','write','10TjYNos','1130118Kplvky','9JxLfzE','1806124TeQjkD','add','10684952VpCLpQ','123582ioCHRA','612982dXTyRm','1202607SuRuvu','Register\x20an\x20app\x20profile\x20in\x20the\x20current\x20workspace\x20(or\x20--global)','518936QJsTvy'];a168_0x1f86=function(){return _0x4af738;};return a168_0x1f86();}export const workspaceAddDefinition={'service':a168_0xf07df3(0xa5),'command':a168_0xf07df3(0x9e),'description':a168_0xf07df3(0xa3),'risk':a168_0xf07df3(0xa7),'requiresAuth':![],'requiresAppCode':![],'args':[{'name':'name','description':'App\x20profile\x20name','required':!![]}],'flags':buildAppAddFlags(),'validate':_0x26ddcd=>validateAppName(_0x26ddcd,a168_0xf07df3(0xa6)),'execute':_0x291db4=>runAppAdd(_0x291db4,a168_0xf07df3(0xa6))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a169_0x262afc=a169_0x22ed;(function(_0x324e74,_0x1cee21){const _0x2c4b24=a169_0x22ed,_0x1c59c1=_0x324e74();while(!![]){try{const _0xa2f531=-parseInt(_0x2c4b24(0x97))/0x1+-parseInt(_0x2c4b24(0x84))/0x2*(-parseInt(_0x2c4b24(0x99))/0x3)+-parseInt(_0x2c4b24(0x9e))/0x4*(-parseInt(_0x2c4b24(0xa0))/0x5)+-parseInt(_0x2c4b24(0x75))/0x6*(parseInt(_0x2c4b24(0xa6))/0x7)+parseInt(_0x2c4b24(0x92))/0x8*(-parseInt(_0x2c4b24(0x9b))/0x9)+parseInt(_0x2c4b24(0x6f))/0xa+parseInt(_0x2c4b24(0xaa))/0xb;if(_0xa2f531===_0x1cee21)break;else _0x1c59c1['push'](_0x1c59c1['shift']());}catch(_0x397f89){_0x1c59c1['push'](_0x1c59c1['shift']());}}}(a169_0x4bf7,0x9f330));import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';import{RABETBASE_ENV_VALUES}from'../../constant/env.js';import{RABETBASE_OUTPUT_FORMAT_VALUES}from'../../constant/output.js';import{RISK_LEVEL_VALUES}from'../../constant/risk.js';import{validateAppcode}from'../../commands/common/validate.js';import{readConfigFile,readRawConfigWithLayers,resolveWriteConfigPath,writeConfigFile}from'../../context.js';import{workspaceAddDefinition}from'../../commands/workspace/add.js';function a169_0x22ed(_0x4e4384,_0x3b6fc5){_0x4e4384=_0x4e4384-0x6e;const _0x4bf747=a169_0x4bf7();let _0x22ed47=_0x4bf747[_0x4e4384];return _0x22ed47;}import{workspaceRemoveDefinition}from'../../commands/workspace/remove.js';const WORKSPACE_USAGE=CLI_BIN_NAME+a169_0x262afc(0x87),SAFE_PROFILE_KEYS=[a169_0x262afc(0x73),a169_0x262afc(0x94),a169_0x262afc(0x9d),a169_0x262afc(0x8f),a169_0x262afc(0x74),'riskLevel',a169_0x262afc(0x8c)],workspaceFlags=[{'name':a169_0x262afc(0x88),'type':a169_0x262afc(0x7f),'description':a169_0x262afc(0x76)},{'name':a169_0x262afc(0x73),'type':a169_0x262afc(0x7f),'description':a169_0x262afc(0x93)},{'name':a169_0x262afc(0x94),'type':a169_0x262afc(0x7f),'description':a169_0x262afc(0x8e),'enum':[...RABETBASE_ENV_VALUES]},{'name':a169_0x262afc(0x9d),'type':'string','description':a169_0x262afc(0xa5)},{'name':a169_0x262afc(0x91),'type':a169_0x262afc(0x7f),'description':a169_0x262afc(0x80),'enum':[...RABETBASE_OUTPUT_FORMAT_VALUES]},{'name':a169_0x262afc(0x74),'type':a169_0x262afc(0x85),'description':a169_0x262afc(0x89)},{'name':a169_0x262afc(0x95),'type':a169_0x262afc(0x7f),'description':a169_0x262afc(0x71),'enum':[...RISK_LEVEL_VALUES]},{'name':a169_0x262afc(0x8c),'type':a169_0x262afc(0x7f),'description':'Locale\x20for\x20this\x20workspace\x20app\x20profile'}];function isRecord(_0x571612){const _0x3fe929=a169_0x262afc;return!!_0x571612&&typeof _0x571612===_0x3fe929(0xa1)&&!Array[_0x3fe929(0x9f)](_0x571612);}function assertValidAppcode(_0x5190ab){const _0x5b3d50=a169_0x262afc,{valid:_0x460d8f,message:_0x10a7e4}=validateAppcode(_0x5190ab);if(!_0x460d8f)throw CliErrors[_0x5b3d50(0x6e)](_0x5b3d50(0x8a)+_0x5190ab,_0x10a7e4);}function a169_0x4bf7(){const _0x208359=['650pEXWnR','object','workspace.','trim','write','API\x20directory\x20path\x20for\x20this\x20workspace\x20app\x20profile','9219jkXcUw','Workspace\x20','Initialize\x20the\x20current\x20workspace\x20app\x20binding','\x20(appcode:\x20','26219424ByJuMz','validation','9230lSafHf','updated','Risk\x20level\x20for\x20this\x20workspace\x20app\x20profile','initialized','appcode','pageSize','1842nXPkSF','App\x20profile\x20name\x20to\x20use\x20in\x20this\x20workspace','defaultApp','flag','init','apps',').\x20Config:\x20','App\x20\x22','\x20--app\x20','Missing\x20workspace\x20app\x20selector.','string','Default\x20output\x20format\x20for\x20this\x20workspace\x20app\x20profile','use','\x22\x20not\x20found.','length','2jVUTjQ','number','Pass\x20--appcode\x20<code>,\x20or\x20choose\x20one\x20of:\x20','\x20workspace\x20<init|use>\x20--app\x20<name>\x20[--appcode\x20<code>]','app','Default\x20page\x20size\x20for\x20this\x20workspace\x20app\x20profile','Invalid\x20appcode:\x20','\x20workspace\x20use\x20--app\x20<name>`.','locale','workspace','Target\x20environment','format','str','defaultFormat','32ZmSwFB','App\x20code\x20to\x20bind\x20to\x20this\x20workspace','env','riskLevel','Use\x20`','901206OBBjOK','project','96762mtcmwi','globalConfig','2032866pUMKsP','\x20workspace\x20init\x20--appcode\x20<code>`\x20or\x20`','apiDir','13672BPkyed','isArray'];a169_0x4bf7=function(){return _0x208359;};return a169_0x4bf7();}function sanitizeProfile(_0xac97fb){if(!isRecord(_0xac97fb))return{};const _0x15ae60={};for(const _0x4b8475 of SAFE_PROFILE_KEYS){if(_0xac97fb[_0x4b8475]!==undefined)_0x15ae60[_0x4b8475]=_0xac97fb[_0x4b8475];}return _0x15ae60;}function cloneProfile(_0x65236a){return isRecord(_0x65236a)?{..._0x65236a}:{};}function collectWorkspaceProfileOverrides(_0x4f1ffa){const _0x4b1ff5=a169_0x262afc,_0x3b66ed={},_0x15f3c7=_0x4f1ffa[_0x4b1ff5(0x90)](_0x4b1ff5(0x94)),_0x246a8d=_0x4f1ffa[_0x4b1ff5(0x90)](_0x4b1ff5(0x9d)),_0x11968b=_0x4f1ffa[_0x4b1ff5(0x90)](_0x4b1ff5(0x91)),_0x1c6058=_0x4f1ffa[_0x4b1ff5(0x78)](_0x4b1ff5(0x74)),_0x1c638c=_0x4f1ffa[_0x4b1ff5(0x90)](_0x4b1ff5(0x95)),_0x3f6c3e=_0x4f1ffa[_0x4b1ff5(0x90)](_0x4b1ff5(0x8c));if(_0x15f3c7)_0x3b66ed[_0x4b1ff5(0x94)]=_0x15f3c7;if(_0x246a8d)_0x3b66ed['apiDir']=_0x246a8d;if(_0x11968b)_0x3b66ed['format']=_0x11968b;if(_0x1c6058!==undefined&&_0x1c6058!=='')_0x3b66ed[_0x4b1ff5(0x74)]=Number(_0x1c6058);if(_0x1c638c)_0x3b66ed[_0x4b1ff5(0x95)]=_0x1c638c;if(_0x3f6c3e)_0x3b66ed[_0x4b1ff5(0x8c)]=_0x3f6c3e;return _0x3b66ed;}async function validateWorkspaceArgs(_0x2c30a6){const _0x2e7869=a169_0x262afc,_0x30c0c5=_0x2c30a6['str'](_0x2e7869(0x88))[_0x2e7869(0xa3)](),_0x375a54=_0x2c30a6[_0x2e7869(0x90)](_0x2e7869(0x73))[_0x2e7869(0xa3)]();if(!_0x30c0c5&&!_0x375a54)throw CliErrors['validation'](_0x2e7869(0x7e),_0x2e7869(0x96)+CLI_BIN_NAME+'\x20workspace\x20init\x20--appcode\x20<code>`\x20or\x20`'+CLI_BIN_NAME+'\x20workspace\x20use\x20--app\x20<name>`.');if(_0x375a54)assertValidAppcode(_0x375a54);}function resolveKnownApps(){const _0x7b852b=a169_0x262afc,{config:_0x5987ef,layers:_0x44d7c4}=readRawConfigWithLayers(),_0x43cc36=isRecord(_0x5987ef[_0x7b852b(0x7a)])?_0x5987ef['apps']:{},_0x243da2=isRecord(_0x44d7c4['globalConfig'][_0x7b852b(0x7a)])?_0x44d7c4[_0x7b852b(0x9a)][_0x7b852b(0x7a)]:{};return{..._0x243da2,..._0x43cc36};}async function configureWorkspace(_0x2e4949,_0x1f9e2d){const _0x443d6c=a169_0x262afc,_0x345d36=_0x2e4949['str'](_0x443d6c(0x88))[_0x443d6c(0xa3)](),_0x6ecd20=_0x2e4949[_0x443d6c(0x90)]('appcode')['trim'](),_0x1d88c5=_0x345d36||_0x6ecd20;if(!_0x1d88c5)throw CliErrors[_0x443d6c(0x6e)](_0x443d6c(0x7e),_0x443d6c(0x96)+CLI_BIN_NAME+_0x443d6c(0x9c)+CLI_BIN_NAME+_0x443d6c(0x8b));if(_0x6ecd20)assertValidAppcode(_0x6ecd20);const _0x21c334=resolveWriteConfigPath(_0x443d6c(0x98)),_0x5ae9a6=readConfigFile(_0x21c334),_0x37092e=resolveKnownApps(),_0x2bb2d3=isRecord(_0x5ae9a6[_0x443d6c(0x7a)])?{..._0x5ae9a6[_0x443d6c(0x7a)]}:{},_0x192fd2=cloneProfile(_0x2bb2d3[_0x1d88c5]),_0x1993c0=sanitizeProfile(_0x37092e[_0x1d88c5]),_0x3d01d8=_0x6ecd20?{}:_0x1993c0,_0x4d1446=_0x6ecd20||_0x3d01d8[_0x443d6c(0x73)];if(!_0x4d1446){const _0x123140=Object['keys'](_0x37092e),_0x16e52f=_0x123140[_0x443d6c(0x83)]===0x0?_0x443d6c(0x96)+CLI_BIN_NAME+'\x20workspace\x20'+_0x1f9e2d+_0x443d6c(0x7d)+_0x1d88c5+'\x20--appcode\x20<code>`.':_0x443d6c(0x86)+_0x123140['join'](',\x20');throw CliErrors[_0x443d6c(0x6e)](_0x443d6c(0x7c)+_0x1d88c5+_0x443d6c(0x82),_0x16e52f);}assertValidAppcode(String(_0x4d1446));const _0x16a0cc={..._0x3d01d8,..._0x192fd2,'appcode':String(_0x4d1446),...collectWorkspaceProfileOverrides(_0x2e4949)};return _0x2bb2d3[_0x1d88c5]=_0x16a0cc,_0x5ae9a6['apps']=_0x2bb2d3,_0x5ae9a6[_0x443d6c(0x77)]=_0x1d88c5,delete _0x5ae9a6[_0x443d6c(0x73)],delete _0x5ae9a6[_0x443d6c(0x88)],_0x16a0cc[_0x443d6c(0x94)]&&(_0x5ae9a6[_0x443d6c(0x94)]=_0x16a0cc[_0x443d6c(0x94)]),writeConfigFile(_0x21c334,_0x5ae9a6),{'ok':!![],'message':_0x443d6c(0xa7)+(_0x1f9e2d===_0x443d6c(0x79)?_0x443d6c(0x72):_0x443d6c(0x70))+':\x20'+_0x1d88c5+_0x443d6c(0xa9)+_0x16a0cc[_0x443d6c(0x73)]+_0x443d6c(0x7b)+_0x21c334+'.\x20Credentials:\x20not\x20written.','data':{'operation':_0x443d6c(0xa2)+_0x1f9e2d,'configPath':_0x21c334,'app':_0x1d88c5,'appcode':_0x16a0cc['appcode'],'env':_0x16a0cc[_0x443d6c(0x94)]??null,'credentialsWritten':![]}};}const workspaceInitDefinition={'service':'workspace','command':a169_0x262afc(0x79),'description':a169_0x262afc(0xa8),'risk':a169_0x262afc(0xa4),'requiresAuth':![],'requiresAppCode':![],'args':[],'flags':workspaceFlags,'validate':validateWorkspaceArgs,'execute':_0x5772a9=>configureWorkspace(_0x5772a9,'init')},workspaceUseDefinition={'service':a169_0x262afc(0x8d),'command':a169_0x262afc(0x81),'description':'Switch\x20the\x20current\x20workspace\x20app\x20binding','risk':a169_0x262afc(0xa4),'requiresAuth':![],'requiresAppCode':![],'args':[],'flags':workspaceFlags,'validate':validateWorkspaceArgs,'execute':_0x253c8b=>configureWorkspace(_0x253c8b,a169_0x262afc(0x81))};export const workspaceDefinitions=[workspaceInitDefinition,workspaceUseDefinition,workspaceAddDefinition,workspaceRemoveDefinition];export{WORKSPACE_USAGE};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a170_0x37c341=a170_0x5cfc;(function(_0x98383f,_0x2e2fa7){const _0x5e3f79=a170_0x5cfc,_0x215792=_0x98383f();while(!![]){try{const _0xc85d96=-parseInt(_0x5e3f79(0xaf))/0x1*(parseInt(_0x5e3f79(0xb5))/0x2)+-parseInt(_0x5e3f79(0xae))/0x3*(parseInt(_0x5e3f79(0xac))/0x4)+parseInt(_0x5e3f79(0xad))/0x5*(-parseInt(_0x5e3f79(0xb2))/0x6)+parseInt(_0x5e3f79(0xb3))/0x7*(-parseInt(_0x5e3f79(0xab))/0x8)+-parseInt(_0x5e3f79(0xb0))/0x9*(-parseInt(_0x5e3f79(0xa5))/0xa)+parseInt(_0x5e3f79(0xb4))/0xb*(parseInt(_0x5e3f79(0xb1))/0xc)+parseInt(_0x5e3f79(0xa4))/0xd;if(_0xc85d96===_0x2e2fa7)break;else _0x215792['push'](_0x215792['shift']());}catch(_0x567c98){_0x215792['push'](_0x215792['shift']());}}}(a170_0x18f0,0xee5a9));function a170_0x5cfc(_0x29ad1b,_0x281ca2){_0x29ad1b=_0x29ad1b-0xa4;const _0x18f0f0=a170_0x18f0();let _0x5cfc78=_0x18f0f0[_0x29ad1b];return _0x5cfc78;}import{buildAppRemoveFlags,runAppRemove,validateAppName}from'../../commands/common/app-registry.js';export const workspaceRemoveDefinition={'service':a170_0x37c341(0xa6),'command':a170_0x37c341(0xa8),'description':a170_0x37c341(0xaa),'risk':a170_0x37c341(0xa9),'requiresAuth':![],'requiresAppCode':![],'args':[{'name':'name','description':a170_0x37c341(0xb6),'required':!![]}],'flags':buildAppRemoveFlags(),'validate':_0x142334=>validateAppName(_0x142334,'workspace\x20remove'),'execute':_0x3ade31=>runAppRemove(_0x3ade31,a170_0x37c341(0xa7))};function a170_0x18f0(){const _0x4b09a1=['App\x20profile\x20name\x20to\x20remove','25119549zvUbKU','798580FdkQdH','workspace','workspace\x20remove','remove','high-risk-write','Remove\x20an\x20app\x20profile\x20from\x20the\x20current\x20workspace\x20(or\x20--global)','47576SNbhdo','488188CVzwjf','18195jzkhaz','3fvlwXk','101mQiPHj','207anGDCm','114192rxWdSf','2598fGEfQN','2009slOsWg','1947sRdVcw','21238vrXcsZ'];a170_0x18f0=function(){return _0x4b09a1;};return a170_0x18f0();}
|
package/lib/config/schema.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a171_0x538a56=a171_0x12cf;(function(_0x4c4a97,_0x185ee5){const _0x5c46da=a171_0x12cf,_0x249a38=_0x4c4a97();while(!![]){try{const _0xa048f7=-parseInt(_0x5c46da(0xe2))/0x1+parseInt(_0x5c46da(0xec))/0x2+-parseInt(_0x5c46da(0xef))/0x3*(-parseInt(_0x5c46da(0xcd))/0x4)+parseInt(_0x5c46da(0xdb))/0x5*(parseInt(_0x5c46da(0xca))/0x6)+parseInt(_0x5c46da(0xe5))/0x7*(-parseInt(_0x5c46da(0xe8))/0x8)+parseInt(_0x5c46da(0xcf))/0x9*(-parseInt(_0x5c46da(0xc7))/0xa)+-parseInt(_0x5c46da(0xe3))/0xb*(-parseInt(_0x5c46da(0xd4))/0xc);if(_0xa048f7===_0x185ee5)break;else _0x249a38['push'](_0x249a38['shift']());}catch(_0x5cf83b){_0x249a38['push'](_0x249a38['shift']());}}}(a171_0x306b,0x52aad));import{DEFAULT_CONFIG_VALUES}from'../constant/defaults.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';export{DEFAULT_CONFIG_VALUES}from'../constant/defaults.js';export const PROJECT_CREATE_INHERITABLE_KEYS=[a171_0x538a56(0xd2),a171_0x538a56(0xeb),a171_0x538a56(0xe6),a171_0x538a56(0xd3),a171_0x538a56(0xe9)];export const TOP_LEVEL_CONFIG_KEYS=new Set([a171_0x538a56(0xd5),'env','locale',a171_0x538a56(0xd3),a171_0x538a56(0xd2),a171_0x538a56(0xeb),a171_0x538a56(0xee)]);export const CONFIG_ENUM_VALUES={'env':[...RABETBASE_ENV_VALUES],'format':[...RABETBASE_OUTPUT_FORMAT_VALUES]};export function formatConfigKeyList(_0x5f382b){const _0x1862fe=a171_0x538a56;return[..._0x5f382b][_0x1862fe(0xc6)](',\x20');}export function getTopLevelConfigKeyList(){return[...TOP_LEVEL_CONFIG_KEYS];}export function isTopLevelConfigKey(_0xa66b39){const _0xbce564=a171_0x538a56;return TOP_LEVEL_CONFIG_KEYS[_0xbce564(0xda)](_0xa66b39);}export function getTopLevelConfigKeySummary(){return formatConfigKeyList(getTopLevelConfigKeyList());}export function getConfigCommandKeyDescription(){const _0x5d768d=a171_0x538a56;return _0x5d768d(0xdf)+getTopLevelConfigKeySummary()+')';}function a171_0x12cf(_0x3dc52f,_0x2791e2){_0x3dc52f=_0x3dc52f-0xc4;const _0x306b82=a171_0x306b();let _0x12cfef=_0x306b82[_0x3dc52f];return _0x12cfef;}export const APP_PROFILE_FLAG_KEY_MAP={'env':'env','apiDir':a171_0x538a56(0xee),'cookie':a171_0x538a56(0xd2),'accessKey':a171_0x538a56(0xeb),'defaultFormat':a171_0x538a56(0xd3),'pageSize':a171_0x538a56(0xd6),'riskLevel':a171_0x538a56(0xe9),'locale':'locale'};export function getAppProfileFlagDefs(){const _0x57d0f5=a171_0x538a56;return[{'name':_0x57d0f5(0xcc),'type':_0x57d0f5(0xd8),'description':_0x57d0f5(0xe7),'enum':[...RABETBASE_ENV_VALUES]},{'name':_0x57d0f5(0xee),'type':'string','description':_0x57d0f5(0xd9)},{'name':'cookie','type':'string','description':'Auth\x20cookie','hidden':!![]},{'name':_0x57d0f5(0xeb),'type':_0x57d0f5(0xd8),'description':'Access\x20key','hidden':!![]},{'name':_0x57d0f5(0xd1),'type':_0x57d0f5(0xd8),'description':_0x57d0f5(0xd0),'enum':[...RABETBASE_OUTPUT_FORMAT_VALUES]},{'name':_0x57d0f5(0xd6),'type':_0x57d0f5(0xde),'description':_0x57d0f5(0xe0)},{'name':_0x57d0f5(0xe9),'type':_0x57d0f5(0xd8),'description':_0x57d0f5(0xc4),'enum':[...RISK_LEVEL_VALUES]},{'name':_0x57d0f5(0xe6),'type':_0x57d0f5(0xd8),'description':'Locale'}];}export function collectAppProfileOverrides(_0x33a1ef){const _0x247d3d=a171_0x538a56,_0x318327={};for(const [_0x4cd7bb,_0x3d606d]of Object[_0x247d3d(0xd7)](APP_PROFILE_FLAG_KEY_MAP)){const _0x48bd3d=_0x33a1ef(_0x4cd7bb);if(!_0x48bd3d)continue;_0x318327[_0x3d606d]=_0x3d606d===_0x247d3d(0xd6)?Number(_0x48bd3d):_0x48bd3d;}return _0x318327;}function a171_0x306b(){const _0x2fc6e5=['4FlYXcB','zh-CN','18CeRXmj','Default\x20output\x20format\x20for\x20this\x20app\x20(profile)','defaultFormat','cookie','format','12QGQRgn','appcode','pageSize','entries','string','API\x20directory\x20path','has','16850wpRUSy','toLowerCase','app','number','Config\x20key\x20(','Default\x20page\x20size','defaultApp','614746ammisw','6095606dDAqoo','inherit','1449TLjmTQ','locale','Target\x20environment','7032BMrgNF','riskLevel','en-US','accessKey','725160rZNpCu','apps','apiDir','410316MCHxBO','Risk\x20level','trim','join','45920cYDjEG','filter','length','162ppJBvN','keys','env'];a171_0x306b=function(){return _0x2fc6e5;};return a171_0x306b();}export function buildAppProfileListFields(_0x450fe4){const _0x5f1257=a171_0x538a56;return{'env':_0x450fe4[_0x5f1257(0xcc)]??null,'apiDir':_0x450fe4[_0x5f1257(0xee)]??null,'hasCookie':!!_0x450fe4[_0x5f1257(0xd2)],'hasAccessKey':!!_0x450fe4['accessKey'],'format':_0x450fe4[_0x5f1257(0xd3)]??null,'pageSize':_0x450fe4['pageSize']??null,'riskLevel':_0x450fe4[_0x5f1257(0xe9)]??null,'locale':_0x450fe4[_0x5f1257(0xe6)]??null};}export function buildAppDoctorFields(_0x1f04c0,_0x30ea1f){const _0x388fe5=a171_0x538a56;return{'env':{'value':_0x1f04c0[_0x388fe5(0xcc)]||_0x30ea1f[_0x388fe5(0xcc)],'source':_0x1f04c0[_0x388fe5(0xcc)]?_0x388fe5(0xdd):_0x388fe5(0xe4)},'apiDir':{'value':_0x1f04c0[_0x388fe5(0xee)]||_0x30ea1f['apiDir'],'source':_0x1f04c0[_0x388fe5(0xee)]?_0x388fe5(0xdd):_0x388fe5(0xe4)},'cookie':{'value':_0x1f04c0[_0x388fe5(0xd2)]||_0x30ea1f[_0x388fe5(0xd2)],'source':_0x1f04c0[_0x388fe5(0xd2)]?_0x388fe5(0xdd):'inherit'},'accessKey':{'value':_0x1f04c0[_0x388fe5(0xeb)]||_0x30ea1f['accessKey'],'source':_0x1f04c0[_0x388fe5(0xeb)]?_0x388fe5(0xdd):_0x388fe5(0xe4)}};}export function buildCanonicalAppConfig(_0xfde658,_0x35cb88){const _0x26cd45=a171_0x538a56,_0xd863fa=_0xfde658['map'](_0x4071ae=>String(_0x4071ae||'')[_0x26cd45(0xc5)]())[_0x26cd45(0xc8)](Boolean);if(_0xd863fa[_0x26cd45(0xc9)]===0x0)return{};const _0x3d5057={};for(const _0x3faea7 of _0xd863fa){_0x3d5057[_0x3faea7]=_0x35cb88?{'appcode':_0x3faea7,'env':_0x35cb88}:{'appcode':_0x3faea7};}return{'apps':_0x3d5057,'defaultApp':_0xd863fa[0x0]};}export function buildCanonicalProjectConfig(_0x515501,_0x4c4d5a){const _0x412db5=a171_0x538a56,{appCodes:appCodes=[],env:_0x1062fd,metadata:_0x3265c6}=_0x4c4d5a,_0x28fd5b={..._0x515501,..._0x3265c6||{}};delete _0x28fd5b[_0x412db5(0xd5)],delete _0x28fd5b[_0x412db5(0xdd)];if(_0x1062fd)_0x28fd5b[_0x412db5(0xcc)]=_0x1062fd;else!_0x28fd5b[_0x412db5(0xcc)]&&(_0x28fd5b[_0x412db5(0xcc)]=DEFAULT_CONFIG_VALUES[_0x412db5(0xcc)]);const _0x4979e1=buildCanonicalAppConfig(appCodes,_0x28fd5b['env']);return Object[_0x412db5(0xcb)](_0x4979e1)[_0x412db5(0xc9)]>0x0&&(_0x28fd5b[_0x412db5(0xed)]=_0x4979e1[_0x412db5(0xed)],_0x28fd5b[_0x412db5(0xe1)]=_0x4979e1['defaultApp']),_0x28fd5b;}const LOCALE_MAP={'zh':a171_0x538a56(0xce),'zh-cn':a171_0x538a56(0xce),'zh_cn':a171_0x538a56(0xce),'en':a171_0x538a56(0xea),'en-us':a171_0x538a56(0xea),'en_us':'en-US'};export function normalizeLocale(_0x5a106b){const _0x21920b=a171_0x538a56;if(!_0x5a106b)return null;return LOCALE_MAP[_0x5a106b[_0x21920b(0xdc)]()]??null;}
|
package/lib/constant/cdn.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a172_0x268f43=a172_0x1841;function a172_0x2d51(){const _0x1c7359=['46059wcjiCi','9uBRRXZ','1066086oMuCjL','1540104VFyHBu','404280ldSxBs','https://g.lovrabet.com/dist/rabetbase-cli/config/index.json','806043Ybmlwm','2jGlLoz','256567IluWVV','5qStDqP','295660rlTkYl','33HWEaqp'];a172_0x2d51=function(){return _0x1c7359;};return a172_0x2d51();}function a172_0x1841(_0x48659a,_0x12d1a4){_0x48659a=_0x48659a-0x182;const _0x2d517b=a172_0x2d51();let _0x1841f6=_0x2d517b[_0x48659a];return _0x1841f6;}(function(_0x2b5711,_0x27ae10){const _0x57403b=a172_0x1841,_0x5dac95=_0x2b5711();while(!![]){try{const _0x2b16c9=parseInt(_0x57403b(0x186))/0x1*(-parseInt(_0x57403b(0x185))/0x2)+-parseInt(_0x57403b(0x18a))/0x3+-parseInt(_0x57403b(0x188))/0x4*(-parseInt(_0x57403b(0x187))/0x5)+parseInt(_0x57403b(0x18c))/0x6+parseInt(_0x57403b(0x184))/0x7+-parseInt(_0x57403b(0x18d))/0x8*(-parseInt(_0x57403b(0x18b))/0x9)+-parseInt(_0x57403b(0x182))/0xa*(parseInt(_0x57403b(0x189))/0xb);if(_0x2b16c9===_0x27ae10)break;else _0x5dac95['push'](_0x5dac95['shift']());}catch(_0xce0b09){_0x5dac95['push'](_0x5dac95['shift']());}}}(a172_0x2d51,0x288a6));export const CLI_VERSION_POLICY_URL=a172_0x268f43(0x183);
|