@lovrabet/rabetbase-cli 2.3.8 → 2.3.9-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/api-doc.js +1 -1
- package/lib/api/fetch-model-list.js +1 -1
- package/lib/api/generate-api-file.js +1 -1
- package/lib/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 -1
- package/lib/commands/notification/index.js +1 -1
- package/lib/commands/page/generate-start.js +1 -1
- package/lib/commands/page/generate-status.js +1 -1
- package/lib/commands/page/index.js +1 -1
- package/lib/commands/page/pull.js +1 -1
- package/lib/commands/page/push.js +1 -1
- package/lib/commands/page/relation-audit.js +1 -1
- package/lib/commands/page/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
|
+
const a158_0x28fe0=a158_0xb8d3;(function(_0x3ef637,_0x4fd7f2){const _0xc5005f=a158_0xb8d3,_0x150f99=_0x3ef637();while(!![]){try{const _0x38136a=parseInt(_0xc5005f(0x6c))/0x1+-parseInt(_0xc5005f(0x74))/0x2*(parseInt(_0xc5005f(0x70))/0x3)+parseInt(_0xc5005f(0x76))/0x4*(-parseInt(_0xc5005f(0x6d))/0x5)+parseInt(_0xc5005f(0x69))/0x6+-parseInt(_0xc5005f(0x72))/0x7*(parseInt(_0xc5005f(0x6e))/0x8)+parseInt(_0xc5005f(0x7b))/0x9+parseInt(_0xc5005f(0x6f))/0xa;if(_0x38136a===_0x4fd7f2)break;else _0x150f99['push'](_0x150f99['shift']());}catch(_0x2ec854){_0x150f99['push'](_0x150f99['shift']());}}}(a158_0x2029,0xe1db5));import{getSqlQueryInfo}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';function a158_0x2029(){const _0x52b117=['965301MVuAyg','sqlName','7DXDYGr','Return\x20full\x20raw\x20SQL\x20query\x20object','10edupEi','str','22628iARwGy','sql','sqlcode','appCode','sqlContent','4660695LHjeWl','7337346LLTRAs','sqlCode','dbId','883841VdOdAd','95zQsqIU','1126680HdwRLa','1576750CZPFdS'];a158_0x2029=function(){return _0x52b117;};return a158_0x2029();}function a158_0xb8d3(_0x1881b5,_0x4bd257){_0x1881b5=_0x1881b5-0x69;const _0x202947=a158_0x2029();let _0xb8d300=_0x202947[_0x1881b5];return _0xb8d300;}import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':a158_0x28fe0(0x77),'command':'detail','description':'Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','risk':'read','flags':[SQLCODE_FLAG,{'name':'verbose','type':'boolean','description':a158_0x28fe0(0x73)}],async 'execute'(_0x1476cf){const _0xc9b231=a158_0x28fe0,_0x54f1d9=await getSqlQueryInfo(_0x1476cf[_0xc9b231(0x79)],_0x1476cf[_0xc9b231(0x75)](_0xc9b231(0x78))),_0x2e8290=_0x1476cf['bool']('verbose');if(_0x2e8290)return{'ok':!![],'data':_0x54f1d9};const _0x23befa=_0x54f1d9[_0xc9b231(0x6b)]?await getDbName(_0x1476cf[_0xc9b231(0x79)],_0x54f1d9[_0xc9b231(0x6b)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x54f1d9[_0xc9b231(0x6a)],'sqlName':_0x54f1d9[_0xc9b231(0x71)],'db':_0x23befa?_0x23befa+'\x20('+_0x54f1d9[_0xc9b231(0x6b)]+')':_0x54f1d9[_0xc9b231(0x6b)]??'','description':_0x54f1d9['description']??'','sqlContent':_0x54f1d9[_0xc9b231(0x7a)]??''}};}};
|
package/lib/commands/sql/exec.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a159_0x109bb7=a159_0x55f6;(function(_0x5c08b6,_0x2d189d){const _0x3aaa68=a159_0x55f6,_0x1b3a56=_0x5c08b6();while(!![]){try{const _0x240d9f=parseInt(_0x3aaa68(0x170))/0x1+parseInt(_0x3aaa68(0x174))/0x2+parseInt(_0x3aaa68(0x175))/0x3+-parseInt(_0x3aaa68(0x169))/0x4*(parseInt(_0x3aaa68(0x176))/0x5)+parseInt(_0x3aaa68(0x165))/0x6+-parseInt(_0x3aaa68(0x16f))/0x7+-parseInt(_0x3aaa68(0x178))/0x8;if(_0x240d9f===_0x2d189d)break;else _0x1b3a56['push'](_0x1b3a56['shift']());}catch(_0x5f59cd){_0x1b3a56['push'](_0x1b3a56['shift']());}}}(a159_0x24c3,0xb7833));import{executeSql}from'../../core/api-client.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';function a159_0x55f6(_0x760012,_0x2d0b63){_0x760012=_0x760012-0x160;const _0x24c3fb=a159_0x24c3();let _0x55f66c=_0x24c3fb[_0x760012];return _0x55f66c;}import{parseJsonParams}from'../../utils/params.js';export const sqlExec={'service':a159_0x109bb7(0x163),'command':a159_0x109bb7(0x16c),'description':a159_0x109bb7(0x171),'risk':a159_0x109bb7(0x177),'flags':[SQLCODE_FLAG,{'name':'params','type':a159_0x109bb7(0x164),'description':'SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)'}],async 'execute'(_0x4619f4){const _0xa675a8=a159_0x109bb7,_0x16d340=parseJsonParams(_0x4619f4[_0xa675a8(0x161)](_0xa675a8(0x160))),_0x3f56a3=Date['now'](),_0x391498=await executeSql(_0x4619f4[_0xa675a8(0x16b)],_0x4619f4[_0xa675a8(0x161)](_0xa675a8(0x167)),_0x16d340),_0x2cf949=Date[_0xa675a8(0x173)]()-_0x3f56a3,_0x2464be=_0x391498?.[_0xa675a8(0x172)]??_0x391498,_0x96813a=_0x391498?.[_0xa675a8(0x166)]??!![];if(!_0x96813a)return{'ok':![],'data':{'error':_0x391498?.[_0xa675a8(0x16e)]||_0xa675a8(0x162),'elapsed':_0x2cf949},'message':'SQL\x20execution\x20failed'};const _0x2d3809=Array[_0xa675a8(0x168)](_0x2464be)?_0x2464be:[];return{'ok':!![],'data':{'rows':_0x2d3809,'rowCount':_0x2d3809[_0xa675a8(0x16d)],'elapsed':_0x2cf949},'message':_0xa675a8(0x16a)+_0x2d3809[_0xa675a8(0x16d)]+'\x20row(s)\x20in\x20'+_0x2cf949+'ms'};}};function a159_0x24c3(){const _0x3372a4=['string','8272380oKpgBz','execSuccess','sqlcode','isArray','289400VUUNsg','Returned\x20','appCode','exec','length','execError','7935361aXwDXr','838490hTUEFW','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','execResult','now','576494CQTGbe','1123422axWuTP','5Fbiazb','read','7378408HXOtpT','params','str','SQL\x20execution\x20failed','sql'];a159_0x24c3=function(){return _0x3372a4;};return a159_0x24c3();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x125d03,_0x17e6c7){const _0x41e7b8=a160_0x1e81,_0x36eed6=_0x125d03();while(!![]){try{const _0x5b0fcb=-parseInt(_0x41e7b8(0x12b))/0x1+parseInt(_0x41e7b8(0x12e))/0x2*(-parseInt(_0x41e7b8(0x131))/0x3)+parseInt(_0x41e7b8(0x134))/0x4+parseInt(_0x41e7b8(0x132))/0x5*(parseInt(_0x41e7b8(0x12f))/0x6)+parseInt(_0x41e7b8(0x12d))/0x7+-parseInt(_0x41e7b8(0x12c))/0x8*(-parseInt(_0x41e7b8(0x133))/0x9)+-parseInt(_0x41e7b8(0x135))/0xa*(parseInt(_0x41e7b8(0x130))/0xb);if(_0x5b0fcb===_0x17e6c7)break;else _0x36eed6['push'](_0x36eed6['shift']());}catch(_0x473429){_0x36eed6['push'](_0x36eed6['shift']());}}}(a160_0x4228,0x7c280));function a160_0x1e81(_0x33fbf2,_0x5ac46f){_0x33fbf2=_0x33fbf2-0x12b;const _0x4228a1=a160_0x4228();let _0x1e81fe=_0x4228a1[_0x33fbf2];return _0x1e81fe;}import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';import{sqlSave}from'../../commands/sql/save.js';import{sqlExec}from'../../commands/sql/exec.js';import{sqlPull}from'../../commands/sql/pull.js';import{sqlCreate}from'../../commands/sql/create.js';import{sqlStatus}from'../../commands/sql/status.js';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];function a160_0x4228(){const _0x3a7628=['77zVhwoI','120sCUciN','255EgdFQI','3897ivTPqH','2390948EqfBnw','572340riwTvS','359121cHIGBC','1608EdHrhD','5488042MsrUQn','41738SfRQsh','74622RZkihG'];a160_0x4228=function(){return _0x3a7628;};return a160_0x4228();}
|
package/lib/commands/sql/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a161_0x2a4202=a161_0x1eb6;(function(_0x525303,_0x94bdf0){const _0x214203=a161_0x1eb6,_0x332285=_0x525303();while(!![]){try{const _0x2c9a93=-parseInt(_0x214203(0x159))/0x1+parseInt(_0x214203(0x17a))/0x2*(-parseInt(_0x214203(0x15e))/0x3)+-parseInt(_0x214203(0x16e))/0x4+parseInt(_0x214203(0x158))/0x5+parseInt(_0x214203(0x15f))/0x6+parseInt(_0x214203(0x174))/0x7*(parseInt(_0x214203(0x16d))/0x8)+-parseInt(_0x214203(0x171))/0x9*(-parseInt(_0x214203(0x167))/0xa);if(_0x2c9a93===_0x94bdf0)break;else _0x332285['push'](_0x332285['shift']());}catch(_0x9597fd){_0x332285['push'](_0x332285['shift']());}}}(a161_0x597d,0x8db39));import{listSqlQueries}from'../../core/api-client.js';function a161_0x597d(){const _0x1130c9=['3648558YslUxb','sqlCode','string','Page\x20size','Found\x20','appCode','Page\x20number','tableData','632890KEwsLl','dbId','list','List\x20custom\x20SQL\x20queries','pagesize','all','8AVTOaV','1275992GIStbo','length','num','27aodnGg','description','name','3982790fizmca','sqlcode','No\x20custom\x20SQL\x20queries\x20found.','verbose','paging','Filter\x20by\x20SQL\x20name','24844yaTAEz','sqlName','str','2560160cvgvlz','234235KYZLFN','page','number','\x20SQL\x20queries\x20(total:\x20','read','180ACMIyI'];a161_0x597d=function(){return _0x1130c9;};return a161_0x597d();}import{getDbName}from'../../core/db-resolver.js';function a161_0x1eb6(_0x529288,_0xf75379){_0x529288=_0x529288-0x157;const _0x597dce=a161_0x597d();let _0x1eb6f0=_0x597dce[_0x529288];return _0x1eb6f0;}import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':'sql','command':a161_0x2a4202(0x169),'description':a161_0x2a4202(0x16a),'risk':a161_0x2a4202(0x15d),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a161_0x2a4202(0x173),'type':a161_0x2a4202(0x161),'description':a161_0x2a4202(0x179)},{'name':'page','type':'number','description':a161_0x2a4202(0x165),'default':0x1},{'name':a161_0x2a4202(0x16b),'type':a161_0x2a4202(0x15b),'description':a161_0x2a4202(0x162)},{'name':a161_0x2a4202(0x177),'type':'boolean','description':'Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content'}],async 'execute'(_0x46d0b3){const _0x531244=a161_0x2a4202,_0x516e01=await listSqlQueries(_0x46d0b3[_0x531244(0x164)],{'sqlCode':_0x46d0b3['str'](_0x531244(0x175))||undefined,'sqlName':_0x46d0b3[_0x531244(0x157)](_0x531244(0x173))||undefined,'currentPage':_0x46d0b3[_0x531244(0x170)](_0x531244(0x15a)),'pageSize':_0x46d0b3[_0x531244(0x170)]('pagesize',0x32)}),_0x32891e=_0x46d0b3['bool'](_0x531244(0x177)),_0x55c90e=_0x516e01[_0x531244(0x166)]??[],_0x4afe4d=_0x516e01[_0x531244(0x178)]?.['totalCount']??_0x55c90e[_0x531244(0x16f)];let _0x4e5634;return _0x32891e?_0x4e5634=_0x55c90e:_0x4e5634=await Promise[_0x531244(0x16c)](_0x55c90e['map'](async _0x2a3a7c=>{const _0x5c39ba=_0x531244;let _0x1b67ee;try{_0x1b67ee=_0x2a3a7c[_0x5c39ba(0x168)]?await getDbName(_0x46d0b3[_0x5c39ba(0x164)],_0x2a3a7c[_0x5c39ba(0x168)]):undefined;}catch{}return{'sqlCode':_0x2a3a7c[_0x5c39ba(0x160)],'sqlName':_0x2a3a7c[_0x5c39ba(0x17b)],'description':_0x2a3a7c[_0x5c39ba(0x172)]??'','db':_0x1b67ee?_0x1b67ee+'\x20('+_0x2a3a7c[_0x5c39ba(0x168)]+')':_0x2a3a7c['dbId']??''};})),{'ok':!![],'data':_0x4e5634,'message':_0x55c90e['length']===0x0?_0x531244(0x176):_0x531244(0x163)+_0x55c90e[_0x531244(0x16f)]+_0x531244(0x15c)+_0x4afe4d+').'};}};
|
package/lib/commands/sql/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a162_0x10d41e=a162_0x5ece;(function(_0x426bce,_0x2c2cd9){const _0x47836b=a162_0x5ece,_0x195df2=_0x426bce();while(!![]){try{const _0x338955=parseInt(_0x47836b(0x131))/0x1+-parseInt(_0x47836b(0x126))/0x2+-parseInt(_0x47836b(0x120))/0x3*(parseInt(_0x47836b(0x136))/0x4)+parseInt(_0x47836b(0x138))/0x5+parseInt(_0x47836b(0x134))/0x6+-parseInt(_0x47836b(0x146))/0x7+-parseInt(_0x47836b(0x114))/0x8*(-parseInt(_0x47836b(0x113))/0x9);if(_0x338955===_0x2c2cd9)break;else _0x195df2['push'](_0x195df2['shift']());}catch(_0x3d231f){_0x195df2['push'](_0x195df2['shift']());}}}(a162_0x3124,0x6a639));import{readFile,rm,writeFile}from'node:fs/promises';function a162_0x3124(){const _0x5a8efa=['sqls','lastSync','18798apYYBr','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','filter','2282628EiWmgq','sqlRoot','12076mPwdcl','trimStart','4088715ckQNGf','str','nonInteractive','join','force','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','replace','Force\x20pull\x20cancelled.','sqlContent','sql','\x20skipped,\x20','would_pull','sqlRootDir','5917681fHbblK','No\x20remote\x20SQL\x20queries\x20matched.','length','sqlCode','sqlcode','sqlName','toISOString','Filter\x20by\x20SQL\x20display\x20name','9kBNaeE','4296752ieBcZZ','push','mybatisXml','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','tableData','test','bool','\x20SQL\x20file(s)\x20into\x20','description','local\x20differs\x20from\x20remote','utf8','appCode','264oLwNid','skipped','path','Would\x20pull\x20','POST','unchanged','414498YHYcIS','message','name','catch','string','dbId','apps','pull','lockFilePath'];a162_0x3124=function(){return _0x5a8efa;};return a162_0x3124();}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(_0x5beabb,_0x506b81){const _0x39e5ce=a162_0x5ece,_0x43382a=[];let _0x558f37=0x1;while(!![]){const _0x2feed1=await listSqlQueries(_0x5beabb,{'currentPage':_0x558f37,'pageSize':PAGE_SIZE,'sqlCode':_0x506b81[_0x39e5ce(0x10e)],'sqlName':_0x506b81['sqlName']}),_0x282bb4=_0x2feed1[_0x39e5ce(0x118)]??[];_0x43382a[_0x39e5ce(0x115)](..._0x282bb4);if(_0x282bb4['length']===0x0)break;const _0x17c501=_0x2feed1['paging']?.['totalCount'];if(_0x17c501!=null?_0x43382a[_0x39e5ce(0x10d)]>=_0x17c501:_0x282bb4['length']<PAGE_SIZE)break;_0x558f37++;}return _0x43382a;}function a162_0x5ece(_0x241a77,_0x5d9c5a){_0x241a77=_0x241a77-0x10d;const _0x3124f5=a162_0x3124();let _0x5ece62=_0x3124f5[_0x241a77];return _0x5ece62;}async function ensureSqlContent(_0x454b5f){const _0x36452a=a162_0x5ece;if(_0x454b5f[_0x36452a(0x141)]!=null&&String(_0x454b5f[_0x36452a(0x141)])['length']>0x0)return _0x454b5f;return getSqlQueryDetail(_0x454b5f[_0x36452a(0x10e)]);}export const sqlPull={'service':a162_0x10d41e(0x142),'command':a162_0x10d41e(0x12d),'description':a162_0x10d41e(0x13e),'risk':'write','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a162_0x10d41e(0x128),'type':a162_0x10d41e(0x12a),'description':a162_0x10d41e(0x112)},{'name':a162_0x10d41e(0x13c),'type':'boolean','description':'Force\x20overwrite\x20local\x20unsynced\x20changes'}],async 'dryRun'(_0x185a77){const _0x124de8=a162_0x10d41e,_0x213e04=loadSqlProjectConfig(_0x185a77[_0x124de8(0x11f)]),_0x3e9507=await readSqlLockFile(_0x213e04[_0x124de8(0x12e)]),{appLock:_0x50125f}=ensureSqlLockScope(_0x3e9507??createEmptySqlLock(),_0x213e04[_0x124de8(0x11f)],_0x213e04[_0x124de8(0x135)],_0x124de8(0x12d)),_0x3ced3f=await fetchAllSqlQueries(_0x185a77[_0x124de8(0x11f)],{'sqlCode':_0x185a77['str']('sqlcode')||undefined,'sqlName':_0x185a77[_0x124de8(0x139)](_0x124de8(0x128))||undefined}),_0x16b2d5=[];for(const _0x4c207a of _0x3ced3f){const _0x38cfde=await ensureSqlContent(_0x4c207a),_0x31f782=ensureRemoteSqlContent(_0x38cfde),_0x247d9a=detectModeFromSql(_0x38cfde),_0x1818f8=_0x38cfde[_0x124de8(0x12b)]?await getDbName(_0x185a77[_0x124de8(0x11f)],Number(_0x38cfde[_0x124de8(0x12b)]))[_0x124de8(0x129)](()=>undefined):undefined,_0x3c9a74=buildLocalSqlFileContent({'sqlCode':_0x38cfde['sqlCode'],'sqlName':_0x38cfde[_0x124de8(0x110)],'dbId':_0x38cfde[_0x124de8(0x12b)]},_0x31f782,{'dbName':_0x1818f8,'mode':_0x247d9a,'syncedAt':new Date()['toISOString'](),'description':_0x38cfde[_0x124de8(0x11c)]}),_0x166a08=buildSqlLockEntry(_0x38cfde,_0x31f782,'',{'dbName':_0x1818f8}),_0x542278=resolveLocalSqlFilePath(_0x213e04,_0x38cfde['sqlCode'],_0x166a08);let _0x3c55a7=_0x124de8(0x144),_0x28c33d;if(await fileExists(_0x542278)){const _0x4a0985=await readFile(_0x542278,_0x124de8(0x11e));isEquivalentPulledSqlFile(_0x4a0985,_0x3c9a74,_0x247d9a)?(_0x3c55a7=_0x124de8(0x121),_0x28c33d=_0x124de8(0x125)):(_0x3c55a7='conflict',_0x28c33d=_0x124de8(0x13d));}_0x16b2d5['push']({'sqlCode':_0x38cfde[_0x124de8(0x10e)],'sqlName':_0x38cfde[_0x124de8(0x110)],'filePath':_0x542278,'status':_0x3c55a7,'reason':_0x28c33d});}return{'method':_0x124de8(0x124),'url':_0x124de8(0x132),'body':{'appCode':_0x185a77['appCode'],'sqlCode':_0x185a77[_0x124de8(0x139)](_0x124de8(0x10f))||null,'sqlName':_0x185a77[_0x124de8(0x139)](_0x124de8(0x128))||null,'files':_0x16b2d5},'description':_0x124de8(0x123)+_0x16b2d5[_0x124de8(0x10d)]+_0x124de8(0x11b)+_0x213e04[_0x124de8(0x145)]};},async 'execute'(_0x621c2f){const _0x2b6ffb=a162_0x10d41e,_0x5f0674=loadSqlProjectConfig(_0x621c2f[_0x2b6ffb(0x11f)]),_0x44c603=await readSqlLockFile(_0x5f0674[_0x2b6ffb(0x12e)]),{lockData:_0x485788,appLock:_0x56a66e}=ensureSqlLockScope(_0x44c603??createEmptySqlLock(),_0x5f0674[_0x2b6ffb(0x11f)],_0x5f0674[_0x2b6ffb(0x135)],_0x2b6ffb(0x12d)),_0x2b3dfb=_0x621c2f[_0x2b6ffb(0x11a)](_0x2b6ffb(0x13c)),_0x50b5fa=await fetchAllSqlQueries(_0x621c2f[_0x2b6ffb(0x11f)],{'sqlCode':_0x621c2f[_0x2b6ffb(0x139)]('sqlcode')||undefined,'sqlName':_0x621c2f[_0x2b6ffb(0x139)](_0x2b6ffb(0x128))||undefined});if(_0x50b5fa[_0x2b6ffb(0x10d)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x2b6ffb(0x147)};const _0x15992f=[],_0x3155d7=[];for(const _0x5988e0 of _0x50b5fa){try{_0x15992f[_0x2b6ffb(0x115)](await ensureSqlContent(_0x5988e0));}catch(_0x413f59){_0x3155d7[_0x2b6ffb(0x115)]({'sqlCode':_0x5988e0[_0x2b6ffb(0x10e)],'error':_0x413f59 instanceof Error?_0x413f59[_0x2b6ffb(0x127)]:String(_0x413f59)});}}if(_0x2b3dfb&&!_0x621c2f[_0x2b6ffb(0x13a)]){let _0x94c450=![];for(const _0x586e5d of _0x15992f){const _0x18a249=detectModeFromSql(_0x586e5d),_0x5108fb=_0x586e5d[_0x2b6ffb(0x12b)]?await getDbName(_0x621c2f[_0x2b6ffb(0x11f)],Number(_0x586e5d[_0x2b6ffb(0x12b)]))[_0x2b6ffb(0x129)](()=>undefined):undefined,_0x38118d=buildLocalSqlFileContent({'sqlCode':_0x586e5d['sqlCode'],'sqlName':_0x586e5d[_0x2b6ffb(0x110)],'dbId':_0x586e5d[_0x2b6ffb(0x12b)]},ensureRemoteSqlContent(_0x586e5d),{'dbName':_0x5108fb,'mode':_0x18a249,'syncedAt':new Date()[_0x2b6ffb(0x111)](),'description':_0x586e5d[_0x2b6ffb(0x11c)]}),_0x45c5d1=resolveLocalSqlFilePath(_0x5f0674,_0x586e5d[_0x2b6ffb(0x10e)],buildSqlLockEntry(_0x586e5d,ensureRemoteSqlContent(_0x586e5d),'',{'dbName':_0x5108fb}));if(await fileExists(_0x45c5d1)){const _0x5adb96=await readFile(_0x45c5d1,_0x2b6ffb(0x11e));if(!isEquivalentPulledSqlFile(_0x5adb96,_0x38118d,_0x18a249)){_0x94c450=!![];break;}}}if(_0x94c450){const _0x5a7e6b=await confirmForceOverwrite(_0x2b6ffb(0x117));if(!_0x5a7e6b)throw CliErrors['cancelled'](_0x2b6ffb(0x140));}}const _0x4e54f4=cloneSqlLockData(_0x485788),_0x58565c=_0x4e54f4[_0x2b6ffb(0x12c)][_0x5f0674[_0x2b6ffb(0x11f)]],_0x37d820=[],_0x1e840d=[];for(const _0x930450 of _0x15992f){const _0x21e7e5=_0x58565c[_0x2b6ffb(0x12f)][_0x930450[_0x2b6ffb(0x10e)]],_0x5923a7=ensureRemoteSqlContent(_0x930450),_0x20752b=detectModeFromSql(_0x930450),_0x4fac42=_0x930450[_0x2b6ffb(0x12b)]?await getDbName(_0x621c2f[_0x2b6ffb(0x11f)],Number(_0x930450[_0x2b6ffb(0x12b)]))['catch'](()=>undefined):undefined,_0x3078ad=buildLocalSqlFileContent({'sqlCode':_0x930450[_0x2b6ffb(0x10e)],'sqlName':_0x930450[_0x2b6ffb(0x110)],'dbId':_0x930450[_0x2b6ffb(0x12b)]},_0x5923a7,{'dbName':_0x4fac42,'mode':_0x20752b,'syncedAt':new Date()['toISOString'](),'description':_0x930450[_0x2b6ffb(0x11c)]}),_0x1e9f2d=buildSqlLockEntry(_0x930450,_0x5923a7,computeSqlContentHash(_0x3078ad),{'dbName':_0x4fac42}),_0x585c0c=_0x1e9f2d[_0x2b6ffb(0x122)],_0x1d3496=join(_0x5f0674[_0x2b6ffb(0x145)],_0x585c0c);try{if(await fileExists(_0x1d3496)){const _0xbb2d75=await readFile(_0x1d3496,_0x2b6ffb(0x11e));if(isEquivalentPulledSqlFile(_0xbb2d75,_0x3078ad,_0x20752b)){_0x1e840d['push']({'sqlCode':_0x930450[_0x2b6ffb(0x10e)],'reason':_0x2b6ffb(0x125)}),_0x58565c['sqls'][_0x930450['sqlCode']]={..._0x1e9f2d,'hash':computeSqlContentHash(_0xbb2d75),'path':_0x585c0c};continue;}if(!_0x2b3dfb){_0x1e840d['push']({'sqlCode':_0x930450[_0x2b6ffb(0x10e)],'reason':_0x2b6ffb(0x11d)});continue;}}const _0x509b1a=_0x21e7e5?.[_0x2b6ffb(0x122)]?join(_0x5f0674[_0x2b6ffb(0x145)],_0x21e7e5[_0x2b6ffb(0x122)]):undefined;_0x509b1a&&_0x509b1a!==_0x1d3496&&await fileExists(_0x509b1a)&&await rm(_0x509b1a,{'force':!![]}),await ensureParentDirectory(_0x1d3496),await writeFile(_0x1d3496,_0x3078ad,_0x2b6ffb(0x11e)),_0x58565c[_0x2b6ffb(0x12f)][_0x930450[_0x2b6ffb(0x10e)]]={..._0x1e9f2d,'path':_0x585c0c},_0x37d820[_0x2b6ffb(0x115)]({'sqlCode':_0x930450[_0x2b6ffb(0x10e)],'filePath':_0x1d3496});}catch(_0x5d9de1){_0x3155d7[_0x2b6ffb(0x115)]({'sqlCode':_0x930450[_0x2b6ffb(0x10e)],'error':_0x5d9de1 instanceof Error?_0x5d9de1['message']:String(_0x5d9de1)});}}return _0x58565c[_0x2b6ffb(0x130)]=new Date()[_0x2b6ffb(0x111)](),await writeSqlLockFile(_0x5f0674['lockFilePath'],_0x4e54f4),{'ok':_0x3155d7[_0x2b6ffb(0x10d)]===0x0,'data':{'pulled':_0x37d820,'skipped':_0x1e840d,'failed':_0x3155d7},'message':'Pull\x20complete:\x20'+_0x37d820['length']+'\x20written,\x20'+_0x1e840d['length']+_0x2b6ffb(0x143)+_0x3155d7[_0x2b6ffb(0x10d)]+'\x20failed'};}};function detectModeFromSql(_0x419646){const _0x7b7deb=a162_0x10d41e,_0x127ee7=ensureRemoteSqlContent(_0x419646),_0x14cc31=stripLocalSqlMetadata(_0x127ee7,_0x7b7deb(0x116))[_0x7b7deb(0x137)]();if(/^<(select|insert|update|delete)\b/i[_0x7b7deb(0x119)](_0x14cc31))return _0x7b7deb(0x116);return _0x7b7deb(0x142);}function isEquivalentPulledSqlFile(_0x39f4b1,_0x27d94d,_0x4270e3){return normalizePullComparableContent(_0x39f4b1,_0x4270e3)===normalizePullComparableContent(_0x27d94d,_0x4270e3);}function normalizePullComparableContent(_0x3ed0f4,_0x9f82a0){const _0x39f92d=a162_0x10d41e,_0x5dc99d=_0x3ed0f4[_0x39f92d(0x13f)](/\r\n/g,'\x0a')['split']('\x0a'),_0x3d8c67=_0x5dc99d[_0x39f92d(0x133)](_0xc09799=>!isSyncedAtMetadataLine(_0xc09799,_0x9f82a0));return _0x3d8c67[_0x39f92d(0x13b)]('\x0a');}function isSyncedAtMetadataLine(_0x67061f,_0x79e188){const _0x59d6a9=a162_0x10d41e;if(_0x79e188===_0x59d6a9(0x116))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x59d6a9(0x119)](_0x67061f);return/^\s*--\s*@lovrabet\.syncedAt:/['test'](_0x67061f);}
|
|
1
|
+
const a162_0x4752d0=a162_0x5b08;function a162_0x5b08(_0x3f6f7a,_0x21ceb1){_0x3f6f7a=_0x3f6f7a-0xeb;const _0x1d6710=a162_0x1d67();let _0x5b0808=_0x1d6710[_0x3f6f7a];return _0x5b0808;}(function(_0x4edcd4,_0x236d70){const _0x364e7e=a162_0x5b08,_0x76a327=_0x4edcd4();while(!![]){try{const _0x1661f0=parseInt(_0x364e7e(0xec))/0x1+-parseInt(_0x364e7e(0xf3))/0x2*(-parseInt(_0x364e7e(0x109))/0x3)+-parseInt(_0x364e7e(0x126))/0x4+parseInt(_0x364e7e(0x124))/0x5*(parseInt(_0x364e7e(0x10c))/0x6)+parseInt(_0x364e7e(0x11e))/0x7*(-parseInt(_0x364e7e(0x103))/0x8)+parseInt(_0x364e7e(0x111))/0x9*(-parseInt(_0x364e7e(0x129))/0xa)+parseInt(_0x364e7e(0xf5))/0xb;if(_0x1661f0===_0x236d70)break;else _0x76a327['push'](_0x76a327['shift']());}catch(_0x11b74f){_0x76a327['push'](_0x76a327['shift']());}}}(a162_0x1d67,0x7de83));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';function a162_0x1d67(){const _0x35d5e9=['Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','tableData','lockFilePath','Filter\x20by\x20SQL\x20display\x20name','boolean','Would\x20pull\x20','replace','bool','force','trimStart','cancelled','32599QyFhnk','\x20skipped,\x20','dbId','message','apps','sqlContent','5zhMBik','mybatisXml','1943964QckGCB','appCode','Force\x20pull\x20cancelled.','5152790FCmIjY','name','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','filter','510707TxAXaz','paging','Pull\x20complete:\x20','sqlRootDir','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','Force\x20overwrite\x20local\x20unsynced\x20changes','path','8sYOfwn','catch','11964590VmYuaf','\x20SQL\x20file(s)\x20into\x20','conflict','sqlCode','sqls','sqlName','\x20written,\x20','push','pull','str','unchanged','sqlcode','No\x20remote\x20SQL\x20queries\x20matched.','length','80iabJan','description','nonInteractive','sql','toISOString','totalCount','131907uQdZzI','skipped','join','1827366gVCYJh','\x20failed','string','test','utf8','18vBRNEV','sqlRoot'];a162_0x1d67=function(){return _0x35d5e9;};return a162_0x1d67();}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(_0x99ed3c,_0x304a33){const _0x4f91ad=a162_0x5b08,_0x2eff23=[];let _0x2acce7=0x1;while(!![]){const _0x1bc937=await listSqlQueries(_0x99ed3c,{'currentPage':_0x2acce7,'pageSize':PAGE_SIZE,'sqlCode':_0x304a33[_0x4f91ad(0xf8)],'sqlName':_0x304a33[_0x4f91ad(0xfa)]}),_0x31b371=_0x1bc937[_0x4f91ad(0x114)]??[];_0x2eff23[_0x4f91ad(0xfc)](..._0x31b371);if(_0x31b371['length']===0x0)break;const _0x1bfe7e=_0x1bc937[_0x4f91ad(0xed)]?.[_0x4f91ad(0x108)];if(_0x1bfe7e!=null?_0x2eff23[_0x4f91ad(0x102)]>=_0x1bfe7e:_0x31b371[_0x4f91ad(0x102)]<PAGE_SIZE)break;_0x2acce7++;}return _0x2eff23;}async function ensureSqlContent(_0x2d69f6){const _0x4cb295=a162_0x5b08;if(_0x2d69f6[_0x4cb295(0x123)]!=null&&String(_0x2d69f6[_0x4cb295(0x123)])['length']>0x0)return _0x2d69f6;return getSqlQueryDetail(_0x2d69f6['sqlCode']);}export const sqlPull={'service':a162_0x4752d0(0x106),'command':'pull','description':a162_0x4752d0(0x113),'risk':'write','flags':[SQLCODE_FLAG_OPTIONAL,{'name':'name','type':a162_0x4752d0(0x10e),'description':a162_0x4752d0(0x116)},{'name':'force','type':a162_0x4752d0(0x117),'description':a162_0x4752d0(0xf1)}],async 'dryRun'(_0x9c60ce){const _0x393d05=a162_0x4752d0,_0x216735=loadSqlProjectConfig(_0x9c60ce['appCode']),_0x2b6a3c=await readSqlLockFile(_0x216735[_0x393d05(0x115)]),{appLock:_0x4bfa91}=ensureSqlLockScope(_0x2b6a3c??createEmptySqlLock(),_0x216735[_0x393d05(0x127)],_0x216735[_0x393d05(0x112)],_0x393d05(0xfd)),_0x45822a=await fetchAllSqlQueries(_0x9c60ce[_0x393d05(0x127)],{'sqlCode':_0x9c60ce[_0x393d05(0xfe)](_0x393d05(0x100))||undefined,'sqlName':_0x9c60ce[_0x393d05(0xfe)](_0x393d05(0x12a))||undefined}),_0x5ceee7=[];for(const _0x54d47b of _0x45822a){const _0x176da7=await ensureSqlContent(_0x54d47b),_0x29fb8d=ensureRemoteSqlContent(_0x176da7),_0x206211=detectModeFromSql(_0x176da7),_0x27a90a=_0x176da7[_0x393d05(0x120)]?await getDbName(_0x9c60ce['appCode'],Number(_0x176da7[_0x393d05(0x120)]))['catch'](()=>undefined):undefined,_0x220b31=buildLocalSqlFileContent({'sqlCode':_0x176da7[_0x393d05(0xf8)],'sqlName':_0x176da7[_0x393d05(0xfa)],'dbId':_0x176da7['dbId']},_0x29fb8d,{'dbName':_0x27a90a,'mode':_0x206211,'syncedAt':new Date()[_0x393d05(0x107)](),'description':_0x176da7[_0x393d05(0x104)]}),_0x19b359=buildSqlLockEntry(_0x176da7,_0x29fb8d,'',{'dbName':_0x27a90a}),_0x245447=resolveLocalSqlFilePath(_0x216735,_0x176da7[_0x393d05(0xf8)],_0x19b359);let _0x1ba4fe='would_pull',_0x45ace8;if(await fileExists(_0x245447)){const _0x3a3b26=await readFile(_0x245447,'utf8');isEquivalentPulledSqlFile(_0x3a3b26,_0x220b31,_0x206211)?(_0x1ba4fe=_0x393d05(0x10a),_0x45ace8=_0x393d05(0xff)):(_0x1ba4fe=_0x393d05(0xf7),_0x45ace8=_0x393d05(0xf0));}_0x5ceee7['push']({'sqlCode':_0x176da7[_0x393d05(0xf8)],'sqlName':_0x176da7[_0x393d05(0xfa)],'filePath':_0x245447,'status':_0x1ba4fe,'reason':_0x45ace8});}return{'method':'POST','url':_0x393d05(0x12b),'body':{'appCode':_0x9c60ce['appCode'],'sqlCode':_0x9c60ce[_0x393d05(0xfe)](_0x393d05(0x100))||null,'sqlName':_0x9c60ce[_0x393d05(0xfe)](_0x393d05(0x12a))||null,'files':_0x5ceee7},'description':_0x393d05(0x118)+_0x5ceee7[_0x393d05(0x102)]+_0x393d05(0xf6)+_0x216735[_0x393d05(0xef)]};},async 'execute'(_0x1cb688){const _0x2fb4dc=a162_0x4752d0,_0x53e22b=loadSqlProjectConfig(_0x1cb688[_0x2fb4dc(0x127)]),_0x1e28ea=await readSqlLockFile(_0x53e22b[_0x2fb4dc(0x115)]),{lockData:_0x4f43b3,appLock:_0x1150d9}=ensureSqlLockScope(_0x1e28ea??createEmptySqlLock(),_0x53e22b[_0x2fb4dc(0x127)],_0x53e22b['sqlRoot'],_0x2fb4dc(0xfd)),_0x29aecf=_0x1cb688[_0x2fb4dc(0x11a)](_0x2fb4dc(0x11b)),_0x13dbd0=await fetchAllSqlQueries(_0x1cb688[_0x2fb4dc(0x127)],{'sqlCode':_0x1cb688['str'](_0x2fb4dc(0x100))||undefined,'sqlName':_0x1cb688[_0x2fb4dc(0xfe)]('name')||undefined});if(_0x13dbd0[_0x2fb4dc(0x102)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x2fb4dc(0x101)};const _0x1075ef=[],_0x1f63d9=[];for(const _0x4d9f4a of _0x13dbd0){try{_0x1075ef[_0x2fb4dc(0xfc)](await ensureSqlContent(_0x4d9f4a));}catch(_0x259018){_0x1f63d9[_0x2fb4dc(0xfc)]({'sqlCode':_0x4d9f4a['sqlCode'],'error':_0x259018 instanceof Error?_0x259018[_0x2fb4dc(0x121)]:String(_0x259018)});}}if(_0x29aecf&&!_0x1cb688[_0x2fb4dc(0x105)]){let _0x5c32fa=![];for(const _0x35c469 of _0x1075ef){const _0x15fa1a=detectModeFromSql(_0x35c469),_0x4c7878=_0x35c469[_0x2fb4dc(0x120)]?await getDbName(_0x1cb688[_0x2fb4dc(0x127)],Number(_0x35c469['dbId']))['catch'](()=>undefined):undefined,_0xc28283=buildLocalSqlFileContent({'sqlCode':_0x35c469[_0x2fb4dc(0xf8)],'sqlName':_0x35c469[_0x2fb4dc(0xfa)],'dbId':_0x35c469[_0x2fb4dc(0x120)]},ensureRemoteSqlContent(_0x35c469),{'dbName':_0x4c7878,'mode':_0x15fa1a,'syncedAt':new Date()[_0x2fb4dc(0x107)](),'description':_0x35c469[_0x2fb4dc(0x104)]}),_0xb871cc=resolveLocalSqlFilePath(_0x53e22b,_0x35c469['sqlCode'],buildSqlLockEntry(_0x35c469,ensureRemoteSqlContent(_0x35c469),'',{'dbName':_0x4c7878}));if(await fileExists(_0xb871cc)){const _0x9f58b2=await readFile(_0xb871cc,_0x2fb4dc(0x110));if(!isEquivalentPulledSqlFile(_0x9f58b2,_0xc28283,_0x15fa1a)){_0x5c32fa=!![];break;}}}if(_0x5c32fa){const _0x42dbdb=await confirmForceOverwrite(_0x2fb4dc(0x12c));if(!_0x42dbdb)throw CliErrors[_0x2fb4dc(0x11d)](_0x2fb4dc(0x128));}}const _0x4498f1=cloneSqlLockData(_0x4f43b3),_0x3faa63=_0x4498f1[_0x2fb4dc(0x122)][_0x53e22b[_0x2fb4dc(0x127)]],_0xfe60fd=[],_0x20b08a=[];for(const _0x5b7882 of _0x1075ef){const _0x3a29f4=_0x3faa63[_0x2fb4dc(0xf9)][_0x5b7882[_0x2fb4dc(0xf8)]],_0x2fff32=ensureRemoteSqlContent(_0x5b7882),_0x12a875=detectModeFromSql(_0x5b7882),_0x35cc88=_0x5b7882['dbId']?await getDbName(_0x1cb688['appCode'],Number(_0x5b7882[_0x2fb4dc(0x120)]))[_0x2fb4dc(0xf4)](()=>undefined):undefined,_0x206572=buildLocalSqlFileContent({'sqlCode':_0x5b7882[_0x2fb4dc(0xf8)],'sqlName':_0x5b7882[_0x2fb4dc(0xfa)],'dbId':_0x5b7882[_0x2fb4dc(0x120)]},_0x2fff32,{'dbName':_0x35cc88,'mode':_0x12a875,'syncedAt':new Date()[_0x2fb4dc(0x107)](),'description':_0x5b7882[_0x2fb4dc(0x104)]}),_0x3207c0=buildSqlLockEntry(_0x5b7882,_0x2fff32,computeSqlContentHash(_0x206572),{'dbName':_0x35cc88}),_0x510157=_0x3207c0[_0x2fb4dc(0xf2)],_0x147607=join(_0x53e22b[_0x2fb4dc(0xef)],_0x510157);try{if(await fileExists(_0x147607)){const _0x915de0=await readFile(_0x147607,'utf8');if(isEquivalentPulledSqlFile(_0x915de0,_0x206572,_0x12a875)){_0x20b08a[_0x2fb4dc(0xfc)]({'sqlCode':_0x5b7882[_0x2fb4dc(0xf8)],'reason':_0x2fb4dc(0xff)}),_0x3faa63[_0x2fb4dc(0xf9)][_0x5b7882[_0x2fb4dc(0xf8)]]={..._0x3207c0,'hash':computeSqlContentHash(_0x915de0),'path':_0x510157};continue;}if(!_0x29aecf){_0x20b08a['push']({'sqlCode':_0x5b7882[_0x2fb4dc(0xf8)],'reason':'local\x20differs\x20from\x20remote'});continue;}}const _0x534acc=_0x3a29f4?.[_0x2fb4dc(0xf2)]?join(_0x53e22b[_0x2fb4dc(0xef)],_0x3a29f4[_0x2fb4dc(0xf2)]):undefined;_0x534acc&&_0x534acc!==_0x147607&&await fileExists(_0x534acc)&&await rm(_0x534acc,{'force':!![]}),await ensureParentDirectory(_0x147607),await writeFile(_0x147607,_0x206572,_0x2fb4dc(0x110)),_0x3faa63[_0x2fb4dc(0xf9)][_0x5b7882['sqlCode']]={..._0x3207c0,'path':_0x510157},_0xfe60fd['push']({'sqlCode':_0x5b7882[_0x2fb4dc(0xf8)],'filePath':_0x147607});}catch(_0x5586cd){_0x1f63d9['push']({'sqlCode':_0x5b7882[_0x2fb4dc(0xf8)],'error':_0x5586cd instanceof Error?_0x5586cd['message']:String(_0x5586cd)});}}return _0x3faa63['lastSync']=new Date()[_0x2fb4dc(0x107)](),await writeSqlLockFile(_0x53e22b['lockFilePath'],_0x4498f1),{'ok':_0x1f63d9[_0x2fb4dc(0x102)]===0x0,'data':{'pulled':_0xfe60fd,'skipped':_0x20b08a,'failed':_0x1f63d9},'message':_0x2fb4dc(0xee)+_0xfe60fd['length']+_0x2fb4dc(0xfb)+_0x20b08a[_0x2fb4dc(0x102)]+_0x2fb4dc(0x11f)+_0x1f63d9[_0x2fb4dc(0x102)]+_0x2fb4dc(0x10d)};}};function detectModeFromSql(_0x153a21){const _0x56f664=a162_0x4752d0,_0x2260b5=ensureRemoteSqlContent(_0x153a21),_0x3069bc=stripLocalSqlMetadata(_0x2260b5,_0x56f664(0x125))[_0x56f664(0x11c)]();if(/^<(select|insert|update|delete)\b/i[_0x56f664(0x10f)](_0x3069bc))return _0x56f664(0x125);return _0x56f664(0x106);}function isEquivalentPulledSqlFile(_0x301a0d,_0x2e8d09,_0x314f32){return normalizePullComparableContent(_0x301a0d,_0x314f32)===normalizePullComparableContent(_0x2e8d09,_0x314f32);}function normalizePullComparableContent(_0x46d666,_0x10c9c0){const _0x49e4eb=a162_0x4752d0,_0x2e81bd=_0x46d666[_0x49e4eb(0x119)](/\r\n/g,'\x0a')['split']('\x0a'),_0x2f2ab7=_0x2e81bd[_0x49e4eb(0xeb)](_0xda297f=>!isSyncedAtMetadataLine(_0xda297f,_0x10c9c0));return _0x2f2ab7[_0x49e4eb(0x10b)]('\x0a');}function isSyncedAtMetadataLine(_0x574351,_0x429a6f){const _0xfa8c54=a162_0x4752d0;if(_0x429a6f===_0xfa8c54(0x125))return/^\s*<!--\s*@lovrabet\.syncedAt:/['test'](_0x574351);return/^\s*--\s*@lovrabet\.syncedAt:/[_0xfa8c54(0x10f)](_0x574351);}
|
package/lib/commands/sql/push.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a163_0x1f400b=a163_0x277a;function a163_0x277a(_0xeba244,_0x2e0c29){_0xeba244=_0xeba244-0x120;const _0x2b9a57=a163_0x2b9a();let _0x277a1c=_0x2b9a57[_0xeba244];return _0x277a1c;}(function(_0x1241c8,_0x9d7df1){const _0x1115e3=a163_0x277a,_0x95f146=_0x1241c8();while(!![]){try{const _0x980668=parseInt(_0x1115e3(0x13a))/0x1*(parseInt(_0x1115e3(0x13c))/0x2)+parseInt(_0x1115e3(0x148))/0x3*(parseInt(_0x1115e3(0x121))/0x4)+parseInt(_0x1115e3(0x156))/0x5*(parseInt(_0x1115e3(0x135))/0x6)+-parseInt(_0x1115e3(0x138))/0x7+-parseInt(_0x1115e3(0x139))/0x8*(parseInt(_0x1115e3(0x129))/0x9)+-parseInt(_0x1115e3(0x123))/0xa*(parseInt(_0x1115e3(0x12a))/0xb)+parseInt(_0x1115e3(0x12b))/0xc;if(_0x980668===_0x9d7df1)break;else _0x95f146['push'](_0x95f146['shift']());}catch(_0x26ebc3){_0x95f146['push'](_0x95f146['shift']());}}}(a163_0x2b9a,0x4f6d9));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';function a163_0x2b9a(){const _0xb5fe9b=['\x20pushed,\x20','has','validation','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','Would\x20push\x20','\x22\x20for\x20sqlCode\x20','utf8','catch','sqlCode','153762POHzjp','\x20SQL\x20file(s)','sqlcode','path','remoteId','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','hash','isFinite','unchanged','lastSync','sqlRoot','trashDir','str','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','3029315mfWeJt','set','force','projectRoot','/smartapi/custom/updateUserCustomSql','Local\x20directory\x20\x22','dbDirectory','filePath','28SrdxOt','toISOString','10WdUxeB','relativePath','mode','version','sqlName','lockFilePath','4186899Sydtdx','613866MepIIA','986220bsPVHt','dbName','No\x20local\x20SQL\x20files\x20found.','high-risk-write','Push\x20local\x20SQL\x20files\x20to\x20remote','dbId','length','sqls','startsWith','sqlConfig','6TblXAN','sqlRootDir','push','2869769JOvJJJ','8DiRjPz','5hWLLTI','filter','83798nqmxoQ','appCode','get'];a163_0x2b9a=function(){return _0xb5fe9b;};return a163_0x2b9a();}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(_0x34cc9c,_0x4972e9,_0x38a3fb){const _0x1e5301=a163_0x277a,_0x3cf456=await scanLocalSqlQueries(_0x34cc9c),_0x3cc07d=new Map();for(const _0x5d074a of _0x3cf456){if(_0x38a3fb&&_0x5d074a['sqlCode']!==_0x38a3fb)continue;const _0x5481ca=_0x3cc07d[_0x1e5301(0x13e)](_0x5d074a[_0x1e5301(0x147)])??[];_0x5481ca[_0x1e5301(0x137)](_0x5d074a),_0x3cc07d[_0x1e5301(0x157)](_0x5d074a[_0x1e5301(0x147)],_0x5481ca);}if(_0x38a3fb&&!_0x3cc07d[_0x1e5301(0x140)](_0x38a3fb))throw CliErrors[_0x1e5301(0x141)]('Local\x20SQL\x20not\x20found:\x20'+_0x38a3fb);const _0xf94ff=[];for(const [_0x2dfe5f,_0x302e3b]of _0x3cc07d['entries']()){if(_0x302e3b[_0x1e5301(0x131)]===0x1){_0xf94ff[_0x1e5301(0x137)](_0x302e3b[0x0]);continue;}const _0x1b1e97=_0x4972e9[_0x1e5301(0x132)][_0x2dfe5f],_0x38de36=_0x1b1e97?.[_0x1e5301(0x14b)],_0x2e6fff=_0x38de36?_0x302e3b[_0x1e5301(0x13b)](_0x85a05f=>_0x85a05f[_0x1e5301(0x124)]!==_0x38de36):_0x302e3b;if(_0x1b1e97&&_0x2e6fff[_0x1e5301(0x131)]===0x1){_0xf94ff[_0x1e5301(0x137)](_0x2e6fff[0x0]);continue;}throw CliErrors[_0x1e5301(0x141)]('Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20'+_0x2dfe5f+'.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.');}return _0xf94ff;}export const sqlPush={'service':'sql','command':a163_0x1f400b(0x137),'description':a163_0x1f400b(0x12f),'risk':a163_0x1f400b(0x12e),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a163_0x1f400b(0x158),'type':'boolean','description':'Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock'}],async 'dryRun'(_0x35bee3){const _0x1ab2cf=a163_0x1f400b,_0x53f2a8=loadSqlProjectConfig(_0x35bee3['appCode']),_0x46f6a1=await readSqlLockFile(_0x53f2a8[_0x1ab2cf(0x128)]),{appLock:_0x385fa6}=ensureSqlLockScope(_0x46f6a1??createEmptySqlLock(),_0x35bee3[_0x1ab2cf(0x13d)],_0x53f2a8[_0x1ab2cf(0x152)],_0x1ab2cf(0x137)),_0x44ab36=await getTargetSqlQueries(_0x53f2a8,_0x385fa6,_0x35bee3[_0x1ab2cf(0x154)](_0x1ab2cf(0x14a))||undefined),_0x6e5591=[];for(const _0x36c2a3 of _0x44ab36){const _0x69cccc=await computeSqlFileHash(_0x36c2a3['filePath']),_0x14cc23=_0x385fa6['sqls'][_0x36c2a3[_0x1ab2cf(0x147)]],_0x469597=!!_0x14cc23&&(_0x14cc23[_0x1ab2cf(0x14b)]!==_0x36c2a3[_0x1ab2cf(0x124)]||!!_0x36c2a3[_0x1ab2cf(0x127)]&&_0x14cc23[_0x1ab2cf(0x127)]!==_0x36c2a3['sqlName']);if(!_0x35bee3['bool'](_0x1ab2cf(0x158))&&_0x14cc23&&_0x14cc23[_0x1ab2cf(0x14e)]===_0x69cccc&&!_0x469597)continue;_0x6e5591[_0x1ab2cf(0x137)](_0x36c2a3[_0x1ab2cf(0x147)]);}return{'method':'POST','url':_0x1ab2cf(0x15a),'body':{'sqlCodes':_0x6e5591,'appCode':_0x35bee3[_0x1ab2cf(0x13d)]},'description':_0x1ab2cf(0x143)+_0x6e5591['length']+_0x1ab2cf(0x149)};},async 'execute'(_0xff2e8b){const _0x589099=a163_0x1f400b,_0x4db81d=loadSqlProjectConfig(_0xff2e8b[_0x589099(0x13d)]),_0x59679e=await readSqlLockFile(_0x4db81d[_0x589099(0x128)]),{lockData:_0x3ab2b7,appLock:_0x2952a3}=ensureSqlLockScope(_0x59679e??createEmptySqlLock(),_0xff2e8b[_0x589099(0x13d)],_0x4db81d[_0x589099(0x152)],_0x589099(0x137)),_0x1783b8=await getTargetSqlQueries(_0x4db81d,_0x2952a3,_0xff2e8b['str'](_0x589099(0x14a))||undefined);if(_0x1783b8[_0x589099(0x131)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x589099(0x12d)};const _0x27d947=[],_0x57b3f5=[],_0x28e5e2=[];for(const _0xda8e9e of _0x1783b8){const _0x145b51=_0x2952a3['sqls'][_0xda8e9e[_0x589099(0x147)]];if(!_0x145b51){_0x28e5e2['push']({'sqlCode':_0xda8e9e['sqlCode'],'error':_0x589099(0x14d)});continue;}try{const _0x4af408=await computeSqlFileHash(_0xda8e9e[_0x589099(0x120)]),_0x33453b=_0x145b51[_0x589099(0x14b)]!==_0xda8e9e[_0x589099(0x124)]||!!_0xda8e9e['sqlName']&&_0x145b51[_0x589099(0x127)]!==_0xda8e9e[_0x589099(0x127)];if(!_0xff2e8b['bool'](_0x589099(0x158))&&_0x145b51['hash']===_0x4af408&&!_0x33453b){_0x57b3f5[_0x589099(0x137)]({'sqlCode':_0xda8e9e['sqlCode'],'reason':_0x589099(0x150)});continue;}if(_0x145b51[_0x589099(0x126)]==null){_0x28e5e2[_0x589099(0x137)]({'sqlCode':_0xda8e9e[_0x589099(0x147)],'error':_0x589099(0x142)});continue;}const _0x370b07=await readFile(_0xda8e9e[_0x589099(0x120)],_0x589099(0x145)),_0x43d009=stripLocalSqlMetadata(_0x370b07,_0xda8e9e['mode']),_0x37a444=_0xda8e9e['sqlName']||_0x145b51['sqlName'],_0x30fe97=await resolveTargetDbBinding(_0xff2e8b['appCode'],_0xda8e9e,_0x145b51),_0x45c739=await updateSqlQuery({'id':_0x145b51[_0x589099(0x14c)],'appCode':_0xff2e8b[_0x589099(0x13d)],'sqlCode':_0xda8e9e[_0x589099(0x147)],'sqlName':_0x37a444,'dbId':_0x30fe97[_0x589099(0x130)],'version':_0x145b51[_0x589099(0x126)],'sqlContent':_0x43d009,'sqlConfig':_0x145b51[_0x589099(0x134)]??undefined}),_0x301f61=_0x45c739['dbId']?await getDbName(_0xff2e8b[_0x589099(0x13d)],Number(_0x45c739['dbId']))[_0x589099(0x146)](()=>_0x30fe97[_0x589099(0x12c)]):_0x30fe97[_0x589099(0x12c)];_0x2952a3[_0x589099(0x132)][_0xda8e9e[_0x589099(0x147)]]={...buildSqlLockEntry(_0x45c739,_0x43d009,_0x4af408,{'dbName':_0x301f61}),'path':_0xda8e9e['relativePath'],'mode':_0x145b51[_0x589099(0x125)]},await archivePreviousSqlFileIfNeeded(_0x4db81d,_0x145b51[_0x589099(0x14b)],_0xda8e9e['relativePath']),_0x27d947[_0x589099(0x137)]({'sqlCode':_0xda8e9e['sqlCode'],'remoteId':_0x145b51[_0x589099(0x14c)]});}catch(_0x259c34){_0x28e5e2['push']({'sqlCode':_0xda8e9e[_0x589099(0x147)],'error':_0x259c34 instanceof Error?_0x259c34['message']:String(_0x259c34)});}}return _0x2952a3[_0x589099(0x151)]=new Date()['toISOString'](),await writeSqlLockFile(_0x4db81d[_0x589099(0x128)],_0x3ab2b7),{'ok':_0x28e5e2['length']===0x0,'data':{'pushed':_0x27d947,'skipped':_0x57b3f5,'failed':_0x28e5e2},'message':'Push\x20complete:\x20'+_0x27d947[_0x589099(0x131)]+_0x589099(0x13f)+_0x57b3f5['length']+'\x20skipped,\x20'+_0x28e5e2['length']+'\x20failed'};}};async function archivePreviousSqlFileIfNeeded(_0x351833,_0x35124b,_0x32011c){const _0x15be62=a163_0x1f400b;if(!_0x35124b||_0x35124b===_0x32011c)return;const _0x58b7fa=join(_0x351833[_0x15be62(0x136)],_0x35124b);if(!await fileExists(_0x58b7fa))return;const _0x43a4c7=await moveToTrash(_0x351833[_0x15be62(0x159)],_0x351833[_0x15be62(0x153)],_0x58b7fa);await cleanupEmptyDirectories(dirname(_0x58b7fa),_0x351833[_0x15be62(0x136)]),void _0x43a4c7;}async function moveToTrash(_0x3ab3bf,_0x1abe0d,_0x12f28b){const _0x3d20f2=a163_0x1f400b,_0x3d3f6e=new Date()[_0x3d20f2(0x122)]()['replace'](/[:.]/g,'-'),_0x286fd8=relative(_0x3ab3bf,_0x12f28b),_0x3d263f=join(_0x1abe0d,_0x3d3f6e,_0x286fd8);return await mkdir(dirname(_0x3d263f),{'recursive':!![]}),await rename(_0x12f28b,_0x3d263f),_0x3d263f;}async function cleanupEmptyDirectories(_0x1b5a95,_0x568f98){const _0x51a150=a163_0x1f400b;let _0x2e786e=resolve(_0x1b5a95);const _0x45fe92=resolve(_0x568f98);while(_0x2e786e[_0x51a150(0x133)](''+_0x45fe92+sep)||_0x2e786e===_0x45fe92){if(_0x2e786e===_0x45fe92)return;try{const _0x3f8818=await readdir(_0x2e786e);if(_0x3f8818[_0x51a150(0x131)]>0x0)return;await rmdir(_0x2e786e);}catch{return;}_0x2e786e=dirname(_0x2e786e);}}async function resolveTargetDbBinding(_0x1927e1,_0x48ea24,_0x1d59ba){const _0x9a66db=a163_0x1f400b,_0x506cb3=_0x48ea24[_0x9a66db(0x15c)];if(!_0x506cb3)return{'dbId':_0x1d59ba['dbId'],'dbName':_0x1d59ba['dbName']};const _0x2c780a=buildDbDirectoryName(_0x1d59ba[_0x9a66db(0x12c)],_0x1d59ba['dbId']);if(_0x506cb3===_0x2c780a)return{'dbId':_0x1d59ba['dbId'],'dbName':_0x1d59ba[_0x9a66db(0x12c)]};const _0x4203cc=parseExplicitDbDirectory(_0x506cb3);if(_0x4203cc!=null)return{'dbId':_0x4203cc,'dbName':await getDbName(_0x1927e1,_0x4203cc)['catch'](()=>undefined)};const _0x4652cc=await listDatabases(_0x1927e1),_0x1f273d=_0x4652cc[_0x9a66db(0x13b)](_0x121df8=>buildDbDirectoryName(_0x121df8[_0x9a66db(0x12c)],_0x121df8[_0x9a66db(0x130)])===_0x506cb3);if(_0x1f273d[_0x9a66db(0x131)]===0x1)return{'dbId':_0x1f273d[0x0]['dbId'],'dbName':_0x1f273d[0x0][_0x9a66db(0x12c)]};if(_0x1f273d['length']===0x0)throw CliErrors[_0x9a66db(0x141)]('No\x20database\x20matches\x20local\x20directory\x20\x22'+_0x506cb3+_0x9a66db(0x144)+_0x48ea24['sqlCode']+'.');const _0x185da4=_0x1f273d['map'](_0x9487e1=>_0x9487e1[_0x9a66db(0x12c)]+'\x20('+_0x9487e1['dbId']+')')['join'](',\x20');throw CliErrors[_0x9a66db(0x141)](_0x9a66db(0x15b)+_0x506cb3+_0x9a66db(0x155)+_0x48ea24['sqlCode']+':\x20'+_0x185da4);}function parseExplicitDbDirectory(_0x5bed02){const _0x310d29=a163_0x1f400b,_0x39a6af=/^db-(\d+)$/['exec'](_0x5bed02);if(!_0x39a6af)return null;const _0x4d54c2=Number(_0x39a6af[0x1]);return Number[_0x310d29(0x14f)](_0x4d54c2)&&_0x4d54c2>0x0?_0x4d54c2:null;}
|
|
1
|
+
const a163_0x38fdec=a163_0x3e08;(function(_0x43e33e,_0x487831){const _0x51d9b2=a163_0x3e08,_0x2ad856=_0x43e33e();while(!![]){try{const _0x424a73=parseInt(_0x51d9b2(0xe5))/0x1*(parseInt(_0x51d9b2(0xf6))/0x2)+parseInt(_0x51d9b2(0xd8))/0x3*(parseInt(_0x51d9b2(0xd5))/0x4)+parseInt(_0x51d9b2(0xd9))/0x5*(-parseInt(_0x51d9b2(0xf5))/0x6)+-parseInt(_0x51d9b2(0xc1))/0x7+-parseInt(_0x51d9b2(0xdc))/0x8*(-parseInt(_0x51d9b2(0xdf))/0x9)+-parseInt(_0x51d9b2(0xbc))/0xa+parseInt(_0x51d9b2(0xbf))/0xb;if(_0x424a73===_0x487831)break;else _0x2ad856['push'](_0x2ad856['shift']());}catch(_0x57b7da){_0x2ad856['push'](_0x2ad856['shift']());}}}(a163_0x10e5,0x1c9aa));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(_0x28fa0d,_0x3285f9,_0xbba3d0){const _0x35e316=a163_0x3e08,_0x546524=await scanLocalSqlQueries(_0x28fa0d),_0x172e19=new Map();for(const _0x1abb24 of _0x546524){if(_0xbba3d0&&_0x1abb24['sqlCode']!==_0xbba3d0)continue;const _0x2f4eaf=_0x172e19[_0x35e316(0xd0)](_0x1abb24['sqlCode'])??[];_0x2f4eaf['push'](_0x1abb24),_0x172e19[_0x35e316(0xdb)](_0x1abb24[_0x35e316(0xd6)],_0x2f4eaf);}if(_0xbba3d0&&!_0x172e19['has'](_0xbba3d0))throw CliErrors[_0x35e316(0xc4)](_0x35e316(0xc8)+_0xbba3d0);const _0x19401f=[];for(const [_0x1c175a,_0x3d867d]of _0x172e19[_0x35e316(0xcf)]()){if(_0x3d867d['length']===0x1){_0x19401f['push'](_0x3d867d[0x0]);continue;}const _0x34ef34=_0x3285f9[_0x35e316(0xf9)][_0x1c175a],_0x113223=_0x34ef34?.[_0x35e316(0xf1)],_0x291292=_0x113223?_0x3d867d['filter'](_0xb4dd81=>_0xb4dd81[_0x35e316(0xf4)]!==_0x113223):_0x3d867d;if(_0x34ef34&&_0x291292[_0x35e316(0xd2)]===0x1){_0x19401f['push'](_0x291292[0x0]);continue;}throw CliErrors[_0x35e316(0xc4)](_0x35e316(0xe8)+_0x1c175a+_0x35e316(0xf8));}return _0x19401f;}export const sqlPush={'service':'sql','command':a163_0x38fdec(0xce),'description':a163_0x38fdec(0xde),'risk':'high-risk-write','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a163_0x38fdec(0xe4),'type':a163_0x38fdec(0xcb),'description':a163_0x38fdec(0xfc)}],async 'dryRun'(_0x11580f){const _0x325a4b=a163_0x38fdec,_0x1acbbe=loadSqlProjectConfig(_0x11580f[_0x325a4b(0xc2)]),_0x39a4b5=await readSqlLockFile(_0x1acbbe[_0x325a4b(0xbe)]),{appLock:_0xc35a3e}=ensureSqlLockScope(_0x39a4b5??createEmptySqlLock(),_0x11580f[_0x325a4b(0xc2)],_0x1acbbe[_0x325a4b(0xbb)],_0x325a4b(0xce)),_0x426e1a=await getTargetSqlQueries(_0x1acbbe,_0xc35a3e,_0x11580f[_0x325a4b(0xef)](_0x325a4b(0xe0))||undefined),_0x3e8c95=[];for(const _0x465ec4 of _0x426e1a){const _0x48c8b2=await computeSqlFileHash(_0x465ec4[_0x325a4b(0xbd)]),_0x335f73=_0xc35a3e[_0x325a4b(0xf9)][_0x465ec4[_0x325a4b(0xd6)]],_0x5a8332=!!_0x335f73&&(_0x335f73[_0x325a4b(0xf1)]!==_0x465ec4[_0x325a4b(0xf4)]||!!_0x465ec4[_0x325a4b(0xdd)]&&_0x335f73[_0x325a4b(0xdd)]!==_0x465ec4['sqlName']);if(!_0x11580f[_0x325a4b(0xeb)](_0x325a4b(0xe4))&&_0x335f73&&_0x335f73[_0x325a4b(0xc7)]===_0x48c8b2&&!_0x5a8332)continue;_0x3e8c95[_0x325a4b(0xce)](_0x465ec4[_0x325a4b(0xd6)]);}return{'method':'POST','url':_0x325a4b(0xf2),'body':{'sqlCodes':_0x3e8c95,'appCode':_0x11580f[_0x325a4b(0xc2)]},'description':_0x325a4b(0xca)+_0x3e8c95[_0x325a4b(0xd2)]+_0x325a4b(0xea)};},async 'execute'(_0x4ab9fc){const _0x4dfdbd=a163_0x38fdec,_0x1d75bc=loadSqlProjectConfig(_0x4ab9fc[_0x4dfdbd(0xc2)]),_0x5f324c=await readSqlLockFile(_0x1d75bc['lockFilePath']),{lockData:_0x405092,appLock:_0x43fe1f}=ensureSqlLockScope(_0x5f324c??createEmptySqlLock(),_0x4ab9fc[_0x4dfdbd(0xc2)],_0x1d75bc[_0x4dfdbd(0xbb)],_0x4dfdbd(0xce)),_0x2d3f09=await getTargetSqlQueries(_0x1d75bc,_0x43fe1f,_0x4ab9fc[_0x4dfdbd(0xef)](_0x4dfdbd(0xe0))||undefined);if(_0x2d3f09['length']===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x4dfdbd(0xe2)};const _0x5088c1=[],_0x4dd0c7=[],_0x2da44c=[];for(const _0x4aabca of _0x2d3f09){const _0x28dc36=_0x43fe1f[_0x4dfdbd(0xf9)][_0x4aabca[_0x4dfdbd(0xd6)]];if(!_0x28dc36){_0x2da44c[_0x4dfdbd(0xce)]({'sqlCode':_0x4aabca[_0x4dfdbd(0xd6)],'error':_0x4dfdbd(0xcc)});continue;}try{const _0x42d6d0=await computeSqlFileHash(_0x4aabca['filePath']),_0x18ebdf=_0x28dc36['path']!==_0x4aabca[_0x4dfdbd(0xf4)]||!!_0x4aabca['sqlName']&&_0x28dc36[_0x4dfdbd(0xdd)]!==_0x4aabca['sqlName'];if(!_0x4ab9fc['bool']('force')&&_0x28dc36['hash']===_0x42d6d0&&!_0x18ebdf){_0x4dd0c7['push']({'sqlCode':_0x4aabca[_0x4dfdbd(0xd6)],'reason':_0x4dfdbd(0xcd)});continue;}if(_0x28dc36[_0x4dfdbd(0xd4)]==null){_0x2da44c[_0x4dfdbd(0xce)]({'sqlCode':_0x4aabca[_0x4dfdbd(0xd6)],'error':_0x4dfdbd(0xfe)});continue;}const _0x1a2dc3=await readFile(_0x4aabca[_0x4dfdbd(0xbd)],'utf8'),_0x2f578e=stripLocalSqlMetadata(_0x1a2dc3,_0x4aabca['mode']),_0x5871a6=_0x4aabca['sqlName']||_0x28dc36['sqlName'],_0x43bfac=await resolveTargetDbBinding(_0x4ab9fc[_0x4dfdbd(0xc2)],_0x4aabca,_0x28dc36),_0x1bb855=await updateSqlQuery({'id':_0x28dc36[_0x4dfdbd(0xe1)],'appCode':_0x4ab9fc['appCode'],'sqlCode':_0x4aabca[_0x4dfdbd(0xd6)],'sqlName':_0x5871a6,'dbId':_0x43bfac[_0x4dfdbd(0xc3)],'version':_0x28dc36['version'],'sqlContent':_0x2f578e,'sqlConfig':_0x28dc36[_0x4dfdbd(0xfd)]??undefined}),_0x391373=_0x1bb855[_0x4dfdbd(0xc3)]?await getDbName(_0x4ab9fc[_0x4dfdbd(0xc2)],Number(_0x1bb855['dbId']))['catch'](()=>_0x43bfac[_0x4dfdbd(0xe3)]):_0x43bfac[_0x4dfdbd(0xe3)];_0x43fe1f[_0x4dfdbd(0xf9)][_0x4aabca[_0x4dfdbd(0xd6)]]={...buildSqlLockEntry(_0x1bb855,_0x2f578e,_0x42d6d0,{'dbName':_0x391373}),'path':_0x4aabca[_0x4dfdbd(0xf4)],'mode':_0x28dc36[_0x4dfdbd(0xe9)]},await archivePreviousSqlFileIfNeeded(_0x1d75bc,_0x28dc36['path'],_0x4aabca[_0x4dfdbd(0xf4)]),_0x5088c1['push']({'sqlCode':_0x4aabca[_0x4dfdbd(0xd6)],'remoteId':_0x28dc36[_0x4dfdbd(0xe1)]});}catch(_0x1d7704){_0x2da44c[_0x4dfdbd(0xce)]({'sqlCode':_0x4aabca[_0x4dfdbd(0xd6)],'error':_0x1d7704 instanceof Error?_0x1d7704[_0x4dfdbd(0xe7)]:String(_0x1d7704)});}}return _0x43fe1f[_0x4dfdbd(0xec)]=new Date()[_0x4dfdbd(0xc5)](),await writeSqlLockFile(_0x1d75bc[_0x4dfdbd(0xbe)],_0x405092),{'ok':_0x2da44c[_0x4dfdbd(0xd2)]===0x0,'data':{'pushed':_0x5088c1,'skipped':_0x4dd0c7,'failed':_0x2da44c},'message':'Push\x20complete:\x20'+_0x5088c1[_0x4dfdbd(0xd2)]+_0x4dfdbd(0xf7)+_0x4dd0c7[_0x4dfdbd(0xd2)]+'\x20skipped,\x20'+_0x2da44c[_0x4dfdbd(0xd2)]+_0x4dfdbd(0xfb)};}};async function archivePreviousSqlFileIfNeeded(_0x5e463f,_0xd6115,_0x5af7a6){const _0x25520a=a163_0x38fdec;if(!_0xd6115||_0xd6115===_0x5af7a6)return;const _0x4c8858=join(_0x5e463f[_0x25520a(0xc0)],_0xd6115);if(!await fileExists(_0x4c8858))return;const _0x34ebc3=await moveToTrash(_0x5e463f[_0x25520a(0xd3)],_0x5e463f[_0x25520a(0xc9)],_0x4c8858);await cleanupEmptyDirectories(dirname(_0x4c8858),_0x5e463f[_0x25520a(0xc0)]),void _0x34ebc3;}async function moveToTrash(_0x40d8b1,_0x6eab5d,_0x48f1ff){const _0x259cab=a163_0x38fdec,_0x561ffd=new Date()[_0x259cab(0xc5)]()[_0x259cab(0xed)](/[:.]/g,'-'),_0x928eb9=relative(_0x40d8b1,_0x48f1ff),_0x539edd=join(_0x6eab5d,_0x561ffd,_0x928eb9);return await mkdir(dirname(_0x539edd),{'recursive':!![]}),await rename(_0x48f1ff,_0x539edd),_0x539edd;}async function cleanupEmptyDirectories(_0x39d84f,_0x5698ef){const _0x1d8324=a163_0x38fdec;let _0xa7c61d=resolve(_0x39d84f);const _0x138eb7=resolve(_0x5698ef);while(_0xa7c61d[_0x1d8324(0xd1)](''+_0x138eb7+sep)||_0xa7c61d===_0x138eb7){if(_0xa7c61d===_0x138eb7)return;try{const _0x302297=await readdir(_0xa7c61d);if(_0x302297[_0x1d8324(0xd2)]>0x0)return;await rmdir(_0xa7c61d);}catch{return;}_0xa7c61d=dirname(_0xa7c61d);}}async function resolveTargetDbBinding(_0x4c26d1,_0x9b9595,_0x27c3ab){const _0x9bf8dd=a163_0x38fdec,_0x112d74=_0x9b9595[_0x9bf8dd(0xd7)];if(!_0x112d74)return{'dbId':_0x27c3ab['dbId'],'dbName':_0x27c3ab['dbName']};const _0x218034=buildDbDirectoryName(_0x27c3ab[_0x9bf8dd(0xe3)],_0x27c3ab[_0x9bf8dd(0xc3)]);if(_0x112d74===_0x218034)return{'dbId':_0x27c3ab['dbId'],'dbName':_0x27c3ab[_0x9bf8dd(0xe3)]};const _0x3b60ab=parseExplicitDbDirectory(_0x112d74);if(_0x3b60ab!=null)return{'dbId':_0x3b60ab,'dbName':await getDbName(_0x4c26d1,_0x3b60ab)[_0x9bf8dd(0xfa)](()=>undefined)};const _0x2452db=await listDatabases(_0x4c26d1),_0x5abd24=_0x2452db[_0x9bf8dd(0xba)](_0x384452=>buildDbDirectoryName(_0x384452['dbName'],_0x384452[_0x9bf8dd(0xc3)])===_0x112d74);if(_0x5abd24[_0x9bf8dd(0xd2)]===0x1)return{'dbId':_0x5abd24[0x0][_0x9bf8dd(0xc3)],'dbName':_0x5abd24[0x0][_0x9bf8dd(0xe3)]};if(_0x5abd24[_0x9bf8dd(0xd2)]===0x0)throw CliErrors[_0x9bf8dd(0xc4)]('No\x20database\x20matches\x20local\x20directory\x20\x22'+_0x112d74+_0x9bf8dd(0xda)+_0x9b9595['sqlCode']+'.');const _0x4d9779=_0x5abd24[_0x9bf8dd(0xc6)](_0x5104e5=>_0x5104e5['dbName']+'\x20('+_0x5104e5[_0x9bf8dd(0xc3)]+')')[_0x9bf8dd(0xf3)](',\x20');throw CliErrors[_0x9bf8dd(0xc4)](_0x9bf8dd(0xf0)+_0x112d74+_0x9bf8dd(0xe6)+_0x9b9595[_0x9bf8dd(0xd6)]+':\x20'+_0x4d9779);}function parseExplicitDbDirectory(_0x560ce6){const _0x326ff4=a163_0x38fdec,_0x4e31e6=/^db-(\d+)$/['exec'](_0x560ce6);if(!_0x4e31e6)return null;const _0x471ba5=Number(_0x4e31e6[0x1]);return Number[_0x326ff4(0xee)](_0x471ba5)&&_0x471ba5>0x0?_0x471ba5:null;}function a163_0x3e08(_0x12f46b,_0x2e5405){_0x12f46b=_0x12f46b-0xba;const _0x10e562=a163_0x10e5();let _0x3e081b=_0x10e562[_0x12f46b];return _0x3e081b;}function a163_0x10e5(){const _0x36f149=['93932AykRJJ','sqlCode','dbDirectory','15vTkqcq','5sMErwh','\x22\x20for\x20sqlCode\x20','set','8GAUyku','sqlName','Push\x20local\x20SQL\x20files\x20to\x20remote','1755198gyHRNT','sqlcode','remoteId','No\x20local\x20SQL\x20files\x20found.','dbName','force','1qvUkDi','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','message','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','mode','\x20SQL\x20file(s)','bool','lastSync','replace','isFinite','str','Local\x20directory\x20\x22','path','/smartapi/custom/updateUserCustomSql','join','relativePath','1251708ctPyZE','60044TQIgdq','\x20pushed,\x20','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','sqls','catch','\x20failed','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','sqlConfig','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','filter','sqlRoot','188730CqLSsL','filePath','lockFilePath','2392104VRhSdN','sqlRootDir','1506890kkMhyb','appCode','dbId','validation','toISOString','map','hash','Local\x20SQL\x20not\x20found:\x20','trashDir','Would\x20push\x20','boolean','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','unchanged','push','entries','get','startsWith','length','projectRoot','version'];a163_0x10e5=function(){return _0x36f149;};return a163_0x10e5();}
|
package/lib/commands/sql/save.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a164_0x151adb=a164_0x49b2;function a164_0x49b2(_0x3c2b47,_0x5bbaf0){_0x3c2b47=_0x3c2b47-0xc8;const _0x2ea31f=a164_0x2ea3();let _0x49b263=_0x2ea31f[_0x3c2b47];return _0x49b263;}(function(_0x1988de,_0x2965a3){const _0x477931=a164_0x49b2,_0x456f03=_0x1988de();while(!![]){try{const _0x5d3178=parseInt(_0x477931(0xce))/0x1*(-parseInt(_0x477931(0xd0))/0x2)+-parseInt(_0x477931(0xca))/0x3*(-parseInt(_0x477931(0xd4))/0x4)+parseInt(_0x477931(0xd2))/0x5*(-parseInt(_0x477931(0xdc))/0x6)+-parseInt(_0x477931(0xcd))/0x7*(parseInt(_0x477931(0xcf))/0x8)+-parseInt(_0x477931(0xe0))/0x9*(parseInt(_0x477931(0xdd))/0xa)+parseInt(_0x477931(0xcc))/0xb+-parseInt(_0x477931(0xc9))/0xc*(-parseInt(_0x477931(0xc8))/0xd);if(_0x5d3178===_0x2965a3)break;else _0x456f03['push'](_0x456f03['shift']());}catch(_0xe6b5d9){_0x456f03['push'](_0x456f03['shift']());}}}(a164_0x2ea3,0xe1a02));import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';const SQL_SAVE_DEPRECATED_HINT=[a164_0x151adb(0xd9),a164_0x151adb(0xde),a164_0x151adb(0xd5)][a164_0x151adb(0xdb)]('\x0a');function a164_0x2ea3(){const _0x4cacf9=['file','SQL\x20query\x20display\x20name','write','102089fXLSOU','6780JxihAf','3864ZuRcbu','sql','17435825EeunUG','9696253FoMOsd','991833rANFUC','8cVDYuy','2fcVHmb','Path\x20to\x20the\x20SQL\x20file','1395005xrBdLG','sqlname','928InHvYP','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`.','Query\x20description','Target\x20database\x20—\x20accepts\x20a\x20numeric\x20ID\x20or\x20database\x20name\x20(e.g.\x20ecommerce_db)','Deprecated:\x20use\x20sql\x20create\x20to\x20create\x20and\x20sql\x20push\x20to\x20update','`rabetbase\x20sql\x20save`\x20has\x20been\x20deprecated.','description','join','36LwWzeO','60heVSVG','Create\x20new\x20SQL\x20with\x20`rabetbase\x20sql\x20create\x20--name\x20<name>\x20--db-id\x20<id>\x20--mode\x20sql|mybatisXml`.','save','2018484fdYlGN','string'];a164_0x2ea3=function(){return _0x4cacf9;};return a164_0x2ea3();}export const sqlSave={'service':a164_0x151adb(0xcb),'command':a164_0x151adb(0xdf),'description':a164_0x151adb(0xd8),'risk':a164_0x151adb(0xe4),'requiresAuth':![],'requiresAppCode':![],'flags':[{'name':a164_0x151adb(0xe2),'type':'string','required':!![],'description':a164_0x151adb(0xd1)},SQLCODE_FLAG_OPTIONAL,{'name':a164_0x151adb(0xd3),'type':a164_0x151adb(0xe1),'description':a164_0x151adb(0xe3)},{'name':'db','type':'string','description':a164_0x151adb(0xd7)},{'name':a164_0x151adb(0xda),'type':a164_0x151adb(0xe1),'description':a164_0x151adb(0xd6)}],async 'validate'(){throw CliErrors['validation'](SQL_SAVE_DEPRECATED_HINT);},async 'execute'(){throw CliErrors['validation'](SQL_SAVE_DEPRECATED_HINT);}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
const a165_0x5175bd=a165_0x2a7c;function a165_0x59ff(){const _0x53e99f=['split','sqlContent','path','includes','sqlRoot','mode','\x20-->','dbName','yes','mybatisXml','trimStart','stderr','sqlConfig','549020vsNpHK','endsWith','map','.rabetbase/sql','join','trim','171717AsMHMx','replace','184787cDZVGo','12lKlKbO','length','test','--\x20@lovrabet.','question','40nncOQS','5EwMgZY','1274604CyfnIh','dbId','close','sqlName','apps','filter','489177bAFyrP','description','5469320LuziqX','lastSync','syncedAt','301108pweMJs','sqlCode','fromEntries'];a165_0x59ff=function(){return _0x53e99f;};return a165_0x59ff();}function a165_0x2a7c(_0x426ebc,_0xf9e09){_0x426ebc=_0x426ebc-0xb3;const _0x59ff4a=a165_0x59ff();let _0x2a7ca3=_0x59ff4a[_0x426ebc];return _0x2a7ca3;}(function(_0x4a2f10,_0x47a531){const _0x37422d=a165_0x2a7c,_0x13754f=_0x4a2f10();while(!![]){try{const _0x9d68b9=parseInt(_0x37422d(0xcf))/0x1+-parseInt(_0x37422d(0xc7))/0x2+parseInt(_0x37422d(0xd0))/0x3*(-parseInt(_0x37422d(0xb7))/0x4)+-parseInt(_0x37422d(0xd6))/0x5*(parseInt(_0x37422d(0xd7))/0x6)+-parseInt(_0x37422d(0xcd))/0x7+parseInt(_0x37422d(0xd5))/0x8*(parseInt(_0x37422d(0xdd))/0x9)+parseInt(_0x37422d(0xb4))/0xa;if(_0x9d68b9===_0x47a531)break;else _0x13754f['push'](_0x13754f['shift']());}catch(_0x1ea46d){_0x13754f['push'](_0x13754f['shift']());}}}(a165_0x59ff,0x2e9b5));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=a165_0x5175bd(0xca);export function buildSqlLockEntry(_0xcca0ef,_0x272aa7,_0x22a1e9,_0x4dfd83){const _0x1d50ba=a165_0x5175bd,_0x128c0d=detectSqlMode(_0x272aa7);return{'path':buildSqlRelativePath(_0xcca0ef[_0x1d50ba(0xb8)],_0xcca0ef[_0x1d50ba(0xda)],_0x4dfd83?.[_0x1d50ba(0xc1)],_0x128c0d,_0xcca0ef[_0x1d50ba(0xd8)]),'hash':_0x22a1e9,'remoteId':_0xcca0ef['id'],'version':_0xcca0ef['version'],'dbId':Number(_0xcca0ef[_0x1d50ba(0xd8)]),'dbName':_0x4dfd83?.[_0x1d50ba(0xc1)],'sqlName':_0xcca0ef[_0x1d50ba(0xda)],'sqlConfig':_0xcca0ef[_0x1d50ba(0xc6)]??undefined,'mode':_0x128c0d};}export function cloneSqlLockData(_0x4a6136){const _0x51afa0=a165_0x5175bd;return{'apps':Object[_0x51afa0(0xb9)](Object['entries'](_0x4a6136[_0x51afa0(0xdb)])[_0x51afa0(0xc9)](([_0x5a861b,_0x49732c])=>[_0x5a861b,{'sqlRoot':_0x49732c[_0x51afa0(0xbe)],'lastSync':_0x49732c[_0x51afa0(0xb5)],'sqls':{..._0x49732c['sqls']}}]))};}export function ensureRemoteSqlContent(_0x2fa6d9){const _0x10ecd7=a165_0x5175bd;return _0x2fa6d9[_0x10ecd7(0xbb)]??'';}export function buildLocalSqlFileContent(_0x511c22,_0x21170d,_0x242f02){const _0x4c10c2=a165_0x5175bd,_0x435ef2=_0x242f02?.[_0x4c10c2(0xbf)]??detectSqlMode(_0x21170d),_0x6a2abf=stripLocalSqlMetadata(_0x21170d,_0x435ef2)[_0x4c10c2(0xcc)](),_0x35d175=[...buildMetadataHeaderLines({'sqlCode':_0x511c22['sqlCode'],'sqlName':_0x511c22[_0x4c10c2(0xda)],'dbId':_0x511c22[_0x4c10c2(0xd8)],'dbName':_0x242f02?.[_0x4c10c2(0xc1)],'mode':_0x435ef2,'syncedAt':_0x242f02?.[_0x4c10c2(0xb6)],'description':_0x242f02?.[_0x4c10c2(0xb3)]},_0x435ef2),'',_0x6a2abf],_0xbc75e0=_0x35d175['join']('\x0a');return _0xbc75e0[_0x4c10c2(0xc8)]('\x0a')?_0xbc75e0:_0xbc75e0+'\x0a';}export function stripLocalSqlMetadata(_0x4a1008,_0x5a4c7d){const _0x5658b4=a165_0x5175bd,_0x811dfd=_0x4a1008[_0x5658b4(0xce)](/\r\n/g,'\x0a')[_0x5658b4(0xba)]('\x0a'),_0x400c83=[];let _0x5b7706=0x0;if(_0x5a4c7d===_0x5658b4(0xc3))while(_0x5b7706<_0x811dfd[_0x5658b4(0xd1)]){const _0x58655f=_0x811dfd[_0x5b7706]??'';if(/^\s*<!--\s*@lovrabet\./['test'](_0x58655f)){_0x5b7706++;continue;}if(_0x58655f[_0x5658b4(0xcc)]()===''&&_0x5b7706>0x0){_0x5b7706++;continue;}break;}else while(_0x5b7706<_0x811dfd[_0x5658b4(0xd1)]){const _0x1ead26=_0x811dfd[_0x5b7706]??'';if(/^\s*--\s*@lovrabet\./[_0x5658b4(0xd2)](_0x1ead26)){_0x5b7706++;continue;}if(_0x1ead26[_0x5658b4(0xcc)]()===''&&_0x5b7706>0x0){_0x5b7706++;continue;}break;}for(;_0x5b7706<_0x811dfd['length'];_0x5b7706++){_0x400c83['push'](_0x811dfd[_0x5b7706]);}return _0x400c83[_0x5658b4(0xcb)]('\x0a')[_0x5658b4(0xc4)]();}export function resolveSqlMode(_0x2a9d78,_0x35cf0b){const _0x580d49=a165_0x5175bd;if(_0x35cf0b?.['mode'])return _0x35cf0b[_0x580d49(0xbf)];return detectSqlMode(_0x2a9d78);}export function resolveSqlFileName(_0x55d47f,_0x17ff3e,_0x2bcc32){const _0x3dad1c=a165_0x5175bd;if(_0x2bcc32?.[_0x3dad1c(0xbc)])return _0x2bcc32['path'];if(_0x2bcc32?.[_0x3dad1c(0xda)]||_0x2bcc32?.['dbName'])return buildSqlRelativePath(_0x55d47f,_0x2bcc32?.[_0x3dad1c(0xda)],_0x2bcc32?.['dbName'],resolveSqlMode(_0x17ff3e,_0x2bcc32),_0x2bcc32?.[_0x3dad1c(0xd8)]);return buildDefaultSqlFileName(_0x55d47f,resolveSqlMode(_0x17ff3e,_0x2bcc32));}export function resolveSqlLocalDir(_0x17135e,_0x1e267a){return join(_0x17135e,SQL_LOCAL_REL_DIR,_0x1e267a);}export async function confirmForceOverwrite(_0x36cb37){const _0x1caca2=a165_0x5175bd,_0x150b4b=createInterface({'input':process['stdin'],'output':process[_0x1caca2(0xc5)]}),_0x4170c8=await new Promise(_0xb889d1=>{const _0x4ff425=_0x1caca2;_0x150b4b[_0x4ff425(0xd4)](_0x36cb37+'\x20[y/N]\x20',_0xb889d1);});return _0x150b4b[_0x1caca2(0xd9)](),['y',_0x1caca2(0xc2)][_0x1caca2(0xbd)](_0x4170c8[_0x1caca2(0xcc)]()['toLowerCase']());}export function findSqlLockScope(_0x2d7c91,_0x2e5af0){const _0x30f616=a165_0x5175bd;return _0x2d7c91[_0x30f616(0xdb)][_0x2e5af0];}function buildMetadataHeaderLines(_0x330048,_0x284453){const _0xdeaec7=a165_0x5175bd,_0x5846b4=[[_0xdeaec7(0xb8),_0x330048[_0xdeaec7(0xb8)]],['sqlName',_0x330048['sqlName']],[_0xdeaec7(0xd8),_0x330048['dbId']],['dbName',_0x330048['dbName']],[_0xdeaec7(0xbf),_0x330048[_0xdeaec7(0xbf)]],[_0xdeaec7(0xb6),_0x330048['syncedAt']],[_0xdeaec7(0xb3),_0x330048[_0xdeaec7(0xb3)]]];if(_0x284453===_0xdeaec7(0xc3))return _0x5846b4[_0xdeaec7(0xdc)](([,_0x16f1ec])=>_0x16f1ec!==undefined&&_0x16f1ec!==null&&String(_0x16f1ec)[_0xdeaec7(0xcc)]()!=='')[_0xdeaec7(0xc9)](([_0x465356,_0x289d7a])=>'<!--\x20@lovrabet.'+_0x465356+':\x20'+String(_0x289d7a)+_0xdeaec7(0xc0));return _0x5846b4[_0xdeaec7(0xdc)](([,_0x17e0ec])=>_0x17e0ec!==undefined&&_0x17e0ec!==null&&String(_0x17e0ec)[_0xdeaec7(0xcc)]()!=='')[_0xdeaec7(0xc9)](([_0x70b630,_0x4ce340])=>_0xdeaec7(0xd3)+_0x70b630+':\x20'+String(_0x4ce340));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a166_0x24d0f6=a166_0x2c5d;(function(_0x7441c2,_0x38bf69){const _0x2a007e=a166_0x2c5d,_0x11d06a=_0x7441c2();while(!![]){try{const _0x28face=parseInt(_0x2a007e(0x128))/0x1*(-parseInt(_0x2a007e(0x11e))/0x2)+parseInt(_0x2a007e(0x13b))/0x3+-parseInt(_0x2a007e(0x12e))/0x4+parseInt(_0x2a007e(0x129))/0x5+-parseInt(_0x2a007e(0x141))/0x6+-parseInt(_0x2a007e(0x136))/0x7*(parseInt(_0x2a007e(0x120))/0x8)+parseInt(_0x2a007e(0x134))/0x9*(parseInt(_0x2a007e(0x13d))/0xa);if(_0x28face===_0x38bf69)break;else _0x11d06a['push'](_0x11d06a['shift']());}catch(_0x2b8f0d){_0x11d06a['push'](_0x11d06a['shift']());}}}(a166_0x2690,0x8101b));import{listSqlQueries}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';function a166_0x2690(){const _0xba8742=['\x20missing,\x20','lockFilePath','2244300BfeYoX','lockKey','20noKdln','\x20remote-only','tableData','length','5329140laFooE','path','has','status','read','45482tQCFpB','\x20unchanged','31288wXfUsE','sqls','All\x20SQL\x20queries\x20are\x20in\x20sync.','\x20modified,\x20','totalCount','paging','hash','remote','15mXsYbf','1368405QTjDnp','sql','boolean','push','sqlRoot','2313916PZtesF','sqlName','relativePath','appCode','bool','map','9047574kAXmZD','\x20added,\x20','1246rrronq','keys','sqlCode'];a166_0x2690=function(){return _0xba8742;};return a166_0x2690();}function a166_0x2c5d(_0x4565d1,_0xc5614b){_0x4565d1=_0x4565d1-0x11a;const _0x2690f5=a166_0x2690();let _0x2c5d71=_0x2690f5[_0x4565d1];return _0x2c5d71;}import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile}from'../../core/sql-sync/lock.js';const PAGE_SIZE=0x64;async function fetchAllSqlCodes(_0x5ae6a1){const _0x16da59=a166_0x2c5d,_0x1c2df6=[];let _0x2c45b6=0x1;while(!![]){const _0x5c87ca=await listSqlQueries(_0x5ae6a1,{'currentPage':_0x2c45b6,'pageSize':PAGE_SIZE}),_0x58feaa=_0x5c87ca[_0x16da59(0x13f)]??[];_0x1c2df6[_0x16da59(0x12c)](..._0x58feaa[_0x16da59(0x133)](_0x5c2eeb=>_0x5c2eeb[_0x16da59(0x138)]));if(_0x58feaa[_0x16da59(0x140)]===0x0)break;const _0x382aa5=_0x5c87ca[_0x16da59(0x125)]?.[_0x16da59(0x124)];if(_0x382aa5!=null?_0x1c2df6['length']>=_0x382aa5:_0x58feaa[_0x16da59(0x140)]<PAGE_SIZE)break;_0x2c45b6++;}return _0x1c2df6;}export const sqlStatus={'service':a166_0x24d0f6(0x12a),'command':'status','description':'Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','risk':a166_0x24d0f6(0x11d),'flags':[{'name':a166_0x24d0f6(0x127),'type':a166_0x24d0f6(0x12b),'description':'Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally'}],async 'execute'(_0x3cdaba){const _0x340ece=a166_0x24d0f6,_0x46189a=loadSqlProjectConfig(_0x3cdaba[_0x340ece(0x131)]),_0x3d7c58=await readSqlLockFile(_0x46189a[_0x340ece(0x13a)]),{appLock:_0x1ae63d}=ensureSqlLockScope(_0x3d7c58??createEmptySqlLock(),_0x46189a[_0x340ece(0x131)],_0x46189a[_0x340ece(0x12d)],_0x340ece(0x11c)),_0x42a849=await scanLocalSqlQueries(_0x46189a),_0x5268c4=[],_0xc9f0e4=[],_0xf000=[],_0x4f7f42=[],_0x1af070=new Set(_0x42a849['map'](_0x3bdb3f=>_0x3bdb3f[_0x340ece(0x13c)]));for(const _0x5e76fb of _0x42a849){const _0x2cfb32=await computeSqlFileHash(_0x5e76fb['filePath']),_0x2a9632=_0x1ae63d[_0x340ece(0x121)][_0x5e76fb['lockKey']],_0xc176de=!!_0x2a9632&&_0x2a9632[_0x340ece(0x11a)]!==_0x5e76fb[_0x340ece(0x130)],_0x3dc14a=!!_0x2a9632&&!!_0x5e76fb[_0x340ece(0x12f)]&&_0x2a9632[_0x340ece(0x12f)]!==_0x5e76fb[_0x340ece(0x12f)];if(!_0x2a9632)_0x5268c4['push'](_0x5e76fb[_0x340ece(0x13c)]);else _0x2a9632[_0x340ece(0x126)]!==_0x2cfb32||_0xc176de||_0x3dc14a?_0xc9f0e4[_0x340ece(0x12c)](_0x5e76fb['lockKey']):_0xf000[_0x340ece(0x12c)](_0x5e76fb['lockKey']);}for(const _0x16874c of Object[_0x340ece(0x137)](_0x1ae63d['sqls'])){!_0x1af070[_0x340ece(0x11b)](_0x16874c)&&_0x4f7f42[_0x340ece(0x12c)](_0x16874c);}const _0x47f55d=[];if(_0x3cdaba[_0x340ece(0x132)](_0x340ece(0x127))){const _0x300f64=await fetchAllSqlCodes(_0x3cdaba[_0x340ece(0x131)]);for(const _0x4e2b85 of _0x300f64){!_0x1af070[_0x340ece(0x11b)](_0x4e2b85)&&!_0x1ae63d[_0x340ece(0x121)][_0x4e2b85]&&_0x47f55d[_0x340ece(0x12c)](_0x4e2b85);}}const _0x367578=_0x5268c4[_0x340ece(0x140)]===0x0&&_0xc9f0e4[_0x340ece(0x140)]===0x0&&_0x4f7f42[_0x340ece(0x140)]===0x0&&_0x47f55d[_0x340ece(0x140)]===0x0;return{'ok':!![],'data':{'added':_0x5268c4,'modified':_0xc9f0e4,'missing':_0x4f7f42,'unchanged':_0xf000,'remoteOnly':_0x47f55d},'message':_0x367578?_0x340ece(0x122):_0x5268c4['length']+_0x340ece(0x135)+_0xc9f0e4[_0x340ece(0x140)]+_0x340ece(0x123)+_0x4f7f42[_0x340ece(0x140)]+_0x340ece(0x139)+_0xf000[_0x340ece(0x140)]+_0x340ece(0x11f)+(_0x47f55d['length']>0x0?',\x20'+_0x47f55d[_0x340ece(0x140)]+_0x340ece(0x13e):'')};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a167_0x52fad9=a167_0x2b09;(function(_0x3206a9,_0x1c7135){const _0x3c0ac7=a167_0x2b09,_0x228c83=_0x3206a9();while(!![]){try{const _0x3ab25a=parseInt(_0x3c0ac7(0x1f8))/0x1*(parseInt(_0x3c0ac7(0x205))/0x2)+-parseInt(_0x3c0ac7(0x211))/0x3+parseInt(_0x3c0ac7(0x1f0))/0x4+parseInt(_0x3c0ac7(0x1fe))/0x5*(parseInt(_0x3c0ac7(0x215))/0x6)+-parseInt(_0x3c0ac7(0x213))/0x7+parseInt(_0x3c0ac7(0x1fb))/0x8+-parseInt(_0x3c0ac7(0x1fc))/0x9;if(_0x3ab25a===_0x1c7135)break;else _0x228c83['push'](_0x228c83['shift']());}catch(_0x40f37c){_0x228c83['push'](_0x228c83['shift']());}}}(a167_0x3537,0xbe555));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';import{CliErrors}from'../../errors.js';import{assertDatasetIsDbTableBacked,filterDbTableBackedDatasets}from'../../commands/dataset/capability.js';function a167_0x2b09(_0x44380e,_0xcd6e18){_0x44380e=_0x44380e-0x1ea;const _0x353768=a167_0x3537();let _0x2b09aa=_0x353768[_0x44380e];return _0x2b09aa;}function a167_0x3537(){const _0x5a54fb=['size','schemas','Table\x20\x22','tableName','fields','message','string','Inline\x20SQL\x20content\x20to\x20validate\x20(alternative\x20to\x20--file)','\x22\x20not\x20found\x20in\x20any\x20dataset','isSelectOnly','3219260Chcvzb','\x22\x20not\x20found\x20or\x20not\x20accessible','SQL\x20schema\x20validation','Validate\x20SQL\x20content\x20without\x20saving\x20(type\x20detection,\x20parameter\x20extraction,\x20optional\x20schema\x20check)','split','tables','name','toLowerCase','89242SrZOkg','schemaWarnings','validate','5247704HuzxYQ','554877wlAFIj','sqlType','2016110NOiKUn','schema:','validation','str','type','file','Path\x20to\x20the\x20SQL\x20file\x20to\x20validate','18OgGpwv','parameters','filter','push','File\x20not\x20found:\x20','cwd','Provide\x20--file\x20or\x20--sql','utf-8','read','trim','get','appCode','4610595UUfMFW','valid','2023385SpMeIm','reason','6ozzIbg'];a167_0x3537=function(){return _0x5a54fb;};return a167_0x3537();}export const sqlValidate={'service':'sql','command':a167_0x52fad9(0x1fa),'description':a167_0x52fad9(0x1f3),'risk':a167_0x52fad9(0x20d),'flags':[{'name':a167_0x52fad9(0x203),'type':'string','description':a167_0x52fad9(0x204)},{'name':'sql','type':'string','description':a167_0x52fad9(0x1ed)},{'name':'schemas','type':a167_0x52fad9(0x1ec),'description':'Comma-separated\x20dataset\x20codes\x20to\x20cross-check\x20table/column\x20names\x20against'}],async 'execute'(_0x51bc31){const _0x55029e=a167_0x52fad9,_0xde0bf2=_0x51bc31[_0x55029e(0x201)](_0x55029e(0x203)),_0x43e67e=_0x51bc31['str']('sql');if(!_0xde0bf2&&!_0x43e67e)throw CliErrors['flagMissing'](_0x55029e(0x203),_0x55029e(0x20b));let _0xc55c1e;if(_0xde0bf2){const _0x557b99=resolve(process[_0x55029e(0x20a)](),_0xde0bf2);if(!existsSync(_0x557b99))throw CliErrors[_0x55029e(0x200)](_0x55029e(0x209)+_0x557b99);_0xc55c1e=readFileSync(_0x557b99,_0x55029e(0x20c));}else _0xc55c1e=_0x43e67e;const _0x48a947=validateSql(_0xc55c1e),_0x1d626b={'valid':_0x48a947[_0x55029e(0x212)],'sqlType':_0x48a947[_0x55029e(0x1fd)][_0x55029e(0x202)],'isSelectOnly':_0x48a947[_0x55029e(0x1fd)][_0x55029e(0x1ef)],'isDangerous':_0x48a947[_0x55029e(0x1fd)]['isDangerous'],'tables':_0x48a947['tables'],'parameters':_0x48a947[_0x55029e(0x206)],'message':_0x48a947['message']};_0x48a947[_0x55029e(0x1fd)][_0x55029e(0x214)]&&(_0x1d626b[_0x55029e(0x214)]=_0x48a947[_0x55029e(0x1fd)][_0x55029e(0x214)]);const _0x5327ac=_0x51bc31[_0x55029e(0x201)](_0x55029e(0x217));if(_0x5327ac&&_0x48a947[_0x55029e(0x212)]){const _0x2cbb72=_0x5327ac[_0x55029e(0x1f4)](',')['map'](_0x39057c=>_0x39057c[_0x55029e(0x20e)]())[_0x55029e(0x207)](Boolean),_0x416014=[],_0x22cb97=filterDbTableBackedDatasets(await listDatasets(_0x51bc31[_0x55029e(0x210)])),_0x3ac9f4=new Map(_0x22cb97['map'](_0x5aff73=>[_0x5aff73['dbtableConfig']?.[_0x55029e(0x219)]?.[_0x55029e(0x1f7)](),_0x5aff73]));for(const _0x3d5913 of _0x48a947[_0x55029e(0x1f5)]){const _0x554547=_0x3ac9f4[_0x55029e(0x20f)](_0x3d5913[_0x55029e(0x1f7)]());!_0x554547&&_0x416014['push'](_0x55029e(0x218)+_0x3d5913+_0x55029e(0x1ee));}for(const _0xb2a64e of _0x2cbb72){let _0x3f1512;try{_0x3f1512=await getDatasetDetail(_0xb2a64e);}catch{_0x416014[_0x55029e(0x208)]('Dataset\x20\x22'+_0xb2a64e+_0x55029e(0x1f1));continue;}assertDatasetIsDbTableBacked(_0x3f1512,_0x55029e(0x1f2));const _0x417bdf=Array['isArray'](_0x3f1512[_0x55029e(0x1ea)])?_0x3f1512[_0x55029e(0x1ea)]:[],_0x963223=new Set(_0x417bdf['map'](_0x2763ca=>_0x2763ca[_0x55029e(0x1f6)]?.[_0x55029e(0x1f7)]())),_0x27d795=_0x3f1512['dbtableConfig']?.[_0x55029e(0x219)]||_0x3f1512['tableName']||_0xb2a64e;_0x1d626b[_0x55029e(0x1ff)+_0x27d795]={'code':_0xb2a64e,'tableName':_0x27d795,'fieldCount':_0x963223[_0x55029e(0x216)],'fields':Array['from'](_0x963223)};}_0x416014['length']>0x0&&(_0x1d626b[_0x55029e(0x1f9)]=_0x416014);}return{'ok':_0x48a947[_0x55029e(0x212)],'data':_0x1d626b,'message':_0x48a947[_0x55029e(0x1eb)]};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a168_0x26e5c0=a168_0x555d;function a168_0x1277(){const _0x479547=['217920gfodIi','3088224EDaJcv','name','add','6448022XDsjWA','1493652hviFpw','172ZmYlRy','App\x20profile\x20name','126aZxlri','1667505CcRrSp','workspace','48XsHGzL','2812ReIwUO','2517nggMwC'];a168_0x1277=function(){return _0x479547;};return a168_0x1277();}(function(_0xd6f9a4,_0x1cf186){const _0x38b5ac=a168_0x555d,_0x4b8ea7=_0xd6f9a4();while(!![]){try{const _0xbf1395=-parseInt(_0x38b5ac(0x7a))/0x1*(-parseInt(_0x38b5ac(0x72))/0x2)+-parseInt(_0x38b5ac(0x73))/0x3*(-parseInt(_0x38b5ac(0x71))/0x4)+-parseInt(_0x38b5ac(0x6f))/0x5+-parseInt(_0x38b5ac(0x79))/0x6+parseInt(_0x38b5ac(0x78))/0x7+-parseInt(_0x38b5ac(0x75))/0x8+-parseInt(_0x38b5ac(0x6e))/0x9*(-parseInt(_0x38b5ac(0x74))/0xa);if(_0xbf1395===_0x1cf186)break;else _0x4b8ea7['push'](_0x4b8ea7['shift']());}catch(_0x54b76f){_0x4b8ea7['push'](_0x4b8ea7['shift']());}}}(a168_0x1277,0x7c6df));import{buildAppAddFlags,runAppAdd,validateAppName}from'../../commands/common/app-registry.js';function a168_0x555d(_0x2853e3,_0x18cd40){_0x2853e3=_0x2853e3-0x6e;const _0x1277f1=a168_0x1277();let _0x555d79=_0x1277f1[_0x2853e3];return _0x555d79;}export const workspaceAddDefinition={'service':a168_0x26e5c0(0x70),'command':a168_0x26e5c0(0x77),'description':'Register\x20an\x20app\x20profile\x20in\x20the\x20current\x20workspace\x20(or\x20--global)','risk':'write','requiresAuth':![],'requiresAppCode':![],'args':[{'name':a168_0x26e5c0(0x76),'description':a168_0x26e5c0(0x7b),'required':!![]}],'flags':buildAppAddFlags(),'validate':_0x500a51=>validateAppName(_0x500a51,'workspace\x20add'),'execute':_0x1d5375=>runAppAdd(_0x1d5375,'workspace\x20add')};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a169_0x438b67=a169_0x4577;(function(_0x525f91,_0x38f1d4){const _0x2591c7=a169_0x4577,_0x2c89a9=_0x525f91();while(!![]){try{const _0x3db81d=parseInt(_0x2591c7(0x1e1))/0x1+parseInt(_0x2591c7(0x1fe))/0x2*(-parseInt(_0x2591c7(0x1ec))/0x3)+-parseInt(_0x2591c7(0x204))/0x4+parseInt(_0x2591c7(0x1e4))/0x5+-parseInt(_0x2591c7(0x1f6))/0x6*(-parseInt(_0x2591c7(0x1db))/0x7)+parseInt(_0x2591c7(0x205))/0x8+-parseInt(_0x2591c7(0x1da))/0x9*(parseInt(_0x2591c7(0x1e5))/0xa);if(_0x3db81d===_0x38f1d4)break;else _0x2c89a9['push'](_0x2c89a9['shift']());}catch(_0x2461e6){_0x2c89a9['push'](_0x2c89a9['shift']());}}}(a169_0x2a6e,0x8b053));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';function a169_0x4577(_0x3876b1,_0x59b34e){_0x3876b1=_0x3876b1-0x1d2;const _0x2a6ef1=a169_0x2a6e();let _0x45772a=_0x2a6ef1[_0x3876b1];return _0x45772a;}import{workspaceAddDefinition}from'../../commands/workspace/add.js';import{workspaceRemoveDefinition}from'../../commands/workspace/remove.js';const WORKSPACE_USAGE=CLI_BIN_NAME+a169_0x438b67(0x1ee),SAFE_PROFILE_KEYS=[a169_0x438b67(0x1ed),'env',a169_0x438b67(0x1d7),'format','pageSize',a169_0x438b67(0x1f4),a169_0x438b67(0x1fb)],workspaceFlags=[{'name':a169_0x438b67(0x1d9),'type':a169_0x438b67(0x1d3),'description':'App\x20profile\x20name\x20to\x20use\x20in\x20this\x20workspace'},{'name':a169_0x438b67(0x1ed),'type':a169_0x438b67(0x1d3),'description':a169_0x438b67(0x1eb)},{'name':a169_0x438b67(0x1d2),'type':a169_0x438b67(0x1d3),'description':'Target\x20environment','enum':[...RABETBASE_ENV_VALUES]},{'name':a169_0x438b67(0x1d7),'type':a169_0x438b67(0x1d3),'description':a169_0x438b67(0x1e2)},{'name':a169_0x438b67(0x1d8),'type':a169_0x438b67(0x1d3),'description':a169_0x438b67(0x1f9),'enum':[...RABETBASE_OUTPUT_FORMAT_VALUES]},{'name':a169_0x438b67(0x200),'type':a169_0x438b67(0x1f3),'description':a169_0x438b67(0x1e7)},{'name':a169_0x438b67(0x1f4),'type':a169_0x438b67(0x1d3),'description':a169_0x438b67(0x1fc),'enum':[...RISK_LEVEL_VALUES]},{'name':a169_0x438b67(0x1fb),'type':'string','description':a169_0x438b67(0x1e0)}];function a169_0x2a6e(){const _0x69e28e=['apiDir','defaultFormat','app','9EfJQbJ','674009HvEfCo','\x20workspace\x20','apps','workspace','join','Locale\x20for\x20this\x20workspace\x20app\x20profile','648043yWdmEG','API\x20directory\x20path\x20for\x20this\x20workspace\x20app\x20profile','\x20--app\x20','3466595xkUFHB','9707230mqjgwv','\x20--appcode\x20<code>`.','Default\x20page\x20size\x20for\x20this\x20workspace\x20app\x20profile','trim','use','project','App\x20code\x20to\x20bind\x20to\x20this\x20workspace','57GfUxIL','appcode','\x20workspace\x20<init|use>\x20--app\x20<name>\x20[--appcode\x20<code>]','length','Invalid\x20appcode:\x20','Use\x20`','\x22\x20not\x20found.','number','riskLevel','validation','42lMikgj','flag','workspace.','Default\x20output\x20format\x20for\x20this\x20workspace\x20app\x20profile','defaultApp','locale','Risk\x20level\x20for\x20this\x20workspace\x20app\x20profile','initialized','30362ShFmrv','object','pageSize','updated','Pass\x20--appcode\x20<code>,\x20or\x20choose\x20one\x20of:\x20',').\x20Config:\x20','1058548UDjupS','622840SLmkNe','Workspace\x20','isArray','write','init','App\x20\x22','env','string','globalConfig','\x20workspace\x20init\x20--appcode\x20<code>`\x20or\x20`','str'];a169_0x2a6e=function(){return _0x69e28e;};return a169_0x2a6e();}function isRecord(_0xdf634a){const _0xe44b79=a169_0x438b67;return!!_0xdf634a&&typeof _0xdf634a===_0xe44b79(0x1ff)&&!Array[_0xe44b79(0x207)](_0xdf634a);}function assertValidAppcode(_0x1e5304){const _0x291ae6=a169_0x438b67,{valid:_0x1aa9aa,message:_0x4ecc02}=validateAppcode(_0x1e5304);if(!_0x1aa9aa)throw CliErrors[_0x291ae6(0x1f5)](_0x291ae6(0x1f0)+_0x1e5304,_0x4ecc02);}function sanitizeProfile(_0x2b340d){if(!isRecord(_0x2b340d))return{};const _0x4a6a37={};for(const _0x49ee77 of SAFE_PROFILE_KEYS){if(_0x2b340d[_0x49ee77]!==undefined)_0x4a6a37[_0x49ee77]=_0x2b340d[_0x49ee77];}return _0x4a6a37;}function cloneProfile(_0x32f4ac){return isRecord(_0x32f4ac)?{..._0x32f4ac}:{};}function collectWorkspaceProfileOverrides(_0x58307){const _0x2cc8da=a169_0x438b67,_0x17fd95={},_0x585d2e=_0x58307[_0x2cc8da(0x1d6)](_0x2cc8da(0x1d2)),_0x480c0f=_0x58307['str'](_0x2cc8da(0x1d7)),_0x4e5f0c=_0x58307[_0x2cc8da(0x1d6)]('defaultFormat'),_0x1cff13=_0x58307[_0x2cc8da(0x1f7)](_0x2cc8da(0x200)),_0x5c7e4c=_0x58307[_0x2cc8da(0x1d6)](_0x2cc8da(0x1f4)),_0xdd69b5=_0x58307[_0x2cc8da(0x1d6)]('locale');if(_0x585d2e)_0x17fd95[_0x2cc8da(0x1d2)]=_0x585d2e;if(_0x480c0f)_0x17fd95[_0x2cc8da(0x1d7)]=_0x480c0f;if(_0x4e5f0c)_0x17fd95['format']=_0x4e5f0c;if(_0x1cff13!==undefined&&_0x1cff13!=='')_0x17fd95[_0x2cc8da(0x200)]=Number(_0x1cff13);if(_0x5c7e4c)_0x17fd95[_0x2cc8da(0x1f4)]=_0x5c7e4c;if(_0xdd69b5)_0x17fd95[_0x2cc8da(0x1fb)]=_0xdd69b5;return _0x17fd95;}async function validateWorkspaceArgs(_0x58e0c8){const _0x2732b2=a169_0x438b67,_0x181f15=_0x58e0c8[_0x2732b2(0x1d6)](_0x2732b2(0x1d9))[_0x2732b2(0x1e8)](),_0x279852=_0x58e0c8['str'](_0x2732b2(0x1ed))[_0x2732b2(0x1e8)]();if(!_0x181f15&&!_0x279852)throw CliErrors[_0x2732b2(0x1f5)]('Missing\x20workspace\x20app\x20selector.',_0x2732b2(0x1f1)+CLI_BIN_NAME+_0x2732b2(0x1d5)+CLI_BIN_NAME+'\x20workspace\x20use\x20--app\x20<name>`.');if(_0x279852)assertValidAppcode(_0x279852);}function resolveKnownApps(){const _0x836fd3=a169_0x438b67,{config:_0x2bf8c1,layers:_0x2cfe67}=readRawConfigWithLayers(),_0x19b24b=isRecord(_0x2bf8c1[_0x836fd3(0x1dd)])?_0x2bf8c1['apps']:{},_0x5b2465=isRecord(_0x2cfe67[_0x836fd3(0x1d4)][_0x836fd3(0x1dd)])?_0x2cfe67[_0x836fd3(0x1d4)][_0x836fd3(0x1dd)]:{};return{..._0x5b2465,..._0x19b24b};}async function configureWorkspace(_0x5d6d03,_0x4cc542){const _0x20c26d=a169_0x438b67,_0x1bd776=_0x5d6d03[_0x20c26d(0x1d6)](_0x20c26d(0x1d9))[_0x20c26d(0x1e8)](),_0xf5a014=_0x5d6d03['str']('appcode')['trim'](),_0x3b44e9=_0x1bd776||_0xf5a014;if(!_0x3b44e9)throw CliErrors[_0x20c26d(0x1f5)]('Missing\x20workspace\x20app\x20selector.',_0x20c26d(0x1f1)+CLI_BIN_NAME+'\x20workspace\x20init\x20--appcode\x20<code>`\x20or\x20`'+CLI_BIN_NAME+'\x20workspace\x20use\x20--app\x20<name>`.');if(_0xf5a014)assertValidAppcode(_0xf5a014);const _0x5dffeb=resolveWriteConfigPath(_0x20c26d(0x1ea)),_0x29ad86=readConfigFile(_0x5dffeb),_0x1a5cc6=resolveKnownApps(),_0x29f37d=isRecord(_0x29ad86['apps'])?{..._0x29ad86[_0x20c26d(0x1dd)]}:{},_0x15d2c1=cloneProfile(_0x29f37d[_0x3b44e9]),_0xf34397=sanitizeProfile(_0x1a5cc6[_0x3b44e9]),_0x20bc4c=_0xf5a014?{}:_0xf34397,_0x20cb16=_0xf5a014||_0x20bc4c['appcode'];if(!_0x20cb16){const _0x582870=Object['keys'](_0x1a5cc6),_0x1237a9=_0x582870[_0x20c26d(0x1ef)]===0x0?_0x20c26d(0x1f1)+CLI_BIN_NAME+_0x20c26d(0x1dc)+_0x4cc542+_0x20c26d(0x1e3)+_0x3b44e9+_0x20c26d(0x1e6):_0x20c26d(0x202)+_0x582870[_0x20c26d(0x1df)](',\x20');throw CliErrors[_0x20c26d(0x1f5)](_0x20c26d(0x20a)+_0x3b44e9+_0x20c26d(0x1f2),_0x1237a9);}assertValidAppcode(String(_0x20cb16));const _0x2a9a89={..._0x20bc4c,..._0x15d2c1,'appcode':String(_0x20cb16),...collectWorkspaceProfileOverrides(_0x5d6d03)};return _0x29f37d[_0x3b44e9]=_0x2a9a89,_0x29ad86[_0x20c26d(0x1dd)]=_0x29f37d,_0x29ad86[_0x20c26d(0x1fa)]=_0x3b44e9,delete _0x29ad86[_0x20c26d(0x1ed)],delete _0x29ad86['app'],_0x2a9a89[_0x20c26d(0x1d2)]&&(_0x29ad86['env']=_0x2a9a89[_0x20c26d(0x1d2)]),writeConfigFile(_0x5dffeb,_0x29ad86),{'ok':!![],'message':_0x20c26d(0x206)+(_0x4cc542==='init'?_0x20c26d(0x1fd):_0x20c26d(0x201))+':\x20'+_0x3b44e9+'\x20(appcode:\x20'+_0x2a9a89[_0x20c26d(0x1ed)]+_0x20c26d(0x203)+_0x5dffeb+'.\x20Credentials:\x20not\x20written.','data':{'operation':_0x20c26d(0x1f8)+_0x4cc542,'configPath':_0x5dffeb,'app':_0x3b44e9,'appcode':_0x2a9a89[_0x20c26d(0x1ed)],'env':_0x2a9a89['env']??null,'credentialsWritten':![]}};}const workspaceInitDefinition={'service':a169_0x438b67(0x1de),'command':a169_0x438b67(0x209),'description':'Initialize\x20the\x20current\x20workspace\x20app\x20binding','risk':a169_0x438b67(0x208),'requiresAuth':![],'requiresAppCode':![],'args':[],'flags':workspaceFlags,'validate':validateWorkspaceArgs,'execute':_0x367a8e=>configureWorkspace(_0x367a8e,'init')},workspaceUseDefinition={'service':a169_0x438b67(0x1de),'command':a169_0x438b67(0x1e9),'description':'Switch\x20the\x20current\x20workspace\x20app\x20binding','risk':a169_0x438b67(0x208),'requiresAuth':![],'requiresAppCode':![],'args':[],'flags':workspaceFlags,'validate':validateWorkspaceArgs,'execute':_0x3a60a4=>configureWorkspace(_0x3a60a4,'use')};export const workspaceDefinitions=[workspaceInitDefinition,workspaceUseDefinition,workspaceAddDefinition,workspaceRemoveDefinition];export{WORKSPACE_USAGE};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a170_0x6b0fac=a170_0x3810;(function(_0x2e8cb6,_0xcd9539){const _0x363447=a170_0x3810,_0x58b3ec=_0x2e8cb6();while(!![]){try{const _0x378efe=parseInt(_0x363447(0x1c5))/0x1*(parseInt(_0x363447(0x1c2))/0x2)+-parseInt(_0x363447(0x1c9))/0x3+-parseInt(_0x363447(0x1bd))/0x4*(-parseInt(_0x363447(0x1c8))/0x5)+parseInt(_0x363447(0x1bf))/0x6*(parseInt(_0x363447(0x1cb))/0x7)+parseInt(_0x363447(0x1cc))/0x8*(-parseInt(_0x363447(0x1c0))/0x9)+parseInt(_0x363447(0x1c6))/0xa+-parseInt(_0x363447(0x1c1))/0xb*(parseInt(_0x363447(0x1ca))/0xc);if(_0x378efe===_0xcd9539)break;else _0x58b3ec['push'](_0x58b3ec['shift']());}catch(_0x314f5a){_0x58b3ec['push'](_0x58b3ec['shift']());}}}(a170_0x4ba2,0x56060));function a170_0x3810(_0x28cd89,_0x32a8eb){_0x28cd89=_0x28cd89-0x1bd;const _0x4ba2ba=a170_0x4ba2();let _0x38101f=_0x4ba2ba[_0x28cd89];return _0x38101f;}import{buildAppRemoveFlags,runAppRemove,validateAppName}from'../../commands/common/app-registry.js';export const workspaceRemoveDefinition={'service':'workspace','command':a170_0x6b0fac(0x1c3),'description':a170_0x6b0fac(0x1cd),'risk':'high-risk-write','requiresAuth':![],'requiresAppCode':![],'args':[{'name':a170_0x6b0fac(0x1c7),'description':a170_0x6b0fac(0x1c4),'required':!![]}],'flags':buildAppRemoveFlags(),'validate':_0xe9b651=>validateAppName(_0xe9b651,a170_0x6b0fac(0x1be)),'execute':_0x591a4d=>runAppRemove(_0x591a4d,'workspace\x20remove')};function a170_0x4ba2(){const _0xa85481=['90752ZjUyja','workspace\x20remove','120702gVxcEj','9YfaUXZ','46079QbMLro','3788zMcask','remove','App\x20profile\x20name\x20to\x20remove','277gGyveE','3376860VQowUg','name','5slLzfj','128961IfxFXM','1104OUirwz','154JknHhf','4374872iUMrci','Remove\x20an\x20app\x20profile\x20from\x20the\x20current\x20workspace\x20(or\x20--global)'];a170_0x4ba2=function(){return _0xa85481;};return a170_0x4ba2();}
|
package/lib/config/schema.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a171_0x504a(){const _0x1a5728=['apps','pageSize','defaultApp','zh-CN','620340vIRcHn','Default\x20output\x20format\x20for\x20this\x20app\x20(profile)','join','3413259vJiAqH','10jLpYYP','keys','110atQnlP','en-US','accessKey','locale','Target\x20environment','env','API\x20directory\x20path','appcode','6315fpNYMi','813700xhCajS','number','format','410080lfACoX','12WVeYKg','length','apiDir','string','riskLevel','Access\x20key','Risk\x20level','cookie','Default\x20page\x20size','app','Config\x20key\x20(','entries','44101OyKFPT','toLowerCase','772USjDRd','1069265pODKBk','inherit','trim','has'];a171_0x504a=function(){return _0x1a5728;};return a171_0x504a();}const a171_0x5291a8=a171_0xb38e;(function(_0x2e88d8,_0x5a8f8c){const _0x3f42c5=a171_0xb38e,_0x4c7342=_0x2e88d8();while(!![]){try{const _0x4a3224=parseInt(_0x3f42c5(0x1eb))/0x1*(parseInt(_0x3f42c5(0x1d0))/0x2)+-parseInt(_0x3f42c5(0x1da))/0x3*(parseInt(_0x3f42c5(0x1ed))/0x4)+-parseInt(_0x3f42c5(0x1ee))/0x5+parseInt(_0x3f42c5(0x1df))/0x6*(parseInt(_0x3f42c5(0x1cc))/0x7)+parseInt(_0x3f42c5(0x1de))/0x8+-parseInt(_0x3f42c5(0x1cf))/0x9+-parseInt(_0x3f42c5(0x1db))/0xa*(-parseInt(_0x3f42c5(0x1d2))/0xb);if(_0x4a3224===_0x5a8f8c)break;else _0x4c7342['push'](_0x4c7342['shift']());}catch(_0x289133){_0x4c7342['push'](_0x4c7342['shift']());}}}(a171_0x504a,0x404a8));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_0x5291a8(0x1e6),a171_0x5291a8(0x1d4),a171_0x5291a8(0x1d5),a171_0x5291a8(0x1dd),'riskLevel'];export const TOP_LEVEL_CONFIG_KEYS=new Set([a171_0x5291a8(0x1d9),a171_0x5291a8(0x1d7),a171_0x5291a8(0x1d5),'format',a171_0x5291a8(0x1e6),a171_0x5291a8(0x1d4),a171_0x5291a8(0x1e1)]);function a171_0xb38e(_0x57d89f,_0x38056f){_0x57d89f=_0x57d89f-0x1c5;const _0x504aa7=a171_0x504a();let _0xb38ed9=_0x504aa7[_0x57d89f];return _0xb38ed9;}export const CONFIG_ENUM_VALUES={'env':[...RABETBASE_ENV_VALUES],'format':[...RABETBASE_OUTPUT_FORMAT_VALUES]};export function formatConfigKeyList(_0x5d324c){const _0x18a0ff=a171_0x5291a8;return[..._0x5d324c][_0x18a0ff(0x1ce)](',\x20');}export function getTopLevelConfigKeyList(){return[...TOP_LEVEL_CONFIG_KEYS];}export function isTopLevelConfigKey(_0x51a0c5){const _0x2a3970=a171_0x5291a8;return TOP_LEVEL_CONFIG_KEYS[_0x2a3970(0x1c7)](_0x51a0c5);}export function getTopLevelConfigKeySummary(){return formatConfigKeyList(getTopLevelConfigKeyList());}export function getConfigCommandKeyDescription(){const _0x311014=a171_0x5291a8;return _0x311014(0x1e9)+getTopLevelConfigKeySummary()+')';}export const APP_PROFILE_FLAG_KEY_MAP={'env':'env','apiDir':a171_0x5291a8(0x1e1),'cookie':a171_0x5291a8(0x1e6),'accessKey':a171_0x5291a8(0x1d4),'defaultFormat':'format','pageSize':a171_0x5291a8(0x1c9),'riskLevel':'riskLevel','locale':a171_0x5291a8(0x1d5)};export function getAppProfileFlagDefs(){const _0x1a1ce9=a171_0x5291a8;return[{'name':_0x1a1ce9(0x1d7),'type':_0x1a1ce9(0x1e2),'description':_0x1a1ce9(0x1d6),'enum':[...RABETBASE_ENV_VALUES]},{'name':_0x1a1ce9(0x1e1),'type':_0x1a1ce9(0x1e2),'description':_0x1a1ce9(0x1d8)},{'name':_0x1a1ce9(0x1e6),'type':_0x1a1ce9(0x1e2),'description':'Auth\x20cookie','hidden':!![]},{'name':_0x1a1ce9(0x1d4),'type':_0x1a1ce9(0x1e2),'description':_0x1a1ce9(0x1e4),'hidden':!![]},{'name':'defaultFormat','type':_0x1a1ce9(0x1e2),'description':_0x1a1ce9(0x1cd),'enum':[...RABETBASE_OUTPUT_FORMAT_VALUES]},{'name':_0x1a1ce9(0x1c9),'type':_0x1a1ce9(0x1dc),'description':_0x1a1ce9(0x1e7)},{'name':_0x1a1ce9(0x1e3),'type':_0x1a1ce9(0x1e2),'description':_0x1a1ce9(0x1e5),'enum':[...RISK_LEVEL_VALUES]},{'name':_0x1a1ce9(0x1d5),'type':'string','description':'Locale'}];}export function collectAppProfileOverrides(_0x2b2e53){const _0x142ce0=a171_0x5291a8,_0x171c2b={};for(const [_0x1fd998,_0x435944]of Object[_0x142ce0(0x1ea)](APP_PROFILE_FLAG_KEY_MAP)){const _0x1ecfc6=_0x2b2e53(_0x1fd998);if(!_0x1ecfc6)continue;_0x171c2b[_0x435944]=_0x435944===_0x142ce0(0x1c9)?Number(_0x1ecfc6):_0x1ecfc6;}return _0x171c2b;}export function buildAppProfileListFields(_0x777901){const _0x324f1b=a171_0x5291a8;return{'env':_0x777901[_0x324f1b(0x1d7)]??null,'apiDir':_0x777901[_0x324f1b(0x1e1)]??null,'hasCookie':!!_0x777901['cookie'],'hasAccessKey':!!_0x777901[_0x324f1b(0x1d4)],'format':_0x777901[_0x324f1b(0x1dd)]??null,'pageSize':_0x777901[_0x324f1b(0x1c9)]??null,'riskLevel':_0x777901['riskLevel']??null,'locale':_0x777901[_0x324f1b(0x1d5)]??null};}export function buildAppDoctorFields(_0x32882f,_0xcee1a){const _0x346149=a171_0x5291a8;return{'env':{'value':_0x32882f[_0x346149(0x1d7)]||_0xcee1a['env'],'source':_0x32882f[_0x346149(0x1d7)]?_0x346149(0x1e8):'inherit'},'apiDir':{'value':_0x32882f[_0x346149(0x1e1)]||_0xcee1a['apiDir'],'source':_0x32882f[_0x346149(0x1e1)]?_0x346149(0x1e8):_0x346149(0x1c5)},'cookie':{'value':_0x32882f[_0x346149(0x1e6)]||_0xcee1a[_0x346149(0x1e6)],'source':_0x32882f[_0x346149(0x1e6)]?_0x346149(0x1e8):_0x346149(0x1c5)},'accessKey':{'value':_0x32882f[_0x346149(0x1d4)]||_0xcee1a[_0x346149(0x1d4)],'source':_0x32882f[_0x346149(0x1d4)]?_0x346149(0x1e8):_0x346149(0x1c5)}};}export function buildCanonicalAppConfig(_0x4c33ab,_0xdd7c31){const _0x1ea51b=a171_0x5291a8,_0x3b1dae=_0x4c33ab['map'](_0x34bb39=>String(_0x34bb39||'')[_0x1ea51b(0x1c6)]())['filter'](Boolean);if(_0x3b1dae['length']===0x0)return{};const _0x5722db={};for(const _0xed4c8e of _0x3b1dae){_0x5722db[_0xed4c8e]=_0xdd7c31?{'appcode':_0xed4c8e,'env':_0xdd7c31}:{'appcode':_0xed4c8e};}return{'apps':_0x5722db,'defaultApp':_0x3b1dae[0x0]};}export function buildCanonicalProjectConfig(_0x396299,_0x59b338){const _0x4d1d75=a171_0x5291a8,{appCodes:appCodes=[],env:_0x56b6c0,metadata:_0x4b9003}=_0x59b338,_0x4e6b15={..._0x396299,..._0x4b9003||{}};delete _0x4e6b15[_0x4d1d75(0x1d9)],delete _0x4e6b15[_0x4d1d75(0x1e8)];if(_0x56b6c0)_0x4e6b15[_0x4d1d75(0x1d7)]=_0x56b6c0;else!_0x4e6b15[_0x4d1d75(0x1d7)]&&(_0x4e6b15[_0x4d1d75(0x1d7)]=DEFAULT_CONFIG_VALUES[_0x4d1d75(0x1d7)]);const _0x5388ff=buildCanonicalAppConfig(appCodes,_0x4e6b15[_0x4d1d75(0x1d7)]);return Object[_0x4d1d75(0x1d1)](_0x5388ff)[_0x4d1d75(0x1e0)]>0x0&&(_0x4e6b15[_0x4d1d75(0x1c8)]=_0x5388ff['apps'],_0x4e6b15[_0x4d1d75(0x1ca)]=_0x5388ff['defaultApp']),_0x4e6b15;}const LOCALE_MAP={'zh':'zh-CN','zh-cn':a171_0x5291a8(0x1cb),'zh_cn':'zh-CN','en':a171_0x5291a8(0x1d3),'en-us':a171_0x5291a8(0x1d3),'en_us':a171_0x5291a8(0x1d3)};export function normalizeLocale(_0x5d96eb){const _0x530a1a=a171_0x5291a8;if(!_0x5d96eb)return null;return LOCALE_MAP[_0x5d96eb[_0x530a1a(0x1ec)]()]??null;}
|
package/lib/constant/cdn.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a172_0x5dd23c=a172_0x7964;(function(_0x5b07f4,_0x35611f){const _0x2ed1b3=a172_0x7964,_0x2441ab=_0x5b07f4();while(!![]){try{const _0x1622f7=-parseInt(_0x2ed1b3(0x14e))/0x1+-parseInt(_0x2ed1b3(0x150))/0x2*(-parseInt(_0x2ed1b3(0x14a))/0x3)+-parseInt(_0x2ed1b3(0x14f))/0x4*(parseInt(_0x2ed1b3(0x152))/0x5)+-parseInt(_0x2ed1b3(0x14c))/0x6+-parseInt(_0x2ed1b3(0x14b))/0x7*(parseInt(_0x2ed1b3(0x148))/0x8)+-parseInt(_0x2ed1b3(0x14d))/0x9*(-parseInt(_0x2ed1b3(0x149))/0xa)+parseInt(_0x2ed1b3(0x153))/0xb;if(_0x1622f7===_0x35611f)break;else _0x2441ab['push'](_0x2441ab['shift']());}catch(_0x2eb1d8){_0x2441ab['push'](_0x2441ab['shift']());}}}(a172_0x2c99,0x943fb));export const CLI_VERSION_POLICY_URL=a172_0x5dd23c(0x151);function a172_0x7964(_0x14fa1b,_0x540984){_0x14fa1b=_0x14fa1b-0x148;const _0x2c9959=a172_0x2c99();let _0x79646d=_0x2c9959[_0x14fa1b];return _0x79646d;}function a172_0x2c99(){const _0x4cc3a1=['280ukufZC','3JbphAX','7cBjiUT','2814978bXIVyv','68454lBbede','688894BKXHVd','140872yjviXc','1133548SvcbIL','https://g.lovrabet.com/dist/rabetbase-cli/config/index.json','95YTgbTb','30565557kZDuKl','8992024TBhqhI'];a172_0x2c99=function(){return _0x4cc3a1;};return a172_0x2c99();}
|