@lovrabet/rabetbase-cli 2.3.16-beta.1 → 2.3.16-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- 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/index.js +1 -1
- package/lib/commands/app/list.js +1 -1
- package/lib/commands/app/members-list.js +1 -0
- package/lib/commands/app/remote-directory.js +1 -1
- package/lib/commands/app/shared.js +1 -1
- package/lib/commands/app-config/delete.js +1 -1
- package/lib/commands/app-config/get.js +1 -1
- package/lib/commands/app-config/index.js +1 -1
- package/lib/commands/app-config/list.js +1 -1
- package/lib/commands/app-config/set.js +1 -1
- package/lib/commands/app-config/shared.js +1 -1
- package/lib/commands/auth/index.js +1 -1
- package/lib/commands/bff/create.js +1 -1
- package/lib/commands/bff/delete.js +1 -1
- package/lib/commands/bff/detail.js +1 -1
- package/lib/commands/bff/index.js +1 -1
- package/lib/commands/bff/list.js +1 -1
- package/lib/commands/bff/pull.js +1 -1
- package/lib/commands/bff/push.js +1 -1
- package/lib/commands/bff/status.js +1 -1
- package/lib/commands/cli-skill/index.js +1 -1
- package/lib/commands/cli-update.js +1 -1
- package/lib/commands/codegen/index.js +1 -1
- package/lib/commands/codegen/sdk.js +1 -1
- package/lib/commands/codegen/sql.js +1 -1
- package/lib/commands/common/app-registry.js +1 -1
- package/lib/commands/common/app-selector.js +1 -1
- package/lib/commands/common/async-task.js +1 -1
- package/lib/commands/common/dry-run.js +1 -1
- package/lib/commands/common/flags.js +1 -1
- package/lib/commands/common/local-file.js +1 -1
- package/lib/commands/common/validate.js +1 -1
- package/lib/commands/config/get.js +1 -1
- package/lib/commands/config/index.js +1 -1
- package/lib/commands/config/list.js +1 -1
- package/lib/commands/config/set.js +1 -1
- package/lib/commands/config/shared.js +1 -1
- package/lib/commands/data/filter.js +1 -1
- package/lib/commands/data/getOne.js +1 -1
- package/lib/commands/data/index.js +1 -1
- package/lib/commands/data/shared.js +1 -1
- package/lib/commands/dataset/business-group-update.js +1 -1
- package/lib/commands/dataset/capability.js +1 -1
- package/lib/commands/dataset/delete.js +1 -1
- package/lib/commands/dataset/detail.js +1 -1
- package/lib/commands/dataset/extend-update.js +1 -1
- package/lib/commands/dataset/field-update.js +1 -1
- package/lib/commands/dataset/generate.js +1 -1
- package/lib/commands/dataset/index.js +1 -1
- package/lib/commands/dataset/list.js +1 -1
- package/lib/commands/dataset/operations.js +1 -1
- package/lib/commands/dataset/relation-audit.js +1 -1
- package/lib/commands/dataset/relation-create.js +1 -1
- package/lib/commands/dataset/relation-delete.js +1 -1
- package/lib/commands/dataset/relation-shared.js +1 -1
- package/lib/commands/dataset/relation-update.js +1 -1
- package/lib/commands/dataset/relations.js +1 -1
- package/lib/commands/dataset/rename.js +1 -1
- package/lib/commands/dataset/restore.js +1 -1
- package/lib/commands/db/analysis-batching.js +1 -1
- package/lib/commands/db/analyze-batch-plan.js +1 -1
- package/lib/commands/db/analyze-cancel.js +1 -1
- package/lib/commands/db/analyze-start.js +1 -1
- package/lib/commands/db/analyze-status.js +1 -1
- package/lib/commands/db/create.js +1 -1
- package/lib/commands/db/delete.js +1 -1
- package/lib/commands/db/detail.js +1 -1
- package/lib/commands/db/diff.js +1 -1
- package/lib/commands/db/index.js +1 -1
- package/lib/commands/db/list.js +1 -1
- package/lib/commands/db/shared.js +1 -1
- package/lib/commands/db/tables.js +1 -1
- package/lib/commands/db/test.js +1 -1
- package/lib/commands/db/update.js +1 -1
- package/lib/commands/doctor.js +1 -1
- package/lib/commands/file/index.js +1 -1
- package/lib/commands/init/index.js +1 -1
- package/lib/commands/issue/index.js +1 -1
- package/lib/commands/issue/nudge.js +1 -1
- package/lib/commands/issue/report.js +1 -1
- package/lib/commands/issue/shared.js +1 -1
- package/lib/commands/kb/create.js +1 -1
- package/lib/commands/kb/delete.js +1 -1
- package/lib/commands/kb/detail.js +1 -1
- package/lib/commands/kb/index.js +1 -1
- package/lib/commands/kb/list.js +1 -1
- package/lib/commands/kb/shared.js +1 -1
- package/lib/commands/kb/update.js +1 -1
- package/lib/commands/logs/index.js +1 -1
- package/lib/commands/menu/asset-update.js +1 -1
- package/lib/commands/menu/delete.js +1 -1
- package/lib/commands/menu/external-link-create.js +1 -1
- package/lib/commands/menu/external-link-update.js +1 -1
- package/lib/commands/menu/group-create.js +1 -1
- package/lib/commands/menu/group-update.js +1 -1
- package/lib/commands/menu/index.js +1 -1
- package/lib/commands/menu/list.js +1 -1
- package/lib/commands/menu/move.js +1 -1
- package/lib/commands/menu/regroup-start.js +1 -1
- package/lib/commands/menu/rename.js +1 -1
- package/lib/commands/menu/shared/compare-table.js +1 -1
- package/lib/commands/menu/shared/delete-plan.js +1 -1
- package/lib/commands/menu/shared/facts.js +1 -1
- package/lib/commands/menu/shared/index.js +1 -1
- package/lib/commands/menu/shared/inquirer.js +1 -1
- package/lib/commands/menu/shared/local-pages.js +1 -1
- package/lib/commands/menu/shared/logic.js +1 -1
- package/lib/commands/menu/shared/mutations.js +1 -1
- package/lib/commands/menu/shared/service.js +1 -1
- package/lib/commands/menu/shared/sync-core.js +1 -1
- package/lib/commands/menu/shared/update-core.js +1 -1
- package/lib/commands/menu/shared/valid-url.js +1 -1
- package/lib/commands/menu/sync.js +1 -1
- package/lib/commands/notification/config-list.js +1 -1
- package/lib/commands/notification/index.js +1 -1
- package/lib/commands/ocr/index.js +1 -1
- package/lib/commands/page/generate-start.js +1 -1
- package/lib/commands/page/generate-status.js +1 -1
- package/lib/commands/page/index.js +1 -1
- package/lib/commands/page/pull.js +1 -1
- package/lib/commands/page/push.js +1 -1
- package/lib/commands/page/react/create.js +1 -0
- package/lib/commands/page/react/detail.js +1 -0
- package/lib/commands/page/react/list.js +1 -0
- package/lib/commands/page/react/publish.js +1 -0
- package/lib/commands/page/react/shared.js +1 -0
- package/lib/commands/page/react/syntax.js +1 -0
- package/lib/commands/page/react/template.js +1 -0
- package/lib/commands/page/react/update.js +1 -0
- package/lib/commands/page/relation-audit.js +1 -1
- package/lib/commands/page/restore.js +1 -1
- package/lib/commands/page/shared.js +1 -1
- package/lib/commands/page/standard-page-status.js +1 -1
- package/lib/commands/page/sync.js +1 -1
- package/lib/commands/permit/index.js +1 -1
- package/lib/commands/permit/page-get.js +1 -1
- package/lib/commands/permit/page-set.js +1 -1
- package/lib/commands/permit/role-apis-set.js +1 -1
- package/lib/commands/permit/role-menus-set.js +1 -1
- package/lib/commands/permit/role-menus.js +1 -1
- package/lib/commands/permit/shared.js +1 -1
- package/lib/commands/project/create/enhanced-guided-create.js +1 -1
- package/lib/commands/project/create/format-elapsed.js +1 -1
- package/lib/commands/project/create/main.js +1 -1
- package/lib/commands/project/create/non-interactive.js +1 -1
- package/lib/commands/project/create/project-template-path.js +1 -1
- package/lib/commands/project/create/use-copy-project-template.js +1 -1
- package/lib/commands/project/create/use-format-code.js +1 -1
- package/lib/commands/project/create/use-install-dependencies.js +1 -1
- package/lib/commands/project/index.js +1 -1
- package/lib/commands/project/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/shared.js +1 -1
- package/lib/commands/sql/status.js +1 -1
- package/lib/commands/sql/validate.js +1 -1
- package/lib/commands/task/index.js +1 -1
- package/lib/commands/task/status.js +1 -1
- package/lib/commands/tenant/index.js +1 -0
- package/lib/commands/tenant/members-list.js +1 -0
- package/lib/commands/tenant/shared.js +1 -0
- package/lib/commands/workspace/add.js +1 -1
- package/lib/commands/workspace/index.js +1 -1
- package/lib/commands/workspace/remove.js +1 -1
- package/lib/config/schema.js +1 -1
- package/lib/constant/cdn.js +1 -1
- package/lib/constant/cli.js +1 -1
- package/lib/constant/defaults.js +1 -1
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/constant/output.js +1 -1
- package/lib/constant/paths.js +1 -1
- package/lib/constant/risk.js +1 -1
- package/lib/context/app-resolver.js +1 -1
- package/lib/context/auth-resolver.js +1 -1
- package/lib/context/config-loader.js +1 -1
- package/lib/context.js +1 -1
- package/lib/core/alias-resolver.js +1 -1
- package/lib/core/api-client.js +1 -1
- package/lib/core/bff/config.js +1 -1
- package/lib/core/bff/file-system.js +1 -1
- package/lib/core/bff/hash.js +1 -1
- package/lib/core/bff/lock.js +1 -1
- package/lib/core/bff/utils.js +1 -1
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/page/file-system.js +1 -1
- package/lib/core/page/hash.js +1 -1
- package/lib/core/page/lock.js +1 -1
- package/lib/core/sql-index-auditor.js +1 -1
- package/lib/core/sql-sync/config.js +1 -1
- package/lib/core/sql-sync/file-system.js +1 -1
- package/lib/core/sql-sync/hash.js +1 -1
- package/lib/core/sql-sync/lock.js +1 -1
- package/lib/core/sql-sync/utils.js +1 -1
- package/lib/core/sql-validator.js +1 -1
- package/lib/errors.js +1 -1
- package/lib/framework/build-all-flags.js +1 -1
- package/lib/framework/error-output.js +1 -1
- package/lib/framework/explicit-yes.js +1 -1
- package/lib/framework/flags.js +1 -1
- package/lib/framework/help.js +1 -1
- package/lib/framework/index.js +1 -1
- package/lib/framework/output.js +1 -1
- package/lib/framework/response.js +1 -1
- package/lib/framework/runner-alias.js +1 -1
- package/lib/framework/runner.js +1 -1
- package/lib/framework/schema-export.js +1 -1
- package/lib/framework/types.js +1 -1
- package/lib/generated/build-info.js +1 -1
- package/lib/help.js +1 -1
- package/lib/skills/main.js +1 -1
- package/lib/skills/npx-skills-add.js +1 -1
- package/lib/skills/skill-presence.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 +2 -2
- package/templates/projects/sub-app-react-demo/CHANGELOG.md +1 -1
- package/templates/projects/sub-app-react-demo/README.md +1 -1
- package/templates/projects/sub-app-react-demo/docs/quick-start.md +1 -1
- package/templates/projects/sub-app-react-demo/src/pages/index.tsx +1 -1
- package/lib/commands/app/add.js +0 -1
- package/lib/commands/app/remove.js +0 -1
- package/lib/commands/project/init.js +0 -1
- package/lib/commands/sql/save.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a218_0x44494d=a218_0xe969;(function(_0x57e83d,_0x4f5486){const _0x356f87=a218_0xe969,_0x340212=_0x57e83d();while(!![]){try{const _0xcbda3=parseInt(_0x356f87(0xdb))/0x1+-parseInt(_0x356f87(0xe9))/0x2+-parseInt(_0x356f87(0xca))/0x3*(-parseInt(_0x356f87(0xc7))/0x4)+-parseInt(_0x356f87(0xda))/0x5+-parseInt(_0x356f87(0xc8))/0x6*(-parseInt(_0x356f87(0xc6))/0x7)+-parseInt(_0x356f87(0xe3))/0x8+parseInt(_0x356f87(0xe4))/0x9*(parseInt(_0x356f87(0xcc))/0xa);if(_0xcbda3===_0x4f5486)break;else _0x340212['push'](_0x340212['shift']());}catch(_0xc14488){_0x340212['push'](_0x340212['shift']());}}}(a218_0x1fe5,0xd2da9));import{access,mkdir,readdir,stat}from'node:fs/promises';import{constants}from'node:fs';import{dirname,join}from'node:path';import{findHookLocationByRemoteId,snakeToCamel}from'../../core/bff/utils.js';export const SUPPORTED_BFF_TYPES=[a218_0x44494d(0xe8),'ENDPOINT',a218_0x44494d(0xcd)];export function normalizeBffType(_0x41932f){const _0xb1804=a218_0x44494d;if(!_0x41932f)return undefined;const _0x4a66d3=_0x41932f[_0xb1804(0xd1)]()[_0xb1804(0xde)]();return SUPPORTED_BFF_TYPES['includes'](_0x4a66d3)?_0x4a66d3:undefined;}async function scanJsFilesRecursively(_0x5e7768,_0x3874bc){const _0x390b10=a218_0x44494d,_0x3f5859=[];try{const _0x3e90dd=await readdir(_0x5e7768,{'withFileTypes':!![]});for(const _0x55da02 of _0x3e90dd){const _0x27ee36=join(_0x5e7768,_0x55da02[_0x390b10(0xe0)]);if(_0x55da02[_0x390b10(0xe2)]())_0x3f5859[_0x390b10(0xd9)](...await scanJsFilesRecursively(_0x27ee36,_0x3874bc+'/'+_0x55da02[_0x390b10(0xe0)]));else _0x55da02['isFile']()&&_0x55da02[_0x390b10(0xe0)][_0x390b10(0xc9)](_0x390b10(0xd7))&&_0x3f5859[_0x390b10(0xd9)]({'lockKey':_0x3874bc+'/'+_0x55da02[_0x390b10(0xe0)][_0x390b10(0xdf)](/\.js$/,''),'filePath':_0x27ee36});}}catch(_0x1128a2){if(_0x1128a2[_0x390b10(0xea)]!=='ENOENT')throw _0x1128a2;}return _0x3f5859;}async function scanFlatFunctions(_0x22b74c,_0x1c71e2){const _0x4810f7=a218_0x44494d,_0x5e77bd=join(_0x22b74c['scriptsRootDir'],_0x1c71e2),_0x51e61c=await scanJsFilesRecursively(_0x5e77bd,_0x1c71e2);return _0x51e61c[_0x4810f7(0xdc)](({lockKey:_0x484206,filePath:_0x588fe7})=>({'type':_0x1c71e2,'name':_0x484206[_0x4810f7(0xd5)]('/')['at'](-0x1)??'','filePath':_0x588fe7,'lockKey':_0x484206}));}async function scanHookFunctions(_0x1e1fe1){const _0x263f14=a218_0x44494d,_0x389646=join(_0x1e1fe1[_0x263f14(0xd0)],_0x263f14(0xcd)),_0x1c66e3=[];try{const _0x19582b=await readdir(_0x389646,{'withFileTypes':!![]});for(const _0x408bd0 of _0x19582b){if(!_0x408bd0[_0x263f14(0xe2)]())continue;const _0x5426c7=_0x408bd0[_0x263f14(0xe0)],_0x37faf9=join(_0x389646,_0x5426c7),_0x266e03=await readdir(_0x37faf9,{'withFileTypes':!![]});for(const _0x4d365b of _0x266e03){if(!_0x4d365b[_0x263f14(0xe2)]())continue;const _0x57b265=_0x4d365b[_0x263f14(0xe0)],_0x2991b1=join(_0x37faf9,_0x57b265),_0x28341d=await readdir(_0x2991b1,{'withFileTypes':!![]});for(const _0x1f2e17 of _0x28341d){if(!_0x1f2e17[_0x263f14(0xe2)]())continue;const _0x50902c=_0x1f2e17['name'],_0x27488b=join(_0x2991b1,_0x50902c),_0x32d0a8=await readdir(_0x27488b,{'withFileTypes':!![]});for(const _0x12929b of _0x32d0a8){if(!_0x12929b[_0x263f14(0xd2)]()||!_0x12929b[_0x263f14(0xe0)]['endsWith']('.js'))continue;const _0x4009df=_0x12929b['name'][_0x263f14(0xdf)](/\.js$/,'');_0x1c66e3[_0x263f14(0xd9)]({'type':_0x263f14(0xcd),'name':_0x4009df,'filePath':join(_0x27488b,_0x12929b[_0x263f14(0xe0)]),'lockKey':_0x263f14(0xd4)+_0x5426c7+'/'+_0x57b265+'/'+_0x50902c+'/'+_0x4009df,'alias':_0x5426c7,'operationType':_0x57b265,'functionNode':_0x50902c});}}}}}catch(_0x1295a0){if(_0x1295a0[_0x263f14(0xea)]!=='ENOENT')throw _0x1295a0;}return _0x1c66e3;}export async function scanLocalBffFunctions(_0x516550,_0x2bcf53){const _0x12cfdb=a218_0x44494d;if(_0x2bcf53==='COMMON'||_0x2bcf53===_0x12cfdb(0xce))return scanFlatFunctions(_0x516550,_0x2bcf53);if(_0x2bcf53===_0x12cfdb(0xcd))return scanHookFunctions(_0x516550);const [_0x321aa3,_0x11f697,_0x3837d8]=await Promise['all']([scanFlatFunctions(_0x516550,_0x12cfdb(0xe8)),scanFlatFunctions(_0x516550,'ENDPOINT'),scanHookFunctions(_0x516550)]);return[..._0x321aa3,..._0x11f697,..._0x3837d8];}function a218_0x1fe5(){const _0x359ea6=['4991215wiIPFH','1200277crPQxH','map','after','toUpperCase','replace','name','datasetCode','isDirectory','10358704sAxwCX','24858FTHRNL','operationType','before','functionName','COMMON','1577352skcELp','code','36631jPQtsL','11652rsrHGb','150UbHWUJ','endsWith','468nomMOb','functionNode','7820seAJsZ','HOOK','ENDPOINT','scriptType','scriptsRootDir','trim','isFile','F_OK','HOOK/','split','afterScriptId','.js','beforeScriptId','push'];a218_0x1fe5=function(){return _0x359ea6;};return a218_0x1fe5();}export function resolveLocalFilePathFromLockKey(_0x4db779,_0x3071d6){const _0x64ac82=a218_0x44494d;return join(_0x4db779['scriptsRootDir'],..._0x3071d6[_0x64ac82(0xd5)]('/'))+_0x64ac82(0xd7);}function a218_0xe969(_0xc5c451,_0x2d9802){_0xc5c451=_0xc5c451-0xc6;const _0x1fe55a=a218_0x1fe5();let _0xe96958=_0x1fe55a[_0xc5c451];return _0xe96958;}export function createHookLocationMap(_0x331b4b){const _0x4570b7=a218_0x44494d,_0x4a0ce6=new Map();for(const _0x5b78d8 of _0x331b4b){_0x5b78d8[_0x4570b7(0xd8)]&&_0x4a0ce6['set'](_0x5b78d8[_0x4570b7(0xd8)],{'datasetCode':_0x5b78d8[_0x4570b7(0xe1)],'operationType':snakeToCamel(_0x5b78d8[_0x4570b7(0xe5)]),'functionNode':_0x4570b7(0xe6)}),_0x5b78d8[_0x4570b7(0xd6)]&&_0x4a0ce6['set'](_0x5b78d8[_0x4570b7(0xd6)],{'datasetCode':_0x5b78d8[_0x4570b7(0xe1)],'operationType':snakeToCamel(_0x5b78d8[_0x4570b7(0xe5)]),'functionNode':_0x4570b7(0xdd)});}return _0x4a0ce6;}export function resolveRemoteScriptTarget(_0x289a21,_0x1055fb,_0x3597c1,_0x34f27c,_0x369554){const _0x4f8d63=a218_0x44494d,_0x46f7c2=normalizeBffType(_0x1055fb[_0x4f8d63(0xcf)]);if(!_0x46f7c2||!_0x1055fb[_0x4f8d63(0xe7)])return null;if(_0x46f7c2==='HOOK'){const _0x176495=(_0x1055fb['id']?_0x3597c1['get'](_0x1055fb['id']):undefined)??findHookLocationByRemoteId(_0x34f27c,_0x1055fb['id']);if(!_0x176495)return null;const _0x3c7031=_0x176495['alias']||_0x369554['get'](_0x176495[_0x4f8d63(0xe1)]),_0x1af8a2=_0x3c7031??_0x176495[_0x4f8d63(0xe1)],_0x1d9e03={..._0x176495,'alias':_0x3c7031},_0x2fc87c=_0x4f8d63(0xd4)+_0x1af8a2+'/'+_0x1d9e03[_0x4f8d63(0xe5)]+'/'+_0x1d9e03[_0x4f8d63(0xcb)]+'/'+_0x1055fb[_0x4f8d63(0xe7)];return{'lockKey':_0x2fc87c,'filePath':resolveLocalFilePathFromLockKey(_0x289a21,_0x2fc87c),'type':_0x4f8d63(0xcd),'hookLocation':_0x1d9e03};}const _0x4c6b48=_0x46f7c2+'/'+_0x1055fb['functionName'];return{'lockKey':_0x4c6b48,'filePath':resolveLocalFilePathFromLockKey(_0x289a21,_0x4c6b48),'type':_0x46f7c2};}export async function ensureParentDirectory(_0xa09c8a){await mkdir(dirname(_0xa09c8a),{'recursive':!![]});}export async function fileExists(_0x55c210){const _0x226cd8=a218_0x44494d;try{return await access(_0x55c210,constants[_0x226cd8(0xd3)]),!![];}catch{return![];}}export async function directoryExists(_0x3e8f45){const _0x139708=a218_0x44494d;try{const _0x18510a=await stat(_0x3e8f45);return _0x18510a[_0x139708(0xe2)]();}catch{return![];}}
|
package/lib/core/bff/hash.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x314720,_0x2322e1){const _0x3b840a=a219_0x4413,_0x55a7ed=_0x314720();while(!![]){try{const _0x1a243b=-parseInt(_0x3b840a(0x8a))/0x1+-parseInt(_0x3b840a(0x81))/0x2*(-parseInt(_0x3b840a(0x7e))/0x3)+parseInt(_0x3b840a(0x82))/0x4+parseInt(_0x3b840a(0x7f))/0x5+-parseInt(_0x3b840a(0x88))/0x6*(parseInt(_0x3b840a(0x89))/0x7)+-parseInt(_0x3b840a(0x83))/0x8*(-parseInt(_0x3b840a(0x84))/0x9)+-parseInt(_0x3b840a(0x87))/0xa;if(_0x1a243b===_0x2322e1)break;else _0x55a7ed['push'](_0x55a7ed['shift']());}catch(_0x112bca){_0x55a7ed['push'](_0x55a7ed['shift']());}}}(a219_0x5073,0x1bcd6));import{readFile}from'node:fs/promises';import a219_0x1ea394 from'node:crypto';export function computeContentHash(_0x3eb53e){const _0x36ec41=a219_0x4413;return a219_0x1ea394[_0x36ec41(0x86)]('md5')[_0x36ec41(0x85)](_0x3eb53e)['digest']('hex');}export async function computeFileHash(_0x888362){const _0x5857c8=a219_0x4413,_0x15e062=await readFile(_0x888362,_0x5857c8(0x80));return computeContentHash(_0x15e062);}function a219_0x4413(_0x2f71e6,_0x55cf59){_0x2f71e6=_0x2f71e6-0x7e;const _0x50739b=a219_0x5073();let _0x44139f=_0x50739b[_0x2f71e6];return _0x44139f;}function a219_0x5073(){const _0x537100=['utf8','2GGIBDX','744672hgMOcx','889736vxJvbh','9miBMxg','update','createHash','2358360OKYPxk','24RcXxfw','1295jSaAIH','225910rtZwom','578559rPHoZR','430630KaIoag'];a219_0x5073=function(){return _0x537100;};return a219_0x5073();}
|
package/lib/core/bff/lock.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x5949e0,_0x4cb3e8){const _0x132bb8=a220_0x6de9,_0x48839d=_0x5949e0();while(!![]){try{const _0x24d602=-parseInt(_0x132bb8(0x9b))/0x1*(-parseInt(_0x132bb8(0x9e))/0x2)+-parseInt(_0x132bb8(0x94))/0x3+-parseInt(_0x132bb8(0x98))/0x4+-parseInt(_0x132bb8(0x9f))/0x5*(-parseInt(_0x132bb8(0x92))/0x6)+-parseInt(_0x132bb8(0x90))/0x7*(-parseInt(_0x132bb8(0x96))/0x8)+-parseInt(_0x132bb8(0x95))/0x9*(-parseInt(_0x132bb8(0x8e))/0xa)+-parseInt(_0x132bb8(0x9c))/0xb;if(_0x24d602===_0x4cb3e8)break;else _0x48839d['push'](_0x48839d['shift']());}catch(_0x452450){_0x48839d['push'](_0x48839d['shift']());}}}(a220_0x45f3,0xd854b));import{mkdir,readFile,writeFile}from'node:fs/promises';import{dirname}from'node:path';function a220_0x6de9(_0x1d3330,_0x341a8f){_0x1d3330=_0x1d3330-0x8d;const _0x45f3ed=a220_0x45f3();let _0x6de92b=_0x45f3ed[_0x1d3330];return _0x6de92b;}function a220_0x45f3(){const _0x260d8b=['19687228qyjyiH','scriptsRoot','7934QgWPxL','674715WinOmf','code','\x22.\x20','lastSync','functions','apps','\x22\x20vs\x20lock\x20\x22','Check\x20.rabetbase/bff.lock.json\x20or\x20operate\x20from\x20the\x20correct\x20project\x20directory.','15014330FPYEga','parse','294301hHnXpX','object','66gTFEZQ','current\x20\x22','4703010LJquye','9mhLZFf','40ZYpJAw','utf8','2284192UwjgiT',':\x20scriptsRoot\x20mismatch\x20—\x20','stringify','408GzpVDM'];a220_0x45f3=function(){return _0x260d8b;};return a220_0x45f3();}export function createEmptyBffLock(){return{'apps':{}};}export function ensureLockScope(_0x2d6d83,_0x3f45d6,_0x26440a,_0x6bd328){const _0x11a02e=a220_0x6de9,_0x496712={'apps':_0x2d6d83[_0x11a02e(0xa4)]&&typeof _0x2d6d83['apps']==='object'?_0x2d6d83['apps']:{}};let _0x2e8b90=_0x496712[_0x11a02e(0xa4)][_0x3f45d6];if(!_0x2e8b90)return _0x2e8b90={'scriptsRoot':_0x26440a,'lastSync':'','functions':{}},_0x496712[_0x11a02e(0xa4)][_0x3f45d6]=_0x2e8b90,{'lockData':_0x496712,'appLock':_0x2e8b90};if(!_0x2e8b90[_0x11a02e(0x9d)])_0x2e8b90[_0x11a02e(0x9d)]=_0x26440a;else{if(_0x2e8b90[_0x11a02e(0x9d)]!==_0x26440a)throw new Error(_0x6bd328+_0x11a02e(0x99)+(_0x11a02e(0x93)+_0x26440a+_0x11a02e(0xa5)+_0x2e8b90[_0x11a02e(0x9d)]+_0x11a02e(0xa1))+_0x11a02e(0x8d));}return!_0x2e8b90[_0x11a02e(0xa3)]&&(_0x2e8b90[_0x11a02e(0xa3)]={}),!_0x2e8b90[_0x11a02e(0xa2)]&&(_0x2e8b90[_0x11a02e(0xa2)]=''),{'lockData':_0x496712,'appLock':_0x2e8b90};}export async function readBffLockFile(_0x10ca27){const _0x39fb43=a220_0x6de9;try{const _0x2f520e=await readFile(_0x10ca27,_0x39fb43(0x97)),_0x5d8a2f=JSON[_0x39fb43(0x8f)](_0x2f520e);return{'apps':_0x5d8a2f['apps']&&typeof _0x5d8a2f[_0x39fb43(0xa4)]===_0x39fb43(0x91)?_0x5d8a2f[_0x39fb43(0xa4)]:{}};}catch(_0x945d20){if(_0x945d20[_0x39fb43(0xa0)]==='ENOENT')return null;throw new Error('Failed\x20to\x20read\x20BFF\x20lock\x20file:\x20'+String(_0x945d20));}}export async function writeBffLockFile(_0x199776,_0x3387da){const _0x4e83a9=a220_0x6de9;await mkdir(dirname(_0x199776),{'recursive':!![]}),await writeFile(_0x199776,JSON[_0x4e83a9(0x9a)](_0x3387da,null,0x2),_0x4e83a9(0x97));}
|
package/lib/core/bff/utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a222_0xdf66(_0x45197a,_0x2d0cbd){_0x45197a=_0x45197a-0xfd;const _0x41eb2f=a222_0x41eb();let _0xdf666=_0x41eb2f[_0x45197a];return _0xdf666;}(function(_0x3d3eed,_0x4cccf2){const _0x10e32e=a222_0xdf66,_0xb02c81=_0x3d3eed();while(!![]){try{const _0x2dc2b3=-parseInt(_0x10e32e(0x110))/0x1*(-parseInt(_0x10e32e(0x102))/0x2)+-parseInt(_0x10e32e(0x104))/0x3+-parseInt(_0x10e32e(0x10d))/0x4+-parseInt(_0x10e32e(0x112))/0x5*(parseInt(_0x10e32e(0x103))/0x6)+-parseInt(_0x10e32e(0xff))/0x7+parseInt(_0x10e32e(0x106))/0x8*(parseInt(_0x10e32e(0x111))/0x9)+parseInt(_0x10e32e(0x108))/0xa;if(_0x2dc2b3===_0x4cccf2)break;else _0xb02c81['push'](_0xb02c81['shift']());}catch(_0x5af131){_0xb02c81['push'](_0xb02c81['shift']());}}}(a222_0x41eb,0x78611));export function snakeToCamel(_0x42daab){const _0x1a37a3=a222_0xdf66;return _0x42daab[_0x1a37a3(0xfe)]()[_0x1a37a3(0x10c)](/_([a-z])/g,(_0xe89aba,_0x1e3f64)=>_0x1e3f64[_0x1a37a3(0x10a)]());}export function findHookLocationByRemoteId(_0x3905eb,_0x570515){const _0x56651c=a222_0xdf66;if(!_0x570515)return undefined;for(const _0x194f14 of Object[_0x56651c(0x105)](_0x3905eb)){if(_0x194f14[_0x56651c(0x10f)]===_0x570515&&_0x194f14[_0x56651c(0xfd)]&&_0x194f14[_0x56651c(0x101)]&&_0x194f14[_0x56651c(0x109)])return{'datasetCode':_0x194f14[_0x56651c(0xfd)],'operationType':_0x194f14['operationType'],'functionNode':_0x194f14['functionNode']};}return undefined;}export function extractScriptDescription(_0x14b783){const _0x4a43c3=a222_0xdf66,_0x4bb2ce=_0x14b783[_0x4a43c3(0x10b)](/\[\s*脚本描述\s*]\s*(.+)/);return _0x4bb2ce?.[0x1]?.[_0x4a43c3(0x10e)]()||undefined;}export function isValidBffFunctionName(_0x4561b3){const _0x20198f=a222_0xdf66;return/^[A-Za-z_$][A-Za-z0-9_$]*$/[_0x20198f(0x100)](_0x4561b3);}export function normalizeHookFunctionNode(_0x8ab0f1){const _0x3d132a=a222_0xdf66;if(!_0x8ab0f1)return undefined;const _0x414866=_0x8ab0f1[_0x3d132a(0x10e)]()[_0x3d132a(0xfe)]();if(_0x414866===_0x3d132a(0x107)||_0x414866==='after')return _0x414866;return undefined;}function a222_0x41eb(){const _0x3f9e4e=['2429036mvimli','trim','remoteId','7JVEjlM','9qEtcks','45UWwjgI','datasetCode','toLowerCase','4568690YwUIAA','test','operationType','256642ffcrEc','117954ZzBWRe','1900863UamOxA','values','6221704TxoHdv','before','8875940hfMVcp','functionNode','toUpperCase','match','replace'];a222_0x41eb=function(){return _0x3f9e4e;};return a222_0x41eb();}
|
package/lib/core/db-resolver.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x2f5867,_0x3c81a1){const _0x43cfa6=a223_0x30cb,_0x3e8338=_0x2f5867();while(!![]){try{const _0x1bca8e=-parseInt(_0x43cfa6(0x86))/0x1+-parseInt(_0x43cfa6(0x89))/0x2+parseInt(_0x43cfa6(0x7c))/0x3+parseInt(_0x43cfa6(0x83))/0x4+parseInt(_0x43cfa6(0x75))/0x5*(-parseInt(_0x43cfa6(0x74))/0x6)+parseInt(_0x43cfa6(0x8e))/0x7*(-parseInt(_0x43cfa6(0x7a))/0x8)+parseInt(_0x43cfa6(0x80))/0x9;if(_0x1bca8e===_0x3c81a1)break;else _0x3e8338['push'](_0x3e8338['shift']());}catch(_0x14e053){_0x3e8338['push'](_0x3e8338['shift']());}}}(a223_0x3cd9,0x1c85e));import{listDatasets}from'../core/api-client.js';const cache=new Map();function a223_0x30cb(_0x462989,_0x21ec92){_0x462989=_0x462989-0x71;const _0x3cd9f5=a223_0x3cd9();let _0x30cbad=_0x3cd9f5[_0x462989];return _0x30cbad;}export async function listDatabases(_0x3563d8){const _0x5c6086=a223_0x30cb;if(cache[_0x5c6086(0x73)](_0x3563d8))return cache['get'](_0x3563d8);const _0xded5a4=await listDatasets(_0x3563d8),_0x16929a=new Map();for(const _0x20a644 of _0xded5a4){const _0x43a152=_0x20a644[_0x5c6086(0x81)];_0x43a152?.[_0x5c6086(0x71)]!=null&&_0x16929a['set'](_0x43a152[_0x5c6086(0x71)],_0x43a152[_0x5c6086(0x87)]??_0x5c6086(0x7e)+_0x43a152['dbId']);}const _0xb40526=[..._0x16929a[_0x5c6086(0x79)]()]['map'](([_0xbdb2d6,_0x275db7])=>({'dbId':_0xbdb2d6,'dbName':_0x275db7}));return cache[_0x5c6086(0x76)](_0x3563d8,_0xb40526),_0xb40526;}export async function resolveDb(_0x1249cb,_0x3b118f){const _0x4cb207=a223_0x30cb,_0x13c30f=await listDatabases(_0x1249cb);if(_0x13c30f[_0x4cb207(0x78)]===0x0)return{'resolved':[],'error':_0x4cb207(0x88)+_0x1249cb+'\x22.\x20Make\x20sure\x20datasets\x20have\x20been\x20created.'};if(!_0x3b118f)return{'resolved':_0x13c30f};const _0x4e512e=Number(_0x3b118f);if(!Number['isNaN'](_0x4e512e)){const _0x5ca017=_0x13c30f[_0x4cb207(0x84)](_0x5b7395=>_0x5b7395[_0x4cb207(0x71)]===_0x4e512e);if(_0x5ca017)return{'resolved':[_0x5ca017]};}const _0x396d4c=_0x3b118f[_0x4cb207(0x7f)](),_0x1fe662=_0x13c30f[_0x4cb207(0x8b)](_0x9941c1=>_0x9941c1[_0x4cb207(0x87)]['toLowerCase']()[_0x4cb207(0x72)](_0x396d4c));if(_0x1fe662['length']>0x0)return{'resolved':_0x1fe662};const _0x39fb66=_0x13c30f[_0x4cb207(0x8c)](_0x2f40a6=>_0x2f40a6[_0x4cb207(0x87)]+'\x20('+_0x2f40a6['dbId']+')')[_0x4cb207(0x82)](',\x20');return{'resolved':[],'error':'No\x20database\x20matching\x20\x22'+_0x3b118f+_0x4cb207(0x77)+_0x1249cb+_0x4cb207(0x8a)+_0x39fb66+_0x4cb207(0x7d)};}export async function resolveOneDb(_0x363bbb,_0x469d33){const _0x28794e=a223_0x30cb,{resolved:_0x4210c3,error:_0x4bbada}=await resolveDb(_0x363bbb,_0x469d33);if(_0x4bbada)return{'db':null,'error':_0x4bbada};if(_0x4210c3[_0x28794e(0x78)]===0x1)return{'db':_0x4210c3[0x0]};if(!_0x469d33){const _0x539384=_0x4210c3[_0x28794e(0x8c)](_0x4dd849=>_0x4dd849[_0x28794e(0x87)]+'\x20('+_0x4dd849[_0x28794e(0x71)]+')')[_0x28794e(0x82)](',\x20');return{'db':null,'error':_0x28794e(0x7b)+_0x539384};}const _0x41b47e=_0x4210c3['map'](_0x98e146=>_0x98e146[_0x28794e(0x87)]+'\x20('+_0x98e146[_0x28794e(0x71)]+')')[_0x28794e(0x82)](',\x20');return{'db':null,'error':'\x22'+_0x469d33+_0x28794e(0x85)+_0x41b47e+_0x28794e(0x8d)};}export async function getDbName(_0x4ae8c0,_0x4da092){const _0x1cc085=a223_0x30cb,_0x4bc9d9=await listDatabases(_0x4ae8c0);return _0x4bc9d9[_0x1cc085(0x84)](_0x4afdae=>_0x4afdae[_0x1cc085(0x71)]===_0x4da092)?.[_0x1cc085(0x87)];}function a223_0x3cd9(){const _0x1e0c81=['760710OumIeY','5dPzoJA','set','\x22\x20under\x20app\x20\x22','length','entries','16IOYFdO','Multiple\x20databases\x20found.\x20Specify\x20one\x20with\x20--db:\x20','115281DTcFNJ','.\x20If\x20this\x20db\x20belongs\x20to\x20another\x20app,\x20rerun\x20with\x20--appcode\x20<appCode>.','db-','toLowerCase','5285862eEyKNP','dbtableConfig','join','837580HtPiiD','find','\x22\x20matches\x20multiple\x20databases:\x20','214710GVTwTW','dbName','No\x20linked\x20databases\x20found\x20under\x20app\x20\x22','419022KwkEVi','\x22.\x20Available:\x20','filter','map','.\x20Be\x20more\x20specific.','585564QHRePS','dbId','includes','has'];a223_0x3cd9=function(){return _0x1e0c81;};return a223_0x3cd9();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a224_0x1d644b=a224_0xe98f;(function(_0x41a296,_0x1bb8fc){const _0x1b3b6c=a224_0xe98f,_0xca9e7d=_0x41a296();while(!![]){try{const _0x382c0d=-parseInt(_0x1b3b6c(0x1b1))/0x1*(-parseInt(_0x1b3b6c(0x1b2))/0x2)+-parseInt(_0x1b3b6c(0x1a4))/0x3*(-parseInt(_0x1b3b6c(0x1ac))/0x4)+-parseInt(_0x1b3b6c(0x1aa))/0x5+parseInt(_0x1b3b6c(0x1ae))/0x6+-parseInt(_0x1b3b6c(0x1a3))/0x7*(parseInt(_0x1b3b6c(0x1b0))/0x8)+-parseInt(_0x1b3b6c(0x1ad))/0x9+parseInt(_0x1b3b6c(0x1a7))/0xa*(-parseInt(_0x1b3b6c(0x1ab))/0xb);if(_0x382c0d===_0x1bb8fc)break;else _0xca9e7d['push'](_0xca9e7d['shift']());}catch(_0xe54c17){_0xca9e7d['push'](_0xca9e7d['shift']());}}}(a224_0x4b0d,0x7de65));import{constants}from'node:fs';import{access,mkdir}from'node:fs/promises';import{dirname,join,resolve}from'node:path';function a224_0xe98f(_0x3a356c,_0x572518){_0x3a356c=_0x3a356c-0x1a3;const _0x4b0dff=a224_0x4b0d();let _0xe98ff6=_0x4b0dff[_0x3a356c];return _0xe98ff6;}export function loadPageProjectConfig(_0x158695,_0x3c3356=process[a224_0x1d644b(0x1a8)]()){const _0x3b8d01=a224_0x1d644b,_0x3b841e=resolve(_0x3c3356),_0x22a6bc=join(_0x3b841e,'.rabetbase',_0x3b8d01(0x1a5));return{'projectRoot':_0x3b841e,'pagesBaseDir':_0x22a6bc,'appPagesDir':join(_0x22a6bc,_0x158695),'lockFilePath':join(_0x3b841e,'.rabetbase',_0x3b8d01(0x1af))};}export function buildPageFileName(_0x5107c0,_0x114302){return _0x5107c0+'-'+String(_0x114302)['toUpperCase']()+'.json';}export function resolvePageFilePath(_0x346375,_0xd7b42b,_0x1bee4a){const _0x13effa=a224_0x1d644b;return join(_0x346375[_0x13effa(0x1a9)],buildPageFileName(_0xd7b42b,_0x1bee4a));}function a224_0x4b0d(){const _0x6523dc=['4wcZewJ','283698YUQCSr','1569756tNtIVr','page.lock.json','2980120nZskfv','5vVKjlU','215294yGaltz','7cXHaiR','1417809KJgJSF','page','F_OK','1486770KxWEME','cwd','appPagesDir','1020325GMTrHf','11PuaSSq'];a224_0x4b0d=function(){return _0x6523dc;};return a224_0x4b0d();}export async function ensureParentDirectory(_0x246a5){await mkdir(dirname(_0x246a5),{'recursive':!![]});}export async function fileExists(_0x4fcb54){const _0x2eb7d9=a224_0x1d644b;try{return await access(_0x4fcb54,constants[_0x2eb7d9(0x1a6)]),!![];}catch{return![];}}
|
package/lib/core/page/hash.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x902ca9,_0x2e7e11){const _0x298b47=a225_0x51ec,_0xcc54d3=_0x902ca9();while(!![]){try{const _0x1418dc=-parseInt(_0x298b47(0x88))/0x1+-parseInt(_0x298b47(0x8d))/0x2*(-parseInt(_0x298b47(0x85))/0x3)+parseInt(_0x298b47(0x90))/0x4+parseInt(_0x298b47(0x91))/0x5*(-parseInt(_0x298b47(0x8e))/0x6)+-parseInt(_0x298b47(0x8f))/0x7*(parseInt(_0x298b47(0x8a))/0x8)+parseInt(_0x298b47(0x8b))/0x9*(-parseInt(_0x298b47(0x84))/0xa)+parseInt(_0x298b47(0x89))/0xb;if(_0x1418dc===_0x2e7e11)break;else _0xcc54d3['push'](_0xcc54d3['shift']());}catch(_0xac65f3){_0xcc54d3['push'](_0xcc54d3['shift']());}}}(a225_0x821d,0x3ad52));import a225_0x260539 from'node:crypto';import{readFile}from'node:fs/promises';export function serializePageSchemaForFile(_0x24db6e){return JSON['stringify'](JSON['parse'](_0x24db6e),null,0x2)+'\x0a';}function a225_0x821d(){const _0x4b6d3e=['319566aYddzs','14762539MqEUPJ','136utVybC','208296tbgmny','hex','33594tIavTQ','180opTwul','182560hQvagN','161184LNkdfk','59900sIwQXp','30JxNlZT','9pBVTGs','md5','digest'];a225_0x821d=function(){return _0x4b6d3e;};return a225_0x821d();}export function computePageContentHash(_0x5c8938){const _0x325610=a225_0x51ec;return a225_0x260539['createHash'](_0x325610(0x86))['update'](_0x5c8938)[_0x325610(0x87)](_0x325610(0x8c));}function a225_0x51ec(_0x10b5ca,_0x2fbc78){_0x10b5ca=_0x10b5ca-0x84;const _0x821d57=a225_0x821d();let _0x51ecd0=_0x821d57[_0x10b5ca];return _0x51ecd0;}export function computeSerializedSchemaHash(_0x20129d){return computePageContentHash(serializePageSchemaForFile(_0x20129d));}export async function computePageFileHash(_0x29e51b){const _0x58dcaa=await readFile(_0x29e51b,'utf8');return computePageContentHash(_0x58dcaa);}
|
package/lib/core/page/lock.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x774769,_0x1b50b7){const _0x4465ff=a226_0x2534,_0x3e3f2d=_0x774769();while(!![]){try{const _0x4a92b5=parseInt(_0x4465ff(0x125))/0x1+-parseInt(_0x4465ff(0x128))/0x2+parseInt(_0x4465ff(0x11b))/0x3*(-parseInt(_0x4465ff(0x11c))/0x4)+parseInt(_0x4465ff(0x120))/0x5*(-parseInt(_0x4465ff(0x124))/0x6)+-parseInt(_0x4465ff(0x11e))/0x7+parseInt(_0x4465ff(0x127))/0x8+parseInt(_0x4465ff(0x122))/0x9;if(_0x4a92b5===_0x1b50b7)break;else _0x3e3f2d['push'](_0x3e3f2d['shift']());}catch(_0xe91e8d){_0x3e3f2d['push'](_0x3e3f2d['shift']());}}}(a226_0xd9ba,0xbf2d9));function a226_0x2534(_0xcf8232,_0x30e2ae){_0xcf8232=_0xcf8232-0x11a;const _0xd9ba42=a226_0xd9ba();let _0x2534a5=_0xd9ba42[_0xcf8232];return _0x2534a5;}import{mkdir,readFile,writeFile}from'node:fs/promises';function a226_0xd9ba(){const _0x1a4df4=['308956FepFKj','parse','ENOENT','code','apps','pages','2055nGOfZa','8116AYGXtz','Failed\x20to\x20read\x20page\x20lock\x20file:\x20','2182509aJkNhy','stringify','80285UWspvE','object','12378978ciufoA','utf8','90qBRiFF','1395391DzWrmn','lastSync','873736GLlKHR'];a226_0xd9ba=function(){return _0x1a4df4;};return a226_0xd9ba();}import{dirname}from'node:path';export function createEmptyPageLock(){return{'apps':{}};}export function ensurePageLockScope(_0x28ba42,_0x391e1e){const _0x5e006d=a226_0x2534,_0x5d5f77={'apps':_0x28ba42['apps']&&typeof _0x28ba42['apps']===_0x5e006d(0x121)?_0x28ba42[_0x5e006d(0x12c)]:{}};let _0x141886=_0x5d5f77[_0x5e006d(0x12c)][_0x391e1e];if(!_0x141886)return _0x141886={'lastSync':'','pages':{}},_0x5d5f77[_0x5e006d(0x12c)][_0x391e1e]=_0x141886,{'lockData':_0x5d5f77,'appLock':_0x141886};return!_0x141886[_0x5e006d(0x126)]&&(_0x141886[_0x5e006d(0x126)]=''),(!_0x141886[_0x5e006d(0x11a)]||typeof _0x141886[_0x5e006d(0x11a)]!==_0x5e006d(0x121))&&(_0x141886[_0x5e006d(0x11a)]={}),{'lockData':_0x5d5f77,'appLock':_0x141886};}export async function readPageLockFile(_0x2914a6){const _0x1da334=a226_0x2534;try{const _0x30cb13=await readFile(_0x2914a6,_0x1da334(0x123)),_0x264721=JSON[_0x1da334(0x129)](_0x30cb13);return{'apps':_0x264721[_0x1da334(0x12c)]&&typeof _0x264721[_0x1da334(0x12c)]===_0x1da334(0x121)?_0x264721[_0x1da334(0x12c)]:{}};}catch(_0x54898b){if(_0x54898b[_0x1da334(0x12b)]===_0x1da334(0x12a))return null;throw new Error(_0x1da334(0x11d)+String(_0x54898b));}}export async function writePageLockFile(_0x20e58f,_0x3c0cad){const _0x486cb6=a226_0x2534;await mkdir(dirname(_0x20e58f),{'recursive':!![]}),await writeFile(_0x20e58f,JSON[_0x486cb6(0x11f)](_0x3c0cad,null,0x2),_0x486cb6(0x123));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0x113845,_0x162c29){const _0x427de4=a220_0x21b6,_0x5d2d1c=_0x113845();while(!![]){try{const _0x4cfa2d=-parseInt(_0x427de4(0x1de))/0x1*(-parseInt(_0x427de4(0x1d0))/0x2)+-parseInt(_0x427de4(0x1b0))/0x3+-parseInt(_0x427de4(0x1d6))/0x4+-parseInt(_0x427de4(0x1c1))/0x5+parseInt(_0x427de4(0x1e4))/0x6*(parseInt(_0x427de4(0x1f9))/0x7)+-parseInt(_0x427de4(0x1f2))/0x8*(parseInt(_0x427de4(0x1ed))/0x9)+parseInt(_0x427de4(0x1e9))/0xa*(parseInt(_0x427de4(0x1e1))/0xb);if(_0x4cfa2d===_0x162c29)break;else _0x5d2d1c['push'](_0x5d2d1c['shift']());}catch(_0x476bfd){_0x5d2d1c['push'](_0x5d2d1c['shift']());}}}(a220_0x3a14,0x24ce0));import{MYBATIS_DYNAMIC_END_MARKER,MYBATIS_DYNAMIC_START_MARKER,MYBATIS_INCLUDE_MARKER,normalizeSqlForStaticAnalysis}from'./sql-validator.js';export function auditSqlJoinIndexes(_0x53406f,_0x54f871){const _0x2a3800=a220_0x21b6,_0x5645b6=[],_0x324234=normalizeSqlForStaticAnalysis(_0x53406f),_0x5f3bc2=(_0x324234[_0x2a3800(0x1b2)]?[]:extractJoinFacts(_0x324234[_0x2a3800(0x1ca)]))['map'](_0x2981ae=>{const _0x50bb12=_0x2a3800;if(_0x2981ae[_0x50bb12(0x1e0)]||_0x2981ae[_0x50bb12(0x1fc)][_0x50bb12(0x1e2)]===0x0)return _0x5645b6[_0x50bb12(0x1cf)]({'code':_0x50bb12(0x1ba),'table':_0x2981ae['table'],'alias':_0x2981ae['alias'],'columns':_0x2981ae[_0x50bb12(0x1fc)],'reason':_0x2981ae['unsupportedReason']??_0x50bb12(0x1f8)}),{'table':_0x2981ae[_0x50bb12(0x1b3)],'alias':_0x2981ae[_0x50bb12(0x1b6)],'columns':_0x2981ae[_0x50bb12(0x1fc)],'status':_0x50bb12(0x1c3)};const _0x139e30=resolveTableMetadata(_0x54f871,_0x2981ae[_0x50bb12(0x1b3)]),_0xd6f6dd=(_0x139e30?.[_0x50bb12(0x1f1)]??[])[_0x50bb12(0x1df)](_0x17ba3e=>({'index':_0x17ba3e,'matchedPrefix':findEqualityPrefix(_0x17ba3e[_0x50bb12(0x1fc)],_0x2981ae[_0x50bb12(0x1fc)])}))[_0x50bb12(0x1cc)](_0x2a48c3=>_0x2a48c3['matchedPrefix'][_0x50bb12(0x1e2)]>0x0),_0x489c99=_0xd6f6dd['reduce']((_0x2e890e,_0x37b8ef)=>!_0x2e890e||_0x37b8ef['matchedPrefix']['length']>_0x2e890e[_0x50bb12(0x1b7)][_0x50bb12(0x1e2)]?_0x37b8ef:_0x2e890e,_0xd6f6dd[0x0]);if(_0x489c99)return{'table':_0x2981ae['table'],'alias':_0x2981ae[_0x50bb12(0x1b6)],'columns':_0x2981ae[_0x50bb12(0x1fc)],'status':_0x50bb12(0x1ee),'matchedIndex':{..._0x489c99[_0x50bb12(0x1bf)],'matchedPrefix':_0x489c99[_0x50bb12(0x1b7)]}};const _0x47fb95=_0x139e30?.[_0x50bb12(0x1f1)][_0x50bb12(0x1cc)](_0x40f3e9=>_0x40f3e9[_0x50bb12(0x1fc)][_0x50bb12(0x1c6)](_0x44fec2=>_0x2981ae['columns']['some'](_0x216ed8=>columnNamesMatch(_0x44fec2,_0x216ed8))))??[];if(_0x47fb95[_0x50bb12(0x1e2)]>0x0)return _0x5645b6[_0x50bb12(0x1cf)]({'code':_0x50bb12(0x1e6),'table':_0x2981ae['table'],'alias':_0x2981ae[_0x50bb12(0x1b6)],'columns':_0x2981ae[_0x50bb12(0x1fc)],'reason':_0x50bb12(0x1af)}),{'table':_0x2981ae[_0x50bb12(0x1b3)],'alias':_0x2981ae['alias'],'columns':_0x2981ae['columns'],'status':_0x50bb12(0x1d1),'candidateIndexes':_0x47fb95};if(_0x139e30&&_0x139e30[_0x50bb12(0x1b1)]!==![]&&_0x139e30[_0x50bb12(0x1f1)][_0x50bb12(0x1e2)]>0x0&&_0x2981ae[_0x50bb12(0x1fc)]['length']>0x0)return _0x5645b6[_0x50bb12(0x1cf)]({'code':'JOIN_INDEX_MISSING','table':_0x2981ae[_0x50bb12(0x1b3)],'alias':_0x2981ae[_0x50bb12(0x1b6)],'columns':_0x2981ae[_0x50bb12(0x1fc)],'reason':'No\x20reported\x20index\x20contains\x20the\x20JOIN\x20access\x20columns.'}),{'table':_0x2981ae[_0x50bb12(0x1b3)],'alias':_0x2981ae[_0x50bb12(0x1b6)],'columns':_0x2981ae[_0x50bb12(0x1fc)],'status':_0x50bb12(0x1d1)};return _0x5645b6[_0x50bb12(0x1cf)]({'code':'INDEX_METADATA_UNAVAILABLE','table':_0x2981ae[_0x50bb12(0x1b3)],'alias':_0x2981ae[_0x50bb12(0x1b6)],'columns':_0x2981ae[_0x50bb12(0x1fc)],'reason':_0x139e30?_0x50bb12(0x1f5):_0x50bb12(0x1cd)}),{'table':_0x2981ae[_0x50bb12(0x1b3)],'alias':_0x2981ae[_0x50bb12(0x1b6)],'columns':_0x2981ae['columns'],'status':_0x50bb12(0x1c3)};});return{'checked':_0x5f3bc2[_0x2a3800(0x1e2)]>0x0,'joins':_0x5f3bc2,'warnings':_0x5645b6};}function extractJoinFacts(_0x479be3){const _0x18fcff=a220_0x21b6,_0x42bb12=maskNestedQueries(stripSqlNoise(_0x479be3)),_0x50c955=maskQuotedIdentifiers(_0x42bb12),_0x2eadeb=[],_0x746385=new Set(),_0x4e7445=/\b(?:(INNER|LEFT|RIGHT|FULL)(?:\s+OUTER)?\s+)?JOIN\s+([`"\w$.]+)(?:\s+(?:AS\s+)?([`"\w$]+))?\s+ON\s+([\s\S]*?)(?=\s+(?:(?:(?:INNER|LEFT|RIGHT|FULL)(?:\s+OUTER)?\s+)?JOIN\b|(?:WHERE|GROUP\s+BY|ORDER\s+BY|HAVING|LIMIT|UNION)\b)|;|$)/gi;for(const _0x119750 of _0x42bb12[_0x18fcff(0x1d2)](_0x4e7445)){const _0xb522b4=_0x119750[_0x18fcff(0x1bf)]??0x0,_0x406f56=_0x119750[0x0][_0x18fcff(0x1cb)](/\bJOIN\b/i),_0x3c94e0=_0xb522b4+Math[_0x18fcff(0x1f7)](0x0,_0x406f56);if(!/^JOIN\b/i[_0x18fcff(0x1d9)](_0x50c955['slice'](_0x3c94e0)))continue;_0x746385['add'](_0x3c94e0);const _0x69cf68=normalizeIdentifier(_0x119750[0x1]||_0x18fcff(0x1bc)),_0x281e03=normalizeIdentifier(_0x119750[0x2]??''),_0x248e5f=normalizeIdentifier(_0x119750[0x3]||_0x281e03[_0x18fcff(0x1d8)]('.')['at'](-0x1)||_0x281e03),_0x4ae194=[],_0x2a43e6=_0x281e03===_0x18fcff(0x1e7);let _0x54ea34=_0x69cf68===_0x18fcff(0x1f0)||_0x69cf68==='full'||_0x2a43e6,_0x3bf80f=_0x54ea34?_0x2a43e6?_0x18fcff(0x1d7):_0x69cf68['toUpperCase']()+_0x18fcff(0x1c8):undefined;const _0x5da761=stripOuterParentheses(_0x119750[0x4]??''),_0x45f8fe=_0x5da761[_0x18fcff(0x1c7)](MYBATIS_DYNAMIC_START_MARKER)||_0x5da761[_0x18fcff(0x1c7)](MYBATIS_DYNAMIC_END_MARKER),_0x3c8b24=_0x5da761[_0x18fcff(0x1c7)](MYBATIS_INCLUDE_MARKER);_0x45f8fe&&(_0x54ea34=!![],_0x3bf80f??=_0x18fcff(0x1bd));_0x3c8b24&&(_0x54ea34=!![],_0x3bf80f??=_0x18fcff(0x1f3));const _0x241caa=_0x5da761[_0x18fcff(0x1d5)](MYBATIS_DYNAMIC_START_MARKER,'\x20')[_0x18fcff(0x1d5)](MYBATIS_DYNAMIC_END_MARKER,'\x20')[_0x18fcff(0x1d5)](MYBATIS_INCLUDE_MARKER,'\x20');hasTopLevelKeyword(_0x241caa,'OR')&&(_0x54ea34=!![],_0x3bf80f??=_0x18fcff(0x1b5));for(const _0x17b448 of splitTopLevelAnd(_0x241caa)){const _0x4723bf=stripOuterParentheses(_0x17b448);if(hasTopLevelKeyword(_0x4723bf,'OR')){_0x54ea34=!![],_0x3bf80f??=_0x18fcff(0x1b5);continue;}const _0x444f9a=splitEquality(_0x4723bf);if(!_0x444f9a){containsColumnReference(_0x17b448,_0x248e5f)&&(_0x54ea34=!![]);continue;}const _0x1c891=parseDirectColumnReference(_0x444f9a[0x0],_0x248e5f),_0x284e3f=parseDirectColumnReference(_0x444f9a[0x1],_0x248e5f),_0x4159eb=containsColumnReference(_0x444f9a[0x0],_0x248e5f),_0x18c3d1=containsColumnReference(_0x444f9a[0x1],_0x248e5f),_0x4acc25=_0x1c891&&!_0x18c3d1?_0x1c891:_0x284e3f&&!_0x4159eb?_0x284e3f:null;if(_0x4acc25&&!_0x4ae194['includes'](_0x4acc25))_0x4ae194[_0x18fcff(0x1cf)](_0x4acc25);else!_0x4acc25&&containsColumnReference(_0x17b448,_0x248e5f)&&(_0x54ea34=!![]);}_0x2eadeb['push']({'table':_0x281e03,'alias':_0x248e5f,'columns':_0x4ae194,'unsupportedPredicate':_0x54ea34,'unsupportedReason':_0x3bf80f,'containsUnresolvedInclude':_0x3c8b24,'position':_0x3c94e0});}for(const _0x7fd4c3 of _0x50c955[_0x18fcff(0x1d2)](/\bJOIN\b/gi)){const _0x51fdbb=_0x7fd4c3['index']??0x0;if(_0x746385[_0x18fcff(0x1b4)](_0x51fdbb))continue;const _0x3e7ddb=/^\s+([`"\w$.]+)(?:\s+(?:AS\s+)?([`"\w$]+))?/[_0x18fcff(0x1ea)](_0x42bb12[_0x18fcff(0x1eb)](_0x51fdbb+_0x7fd4c3[0x0][_0x18fcff(0x1e2)])),_0x5abae6=normalizeIdentifier(_0x3e7ddb?.[0x1]||_0x18fcff(0x1dc)),_0x5b3c8a=normalizeIdentifier(_0x3e7ddb?.[0x2]||''),_0x16d7ae=isSqlClauseKeyword(_0x5b3c8a)?_0x5abae6[_0x18fcff(0x1d8)]('.')['at'](-0x1)||_0x5abae6:_0x5b3c8a||_0x5abae6[_0x18fcff(0x1d8)]('.')['at'](-0x1)||_0x5abae6;_0x2eadeb[_0x18fcff(0x1cf)]({'table':_0x5abae6,'alias':_0x16d7ae,'columns':[],'unsupportedPredicate':!![],'unsupportedReason':_0x18fcff(0x1e3),'position':_0x51fdbb});}const _0x2eaeca=_0x50c955['indexOf'](MYBATIS_INCLUDE_MARKER);return _0x2eaeca>=0x0&&!_0x2eadeb[_0x18fcff(0x1c6)](_0x588428=>_0x588428['containsUnresolvedInclude'])&&_0x2eadeb[_0x18fcff(0x1cf)]({'table':_0x18fcff(0x1dc),'alias':_0x18fcff(0x1dc),'columns':[],'unsupportedPredicate':!![],'unsupportedReason':_0x18fcff(0x1ec),'containsUnresolvedInclude':!![],'position':_0x2eaeca}),_0x2eadeb[_0x18fcff(0x1c9)]((_0xc2e2db,_0x321e74)=>_0xc2e2db[_0x18fcff(0x1b9)]-_0x321e74[_0x18fcff(0x1b9)]);}function stripSqlNoise(_0x379dcc){const _0x1f41a9=a220_0x21b6,_0x12d8aa=Array[_0x1f41a9(0x1f6)](_0x379dcc),_0x2a3b1c=(_0x46cc5c,_0x3b5193)=>{for(let _0x2de727=_0x46cc5c;_0x2de727<_0x3b5193;_0x2de727+=0x1){_0x12d8aa[_0x2de727]!=='\x0a'&&_0x12d8aa[_0x2de727]!=='\x0d'&&(_0x12d8aa[_0x2de727]='\x20');}};for(let _0x57be34=0x0;_0x57be34<_0x12d8aa['length'];_0x57be34+=0x1){const _0x5dca83=_0x12d8aa[_0x57be34],_0x330107=_0x12d8aa[_0x57be34+0x1];if(_0x5dca83==='\x27'||_0x5dca83==='\x22'||_0x5dca83==='`'){const _0x232e03=_0x5dca83,_0x4bfe17=_0x57be34;_0x57be34+=0x1;while(_0x57be34<_0x12d8aa[_0x1f41a9(0x1e2)]){if(_0x12d8aa[_0x57be34]==='\x5c'&&_0x57be34+0x1<_0x12d8aa['length']){_0x57be34+=0x2;continue;}if(_0x12d8aa[_0x57be34]!==_0x232e03){_0x57be34+=0x1;continue;}if(_0x12d8aa[_0x57be34+0x1]===_0x232e03){_0x57be34+=0x2;continue;}break;}if(_0x232e03==='\x27')_0x2a3b1c(_0x4bfe17,Math[_0x1f41a9(0x1c2)](_0x57be34+0x1,_0x12d8aa[_0x1f41a9(0x1e2)]));continue;}if(_0x5dca83==='-'&&_0x330107==='-'){const _0x548b1b=_0x57be34;while(_0x57be34<_0x12d8aa[_0x1f41a9(0x1e2)]&&_0x12d8aa[_0x57be34]!=='\x0a')_0x57be34+=0x1;_0x2a3b1c(_0x548b1b,_0x57be34);continue;}if(_0x5dca83==='/'&&_0x330107==='*'){const _0x1f2f3e=_0x57be34;_0x57be34+=0x2;while(_0x57be34<_0x12d8aa[_0x1f41a9(0x1e2)]&&!(_0x12d8aa[_0x57be34]==='*'&&_0x12d8aa[_0x57be34+0x1]==='/')){_0x57be34+=0x1;}_0x57be34=Math[_0x1f41a9(0x1c2)](_0x57be34+0x1,_0x12d8aa[_0x1f41a9(0x1e2)]-0x1),_0x2a3b1c(_0x1f2f3e,_0x57be34+0x1);continue;}if(_0x5dca83==='#'&&_0x330107!=='{'){const _0x232cba=_0x57be34;while(_0x57be34<_0x12d8aa[_0x1f41a9(0x1e2)]&&_0x12d8aa[_0x57be34]!=='\x0a')_0x57be34+=0x1;_0x2a3b1c(_0x232cba,_0x57be34);continue;}if((_0x5dca83==='#'||_0x5dca83==='$')&&_0x330107==='{'){const _0x4f4da2=_0x57be34;_0x57be34+=0x2;while(_0x57be34<_0x12d8aa[_0x1f41a9(0x1e2)]&&_0x12d8aa[_0x57be34]!=='}')_0x57be34+=0x1;_0x2a3b1c(_0x4f4da2,Math['min'](_0x57be34+0x1,_0x12d8aa[_0x1f41a9(0x1e2)]));}}return _0x12d8aa[_0x1f41a9(0x1ef)]('');}function maskQuotedIdentifiers(_0x3dcd2d){const _0x3c39fc=a220_0x21b6,_0x242af3=Array[_0x3c39fc(0x1f6)](_0x3dcd2d);for(let _0x33f4eb=0x0;_0x33f4eb<_0x242af3['length'];_0x33f4eb+=0x1){const _0x5e6460=_0x242af3[_0x33f4eb];if(_0x5e6460!=='\x22'&&_0x5e6460!=='`')continue;_0x33f4eb+=0x1;while(_0x33f4eb<_0x242af3[_0x3c39fc(0x1e2)]){if(_0x242af3[_0x33f4eb]===_0x5e6460){if(_0x242af3[_0x33f4eb+0x1]===_0x5e6460){_0x242af3[_0x33f4eb]='\x20',_0x242af3[_0x33f4eb+0x1]='\x20',_0x33f4eb+=0x2;continue;}break;}_0x242af3[_0x33f4eb]='\x20',_0x33f4eb+=0x1;}}return _0x242af3['join']('');}function maskNestedQueries(_0x141049){const _0x3c7fba=a220_0x21b6,_0x5661d7=Array[_0x3c7fba(0x1f6)](_0x141049);for(let _0x439c2d=0x0;_0x439c2d<_0x5661d7[_0x3c7fba(0x1e2)];_0x439c2d+=0x1){if(_0x5661d7[_0x439c2d]!=='(')continue;const _0x26caa6=_0x141049['slice'](_0x439c2d+0x1);if(!/^\s*(?:SELECT|WITH)\b/i[_0x3c7fba(0x1d9)](_0x26caa6))continue;let _0x4bb09a=0x1,_0xcdb61b=_0x439c2d+0x1;for(;_0xcdb61b<_0x5661d7[_0x3c7fba(0x1e2)]&&_0x4bb09a>0x0;_0xcdb61b+=0x1){if(_0x5661d7[_0xcdb61b]==='(')_0x4bb09a+=0x1;if(_0x5661d7[_0xcdb61b]===')')_0x4bb09a-=0x1;}if(_0x4bb09a!==0x0)continue;for(let _0xedd973=_0x439c2d;_0xedd973<_0xcdb61b;_0xedd973+=0x1){_0x5661d7[_0xedd973]='\x20';}const _0xd43041=_0x3c7fba(0x1e7);for(let _0x11c2db=0x0;_0x11c2db<_0xd43041[_0x3c7fba(0x1e2)]&&_0x439c2d+_0x11c2db<_0xcdb61b;_0x11c2db+=0x1){_0x5661d7[_0x439c2d+_0x11c2db]=_0xd43041[_0x11c2db];}_0x439c2d=_0xcdb61b-0x1;}return _0x5661d7[_0x3c7fba(0x1ef)]('');}function splitTopLevelAnd(_0x105b5b){const _0x303e8d=a220_0x21b6,_0x2b7e3f=[];let _0x5f4eb2=0x0,_0x591b62=0x0;for(let _0x18adb6=0x0;_0x18adb6<_0x105b5b[_0x303e8d(0x1e2)];_0x18adb6+=0x1){const _0x10f09c=_0x105b5b[_0x18adb6];if(_0x10f09c==='(')_0x5f4eb2+=0x1;if(_0x10f09c===')')_0x5f4eb2=Math[_0x303e8d(0x1f7)](0x0,_0x5f4eb2-0x1);_0x5f4eb2===0x0&&_0x105b5b['slice'](_0x18adb6)[_0x303e8d(0x1f4)](/^AND\b/i)&&(_0x18adb6===0x0||/\s/[_0x303e8d(0x1d9)](_0x105b5b[_0x18adb6-0x1]??''))&&(_0x2b7e3f[_0x303e8d(0x1cf)](_0x105b5b[_0x303e8d(0x1eb)](_0x591b62,_0x18adb6)[_0x303e8d(0x1b8)]()),_0x18adb6+=0x2,_0x591b62=_0x18adb6+0x1);}const _0x1b079e=_0x105b5b[_0x303e8d(0x1eb)](_0x591b62)[_0x303e8d(0x1b8)]();if(_0x1b079e)_0x2b7e3f['push'](_0x1b079e);return _0x2b7e3f;}function hasTopLevelKeyword(_0x4e9125,_0x204307){const _0x215333=a220_0x21b6;let _0x199251=0x0;for(let _0x365598=0x0;_0x365598<_0x4e9125[_0x215333(0x1e2)];_0x365598+=0x1){const _0x3a1685=_0x4e9125[_0x365598];if(_0x3a1685==='(')_0x199251+=0x1;if(_0x3a1685===')')_0x199251=Math[_0x215333(0x1f7)](0x0,_0x199251-0x1);if(_0x199251!==0x0)continue;const _0x1f1aad=_0x4e9125[_0x215333(0x1eb)](_0x365598,_0x365598+_0x204307[_0x215333(0x1e2)]),_0xa0f113=_0x4e9125[_0x365598-0x1]??'\x20',_0x583bd8=_0x4e9125[_0x365598+_0x204307['length']]??'\x20';if(_0x1f1aad[_0x215333(0x1be)]()===_0x204307[_0x215333(0x1be)]()&&!/[\w$]/['test'](_0xa0f113)&&!/[\w$]/[_0x215333(0x1d9)](_0x583bd8))return!![];}return![];}function splitEquality(_0x36329c){const _0x5eb1b7=a220_0x21b6,_0x3cf7c1=stripOuterParentheses(_0x36329c);let _0x23ff27=0x0,_0x2ded5c;for(let _0x46657c=0x0;_0x46657c<_0x3cf7c1[_0x5eb1b7(0x1e2)];_0x46657c+=0x1){const _0x57cf5d=_0x3cf7c1[_0x46657c];if(_0x57cf5d==='(')_0x23ff27+=0x1;if(_0x57cf5d===')')_0x23ff27=Math[_0x5eb1b7(0x1f7)](0x0,_0x23ff27-0x1);const _0x1b36f0=_0x3cf7c1[_0x46657c-0x1]??'',_0x54a276=_0x3cf7c1[_0x46657c+0x1]??'';if(_0x57cf5d==='='&&_0x23ff27===0x0&&!/[!<>=:]/[_0x5eb1b7(0x1d9)](_0x1b36f0)&&_0x54a276!=='='){if(_0x2ded5c!==undefined)return null;_0x2ded5c=_0x46657c;}}return _0x2ded5c===undefined?null:[_0x3cf7c1[_0x5eb1b7(0x1eb)](0x0,_0x2ded5c)[_0x5eb1b7(0x1b8)](),_0x3cf7c1[_0x5eb1b7(0x1eb)](_0x2ded5c+0x1)['trim']()];}function parseDirectColumnReference(_0x4236a2,_0x5305a0){const _0x45c935=a220_0x21b6,_0x5ca758=/^([`"]?[\w$]+[`"]?)\s*\.\s*([`"]?[\w$]+[`"]?)$/[_0x45c935(0x1ea)](stripOuterParentheses(_0x4236a2));if(!_0x5ca758)return null;if(normalizeIdentifier(_0x5ca758[0x1]??'')!==normalizeIdentifier(_0x5305a0))return null;return normalizeIdentifier(_0x5ca758[0x2]??'');}function containsColumnReference(_0x3b7d14,_0x30b95a){const _0x2e31ab=a220_0x21b6,_0x24376a=_0x3b7d14['replace'](/[`"]/g,''),_0x38319c=_0x30b95a[_0x2e31ab(0x1d4)](/[.*+?^${}()|[\]\\]/g,_0x2e31ab(0x1c5));return new RegExp(_0x2e31ab(0x1dd)+_0x38319c+'\x5cs*\x5c.\x5cs*[\x5cw$]+','i')[_0x2e31ab(0x1d9)](_0x24376a);}function findEqualityPrefix(_0x421aec,_0x300f46){const _0x20cae4=a220_0x21b6,_0x4a2130=new Set(_0x300f46[_0x20cae4(0x1df)](normalizeIdentifier)),_0x34d158=[];for(const _0xcc7edd of _0x421aec){if(!_0x4a2130[_0x20cae4(0x1b4)](normalizeIdentifier(_0xcc7edd)))break;_0x34d158[_0x20cae4(0x1cf)](_0xcc7edd);}return _0x34d158;}function a220_0x21b6(_0x3d56f6,_0x29be82){_0x3d56f6=_0x3d56f6-0x1af;const _0x3a1417=a220_0x3a14();let _0x21b6cb=_0x3a1417[_0x3d56f6];return _0x21b6cb;}function resolveTableMetadata(_0x19900b,_0x22f2f7){const _0x4b2b82=a220_0x21b6,_0x20ee3a=normalizeIdentifier(_0x22f2f7),_0xee9a33=_0x19900b['filter'](_0x3e8d5b=>normalizeIdentifier(_0x3e8d5b[_0x4b2b82(0x1db)])===_0x20ee3a);if(_0xee9a33[_0x4b2b82(0x1e2)]===0x1)return _0xee9a33[0x0];const _0x58ddbe=_0x20ee3a[_0x4b2b82(0x1c7)]('.'),_0x4fe2d6=_0x20ee3a[_0x4b2b82(0x1d8)]('.')['at'](-0x1),_0x1872a6=_0x19900b[_0x4b2b82(0x1cc)](_0x554aa0=>{const _0x4a2488=_0x4b2b82,_0x547689=normalizeIdentifier(_0x554aa0[_0x4a2488(0x1db)]);if(_0x58ddbe&&_0x547689['includes']('.'))return![];return _0x547689[_0x4a2488(0x1d8)]('.')['at'](-0x1)===_0x4fe2d6;});return _0x1872a6[_0x4b2b82(0x1e2)]===0x1?_0x1872a6[0x0]:undefined;}function columnNamesMatch(_0x19b60a,_0xe9a528){return normalizeIdentifier(_0x19b60a)===normalizeIdentifier(_0xe9a528);}function a220_0x3a14(){const _0x17842e=['248jnGDky','MyBatis\x20<include>\x20JOIN\x20fragments\x20cannot\x20be\x20expanded\x20statically.','match','The\x20dataset\x20returned\x20no\x20distinguishable\x20index\x20metadata.','from','max','Not\x20every\x20JOIN\x20target\x20predicate\x20could\x20be\x20audited\x20safely.','1702169pISRGT','natural','inner','columns','Relevant\x20columns\x20do\x20not\x20form\x20a\x20complete\x20leftmost\x20index\x20prefix.','707220suXVrq','metadataAvailable','error','table','has','OR-connected\x20JOIN\x20predicates\x20are\x20not\x20supported.','alias','matchedPrefix','trim','position','JOIN_PREDICATE_UNSUPPORTED','full','INNER','MyBatis\x20dynamic\x20JOIN\x20predicates\x20cannot\x20be\x20audited\x20deterministically.','toUpperCase','index','startsWith','281655RMZCJm','min','unavailable','using','\x5c$&','some','includes','\x20JOIN\x20direction\x20is\x20not\x20supported\x20by\x20static\x20index\x20auditing.','sort','sql','search','filter','No\x20dataset\x20metadata\x20matched\x20the\x20JOIN\x20table.','endsWith','push','74jqxuoN','warning','matchAll','toLowerCase','replace','replaceAll','322360QNoTpE','Derived-table\x20JOIN\x20targets\x20are\x20not\x20supported.','split','test','cross','tableName','unknown','(?:^|[^\x5cw$])','4052dYeXgm','map','unsupportedPredicate','484781SgnpEc','length','Only\x20explicit\x20table\x20JOIN\x20clauses\x20with\x20an\x20ON\x20predicate\x20are\x20supported.','6XAjDoK','where','JOIN_INDEX_NOT_USABLE','__sq__','left','30WduyNr','exec','slice','MyBatis\x20<include>\x20fragments\x20cannot\x20be\x20expanded\x20for\x20JOIN\x20auditing.','549yDAQDs','covered','join','right','indexes'];a220_0x3a14=function(){return _0x17842e;};return a220_0x3a14();}function normalizeIdentifier(_0x5af6d4){const _0x196a8a=a220_0x21b6;return _0x5af6d4[_0x196a8a(0x1d4)](/[`"]/g,'')[_0x196a8a(0x1b8)]()[_0x196a8a(0x1d3)]();}function isSqlClauseKeyword(_0x4a2e43){const _0x5d771f=a220_0x21b6;return new Set(['on',_0x5d771f(0x1c4),_0x5d771f(0x1e5),_0x5d771f(0x1ef),_0x5d771f(0x1fb),_0x5d771f(0x1e8),_0x5d771f(0x1f0),_0x5d771f(0x1bb),_0x5d771f(0x1da),_0x5d771f(0x1fa)])['has'](_0x4a2e43);}function stripOuterParentheses(_0x5af2a6){const _0x4029e1=a220_0x21b6;let _0x1d6bc0=_0x5af2a6[_0x4029e1(0x1b8)]();while(_0x1d6bc0[_0x4029e1(0x1c0)]('(')&&_0x1d6bc0[_0x4029e1(0x1ce)](')')){let _0x56d351=0x0,_0x2e9d25=!![];for(let _0x350ab4=0x0;_0x350ab4<_0x1d6bc0[_0x4029e1(0x1e2)];_0x350ab4+=0x1){if(_0x1d6bc0[_0x350ab4]==='(')_0x56d351+=0x1;if(_0x1d6bc0[_0x350ab4]===')')_0x56d351-=0x1;if(_0x56d351===0x0&&_0x350ab4<_0x1d6bc0[_0x4029e1(0x1e2)]-0x1){_0x2e9d25=![];break;}}if(!_0x2e9d25||_0x56d351!==0x0)break;_0x1d6bc0=_0x1d6bc0['slice'](0x1,-0x1)['trim']();}return _0x1d6bc0;}
|
|
1
|
+
(function(_0x347e4a,_0x5bcf4c){const _0x46a2e1=a228_0x56d2,_0x197a08=_0x347e4a();while(!![]){try{const _0x18fba5=parseInt(_0x46a2e1(0x1a7))/0x1*(-parseInt(_0x46a2e1(0x1bf))/0x2)+-parseInt(_0x46a2e1(0x1b4))/0x3+parseInt(_0x46a2e1(0x191))/0x4+-parseInt(_0x46a2e1(0x17c))/0x5*(-parseInt(_0x46a2e1(0x188))/0x6)+parseInt(_0x46a2e1(0x18f))/0x7+-parseInt(_0x46a2e1(0x17a))/0x8*(parseInt(_0x46a2e1(0x187))/0x9)+parseInt(_0x46a2e1(0x17e))/0xa;if(_0x18fba5===_0x5bcf4c)break;else _0x197a08['push'](_0x197a08['shift']());}catch(_0x2f2be3){_0x197a08['push'](_0x197a08['shift']());}}}(a228_0x62fc,0x1b1f1));import{MYBATIS_DYNAMIC_END_MARKER,MYBATIS_DYNAMIC_START_MARKER,MYBATIS_INCLUDE_MARKER,normalizeSqlForStaticAnalysis}from'./sql-validator.js';export function auditSqlJoinIndexes(_0x2a43de,_0x2175fc){const _0x42db26=a228_0x56d2,_0x708081=[],_0x2c004b=normalizeSqlForStaticAnalysis(_0x2a43de),_0x18755c=(_0x2c004b[_0x42db26(0x182)]?[]:extractJoinFacts(_0x2c004b[_0x42db26(0x1b2)]))[_0x42db26(0x1b9)](_0x1179cf=>{const _0x349f87=_0x42db26;if(_0x1179cf[_0x349f87(0x181)]||_0x1179cf[_0x349f87(0x193)][_0x349f87(0x1a2)]===0x0)return _0x708081[_0x349f87(0x1a4)]({'code':_0x349f87(0x19c),'table':_0x1179cf[_0x349f87(0x1ad)],'alias':_0x1179cf[_0x349f87(0x1a5)],'columns':_0x1179cf['columns'],'reason':_0x1179cf['unsupportedReason']??_0x349f87(0x1bb)}),{'table':_0x1179cf[_0x349f87(0x1ad)],'alias':_0x1179cf['alias'],'columns':_0x1179cf[_0x349f87(0x193)],'status':_0x349f87(0x1af)};const _0x21450d=resolveTableMetadata(_0x2175fc,_0x1179cf['table']),_0x3f20c7=(_0x21450d?.[_0x349f87(0x1a1)]??[])['map'](_0x248220=>({'index':_0x248220,'matchedPrefix':findEqualityPrefix(_0x248220[_0x349f87(0x193)],_0x1179cf['columns'])}))[_0x349f87(0x19d)](_0x17f7e0=>_0x17f7e0[_0x349f87(0x18d)][_0x349f87(0x1a2)]>0x0),_0x489fc4=_0x3f20c7[_0x349f87(0x1b3)]((_0x73210e,_0x1fa26d)=>!_0x73210e||_0x1fa26d[_0x349f87(0x18d)]['length']>_0x73210e[_0x349f87(0x18d)][_0x349f87(0x1a2)]?_0x1fa26d:_0x73210e,_0x3f20c7[0x0]);if(_0x489fc4)return{'table':_0x1179cf[_0x349f87(0x1ad)],'alias':_0x1179cf[_0x349f87(0x1a5)],'columns':_0x1179cf[_0x349f87(0x193)],'status':'covered','matchedIndex':{..._0x489fc4[_0x349f87(0x1b7)],'matchedPrefix':_0x489fc4[_0x349f87(0x18d)]}};const _0xc92bb=_0x21450d?.[_0x349f87(0x1a1)][_0x349f87(0x19d)](_0x39f440=>_0x39f440[_0x349f87(0x193)][_0x349f87(0x190)](_0xa4e53c=>_0x1179cf['columns'][_0x349f87(0x190)](_0x4fc6f4=>columnNamesMatch(_0xa4e53c,_0x4fc6f4))))??[];if(_0xc92bb[_0x349f87(0x1a2)]>0x0)return _0x708081[_0x349f87(0x1a4)]({'code':_0x349f87(0x1b0),'table':_0x1179cf[_0x349f87(0x1ad)],'alias':_0x1179cf['alias'],'columns':_0x1179cf[_0x349f87(0x193)],'reason':'Relevant\x20columns\x20do\x20not\x20form\x20a\x20complete\x20leftmost\x20index\x20prefix.'}),{'table':_0x1179cf['table'],'alias':_0x1179cf[_0x349f87(0x1a5)],'columns':_0x1179cf[_0x349f87(0x193)],'status':_0x349f87(0x1ba),'candidateIndexes':_0xc92bb};if(_0x21450d&&_0x21450d[_0x349f87(0x17f)]!==![]&&_0x21450d['indexes']['length']>0x0&&_0x1179cf[_0x349f87(0x193)]['length']>0x0)return _0x708081[_0x349f87(0x1a4)]({'code':'JOIN_INDEX_MISSING','table':_0x1179cf['table'],'alias':_0x1179cf[_0x349f87(0x1a5)],'columns':_0x1179cf[_0x349f87(0x193)],'reason':_0x349f87(0x1c0)}),{'table':_0x1179cf[_0x349f87(0x1ad)],'alias':_0x1179cf[_0x349f87(0x1a5)],'columns':_0x1179cf[_0x349f87(0x193)],'status':_0x349f87(0x1ba)};return _0x708081[_0x349f87(0x1a4)]({'code':_0x349f87(0x183),'table':_0x1179cf[_0x349f87(0x1ad)],'alias':_0x1179cf[_0x349f87(0x1a5)],'columns':_0x1179cf[_0x349f87(0x193)],'reason':_0x21450d?_0x349f87(0x1a3):'No\x20dataset\x20metadata\x20matched\x20the\x20JOIN\x20table.'}),{'table':_0x1179cf[_0x349f87(0x1ad)],'alias':_0x1179cf[_0x349f87(0x1a5)],'columns':_0x1179cf[_0x349f87(0x193)],'status':_0x349f87(0x1af)};});return{'checked':_0x18755c[_0x42db26(0x1a2)]>0x0,'joins':_0x18755c,'warnings':_0x708081};}function extractJoinFacts(_0x15c1c1){const _0x5e7570=a228_0x56d2,_0x147dc3=maskNestedQueries(stripSqlNoise(_0x15c1c1)),_0x3fe185=maskQuotedIdentifiers(_0x147dc3),_0x1c9dfd=[],_0x5f5b0f=new Set(),_0x30cb2b=/\b(?:(INNER|LEFT|RIGHT|FULL)(?:\s+OUTER)?\s+)?JOIN\s+([`"\w$.]+)(?:\s+(?:AS\s+)?([`"\w$]+))?\s+ON\s+([\s\S]*?)(?=\s+(?:(?:(?:INNER|LEFT|RIGHT|FULL)(?:\s+OUTER)?\s+)?JOIN\b|(?:WHERE|GROUP\s+BY|ORDER\s+BY|HAVING|LIMIT|UNION)\b)|;|$)/gi;for(const _0x5af2ff of _0x147dc3[_0x5e7570(0x1a9)](_0x30cb2b)){const _0x1aa214=_0x5af2ff[_0x5e7570(0x1b7)]??0x0,_0x312d62=_0x5af2ff[0x0][_0x5e7570(0x195)](/\bJOIN\b/i),_0x175c9d=_0x1aa214+Math[_0x5e7570(0x1b5)](0x0,_0x312d62);if(!/^JOIN\b/i[_0x5e7570(0x184)](_0x3fe185[_0x5e7570(0x192)](_0x175c9d)))continue;_0x5f5b0f[_0x5e7570(0x1ab)](_0x175c9d);const _0x50817a=normalizeIdentifier(_0x5af2ff[0x1]||_0x5e7570(0x19a)),_0x39aed2=normalizeIdentifier(_0x5af2ff[0x2]??''),_0x5ef2e2=normalizeIdentifier(_0x5af2ff[0x3]||_0x39aed2[_0x5e7570(0x17b)]('.')['at'](-0x1)||_0x39aed2),_0x4611d8=[],_0x1aaf63=_0x39aed2==='__sq__';let _0x524e60=_0x50817a===_0x5e7570(0x1c5)||_0x50817a==='full'||_0x1aaf63,_0x558f39=_0x524e60?_0x1aaf63?'Derived-table\x20JOIN\x20targets\x20are\x20not\x20supported.':_0x50817a[_0x5e7570(0x199)]()+_0x5e7570(0x1bd):undefined;const _0x289afa=stripOuterParentheses(_0x5af2ff[0x4]??''),_0x51cb4a=_0x289afa['includes'](MYBATIS_DYNAMIC_START_MARKER)||_0x289afa['includes'](MYBATIS_DYNAMIC_END_MARKER),_0x422cba=_0x289afa[_0x5e7570(0x1a0)](MYBATIS_INCLUDE_MARKER);_0x51cb4a&&(_0x524e60=!![],_0x558f39??=_0x5e7570(0x197));_0x422cba&&(_0x524e60=!![],_0x558f39??=_0x5e7570(0x1aa));const _0xf568fd=_0x289afa[_0x5e7570(0x189)](MYBATIS_DYNAMIC_START_MARKER,'\x20')[_0x5e7570(0x189)](MYBATIS_DYNAMIC_END_MARKER,'\x20')[_0x5e7570(0x189)](MYBATIS_INCLUDE_MARKER,'\x20');hasTopLevelKeyword(_0xf568fd,'OR')&&(_0x524e60=!![],_0x558f39??='OR-connected\x20JOIN\x20predicates\x20are\x20not\x20supported.');for(const _0x12e8b3 of splitTopLevelAnd(_0xf568fd)){const _0x269467=stripOuterParentheses(_0x12e8b3);if(hasTopLevelKeyword(_0x269467,'OR')){_0x524e60=!![],_0x558f39??=_0x5e7570(0x1c2);continue;}const _0x1fbdf9=splitEquality(_0x269467);if(!_0x1fbdf9){containsColumnReference(_0x12e8b3,_0x5ef2e2)&&(_0x524e60=!![]);continue;}const _0x257da6=parseDirectColumnReference(_0x1fbdf9[0x0],_0x5ef2e2),_0x5ad8e3=parseDirectColumnReference(_0x1fbdf9[0x1],_0x5ef2e2),_0x3fc40c=containsColumnReference(_0x1fbdf9[0x0],_0x5ef2e2),_0x55bdc2=containsColumnReference(_0x1fbdf9[0x1],_0x5ef2e2),_0x517615=_0x257da6&&!_0x55bdc2?_0x257da6:_0x5ad8e3&&!_0x3fc40c?_0x5ad8e3:null;if(_0x517615&&!_0x4611d8['includes'](_0x517615))_0x4611d8[_0x5e7570(0x1a4)](_0x517615);else!_0x517615&&containsColumnReference(_0x12e8b3,_0x5ef2e2)&&(_0x524e60=!![]);}_0x1c9dfd[_0x5e7570(0x1a4)]({'table':_0x39aed2,'alias':_0x5ef2e2,'columns':_0x4611d8,'unsupportedPredicate':_0x524e60,'unsupportedReason':_0x558f39,'containsUnresolvedInclude':_0x422cba,'position':_0x175c9d});}for(const _0x2c2575 of _0x3fe185[_0x5e7570(0x1a9)](/\bJOIN\b/gi)){const _0x367101=_0x2c2575['index']??0x0;if(_0x5f5b0f[_0x5e7570(0x1b8)](_0x367101))continue;const _0x206e5e=/^\s+([`"\w$.]+)(?:\s+(?:AS\s+)?([`"\w$]+))?/[_0x5e7570(0x198)](_0x147dc3[_0x5e7570(0x192)](_0x367101+_0x2c2575[0x0]['length'])),_0x5725bb=normalizeIdentifier(_0x206e5e?.[0x1]||_0x5e7570(0x194)),_0x21efce=normalizeIdentifier(_0x206e5e?.[0x2]||''),_0x18af19=isSqlClauseKeyword(_0x21efce)?_0x5725bb['split']('.')['at'](-0x1)||_0x5725bb:_0x21efce||_0x5725bb[_0x5e7570(0x17b)]('.')['at'](-0x1)||_0x5725bb;_0x1c9dfd[_0x5e7570(0x1a4)]({'table':_0x5725bb,'alias':_0x18af19,'columns':[],'unsupportedPredicate':!![],'unsupportedReason':'Only\x20explicit\x20table\x20JOIN\x20clauses\x20with\x20an\x20ON\x20predicate\x20are\x20supported.','position':_0x367101});}const _0x397146=_0x3fe185[_0x5e7570(0x196)](MYBATIS_INCLUDE_MARKER);return _0x397146>=0x0&&!_0x1c9dfd[_0x5e7570(0x190)](_0xa437cf=>_0xa437cf[_0x5e7570(0x1ac)])&&_0x1c9dfd[_0x5e7570(0x1a4)]({'table':_0x5e7570(0x194),'alias':_0x5e7570(0x194),'columns':[],'unsupportedPredicate':!![],'unsupportedReason':_0x5e7570(0x18a),'containsUnresolvedInclude':!![],'position':_0x397146}),_0x1c9dfd[_0x5e7570(0x19b)]((_0x4caec5,_0x523d5e)=>_0x4caec5[_0x5e7570(0x19f)]-_0x523d5e[_0x5e7570(0x19f)]);}function stripSqlNoise(_0x5baa9d){const _0x429ea6=a228_0x56d2,_0x136bda=Array[_0x429ea6(0x1c1)](_0x5baa9d),_0x156334=(_0x2c8fee,_0x3a97fd)=>{for(let _0x239a0a=_0x2c8fee;_0x239a0a<_0x3a97fd;_0x239a0a+=0x1){_0x136bda[_0x239a0a]!=='\x0a'&&_0x136bda[_0x239a0a]!=='\x0d'&&(_0x136bda[_0x239a0a]='\x20');}};for(let _0x17f0f1=0x0;_0x17f0f1<_0x136bda[_0x429ea6(0x1a2)];_0x17f0f1+=0x1){const _0x51ff6a=_0x136bda[_0x17f0f1],_0x3d51dc=_0x136bda[_0x17f0f1+0x1];if(_0x51ff6a==='\x27'||_0x51ff6a==='\x22'||_0x51ff6a==='`'){const _0x1cb5ab=_0x51ff6a,_0x1f2355=_0x17f0f1;_0x17f0f1+=0x1;while(_0x17f0f1<_0x136bda['length']){if(_0x136bda[_0x17f0f1]==='\x5c'&&_0x17f0f1+0x1<_0x136bda[_0x429ea6(0x1a2)]){_0x17f0f1+=0x2;continue;}if(_0x136bda[_0x17f0f1]!==_0x1cb5ab){_0x17f0f1+=0x1;continue;}if(_0x136bda[_0x17f0f1+0x1]===_0x1cb5ab){_0x17f0f1+=0x2;continue;}break;}if(_0x1cb5ab==='\x27')_0x156334(_0x1f2355,Math['min'](_0x17f0f1+0x1,_0x136bda['length']));continue;}if(_0x51ff6a==='-'&&_0x3d51dc==='-'){const _0x420710=_0x17f0f1;while(_0x17f0f1<_0x136bda[_0x429ea6(0x1a2)]&&_0x136bda[_0x17f0f1]!=='\x0a')_0x17f0f1+=0x1;_0x156334(_0x420710,_0x17f0f1);continue;}if(_0x51ff6a==='/'&&_0x3d51dc==='*'){const _0x29a761=_0x17f0f1;_0x17f0f1+=0x2;while(_0x17f0f1<_0x136bda['length']&&!(_0x136bda[_0x17f0f1]==='*'&&_0x136bda[_0x17f0f1+0x1]==='/')){_0x17f0f1+=0x1;}_0x17f0f1=Math[_0x429ea6(0x1bc)](_0x17f0f1+0x1,_0x136bda[_0x429ea6(0x1a2)]-0x1),_0x156334(_0x29a761,_0x17f0f1+0x1);continue;}if(_0x51ff6a==='#'&&_0x3d51dc!=='{'){const _0x19b8a8=_0x17f0f1;while(_0x17f0f1<_0x136bda[_0x429ea6(0x1a2)]&&_0x136bda[_0x17f0f1]!=='\x0a')_0x17f0f1+=0x1;_0x156334(_0x19b8a8,_0x17f0f1);continue;}if((_0x51ff6a==='#'||_0x51ff6a==='$')&&_0x3d51dc==='{'){const _0xec5a17=_0x17f0f1;_0x17f0f1+=0x2;while(_0x17f0f1<_0x136bda[_0x429ea6(0x1a2)]&&_0x136bda[_0x17f0f1]!=='}')_0x17f0f1+=0x1;_0x156334(_0xec5a17,Math[_0x429ea6(0x1bc)](_0x17f0f1+0x1,_0x136bda[_0x429ea6(0x1a2)]));}}return _0x136bda[_0x429ea6(0x1b6)]('');}function maskQuotedIdentifiers(_0x2a9e46){const _0x1938e6=a228_0x56d2,_0x1122c6=Array[_0x1938e6(0x1c1)](_0x2a9e46);for(let _0x3ba276=0x0;_0x3ba276<_0x1122c6[_0x1938e6(0x1a2)];_0x3ba276+=0x1){const _0x1cca85=_0x1122c6[_0x3ba276];if(_0x1cca85!=='\x22'&&_0x1cca85!=='`')continue;_0x3ba276+=0x1;while(_0x3ba276<_0x1122c6['length']){if(_0x1122c6[_0x3ba276]===_0x1cca85){if(_0x1122c6[_0x3ba276+0x1]===_0x1cca85){_0x1122c6[_0x3ba276]='\x20',_0x1122c6[_0x3ba276+0x1]='\x20',_0x3ba276+=0x2;continue;}break;}_0x1122c6[_0x3ba276]='\x20',_0x3ba276+=0x1;}}return _0x1122c6['join']('');}function maskNestedQueries(_0x58518f){const _0x473ad6=a228_0x56d2,_0x3c57ee=Array[_0x473ad6(0x1c1)](_0x58518f);for(let _0x44cc43=0x0;_0x44cc43<_0x3c57ee[_0x473ad6(0x1a2)];_0x44cc43+=0x1){if(_0x3c57ee[_0x44cc43]!=='(')continue;const _0x2330e8=_0x58518f[_0x473ad6(0x192)](_0x44cc43+0x1);if(!/^\s*(?:SELECT|WITH)\b/i[_0x473ad6(0x184)](_0x2330e8))continue;let _0x55f01b=0x1,_0x39139=_0x44cc43+0x1;for(;_0x39139<_0x3c57ee[_0x473ad6(0x1a2)]&&_0x55f01b>0x0;_0x39139+=0x1){if(_0x3c57ee[_0x39139]==='(')_0x55f01b+=0x1;if(_0x3c57ee[_0x39139]===')')_0x55f01b-=0x1;}if(_0x55f01b!==0x0)continue;for(let _0x14d3ae=_0x44cc43;_0x14d3ae<_0x39139;_0x14d3ae+=0x1){_0x3c57ee[_0x14d3ae]='\x20';}const _0x11d1ce=_0x473ad6(0x1a6);for(let _0x52059e=0x0;_0x52059e<_0x11d1ce[_0x473ad6(0x1a2)]&&_0x44cc43+_0x52059e<_0x39139;_0x52059e+=0x1){_0x3c57ee[_0x44cc43+_0x52059e]=_0x11d1ce[_0x52059e];}_0x44cc43=_0x39139-0x1;}return _0x3c57ee[_0x473ad6(0x1b6)]('');}function a228_0x62fc(){const _0x50e613=['unavailable','JOIN_INDEX_NOT_USABLE','(?:^|[^\x5cw$])','sql','reduce','385317OkknVA','max','join','index','has','map','warning','Not\x20every\x20JOIN\x20target\x20predicate\x20could\x20be\x20audited\x20safely.','min','\x20JOIN\x20direction\x20is\x20not\x20supported\x20by\x20static\x20index\x20auditing.','\x5c$&','8044pKmxpx','No\x20reported\x20index\x20contains\x20the\x20JOIN\x20access\x20columns.','from','OR-connected\x20JOIN\x20predicates\x20are\x20not\x20supported.','replace','inner','right','cross','1126648pKLRyF','split','5BpeBxi','natural','1519210gJvtmL','metadataAvailable','toLowerCase','unsupportedPredicate','error','INDEX_METADATA_UNAVAILABLE','test','match','startsWith','9IujrWw','880266gMHGJg','replaceAll','MyBatis\x20<include>\x20fragments\x20cannot\x20be\x20expanded\x20for\x20JOIN\x20auditing.','endsWith','trim','matchedPrefix','left','1164023mlaTBN','some','433976NkbWri','slice','columns','unknown','search','indexOf','MyBatis\x20dynamic\x20JOIN\x20predicates\x20cannot\x20be\x20audited\x20deterministically.','exec','toUpperCase','INNER','sort','JOIN_PREDICATE_UNSUPPORTED','filter','tableName','position','includes','indexes','length','The\x20dataset\x20returned\x20no\x20distinguishable\x20index\x20metadata.','push','alias','__sq__','48PekBOC','where','matchAll','MyBatis\x20<include>\x20JOIN\x20fragments\x20cannot\x20be\x20expanded\x20statically.','add','containsUnresolvedInclude','table','\x5cs*\x5c.\x5cs*[\x5cw$]+'];a228_0x62fc=function(){return _0x50e613;};return a228_0x62fc();}function splitTopLevelAnd(_0x4bf84b){const _0x457f94=a228_0x56d2,_0x3e65c4=[];let _0x4ab47f=0x0,_0x1a2100=0x0;for(let _0x216bae=0x0;_0x216bae<_0x4bf84b['length'];_0x216bae+=0x1){const _0x24da33=_0x4bf84b[_0x216bae];if(_0x24da33==='(')_0x4ab47f+=0x1;if(_0x24da33===')')_0x4ab47f=Math[_0x457f94(0x1b5)](0x0,_0x4ab47f-0x1);_0x4ab47f===0x0&&_0x4bf84b[_0x457f94(0x192)](_0x216bae)[_0x457f94(0x185)](/^AND\b/i)&&(_0x216bae===0x0||/\s/['test'](_0x4bf84b[_0x216bae-0x1]??''))&&(_0x3e65c4[_0x457f94(0x1a4)](_0x4bf84b[_0x457f94(0x192)](_0x1a2100,_0x216bae)[_0x457f94(0x18c)]()),_0x216bae+=0x2,_0x1a2100=_0x216bae+0x1);}const _0x5515a7=_0x4bf84b[_0x457f94(0x192)](_0x1a2100)[_0x457f94(0x18c)]();if(_0x5515a7)_0x3e65c4[_0x457f94(0x1a4)](_0x5515a7);return _0x3e65c4;}function hasTopLevelKeyword(_0x172318,_0x5df640){const _0x449222=a228_0x56d2;let _0x4293f8=0x0;for(let _0xfde014=0x0;_0xfde014<_0x172318[_0x449222(0x1a2)];_0xfde014+=0x1){const _0x3d7320=_0x172318[_0xfde014];if(_0x3d7320==='(')_0x4293f8+=0x1;if(_0x3d7320===')')_0x4293f8=Math[_0x449222(0x1b5)](0x0,_0x4293f8-0x1);if(_0x4293f8!==0x0)continue;const _0x5c9545=_0x172318['slice'](_0xfde014,_0xfde014+_0x5df640[_0x449222(0x1a2)]),_0x4f56fe=_0x172318[_0xfde014-0x1]??'\x20',_0x8e44ed=_0x172318[_0xfde014+_0x5df640[_0x449222(0x1a2)]]??'\x20';if(_0x5c9545['toUpperCase']()===_0x5df640[_0x449222(0x199)]()&&!/[\w$]/[_0x449222(0x184)](_0x4f56fe)&&!/[\w$]/[_0x449222(0x184)](_0x8e44ed))return!![];}return![];}function splitEquality(_0x31a41d){const _0x5df498=a228_0x56d2,_0x123d79=stripOuterParentheses(_0x31a41d);let _0x45b9ab=0x0,_0x342381;for(let _0x68ce37=0x0;_0x68ce37<_0x123d79[_0x5df498(0x1a2)];_0x68ce37+=0x1){const _0x308862=_0x123d79[_0x68ce37];if(_0x308862==='(')_0x45b9ab+=0x1;if(_0x308862===')')_0x45b9ab=Math[_0x5df498(0x1b5)](0x0,_0x45b9ab-0x1);const _0x3a9aa8=_0x123d79[_0x68ce37-0x1]??'',_0x4bd6a9=_0x123d79[_0x68ce37+0x1]??'';if(_0x308862==='='&&_0x45b9ab===0x0&&!/[!<>=:]/[_0x5df498(0x184)](_0x3a9aa8)&&_0x4bd6a9!=='='){if(_0x342381!==undefined)return null;_0x342381=_0x68ce37;}}return _0x342381===undefined?null:[_0x123d79['slice'](0x0,_0x342381)[_0x5df498(0x18c)](),_0x123d79[_0x5df498(0x192)](_0x342381+0x1)[_0x5df498(0x18c)]()];}function parseDirectColumnReference(_0x2a5bad,_0x32e1af){const _0x524139=a228_0x56d2,_0x157812=/^([`"]?[\w$]+[`"]?)\s*\.\s*([`"]?[\w$]+[`"]?)$/[_0x524139(0x198)](stripOuterParentheses(_0x2a5bad));if(!_0x157812)return null;if(normalizeIdentifier(_0x157812[0x1]??'')!==normalizeIdentifier(_0x32e1af))return null;return normalizeIdentifier(_0x157812[0x2]??'');}function containsColumnReference(_0x150c39,_0x25bb8f){const _0x300dd4=a228_0x56d2,_0x284a51=_0x150c39['replace'](/[`"]/g,''),_0x1f7503=_0x25bb8f[_0x300dd4(0x1c3)](/[.*+?^${}()|[\]\\]/g,_0x300dd4(0x1be));return new RegExp(_0x300dd4(0x1b1)+_0x1f7503+_0x300dd4(0x1ae),'i')['test'](_0x284a51);}function findEqualityPrefix(_0x423d63,_0x2e3593){const _0x1c4f8c=a228_0x56d2,_0x3f7f69=new Set(_0x2e3593[_0x1c4f8c(0x1b9)](normalizeIdentifier)),_0x52e3c0=[];for(const _0x35a072 of _0x423d63){if(!_0x3f7f69['has'](normalizeIdentifier(_0x35a072)))break;_0x52e3c0['push'](_0x35a072);}return _0x52e3c0;}function resolveTableMetadata(_0x5d2a5e,_0x4ede2f){const _0x520e85=a228_0x56d2,_0x360d9c=normalizeIdentifier(_0x4ede2f),_0x139786=_0x5d2a5e[_0x520e85(0x19d)](_0x2d3000=>normalizeIdentifier(_0x2d3000[_0x520e85(0x19e)])===_0x360d9c);if(_0x139786[_0x520e85(0x1a2)]===0x1)return _0x139786[0x0];const _0x5485fe=_0x360d9c[_0x520e85(0x1a0)]('.'),_0x597ba4=_0x360d9c['split']('.')['at'](-0x1),_0x588371=_0x5d2a5e[_0x520e85(0x19d)](_0x2d5301=>{const _0x48a606=_0x520e85,_0x2dc303=normalizeIdentifier(_0x2d5301['tableName']);if(_0x5485fe&&_0x2dc303[_0x48a606(0x1a0)]('.'))return![];return _0x2dc303[_0x48a606(0x17b)]('.')['at'](-0x1)===_0x597ba4;});return _0x588371[_0x520e85(0x1a2)]===0x1?_0x588371[0x0]:undefined;}function a228_0x56d2(_0x5ccc3f,_0x162c2a){_0x5ccc3f=_0x5ccc3f-0x179;const _0x62fc79=a228_0x62fc();let _0x56d202=_0x62fc79[_0x5ccc3f];return _0x56d202;}function columnNamesMatch(_0xfa7959,_0x4efb74){return normalizeIdentifier(_0xfa7959)===normalizeIdentifier(_0x4efb74);}function normalizeIdentifier(_0x2bb9be){const _0x7d70f3=a228_0x56d2;return _0x2bb9be[_0x7d70f3(0x1c3)](/[`"]/g,'')[_0x7d70f3(0x18c)]()[_0x7d70f3(0x180)]();}function isSqlClauseKeyword(_0x4cd697){const _0x121c55=a228_0x56d2;return new Set(['on','using',_0x121c55(0x1a8),_0x121c55(0x1b6),_0x121c55(0x1c4),_0x121c55(0x18e),_0x121c55(0x1c5),'full',_0x121c55(0x179),_0x121c55(0x17d)])[_0x121c55(0x1b8)](_0x4cd697);}function stripOuterParentheses(_0x189dc1){const _0x324a86=a228_0x56d2;let _0x4ebbe8=_0x189dc1[_0x324a86(0x18c)]();while(_0x4ebbe8[_0x324a86(0x186)]('(')&&_0x4ebbe8[_0x324a86(0x18b)](')')){let _0x3402c8=0x0,_0x171673=!![];for(let _0x4f761b=0x0;_0x4f761b<_0x4ebbe8['length'];_0x4f761b+=0x1){if(_0x4ebbe8[_0x4f761b]==='(')_0x3402c8+=0x1;if(_0x4ebbe8[_0x4f761b]===')')_0x3402c8-=0x1;if(_0x3402c8===0x0&&_0x4f761b<_0x4ebbe8[_0x324a86(0x1a2)]-0x1){_0x171673=![];break;}}if(!_0x171673||_0x3402c8!==0x0)break;_0x4ebbe8=_0x4ebbe8[_0x324a86(0x192)](0x1,-0x1)[_0x324a86(0x18c)]();}return _0x4ebbe8;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a229_0x33d9(){const _0x20524a=['116hVzANT','.rabetbase','3760330OJucqW','sql-trash','5460zslNTQ','11jKIzKz','132033wpYDel','12884HRECVQ','1176VvkUcM','/sql','sql.lock.json','4049055PawInh','2700110uyObky','sql','6488064DOXZDG','12XsAopl'];a229_0x33d9=function(){return _0x20524a;};return a229_0x33d9();}const a229_0x205901=a229_0x52cd;(function(_0x2f09ee,_0x547a1b){const _0x457784=a229_0x52cd,_0xf3cc2d=_0x2f09ee();while(!![]){try{const _0x3798b7=parseInt(_0x457784(0xf0))/0x1*(parseInt(_0x457784(0xf9))/0x2)+parseInt(_0x457784(0xef))/0x3*(parseInt(_0x457784(0xf8))/0x4)+-parseInt(_0x457784(0xf5))/0x5+-parseInt(_0x457784(0xf1))/0x6*(-parseInt(_0x457784(0xfd))/0x7)+parseInt(_0x457784(0xf7))/0x8+-parseInt(_0x457784(0xf4))/0x9+-parseInt(_0x457784(0xfb))/0xa*(parseInt(_0x457784(0xfe))/0xb);if(_0x3798b7===_0x547a1b)break;else _0xf3cc2d['push'](_0xf3cc2d['shift']());}catch(_0x2444d0){_0xf3cc2d['push'](_0xf3cc2d['shift']());}}}(a229_0x33d9,0x7483b));import{resolve}from'node:path';import{findProjectRootDirectory}from'../../context.js';const DOT_DIR=a229_0x205901(0xfa),LOCK_FILE_NAME=a229_0x205901(0xf3),TRASH_DIR_NAME=a229_0x205901(0xfc);function a229_0x52cd(_0x4238ca,_0x29956e){_0x4238ca=_0x4238ca-0xef;const _0x33d9f0=a229_0x33d9();let _0x52cd53=_0x33d9f0[_0x4238ca];return _0x52cd53;}export function loadSqlProjectConfig(_0x48c115,_0x1b22df){const _0x2bf92f=a229_0x205901,_0xc4fd72=resolve(_0x1b22df??findProjectRootDirectory()),_0x4def99=DOT_DIR+_0x2bf92f(0xf2),_0x274063=_0x4def99+'/'+_0x48c115;return{'projectRoot':_0xc4fd72,'appCode':_0x48c115,'sqlWorkspaceRoot':_0x4def99,'sqlRoot':_0x274063,'sqlRootDir':resolve(_0xc4fd72,DOT_DIR,_0x2bf92f(0xf6),_0x48c115),'lockFilePath':resolve(_0xc4fd72,DOT_DIR,LOCK_FILE_NAME),'trashDir':resolve(_0xc4fd72,DOT_DIR,TRASH_DIR_NAME)};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a230_0x4b81(){const _0x12c7de=['129884hItpaR','isDirectory','43990sVdUgv','code','.sql','189372UAKAtJ','replace','233217pPvAza','dbName','ENOENT','length','4JfzHXj','push','name','split','sqlRootDir','63030pkXwoz','filter','sql','108HkyHlI','590360lVhBVM','6oyHpVn','mode','10LkDaGA','slice','sqlCode','sqlName','475601WrbKoQ','9KWhCoU','.xml','mybatisXml'];a230_0x4b81=function(){return _0x12c7de;};return a230_0x4b81();}(function(_0x287001,_0x134fbf){const _0x34cb7c=a230_0x28ba,_0x41017d=_0x287001();while(!![]){try{const _0x3be128=parseInt(_0x34cb7c(0xfa))/0x1+-parseInt(_0x34cb7c(0x105))/0x2*(parseInt(_0x34cb7c(0x101))/0x3)+parseInt(_0x34cb7c(0xff))/0x4*(parseInt(_0x34cb7c(0xf2))/0x5)+-parseInt(_0x34cb7c(0xf0))/0x6*(-parseInt(_0x34cb7c(0xf6))/0x7)+parseInt(_0x34cb7c(0xef))/0x8*(parseInt(_0x34cb7c(0xf7))/0x9)+parseInt(_0x34cb7c(0xfc))/0xa+parseInt(_0x34cb7c(0xeb))/0xb*(-parseInt(_0x34cb7c(0xee))/0xc);if(_0x3be128===_0x134fbf)break;else _0x41017d['push'](_0x41017d['shift']());}catch(_0xb380fe){_0x41017d['push'](_0x41017d['shift']());}}}(a230_0x4b81,0x27f4b));import{readdir,stat}from'node:fs/promises';import{extname,join,relative}from'node:path';import{buildDefaultSqlFileName,buildSqlRelativePath}from'./utils.js';function a230_0x28ba(_0x2eaf4e,_0x1d1329){_0x2eaf4e=_0x2eaf4e-0xe7;const _0x4b8136=a230_0x4b81();let _0x28ba78=_0x4b8136[_0x2eaf4e];return _0x28ba78;}function extensionToMode(_0x37a902){const _0x39ec34=a230_0x28ba;if(_0x37a902===_0x39ec34(0xfe))return _0x39ec34(0xed);if(_0x37a902===_0x39ec34(0xf8))return _0x39ec34(0xf9);return undefined;}async function scanSqlFilesRecursively(_0x3207f6,_0x42dfc3){const _0x52e96f=a230_0x28ba,_0x2f6f88=[];try{const _0x560dbf=await readdir(_0x3207f6,{'withFileTypes':!![]});for(const _0x338dec of _0x560dbf){const _0x2db6d0=join(_0x3207f6,_0x338dec[_0x52e96f(0xe8)]);if(_0x338dec['isDirectory']()){_0x2f6f88[_0x52e96f(0xe7)](...await scanSqlFilesRecursively(_0x2db6d0,_0x42dfc3));continue;}if(!_0x338dec['isFile']())continue;const _0x439ba3=extname(_0x338dec[_0x52e96f(0xe8)])['toLowerCase'](),_0x1dcce4=extensionToMode(_0x439ba3);if(!_0x1dcce4)continue;const _0x55793e=relative(_0x42dfc3,_0x2db6d0)[_0x52e96f(0x100)](/\\/g,'/'),_0x3cb7b8=_0x55793e[_0x52e96f(0xe9)]('/')[_0x52e96f(0xec)](Boolean),_0x2c9b7d=parseSqlPath(_0x3cb7b8,_0x338dec[_0x52e96f(0xe8)],_0x439ba3);if(!_0x2c9b7d)continue;_0x2f6f88[_0x52e96f(0xe7)]({'sqlCode':_0x2c9b7d['sqlCode'],'sqlName':_0x2c9b7d['sqlName'],'dbDirectory':_0x3cb7b8[0x0],'filePath':_0x2db6d0,'relativePath':_0x55793e,'lockKey':_0x2c9b7d[_0x52e96f(0xf4)],'mode':_0x1dcce4});}}catch(_0x37ecdd){if(_0x37ecdd[_0x52e96f(0xfd)]!==_0x52e96f(0x103))throw _0x37ecdd;}return _0x2f6f88;}export async function scanLocalSqlQueries(_0x3e038b){const _0x29f460=a230_0x28ba;return scanSqlFilesRecursively(_0x3e038b['sqlRootDir'],_0x3e038b[_0x29f460(0xea)]);}export function resolveLocalSqlFilePath(_0x2683a5,_0x3bbbab,_0x59ab6a){const _0x1527d5=a230_0x28ba,_0x4b4aec=_0x59ab6a?.['path']||(_0x59ab6a?.[_0x1527d5(0xf5)]||_0x59ab6a?.[_0x1527d5(0x102)]?buildSqlRelativePath(_0x3bbbab,_0x59ab6a?.[_0x1527d5(0xf5)],_0x59ab6a?.[_0x1527d5(0x102)],_0x59ab6a?.[_0x1527d5(0xf1)]||_0x1527d5(0xed),_0x59ab6a?.['dbId']):buildDefaultSqlFileName(_0x3bbbab,_0x59ab6a?.[_0x1527d5(0xf1)]||_0x1527d5(0xed)));return join(_0x2683a5[_0x1527d5(0xea)],_0x4b4aec);}export async function directoryExists(_0x7cc18d){const _0x284c06=a230_0x28ba;try{const _0x45009a=await stat(_0x7cc18d);return _0x45009a[_0x284c06(0xfb)]();}catch{return![];}}function parseSqlPath(_0x6dfbde,_0x3d3b1a,_0x2de0b9){const _0x2aff90=a230_0x28ba,_0x1b4730=_0x3d3b1a['slice'](0x0,-_0x2de0b9['length']);if(_0x6dfbde[_0x2aff90(0x104)]<0x2)return null;const _0x42b209=_0x1b4730['indexOf']('_');if(_0x42b209<=0x0||_0x42b209>=_0x1b4730[_0x2aff90(0x104)]-0x1)return null;const _0xe3bab2=_0x1b4730['slice'](0x0,_0x42b209);if(!isLikelySqlCode(_0xe3bab2))return null;return{'sqlCode':_0xe3bab2,'sqlName':_0x1b4730[_0x2aff90(0xf3)](_0x42b209+0x1)};}function isLikelySqlCode(_0x42b2dd){return/^[A-Za-z0-9-]+-[A-Za-z0-9-]+$/['test'](_0x42b2dd);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0xac0551,_0x26ef66){const _0x3ebf42=a231_0x120d,_0x4a3b67=_0xac0551();while(!![]){try{const _0x50b94f=-parseInt(_0x3ebf42(0x150))/0x1*(parseInt(_0x3ebf42(0x15a))/0x2)+-parseInt(_0x3ebf42(0x14a))/0x3+parseInt(_0x3ebf42(0x14c))/0x4*(-parseInt(_0x3ebf42(0x158))/0x5)+parseInt(_0x3ebf42(0x14b))/0x6+parseInt(_0x3ebf42(0x155))/0x7*(parseInt(_0x3ebf42(0x157))/0x8)+-parseInt(_0x3ebf42(0x14e))/0x9*(-parseInt(_0x3ebf42(0x153))/0xa)+parseInt(_0x3ebf42(0x14d))/0xb*(parseInt(_0x3ebf42(0x15b))/0xc);if(_0x50b94f===_0x26ef66)break;else _0x4a3b67['push'](_0x4a3b67['shift']());}catch(_0x35e895){_0x4a3b67['push'](_0x4a3b67['shift']());}}}(a231_0x2cee,0x6d22d));import{readFile}from'node:fs/promises';import a231_0xfaff47 from'node:crypto';export function computeSqlContentHash(_0x5a7f08){const _0x4cce70=a231_0x120d;return a231_0xfaff47[_0x4cce70(0x152)](_0x4cce70(0x151))[_0x4cce70(0x154)](_0x5a7f08)[_0x4cce70(0x156)](_0x4cce70(0x14f));}export async function computeSqlFileHash(_0x4da799){const _0x3ab6b0=a231_0x120d,_0x54babd=await readFile(_0x4da799,_0x3ab6b0(0x159));return computeSqlContentHash(_0x54babd);}function a231_0x120d(_0x48a244,_0x49b50d){_0x48a244=_0x48a244-0x14a;const _0x2cee06=a231_0x2cee();let _0x120dc5=_0x2cee06[_0x48a244];return _0x120dc5;}function a231_0x2cee(){const _0x487659=['1387284NtSVnX','28kKBejI','8659717yrVvdt','1125jOICRq','hex','35467IYzhIj','md5','createHash','16410Wdtzqq','update','18809MecYKG','digest','2384oAEilC','513650ysRKez','utf8','6kSGEyG','12VxsoZO','2255340DUAAoQ'];a231_0x2cee=function(){return _0x487659;};return a231_0x2cee();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x3ceda2,_0x29f9e2){const _0x37579d=a232_0x5c57,_0x534fa6=_0x3ceda2();while(!![]){try{const _0x1f8ce4=parseInt(_0x37579d(0xb2))/0x1*(-parseInt(_0x37579d(0xbd))/0x2)+-parseInt(_0x37579d(0xb7))/0x3*(parseInt(_0x37579d(0xbb))/0x4)+-parseInt(_0x37579d(0xbc))/0x5+-parseInt(_0x37579d(0xb6))/0x6+-parseInt(_0x37579d(0xb4))/0x7+-parseInt(_0x37579d(0xbe))/0x8+-parseInt(_0x37579d(0xb1))/0x9*(-parseInt(_0x37579d(0xb8))/0xa);if(_0x1f8ce4===_0x29f9e2)break;else _0x534fa6['push'](_0x534fa6['shift']());}catch(_0x21ce3d){_0x534fa6['push'](_0x534fa6['shift']());}}}(a232_0x3779,0xc8ead));import{mkdir,readFile,writeFile}from'node:fs/promises';function a232_0x5c57(_0xce397e,_0x480352){_0xce397e=_0xce397e-0xa9;const _0x377968=a232_0x3779();let _0x5c573f=_0x377968[_0xce397e];return _0x5c573f;}import{dirname}from'node:path';export function createEmptySqlLock(){return{'apps':{}};}export function ensureSqlLockScope(_0x809943,_0x136b2d,_0x5e95ca,_0x11da53){const _0xad3fa6=a232_0x5c57,_0x3839eb=_0x809943??createEmptySqlLock();let _0x575d54=_0x3839eb[_0xad3fa6(0xb5)][_0x136b2d];if(!_0x575d54)return _0x575d54={'sqlRoot':_0x5e95ca,'lastSync':'','sqls':{}},_0x3839eb[_0xad3fa6(0xb5)][_0x136b2d]=_0x575d54,{'lockData':_0x3839eb,'appLock':_0x575d54};if(!_0x575d54[_0xad3fa6(0xb9)])_0x575d54['sqlRoot']=_0x5e95ca;else{if(_0x575d54[_0xad3fa6(0xb9)]!==_0x5e95ca)throw new Error(_0x11da53+_0xad3fa6(0xb0)+_0x5e95ca+_0xad3fa6(0xaf)+_0x575d54[_0xad3fa6(0xb9)]+_0xad3fa6(0xba)+_0xad3fa6(0xad));}return!_0x575d54[_0xad3fa6(0xae)]&&(_0x575d54[_0xad3fa6(0xae)]={}),!_0x575d54[_0xad3fa6(0xa9)]&&(_0x575d54[_0xad3fa6(0xa9)]=''),{'lockData':_0x3839eb,'appLock':_0x575d54};}export async function readSqlLockFile(_0x354b76){const _0x506475=a232_0x5c57;try{const _0x3ac521=await readFile(_0x354b76,_0x506475(0xbf));return JSON[_0x506475(0xaa)](_0x3ac521);}catch(_0x245f0c){if(_0x245f0c[_0x506475(0xac)]===_0x506475(0xab))return null;throw new Error('Failed\x20to\x20read\x20SQL\x20lock\x20file:\x20'+String(_0x245f0c));}}function a232_0x3779(){const _0x1ee2c3=['1117858qlElvW','314512qTbMdb','utf8','lastSync','parse','ENOENT','code','Check\x20.rabetbase/sql.lock.json\x20or\x20operate\x20from\x20the\x20correct\x20project\x20directory.','sqls','\x22\x20vs\x20lock\x20\x22',':\x20sqlRoot\x20mismatch\x20—\x20current\x20\x22','3190419dofgjD','1fehoSS','stringify','8367338SCzbYk','apps','6720708UWFKVZ','5808qQhdid','190YarMBn','sqlRoot','\x22.\x20','3244bkWzPT','7142905cVPiyF'];a232_0x3779=function(){return _0x1ee2c3;};return a232_0x3779();}export async function writeSqlLockFile(_0x381125,_0x2490d5){const _0x101bb0=a232_0x5c57;await mkdir(dirname(_0x381125),{'recursive':!![]}),await writeFile(_0x381125,JSON[_0x101bb0(0xb3)](_0x2490d5,null,0x2),'utf8');}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x319bcf,_0x241ec6){const _0x827b8d=a234_0x7b6d,_0x5b8d7c=_0x319bcf();while(!![]){try{const _0x393d56=-parseInt(_0x827b8d(0x88))/0x1*(-parseInt(_0x827b8d(0x86))/0x2)+parseInt(_0x827b8d(0x7e))/0x3*(parseInt(_0x827b8d(0x81))/0x4)+-parseInt(_0x827b8d(0x8a))/0x5*(parseInt(_0x827b8d(0x80))/0x6)+parseInt(_0x827b8d(0x8e))/0x7*(parseInt(_0x827b8d(0x7c))/0x8)+parseInt(_0x827b8d(0x87))/0x9*(-parseInt(_0x827b8d(0x89))/0xa)+-parseInt(_0x827b8d(0x82))/0xb*(parseInt(_0x827b8d(0x7d))/0xc)+parseInt(_0x827b8d(0x7a))/0xd;if(_0x393d56===_0x241ec6)break;else _0x5b8d7c['push'](_0x5b8d7c['shift']());}catch(_0x42f4c0){_0x5b8d7c['push'](_0x5b8d7c['shift']());}}}(a234_0x52f4,0x947a9));export function detectSqlMode(_0x288096){const _0x5d0b14=a234_0x7b6d,_0x1e6ca8=_0x288096[_0x5d0b14(0x8f)]();if(/^<(select|insert|update|delete)\b/i[_0x5d0b14(0x8d)](_0x1e6ca8))return'mybatisXml';return _0x5d0b14(0x90);}export function getSqlFileExtension(_0x4ff19e){const _0x541fa9=a234_0x7b6d;return _0x4ff19e==='mybatisXml'?_0x541fa9(0x83):_0x541fa9(0x8b);}export function buildDefaultSqlFileName(_0x4f8e52,_0x5ce7ae){return''+_0x4f8e52+getSqlFileExtension(_0x5ce7ae);}export function sanitizeSqlPathSegment(_0x6d5717,_0x1e917b){const _0x4f11af=a234_0x7b6d,_0x3dd731=String(_0x6d5717??'')[_0x4f11af(0x7b)](),_0x12fe30=_0x3dd731[_0x4f11af(0x84)](/[<>:"/\\|?*\u0000-\u001F]/g,'-')[_0x4f11af(0x84)](/\s+/g,'-')[_0x4f11af(0x84)](/-+/g,'-')['replace'](/^\.+/,'')[_0x4f11af(0x84)](/\.+$/,'')[_0x4f11af(0x84)](/^-+/,'')[_0x4f11af(0x84)](/-+$/,'');return _0x12fe30||_0x1e917b;}export function buildDbDirectoryName(_0x2d0f6b,_0x463f52){const _0x192135=a234_0x7b6d;return sanitizeSqlPathSegment(_0x2d0f6b,_0x463f52!=null?_0x192135(0x85)+_0x463f52:_0x192135(0x8c));}function a234_0x52f4(){const _0x1d041a=['4ajXwZj','18YhgCGR','68489hIyxQn','343630oxFZOL','5DYlcSg','.sql','unknown-db','test','2380259AuVMFy','trimStart','sql','6044272dyBYeT','trim','24vMAndU','12uYJjVO','4839bfcjwG','unknown-sql','1485474hZZjxs','316CFDgRs','9074846zPFxZD','.xml','replace','db-'];a234_0x52f4=function(){return _0x1d041a;};return a234_0x52f4();}function a234_0x7b6d(_0x19296b,_0x34a23a){_0x19296b=_0x19296b-0x7a;const _0x52f421=a234_0x52f4();let _0x7b6d1c=_0x52f421[_0x19296b];return _0x7b6d1c;}export function buildSqlRelativePath(_0x2ed73d,_0x4cea84,_0x38071c,_0x37d135,_0x36a80d){const _0x40dfb9=a234_0x7b6d,_0x443f6a=buildDbDirectoryName(_0x38071c,_0x36a80d),_0x5698ac=sanitizeSqlPathSegment(_0x2ed73d,_0x40dfb9(0x7f)),_0x3eb8a4=sanitizeSqlPathSegment(_0x4cea84,_0x5698ac);return _0x443f6a+'/'+_0x5698ac+'_'+_0x3eb8a4+getSqlFileExtension(_0x37d135);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a227_0x5d9a8f=a227_0x5061;(function(_0x51d63a,_0x43b8a6){const _0x2dfb1e=a227_0x5061,_0x32f5de=_0x51d63a();while(!![]){try{const _0x2c51e4=-parseInt(_0x2dfb1e(0x20e))/0x1*(-parseInt(_0x2dfb1e(0x1f6))/0x2)+parseInt(_0x2dfb1e(0x215))/0x3+-parseInt(_0x2dfb1e(0x21d))/0x4*(-parseInt(_0x2dfb1e(0x239))/0x5)+parseInt(_0x2dfb1e(0x22a))/0x6+parseInt(_0x2dfb1e(0x23a))/0x7*(-parseInt(_0x2dfb1e(0x211))/0x8)+-parseInt(_0x2dfb1e(0x1fa))/0x9+-parseInt(_0x2dfb1e(0x1fb))/0xa*(parseInt(_0x2dfb1e(0x1fd))/0xb);if(_0x2c51e4===_0x43b8a6)break;else _0x32f5de['push'](_0x32f5de['shift']());}catch(_0x4fd05b){_0x32f5de['push'](_0x32f5de['shift']());}}}(a227_0x4ce2,0xdfade));const MYBATIS_OUTER_TAGS=new Map([['select',a227_0x5d9a8f(0x21c)],[a227_0x5d9a8f(0x1f9),a227_0x5d9a8f(0x202)],[a227_0x5d9a8f(0x22e),a227_0x5d9a8f(0x1f5)],['delete',a227_0x5d9a8f(0x21e)]]),MYBATIS_DYNAMIC_TAGS=new Set(['if',a227_0x5d9a8f(0x221),a227_0x5d9a8f(0x233),a227_0x5d9a8f(0x225),a227_0x5d9a8f(0x20b),a227_0x5d9a8f(0x23b),a227_0x5d9a8f(0x217),a227_0x5d9a8f(0x228),a227_0x5d9a8f(0x23d),a227_0x5d9a8f(0x22d),a227_0x5d9a8f(0x207)]),MYBATIS_BRANCH_TAGS=new Set(['if','foreach',a227_0x5d9a8f(0x225),'when',a227_0x5d9a8f(0x23b)]);export const MYBATIS_DYNAMIC_START_MARKER=a227_0x5d9a8f(0x234);export const MYBATIS_DYNAMIC_END_MARKER=a227_0x5d9a8f(0x1e9);export const MYBATIS_INCLUDE_MARKER=a227_0x5d9a8f(0x227);const UNRESOLVED_SQL_FRAGMENT='__RABETBASE_UNRESOLVED_SQL_FRAGMENT__',MYBATIS_OUTER_TAG_PATTERN=new RegExp(a227_0x5d9a8f(0x236)+[...MYBATIS_OUTER_TAGS['keys']()][a227_0x5d9a8f(0x201)]('|')+')\x5cb','i');export function normalizeSqlForStaticAnalysis(_0x7cd4cf){const _0x573348=a227_0x5d9a8f,_0x1c2492=typeof _0x7cd4cf==='string'?_0x7cd4cf:'';if(!startsWithMybatisStatementWrapper(_0x1c2492))return{'sql':_0x1c2492,'mode':_0x573348(0x223)};let _0x447f2a=0x0,_0x564643='',_0x7a5f8c,_0xa4446f=![],_0x2ce7e8=![];const _0x5b9488=[];while(_0x447f2a<_0x1c2492[_0x573348(0x216)]){if(_0x1c2492[_0x573348(0x224)](_0x573348(0x23c),_0x447f2a)){const _0x4f4f9f=_0x1c2492['indexOf'](_0x573348(0x1e6),_0x447f2a+0x4);if(_0x4f4f9f<0x0)return invalidMybatisSource('Unterminated\x20XML\x20comment.');_0x564643+='\x20',_0x447f2a=_0x4f4f9f+0x3;continue;}if(_0x1c2492[_0x573348(0x224)]('<;if(_0x3fc377<0x0)return invalidMybatisSource(_0x573348(0x21b));_0x564643+=_0x1c2492['slice'](_0x447f2a+0x9,_0x3fc377),_0x447f2a=_0x3fc377+0x3;continue;}if(_0x1c2492[_0x573348(0x224)]('<?',_0x447f2a)){if(_0xa4446f)return invalidMybatisSource(_0x573348(0x237));const _0x322111=_0x1c2492[_0x573348(0x1e5)]('?>',_0x447f2a+0x2);if(_0x322111<0x0)return invalidMybatisSource(_0x573348(0x20d));_0x564643+='\x20',_0x447f2a=_0x322111+0x2;continue;}if(_0x1c2492[_0x447f2a]!=='<'){const _0xc5c3c3=_0x1c2492[_0x573348(0x1e5)]('<',_0x447f2a),_0x4005c3=_0xc5c3c3<0x0?_0x1c2492[_0x573348(0x216)]:_0xc5c3c3,_0x220afa=_0x1c2492[_0x573348(0x229)](_0x447f2a,_0x4005c3);if((!_0xa4446f||_0x2ce7e8)&&_0x220afa['trim']())return invalidMybatisSource('SQL\x20text\x20must\x20be\x20inside\x20the\x20MyBatis\x20statement\x20wrapper.');if(_0xa4446f&&!_0x2ce7e8){const _0x4bb83d=decodeXmlEntities(_0x220afa);if(_0x4bb83d===null)return invalidMybatisSource(_0x573348(0x1e4));_0x564643+=_0x4bb83d;}else _0x564643+='\x20';_0x447f2a=_0x4005c3;continue;}const _0x337823=findXmlTagEnd(_0x1c2492,_0x447f2a);if(_0x337823<0x0)return invalidMybatisSource('Unterminated\x20MyBatis\x20XML\x20tag.');const _0x4ea4fa=_0x1c2492['slice'](_0x447f2a,_0x337823+0x1),_0x348129=/^<\s*(\/?)\s*([A-Za-z][\w:-]*)([\s\S]*?)(\/?)\s*>$/['exec'](_0x4ea4fa);if(!_0x348129)return invalidMybatisSource(_0x573348(0x1e1));const _0x25a61a=_0x348129[0x1]==='/',_0x364a88=_0x348129[0x2]??'',_0x1b652d=_0x364a88['toLowerCase'](),_0xc0a5b4=_0x348129[0x3]??'',_0x31c0e3=_0x348129[0x4]==='/',_0x3131bd=MYBATIS_OUTER_TAGS[_0x573348(0x210)](_0x1b652d);if(!_0x3131bd&&!MYBATIS_DYNAMIC_TAGS['has'](_0x1b652d))return invalidMybatisSource(_0x573348(0x1f2)+_0x1b652d+'>.');if(!_0x3131bd&&_0x364a88!==_0x1b652d)return invalidMybatisSource(_0x573348(0x220)+_0x364a88+'>.');if(_0x25a61a){if(_0xc0a5b4['trim']()||_0x31c0e3)return invalidMybatisSource(_0x573348(0x200)+_0x364a88+'>.');const _0x2e6619=_0x5b9488['at'](-0x1);if(!_0x2e6619||(_0x2e6619[_0x573348(0x1e2)]?_0x2e6619['tagName']!==_0x1b652d:_0x2e6619[_0x573348(0x1fc)]!==_0x364a88))return invalidMybatisSource(_0x573348(0x203)+_0x364a88+'>.');_0x5b9488[_0x573348(0x1f8)]();if(_0x2e6619[_0x573348(0x1e2)])_0x2ce7e8=!![];_0x564643+=MYBATIS_BRANCH_TAGS[_0x573348(0x21f)](_0x1b652d)?'\x20'+MYBATIS_DYNAMIC_END_MARKER+'\x20':'\x20';}else{if(!hasWellFormedXmlAttributes(_0xc0a5b4))return invalidMybatisSource('Invalid\x20attributes\x20on\x20MyBatis\x20XML\x20tag:\x20<'+_0x364a88+'>.');if(_0x1b652d===_0x573348(0x207)&&(!_0x31c0e3||_0x5b9488['at'](-0x1)?.[_0x573348(0x222)]!==_0x573348(0x22d)))return invalidMybatisSource(_0x573348(0x204));if(_0x3131bd){if(_0xa4446f||_0x5b9488[_0x573348(0x216)]>0x0)return invalidMybatisSource(_0x573348(0x231));_0xa4446f=!![],_0x2ce7e8=_0x31c0e3,_0x7a5f8c=_0x3131bd;}else{if(!_0xa4446f||_0x2ce7e8)return invalidMybatisSource(_0x573348(0x212)+_0x364a88+'>.');}_0x564643+=_0x1b652d===_0x573348(0x221)?_0x573348(0x1ec):_0x1b652d===_0x573348(0x228)?_0x573348(0x1fe):_0x1b652d===_0x573348(0x22d)?'\x20'+MYBATIS_INCLUDE_MARKER+'\x20':MYBATIS_BRANCH_TAGS['has'](_0x1b652d)&&!_0x31c0e3?'\x20'+MYBATIS_DYNAMIC_START_MARKER+'\x20':'\x20',!_0x31c0e3&&_0x5b9488['push']({'rawName':_0x364a88,'tagName':_0x1b652d,'outer':!!_0x3131bd});}_0x447f2a=_0x337823+0x1;}if(_0x5b9488[_0x573348(0x216)]>0x0)return invalidMybatisSource('Unclosed\x20MyBatis\x20XML\x20tag:\x20<'+_0x5b9488['at'](-0x1)?.[_0x573348(0x1fc)]+'>.');if(!_0xa4446f||!_0x2ce7e8)return invalidMybatisSource(_0x573348(0x22c));return{'sql':_0x564643[_0x573348(0x217)](),'mode':_0x573348(0x209),..._0x7a5f8c?{'statementType':_0x7a5f8c}:{}};}function hasWellFormedXmlAttributes(_0x86e786){const _0x5043bd=a227_0x5d9a8f;let _0x3577c3=0x0;const _0x351342=new Set();while(_0x3577c3<_0x86e786[_0x5043bd(0x216)]){while(_0x3577c3<_0x86e786['length']&&/\s/[_0x5043bd(0x22b)](_0x86e786[_0x3577c3]??''))_0x3577c3+=0x1;if(_0x3577c3>=_0x86e786[_0x5043bd(0x216)])return!![];const _0x153367=/^[A-Za-z_:][\w:.-]*/['exec'](_0x86e786[_0x5043bd(0x229)](_0x3577c3)),_0x16ba5d=_0x153367?.[0x0];if(!_0x16ba5d||_0x351342['has'](_0x16ba5d))return![];_0x351342['add'](_0x16ba5d),_0x3577c3+=_0x16ba5d[_0x5043bd(0x216)];while(_0x3577c3<_0x86e786[_0x5043bd(0x216)]&&/\s/[_0x5043bd(0x22b)](_0x86e786[_0x3577c3]??''))_0x3577c3+=0x1;if(_0x86e786[_0x3577c3]!=='=')return![];_0x3577c3+=0x1;while(_0x3577c3<_0x86e786['length']&&/\s/[_0x5043bd(0x22b)](_0x86e786[_0x3577c3]??''))_0x3577c3+=0x1;const _0x536053=_0x86e786[_0x3577c3];if(_0x536053!=='\x22'&&_0x536053!=='\x27')return![];_0x3577c3+=0x1;const _0x43a96d=_0x86e786[_0x5043bd(0x1e5)](_0x536053,_0x3577c3);if(_0x43a96d<0x0)return![];if(decodeXmlEntities(_0x86e786[_0x5043bd(0x229)](_0x3577c3,_0x43a96d))===null)return![];_0x3577c3=_0x43a96d+0x1;}return!![];}function startsWithMybatisStatementWrapper(_0x3b5670){const _0x357ddc=a227_0x5d9a8f;let _0x14d6e6=0x0;const _0x8f53d5=()=>{const _0x1bd64a=a227_0x5061;while(_0x14d6e6<_0x3b5670[_0x1bd64a(0x216)]&&/\s/['test'](_0x3b5670[_0x14d6e6]??''))_0x14d6e6+=0x1;};_0x8f53d5();while(_0x14d6e6<_0x3b5670[_0x357ddc(0x216)]){if(_0x3b5670[_0x357ddc(0x224)](_0x357ddc(0x23c),_0x14d6e6)){const _0x2c3aec=_0x3b5670['indexOf'](_0x357ddc(0x1e6),_0x14d6e6+0x4);if(_0x2c3aec<0x0)return!![];_0x14d6e6=_0x2c3aec+0x3,_0x8f53d5();continue;}if(_0x3b5670['startsWith']('<?',_0x14d6e6)){const _0x207539=_0x3b5670[_0x357ddc(0x1e5)]('?>',_0x14d6e6+0x2);if(_0x207539<0x0)return!![];_0x14d6e6=_0x207539+0x2,_0x8f53d5();continue;}break;}return MYBATIS_OUTER_TAG_PATTERN['test'](_0x3b5670[_0x357ddc(0x229)](_0x14d6e6));}function a227_0x5061(_0x5eb35a,_0x2b0dec){_0x5eb35a=_0x5eb35a-0x1e1;const _0x4ce2ad=a227_0x4ce2();let _0x506105=_0x4ce2ad[_0x5eb35a];return _0x506105;}function invalidMybatisSource(_0x5ad734){const _0x561960=a227_0x5d9a8f;return{'sql':'','mode':_0x561960(0x209),'error':_0x5ad734};}function findXmlTagEnd(_0x1a5269,_0x4d1867){let _0x5d3e77;for(let _0x476e5f=_0x4d1867+0x1;_0x476e5f<_0x1a5269['length'];_0x476e5f+=0x1){const _0x1999ed=_0x1a5269[_0x476e5f];if(_0x5d3e77){if(_0x1999ed===_0x5d3e77)_0x5d3e77=undefined;continue;}if(_0x1999ed==='\x22'||_0x1999ed==='\x27'){_0x5d3e77=_0x1999ed;continue;}if(_0x1999ed==='>')return _0x476e5f;}return-0x1;}function decodeXmlEntities(_0x14392c){let _0x3d6485=![];const _0x1be684=_0x14392c['replace'](/&(?:#x[0-9a-f]+;|#[0-9]+;|[A-Za-z_:][\w:.-]*;)?/g,_0x47ff41=>{const _0x31da24=a227_0x5061;if(_0x47ff41===_0x31da24(0x1ed))return'<';if(_0x47ff41==='>')return'>';if(_0x47ff41===_0x31da24(0x1e8))return'\x22';if(_0x47ff41===''')return'\x27';if(_0x47ff41===_0x31da24(0x1ea))return'&';const _0x3af98e=/^&#(?:x([0-9a-f]+)|([0-9]+));$/[_0x31da24(0x205)](_0x47ff41);if(_0x3af98e){const _0x5832d6=_0x3af98e[0x1],_0x58c65e=_0x3af98e[0x2],_0x49c333=Number[_0x31da24(0x238)](_0x5832d6??_0x58c65e??'',_0x5832d6?0x10:0xa);if(isValidXmlCharacter(_0x49c333))return String[_0x31da24(0x21a)](_0x49c333);}return _0x3d6485=!![],'';});return _0x3d6485?null:_0x1be684;}function isValidXmlCharacter(_0x2c38d3){return _0x2c38d3===0x9||_0x2c38d3===0xa||_0x2c38d3===0xd||_0x2c38d3>=0x20&&_0x2c38d3<=0xd7ff||_0x2c38d3>=0xe000&&_0x2c38d3<=0xfffd||_0x2c38d3>=0x10000&&_0x2c38d3<=0x10ffff;}export function detectSqlType(_0x5e4576){return detectNormalizedSqlType(normalizeSqlForStaticAnalysis(_0x5e4576));}function detectNormalizedSqlType(_0x31f34e){const _0x5024df=a227_0x5d9a8f;if(_0x31f34e[_0x5024df(0x235)])return{'type':_0x5024df(0x20c),'isSelectOnly':![],'isDangerous':![],'reason':_0x31f34e[_0x5024df(0x235)]};if(!_0x31f34e['sql'][_0x5024df(0x217)]())return{'type':_0x5024df(0x20c),'isSelectOnly':![],'isDangerous':![],'reason':'SQL\x20content\x20is\x20empty'};const _0x3ea41a=stripStaticAnalysisMarkers(_0x31f34e[_0x5024df(0x223)])[_0x5024df(0x208)](/#\{[^}]*\}/g,'?')[_0x5024df(0x208)](/\$\{[^}]*\}/g,'?')[_0x5024df(0x208)](/@[^(\s]+(\([^)]*\))?/g,'')[_0x5024df(0x208)](/\/\*[\s\S]*?\*\//g,'')[_0x5024df(0x217)](),_0x4756e0=_0x3ea41a['split']('\x0a');let _0x168873='';for(const _0x5c27e0 of _0x4756e0){const _0xb69631=_0x5c27e0[_0x5024df(0x217)]();if(!_0xb69631||_0xb69631[_0x5024df(0x224)]('--')||_0xb69631[_0x5024df(0x224)]('/*'))continue;_0x168873=_0xb69631;break;}const _0x45229c=_0x168873[_0x5024df(0x1ff)](),_0x2dc046=_0x31f34e[_0x5024df(0x20a)],_0x242d4a=maskSqlTextForBlockedKeywordScan(_0x3ea41a),_0x2bc2fb=/\b(DELETE|DROP|ALTER|CREATE|TRUNCATE)\b/i[_0x5024df(0x22b)](_0x242d4a);if(_0x2dc046===_0x5024df(0x21c)||!_0x2dc046&&(_0x45229c['startsWith'](_0x5024df(0x21c))||_0x45229c[_0x5024df(0x224)](_0x5024df(0x214)))){const _0x370a02=/\b(INSERT|UPDATE|DELETE|DROP|ALTER|CREATE|TRUNCATE)\b/i[_0x5024df(0x22b)](_0x3ea41a);return{'type':_0x5024df(0x21c),'isSelectOnly':!_0x370a02,'isDangerous':_0x370a02,'reason':_0x370a02?'SQL\x20contains\x20modification\x20statements\x20alongside\x20SELECT':undefined};}if(_0x2dc046===_0x5024df(0x202)||!_0x2dc046&&_0x45229c['startsWith'](_0x5024df(0x202)))return{'type':_0x5024df(0x202),'isSelectOnly':![],'isDangerous':_0x2bc2fb,'reason':_0x2bc2fb?_0x5024df(0x206):undefined};if(_0x2dc046===_0x5024df(0x1f5)||!_0x2dc046&&_0x45229c['startsWith'](_0x5024df(0x1f5)))return{'type':_0x5024df(0x1f5),'isSelectOnly':![],'isDangerous':_0x2bc2fb,'reason':_0x2bc2fb?_0x5024df(0x206):undefined};if(_0x2dc046==='DELETE'||!_0x2dc046&&_0x45229c['startsWith'](_0x5024df(0x21e)))return{'type':_0x5024df(0x21e),'isSelectOnly':![],'isDangerous':!![],'reason':_0x5024df(0x1f7)};if(/^(CREATE|ALTER|DROP|TRUNCATE)/i[_0x5024df(0x22b)](_0x45229c))return{'type':_0x5024df(0x219),'isSelectOnly':![],'isDangerous':!![],'reason':'DDL\x20statements\x20are\x20blocked\x20from\x20auto-save'};return{'type':_0x5024df(0x20c),'isSelectOnly':![],'isDangerous':![]};}function stripStaticAnalysisMarkers(_0x3c3f55){const _0x516f49=a227_0x5d9a8f;return _0x3c3f55[_0x516f49(0x1ee)](MYBATIS_DYNAMIC_START_MARKER,'\x20')[_0x516f49(0x1ee)](MYBATIS_DYNAMIC_END_MARKER,'\x20')[_0x516f49(0x1ee)](MYBATIS_INCLUDE_MARKER,'\x20'+UNRESOLVED_SQL_FRAGMENT+'\x20');}function maskSqlTextForBlockedKeywordScan(_0x24857c){const _0x28aced=a227_0x5d9a8f;return _0x24857c[_0x28aced(0x208)](/'(?:''|\\.|[^'])*'/g,'\x20')[_0x28aced(0x208)](/"(?:""|\\.|[^"])*"/g,'\x20')[_0x28aced(0x208)](/`(?:``|\\.|[^`])*`/g,'\x20')['replace'](/--.*$/gm,'\x20')[_0x28aced(0x208)](/#.*$/gm,'\x20')[_0x28aced(0x208)](/\/\*[\s\S]*?\*\//g,'\x20');}function extractTables(_0x7eae43){const _0x5522c3=a227_0x5d9a8f,_0x437d0b=_0x7eae43[_0x5522c3(0x208)](/#\{[^}]*\}/g,'?')[_0x5522c3(0x208)](/\$\{[^}]*\}/g,'?')[_0x5522c3(0x208)](/'[^']*'/g,'\x27\x27')[_0x5522c3(0x208)](/--.*$/gm,'')[_0x5522c3(0x208)](/\/\*[\s\S]*?\*\//g,''),_0x302505=[],_0x1edf98=_0x437d0b[_0x5522c3(0x1e3)](/FROM\s+([^\s,)(]+)/i);addTable(_0x302505,_0x1edf98?.[0x1]);for(const _0x5caf52 of _0x437d0b[_0x5522c3(0x1f3)](/(?:INNER|LEFT|RIGHT|FULL|CROSS)?\s*JOIN\s+([^\s,)(]+)/gi)){addTable(_0x302505,_0x5caf52[0x1]);}const _0x101ff9=_0x437d0b[_0x5522c3(0x1e3)](/INTO\s+([^\s(]+)/i);addTable(_0x302505,_0x101ff9?.[0x1]);const _0x1359f2=_0x437d0b[_0x5522c3(0x1e3)](/UPDATE\s+([^\s,)(]+)/i);return addTable(_0x302505,_0x1359f2?.[0x1]),_0x302505;}function addTable(_0x33e242,_0x167e4b){const _0x1c3f2a=a227_0x5d9a8f,_0x3e7f24=_0x167e4b?.['replace'](/[`"]/g,'');_0x3e7f24&&_0x3e7f24!==UNRESOLVED_SQL_FRAGMENT&&!_0x33e242[_0x1c3f2a(0x218)](_0x3e7f24)&&_0x33e242[_0x1c3f2a(0x213)](_0x3e7f24);}function extractParameters(_0x596ee9){const _0x480ebb=a227_0x5d9a8f,_0x345bba=new Set();for(const _0x2163e3 of _0x596ee9[_0x480ebb(0x1f3)](/[#$]\{\s*([A-Za-z_][\w.]*)\s*(?=[,}])/g)){if(_0x2163e3[0x1])_0x345bba[_0x480ebb(0x230)](_0x2163e3[0x1]);}return Array[_0x480ebb(0x232)](_0x345bba);}function a227_0x4ce2(){const _0x5940be=['Unable\x20to\x20detect\x20SQL\x20type.\x20Please\x20check\x20the\x20SQL\x20content.','Unsupported\x20MyBatis\x20XML\x20tag:\x20<','matchAll','\x20query\x20targeting\x20','UPDATE','348iAUwwa','DELETE\x20statements\x20are\x20blocked\x20from\x20auto-save','pop','insert','13687956aNZuZK','125500nShUfn','rawName','275TbeDBE','\x20SET\x20','toUpperCase','Invalid\x20MyBatis\x20XML\x20closing\x20tag:\x20</','join','INSERT','Mismatched\x20MyBatis\x20XML\x20closing\x20tag:\x20</','MyBatis\x20<property>\x20must\x20be\x20a\x20self-closing\x20direct\x20child\x20of\x20<include>.','exec','SQL\x20contains\x20blocked\x20DELETE\x20or\x20DDL\x20statements','property','replace','mybatisXml','statementType','when','UNKNOWN','Unterminated\x20XML\x20declaration.','2547rqMNUp','\x20with\x20parameters:\x20','get','4984FaZpGj','MyBatis\x20dynamic\x20tag\x20must\x20be\x20inside\x20the\x20statement\x20wrapper:\x20<','push','WITH','2364561isXIiG','length','trim','includes','DDL','fromCodePoint','Unterminated\x20CDATA\x20section.','SELECT','692xSIyCM','DELETE','has','MyBatis\x20dynamic\x20tag\x20names\x20must\x20be\x20lowercase:\x20<','where','tagName','sql','startsWith','choose','reason','__RABETBASE_MYBATIS_INCLUDE_UNRESOLVED__','set','slice','7123404SZchtN','test','MyBatis\x20XML\x20must\x20contain\x20exactly\x20one\x20complete\x20statement\x20wrapper.','include','update','Unable\x20to\x20detect\x20SQL\x20type.\x20','add','Multiple\x20MyBatis\x20statement\x20wrappers\x20are\x20not\x20supported.','from','foreach','__RABETBASE_MYBATIS_DYNAMIC_START__','error','^<\x5cs*(?:','XML\x20declarations\x20must\x20precede\x20the\x20MyBatis\x20statement\x20wrapper.','parseInt','38015moGIwO','11046aBCFnc','otherwise','<!--','bind','Invalid\x20MyBatis\x20XML\x20tag.','outer','match','Invalid\x20XML\x20entity\x20reference.','indexOf','-->','CDATA\x20sections\x20must\x20be\x20inside\x20the\x20MyBatis\x20statement\x20wrapper.','"','__RABETBASE_MYBATIS_DYNAMIC_END__','&','\x20statements\x20cannot\x20be\x20auto-saved.\x20Please\x20operate\x20manually\x20on\x20the\x20platform.','\x20WHERE\x20','<','replaceAll','type','isDangerous'];a227_0x4ce2=function(){return _0x5940be;};return a227_0x4ce2();}export function validateSql(_0x312bbf){const _0x598057=a227_0x5d9a8f,_0x5ab62d=normalizeSqlForStaticAnalysis(_0x312bbf),_0x181056=detectNormalizedSqlType(_0x5ab62d),_0x39f931=stripStaticAnalysisMarkers(_0x5ab62d['sql']),_0x19e3c4=_0x5ab62d[_0x598057(0x235)]?[]:extractTables(_0x39f931),_0x41fb4d=_0x5ab62d[_0x598057(0x235)]?[]:extractParameters(_0x39f931);if(_0x181056[_0x598057(0x1f0)])return{'valid':![],'sqlType':_0x181056,'tables':_0x19e3c4,'parameters':_0x41fb4d,'message':_0x181056[_0x598057(0x226)]||_0x181056[_0x598057(0x1ef)]+_0x598057(0x1eb)};if(_0x181056['type']===_0x598057(0x20c))return{'valid':![],'sqlType':_0x181056,'tables':_0x19e3c4,'parameters':_0x41fb4d,'message':_0x5ab62d['error']?_0x598057(0x22f)+_0x5ab62d[_0x598057(0x235)]:_0x598057(0x1f1)};return{'valid':!![],'sqlType':_0x181056,'tables':_0x19e3c4,'parameters':_0x41fb4d,'message':_0x181056[_0x598057(0x1ef)]+_0x598057(0x1f4)+(_0x19e3c4[_0x598057(0x216)]?_0x19e3c4['join'](',\x20'):'unknown\x20table(s)')+(_0x41fb4d[_0x598057(0x216)]?_0x598057(0x20f)+_0x41fb4d[_0x598057(0x201)](',\x20'):'')};}
|
|
1
|
+
const a235_0x354b9f=a235_0x256d;(function(_0x5042ff,_0x5ad9f7){const _0x418eb4=a235_0x256d,_0x43551a=_0x5042ff();while(!![]){try{const _0x28a21f=parseInt(_0x418eb4(0x125))/0x1*(parseInt(_0x418eb4(0x16a))/0x2)+parseInt(_0x418eb4(0x139))/0x3*(-parseInt(_0x418eb4(0x151))/0x4)+parseInt(_0x418eb4(0x172))/0x5*(parseInt(_0x418eb4(0x131))/0x6)+-parseInt(_0x418eb4(0x119))/0x7*(-parseInt(_0x418eb4(0x11a))/0x8)+parseInt(_0x418eb4(0x173))/0x9*(-parseInt(_0x418eb4(0x16d))/0xa)+-parseInt(_0x418eb4(0x175))/0xb+-parseInt(_0x418eb4(0x155))/0xc*(-parseInt(_0x418eb4(0x15e))/0xd);if(_0x28a21f===_0x5ad9f7)break;else _0x43551a['push'](_0x43551a['shift']());}catch(_0x308f46){_0x43551a['push'](_0x43551a['shift']());}}}(a235_0x2275,0x37643));const MYBATIS_OUTER_TAGS=new Map([['select',a235_0x354b9f(0x12a)],[a235_0x354b9f(0x149),a235_0x354b9f(0x126)],[a235_0x354b9f(0x16b),a235_0x354b9f(0x13d)],[a235_0x354b9f(0x13f),a235_0x354b9f(0x11e)]]),MYBATIS_DYNAMIC_TAGS=new Set(['if',a235_0x354b9f(0x162),a235_0x354b9f(0x135),a235_0x354b9f(0x134),a235_0x354b9f(0x150),a235_0x354b9f(0x14b),a235_0x354b9f(0x137),'set',a235_0x354b9f(0x176),a235_0x354b9f(0x133),a235_0x354b9f(0x14f)]),MYBATIS_BRANCH_TAGS=new Set(['if','foreach',a235_0x354b9f(0x134),a235_0x354b9f(0x150),a235_0x354b9f(0x14b)]);export const MYBATIS_DYNAMIC_START_MARKER=a235_0x354b9f(0x124);export const MYBATIS_DYNAMIC_END_MARKER=a235_0x354b9f(0x163);export const MYBATIS_INCLUDE_MARKER=a235_0x354b9f(0x15d);const UNRESOLVED_SQL_FRAGMENT=a235_0x354b9f(0x12e),MYBATIS_OUTER_TAG_PATTERN=new RegExp(a235_0x354b9f(0x15a)+[...MYBATIS_OUTER_TAGS[a235_0x354b9f(0x118)]()][a235_0x354b9f(0x14e)]('|')+a235_0x354b9f(0x160),'i');export function normalizeSqlForStaticAnalysis(_0x35d31b){const _0x4dda78=a235_0x354b9f,_0x263059=typeof _0x35d31b==='string'?_0x35d31b:'';if(!startsWithMybatisStatementWrapper(_0x263059))return{'sql':_0x263059,'mode':_0x4dda78(0x159)};let _0x107e2d=0x0,_0x55c7f2='',_0x3af143,_0x457258=![],_0x59fa27=![];const _0x3c3098=[];while(_0x107e2d<_0x263059[_0x4dda78(0x153)]){if(_0x263059['startsWith'](_0x4dda78(0x14a),_0x107e2d)){const _0xfa743a=_0x263059[_0x4dda78(0x179)]('-->',_0x107e2d+0x4);if(_0xfa743a<0x0)return invalidMybatisSource(_0x4dda78(0x152));_0x55c7f2+='\x20',_0x107e2d=_0xfa743a+0x3;continue;}if(_0x263059[_0x4dda78(0x164)](_0x4dda78(0x16f),_0x107e2d)){if(!_0x457258||_0x59fa27)return invalidMybatisSource(_0x4dda78(0x12b));const _0x19aeeb=_0x263059[_0x4dda78(0x179)](']]>',_0x107e2d+0x9);if(_0x19aeeb<0x0)return invalidMybatisSource(_0x4dda78(0x14d));_0x55c7f2+=_0x263059[_0x4dda78(0x144)](_0x107e2d+0x9,_0x19aeeb),_0x107e2d=_0x19aeeb+0x3;continue;}if(_0x263059[_0x4dda78(0x164)]('<?',_0x107e2d)){if(_0x457258)return invalidMybatisSource(_0x4dda78(0x145));const _0x16b9d8=_0x263059['indexOf']('?>',_0x107e2d+0x2);if(_0x16b9d8<0x0)return invalidMybatisSource(_0x4dda78(0x16c));_0x55c7f2+='\x20',_0x107e2d=_0x16b9d8+0x2;continue;}if(_0x263059[_0x107e2d]!=='<'){const _0x552c6b=_0x263059[_0x4dda78(0x179)]('<',_0x107e2d),_0x135463=_0x552c6b<0x0?_0x263059[_0x4dda78(0x153)]:_0x552c6b,_0x23e0c4=_0x263059[_0x4dda78(0x144)](_0x107e2d,_0x135463);if((!_0x457258||_0x59fa27)&&_0x23e0c4['trim']())return invalidMybatisSource(_0x4dda78(0x11f));if(_0x457258&&!_0x59fa27){const _0x22c7a4=decodeXmlEntities(_0x23e0c4);if(_0x22c7a4===null)return invalidMybatisSource(_0x4dda78(0x166));_0x55c7f2+=_0x22c7a4;}else _0x55c7f2+='\x20';_0x107e2d=_0x135463;continue;}const _0xa4ad97=findXmlTagEnd(_0x263059,_0x107e2d);if(_0xa4ad97<0x0)return invalidMybatisSource('Unterminated\x20MyBatis\x20XML\x20tag.');const _0x1e265e=_0x263059['slice'](_0x107e2d,_0xa4ad97+0x1),_0x400305=/^<\s*(\/?)\s*([A-Za-z][\w:-]*)([\s\S]*?)(\/?)\s*>$/[_0x4dda78(0x171)](_0x1e265e);if(!_0x400305)return invalidMybatisSource(_0x4dda78(0x154));const _0x10f216=_0x400305[0x1]==='/',_0x4ada0a=_0x400305[0x2]??'',_0xb3d57b=_0x4ada0a['toLowerCase'](),_0x4c2958=_0x400305[0x3]??'',_0x3373b8=_0x400305[0x4]==='/',_0xf8fd3e=MYBATIS_OUTER_TAGS[_0x4dda78(0x14c)](_0xb3d57b);if(!_0xf8fd3e&&!MYBATIS_DYNAMIC_TAGS[_0x4dda78(0x142)](_0xb3d57b))return invalidMybatisSource(_0x4dda78(0x158)+_0xb3d57b+'>.');if(!_0xf8fd3e&&_0x4ada0a!==_0xb3d57b)return invalidMybatisSource(_0x4dda78(0x157)+_0x4ada0a+'>.');if(_0x10f216){if(_0x4c2958['trim']()||_0x3373b8)return invalidMybatisSource(_0x4dda78(0x11c)+_0x4ada0a+'>.');const _0xb51823=_0x3c3098['at'](-0x1);if(!_0xb51823||(_0xb51823['outer']?_0xb51823[_0x4dda78(0x130)]!==_0xb3d57b:_0xb51823[_0x4dda78(0x11d)]!==_0x4ada0a))return invalidMybatisSource('Mismatched\x20MyBatis\x20XML\x20closing\x20tag:\x20</'+_0x4ada0a+'>.');_0x3c3098['pop']();if(_0xb51823[_0x4dda78(0x12d)])_0x59fa27=!![];_0x55c7f2+=MYBATIS_BRANCH_TAGS[_0x4dda78(0x142)](_0xb3d57b)?'\x20'+MYBATIS_DYNAMIC_END_MARKER+'\x20':'\x20';}else{if(!hasWellFormedXmlAttributes(_0x4c2958))return invalidMybatisSource('Invalid\x20attributes\x20on\x20MyBatis\x20XML\x20tag:\x20<'+_0x4ada0a+'>.');if(_0xb3d57b===_0x4dda78(0x14f)&&(!_0x3373b8||_0x3c3098['at'](-0x1)?.[_0x4dda78(0x130)]!==_0x4dda78(0x133)))return invalidMybatisSource(_0x4dda78(0x178));if(_0xf8fd3e){if(_0x457258||_0x3c3098[_0x4dda78(0x153)]>0x0)return invalidMybatisSource(_0x4dda78(0x161));_0x457258=!![],_0x59fa27=_0x3373b8,_0x3af143=_0xf8fd3e;}else{if(!_0x457258||_0x59fa27)return invalidMybatisSource(_0x4dda78(0x147)+_0x4ada0a+'>.');}_0x55c7f2+=_0xb3d57b===_0x4dda78(0x162)?'\x20WHERE\x20':_0xb3d57b===_0x4dda78(0x15b)?_0x4dda78(0x12c):_0xb3d57b===_0x4dda78(0x133)?'\x20'+MYBATIS_INCLUDE_MARKER+'\x20':MYBATIS_BRANCH_TAGS[_0x4dda78(0x142)](_0xb3d57b)&&!_0x3373b8?'\x20'+MYBATIS_DYNAMIC_START_MARKER+'\x20':'\x20',!_0x3373b8&&_0x3c3098[_0x4dda78(0x167)]({'rawName':_0x4ada0a,'tagName':_0xb3d57b,'outer':!!_0xf8fd3e});}_0x107e2d=_0xa4ad97+0x1;}if(_0x3c3098[_0x4dda78(0x153)]>0x0)return invalidMybatisSource(_0x4dda78(0x168)+_0x3c3098['at'](-0x1)?.[_0x4dda78(0x11d)]+'>.');if(!_0x457258||!_0x59fa27)return invalidMybatisSource('MyBatis\x20XML\x20must\x20contain\x20exactly\x20one\x20complete\x20statement\x20wrapper.');return{'sql':_0x55c7f2['trim'](),'mode':'mybatisXml',..._0x3af143?{'statementType':_0x3af143}:{}};}function hasWellFormedXmlAttributes(_0x4d2f2a){const _0x36f5a5=a235_0x354b9f;let _0x73face=0x0;const _0x2e2e91=new Set();while(_0x73face<_0x4d2f2a[_0x36f5a5(0x153)]){while(_0x73face<_0x4d2f2a['length']&&/\s/[_0x36f5a5(0x13e)](_0x4d2f2a[_0x73face]??''))_0x73face+=0x1;if(_0x73face>=_0x4d2f2a[_0x36f5a5(0x153)])return!![];const _0x30d841=/^[A-Za-z_:][\w:.-]*/[_0x36f5a5(0x171)](_0x4d2f2a[_0x36f5a5(0x144)](_0x73face)),_0x35f44f=_0x30d841?.[0x0];if(!_0x35f44f||_0x2e2e91[_0x36f5a5(0x142)](_0x35f44f))return![];_0x2e2e91[_0x36f5a5(0x128)](_0x35f44f),_0x73face+=_0x35f44f[_0x36f5a5(0x153)];while(_0x73face<_0x4d2f2a[_0x36f5a5(0x153)]&&/\s/[_0x36f5a5(0x13e)](_0x4d2f2a[_0x73face]??''))_0x73face+=0x1;if(_0x4d2f2a[_0x73face]!=='=')return![];_0x73face+=0x1;while(_0x73face<_0x4d2f2a['length']&&/\s/[_0x36f5a5(0x13e)](_0x4d2f2a[_0x73face]??''))_0x73face+=0x1;const _0x20b057=_0x4d2f2a[_0x73face];if(_0x20b057!=='\x22'&&_0x20b057!=='\x27')return![];_0x73face+=0x1;const _0x5775cb=_0x4d2f2a[_0x36f5a5(0x179)](_0x20b057,_0x73face);if(_0x5775cb<0x0)return![];if(decodeXmlEntities(_0x4d2f2a[_0x36f5a5(0x144)](_0x73face,_0x5775cb))===null)return![];_0x73face=_0x5775cb+0x1;}return!![];}function startsWithMybatisStatementWrapper(_0x8dcaf3){const _0x1ca39c=a235_0x354b9f;let _0x1d3dc2=0x0;const _0x480f67=()=>{const _0x244410=a235_0x256d;while(_0x1d3dc2<_0x8dcaf3[_0x244410(0x153)]&&/\s/['test'](_0x8dcaf3[_0x1d3dc2]??''))_0x1d3dc2+=0x1;};_0x480f67();while(_0x1d3dc2<_0x8dcaf3[_0x1ca39c(0x153)]){if(_0x8dcaf3['startsWith'](_0x1ca39c(0x14a),_0x1d3dc2)){const _0x280aec=_0x8dcaf3['indexOf'](_0x1ca39c(0x141),_0x1d3dc2+0x4);if(_0x280aec<0x0)return!![];_0x1d3dc2=_0x280aec+0x3,_0x480f67();continue;}if(_0x8dcaf3[_0x1ca39c(0x164)]('<?',_0x1d3dc2)){const _0x422047=_0x8dcaf3['indexOf']('?>',_0x1d3dc2+0x2);if(_0x422047<0x0)return!![];_0x1d3dc2=_0x422047+0x2,_0x480f67();continue;}break;}return MYBATIS_OUTER_TAG_PATTERN['test'](_0x8dcaf3[_0x1ca39c(0x144)](_0x1d3dc2));}function invalidMybatisSource(_0x5cd9a0){const _0xe5408=a235_0x354b9f;return{'sql':'','mode':_0xe5408(0x174),'error':_0x5cd9a0};}function findXmlTagEnd(_0xfb8c0f,_0xd16ea2){const _0x1879f2=a235_0x354b9f;let _0x4fff35;for(let _0x57054c=_0xd16ea2+0x1;_0x57054c<_0xfb8c0f[_0x1879f2(0x153)];_0x57054c+=0x1){const _0x125ef5=_0xfb8c0f[_0x57054c];if(_0x4fff35){if(_0x125ef5===_0x4fff35)_0x4fff35=undefined;continue;}if(_0x125ef5==='\x22'||_0x125ef5==='\x27'){_0x4fff35=_0x125ef5;continue;}if(_0x125ef5==='>')return _0x57054c;}return-0x1;}function decodeXmlEntities(_0x10336b){const _0x3dcf1a=a235_0x354b9f;let _0x3a6546=![];const _0x27bd6a=_0x10336b[_0x3dcf1a(0x120)](/&(?:#x[0-9a-f]+;|#[0-9]+;|[A-Za-z_:][\w:.-]*;)?/g,_0x2bae74=>{const _0x2825b2=_0x3dcf1a;if(_0x2bae74==='<')return'<';if(_0x2bae74===_0x2825b2(0x122))return'>';if(_0x2bae74==='"')return'\x22';if(_0x2bae74===_0x2825b2(0x143))return'\x27';if(_0x2bae74==='&')return'&';const _0x4876fd=/^&#(?:x([0-9a-f]+)|([0-9]+));$/['exec'](_0x2bae74);if(_0x4876fd){const _0x37d04f=_0x4876fd[0x1],_0x7f0d15=_0x4876fd[0x2],_0xdc5b78=Number[_0x2825b2(0x156)](_0x37d04f??_0x7f0d15??'',_0x37d04f?0x10:0xa);if(isValidXmlCharacter(_0xdc5b78))return String[_0x2825b2(0x129)](_0xdc5b78);}return _0x3a6546=!![],'';});return _0x3a6546?null:_0x27bd6a;}function isValidXmlCharacter(_0x181cda){return _0x181cda===0x9||_0x181cda===0xa||_0x181cda===0xd||_0x181cda>=0x20&&_0x181cda<=0xd7ff||_0x181cda>=0xe000&&_0x181cda<=0xfffd||_0x181cda>=0x10000&&_0x181cda<=0x10ffff;}export function detectSqlType(_0xb3c8f){return detectNormalizedSqlType(normalizeSqlForStaticAnalysis(_0xb3c8f));}function detectNormalizedSqlType(_0x49a8bc){const _0x34ac62=a235_0x354b9f;if(_0x49a8bc[_0x34ac62(0x132)])return{'type':'UNKNOWN','isSelectOnly':![],'isDangerous':![],'reason':_0x49a8bc[_0x34ac62(0x132)]};if(!_0x49a8bc[_0x34ac62(0x159)][_0x34ac62(0x137)]())return{'type':_0x34ac62(0x165),'isSelectOnly':![],'isDangerous':![],'reason':_0x34ac62(0x13c)};const _0x10a4d2=stripStaticAnalysisMarkers(_0x49a8bc[_0x34ac62(0x159)])[_0x34ac62(0x120)](/#\{[^}]*\}/g,'?')['replace'](/\$\{[^}]*\}/g,'?')['replace'](/@[^(\s]+(\([^)]*\))?/g,'')['replace'](/\/\*[\s\S]*?\*\//g,'')[_0x34ac62(0x137)](),_0x280e69=_0x10a4d2['split']('\x0a');let _0x3d69ba='';for(const _0x45cf2b of _0x280e69){const _0x61041b=_0x45cf2b['trim']();if(!_0x61041b||_0x61041b[_0x34ac62(0x164)]('--')||_0x61041b['startsWith']('/*'))continue;_0x3d69ba=_0x61041b;break;}const _0x5619b3=_0x3d69ba[_0x34ac62(0x177)](),_0x3a7420=_0x49a8bc[_0x34ac62(0x15c)],_0x5d114e=maskSqlTextForBlockedKeywordScan(_0x10a4d2),_0x32185f=/\b(DELETE|DROP|ALTER|CREATE|TRUNCATE)\b/i[_0x34ac62(0x13e)](_0x5d114e);if(_0x3a7420==='SELECT'||!_0x3a7420&&(_0x5619b3[_0x34ac62(0x164)]('SELECT')||_0x5619b3[_0x34ac62(0x164)]('WITH'))){const _0x170604=/\b(INSERT|UPDATE|DELETE|DROP|ALTER|CREATE|TRUNCATE)\b/i[_0x34ac62(0x13e)](_0x10a4d2);return{'type':_0x34ac62(0x12a),'isSelectOnly':!_0x170604,'isDangerous':_0x170604,'reason':_0x170604?'SQL\x20contains\x20modification\x20statements\x20alongside\x20SELECT':undefined};}if(_0x3a7420===_0x34ac62(0x126)||!_0x3a7420&&_0x5619b3[_0x34ac62(0x164)](_0x34ac62(0x126)))return{'type':'INSERT','isSelectOnly':![],'isDangerous':_0x32185f,'reason':_0x32185f?_0x34ac62(0x170):undefined};if(_0x3a7420==='UPDATE'||!_0x3a7420&&_0x5619b3[_0x34ac62(0x164)](_0x34ac62(0x13d)))return{'type':_0x34ac62(0x13d),'isSelectOnly':![],'isDangerous':_0x32185f,'reason':_0x32185f?_0x34ac62(0x170):undefined};if(_0x3a7420===_0x34ac62(0x11e)||!_0x3a7420&&_0x5619b3[_0x34ac62(0x164)](_0x34ac62(0x11e)))return{'type':'DELETE','isSelectOnly':![],'isDangerous':!![],'reason':_0x34ac62(0x17a)};if(/^(CREATE|ALTER|DROP|TRUNCATE)/i['test'](_0x5619b3))return{'type':_0x34ac62(0x15f),'isSelectOnly':![],'isDangerous':!![],'reason':_0x34ac62(0x11b)};return{'type':'UNKNOWN','isSelectOnly':![],'isDangerous':![]};}function stripStaticAnalysisMarkers(_0x3f486d){const _0x1da747=a235_0x354b9f;return _0x3f486d['replaceAll'](MYBATIS_DYNAMIC_START_MARKER,'\x20')[_0x1da747(0x148)](MYBATIS_DYNAMIC_END_MARKER,'\x20')['replaceAll'](MYBATIS_INCLUDE_MARKER,'\x20'+UNRESOLVED_SQL_FRAGMENT+'\x20');}function a235_0x2275(){const _0x5144e0=['Unable\x20to\x20detect\x20SQL\x20type.\x20','add','fromCodePoint','SELECT','CDATA\x20sections\x20must\x20be\x20inside\x20the\x20MyBatis\x20statement\x20wrapper.','\x20SET\x20','outer','__RABETBASE_UNRESOLVED_SQL_FRAGMENT__','reason','tagName','1326qZHkTr','error','include','choose','foreach','\x20with\x20parameters:\x20','trim','\x20statements\x20cannot\x20be\x20auto-saved.\x20Please\x20operate\x20manually\x20on\x20the\x20platform.','4068aJnAdw','type','match','SQL\x20content\x20is\x20empty','UPDATE','test','delete','includes','-->','has',''','slice','XML\x20declarations\x20must\x20precede\x20the\x20MyBatis\x20statement\x20wrapper.','from','MyBatis\x20dynamic\x20tag\x20must\x20be\x20inside\x20the\x20statement\x20wrapper:\x20<','replaceAll','insert','<!--','otherwise','get','Unterminated\x20CDATA\x20section.','join','property','when','884MwccGy','Unterminated\x20XML\x20comment.','length','Invalid\x20MyBatis\x20XML\x20tag.','2316Tmrcrk','parseInt','MyBatis\x20dynamic\x20tag\x20names\x20must\x20be\x20lowercase:\x20<','Unsupported\x20MyBatis\x20XML\x20tag:\x20<','sql','^<\x5cs*(?:','set','statementType','__RABETBASE_MYBATIS_INCLUDE_UNRESOLVED__','4979uRDzge','DDL',')\x5cb','Multiple\x20MyBatis\x20statement\x20wrappers\x20are\x20not\x20supported.','where','__RABETBASE_MYBATIS_DYNAMIC_END__','startsWith','UNKNOWN','Invalid\x20XML\x20entity\x20reference.','push','Unclosed\x20MyBatis\x20XML\x20tag:\x20<','\x20query\x20targeting\x20','2PpJIqb','update','Unterminated\x20XML\x20declaration.','10HzWdLd','unknown\x20table(s)','<![CDATA[','SQL\x20contains\x20blocked\x20DELETE\x20or\x20DDL\x20statements','exec','8455GUjAPD','2440674mivPpB','mybatisXml','1160016qbNteq','bind','toUpperCase','MyBatis\x20<property>\x20must\x20be\x20a\x20self-closing\x20direct\x20child\x20of\x20<include>.','indexOf','DELETE\x20statements\x20are\x20blocked\x20from\x20auto-save','keys','14wuKtUs','460232RBWoBm','DDL\x20statements\x20are\x20blocked\x20from\x20auto-save','Invalid\x20MyBatis\x20XML\x20closing\x20tag:\x20</','rawName','DELETE','SQL\x20text\x20must\x20be\x20inside\x20the\x20MyBatis\x20statement\x20wrapper.','replace','matchAll','>','Unable\x20to\x20detect\x20SQL\x20type.\x20Please\x20check\x20the\x20SQL\x20content.','__RABETBASE_MYBATIS_DYNAMIC_START__','340513FKaaSJ','INSERT'];a235_0x2275=function(){return _0x5144e0;};return a235_0x2275();}function a235_0x256d(_0x16a3d1,_0x340251){_0x16a3d1=_0x16a3d1-0x118;const _0x22759e=a235_0x2275();let _0x256d37=_0x22759e[_0x16a3d1];return _0x256d37;}function maskSqlTextForBlockedKeywordScan(_0x157821){const _0x40a70c=a235_0x354b9f;return _0x157821[_0x40a70c(0x120)](/'(?:''|\\.|[^'])*'/g,'\x20')['replace'](/"(?:""|\\.|[^"])*"/g,'\x20')[_0x40a70c(0x120)](/`(?:``|\\.|[^`])*`/g,'\x20')[_0x40a70c(0x120)](/--.*$/gm,'\x20')[_0x40a70c(0x120)](/#.*$/gm,'\x20')[_0x40a70c(0x120)](/\/\*[\s\S]*?\*\//g,'\x20');}function extractTables(_0x3c90c9){const _0x44441c=a235_0x354b9f,_0x51963f=_0x3c90c9[_0x44441c(0x120)](/#\{[^}]*\}/g,'?')[_0x44441c(0x120)](/\$\{[^}]*\}/g,'?')[_0x44441c(0x120)](/'[^']*'/g,'\x27\x27')['replace'](/--.*$/gm,'')[_0x44441c(0x120)](/\/\*[\s\S]*?\*\//g,''),_0xe0c65=[],_0x3a7de5=_0x51963f[_0x44441c(0x13b)](/FROM\s+([^\s,)(]+)/i);addTable(_0xe0c65,_0x3a7de5?.[0x1]);for(const _0x1bec1b of _0x51963f[_0x44441c(0x121)](/(?:INNER|LEFT|RIGHT|FULL|CROSS)?\s*JOIN\s+([^\s,)(]+)/gi)){addTable(_0xe0c65,_0x1bec1b[0x1]);}const _0x1fceb7=_0x51963f[_0x44441c(0x13b)](/INTO\s+([^\s(]+)/i);addTable(_0xe0c65,_0x1fceb7?.[0x1]);const _0x206ac7=_0x51963f[_0x44441c(0x13b)](/UPDATE\s+([^\s,)(]+)/i);return addTable(_0xe0c65,_0x206ac7?.[0x1]),_0xe0c65;}function addTable(_0x3d82df,_0x18a1c2){const _0x2b44d9=a235_0x354b9f,_0xd1d9de=_0x18a1c2?.[_0x2b44d9(0x120)](/[`"]/g,'');_0xd1d9de&&_0xd1d9de!==UNRESOLVED_SQL_FRAGMENT&&!_0x3d82df[_0x2b44d9(0x140)](_0xd1d9de)&&_0x3d82df[_0x2b44d9(0x167)](_0xd1d9de);}function extractParameters(_0x55b644){const _0x3e0845=a235_0x354b9f,_0x2178fd=new Set();for(const _0x3dfc86 of _0x55b644[_0x3e0845(0x121)](/[#$]\{\s*([A-Za-z_][\w.]*)\s*(?=[,}])/g)){if(_0x3dfc86[0x1])_0x2178fd[_0x3e0845(0x128)](_0x3dfc86[0x1]);}return Array[_0x3e0845(0x146)](_0x2178fd);}export function validateSql(_0x49aa21){const _0xa882d5=a235_0x354b9f,_0x421ac0=normalizeSqlForStaticAnalysis(_0x49aa21),_0x747197=detectNormalizedSqlType(_0x421ac0),_0xa90295=stripStaticAnalysisMarkers(_0x421ac0['sql']),_0x1d659c=_0x421ac0['error']?[]:extractTables(_0xa90295),_0x20af5b=_0x421ac0['error']?[]:extractParameters(_0xa90295);if(_0x747197['isDangerous'])return{'valid':![],'sqlType':_0x747197,'tables':_0x1d659c,'parameters':_0x20af5b,'message':_0x747197[_0xa882d5(0x12f)]||_0x747197['type']+_0xa882d5(0x138)};if(_0x747197[_0xa882d5(0x13a)]==='UNKNOWN')return{'valid':![],'sqlType':_0x747197,'tables':_0x1d659c,'parameters':_0x20af5b,'message':_0x421ac0[_0xa882d5(0x132)]?_0xa882d5(0x127)+_0x421ac0['error']:_0xa882d5(0x123)};return{'valid':!![],'sqlType':_0x747197,'tables':_0x1d659c,'parameters':_0x20af5b,'message':_0x747197[_0xa882d5(0x13a)]+_0xa882d5(0x169)+(_0x1d659c['length']?_0x1d659c[_0xa882d5(0x14e)](',\x20'):_0xa882d5(0x16e))+(_0x20af5b['length']?_0xa882d5(0x136)+_0x20af5b[_0xa882d5(0x14e)](',\x20'):'')};}
|
package/lib/errors.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a236_0x32c8(){const _0x2c8492=['27452200gejpKl','\x20init\x20--appcode\x20<code>\x20--global`\x20registers\x20globally\x20so\x20you\x20can\x20use\x20it\x20from\x20anywhere.','9282960SSbEvi','2748VOFqNb','Tip:\x20`','1626iCbaaW','35077vAqQOS','606KRgsmi','Run\x20`','6654qLPmxZ','1176HHVNdA','Run\x20this\x20command\x20inside\x20a\x20project\x20with\x20.rabetbase.json\x20file.','3366940ojhfpk','10499152nMWNJV','\x20auth`\x20to\x20login\x20first.'];a236_0x32c8=function(){return _0x2c8492;};return a236_0x32c8();}function a236_0x4e6a(_0x37bfb4,_0xea5fc4){_0x37bfb4=_0x37bfb4-0x10e;const _0x32c8b5=a236_0x32c8();let _0x4e6a3d=_0x32c8b5[_0x37bfb4];return _0x4e6a3d;}const a236_0x4553db=a236_0x4e6a;(function(_0x43ec0e,_0x2d2cd5){const _0x465a4b=a236_0x4e6a,_0x43698e=_0x43ec0e();while(!![]){try{const _0xc3b281=-parseInt(_0x465a4b(0x111))/0x1*(parseInt(_0x465a4b(0x115))/0x2)+-parseInt(_0x465a4b(0x117))/0x3*(-parseInt(_0x465a4b(0x118))/0x4)+-parseInt(_0x465a4b(0x11a))/0x5+-parseInt(_0x465a4b(0x113))/0x6*(parseInt(_0x465a4b(0x114))/0x7)+parseInt(_0x465a4b(0x11b))/0x8+-parseInt(_0x465a4b(0x110))/0x9+parseInt(_0x465a4b(0x10e))/0xa;if(_0xc3b281===_0x2d2cd5)break;else _0x43698e['push'](_0x43698e['shift']());}catch(_0x503a3e){_0x43698e['push'](_0x43698e['shift']());}}}(a236_0x32c8,0xc6cad));import{CliError,createCliErrors}from'@lovrabet/cli-framework';import{CLI_BIN_NAME}from'./constant/cli.js';export{CliError};export const CliErrors=createCliErrors({'cliBinName':CLI_BIN_NAME,'authRequiredHint':a236_0x4553db(0x116)+CLI_BIN_NAME+a236_0x4553db(0x11c),'configMissingHint':['Set\x20appcode\x20via\x20`'+CLI_BIN_NAME+'\x20init\x20--appcode\x20<code>`\x20or\x20pass\x20--appcode.',a236_0x4553db(0x112)+CLI_BIN_NAME+a236_0x4553db(0x10f)]['join']('\x0a\x20\x20\x20\x20\x20\x20\x20'),'notInProjectHint':a236_0x4553db(0x119)});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x13503b,_0x2f996b){const _0x4d428d=a237_0xef44,_0x561d57=_0x13503b();while(!![]){try{const _0x3fd69e=parseInt(_0x4d428d(0xfb))/0x1+-parseInt(_0x4d428d(0x107))/0x2*(parseInt(_0x4d428d(0xfd))/0x3)+-parseInt(_0x4d428d(0x101))/0x4+-parseInt(_0x4d428d(0xff))/0x5+-parseInt(_0x4d428d(0xfc))/0x6*(-parseInt(_0x4d428d(0x102))/0x7)+-parseInt(_0x4d428d(0x104))/0x8+parseInt(_0x4d428d(0x106))/0x9*(parseInt(_0x4d428d(0x103))/0xa);if(_0x3fd69e===_0x2f996b)break;else _0x561d57['push'](_0x561d57['shift']());}catch(_0x3fb53d){_0x561d57['push'](_0x561d57['shift']());}}}(a237_0x24d5,0xdbdd8));import{DEFAULT_COMMAND_OUTPUT_FORMAT}from'../constant/defaults.js';function a237_0xef44(_0x468f85,_0x1cfd41){_0x468f85=_0x468f85-0xfb;const _0x24d56f=a237_0x24d5();let _0xef4435=_0x24d56f[_0x468f85];return _0xef4435;}import{buildAllFlags as a237_0x2ddb68}from'@lovrabet/cli-framework';import{EXPLICIT_YES_FLAG_DESCRIPTION,requiresExplicitYes}from'../framework/explicit-yes.js';function a237_0x24d5(){const _0x1ae1ec=['map','3793220WWLbnB','yes','3272664PCikqq','930020QsuNyJ','30tLcjhV','7003232kWPbIF','name','10831599zqmNNM','2nnnpcG','733825pAtNSB','30scIEly','4967628hbnNQZ'];a237_0x24d5=function(){return _0x1ae1ec;};return a237_0x24d5();}export function buildAllFlags(_0x47366b){const _0x452d83=a237_0xef44,_0x2c2740=a237_0x2ddb68(_0x47366b,{'defaultOutputFormat':DEFAULT_COMMAND_OUTPUT_FORMAT});if(!requiresExplicitYes(_0x47366b))return _0x2c2740;return _0x2c2740[_0x452d83(0xfe)](_0x517511=>_0x517511[_0x452d83(0x105)]===_0x452d83(0x100)?{..._0x517511,'description':EXPLICIT_YES_FLAG_DESCRIPTION}:_0x517511);}
|