@lovrabet/rabetbase-cli 2.4.5 → 2.4.6-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -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 -1
- 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/business-groups.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-refresh-start.js +1 -1
- package/lib/commands/db/diff-refresh-status.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.d.ts +8 -7
- 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/types.d.ts +17 -2
- 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/{page/standard-page-status.d.ts → menu/visibility-update.d.ts} +1 -1
- package/lib/commands/menu/visibility-update.js +1 -0
- package/lib/commands/notification/config-create.js +1 -1
- package/lib/commands/notification/config-delete.js +1 -1
- package/lib/commands/notification/config-list.js +1 -1
- package/lib/commands/notification/config-update.js +1 -1
- package/lib/commands/notification/index.js +1 -1
- package/lib/commands/notification/shared.js +1 -1
- package/lib/commands/ocr/index.js +1 -1
- package/lib/commands/page/create.d.ts +2 -0
- package/lib/commands/page/create.js +1 -0
- package/lib/commands/page/{react → custom}/detail.d.ts +1 -1
- package/lib/commands/page/custom/detail.js +1 -0
- package/lib/commands/page/{react → custom}/list.d.ts +1 -1
- package/lib/commands/page/custom/list.js +1 -0
- package/lib/commands/page/{react → custom}/publish.d.ts +1 -1
- package/lib/commands/page/custom/publish.js +1 -0
- package/lib/commands/page/{react → custom}/shared.d.ts +15 -15
- package/lib/commands/page/custom/shared.js +1 -0
- package/lib/commands/page/{react → custom}/syntax.d.ts +2 -2
- package/lib/commands/page/custom/syntax.js +1 -0
- package/lib/commands/page/custom/template.js +1 -0
- package/lib/commands/page/{react → custom}/update.d.ts +1 -1
- package/lib/commands/page/custom/update.js +1 -0
- package/lib/commands/page/data-list-status.d.ts +2 -0
- package/lib/commands/page/data-list-status.js +1 -0
- package/lib/commands/page/generate-start.js +1 -1
- package/lib/commands/page/generate-status.js +1 -1
- package/lib/commands/page/index.js +1 -1
- package/lib/commands/page/pull.js +1 -1
- package/lib/commands/page/push.js +1 -1
- package/lib/commands/page/relation-audit.js +1 -1
- package/lib/commands/page/restore.js +1 -1
- package/lib/commands/page/shared.d.ts +18 -18
- package/lib/commands/page/shared.js +1 -1
- package/lib/commands/page/sync.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/materialize-project-template.js +1 -1
- package/lib/commands/project/create/project-name.js +1 -1
- package/lib/commands/project/create/project-template-archive.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/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 -1
- package/lib/commands/tenant/members-list.js +1 -1
- package/lib/commands/tenant/shared.js +1 -1
- package/lib/commands/user-account/dingding-sandbox-bind.js +1 -1
- package/lib/commands/user-account/index.js +1 -1
- package/lib/commands/workspace/add.js +1 -1
- package/lib/commands/workspace/index.js +1 -1
- package/lib/commands/workspace/remove.js +1 -1
- package/lib/config/schema.js +1 -1
- package/lib/constant/cdn.js +1 -1
- package/lib/constant/cli.js +1 -1
- package/lib/constant/defaults.js +1 -1
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/constant/output.js +1 -1
- package/lib/constant/paths.js +1 -1
- package/lib/constant/risk.js +1 -1
- package/lib/context/app-resolver.js +1 -1
- package/lib/context/auth-resolver.js +1 -1
- package/lib/context/config-loader.js +1 -1
- package/lib/context.js +1 -1
- package/lib/core/alias-resolver.js +1 -1
- package/lib/core/api-client.d.ts +43 -43
- 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.d.ts +3 -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.d.ts +4 -4
- package/lib/generated/build-info.js +1 -1
- package/lib/help.js +1 -1
- package/lib/postinstall.js +1 -1
- package/lib/runtime/confirmation.js +1 -1
- package/lib/runtime/event.js +1 -1
- package/lib/runtime/index.js +1 -1
- package/lib/runtime/queue.js +1 -1
- package/lib/runtime/resolve.js +1 -1
- package/lib/skills/builtin-skill.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/entity-with-id.js +1 -1
- package/lib/utils/file-utils.js +1 -1
- package/lib/utils/guides-cdn.js +1 -1
- package/lib/utils/http-client.js +1 -1
- package/lib/utils/is-non-interactive.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/params.js +1 -1
- package/lib/utils/platform.js +1 -1
- package/lib/utils/rules-cdn.js +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.js +1 -1
- package/lib/utils/update-notice.js +1 -1
- package/lib/utils/version.js +1 -1
- package/lib/utils/with-active-cookie.js +1 -1
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +1 -1
- package/skills/rabetbase/SKILL.md +35 -34
- package/skills/rabetbase/guides/backend-function.md +63 -18
- package/skills/rabetbase/guides/bff-creation-workflow.md +2 -0
- package/skills/rabetbase/guides/{react-custom-page-workflow.md → custom-page-workflow.md} +45 -45
- package/skills/rabetbase/guides/page-development-workflow.md +22 -22
- package/skills/rabetbase/knowledge/{react-page → custom-page}/components.md +2 -2
- package/skills/rabetbase/knowledge/{react-page → custom-page}/generation-standards.md +6 -6
- package/skills/rabetbase/knowledge/page-schema/LrSmartTable.md +6 -6
- package/skills/rabetbase/knowledge/page-schema/external-resources-usage.md +1 -1
- package/skills/rabetbase/references/rabetbase-bff-create.md +2 -0
- package/skills/rabetbase/references/{rabetbase-standard-page-status.md → rabetbase-data-list-status.md} +6 -6
- package/skills/rabetbase/references/rabetbase-dataset-generate.md +1 -1
- package/skills/rabetbase/references/rabetbase-dataset-relation-mutations.md +1 -1
- package/skills/rabetbase/references/rabetbase-dataset-relations.md +1 -1
- package/skills/rabetbase/references/rabetbase-dataset-restore.md +1 -1
- package/skills/rabetbase/references/rabetbase-menu-list.md +4 -2
- package/skills/rabetbase/references/rabetbase-menu-visibility-update.md +59 -0
- package/skills/rabetbase/references/rabetbase-page-create.md +31 -0
- package/skills/rabetbase/references/{rabetbase-page-react-detail.md → rabetbase-page-custom-detail.md} +5 -5
- package/skills/rabetbase/references/{rabetbase-page-react-list.md → rabetbase-page-custom-list.md} +4 -4
- package/skills/rabetbase/references/{rabetbase-page-react-publish.md → rabetbase-page-custom-publish.md} +6 -6
- package/skills/rabetbase/references/{rabetbase-page-react-update.md → rabetbase-page-custom-update.md} +6 -6
- package/skills/rabetbase/references/rabetbase-page-generate-start.md +5 -4
- package/skills/rabetbase/references/rabetbase-page-generate-status.md +4 -4
- package/skills/rabetbase/references/rabetbase-page-pull.md +2 -2
- package/skills/rabetbase/references/rabetbase-page-relation-binding.md +1 -1
- package/skills/rabetbase/references/rabetbase-page-restore.md +7 -7
- package/skills/rabetbase/references/rabetbase-page-sync.md +3 -3
- package/skills/rabetbase.manifest.json +13 -12
- package/lib/commands/page/react/create.d.ts +0 -2
- package/lib/commands/page/react/create.js +0 -1
- package/lib/commands/page/react/detail.js +0 -1
- package/lib/commands/page/react/list.js +0 -1
- package/lib/commands/page/react/publish.js +0 -1
- package/lib/commands/page/react/shared.js +0 -1
- package/lib/commands/page/react/syntax.js +0 -1
- package/lib/commands/page/react/template.js +0 -1
- package/lib/commands/page/react/update.js +0 -1
- package/lib/commands/page/standard-page-status.js +0 -1
- package/skills/rabetbase/references/rabetbase-page-react-create.md +0 -29
- /package/lib/commands/page/{react → custom}/template.d.ts +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a222_0x79151c=a222_0x1291;(function(_0x40b70e,_0x44c557){const _0x4a251=a222_0x1291,_0x536a0f=_0x40b70e();while(!![]){try{const _0x34af3e=parseInt(_0x4a251(0x148))/0x1*(parseInt(_0x4a251(0x162))/0x2)+-parseInt(_0x4a251(0x161))/0x3+parseInt(_0x4a251(0x151))/0x4*(-parseInt(_0x4a251(0x14e))/0x5)+-parseInt(_0x4a251(0x13b))/0x6*(parseInt(_0x4a251(0x142))/0x7)+parseInt(_0x4a251(0x15e))/0x8*(-parseInt(_0x4a251(0x144))/0x9)+parseInt(_0x4a251(0x156))/0xa*(-parseInt(_0x4a251(0x13f))/0xb)+parseInt(_0x4a251(0x14f))/0xc;if(_0x34af3e===_0x44c557)break;else _0x536a0f['push'](_0x536a0f['shift']());}catch(_0x4110b9){_0x536a0f['push'](_0x536a0f['shift']());}}}(a222_0x531a,0x4390b));import{access,mkdir,readdir,stat}from'node:fs/promises';import{constants}from'node:fs';import{dirname,join,resolve,sep}from'node:path';import{findHookLocationByRemoteId,snakeToCamel}from'../../core/bff/utils.js';export const SUPPORTED_BFF_TYPES=[a222_0x79151c(0x15c),'ENDPOINT',a222_0x79151c(0x138)];export function normalizeBffType(_0x2864ec){const _0x365ddb=a222_0x79151c;if(!_0x2864ec)return undefined;const _0x3e8467=_0x2864ec['trim']()['toUpperCase']();return SUPPORTED_BFF_TYPES[_0x365ddb(0x143)](_0x3e8467)?_0x3e8467:undefined;}async function scanJsFilesRecursively(_0x319310,_0x513b69){const _0x34ec05=a222_0x79151c,_0x59cf18=[];try{const _0x48c1f1=await readdir(_0x319310,{'withFileTypes':!![]});for(const _0x5e5e59 of _0x48c1f1){const _0x4e7242=join(_0x319310,_0x5e5e59['name']);if(_0x5e5e59[_0x34ec05(0x155)]())_0x59cf18[_0x34ec05(0x140)](...await scanJsFilesRecursively(_0x4e7242,_0x513b69+'/'+_0x5e5e59[_0x34ec05(0x141)]));else _0x5e5e59['isFile']()&&_0x5e5e59['name'][_0x34ec05(0x14b)](_0x34ec05(0x13d))&&_0x59cf18[_0x34ec05(0x140)]({'lockKey':_0x513b69+'/'+_0x5e5e59[_0x34ec05(0x141)]['replace'](/\.js$/,''),'filePath':_0x4e7242});}}catch(_0x484aa5){if(_0x484aa5['code']!==_0x34ec05(0x15b))throw _0x484aa5;}return _0x59cf18;}async function scanFlatFunctions(_0x557357,_0x3f3df3){const _0x4bd8e0=a222_0x79151c,_0x481bf6=join(_0x557357[_0x4bd8e0(0x146)],_0x3f3df3),_0x4c0ec4=await scanJsFilesRecursively(_0x481bf6,_0x3f3df3);return _0x4c0ec4[_0x4bd8e0(0x13a)](({lockKey:_0x8ad6bf,filePath:_0x4ab913})=>({'type':_0x3f3df3,'name':_0x8ad6bf[_0x4bd8e0(0x13c)]('/')['at'](-0x1)??'','filePath':_0x4ab913,'lockKey':_0x8ad6bf}));}async function scanHookFunctions(_0x58c48d){const _0x30d192=a222_0x79151c,_0x97cfe=join(_0x58c48d['scriptsRootDir'],_0x30d192(0x138)),_0x3a2d98=[];try{const _0x47eeda=await readdir(_0x97cfe,{'withFileTypes':!![]});for(const _0x5b4210 of _0x47eeda){if(!_0x5b4210[_0x30d192(0x155)]())continue;const _0x3a7312=_0x5b4210['name'],_0x26ef3c=join(_0x97cfe,_0x3a7312),_0x5d9ea5=await readdir(_0x26ef3c,{'withFileTypes':!![]});for(const _0xc32469 of _0x5d9ea5){if(!_0xc32469[_0x30d192(0x155)]())continue;const _0x216082=_0xc32469['name'],_0x21b521=join(_0x26ef3c,_0x216082),_0x49a67f=await readdir(_0x21b521,{'withFileTypes':!![]});for(const _0x444af1 of _0x49a67f){if(!_0x444af1['isDirectory']())continue;const _0x4e3bb2=_0x444af1[_0x30d192(0x141)],_0xd87985=join(_0x21b521,_0x4e3bb2),_0x24ea66=await readdir(_0xd87985,{'withFileTypes':!![]});for(const _0x145f74 of _0x24ea66){if(!_0x145f74[_0x30d192(0x14a)]()||!_0x145f74[_0x30d192(0x141)][_0x30d192(0x14b)](_0x30d192(0x13d)))continue;const _0x14d0a5=_0x145f74[_0x30d192(0x141)][_0x30d192(0x153)](/\.js$/,'');_0x3a2d98[_0x30d192(0x140)]({'type':_0x30d192(0x138),'name':_0x14d0a5,'filePath':join(_0xd87985,_0x145f74[_0x30d192(0x141)]),'lockKey':_0x30d192(0x15d)+_0x3a7312+'/'+_0x216082+'/'+_0x4e3bb2+'/'+_0x14d0a5,'alias':_0x3a7312,'operationType':_0x216082,'functionNode':_0x4e3bb2});}}}}}catch(_0x2c488a){if(_0x2c488a[_0x30d192(0x14c)]!==_0x30d192(0x15b))throw _0x2c488a;}return _0x3a2d98;}export async function scanLocalBffFunctions(_0x48c9cd,_0x2a6f14){const _0x51be7d=a222_0x79151c;if(_0x2a6f14===_0x51be7d(0x15c)||_0x2a6f14===_0x51be7d(0x15a))return scanFlatFunctions(_0x48c9cd,_0x2a6f14);if(_0x2a6f14===_0x51be7d(0x138))return scanHookFunctions(_0x48c9cd);const [_0x12e471,_0x32eb40,_0xb13112]=await Promise[_0x51be7d(0x154)]([scanFlatFunctions(_0x48c9cd,_0x51be7d(0x15c)),scanFlatFunctions(_0x48c9cd,'ENDPOINT'),scanHookFunctions(_0x48c9cd)]);return[..._0x12e471,..._0x32eb40,..._0xb13112];}const SAFE_LOCK_KEY_SEGMENT=/^[A-Za-z0-9_$.-]+$/;export function isSafeLockKeySegment(_0x3368b2){return SAFE_LOCK_KEY_SEGMENT['test'](_0x3368b2)&&_0x3368b2!=='.'&&_0x3368b2!=='..';}export function resolveLocalFilePathFromLockKey(_0x462e3b,_0x440298){const _0x5135c2=a222_0x79151c,_0xf570d8=_0x440298[_0x5135c2(0x13c)]('/');if(!_0xf570d8['every'](isSafeLockKeySegment))throw new Error(_0x5135c2(0x160)+_0x440298);const _0x5f507a=resolve(join(_0x462e3b[_0x5135c2(0x146)],..._0xf570d8)+_0x5135c2(0x13d)),_0x3ec771=resolve(_0x462e3b[_0x5135c2(0x146)]);if(_0x5f507a!==_0x3ec771&&!_0x5f507a[_0x5135c2(0x152)](_0x3ec771+sep))throw new Error('Resolved\x20BFF\x20script\x20path\x20escapes\x20scripts\x20root:\x20'+_0x5f507a);return _0x5f507a;}export function createHookLocationMap(_0x15f027){const _0x5747aa=a222_0x79151c,_0x37cede=new Map();for(const _0x113c23 of _0x15f027){_0x113c23[_0x5747aa(0x14d)]&&_0x37cede[_0x5747aa(0x149)](_0x113c23[_0x5747aa(0x14d)],{'datasetCode':_0x113c23[_0x5747aa(0x158)],'operationType':snakeToCamel(_0x113c23[_0x5747aa(0x159)]),'functionNode':'before'}),_0x113c23[_0x5747aa(0x15f)]&&_0x37cede[_0x5747aa(0x149)](_0x113c23[_0x5747aa(0x15f)],{'datasetCode':_0x113c23['datasetCode'],'operationType':snakeToCamel(_0x113c23[_0x5747aa(0x159)]),'functionNode':_0x5747aa(0x13e)});}return _0x37cede;}export function resolveRemoteScriptTarget(_0x159bcd,_0x247ea5,_0x2a0726,_0x12bab7,_0x21f911){const _0x5e5918=a222_0x79151c,_0x4ab2f4=normalizeBffType(_0x247ea5[_0x5e5918(0x147)]);if(!_0x4ab2f4||!_0x247ea5[_0x5e5918(0x139)])return null;if(_0x4ab2f4==='HOOK'){const _0x366d46=(_0x247ea5['id']?_0x2a0726[_0x5e5918(0x157)](_0x247ea5['id']):undefined)??findHookLocationByRemoteId(_0x12bab7,_0x247ea5['id']);if(!_0x366d46)return null;const _0x54d5cd=_0x366d46[_0x5e5918(0x145)]||_0x21f911['get'](_0x366d46[_0x5e5918(0x158)]),_0x6acb15=_0x54d5cd??_0x366d46[_0x5e5918(0x158)],_0x3e441d={..._0x366d46,'alias':_0x54d5cd},_0x277ef3=_0x5e5918(0x15d)+_0x6acb15+'/'+_0x3e441d[_0x5e5918(0x159)]+'/'+_0x3e441d['functionNode']+'/'+_0x247ea5[_0x5e5918(0x139)];if(!_0x277ef3[_0x5e5918(0x13c)]('/')[_0x5e5918(0x150)](isSafeLockKeySegment))return null;return{'lockKey':_0x277ef3,'filePath':resolveLocalFilePathFromLockKey(_0x159bcd,_0x277ef3),'type':'HOOK','hookLocation':_0x3e441d};}const _0x2a186f=_0x4ab2f4+'/'+_0x247ea5['functionName'];if(!_0x2a186f[_0x5e5918(0x13c)]('/')[_0x5e5918(0x150)](isSafeLockKeySegment))return null;return{'lockKey':_0x2a186f,'filePath':resolveLocalFilePathFromLockKey(_0x159bcd,_0x2a186f),'type':_0x4ab2f4};}function a222_0x1291(_0xc0327f,_0x502ae8){_0xc0327f=_0xc0327f-0x138;const _0x531a64=a222_0x531a();let _0x129149=_0x531a64[_0xc0327f];return _0x129149;}export async function ensureParentDirectory(_0xb38d38){await mkdir(dirname(_0xb38d38),{'recursive':!![]});}function a222_0x531a(){const _0x486758=['map','300162LWXkvn','split','.js','after','746955HuLuHj','push','name','7mMBEds','includes','3307212ammZRF','alias','scriptsRootDir','scriptType','1175bjkHAz','set','isFile','endsWith','code','beforeScriptId','1390QtUYAt','7661448IYUlMn','every','152BGzKOI','startsWith','replace','all','isDirectory','10RXcKYV','get','datasetCode','operationType','ENDPOINT','ENOENT','COMMON','HOOK/','8ZATLta','afterScriptId','Unsafe\x20BFF\x20lock\x20key\x20(traversal\x20or\x20invalid\x20segment):\x20','178854uVeEee','330gZRZUS','HOOK','functionName'];a222_0x531a=function(){return _0x486758;};return a222_0x531a();}export async function fileExists(_0x25596a){try{return await access(_0x25596a,constants['F_OK']),!![];}catch{return![];}}export async function directoryExists(_0x4ab768){const _0x1e75c3=a222_0x79151c;try{const _0x10bdb4=await stat(_0x4ab768);return _0x10bdb4[_0x1e75c3(0x155)]();}catch{return![];}}
|
package/lib/core/bff/hash.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a223_0x3bf8(){const _0x553578=['createHash','hex','18dvZBTa','14PDHtsI','4Hwtrnl','3wVKVzq','25993EmzNVK','1878270FJwbeI','4900596kUEZeS','4668YqxncM','update','1796304dkjbNO','225540hwCUyV','862dhIcJI','2221290YuZxBy','digest'];a223_0x3bf8=function(){return _0x553578;};return a223_0x3bf8();}function a223_0x2d24(_0x1e0ea6,_0x2a68bb){_0x1e0ea6=_0x1e0ea6-0x1b3;const _0x3bf833=a223_0x3bf8();let _0x2d249d=_0x3bf833[_0x1e0ea6];return _0x2d249d;}(function(_0x3e6086,_0x5eeace){const _0x12d707=a223_0x2d24,_0x489d64=_0x3e6086();while(!![]){try{const _0x3c3f9d=-parseInt(_0x12d707(0x1bb))/0x1*(parseInt(_0x12d707(0x1c2))/0x2)+-parseInt(_0x12d707(0x1b3))/0x3*(parseInt(_0x12d707(0x1ba))/0x4)+parseInt(_0x12d707(0x1bc))/0x5+-parseInt(_0x12d707(0x1b6))/0x6+parseInt(_0x12d707(0x1c1))/0x7*(-parseInt(_0x12d707(0x1b9))/0x8)+-parseInt(_0x12d707(0x1c0))/0x9*(-parseInt(_0x12d707(0x1b5))/0xa)+-parseInt(_0x12d707(0x1b4))/0xb*(-parseInt(_0x12d707(0x1b7))/0xc);if(_0x3c3f9d===_0x5eeace)break;else _0x489d64['push'](_0x489d64['shift']());}catch(_0x16ef86){_0x489d64['push'](_0x489d64['shift']());}}}(a223_0x3bf8,0x655c0));import{readFile}from'node:fs/promises';import a223_0x29a7e9 from'node:crypto';export function computeContentHash(_0x122539){const _0x46a73e=a223_0x2d24;return a223_0x29a7e9[_0x46a73e(0x1be)]('md5')[_0x46a73e(0x1b8)](_0x122539)[_0x46a73e(0x1bd)](_0x46a73e(0x1bf));}export async function computeFileHash(_0x5df635){const _0x258c7c=await readFile(_0x5df635,'utf8');return computeContentHash(_0x258c7c);}
|
package/lib/core/bff/lock.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a224_0x5bc2(){const _0x35a658=['509436gKFXlu','code','apps','utf8','1876PwAymR','1127922taMATb','2707984bdMPWu','\x22.\x20','13111630bzppvt','functions','object','stringify','1479402LQRbmZ','current\x20\x22','lastSync','\x22\x20vs\x20lock\x20\x22','5263872beAXkV','1585hutznF','scriptsRoot'];a224_0x5bc2=function(){return _0x35a658;};return a224_0x5bc2();}(function(_0x48f8fa,_0x568bfa){const _0x4b5f9f=a224_0x36ba,_0x813212=_0x48f8fa();while(!![]){try{const _0x3185ea=-parseInt(_0x4b5f9f(0x118))/0x1+-parseInt(_0x4b5f9f(0x10b))/0x2+parseInt(_0x4b5f9f(0x10a))/0x3+-parseInt(_0x4b5f9f(0x109))/0x4*(-parseInt(_0x4b5f9f(0x116))/0x5)+-parseInt(_0x4b5f9f(0x111))/0x6+parseInt(_0x4b5f9f(0x10d))/0x7+parseInt(_0x4b5f9f(0x115))/0x8;if(_0x3185ea===_0x568bfa)break;else _0x813212['push'](_0x813212['shift']());}catch(_0x1ed942){_0x813212['push'](_0x813212['shift']());}}}(a224_0x5bc2,0xe6e3e));function a224_0x36ba(_0xc591c9,_0x258ca5){_0xc591c9=_0xc591c9-0x107;const _0x5bc227=a224_0x5bc2();let _0x36babc=_0x5bc227[_0xc591c9];return _0x36babc;}import{mkdir,readFile,writeFile}from'node:fs/promises';import{dirname}from'node:path';export function createEmptyBffLock(){return{'apps':{}};}export function ensureLockScope(_0x347d1e,_0x4d5b69,_0x2992ac,_0x40146c){const _0x54dd2b=a224_0x36ba,_0x1b872e={'apps':_0x347d1e[_0x54dd2b(0x107)]&&typeof _0x347d1e[_0x54dd2b(0x107)]===_0x54dd2b(0x10f)?_0x347d1e[_0x54dd2b(0x107)]:{}};let _0x2bda9b=_0x1b872e['apps'][_0x4d5b69];if(!_0x2bda9b)return _0x2bda9b={'scriptsRoot':_0x2992ac,'lastSync':'','functions':{}},_0x1b872e[_0x54dd2b(0x107)][_0x4d5b69]=_0x2bda9b,{'lockData':_0x1b872e,'appLock':_0x2bda9b};if(!_0x2bda9b[_0x54dd2b(0x117)])_0x2bda9b[_0x54dd2b(0x117)]=_0x2992ac;else{if(_0x2bda9b[_0x54dd2b(0x117)]!==_0x2992ac)throw new Error(_0x40146c+':\x20scriptsRoot\x20mismatch\x20—\x20'+(_0x54dd2b(0x112)+_0x2992ac+_0x54dd2b(0x114)+_0x2bda9b[_0x54dd2b(0x117)]+_0x54dd2b(0x10c))+'Check\x20.rabetbase/bff.lock.json\x20or\x20operate\x20from\x20the\x20correct\x20project\x20directory.');}return!_0x2bda9b[_0x54dd2b(0x10e)]&&(_0x2bda9b[_0x54dd2b(0x10e)]={}),!_0x2bda9b[_0x54dd2b(0x113)]&&(_0x2bda9b['lastSync']=''),{'lockData':_0x1b872e,'appLock':_0x2bda9b};}export async function readBffLockFile(_0x1b669a){const _0x51d1c1=a224_0x36ba;try{const _0x949c4c=await readFile(_0x1b669a,'utf8'),_0x54e40c=JSON['parse'](_0x949c4c);return{'apps':_0x54e40c[_0x51d1c1(0x107)]&&typeof _0x54e40c[_0x51d1c1(0x107)]===_0x51d1c1(0x10f)?_0x54e40c[_0x51d1c1(0x107)]:{}};}catch(_0x5caeaf){if(_0x5caeaf[_0x51d1c1(0x119)]==='ENOENT')return null;throw new Error('Failed\x20to\x20read\x20BFF\x20lock\x20file:\x20'+String(_0x5caeaf));}}export async function writeBffLockFile(_0x527548,_0x144118){const _0xe9d980=a224_0x36ba;await mkdir(dirname(_0x527548),{'recursive':!![]}),await writeFile(_0x527548,JSON[_0xe9d980(0x110)](_0x144118,null,0x2),_0xe9d980(0x108));}
|
package/lib/core/bff/utils.d.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* 纯逻辑工具,不依赖 CLI 交互、cookie、domain 等运行时环境。
|
|
5
5
|
*/
|
|
6
6
|
import type { BffLockEntry, HookLocation } from "../../core/bff/types.js";
|
|
7
|
+
export declare const DEFAULT_BFF_SCRIPT_DESCRIPTION = "TODO: \u8865\u5145\u811A\u672C\u529F\u80FD\u63CF\u8FF0";
|
|
7
8
|
export declare function snakeToCamel(value: string): string;
|
|
8
9
|
/**
|
|
9
10
|
* Reverse-lookup a HOOK location from lock entries by remote script ID.
|
|
@@ -12,7 +13,8 @@ export declare function snakeToCamel(value: string): string;
|
|
|
12
13
|
export declare function findHookLocationByRemoteId(lockFunctions: Record<string, BffLockEntry>, remoteId?: number): HookLocation | undefined;
|
|
13
14
|
/**
|
|
14
15
|
* Extract description from a script's header comment block.
|
|
15
|
-
*
|
|
16
|
+
* Reads the legacy marker for migration, otherwise uses the first plain
|
|
17
|
+
* summary line in a recognized BFF template header.
|
|
16
18
|
*/
|
|
17
19
|
export declare function extractScriptDescription(scriptContent: string): string | undefined;
|
|
18
20
|
/**
|
package/lib/core/bff/utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
const a226_0x48b084=a226_0x4779;(function(_0x5cda13,_0x28bc67){const _0x10bbc3=a226_0x4779,_0x32b965=_0x5cda13();while(!![]){try{const _0x5acaf5=parseInt(_0x10bbc3(0x14f))/0x1*(-parseInt(_0x10bbc3(0x151))/0x2)+parseInt(_0x10bbc3(0x158))/0x3+-parseInt(_0x10bbc3(0x160))/0x4+-parseInt(_0x10bbc3(0x169))/0x5*(parseInt(_0x10bbc3(0x15d))/0x6)+-parseInt(_0x10bbc3(0x162))/0x7+-parseInt(_0x10bbc3(0x163))/0x8*(parseInt(_0x10bbc3(0x164))/0x9)+parseInt(_0x10bbc3(0x167))/0xa;if(_0x5acaf5===_0x28bc67)break;else _0x32b965['push'](_0x32b965['shift']());}catch(_0x258825){_0x32b965['push'](_0x32b965['shift']());}}}(a226_0x2014,0xa75e8));export const DEFAULT_BFF_SCRIPT_DESCRIPTION=a226_0x48b084(0x15c);const LEGACY_DEFAULT_BFF_SCRIPT_DESCRIPTION=a226_0x48b084(0x159);export function snakeToCamel(_0x258e8f){const _0x16907c=a226_0x48b084;return _0x258e8f[_0x16907c(0x166)]()[_0x16907c(0x15e)](/_([a-z])/g,(_0x3c202d,_0x3bdb5d)=>_0x3bdb5d[_0x16907c(0x15a)]());}export function findHookLocationByRemoteId(_0x3684b8,_0x357107){const _0x3d152e=a226_0x48b084;if(!_0x357107)return undefined;for(const _0x28c884 of Object['values'](_0x3684b8)){if(_0x28c884[_0x3d152e(0x155)]===_0x357107&&_0x28c884['datasetCode']&&_0x28c884[_0x3d152e(0x157)]&&_0x28c884[_0x3d152e(0x15b)])return{'datasetCode':_0x28c884[_0x3d152e(0x153)],'operationType':_0x28c884['operationType'],'functionNode':_0x28c884['functionNode']};}return undefined;}export function extractScriptDescription(_0x40b998){const _0x3a1950=a226_0x48b084,_0x507d2c=_0x40b998[_0x3a1950(0x15f)](/^\s*\/\*\*([\s\S]*?)\*\//);if(!_0x507d2c?.[0x1])return undefined;const _0x432529=_0x507d2c[0x1],_0x16a01b=_0x328a02=>{const _0x4caeaf=_0x3a1950,_0x4d051d=_0x328a02?.[_0x4caeaf(0x154)]();if(!_0x4d051d||_0x4d051d===DEFAULT_BFF_SCRIPT_DESCRIPTION||_0x4d051d===LEGACY_DEFAULT_BFF_SCRIPT_DESCRIPTION)return undefined;return _0x4d051d;},_0x1f1bcf=_0x432529['match'](/^\s*\*\s*\[\s*脚本描述\s*]\s*(.+)$/m);if(_0x1f1bcf)return _0x16a01b(_0x1f1bcf[0x1]);const _0x54c330=_0x432529[_0x3a1950(0x150)](/\r?\n/)['map'](_0x996cad=>_0x996cad[_0x3a1950(0x15e)](/^\s*\*\s?/,'')['trim']()),_0x1908e5=_0x54c330[_0x3a1950(0x156)](_0x32387e=>/^\[\s*脚本类型\s*]\s*\S+/[_0x3a1950(0x152)](_0x32387e))&&_0x54c330[_0x3a1950(0x156)](_0x4d6b77=>/^\[\s*脚本名称\s*]\s*\S+/[_0x3a1950(0x152)](_0x4d6b77));if(!_0x1908e5)return undefined;for(const _0x38ecbe of _0x54c330){if(!_0x38ecbe||_0x38ecbe[_0x3a1950(0x168)]('@')||/^\[[^\]]+]\s*/[_0x3a1950(0x152)](_0x38ecbe))continue;return _0x16a01b(_0x38ecbe);}return undefined;}export function isValidBffFunctionName(_0x4f83b4){const _0x491b5e=a226_0x48b084;return/^[A-Za-z_$][A-Za-z0-9_$]*$/[_0x491b5e(0x152)](_0x4f83b4);}export function normalizeHookFunctionNode(_0xfca5be){const _0xd495ba=a226_0x48b084;if(!_0xfca5be)return undefined;const _0x3bee30=_0xfca5be[_0xd495ba(0x154)]()['toLowerCase']();if(_0x3bee30===_0xd495ba(0x165)||_0x3bee30===_0xd495ba(0x161))return _0x3bee30;return undefined;}function a226_0x4779(_0x4fe35a,_0x18d09c){_0x4fe35a=_0x4fe35a-0x14f;const _0x20149f=a226_0x2014();let _0x4779d0=_0x20149f[_0x4fe35a];return _0x4779d0;}function a226_0x2014(){const _0x350209=['1613712BpjfoJ','after','3613456NuvjOE','8OEGNJo','11739402YwsGAj','before','toLowerCase','35425050BooSeb','startsWith','5TwnfIJ','37SgZoJP','split','26218UGTXad','test','datasetCode','trim','remoteId','some','operationType','3203325MpKBfd','TODO:\x20add\x20script\x20description','toUpperCase','functionNode','TODO:\x20补充脚本功能描述','7294134nUaXdN','replace','match'];a226_0x2014=function(){return _0x350209;};return a226_0x2014();}
|
package/lib/core/db-resolver.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a227_0x5948(_0x25b9f3,_0x4cd569){_0x25b9f3=_0x25b9f3-0x1ee;const _0x4ed4c7=a227_0x4ed4();let _0x594884=_0x4ed4c7[_0x25b9f3];return _0x594884;}(function(_0x52eac5,_0x22d90f){const _0x33336b=a227_0x5948,_0x268b4c=_0x52eac5();while(!![]){try{const _0x352bee=-parseInt(_0x33336b(0x1ee))/0x1+parseInt(_0x33336b(0x207))/0x2+parseInt(_0x33336b(0x1f9))/0x3+parseInt(_0x33336b(0x1f2))/0x4*(parseInt(_0x33336b(0x1f1))/0x5)+-parseInt(_0x33336b(0x200))/0x6*(-parseInt(_0x33336b(0x20b))/0x7)+-parseInt(_0x33336b(0x201))/0x8+parseInt(_0x33336b(0x204))/0x9*(parseInt(_0x33336b(0x1fd))/0xa);if(_0x352bee===_0x22d90f)break;else _0x268b4c['push'](_0x268b4c['shift']());}catch(_0x7d534f){_0x268b4c['push'](_0x268b4c['shift']());}}}(a227_0x4ed4,0xa5f37));import{listDatasets}from'../core/api-client.js';const cache=new Map();export async function listDatabases(_0x31a940){const _0x4be9ad=a227_0x5948;if(cache['has'](_0x31a940))return cache[_0x4be9ad(0x1ef)](_0x31a940);const _0x303985=await listDatasets(_0x31a940),_0x4fa9e7=new Map();for(const _0xe57d25 of _0x303985){const _0x25c65f=_0xe57d25[_0x4be9ad(0x205)];_0x25c65f?.[_0x4be9ad(0x20a)]!=null&&_0x4fa9e7[_0x4be9ad(0x1f0)](_0x25c65f['dbId'],_0x25c65f[_0x4be9ad(0x209)]??_0x4be9ad(0x1fb)+_0x25c65f[_0x4be9ad(0x20a)]);}const _0x37ff28=[..._0x4fa9e7[_0x4be9ad(0x1f7)]()][_0x4be9ad(0x1f6)](([_0x26e157,_0x3999f8])=>({'dbId':_0x26e157,'dbName':_0x3999f8}));return cache['set'](_0x31a940,_0x37ff28),_0x37ff28;}function a227_0x4ed4(){const _0x4a78c9=['length','9dmCwzg','dbtableConfig','No\x20linked\x20databases\x20found\x20under\x20app\x20\x22','762854pnqmbz','\x22\x20under\x20app\x20\x22','dbName','dbId','908971bMoQKj','toLowerCase','1215918yjnowD','get','set','56745sCHjkg','72ahMXzf','.\x20Be\x20more\x20specific.','find','\x22.\x20Available:\x20','map','entries','No\x20database\x20matching\x20\x22','2059419IXYxKn','Multiple\x20databases\x20found.\x20Specify\x20one\x20with\x20--db:\x20','db-','join','7220660VjoOXs','.\x20If\x20this\x20db\x20belongs\x20to\x20another\x20app,\x20rerun\x20with\x20--appcode\x20<appCode>.','filter','12UVLpfg','2866408VJTXkC','\x22.\x20Make\x20sure\x20datasets\x20have\x20been\x20created.'];a227_0x4ed4=function(){return _0x4a78c9;};return a227_0x4ed4();}export async function resolveDb(_0x6a8c73,_0x35f6ec){const _0x5bdbed=a227_0x5948,_0x510c0b=await listDatabases(_0x6a8c73);if(_0x510c0b[_0x5bdbed(0x203)]===0x0)return{'resolved':[],'error':_0x5bdbed(0x206)+_0x6a8c73+_0x5bdbed(0x202)};if(!_0x35f6ec)return{'resolved':_0x510c0b};const _0x5abb6d=Number(_0x35f6ec);if(!Number['isNaN'](_0x5abb6d)){const _0x4955c7=_0x510c0b[_0x5bdbed(0x1f4)](_0x49b556=>_0x49b556['dbId']===_0x5abb6d);if(_0x4955c7)return{'resolved':[_0x4955c7]};}const _0x505b7f=_0x35f6ec[_0x5bdbed(0x20c)](),_0x136074=_0x510c0b[_0x5bdbed(0x1ff)](_0x23874c=>_0x23874c[_0x5bdbed(0x209)][_0x5bdbed(0x20c)]()['includes'](_0x505b7f));if(_0x136074[_0x5bdbed(0x203)]>0x0)return{'resolved':_0x136074};const _0xb25be6=_0x510c0b[_0x5bdbed(0x1f6)](_0x34796f=>_0x34796f[_0x5bdbed(0x209)]+'\x20('+_0x34796f[_0x5bdbed(0x20a)]+')')[_0x5bdbed(0x1fc)](',\x20');return{'resolved':[],'error':_0x5bdbed(0x1f8)+_0x35f6ec+_0x5bdbed(0x208)+_0x6a8c73+_0x5bdbed(0x1f5)+_0xb25be6+_0x5bdbed(0x1fe)};}export async function resolveOneDb(_0x681708,_0x137d55){const _0x136b9a=a227_0x5948,{resolved:_0x5326a8,error:_0x11c21a}=await resolveDb(_0x681708,_0x137d55);if(_0x11c21a)return{'db':null,'error':_0x11c21a};if(_0x5326a8[_0x136b9a(0x203)]===0x1)return{'db':_0x5326a8[0x0]};if(!_0x137d55){const _0x253ac2=_0x5326a8['map'](_0xd306cb=>_0xd306cb['dbName']+'\x20('+_0xd306cb[_0x136b9a(0x20a)]+')')[_0x136b9a(0x1fc)](',\x20');return{'db':null,'error':_0x136b9a(0x1fa)+_0x253ac2};}const _0x42ade6=_0x5326a8[_0x136b9a(0x1f6)](_0x4524e6=>_0x4524e6['dbName']+'\x20('+_0x4524e6[_0x136b9a(0x20a)]+')')[_0x136b9a(0x1fc)](',\x20');return{'db':null,'error':'\x22'+_0x137d55+'\x22\x20matches\x20multiple\x20databases:\x20'+_0x42ade6+_0x136b9a(0x1f3)};}export async function getDbName(_0x37aac3,_0x15d765){const _0x1eb456=a227_0x5948,_0x2f348f=await listDatabases(_0x37aac3);return _0x2f348f[_0x1eb456(0x1f4)](_0x3488ab=>_0x3488ab[_0x1eb456(0x20a)]===_0x15d765)?.[_0x1eb456(0x209)];}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a228_0x3bda0d=a228_0x1a3c;(function(_0x20b4b7,_0x2c0640){const _0x55dee4=a228_0x1a3c,_0x582cae=_0x20b4b7();while(!![]){try{const _0x2880e5=parseInt(_0x55dee4(0x1a8))/0x1+-parseInt(_0x55dee4(0x1b5))/0x2*(parseInt(_0x55dee4(0x1b3))/0x3)+-parseInt(_0x55dee4(0x1b2))/0x4*(-parseInt(_0x55dee4(0x1af))/0x5)+parseInt(_0x55dee4(0x1ae))/0x6+parseInt(_0x55dee4(0x1a9))/0x7*(parseInt(_0x55dee4(0x1ab))/0x8)+-parseInt(_0x55dee4(0x1b0))/0x9+-parseInt(_0x55dee4(0x1b4))/0xa;if(_0x2880e5===_0x2c0640)break;else _0x582cae['push'](_0x582cae['shift']());}catch(_0x1e3f98){_0x582cae['push'](_0x582cae['shift']());}}}(a228_0x539e,0xc4863));import{constants}from'node:fs';import{access,mkdir}from'node:fs/promises';import{dirname,join,resolve}from'node:path';export function loadPageProjectConfig(_0xbcabdc,_0xa53700=process[a228_0x3bda0d(0x1aa)]()){const _0x3b180d=a228_0x3bda0d,_0x337cb0=resolve(_0xa53700),_0x165825=join(_0x337cb0,_0x3b180d(0x1ac),'page');return{'projectRoot':_0x337cb0,'pagesBaseDir':_0x165825,'appPagesDir':join(_0x165825,_0xbcabdc),'lockFilePath':join(_0x337cb0,'.rabetbase','page.lock.json')};}export function buildPageFileName(_0x58c6dd,_0x37e9f4){const _0x3ef6be=a228_0x3bda0d;return _0x58c6dd+'-'+String(_0x37e9f4)['toUpperCase']()+_0x3ef6be(0x1b1);}export function resolvePageFilePath(_0x39fb9a,_0x5d4d95,_0x1eff84){return join(_0x39fb9a['appPagesDir'],buildPageFileName(_0x5d4d95,_0x1eff84));}function a228_0x539e(){const _0x2d8311=['635058CEJqSf','5076980KWcFXv','2tdgBGZ','13952zSkPBg','251174wcCKqX','cwd','40VcwSaI','.rabetbase','F_OK','5970000gAdIDn','10EgOsLD','10941543DVcHwF','.json','3103424ewLCDM'];a228_0x539e=function(){return _0x2d8311;};return a228_0x539e();}function a228_0x1a3c(_0xf3e0f6,_0x472f35){_0xf3e0f6=_0xf3e0f6-0x1a8;const _0x539e1b=a228_0x539e();let _0x1a3c07=_0x539e1b[_0xf3e0f6];return _0x1a3c07;}export async function ensureParentDirectory(_0x359bca){await mkdir(dirname(_0x359bca),{'recursive':!![]});}export async function fileExists(_0x58e534){const _0x4f7e26=a228_0x3bda0d;try{return await access(_0x58e534,constants[_0x4f7e26(0x1ad)]),!![];}catch{return![];}}
|
package/lib/core/page/hash.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a229_0x42a7(_0x24328e,_0x4d3192){_0x24328e=_0x24328e-0x10b;const _0x7d6a42=a229_0x7d6a();let _0x42a781=_0x7d6a42[_0x24328e];return _0x42a781;}(function(_0x3fcbcc,_0x532f95){const _0x5408ab=a229_0x42a7,_0x2f263d=_0x3fcbcc();while(!![]){try{const _0x6605fa=parseInt(_0x5408ab(0x112))/0x1*(parseInt(_0x5408ab(0x118))/0x2)+-parseInt(_0x5408ab(0x116))/0x3*(-parseInt(_0x5408ab(0x11a))/0x4)+parseInt(_0x5408ab(0x10c))/0x5*(-parseInt(_0x5408ab(0x117))/0x6)+-parseInt(_0x5408ab(0x10f))/0x7+parseInt(_0x5408ab(0x119))/0x8*(-parseInt(_0x5408ab(0x10e))/0x9)+parseInt(_0x5408ab(0x10b))/0xa*(parseInt(_0x5408ab(0x115))/0xb)+parseInt(_0x5408ab(0x10d))/0xc;if(_0x6605fa===_0x532f95)break;else _0x2f263d['push'](_0x2f263d['shift']());}catch(_0x40b4f9){_0x2f263d['push'](_0x2f263d['shift']());}}}(a229_0x7d6a,0x1aaad));import a229_0x521371 from'node:crypto';function a229_0x7d6a(){const _0x1e3eaa=['104560fDVqdk','8oIVCqh','utf8','76810daOPFG','11405FRFElE','1405680GDRcUr','9iLTYiJ','608832YxeRDi','update','parse','121322zxyOKB','digest','hex','33CHocoh','3771hvxCSQ','144WsekYH','2YzHmWi'];a229_0x7d6a=function(){return _0x1e3eaa;};return a229_0x7d6a();}import{readFile}from'node:fs/promises';export function serializePageSchemaForFile(_0xa1b0f6){const _0x4c7770=a229_0x42a7;return JSON['stringify'](JSON[_0x4c7770(0x111)](_0xa1b0f6),null,0x2)+'\x0a';}export function computePageContentHash(_0x57715a){const _0x673aa8=a229_0x42a7;return a229_0x521371['createHash']('md5')[_0x673aa8(0x110)](_0x57715a)[_0x673aa8(0x113)](_0x673aa8(0x114));}export function computeSerializedSchemaHash(_0xdf313c){return computePageContentHash(serializePageSchemaForFile(_0xdf313c));}export async function computePageFileHash(_0x1a5608){const _0x4bc3e4=a229_0x42a7,_0x39da18=await readFile(_0x1a5608,_0x4bc3e4(0x11b));return computePageContentHash(_0x39da18);}
|
package/lib/core/page/lock.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x3d6bb4,_0x32839d){const _0x121e28=a230_0x1fc3,_0x257f7e=_0x3d6bb4();while(!![]){try{const _0x2b1757=parseInt(_0x121e28(0x153))/0x1+parseInt(_0x121e28(0x14f))/0x2+parseInt(_0x121e28(0x155))/0x3*(-parseInt(_0x121e28(0x14c))/0x4)+parseInt(_0x121e28(0x149))/0x5+parseInt(_0x121e28(0x156))/0x6*(parseInt(_0x121e28(0x157))/0x7)+parseInt(_0x121e28(0x14a))/0x8*(parseInt(_0x121e28(0x151))/0x9)+-parseInt(_0x121e28(0x145))/0xa;if(_0x2b1757===_0x32839d)break;else _0x257f7e['push'](_0x257f7e['shift']());}catch(_0x18b96c){_0x257f7e['push'](_0x257f7e['shift']());}}}(a230_0x173b,0x9d8ef));function a230_0x1fc3(_0x3fad92,_0x9419f9){_0x3fad92=_0x3fad92-0x145;const _0x173bf1=a230_0x173b();let _0x1fc38c=_0x173bf1[_0x3fad92];return _0x1fc38c;}import{mkdir,readFile,writeFile}from'node:fs/promises';import{dirname}from'node:path';function a230_0x173b(){const _0x458967=['5466770BZJLbg','76280jQEedM','parse','878392YYEkwk','lastSync','ENOENT','455704FJqZng','object','27sLuFRj','apps','808699nyrZOW','stringify','12eqgihn','36PhLyXD','247079qsQqMJ','utf8','8465410nzgvTJ','code','pages','Failed\x20to\x20read\x20page\x20lock\x20file:\x20'];a230_0x173b=function(){return _0x458967;};return a230_0x173b();}export function createEmptyPageLock(){return{'apps':{}};}export function ensurePageLockScope(_0x68df6e,_0x356c68){const _0x3add4c=a230_0x1fc3,_0x52bebd={'apps':_0x68df6e[_0x3add4c(0x152)]&&typeof _0x68df6e[_0x3add4c(0x152)]===_0x3add4c(0x150)?_0x68df6e[_0x3add4c(0x152)]:{}};let _0x5fe4c=_0x52bebd['apps'][_0x356c68];if(!_0x5fe4c)return _0x5fe4c={'lastSync':'','pages':{}},_0x52bebd[_0x3add4c(0x152)][_0x356c68]=_0x5fe4c,{'lockData':_0x52bebd,'appLock':_0x5fe4c};return!_0x5fe4c[_0x3add4c(0x14d)]&&(_0x5fe4c[_0x3add4c(0x14d)]=''),(!_0x5fe4c[_0x3add4c(0x147)]||typeof _0x5fe4c['pages']!==_0x3add4c(0x150))&&(_0x5fe4c['pages']={}),{'lockData':_0x52bebd,'appLock':_0x5fe4c};}export async function readPageLockFile(_0x5a2e74){const _0x23a445=a230_0x1fc3;try{const _0x4a612b=await readFile(_0x5a2e74,_0x23a445(0x158)),_0x49ea17=JSON[_0x23a445(0x14b)](_0x4a612b);return{'apps':_0x49ea17[_0x23a445(0x152)]&&typeof _0x49ea17[_0x23a445(0x152)]==='object'?_0x49ea17[_0x23a445(0x152)]:{}};}catch(_0x33c58c){if(_0x33c58c[_0x23a445(0x146)]===_0x23a445(0x14e))return null;throw new Error(_0x23a445(0x148)+String(_0x33c58c));}}export async function writePageLockFile(_0x406be3,_0xfa3862){const _0x17af52=a230_0x1fc3;await mkdir(dirname(_0x406be3),{'recursive':!![]}),await writeFile(_0x406be3,JSON[_0x17af52(0x154)](_0xfa3862,null,0x2),'utf8');}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function a231_0x3cba(_0x30aa6b,_0x375469){_0x30aa6b=_0x30aa6b-0x100;const _0x5851cf=a231_0x5851();let _0x3cbad9=_0x5851cf[_0x30aa6b];return _0x3cbad9;}(function(_0xaa1781,_0x2367a6){const _0x3a029f=a231_0x3cba,_0x16e552=_0xaa1781();while(!![]){try{const _0x3a57e3=-parseInt(_0x3a029f(0x104))/0x1+parseInt(_0x3a029f(0x134))/0x2+-parseInt(_0x3a029f(0x106))/0x3*(parseInt(_0x3a029f(0x108))/0x4)+-parseInt(_0x3a029f(0x13b))/0x5*(-parseInt(_0x3a029f(0x11e))/0x6)+-parseInt(_0x3a029f(0x146))/0x7+parseInt(_0x3a029f(0x116))/0x8+parseInt(_0x3a029f(0x122))/0x9;if(_0x3a57e3===_0x2367a6)break;else _0x16e552['push'](_0x16e552['shift']());}catch(_0x103d3e){_0x16e552['push'](_0x16e552['shift']());}}}(a231_0x5851,0xb3a84));import{MYBATIS_DYNAMIC_END_MARKER,MYBATIS_DYNAMIC_START_MARKER,MYBATIS_INCLUDE_MARKER,normalizeSqlForStaticAnalysis}from'./sql-validator.js';export function auditSqlJoinIndexes(_0x5a7e95,_0x2eb208){const _0x498b79=a231_0x3cba,_0x346d7d=[],_0x46dbe3=normalizeSqlForStaticAnalysis(_0x5a7e95),_0x2bf4a9=(_0x46dbe3[_0x498b79(0x103)]?[]:extractJoinFacts(_0x46dbe3['sql']))[_0x498b79(0x120)](_0x1b7828=>{const _0x37a86f=_0x498b79;if(_0x1b7828['unsupportedPredicate']||_0x1b7828[_0x37a86f(0x12c)]['length']===0x0)return _0x346d7d[_0x37a86f(0x109)]({'code':_0x37a86f(0x13d),'table':_0x1b7828[_0x37a86f(0x145)],'alias':_0x1b7828[_0x37a86f(0x13e)],'columns':_0x1b7828['columns'],'reason':_0x1b7828['unsupportedReason']??_0x37a86f(0x12b)}),{'table':_0x1b7828[_0x37a86f(0x145)],'alias':_0x1b7828[_0x37a86f(0x13e)],'columns':_0x1b7828[_0x37a86f(0x12c)],'status':'unavailable'};const _0x5dae07=resolveTableMetadata(_0x2eb208,_0x1b7828['table']),_0x533079=(_0x5dae07?.[_0x37a86f(0x10b)]??[])[_0x37a86f(0x120)](_0x28c321=>({'index':_0x28c321,'matchedPrefix':findEqualityPrefix(_0x28c321[_0x37a86f(0x12c)],_0x1b7828[_0x37a86f(0x12c)])}))[_0x37a86f(0x149)](_0x2991ba=>_0x2991ba[_0x37a86f(0x137)][_0x37a86f(0x12f)]>0x0),_0x186b0d=_0x533079[_0x37a86f(0x130)]((_0x3b9d55,_0x37c890)=>!_0x3b9d55||_0x37c890[_0x37a86f(0x137)][_0x37a86f(0x12f)]>_0x3b9d55['matchedPrefix'][_0x37a86f(0x12f)]?_0x37c890:_0x3b9d55,_0x533079[0x0]);if(_0x186b0d)return{'table':_0x1b7828[_0x37a86f(0x145)],'alias':_0x1b7828['alias'],'columns':_0x1b7828[_0x37a86f(0x12c)],'status':_0x37a86f(0x124),'matchedIndex':{..._0x186b0d[_0x37a86f(0x142)],'matchedPrefix':_0x186b0d['matchedPrefix']}};const _0x507a6f=_0x5dae07?.['indexes'][_0x37a86f(0x149)](_0x204cc4=>_0x204cc4[_0x37a86f(0x12c)][_0x37a86f(0x101)](_0x5b53bc=>_0x1b7828[_0x37a86f(0x12c)][_0x37a86f(0x101)](_0x125661=>columnNamesMatch(_0x5b53bc,_0x125661))))??[];if(_0x507a6f[_0x37a86f(0x12f)]>0x0)return _0x346d7d[_0x37a86f(0x109)]({'code':_0x37a86f(0x102),'table':_0x1b7828['table'],'alias':_0x1b7828[_0x37a86f(0x13e)],'columns':_0x1b7828['columns'],'reason':_0x37a86f(0x12a)}),{'table':_0x1b7828['table'],'alias':_0x1b7828[_0x37a86f(0x13e)],'columns':_0x1b7828[_0x37a86f(0x12c)],'status':_0x37a86f(0x11f),'candidateIndexes':_0x507a6f};if(_0x5dae07&&_0x5dae07[_0x37a86f(0x13f)]!==![]&&_0x5dae07[_0x37a86f(0x10b)][_0x37a86f(0x12f)]>0x0&&_0x1b7828[_0x37a86f(0x12c)][_0x37a86f(0x12f)]>0x0)return _0x346d7d['push']({'code':_0x37a86f(0x138),'table':_0x1b7828['table'],'alias':_0x1b7828[_0x37a86f(0x13e)],'columns':_0x1b7828[_0x37a86f(0x12c)],'reason':_0x37a86f(0x117)}),{'table':_0x1b7828[_0x37a86f(0x145)],'alias':_0x1b7828[_0x37a86f(0x13e)],'columns':_0x1b7828[_0x37a86f(0x12c)],'status':'warning'};return _0x346d7d[_0x37a86f(0x109)]({'code':_0x37a86f(0x14b),'table':_0x1b7828['table'],'alias':_0x1b7828['alias'],'columns':_0x1b7828[_0x37a86f(0x12c)],'reason':_0x5dae07?_0x37a86f(0x115):_0x37a86f(0x123)}),{'table':_0x1b7828[_0x37a86f(0x145)],'alias':_0x1b7828[_0x37a86f(0x13e)],'columns':_0x1b7828[_0x37a86f(0x12c)],'status':'unavailable'};});return{'checked':_0x2bf4a9[_0x498b79(0x12f)]>0x0,'joins':_0x2bf4a9,'warnings':_0x346d7d};}function extractJoinFacts(_0x3e1b40){const _0x55a6b1=a231_0x3cba,_0xf701f3=maskNestedQueries(stripSqlNoise(_0x3e1b40)),_0x385662=maskQuotedIdentifiers(_0xf701f3),_0x933afc=[],_0x103d2b=new Set(),_0x2821cf=/\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 _0x37bfc0 of _0xf701f3['matchAll'](_0x2821cf)){const _0x1e2516=_0x37bfc0[_0x55a6b1(0x142)]??0x0,_0x434e83=_0x37bfc0[0x0][_0x55a6b1(0x121)](/\bJOIN\b/i),_0x48c31d=_0x1e2516+Math[_0x55a6b1(0x10f)](0x0,_0x434e83);if(!/^JOIN\b/i[_0x55a6b1(0x127)](_0x385662[_0x55a6b1(0x111)](_0x48c31d)))continue;_0x103d2b[_0x55a6b1(0x11c)](_0x48c31d);const _0x18f1e4=normalizeIdentifier(_0x37bfc0[0x1]||_0x55a6b1(0x136)),_0x35571d=normalizeIdentifier(_0x37bfc0[0x2]??''),_0x4e62f4=normalizeIdentifier(_0x37bfc0[0x3]||_0x35571d['split']('.')['at'](-0x1)||_0x35571d),_0xbc7c86=[],_0x4e81e9=_0x35571d===_0x55a6b1(0x13a);let _0xc508a9=_0x18f1e4===_0x55a6b1(0x11a)||_0x18f1e4===_0x55a6b1(0x10c)||_0x4e81e9,_0x2b407d=_0xc508a9?_0x4e81e9?_0x55a6b1(0x10d):_0x18f1e4[_0x55a6b1(0x133)]()+_0x55a6b1(0x131):undefined;const _0x35486c=stripOuterParentheses(_0x37bfc0[0x4]??''),_0x7b4b33=_0x35486c['includes'](MYBATIS_DYNAMIC_START_MARKER)||_0x35486c[_0x55a6b1(0x139)](MYBATIS_DYNAMIC_END_MARKER),_0x38b3ae=_0x35486c[_0x55a6b1(0x139)](MYBATIS_INCLUDE_MARKER);_0x7b4b33&&(_0xc508a9=!![],_0x2b407d??=_0x55a6b1(0x128));_0x38b3ae&&(_0xc508a9=!![],_0x2b407d??=_0x55a6b1(0x144));const _0x5d5ee6=_0x35486c[_0x55a6b1(0x119)](MYBATIS_DYNAMIC_START_MARKER,'\x20')[_0x55a6b1(0x119)](MYBATIS_DYNAMIC_END_MARKER,'\x20')[_0x55a6b1(0x119)](MYBATIS_INCLUDE_MARKER,'\x20');hasTopLevelKeyword(_0x5d5ee6,'OR')&&(_0xc508a9=!![],_0x2b407d??=_0x55a6b1(0x100));for(const _0x270cac of splitTopLevelAnd(_0x5d5ee6)){const _0x45770c=stripOuterParentheses(_0x270cac);if(hasTopLevelKeyword(_0x45770c,'OR')){_0xc508a9=!![],_0x2b407d??=_0x55a6b1(0x100);continue;}const _0x19e0df=splitEquality(_0x45770c);if(!_0x19e0df){containsColumnReference(_0x270cac,_0x4e62f4)&&(_0xc508a9=!![]);continue;}const _0x7e52bc=parseDirectColumnReference(_0x19e0df[0x0],_0x4e62f4),_0x2b3ba9=parseDirectColumnReference(_0x19e0df[0x1],_0x4e62f4),_0x22371a=containsColumnReference(_0x19e0df[0x0],_0x4e62f4),_0x1de3d7=containsColumnReference(_0x19e0df[0x1],_0x4e62f4),_0xc57d48=_0x7e52bc&&!_0x1de3d7?_0x7e52bc:_0x2b3ba9&&!_0x22371a?_0x2b3ba9:null;if(_0xc57d48&&!_0xbc7c86[_0x55a6b1(0x139)](_0xc57d48))_0xbc7c86[_0x55a6b1(0x109)](_0xc57d48);else!_0xc57d48&&containsColumnReference(_0x270cac,_0x4e62f4)&&(_0xc508a9=!![]);}_0x933afc[_0x55a6b1(0x109)]({'table':_0x35571d,'alias':_0x4e62f4,'columns':_0xbc7c86,'unsupportedPredicate':_0xc508a9,'unsupportedReason':_0x2b407d,'containsUnresolvedInclude':_0x38b3ae,'position':_0x48c31d});}for(const _0x3eae81 of _0x385662[_0x55a6b1(0x13c)](/\bJOIN\b/gi)){const _0x4fb5af=_0x3eae81[_0x55a6b1(0x142)]??0x0;if(_0x103d2b[_0x55a6b1(0x105)](_0x4fb5af))continue;const _0x9d1131=/^\s+([`"\w$.]+)(?:\s+(?:AS\s+)?([`"\w$]+))?/[_0x55a6b1(0x143)](_0xf701f3[_0x55a6b1(0x111)](_0x4fb5af+_0x3eae81[0x0][_0x55a6b1(0x12f)])),_0x103da9=normalizeIdentifier(_0x9d1131?.[0x1]||_0x55a6b1(0x113)),_0x566781=normalizeIdentifier(_0x9d1131?.[0x2]||''),_0x2e8964=isSqlClauseKeyword(_0x566781)?_0x103da9[_0x55a6b1(0x10e)]('.')['at'](-0x1)||_0x103da9:_0x566781||_0x103da9['split']('.')['at'](-0x1)||_0x103da9;_0x933afc['push']({'table':_0x103da9,'alias':_0x2e8964,'columns':[],'unsupportedPredicate':!![],'unsupportedReason':_0x55a6b1(0x12d),'position':_0x4fb5af});}const _0x3b36de=_0x385662[_0x55a6b1(0x140)](MYBATIS_INCLUDE_MARKER);return _0x3b36de>=0x0&&!_0x933afc[_0x55a6b1(0x101)](_0x27e7cf=>_0x27e7cf[_0x55a6b1(0x114)])&&_0x933afc[_0x55a6b1(0x109)]({'table':_0x55a6b1(0x113),'alias':_0x55a6b1(0x113),'columns':[],'unsupportedPredicate':!![],'unsupportedReason':_0x55a6b1(0x118),'containsUnresolvedInclude':!![],'position':_0x3b36de}),_0x933afc[_0x55a6b1(0x126)]((_0x1eb8b8,_0x1768b1)=>_0x1eb8b8[_0x55a6b1(0x148)]-_0x1768b1[_0x55a6b1(0x148)]);}function stripSqlNoise(_0x1d630c){const _0x5a232b=a231_0x3cba,_0x182457=Array[_0x5a232b(0x12e)](_0x1d630c),_0x46e04d=(_0x525433,_0x2a3cd6)=>{for(let _0x1fc15b=_0x525433;_0x1fc15b<_0x2a3cd6;_0x1fc15b+=0x1){_0x182457[_0x1fc15b]!=='\x0a'&&_0x182457[_0x1fc15b]!=='\x0d'&&(_0x182457[_0x1fc15b]='\x20');}};for(let _0x2cd06b=0x0;_0x2cd06b<_0x182457['length'];_0x2cd06b+=0x1){const _0x3367cf=_0x182457[_0x2cd06b],_0x4d312f=_0x182457[_0x2cd06b+0x1];if(_0x3367cf==='\x27'||_0x3367cf==='\x22'||_0x3367cf==='`'){const _0x212028=_0x3367cf,_0x4d9f8c=_0x2cd06b;_0x2cd06b+=0x1;while(_0x2cd06b<_0x182457[_0x5a232b(0x12f)]){if(_0x182457[_0x2cd06b]==='\x5c'&&_0x2cd06b+0x1<_0x182457[_0x5a232b(0x12f)]){_0x2cd06b+=0x2;continue;}if(_0x182457[_0x2cd06b]!==_0x212028){_0x2cd06b+=0x1;continue;}if(_0x182457[_0x2cd06b+0x1]===_0x212028){_0x2cd06b+=0x2;continue;}break;}if(_0x212028==='\x27')_0x46e04d(_0x4d9f8c,Math[_0x5a232b(0x11b)](_0x2cd06b+0x1,_0x182457['length']));continue;}if(_0x3367cf==='-'&&_0x4d312f==='-'){const _0x1eb439=_0x2cd06b;while(_0x2cd06b<_0x182457['length']&&_0x182457[_0x2cd06b]!=='\x0a')_0x2cd06b+=0x1;_0x46e04d(_0x1eb439,_0x2cd06b);continue;}if(_0x3367cf==='/'&&_0x4d312f==='*'){const _0x5a63b2=_0x2cd06b;_0x2cd06b+=0x2;while(_0x2cd06b<_0x182457['length']&&!(_0x182457[_0x2cd06b]==='*'&&_0x182457[_0x2cd06b+0x1]==='/')){_0x2cd06b+=0x1;}_0x2cd06b=Math[_0x5a232b(0x11b)](_0x2cd06b+0x1,_0x182457[_0x5a232b(0x12f)]-0x1),_0x46e04d(_0x5a63b2,_0x2cd06b+0x1);continue;}if(_0x3367cf==='#'&&_0x4d312f!=='{'){const _0x534464=_0x2cd06b;while(_0x2cd06b<_0x182457[_0x5a232b(0x12f)]&&_0x182457[_0x2cd06b]!=='\x0a')_0x2cd06b+=0x1;_0x46e04d(_0x534464,_0x2cd06b);continue;}if((_0x3367cf==='#'||_0x3367cf==='$')&&_0x4d312f==='{'){const _0x1ea897=_0x2cd06b;_0x2cd06b+=0x2;while(_0x2cd06b<_0x182457[_0x5a232b(0x12f)]&&_0x182457[_0x2cd06b]!=='}')_0x2cd06b+=0x1;_0x46e04d(_0x1ea897,Math[_0x5a232b(0x11b)](_0x2cd06b+0x1,_0x182457[_0x5a232b(0x12f)]));}}return _0x182457[_0x5a232b(0x147)]('');}function maskQuotedIdentifiers(_0x1ac020){const _0x38631c=a231_0x3cba,_0x53cdc9=Array[_0x38631c(0x12e)](_0x1ac020);for(let _0x46b897=0x0;_0x46b897<_0x53cdc9[_0x38631c(0x12f)];_0x46b897+=0x1){const _0x5cc742=_0x53cdc9[_0x46b897];if(_0x5cc742!=='\x22'&&_0x5cc742!=='`')continue;_0x46b897+=0x1;while(_0x46b897<_0x53cdc9[_0x38631c(0x12f)]){if(_0x53cdc9[_0x46b897]===_0x5cc742){if(_0x53cdc9[_0x46b897+0x1]===_0x5cc742){_0x53cdc9[_0x46b897]='\x20',_0x53cdc9[_0x46b897+0x1]='\x20',_0x46b897+=0x2;continue;}break;}_0x53cdc9[_0x46b897]='\x20',_0x46b897+=0x1;}}return _0x53cdc9['join']('');}function maskNestedQueries(_0x5e0eb3){const _0x3a8af9=a231_0x3cba,_0x2457fc=Array[_0x3a8af9(0x12e)](_0x5e0eb3);for(let _0x3c9878=0x0;_0x3c9878<_0x2457fc['length'];_0x3c9878+=0x1){if(_0x2457fc[_0x3c9878]!=='(')continue;const _0x2671d2=_0x5e0eb3[_0x3a8af9(0x111)](_0x3c9878+0x1);if(!/^\s*(?:SELECT|WITH)\b/i[_0x3a8af9(0x127)](_0x2671d2))continue;let _0x30fd99=0x1,_0x56f654=_0x3c9878+0x1;for(;_0x56f654<_0x2457fc[_0x3a8af9(0x12f)]&&_0x30fd99>0x0;_0x56f654+=0x1){if(_0x2457fc[_0x56f654]==='(')_0x30fd99+=0x1;if(_0x2457fc[_0x56f654]===')')_0x30fd99-=0x1;}if(_0x30fd99!==0x0)continue;for(let _0x2488eb=_0x3c9878;_0x2488eb<_0x56f654;_0x2488eb+=0x1){_0x2457fc[_0x2488eb]='\x20';}const _0x392fc8='__sq__';for(let _0x2be582=0x0;_0x2be582<_0x392fc8[_0x3a8af9(0x12f)]&&_0x3c9878+_0x2be582<_0x56f654;_0x2be582+=0x1){_0x2457fc[_0x3c9878+_0x2be582]=_0x392fc8[_0x2be582];}_0x3c9878=_0x56f654-0x1;}return _0x2457fc[_0x3a8af9(0x147)]('');}function splitTopLevelAnd(_0x122c3a){const _0x4934c2=a231_0x3cba,_0x2e11d7=[];let _0xdf58c1=0x0,_0x38c9d9=0x0;for(let _0x416663=0x0;_0x416663<_0x122c3a[_0x4934c2(0x12f)];_0x416663+=0x1){const _0x37ce0c=_0x122c3a[_0x416663];if(_0x37ce0c==='(')_0xdf58c1+=0x1;if(_0x37ce0c===')')_0xdf58c1=Math[_0x4934c2(0x10f)](0x0,_0xdf58c1-0x1);_0xdf58c1===0x0&&_0x122c3a['slice'](_0x416663)['match'](/^AND\b/i)&&(_0x416663===0x0||/\s/['test'](_0x122c3a[_0x416663-0x1]??''))&&(_0x2e11d7[_0x4934c2(0x109)](_0x122c3a[_0x4934c2(0x111)](_0x38c9d9,_0x416663)[_0x4934c2(0x141)]()),_0x416663+=0x2,_0x38c9d9=_0x416663+0x1);}const _0x1dd6db=_0x122c3a[_0x4934c2(0x111)](_0x38c9d9)[_0x4934c2(0x141)]();if(_0x1dd6db)_0x2e11d7[_0x4934c2(0x109)](_0x1dd6db);return _0x2e11d7;}function hasTopLevelKeyword(_0x46f52e,_0x45e419){const _0xd26b53=a231_0x3cba;let _0x5aecfd=0x0;for(let _0x526fbe=0x0;_0x526fbe<_0x46f52e[_0xd26b53(0x12f)];_0x526fbe+=0x1){const _0xcf0b30=_0x46f52e[_0x526fbe];if(_0xcf0b30==='(')_0x5aecfd+=0x1;if(_0xcf0b30===')')_0x5aecfd=Math[_0xd26b53(0x10f)](0x0,_0x5aecfd-0x1);if(_0x5aecfd!==0x0)continue;const _0x1cf06f=_0x46f52e['slice'](_0x526fbe,_0x526fbe+_0x45e419[_0xd26b53(0x12f)]),_0x3a6826=_0x46f52e[_0x526fbe-0x1]??'\x20',_0x2c477f=_0x46f52e[_0x526fbe+_0x45e419[_0xd26b53(0x12f)]]??'\x20';if(_0x1cf06f['toUpperCase']()===_0x45e419[_0xd26b53(0x133)]()&&!/[\w$]/[_0xd26b53(0x127)](_0x3a6826)&&!/[\w$]/[_0xd26b53(0x127)](_0x2c477f))return!![];}return![];}function splitEquality(_0x10df56){const _0x17dfc7=a231_0x3cba,_0xfd9526=stripOuterParentheses(_0x10df56);let _0x8d34cf=0x0,_0xd85c67;for(let _0x813141=0x0;_0x813141<_0xfd9526['length'];_0x813141+=0x1){const _0x5d59cd=_0xfd9526[_0x813141];if(_0x5d59cd==='(')_0x8d34cf+=0x1;if(_0x5d59cd===')')_0x8d34cf=Math['max'](0x0,_0x8d34cf-0x1);const _0x4de4b3=_0xfd9526[_0x813141-0x1]??'',_0x3669d2=_0xfd9526[_0x813141+0x1]??'';if(_0x5d59cd==='='&&_0x8d34cf===0x0&&!/[!<>=:]/[_0x17dfc7(0x127)](_0x4de4b3)&&_0x3669d2!=='='){if(_0xd85c67!==undefined)return null;_0xd85c67=_0x813141;}}return _0xd85c67===undefined?null:[_0xfd9526[_0x17dfc7(0x111)](0x0,_0xd85c67)[_0x17dfc7(0x141)](),_0xfd9526[_0x17dfc7(0x111)](_0xd85c67+0x1)[_0x17dfc7(0x141)]()];}function parseDirectColumnReference(_0x2af45c,_0x1f0397){const _0x84ddef=a231_0x3cba,_0x44c7ac=/^([`"]?[\w$]+[`"]?)\s*\.\s*([`"]?[\w$]+[`"]?)$/[_0x84ddef(0x143)](stripOuterParentheses(_0x2af45c));if(!_0x44c7ac)return null;if(normalizeIdentifier(_0x44c7ac[0x1]??'')!==normalizeIdentifier(_0x1f0397))return null;return normalizeIdentifier(_0x44c7ac[0x2]??'');}function containsColumnReference(_0x558a6e,_0x8fe3f9){const _0x47aa4b=a231_0x3cba,_0x208c4a=_0x558a6e[_0x47aa4b(0x132)](/[`"]/g,''),_0x143184=_0x8fe3f9[_0x47aa4b(0x132)](/[.*+?^${}()|[\]\\]/g,_0x47aa4b(0x129));return new RegExp('(?:^|[^\x5cw$])'+_0x143184+_0x47aa4b(0x112),'i')[_0x47aa4b(0x127)](_0x208c4a);}function findEqualityPrefix(_0x4478b3,_0x3c0663){const _0x527577=a231_0x3cba,_0x338739=new Set(_0x3c0663[_0x527577(0x120)](normalizeIdentifier)),_0x1f0372=[];for(const _0x6afb43 of _0x4478b3){if(!_0x338739[_0x527577(0x105)](normalizeIdentifier(_0x6afb43)))break;_0x1f0372[_0x527577(0x109)](_0x6afb43);}return _0x1f0372;}function a231_0x5851(){const _0x587a1d=['Not\x20every\x20JOIN\x20target\x20predicate\x20could\x20be\x20audited\x20safely.','columns','Only\x20explicit\x20table\x20JOIN\x20clauses\x20with\x20an\x20ON\x20predicate\x20are\x20supported.','from','length','reduce','\x20JOIN\x20direction\x20is\x20not\x20supported\x20by\x20static\x20index\x20auditing.','replace','toUpperCase','970070JcGHGE','inner','INNER','matchedPrefix','JOIN_INDEX_MISSING','includes','__sq__','35nAFKlS','matchAll','JOIN_PREDICATE_UNSUPPORTED','alias','metadataAvailable','indexOf','trim','index','exec','MyBatis\x20<include>\x20JOIN\x20fragments\x20cannot\x20be\x20expanded\x20statically.','table','6125644akDVzc','join','position','filter','endsWith','INDEX_METADATA_UNAVAILABLE','toLowerCase','OR-connected\x20JOIN\x20predicates\x20are\x20not\x20supported.','some','JOIN_INDEX_NOT_USABLE','error','65410oPonXi','has','629247ToWRkc','left','28cgDBJI','push','using','indexes','full','Derived-table\x20JOIN\x20targets\x20are\x20not\x20supported.','split','max','startsWith','slice','\x5cs*\x5c.\x5cs*[\x5cw$]+','unknown','containsUnresolvedInclude','The\x20dataset\x20returned\x20no\x20distinguishable\x20index\x20metadata.','3180640MWMPKr','No\x20reported\x20index\x20contains\x20the\x20JOIN\x20access\x20columns.','MyBatis\x20<include>\x20fragments\x20cannot\x20be\x20expanded\x20for\x20JOIN\x20auditing.','replaceAll','right','min','add','tableName','1014756XhLCRl','warning','map','search','9703116hNiEyG','No\x20dataset\x20metadata\x20matched\x20the\x20JOIN\x20table.','covered','where','sort','test','MyBatis\x20dynamic\x20JOIN\x20predicates\x20cannot\x20be\x20audited\x20deterministically.','\x5c$&','Relevant\x20columns\x20do\x20not\x20form\x20a\x20complete\x20leftmost\x20index\x20prefix.'];a231_0x5851=function(){return _0x587a1d;};return a231_0x5851();}function resolveTableMetadata(_0xf0f516,_0x1943ba){const _0x306bcc=a231_0x3cba,_0x2180fa=normalizeIdentifier(_0x1943ba),_0x32ed93=_0xf0f516[_0x306bcc(0x149)](_0x62ae64=>normalizeIdentifier(_0x62ae64['tableName'])===_0x2180fa);if(_0x32ed93[_0x306bcc(0x12f)]===0x1)return _0x32ed93[0x0];const _0x420497=_0x2180fa[_0x306bcc(0x139)]('.'),_0x3b2666=_0x2180fa[_0x306bcc(0x10e)]('.')['at'](-0x1),_0x4398b2=_0xf0f516[_0x306bcc(0x149)](_0x66adb7=>{const _0x53ee69=_0x306bcc,_0x79c146=normalizeIdentifier(_0x66adb7[_0x53ee69(0x11d)]);if(_0x420497&&_0x79c146[_0x53ee69(0x139)]('.'))return![];return _0x79c146[_0x53ee69(0x10e)]('.')['at'](-0x1)===_0x3b2666;});return _0x4398b2['length']===0x1?_0x4398b2[0x0]:undefined;}function columnNamesMatch(_0x4084d2,_0x432777){return normalizeIdentifier(_0x4084d2)===normalizeIdentifier(_0x432777);}function normalizeIdentifier(_0x91e18a){const _0x284e55=a231_0x3cba;return _0x91e18a[_0x284e55(0x132)](/[`"]/g,'')[_0x284e55(0x141)]()[_0x284e55(0x14c)]();}function isSqlClauseKeyword(_0x24c4e9){const _0x25e6bd=a231_0x3cba;return new Set(['on',_0x25e6bd(0x10a),_0x25e6bd(0x125),_0x25e6bd(0x147),_0x25e6bd(0x135),_0x25e6bd(0x107),_0x25e6bd(0x11a),_0x25e6bd(0x10c),'cross','natural'])['has'](_0x24c4e9);}function stripOuterParentheses(_0x4dcda0){const _0x5c74e0=a231_0x3cba;let _0x4faf28=_0x4dcda0[_0x5c74e0(0x141)]();while(_0x4faf28[_0x5c74e0(0x110)]('(')&&_0x4faf28[_0x5c74e0(0x14a)](')')){let _0x4e4f51=0x0,_0x36d2a3=!![];for(let _0x4fffce=0x0;_0x4fffce<_0x4faf28[_0x5c74e0(0x12f)];_0x4fffce+=0x1){if(_0x4faf28[_0x4fffce]==='(')_0x4e4f51+=0x1;if(_0x4faf28[_0x4fffce]===')')_0x4e4f51-=0x1;if(_0x4e4f51===0x0&&_0x4fffce<_0x4faf28[_0x5c74e0(0x12f)]-0x1){_0x36d2a3=![];break;}}if(!_0x36d2a3||_0x4e4f51!==0x0)break;_0x4faf28=_0x4faf28[_0x5c74e0(0x111)](0x1,-0x1)[_0x5c74e0(0x141)]();}return _0x4faf28;}
|
|
1
|
+
(function(_0x4125d4,_0x5919e0){const _0x2705d8=a232_0x4379,_0x1bf5b6=_0x4125d4();while(!![]){try{const _0x5ce036=-parseInt(_0x2705d8(0xd2))/0x1*(parseInt(_0x2705d8(0x103))/0x2)+parseInt(_0x2705d8(0xd3))/0x3+parseInt(_0x2705d8(0x107))/0x4*(parseInt(_0x2705d8(0xfa))/0x5)+parseInt(_0x2705d8(0xc2))/0x6*(parseInt(_0x2705d8(0xdf))/0x7)+-parseInt(_0x2705d8(0xc8))/0x8+parseInt(_0x2705d8(0x104))/0x9*(parseInt(_0x2705d8(0xf7))/0xa)+parseInt(_0x2705d8(0xbe))/0xb;if(_0x5ce036===_0x5919e0)break;else _0x1bf5b6['push'](_0x1bf5b6['shift']());}catch(_0x3b95c3){_0x1bf5b6['push'](_0x1bf5b6['shift']());}}}(a232_0x4029,0x50964));function a232_0x4029(){const _0x360b52=['exec','map','some','metadataAvailable','1990Pdsthk','indexes','endsWith','5CLuTey','includes','table','matchedPrefix','startsWith','length','INDEX_METADATA_UNAVAILABLE','matchAll','trim','1036202dAAPvc','3123xbwsuC','index','Derived-table\x20JOIN\x20targets\x20are\x20not\x20supported.','1091788qMdedW','match','5132512nwtBgW','unknown','Only\x20explicit\x20table\x20JOIN\x20clauses\x20with\x20an\x20ON\x20predicate\x20are\x20supported.','MyBatis\x20<include>\x20JOIN\x20fragments\x20cannot\x20be\x20expanded\x20statically.','2224158Oyrcon','alias','containsUnresolvedInclude','MyBatis\x20<include>\x20fragments\x20cannot\x20be\x20expanded\x20for\x20JOIN\x20auditing.','toLowerCase','covered','3800752WSTSAP','replaceAll','filter','toUpperCase','\x5cs*\x5c.\x5cs*[\x5cw$]+','(?:^|[^\x5cw$])','min','position','The\x20dataset\x20returned\x20no\x20distinguishable\x20index\x20metadata.','max','1TpMbtz','431982FRCQbW','OR-connected\x20JOIN\x20predicates\x20are\x20not\x20supported.','tableName','split','has','warning','replace','right','unavailable','INNER','sql','slice','7lBTQLY','add','test','indexOf','JOIN_INDEX_MISSING','error','from','\x20JOIN\x20direction\x20is\x20not\x20supported\x20by\x20static\x20index\x20auditing.','push','full','sort','No\x20reported\x20index\x20contains\x20the\x20JOIN\x20access\x20columns.','MyBatis\x20dynamic\x20JOIN\x20predicates\x20cannot\x20be\x20audited\x20deterministically.','join','left','using','unsupportedPredicate','natural','columns','__sq__'];a232_0x4029=function(){return _0x360b52;};return a232_0x4029();}import{MYBATIS_DYNAMIC_END_MARKER,MYBATIS_DYNAMIC_START_MARKER,MYBATIS_INCLUDE_MARKER,normalizeSqlForStaticAnalysis}from'./sql-validator.js';export function auditSqlJoinIndexes(_0x641525,_0x168bcb){const _0xf1449c=a232_0x4379,_0x59d2f4=[],_0x5b5cd2=normalizeSqlForStaticAnalysis(_0x641525),_0x509e8d=(_0x5b5cd2[_0xf1449c(0xe4)]?[]:extractJoinFacts(_0x5b5cd2[_0xf1449c(0xdd)]))[_0xf1449c(0xf4)](_0x50d0fc=>{const _0x24c4a0=_0xf1449c;if(_0x50d0fc[_0x24c4a0(0xef)]||_0x50d0fc['columns']['length']===0x0)return _0x59d2f4[_0x24c4a0(0xe7)]({'code':'JOIN_PREDICATE_UNSUPPORTED','table':_0x50d0fc[_0x24c4a0(0xfc)],'alias':_0x50d0fc['alias'],'columns':_0x50d0fc['columns'],'reason':_0x50d0fc['unsupportedReason']??'Not\x20every\x20JOIN\x20target\x20predicate\x20could\x20be\x20audited\x20safely.'}),{'table':_0x50d0fc['table'],'alias':_0x50d0fc['alias'],'columns':_0x50d0fc[_0x24c4a0(0xf1)],'status':_0x24c4a0(0xdb)};const _0x3550da=resolveTableMetadata(_0x168bcb,_0x50d0fc[_0x24c4a0(0xfc)]),_0xd9a0aa=(_0x3550da?.[_0x24c4a0(0xf8)]??[])['map'](_0x5f4732=>({'index':_0x5f4732,'matchedPrefix':findEqualityPrefix(_0x5f4732[_0x24c4a0(0xf1)],_0x50d0fc[_0x24c4a0(0xf1)])}))[_0x24c4a0(0xca)](_0x284e21=>_0x284e21[_0x24c4a0(0xfd)]['length']>0x0),_0x4e443b=_0xd9a0aa['reduce']((_0x5056a6,_0x1f7670)=>!_0x5056a6||_0x1f7670[_0x24c4a0(0xfd)][_0x24c4a0(0xff)]>_0x5056a6[_0x24c4a0(0xfd)]['length']?_0x1f7670:_0x5056a6,_0xd9a0aa[0x0]);if(_0x4e443b)return{'table':_0x50d0fc[_0x24c4a0(0xfc)],'alias':_0x50d0fc[_0x24c4a0(0xc3)],'columns':_0x50d0fc['columns'],'status':_0x24c4a0(0xc7),'matchedIndex':{..._0x4e443b[_0x24c4a0(0x105)],'matchedPrefix':_0x4e443b[_0x24c4a0(0xfd)]}};const _0x312f73=_0x3550da?.['indexes'][_0x24c4a0(0xca)](_0x31f82d=>_0x31f82d[_0x24c4a0(0xf1)][_0x24c4a0(0xf5)](_0x3e826c=>_0x50d0fc['columns'][_0x24c4a0(0xf5)](_0x2a0636=>columnNamesMatch(_0x3e826c,_0x2a0636))))??[];if(_0x312f73['length']>0x0)return _0x59d2f4['push']({'code':'JOIN_INDEX_NOT_USABLE','table':_0x50d0fc[_0x24c4a0(0xfc)],'alias':_0x50d0fc[_0x24c4a0(0xc3)],'columns':_0x50d0fc['columns'],'reason':'Relevant\x20columns\x20do\x20not\x20form\x20a\x20complete\x20leftmost\x20index\x20prefix.'}),{'table':_0x50d0fc[_0x24c4a0(0xfc)],'alias':_0x50d0fc[_0x24c4a0(0xc3)],'columns':_0x50d0fc['columns'],'status':_0x24c4a0(0xd8),'candidateIndexes':_0x312f73};if(_0x3550da&&_0x3550da[_0x24c4a0(0xf6)]!==![]&&_0x3550da[_0x24c4a0(0xf8)][_0x24c4a0(0xff)]>0x0&&_0x50d0fc[_0x24c4a0(0xf1)][_0x24c4a0(0xff)]>0x0)return _0x59d2f4[_0x24c4a0(0xe7)]({'code':_0x24c4a0(0xe3),'table':_0x50d0fc[_0x24c4a0(0xfc)],'alias':_0x50d0fc[_0x24c4a0(0xc3)],'columns':_0x50d0fc[_0x24c4a0(0xf1)],'reason':_0x24c4a0(0xea)}),{'table':_0x50d0fc[_0x24c4a0(0xfc)],'alias':_0x50d0fc[_0x24c4a0(0xc3)],'columns':_0x50d0fc[_0x24c4a0(0xf1)],'status':'warning'};return _0x59d2f4['push']({'code':_0x24c4a0(0x100),'table':_0x50d0fc['table'],'alias':_0x50d0fc[_0x24c4a0(0xc3)],'columns':_0x50d0fc[_0x24c4a0(0xf1)],'reason':_0x3550da?_0x24c4a0(0xd0):'No\x20dataset\x20metadata\x20matched\x20the\x20JOIN\x20table.'}),{'table':_0x50d0fc['table'],'alias':_0x50d0fc['alias'],'columns':_0x50d0fc[_0x24c4a0(0xf1)],'status':_0x24c4a0(0xdb)};});return{'checked':_0x509e8d[_0xf1449c(0xff)]>0x0,'joins':_0x509e8d,'warnings':_0x59d2f4};}function extractJoinFacts(_0x5a2dd1){const _0x27383e=a232_0x4379,_0x3c50f7=maskNestedQueries(stripSqlNoise(_0x5a2dd1)),_0x463f10=maskQuotedIdentifiers(_0x3c50f7),_0x77d5f3=[],_0x1b05dc=new Set(),_0x261076=/\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 _0xdebed of _0x3c50f7[_0x27383e(0x101)](_0x261076)){const _0x5198e9=_0xdebed[_0x27383e(0x105)]??0x0,_0x29051d=_0xdebed[0x0]['search'](/\bJOIN\b/i),_0x3044f8=_0x5198e9+Math[_0x27383e(0xd1)](0x0,_0x29051d);if(!/^JOIN\b/i[_0x27383e(0xe1)](_0x463f10['slice'](_0x3044f8)))continue;_0x1b05dc[_0x27383e(0xe0)](_0x3044f8);const _0x72c552=normalizeIdentifier(_0xdebed[0x1]||_0x27383e(0xdc)),_0x40250b=normalizeIdentifier(_0xdebed[0x2]??''),_0x1e4e1c=normalizeIdentifier(_0xdebed[0x3]||_0x40250b['split']('.')['at'](-0x1)||_0x40250b),_0x8ff933=[],_0x1eac48=_0x40250b===_0x27383e(0xf2);let _0xd081fc=_0x72c552===_0x27383e(0xda)||_0x72c552===_0x27383e(0xe8)||_0x1eac48,_0x34a533=_0xd081fc?_0x1eac48?_0x27383e(0x106):_0x72c552[_0x27383e(0xcb)]()+_0x27383e(0xe6):undefined;const _0x223c01=stripOuterParentheses(_0xdebed[0x4]??''),_0x3e614a=_0x223c01['includes'](MYBATIS_DYNAMIC_START_MARKER)||_0x223c01['includes'](MYBATIS_DYNAMIC_END_MARKER),_0x3b73af=_0x223c01[_0x27383e(0xfb)](MYBATIS_INCLUDE_MARKER);_0x3e614a&&(_0xd081fc=!![],_0x34a533??=_0x27383e(0xeb));_0x3b73af&&(_0xd081fc=!![],_0x34a533??=_0x27383e(0xc1));const _0x3c581e=_0x223c01[_0x27383e(0xc9)](MYBATIS_DYNAMIC_START_MARKER,'\x20')[_0x27383e(0xc9)](MYBATIS_DYNAMIC_END_MARKER,'\x20')[_0x27383e(0xc9)](MYBATIS_INCLUDE_MARKER,'\x20');hasTopLevelKeyword(_0x3c581e,'OR')&&(_0xd081fc=!![],_0x34a533??=_0x27383e(0xd4));for(const _0x25baeb of splitTopLevelAnd(_0x3c581e)){const _0x3a4228=stripOuterParentheses(_0x25baeb);if(hasTopLevelKeyword(_0x3a4228,'OR')){_0xd081fc=!![],_0x34a533??='OR-connected\x20JOIN\x20predicates\x20are\x20not\x20supported.';continue;}const _0x2c12c6=splitEquality(_0x3a4228);if(!_0x2c12c6){containsColumnReference(_0x25baeb,_0x1e4e1c)&&(_0xd081fc=!![]);continue;}const _0x577f72=parseDirectColumnReference(_0x2c12c6[0x0],_0x1e4e1c),_0x5369d7=parseDirectColumnReference(_0x2c12c6[0x1],_0x1e4e1c),_0x3be536=containsColumnReference(_0x2c12c6[0x0],_0x1e4e1c),_0x544527=containsColumnReference(_0x2c12c6[0x1],_0x1e4e1c),_0x403439=_0x577f72&&!_0x544527?_0x577f72:_0x5369d7&&!_0x3be536?_0x5369d7:null;if(_0x403439&&!_0x8ff933[_0x27383e(0xfb)](_0x403439))_0x8ff933[_0x27383e(0xe7)](_0x403439);else!_0x403439&&containsColumnReference(_0x25baeb,_0x1e4e1c)&&(_0xd081fc=!![]);}_0x77d5f3[_0x27383e(0xe7)]({'table':_0x40250b,'alias':_0x1e4e1c,'columns':_0x8ff933,'unsupportedPredicate':_0xd081fc,'unsupportedReason':_0x34a533,'containsUnresolvedInclude':_0x3b73af,'position':_0x3044f8});}for(const _0x3d0be6 of _0x463f10[_0x27383e(0x101)](/\bJOIN\b/gi)){const _0x15d77f=_0x3d0be6[_0x27383e(0x105)]??0x0;if(_0x1b05dc[_0x27383e(0xd7)](_0x15d77f))continue;const _0x4d82cc=/^\s+([`"\w$.]+)(?:\s+(?:AS\s+)?([`"\w$]+))?/[_0x27383e(0xf3)](_0x3c50f7[_0x27383e(0xde)](_0x15d77f+_0x3d0be6[0x0][_0x27383e(0xff)])),_0x53bbe5=normalizeIdentifier(_0x4d82cc?.[0x1]||'unknown'),_0x1802ad=normalizeIdentifier(_0x4d82cc?.[0x2]||''),_0x4c940d=isSqlClauseKeyword(_0x1802ad)?_0x53bbe5[_0x27383e(0xd6)]('.')['at'](-0x1)||_0x53bbe5:_0x1802ad||_0x53bbe5[_0x27383e(0xd6)]('.')['at'](-0x1)||_0x53bbe5;_0x77d5f3[_0x27383e(0xe7)]({'table':_0x53bbe5,'alias':_0x4c940d,'columns':[],'unsupportedPredicate':!![],'unsupportedReason':_0x27383e(0xc0),'position':_0x15d77f});}const _0x3804ad=_0x463f10[_0x27383e(0xe2)](MYBATIS_INCLUDE_MARKER);return _0x3804ad>=0x0&&!_0x77d5f3[_0x27383e(0xf5)](_0x2322e9=>_0x2322e9[_0x27383e(0xc4)])&&_0x77d5f3[_0x27383e(0xe7)]({'table':_0x27383e(0xbf),'alias':'unknown','columns':[],'unsupportedPredicate':!![],'unsupportedReason':_0x27383e(0xc5),'containsUnresolvedInclude':!![],'position':_0x3804ad}),_0x77d5f3[_0x27383e(0xe9)]((_0x2ebb53,_0x1acc0b)=>_0x2ebb53[_0x27383e(0xcf)]-_0x1acc0b['position']);}function stripSqlNoise(_0x566059){const _0x4f1d6e=a232_0x4379,_0x379656=Array[_0x4f1d6e(0xe5)](_0x566059),_0xcaa617=(_0x1e249d,_0x206002)=>{for(let _0xa5a0bd=_0x1e249d;_0xa5a0bd<_0x206002;_0xa5a0bd+=0x1){_0x379656[_0xa5a0bd]!=='\x0a'&&_0x379656[_0xa5a0bd]!=='\x0d'&&(_0x379656[_0xa5a0bd]='\x20');}};for(let _0x400009=0x0;_0x400009<_0x379656['length'];_0x400009+=0x1){const _0x448779=_0x379656[_0x400009],_0x2515c2=_0x379656[_0x400009+0x1];if(_0x448779==='\x27'||_0x448779==='\x22'||_0x448779==='`'){const _0x2884cd=_0x448779,_0x3ba2a7=_0x400009;_0x400009+=0x1;while(_0x400009<_0x379656['length']){if(_0x379656[_0x400009]==='\x5c'&&_0x400009+0x1<_0x379656['length']){_0x400009+=0x2;continue;}if(_0x379656[_0x400009]!==_0x2884cd){_0x400009+=0x1;continue;}if(_0x379656[_0x400009+0x1]===_0x2884cd){_0x400009+=0x2;continue;}break;}if(_0x2884cd==='\x27')_0xcaa617(_0x3ba2a7,Math[_0x4f1d6e(0xce)](_0x400009+0x1,_0x379656[_0x4f1d6e(0xff)]));continue;}if(_0x448779==='-'&&_0x2515c2==='-'){const _0x18eb7b=_0x400009;while(_0x400009<_0x379656[_0x4f1d6e(0xff)]&&_0x379656[_0x400009]!=='\x0a')_0x400009+=0x1;_0xcaa617(_0x18eb7b,_0x400009);continue;}if(_0x448779==='/'&&_0x2515c2==='*'){const _0x1f07be=_0x400009;_0x400009+=0x2;while(_0x400009<_0x379656[_0x4f1d6e(0xff)]&&!(_0x379656[_0x400009]==='*'&&_0x379656[_0x400009+0x1]==='/')){_0x400009+=0x1;}_0x400009=Math[_0x4f1d6e(0xce)](_0x400009+0x1,_0x379656[_0x4f1d6e(0xff)]-0x1),_0xcaa617(_0x1f07be,_0x400009+0x1);continue;}if(_0x448779==='#'&&_0x2515c2!=='{'){const _0xb2b827=_0x400009;while(_0x400009<_0x379656['length']&&_0x379656[_0x400009]!=='\x0a')_0x400009+=0x1;_0xcaa617(_0xb2b827,_0x400009);continue;}if((_0x448779==='#'||_0x448779==='$')&&_0x2515c2==='{'){const _0x58bc83=_0x400009;_0x400009+=0x2;while(_0x400009<_0x379656['length']&&_0x379656[_0x400009]!=='}')_0x400009+=0x1;_0xcaa617(_0x58bc83,Math[_0x4f1d6e(0xce)](_0x400009+0x1,_0x379656[_0x4f1d6e(0xff)]));}}return _0x379656['join']('');}function maskQuotedIdentifiers(_0x3f6939){const _0x108b39=a232_0x4379,_0x3bf02d=Array[_0x108b39(0xe5)](_0x3f6939);for(let _0x149758=0x0;_0x149758<_0x3bf02d[_0x108b39(0xff)];_0x149758+=0x1){const _0xab1332=_0x3bf02d[_0x149758];if(_0xab1332!=='\x22'&&_0xab1332!=='`')continue;_0x149758+=0x1;while(_0x149758<_0x3bf02d['length']){if(_0x3bf02d[_0x149758]===_0xab1332){if(_0x3bf02d[_0x149758+0x1]===_0xab1332){_0x3bf02d[_0x149758]='\x20',_0x3bf02d[_0x149758+0x1]='\x20',_0x149758+=0x2;continue;}break;}_0x3bf02d[_0x149758]='\x20',_0x149758+=0x1;}}return _0x3bf02d[_0x108b39(0xec)]('');}function maskNestedQueries(_0x23a2d2){const _0x2c37d7=a232_0x4379,_0x382fdd=Array[_0x2c37d7(0xe5)](_0x23a2d2);for(let _0x294612=0x0;_0x294612<_0x382fdd[_0x2c37d7(0xff)];_0x294612+=0x1){if(_0x382fdd[_0x294612]!=='(')continue;const _0x116719=_0x23a2d2[_0x2c37d7(0xde)](_0x294612+0x1);if(!/^\s*(?:SELECT|WITH)\b/i[_0x2c37d7(0xe1)](_0x116719))continue;let _0x22f273=0x1,_0x3c47b6=_0x294612+0x1;for(;_0x3c47b6<_0x382fdd[_0x2c37d7(0xff)]&&_0x22f273>0x0;_0x3c47b6+=0x1){if(_0x382fdd[_0x3c47b6]==='(')_0x22f273+=0x1;if(_0x382fdd[_0x3c47b6]===')')_0x22f273-=0x1;}if(_0x22f273!==0x0)continue;for(let _0x16be34=_0x294612;_0x16be34<_0x3c47b6;_0x16be34+=0x1){_0x382fdd[_0x16be34]='\x20';}const _0x12251b=_0x2c37d7(0xf2);for(let _0x5bda88=0x0;_0x5bda88<_0x12251b[_0x2c37d7(0xff)]&&_0x294612+_0x5bda88<_0x3c47b6;_0x5bda88+=0x1){_0x382fdd[_0x294612+_0x5bda88]=_0x12251b[_0x5bda88];}_0x294612=_0x3c47b6-0x1;}return _0x382fdd[_0x2c37d7(0xec)]('');}function splitTopLevelAnd(_0x3f8801){const _0x52f915=a232_0x4379,_0x382152=[];let _0x2d6add=0x0,_0x2151d9=0x0;for(let _0x5a7a8c=0x0;_0x5a7a8c<_0x3f8801['length'];_0x5a7a8c+=0x1){const _0x318069=_0x3f8801[_0x5a7a8c];if(_0x318069==='(')_0x2d6add+=0x1;if(_0x318069===')')_0x2d6add=Math[_0x52f915(0xd1)](0x0,_0x2d6add-0x1);_0x2d6add===0x0&&_0x3f8801[_0x52f915(0xde)](_0x5a7a8c)[_0x52f915(0xbd)](/^AND\b/i)&&(_0x5a7a8c===0x0||/\s/[_0x52f915(0xe1)](_0x3f8801[_0x5a7a8c-0x1]??''))&&(_0x382152[_0x52f915(0xe7)](_0x3f8801['slice'](_0x2151d9,_0x5a7a8c)[_0x52f915(0x102)]()),_0x5a7a8c+=0x2,_0x2151d9=_0x5a7a8c+0x1);}const _0x44ee7c=_0x3f8801['slice'](_0x2151d9)[_0x52f915(0x102)]();if(_0x44ee7c)_0x382152[_0x52f915(0xe7)](_0x44ee7c);return _0x382152;}function hasTopLevelKeyword(_0x3afd01,_0x2a5ae4){const _0x129546=a232_0x4379;let _0x4956ad=0x0;for(let _0xa89cbd=0x0;_0xa89cbd<_0x3afd01[_0x129546(0xff)];_0xa89cbd+=0x1){const _0x137b50=_0x3afd01[_0xa89cbd];if(_0x137b50==='(')_0x4956ad+=0x1;if(_0x137b50===')')_0x4956ad=Math['max'](0x0,_0x4956ad-0x1);if(_0x4956ad!==0x0)continue;const _0x240aa9=_0x3afd01[_0x129546(0xde)](_0xa89cbd,_0xa89cbd+_0x2a5ae4[_0x129546(0xff)]),_0xa731c4=_0x3afd01[_0xa89cbd-0x1]??'\x20',_0xca0727=_0x3afd01[_0xa89cbd+_0x2a5ae4['length']]??'\x20';if(_0x240aa9[_0x129546(0xcb)]()===_0x2a5ae4[_0x129546(0xcb)]()&&!/[\w$]/[_0x129546(0xe1)](_0xa731c4)&&!/[\w$]/[_0x129546(0xe1)](_0xca0727))return!![];}return![];}function splitEquality(_0x437edf){const _0x3650f0=a232_0x4379,_0x832e6a=stripOuterParentheses(_0x437edf);let _0x3e578b=0x0,_0x41ee65;for(let _0x2006fd=0x0;_0x2006fd<_0x832e6a[_0x3650f0(0xff)];_0x2006fd+=0x1){const _0x267b35=_0x832e6a[_0x2006fd];if(_0x267b35==='(')_0x3e578b+=0x1;if(_0x267b35===')')_0x3e578b=Math[_0x3650f0(0xd1)](0x0,_0x3e578b-0x1);const _0x32e7f2=_0x832e6a[_0x2006fd-0x1]??'',_0x25f0d9=_0x832e6a[_0x2006fd+0x1]??'';if(_0x267b35==='='&&_0x3e578b===0x0&&!/[!<>=:]/[_0x3650f0(0xe1)](_0x32e7f2)&&_0x25f0d9!=='='){if(_0x41ee65!==undefined)return null;_0x41ee65=_0x2006fd;}}return _0x41ee65===undefined?null:[_0x832e6a[_0x3650f0(0xde)](0x0,_0x41ee65)['trim'](),_0x832e6a[_0x3650f0(0xde)](_0x41ee65+0x1)[_0x3650f0(0x102)]()];}function parseDirectColumnReference(_0x1fb9a3,_0x3a12b6){const _0x39a9d5=a232_0x4379,_0x2bbfb8=/^([`"]?[\w$]+[`"]?)\s*\.\s*([`"]?[\w$]+[`"]?)$/[_0x39a9d5(0xf3)](stripOuterParentheses(_0x1fb9a3));if(!_0x2bbfb8)return null;if(normalizeIdentifier(_0x2bbfb8[0x1]??'')!==normalizeIdentifier(_0x3a12b6))return null;return normalizeIdentifier(_0x2bbfb8[0x2]??'');}function a232_0x4379(_0x9a60af,_0xbc9072){_0x9a60af=_0x9a60af-0xbd;const _0x40298b=a232_0x4029();let _0x43790e=_0x40298b[_0x9a60af];return _0x43790e;}function containsColumnReference(_0x13a4d7,_0x3adaf4){const _0x349038=a232_0x4379,_0x364270=_0x13a4d7[_0x349038(0xd9)](/[`"]/g,''),_0x245781=_0x3adaf4['replace'](/[.*+?^${}()|[\]\\]/g,'\x5c$&');return new RegExp(_0x349038(0xcd)+_0x245781+_0x349038(0xcc),'i')[_0x349038(0xe1)](_0x364270);}function findEqualityPrefix(_0x1b8922,_0x496705){const _0x471bc3=a232_0x4379,_0xd70136=new Set(_0x496705[_0x471bc3(0xf4)](normalizeIdentifier)),_0x496fc4=[];for(const _0x211872 of _0x1b8922){if(!_0xd70136[_0x471bc3(0xd7)](normalizeIdentifier(_0x211872)))break;_0x496fc4[_0x471bc3(0xe7)](_0x211872);}return _0x496fc4;}function resolveTableMetadata(_0x266eff,_0x28c4c9){const _0x53d48f=a232_0x4379,_0x1c29a9=normalizeIdentifier(_0x28c4c9),_0x419e92=_0x266eff['filter'](_0x33379c=>normalizeIdentifier(_0x33379c[_0x53d48f(0xd5)])===_0x1c29a9);if(_0x419e92[_0x53d48f(0xff)]===0x1)return _0x419e92[0x0];const _0x56e362=_0x1c29a9[_0x53d48f(0xfb)]('.'),_0x3e24f6=_0x1c29a9['split']('.')['at'](-0x1),_0x1a26b7=_0x266eff[_0x53d48f(0xca)](_0x4d1581=>{const _0x2717ba=_0x53d48f,_0x2a667a=normalizeIdentifier(_0x4d1581['tableName']);if(_0x56e362&&_0x2a667a[_0x2717ba(0xfb)]('.'))return![];return _0x2a667a[_0x2717ba(0xd6)]('.')['at'](-0x1)===_0x3e24f6;});return _0x1a26b7['length']===0x1?_0x1a26b7[0x0]:undefined;}function columnNamesMatch(_0x3cf725,_0x457639){return normalizeIdentifier(_0x3cf725)===normalizeIdentifier(_0x457639);}function normalizeIdentifier(_0x1e2fc9){const _0x3c108e=a232_0x4379;return _0x1e2fc9[_0x3c108e(0xd9)](/[`"]/g,'')[_0x3c108e(0x102)]()[_0x3c108e(0xc6)]();}function isSqlClauseKeyword(_0x2022dc){const _0x5bf0cb=a232_0x4379;return new Set(['on',_0x5bf0cb(0xee),'where',_0x5bf0cb(0xec),'inner',_0x5bf0cb(0xed),'right',_0x5bf0cb(0xe8),'cross',_0x5bf0cb(0xf0)])['has'](_0x2022dc);}function stripOuterParentheses(_0x59c4a1){const _0x13556d=a232_0x4379;let _0x4aedda=_0x59c4a1[_0x13556d(0x102)]();while(_0x4aedda[_0x13556d(0xfe)]('(')&&_0x4aedda[_0x13556d(0xf9)](')')){let _0x329fc8=0x0,_0x4033c9=!![];for(let _0x2d8d83=0x0;_0x2d8d83<_0x4aedda['length'];_0x2d8d83+=0x1){if(_0x4aedda[_0x2d8d83]==='(')_0x329fc8+=0x1;if(_0x4aedda[_0x2d8d83]===')')_0x329fc8-=0x1;if(_0x329fc8===0x0&&_0x2d8d83<_0x4aedda[_0x13556d(0xff)]-0x1){_0x4033c9=![];break;}}if(!_0x4033c9||_0x329fc8!==0x0)break;_0x4aedda=_0x4aedda[_0x13556d(0xde)](0x1,-0x1)[_0x13556d(0x102)]();}return _0x4aedda;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a233_0x47d3f0=a233_0x14d0;(function(_0x34f763,_0x1f9cb0){const _0x3492a5=a233_0x14d0,_0xcf8aab=_0x34f763();while(!![]){try{const _0x327644=parseInt(_0x3492a5(0x1be))/0x1*(parseInt(_0x3492a5(0x1b1))/0x2)+-parseInt(_0x3492a5(0x1b5))/0x3*(-parseInt(_0x3492a5(0x1bf))/0x4)+parseInt(_0x3492a5(0x1b0))/0x5*(-parseInt(_0x3492a5(0x1bd))/0x6)+-parseInt(_0x3492a5(0x1b9))/0x7+-parseInt(_0x3492a5(0x1b3))/0x8*(-parseInt(_0x3492a5(0x1bb))/0x9)+-parseInt(_0x3492a5(0x1b6))/0xa*(parseInt(_0x3492a5(0x1b7))/0xb)+-parseInt(_0x3492a5(0x1ae))/0xc*(parseInt(_0x3492a5(0x1bc))/0xd);if(_0x327644===_0x1f9cb0)break;else _0xcf8aab['push'](_0xcf8aab['shift']());}catch(_0x36378f){_0xcf8aab['push'](_0xcf8aab['shift']());}}}(a233_0x247a,0xefe11));import{resolve}from'node:path';import{findProjectRootDirectory}from'../../context.js';function a233_0x14d0(_0x416a50,_0x1a586c){_0x416a50=_0x416a50-0x1ae;const _0x247a5a=a233_0x247a();let _0x14d058=_0x247a5a[_0x416a50];return _0x14d058;}const DOT_DIR=a233_0x47d3f0(0x1b8),LOCK_FILE_NAME=a233_0x47d3f0(0x1ba),TRASH_DIR_NAME=a233_0x47d3f0(0x1af);export function loadSqlProjectConfig(_0x1676e0,_0x272361){const _0xfc217c=a233_0x47d3f0,_0xcb925e=resolve(_0x272361??findProjectRootDirectory()),_0x4cf3e1=DOT_DIR+_0xfc217c(0x1b4),_0x5be888=_0x4cf3e1+'/'+_0x1676e0;return{'projectRoot':_0xcb925e,'appCode':_0x1676e0,'sqlWorkspaceRoot':_0x4cf3e1,'sqlRoot':_0x5be888,'sqlRootDir':resolve(_0xcb925e,DOT_DIR,_0xfc217c(0x1b2),_0x1676e0),'lockFilePath':resolve(_0xcb925e,DOT_DIR,LOCK_FILE_NAME),'trashDir':resolve(_0xcb925e,DOT_DIR,TRASH_DIR_NAME)};}function a233_0x247a(){const _0x35966b=['11185112UNelrR','/sql','63FWYfji','2990HWaTaI','29007lIZvqX','.rabetbase','7825888PoKhTb','sql.lock.json','9yvlpjx','3056469hcacFg','18moVqud','124681UnOcgk','274776SUZqXK','12eTeePB','sql-trash','1397895JxRFxf','18PzIXvL','sql'];a233_0x247a=function(){return _0x35966b;};return a233_0x247a();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x570e5a,_0x76b8f1){const _0x57383d=a234_0x4fb0,_0x32d0a1=_0x570e5a();while(!![]){try{const _0x5618be=parseInt(_0x57383d(0x1f2))/0x1+-parseInt(_0x57383d(0x1ef))/0x2+-parseInt(_0x57383d(0x1fc))/0x3*(-parseInt(_0x57383d(0x1fe))/0x4)+-parseInt(_0x57383d(0x1f4))/0x5+parseInt(_0x57383d(0x20d))/0x6*(-parseInt(_0x57383d(0x1f9))/0x7)+-parseInt(_0x57383d(0x206))/0x8*(-parseInt(_0x57383d(0x1fa))/0x9)+parseInt(_0x57383d(0x201))/0xa*(parseInt(_0x57383d(0x1f0))/0xb);if(_0x5618be===_0x76b8f1)break;else _0x32d0a1['push'](_0x32d0a1['shift']());}catch(_0x2eea11){_0x32d0a1['push'](_0x32d0a1['shift']());}}}(a234_0x763f,0x4f25f));import{readdir,stat}from'node:fs/promises';function a234_0x4fb0(_0x11f75c,_0x4e4389){_0x11f75c=_0x11f75c-0x1ec;const _0x763f94=a234_0x763f();let _0x4fb0c4=_0x763f94[_0x11f75c];return _0x4fb0c4;}import{extname,join,relative}from'node:path';import{buildDefaultSqlFileName,buildSqlRelativePath}from'./utils.js';function extensionToMode(_0x52c773){const _0xdaa486=a234_0x4fb0;if(_0x52c773==='.sql')return _0xdaa486(0x20a);if(_0x52c773===_0xdaa486(0x1ff))return _0xdaa486(0x209);return undefined;}async function scanSqlFilesRecursively(_0x813f55,_0x45f580){const _0x1d42d0=a234_0x4fb0,_0xeb030c=[];try{const _0x557518=await readdir(_0x813f55,{'withFileTypes':!![]});for(const _0x5bda4a of _0x557518){const _0x3eb8f2=join(_0x813f55,_0x5bda4a[_0x1d42d0(0x1ed)]);if(_0x5bda4a[_0x1d42d0(0x20c)]()){_0xeb030c[_0x1d42d0(0x20b)](...await scanSqlFilesRecursively(_0x3eb8f2,_0x45f580));continue;}if(!_0x5bda4a[_0x1d42d0(0x1ec)]())continue;const _0x3df301=extname(_0x5bda4a[_0x1d42d0(0x1ed)])[_0x1d42d0(0x204)](),_0xa3f829=extensionToMode(_0x3df301);if(!_0xa3f829)continue;const _0x47948e=relative(_0x45f580,_0x3eb8f2)[_0x1d42d0(0x203)](/\\/g,'/'),_0xd7c3fe=_0x47948e[_0x1d42d0(0x205)]('/')[_0x1d42d0(0x1ee)](Boolean),_0x5794e7=parseSqlPath(_0xd7c3fe,_0x5bda4a[_0x1d42d0(0x1ed)],_0x3df301);if(!_0x5794e7)continue;_0xeb030c[_0x1d42d0(0x20b)]({'sqlCode':_0x5794e7[_0x1d42d0(0x1f1)],'sqlName':_0x5794e7[_0x1d42d0(0x1fd)],'dbDirectory':_0xd7c3fe[0x0],'filePath':_0x3eb8f2,'relativePath':_0x47948e,'lockKey':_0x5794e7['sqlCode'],'mode':_0xa3f829});}}catch(_0x2a7c20){if(_0x2a7c20['code']!==_0x1d42d0(0x1f5))throw _0x2a7c20;}return _0xeb030c;}function a234_0x763f(){const _0x118434=['sqlRootDir','indexOf','dbId','3908009EgSVij','90jtqjKJ','test','6qcCirT','sqlName','838456ttiHRx','.xml','path','5215030lwEfCW','slice','replace','toLowerCase','split','477488RaWZNx','dbName','mode','mybatisXml','sql','push','isDirectory','6pGLPCl','isFile','name','filter','1247210XKMMzB','22rwOVfS','sqlCode','47960QDecBx','length','3004855Efanxl','ENOENT'];a234_0x763f=function(){return _0x118434;};return a234_0x763f();}export async function scanLocalSqlQueries(_0x4d6db0){const _0x3ea70a=a234_0x4fb0;return scanSqlFilesRecursively(_0x4d6db0[_0x3ea70a(0x1f6)],_0x4d6db0[_0x3ea70a(0x1f6)]);}export function resolveLocalSqlFilePath(_0x191825,_0x3a7f50,_0x2297c7){const _0x56a9a9=a234_0x4fb0,_0x5d94e1=_0x2297c7?.[_0x56a9a9(0x200)]||(_0x2297c7?.[_0x56a9a9(0x1fd)]||_0x2297c7?.[_0x56a9a9(0x207)]?buildSqlRelativePath(_0x3a7f50,_0x2297c7?.[_0x56a9a9(0x1fd)],_0x2297c7?.[_0x56a9a9(0x207)],_0x2297c7?.[_0x56a9a9(0x208)]||'sql',_0x2297c7?.[_0x56a9a9(0x1f8)]):buildDefaultSqlFileName(_0x3a7f50,_0x2297c7?.['mode']||'sql'));return join(_0x191825[_0x56a9a9(0x1f6)],_0x5d94e1);}export async function directoryExists(_0x2ff866){const _0x3f7e9=a234_0x4fb0;try{const _0x2c5c03=await stat(_0x2ff866);return _0x2c5c03[_0x3f7e9(0x20c)]();}catch{return![];}}function parseSqlPath(_0x309d7d,_0xf4538e,_0x452452){const _0x243670=a234_0x4fb0,_0x45c26c=_0xf4538e[_0x243670(0x202)](0x0,-_0x452452[_0x243670(0x1f3)]);if(_0x309d7d[_0x243670(0x1f3)]<0x2)return null;const _0x4ce375=_0x45c26c[_0x243670(0x1f7)]('_');if(_0x4ce375<=0x0||_0x4ce375>=_0x45c26c[_0x243670(0x1f3)]-0x1)return null;const _0x154005=_0x45c26c[_0x243670(0x202)](0x0,_0x4ce375);if(!isLikelySqlCode(_0x154005))return null;return{'sqlCode':_0x154005,'sqlName':_0x45c26c[_0x243670(0x202)](_0x4ce375+0x1)};}function isLikelySqlCode(_0x3e27ba){const _0x5d1887=a234_0x4fb0;return/^[A-Za-z0-9-]+-[A-Za-z0-9-]+$/[_0x5d1887(0x1fb)](_0x3e27ba);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x587a8d,_0x1c1736){const _0x5caeed=a235_0x97e7,_0xd99ab7=_0x587a8d();while(!![]){try{const _0x2933ec=-parseInt(_0x5caeed(0xdd))/0x1+parseInt(_0x5caeed(0xe3))/0x2+parseInt(_0x5caeed(0xd8))/0x3*(parseInt(_0x5caeed(0xda))/0x4)+parseInt(_0x5caeed(0xe2))/0x5+-parseInt(_0x5caeed(0xd6))/0x6*(-parseInt(_0x5caeed(0xd9))/0x7)+-parseInt(_0x5caeed(0xdb))/0x8*(parseInt(_0x5caeed(0xdc))/0x9)+-parseInt(_0x5caeed(0xde))/0xa;if(_0x2933ec===_0x1c1736)break;else _0xd99ab7['push'](_0xd99ab7['shift']());}catch(_0x354580){_0xd99ab7['push'](_0xd99ab7['shift']());}}}(a235_0x5396,0x241bf));import{readFile}from'node:fs/promises';function a235_0x5396(){const _0x17ba24=['79862ULYdNI','3720850IgzfIA','md5','update','hex','1212670dpkqOb','479276JBurlQ','digest','createHash','6738jAZFLq','utf8','33yZhrab','98npBEvQ','84252IqowpA','1037896hhRZum','9vOIdHF'];a235_0x5396=function(){return _0x17ba24;};return a235_0x5396();}function a235_0x97e7(_0x19c314,_0x3b7a00){_0x19c314=_0x19c314-0xd6;const _0x539637=a235_0x5396();let _0x97e761=_0x539637[_0x19c314];return _0x97e761;}import a235_0x4890a4 from'node:crypto';export function computeSqlContentHash(_0x169e14){const _0x34a99b=a235_0x97e7;return a235_0x4890a4[_0x34a99b(0xe5)](_0x34a99b(0xdf))[_0x34a99b(0xe0)](_0x169e14)[_0x34a99b(0xe4)](_0x34a99b(0xe1));}export async function computeSqlFileHash(_0x1ed7ba){const _0x1eb71a=a235_0x97e7,_0x1c8339=await readFile(_0x1ed7ba,_0x1eb71a(0xd7));return computeSqlContentHash(_0x1c8339);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a236_0x46e6(){const _0x1abbfc=['2944858ybAzyH','parse','code','apps','Check\x20.rabetbase/sql.lock.json\x20or\x20operate\x20from\x20the\x20correct\x20project\x20directory.','Failed\x20to\x20read\x20SQL\x20lock\x20file:\x20','\x22.\x20','\x22\x20vs\x20lock\x20\x22','1nltQTE','612573BZZwyn','811570yPpUzR','1604038MEvJhI','3297648pDIkId','4360338AtWwDI','605Jddmpp','sqls','15348ONlkmf','lastSync','stringify','utf8','sqlRoot','8SRZtzm','253kgVfgC'];a236_0x46e6=function(){return _0x1abbfc;};return a236_0x46e6();}function a236_0x1501(_0x1e4533,_0x54241e){_0x1e4533=_0x1e4533-0xef;const _0x46e6e9=a236_0x46e6();let _0x150135=_0x46e6e9[_0x1e4533];return _0x150135;}(function(_0x3a913d,_0x2da125){const _0x352f8e=a236_0x1501,_0x3884ca=_0x3a913d();while(!![]){try{const _0x20b71c=-parseInt(_0x352f8e(0x103))/0x1*(parseInt(_0x352f8e(0xef))/0x2)+-parseInt(_0x352f8e(0x104))/0x3+parseInt(_0x352f8e(0xf0))/0x4+-parseInt(_0x352f8e(0xf2))/0x5*(parseInt(_0x352f8e(0xf4))/0x6)+-parseInt(_0x352f8e(0xfb))/0x7+-parseInt(_0x352f8e(0xf9))/0x8*(parseInt(_0x352f8e(0xf1))/0x9)+parseInt(_0x352f8e(0x105))/0xa*(parseInt(_0x352f8e(0xfa))/0xb);if(_0x20b71c===_0x2da125)break;else _0x3884ca['push'](_0x3884ca['shift']());}catch(_0x1436a3){_0x3884ca['push'](_0x3884ca['shift']());}}}(a236_0x46e6,0x72c67));import{mkdir,readFile,writeFile}from'node:fs/promises';import{dirname}from'node:path';export function createEmptySqlLock(){return{'apps':{}};}export function ensureSqlLockScope(_0xc8a411,_0x3289cf,_0x233fe2,_0x174a17){const _0x5251c6=a236_0x1501,_0x167911=_0xc8a411??createEmptySqlLock();let _0x24e2f6=_0x167911[_0x5251c6(0xfe)][_0x3289cf];if(!_0x24e2f6)return _0x24e2f6={'sqlRoot':_0x233fe2,'lastSync':'','sqls':{}},_0x167911[_0x5251c6(0xfe)][_0x3289cf]=_0x24e2f6,{'lockData':_0x167911,'appLock':_0x24e2f6};if(!_0x24e2f6[_0x5251c6(0xf8)])_0x24e2f6['sqlRoot']=_0x233fe2;else{if(_0x24e2f6[_0x5251c6(0xf8)]!==_0x233fe2)throw new Error(_0x174a17+':\x20sqlRoot\x20mismatch\x20—\x20current\x20\x22'+_0x233fe2+_0x5251c6(0x102)+_0x24e2f6[_0x5251c6(0xf8)]+_0x5251c6(0x101)+_0x5251c6(0xff));}return!_0x24e2f6[_0x5251c6(0xf3)]&&(_0x24e2f6[_0x5251c6(0xf3)]={}),!_0x24e2f6['lastSync']&&(_0x24e2f6[_0x5251c6(0xf5)]=''),{'lockData':_0x167911,'appLock':_0x24e2f6};}export async function readSqlLockFile(_0x34a179){const _0x3fe1b8=a236_0x1501;try{const _0x584d58=await readFile(_0x34a179,_0x3fe1b8(0xf7));return JSON[_0x3fe1b8(0xfc)](_0x584d58);}catch(_0x123882){if(_0x123882[_0x3fe1b8(0xfd)]==='ENOENT')return null;throw new Error(_0x3fe1b8(0x100)+String(_0x123882));}}export async function writeSqlLockFile(_0xfde406,_0x2461bc){const _0xb432ec=a236_0x1501;await mkdir(dirname(_0xfde406),{'recursive':!![]}),await writeFile(_0xfde406,JSON[_0xb432ec(0xf6)](_0x2461bc,null,0x2),'utf8');}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x522d15,_0x4c11ef){const _0x2e1bd3=a238_0x1063,_0x1b3f58=_0x522d15();while(!![]){try{const _0x465890=parseInt(_0x2e1bd3(0xe5))/0x1+-parseInt(_0x2e1bd3(0xde))/0x2+parseInt(_0x2e1bd3(0xdd))/0x3*(-parseInt(_0x2e1bd3(0xe6))/0x4)+parseInt(_0x2e1bd3(0xdc))/0x5*(parseInt(_0x2e1bd3(0xe7))/0x6)+parseInt(_0x2e1bd3(0xdf))/0x7+parseInt(_0x2e1bd3(0xe2))/0x8+parseInt(_0x2e1bd3(0xe1))/0x9*(parseInt(_0x2e1bd3(0xe4))/0xa);if(_0x465890===_0x4c11ef)break;else _0x1b3f58['push'](_0x1b3f58['shift']());}catch(_0x2386e0){_0x1b3f58['push'](_0x1b3f58['shift']());}}}(a238_0x4751,0xcd049));export function detectSqlMode(_0x1e6c88){const _0x2632ae=a238_0x1063,_0x34dbb5=_0x1e6c88[_0x2632ae(0xe9)]();if(/^<(select|insert|update|delete)\b/i[_0x2632ae(0xe0)](_0x34dbb5))return _0x2632ae(0xe8);return'sql';}export function getSqlFileExtension(_0x40fae7){const _0x56bbe5=a238_0x1063;return _0x40fae7===_0x56bbe5(0xe8)?'.xml':_0x56bbe5(0xe3);}export function buildDefaultSqlFileName(_0x4bf016,_0x5605ab){return''+_0x4bf016+getSqlFileExtension(_0x5605ab);}export function sanitizeSqlPathSegment(_0x2315c7,_0x54c798){const _0x3621e3=a238_0x1063,_0x2dbd37=String(_0x2315c7??'')[_0x3621e3(0xeb)](),_0x13c8b7=_0x2dbd37['replace'](/[<>:"/\\|?*\u0000-\u001F]/g,'-')[_0x3621e3(0xec)](/\s+/g,'-')['replace'](/-+/g,'-')[_0x3621e3(0xec)](/^\.+/,'')[_0x3621e3(0xec)](/\.+$/,'')[_0x3621e3(0xec)](/^-+/,'')[_0x3621e3(0xec)](/-+$/,'');return _0x13c8b7||_0x54c798;}export function buildDbDirectoryName(_0x16ce86,_0x54e00b){const _0x3da5d9=a238_0x1063;return sanitizeSqlPathSegment(_0x16ce86,_0x54e00b!=null?'db-'+_0x54e00b:_0x3da5d9(0xed));}function a238_0x4751(){const _0x11a165=['unknown-db','466285ySJLgB','21MyitXC','3343028JXNhIW','3367609IoNtMv','test','2858589mUUMyG','4502064ICmtqb','.sql','10TsrtTe','161943tHVsKS','128276BupQek','78OjtgrV','mybatisXml','trimStart','unknown-sql','trim','replace'];a238_0x4751=function(){return _0x11a165;};return a238_0x4751();}function a238_0x1063(_0x5b1ed9,_0xb276a9){_0x5b1ed9=_0x5b1ed9-0xdc;const _0x4751fc=a238_0x4751();let _0x10635a=_0x4751fc[_0x5b1ed9];return _0x10635a;}export function buildSqlRelativePath(_0x16326a,_0x53dfc7,_0x739772,_0x1c1210,_0x157f02){const _0x2148bc=a238_0x1063,_0xf4a7e6=buildDbDirectoryName(_0x739772,_0x157f02),_0x43d672=sanitizeSqlPathSegment(_0x16326a,_0x2148bc(0xea)),_0xafc448=sanitizeSqlPathSegment(_0x53dfc7,_0x43d672);return _0xf4a7e6+'/'+_0x43d672+'_'+_0xafc448+getSqlFileExtension(_0x1c1210);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a238_0x5ef39d=a238_0x3fe4;(function(_0x1c1d96,_0x3e9c5a){const _0x2ec155=a238_0x3fe4,_0x3bec70=_0x1c1d96();while(!![]){try{const _0x23ef5c=-parseInt(_0x2ec155(0x1c6))/0x1*(-parseInt(_0x2ec155(0x1aa))/0x2)+parseInt(_0x2ec155(0x1b1))/0x3+-parseInt(_0x2ec155(0x18d))/0x4*(parseInt(_0x2ec155(0x196))/0x5)+-parseInt(_0x2ec155(0x1a8))/0x6+parseInt(_0x2ec155(0x1a7))/0x7*(-parseInt(_0x2ec155(0x183))/0x8)+parseInt(_0x2ec155(0x191))/0x9+parseInt(_0x2ec155(0x182))/0xa;if(_0x23ef5c===_0x3e9c5a)break;else _0x3bec70['push'](_0x3bec70['shift']());}catch(_0x539a03){_0x3bec70['push'](_0x3bec70['shift']());}}}(a238_0x35f1,0x8a722));const MYBATIS_OUTER_TAGS=new Map([[a238_0x5ef39d(0x1c5),a238_0x5ef39d(0x16b)],[a238_0x5ef39d(0x1ad),a238_0x5ef39d(0x1c1)],[a238_0x5ef39d(0x1b0),a238_0x5ef39d(0x1bd)],[a238_0x5ef39d(0x18a),a238_0x5ef39d(0x177)]]),MYBATIS_DYNAMIC_TAGS=new Set(['if',a238_0x5ef39d(0x16f),a238_0x5ef39d(0x16e),'choose','when',a238_0x5ef39d(0x169),'trim',a238_0x5ef39d(0x168),a238_0x5ef39d(0x188),a238_0x5ef39d(0x1a9),a238_0x5ef39d(0x19d)]),MYBATIS_BRANCH_TAGS=new Set(['if','foreach',a238_0x5ef39d(0x199),a238_0x5ef39d(0x192),'otherwise']);export const MYBATIS_DYNAMIC_START_MARKER=a238_0x5ef39d(0x176);export const MYBATIS_DYNAMIC_END_MARKER=a238_0x5ef39d(0x195);function a238_0x35f1(){const _0x33ac03=['Mismatched\x20MyBatis\x20XML\x20closing\x20tag:\x20</','statementType','INSERT','rawName','__RABETBASE_UNRESOLVED_SQL_FRAGMENT__','MyBatis\x20dynamic\x20tag\x20names\x20must\x20be\x20lowercase:\x20<','select','31ZZFpWR','set','otherwise','__RABETBASE_MYBATIS_INCLUDE_UNRESOLVED__','SELECT','Unterminated\x20XML\x20declaration.','Invalid\x20MyBatis\x20XML\x20tag.','foreach','where','startsWith','type','matchAll','error','tagName','from','__RABETBASE_MYBATIS_DYNAMIC_START__','DELETE','UNKNOWN','XML\x20declarations\x20must\x20precede\x20the\x20MyBatis\x20statement\x20wrapper.','"','SQL\x20contains\x20blocked\x20DELETE\x20or\x20DDL\x20statements','push','DDL','<![CDATA[','get','slice','SQL\x20contains\x20modification\x20statements\x20alongside\x20SELECT','17524540FggTWR','8770544TstFrU','WITH','&','unknown\x20table(s)','Invalid\x20MyBatis\x20XML\x20closing\x20tag:\x20</','bind','has','delete','Invalid\x20XML\x20entity\x20reference.','MyBatis\x20XML\x20must\x20contain\x20exactly\x20one\x20complete\x20statement\x20wrapper.','30252mnozPi','replaceAll','test','Unable\x20to\x20detect\x20SQL\x20type.\x20Please\x20check\x20the\x20SQL\x20content.','6504903nPhTjV','when','-->','<','__RABETBASE_MYBATIS_DYNAMIC_END__','430cFtlNg',']]>','DDL\x20statements\x20are\x20blocked\x20from\x20auto-save','choose','add','trim','indexOf','property','>','keys',''','Invalid\x20attributes\x20on\x20MyBatis\x20XML\x20tag:\x20<','outer','mybatisXml','Unsupported\x20MyBatis\x20XML\x20tag:\x20<','<!--','\x20with\x20parameters:\x20','7kyMsrw','5182482WQHaZQ','include','31264YRwYVo','exec','SQL\x20text\x20must\x20be\x20inside\x20the\x20MyBatis\x20statement\x20wrapper.','insert','\x20WHERE\x20',')\x5cb','update','653232jAcLFi','fromCodePoint','join','\x20query\x20targeting\x20','toUpperCase','sql','MyBatis\x20dynamic\x20tag\x20must\x20be\x20inside\x20the\x20statement\x20wrapper:\x20<','replace','split','match','Unclosed\x20MyBatis\x20XML\x20tag:\x20<','length','UPDATE','toLowerCase'];a238_0x35f1=function(){return _0x33ac03;};return a238_0x35f1();}export const MYBATIS_INCLUDE_MARKER=a238_0x5ef39d(0x16a);const UNRESOLVED_SQL_FRAGMENT=a238_0x5ef39d(0x1c3),MYBATIS_OUTER_TAG_PATTERN=new RegExp('^<\x5cs*(?:'+[...MYBATIS_OUTER_TAGS[a238_0x5ef39d(0x19f)]()][a238_0x5ef39d(0x1b3)]('|')+a238_0x5ef39d(0x1af),'i');export function normalizeSqlForStaticAnalysis(_0x55dcab){const _0x380762=a238_0x5ef39d,_0x260222=typeof _0x55dcab==='string'?_0x55dcab:'';if(!startsWithMybatisStatementWrapper(_0x260222))return{'sql':_0x260222,'mode':_0x380762(0x1b6)};let _0x54b902=0x0,_0x560611='',_0x3d657f,_0x11ba2c=![],_0x3bcc03=![];const _0x253b2d=[];while(_0x54b902<_0x260222[_0x380762(0x1bc)]){if(_0x260222[_0x380762(0x170)](_0x380762(0x1a5),_0x54b902)){const _0x1ce886=_0x260222[_0x380762(0x19c)](_0x380762(0x193),_0x54b902+0x4);if(_0x1ce886<0x0)return invalidMybatisSource('Unterminated\x20XML\x20comment.');_0x560611+='\x20',_0x54b902=_0x1ce886+0x3;continue;}if(_0x260222[_0x380762(0x170)](_0x380762(0x17e),_0x54b902)){if(!_0x11ba2c||_0x3bcc03)return invalidMybatisSource('CDATA\x20sections\x20must\x20be\x20inside\x20the\x20MyBatis\x20statement\x20wrapper.');const _0x407d6c=_0x260222['indexOf'](_0x380762(0x197),_0x54b902+0x9);if(_0x407d6c<0x0)return invalidMybatisSource('Unterminated\x20CDATA\x20section.');_0x560611+=_0x260222[_0x380762(0x180)](_0x54b902+0x9,_0x407d6c),_0x54b902=_0x407d6c+0x3;continue;}if(_0x260222[_0x380762(0x170)]('<?',_0x54b902)){if(_0x11ba2c)return invalidMybatisSource(_0x380762(0x179));const _0x12f92f=_0x260222[_0x380762(0x19c)]('?>',_0x54b902+0x2);if(_0x12f92f<0x0)return invalidMybatisSource(_0x380762(0x16c));_0x560611+='\x20',_0x54b902=_0x12f92f+0x2;continue;}if(_0x260222[_0x54b902]!=='<'){const _0x3d148d=_0x260222['indexOf']('<',_0x54b902),_0x3f73e7=_0x3d148d<0x0?_0x260222[_0x380762(0x1bc)]:_0x3d148d,_0x1e9817=_0x260222[_0x380762(0x180)](_0x54b902,_0x3f73e7);if((!_0x11ba2c||_0x3bcc03)&&_0x1e9817[_0x380762(0x19b)]())return invalidMybatisSource(_0x380762(0x1ac));if(_0x11ba2c&&!_0x3bcc03){const _0x2dfb9e=decodeXmlEntities(_0x1e9817);if(_0x2dfb9e===null)return invalidMybatisSource(_0x380762(0x18b));_0x560611+=_0x2dfb9e;}else _0x560611+='\x20';_0x54b902=_0x3f73e7;continue;}const _0x179b05=findXmlTagEnd(_0x260222,_0x54b902);if(_0x179b05<0x0)return invalidMybatisSource('Unterminated\x20MyBatis\x20XML\x20tag.');const _0x1ad399=_0x260222[_0x380762(0x180)](_0x54b902,_0x179b05+0x1),_0x829b85=/^<\s*(\/?)\s*([A-Za-z][\w:-]*)([\s\S]*?)(\/?)\s*>$/['exec'](_0x1ad399);if(!_0x829b85)return invalidMybatisSource(_0x380762(0x16d));const _0x17a8dd=_0x829b85[0x1]==='/',_0x47ec6f=_0x829b85[0x2]??'',_0x575e30=_0x47ec6f[_0x380762(0x1be)](),_0x1b7305=_0x829b85[0x3]??'',_0x233885=_0x829b85[0x4]==='/',_0x5b304a=MYBATIS_OUTER_TAGS[_0x380762(0x17f)](_0x575e30);if(!_0x5b304a&&!MYBATIS_DYNAMIC_TAGS[_0x380762(0x189)](_0x575e30))return invalidMybatisSource(_0x380762(0x1a4)+_0x575e30+'>.');if(!_0x5b304a&&_0x47ec6f!==_0x575e30)return invalidMybatisSource(_0x380762(0x1c4)+_0x47ec6f+'>.');if(_0x17a8dd){if(_0x1b7305[_0x380762(0x19b)]()||_0x233885)return invalidMybatisSource(_0x380762(0x187)+_0x47ec6f+'>.');const _0x3c024e=_0x253b2d['at'](-0x1);if(!_0x3c024e||(_0x3c024e[_0x380762(0x1a2)]?_0x3c024e[_0x380762(0x174)]!==_0x575e30:_0x3c024e[_0x380762(0x1c2)]!==_0x47ec6f))return invalidMybatisSource(_0x380762(0x1bf)+_0x47ec6f+'>.');_0x253b2d['pop']();if(_0x3c024e[_0x380762(0x1a2)])_0x3bcc03=!![];_0x560611+=MYBATIS_BRANCH_TAGS[_0x380762(0x189)](_0x575e30)?'\x20'+MYBATIS_DYNAMIC_END_MARKER+'\x20':'\x20';}else{if(!hasWellFormedXmlAttributes(_0x1b7305))return invalidMybatisSource(_0x380762(0x1a1)+_0x47ec6f+'>.');if(_0x575e30===_0x380762(0x19d)&&(!_0x233885||_0x253b2d['at'](-0x1)?.['tagName']!==_0x380762(0x1a9)))return invalidMybatisSource('MyBatis\x20<property>\x20must\x20be\x20a\x20self-closing\x20direct\x20child\x20of\x20<include>.');if(_0x5b304a){if(_0x11ba2c||_0x253b2d[_0x380762(0x1bc)]>0x0)return invalidMybatisSource('Multiple\x20MyBatis\x20statement\x20wrappers\x20are\x20not\x20supported.');_0x11ba2c=!![],_0x3bcc03=_0x233885,_0x3d657f=_0x5b304a;}else{if(!_0x11ba2c||_0x3bcc03)return invalidMybatisSource(_0x380762(0x1b7)+_0x47ec6f+'>.');}_0x560611+=_0x575e30==='where'?_0x380762(0x1ae):_0x575e30===_0x380762(0x168)?'\x20SET\x20':_0x575e30===_0x380762(0x1a9)?'\x20'+MYBATIS_INCLUDE_MARKER+'\x20':MYBATIS_BRANCH_TAGS[_0x380762(0x189)](_0x575e30)&&!_0x233885?'\x20'+MYBATIS_DYNAMIC_START_MARKER+'\x20':'\x20',!_0x233885&&_0x253b2d['push']({'rawName':_0x47ec6f,'tagName':_0x575e30,'outer':!!_0x5b304a});}_0x54b902=_0x179b05+0x1;}if(_0x253b2d['length']>0x0)return invalidMybatisSource(_0x380762(0x1bb)+_0x253b2d['at'](-0x1)?.[_0x380762(0x1c2)]+'>.');if(!_0x11ba2c||!_0x3bcc03)return invalidMybatisSource(_0x380762(0x18c));return{'sql':_0x560611['trim'](),'mode':_0x380762(0x1a3),..._0x3d657f?{'statementType':_0x3d657f}:{}};}function hasWellFormedXmlAttributes(_0x2e52b9){const _0x830a64=a238_0x5ef39d;let _0x263119=0x0;const _0xa37c00=new Set();while(_0x263119<_0x2e52b9['length']){while(_0x263119<_0x2e52b9['length']&&/\s/[_0x830a64(0x18f)](_0x2e52b9[_0x263119]??''))_0x263119+=0x1;if(_0x263119>=_0x2e52b9['length'])return!![];const _0x29747b=/^[A-Za-z_:][\w:.-]*/[_0x830a64(0x1ab)](_0x2e52b9[_0x830a64(0x180)](_0x263119)),_0x8a0cac=_0x29747b?.[0x0];if(!_0x8a0cac||_0xa37c00[_0x830a64(0x189)](_0x8a0cac))return![];_0xa37c00['add'](_0x8a0cac),_0x263119+=_0x8a0cac['length'];while(_0x263119<_0x2e52b9['length']&&/\s/['test'](_0x2e52b9[_0x263119]??''))_0x263119+=0x1;if(_0x2e52b9[_0x263119]!=='=')return![];_0x263119+=0x1;while(_0x263119<_0x2e52b9[_0x830a64(0x1bc)]&&/\s/[_0x830a64(0x18f)](_0x2e52b9[_0x263119]??''))_0x263119+=0x1;const _0x883f79=_0x2e52b9[_0x263119];if(_0x883f79!=='\x22'&&_0x883f79!=='\x27')return![];_0x263119+=0x1;const _0x8a560d=_0x2e52b9[_0x830a64(0x19c)](_0x883f79,_0x263119);if(_0x8a560d<0x0)return![];if(decodeXmlEntities(_0x2e52b9['slice'](_0x263119,_0x8a560d))===null)return![];_0x263119=_0x8a560d+0x1;}return!![];}function startsWithMybatisStatementWrapper(_0x555e6d){const _0x351347=a238_0x5ef39d;let _0x1d7ad1=0x0;const _0x1904f7=()=>{const _0x1c9fb5=a238_0x3fe4;while(_0x1d7ad1<_0x555e6d[_0x1c9fb5(0x1bc)]&&/\s/[_0x1c9fb5(0x18f)](_0x555e6d[_0x1d7ad1]??''))_0x1d7ad1+=0x1;};_0x1904f7();while(_0x1d7ad1<_0x555e6d['length']){if(_0x555e6d['startsWith'](_0x351347(0x1a5),_0x1d7ad1)){const _0xf17c46=_0x555e6d[_0x351347(0x19c)](_0x351347(0x193),_0x1d7ad1+0x4);if(_0xf17c46<0x0)return!![];_0x1d7ad1=_0xf17c46+0x3,_0x1904f7();continue;}if(_0x555e6d[_0x351347(0x170)]('<?',_0x1d7ad1)){const _0x32565d=_0x555e6d['indexOf']('?>',_0x1d7ad1+0x2);if(_0x32565d<0x0)return!![];_0x1d7ad1=_0x32565d+0x2,_0x1904f7();continue;}break;}return MYBATIS_OUTER_TAG_PATTERN[_0x351347(0x18f)](_0x555e6d['slice'](_0x1d7ad1));}function invalidMybatisSource(_0x2eb720){const _0xb9a0c8=a238_0x5ef39d;return{'sql':'','mode':_0xb9a0c8(0x1a3),'error':_0x2eb720};}function findXmlTagEnd(_0x52c284,_0x5db3e4){const _0xfef338=a238_0x5ef39d;let _0x2e06d1;for(let _0x39d7a7=_0x5db3e4+0x1;_0x39d7a7<_0x52c284[_0xfef338(0x1bc)];_0x39d7a7+=0x1){const _0x386db7=_0x52c284[_0x39d7a7];if(_0x2e06d1){if(_0x386db7===_0x2e06d1)_0x2e06d1=undefined;continue;}if(_0x386db7==='\x22'||_0x386db7==='\x27'){_0x2e06d1=_0x386db7;continue;}if(_0x386db7==='>')return _0x39d7a7;}return-0x1;}function decodeXmlEntities(_0x170104){const _0x43834f=a238_0x5ef39d;let _0x511f06=![];const _0x1d48f1=_0x170104[_0x43834f(0x1b8)](/&(?:#x[0-9a-f]+;|#[0-9]+;|[A-Za-z_:][\w:.-]*;)?/g,_0x225584=>{const _0x56d253=_0x43834f;if(_0x225584===_0x56d253(0x194))return'<';if(_0x225584===_0x56d253(0x19e))return'>';if(_0x225584===_0x56d253(0x17a))return'\x22';if(_0x225584===_0x56d253(0x1a0))return'\x27';if(_0x225584===_0x56d253(0x185))return'&';const _0x22e2c8=/^&#(?:x([0-9a-f]+)|([0-9]+));$/[_0x56d253(0x1ab)](_0x225584);if(_0x22e2c8){const _0x4802c7=_0x22e2c8[0x1],_0x5a88a0=_0x22e2c8[0x2],_0x5c54ad=Number['parseInt'](_0x4802c7??_0x5a88a0??'',_0x4802c7?0x10:0xa);if(isValidXmlCharacter(_0x5c54ad))return String[_0x56d253(0x1b2)](_0x5c54ad);}return _0x511f06=!![],'';});return _0x511f06?null:_0x1d48f1;}function isValidXmlCharacter(_0x16dfc3){return _0x16dfc3===0x9||_0x16dfc3===0xa||_0x16dfc3===0xd||_0x16dfc3>=0x20&&_0x16dfc3<=0xd7ff||_0x16dfc3>=0xe000&&_0x16dfc3<=0xfffd||_0x16dfc3>=0x10000&&_0x16dfc3<=0x10ffff;}export function detectSqlType(_0x1a9d43){return detectNormalizedSqlType(normalizeSqlForStaticAnalysis(_0x1a9d43));}function detectNormalizedSqlType(_0x18cb25){const _0x39ef98=a238_0x5ef39d;if(_0x18cb25[_0x39ef98(0x173)])return{'type':'UNKNOWN','isSelectOnly':![],'isDangerous':![],'reason':_0x18cb25['error']};if(!_0x18cb25[_0x39ef98(0x1b6)][_0x39ef98(0x19b)]())return{'type':_0x39ef98(0x178),'isSelectOnly':![],'isDangerous':![],'reason':'SQL\x20content\x20is\x20empty'};const _0x3283c6=stripStaticAnalysisMarkers(_0x18cb25[_0x39ef98(0x1b6)])[_0x39ef98(0x1b8)](/#\{[^}]*\}/g,'?')[_0x39ef98(0x1b8)](/\$\{[^}]*\}/g,'?')[_0x39ef98(0x1b8)](/@[^(\s]+(\([^)]*\))?/g,'')['replace'](/\/\*[\s\S]*?\*\//g,'')[_0x39ef98(0x19b)](),_0xf73bbc=_0x3283c6[_0x39ef98(0x1b9)]('\x0a');let _0x16c888='';for(const _0x585de7 of _0xf73bbc){const _0x4c5325=_0x585de7['trim']();if(!_0x4c5325||_0x4c5325['startsWith']('--')||_0x4c5325[_0x39ef98(0x170)]('/*'))continue;_0x16c888=_0x4c5325;break;}const _0xb3ee04=_0x16c888[_0x39ef98(0x1b5)](),_0x4b826b=_0x18cb25[_0x39ef98(0x1c0)],_0xf43f6b=maskSqlTextForBlockedKeywordScan(_0x3283c6),_0x3e46c3=/\b(DELETE|DROP|ALTER|CREATE|TRUNCATE)\b/i[_0x39ef98(0x18f)](_0xf43f6b);if(_0x4b826b==='SELECT'||!_0x4b826b&&(_0xb3ee04[_0x39ef98(0x170)]('SELECT')||_0xb3ee04[_0x39ef98(0x170)](_0x39ef98(0x184)))){const _0x233179=/\b(INSERT|UPDATE|DELETE|DROP|ALTER|CREATE|TRUNCATE)\b/i[_0x39ef98(0x18f)](_0x3283c6);return{'type':_0x39ef98(0x16b),'isSelectOnly':!_0x233179,'isDangerous':_0x233179,'reason':_0x233179?_0x39ef98(0x181):undefined};}if(_0x4b826b==='INSERT'||!_0x4b826b&&_0xb3ee04[_0x39ef98(0x170)](_0x39ef98(0x1c1)))return{'type':_0x39ef98(0x1c1),'isSelectOnly':![],'isDangerous':_0x3e46c3,'reason':_0x3e46c3?'SQL\x20contains\x20blocked\x20DELETE\x20or\x20DDL\x20statements':undefined};if(_0x4b826b===_0x39ef98(0x1bd)||!_0x4b826b&&_0xb3ee04[_0x39ef98(0x170)](_0x39ef98(0x1bd)))return{'type':_0x39ef98(0x1bd),'isSelectOnly':![],'isDangerous':_0x3e46c3,'reason':_0x3e46c3?_0x39ef98(0x17b):undefined};if(_0x4b826b===_0x39ef98(0x177)||!_0x4b826b&&_0xb3ee04['startsWith'](_0x39ef98(0x177)))return{'type':_0x39ef98(0x177),'isSelectOnly':![],'isDangerous':!![],'reason':'DELETE\x20statements\x20are\x20blocked\x20from\x20auto-save'};if(/^(CREATE|ALTER|DROP|TRUNCATE)/i['test'](_0xb3ee04))return{'type':_0x39ef98(0x17d),'isSelectOnly':![],'isDangerous':!![],'reason':_0x39ef98(0x198)};return{'type':_0x39ef98(0x178),'isSelectOnly':![],'isDangerous':![]};}function stripStaticAnalysisMarkers(_0x130482){const _0x2bd3f6=a238_0x5ef39d;return _0x130482[_0x2bd3f6(0x18e)](MYBATIS_DYNAMIC_START_MARKER,'\x20')[_0x2bd3f6(0x18e)](MYBATIS_DYNAMIC_END_MARKER,'\x20')['replaceAll'](MYBATIS_INCLUDE_MARKER,'\x20'+UNRESOLVED_SQL_FRAGMENT+'\x20');}function maskSqlTextForBlockedKeywordScan(_0x265a6a){const _0xa97d9e=a238_0x5ef39d;return _0x265a6a[_0xa97d9e(0x1b8)](/'(?:''|\\.|[^'])*'/g,'\x20')['replace'](/"(?:""|\\.|[^"])*"/g,'\x20')[_0xa97d9e(0x1b8)](/`(?:``|\\.|[^`])*`/g,'\x20')[_0xa97d9e(0x1b8)](/--.*$/gm,'\x20')['replace'](/#.*$/gm,'\x20')[_0xa97d9e(0x1b8)](/\/\*[\s\S]*?\*\//g,'\x20');}function extractTables(_0xa46620){const _0x3d455e=a238_0x5ef39d,_0x5a69f8=_0xa46620['replace'](/#\{[^}]*\}/g,'?')[_0x3d455e(0x1b8)](/\$\{[^}]*\}/g,'?')[_0x3d455e(0x1b8)](/'[^']*'/g,'\x27\x27')[_0x3d455e(0x1b8)](/--.*$/gm,'')[_0x3d455e(0x1b8)](/\/\*[\s\S]*?\*\//g,''),_0x142923=[],_0x232313=_0x5a69f8[_0x3d455e(0x1ba)](/FROM\s+([^\s,)(]+)/i);addTable(_0x142923,_0x232313?.[0x1]);for(const _0x249379 of _0x5a69f8[_0x3d455e(0x172)](/(?:INNER|LEFT|RIGHT|FULL|CROSS)?\s*JOIN\s+([^\s,)(]+)/gi)){addTable(_0x142923,_0x249379[0x1]);}const _0x383282=_0x5a69f8[_0x3d455e(0x1ba)](/INTO\s+([^\s(]+)/i);addTable(_0x142923,_0x383282?.[0x1]);const _0x4e7636=_0x5a69f8['match'](/UPDATE\s+([^\s,)(]+)/i);return addTable(_0x142923,_0x4e7636?.[0x1]),_0x142923;}function a238_0x3fe4(_0x68081e,_0x3becce){_0x68081e=_0x68081e-0x168;const _0x35f180=a238_0x35f1();let _0x3fe4cd=_0x35f180[_0x68081e];return _0x3fe4cd;}function addTable(_0x1400f1,_0x294ca0){const _0x3898ec=a238_0x5ef39d,_0x31290d=_0x294ca0?.[_0x3898ec(0x1b8)](/[`"]/g,'');_0x31290d&&_0x31290d!==UNRESOLVED_SQL_FRAGMENT&&!_0x1400f1['includes'](_0x31290d)&&_0x1400f1[_0x3898ec(0x17c)](_0x31290d);}function extractParameters(_0x3f98a1){const _0x4becbd=a238_0x5ef39d,_0x35756e=new Set();for(const _0x3976ae of _0x3f98a1[_0x4becbd(0x172)](/[#$]\{\s*([A-Za-z_][\w.]*)\s*(?=[,}])/g)){if(_0x3976ae[0x1])_0x35756e[_0x4becbd(0x19a)](_0x3976ae[0x1]);}return Array[_0x4becbd(0x175)](_0x35756e);}export function validateSql(_0x2c1c77){const _0x1fc96a=a238_0x5ef39d,_0x23c505=normalizeSqlForStaticAnalysis(_0x2c1c77),_0x43508f=detectNormalizedSqlType(_0x23c505),_0x5d144c=stripStaticAnalysisMarkers(_0x23c505['sql']),_0x14d925=_0x23c505[_0x1fc96a(0x173)]?[]:extractTables(_0x5d144c),_0x503feb=_0x23c505[_0x1fc96a(0x173)]?[]:extractParameters(_0x5d144c);if(_0x43508f['isDangerous'])return{'valid':![],'sqlType':_0x43508f,'tables':_0x14d925,'parameters':_0x503feb,'message':_0x43508f['reason']||_0x43508f[_0x1fc96a(0x171)]+'\x20statements\x20cannot\x20be\x20auto-saved.\x20Please\x20operate\x20manually\x20on\x20the\x20platform.'};if(_0x43508f[_0x1fc96a(0x171)]==='UNKNOWN')return{'valid':![],'sqlType':_0x43508f,'tables':_0x14d925,'parameters':_0x503feb,'message':_0x23c505[_0x1fc96a(0x173)]?'Unable\x20to\x20detect\x20SQL\x20type.\x20'+_0x23c505[_0x1fc96a(0x173)]:_0x1fc96a(0x190)};return{'valid':!![],'sqlType':_0x43508f,'tables':_0x14d925,'parameters':_0x503feb,'message':_0x43508f['type']+_0x1fc96a(0x1b4)+(_0x14d925[_0x1fc96a(0x1bc)]?_0x14d925[_0x1fc96a(0x1b3)](',\x20'):_0x1fc96a(0x186))+(_0x503feb[_0x1fc96a(0x1bc)]?_0x1fc96a(0x1a6)+_0x503feb[_0x1fc96a(0x1b3)](',\x20'):'')};}
|
|
1
|
+
const a239_0x75d061=a239_0x5e99;(function(_0x22f5e4,_0x4f2ac6){const _0x5adb21=a239_0x5e99,_0x5a2f8d=_0x22f5e4();while(!![]){try{const _0x39ed1d=parseInt(_0x5adb21(0x14d))/0x1*(-parseInt(_0x5adb21(0x12d))/0x2)+-parseInt(_0x5adb21(0x16a))/0x3+parseInt(_0x5adb21(0x130))/0x4*(parseInt(_0x5adb21(0x125))/0x5)+parseInt(_0x5adb21(0x111))/0x6*(parseInt(_0x5adb21(0x135))/0x7)+-parseInt(_0x5adb21(0x128))/0x8+-parseInt(_0x5adb21(0x144))/0x9+-parseInt(_0x5adb21(0x159))/0xa*(-parseInt(_0x5adb21(0x115))/0xb);if(_0x39ed1d===_0x4f2ac6)break;else _0x5a2f8d['push'](_0x5a2f8d['shift']());}catch(_0x47b07d){_0x5a2f8d['push'](_0x5a2f8d['shift']());}}}(a239_0x4bb3,0x99bd3));const MYBATIS_OUTER_TAGS=new Map([[a239_0x75d061(0x138),'SELECT'],[a239_0x75d061(0x117),'INSERT'],['update',a239_0x75d061(0x15b)],[a239_0x75d061(0x165),'DELETE']]),MYBATIS_DYNAMIC_TAGS=new Set(['if',a239_0x75d061(0x134),a239_0x75d061(0x123),a239_0x75d061(0x156),a239_0x75d061(0x12e),a239_0x75d061(0x139),a239_0x75d061(0x10e),a239_0x75d061(0x16e),a239_0x75d061(0x150),a239_0x75d061(0x155),'property']),MYBATIS_BRANCH_TAGS=new Set(['if',a239_0x75d061(0x123),a239_0x75d061(0x156),a239_0x75d061(0x12e),a239_0x75d061(0x139)]);export const MYBATIS_DYNAMIC_START_MARKER=a239_0x75d061(0x16f);export const MYBATIS_DYNAMIC_END_MARKER=a239_0x75d061(0x122);export const MYBATIS_INCLUDE_MARKER=a239_0x75d061(0x13b);const UNRESOLVED_SQL_FRAGMENT=a239_0x75d061(0x157),MYBATIS_OUTER_TAG_PATTERN=new RegExp(a239_0x75d061(0x160)+[...MYBATIS_OUTER_TAGS[a239_0x75d061(0x152)]()][a239_0x75d061(0x137)]('|')+a239_0x75d061(0x140),'i');export function normalizeSqlForStaticAnalysis(_0xa5a506){const _0x9970a8=a239_0x75d061,_0x420c75=typeof _0xa5a506===_0x9970a8(0x116)?_0xa5a506:'';if(!startsWithMybatisStatementWrapper(_0x420c75))return{'sql':_0x420c75,'mode':'sql'};let _0x24e86a=0x0,_0x34949f='',_0x32849e,_0xaaa2f5=![],_0x583673=![];const _0x35598a=[];while(_0x24e86a<_0x420c75['length']){if(_0x420c75['startsWith'](_0x9970a8(0x120),_0x24e86a)){const _0x571db1=_0x420c75['indexOf'](_0x9970a8(0x119),_0x24e86a+0x4);if(_0x571db1<0x0)return invalidMybatisSource(_0x9970a8(0x162));_0x34949f+='\x20',_0x24e86a=_0x571db1+0x3;continue;}if(_0x420c75[_0x9970a8(0x10f)](_0x9970a8(0x146),_0x24e86a)){if(!_0xaaa2f5||_0x583673)return invalidMybatisSource(_0x9970a8(0x151));const _0x5d48e5=_0x420c75[_0x9970a8(0x16c)](_0x9970a8(0x11f),_0x24e86a+0x9);if(_0x5d48e5<0x0)return invalidMybatisSource(_0x9970a8(0x13a));_0x34949f+=_0x420c75['slice'](_0x24e86a+0x9,_0x5d48e5),_0x24e86a=_0x5d48e5+0x3;continue;}if(_0x420c75[_0x9970a8(0x10f)]('<?',_0x24e86a)){if(_0xaaa2f5)return invalidMybatisSource(_0x9970a8(0x15f));const _0x56f54b=_0x420c75[_0x9970a8(0x16c)]('?>',_0x24e86a+0x2);if(_0x56f54b<0x0)return invalidMybatisSource(_0x9970a8(0x14b));_0x34949f+='\x20',_0x24e86a=_0x56f54b+0x2;continue;}if(_0x420c75[_0x24e86a]!=='<'){const _0x490028=_0x420c75[_0x9970a8(0x16c)]('<',_0x24e86a),_0x25b20c=_0x490028<0x0?_0x420c75[_0x9970a8(0x118)]:_0x490028,_0x3cd6cd=_0x420c75[_0x9970a8(0x16b)](_0x24e86a,_0x25b20c);if((!_0xaaa2f5||_0x583673)&&_0x3cd6cd['trim']())return invalidMybatisSource('SQL\x20text\x20must\x20be\x20inside\x20the\x20MyBatis\x20statement\x20wrapper.');if(_0xaaa2f5&&!_0x583673){const _0x840dcb=decodeXmlEntities(_0x3cd6cd);if(_0x840dcb===null)return invalidMybatisSource('Invalid\x20XML\x20entity\x20reference.');_0x34949f+=_0x840dcb;}else _0x34949f+='\x20';_0x24e86a=_0x25b20c;continue;}const _0x4b6f01=findXmlTagEnd(_0x420c75,_0x24e86a);if(_0x4b6f01<0x0)return invalidMybatisSource(_0x9970a8(0x163));const _0xb6945b=_0x420c75[_0x9970a8(0x16b)](_0x24e86a,_0x4b6f01+0x1),_0x456f36=/^<\s*(\/?)\s*([A-Za-z][\w:-]*)([\s\S]*?)(\/?)\s*>$/['exec'](_0xb6945b);if(!_0x456f36)return invalidMybatisSource(_0x9970a8(0x13f));const _0x46bb03=_0x456f36[0x1]==='/',_0x14a4dc=_0x456f36[0x2]??'',_0x1f8802=_0x14a4dc[_0x9970a8(0x126)](),_0x516197=_0x456f36[0x3]??'',_0x3d40f4=_0x456f36[0x4]==='/',_0x2f8c98=MYBATIS_OUTER_TAGS[_0x9970a8(0x168)](_0x1f8802);if(!_0x2f8c98&&!MYBATIS_DYNAMIC_TAGS['has'](_0x1f8802))return invalidMybatisSource(_0x9970a8(0x147)+_0x1f8802+'>.');if(!_0x2f8c98&&_0x14a4dc!==_0x1f8802)return invalidMybatisSource(_0x9970a8(0x15a)+_0x14a4dc+'>.');if(_0x46bb03){if(_0x516197['trim']()||_0x3d40f4)return invalidMybatisSource('Invalid\x20MyBatis\x20XML\x20closing\x20tag:\x20</'+_0x14a4dc+'>.');const _0x48153b=_0x35598a['at'](-0x1);if(!_0x48153b||(_0x48153b[_0x9970a8(0x10d)]?_0x48153b[_0x9970a8(0x132)]!==_0x1f8802:_0x48153b[_0x9970a8(0x15d)]!==_0x14a4dc))return invalidMybatisSource(_0x9970a8(0x129)+_0x14a4dc+'>.');_0x35598a['pop']();if(_0x48153b[_0x9970a8(0x10d)])_0x583673=!![];_0x34949f+=MYBATIS_BRANCH_TAGS['has'](_0x1f8802)?'\x20'+MYBATIS_DYNAMIC_END_MARKER+'\x20':'\x20';}else{if(!hasWellFormedXmlAttributes(_0x516197))return invalidMybatisSource('Invalid\x20attributes\x20on\x20MyBatis\x20XML\x20tag:\x20<'+_0x14a4dc+'>.');if(_0x1f8802===_0x9970a8(0x11c)&&(!_0x3d40f4||_0x35598a['at'](-0x1)?.[_0x9970a8(0x132)]!=='include'))return invalidMybatisSource(_0x9970a8(0x158));if(_0x2f8c98){if(_0xaaa2f5||_0x35598a['length']>0x0)return invalidMybatisSource('Multiple\x20MyBatis\x20statement\x20wrappers\x20are\x20not\x20supported.');_0xaaa2f5=!![],_0x583673=_0x3d40f4,_0x32849e=_0x2f8c98;}else{if(!_0xaaa2f5||_0x583673)return invalidMybatisSource(_0x9970a8(0x14e)+_0x14a4dc+'>.');}_0x34949f+=_0x1f8802===_0x9970a8(0x134)?'\x20WHERE\x20':_0x1f8802===_0x9970a8(0x16e)?'\x20SET\x20':_0x1f8802==='include'?'\x20'+MYBATIS_INCLUDE_MARKER+'\x20':MYBATIS_BRANCH_TAGS[_0x9970a8(0x141)](_0x1f8802)&&!_0x3d40f4?'\x20'+MYBATIS_DYNAMIC_START_MARKER+'\x20':'\x20',!_0x3d40f4&&_0x35598a[_0x9970a8(0x15e)]({'rawName':_0x14a4dc,'tagName':_0x1f8802,'outer':!!_0x2f8c98});}_0x24e86a=_0x4b6f01+0x1;}if(_0x35598a[_0x9970a8(0x118)]>0x0)return invalidMybatisSource(_0x9970a8(0x124)+_0x35598a['at'](-0x1)?.[_0x9970a8(0x15d)]+'>.');if(!_0xaaa2f5||!_0x583673)return invalidMybatisSource(_0x9970a8(0x12c));return{'sql':_0x34949f[_0x9970a8(0x10e)](),'mode':_0x9970a8(0x114),..._0x32849e?{'statementType':_0x32849e}:{}};}function hasWellFormedXmlAttributes(_0x4e999c){const _0xeb6eca=a239_0x75d061;let _0x411f76=0x0;const _0x26fb2c=new Set();while(_0x411f76<_0x4e999c[_0xeb6eca(0x118)]){while(_0x411f76<_0x4e999c[_0xeb6eca(0x118)]&&/\s/[_0xeb6eca(0x14a)](_0x4e999c[_0x411f76]??''))_0x411f76+=0x1;if(_0x411f76>=_0x4e999c[_0xeb6eca(0x118)])return!![];const _0x2ef9be=/^[A-Za-z_:][\w:.-]*/[_0xeb6eca(0x153)](_0x4e999c[_0xeb6eca(0x16b)](_0x411f76)),_0x57e4dc=_0x2ef9be?.[0x0];if(!_0x57e4dc||_0x26fb2c['has'](_0x57e4dc))return![];_0x26fb2c[_0xeb6eca(0x12b)](_0x57e4dc),_0x411f76+=_0x57e4dc[_0xeb6eca(0x118)];while(_0x411f76<_0x4e999c[_0xeb6eca(0x118)]&&/\s/[_0xeb6eca(0x14a)](_0x4e999c[_0x411f76]??''))_0x411f76+=0x1;if(_0x4e999c[_0x411f76]!=='=')return![];_0x411f76+=0x1;while(_0x411f76<_0x4e999c['length']&&/\s/['test'](_0x4e999c[_0x411f76]??''))_0x411f76+=0x1;const _0x145b27=_0x4e999c[_0x411f76];if(_0x145b27!=='\x22'&&_0x145b27!=='\x27')return![];_0x411f76+=0x1;const _0x460533=_0x4e999c[_0xeb6eca(0x16c)](_0x145b27,_0x411f76);if(_0x460533<0x0)return![];if(decodeXmlEntities(_0x4e999c[_0xeb6eca(0x16b)](_0x411f76,_0x460533))===null)return![];_0x411f76=_0x460533+0x1;}return!![];}function startsWithMybatisStatementWrapper(_0xdb8e35){const _0x5f3c09=a239_0x75d061;let _0x4f4368=0x0;const _0x17229f=()=>{const _0x107a00=a239_0x5e99;while(_0x4f4368<_0xdb8e35[_0x107a00(0x118)]&&/\s/[_0x107a00(0x14a)](_0xdb8e35[_0x4f4368]??''))_0x4f4368+=0x1;};_0x17229f();while(_0x4f4368<_0xdb8e35[_0x5f3c09(0x118)]){if(_0xdb8e35[_0x5f3c09(0x10f)](_0x5f3c09(0x120),_0x4f4368)){const _0x4e61d2=_0xdb8e35[_0x5f3c09(0x16c)]('-->',_0x4f4368+0x4);if(_0x4e61d2<0x0)return!![];_0x4f4368=_0x4e61d2+0x3,_0x17229f();continue;}if(_0xdb8e35[_0x5f3c09(0x10f)]('<?',_0x4f4368)){const _0x5de1d3=_0xdb8e35['indexOf']('?>',_0x4f4368+0x2);if(_0x5de1d3<0x0)return!![];_0x4f4368=_0x5de1d3+0x2,_0x17229f();continue;}break;}return MYBATIS_OUTER_TAG_PATTERN[_0x5f3c09(0x14a)](_0xdb8e35[_0x5f3c09(0x16b)](_0x4f4368));}function a239_0x5e99(_0x459d06,_0x59969d){_0x459d06=_0x459d06-0x10d;const _0x4bb391=a239_0x4bb3();let _0x5e9984=_0x4bb391[_0x459d06];return _0x5e9984;}function invalidMybatisSource(_0x1c7725){return{'sql':'','mode':'mybatisXml','error':_0x1c7725};}function a239_0x4bb3(){const _0x495d32=['28KRkQsR','when','<','48PBCCZi','isDangerous','tagName','type','where','1106KXhATl','replaceAll','join','select','otherwise','Unterminated\x20CDATA\x20section.','__RABETBASE_MYBATIS_INCLUDE_UNRESOLVED__',''','SELECT','\x20statements\x20cannot\x20be\x20auto-saved.\x20Please\x20operate\x20manually\x20on\x20the\x20platform.','Invalid\x20MyBatis\x20XML\x20tag.',')\x5cb','has','Unable\x20to\x20detect\x20SQL\x20type.\x20Please\x20check\x20the\x20SQL\x20content.','split','593541gMFydJ','Unable\x20to\x20detect\x20SQL\x20type.\x20','<![CDATA[','Unsupported\x20MyBatis\x20XML\x20tag:\x20<','sql','unknown\x20table(s)','test','Unterminated\x20XML\x20declaration.','error','88301NaUigx','MyBatis\x20dynamic\x20tag\x20must\x20be\x20inside\x20the\x20statement\x20wrapper:\x20<','statementType','bind','CDATA\x20sections\x20must\x20be\x20inside\x20the\x20MyBatis\x20statement\x20wrapper.','keys','exec','DELETE','include','choose','__RABETBASE_UNRESOLVED_SQL_FRAGMENT__','MyBatis\x20<property>\x20must\x20be\x20a\x20self-closing\x20direct\x20child\x20of\x20<include>.','430NCCnRM','MyBatis\x20dynamic\x20tag\x20names\x20must\x20be\x20lowercase:\x20<','UPDATE','replace','rawName','push','XML\x20declarations\x20must\x20precede\x20the\x20MyBatis\x20statement\x20wrapper.','^<\x5cs*(?:','match','Unterminated\x20XML\x20comment.','Unterminated\x20MyBatis\x20XML\x20tag.','SQL\x20content\x20is\x20empty','delete','"','from','get','reason','468519loApPB','slice','indexOf','parseInt','set','__RABETBASE_MYBATIS_DYNAMIC_START__','outer','trim','startsWith','&','37644PTZZqS','INSERT','>','mybatisXml','318670ypeXpx','string','insert','length','-->','DELETE\x20statements\x20are\x20blocked\x20from\x20auto-save','toUpperCase','property','SQL\x20contains\x20blocked\x20DELETE\x20or\x20DDL\x20statements','UNKNOWN',']]>','<!--','includes','__RABETBASE_MYBATIS_DYNAMIC_END__','foreach','Unclosed\x20MyBatis\x20XML\x20tag:\x20<','41880Zursmq','toLowerCase','\x20query\x20targeting\x20','1995704WLfUpX','Mismatched\x20MyBatis\x20XML\x20closing\x20tag:\x20</','matchAll','add','MyBatis\x20XML\x20must\x20contain\x20exactly\x20one\x20complete\x20statement\x20wrapper.'];a239_0x4bb3=function(){return _0x495d32;};return a239_0x4bb3();}function findXmlTagEnd(_0x1385cb,_0x31ccf4){let _0x5d4a00;for(let _0x5c1685=_0x31ccf4+0x1;_0x5c1685<_0x1385cb['length'];_0x5c1685+=0x1){const _0xfba18a=_0x1385cb[_0x5c1685];if(_0x5d4a00){if(_0xfba18a===_0x5d4a00)_0x5d4a00=undefined;continue;}if(_0xfba18a==='\x22'||_0xfba18a==='\x27'){_0x5d4a00=_0xfba18a;continue;}if(_0xfba18a==='>')return _0x5c1685;}return-0x1;}function decodeXmlEntities(_0xc27918){const _0x1a4e0f=a239_0x75d061;let _0x4ff4b8=![];const _0x2784c1=_0xc27918[_0x1a4e0f(0x15c)](/&(?:#x[0-9a-f]+;|#[0-9]+;|[A-Za-z_:][\w:.-]*;)?/g,_0x33d015=>{const _0x35fc78=_0x1a4e0f;if(_0x33d015===_0x35fc78(0x12f))return'<';if(_0x33d015===_0x35fc78(0x113))return'>';if(_0x33d015===_0x35fc78(0x166))return'\x22';if(_0x33d015===_0x35fc78(0x13c))return'\x27';if(_0x33d015===_0x35fc78(0x110))return'&';const _0x49ec63=/^&#(?:x([0-9a-f]+)|([0-9]+));$/[_0x35fc78(0x153)](_0x33d015);if(_0x49ec63){const _0x5f12d8=_0x49ec63[0x1],_0x4d3d09=_0x49ec63[0x2],_0x52f860=Number[_0x35fc78(0x16d)](_0x5f12d8??_0x4d3d09??'',_0x5f12d8?0x10:0xa);if(isValidXmlCharacter(_0x52f860))return String['fromCodePoint'](_0x52f860);}return _0x4ff4b8=!![],'';});return _0x4ff4b8?null:_0x2784c1;}function isValidXmlCharacter(_0x518beb){return _0x518beb===0x9||_0x518beb===0xa||_0x518beb===0xd||_0x518beb>=0x20&&_0x518beb<=0xd7ff||_0x518beb>=0xe000&&_0x518beb<=0xfffd||_0x518beb>=0x10000&&_0x518beb<=0x10ffff;}export function detectSqlType(_0x259ed2){return detectNormalizedSqlType(normalizeSqlForStaticAnalysis(_0x259ed2));}function detectNormalizedSqlType(_0x1c8988){const _0x55d218=a239_0x75d061;if(_0x1c8988[_0x55d218(0x14c)])return{'type':_0x55d218(0x11e),'isSelectOnly':![],'isDangerous':![],'reason':_0x1c8988[_0x55d218(0x14c)]};if(!_0x1c8988[_0x55d218(0x148)][_0x55d218(0x10e)]())return{'type':_0x55d218(0x11e),'isSelectOnly':![],'isDangerous':![],'reason':_0x55d218(0x164)};const _0x3cb9de=stripStaticAnalysisMarkers(_0x1c8988['sql'])[_0x55d218(0x15c)](/#\{[^}]*\}/g,'?')[_0x55d218(0x15c)](/\$\{[^}]*\}/g,'?')['replace'](/@[^(\s]+(\([^)]*\))?/g,'')[_0x55d218(0x15c)](/\/\*[\s\S]*?\*\//g,'')[_0x55d218(0x10e)](),_0x220ccd=_0x3cb9de[_0x55d218(0x143)]('\x0a');let _0x3767a0='';for(const _0x33173d of _0x220ccd){const _0x1a5661=_0x33173d['trim']();if(!_0x1a5661||_0x1a5661['startsWith']('--')||_0x1a5661['startsWith']('/*'))continue;_0x3767a0=_0x1a5661;break;}const _0x3dc5a2=_0x3767a0[_0x55d218(0x11b)](),_0x32e693=_0x1c8988[_0x55d218(0x14f)],_0x419fc6=maskSqlTextForBlockedKeywordScan(_0x3cb9de),_0x56dedf=/\b(DELETE|DROP|ALTER|CREATE|TRUNCATE)\b/i[_0x55d218(0x14a)](_0x419fc6);if(_0x32e693==='SELECT'||!_0x32e693&&(_0x3dc5a2[_0x55d218(0x10f)](_0x55d218(0x13d))||_0x3dc5a2[_0x55d218(0x10f)]('WITH'))){const _0x55695a=/\b(INSERT|UPDATE|DELETE|DROP|ALTER|CREATE|TRUNCATE)\b/i[_0x55d218(0x14a)](_0x3cb9de);return{'type':_0x55d218(0x13d),'isSelectOnly':!_0x55695a,'isDangerous':_0x55695a,'reason':_0x55695a?'SQL\x20contains\x20modification\x20statements\x20alongside\x20SELECT':undefined};}if(_0x32e693===_0x55d218(0x112)||!_0x32e693&&_0x3dc5a2[_0x55d218(0x10f)](_0x55d218(0x112)))return{'type':'INSERT','isSelectOnly':![],'isDangerous':_0x56dedf,'reason':_0x56dedf?_0x55d218(0x11d):undefined};if(_0x32e693==='UPDATE'||!_0x32e693&&_0x3dc5a2[_0x55d218(0x10f)]('UPDATE'))return{'type':_0x55d218(0x15b),'isSelectOnly':![],'isDangerous':_0x56dedf,'reason':_0x56dedf?'SQL\x20contains\x20blocked\x20DELETE\x20or\x20DDL\x20statements':undefined};if(_0x32e693===_0x55d218(0x154)||!_0x32e693&&_0x3dc5a2[_0x55d218(0x10f)](_0x55d218(0x154)))return{'type':_0x55d218(0x154),'isSelectOnly':![],'isDangerous':!![],'reason':_0x55d218(0x11a)};if(/^(CREATE|ALTER|DROP|TRUNCATE)/i[_0x55d218(0x14a)](_0x3dc5a2))return{'type':'DDL','isSelectOnly':![],'isDangerous':!![],'reason':'DDL\x20statements\x20are\x20blocked\x20from\x20auto-save'};return{'type':'UNKNOWN','isSelectOnly':![],'isDangerous':![]};}function stripStaticAnalysisMarkers(_0x4420bb){const _0xa71780=a239_0x75d061;return _0x4420bb[_0xa71780(0x136)](MYBATIS_DYNAMIC_START_MARKER,'\x20')[_0xa71780(0x136)](MYBATIS_DYNAMIC_END_MARKER,'\x20')['replaceAll'](MYBATIS_INCLUDE_MARKER,'\x20'+UNRESOLVED_SQL_FRAGMENT+'\x20');}function maskSqlTextForBlockedKeywordScan(_0x19d8cb){const _0x2f910e=a239_0x75d061;return _0x19d8cb[_0x2f910e(0x15c)](/'(?:''|\\.|[^'])*'/g,'\x20')[_0x2f910e(0x15c)](/"(?:""|\\.|[^"])*"/g,'\x20')[_0x2f910e(0x15c)](/`(?:``|\\.|[^`])*`/g,'\x20')[_0x2f910e(0x15c)](/--.*$/gm,'\x20')['replace'](/#.*$/gm,'\x20')[_0x2f910e(0x15c)](/\/\*[\s\S]*?\*\//g,'\x20');}function extractTables(_0x3c2d3d){const _0x571e02=a239_0x75d061,_0x1efef7=_0x3c2d3d[_0x571e02(0x15c)](/#\{[^}]*\}/g,'?')[_0x571e02(0x15c)](/\$\{[^}]*\}/g,'?')[_0x571e02(0x15c)](/'[^']*'/g,'\x27\x27')[_0x571e02(0x15c)](/--.*$/gm,'')[_0x571e02(0x15c)](/\/\*[\s\S]*?\*\//g,''),_0x5c85d4=[],_0x1bfffa=_0x1efef7[_0x571e02(0x161)](/FROM\s+([^\s,)(]+)/i);addTable(_0x5c85d4,_0x1bfffa?.[0x1]);for(const _0x3aae8b of _0x1efef7[_0x571e02(0x12a)](/(?:INNER|LEFT|RIGHT|FULL|CROSS)?\s*JOIN\s+([^\s,)(]+)/gi)){addTable(_0x5c85d4,_0x3aae8b[0x1]);}const _0x3e0950=_0x1efef7['match'](/INTO\s+([^\s(]+)/i);addTable(_0x5c85d4,_0x3e0950?.[0x1]);const _0x59eac1=_0x1efef7['match'](/UPDATE\s+([^\s,)(]+)/i);return addTable(_0x5c85d4,_0x59eac1?.[0x1]),_0x5c85d4;}function addTable(_0x4c3233,_0x195ef5){const _0xce8f8b=a239_0x75d061,_0x5c9225=_0x195ef5?.[_0xce8f8b(0x15c)](/[`"]/g,'');_0x5c9225&&_0x5c9225!==UNRESOLVED_SQL_FRAGMENT&&!_0x4c3233[_0xce8f8b(0x121)](_0x5c9225)&&_0x4c3233[_0xce8f8b(0x15e)](_0x5c9225);}function extractParameters(_0x13a774){const _0x7e2144=a239_0x75d061,_0x4ed7a7=new Set();for(const _0x40d912 of _0x13a774[_0x7e2144(0x12a)](/[#$]\{\s*([A-Za-z_][\w.]*)\s*(?=[,}])/g)){if(_0x40d912[0x1])_0x4ed7a7[_0x7e2144(0x12b)](_0x40d912[0x1]);}return Array[_0x7e2144(0x167)](_0x4ed7a7);}export function validateSql(_0x432383){const _0x26277f=a239_0x75d061,_0x82e833=normalizeSqlForStaticAnalysis(_0x432383),_0x472d77=detectNormalizedSqlType(_0x82e833),_0x4720b0=stripStaticAnalysisMarkers(_0x82e833['sql']),_0x550398=_0x82e833[_0x26277f(0x14c)]?[]:extractTables(_0x4720b0),_0x134f13=_0x82e833[_0x26277f(0x14c)]?[]:extractParameters(_0x4720b0);if(_0x472d77[_0x26277f(0x131)])return{'valid':![],'sqlType':_0x472d77,'tables':_0x550398,'parameters':_0x134f13,'message':_0x472d77[_0x26277f(0x169)]||_0x472d77['type']+_0x26277f(0x13e)};if(_0x472d77[_0x26277f(0x133)]===_0x26277f(0x11e))return{'valid':![],'sqlType':_0x472d77,'tables':_0x550398,'parameters':_0x134f13,'message':_0x82e833[_0x26277f(0x14c)]?_0x26277f(0x145)+_0x82e833[_0x26277f(0x14c)]:_0x26277f(0x142)};return{'valid':!![],'sqlType':_0x472d77,'tables':_0x550398,'parameters':_0x134f13,'message':_0x472d77[_0x26277f(0x133)]+_0x26277f(0x127)+(_0x550398['length']?_0x550398[_0x26277f(0x137)](',\x20'):_0x26277f(0x149))+(_0x134f13['length']?'\x20with\x20parameters:\x20'+_0x134f13[_0x26277f(0x137)](',\x20'):'')};}
|