@lovrabet/rabetbase-cli 2.3.7-beta.1 → 2.3.7-beta.2
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 -0
- package/lib/commands/db/analyze-batch-plan.js +1 -0
- package/lib/commands/db/analyze-cancel.js +1 -1
- package/lib/commands/db/analyze-start.js +1 -1
- package/lib/commands/db/analyze-status.js +1 -1
- package/lib/commands/db/create.js +1 -1
- package/lib/commands/db/delete.js +1 -1
- package/lib/commands/db/detail.js +1 -1
- package/lib/commands/db/diff.js +1 -1
- package/lib/commands/db/index.js +1 -1
- package/lib/commands/db/list.js +1 -1
- package/lib/commands/db/shared.js +1 -1
- package/lib/commands/db/tables.js +1 -1
- package/lib/commands/db/test.js +1 -1
- package/lib/commands/db/update.js +1 -1
- package/lib/commands/doctor.js +1 -1
- package/lib/commands/file/index.js +1 -1
- package/lib/commands/init/index.js +1 -1
- package/lib/commands/issue/index.js +1 -1
- package/lib/commands/issue/nudge.js +1 -1
- package/lib/commands/issue/report.js +1 -1
- package/lib/commands/issue/shared.js +1 -1
- package/lib/commands/logs/index.js +1 -1
- package/lib/commands/menu/index.js +1 -1
- package/lib/commands/menu/list.js +1 -1
- package/lib/commands/menu/shared/compare-table.js +1 -1
- package/lib/commands/menu/shared/index.js +1 -1
- package/lib/commands/menu/shared/inquirer.js +1 -1
- package/lib/commands/menu/shared/local-pages.js +1 -1
- package/lib/commands/menu/shared/logic.js +1 -1
- package/lib/commands/menu/shared/service.js +1 -1
- package/lib/commands/menu/shared/sync-core.js +1 -1
- package/lib/commands/menu/shared/update-core.js +1 -1
- package/lib/commands/menu/shared/valid-url.js +1 -1
- package/lib/commands/menu/sync.js +1 -1
- package/lib/commands/menu/update.js +1 -1
- package/lib/commands/page/generate-start.js +1 -1
- package/lib/commands/page/generate-status.js +1 -1
- package/lib/commands/page/index.js +1 -1
- package/lib/commands/page/pull.js +1 -1
- package/lib/commands/page/push.js +1 -1
- package/lib/commands/page/relation-audit.js +1 -1
- package/lib/commands/page/shared.js +1 -1
- package/lib/commands/page/standard-page-status.js +1 -1
- package/lib/commands/page/sync.js +1 -1
- package/lib/commands/permit/index.js +1 -1
- package/lib/commands/permit/page-get.js +1 -1
- package/lib/commands/permit/page-set.js +1 -1
- package/lib/commands/permit/role-apis-set.js +1 -1
- package/lib/commands/permit/role-menus-set.js +1 -1
- package/lib/commands/permit/role-menus.js +1 -1
- package/lib/commands/permit/shared.js +1 -1
- package/lib/commands/project/create/enhanced-guided-create.js +1 -1
- package/lib/commands/project/create/format-elapsed.js +1 -1
- package/lib/commands/project/create/main.js +1 -1
- package/lib/commands/project/create/non-interactive.js +1 -1
- package/lib/commands/project/create/project-template-path.js +1 -1
- package/lib/commands/project/create/use-copy-project-template.js +1 -1
- package/lib/commands/project/create/use-format-code.js +1 -1
- package/lib/commands/project/create/use-install-dependencies.js +1 -1
- package/lib/commands/project/index.js +1 -1
- package/lib/commands/project/init.js +1 -1
- package/lib/commands/project/upgrade.js +1 -1
- package/lib/commands/registry.js +1 -1
- package/lib/commands/role/create.js +1 -1
- package/lib/commands/role/delete.js +1 -1
- package/lib/commands/role/detail.js +1 -1
- package/lib/commands/role/index.js +1 -1
- package/lib/commands/role/list.js +1 -1
- package/lib/commands/role/shared.js +1 -1
- package/lib/commands/role/update.js +1 -1
- package/lib/commands/role/user-add.js +1 -1
- package/lib/commands/role/user-remove.js +1 -1
- package/lib/commands/role/user-resolve.js +1 -1
- package/lib/commands/run/index.js +1 -1
- package/lib/commands/schema.js +1 -1
- package/lib/commands/sql/create.js +1 -1
- package/lib/commands/sql/delete.js +1 -1
- package/lib/commands/sql/detail.js +1 -1
- package/lib/commands/sql/exec.js +1 -1
- package/lib/commands/sql/index.js +1 -1
- package/lib/commands/sql/list.js +1 -1
- package/lib/commands/sql/pull.js +1 -1
- package/lib/commands/sql/push.js +1 -1
- package/lib/commands/sql/save.js +1 -1
- package/lib/commands/sql/shared.js +1 -1
- package/lib/commands/sql/status.js +1 -1
- package/lib/commands/sql/validate.js +1 -1
- package/lib/commands/workspace/add.js +1 -1
- package/lib/commands/workspace/index.js +1 -1
- package/lib/commands/workspace/remove.js +1 -1
- package/lib/config/schema.js +1 -1
- package/lib/constant/cdn.js +1 -1
- package/lib/constant/cli.js +1 -1
- package/lib/constant/defaults.js +1 -1
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/constant/output.js +1 -1
- package/lib/constant/paths.js +1 -1
- package/lib/constant/risk.js +1 -1
- package/lib/context/app-resolver.js +1 -1
- package/lib/context/auth-resolver.js +1 -1
- package/lib/context/config-loader.js +1 -1
- package/lib/context.js +1 -1
- package/lib/core/alias-resolver.js +1 -1
- package/lib/core/api-client.js +1 -1
- package/lib/core/bff/config.js +1 -1
- package/lib/core/bff/file-system.js +1 -1
- package/lib/core/bff/hash.js +1 -1
- package/lib/core/bff/lock.js +1 -1
- package/lib/core/bff/utils.js +1 -1
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/page/file-system.js +1 -1
- package/lib/core/page/hash.js +1 -1
- package/lib/core/page/lock.js +1 -1
- package/lib/core/sql-sync/config.js +1 -1
- package/lib/core/sql-sync/file-system.js +1 -1
- package/lib/core/sql-sync/hash.js +1 -1
- package/lib/core/sql-sync/lock.js +1 -1
- package/lib/core/sql-sync/utils.js +1 -1
- package/lib/core/sql-validator.js +1 -1
- package/lib/errors.js +1 -1
- package/lib/framework/build-all-flags.js +1 -1
- package/lib/framework/flags.js +1 -1
- package/lib/framework/help.js +1 -1
- package/lib/framework/index.js +1 -1
- package/lib/framework/output.js +1 -1
- package/lib/framework/response.js +1 -1
- package/lib/framework/runner-alias.js +1 -1
- package/lib/framework/runner.js +1 -1
- package/lib/framework/schema-export.js +1 -1
- package/lib/framework/types.js +1 -1
- package/lib/generated/build-info.js +1 -1
- package/lib/help.js +1 -1
- package/lib/skills/main.js +1 -1
- package/lib/skills/npx-skills-add.js +1 -1
- package/lib/telemetry/cli-command-trace.js +1 -1
- package/lib/telemetry/cli-help-trace.js +1 -1
- package/lib/telemetry/ensure-cli-otel-config.js +1 -1
- package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
- package/lib/telemetry/send-cli-trace-log.js +1 -1
- package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
- package/lib/utils/ai_config.js +1 -1
- package/lib/utils/apply-jq-filter.js +1 -1
- package/lib/utils/cdn-config.js +1 -1
- package/lib/utils/check-sdk-version.js +1 -1
- package/lib/utils/cli-version-check.js +1 -1
- package/lib/utils/cli-version-policy.js +1 -1
- package/lib/utils/config.js +1 -1
- package/lib/utils/copy-directory.js +1 -1
- package/lib/utils/entity-with-id.js +1 -1
- package/lib/utils/file-utils.js +1 -1
- package/lib/utils/guides-cdn.js +1 -1
- package/lib/utils/http-client.js +1 -1
- package/lib/utils/is-non-interactive.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/params.js +1 -1
- package/lib/utils/platform.js +1 -1
- package/lib/utils/rules-cdn.js +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.js +1 -1
- package/lib/utils/update-notice.js +1 -1
- package/lib/utils/version.js +1 -1
- package/lib/utils/with-active-cookie.js +1 -1
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a156_0x2d077b=a156_0x3bc0;(function(_0x258b42,_0x2e5b48){const _0x465328=a156_0x3bc0,_0x253287=_0x258b42();while(!![]){try{const _0x48bc32=-parseInt(_0x465328(0x1f2))/0x1+parseInt(_0x465328(0x1f0))/0x2+parseInt(_0x465328(0x1e6))/0x3+-parseInt(_0x465328(0x1ea))/0x4+-parseInt(_0x465328(0x1e4))/0x5*(parseInt(_0x465328(0x1f1))/0x6)+-parseInt(_0x465328(0x1e9))/0x7+parseInt(_0x465328(0x1f7))/0x8;if(_0x48bc32===_0x2e5b48)break;else _0x253287['push'](_0x253287['shift']());}catch(_0x4982d0){_0x253287['push'](_0x253287['shift']());}}}(a156_0x509a,0x21ed1));import{getSqlQueryInfo}from'../../core/api-client.js';function a156_0x509a(){const _0x1db7ed=['sqlName','950362KpMpAL','1053644pMAzNT','read','sqlContent','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','verbose','bool','392064KFASdR','6lgIbfl','263722SFhJCZ','detail','appCode','sqlCode','dbId','4524504nDcMTY','772715TLrIFm','boolean','584424UsiMWs','sql'];a156_0x509a=function(){return _0x1db7ed;};return a156_0x509a();}import{getDbName}from'../../core/db-resolver.js';function a156_0x3bc0(_0x1825de,_0x4fe6fe){_0x1825de=_0x1825de-0x1e4;const _0x509a53=a156_0x509a();let _0x3bc043=_0x509a53[_0x1825de];return _0x3bc043;}import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':a156_0x2d077b(0x1e7),'command':a156_0x2d077b(0x1f3),'description':a156_0x2d077b(0x1ed),'risk':a156_0x2d077b(0x1eb),'flags':[SQLCODE_FLAG,{'name':a156_0x2d077b(0x1ee),'type':a156_0x2d077b(0x1e5),'description':'Return\x20full\x20raw\x20SQL\x20query\x20object'}],async 'execute'(_0x1bd1f4){const _0xa9d75e=a156_0x2d077b,_0x3ccfdd=await getSqlQueryInfo(_0x1bd1f4[_0xa9d75e(0x1f4)],_0x1bd1f4['str']('sqlcode')),_0x4156f7=_0x1bd1f4[_0xa9d75e(0x1ef)](_0xa9d75e(0x1ee));if(_0x4156f7)return{'ok':!![],'data':_0x3ccfdd};const _0x2b3af1=_0x3ccfdd['dbId']?await getDbName(_0x1bd1f4['appCode'],_0x3ccfdd[_0xa9d75e(0x1f6)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x3ccfdd[_0xa9d75e(0x1f5)],'sqlName':_0x3ccfdd[_0xa9d75e(0x1e8)],'db':_0x2b3af1?_0x2b3af1+'\x20('+_0x3ccfdd[_0xa9d75e(0x1f6)]+')':_0x3ccfdd['dbId']??'','description':_0x3ccfdd['description']??'','sqlContent':_0x3ccfdd[_0xa9d75e(0x1ec)]??''}};}};
|
package/lib/commands/sql/exec.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a157_0x26fe2a=a157_0x5444;(function(_0x2d0685,_0x1b36a6){const _0x1dbeb9=a157_0x5444,_0x336592=_0x2d0685();while(!![]){try{const _0x2c9eb4=parseInt(_0x1dbeb9(0x76))/0x1*(-parseInt(_0x1dbeb9(0x7c))/0x2)+-parseInt(_0x1dbeb9(0x73))/0x3*(-parseInt(_0x1dbeb9(0x72))/0x4)+-parseInt(_0x1dbeb9(0x75))/0x5*(parseInt(_0x1dbeb9(0x82))/0x6)+parseInt(_0x1dbeb9(0x7f))/0x7+-parseInt(_0x1dbeb9(0x79))/0x8+-parseInt(_0x1dbeb9(0x71))/0x9+-parseInt(_0x1dbeb9(0x7d))/0xa*(-parseInt(_0x1dbeb9(0x6b))/0xb);if(_0x2c9eb4===_0x1b36a6)break;else _0x336592['push'](_0x336592['shift']());}catch(_0x24dcec){_0x336592['push'](_0x336592['shift']());}}}(a157_0x1c77,0xcbd5c));import{executeSql}from'../../core/api-client.js';function a157_0x5444(_0x318832,_0x426001){_0x318832=_0x318832-0x6a;const _0x1c771e=a157_0x1c77();let _0x5444b8=_0x1c771e[_0x318832];return _0x5444b8;}function a157_0x1c77(){const _0x3249d7=['Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','execResult','32JMHGMC','250bavMFL','exec','5207020icPPmh','\x20row(s)\x20in\x20','string','3054BTzoMG','SQL\x20execution\x20failed','1222111kFQgPK','sql','str','read','appCode','length','14078808fVewPv','29960wSICCh','585ZLpKzP','execSuccess','8135IxGJca','60610AnONRK','params','Returned\x20','6278496vKtJkL'];a157_0x1c77=function(){return _0x3249d7;};return a157_0x1c77();}import{SQLCODE_FLAG}from'../../commands/common/flags.js';import{parseJsonParams}from'../../utils/params.js';export const sqlExec={'service':a157_0x26fe2a(0x6c),'command':a157_0x26fe2a(0x7e),'description':a157_0x26fe2a(0x7a),'risk':a157_0x26fe2a(0x6e),'flags':[SQLCODE_FLAG,{'name':'params','type':a157_0x26fe2a(0x81),'description':'SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)'}],async 'execute'(_0x3a0f41){const _0x27bde4=a157_0x26fe2a,_0x49056b=parseJsonParams(_0x3a0f41[_0x27bde4(0x6d)](_0x27bde4(0x77))),_0x39f69a=Date['now'](),_0x143269=await executeSql(_0x3a0f41[_0x27bde4(0x6f)],_0x3a0f41[_0x27bde4(0x6d)]('sqlcode'),_0x49056b),_0x357842=Date['now']()-_0x39f69a,_0x52121d=_0x143269?.[_0x27bde4(0x7b)]??_0x143269,_0x37a27d=_0x143269?.[_0x27bde4(0x74)]??!![];if(!_0x37a27d)return{'ok':![],'data':{'error':_0x143269?.['execError']||_0x27bde4(0x6a),'elapsed':_0x357842},'message':_0x27bde4(0x6a)};const _0x4e3475=Array['isArray'](_0x52121d)?_0x52121d:[];return{'ok':!![],'data':{'rows':_0x4e3475,'rowCount':_0x4e3475[_0x27bde4(0x70)],'elapsed':_0x357842},'message':_0x27bde4(0x78)+_0x4e3475[_0x27bde4(0x70)]+_0x27bde4(0x80)+_0x357842+'ms'};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x23f675,_0x23bb1f){const _0x4f7956=a158_0x7d04,_0xe23146=_0x23f675();while(!![]){try{const _0x5076a7=-parseInt(_0x4f7956(0x123))/0x1*(parseInt(_0x4f7956(0x120))/0x2)+-parseInt(_0x4f7956(0x11b))/0x3+parseInt(_0x4f7956(0x11a))/0x4*(-parseInt(_0x4f7956(0x124))/0x5)+parseInt(_0x4f7956(0x11d))/0x6+-parseInt(_0x4f7956(0x121))/0x7*(-parseInt(_0x4f7956(0x11c))/0x8)+parseInt(_0x4f7956(0x11e))/0x9*(-parseInt(_0x4f7956(0x11f))/0xa)+parseInt(_0x4f7956(0x122))/0xb;if(_0x5076a7===_0x23bb1f)break;else _0xe23146['push'](_0xe23146['shift']());}catch(_0x5ce372){_0xe23146['push'](_0xe23146['shift']());}}}(a158_0x164c,0x8dd1b));import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';function a158_0x7d04(_0x5b3f43,_0xd899ed){_0x5b3f43=_0x5b3f43-0x11a;const _0x164c39=a158_0x164c();let _0x7d0472=_0x164c39[_0x5b3f43];return _0x7d0472;}import{sqlSave}from'../../commands/sql/save.js';function a158_0x164c(){const _0x228cbe=['12447hMOftr','7070KSgpFy','328sIWqMf','63273LDbFZe','28147735TIVJzE','2855oWkCPc','25NFbxqV','326748ddHjEg','3036603XjYuuD','160hBjmZQ','4247178mwmLzx'];a158_0x164c=function(){return _0x228cbe;};return a158_0x164c();}import{sqlExec}from'../../commands/sql/exec.js';import{sqlPull}from'../../commands/sql/pull.js';import{sqlCreate}from'../../commands/sql/create.js';import{sqlStatus}from'../../commands/sql/status.js';import{sqlPush}from'../../commands/sql/push.js';import{sqlDelete}from'../../commands/sql/delete.js';export const sqlDefinitions=[sqlList,sqlDetail,sqlStatus,sqlCreate,sqlPush,sqlValidate,sqlSave,sqlExec,sqlPull,sqlDelete];
|
package/lib/commands/sql/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a159_0x18bd18=a159_0x77a9;(function(_0x3a599d,_0x98cd){const _0x1df0b8=a159_0x77a9,_0x2d38ba=_0x3a599d();while(!![]){try{const _0x515aab=parseInt(_0x1df0b8(0x1a4))/0x1*(-parseInt(_0x1df0b8(0x199))/0x2)+parseInt(_0x1df0b8(0x1b8))/0x3*(parseInt(_0x1df0b8(0x19e))/0x4)+-parseInt(_0x1df0b8(0x1ba))/0x5*(-parseInt(_0x1df0b8(0x1af))/0x6)+parseInt(_0x1df0b8(0x19d))/0x7*(-parseInt(_0x1df0b8(0x196))/0x8)+-parseInt(_0x1df0b8(0x1b1))/0x9*(-parseInt(_0x1df0b8(0x1b6))/0xa)+-parseInt(_0x1df0b8(0x19f))/0xb*(parseInt(_0x1df0b8(0x195))/0xc)+parseInt(_0x1df0b8(0x1a9))/0xd;if(_0x515aab===_0x98cd)break;else _0x2d38ba['push'](_0x2d38ba['shift']());}catch(_0x18babe){_0x2d38ba['push'](_0x2d38ba['shift']());}}}(a159_0x231e,0x71f76));function a159_0x231e(){const _0x2ee159=['1958735qNQUtF','dbId','all','bool','9132DGneeF','864mbvDtM','length','map','8966aOQjKH','boolean','name','description','59843AJWUmK','28XCBbzv','12034lPFtZZ','str','pagesize','read','sqlName','23MoGkeH','tableData','Page\x20size','sql','verbose','4036422ygpJum','Page\x20number','List\x20custom\x20SQL\x20queries','sqlcode','page','num','6nOHJpr','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','9vNKvSw','list','string','number','appCode','8241910MfDggw','paging','342561AQnSpG','totalCount'];a159_0x231e=function(){return _0x2ee159;};return a159_0x231e();}import{listSqlQueries}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';function a159_0x77a9(_0x328138,_0x5dc4d0){_0x328138=_0x328138-0x192;const _0x231e32=a159_0x231e();let _0x77a9a5=_0x231e32[_0x328138];return _0x77a9a5;}import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':a159_0x18bd18(0x1a7),'command':a159_0x18bd18(0x1b2),'description':a159_0x18bd18(0x1ab),'risk':a159_0x18bd18(0x1a2),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a159_0x18bd18(0x19b),'type':a159_0x18bd18(0x1b3),'description':'Filter\x20by\x20SQL\x20name'},{'name':'page','type':a159_0x18bd18(0x1b4),'description':a159_0x18bd18(0x1aa),'default':0x1},{'name':a159_0x18bd18(0x1a1),'type':a159_0x18bd18(0x1b4),'description':a159_0x18bd18(0x1a6)},{'name':a159_0x18bd18(0x1a8),'type':a159_0x18bd18(0x19a),'description':a159_0x18bd18(0x1b0)}],async 'execute'(_0x3d6ae1){const _0x19e370=a159_0x18bd18,_0xef66c8=await listSqlQueries(_0x3d6ae1[_0x19e370(0x1b5)],{'sqlCode':_0x3d6ae1[_0x19e370(0x1a0)](_0x19e370(0x1ac))||undefined,'sqlName':_0x3d6ae1[_0x19e370(0x1a0)](_0x19e370(0x19b))||undefined,'currentPage':_0x3d6ae1[_0x19e370(0x1ae)](_0x19e370(0x1ad)),'pageSize':_0x3d6ae1[_0x19e370(0x1ae)](_0x19e370(0x1a1),0x32)}),_0x4d7f58=_0x3d6ae1[_0x19e370(0x194)](_0x19e370(0x1a8)),_0x34ac53=_0xef66c8[_0x19e370(0x1a5)]??[],_0x28fd78=_0xef66c8[_0x19e370(0x1b7)]?.[_0x19e370(0x1b9)]??_0x34ac53[_0x19e370(0x197)];let _0x5cc2b5;return _0x4d7f58?_0x5cc2b5=_0x34ac53:_0x5cc2b5=await Promise[_0x19e370(0x193)](_0x34ac53[_0x19e370(0x198)](async _0x3cfe4b=>{const _0x4d0d41=_0x19e370;let _0x12b20d;try{_0x12b20d=_0x3cfe4b[_0x4d0d41(0x192)]?await getDbName(_0x3d6ae1[_0x4d0d41(0x1b5)],_0x3cfe4b[_0x4d0d41(0x192)]):undefined;}catch{}return{'sqlCode':_0x3cfe4b['sqlCode'],'sqlName':_0x3cfe4b[_0x4d0d41(0x1a3)],'description':_0x3cfe4b[_0x4d0d41(0x19c)]??'','db':_0x12b20d?_0x12b20d+'\x20('+_0x3cfe4b[_0x4d0d41(0x192)]+')':_0x3cfe4b[_0x4d0d41(0x192)]??''};})),{'ok':!![],'data':_0x5cc2b5,'message':_0x34ac53['length']===0x0?'No\x20custom\x20SQL\x20queries\x20found.':'Found\x20'+_0x34ac53[_0x19e370(0x197)]+'\x20SQL\x20queries\x20(total:\x20'+_0x28fd78+').'};}};
|
package/lib/commands/sql/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a158_0x36f9dc=a158_0x5ff6;(function(_0x5eaee1,_0x3f1d0e){const _0x31747d=a158_0x5ff6,_0x45321b=_0x5eaee1();while(!![]){try{const _0x412cbd=-parseInt(_0x31747d(0xaf))/0x1*(-parseInt(_0x31747d(0xe2))/0x2)+-parseInt(_0x31747d(0xaa))/0x3*(-parseInt(_0x31747d(0xad))/0x4)+-parseInt(_0x31747d(0xba))/0x5*(parseInt(_0x31747d(0xab))/0x6)+parseInt(_0x31747d(0xcb))/0x7*(-parseInt(_0x31747d(0xde))/0x8)+-parseInt(_0x31747d(0xd9))/0x9*(-parseInt(_0x31747d(0xdc))/0xa)+-parseInt(_0x31747d(0xe5))/0xb*(parseInt(_0x31747d(0xe3))/0xc)+-parseInt(_0x31747d(0xd3))/0xd*(-parseInt(_0x31747d(0xd5))/0xe);if(_0x412cbd===_0x3f1d0e)break;else _0x45321b['push'](_0x45321b['shift']());}catch(_0x833faf){_0x45321b['push'](_0x45321b['shift']());}}}(a158_0x2550,0x41220));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';function a158_0x2550(){const _0x465858=['local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','bool','nonInteractive','217365xawggd','description','utf8','join','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','str','string','sqlcode','replace','tableData','toISOString','path','sqlName','sqlCode','appCode','filter','\x20written,\x20','1862VFiMKk','lastSync','apps','unchanged','trimStart','cancelled','message','catch','6929JKvDBF','test','14434VJQPUC','No\x20remote\x20SQL\x20queries\x20matched.','conflict','sql','69453UmfXgY','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','push','110RnRqFF','lockFilePath','9560QtoUsm','sqlRoot','sqlContent','sqls','1908EzBbjQ','78612JrrCJf','split','649ICMPeJ','pull','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','write','Force\x20overwrite\x20local\x20unsynced\x20changes','501eClkbt','66FrImgp','dbId','11568KVQxrz','Filter\x20by\x20SQL\x20display\x20name','348nPKHFs','length','mybatisXml','Pull\x20complete:\x20','name','force','local\x20differs\x20from\x20remote','Force\x20pull\x20cancelled.'];a158_0x2550=function(){return _0x465858;};return a158_0x2550();}import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';function a158_0x5ff6(_0x11aaae,_0x484bf1){_0x11aaae=_0x11aaae-0xa9;const _0x2550a5=a158_0x2550();let _0x5ff666=_0x2550a5[_0x11aaae];return _0x5ff666;}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(_0x4c5f0c,_0x246bde){const _0x21333c=a158_0x5ff6,_0x59dd9d=[];let _0x4a46cc=0x1;while(!![]){const _0x3f0fc2=await listSqlQueries(_0x4c5f0c,{'currentPage':_0x4a46cc,'pageSize':PAGE_SIZE,'sqlCode':_0x246bde['sqlCode'],'sqlName':_0x246bde['sqlName']}),_0x31004d=_0x3f0fc2[_0x21333c(0xc3)]??[];_0x59dd9d[_0x21333c(0xdb)](..._0x31004d);if(_0x31004d[_0x21333c(0xb0)]===0x0)break;const _0x3a5317=_0x3f0fc2['paging']?.['totalCount'];if(_0x3a5317!=null?_0x59dd9d['length']>=_0x3a5317:_0x31004d['length']<PAGE_SIZE)break;_0x4a46cc++;}return _0x59dd9d;}async function ensureSqlContent(_0x461d85){const _0x3b70c3=a158_0x5ff6;if(_0x461d85['sqlContent']!=null&&String(_0x461d85[_0x3b70c3(0xe0)])[_0x3b70c3(0xb0)]>0x0)return _0x461d85;return getSqlQueryDetail(_0x461d85[_0x3b70c3(0xc7)]);}export const sqlPull={'service':a158_0x36f9dc(0xd8),'command':'pull','description':a158_0x36f9dc(0xbe),'risk':a158_0x36f9dc(0xe8),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a158_0x36f9dc(0xb3),'type':a158_0x36f9dc(0xc0),'description':a158_0x36f9dc(0xae)},{'name':a158_0x36f9dc(0xb4),'type':'boolean','description':a158_0x36f9dc(0xa9)}],async 'dryRun'(_0x30b7e0){const _0x45c60b=a158_0x36f9dc,_0x25cce7=loadSqlProjectConfig(_0x30b7e0['appCode']),_0x3c5983=await readSqlLockFile(_0x25cce7[_0x45c60b(0xdd)]),{appLock:_0x359c9c}=ensureSqlLockScope(_0x3c5983??createEmptySqlLock(),_0x25cce7[_0x45c60b(0xc8)],_0x25cce7[_0x45c60b(0xdf)],_0x45c60b(0xe6)),_0x596f31=await fetchAllSqlQueries(_0x30b7e0[_0x45c60b(0xc8)],{'sqlCode':_0x30b7e0[_0x45c60b(0xbf)](_0x45c60b(0xc1))||undefined,'sqlName':_0x30b7e0['str'](_0x45c60b(0xb3))||undefined}),_0x295d25=[];for(const _0x3df544 of _0x596f31){const _0x2740bc=await ensureSqlContent(_0x3df544),_0x371c60=ensureRemoteSqlContent(_0x2740bc),_0x53bdce=detectModeFromSql(_0x2740bc),_0x4424e0=_0x2740bc[_0x45c60b(0xac)]?await getDbName(_0x30b7e0[_0x45c60b(0xc8)],Number(_0x2740bc['dbId']))[_0x45c60b(0xd2)](()=>undefined):undefined,_0x4618a8=buildLocalSqlFileContent({'sqlCode':_0x2740bc[_0x45c60b(0xc7)],'sqlName':_0x2740bc[_0x45c60b(0xc6)],'dbId':_0x2740bc[_0x45c60b(0xac)]},_0x371c60,{'dbName':_0x4424e0,'mode':_0x53bdce,'syncedAt':new Date()[_0x45c60b(0xc4)](),'description':_0x2740bc[_0x45c60b(0xbb)]}),_0x4ff6f6=buildSqlLockEntry(_0x2740bc,_0x371c60,'',{'dbName':_0x4424e0}),_0x429e10=resolveLocalSqlFilePath(_0x25cce7,_0x2740bc[_0x45c60b(0xc7)],_0x4ff6f6);let _0x263988='would_pull',_0x51093a;if(await fileExists(_0x429e10)){const _0x4a9d3c=await readFile(_0x429e10,_0x45c60b(0xbc));isEquivalentPulledSqlFile(_0x4a9d3c,_0x4618a8,_0x53bdce)?(_0x263988='skipped',_0x51093a=_0x45c60b(0xce)):(_0x263988=_0x45c60b(0xd7),_0x51093a=_0x45c60b(0xb7));}_0x295d25[_0x45c60b(0xdb)]({'sqlCode':_0x2740bc[_0x45c60b(0xc7)],'sqlName':_0x2740bc[_0x45c60b(0xc6)],'filePath':_0x429e10,'status':_0x263988,'reason':_0x51093a});}return{'method':'POST','url':_0x45c60b(0xda),'body':{'appCode':_0x30b7e0[_0x45c60b(0xc8)],'sqlCode':_0x30b7e0[_0x45c60b(0xbf)](_0x45c60b(0xc1))||null,'sqlName':_0x30b7e0[_0x45c60b(0xbf)](_0x45c60b(0xb3))||null,'files':_0x295d25},'description':'Would\x20pull\x20'+_0x295d25[_0x45c60b(0xb0)]+'\x20SQL\x20file(s)\x20into\x20'+_0x25cce7['sqlRootDir']};},async 'execute'(_0x5c0ba4){const _0x147bd2=a158_0x36f9dc,_0x278263=loadSqlProjectConfig(_0x5c0ba4[_0x147bd2(0xc8)]),_0x10b4b8=await readSqlLockFile(_0x278263[_0x147bd2(0xdd)]),{lockData:_0x4063e8,appLock:_0xea551f}=ensureSqlLockScope(_0x10b4b8??createEmptySqlLock(),_0x278263['appCode'],_0x278263['sqlRoot'],_0x147bd2(0xe6)),_0xf92904=_0x5c0ba4[_0x147bd2(0xb8)](_0x147bd2(0xb4)),_0x3e8f56=await fetchAllSqlQueries(_0x5c0ba4['appCode'],{'sqlCode':_0x5c0ba4['str'](_0x147bd2(0xc1))||undefined,'sqlName':_0x5c0ba4[_0x147bd2(0xbf)](_0x147bd2(0xb3))||undefined});if(_0x3e8f56[_0x147bd2(0xb0)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x147bd2(0xd6)};const _0x308fdb=[],_0x8d6673=[];for(const _0x24d239 of _0x3e8f56){try{_0x308fdb[_0x147bd2(0xdb)](await ensureSqlContent(_0x24d239));}catch(_0x144b2a){_0x8d6673[_0x147bd2(0xdb)]({'sqlCode':_0x24d239['sqlCode'],'error':_0x144b2a instanceof Error?_0x144b2a[_0x147bd2(0xd1)]:String(_0x144b2a)});}}if(_0xf92904&&!_0x5c0ba4[_0x147bd2(0xb9)]){let _0x3c7145=![];for(const _0x2226c6 of _0x308fdb){const _0x45c015=detectModeFromSql(_0x2226c6),_0x453304=_0x2226c6[_0x147bd2(0xac)]?await getDbName(_0x5c0ba4['appCode'],Number(_0x2226c6[_0x147bd2(0xac)]))[_0x147bd2(0xd2)](()=>undefined):undefined,_0x1ff584=buildLocalSqlFileContent({'sqlCode':_0x2226c6[_0x147bd2(0xc7)],'sqlName':_0x2226c6[_0x147bd2(0xc6)],'dbId':_0x2226c6[_0x147bd2(0xac)]},ensureRemoteSqlContent(_0x2226c6),{'dbName':_0x453304,'mode':_0x45c015,'syncedAt':new Date()[_0x147bd2(0xc4)](),'description':_0x2226c6['description']}),_0x118e1a=resolveLocalSqlFilePath(_0x278263,_0x2226c6[_0x147bd2(0xc7)],buildSqlLockEntry(_0x2226c6,ensureRemoteSqlContent(_0x2226c6),'',{'dbName':_0x453304}));if(await fileExists(_0x118e1a)){const _0x12b81e=await readFile(_0x118e1a,'utf8');if(!isEquivalentPulledSqlFile(_0x12b81e,_0x1ff584,_0x45c015)){_0x3c7145=!![];break;}}}if(_0x3c7145){const _0x11aede=await confirmForceOverwrite(_0x147bd2(0xe7));if(!_0x11aede)throw CliErrors[_0x147bd2(0xd0)](_0x147bd2(0xb6));}}const _0x4eca2a=cloneSqlLockData(_0x4063e8),_0x1605d8=_0x4eca2a[_0x147bd2(0xcd)][_0x278263[_0x147bd2(0xc8)]],_0x32e46c=[],_0x2bef38=[];for(const _0x285f57 of _0x308fdb){const _0x377a15=_0x1605d8[_0x147bd2(0xe1)][_0x285f57[_0x147bd2(0xc7)]],_0x462834=ensureRemoteSqlContent(_0x285f57),_0x4cb2da=detectModeFromSql(_0x285f57),_0x614c7d=_0x285f57['dbId']?await getDbName(_0x5c0ba4[_0x147bd2(0xc8)],Number(_0x285f57['dbId']))[_0x147bd2(0xd2)](()=>undefined):undefined,_0x52dee4=buildLocalSqlFileContent({'sqlCode':_0x285f57[_0x147bd2(0xc7)],'sqlName':_0x285f57[_0x147bd2(0xc6)],'dbId':_0x285f57[_0x147bd2(0xac)]},_0x462834,{'dbName':_0x614c7d,'mode':_0x4cb2da,'syncedAt':new Date()[_0x147bd2(0xc4)](),'description':_0x285f57[_0x147bd2(0xbb)]}),_0x117a78=buildSqlLockEntry(_0x285f57,_0x462834,computeSqlContentHash(_0x52dee4),{'dbName':_0x614c7d}),_0x250a5a=_0x117a78[_0x147bd2(0xc5)],_0x4c2771=join(_0x278263['sqlRootDir'],_0x250a5a);try{if(await fileExists(_0x4c2771)){const _0x5de895=await readFile(_0x4c2771,_0x147bd2(0xbc));if(isEquivalentPulledSqlFile(_0x5de895,_0x52dee4,_0x4cb2da)){_0x2bef38['push']({'sqlCode':_0x285f57['sqlCode'],'reason':'unchanged'}),_0x1605d8['sqls'][_0x285f57[_0x147bd2(0xc7)]]={..._0x117a78,'hash':computeSqlContentHash(_0x5de895),'path':_0x250a5a};continue;}if(!_0xf92904){_0x2bef38[_0x147bd2(0xdb)]({'sqlCode':_0x285f57['sqlCode'],'reason':_0x147bd2(0xb5)});continue;}}const _0x2cac30=_0x377a15?.[_0x147bd2(0xc5)]?join(_0x278263['sqlRootDir'],_0x377a15[_0x147bd2(0xc5)]):undefined;_0x2cac30&&_0x2cac30!==_0x4c2771&&await fileExists(_0x2cac30)&&await rm(_0x2cac30,{'force':!![]}),await ensureParentDirectory(_0x4c2771),await writeFile(_0x4c2771,_0x52dee4,_0x147bd2(0xbc)),_0x1605d8[_0x147bd2(0xe1)][_0x285f57['sqlCode']]={..._0x117a78,'path':_0x250a5a},_0x32e46c[_0x147bd2(0xdb)]({'sqlCode':_0x285f57[_0x147bd2(0xc7)],'filePath':_0x4c2771});}catch(_0x4c1acd){_0x8d6673['push']({'sqlCode':_0x285f57['sqlCode'],'error':_0x4c1acd instanceof Error?_0x4c1acd[_0x147bd2(0xd1)]:String(_0x4c1acd)});}}return _0x1605d8[_0x147bd2(0xcc)]=new Date()[_0x147bd2(0xc4)](),await writeSqlLockFile(_0x278263[_0x147bd2(0xdd)],_0x4eca2a),{'ok':_0x8d6673[_0x147bd2(0xb0)]===0x0,'data':{'pulled':_0x32e46c,'skipped':_0x2bef38,'failed':_0x8d6673},'message':_0x147bd2(0xb2)+_0x32e46c[_0x147bd2(0xb0)]+_0x147bd2(0xca)+_0x2bef38[_0x147bd2(0xb0)]+'\x20skipped,\x20'+_0x8d6673[_0x147bd2(0xb0)]+'\x20failed'};}};function detectModeFromSql(_0x331577){const _0x26867a=a158_0x36f9dc,_0x5acbc8=ensureRemoteSqlContent(_0x331577),_0x460b5a=stripLocalSqlMetadata(_0x5acbc8,_0x26867a(0xb1))[_0x26867a(0xcf)]();if(/^<(select|insert|update|delete)\b/i['test'](_0x460b5a))return _0x26867a(0xb1);return _0x26867a(0xd8);}function isEquivalentPulledSqlFile(_0x4c75c6,_0x3b879f,_0x408c40){return normalizePullComparableContent(_0x4c75c6,_0x408c40)===normalizePullComparableContent(_0x3b879f,_0x408c40);}function normalizePullComparableContent(_0x5e4397,_0x470526){const _0x13c012=a158_0x36f9dc,_0x4d5e0b=_0x5e4397[_0x13c012(0xc2)](/\r\n/g,'\x0a')[_0x13c012(0xe4)]('\x0a'),_0xe6fce2=_0x4d5e0b[_0x13c012(0xc9)](_0x30c37e=>!isSyncedAtMetadataLine(_0x30c37e,_0x470526));return _0xe6fce2[_0x13c012(0xbd)]('\x0a');}function isSyncedAtMetadataLine(_0x212b77,_0x4c8314){const _0x44e873=a158_0x36f9dc;if(_0x4c8314===_0x44e873(0xb1))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x44e873(0xd4)](_0x212b77);return/^\s*--\s*@lovrabet\.syncedAt:/['test'](_0x212b77);}
|
|
1
|
+
function a160_0x447e(_0x6c9441,_0x6ef2a1){_0x6c9441=_0x6c9441-0xa4;const _0x2f5c49=a160_0x2f5c();let _0x447ee3=_0x2f5c49[_0x6c9441];return _0x447ee3;}const a160_0x537a4=a160_0x447e;(function(_0x1d085b,_0xfa8a3d){const _0x5d7956=a160_0x447e,_0x23f542=_0x1d085b();while(!![]){try{const _0xef4a72=-parseInt(_0x5d7956(0xa6))/0x1+-parseInt(_0x5d7956(0xb8))/0x2+parseInt(_0x5d7956(0xaf))/0x3+-parseInt(_0x5d7956(0xb9))/0x4+parseInt(_0x5d7956(0xae))/0x5+-parseInt(_0x5d7956(0xd2))/0x6*(-parseInt(_0x5d7956(0xd4))/0x7)+parseInt(_0x5d7956(0xd0))/0x8;if(_0xef4a72===_0xfa8a3d)break;else _0x23f542['push'](_0x23f542['shift']());}catch(_0x1ae473){_0x23f542['push'](_0x23f542['shift']());}}}(a160_0x2f5c,0xef095));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x50cf63,_0x3ddece){const _0x3024e9=a160_0x447e,_0x1199cc=[];let _0x30e4ea=0x1;while(!![]){const _0x169d00=await listSqlQueries(_0x50cf63,{'currentPage':_0x30e4ea,'pageSize':PAGE_SIZE,'sqlCode':_0x3ddece[_0x3024e9(0xb2)],'sqlName':_0x3ddece[_0x3024e9(0xc1)]}),_0x29b061=_0x169d00[_0x3024e9(0xd9)]??[];_0x1199cc[_0x3024e9(0xdb)](..._0x29b061);if(_0x29b061[_0x3024e9(0xd7)]===0x0)break;const _0x2786f6=_0x169d00['paging']?.[_0x3024e9(0xc9)];if(_0x2786f6!=null?_0x1199cc['length']>=_0x2786f6:_0x29b061[_0x3024e9(0xd7)]<PAGE_SIZE)break;_0x30e4ea++;}return _0x1199cc;}async function ensureSqlContent(_0x388a6a){const _0x19f7cc=a160_0x447e;if(_0x388a6a[_0x19f7cc(0xbf)]!=null&&String(_0x388a6a[_0x19f7cc(0xbf)])[_0x19f7cc(0xd7)]>0x0)return _0x388a6a;return getSqlQueryDetail(_0x388a6a[_0x19f7cc(0xb2)]);}export const sqlPull={'service':a160_0x537a4(0xc8),'command':a160_0x537a4(0xad),'description':a160_0x537a4(0xbe),'risk':'write','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a160_0x537a4(0xb1),'type':a160_0x537a4(0xc7),'description':a160_0x537a4(0xab)},{'name':'force','type':a160_0x537a4(0xdc),'description':'Force\x20overwrite\x20local\x20unsynced\x20changes'}],async 'dryRun'(_0x10110f){const _0x4cd0ee=a160_0x537a4,_0x525c42=loadSqlProjectConfig(_0x10110f['appCode']),_0x34d5b7=await readSqlLockFile(_0x525c42[_0x4cd0ee(0xa8)]),{appLock:_0x438a75}=ensureSqlLockScope(_0x34d5b7??createEmptySqlLock(),_0x525c42[_0x4cd0ee(0xdd)],_0x525c42[_0x4cd0ee(0xa4)],_0x4cd0ee(0xad)),_0x490dcc=await fetchAllSqlQueries(_0x10110f[_0x4cd0ee(0xdd)],{'sqlCode':_0x10110f[_0x4cd0ee(0xbd)](_0x4cd0ee(0xc3))||undefined,'sqlName':_0x10110f[_0x4cd0ee(0xbd)](_0x4cd0ee(0xb1))||undefined}),_0x36e343=[];for(const _0x559e1c of _0x490dcc){const _0x4d5650=await ensureSqlContent(_0x559e1c),_0x16f177=ensureRemoteSqlContent(_0x4d5650),_0x3d32cf=detectModeFromSql(_0x4d5650),_0x55e48d=_0x4d5650[_0x4cd0ee(0xda)]?await getDbName(_0x10110f[_0x4cd0ee(0xdd)],Number(_0x4d5650[_0x4cd0ee(0xda)]))['catch'](()=>undefined):undefined,_0x1e5866=buildLocalSqlFileContent({'sqlCode':_0x4d5650['sqlCode'],'sqlName':_0x4d5650[_0x4cd0ee(0xc1)],'dbId':_0x4d5650[_0x4cd0ee(0xda)]},_0x16f177,{'dbName':_0x55e48d,'mode':_0x3d32cf,'syncedAt':new Date()[_0x4cd0ee(0xc0)](),'description':_0x4d5650[_0x4cd0ee(0xb5)]}),_0x88e7e9=buildSqlLockEntry(_0x4d5650,_0x16f177,'',{'dbName':_0x55e48d}),_0x524eb1=resolveLocalSqlFilePath(_0x525c42,_0x4d5650[_0x4cd0ee(0xb2)],_0x88e7e9);let _0x4aff64=_0x4cd0ee(0xa5),_0x37fed5;if(await fileExists(_0x524eb1)){const _0x18aa69=await readFile(_0x524eb1,_0x4cd0ee(0xca));isEquivalentPulledSqlFile(_0x18aa69,_0x1e5866,_0x3d32cf)?(_0x4aff64='skipped',_0x37fed5='unchanged'):(_0x4aff64=_0x4cd0ee(0xb6),_0x37fed5=_0x4cd0ee(0xb3));}_0x36e343[_0x4cd0ee(0xdb)]({'sqlCode':_0x4d5650[_0x4cd0ee(0xb2)],'sqlName':_0x4d5650[_0x4cd0ee(0xc1)],'filePath':_0x524eb1,'status':_0x4aff64,'reason':_0x37fed5});}return{'method':_0x4cd0ee(0xac),'url':'/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','body':{'appCode':_0x10110f[_0x4cd0ee(0xdd)],'sqlCode':_0x10110f[_0x4cd0ee(0xbd)](_0x4cd0ee(0xc3))||null,'sqlName':_0x10110f[_0x4cd0ee(0xbd)](_0x4cd0ee(0xb1))||null,'files':_0x36e343},'description':_0x4cd0ee(0xba)+_0x36e343[_0x4cd0ee(0xd7)]+_0x4cd0ee(0xcc)+_0x525c42[_0x4cd0ee(0xa7)]};},async 'execute'(_0x506607){const _0x4f9ccb=a160_0x537a4,_0x5a9f9f=loadSqlProjectConfig(_0x506607[_0x4f9ccb(0xdd)]),_0x1608a8=await readSqlLockFile(_0x5a9f9f[_0x4f9ccb(0xa8)]),{lockData:_0x132acc,appLock:_0x368c55}=ensureSqlLockScope(_0x1608a8??createEmptySqlLock(),_0x5a9f9f[_0x4f9ccb(0xdd)],_0x5a9f9f[_0x4f9ccb(0xa4)],_0x4f9ccb(0xad)),_0x26a74a=_0x506607[_0x4f9ccb(0xb4)](_0x4f9ccb(0xb7)),_0x2d50d9=await fetchAllSqlQueries(_0x506607[_0x4f9ccb(0xdd)],{'sqlCode':_0x506607['str'](_0x4f9ccb(0xc3))||undefined,'sqlName':_0x506607[_0x4f9ccb(0xbd)](_0x4f9ccb(0xb1))||undefined});if(_0x2d50d9[_0x4f9ccb(0xd7)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x4f9ccb(0xc5)};const _0x228164=[],_0xd729cf=[];for(const _0x399cc3 of _0x2d50d9){try{_0x228164[_0x4f9ccb(0xdb)](await ensureSqlContent(_0x399cc3));}catch(_0x4a4aa6){_0xd729cf['push']({'sqlCode':_0x399cc3['sqlCode'],'error':_0x4a4aa6 instanceof Error?_0x4a4aa6[_0x4f9ccb(0xaa)]:String(_0x4a4aa6)});}}if(_0x26a74a&&!_0x506607['nonInteractive']){let _0x18ad29=![];for(const _0x401f93 of _0x228164){const _0x28c45a=detectModeFromSql(_0x401f93),_0x979ab7=_0x401f93[_0x4f9ccb(0xda)]?await getDbName(_0x506607[_0x4f9ccb(0xdd)],Number(_0x401f93['dbId']))[_0x4f9ccb(0xde)](()=>undefined):undefined,_0x287c9d=buildLocalSqlFileContent({'sqlCode':_0x401f93['sqlCode'],'sqlName':_0x401f93['sqlName'],'dbId':_0x401f93[_0x4f9ccb(0xda)]},ensureRemoteSqlContent(_0x401f93),{'dbName':_0x979ab7,'mode':_0x28c45a,'syncedAt':new Date()[_0x4f9ccb(0xc0)](),'description':_0x401f93['description']}),_0x536e9d=resolveLocalSqlFilePath(_0x5a9f9f,_0x401f93[_0x4f9ccb(0xb2)],buildSqlLockEntry(_0x401f93,ensureRemoteSqlContent(_0x401f93),'',{'dbName':_0x979ab7}));if(await fileExists(_0x536e9d)){const _0x29c630=await readFile(_0x536e9d,_0x4f9ccb(0xca));if(!isEquivalentPulledSqlFile(_0x29c630,_0x287c9d,_0x28c45a)){_0x18ad29=!![];break;}}}if(_0x18ad29){const _0x366e6b=await confirmForceOverwrite('Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.');if(!_0x366e6b)throw CliErrors['cancelled'](_0x4f9ccb(0xcb));}}const _0x162691=cloneSqlLockData(_0x132acc),_0x5043a1=_0x162691[_0x4f9ccb(0xd6)][_0x5a9f9f[_0x4f9ccb(0xdd)]],_0x127c2b=[],_0x717e72=[];for(const _0x1fe994 of _0x228164){const _0x23a430=_0x5043a1[_0x4f9ccb(0xce)][_0x1fe994['sqlCode']],_0x10a2fd=ensureRemoteSqlContent(_0x1fe994),_0x4ff51a=detectModeFromSql(_0x1fe994),_0x2a0b78=_0x1fe994['dbId']?await getDbName(_0x506607['appCode'],Number(_0x1fe994[_0x4f9ccb(0xda)]))[_0x4f9ccb(0xde)](()=>undefined):undefined,_0x2c8d19=buildLocalSqlFileContent({'sqlCode':_0x1fe994[_0x4f9ccb(0xb2)],'sqlName':_0x1fe994[_0x4f9ccb(0xc1)],'dbId':_0x1fe994[_0x4f9ccb(0xda)]},_0x10a2fd,{'dbName':_0x2a0b78,'mode':_0x4ff51a,'syncedAt':new Date()['toISOString'](),'description':_0x1fe994[_0x4f9ccb(0xb5)]}),_0x2e9e0b=buildSqlLockEntry(_0x1fe994,_0x10a2fd,computeSqlContentHash(_0x2c8d19),{'dbName':_0x2a0b78}),_0x75fdbd=_0x2e9e0b[_0x4f9ccb(0xc6)],_0x27c0a8=join(_0x5a9f9f[_0x4f9ccb(0xa7)],_0x75fdbd);try{if(await fileExists(_0x27c0a8)){const _0x57a39c=await readFile(_0x27c0a8,_0x4f9ccb(0xca));if(isEquivalentPulledSqlFile(_0x57a39c,_0x2c8d19,_0x4ff51a)){_0x717e72['push']({'sqlCode':_0x1fe994[_0x4f9ccb(0xb2)],'reason':_0x4f9ccb(0xcf)}),_0x5043a1[_0x4f9ccb(0xce)][_0x1fe994['sqlCode']]={..._0x2e9e0b,'hash':computeSqlContentHash(_0x57a39c),'path':_0x75fdbd};continue;}if(!_0x26a74a){_0x717e72[_0x4f9ccb(0xdb)]({'sqlCode':_0x1fe994[_0x4f9ccb(0xb2)],'reason':_0x4f9ccb(0xc4)});continue;}}const _0x55396a=_0x23a430?.[_0x4f9ccb(0xc6)]?join(_0x5a9f9f[_0x4f9ccb(0xa7)],_0x23a430[_0x4f9ccb(0xc6)]):undefined;_0x55396a&&_0x55396a!==_0x27c0a8&&await fileExists(_0x55396a)&&await rm(_0x55396a,{'force':!![]}),await ensureParentDirectory(_0x27c0a8),await writeFile(_0x27c0a8,_0x2c8d19,'utf8'),_0x5043a1[_0x4f9ccb(0xce)][_0x1fe994[_0x4f9ccb(0xb2)]]={..._0x2e9e0b,'path':_0x75fdbd},_0x127c2b[_0x4f9ccb(0xdb)]({'sqlCode':_0x1fe994['sqlCode'],'filePath':_0x27c0a8});}catch(_0x2b2193){_0xd729cf[_0x4f9ccb(0xdb)]({'sqlCode':_0x1fe994[_0x4f9ccb(0xb2)],'error':_0x2b2193 instanceof Error?_0x2b2193[_0x4f9ccb(0xaa)]:String(_0x2b2193)});}}return _0x5043a1[_0x4f9ccb(0xd3)]=new Date()[_0x4f9ccb(0xc0)](),await writeSqlLockFile(_0x5a9f9f['lockFilePath'],_0x162691),{'ok':_0xd729cf['length']===0x0,'data':{'pulled':_0x127c2b,'skipped':_0x717e72,'failed':_0xd729cf},'message':_0x4f9ccb(0xb0)+_0x127c2b[_0x4f9ccb(0xd7)]+_0x4f9ccb(0xbc)+_0x717e72[_0x4f9ccb(0xd7)]+_0x4f9ccb(0xbb)+_0xd729cf[_0x4f9ccb(0xd7)]+'\x20failed'};}};function detectModeFromSql(_0x757116){const _0x3744ce=a160_0x537a4,_0x2f46d7=ensureRemoteSqlContent(_0x757116),_0x49b030=stripLocalSqlMetadata(_0x2f46d7,_0x3744ce(0xc2))[_0x3744ce(0xd5)]();if(/^<(select|insert|update|delete)\b/i[_0x3744ce(0xa9)](_0x49b030))return _0x3744ce(0xc2);return _0x3744ce(0xc8);}function isEquivalentPulledSqlFile(_0x3c0b87,_0x558ec3,_0x1779cc){return normalizePullComparableContent(_0x3c0b87,_0x1779cc)===normalizePullComparableContent(_0x558ec3,_0x1779cc);}function a160_0x2f5c(){const _0x20047d=['appCode','catch','sqlRoot','would_pull','893077UqhwVb','sqlRootDir','lockFilePath','test','message','Filter\x20by\x20SQL\x20display\x20name','POST','pull','4066750LyZaMN','2393337QYILGf','Pull\x20complete:\x20','name','sqlCode','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','bool','description','conflict','force','2440762iLPduJ','2423164zdvemd','Would\x20pull\x20','\x20skipped,\x20','\x20written,\x20','str','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','sqlContent','toISOString','sqlName','mybatisXml','sqlcode','local\x20differs\x20from\x20remote','No\x20remote\x20SQL\x20queries\x20matched.','path','string','sql','totalCount','utf8','Force\x20pull\x20cancelled.','\x20SQL\x20file(s)\x20into\x20','split','sqls','unchanged','2860496BSnqIV','filter','462FFFmEu','lastSync','157241bLUnRF','trimStart','apps','length','join','tableData','dbId','push','boolean'];a160_0x2f5c=function(){return _0x20047d;};return a160_0x2f5c();}function normalizePullComparableContent(_0x2259a4,_0x19f453){const _0x517f83=a160_0x537a4,_0x5b280f=_0x2259a4['replace'](/\r\n/g,'\x0a')[_0x517f83(0xcd)]('\x0a'),_0x53519f=_0x5b280f[_0x517f83(0xd1)](_0x1b54f2=>!isSyncedAtMetadataLine(_0x1b54f2,_0x19f453));return _0x53519f[_0x517f83(0xd8)]('\x0a');}function isSyncedAtMetadataLine(_0x82ee15,_0x5e039c){const _0x5567d8=a160_0x537a4;if(_0x5e039c===_0x5567d8(0xc2))return/^\s*<!--\s*@lovrabet\.syncedAt:/['test'](_0x82ee15);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x5567d8(0xa9)](_0x82ee15);}
|
package/lib/commands/sql/push.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a159_0x307fe6=a159_0x23ec;(function(_0xe56ade,_0x4b6e20){const _0x57aaa4=a159_0x23ec,_0x26277a=_0xe56ade();while(!![]){try{const _0x4c2364=-parseInt(_0x57aaa4(0x149))/0x1+parseInt(_0x57aaa4(0x15b))/0x2*(-parseInt(_0x57aaa4(0x15d))/0x3)+-parseInt(_0x57aaa4(0x153))/0x4*(-parseInt(_0x57aaa4(0x13d))/0x5)+parseInt(_0x57aaa4(0x15a))/0x6+parseInt(_0x57aaa4(0x159))/0x7+-parseInt(_0x57aaa4(0x144))/0x8+-parseInt(_0x57aaa4(0x139))/0x9*(-parseInt(_0x57aaa4(0x134))/0xa);if(_0x4c2364===_0x4b6e20)break;else _0x26277a['push'](_0x26277a['shift']());}catch(_0x4d1775){_0x26277a['push'](_0x26277a['shift']());}}}(a159_0x2ed6,0x85ea1));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(_0x21c330,_0x501551,_0x232be2){const _0x3566c8=a159_0x23ec,_0x2b7853=await scanLocalSqlQueries(_0x21c330),_0x150d30=new Map();for(const _0x3caf15 of _0x2b7853){if(_0x232be2&&_0x3caf15[_0x3566c8(0x16e)]!==_0x232be2)continue;const _0xa66d29=_0x150d30[_0x3566c8(0x154)](_0x3caf15[_0x3566c8(0x16e)])??[];_0xa66d29[_0x3566c8(0x130)](_0x3caf15),_0x150d30['set'](_0x3caf15[_0x3566c8(0x16e)],_0xa66d29);}if(_0x232be2&&!_0x150d30[_0x3566c8(0x14d)](_0x232be2))throw CliErrors[_0x3566c8(0x137)]('Local\x20SQL\x20not\x20found:\x20'+_0x232be2);const _0xbc996d=[];for(const [_0x575f11,_0x44f999]of _0x150d30[_0x3566c8(0x136)]()){if(_0x44f999[_0x3566c8(0x140)]===0x1){_0xbc996d['push'](_0x44f999[0x0]);continue;}const _0x3df98d=_0x501551[_0x3566c8(0x160)][_0x575f11],_0x54831d=_0x3df98d?.[_0x3566c8(0x16c)],_0x1c435b=_0x54831d?_0x44f999['filter'](_0x55003e=>_0x55003e[_0x3566c8(0x157)]!==_0x54831d):_0x44f999;if(_0x3df98d&&_0x1c435b[_0x3566c8(0x140)]===0x1){_0xbc996d[_0x3566c8(0x130)](_0x1c435b[0x0]);continue;}throw CliErrors[_0x3566c8(0x137)](_0x3566c8(0x147)+_0x575f11+_0x3566c8(0x13a));}return _0xbc996d;}export const sqlPush={'service':a159_0x307fe6(0x166),'command':a159_0x307fe6(0x130),'description':a159_0x307fe6(0x174),'risk':a159_0x307fe6(0x14a),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a159_0x307fe6(0x145),'type':a159_0x307fe6(0x135),'description':'Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock'}],async 'dryRun'(_0x5f57a2){const _0x78a3b1=a159_0x307fe6,_0x9c2212=loadSqlProjectConfig(_0x5f57a2[_0x78a3b1(0x133)]),_0x373e34=await readSqlLockFile(_0x9c2212[_0x78a3b1(0x172)]),{appLock:_0x31934c}=ensureSqlLockScope(_0x373e34??createEmptySqlLock(),_0x5f57a2[_0x78a3b1(0x133)],_0x9c2212[_0x78a3b1(0x170)],_0x78a3b1(0x130)),_0x3b3c9c=await getTargetSqlQueries(_0x9c2212,_0x31934c,_0x5f57a2[_0x78a3b1(0x148)](_0x78a3b1(0x14f))||undefined),_0x5a8032=[];for(const _0x3f8b36 of _0x3b3c9c){const _0x404f8f=await computeSqlFileHash(_0x3f8b36['filePath']),_0x191b70=_0x31934c[_0x78a3b1(0x160)][_0x3f8b36[_0x78a3b1(0x16e)]],_0x15c471=!!_0x191b70&&(_0x191b70[_0x78a3b1(0x16c)]!==_0x3f8b36['relativePath']||!!_0x3f8b36[_0x78a3b1(0x163)]&&_0x191b70[_0x78a3b1(0x163)]!==_0x3f8b36[_0x78a3b1(0x163)]);if(!_0x5f57a2['bool'](_0x78a3b1(0x145))&&_0x191b70&&_0x191b70[_0x78a3b1(0x152)]===_0x404f8f&&!_0x15c471)continue;_0x5a8032['push'](_0x3f8b36[_0x78a3b1(0x16e)]);}return{'method':_0x78a3b1(0x143),'url':_0x78a3b1(0x150),'body':{'sqlCodes':_0x5a8032,'appCode':_0x5f57a2[_0x78a3b1(0x133)]},'description':_0x78a3b1(0x164)+_0x5a8032['length']+_0x78a3b1(0x131)};},async 'execute'(_0xcded3d){const _0x358f48=a159_0x307fe6,_0x58d439=loadSqlProjectConfig(_0xcded3d[_0x358f48(0x133)]),_0x1a2480=await readSqlLockFile(_0x58d439['lockFilePath']),{lockData:_0x3ea56d,appLock:_0x2cce84}=ensureSqlLockScope(_0x1a2480??createEmptySqlLock(),_0xcded3d[_0x358f48(0x133)],_0x58d439[_0x358f48(0x170)],'push'),_0x3a0c3a=await getTargetSqlQueries(_0x58d439,_0x2cce84,_0xcded3d[_0x358f48(0x148)](_0x358f48(0x14f))||undefined);if(_0x3a0c3a[_0x358f48(0x140)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x358f48(0x162)};const _0x14fa79=[],_0x185185=[],_0x2f6e4f=[];for(const _0x16d699 of _0x3a0c3a){const _0x3b400d=_0x2cce84[_0x358f48(0x160)][_0x16d699[_0x358f48(0x16e)]];if(!_0x3b400d){_0x2f6e4f[_0x358f48(0x130)]({'sqlCode':_0x16d699[_0x358f48(0x16e)],'error':'local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first'});continue;}try{const _0x1e68d6=await computeSqlFileHash(_0x16d699[_0x358f48(0x161)]),_0x2d8ad1=_0x3b400d[_0x358f48(0x16c)]!==_0x16d699[_0x358f48(0x157)]||!!_0x16d699[_0x358f48(0x163)]&&_0x3b400d[_0x358f48(0x163)]!==_0x16d699['sqlName'];if(!_0xcded3d[_0x358f48(0x13e)](_0x358f48(0x145))&&_0x3b400d['hash']===_0x1e68d6&&!_0x2d8ad1){_0x185185[_0x358f48(0x130)]({'sqlCode':_0x16d699[_0x358f48(0x16e)],'reason':_0x358f48(0x13b)});continue;}if(_0x3b400d[_0x358f48(0x16a)]==null){_0x2f6e4f[_0x358f48(0x130)]({'sqlCode':_0x16d699[_0x358f48(0x16e)],'error':_0x358f48(0x14e)});continue;}const _0x4bd5e1=await readFile(_0x16d699[_0x358f48(0x161)],_0x358f48(0x151)),_0x53cb9e=stripLocalSqlMetadata(_0x4bd5e1,_0x16d699[_0x358f48(0x14c)]),_0x26411c=_0x16d699[_0x358f48(0x163)]||_0x3b400d[_0x358f48(0x163)],_0x48e559=await resolveTargetDbBinding(_0xcded3d[_0x358f48(0x133)],_0x16d699,_0x3b400d),_0x42d3fa=await updateSqlQuery({'id':_0x3b400d[_0x358f48(0x15e)],'appCode':_0xcded3d[_0x358f48(0x133)],'sqlCode':_0x16d699[_0x358f48(0x16e)],'sqlName':_0x26411c,'dbId':_0x48e559[_0x358f48(0x158)],'version':_0x3b400d[_0x358f48(0x16a)],'sqlContent':_0x53cb9e,'sqlConfig':_0x3b400d[_0x358f48(0x16f)]??undefined}),_0xed4546=_0x42d3fa[_0x358f48(0x158)]?await getDbName(_0xcded3d[_0x358f48(0x133)],Number(_0x42d3fa[_0x358f48(0x158)]))['catch'](()=>_0x48e559['dbName']):_0x48e559[_0x358f48(0x15f)];_0x2cce84[_0x358f48(0x160)][_0x16d699['sqlCode']]={...buildSqlLockEntry(_0x42d3fa,_0x53cb9e,_0x1e68d6,{'dbName':_0xed4546}),'path':_0x16d699['relativePath'],'mode':_0x3b400d[_0x358f48(0x14c)]},await archivePreviousSqlFileIfNeeded(_0x58d439,_0x3b400d[_0x358f48(0x16c)],_0x16d699[_0x358f48(0x157)]),_0x14fa79['push']({'sqlCode':_0x16d699['sqlCode'],'remoteId':_0x3b400d[_0x358f48(0x15e)]});}catch(_0x2ae0f4){_0x2f6e4f['push']({'sqlCode':_0x16d699['sqlCode'],'error':_0x2ae0f4 instanceof Error?_0x2ae0f4[_0x358f48(0x168)]:String(_0x2ae0f4)});}}return _0x2cce84[_0x358f48(0x14b)]=new Date()[_0x358f48(0x167)](),await writeSqlLockFile(_0x58d439[_0x358f48(0x172)],_0x3ea56d),{'ok':_0x2f6e4f[_0x358f48(0x140)]===0x0,'data':{'pushed':_0x14fa79,'skipped':_0x185185,'failed':_0x2f6e4f},'message':_0x358f48(0x171)+_0x14fa79[_0x358f48(0x140)]+_0x358f48(0x16b)+_0x185185[_0x358f48(0x140)]+_0x358f48(0x15c)+_0x2f6e4f[_0x358f48(0x140)]+_0x358f48(0x175)};}};function a159_0x23ec(_0x3b99f3,_0x5f071b){_0x3b99f3=_0x3b99f3-0x130;const _0x2ed62e=a159_0x2ed6();let _0x23ecc9=_0x2ed62e[_0x3b99f3];return _0x23ecc9;}async function archivePreviousSqlFileIfNeeded(_0x53b348,_0x22730b,_0x1903a7){const _0x50cdd3=a159_0x307fe6;if(!_0x22730b||_0x22730b===_0x1903a7)return;const _0x440206=join(_0x53b348['sqlRootDir'],_0x22730b);if(!await fileExists(_0x440206))return;const _0x58eb13=await moveToTrash(_0x53b348[_0x50cdd3(0x16d)],_0x53b348[_0x50cdd3(0x13c)],_0x440206);await cleanupEmptyDirectories(dirname(_0x440206),_0x53b348['sqlRootDir']),void _0x58eb13;}async function moveToTrash(_0x4d9340,_0x450aaa,_0x3e4ac3){const _0x5b28e8=a159_0x307fe6,_0xa92a3a=new Date()[_0x5b28e8(0x167)]()[_0x5b28e8(0x138)](/[:.]/g,'-'),_0x425174=relative(_0x4d9340,_0x3e4ac3),_0x4b4aba=join(_0x450aaa,_0xa92a3a,_0x425174);return await mkdir(dirname(_0x4b4aba),{'recursive':!![]}),await rename(_0x3e4ac3,_0x4b4aba),_0x4b4aba;}async function cleanupEmptyDirectories(_0x14c1af,_0x45d015){const _0x5e361c=a159_0x307fe6;let _0x38ae51=resolve(_0x14c1af);const _0x528c1f=resolve(_0x45d015);while(_0x38ae51[_0x5e361c(0x173)](''+_0x528c1f+sep)||_0x38ae51===_0x528c1f){if(_0x38ae51===_0x528c1f)return;try{const _0x29e379=await readdir(_0x38ae51);if(_0x29e379[_0x5e361c(0x140)]>0x0)return;await rmdir(_0x38ae51);}catch{return;}_0x38ae51=dirname(_0x38ae51);}}async function resolveTargetDbBinding(_0x52473e,_0x11f61e,_0x121790){const _0x119c93=a159_0x307fe6,_0x2522e3=_0x11f61e[_0x119c93(0x156)];if(!_0x2522e3)return{'dbId':_0x121790[_0x119c93(0x158)],'dbName':_0x121790['dbName']};const _0x529e1d=buildDbDirectoryName(_0x121790[_0x119c93(0x15f)],_0x121790['dbId']);if(_0x2522e3===_0x529e1d)return{'dbId':_0x121790[_0x119c93(0x158)],'dbName':_0x121790['dbName']};const _0x3d0234=parseExplicitDbDirectory(_0x2522e3);if(_0x3d0234!=null)return{'dbId':_0x3d0234,'dbName':await getDbName(_0x52473e,_0x3d0234)[_0x119c93(0x13f)](()=>undefined)};const _0x3eb38e=await listDatabases(_0x52473e),_0x100567=_0x3eb38e[_0x119c93(0x141)](_0x6b5aaa=>buildDbDirectoryName(_0x6b5aaa[_0x119c93(0x15f)],_0x6b5aaa['dbId'])===_0x2522e3);if(_0x100567[_0x119c93(0x140)]===0x1)return{'dbId':_0x100567[0x0][_0x119c93(0x158)],'dbName':_0x100567[0x0]['dbName']};if(_0x100567[_0x119c93(0x140)]===0x0)throw CliErrors[_0x119c93(0x137)](_0x119c93(0x169)+_0x2522e3+_0x119c93(0x142)+_0x11f61e['sqlCode']+'.');const _0x1b2eaf=_0x100567['map'](_0x4946f1=>_0x4946f1[_0x119c93(0x15f)]+'\x20('+_0x4946f1['dbId']+')')['join'](',\x20');throw CliErrors[_0x119c93(0x137)](_0x119c93(0x155)+_0x2522e3+_0x119c93(0x146)+_0x11f61e[_0x119c93(0x16e)]+':\x20'+_0x1b2eaf);}function parseExplicitDbDirectory(_0x57e14f){const _0x33e5c9=a159_0x307fe6,_0xbf6198=/^db-(\d+)$/[_0x33e5c9(0x132)](_0x57e14f);if(!_0xbf6198)return null;const _0x13b492=Number(_0xbf6198[0x1]);return Number[_0x33e5c9(0x165)](_0x13b492)&&_0x13b492>0x0?_0x13b492:null;}function a159_0x2ed6(){const _0x17699f=['bool','catch','length','filter','\x22\x20for\x20sqlCode\x20','POST','4405536uNiSjN','force','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','str','993498XrDYsq','high-risk-write','lastSync','mode','has','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','sqlcode','/smartapi/custom/updateUserCustomSql','utf8','hash','380VMkMwb','get','Local\x20directory\x20\x22','dbDirectory','relativePath','dbId','1207094Ecimde','1165734JJPDQW','32070ESwNDU','\x20skipped,\x20','177isAOJQ','remoteId','dbName','sqls','filePath','No\x20local\x20SQL\x20files\x20found.','sqlName','Would\x20push\x20','isFinite','sql','toISOString','message','No\x20database\x20matches\x20local\x20directory\x20\x22','version','\x20pushed,\x20','path','projectRoot','sqlCode','sqlConfig','sqlRoot','Push\x20complete:\x20','lockFilePath','startsWith','Push\x20local\x20SQL\x20files\x20to\x20remote','\x20failed','push','\x20SQL\x20file(s)','exec','appCode','70ZFsCiw','boolean','entries','validation','replace','2650464tZudoY','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','unchanged','trashDir','32135gRisPz'];a159_0x2ed6=function(){return _0x17699f;};return a159_0x2ed6();}
|
|
1
|
+
const a161_0x428e6a=a161_0x73b8;(function(_0x292c80,_0x5ead11){const _0x476fc9=a161_0x73b8,_0x4a0ce=_0x292c80();while(!![]){try{const _0x43ad55=parseInt(_0x476fc9(0xe9))/0x1+parseInt(_0x476fc9(0xfc))/0x2+parseInt(_0x476fc9(0xd2))/0x3*(parseInt(_0x476fc9(0xf0))/0x4)+-parseInt(_0x476fc9(0x10c))/0x5+-parseInt(_0x476fc9(0x109))/0x6+parseInt(_0x476fc9(0xd5))/0x7*(parseInt(_0x476fc9(0xf5))/0x8)+-parseInt(_0x476fc9(0xd0))/0x9;if(_0x43ad55===_0x5ead11)break;else _0x4a0ce['push'](_0x4a0ce['shift']());}catch(_0x3e9c15){_0x4a0ce['push'](_0x4a0ce['shift']());}}}(a161_0x397e,0x24acb));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';async function getTargetSqlQueries(_0x24463a,_0x1f6b57,_0x1e6fff){const _0x1072d0=a161_0x73b8,_0x331005=await scanLocalSqlQueries(_0x24463a),_0x5481c8=new Map();for(const _0x362e86 of _0x331005){if(_0x1e6fff&&_0x362e86[_0x1072d0(0xd1)]!==_0x1e6fff)continue;const _0x494d8d=_0x5481c8[_0x1072d0(0x104)](_0x362e86[_0x1072d0(0xd1)])??[];_0x494d8d[_0x1072d0(0xd8)](_0x362e86),_0x5481c8[_0x1072d0(0x102)](_0x362e86['sqlCode'],_0x494d8d);}if(_0x1e6fff&&!_0x5481c8[_0x1072d0(0xef)](_0x1e6fff))throw CliErrors['validation'](_0x1072d0(0xda)+_0x1e6fff);const _0x6b6de7=[];for(const [_0x34d352,_0x2ed44b]of _0x5481c8['entries']()){if(_0x2ed44b['length']===0x1){_0x6b6de7[_0x1072d0(0xd8)](_0x2ed44b[0x0]);continue;}const _0xa8fe6f=_0x1f6b57[_0x1072d0(0x106)][_0x34d352],_0x585c41=_0xa8fe6f?.[_0x1072d0(0xe6)],_0x45c64e=_0x585c41?_0x2ed44b[_0x1072d0(0xf8)](_0x140e80=>_0x140e80[_0x1072d0(0xf4)]!==_0x585c41):_0x2ed44b;if(_0xa8fe6f&&_0x45c64e['length']===0x1){_0x6b6de7[_0x1072d0(0xd8)](_0x45c64e[0x0]);continue;}throw CliErrors[_0x1072d0(0xe2)](_0x1072d0(0xe8)+_0x34d352+_0x1072d0(0xed));}return _0x6b6de7;}export const sqlPush={'service':'sql','command':a161_0x428e6a(0xd8),'description':a161_0x428e6a(0xfa),'risk':a161_0x428e6a(0xfd),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a161_0x428e6a(0xdf),'type':a161_0x428e6a(0xf7),'description':'Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock'}],async 'dryRun'(_0x401101){const _0x116555=a161_0x428e6a,_0x5e5eb6=loadSqlProjectConfig(_0x401101[_0x116555(0xdc)]),_0x41a3e3=await readSqlLockFile(_0x5e5eb6[_0x116555(0x105)]),{appLock:_0x131822}=ensureSqlLockScope(_0x41a3e3??createEmptySqlLock(),_0x401101[_0x116555(0xdc)],_0x5e5eb6['sqlRoot'],_0x116555(0xd8)),_0x521aca=await getTargetSqlQueries(_0x5e5eb6,_0x131822,_0x401101[_0x116555(0xce)](_0x116555(0xcb))||undefined),_0x15d9f0=[];for(const _0x41558c of _0x521aca){const _0x3e3f7a=await computeSqlFileHash(_0x41558c[_0x116555(0xca)]),_0x5c2489=_0x131822[_0x116555(0x106)][_0x41558c[_0x116555(0xd1)]],_0x2439da=!!_0x5c2489&&(_0x5c2489['path']!==_0x41558c['relativePath']||!!_0x41558c['sqlName']&&_0x5c2489[_0x116555(0xfb)]!==_0x41558c[_0x116555(0xfb)]);if(!_0x401101[_0x116555(0xe1)](_0x116555(0xdf))&&_0x5c2489&&_0x5c2489[_0x116555(0xd7)]===_0x3e3f7a&&!_0x2439da)continue;_0x15d9f0[_0x116555(0xd8)](_0x41558c[_0x116555(0xd1)]);}return{'method':_0x116555(0xd9),'url':_0x116555(0x10a),'body':{'sqlCodes':_0x15d9f0,'appCode':_0x401101['appCode']},'description':_0x116555(0xf9)+_0x15d9f0[_0x116555(0xf3)]+_0x116555(0xcd)};},async 'execute'(_0x3eeaa2){const _0x2706a3=a161_0x428e6a,_0x28d4f8=loadSqlProjectConfig(_0x3eeaa2['appCode']),_0x3d46d8=await readSqlLockFile(_0x28d4f8[_0x2706a3(0x105)]),{lockData:_0x54d934,appLock:_0x326fb4}=ensureSqlLockScope(_0x3d46d8??createEmptySqlLock(),_0x3eeaa2['appCode'],_0x28d4f8[_0x2706a3(0xe0)],_0x2706a3(0xd8)),_0x2146c6=await getTargetSqlQueries(_0x28d4f8,_0x326fb4,_0x3eeaa2['str'](_0x2706a3(0xcb))||undefined);if(_0x2146c6[_0x2706a3(0xf3)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x2706a3(0xd3)};const _0x842a15=[],_0x324146=[],_0x2d6449=[];for(const _0x344291 of _0x2146c6){const _0x229f36=_0x326fb4[_0x2706a3(0x106)][_0x344291['sqlCode']];if(!_0x229f36){_0x2d6449['push']({'sqlCode':_0x344291[_0x2706a3(0xd1)],'error':_0x2706a3(0xff)});continue;}try{const _0x46a13e=await computeSqlFileHash(_0x344291[_0x2706a3(0xca)]),_0x45332f=_0x229f36[_0x2706a3(0xe6)]!==_0x344291[_0x2706a3(0xf4)]||!!_0x344291[_0x2706a3(0xfb)]&&_0x229f36[_0x2706a3(0xfb)]!==_0x344291['sqlName'];if(!_0x3eeaa2['bool'](_0x2706a3(0xdf))&&_0x229f36['hash']===_0x46a13e&&!_0x45332f){_0x324146[_0x2706a3(0xd8)]({'sqlCode':_0x344291['sqlCode'],'reason':_0x2706a3(0xee)});continue;}if(_0x229f36[_0x2706a3(0x101)]==null){_0x2d6449[_0x2706a3(0xd8)]({'sqlCode':_0x344291[_0x2706a3(0xd1)],'error':_0x2706a3(0x10d)});continue;}const _0x210d17=await readFile(_0x344291[_0x2706a3(0xca)],'utf8'),_0x5911b9=stripLocalSqlMetadata(_0x210d17,_0x344291['mode']),_0x4ac754=_0x344291[_0x2706a3(0xfb)]||_0x229f36[_0x2706a3(0xfb)],_0x41bee2=await resolveTargetDbBinding(_0x3eeaa2[_0x2706a3(0xdc)],_0x344291,_0x229f36),_0x233c3f=await updateSqlQuery({'id':_0x229f36[_0x2706a3(0xd6)],'appCode':_0x3eeaa2['appCode'],'sqlCode':_0x344291[_0x2706a3(0xd1)],'sqlName':_0x4ac754,'dbId':_0x41bee2[_0x2706a3(0xf2)],'version':_0x229f36['version'],'sqlContent':_0x5911b9,'sqlConfig':_0x229f36[_0x2706a3(0x10b)]??undefined}),_0x11ff48=_0x233c3f['dbId']?await getDbName(_0x3eeaa2[_0x2706a3(0xdc)],Number(_0x233c3f['dbId']))[_0x2706a3(0xe7)](()=>_0x41bee2[_0x2706a3(0xfe)]):_0x41bee2[_0x2706a3(0xfe)];_0x326fb4['sqls'][_0x344291['sqlCode']]={...buildSqlLockEntry(_0x233c3f,_0x5911b9,_0x46a13e,{'dbName':_0x11ff48}),'path':_0x344291['relativePath'],'mode':_0x229f36[_0x2706a3(0xde)]},await archivePreviousSqlFileIfNeeded(_0x28d4f8,_0x229f36[_0x2706a3(0xe6)],_0x344291[_0x2706a3(0xf4)]),_0x842a15[_0x2706a3(0xd8)]({'sqlCode':_0x344291[_0x2706a3(0xd1)],'remoteId':_0x229f36['remoteId']});}catch(_0x4d497c){_0x2d6449[_0x2706a3(0xd8)]({'sqlCode':_0x344291[_0x2706a3(0xd1)],'error':_0x4d497c instanceof Error?_0x4d497c[_0x2706a3(0xeb)]:String(_0x4d497c)});}}return _0x326fb4[_0x2706a3(0x108)]=new Date()[_0x2706a3(0xf6)](),await writeSqlLockFile(_0x28d4f8[_0x2706a3(0x105)],_0x54d934),{'ok':_0x2d6449[_0x2706a3(0xf3)]===0x0,'data':{'pushed':_0x842a15,'skipped':_0x324146,'failed':_0x2d6449},'message':_0x2706a3(0xdb)+_0x842a15[_0x2706a3(0xf3)]+_0x2706a3(0xe5)+_0x324146[_0x2706a3(0xf3)]+_0x2706a3(0xe4)+_0x2d6449[_0x2706a3(0xf3)]+_0x2706a3(0xcf)};}};async function archivePreviousSqlFileIfNeeded(_0xd6882,_0x42b77a,_0x497faa){const _0x58ba52=a161_0x428e6a;if(!_0x42b77a||_0x42b77a===_0x497faa)return;const _0x80f88d=join(_0xd6882[_0x58ba52(0xec)],_0x42b77a);if(!await fileExists(_0x80f88d))return;const _0x23eae6=await moveToTrash(_0xd6882[_0x58ba52(0xdd)],_0xd6882[_0x58ba52(0x103)],_0x80f88d);await cleanupEmptyDirectories(dirname(_0x80f88d),_0xd6882[_0x58ba52(0xec)]),void _0x23eae6;}function a161_0x397e(){const _0xa616c7=['sqlcode','map','\x20SQL\x20file(s)','str','\x20failed','373932NZCAbr','sqlCode','300POxCsJ','No\x20local\x20SQL\x20files\x20found.','\x22\x20for\x20sqlCode\x20','35lwsUNz','remoteId','hash','push','POST','Local\x20SQL\x20not\x20found:\x20','Push\x20complete:\x20','appCode','projectRoot','mode','force','sqlRoot','bool','validation','Local\x20directory\x20\x22','\x20skipped,\x20','\x20pushed,\x20','path','catch','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','291097xIhfdI','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','message','sqlRootDir','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','unchanged','has','4544UXyDJk','exec','dbId','length','relativePath','136ntKMLr','toISOString','boolean','filter','Would\x20push\x20','Push\x20local\x20SQL\x20files\x20to\x20remote','sqlName','48274jmcCOR','high-risk-write','dbName','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','dbDirectory','version','set','trashDir','get','lockFilePath','sqls','isFinite','lastSync','598632YizGAs','/smartapi/custom/updateUserCustomSql','sqlConfig','686900JQgmfG','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','filePath'];a161_0x397e=function(){return _0xa616c7;};return a161_0x397e();}async function moveToTrash(_0x3c450d,_0x73cab1,_0x2f53cc){const _0x4ac236=a161_0x428e6a,_0x3ae4cb=new Date()[_0x4ac236(0xf6)]()['replace'](/[:.]/g,'-'),_0x4cf546=relative(_0x3c450d,_0x2f53cc),_0x2cd00a=join(_0x73cab1,_0x3ae4cb,_0x4cf546);return await mkdir(dirname(_0x2cd00a),{'recursive':!![]}),await rename(_0x2f53cc,_0x2cd00a),_0x2cd00a;}async function cleanupEmptyDirectories(_0x3692be,_0x542ef9){let _0x295b7b=resolve(_0x3692be);const _0x5c835c=resolve(_0x542ef9);while(_0x295b7b['startsWith'](''+_0x5c835c+sep)||_0x295b7b===_0x5c835c){if(_0x295b7b===_0x5c835c)return;try{const _0x8ea353=await readdir(_0x295b7b);if(_0x8ea353['length']>0x0)return;await rmdir(_0x295b7b);}catch{return;}_0x295b7b=dirname(_0x295b7b);}}async function resolveTargetDbBinding(_0x6df8da,_0x3b216a,_0x212407){const _0x5e8b61=a161_0x428e6a,_0x332775=_0x3b216a[_0x5e8b61(0x100)];if(!_0x332775)return{'dbId':_0x212407[_0x5e8b61(0xf2)],'dbName':_0x212407[_0x5e8b61(0xfe)]};const _0x422952=buildDbDirectoryName(_0x212407[_0x5e8b61(0xfe)],_0x212407[_0x5e8b61(0xf2)]);if(_0x332775===_0x422952)return{'dbId':_0x212407[_0x5e8b61(0xf2)],'dbName':_0x212407[_0x5e8b61(0xfe)]};const _0x19f22f=parseExplicitDbDirectory(_0x332775);if(_0x19f22f!=null)return{'dbId':_0x19f22f,'dbName':await getDbName(_0x6df8da,_0x19f22f)['catch'](()=>undefined)};const _0x42517f=await listDatabases(_0x6df8da),_0x4a3cd5=_0x42517f[_0x5e8b61(0xf8)](_0x35e853=>buildDbDirectoryName(_0x35e853['dbName'],_0x35e853[_0x5e8b61(0xf2)])===_0x332775);if(_0x4a3cd5[_0x5e8b61(0xf3)]===0x1)return{'dbId':_0x4a3cd5[0x0][_0x5e8b61(0xf2)],'dbName':_0x4a3cd5[0x0][_0x5e8b61(0xfe)]};if(_0x4a3cd5['length']===0x0)throw CliErrors[_0x5e8b61(0xe2)]('No\x20database\x20matches\x20local\x20directory\x20\x22'+_0x332775+_0x5e8b61(0xd4)+_0x3b216a[_0x5e8b61(0xd1)]+'.');const _0x491fd8=_0x4a3cd5[_0x5e8b61(0xcc)](_0x4b5b0b=>_0x4b5b0b[_0x5e8b61(0xfe)]+'\x20('+_0x4b5b0b[_0x5e8b61(0xf2)]+')')['join'](',\x20');throw CliErrors[_0x5e8b61(0xe2)](_0x5e8b61(0xe3)+_0x332775+_0x5e8b61(0xea)+_0x3b216a[_0x5e8b61(0xd1)]+':\x20'+_0x491fd8);}function a161_0x73b8(_0x5bf747,_0x1395da){_0x5bf747=_0x5bf747-0xca;const _0x397e01=a161_0x397e();let _0x73b8a9=_0x397e01[_0x5bf747];return _0x73b8a9;}function parseExplicitDbDirectory(_0x1d1d48){const _0x357c46=a161_0x428e6a,_0x2e8523=/^db-(\d+)$/[_0x357c46(0xf1)](_0x1d1d48);if(!_0x2e8523)return null;const _0x10741f=Number(_0x2e8523[0x1]);return Number[_0x357c46(0x107)](_0x10741f)&&_0x10741f>0x0?_0x10741f:null;}
|
package/lib/commands/sql/save.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a162_0x1cc99b=a162_0x50e4;function a162_0x50e4(_0x3b87f7,_0x23903f){_0x3b87f7=_0x3b87f7-0x159;const _0x146b5e=a162_0x146b();let _0x50e455=_0x146b5e[_0x3b87f7];return _0x50e455;}(function(_0x8bfd2c,_0x3b0c95){const _0x1597d6=a162_0x50e4,_0x3ebbdc=_0x8bfd2c();while(!![]){try{const _0x190b79=-parseInt(_0x1597d6(0x15b))/0x1+-parseInt(_0x1597d6(0x16b))/0x2+parseInt(_0x1597d6(0x15a))/0x3*(-parseInt(_0x1597d6(0x170))/0x4)+-parseInt(_0x1597d6(0x163))/0x5*(parseInt(_0x1597d6(0x16a))/0x6)+parseInt(_0x1597d6(0x171))/0x7*(-parseInt(_0x1597d6(0x164))/0x8)+parseInt(_0x1597d6(0x169))/0x9*(-parseInt(_0x1597d6(0x160))/0xa)+parseInt(_0x1597d6(0x159))/0xb*(parseInt(_0x1597d6(0x168))/0xc);if(_0x190b79===_0x3b0c95)break;else _0x3ebbdc['push'](_0x3ebbdc['shift']());}catch(_0x4371e3){_0x3ebbdc['push'](_0x3ebbdc['shift']());}}}(a162_0x146b,0x5d333));function a162_0x146b(){const _0x3bfbd7=['Query\x20description','Target\x20database\x20—\x20accepts\x20a\x20numeric\x20ID\x20or\x20database\x20name\x20(e.g.\x20ecommerce_db)','5PvHkQC','17432yZPuMz','save','write','sqlname','32118444BXPZgc','198wRWJga','689160RfiqyN','732326IktZVe','SQL\x20query\x20display\x20name','file','description','`rabetbase\x20sql\x20save`\x20has\x20been\x20deprecated.','4MhKWFV','1673mKDeEs','11sCdgTf','1418394OSxmkX','393498TkDOhB','Path\x20to\x20the\x20SQL\x20file','string','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`.','validation','193950CGwhTy'];a162_0x146b=function(){return _0x3bfbd7;};return a162_0x146b();}import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';const SQL_SAVE_DEPRECATED_HINT=[a162_0x1cc99b(0x16f),'Create\x20new\x20SQL\x20with\x20`rabetbase\x20sql\x20create\x20--name\x20<name>\x20--db-id\x20<id>\x20--mode\x20sql|mybatisXml`.',a162_0x1cc99b(0x15e)]['join']('\x0a');export const sqlSave={'service':'sql','command':a162_0x1cc99b(0x165),'description':'Deprecated:\x20use\x20sql\x20create\x20to\x20create\x20and\x20sql\x20push\x20to\x20update','risk':a162_0x1cc99b(0x166),'requiresAuth':![],'requiresAppCode':![],'flags':[{'name':a162_0x1cc99b(0x16d),'type':a162_0x1cc99b(0x15d),'required':!![],'description':a162_0x1cc99b(0x15c)},SQLCODE_FLAG_OPTIONAL,{'name':a162_0x1cc99b(0x167),'type':a162_0x1cc99b(0x15d),'description':a162_0x1cc99b(0x16c)},{'name':'db','type':a162_0x1cc99b(0x15d),'description':a162_0x1cc99b(0x162)},{'name':a162_0x1cc99b(0x16e),'type':a162_0x1cc99b(0x15d),'description':a162_0x1cc99b(0x161)}],async 'validate'(){const _0x36f221=a162_0x1cc99b;throw CliErrors[_0x36f221(0x15f)](SQL_SAVE_DEPRECATED_HINT);},async 'execute'(){const _0x3d8237=a162_0x1cc99b;throw CliErrors[_0x3d8237(0x15f)](SQL_SAVE_DEPRECATED_HINT);}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a163_0x50eb(_0x321d59,_0x5a185c){_0x321d59=_0x321d59-0x112;const _0x257636=a163_0x2576();let _0x50eb90=_0x257636[_0x321d59];return _0x50eb90;}const a163_0x203136=a163_0x50eb;(function(_0x124389,_0x3b9d15){const _0x3be6fa=a163_0x50eb,_0x16a37b=_0x124389();while(!![]){try{const _0x2d9ee7=-parseInt(_0x3be6fa(0x13a))/0x1+-parseInt(_0x3be6fa(0x13d))/0x2+-parseInt(_0x3be6fa(0x139))/0x3+-parseInt(_0x3be6fa(0x11a))/0x4+-parseInt(_0x3be6fa(0x12c))/0x5+-parseInt(_0x3be6fa(0x11d))/0x6+parseInt(_0x3be6fa(0x12a))/0x7;if(_0x2d9ee7===_0x3b9d15)break;else _0x16a37b['push'](_0x16a37b['shift']());}catch(_0x3a5cad){_0x16a37b['push'](_0x16a37b['shift']());}}}(a163_0x2576,0x329d8));import{createInterface}from'node:readline';import{join}from'node:path';import{buildDefaultSqlFileName,buildSqlRelativePath,detectSqlMode}from'../../core/sql-sync/utils.js';function a163_0x2576(){const _0x2ba35c=['sqlRoot','length','136396UcFnJC','replace','sqlCode','.rabetbase/sql','endsWith','syncedAt','\x20[y/N]\x20','stdin','dbId','222168shCZpA','<!--\x20@lovrabet.','--\x20@lovrabet.','994242shyjXV','sqlConfig','trimStart','trim','split','path','fromEntries','apps','join','version','entries','push','question','7904813Rfgnhx','sqlContent','1936525xYEQoq','\x20-->','yes','test','mode','description','toLowerCase','lastSync','filter','mybatisXml','dbName','map','sqlName','465216CtbZkL','90115gZPmrV'];a163_0x2576=function(){return _0x2ba35c;};return a163_0x2576();}export const SQL_LOCAL_REL_DIR=a163_0x203136(0x114);export function buildSqlLockEntry(_0x422d56,_0x228481,_0x274a11,_0x3c45d4){const _0x1d0fcc=a163_0x203136,_0xee4afc=detectSqlMode(_0x228481);return{'path':buildSqlRelativePath(_0x422d56[_0x1d0fcc(0x113)],_0x422d56[_0x1d0fcc(0x138)],_0x3c45d4?.['dbName'],_0xee4afc,_0x422d56['dbId']),'hash':_0x274a11,'remoteId':_0x422d56['id'],'version':_0x422d56[_0x1d0fcc(0x126)],'dbId':Number(_0x422d56['dbId']),'dbName':_0x3c45d4?.[_0x1d0fcc(0x136)],'sqlName':_0x422d56[_0x1d0fcc(0x138)],'sqlConfig':_0x422d56[_0x1d0fcc(0x11e)]??undefined,'mode':_0xee4afc};}export function cloneSqlLockData(_0x45b6b){const _0x39ae76=a163_0x203136;return{'apps':Object[_0x39ae76(0x123)](Object[_0x39ae76(0x127)](_0x45b6b[_0x39ae76(0x124)])[_0x39ae76(0x137)](([_0x3cf06f,_0xfcd67])=>[_0x3cf06f,{'sqlRoot':_0xfcd67[_0x39ae76(0x13b)],'lastSync':_0xfcd67[_0x39ae76(0x133)],'sqls':{..._0xfcd67['sqls']}}]))};}export function ensureRemoteSqlContent(_0x1e7c24){const _0x234026=a163_0x203136;return _0x1e7c24[_0x234026(0x12b)]??'';}export function buildLocalSqlFileContent(_0x3ae017,_0x138a31,_0x5dde61){const _0x2ff207=a163_0x203136,_0x34ff17=_0x5dde61?.[_0x2ff207(0x130)]??detectSqlMode(_0x138a31),_0x1907aa=stripLocalSqlMetadata(_0x138a31,_0x34ff17)[_0x2ff207(0x120)](),_0x2d7cea=[...buildMetadataHeaderLines({'sqlCode':_0x3ae017[_0x2ff207(0x113)],'sqlName':_0x3ae017[_0x2ff207(0x138)],'dbId':_0x3ae017[_0x2ff207(0x119)],'dbName':_0x5dde61?.[_0x2ff207(0x136)],'mode':_0x34ff17,'syncedAt':_0x5dde61?.[_0x2ff207(0x116)],'description':_0x5dde61?.[_0x2ff207(0x131)]},_0x34ff17),'',_0x1907aa],_0x1eaf62=_0x2d7cea[_0x2ff207(0x125)]('\x0a');return _0x1eaf62[_0x2ff207(0x115)]('\x0a')?_0x1eaf62:_0x1eaf62+'\x0a';}export function stripLocalSqlMetadata(_0x3b9b4e,_0x1d3a31){const _0x4c6b67=a163_0x203136,_0x1b47a0=_0x3b9b4e[_0x4c6b67(0x112)](/\r\n/g,'\x0a')[_0x4c6b67(0x121)]('\x0a'),_0x20e2f7=[];let _0x226636=0x0;if(_0x1d3a31===_0x4c6b67(0x135))while(_0x226636<_0x1b47a0[_0x4c6b67(0x13c)]){const _0x2e7f2e=_0x1b47a0[_0x226636]??'';if(/^\s*<!--\s*@lovrabet\./[_0x4c6b67(0x12f)](_0x2e7f2e)){_0x226636++;continue;}if(_0x2e7f2e[_0x4c6b67(0x120)]()===''&&_0x226636>0x0){_0x226636++;continue;}break;}else while(_0x226636<_0x1b47a0['length']){const _0x1c1371=_0x1b47a0[_0x226636]??'';if(/^\s*--\s*@lovrabet\./[_0x4c6b67(0x12f)](_0x1c1371)){_0x226636++;continue;}if(_0x1c1371[_0x4c6b67(0x120)]()===''&&_0x226636>0x0){_0x226636++;continue;}break;}for(;_0x226636<_0x1b47a0[_0x4c6b67(0x13c)];_0x226636++){_0x20e2f7[_0x4c6b67(0x128)](_0x1b47a0[_0x226636]);}return _0x20e2f7[_0x4c6b67(0x125)]('\x0a')[_0x4c6b67(0x11f)]();}export function resolveSqlMode(_0x4be4c3,_0x35384a){const _0x454186=a163_0x203136;if(_0x35384a?.[_0x454186(0x130)])return _0x35384a[_0x454186(0x130)];return detectSqlMode(_0x4be4c3);}export function resolveSqlFileName(_0x365752,_0x1aa543,_0x6b5843){const _0x3261d3=a163_0x203136;if(_0x6b5843?.[_0x3261d3(0x122)])return _0x6b5843['path'];if(_0x6b5843?.[_0x3261d3(0x138)]||_0x6b5843?.['dbName'])return buildSqlRelativePath(_0x365752,_0x6b5843?.[_0x3261d3(0x138)],_0x6b5843?.['dbName'],resolveSqlMode(_0x1aa543,_0x6b5843),_0x6b5843?.['dbId']);return buildDefaultSqlFileName(_0x365752,resolveSqlMode(_0x1aa543,_0x6b5843));}export function resolveSqlLocalDir(_0x1257c9,_0x1cd085){return join(_0x1257c9,SQL_LOCAL_REL_DIR,_0x1cd085);}export async function confirmForceOverwrite(_0x5a3fa1){const _0x1db166=a163_0x203136,_0x545760=createInterface({'input':process[_0x1db166(0x118)],'output':process['stderr']}),_0x1afb04=await new Promise(_0x4a92b2=>{const _0x1c8a5c=_0x1db166;_0x545760[_0x1c8a5c(0x129)](_0x5a3fa1+_0x1c8a5c(0x117),_0x4a92b2);});return _0x545760['close'](),['y',_0x1db166(0x12e)]['includes'](_0x1afb04[_0x1db166(0x120)]()[_0x1db166(0x132)]());}export function findSqlLockScope(_0x4e22ea,_0x482f13){const _0xf4734d=a163_0x203136;return _0x4e22ea[_0xf4734d(0x124)][_0x482f13];}function buildMetadataHeaderLines(_0x52634c,_0x89b6f0){const _0x3778c4=a163_0x203136,_0x5d9453=[['sqlCode',_0x52634c[_0x3778c4(0x113)]],[_0x3778c4(0x138),_0x52634c[_0x3778c4(0x138)]],[_0x3778c4(0x119),_0x52634c[_0x3778c4(0x119)]],[_0x3778c4(0x136),_0x52634c[_0x3778c4(0x136)]],[_0x3778c4(0x130),_0x52634c['mode']],['syncedAt',_0x52634c['syncedAt']],[_0x3778c4(0x131),_0x52634c[_0x3778c4(0x131)]]];if(_0x89b6f0===_0x3778c4(0x135))return _0x5d9453[_0x3778c4(0x134)](([,_0x4b4c5d])=>_0x4b4c5d!==undefined&&_0x4b4c5d!==null&&String(_0x4b4c5d)[_0x3778c4(0x120)]()!=='')[_0x3778c4(0x137)](([_0x3aaae2,_0x2d3efd])=>_0x3778c4(0x11b)+_0x3aaae2+':\x20'+String(_0x2d3efd)+_0x3778c4(0x12d));return _0x5d9453[_0x3778c4(0x134)](([,_0x4cb151])=>_0x4cb151!==undefined&&_0x4cb151!==null&&String(_0x4cb151)['trim']()!=='')['map'](([_0x3bdff0,_0x55876b])=>_0x3778c4(0x11c)+_0x3bdff0+':\x20'+String(_0x55876b));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a164_0x477883=a164_0x26e6;(function(_0x478a63,_0x32891c){const _0x4a2d01=a164_0x26e6,_0x2baae4=_0x478a63();while(!![]){try{const _0x35c045=parseInt(_0x4a2d01(0x144))/0x1+-parseInt(_0x4a2d01(0x156))/0x2+parseInt(_0x4a2d01(0x13e))/0x3+parseInt(_0x4a2d01(0x149))/0x4*(parseInt(_0x4a2d01(0x162))/0x5)+-parseInt(_0x4a2d01(0x153))/0x6+-parseInt(_0x4a2d01(0x13d))/0x7+parseInt(_0x4a2d01(0x15d))/0x8;if(_0x35c045===_0x32891c)break;else _0x2baae4['push'](_0x2baae4['shift']());}catch(_0x44b7e8){_0x2baae4['push'](_0x2baae4['shift']());}}}(a164_0x5c83,0x8b9a4));import{listSqlQueries}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';function a164_0x26e6(_0x349768,_0x26290f){_0x349768=_0x349768-0x13d;const _0x5c8337=a164_0x5c83();let _0x26e6a0=_0x5c8337[_0x349768];return _0x26e6a0;}import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile}from'../../core/sql-sync/lock.js';const PAGE_SIZE=0x64;function a164_0x5c83(){const _0x31f69a=['appCode','paging','totalCount','\x20added,\x20','Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally','4689696AfKQQl','tableData','sqls','344752hFXUwd','sqlName','\x20missing,\x20','map','keys','\x20remote-only','Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','6905744tSieKi','bool','has','relativePath','push','288055GstroF','7102578LwUvYj','921054aVOlWD','lockKey','status','All\x20SQL\x20queries\x20are\x20in\x20sync.','length','read','736501qEwlyh','path','filePath','remote','sqlRoot','44QYQlpk','hash','\x20unchanged','lockFilePath','sqlCode'];a164_0x5c83=function(){return _0x31f69a;};return a164_0x5c83();}async function fetchAllSqlCodes(_0x4ce17b){const _0x5c1f71=a164_0x26e6,_0x1d94dd=[];let _0x5c5358=0x1;while(!![]){const _0x2cdbdd=await listSqlQueries(_0x4ce17b,{'currentPage':_0x5c5358,'pageSize':PAGE_SIZE}),_0x3f88a8=_0x2cdbdd[_0x5c1f71(0x154)]??[];_0x1d94dd['push'](..._0x3f88a8[_0x5c1f71(0x159)](_0x2aa6bb=>_0x2aa6bb[_0x5c1f71(0x14d)]));if(_0x3f88a8[_0x5c1f71(0x142)]===0x0)break;const _0x530158=_0x2cdbdd[_0x5c1f71(0x14f)]?.[_0x5c1f71(0x150)];if(_0x530158!=null?_0x1d94dd[_0x5c1f71(0x142)]>=_0x530158:_0x3f88a8[_0x5c1f71(0x142)]<PAGE_SIZE)break;_0x5c5358++;}return _0x1d94dd;}export const sqlStatus={'service':'sql','command':'status','description':a164_0x477883(0x15c),'risk':a164_0x477883(0x143),'flags':[{'name':a164_0x477883(0x147),'type':'boolean','description':a164_0x477883(0x152)}],async 'execute'(_0x131431){const _0x576db9=a164_0x477883,_0x9beabb=loadSqlProjectConfig(_0x131431['appCode']),_0x2d2c0f=await readSqlLockFile(_0x9beabb[_0x576db9(0x14c)]),{appLock:_0x3abd3a}=ensureSqlLockScope(_0x2d2c0f??createEmptySqlLock(),_0x9beabb['appCode'],_0x9beabb[_0x576db9(0x148)],_0x576db9(0x140)),_0x5e5748=await scanLocalSqlQueries(_0x9beabb),_0x25881a=[],_0x32b3b0=[],_0x357fdd=[],_0x5507e4=[],_0x520045=new Set(_0x5e5748[_0x576db9(0x159)](_0x353f64=>_0x353f64[_0x576db9(0x13f)]));for(const _0x276af3 of _0x5e5748){const _0x50eb63=await computeSqlFileHash(_0x276af3[_0x576db9(0x146)]),_0x20d944=_0x3abd3a[_0x576db9(0x155)][_0x276af3[_0x576db9(0x13f)]],_0x457a59=!!_0x20d944&&_0x20d944[_0x576db9(0x145)]!==_0x276af3[_0x576db9(0x160)],_0x192cf0=!!_0x20d944&&!!_0x276af3[_0x576db9(0x157)]&&_0x20d944[_0x576db9(0x157)]!==_0x276af3[_0x576db9(0x157)];if(!_0x20d944)_0x25881a[_0x576db9(0x161)](_0x276af3[_0x576db9(0x13f)]);else _0x20d944[_0x576db9(0x14a)]!==_0x50eb63||_0x457a59||_0x192cf0?_0x32b3b0[_0x576db9(0x161)](_0x276af3[_0x576db9(0x13f)]):_0x357fdd[_0x576db9(0x161)](_0x276af3['lockKey']);}for(const _0xf49cb9 of Object[_0x576db9(0x15a)](_0x3abd3a[_0x576db9(0x155)])){!_0x520045[_0x576db9(0x15f)](_0xf49cb9)&&_0x5507e4[_0x576db9(0x161)](_0xf49cb9);}const _0x27d666=[];if(_0x131431[_0x576db9(0x15e)]('remote')){const _0x1102bc=await fetchAllSqlCodes(_0x131431[_0x576db9(0x14e)]);for(const _0x4ca1a4 of _0x1102bc){!_0x520045[_0x576db9(0x15f)](_0x4ca1a4)&&!_0x3abd3a[_0x576db9(0x155)][_0x4ca1a4]&&_0x27d666['push'](_0x4ca1a4);}}const _0x1d5569=_0x25881a[_0x576db9(0x142)]===0x0&&_0x32b3b0[_0x576db9(0x142)]===0x0&&_0x5507e4['length']===0x0&&_0x27d666[_0x576db9(0x142)]===0x0;return{'ok':!![],'data':{'added':_0x25881a,'modified':_0x32b3b0,'missing':_0x5507e4,'unchanged':_0x357fdd,'remoteOnly':_0x27d666},'message':_0x1d5569?_0x576db9(0x141):_0x25881a[_0x576db9(0x142)]+_0x576db9(0x151)+_0x32b3b0[_0x576db9(0x142)]+'\x20modified,\x20'+_0x5507e4[_0x576db9(0x142)]+_0x576db9(0x158)+_0x357fdd[_0x576db9(0x142)]+_0x576db9(0x14b)+(_0x27d666[_0x576db9(0x142)]>0x0?',\x20'+_0x27d666['length']+_0x576db9(0x15b):'')};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a165_0x247fa5=a165_0x13c0;function a165_0x13c0(_0x235d74,_0x177eef){_0x235d74=_0x235d74-0x1c1;const _0x562b9a=a165_0x562b();let _0x13c059=_0x562b9a[_0x235d74];return _0x13c059;}(function(_0x530adf,_0x185f05){const _0x241537=a165_0x13c0,_0x47d029=_0x530adf();while(!![]){try{const _0x2d9f22=parseInt(_0x241537(0x1e9))/0x1*(-parseInt(_0x241537(0x1c5))/0x2)+-parseInt(_0x241537(0x1cb))/0x3+-parseInt(_0x241537(0x1d1))/0x4+parseInt(_0x241537(0x1d6))/0x5*(parseInt(_0x241537(0x1e2))/0x6)+parseInt(_0x241537(0x1db))/0x7+parseInt(_0x241537(0x1eb))/0x8+-parseInt(_0x241537(0x1d4))/0x9;if(_0x2d9f22===_0x185f05)break;else _0x47d029['push'](_0x47d029['shift']());}catch(_0x247a48){_0x47d029['push'](_0x47d029['shift']());}}}(a165_0x562b,0x62020));import{readFileSync,existsSync}from'node:fs';import{resolve}from'node:path';import{validateSql}from'../../core/sql-validator.js';import{getDatasetDetail,listDatasets}from'../../core/api-client.js';function a165_0x562b(){const _0x39e472=['sql','SQL\x20schema\x20validation','schemas','push','1840440ERpvdi','Table\x20\x22','isSelectOnly','toLowerCase','tables','valid','1653000RvRljx','type','appCode','360198BTRXNT','reason','5grngOQ','fields','size','tableName','Path\x20to\x20the\x20SQL\x20file\x20to\x20validate','4412205ozLgcY','\x22\x20not\x20found\x20or\x20not\x20accessible','schema:','get','parameters','Provide\x20--file\x20or\x20--sql','trim','4679238PjVObz','sqlType','file','dbtableConfig','flagMissing','cwd','length','7HWokyH','map','4865688LfchCF','isArray','validate','Validate\x20SQL\x20content\x20without\x20saving\x20(type\x20detection,\x20parameter\x20extraction,\x20optional\x20schema\x20check)','str','split','message','schemaWarnings','name','File\x20not\x20found:\x20','validation','filter','157202smohbV','string'];a165_0x562b=function(){return _0x39e472;};return a165_0x562b();}import{CliErrors}from'../../errors.js';import{assertDatasetIsDbTableBacked,filterDbTableBackedDatasets}from'../../commands/dataset/capability.js';export const sqlValidate={'service':a165_0x247fa5(0x1c7),'command':a165_0x247fa5(0x1ed),'description':a165_0x247fa5(0x1ee),'risk':'read','flags':[{'name':a165_0x247fa5(0x1e4),'type':a165_0x247fa5(0x1c6),'description':a165_0x247fa5(0x1da)},{'name':a165_0x247fa5(0x1c7),'type':a165_0x247fa5(0x1c6),'description':'Inline\x20SQL\x20content\x20to\x20validate\x20(alternative\x20to\x20--file)'},{'name':'schemas','type':'string','description':'Comma-separated\x20dataset\x20codes\x20to\x20cross-check\x20table/column\x20names\x20against'}],async 'execute'(_0x1e00d2){const _0xe8347f=a165_0x247fa5,_0x176ca7=_0x1e00d2['str'](_0xe8347f(0x1e4)),_0x2a065e=_0x1e00d2[_0xe8347f(0x1ef)](_0xe8347f(0x1c7));if(!_0x176ca7&&!_0x2a065e)throw CliErrors[_0xe8347f(0x1e6)](_0xe8347f(0x1e4),_0xe8347f(0x1e0));let _0x3e32dd;if(_0x176ca7){const _0x5ebf8f=resolve(process[_0xe8347f(0x1e7)](),_0x176ca7);if(!existsSync(_0x5ebf8f))throw CliErrors[_0xe8347f(0x1c3)](_0xe8347f(0x1c2)+_0x5ebf8f);_0x3e32dd=readFileSync(_0x5ebf8f,'utf-8');}else _0x3e32dd=_0x2a065e;const _0x5d5fea=validateSql(_0x3e32dd),_0x56a5f3={'valid':_0x5d5fea[_0xe8347f(0x1d0)],'sqlType':_0x5d5fea[_0xe8347f(0x1e3)][_0xe8347f(0x1d2)],'isSelectOnly':_0x5d5fea[_0xe8347f(0x1e3)][_0xe8347f(0x1cd)],'isDangerous':_0x5d5fea[_0xe8347f(0x1e3)]['isDangerous'],'tables':_0x5d5fea[_0xe8347f(0x1cf)],'parameters':_0x5d5fea[_0xe8347f(0x1df)],'message':_0x5d5fea[_0xe8347f(0x1f1)]};_0x5d5fea['sqlType']['reason']&&(_0x56a5f3[_0xe8347f(0x1d5)]=_0x5d5fea[_0xe8347f(0x1e3)][_0xe8347f(0x1d5)]);const _0x2a4cfd=_0x1e00d2[_0xe8347f(0x1ef)](_0xe8347f(0x1c9));if(_0x2a4cfd&&_0x5d5fea['valid']){const _0x8439c0=_0x2a4cfd[_0xe8347f(0x1f0)](',')[_0xe8347f(0x1ea)](_0x4607b6=>_0x4607b6[_0xe8347f(0x1e1)]())[_0xe8347f(0x1c4)](Boolean),_0x9de078=[],_0x902cc=filterDbTableBackedDatasets(await listDatasets(_0x1e00d2[_0xe8347f(0x1d3)])),_0x4f307c=new Map(_0x902cc[_0xe8347f(0x1ea)](_0x2cc58b=>[_0x2cc58b[_0xe8347f(0x1e5)]?.[_0xe8347f(0x1d9)]?.[_0xe8347f(0x1ce)](),_0x2cc58b]));for(const _0xc952e2 of _0x5d5fea[_0xe8347f(0x1cf)]){const _0x598e84=_0x4f307c[_0xe8347f(0x1de)](_0xc952e2['toLowerCase']());!_0x598e84&&_0x9de078[_0xe8347f(0x1ca)](_0xe8347f(0x1cc)+_0xc952e2+'\x22\x20not\x20found\x20in\x20any\x20dataset');}for(const _0x203877 of _0x8439c0){let _0x5bab48;try{_0x5bab48=await getDatasetDetail(_0x203877);}catch{_0x9de078[_0xe8347f(0x1ca)]('Dataset\x20\x22'+_0x203877+_0xe8347f(0x1dc));continue;}assertDatasetIsDbTableBacked(_0x5bab48,_0xe8347f(0x1c8));const _0x154f11=Array[_0xe8347f(0x1ec)](_0x5bab48[_0xe8347f(0x1d7)])?_0x5bab48[_0xe8347f(0x1d7)]:[],_0xdb81e9=new Set(_0x154f11[_0xe8347f(0x1ea)](_0x5cc896=>_0x5cc896[_0xe8347f(0x1c1)]?.[_0xe8347f(0x1ce)]())),_0x1c8d40=_0x5bab48['dbtableConfig']?.['tableName']||_0x5bab48[_0xe8347f(0x1d9)]||_0x203877;_0x56a5f3[_0xe8347f(0x1dd)+_0x1c8d40]={'code':_0x203877,'tableName':_0x1c8d40,'fieldCount':_0xdb81e9[_0xe8347f(0x1d8)],'fields':Array['from'](_0xdb81e9)};}_0x9de078[_0xe8347f(0x1e8)]>0x0&&(_0x56a5f3[_0xe8347f(0x1f2)]=_0x9de078);}return{'ok':_0x5d5fea[_0xe8347f(0x1d0)],'data':_0x56a5f3,'message':_0x5d5fea['message']};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a166_0x58a37c=a166_0x5363;function a166_0x5363(_0x5c6b1c,_0x11d4f6){_0x5c6b1c=_0x5c6b1c-0xa8;const _0x596205=a166_0x5962();let _0x536371=_0x596205[_0x5c6b1c];return _0x536371;}(function(_0x474c3c,_0x278a68){const _0x2d3e39=a166_0x5363,_0x53ca58=_0x474c3c();while(!![]){try{const _0x15efe8=-parseInt(_0x2d3e39(0xb6))/0x1+parseInt(_0x2d3e39(0xa8))/0x2+-parseInt(_0x2d3e39(0xb2))/0x3*(parseInt(_0x2d3e39(0xa9))/0x4)+parseInt(_0x2d3e39(0xb5))/0x5+parseInt(_0x2d3e39(0xaa))/0x6+-parseInt(_0x2d3e39(0xad))/0x7*(-parseInt(_0x2d3e39(0xab))/0x8)+-parseInt(_0x2d3e39(0xaf))/0x9;if(_0x15efe8===_0x278a68)break;else _0x53ca58['push'](_0x53ca58['shift']());}catch(_0x13cbc5){_0x53ca58['push'](_0x53ca58['shift']());}}}(a166_0x5962,0x79631));import{buildAppAddFlags,runAppAdd,validateAppName}from'../../commands/common/app-registry.js';function a166_0x5962(){const _0xa7f445=['2997620RHVvqr','846777XtTypY','721118SFkBIx','4660zaypUm','5470878IKjXQA','5734576kwPJIQ','App\x20profile\x20name','7Blubbe','add','3695400UNpvhg','workspace','write','2148JSfBWD','workspace\x20add','name'];a166_0x5962=function(){return _0xa7f445;};return a166_0x5962();}export const workspaceAddDefinition={'service':a166_0x58a37c(0xb0),'command':a166_0x58a37c(0xae),'description':'Register\x20an\x20app\x20profile\x20in\x20the\x20current\x20workspace\x20(or\x20--global)','risk':a166_0x58a37c(0xb1),'requiresAuth':![],'requiresAppCode':![],'args':[{'name':a166_0x58a37c(0xb4),'description':a166_0x58a37c(0xac),'required':!![]}],'flags':buildAppAddFlags(),'validate':_0x19aab1=>validateAppName(_0x19aab1,a166_0x58a37c(0xb3)),'execute':_0x5cc97c=>runAppAdd(_0x5cc97c,a166_0x58a37c(0xb3))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a167_0x70b7de=a167_0x50cd;(function(_0x379d19,_0x4df457){const _0x3ba424=a167_0x50cd,_0x234aa1=_0x379d19();while(!![]){try{const _0x4fa6d5=parseInt(_0x3ba424(0xba))/0x1+-parseInt(_0x3ba424(0xa7))/0x2*(parseInt(_0x3ba424(0xb9))/0x3)+-parseInt(_0x3ba424(0xd9))/0x4*(parseInt(_0x3ba424(0xd4))/0x5)+parseInt(_0x3ba424(0xc0))/0x6*(parseInt(_0x3ba424(0xcf))/0x7)+-parseInt(_0x3ba424(0xdc))/0x8*(parseInt(_0x3ba424(0xbd))/0x9)+parseInt(_0x3ba424(0xd0))/0xa+parseInt(_0x3ba424(0xb1))/0xb*(parseInt(_0x3ba424(0xac))/0xc);if(_0x4fa6d5===_0x4df457)break;else _0x234aa1['push'](_0x234aa1['shift']());}catch(_0xd478f3){_0x234aa1['push'](_0x234aa1['shift']());}}}(a167_0x5bce,0x80298));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';function a167_0x5bce(){const _0x18bf70=['\x20workspace\x20','App\x20\x22','workspace','App\x20profile\x20name\x20to\x20use\x20in\x20this\x20workspace','flag','Initialize\x20the\x20current\x20workspace\x20app\x20binding','locale','apiDir','number','582183nKYRRe','9686230hOgTzd','app','Invalid\x20appcode:\x20','\x20--app\x20','1707715KTbTDz','Locale\x20for\x20this\x20workspace\x20app\x20profile','Risk\x20level\x20for\x20this\x20workspace\x20app\x20profile','trim','appcode','8OUjuJl','env','Use\x20`','7895216eeOklg','App\x20code\x20to\x20bind\x20to\x20this\x20workspace','updated','validation','riskLevel','init','format','53614lTyNdW','workspace.','API\x20directory\x20path\x20for\x20this\x20workspace\x20app\x20profile','\x20workspace\x20use\x20--app\x20<name>`.','isArray','156rKmlsF','defaultApp','keys','string','Missing\x20workspace\x20app\x20selector.','1355178dLzhWN','project','write','\x20(appcode:\x20','str','Switch\x20the\x20current\x20workspace\x20app\x20binding','apps','pageSize','84BqRWEo','292170yTLsdB','defaultFormat','initialized','9cQQUNc','Default\x20output\x20format\x20for\x20this\x20workspace\x20app\x20profile','.\x20Credentials:\x20not\x20written.','6yQRmZv','Workspace\x20','Target\x20environment','object','join','globalConfig'];a167_0x5bce=function(){return _0x18bf70;};return a167_0x5bce();}function a167_0x50cd(_0x503ca8,_0x501db4){_0x503ca8=_0x503ca8-0xa4;const _0x5bce2c=a167_0x5bce();let _0x50cdbc=_0x5bce2c[_0x503ca8];return _0x50cdbc;}import{RISK_LEVEL_VALUES}from'../../constant/risk.js';import{validateAppcode}from'../../commands/common/validate.js';import{readConfigFile,readRawConfigWithLayers,resolveWriteConfigPath,writeConfigFile}from'../../context.js';import{workspaceAddDefinition}from'../../commands/workspace/add.js';import{workspaceRemoveDefinition}from'../../commands/workspace/remove.js';const WORKSPACE_USAGE=CLI_BIN_NAME+'\x20workspace\x20<init|use>\x20--app\x20<name>\x20[--appcode\x20<code>]',SAFE_PROFILE_KEYS=[a167_0x70b7de(0xd8),a167_0x70b7de(0xda),a167_0x70b7de(0xcd),a167_0x70b7de(0xa6),a167_0x70b7de(0xb8),'riskLevel',a167_0x70b7de(0xcc)],workspaceFlags=[{'name':a167_0x70b7de(0xd1),'type':'string','description':a167_0x70b7de(0xc9)},{'name':a167_0x70b7de(0xd8),'type':a167_0x70b7de(0xaf),'description':a167_0x70b7de(0xdd)},{'name':a167_0x70b7de(0xda),'type':'string','description':a167_0x70b7de(0xc2),'enum':[...RABETBASE_ENV_VALUES]},{'name':a167_0x70b7de(0xcd),'type':a167_0x70b7de(0xaf),'description':a167_0x70b7de(0xa9)},{'name':a167_0x70b7de(0xbb),'type':a167_0x70b7de(0xaf),'description':a167_0x70b7de(0xbe),'enum':[...RABETBASE_OUTPUT_FORMAT_VALUES]},{'name':'pageSize','type':a167_0x70b7de(0xce),'description':'Default\x20page\x20size\x20for\x20this\x20workspace\x20app\x20profile'},{'name':a167_0x70b7de(0xa4),'type':a167_0x70b7de(0xaf),'description':a167_0x70b7de(0xd6),'enum':[...RISK_LEVEL_VALUES]},{'name':a167_0x70b7de(0xcc),'type':'string','description':a167_0x70b7de(0xd5)}];function isRecord(_0x5d6b7){const _0x222a3d=a167_0x70b7de;return!!_0x5d6b7&&typeof _0x5d6b7===_0x222a3d(0xc3)&&!Array[_0x222a3d(0xab)](_0x5d6b7);}function assertValidAppcode(_0x14cf3c){const _0x5b1d7d=a167_0x70b7de,{valid:_0x5eaa0f,message:_0x477c1e}=validateAppcode(_0x14cf3c);if(!_0x5eaa0f)throw CliErrors[_0x5b1d7d(0xdf)](_0x5b1d7d(0xd2)+_0x14cf3c,_0x477c1e);}function sanitizeProfile(_0x49d155){if(!isRecord(_0x49d155))return{};const _0x22f478={};for(const _0x2d6871 of SAFE_PROFILE_KEYS){if(_0x49d155[_0x2d6871]!==undefined)_0x22f478[_0x2d6871]=_0x49d155[_0x2d6871];}return _0x22f478;}function cloneProfile(_0x207f34){return isRecord(_0x207f34)?{..._0x207f34}:{};}function collectWorkspaceProfileOverrides(_0xae89a6){const _0x5eb356=a167_0x70b7de,_0x765837={},_0x6f1a1a=_0xae89a6['str'](_0x5eb356(0xda)),_0x58aade=_0xae89a6[_0x5eb356(0xb5)](_0x5eb356(0xcd)),_0x139fa8=_0xae89a6[_0x5eb356(0xb5)](_0x5eb356(0xbb)),_0xa2b42=_0xae89a6[_0x5eb356(0xca)](_0x5eb356(0xb8)),_0x168ee3=_0xae89a6[_0x5eb356(0xb5)](_0x5eb356(0xa4)),_0x2c288f=_0xae89a6[_0x5eb356(0xb5)](_0x5eb356(0xcc));if(_0x6f1a1a)_0x765837['env']=_0x6f1a1a;if(_0x58aade)_0x765837['apiDir']=_0x58aade;if(_0x139fa8)_0x765837[_0x5eb356(0xa6)]=_0x139fa8;if(_0xa2b42!==undefined&&_0xa2b42!=='')_0x765837[_0x5eb356(0xb8)]=Number(_0xa2b42);if(_0x168ee3)_0x765837[_0x5eb356(0xa4)]=_0x168ee3;if(_0x2c288f)_0x765837[_0x5eb356(0xcc)]=_0x2c288f;return _0x765837;}async function validateWorkspaceArgs(_0x1a7b10){const _0x44afee=a167_0x70b7de,_0x139e31=_0x1a7b10[_0x44afee(0xb5)](_0x44afee(0xd1))[_0x44afee(0xd7)](),_0x5bba0f=_0x1a7b10[_0x44afee(0xb5)](_0x44afee(0xd8))[_0x44afee(0xd7)]();if(!_0x139e31&&!_0x5bba0f)throw CliErrors['validation'](_0x44afee(0xb0),'Use\x20`'+CLI_BIN_NAME+'\x20workspace\x20init\x20--appcode\x20<code>`\x20or\x20`'+CLI_BIN_NAME+_0x44afee(0xaa));if(_0x5bba0f)assertValidAppcode(_0x5bba0f);}function resolveKnownApps(){const _0x4441ec=a167_0x70b7de,{config:_0x370f9c,layers:_0x187329}=readRawConfigWithLayers(),_0x17638d=isRecord(_0x370f9c[_0x4441ec(0xb7)])?_0x370f9c[_0x4441ec(0xb7)]:{},_0x5b6c0c=isRecord(_0x187329[_0x4441ec(0xc5)][_0x4441ec(0xb7)])?_0x187329[_0x4441ec(0xc5)]['apps']:{};return{..._0x5b6c0c,..._0x17638d};}async function configureWorkspace(_0x4d0eec,_0x3ddab2){const _0x4d3cd3=a167_0x70b7de,_0x426a4f=_0x4d0eec[_0x4d3cd3(0xb5)](_0x4d3cd3(0xd1))['trim'](),_0x58a62a=_0x4d0eec[_0x4d3cd3(0xb5)](_0x4d3cd3(0xd8))['trim'](),_0x532a38=_0x426a4f||_0x58a62a;if(!_0x532a38)throw CliErrors[_0x4d3cd3(0xdf)](_0x4d3cd3(0xb0),_0x4d3cd3(0xdb)+CLI_BIN_NAME+'\x20workspace\x20init\x20--appcode\x20<code>`\x20or\x20`'+CLI_BIN_NAME+_0x4d3cd3(0xaa));if(_0x58a62a)assertValidAppcode(_0x58a62a);const _0x2ed727=resolveWriteConfigPath(_0x4d3cd3(0xb2)),_0x2dfd2f=readConfigFile(_0x2ed727),_0x24d40f=resolveKnownApps(),_0x820eba=isRecord(_0x2dfd2f[_0x4d3cd3(0xb7)])?{..._0x2dfd2f['apps']}:{},_0x2b185b=cloneProfile(_0x820eba[_0x532a38]),_0x569b26=sanitizeProfile(_0x24d40f[_0x532a38]),_0x292714=_0x58a62a?{}:_0x569b26,_0x4a11bd=_0x58a62a||_0x292714[_0x4d3cd3(0xd8)];if(!_0x4a11bd){const _0x3c4ba1=Object[_0x4d3cd3(0xae)](_0x24d40f),_0x5dfcd6=_0x3c4ba1['length']===0x0?_0x4d3cd3(0xdb)+CLI_BIN_NAME+_0x4d3cd3(0xc6)+_0x3ddab2+_0x4d3cd3(0xd3)+_0x532a38+'\x20--appcode\x20<code>`.':'Pass\x20--appcode\x20<code>,\x20or\x20choose\x20one\x20of:\x20'+_0x3c4ba1[_0x4d3cd3(0xc4)](',\x20');throw CliErrors['validation'](_0x4d3cd3(0xc7)+_0x532a38+'\x22\x20not\x20found.',_0x5dfcd6);}assertValidAppcode(String(_0x4a11bd));const _0x2631c2={..._0x292714,..._0x2b185b,'appcode':String(_0x4a11bd),...collectWorkspaceProfileOverrides(_0x4d0eec)};return _0x820eba[_0x532a38]=_0x2631c2,_0x2dfd2f['apps']=_0x820eba,_0x2dfd2f[_0x4d3cd3(0xad)]=_0x532a38,delete _0x2dfd2f['appcode'],delete _0x2dfd2f['app'],_0x2631c2[_0x4d3cd3(0xda)]&&(_0x2dfd2f[_0x4d3cd3(0xda)]=_0x2631c2[_0x4d3cd3(0xda)]),writeConfigFile(_0x2ed727,_0x2dfd2f),{'ok':!![],'message':_0x4d3cd3(0xc1)+(_0x3ddab2==='init'?_0x4d3cd3(0xbc):_0x4d3cd3(0xde))+':\x20'+_0x532a38+_0x4d3cd3(0xb4)+_0x2631c2[_0x4d3cd3(0xd8)]+').\x20Config:\x20'+_0x2ed727+_0x4d3cd3(0xbf),'data':{'operation':_0x4d3cd3(0xa8)+_0x3ddab2,'configPath':_0x2ed727,'app':_0x532a38,'appcode':_0x2631c2[_0x4d3cd3(0xd8)],'env':_0x2631c2[_0x4d3cd3(0xda)]??null,'credentialsWritten':![]}};}const workspaceInitDefinition={'service':a167_0x70b7de(0xc8),'command':a167_0x70b7de(0xa5),'description':a167_0x70b7de(0xcb),'risk':a167_0x70b7de(0xb3),'requiresAuth':![],'requiresAppCode':![],'args':[],'flags':workspaceFlags,'validate':validateWorkspaceArgs,'execute':_0x33b8b8=>configureWorkspace(_0x33b8b8,a167_0x70b7de(0xa5))},workspaceUseDefinition={'service':a167_0x70b7de(0xc8),'command':'use','description':a167_0x70b7de(0xb6),'risk':'write','requiresAuth':![],'requiresAppCode':![],'args':[],'flags':workspaceFlags,'validate':validateWorkspaceArgs,'execute':_0x5b5a54=>configureWorkspace(_0x5b5a54,'use')};export const workspaceDefinitions=[workspaceInitDefinition,workspaceUseDefinition,workspaceAddDefinition,workspaceRemoveDefinition];export{WORKSPACE_USAGE};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a168_0x117592=a168_0x497b;(function(_0x17a528,_0x5adce0){const _0x4e3fc4=a168_0x497b,_0x13adc6=_0x17a528();while(!![]){try{const _0x3aba02=parseInt(_0x4e3fc4(0x13c))/0x1+-parseInt(_0x4e3fc4(0x13e))/0x2+-parseInt(_0x4e3fc4(0x142))/0x3+-parseInt(_0x4e3fc4(0x13d))/0x4*(-parseInt(_0x4e3fc4(0x140))/0x5)+-parseInt(_0x4e3fc4(0x143))/0x6+parseInt(_0x4e3fc4(0x138))/0x7*(-parseInt(_0x4e3fc4(0x13b))/0x8)+parseInt(_0x4e3fc4(0x141))/0x9;if(_0x3aba02===_0x5adce0)break;else _0x13adc6['push'](_0x13adc6['shift']());}catch(_0x4540ef){_0x13adc6['push'](_0x13adc6['shift']());}}}(a168_0x4743,0x86b27));import{buildAppRemoveFlags,runAppRemove,validateAppName}from'../../commands/common/app-registry.js';function a168_0x497b(_0x106fb1,_0x59e362){_0x106fb1=_0x106fb1-0x134;const _0x47433d=a168_0x4743();let _0x497b12=_0x47433d[_0x106fb1];return _0x497b12;}function a168_0x4743(){const _0x5483bf=['workspace','217903mqWmoQ','high-risk-write','remove','120WswkvL','907772MGnKtY','117652ceAVod','18070PwdRsp','App\x20profile\x20name\x20to\x20remove','90PxhlCC','8455923ytceqE','1219458vQqTNa','5655468PGPUEv','name','Remove\x20an\x20app\x20profile\x20from\x20the\x20current\x20workspace\x20(or\x20--global)','workspace\x20remove'];a168_0x4743=function(){return _0x5483bf;};return a168_0x4743();}export const workspaceRemoveDefinition={'service':a168_0x117592(0x137),'command':a168_0x117592(0x13a),'description':a168_0x117592(0x135),'risk':a168_0x117592(0x139),'requiresAuth':![],'requiresAppCode':![],'args':[{'name':a168_0x117592(0x134),'description':a168_0x117592(0x13f),'required':!![]}],'flags':buildAppRemoveFlags(),'validate':_0x2cfae2=>validateAppName(_0x2cfae2,a168_0x117592(0x136)),'execute':_0x6c0f3e=>runAppRemove(_0x6c0f3e,a168_0x117592(0x136))};
|
package/lib/config/schema.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a169_0x483b99=a169_0x299c;(function(_0x2d1e7d,_0x7022fa){const _0x22cc32=a169_0x299c,_0x4d10d9=_0x2d1e7d();while(!![]){try{const _0x34d2d6=-parseInt(_0x22cc32(0x1f2))/0x1+parseInt(_0x22cc32(0x206))/0x2+parseInt(_0x22cc32(0x202))/0x3*(-parseInt(_0x22cc32(0x1f3))/0x4)+parseInt(_0x22cc32(0x213))/0x5*(parseInt(_0x22cc32(0x20d))/0x6)+parseInt(_0x22cc32(0x215))/0x7+-parseInt(_0x22cc32(0x210))/0x8*(-parseInt(_0x22cc32(0x207))/0x9)+parseInt(_0x22cc32(0x216))/0xa;if(_0x34d2d6===_0x7022fa)break;else _0x4d10d9['push'](_0x4d10d9['shift']());}catch(_0x4f5ed6){_0x4d10d9['push'](_0x4d10d9['shift']());}}}(a169_0x5972,0x89a2a));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';function a169_0x5972(){const _0x2f26ef=['7976YuRMfN','Default\x20output\x20format\x20for\x20this\x20app\x20(profile)','number','8765mnpfWd','defaultFormat','1576491vtGPng','4524700NRMFUy','locale','inherit','apiDir','Locale','appcode','726410lXpcbJ','8bugfeE','Default\x20page\x20size','length','entries','Config\x20key\x20(','string','accessKey','Access\x20key','toLowerCase','map','filter','en-US','join','riskLevel','keys','575205GWErEe','format','API\x20directory\x20path','has','700940EPICyR','3105epjQfL','env','zh-CN','app','Risk\x20level','pageSize','1032kJUjXZ','cookie','defaultApp'];a169_0x5972=function(){return _0x2f26ef;};return a169_0x5972();}import{RISK_LEVEL_VALUES}from'../constant/risk.js';export{DEFAULT_CONFIG_VALUES}from'../constant/defaults.js';export const PROJECT_CREATE_INHERITABLE_KEYS=[a169_0x483b99(0x20e),'accessKey',a169_0x483b99(0x217),a169_0x483b99(0x203),a169_0x483b99(0x200)];export const TOP_LEVEL_CONFIG_KEYS=new Set([a169_0x483b99(0x21b),a169_0x483b99(0x208),a169_0x483b99(0x217),'format','cookie',a169_0x483b99(0x1f9),a169_0x483b99(0x219)]);export const CONFIG_ENUM_VALUES={'env':[...RABETBASE_ENV_VALUES],'format':[...RABETBASE_OUTPUT_FORMAT_VALUES]};export function formatConfigKeyList(_0x19583f){const _0x3fafd7=a169_0x483b99;return[..._0x19583f][_0x3fafd7(0x1ff)](',\x20');}export function getTopLevelConfigKeyList(){return[...TOP_LEVEL_CONFIG_KEYS];}export function isTopLevelConfigKey(_0x338005){const _0x41d053=a169_0x483b99;return TOP_LEVEL_CONFIG_KEYS[_0x41d053(0x205)](_0x338005);}export function getTopLevelConfigKeySummary(){return formatConfigKeyList(getTopLevelConfigKeyList());}export function getConfigCommandKeyDescription(){const _0x2551f9=a169_0x483b99;return _0x2551f9(0x1f7)+getTopLevelConfigKeySummary()+')';}export const APP_PROFILE_FLAG_KEY_MAP={'env':a169_0x483b99(0x208),'apiDir':a169_0x483b99(0x219),'cookie':a169_0x483b99(0x20e),'accessKey':a169_0x483b99(0x1f9),'defaultFormat':a169_0x483b99(0x203),'pageSize':'pageSize','riskLevel':a169_0x483b99(0x200),'locale':'locale'};export function getAppProfileFlagDefs(){const _0x104ba6=a169_0x483b99;return[{'name':_0x104ba6(0x208),'type':'string','description':'Target\x20environment','enum':[...RABETBASE_ENV_VALUES]},{'name':_0x104ba6(0x219),'type':_0x104ba6(0x1f8),'description':_0x104ba6(0x204)},{'name':_0x104ba6(0x20e),'type':_0x104ba6(0x1f8),'description':'Auth\x20cookie','hidden':!![]},{'name':_0x104ba6(0x1f9),'type':_0x104ba6(0x1f8),'description':_0x104ba6(0x1fa),'hidden':!![]},{'name':_0x104ba6(0x214),'type':_0x104ba6(0x1f8),'description':_0x104ba6(0x211),'enum':[...RABETBASE_OUTPUT_FORMAT_VALUES]},{'name':_0x104ba6(0x20c),'type':_0x104ba6(0x212),'description':_0x104ba6(0x1f4)},{'name':_0x104ba6(0x200),'type':_0x104ba6(0x1f8),'description':_0x104ba6(0x20b),'enum':[...RISK_LEVEL_VALUES]},{'name':_0x104ba6(0x217),'type':'string','description':_0x104ba6(0x21a)}];}function a169_0x299c(_0x3c385c,_0x24d867){_0x3c385c=_0x3c385c-0x1f2;const _0x597254=a169_0x5972();let _0x299c4e=_0x597254[_0x3c385c];return _0x299c4e;}export function collectAppProfileOverrides(_0x587bad){const _0x568bbf=a169_0x483b99,_0x3ae221={};for(const [_0x5166aa,_0x2fc321]of Object[_0x568bbf(0x1f6)](APP_PROFILE_FLAG_KEY_MAP)){const _0x1ed482=_0x587bad(_0x5166aa);if(!_0x1ed482)continue;_0x3ae221[_0x2fc321]=_0x2fc321===_0x568bbf(0x20c)?Number(_0x1ed482):_0x1ed482;}return _0x3ae221;}export function buildAppProfileListFields(_0x303969){const _0x556079=a169_0x483b99;return{'env':_0x303969[_0x556079(0x208)]??null,'apiDir':_0x303969[_0x556079(0x219)]??null,'hasCookie':!!_0x303969[_0x556079(0x20e)],'hasAccessKey':!!_0x303969[_0x556079(0x1f9)],'format':_0x303969['format']??null,'pageSize':_0x303969[_0x556079(0x20c)]??null,'riskLevel':_0x303969[_0x556079(0x200)]??null,'locale':_0x303969[_0x556079(0x217)]??null};}export function buildAppDoctorFields(_0x20216e,_0x24ec69){const _0x59a3b2=a169_0x483b99;return{'env':{'value':_0x20216e[_0x59a3b2(0x208)]||_0x24ec69[_0x59a3b2(0x208)],'source':_0x20216e[_0x59a3b2(0x208)]?_0x59a3b2(0x20a):_0x59a3b2(0x218)},'apiDir':{'value':_0x20216e[_0x59a3b2(0x219)]||_0x24ec69[_0x59a3b2(0x219)],'source':_0x20216e[_0x59a3b2(0x219)]?'app':_0x59a3b2(0x218)},'cookie':{'value':_0x20216e[_0x59a3b2(0x20e)]||_0x24ec69[_0x59a3b2(0x20e)],'source':_0x20216e[_0x59a3b2(0x20e)]?_0x59a3b2(0x20a):_0x59a3b2(0x218)},'accessKey':{'value':_0x20216e[_0x59a3b2(0x1f9)]||_0x24ec69[_0x59a3b2(0x1f9)],'source':_0x20216e[_0x59a3b2(0x1f9)]?_0x59a3b2(0x20a):_0x59a3b2(0x218)}};}export function buildCanonicalAppConfig(_0x45afea,_0x1b5df5){const _0x58c2e5=a169_0x483b99,_0x2de5b2=_0x45afea[_0x58c2e5(0x1fc)](_0xcb1fb6=>String(_0xcb1fb6||'')['trim']())[_0x58c2e5(0x1fd)](Boolean);if(_0x2de5b2[_0x58c2e5(0x1f5)]===0x0)return{};const _0x3370cb={};for(const _0x2ba7a4 of _0x2de5b2){_0x3370cb[_0x2ba7a4]=_0x1b5df5?{'appcode':_0x2ba7a4,'env':_0x1b5df5}:{'appcode':_0x2ba7a4};}return{'apps':_0x3370cb,'defaultApp':_0x2de5b2[0x0]};}export function buildCanonicalProjectConfig(_0x5c886e,_0x81d426){const _0x3d9fd1=a169_0x483b99,{appCodes:appCodes=[],env:_0x5fc23d,metadata:_0x3c6b89}=_0x81d426,_0x279776={..._0x5c886e,..._0x3c6b89||{}};delete _0x279776['appcode'],delete _0x279776['app'];if(_0x5fc23d)_0x279776['env']=_0x5fc23d;else!_0x279776[_0x3d9fd1(0x208)]&&(_0x279776[_0x3d9fd1(0x208)]=DEFAULT_CONFIG_VALUES['env']);const _0x291444=buildCanonicalAppConfig(appCodes,_0x279776[_0x3d9fd1(0x208)]);return Object[_0x3d9fd1(0x201)](_0x291444)[_0x3d9fd1(0x1f5)]>0x0&&(_0x279776['apps']=_0x291444['apps'],_0x279776['defaultApp']=_0x291444[_0x3d9fd1(0x20f)]),_0x279776;}const LOCALE_MAP={'zh':a169_0x483b99(0x209),'zh-cn':'zh-CN','zh_cn':'zh-CN','en':a169_0x483b99(0x1fe),'en-us':'en-US','en_us':a169_0x483b99(0x1fe)};export function normalizeLocale(_0x1188a5){const _0xcbdfb7=a169_0x483b99;if(!_0x1188a5)return null;return LOCALE_MAP[_0x1188a5[_0xcbdfb7(0x1fb)]()]??null;}
|
package/lib/constant/cdn.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a170_0xa027(){const _0x4a3a67=['137242ypEgFP','7ZCRTcR','4673034zlHcAK','14901795YFdQPS','97951GbFoan','1788cizaVE','840jqqveC','336mmVBbj','966YZEjgJ','47945bFaLat','10bjuvxQ','5885UuRCVA','https://g.lovrabet.com/dist/rabetbase-cli/config/index.json','140179FKaDmW','4kGgDBL'];a170_0xa027=function(){return _0x4a3a67;};return a170_0xa027();}const a170_0x2c8638=a170_0x1a13;(function(_0x1f605b,_0x5b0818){const _0xc33cbd=a170_0x1a13,_0x5f0206=_0x1f605b();while(!![]){try{const _0x19ce67=parseInt(_0xc33cbd(0x1a3))/0x1*(parseInt(_0xc33cbd(0x1a2))/0x2)+parseInt(_0xc33cbd(0x1a4))/0x3*(parseInt(_0xc33cbd(0x1b0))/0x4)+-parseInt(_0xc33cbd(0x1ab))/0x5*(parseInt(_0xc33cbd(0x1a8))/0x6)+parseInt(_0xc33cbd(0x1a6))/0x7*(-parseInt(_0xc33cbd(0x1a9))/0x8)+-parseInt(_0xc33cbd(0x1a5))/0x9*(-parseInt(_0xc33cbd(0x1ac))/0xa)+parseInt(_0xc33cbd(0x1ad))/0xb*(-parseInt(_0xc33cbd(0x1a7))/0xc)+-parseInt(_0xc33cbd(0x1af))/0xd*(parseInt(_0xc33cbd(0x1aa))/0xe);if(_0x19ce67===_0x5b0818)break;else _0x5f0206['push'](_0x5f0206['shift']());}catch(_0x5115ab){_0x5f0206['push'](_0x5f0206['shift']());}}}(a170_0xa027,0xe5760));function a170_0x1a13(_0x5c4572,_0x41a7b2){_0x5c4572=_0x5c4572-0x1a2;const _0xa0271d=a170_0xa027();let _0x1a13ac=_0xa0271d[_0x5c4572];return _0x1a13ac;}export const CLI_VERSION_POLICY_URL=a170_0x2c8638(0x1ae);
|