@lovrabet/rabetbase-cli 2.5.1 → 2.5.2-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/api-doc.js +1 -1
- package/lib/api/fetch-model-list.js +1 -1
- package/lib/api/generate-api-file.js +1 -1
- package/lib/api/generate-sdk-config-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/delete.js +1 -1
- package/lib/commands/config/get.js +1 -1
- package/lib/commands/config/index.js +1 -1
- package/lib/commands/config/init.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/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-restore.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/dataset/user-deleted-field-list.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/table-diff-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/deployment/auto-sync.d.ts +3 -11
- package/lib/commands/deployment/auto-sync.js +1 -1
- package/lib/commands/deployment/index.js +1 -1
- package/lib/commands/deployment/sync.js +1 -1
- package/lib/commands/doctor.js +1 -1
- package/lib/commands/file/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/search.js +1 -1
- package/lib/commands/kb/shared.js +1 -1
- package/lib/commands/kb/update.js +1 -1
- package/lib/commands/logs/index.js +1 -1
- package/lib/commands/menu/asset-update.js +1 -1
- package/lib/commands/menu/delete.js +1 -1
- package/lib/commands/menu/external-link-create.js +1 -1
- package/lib/commands/menu/external-link-update.js +1 -1
- package/lib/commands/menu/group-create.js +1 -1
- package/lib/commands/menu/group-update.js +1 -1
- package/lib/commands/menu/index.js +1 -1
- package/lib/commands/menu/list.js +1 -1
- package/lib/commands/menu/move.js +1 -1
- package/lib/commands/menu/regroup-start.js +1 -1
- package/lib/commands/menu/rename.js +1 -1
- package/lib/commands/menu/shared/compare-table.js +1 -1
- package/lib/commands/menu/shared/delete-plan.js +1 -1
- package/lib/commands/menu/shared/facts.js +1 -1
- package/lib/commands/menu/shared/index.js +1 -1
- package/lib/commands/menu/shared/inquirer.js +1 -1
- package/lib/commands/menu/shared/local-pages.js +1 -1
- package/lib/commands/menu/shared/logic.js +1 -1
- package/lib/commands/menu/shared/mutations.js +1 -1
- package/lib/commands/menu/shared/service.js +1 -1
- package/lib/commands/menu/shared/sync-core.js +1 -1
- package/lib/commands/menu/shared/update-core.js +1 -1
- package/lib/commands/menu/shared/valid-url.js +1 -1
- package/lib/commands/menu/sync.js +1 -1
- package/lib/commands/menu/visibility-update.js +1 -1
- 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.js +1 -1
- package/lib/commands/page/custom/detail.js +1 -1
- package/lib/commands/page/custom/list.js +1 -1
- package/lib/commands/page/custom/publish.js +1 -1
- package/lib/commands/page/custom/shared.js +1 -1
- package/lib/commands/page/custom/syntax.js +1 -1
- package/lib/commands/page/custom/template.js +1 -1
- package/lib/commands/page/custom/update.js +1 -1
- package/lib/commands/page/data-list-status.js +1 -1
- package/lib/commands/page/generate-start.js +1 -1
- package/lib/commands/page/generate-status.js +1 -1
- package/lib/commands/page/index.js +1 -1
- package/lib/commands/page/pull.js +1 -1
- package/lib/commands/page/push.js +1 -1
- package/lib/commands/page/relation-audit.js +1 -1
- package/lib/commands/page/restore.js +1 -1
- 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/domain-routing-sync.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/rule/get.js +1 -1
- package/lib/commands/rule/index.js +1 -1
- package/lib/commands/rule/list.js +1 -1
- package/lib/commands/rule/set.js +1 -1
- package/lib/commands/rule/shared.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/domain-config.js +1 -1
- package/lib/config/project-domain-routing.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/region.js +1 -1
- package/lib/constant/risk.js +1 -1
- package/lib/constant/routing-profile.js +1 -1
- package/lib/context/app-resolver.d.ts +0 -2
- 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 +0 -2
- package/lib/core/api-client.js +1 -1
- package/lib/core/bff/config.js +1 -1
- package/lib/core/bff/file-system.js +1 -1
- package/lib/core/bff/hash.js +1 -1
- package/lib/core/bff/lock.js +1 -1
- package/lib/core/bff/utils.js +1 -1
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/kb-search-client.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/supported-flags.d.ts +2 -0
- package/lib/framework/supported-flags.js +1 -0
- package/lib/framework/types.d.ts +2 -4
- 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/generated/official-routing.js +1 -1
- package/lib/generated/routing-contract.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/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 +3 -3
- package/skills/rabetbase/references/rabetbase-deployment-sync.md +16 -44
- package/skills/rabetbase.manifest.json +3 -3
- package/lib/config/deployment-sync.d.ts +0 -10
- package/lib/config/deployment-sync.js +0 -1
package/lib/core/bff/lock.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x442aa0,_0x60e436){const _0x55545e=a239_0x2f2a,_0x1e831f=_0x442aa0();while(!![]){try{const _0x502208=parseInt(_0x55545e(0x193))/0x1+-parseInt(_0x55545e(0x195))/0x2+parseInt(_0x55545e(0x194))/0x3*(parseInt(_0x55545e(0x19a))/0x4)+parseInt(_0x55545e(0x19e))/0x5+parseInt(_0x55545e(0x196))/0x6*(parseInt(_0x55545e(0x1a4))/0x7)+parseInt(_0x55545e(0x19c))/0x8+-parseInt(_0x55545e(0x1a2))/0x9;if(_0x502208===_0x60e436)break;else _0x1e831f['push'](_0x1e831f['shift']());}catch(_0x3a58c0){_0x1e831f['push'](_0x1e831f['shift']());}}}(a239_0x292e,0xd0af6));import{mkdir,readFile,writeFile}from'node:fs/promises';import{dirname}from'node:path';function a239_0x2f2a(_0x4118d5,_0x1ca355){_0x4118d5=_0x4118d5-0x190;const _0x292ec0=a239_0x292e();let _0x2f2aa6=_0x292ec0[_0x4118d5];return _0x2f2aa6;}export function createEmptyBffLock(){return{'apps':{}};}function a239_0x292e(){const _0xac1342=['Check\x20.rabetbase/bff.lock.json\x20or\x20operate\x20from\x20the\x20correct\x20project\x20directory.','77KTsTbQ','\x22\x20vs\x20lock\x20\x22','parse','apps','functions','1630781ZIekzK','3SYrzoP','2425746pBEYpt','368652FtZEEX','ENOENT','lastSync','Failed\x20to\x20read\x20Backend\x20Function\x20lock\x20file:\x20','3314780gCInwU',':\x20scriptsRoot\x20mismatch\x20—\x20','3123904PKLHfI','utf8','6314035hIkEIT','stringify','scriptsRoot','object','24488874brYHox'];a239_0x292e=function(){return _0xac1342;};return a239_0x292e();}export function ensureLockScope(_0x3ae10a,_0x5c29c3,_0x538370,_0x198143){const _0x3f95f1=a239_0x2f2a,_0x16411b={'apps':_0x3ae10a[_0x3f95f1(0x191)]&&typeof _0x3ae10a['apps']==='object'?_0x3ae10a[_0x3f95f1(0x191)]:{}};let _0x396c5b=_0x16411b[_0x3f95f1(0x191)][_0x5c29c3];if(!_0x396c5b)return _0x396c5b={'scriptsRoot':_0x538370,'lastSync':'','functions':{}},_0x16411b[_0x3f95f1(0x191)][_0x5c29c3]=_0x396c5b,{'lockData':_0x16411b,'appLock':_0x396c5b};if(!_0x396c5b[_0x3f95f1(0x1a0)])_0x396c5b[_0x3f95f1(0x1a0)]=_0x538370;else{if(_0x396c5b[_0x3f95f1(0x1a0)]!==_0x538370)throw new Error(_0x198143+_0x3f95f1(0x19b)+('current\x20\x22'+_0x538370+_0x3f95f1(0x1a5)+_0x396c5b[_0x3f95f1(0x1a0)]+'\x22.\x20')+_0x3f95f1(0x1a3));}return!_0x396c5b[_0x3f95f1(0x192)]&&(_0x396c5b[_0x3f95f1(0x192)]={}),!_0x396c5b[_0x3f95f1(0x198)]&&(_0x396c5b[_0x3f95f1(0x198)]=''),{'lockData':_0x16411b,'appLock':_0x396c5b};}export async function readBffLockFile(_0x141654){const _0x15495f=a239_0x2f2a;try{const _0x891249=await readFile(_0x141654,_0x15495f(0x19d)),_0x4c26c1=JSON[_0x15495f(0x190)](_0x891249);return{'apps':_0x4c26c1[_0x15495f(0x191)]&&typeof _0x4c26c1['apps']===_0x15495f(0x1a1)?_0x4c26c1[_0x15495f(0x191)]:{}};}catch(_0x47b7e6){if(_0x47b7e6['code']===_0x15495f(0x197))return null;throw new Error(_0x15495f(0x199)+String(_0x47b7e6));}}export async function writeBffLockFile(_0x2dfa4a,_0x408012){const _0x775ae1=a239_0x2f2a;await mkdir(dirname(_0x2dfa4a),{'recursive':!![]}),await writeFile(_0x2dfa4a,JSON[_0x775ae1(0x19f)](_0x408012,null,0x2),'utf8');}
|
package/lib/core/bff/utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a241_0x298f48=a241_0x144d;(function(_0x4ec950,_0x3978dd){const _0x4eae35=a241_0x144d,_0x3f7ea8=_0x4ec950();while(!![]){try{const _0x20fb41=-parseInt(_0x4eae35(0x1e4))/0x1+-parseInt(_0x4eae35(0x1e3))/0x2+parseInt(_0x4eae35(0x1e8))/0x3*(-parseInt(_0x4eae35(0x1dc))/0x4)+parseInt(_0x4eae35(0x1ea))/0x5+-parseInt(_0x4eae35(0x1e0))/0x6*(-parseInt(_0x4eae35(0x1e1))/0x7)+parseInt(_0x4eae35(0x1e7))/0x8+parseInt(_0x4eae35(0x1dd))/0x9;if(_0x20fb41===_0x3978dd)break;else _0x3f7ea8['push'](_0x3f7ea8['shift']());}catch(_0x4829ca){_0x3f7ea8['push'](_0x3f7ea8['shift']());}}}(a241_0x29fb,0x6185b));export const DEFAULT_BFF_SCRIPT_DESCRIPTION=a241_0x298f48(0x1ed);const LEGACY_DEFAULT_BFF_SCRIPT_DESCRIPTION='TODO:\x20add\x20script\x20description';function a241_0x29fb(){const _0x320367=['before','some','1557424KUGgSJ','1871811BYlhIw','functionNode','1478490ViEkmz','trim','datasetCode','TODO:\x20补充脚本功能描述','toLowerCase','map','test','toUpperCase','split','remoteId','replace','4rQjvxX','7266960KFTdfX','match','operationType','3243012TJAuRq','7jgQVSo','values','760958diWlGM','434451jpblDJ'];a241_0x29fb=function(){return _0x320367;};return a241_0x29fb();}function a241_0x144d(_0x4ae9cb,_0x2c81f0){_0x4ae9cb=_0x4ae9cb-0x1dc;const _0x29fbd3=a241_0x29fb();let _0x144d8c=_0x29fbd3[_0x4ae9cb];return _0x144d8c;}export function snakeToCamel(_0x111c0a){const _0x516285=a241_0x298f48;return _0x111c0a[_0x516285(0x1ee)]()[_0x516285(0x1f4)](/_([a-z])/g,(_0x5e6b07,_0x504093)=>_0x504093[_0x516285(0x1f1)]());}export function findHookLocationByRemoteId(_0x3ba765,_0xc5a77e){const _0x348133=a241_0x298f48;if(!_0xc5a77e)return undefined;for(const _0x39ce44 of Object[_0x348133(0x1e2)](_0x3ba765)){if(_0x39ce44[_0x348133(0x1f3)]===_0xc5a77e&&_0x39ce44[_0x348133(0x1ec)]&&_0x39ce44['operationType']&&_0x39ce44[_0x348133(0x1e9)])return{'datasetCode':_0x39ce44[_0x348133(0x1ec)],'operationType':_0x39ce44[_0x348133(0x1df)],'functionNode':_0x39ce44[_0x348133(0x1e9)]};}return undefined;}export function extractScriptDescription(_0x558306){const _0x384a6c=a241_0x298f48,_0x42ff0e=_0x558306[_0x384a6c(0x1de)](/^\s*\/\*\*([\s\S]*?)\*\//);if(!_0x42ff0e?.[0x1])return undefined;const _0x207983=_0x42ff0e[0x1],_0x53f629=_0x94ad81=>{const _0x5447e4=_0x384a6c,_0x35c43c=_0x94ad81?.[_0x5447e4(0x1eb)]();if(!_0x35c43c||_0x35c43c===DEFAULT_BFF_SCRIPT_DESCRIPTION||_0x35c43c===LEGACY_DEFAULT_BFF_SCRIPT_DESCRIPTION)return undefined;return _0x35c43c;},_0x7959c0=_0x207983['match'](/^\s*\*\s*\[\s*脚本描述\s*]\s*(.+)$/m);if(_0x7959c0)return _0x53f629(_0x7959c0[0x1]);const _0x1f6637=_0x207983[_0x384a6c(0x1f2)](/\r?\n/)[_0x384a6c(0x1ef)](_0x4cc769=>_0x4cc769[_0x384a6c(0x1f4)](/^\s*\*\s?/,'')['trim']()),_0x4287bb=_0x1f6637[_0x384a6c(0x1e6)](_0x14abee=>/^\[\s*脚本类型\s*]\s*\S+/[_0x384a6c(0x1f0)](_0x14abee))&&_0x1f6637[_0x384a6c(0x1e6)](_0x19a122=>/^\[\s*脚本名称\s*]\s*\S+/['test'](_0x19a122));if(!_0x4287bb)return undefined;for(const _0x551471 of _0x1f6637){if(!_0x551471||_0x551471['startsWith']('@')||/^\[[^\]]+]\s*/[_0x384a6c(0x1f0)](_0x551471))continue;return _0x53f629(_0x551471);}return undefined;}export function isValidBffFunctionName(_0x34f9e){const _0x19ef7d=a241_0x298f48;return/^[A-Za-z_$][A-Za-z0-9_$]*$/[_0x19ef7d(0x1f0)](_0x34f9e);}export function normalizeHookFunctionNode(_0x3a74a6){const _0x4b404f=a241_0x298f48;if(!_0x3a74a6)return undefined;const _0x5b6860=_0x3a74a6[_0x4b404f(0x1eb)]()[_0x4b404f(0x1ee)]();if(_0x5b6860===_0x4b404f(0x1e5)||_0x5b6860==='after')return _0x5b6860;return undefined;}
|
package/lib/core/db-resolver.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x3f8140,_0x41af08){const _0x131372=a242_0x557d,_0x284153=_0x3f8140();while(!![]){try{const _0x447568=parseInt(_0x131372(0x121))/0x1*(-parseInt(_0x131372(0x115))/0x2)+-parseInt(_0x131372(0x125))/0x3*(parseInt(_0x131372(0x104))/0x4)+-parseInt(_0x131372(0x10b))/0x5+parseInt(_0x131372(0x110))/0x6*(parseInt(_0x131372(0x10a))/0x7)+-parseInt(_0x131372(0x113))/0x8*(-parseInt(_0x131372(0x105))/0x9)+-parseInt(_0x131372(0x112))/0xa+parseInt(_0x131372(0x118))/0xb*(parseInt(_0x131372(0x11c))/0xc);if(_0x447568===_0x41af08)break;else _0x284153['push'](_0x284153['shift']());}catch(_0x3c7d04){_0x284153['push'](_0x284153['shift']());}}}(a242_0x504f,0xc6754));import{listDatasets}from'../core/api-client.js';const cache=new Map();export async function listDatabases(_0x35322e){const _0x355a42=a242_0x557d;if(cache[_0x355a42(0x10d)](_0x35322e))return cache[_0x355a42(0x122)](_0x35322e);const _0x55dc3c=await listDatasets(_0x35322e),_0x188d34=new Map();for(const _0x20d2fa of _0x55dc3c){const _0x5104c7=_0x20d2fa[_0x355a42(0x123)];_0x5104c7?.[_0x355a42(0x107)]!=null&&_0x188d34[_0x355a42(0x10e)](_0x5104c7['dbId'],_0x5104c7['dbName']??_0x355a42(0x126)+_0x5104c7[_0x355a42(0x107)]);}const _0x389a3c=[..._0x188d34[_0x355a42(0x111)]()][_0x355a42(0x11e)](([_0xf72e97,_0x8ce7de])=>({'dbId':_0xf72e97,'dbName':_0x8ce7de}));return cache['set'](_0x35322e,_0x389a3c),_0x389a3c;}function a242_0x557d(_0x105f58,_0x4b4f7e){_0x105f58=_0x105f58-0x104;const _0x504f27=a242_0x504f();let _0x557d71=_0x504f27[_0x105f58];return _0x557d71;}function a242_0x504f(){const _0x13ea1e=['6824VDLvti','Multiple\x20databases\x20found.\x20Specify\x20one\x20with\x20--db:\x20','19160eJcVHz','isNaN','.\x20Be\x20more\x20specific.','12992386XjeFGY','find','\x22\x20under\x20app\x20\x22','dbName','36aYIWyL','\x22.\x20Make\x20sure\x20datasets\x20have\x20been\x20created.','map','toLowerCase','includes','125Ivyrid','get','dbtableConfig','\x22\x20matches\x20multiple\x20databases:\x20','270861XOQusY','db-','44WxoDMU','5013YRduUj','join','dbId','filter','No\x20linked\x20databases\x20found\x20under\x20app\x20\x22','2321221qwovaj','4813620jGIjmv','No\x20database\x20matching\x20\x22','has','set','length','12DVMHQr','entries','7154400ZBYyjm'];a242_0x504f=function(){return _0x13ea1e;};return a242_0x504f();}export async function resolveDb(_0x44f4d2,_0x1ba494){const _0x36c41a=a242_0x557d,_0x5a4829=await listDatabases(_0x44f4d2);if(_0x5a4829[_0x36c41a(0x10f)]===0x0)return{'resolved':[],'error':_0x36c41a(0x109)+_0x44f4d2+_0x36c41a(0x11d)};if(!_0x1ba494)return{'resolved':_0x5a4829};const _0x3c4eec=Number(_0x1ba494);if(!Number[_0x36c41a(0x116)](_0x3c4eec)){const _0x1f9ba1=_0x5a4829[_0x36c41a(0x119)](_0x175f3b=>_0x175f3b[_0x36c41a(0x107)]===_0x3c4eec);if(_0x1f9ba1)return{'resolved':[_0x1f9ba1]};}const _0x2bf747=_0x1ba494[_0x36c41a(0x11f)](),_0x3404ba=_0x5a4829[_0x36c41a(0x108)](_0x475e3e=>_0x475e3e['dbName'][_0x36c41a(0x11f)]()[_0x36c41a(0x120)](_0x2bf747));if(_0x3404ba['length']>0x0)return{'resolved':_0x3404ba};const _0x2035ef=_0x5a4829[_0x36c41a(0x11e)](_0x2ec7cf=>_0x2ec7cf[_0x36c41a(0x11b)]+'\x20('+_0x2ec7cf['dbId']+')')[_0x36c41a(0x106)](',\x20');return{'resolved':[],'error':_0x36c41a(0x10c)+_0x1ba494+_0x36c41a(0x11a)+_0x44f4d2+'\x22.\x20Available:\x20'+_0x2035ef+'.\x20If\x20this\x20db\x20belongs\x20to\x20another\x20app,\x20rerun\x20with\x20--appcode\x20<appCode>.'};}export async function resolveOneDb(_0x2bb926,_0x25346f){const _0x5d020a=a242_0x557d,{resolved:_0x29775d,error:_0x4ebc11}=await resolveDb(_0x2bb926,_0x25346f);if(_0x4ebc11)return{'db':null,'error':_0x4ebc11};if(_0x29775d[_0x5d020a(0x10f)]===0x1)return{'db':_0x29775d[0x0]};if(!_0x25346f){const _0x28e889=_0x29775d['map'](_0x2e7a95=>_0x2e7a95[_0x5d020a(0x11b)]+'\x20('+_0x2e7a95[_0x5d020a(0x107)]+')')[_0x5d020a(0x106)](',\x20');return{'db':null,'error':_0x5d020a(0x114)+_0x28e889};}const _0x2324e8=_0x29775d['map'](_0x311312=>_0x311312['dbName']+'\x20('+_0x311312[_0x5d020a(0x107)]+')')[_0x5d020a(0x106)](',\x20');return{'db':null,'error':'\x22'+_0x25346f+_0x5d020a(0x124)+_0x2324e8+_0x5d020a(0x117)};}export async function getDbName(_0x25e9b6,_0x853dde){const _0x56f295=a242_0x557d,_0xba7c01=await listDatabases(_0x25e9b6);return _0xba7c01['find'](_0x928131=>_0x928131[_0x56f295(0x107)]===_0x853dde)?.['dbName'];}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a243_0x2804f1=a243_0x343e;(function(_0x595866,_0x475618){const _0x125d27=a243_0x343e,_0x443560=_0x595866();while(!![]){try{const _0x5aea8a=-parseInt(_0x125d27(0x123))/0x1+parseInt(_0x125d27(0x11e))/0x2*(parseInt(_0x125d27(0x122))/0x3)+-parseInt(_0x125d27(0x127))/0x4+parseInt(_0x125d27(0x119))/0x5+-parseInt(_0x125d27(0x107))/0x6*(-parseInt(_0x125d27(0x11c))/0x7)+-parseInt(_0x125d27(0x121))/0x8+-parseInt(_0x125d27(0x12b))/0x9*(-parseInt(_0x125d27(0x11b))/0xa);if(_0x5aea8a===_0x475618)break;else _0x443560['push'](_0x443560['shift']());}catch(_0x53faa9){_0x443560['push'](_0x443560['shift']());}}}(a243_0x248a,0x6007f));import{getKbDomain}from'../constant/domain.js';import{CliError,CliErrors}from'../errors.js';const RESPONSE_KEYS=[a243_0x2804f1(0x116),'profile',a243_0x2804f1(0x144),a243_0x2804f1(0x109),a243_0x2804f1(0x12a),'timingsMs'],HIT_KEYS=['documentId',a243_0x2804f1(0x129),'chunkId',a243_0x2804f1(0x10e),'title',a243_0x2804f1(0x113),'tags','rank',a243_0x2804f1(0x128),'finalScore','scoreKind'];export async function searchDevelopmentKnowledge(_0x38cc8e){const _0x109329=a243_0x2804f1,_0x189e64=_0x38cc8e[_0x109329(0x125)][_0x109329(0x10d)](),_0x24860b=_0x38cc8e[_0x109329(0x111)][_0x109329(0x10d)]();if(!_0x189e64)throw CliErrors[_0x109329(0x13b)](_0x109329(0x13d));if(!_0x38cc8e['cookie'][_0x109329(0x10d)]())throw CliErrors['authRequired']();if(!_0x24860b)throw CliErrors[_0x109329(0x13b)](_0x109329(0x134));validateTopK(_0x38cc8e[_0x109329(0x136)]);const _0x478882=getKbDomain()+_0x109329(0xfb);let _0x347cbe;try{_0x347cbe=await fetch(_0x478882,{'method':_0x109329(0x138),'headers':{'Content-Type':_0x109329(0x130),'Cookie':_0x38cc8e[_0x109329(0x140)],'X-Invoke-Source':_0x109329(0x10b)},'body':JSON[_0x109329(0x133)]({'appCode':_0x189e64,'query':_0x24860b,..._0x38cc8e[_0x109329(0x136)]!==undefined?{'topK':_0x38cc8e[_0x109329(0x136)]}:{}}),'signal':_0x38cc8e[_0x109329(0x106)]});}catch(_0x418d7d){if(_0x418d7d instanceof CliError)throw _0x418d7d;if(_0x418d7d instanceof Error&&_0x418d7d[_0x109329(0xfd)]===_0x109329(0x12e))throw _0x418d7d;throw CliErrors[_0x109329(0x12f)](_0x109329(0x10a));}if(!hasNoStore(_0x347cbe[_0x109329(0x117)]))throw CliErrors[_0x109329(0x114)]('SmartCode\x20knowledge\x20search\x20response\x20is\x20missing\x20Cache-Control:\x20no-store.');if(_0x347cbe['status']===0x191)throw CliErrors[_0x109329(0x11f)]();if(!_0x347cbe['ok'])throw CliErrors['apiError']('SmartCode\x20knowledge\x20search\x20failed\x20(HTTP\x20'+_0x347cbe[_0x109329(0x141)]+').');if(!(_0x347cbe[_0x109329(0x117)][_0x109329(0x112)]('content-type')??'')[_0x109329(0x143)]()[_0x109329(0x11a)](_0x109329(0x130)))throw CliErrors[_0x109329(0x114)](_0x109329(0x105));let _0x380c40;try{_0x380c40=await _0x347cbe[_0x109329(0x146)]();}catch{throw CliErrors[_0x109329(0x114)](_0x109329(0x139));}return parseDevelopmentSearchResponse(readEnvelopeData(_0x380c40),_0x38cc8e[_0x109329(0x136)]);}function a243_0x343e(_0x64651e,_0x916730){_0x64651e=_0x64651e-0xfb;const _0x248af9=a243_0x248a();let _0x343ecc=_0x248af9[_0x64651e];return _0x343ecc;}function readEnvelopeData(_0x87c438){const _0x550f45=a243_0x2804f1,_0x2e2558=requireRecord(_0x87c438,_0x550f45(0x148));if(_0x2e2558[_0x550f45(0x13e)]===![])throw CliErrors['apiError']('SmartCode\x20knowledge\x20search\x20failed.');if(!('data'in _0x2e2558))throw invalidContract('response\x20envelope');return _0x2e2558[_0x550f45(0x115)];}function validateTopK(_0x4d544e){const _0x1563a9=a243_0x2804f1;if(_0x4d544e!==undefined&&(!Number[_0x1563a9(0x137)](_0x4d544e)||_0x4d544e<0x1||_0x4d544e>0x32))throw CliErrors[_0x1563a9(0x13b)](_0x1563a9(0x131));}function hasNoStore(_0x15a3d9){const _0x1c2569=a243_0x2804f1;return(_0x15a3d9[_0x1c2569(0x112)](_0x1c2569(0x118))??'')[_0x1c2569(0x132)](',')[_0x1c2569(0x100)](_0x11b509=>_0x11b509[_0x1c2569(0x10d)]()['toLowerCase']()===_0x1c2569(0x12c));}function parseDevelopmentSearchResponse(_0x31b036,_0x5d4e1e){const _0x544fb9=a243_0x2804f1,_0x444181=requireExactRecord(_0x31b036,RESPONSE_KEYS,_0x544fb9(0xfe));if(_0x444181['schemaVersion']!==0x2||_0x444181['profile']!==_0x544fb9(0x142))throw invalidContract(_0x544fb9(0x12d));if(!Array[_0x544fb9(0x13f)](_0x444181[_0x544fb9(0x109)])||_0x444181[_0x544fb9(0x109)][_0x544fb9(0x110)]>(_0x5d4e1e??0x32))throw invalidContract(_0x544fb9(0x109));if(typeof _0x444181[_0x544fb9(0x12a)]!==_0x544fb9(0x10f)||!/^sha256:[0-9a-f]{64}$/['test'](_0x444181[_0x544fb9(0x12a)]))throw invalidContract(_0x544fb9(0x12a));const _0x4dacbb=requireRecord(_0x444181['timingsMs'],_0x544fb9(0x124)),_0x43fe4c={};for(const [_0x20576e,_0x3c9a41]of Object[_0x544fb9(0x108)](_0x4dacbb)){if(!/^[A-Za-z][A-Za-z0-9]*$/[_0x544fb9(0x104)](_0x20576e)||typeof _0x3c9a41!=='number'||!Number[_0x544fb9(0x145)](_0x3c9a41)||_0x3c9a41<0x0)throw invalidContract(_0x544fb9(0x124));_0x43fe4c[_0x20576e]=_0x3c9a41;}const _0x47892d=_0x444181[_0x544fb9(0x109)]['map']((_0x587f4b,_0x3674b2)=>parseHit(_0x587f4b,_0x3674b2));if(!Number[_0x544fb9(0x137)](_0x444181[_0x544fb9(0x144)])||_0x444181[_0x544fb9(0x144)]!==_0x47892d[_0x544fb9(0x110)])throw invalidContract('total');return{'schemaVersion':_0x444181[_0x544fb9(0x116)],'profile':_0x444181['profile'],'total':_0x444181['total'],'strategyFingerprint':_0x444181['strategyFingerprint'],'timingsMs':_0x43fe4c,'hits':_0x47892d};}function parseHit(_0xbda8e3,_0x1826be){const _0x152d93=a243_0x2804f1,_0x19d4ee=requireExactRecord(_0xbda8e3,HIT_KEYS,_0x152d93(0xff)+_0x1826be+']'),_0x1f6c12=_0x458ee4=>{const _0x924b7a=_0x19d4ee[_0x458ee4];if(typeof _0x924b7a!=='string'||!_0x924b7a)throw invalidContract(_0x458ee4);return _0x924b7a;};if(!Number[_0x152d93(0x137)](_0x19d4ee[_0x152d93(0x129)])||_0x19d4ee[_0x152d93(0x129)]<0x1)throw invalidContract('revision');if(_0x19d4ee[_0x152d93(0x10e)]!==_0x152d93(0x147)&&_0x19d4ee[_0x152d93(0x10e)]!=='company')throw invalidContract(_0x152d93(0x10e));if(typeof _0x19d4ee[_0x152d93(0x120)]!==_0x152d93(0x10f)||typeof _0x19d4ee[_0x152d93(0x113)]!==_0x152d93(0x10f))throw invalidContract(_0x152d93(0x113));if(!Array[_0x152d93(0x13f)](_0x19d4ee[_0x152d93(0x101)])||_0x19d4ee[_0x152d93(0x101)][_0x152d93(0x100)](_0x4a8ad3=>typeof _0x4a8ad3!==_0x152d93(0x10f)))throw invalidContract('tags');if(!Number[_0x152d93(0x137)](_0x19d4ee[_0x152d93(0x13a)])||_0x19d4ee[_0x152d93(0x13a)]!==_0x1826be+0x1)throw invalidContract(_0x152d93(0x13a));if(!isFiniteNumber(_0x19d4ee[_0x152d93(0x128)])||!isFiniteNumber(_0x19d4ee['finalScore']))throw invalidContract('score');return{'documentId':_0x1f6c12(_0x152d93(0x126)),'revision':_0x19d4ee[_0x152d93(0x129)],'chunkId':_0x1f6c12(_0x152d93(0xfc)),'scope':_0x19d4ee[_0x152d93(0x10e)],'title':_0x19d4ee[_0x152d93(0x120)],'text':_0x19d4ee['text'],'tags':[..._0x19d4ee['tags']],'rank':_0x19d4ee[_0x152d93(0x13a)],'rawScore':_0x19d4ee['rawScore'],'finalScore':_0x19d4ee[_0x152d93(0x103)],'scoreKind':_0x1f6c12(_0x152d93(0x10c))};}function requireExactRecord(_0x12708e,_0x3e0cf7,_0x182e2a){const _0x4aa141=a243_0x2804f1,_0x224712=requireRecord(_0x12708e,_0x182e2a),_0x526c4e=Object['keys'](_0x224712)['sort'](),_0x1615b3=[..._0x3e0cf7][_0x4aa141(0x102)]();if(_0x526c4e[_0x4aa141(0x110)]!==_0x1615b3[_0x4aa141(0x110)]||_0x526c4e[_0x4aa141(0x100)]((_0x480822,_0xec275a)=>_0x480822!==_0x1615b3[_0xec275a]))throw invalidContract(_0x182e2a);return _0x224712;}function requireRecord(_0x3ca3f5,_0x480d49){const _0x45ffb3=a243_0x2804f1;if(!_0x3ca3f5||typeof _0x3ca3f5!==_0x45ffb3(0x11d)||Array[_0x45ffb3(0x13f)](_0x3ca3f5))throw invalidContract(_0x480d49);return _0x3ca3f5;}function a243_0x248a(){const _0x31dfb2=['Knowledge\x20search\x20query\x20is\x20required.','\x20contract.','topK','isSafeInteger','POST','SmartCode\x20knowledge\x20search\x20returned\x20invalid\x20JSON.','rank','validation','number','Knowledge\x20search\x20appCode\x20is\x20required.','success','isArray','cookie','status','development','toLowerCase','total','isFinite','json','public','response\x20envelope','/smartapi/knowledge/company-public/search','chunkId','name','response','hits[','some','tags','sort','finalScore','test','SmartCode\x20knowledge\x20search\x20returned\x20a\x20non-JSON\x20content\x20type.','signal','1110720xKdCty','entries','hits','SmartCode\x20knowledge\x20search\x20request\x20failed.','cli:rabetbase','scoreKind','trim','scope','string','length','query','get','text','apiError','data','schemaVersion','headers','cache-control','3145840xBgmRh','includes','10jqJaKS','7nMQBYY','object','9092rZMVBG','authRequired','title','2670880EKFdFs','369hUiYby','495009pwAprd','timingsMs','appCode','documentId','785564vZyUyd','rawScore','revision','strategyFingerprint','406413gGJNXk','no-store','profile','AbortError','networkError','application/json','Knowledge\x20search\x20topK\x20must\x20be\x20an\x20integer\x20from\x201\x20through\x2050.','split','stringify'];a243_0x248a=function(){return _0x31dfb2;};return a243_0x248a();}function isFiniteNumber(_0x33be1f){const _0x6ed0a0=a243_0x2804f1;return typeof _0x33be1f===_0x6ed0a0(0x13c)&&Number[_0x6ed0a0(0x145)](_0x33be1f);}function invalidContract(_0x1072d7){const _0x226b03=a243_0x2804f1;return CliErrors[_0x226b03(0x114)]('SmartCode\x20knowledge\x20search\x20returned\x20an\x20invalid\x20'+_0x1072d7+_0x226b03(0x135));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a244_0x1e1362=a244_0x231c;(function(_0x2058ee,_0x2adcac){const _0x19d14b=a244_0x231c,_0x285af1=_0x2058ee();while(!![]){try{const _0x2c2d4b=parseInt(_0x19d14b(0x1da))/0x1+-parseInt(_0x19d14b(0x1d9))/0x2*(-parseInt(_0x19d14b(0x1d5))/0x3)+-parseInt(_0x19d14b(0x1d1))/0x4*(parseInt(_0x19d14b(0x1e0))/0x5)+-parseInt(_0x19d14b(0x1d7))/0x6*(-parseInt(_0x19d14b(0x1dc))/0x7)+-parseInt(_0x19d14b(0x1d2))/0x8+parseInt(_0x19d14b(0x1d6))/0x9*(parseInt(_0x19d14b(0x1df))/0xa)+-parseInt(_0x19d14b(0x1d0))/0xb*(-parseInt(_0x19d14b(0x1d4))/0xc);if(_0x2c2d4b===_0x2adcac)break;else _0x285af1['push'](_0x285af1['shift']());}catch(_0x5ac4ec){_0x285af1['push'](_0x285af1['shift']());}}}(a244_0x6abe,0x4bcb2));function a244_0x231c(_0xb09c39,_0x409d51){_0xb09c39=_0xb09c39-0x1cd;const _0x6abe64=a244_0x6abe();let _0x231c8e=_0x6abe64[_0xb09c39];return _0x231c8e;}import{constants}from'node:fs';import{access,mkdir}from'node:fs/promises';import{dirname,join,resolve}from'node:path';function a244_0x6abe(){const _0x47e369=['63606IUzuhB','4166370rsjKkR','138SztHQg','toUpperCase','8jIewzi','52291wyGdri','.rabetbase','86226dRfZCP','cwd','F_OK','10mZjdsF','2055yOqatj','.json','page.lock.json','page','1117589PcCNPb','5492VtDDMC','881512XKBGVx','appPagesDir','12imSwjA'];a244_0x6abe=function(){return _0x47e369;};return a244_0x6abe();}export function loadPageProjectConfig(_0xf143b3,_0x19baf2=process[a244_0x1e1362(0x1dd)]()){const _0x3723ad=a244_0x1e1362,_0x22b048=resolve(_0x19baf2),_0x100e74=join(_0x22b048,_0x3723ad(0x1db),_0x3723ad(0x1cf));return{'projectRoot':_0x22b048,'pagesBaseDir':_0x100e74,'appPagesDir':join(_0x100e74,_0xf143b3),'lockFilePath':join(_0x22b048,_0x3723ad(0x1db),_0x3723ad(0x1ce))};}export function buildPageFileName(_0x4d50b6,_0x57fc41){const _0x1cc2a9=a244_0x1e1362;return _0x4d50b6+'-'+String(_0x57fc41)[_0x1cc2a9(0x1d8)]()+_0x1cc2a9(0x1cd);}export function resolvePageFilePath(_0x92de28,_0x2fedd8,_0x2c3ea1){const _0x238277=a244_0x1e1362;return join(_0x92de28[_0x238277(0x1d3)],buildPageFileName(_0x2fedd8,_0x2c3ea1));}export async function ensureParentDirectory(_0x109bad){await mkdir(dirname(_0x109bad),{'recursive':!![]});}export async function fileExists(_0x2b41a8){const _0x169720=a244_0x1e1362;try{return await access(_0x2b41a8,constants[_0x169720(0x1de)]),!![];}catch{return![];}}
|
package/lib/core/page/hash.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x4c7c9a,_0x19f36a){const _0x47cc48=a245_0x5930,_0xa2c374=_0x4c7c9a();while(!![]){try{const _0x4e7082=-parseInt(_0x47cc48(0x12c))/0x1*(parseInt(_0x47cc48(0x132))/0x2)+parseInt(_0x47cc48(0x13a))/0x3+-parseInt(_0x47cc48(0x139))/0x4+-parseInt(_0x47cc48(0x131))/0x5+parseInt(_0x47cc48(0x133))/0x6*(-parseInt(_0x47cc48(0x138))/0x7)+-parseInt(_0x47cc48(0x137))/0x8+-parseInt(_0x47cc48(0x12a))/0x9*(-parseInt(_0x47cc48(0x136))/0xa);if(_0x4e7082===_0x19f36a)break;else _0xa2c374['push'](_0xa2c374['shift']());}catch(_0x11364f){_0xa2c374['push'](_0xa2c374['shift']());}}}(a245_0x22cc,0xd16ae));import a245_0x56354e from'node:crypto';function a245_0x5930(_0x56f198,_0x9b4994){_0x56f198=_0x56f198-0x12a;const _0x22cc0f=a245_0x22cc();let _0x5930e7=_0x22cc0f[_0x56f198];return _0x5930e7;}import{readFile}from'node:fs/promises';function a245_0x22cc(){const _0x149da8=['54zHCXRs','stringify','1985zMiJBK','parse','digest','createHash','md5','7321695qJNiFZ','92yZvpoo','27942FuArUS','utf8','hex','8930640ZXpJnV','10219736xlKcMB','2338spFRTv','2294028IuvEop','1384353SZWolH'];a245_0x22cc=function(){return _0x149da8;};return a245_0x22cc();}export function serializePageSchemaForFile(_0x390df8){const _0x41c872=a245_0x5930;return JSON[_0x41c872(0x12b)](JSON[_0x41c872(0x12d)](_0x390df8),null,0x2)+'\x0a';}export function computePageContentHash(_0x391bb9){const _0x209471=a245_0x5930;return a245_0x56354e[_0x209471(0x12f)](_0x209471(0x130))['update'](_0x391bb9)[_0x209471(0x12e)](_0x209471(0x135));}export function computeSerializedSchemaHash(_0x142753){return computePageContentHash(serializePageSchemaForFile(_0x142753));}export async function computePageFileHash(_0x2cd8d2){const _0x6eb577=a245_0x5930,_0x477653=await readFile(_0x2cd8d2,_0x6eb577(0x134));return computePageContentHash(_0x477653);}
|
package/lib/core/page/lock.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x558a8c,_0x4576ae){const _0x2b1ac5=a246_0x13c7,_0x1a11ea=_0x558a8c();while(!![]){try{const _0x18ecb6=-parseInt(_0x2b1ac5(0x19e))/0x1*(-parseInt(_0x2b1ac5(0x19d))/0x2)+parseInt(_0x2b1ac5(0x197))/0x3+-parseInt(_0x2b1ac5(0x196))/0x4+-parseInt(_0x2b1ac5(0x19b))/0x5*(parseInt(_0x2b1ac5(0x191))/0x6)+-parseInt(_0x2b1ac5(0x18d))/0x7*(-parseInt(_0x2b1ac5(0x198))/0x8)+-parseInt(_0x2b1ac5(0x190))/0x9*(-parseInt(_0x2b1ac5(0x18f))/0xa)+-parseInt(_0x2b1ac5(0x192))/0xb*(parseInt(_0x2b1ac5(0x195))/0xc);if(_0x18ecb6===_0x4576ae)break;else _0x1a11ea['push'](_0x1a11ea['shift']());}catch(_0x4afd01){_0x1a11ea['push'](_0x1a11ea['shift']());}}}(a246_0x4c60,0xa85ee));import{mkdir,readFile,writeFile}from'node:fs/promises';import{dirname}from'node:path';export function createEmptyPageLock(){return{'apps':{}};}export function ensurePageLockScope(_0xc05464,_0x486b50){const _0x484d62=a246_0x13c7,_0x4b845b={'apps':_0xc05464[_0x484d62(0x18e)]&&typeof _0xc05464[_0x484d62(0x18e)]===_0x484d62(0x19a)?_0xc05464[_0x484d62(0x18e)]:{}};let _0x176130=_0x4b845b[_0x484d62(0x18e)][_0x486b50];if(!_0x176130)return _0x176130={'lastSync':'','pages':{}},_0x4b845b[_0x484d62(0x18e)][_0x486b50]=_0x176130,{'lockData':_0x4b845b,'appLock':_0x176130};return!_0x176130[_0x484d62(0x193)]&&(_0x176130['lastSync']=''),(!_0x176130[_0x484d62(0x19f)]||typeof _0x176130[_0x484d62(0x19f)]!==_0x484d62(0x19a))&&(_0x176130[_0x484d62(0x19f)]={}),{'lockData':_0x4b845b,'appLock':_0x176130};}export async function readPageLockFile(_0x250791){const _0x46ef8f=a246_0x13c7;try{const _0x3237ba=await readFile(_0x250791,_0x46ef8f(0x199)),_0x1f4a49=JSON[_0x46ef8f(0x1a0)](_0x3237ba);return{'apps':_0x1f4a49[_0x46ef8f(0x18e)]&&typeof _0x1f4a49[_0x46ef8f(0x18e)]===_0x46ef8f(0x19a)?_0x1f4a49['apps']:{}};}catch(_0x2f9e60){if(_0x2f9e60['code']===_0x46ef8f(0x18c))return null;throw new Error(_0x46ef8f(0x19c)+String(_0x2f9e60));}}function a246_0x13c7(_0x58ee5e,_0x48f335){_0x58ee5e=_0x58ee5e-0x18c;const _0x4c60c4=a246_0x4c60();let _0x13c786=_0x4c60c4[_0x58ee5e];return _0x13c786;}export async function writePageLockFile(_0x1579d1,_0x3025db){const _0x3cf81c=a246_0x13c7;await mkdir(dirname(_0x1579d1),{'recursive':!![]}),await writeFile(_0x1579d1,JSON[_0x3cf81c(0x194)](_0x3025db,null,0x2),_0x3cf81c(0x199));}function a246_0x4c60(){const _0x24b4a4=['2140MoyEZl','Failed\x20to\x20read\x20page\x20lock\x20file:\x20','8396vBsoYp','163hQlTvc','pages','parse','ENOENT','1021594ejdsth','apps','8580430dfGZjp','9apgtdD','1794bzOLgQ','11vuqeyX','lastSync','stringify','5471436GDlOMv','3503800xgVKxJ','70308PdlOQv','32odYEdF','utf8','object'];a246_0x4c60=function(){return _0x24b4a4;};return a246_0x4c60();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0x48eb6a,_0x22e5c5){const _0x54326b=a249_0xb228,_0x445038=_0x48eb6a();while(!![]){try{const _0x2701c1=-parseInt(_0x54326b(0x1a3))/0x1*(-parseInt(_0x54326b(0x195))/0x2)+-parseInt(_0x54326b(0x1c0))/0x3*(-parseInt(_0x54326b(0x1ce))/0x4)+parseInt(_0x54326b(0x1d1))/0x5*(-parseInt(_0x54326b(0x1df))/0x6)+-parseInt(_0x54326b(0x1b1))/0x7*(parseInt(_0x54326b(0x1a1))/0x8)+parseInt(_0x54326b(0x1a5))/0x9+-parseInt(_0x54326b(0x19a))/0xa+parseInt(_0x54326b(0x1b2))/0xb*(parseInt(_0x54326b(0x1a6))/0xc);if(_0x2701c1===_0x22e5c5)break;else _0x445038['push'](_0x445038['shift']());}catch(_0x1ce2f7){_0x445038['push'](_0x445038['shift']());}}}(a249_0x30e7,0xb9c1d));import{MYBATIS_DYNAMIC_END_MARKER,MYBATIS_DYNAMIC_START_MARKER,MYBATIS_INCLUDE_MARKER,normalizeSqlForStaticAnalysis}from'./sql-validator.js';export function auditSqlJoinIndexes(_0x1ae72e,_0x3f6879){const _0x5d643d=a249_0xb228,_0x5bdc2c=[],_0x45f8ce=normalizeSqlForStaticAnalysis(_0x1ae72e),_0x5cb9f2=(_0x45f8ce[_0x5d643d(0x1bd)]?[]:extractJoinFacts(_0x45f8ce['sql']))[_0x5d643d(0x1c1)](_0x16bd94=>{const _0x1e90b3=_0x5d643d;if(_0x16bd94['unsupportedPredicate']||_0x16bd94[_0x1e90b3(0x19d)][_0x1e90b3(0x1ab)]===0x0)return _0x5bdc2c[_0x1e90b3(0x1cf)]({'code':_0x1e90b3(0x1d0),'table':_0x16bd94[_0x1e90b3(0x1d7)],'alias':_0x16bd94[_0x1e90b3(0x1da)],'columns':_0x16bd94[_0x1e90b3(0x19d)],'reason':_0x16bd94[_0x1e90b3(0x1b4)]??_0x1e90b3(0x1af)}),{'table':_0x16bd94[_0x1e90b3(0x1d7)],'alias':_0x16bd94[_0x1e90b3(0x1da)],'columns':_0x16bd94['columns'],'status':_0x1e90b3(0x199)};const _0x3c5843=resolveTableMetadata(_0x3f6879,_0x16bd94[_0x1e90b3(0x1d7)]),_0x169ab=(_0x3c5843?.[_0x1e90b3(0x1ae)]??[])[_0x1e90b3(0x1c1)](_0x3757a8=>({'index':_0x3757a8,'matchedPrefix':findEqualityPrefix(_0x3757a8[_0x1e90b3(0x19d)],_0x16bd94[_0x1e90b3(0x19d)])}))[_0x1e90b3(0x1b5)](_0x11c26b=>_0x11c26b[_0x1e90b3(0x1c9)][_0x1e90b3(0x1ab)]>0x0),_0x1967e3=_0x169ab[_0x1e90b3(0x1b0)]((_0x362981,_0x5ea1ab)=>!_0x362981||_0x5ea1ab[_0x1e90b3(0x1c9)]['length']>_0x362981[_0x1e90b3(0x1c9)][_0x1e90b3(0x1ab)]?_0x5ea1ab:_0x362981,_0x169ab[0x0]);if(_0x1967e3)return{'table':_0x16bd94[_0x1e90b3(0x1d7)],'alias':_0x16bd94[_0x1e90b3(0x1da)],'columns':_0x16bd94[_0x1e90b3(0x19d)],'status':'covered','matchedIndex':{..._0x1967e3[_0x1e90b3(0x1a2)],'matchedPrefix':_0x1967e3['matchedPrefix']}};const _0x21fbd4=_0x3c5843?.[_0x1e90b3(0x1ae)][_0x1e90b3(0x1b5)](_0x34ab2c=>_0x34ab2c[_0x1e90b3(0x19d)][_0x1e90b3(0x1c8)](_0x2df60b=>_0x16bd94[_0x1e90b3(0x19d)][_0x1e90b3(0x1c8)](_0x369a3d=>columnNamesMatch(_0x2df60b,_0x369a3d))))??[];if(_0x21fbd4['length']>0x0)return _0x5bdc2c[_0x1e90b3(0x1cf)]({'code':'JOIN_INDEX_NOT_USABLE','table':_0x16bd94['table'],'alias':_0x16bd94['alias'],'columns':_0x16bd94[_0x1e90b3(0x19d)],'reason':'Relevant\x20columns\x20do\x20not\x20form\x20a\x20complete\x20leftmost\x20index\x20prefix.'}),{'table':_0x16bd94[_0x1e90b3(0x1d7)],'alias':_0x16bd94['alias'],'columns':_0x16bd94['columns'],'status':_0x1e90b3(0x194),'candidateIndexes':_0x21fbd4};if(_0x3c5843&&_0x3c5843[_0x1e90b3(0x1dd)]!==![]&&_0x3c5843[_0x1e90b3(0x1ae)][_0x1e90b3(0x1ab)]>0x0&&_0x16bd94['columns']['length']>0x0)return _0x5bdc2c[_0x1e90b3(0x1cf)]({'code':_0x1e90b3(0x197),'table':_0x16bd94[_0x1e90b3(0x1d7)],'alias':_0x16bd94[_0x1e90b3(0x1da)],'columns':_0x16bd94[_0x1e90b3(0x19d)],'reason':_0x1e90b3(0x1cc)}),{'table':_0x16bd94['table'],'alias':_0x16bd94['alias'],'columns':_0x16bd94['columns'],'status':'warning'};return _0x5bdc2c['push']({'code':_0x1e90b3(0x193),'table':_0x16bd94[_0x1e90b3(0x1d7)],'alias':_0x16bd94[_0x1e90b3(0x1da)],'columns':_0x16bd94[_0x1e90b3(0x19d)],'reason':_0x3c5843?_0x1e90b3(0x1ba):_0x1e90b3(0x1d5)}),{'table':_0x16bd94[_0x1e90b3(0x1d7)],'alias':_0x16bd94[_0x1e90b3(0x1da)],'columns':_0x16bd94[_0x1e90b3(0x19d)],'status':_0x1e90b3(0x199)};});return{'checked':_0x5cb9f2[_0x5d643d(0x1ab)]>0x0,'joins':_0x5cb9f2,'warnings':_0x5bdc2c};}function extractJoinFacts(_0x3db170){const _0x9c5649=a249_0xb228,_0x4357a8=maskNestedQueries(stripSqlNoise(_0x3db170)),_0x4306ed=maskQuotedIdentifiers(_0x4357a8),_0x45e5d5=[],_0x82654a=new Set(),_0x3fac5c=/\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 _0xdcf0e6 of _0x4357a8[_0x9c5649(0x1aa)](_0x3fac5c)){const _0x3ac268=_0xdcf0e6[_0x9c5649(0x1a2)]??0x0,_0x4ceb4a=_0xdcf0e6[0x0][_0x9c5649(0x1b3)](/\bJOIN\b/i),_0x5d8ab4=_0x3ac268+Math[_0x9c5649(0x1d6)](0x0,_0x4ceb4a);if(!/^JOIN\b/i['test'](_0x4306ed[_0x9c5649(0x1ad)](_0x5d8ab4)))continue;_0x82654a[_0x9c5649(0x1b6)](_0x5d8ab4);const _0x377f89=normalizeIdentifier(_0xdcf0e6[0x1]||_0x9c5649(0x1c6)),_0x38bbdb=normalizeIdentifier(_0xdcf0e6[0x2]??''),_0x439d85=normalizeIdentifier(_0xdcf0e6[0x3]||_0x38bbdb[_0x9c5649(0x1a0)]('.')['at'](-0x1)||_0x38bbdb),_0x570f8b=[],_0x113538=_0x38bbdb===_0x9c5649(0x1c4);let _0x17d7b9=_0x377f89===_0x9c5649(0x198)||_0x377f89==='full'||_0x113538,_0x2f10ac=_0x17d7b9?_0x113538?_0x9c5649(0x1c5):_0x377f89[_0x9c5649(0x1be)]()+_0x9c5649(0x1db):undefined;const _0x6bf4f3=stripOuterParentheses(_0xdcf0e6[0x4]??''),_0xeca0f5=_0x6bf4f3[_0x9c5649(0x1bc)](MYBATIS_DYNAMIC_START_MARKER)||_0x6bf4f3[_0x9c5649(0x1bc)](MYBATIS_DYNAMIC_END_MARKER),_0xe69f7f=_0x6bf4f3[_0x9c5649(0x1bc)](MYBATIS_INCLUDE_MARKER);_0xeca0f5&&(_0x17d7b9=!![],_0x2f10ac??=_0x9c5649(0x1c3));_0xe69f7f&&(_0x17d7b9=!![],_0x2f10ac??='MyBatis\x20<include>\x20JOIN\x20fragments\x20cannot\x20be\x20expanded\x20statically.');const _0x570cce=_0x6bf4f3[_0x9c5649(0x1a4)](MYBATIS_DYNAMIC_START_MARKER,'\x20')[_0x9c5649(0x1a4)](MYBATIS_DYNAMIC_END_MARKER,'\x20')[_0x9c5649(0x1a4)](MYBATIS_INCLUDE_MARKER,'\x20');hasTopLevelKeyword(_0x570cce,'OR')&&(_0x17d7b9=!![],_0x2f10ac??=_0x9c5649(0x19f));for(const _0x2fd723 of splitTopLevelAnd(_0x570cce)){const _0x3dee18=stripOuterParentheses(_0x2fd723);if(hasTopLevelKeyword(_0x3dee18,'OR')){_0x17d7b9=!![],_0x2f10ac??=_0x9c5649(0x19f);continue;}const _0x2c83f7=splitEquality(_0x3dee18);if(!_0x2c83f7){containsColumnReference(_0x2fd723,_0x439d85)&&(_0x17d7b9=!![]);continue;}const _0xb28ea7=parseDirectColumnReference(_0x2c83f7[0x0],_0x439d85),_0x5c32e1=parseDirectColumnReference(_0x2c83f7[0x1],_0x439d85),_0x79a08d=containsColumnReference(_0x2c83f7[0x0],_0x439d85),_0x20127a=containsColumnReference(_0x2c83f7[0x1],_0x439d85),_0x3d7524=_0xb28ea7&&!_0x20127a?_0xb28ea7:_0x5c32e1&&!_0x79a08d?_0x5c32e1:null;if(_0x3d7524&&!_0x570f8b[_0x9c5649(0x1bc)](_0x3d7524))_0x570f8b['push'](_0x3d7524);else!_0x3d7524&&containsColumnReference(_0x2fd723,_0x439d85)&&(_0x17d7b9=!![]);}_0x45e5d5['push']({'table':_0x38bbdb,'alias':_0x439d85,'columns':_0x570f8b,'unsupportedPredicate':_0x17d7b9,'unsupportedReason':_0x2f10ac,'containsUnresolvedInclude':_0xe69f7f,'position':_0x5d8ab4});}for(const _0x7eca42 of _0x4306ed[_0x9c5649(0x1aa)](/\bJOIN\b/gi)){const _0x11b989=_0x7eca42['index']??0x0;if(_0x82654a['has'](_0x11b989))continue;const _0x3d540c=/^\s+([`"\w$.]+)(?:\s+(?:AS\s+)?([`"\w$]+))?/['exec'](_0x4357a8[_0x9c5649(0x1ad)](_0x11b989+_0x7eca42[0x0][_0x9c5649(0x1ab)])),_0x5dfffd=normalizeIdentifier(_0x3d540c?.[0x1]||'unknown'),_0x20741f=normalizeIdentifier(_0x3d540c?.[0x2]||''),_0x3eaf31=isSqlClauseKeyword(_0x20741f)?_0x5dfffd[_0x9c5649(0x1a0)]('.')['at'](-0x1)||_0x5dfffd:_0x20741f||_0x5dfffd[_0x9c5649(0x1a0)]('.')['at'](-0x1)||_0x5dfffd;_0x45e5d5[_0x9c5649(0x1cf)]({'table':_0x5dfffd,'alias':_0x3eaf31,'columns':[],'unsupportedPredicate':!![],'unsupportedReason':_0x9c5649(0x1e1),'position':_0x11b989});}const _0x7d7f5a=_0x4306ed[_0x9c5649(0x1ac)](MYBATIS_INCLUDE_MARKER);return _0x7d7f5a>=0x0&&!_0x45e5d5[_0x9c5649(0x1c8)](_0x32041a=>_0x32041a[_0x9c5649(0x1c2)])&&_0x45e5d5[_0x9c5649(0x1cf)]({'table':'unknown','alias':_0x9c5649(0x1a7),'columns':[],'unsupportedPredicate':!![],'unsupportedReason':_0x9c5649(0x1bb),'containsUnresolvedInclude':!![],'position':_0x7d7f5a}),_0x45e5d5[_0x9c5649(0x19e)]((_0x243004,_0x1ff4a3)=>_0x243004[_0x9c5649(0x1d9)]-_0x1ff4a3[_0x9c5649(0x1d9)]);}function stripSqlNoise(_0x30ee55){const _0xea125b=a249_0xb228,_0x1bc5b9=Array[_0xea125b(0x19c)](_0x30ee55),_0x4a0f28=(_0x9048ec,_0x52827e)=>{for(let _0x1c5bd6=_0x9048ec;_0x1c5bd6<_0x52827e;_0x1c5bd6+=0x1){_0x1bc5b9[_0x1c5bd6]!=='\x0a'&&_0x1bc5b9[_0x1c5bd6]!=='\x0d'&&(_0x1bc5b9[_0x1c5bd6]='\x20');}};for(let _0xe5f13d=0x0;_0xe5f13d<_0x1bc5b9[_0xea125b(0x1ab)];_0xe5f13d+=0x1){const _0xf54824=_0x1bc5b9[_0xe5f13d],_0x4c6feb=_0x1bc5b9[_0xe5f13d+0x1];if(_0xf54824==='\x27'||_0xf54824==='\x22'||_0xf54824==='`'){const _0x246dba=_0xf54824,_0x545c89=_0xe5f13d;_0xe5f13d+=0x1;while(_0xe5f13d<_0x1bc5b9['length']){if(_0x1bc5b9[_0xe5f13d]==='\x5c'&&_0xe5f13d+0x1<_0x1bc5b9[_0xea125b(0x1ab)]){_0xe5f13d+=0x2;continue;}if(_0x1bc5b9[_0xe5f13d]!==_0x246dba){_0xe5f13d+=0x1;continue;}if(_0x1bc5b9[_0xe5f13d+0x1]===_0x246dba){_0xe5f13d+=0x2;continue;}break;}if(_0x246dba==='\x27')_0x4a0f28(_0x545c89,Math['min'](_0xe5f13d+0x1,_0x1bc5b9['length']));continue;}if(_0xf54824==='-'&&_0x4c6feb==='-'){const _0x3e0b05=_0xe5f13d;while(_0xe5f13d<_0x1bc5b9[_0xea125b(0x1ab)]&&_0x1bc5b9[_0xe5f13d]!=='\x0a')_0xe5f13d+=0x1;_0x4a0f28(_0x3e0b05,_0xe5f13d);continue;}if(_0xf54824==='/'&&_0x4c6feb==='*'){const _0x29677f=_0xe5f13d;_0xe5f13d+=0x2;while(_0xe5f13d<_0x1bc5b9[_0xea125b(0x1ab)]&&!(_0x1bc5b9[_0xe5f13d]==='*'&&_0x1bc5b9[_0xe5f13d+0x1]==='/')){_0xe5f13d+=0x1;}_0xe5f13d=Math['min'](_0xe5f13d+0x1,_0x1bc5b9[_0xea125b(0x1ab)]-0x1),_0x4a0f28(_0x29677f,_0xe5f13d+0x1);continue;}if(_0xf54824==='#'&&_0x4c6feb!=='{'){const _0xd65124=_0xe5f13d;while(_0xe5f13d<_0x1bc5b9[_0xea125b(0x1ab)]&&_0x1bc5b9[_0xe5f13d]!=='\x0a')_0xe5f13d+=0x1;_0x4a0f28(_0xd65124,_0xe5f13d);continue;}if((_0xf54824==='#'||_0xf54824==='$')&&_0x4c6feb==='{'){const _0x13490a=_0xe5f13d;_0xe5f13d+=0x2;while(_0xe5f13d<_0x1bc5b9[_0xea125b(0x1ab)]&&_0x1bc5b9[_0xe5f13d]!=='}')_0xe5f13d+=0x1;_0x4a0f28(_0x13490a,Math[_0xea125b(0x1c7)](_0xe5f13d+0x1,_0x1bc5b9[_0xea125b(0x1ab)]));}}return _0x1bc5b9[_0xea125b(0x1d2)]('');}function maskQuotedIdentifiers(_0x3b4653){const _0x23270a=a249_0xb228,_0xbaa479=Array[_0x23270a(0x19c)](_0x3b4653);for(let _0x44652c=0x0;_0x44652c<_0xbaa479[_0x23270a(0x1ab)];_0x44652c+=0x1){const _0x76eea1=_0xbaa479[_0x44652c];if(_0x76eea1!=='\x22'&&_0x76eea1!=='`')continue;_0x44652c+=0x1;while(_0x44652c<_0xbaa479['length']){if(_0xbaa479[_0x44652c]===_0x76eea1){if(_0xbaa479[_0x44652c+0x1]===_0x76eea1){_0xbaa479[_0x44652c]='\x20',_0xbaa479[_0x44652c+0x1]='\x20',_0x44652c+=0x2;continue;}break;}_0xbaa479[_0x44652c]='\x20',_0x44652c+=0x1;}}return _0xbaa479[_0x23270a(0x1d2)]('');}function maskNestedQueries(_0x2d1704){const _0x11dc7d=a249_0xb228,_0x4c7633=Array[_0x11dc7d(0x19c)](_0x2d1704);for(let _0x54aada=0x0;_0x54aada<_0x4c7633['length'];_0x54aada+=0x1){if(_0x4c7633[_0x54aada]!=='(')continue;const _0x3face7=_0x2d1704[_0x11dc7d(0x1ad)](_0x54aada+0x1);if(!/^\s*(?:SELECT|WITH)\b/i[_0x11dc7d(0x1b9)](_0x3face7))continue;let _0x309516=0x1,_0x3c92af=_0x54aada+0x1;for(;_0x3c92af<_0x4c7633[_0x11dc7d(0x1ab)]&&_0x309516>0x0;_0x3c92af+=0x1){if(_0x4c7633[_0x3c92af]==='(')_0x309516+=0x1;if(_0x4c7633[_0x3c92af]===')')_0x309516-=0x1;}if(_0x309516!==0x0)continue;for(let _0x101687=_0x54aada;_0x101687<_0x3c92af;_0x101687+=0x1){_0x4c7633[_0x101687]='\x20';}const _0x363a0e=_0x11dc7d(0x1c4);for(let _0x256e5d=0x0;_0x256e5d<_0x363a0e[_0x11dc7d(0x1ab)]&&_0x54aada+_0x256e5d<_0x3c92af;_0x256e5d+=0x1){_0x4c7633[_0x54aada+_0x256e5d]=_0x363a0e[_0x256e5d];}_0x54aada=_0x3c92af-0x1;}return _0x4c7633[_0x11dc7d(0x1d2)]('');}function splitTopLevelAnd(_0x43d581){const _0x2fc231=a249_0xb228,_0x355cc7=[];let _0x3f49d1=0x0,_0x8456d3=0x0;for(let _0x5c08d0=0x0;_0x5c08d0<_0x43d581[_0x2fc231(0x1ab)];_0x5c08d0+=0x1){const _0x208c5c=_0x43d581[_0x5c08d0];if(_0x208c5c==='(')_0x3f49d1+=0x1;if(_0x208c5c===')')_0x3f49d1=Math[_0x2fc231(0x1d6)](0x0,_0x3f49d1-0x1);_0x3f49d1===0x0&&_0x43d581[_0x2fc231(0x1ad)](_0x5c08d0)[_0x2fc231(0x1d8)](/^AND\b/i)&&(_0x5c08d0===0x0||/\s/[_0x2fc231(0x1b9)](_0x43d581[_0x5c08d0-0x1]??''))&&(_0x355cc7[_0x2fc231(0x1cf)](_0x43d581[_0x2fc231(0x1ad)](_0x8456d3,_0x5c08d0)[_0x2fc231(0x1bf)]()),_0x5c08d0+=0x2,_0x8456d3=_0x5c08d0+0x1);}const _0x2e4a75=_0x43d581['slice'](_0x8456d3)[_0x2fc231(0x1bf)]();if(_0x2e4a75)_0x355cc7['push'](_0x2e4a75);return _0x355cc7;}function hasTopLevelKeyword(_0x4a2c4c,_0x213e3d){const _0x1039c5=a249_0xb228;let _0x31e426=0x0;for(let _0x27b8a1=0x0;_0x27b8a1<_0x4a2c4c[_0x1039c5(0x1ab)];_0x27b8a1+=0x1){const _0x560963=_0x4a2c4c[_0x27b8a1];if(_0x560963==='(')_0x31e426+=0x1;if(_0x560963===')')_0x31e426=Math[_0x1039c5(0x1d6)](0x0,_0x31e426-0x1);if(_0x31e426!==0x0)continue;const _0x4c50=_0x4a2c4c[_0x1039c5(0x1ad)](_0x27b8a1,_0x27b8a1+_0x213e3d[_0x1039c5(0x1ab)]),_0x330171=_0x4a2c4c[_0x27b8a1-0x1]??'\x20',_0x3942c0=_0x4a2c4c[_0x27b8a1+_0x213e3d[_0x1039c5(0x1ab)]]??'\x20';if(_0x4c50[_0x1039c5(0x1be)]()===_0x213e3d[_0x1039c5(0x1be)]()&&!/[\w$]/[_0x1039c5(0x1b9)](_0x330171)&&!/[\w$]/['test'](_0x3942c0))return!![];}return![];}function splitEquality(_0x2807e8){const _0x47d753=a249_0xb228,_0x3e1087=stripOuterParentheses(_0x2807e8);let _0x1a02e5=0x0,_0x16e091;for(let _0x2ad4ed=0x0;_0x2ad4ed<_0x3e1087['length'];_0x2ad4ed+=0x1){const _0x417c49=_0x3e1087[_0x2ad4ed];if(_0x417c49==='(')_0x1a02e5+=0x1;if(_0x417c49===')')_0x1a02e5=Math[_0x47d753(0x1d6)](0x0,_0x1a02e5-0x1);const _0x13877e=_0x3e1087[_0x2ad4ed-0x1]??'',_0x1eeac9=_0x3e1087[_0x2ad4ed+0x1]??'';if(_0x417c49==='='&&_0x1a02e5===0x0&&!/[!<>=:]/[_0x47d753(0x1b9)](_0x13877e)&&_0x1eeac9!=='='){if(_0x16e091!==undefined)return null;_0x16e091=_0x2ad4ed;}}return _0x16e091===undefined?null:[_0x3e1087[_0x47d753(0x1ad)](0x0,_0x16e091)[_0x47d753(0x1bf)](),_0x3e1087[_0x47d753(0x1ad)](_0x16e091+0x1)[_0x47d753(0x1bf)]()];}function parseDirectColumnReference(_0x50ab0f,_0x9e80b){const _0x3c6ba7=a249_0xb228,_0x5604c3=/^([`"]?[\w$]+[`"]?)\s*\.\s*([`"]?[\w$]+[`"]?)$/[_0x3c6ba7(0x1a8)](stripOuterParentheses(_0x50ab0f));if(!_0x5604c3)return null;if(normalizeIdentifier(_0x5604c3[0x1]??'')!==normalizeIdentifier(_0x9e80b))return null;return normalizeIdentifier(_0x5604c3[0x2]??'');}function containsColumnReference(_0x11a2f2,_0x1b42b2){const _0x42c046=a249_0xb228,_0x5c410e=_0x11a2f2[_0x42c046(0x1cb)](/[`"]/g,''),_0x18f2b9=_0x1b42b2['replace'](/[.*+?^${}()|[\]\\]/g,_0x42c046(0x196));return new RegExp('(?:^|[^\x5cw$])'+_0x18f2b9+'\x5cs*\x5c.\x5cs*[\x5cw$]+','i')[_0x42c046(0x1b9)](_0x5c410e);}function a249_0x30e7(){const _0x3badfb=['add','natural','has','test','The\x20dataset\x20returned\x20no\x20distinguishable\x20index\x20metadata.','MyBatis\x20<include>\x20fragments\x20cannot\x20be\x20expanded\x20for\x20JOIN\x20auditing.','includes','error','toUpperCase','trim','168501VgzGaO','map','containsUnresolvedInclude','MyBatis\x20dynamic\x20JOIN\x20predicates\x20cannot\x20be\x20audited\x20deterministically.','__sq__','Derived-table\x20JOIN\x20targets\x20are\x20not\x20supported.','INNER','min','some','matchedPrefix','full','replace','No\x20reported\x20index\x20contains\x20the\x20JOIN\x20access\x20columns.','startsWith','52LlHpHM','push','JOIN_PREDICATE_UNSUPPORTED','85BbpDfS','join','left','inner','No\x20dataset\x20metadata\x20matched\x20the\x20JOIN\x20table.','max','table','match','position','alias','\x20JOIN\x20direction\x20is\x20not\x20supported\x20by\x20static\x20index\x20auditing.','toLowerCase','metadataAvailable','cross','397746KLGgbw','where','Only\x20explicit\x20table\x20JOIN\x20clauses\x20with\x20an\x20ON\x20predicate\x20are\x20supported.','endsWith','INDEX_METADATA_UNAVAILABLE','warning','1916312MOiUWb','\x5c$&','JOIN_INDEX_MISSING','right','unavailable','3308840SBwblj','using','from','columns','sort','OR-connected\x20JOIN\x20predicates\x20are\x20not\x20supported.','split','14632SZNkVO','index','1SGBtqB','replaceAll','6245658fpyANd','12uMNqGn','unknown','exec','tableName','matchAll','length','indexOf','slice','indexes','Not\x20every\x20JOIN\x20target\x20predicate\x20could\x20be\x20audited\x20safely.','reduce','3878jjQyBO','9346359jDwgXw','search','unsupportedReason','filter'];a249_0x30e7=function(){return _0x3badfb;};return a249_0x30e7();}function findEqualityPrefix(_0x25d85b,_0x199c1e){const _0x391038=a249_0xb228,_0x3ca184=new Set(_0x199c1e[_0x391038(0x1c1)](normalizeIdentifier)),_0x4c4683=[];for(const _0x362bb2 of _0x25d85b){if(!_0x3ca184['has'](normalizeIdentifier(_0x362bb2)))break;_0x4c4683[_0x391038(0x1cf)](_0x362bb2);}return _0x4c4683;}function resolveTableMetadata(_0x16f718,_0x28a7ee){const _0x5d27e2=a249_0xb228,_0x429bef=normalizeIdentifier(_0x28a7ee),_0x2f890c=_0x16f718[_0x5d27e2(0x1b5)](_0x4f6f73=>normalizeIdentifier(_0x4f6f73[_0x5d27e2(0x1a9)])===_0x429bef);if(_0x2f890c[_0x5d27e2(0x1ab)]===0x1)return _0x2f890c[0x0];const _0x4c64c6=_0x429bef[_0x5d27e2(0x1bc)]('.'),_0x29bde3=_0x429bef[_0x5d27e2(0x1a0)]('.')['at'](-0x1),_0x2f6fdc=_0x16f718[_0x5d27e2(0x1b5)](_0x438dbb=>{const _0x581771=_0x5d27e2,_0x255205=normalizeIdentifier(_0x438dbb[_0x581771(0x1a9)]);if(_0x4c64c6&&_0x255205[_0x581771(0x1bc)]('.'))return![];return _0x255205[_0x581771(0x1a0)]('.')['at'](-0x1)===_0x29bde3;});return _0x2f6fdc[_0x5d27e2(0x1ab)]===0x1?_0x2f6fdc[0x0]:undefined;}function columnNamesMatch(_0x21a38b,_0x55b146){return normalizeIdentifier(_0x21a38b)===normalizeIdentifier(_0x55b146);}function normalizeIdentifier(_0x557ed7){const _0x1e5451=a249_0xb228;return _0x557ed7[_0x1e5451(0x1cb)](/[`"]/g,'')[_0x1e5451(0x1bf)]()[_0x1e5451(0x1dc)]();}function isSqlClauseKeyword(_0x3ce0b2){const _0x536903=a249_0xb228;return new Set(['on',_0x536903(0x19b),_0x536903(0x1e0),'join',_0x536903(0x1d4),_0x536903(0x1d3),_0x536903(0x198),_0x536903(0x1ca),_0x536903(0x1de),_0x536903(0x1b7)])[_0x536903(0x1b8)](_0x3ce0b2);}function a249_0xb228(_0x453cff,_0x61c91e){_0x453cff=_0x453cff-0x192;const _0x30e759=a249_0x30e7();let _0xb228ab=_0x30e759[_0x453cff];return _0xb228ab;}function stripOuterParentheses(_0x2b7867){const _0x588ed8=a249_0xb228;let _0x54b66e=_0x2b7867['trim']();while(_0x54b66e[_0x588ed8(0x1cd)]('(')&&_0x54b66e[_0x588ed8(0x192)](')')){let _0x4fa5e2=0x0,_0x3999ea=!![];for(let _0x5a6623=0x0;_0x5a6623<_0x54b66e[_0x588ed8(0x1ab)];_0x5a6623+=0x1){if(_0x54b66e[_0x5a6623]==='(')_0x4fa5e2+=0x1;if(_0x54b66e[_0x5a6623]===')')_0x4fa5e2-=0x1;if(_0x4fa5e2===0x0&&_0x5a6623<_0x54b66e[_0x588ed8(0x1ab)]-0x1){_0x3999ea=![];break;}}if(!_0x3999ea||_0x4fa5e2!==0x0)break;_0x54b66e=_0x54b66e[_0x588ed8(0x1ad)](0x1,-0x1)[_0x588ed8(0x1bf)]();}return _0x54b66e;}
|
|
1
|
+
(function(_0x12c3db,_0x35ff63){const _0x38e956=a248_0x56d4,_0x1fb464=_0x12c3db();while(!![]){try{const _0x452a27=-parseInt(_0x38e956(0x9a))/0x1+parseInt(_0x38e956(0xab))/0x2+-parseInt(_0x38e956(0x8d))/0x3*(parseInt(_0x38e956(0xad))/0x4)+-parseInt(_0x38e956(0x78))/0x5*(parseInt(_0x38e956(0x90))/0x6)+parseInt(_0x38e956(0xa2))/0x7+-parseInt(_0x38e956(0x7e))/0x8+parseInt(_0x38e956(0x70))/0x9;if(_0x452a27===_0x35ff63)break;else _0x1fb464['push'](_0x1fb464['shift']());}catch(_0x15d810){_0x1fb464['push'](_0x1fb464['shift']());}}}(a248_0x57f2,0x60d56));import{MYBATIS_DYNAMIC_END_MARKER,MYBATIS_DYNAMIC_START_MARKER,MYBATIS_INCLUDE_MARKER,normalizeSqlForStaticAnalysis}from'./sql-validator.js';export function auditSqlJoinIndexes(_0x42abd6,_0x378818){const _0x268b33=a248_0x56d4,_0x50ad6c=[],_0x3d1e13=normalizeSqlForStaticAnalysis(_0x42abd6),_0x28ddd2=(_0x3d1e13['error']?[]:extractJoinFacts(_0x3d1e13[_0x268b33(0x97)]))['map'](_0x4df884=>{const _0x37d2a6=_0x268b33;if(_0x4df884['unsupportedPredicate']||_0x4df884[_0x37d2a6(0x98)][_0x37d2a6(0x9b)]===0x0)return _0x50ad6c['push']({'code':_0x37d2a6(0x81),'table':_0x4df884[_0x37d2a6(0x7a)],'alias':_0x4df884[_0x37d2a6(0x95)],'columns':_0x4df884[_0x37d2a6(0x98)],'reason':_0x4df884[_0x37d2a6(0xa6)]??_0x37d2a6(0x71)}),{'table':_0x4df884[_0x37d2a6(0x7a)],'alias':_0x4df884[_0x37d2a6(0x95)],'columns':_0x4df884[_0x37d2a6(0x98)],'status':_0x37d2a6(0xaf)};const _0x33bb13=resolveTableMetadata(_0x378818,_0x4df884[_0x37d2a6(0x7a)]),_0x163d3c=(_0x33bb13?.[_0x37d2a6(0x6e)]??[])[_0x37d2a6(0x7d)](_0x1c35c0=>({'index':_0x1c35c0,'matchedPrefix':findEqualityPrefix(_0x1c35c0[_0x37d2a6(0x98)],_0x4df884[_0x37d2a6(0x98)])}))[_0x37d2a6(0x77)](_0x2c52ef=>_0x2c52ef[_0x37d2a6(0x7b)][_0x37d2a6(0x9b)]>0x0),_0x4620fe=_0x163d3c['reduce']((_0x540d77,_0x240110)=>!_0x540d77||_0x240110['matchedPrefix'][_0x37d2a6(0x9b)]>_0x540d77['matchedPrefix'][_0x37d2a6(0x9b)]?_0x240110:_0x540d77,_0x163d3c[0x0]);if(_0x4620fe)return{'table':_0x4df884[_0x37d2a6(0x7a)],'alias':_0x4df884[_0x37d2a6(0x95)],'columns':_0x4df884[_0x37d2a6(0x98)],'status':_0x37d2a6(0xa5),'matchedIndex':{..._0x4620fe[_0x37d2a6(0x79)],'matchedPrefix':_0x4620fe[_0x37d2a6(0x7b)]}};const _0x11581c=_0x33bb13?.[_0x37d2a6(0x6e)][_0x37d2a6(0x77)](_0x32bf03=>_0x32bf03[_0x37d2a6(0x98)][_0x37d2a6(0x8a)](_0x2eab4c=>_0x4df884['columns'][_0x37d2a6(0x8a)](_0x30c610=>columnNamesMatch(_0x2eab4c,_0x30c610))))??[];if(_0x11581c['length']>0x0)return _0x50ad6c['push']({'code':_0x37d2a6(0x67),'table':_0x4df884[_0x37d2a6(0x7a)],'alias':_0x4df884[_0x37d2a6(0x95)],'columns':_0x4df884['columns'],'reason':_0x37d2a6(0x99)}),{'table':_0x4df884['table'],'alias':_0x4df884['alias'],'columns':_0x4df884[_0x37d2a6(0x98)],'status':_0x37d2a6(0xb0),'candidateIndexes':_0x11581c};if(_0x33bb13&&_0x33bb13[_0x37d2a6(0x89)]!==![]&&_0x33bb13['indexes'][_0x37d2a6(0x9b)]>0x0&&_0x4df884[_0x37d2a6(0x98)]['length']>0x0)return _0x50ad6c[_0x37d2a6(0x7c)]({'code':_0x37d2a6(0xae),'table':_0x4df884[_0x37d2a6(0x7a)],'alias':_0x4df884[_0x37d2a6(0x95)],'columns':_0x4df884[_0x37d2a6(0x98)],'reason':_0x37d2a6(0xa3)}),{'table':_0x4df884[_0x37d2a6(0x7a)],'alias':_0x4df884[_0x37d2a6(0x95)],'columns':_0x4df884[_0x37d2a6(0x98)],'status':_0x37d2a6(0xb0)};return _0x50ad6c[_0x37d2a6(0x7c)]({'code':_0x37d2a6(0xaa),'table':_0x4df884[_0x37d2a6(0x7a)],'alias':_0x4df884['alias'],'columns':_0x4df884[_0x37d2a6(0x98)],'reason':_0x33bb13?_0x37d2a6(0x8c):_0x37d2a6(0x76)}),{'table':_0x4df884['table'],'alias':_0x4df884[_0x37d2a6(0x95)],'columns':_0x4df884[_0x37d2a6(0x98)],'status':_0x37d2a6(0xaf)};});return{'checked':_0x28ddd2[_0x268b33(0x9b)]>0x0,'joins':_0x28ddd2,'warnings':_0x50ad6c};}function a248_0x57f2(){const _0x7d69cb=['push','map','887608fAxULd','match','replaceAll','JOIN_PREDICATE_UNSUPPORTED','split','trim','cross','right','MyBatis\x20<include>\x20fragments\x20cannot\x20be\x20expanded\x20for\x20JOIN\x20auditing.','tableName','left','metadataAvailable','some','includes','The\x20dataset\x20returned\x20no\x20distinguishable\x20index\x20metadata.','1263738OLlzDe','slice','max','515928BbgzTt','where','min','\x5c$&','inner','alias','containsUnresolvedInclude','sql','columns','Relevant\x20columns\x20do\x20not\x20form\x20a\x20complete\x20leftmost\x20index\x20prefix.','584016bQvnlE','length','\x5cs*\x5c.\x5cs*[\x5cw$]+','unknown','test','startsWith','\x20JOIN\x20direction\x20is\x20not\x20supported\x20by\x20static\x20index\x20auditing.','MyBatis\x20<include>\x20JOIN\x20fragments\x20cannot\x20be\x20expanded\x20statically.','3954104ykHQJy','No\x20reported\x20index\x20contains\x20the\x20JOIN\x20access\x20columns.','full','covered','unsupportedReason','position','exec','search','INDEX_METADATA_UNAVAILABLE','3278wzlywE','join','4CEctHb','JOIN_INDEX_MISSING','unavailable','warning','JOIN_INDEX_NOT_USABLE','has','matchAll','OR-connected\x20JOIN\x20predicates\x20are\x20not\x20supported.','__sq__','toLowerCase','replace','indexes','MyBatis\x20dynamic\x20JOIN\x20predicates\x20cannot\x20be\x20audited\x20deterministically.','14708124NMVwTm','Not\x20every\x20JOIN\x20target\x20predicate\x20could\x20be\x20audited\x20safely.','toUpperCase','from','natural','INNER','No\x20dataset\x20metadata\x20matched\x20the\x20JOIN\x20table.','filter','40IKdJga','index','table','matchedPrefix'];a248_0x57f2=function(){return _0x7d69cb;};return a248_0x57f2();}function extractJoinFacts(_0x3bc0f9){const _0x50f09e=a248_0x56d4,_0xc05889=maskNestedQueries(stripSqlNoise(_0x3bc0f9)),_0x1c6acf=maskQuotedIdentifiers(_0xc05889),_0x262a12=[],_0x4d6f31=new Set(),_0xbde846=/\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 _0x2a4e38 of _0xc05889[_0x50f09e(0x69)](_0xbde846)){const _0x2c07dc=_0x2a4e38['index']??0x0,_0x440596=_0x2a4e38[0x0][_0x50f09e(0xa9)](/\bJOIN\b/i),_0x41e02a=_0x2c07dc+Math['max'](0x0,_0x440596);if(!/^JOIN\b/i[_0x50f09e(0x9e)](_0x1c6acf['slice'](_0x41e02a)))continue;_0x4d6f31['add'](_0x41e02a);const _0x532d52=normalizeIdentifier(_0x2a4e38[0x1]||_0x50f09e(0x75)),_0x43dcb5=normalizeIdentifier(_0x2a4e38[0x2]??''),_0x3ed64d=normalizeIdentifier(_0x2a4e38[0x3]||_0x43dcb5[_0x50f09e(0x82)]('.')['at'](-0x1)||_0x43dcb5),_0x11dcb8=[],_0x5545c6=_0x43dcb5===_0x50f09e(0x6b);let _0x5f320a=_0x532d52==='right'||_0x532d52===_0x50f09e(0xa4)||_0x5545c6,_0x131658=_0x5f320a?_0x5545c6?'Derived-table\x20JOIN\x20targets\x20are\x20not\x20supported.':_0x532d52[_0x50f09e(0x72)]()+_0x50f09e(0xa0):undefined;const _0x304291=stripOuterParentheses(_0x2a4e38[0x4]??''),_0x1fb712=_0x304291['includes'](MYBATIS_DYNAMIC_START_MARKER)||_0x304291[_0x50f09e(0x8b)](MYBATIS_DYNAMIC_END_MARKER),_0x2d7abf=_0x304291[_0x50f09e(0x8b)](MYBATIS_INCLUDE_MARKER);_0x1fb712&&(_0x5f320a=!![],_0x131658??=_0x50f09e(0x6f));_0x2d7abf&&(_0x5f320a=!![],_0x131658??=_0x50f09e(0xa1));const _0x3a27af=_0x304291[_0x50f09e(0x80)](MYBATIS_DYNAMIC_START_MARKER,'\x20')[_0x50f09e(0x80)](MYBATIS_DYNAMIC_END_MARKER,'\x20')[_0x50f09e(0x80)](MYBATIS_INCLUDE_MARKER,'\x20');hasTopLevelKeyword(_0x3a27af,'OR')&&(_0x5f320a=!![],_0x131658??=_0x50f09e(0x6a));for(const _0x4c1ec4 of splitTopLevelAnd(_0x3a27af)){const _0x260c82=stripOuterParentheses(_0x4c1ec4);if(hasTopLevelKeyword(_0x260c82,'OR')){_0x5f320a=!![],_0x131658??=_0x50f09e(0x6a);continue;}const _0x3763f8=splitEquality(_0x260c82);if(!_0x3763f8){containsColumnReference(_0x4c1ec4,_0x3ed64d)&&(_0x5f320a=!![]);continue;}const _0x436535=parseDirectColumnReference(_0x3763f8[0x0],_0x3ed64d),_0x5a7c80=parseDirectColumnReference(_0x3763f8[0x1],_0x3ed64d),_0x1cd6a7=containsColumnReference(_0x3763f8[0x0],_0x3ed64d),_0x5e5f81=containsColumnReference(_0x3763f8[0x1],_0x3ed64d),_0xc03e89=_0x436535&&!_0x5e5f81?_0x436535:_0x5a7c80&&!_0x1cd6a7?_0x5a7c80:null;if(_0xc03e89&&!_0x11dcb8['includes'](_0xc03e89))_0x11dcb8[_0x50f09e(0x7c)](_0xc03e89);else!_0xc03e89&&containsColumnReference(_0x4c1ec4,_0x3ed64d)&&(_0x5f320a=!![]);}_0x262a12['push']({'table':_0x43dcb5,'alias':_0x3ed64d,'columns':_0x11dcb8,'unsupportedPredicate':_0x5f320a,'unsupportedReason':_0x131658,'containsUnresolvedInclude':_0x2d7abf,'position':_0x41e02a});}for(const _0x2a8797 of _0x1c6acf['matchAll'](/\bJOIN\b/gi)){const _0x22120f=_0x2a8797[_0x50f09e(0x79)]??0x0;if(_0x4d6f31[_0x50f09e(0x68)](_0x22120f))continue;const _0xeecfe3=/^\s+([`"\w$.]+)(?:\s+(?:AS\s+)?([`"\w$]+))?/[_0x50f09e(0xa8)](_0xc05889[_0x50f09e(0x8e)](_0x22120f+_0x2a8797[0x0][_0x50f09e(0x9b)])),_0x350baa=normalizeIdentifier(_0xeecfe3?.[0x1]||'unknown'),_0x227257=normalizeIdentifier(_0xeecfe3?.[0x2]||''),_0xd71bf4=isSqlClauseKeyword(_0x227257)?_0x350baa[_0x50f09e(0x82)]('.')['at'](-0x1)||_0x350baa:_0x227257||_0x350baa[_0x50f09e(0x82)]('.')['at'](-0x1)||_0x350baa;_0x262a12[_0x50f09e(0x7c)]({'table':_0x350baa,'alias':_0xd71bf4,'columns':[],'unsupportedPredicate':!![],'unsupportedReason':'Only\x20explicit\x20table\x20JOIN\x20clauses\x20with\x20an\x20ON\x20predicate\x20are\x20supported.','position':_0x22120f});}const _0x15296b=_0x1c6acf['indexOf'](MYBATIS_INCLUDE_MARKER);return _0x15296b>=0x0&&!_0x262a12[_0x50f09e(0x8a)](_0x42b659=>_0x42b659[_0x50f09e(0x96)])&&_0x262a12['push']({'table':_0x50f09e(0x9d),'alias':_0x50f09e(0x9d),'columns':[],'unsupportedPredicate':!![],'unsupportedReason':_0x50f09e(0x86),'containsUnresolvedInclude':!![],'position':_0x15296b}),_0x262a12['sort']((_0x5d9342,_0x132c76)=>_0x5d9342[_0x50f09e(0xa7)]-_0x132c76[_0x50f09e(0xa7)]);}function stripSqlNoise(_0xe4b641){const _0x9464d3=a248_0x56d4,_0x59a722=Array[_0x9464d3(0x73)](_0xe4b641),_0x5e9b0f=(_0x114999,_0x59b3a5)=>{for(let _0x55927c=_0x114999;_0x55927c<_0x59b3a5;_0x55927c+=0x1){_0x59a722[_0x55927c]!=='\x0a'&&_0x59a722[_0x55927c]!=='\x0d'&&(_0x59a722[_0x55927c]='\x20');}};for(let _0x4092b4=0x0;_0x4092b4<_0x59a722[_0x9464d3(0x9b)];_0x4092b4+=0x1){const _0x43a8db=_0x59a722[_0x4092b4],_0x15a9a9=_0x59a722[_0x4092b4+0x1];if(_0x43a8db==='\x27'||_0x43a8db==='\x22'||_0x43a8db==='`'){const _0x24fb0d=_0x43a8db,_0x5c79a4=_0x4092b4;_0x4092b4+=0x1;while(_0x4092b4<_0x59a722[_0x9464d3(0x9b)]){if(_0x59a722[_0x4092b4]==='\x5c'&&_0x4092b4+0x1<_0x59a722['length']){_0x4092b4+=0x2;continue;}if(_0x59a722[_0x4092b4]!==_0x24fb0d){_0x4092b4+=0x1;continue;}if(_0x59a722[_0x4092b4+0x1]===_0x24fb0d){_0x4092b4+=0x2;continue;}break;}if(_0x24fb0d==='\x27')_0x5e9b0f(_0x5c79a4,Math[_0x9464d3(0x92)](_0x4092b4+0x1,_0x59a722[_0x9464d3(0x9b)]));continue;}if(_0x43a8db==='-'&&_0x15a9a9==='-'){const _0xd83f8f=_0x4092b4;while(_0x4092b4<_0x59a722['length']&&_0x59a722[_0x4092b4]!=='\x0a')_0x4092b4+=0x1;_0x5e9b0f(_0xd83f8f,_0x4092b4);continue;}if(_0x43a8db==='/'&&_0x15a9a9==='*'){const _0xf6830c=_0x4092b4;_0x4092b4+=0x2;while(_0x4092b4<_0x59a722['length']&&!(_0x59a722[_0x4092b4]==='*'&&_0x59a722[_0x4092b4+0x1]==='/')){_0x4092b4+=0x1;}_0x4092b4=Math[_0x9464d3(0x92)](_0x4092b4+0x1,_0x59a722[_0x9464d3(0x9b)]-0x1),_0x5e9b0f(_0xf6830c,_0x4092b4+0x1);continue;}if(_0x43a8db==='#'&&_0x15a9a9!=='{'){const _0x4c07a1=_0x4092b4;while(_0x4092b4<_0x59a722[_0x9464d3(0x9b)]&&_0x59a722[_0x4092b4]!=='\x0a')_0x4092b4+=0x1;_0x5e9b0f(_0x4c07a1,_0x4092b4);continue;}if((_0x43a8db==='#'||_0x43a8db==='$')&&_0x15a9a9==='{'){const _0x55e6ec=_0x4092b4;_0x4092b4+=0x2;while(_0x4092b4<_0x59a722[_0x9464d3(0x9b)]&&_0x59a722[_0x4092b4]!=='}')_0x4092b4+=0x1;_0x5e9b0f(_0x55e6ec,Math['min'](_0x4092b4+0x1,_0x59a722[_0x9464d3(0x9b)]));}}return _0x59a722[_0x9464d3(0xac)]('');}function maskQuotedIdentifiers(_0xdd8ee0){const _0x59621e=a248_0x56d4,_0x446c48=Array['from'](_0xdd8ee0);for(let _0x32bd7e=0x0;_0x32bd7e<_0x446c48['length'];_0x32bd7e+=0x1){const _0x5a81fd=_0x446c48[_0x32bd7e];if(_0x5a81fd!=='\x22'&&_0x5a81fd!=='`')continue;_0x32bd7e+=0x1;while(_0x32bd7e<_0x446c48[_0x59621e(0x9b)]){if(_0x446c48[_0x32bd7e]===_0x5a81fd){if(_0x446c48[_0x32bd7e+0x1]===_0x5a81fd){_0x446c48[_0x32bd7e]='\x20',_0x446c48[_0x32bd7e+0x1]='\x20',_0x32bd7e+=0x2;continue;}break;}_0x446c48[_0x32bd7e]='\x20',_0x32bd7e+=0x1;}}return _0x446c48['join']('');}function maskNestedQueries(_0x545771){const _0x3c0971=a248_0x56d4,_0x13029b=Array[_0x3c0971(0x73)](_0x545771);for(let _0x579ac5=0x0;_0x579ac5<_0x13029b[_0x3c0971(0x9b)];_0x579ac5+=0x1){if(_0x13029b[_0x579ac5]!=='(')continue;const _0x3c13fc=_0x545771[_0x3c0971(0x8e)](_0x579ac5+0x1);if(!/^\s*(?:SELECT|WITH)\b/i[_0x3c0971(0x9e)](_0x3c13fc))continue;let _0x52396c=0x1,_0x2e344d=_0x579ac5+0x1;for(;_0x2e344d<_0x13029b['length']&&_0x52396c>0x0;_0x2e344d+=0x1){if(_0x13029b[_0x2e344d]==='(')_0x52396c+=0x1;if(_0x13029b[_0x2e344d]===')')_0x52396c-=0x1;}if(_0x52396c!==0x0)continue;for(let _0x4bec39=_0x579ac5;_0x4bec39<_0x2e344d;_0x4bec39+=0x1){_0x13029b[_0x4bec39]='\x20';}const _0x51e612=_0x3c0971(0x6b);for(let _0x1ad248=0x0;_0x1ad248<_0x51e612['length']&&_0x579ac5+_0x1ad248<_0x2e344d;_0x1ad248+=0x1){_0x13029b[_0x579ac5+_0x1ad248]=_0x51e612[_0x1ad248];}_0x579ac5=_0x2e344d-0x1;}return _0x13029b['join']('');}function splitTopLevelAnd(_0x2c22b4){const _0x19209d=a248_0x56d4,_0x289629=[];let _0x3501f7=0x0,_0x32864f=0x0;for(let _0x263f5b=0x0;_0x263f5b<_0x2c22b4[_0x19209d(0x9b)];_0x263f5b+=0x1){const _0x2f0fbc=_0x2c22b4[_0x263f5b];if(_0x2f0fbc==='(')_0x3501f7+=0x1;if(_0x2f0fbc===')')_0x3501f7=Math[_0x19209d(0x8f)](0x0,_0x3501f7-0x1);_0x3501f7===0x0&&_0x2c22b4[_0x19209d(0x8e)](_0x263f5b)[_0x19209d(0x7f)](/^AND\b/i)&&(_0x263f5b===0x0||/\s/[_0x19209d(0x9e)](_0x2c22b4[_0x263f5b-0x1]??''))&&(_0x289629[_0x19209d(0x7c)](_0x2c22b4[_0x19209d(0x8e)](_0x32864f,_0x263f5b)['trim']()),_0x263f5b+=0x2,_0x32864f=_0x263f5b+0x1);}const _0x51d37b=_0x2c22b4[_0x19209d(0x8e)](_0x32864f)[_0x19209d(0x83)]();if(_0x51d37b)_0x289629[_0x19209d(0x7c)](_0x51d37b);return _0x289629;}function hasTopLevelKeyword(_0x42e0d4,_0x59adbc){const _0x195050=a248_0x56d4;let _0x41dd3e=0x0;for(let _0x207c3c=0x0;_0x207c3c<_0x42e0d4[_0x195050(0x9b)];_0x207c3c+=0x1){const _0x125125=_0x42e0d4[_0x207c3c];if(_0x125125==='(')_0x41dd3e+=0x1;if(_0x125125===')')_0x41dd3e=Math['max'](0x0,_0x41dd3e-0x1);if(_0x41dd3e!==0x0)continue;const _0x6744db=_0x42e0d4[_0x195050(0x8e)](_0x207c3c,_0x207c3c+_0x59adbc['length']),_0x2a10bc=_0x42e0d4[_0x207c3c-0x1]??'\x20',_0xf993c5=_0x42e0d4[_0x207c3c+_0x59adbc[_0x195050(0x9b)]]??'\x20';if(_0x6744db['toUpperCase']()===_0x59adbc[_0x195050(0x72)]()&&!/[\w$]/[_0x195050(0x9e)](_0x2a10bc)&&!/[\w$]/[_0x195050(0x9e)](_0xf993c5))return!![];}return![];}function splitEquality(_0xe47b8c){const _0xcfd837=a248_0x56d4,_0x4104de=stripOuterParentheses(_0xe47b8c);let _0x18029c=0x0,_0x5d0957;for(let _0x22d639=0x0;_0x22d639<_0x4104de[_0xcfd837(0x9b)];_0x22d639+=0x1){const _0x583671=_0x4104de[_0x22d639];if(_0x583671==='(')_0x18029c+=0x1;if(_0x583671===')')_0x18029c=Math[_0xcfd837(0x8f)](0x0,_0x18029c-0x1);const _0x321364=_0x4104de[_0x22d639-0x1]??'',_0x29452d=_0x4104de[_0x22d639+0x1]??'';if(_0x583671==='='&&_0x18029c===0x0&&!/[!<>=:]/[_0xcfd837(0x9e)](_0x321364)&&_0x29452d!=='='){if(_0x5d0957!==undefined)return null;_0x5d0957=_0x22d639;}}return _0x5d0957===undefined?null:[_0x4104de[_0xcfd837(0x8e)](0x0,_0x5d0957)[_0xcfd837(0x83)](),_0x4104de[_0xcfd837(0x8e)](_0x5d0957+0x1)[_0xcfd837(0x83)]()];}function parseDirectColumnReference(_0x2afe25,_0x313e68){const _0xef002d=/^([`"]?[\w$]+[`"]?)\s*\.\s*([`"]?[\w$]+[`"]?)$/['exec'](stripOuterParentheses(_0x2afe25));if(!_0xef002d)return null;if(normalizeIdentifier(_0xef002d[0x1]??'')!==normalizeIdentifier(_0x313e68))return null;return normalizeIdentifier(_0xef002d[0x2]??'');}function containsColumnReference(_0x35f4dc,_0x13fb4c){const _0xd2f0de=a248_0x56d4,_0x24e253=_0x35f4dc[_0xd2f0de(0x6d)](/[`"]/g,''),_0x4c2b97=_0x13fb4c[_0xd2f0de(0x6d)](/[.*+?^${}()|[\]\\]/g,_0xd2f0de(0x93));return new RegExp('(?:^|[^\x5cw$])'+_0x4c2b97+_0xd2f0de(0x9c),'i')[_0xd2f0de(0x9e)](_0x24e253);}function findEqualityPrefix(_0x1d8b50,_0x168b6b){const _0x5740dc=a248_0x56d4,_0x300ded=new Set(_0x168b6b[_0x5740dc(0x7d)](normalizeIdentifier)),_0x3e94ee=[];for(const _0x3e8c1d of _0x1d8b50){if(!_0x300ded[_0x5740dc(0x68)](normalizeIdentifier(_0x3e8c1d)))break;_0x3e94ee[_0x5740dc(0x7c)](_0x3e8c1d);}return _0x3e94ee;}function resolveTableMetadata(_0x321662,_0x567737){const _0x41344c=a248_0x56d4,_0x27c453=normalizeIdentifier(_0x567737),_0x13c860=_0x321662[_0x41344c(0x77)](_0x2ebdb7=>normalizeIdentifier(_0x2ebdb7[_0x41344c(0x87)])===_0x27c453);if(_0x13c860[_0x41344c(0x9b)]===0x1)return _0x13c860[0x0];const _0x1cbfa7=_0x27c453[_0x41344c(0x8b)]('.'),_0xb6051f=_0x27c453[_0x41344c(0x82)]('.')['at'](-0x1),_0x504e1c=_0x321662[_0x41344c(0x77)](_0x3c1995=>{const _0x280aa8=_0x41344c,_0x1ed555=normalizeIdentifier(_0x3c1995[_0x280aa8(0x87)]);if(_0x1cbfa7&&_0x1ed555['includes']('.'))return![];return _0x1ed555[_0x280aa8(0x82)]('.')['at'](-0x1)===_0xb6051f;});return _0x504e1c[_0x41344c(0x9b)]===0x1?_0x504e1c[0x0]:undefined;}function columnNamesMatch(_0x366e7a,_0x30b305){return normalizeIdentifier(_0x366e7a)===normalizeIdentifier(_0x30b305);}function normalizeIdentifier(_0x33dd4b){const _0x33a938=a248_0x56d4;return _0x33dd4b['replace'](/[`"]/g,'')[_0x33a938(0x83)]()[_0x33a938(0x6c)]();}function isSqlClauseKeyword(_0x1ec7fe){const _0x5e808f=a248_0x56d4;return new Set(['on','using',_0x5e808f(0x91),'join',_0x5e808f(0x94),_0x5e808f(0x88),_0x5e808f(0x85),_0x5e808f(0xa4),_0x5e808f(0x84),_0x5e808f(0x74)])[_0x5e808f(0x68)](_0x1ec7fe);}function a248_0x56d4(_0x2b19fe,_0x314d7a){_0x2b19fe=_0x2b19fe-0x67;const _0x57f260=a248_0x57f2();let _0x56d444=_0x57f260[_0x2b19fe];return _0x56d444;}function stripOuterParentheses(_0x382dbf){const _0x143503=a248_0x56d4;let _0x1438b5=_0x382dbf[_0x143503(0x83)]();while(_0x1438b5[_0x143503(0x9f)]('(')&&_0x1438b5['endsWith'](')')){let _0x5ee2e4=0x0,_0x474944=!![];for(let _0x73756a=0x0;_0x73756a<_0x1438b5[_0x143503(0x9b)];_0x73756a+=0x1){if(_0x1438b5[_0x73756a]==='(')_0x5ee2e4+=0x1;if(_0x1438b5[_0x73756a]===')')_0x5ee2e4-=0x1;if(_0x5ee2e4===0x0&&_0x73756a<_0x1438b5[_0x143503(0x9b)]-0x1){_0x474944=![];break;}}if(!_0x474944||_0x5ee2e4!==0x0)break;_0x1438b5=_0x1438b5[_0x143503(0x8e)](0x1,-0x1)[_0x143503(0x83)]();}return _0x1438b5;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a249_0x4ffc57=a249_0x24e7;(function(_0x3e114a,_0x2a421f){const _0x367887=a249_0x24e7,_0x389140=_0x3e114a();while(!![]){try{const _0x46458e=parseInt(_0x367887(0x179))/0x1*(-parseInt(_0x367887(0x17f))/0x2)+-parseInt(_0x367887(0x17b))/0x3*(parseInt(_0x367887(0x17d))/0x4)+-parseInt(_0x367887(0x17e))/0x5+parseInt(_0x367887(0x17a))/0x6+-parseInt(_0x367887(0x174))/0x7*(-parseInt(_0x367887(0x171))/0x8)+-parseInt(_0x367887(0x176))/0x9*(parseInt(_0x367887(0x177))/0xa)+parseInt(_0x367887(0x180))/0xb;if(_0x46458e===_0x2a421f)break;else _0x389140['push'](_0x389140['shift']());}catch(_0x1849b8){_0x389140['push'](_0x389140['shift']());}}}(a249_0x1ddf,0xabb78));import{resolve}from'node:path';function a249_0x24e7(_0x70d781,_0x59dda1){_0x70d781=_0x70d781-0x171;const _0x1ddf76=a249_0x1ddf();let _0x24e73b=_0x1ddf76[_0x70d781];return _0x24e73b;}import{findProjectRootDirectory}from'../../context.js';const DOT_DIR=a249_0x4ffc57(0x17c),LOCK_FILE_NAME=a249_0x4ffc57(0x175),TRASH_DIR_NAME=a249_0x4ffc57(0x172);function a249_0x1ddf(){const _0x297b9d=['4063339OQzqfd','sql.lock.json','4550031ayUnXV','20lIOVsk','/sql','223sqENEX','1054746OJxWgB','12BfgNSk','.rabetbase','507608BLSdVx','4946050qLztGx','610OjOwNb','21368138qbCIBY','16OQBHQT','sql-trash','sql'];a249_0x1ddf=function(){return _0x297b9d;};return a249_0x1ddf();}export function loadSqlProjectConfig(_0x1c8b58,_0x53c557){const _0x118548=a249_0x4ffc57,_0x310eb1=resolve(_0x53c557??findProjectRootDirectory()),_0x42c018=DOT_DIR+_0x118548(0x178),_0x7706ca=_0x42c018+'/'+_0x1c8b58;return{'projectRoot':_0x310eb1,'appCode':_0x1c8b58,'sqlWorkspaceRoot':_0x42c018,'sqlRoot':_0x7706ca,'sqlRootDir':resolve(_0x310eb1,DOT_DIR,_0x118548(0x173),_0x1c8b58),'lockFilePath':resolve(_0x310eb1,DOT_DIR,LOCK_FILE_NAME),'trashDir':resolve(_0x310eb1,DOT_DIR,TRASH_DIR_NAME)};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x3e8c8c,_0x2af135){const _0x3c24bc=a250_0x1878,_0x20bf6c=_0x3e8c8c();while(!![]){try{const _0x9553ff=parseInt(_0x3c24bc(0x200))/0x1+-parseInt(_0x3c24bc(0x1f9))/0x2+-parseInt(_0x3c24bc(0x1fd))/0x3*(parseInt(_0x3c24bc(0x1e7))/0x4)+parseInt(_0x3c24bc(0x1e6))/0x5+-parseInt(_0x3c24bc(0x1f7))/0x6*(parseInt(_0x3c24bc(0x1fe))/0x7)+-parseInt(_0x3c24bc(0x1ef))/0x8+parseInt(_0x3c24bc(0x1fa))/0x9;if(_0x9553ff===_0x2af135)break;else _0x20bf6c['push'](_0x20bf6c['shift']());}catch(_0x5bfd70){_0x20bf6c['push'](_0x20bf6c['shift']());}}}(a250_0x3687,0x378be));import{readdir,stat}from'node:fs/promises';import{extname,join,relative}from'node:path';import{buildDefaultSqlFileName,buildSqlRelativePath}from'./utils.js';function extensionToMode(_0x2d8bcc){const _0x2ef5ea=a250_0x1878;if(_0x2d8bcc===_0x2ef5ea(0x203))return'sql';if(_0x2d8bcc===_0x2ef5ea(0x1e4))return _0x2ef5ea(0x1f5);return undefined;}function a250_0x3687(){const _0x4ba75f=['path','993312hGKFXO','toLowerCase','sqlName','dbId','mode','push','mybatisXml','length','390mVzVZU','split','51350kEGMTV','149382idWGPN','sqlCode','sql','3gVwIDW','26929HcAqbf','slice','411587LuHIBw','indexOf','sqlRootDir','.sql','.xml','filter','1327630YnWswd','265196RlHvFM','dbName','replace','isDirectory','code','name','ENOENT'];a250_0x3687=function(){return _0x4ba75f;};return a250_0x3687();}function a250_0x1878(_0xd4d8cd,_0x205c27){_0xd4d8cd=_0xd4d8cd-0x1e4;const _0x368749=a250_0x3687();let _0x1878f5=_0x368749[_0xd4d8cd];return _0x1878f5;}async function scanSqlFilesRecursively(_0x13132d,_0x5bb662){const _0x3796cc=a250_0x1878,_0xcf953e=[];try{const _0x2cb82f=await readdir(_0x13132d,{'withFileTypes':!![]});for(const _0x4ce485 of _0x2cb82f){const _0x1007cf=join(_0x13132d,_0x4ce485[_0x3796cc(0x1ec)]);if(_0x4ce485['isDirectory']()){_0xcf953e[_0x3796cc(0x1f4)](...await scanSqlFilesRecursively(_0x1007cf,_0x5bb662));continue;}if(!_0x4ce485['isFile']())continue;const _0x2b12b1=extname(_0x4ce485[_0x3796cc(0x1ec)])[_0x3796cc(0x1f0)](),_0x17d199=extensionToMode(_0x2b12b1);if(!_0x17d199)continue;const _0x3e92e7=relative(_0x5bb662,_0x1007cf)[_0x3796cc(0x1e9)](/\\/g,'/'),_0x1a4447=_0x3e92e7[_0x3796cc(0x1f8)]('/')[_0x3796cc(0x1e5)](Boolean),_0x296a1d=parseSqlPath(_0x1a4447,_0x4ce485[_0x3796cc(0x1ec)],_0x2b12b1);if(!_0x296a1d)continue;_0xcf953e[_0x3796cc(0x1f4)]({'sqlCode':_0x296a1d[_0x3796cc(0x1fb)],'sqlName':_0x296a1d[_0x3796cc(0x1f1)],'dbDirectory':_0x1a4447[0x0],'filePath':_0x1007cf,'relativePath':_0x3e92e7,'lockKey':_0x296a1d[_0x3796cc(0x1fb)],'mode':_0x17d199});}}catch(_0x4f213d){if(_0x4f213d[_0x3796cc(0x1eb)]!==_0x3796cc(0x1ed))throw _0x4f213d;}return _0xcf953e;}export async function scanLocalSqlQueries(_0x314b3a){const _0x23ebcf=a250_0x1878;return scanSqlFilesRecursively(_0x314b3a[_0x23ebcf(0x202)],_0x314b3a[_0x23ebcf(0x202)]);}export function resolveLocalSqlFilePath(_0x122b98,_0x3032ae,_0x333a11){const _0x458935=a250_0x1878,_0xca7af6=_0x333a11?.[_0x458935(0x1ee)]||(_0x333a11?.[_0x458935(0x1f1)]||_0x333a11?.[_0x458935(0x1e8)]?buildSqlRelativePath(_0x3032ae,_0x333a11?.['sqlName'],_0x333a11?.[_0x458935(0x1e8)],_0x333a11?.['mode']||_0x458935(0x1fc),_0x333a11?.[_0x458935(0x1f2)]):buildDefaultSqlFileName(_0x3032ae,_0x333a11?.[_0x458935(0x1f3)]||'sql'));return join(_0x122b98[_0x458935(0x202)],_0xca7af6);}export async function directoryExists(_0x3bae90){const _0xf7ee88=a250_0x1878;try{const _0x51f691=await stat(_0x3bae90);return _0x51f691[_0xf7ee88(0x1ea)]();}catch{return![];}}function parseSqlPath(_0x477d77,_0x31b202,_0x5d247e){const _0x5071d4=a250_0x1878,_0x5af189=_0x31b202['slice'](0x0,-_0x5d247e['length']);if(_0x477d77[_0x5071d4(0x1f6)]<0x2)return null;const _0x560406=_0x5af189[_0x5071d4(0x201)]('_');if(_0x560406<=0x0||_0x560406>=_0x5af189['length']-0x1)return null;const _0xcf9fcb=_0x5af189[_0x5071d4(0x1ff)](0x0,_0x560406);if(!isLikelySqlCode(_0xcf9fcb))return null;return{'sqlCode':_0xcf9fcb,'sqlName':_0x5af189[_0x5071d4(0x1ff)](_0x560406+0x1)};}function isLikelySqlCode(_0x1d5812){return/^[A-Za-z0-9-]+-[A-Za-z0-9-]+$/['test'](_0x1d5812);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x376a5b,_0x48f24f){const _0x4a754f=a251_0x3b34,_0x284e4b=_0x376a5b();while(!![]){try{const _0x5e9408=parseInt(_0x4a754f(0x164))/0x1+-parseInt(_0x4a754f(0x16d))/0x2*(-parseInt(_0x4a754f(0x16a))/0x3)+-parseInt(_0x4a754f(0x165))/0x4+parseInt(_0x4a754f(0x161))/0x5+parseInt(_0x4a754f(0x170))/0x6+parseInt(_0x4a754f(0x167))/0x7*(parseInt(_0x4a754f(0x16c))/0x8)+parseInt(_0x4a754f(0x16b))/0x9*(-parseInt(_0x4a754f(0x16f))/0xa);if(_0x5e9408===_0x48f24f)break;else _0x284e4b['push'](_0x284e4b['shift']());}catch(_0x104628){_0x284e4b['push'](_0x284e4b['shift']());}}}(a251_0x5c11,0xa2c25));import{readFile}from'node:fs/promises';function a251_0x5c11(){const _0x313488=['4778JHvdPy','update','4083260APyUFv','1425678Lpzmam','5574135YTtUFr','createHash','digest','211785hDKTLi','3545516yZhMbF','utf8','212513RhgMdC','md5','hex','249aNCZgZ','18NCAcIq','160JLUUhA'];a251_0x5c11=function(){return _0x313488;};return a251_0x5c11();}function a251_0x3b34(_0x265f5f,_0x51a554){_0x265f5f=_0x265f5f-0x161;const _0x5c11fd=a251_0x5c11();let _0x3b34eb=_0x5c11fd[_0x265f5f];return _0x3b34eb;}import a251_0x261f9b from'node:crypto';export function computeSqlContentHash(_0x366912){const _0x4e10fb=a251_0x3b34;return a251_0x261f9b[_0x4e10fb(0x162)](_0x4e10fb(0x168))[_0x4e10fb(0x16e)](_0x366912)[_0x4e10fb(0x163)](_0x4e10fb(0x169));}export async function computeSqlFileHash(_0x43132c){const _0x439504=a251_0x3b34,_0x314563=await readFile(_0x43132c,_0x439504(0x166));return computeSqlContentHash(_0x314563);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x40d7c3,_0x2675b5){const _0x26d1f0=a252_0x557c,_0xb4994e=_0x40d7c3();while(!![]){try{const _0x2fc2be=parseInt(_0x26d1f0(0x156))/0x1*(parseInt(_0x26d1f0(0x159))/0x2)+-parseInt(_0x26d1f0(0x15b))/0x3+parseInt(_0x26d1f0(0x15c))/0x4*(parseInt(_0x26d1f0(0x150))/0x5)+-parseInt(_0x26d1f0(0x160))/0x6*(-parseInt(_0x26d1f0(0x153))/0x7)+-parseInt(_0x26d1f0(0x161))/0x8*(parseInt(_0x26d1f0(0x168))/0x9)+-parseInt(_0x26d1f0(0x15d))/0xa*(parseInt(_0x26d1f0(0x151))/0xb)+parseInt(_0x26d1f0(0x15e))/0xc*(parseInt(_0x26d1f0(0x158))/0xd);if(_0x2fc2be===_0x2675b5)break;else _0xb4994e['push'](_0xb4994e['shift']());}catch(_0x6dd3ab){_0xb4994e['push'](_0xb4994e['shift']());}}}(a252_0x2737,0xc4648));import{mkdir,readFile,writeFile}from'node:fs/promises';import{dirname}from'node:path';export function createEmptySqlLock(){return{'apps':{}};}function a252_0x557c(_0x2d7cb3,_0x309f4f){_0x2d7cb3=_0x2d7cb3-0x150;const _0x2737d9=a252_0x2737();let _0x557cf2=_0x2737d9[_0x2d7cb3];return _0x557cf2;}export function ensureSqlLockScope(_0x47c75e,_0x671b9f,_0x2c0659,_0x3b9cdb){const _0x2a7b73=a252_0x557c,_0x29fbb4=_0x47c75e??createEmptySqlLock();let _0x3e52e5=_0x29fbb4[_0x2a7b73(0x154)][_0x671b9f];if(!_0x3e52e5)return _0x3e52e5={'sqlRoot':_0x2c0659,'lastSync':'','sqls':{}},_0x29fbb4['apps'][_0x671b9f]=_0x3e52e5,{'lockData':_0x29fbb4,'appLock':_0x3e52e5};if(!_0x3e52e5['sqlRoot'])_0x3e52e5[_0x2a7b73(0x167)]=_0x2c0659;else{if(_0x3e52e5[_0x2a7b73(0x167)]!==_0x2c0659)throw new Error(_0x3b9cdb+_0x2a7b73(0x166)+_0x2c0659+'\x22\x20vs\x20lock\x20\x22'+_0x3e52e5[_0x2a7b73(0x167)]+_0x2a7b73(0x152)+_0x2a7b73(0x15a));}return!_0x3e52e5[_0x2a7b73(0x15f)]&&(_0x3e52e5[_0x2a7b73(0x15f)]={}),!_0x3e52e5[_0x2a7b73(0x164)]&&(_0x3e52e5['lastSync']=''),{'lockData':_0x29fbb4,'appLock':_0x3e52e5};}function a252_0x2737(){const _0x4d97cc=['168BBNzvT','sqls','42fUuCSx','2008YTNeyc','ENOENT','parse','lastSync','Failed\x20to\x20read\x20SQL\x20lock\x20file:\x20',':\x20sqlRoot\x20mismatch\x20—\x20current\x20\x22','sqlRoot','45351tEijHe','1622090fgnvnU','8961546uwBLqZ','\x22.\x20','179760swARsA','apps','stringify','1336087OttpJN','utf8','1083498eOxTBF','2VvphPm','Check\x20.rabetbase/sql.lock.json\x20or\x20operate\x20from\x20the\x20correct\x20project\x20directory.','369630RLNMrm','4ZqnABo','10ZJtkZT'];a252_0x2737=function(){return _0x4d97cc;};return a252_0x2737();}export async function readSqlLockFile(_0x4ebfae){const _0x4fdfc5=a252_0x557c;try{const _0x22a968=await readFile(_0x4ebfae,_0x4fdfc5(0x157));return JSON[_0x4fdfc5(0x163)](_0x22a968);}catch(_0x213570){if(_0x213570['code']===_0x4fdfc5(0x162))return null;throw new Error(_0x4fdfc5(0x165)+String(_0x213570));}}export async function writeSqlLockFile(_0x35ecac,_0x41534e){const _0x451b42=a252_0x557c;await mkdir(dirname(_0x35ecac),{'recursive':!![]}),await writeFile(_0x35ecac,JSON[_0x451b42(0x155)](_0x41534e,null,0x2),_0x451b42(0x157));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x491abb,_0x19e3ea){const _0xd31e1f=a254_0x5098,_0x55ad2f=_0x491abb();while(!![]){try{const _0xdc31a=-parseInt(_0xd31e1f(0x1aa))/0x1+parseInt(_0xd31e1f(0x1ab))/0x2*(parseInt(_0xd31e1f(0x1bc))/0x3)+-parseInt(_0xd31e1f(0x1b4))/0x4+parseInt(_0xd31e1f(0x1b6))/0x5*(-parseInt(_0xd31e1f(0x1b9))/0x6)+parseInt(_0xd31e1f(0x1ae))/0x7*(parseInt(_0xd31e1f(0x1ac))/0x8)+parseInt(_0xd31e1f(0x1ba))/0x9+-parseInt(_0xd31e1f(0x1b1))/0xa;if(_0xdc31a===_0x19e3ea)break;else _0x55ad2f['push'](_0x55ad2f['shift']());}catch(_0x546adb){_0x55ad2f['push'](_0x55ad2f['shift']());}}}(a254_0x165a,0x3fed6));export function detectSqlMode(_0x5ca321){const _0x419868=a254_0x5098,_0x1ae25f=_0x5ca321[_0x419868(0x1bb)]();if(/^<(select|insert|update|delete)\b/i[_0x419868(0x1af)](_0x1ae25f))return _0x419868(0x1b5);return'sql';}export function getSqlFileExtension(_0x4c47d4){const _0xd85321=a254_0x5098;return _0x4c47d4===_0xd85321(0x1b5)?_0xd85321(0x1b2):_0xd85321(0x1ad);}export function buildDefaultSqlFileName(_0x3c8bab,_0x1588db){return''+_0x3c8bab+getSqlFileExtension(_0x1588db);}export function sanitizeSqlPathSegment(_0x5859d8,_0x15a529){const _0x4892c3=a254_0x5098,_0x3eeef7=String(_0x5859d8??'')[_0x4892c3(0x1b8)](),_0x4c51b0=_0x3eeef7[_0x4892c3(0x1b3)](/[<>:"/\\|?*\u0000-\u001F]/g,'-')[_0x4892c3(0x1b3)](/\s+/g,'-')['replace'](/-+/g,'-')[_0x4892c3(0x1b3)](/^\.+/,'')[_0x4892c3(0x1b3)](/\.+$/,'')['replace'](/^-+/,'')[_0x4892c3(0x1b3)](/-+$/,'');return _0x4c51b0||_0x15a529;}export function buildDbDirectoryName(_0x54a0fa,_0x4f0da6){const _0x3ef019=a254_0x5098;return sanitizeSqlPathSegment(_0x54a0fa,_0x4f0da6!=null?_0x3ef019(0x1b0)+_0x4f0da6:_0x3ef019(0x1b7));}function a254_0x165a(){const _0x10f944=['716RIgfVR','2485464NZilsh','.sql','7INpQsQ','test','db-','3044670aTtPRT','.xml','replace','621316PmcBzU','mybatisXml','2930Arjeah','unknown-db','trim','1698iAejDf','1162260jZtcwl','trimStart','4236eVtIcR','57839SjNKMw'];a254_0x165a=function(){return _0x10f944;};return a254_0x165a();}function a254_0x5098(_0x5f1f82,_0xd79afe){_0x5f1f82=_0x5f1f82-0x1aa;const _0x165a89=a254_0x165a();let _0x509815=_0x165a89[_0x5f1f82];return _0x509815;}export function buildSqlRelativePath(_0x13613e,_0x591467,_0x2e881e,_0x3de9f2,_0x5d2180){const _0x79f82=buildDbDirectoryName(_0x2e881e,_0x5d2180),_0x457be5=sanitizeSqlPathSegment(_0x13613e,'unknown-sql'),_0x4bf9cf=sanitizeSqlPathSegment(_0x591467,_0x457be5);return _0x79f82+'/'+_0x457be5+'_'+_0x4bf9cf+getSqlFileExtension(_0x3de9f2);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a256_0x55358a=a256_0x4859;(function(_0x5e9ace,_0x2e52f5){const _0x53395b=a256_0x4859,_0x25a26f=_0x5e9ace();while(!![]){try{const _0x47b4c0=parseInt(_0x53395b(0x1e2))/0x1*(parseInt(_0x53395b(0x1a1))/0x2)+-parseInt(_0x53395b(0x1c8))/0x3*(parseInt(_0x53395b(0x1d8))/0x4)+-parseInt(_0x53395b(0x1c9))/0x5*(parseInt(_0x53395b(0x1a7))/0x6)+-parseInt(_0x53395b(0x1df))/0x7+-parseInt(_0x53395b(0x1a0))/0x8+-parseInt(_0x53395b(0x191))/0x9+parseInt(_0x53395b(0x1a2))/0xa*(parseInt(_0x53395b(0x1bd))/0xb);if(_0x47b4c0===_0x2e52f5)break;else _0x25a26f['push'](_0x25a26f['shift']());}catch(_0xdfedc){_0x25a26f['push'](_0x25a26f['shift']());}}}(a256_0x56f0,0xe6240));const MYBATIS_OUTER_TAGS=new Map([[a256_0x55358a(0x1b0),a256_0x55358a(0x1ec)],['insert',a256_0x55358a(0x1b2)],[a256_0x55358a(0x1cf),a256_0x55358a(0x1c5)],[a256_0x55358a(0x1ab),a256_0x55358a(0x19e)]]),MYBATIS_DYNAMIC_TAGS=new Set(['if',a256_0x55358a(0x1d2),'foreach',a256_0x55358a(0x1cb),a256_0x55358a(0x1ce),a256_0x55358a(0x1b4),a256_0x55358a(0x1b7),a256_0x55358a(0x19a),a256_0x55358a(0x1af),a256_0x55358a(0x1ca),a256_0x55358a(0x194)]),MYBATIS_BRANCH_TAGS=new Set(['if',a256_0x55358a(0x1e1),'choose',a256_0x55358a(0x1ce),a256_0x55358a(0x1b4)]);export const MYBATIS_DYNAMIC_START_MARKER='__RABETBASE_MYBATIS_DYNAMIC_START__';export const MYBATIS_DYNAMIC_END_MARKER=a256_0x55358a(0x1ea);export const MYBATIS_INCLUDE_MARKER=a256_0x55358a(0x190);const UNRESOLVED_SQL_FRAGMENT=a256_0x55358a(0x1ee),MYBATIS_OUTER_TAG_PATTERN=new RegExp('^<\x5cs*(?:'+[...MYBATIS_OUTER_TAGS[a256_0x55358a(0x1b5)]()][a256_0x55358a(0x1e7)]('|')+a256_0x55358a(0x1e9),'i');export function normalizeSqlForStaticAnalysis(_0x182f53){const _0x1d6ea6=a256_0x55358a,_0x22ed74=typeof _0x182f53===_0x1d6ea6(0x1eb)?_0x182f53:'';if(!startsWithMybatisStatementWrapper(_0x22ed74))return{'sql':_0x22ed74,'mode':'sql'};let _0x27a539=0x0,_0x500006='',_0x1f6524,_0x557e83=![],_0x5a27c5=![];const _0xdeddcb=[];while(_0x27a539<_0x22ed74['length']){if(_0x22ed74[_0x1d6ea6(0x1e3)](_0x1d6ea6(0x1e6),_0x27a539)){const _0x400604=_0x22ed74['indexOf'](_0x1d6ea6(0x193),_0x27a539+0x4);if(_0x400604<0x0)return invalidMybatisSource(_0x1d6ea6(0x1b1));_0x500006+='\x20',_0x27a539=_0x400604+0x3;continue;}if(_0x22ed74[_0x1d6ea6(0x1e3)]('<,_0x27a539+0x9);if(_0x2c453d<0x0)return invalidMybatisSource(_0x1d6ea6(0x195));_0x500006+=_0x22ed74[_0x1d6ea6(0x1bc)](_0x27a539+0x9,_0x2c453d),_0x27a539=_0x2c453d+0x3;continue;}if(_0x22ed74['startsWith']('<?',_0x27a539)){if(_0x557e83)return invalidMybatisSource(_0x1d6ea6(0x196));const _0x324726=_0x22ed74[_0x1d6ea6(0x1be)]('?>',_0x27a539+0x2);if(_0x324726<0x0)return invalidMybatisSource(_0x1d6ea6(0x1d0));_0x500006+='\x20',_0x27a539=_0x324726+0x2;continue;}if(_0x22ed74[_0x27a539]!=='<'){const _0x12b52e=_0x22ed74[_0x1d6ea6(0x1be)]('<',_0x27a539),_0x41949b=_0x12b52e<0x0?_0x22ed74[_0x1d6ea6(0x1dc)]:_0x12b52e,_0x5984ad=_0x22ed74[_0x1d6ea6(0x1bc)](_0x27a539,_0x41949b);if((!_0x557e83||_0x5a27c5)&&_0x5984ad[_0x1d6ea6(0x1b7)]())return invalidMybatisSource('SQL\x20text\x20must\x20be\x20inside\x20the\x20MyBatis\x20statement\x20wrapper.');if(_0x557e83&&!_0x5a27c5){const _0x12e0fd=decodeXmlEntities(_0x5984ad);if(_0x12e0fd===null)return invalidMybatisSource(_0x1d6ea6(0x1c1));_0x500006+=_0x12e0fd;}else _0x500006+='\x20';_0x27a539=_0x41949b;continue;}const _0x22ce99=findXmlTagEnd(_0x22ed74,_0x27a539);if(_0x22ce99<0x0)return invalidMybatisSource('Unterminated\x20MyBatis\x20XML\x20tag.');const _0x51f3cb=_0x22ed74[_0x1d6ea6(0x1bc)](_0x27a539,_0x22ce99+0x1),_0x36777d=/^<\s*(\/?)\s*([A-Za-z][\w:-]*)([\s\S]*?)(\/?)\s*>$/['exec'](_0x51f3cb);if(!_0x36777d)return invalidMybatisSource(_0x1d6ea6(0x1d1));const _0x135104=_0x36777d[0x1]==='/',_0x33c675=_0x36777d[0x2]??'',_0x251731=_0x33c675['toLowerCase'](),_0x51ad2c=_0x36777d[0x3]??'',_0x301bf8=_0x36777d[0x4]==='/',_0x188b96=MYBATIS_OUTER_TAGS[_0x1d6ea6(0x192)](_0x251731);if(!_0x188b96&&!MYBATIS_DYNAMIC_TAGS[_0x1d6ea6(0x1c2)](_0x251731))return invalidMybatisSource(_0x1d6ea6(0x1ae)+_0x251731+'>.');if(!_0x188b96&&_0x33c675!==_0x251731)return invalidMybatisSource(_0x1d6ea6(0x1c4)+_0x33c675+'>.');if(_0x135104){if(_0x51ad2c[_0x1d6ea6(0x1b7)]()||_0x301bf8)return invalidMybatisSource(_0x1d6ea6(0x1c7)+_0x33c675+'>.');const _0x3052c1=_0xdeddcb['at'](-0x1);if(!_0x3052c1||(_0x3052c1[_0x1d6ea6(0x1ad)]?_0x3052c1[_0x1d6ea6(0x1db)]!==_0x251731:_0x3052c1['rawName']!==_0x33c675))return invalidMybatisSource(_0x1d6ea6(0x1e5)+_0x33c675+'>.');_0xdeddcb['pop']();if(_0x3052c1[_0x1d6ea6(0x1ad)])_0x5a27c5=!![];_0x500006+=MYBATIS_BRANCH_TAGS[_0x1d6ea6(0x1c2)](_0x251731)?'\x20'+MYBATIS_DYNAMIC_END_MARKER+'\x20':'\x20';}else{if(!hasWellFormedXmlAttributes(_0x51ad2c))return invalidMybatisSource('Invalid\x20attributes\x20on\x20MyBatis\x20XML\x20tag:\x20<'+_0x33c675+'>.');if(_0x251731===_0x1d6ea6(0x194)&&(!_0x301bf8||_0xdeddcb['at'](-0x1)?.[_0x1d6ea6(0x1db)]!==_0x1d6ea6(0x1ca)))return invalidMybatisSource(_0x1d6ea6(0x1aa));if(_0x188b96){if(_0x557e83||_0xdeddcb[_0x1d6ea6(0x1dc)]>0x0)return invalidMybatisSource(_0x1d6ea6(0x1bf));_0x557e83=!![],_0x5a27c5=_0x301bf8,_0x1f6524=_0x188b96;}else{if(!_0x557e83||_0x5a27c5)return invalidMybatisSource(_0x1d6ea6(0x19b)+_0x33c675+'>.');}_0x500006+=_0x251731==='where'?_0x1d6ea6(0x1d9):_0x251731==='set'?_0x1d6ea6(0x1a8):_0x251731===_0x1d6ea6(0x1ca)?'\x20'+MYBATIS_INCLUDE_MARKER+'\x20':MYBATIS_BRANCH_TAGS['has'](_0x251731)&&!_0x301bf8?'\x20'+MYBATIS_DYNAMIC_START_MARKER+'\x20':'\x20',!_0x301bf8&&_0xdeddcb['push']({'rawName':_0x33c675,'tagName':_0x251731,'outer':!!_0x188b96});}_0x27a539=_0x22ce99+0x1;}if(_0xdeddcb[_0x1d6ea6(0x1dc)]>0x0)return invalidMybatisSource('Unclosed\x20MyBatis\x20XML\x20tag:\x20<'+_0xdeddcb['at'](-0x1)?.['rawName']+'>.');if(!_0x557e83||!_0x5a27c5)return invalidMybatisSource('MyBatis\x20XML\x20must\x20contain\x20exactly\x20one\x20complete\x20statement\x20wrapper.');return{'sql':_0x500006[_0x1d6ea6(0x1b7)](),'mode':_0x1d6ea6(0x1a3),..._0x1f6524?{'statementType':_0x1f6524}:{}};}function hasWellFormedXmlAttributes(_0x1eae96){const _0x20bc06=a256_0x55358a;let _0x5d2826=0x0;const _0x374f4c=new Set();while(_0x5d2826<_0x1eae96[_0x20bc06(0x1dc)]){while(_0x5d2826<_0x1eae96[_0x20bc06(0x1dc)]&&/\s/[_0x20bc06(0x197)](_0x1eae96[_0x5d2826]??''))_0x5d2826+=0x1;if(_0x5d2826>=_0x1eae96[_0x20bc06(0x1dc)])return!![];const _0x55617f=/^[A-Za-z_:][\w:.-]*/[_0x20bc06(0x1b6)](_0x1eae96[_0x20bc06(0x1bc)](_0x5d2826)),_0xd7177d=_0x55617f?.[0x0];if(!_0xd7177d||_0x374f4c[_0x20bc06(0x1c2)](_0xd7177d))return![];_0x374f4c[_0x20bc06(0x1dd)](_0xd7177d),_0x5d2826+=_0xd7177d['length'];while(_0x5d2826<_0x1eae96['length']&&/\s/['test'](_0x1eae96[_0x5d2826]??''))_0x5d2826+=0x1;if(_0x1eae96[_0x5d2826]!=='=')return![];_0x5d2826+=0x1;while(_0x5d2826<_0x1eae96['length']&&/\s/[_0x20bc06(0x197)](_0x1eae96[_0x5d2826]??''))_0x5d2826+=0x1;const _0x3b6fe9=_0x1eae96[_0x5d2826];if(_0x3b6fe9!=='\x22'&&_0x3b6fe9!=='\x27')return![];_0x5d2826+=0x1;const _0xfcac44=_0x1eae96[_0x20bc06(0x1be)](_0x3b6fe9,_0x5d2826);if(_0xfcac44<0x0)return![];if(decodeXmlEntities(_0x1eae96[_0x20bc06(0x1bc)](_0x5d2826,_0xfcac44))===null)return![];_0x5d2826=_0xfcac44+0x1;}return!![];}function startsWithMybatisStatementWrapper(_0x49142b){const _0x51e094=a256_0x55358a;let _0x24bbf0=0x0;const _0x1e9564=()=>{const _0x28cf6b=a256_0x4859;while(_0x24bbf0<_0x49142b[_0x28cf6b(0x1dc)]&&/\s/[_0x28cf6b(0x197)](_0x49142b[_0x24bbf0]??''))_0x24bbf0+=0x1;};_0x1e9564();while(_0x24bbf0<_0x49142b[_0x51e094(0x1dc)]){if(_0x49142b[_0x51e094(0x1e3)]('<!--',_0x24bbf0)){const _0x4c0e54=_0x49142b[_0x51e094(0x1be)](_0x51e094(0x193),_0x24bbf0+0x4);if(_0x4c0e54<0x0)return!![];_0x24bbf0=_0x4c0e54+0x3,_0x1e9564();continue;}if(_0x49142b[_0x51e094(0x1e3)]('<?',_0x24bbf0)){const _0x30ea8c=_0x49142b[_0x51e094(0x1be)]('?>',_0x24bbf0+0x2);if(_0x30ea8c<0x0)return!![];_0x24bbf0=_0x30ea8c+0x2,_0x1e9564();continue;}break;}return MYBATIS_OUTER_TAG_PATTERN[_0x51e094(0x197)](_0x49142b[_0x51e094(0x1bc)](_0x24bbf0));}function invalidMybatisSource(_0x10b37a){const _0x3c2171=a256_0x55358a;return{'sql':'','mode':_0x3c2171(0x1a3),'error':_0x10b37a};}function findXmlTagEnd(_0x1fe1ef,_0x2057bb){const _0x4f87cf=a256_0x55358a;let _0x5046b9;for(let _0x510d02=_0x2057bb+0x1;_0x510d02<_0x1fe1ef[_0x4f87cf(0x1dc)];_0x510d02+=0x1){const _0x20e5d5=_0x1fe1ef[_0x510d02];if(_0x5046b9){if(_0x20e5d5===_0x5046b9)_0x5046b9=undefined;continue;}if(_0x20e5d5==='\x22'||_0x20e5d5==='\x27'){_0x5046b9=_0x20e5d5;continue;}if(_0x20e5d5==='>')return _0x510d02;}return-0x1;}function decodeXmlEntities(_0x2decc1){const _0x2f6ce2=a256_0x55358a;let _0x46e455=![];const _0x4cc7cd=_0x2decc1[_0x2f6ce2(0x1ba)](/&(?:#x[0-9a-f]+;|#[0-9]+;|[A-Za-z_:][\w:.-]*;)?/g,_0x55effa=>{const _0x2679e8=_0x2f6ce2;if(_0x55effa===_0x2679e8(0x1da))return'<';if(_0x55effa===_0x2679e8(0x1d3))return'>';if(_0x55effa===_0x2679e8(0x1bb))return'\x22';if(_0x55effa===_0x2679e8(0x1c0))return'\x27';if(_0x55effa===_0x2679e8(0x1e4))return'&';const _0x330f68=/^&#(?:x([0-9a-f]+)|([0-9]+));$/[_0x2679e8(0x1b6)](_0x55effa);if(_0x330f68){const _0x664700=_0x330f68[0x1],_0x1fe7b3=_0x330f68[0x2],_0x2b3583=Number[_0x2679e8(0x1c3)](_0x664700??_0x1fe7b3??'',_0x664700?0x10:0xa);if(isValidXmlCharacter(_0x2b3583))return String[_0x2679e8(0x1a9)](_0x2b3583);}return _0x46e455=!![],'';});return _0x46e455?null:_0x4cc7cd;}function isValidXmlCharacter(_0x47aa72){return _0x47aa72===0x9||_0x47aa72===0xa||_0x47aa72===0xd||_0x47aa72>=0x20&&_0x47aa72<=0xd7ff||_0x47aa72>=0xe000&&_0x47aa72<=0xfffd||_0x47aa72>=0x10000&&_0x47aa72<=0x10ffff;}export function detectSqlType(_0x397671){return detectNormalizedSqlType(normalizeSqlForStaticAnalysis(_0x397671));}function a256_0x4859(_0x509f0b,_0x38d4cd){_0x509f0b=_0x509f0b-0x18f;const _0x56f010=a256_0x56f0();let _0x485962=_0x56f010[_0x509f0b];return _0x485962;}function detectNormalizedSqlType(_0x47db8a){const _0x5d9e36=a256_0x55358a;if(_0x47db8a[_0x5d9e36(0x1d5)])return{'type':_0x5d9e36(0x19f),'isSelectOnly':![],'isDangerous':![],'reason':_0x47db8a['error']};if(!_0x47db8a[_0x5d9e36(0x1c6)]['trim']())return{'type':_0x5d9e36(0x19f),'isSelectOnly':![],'isDangerous':![],'reason':_0x5d9e36(0x1ac)};const _0x7adec0=stripStaticAnalysisMarkers(_0x47db8a[_0x5d9e36(0x1c6)])['replace'](/#\{[^}]*\}/g,'?')[_0x5d9e36(0x1ba)](/\$\{[^}]*\}/g,'?')[_0x5d9e36(0x1ba)](/@[^(\s]+(\([^)]*\))?/g,'')['replace'](/\/\*[\s\S]*?\*\//g,'')['trim'](),_0x1d8cef=_0x7adec0[_0x5d9e36(0x1d7)]('\x0a');let _0x24f043='';for(const _0x5a4b4b of _0x1d8cef){const _0x177829=_0x5a4b4b['trim']();if(!_0x177829||_0x177829[_0x5d9e36(0x1e3)]('--')||_0x177829[_0x5d9e36(0x1e3)]('/*'))continue;_0x24f043=_0x177829;break;}const _0x63f348=_0x24f043[_0x5d9e36(0x1e8)](),_0x16d69d=_0x47db8a['statementType'],_0x4f89a1=maskSqlTextForBlockedKeywordScan(_0x7adec0),_0x565164=/\b(DELETE|DROP|ALTER|CREATE|TRUNCATE)\b/i[_0x5d9e36(0x197)](_0x4f89a1);if(_0x16d69d===_0x5d9e36(0x1ec)||!_0x16d69d&&(_0x63f348[_0x5d9e36(0x1e3)]('SELECT')||_0x63f348[_0x5d9e36(0x1e3)]('WITH'))){const _0x4be7ca=/\b(INSERT|UPDATE|DELETE|DROP|ALTER|CREATE|TRUNCATE)\b/i[_0x5d9e36(0x197)](_0x7adec0);return{'type':_0x5d9e36(0x1ec),'isSelectOnly':!_0x4be7ca,'isDangerous':_0x4be7ca,'reason':_0x4be7ca?'SQL\x20contains\x20modification\x20statements\x20alongside\x20SELECT':undefined};}if(_0x16d69d==='INSERT'||!_0x16d69d&&_0x63f348['startsWith'](_0x5d9e36(0x1b2)))return{'type':'INSERT','isSelectOnly':![],'isDangerous':_0x565164,'reason':_0x565164?_0x5d9e36(0x1d6):undefined};if(_0x16d69d===_0x5d9e36(0x1c5)||!_0x16d69d&&_0x63f348[_0x5d9e36(0x1e3)](_0x5d9e36(0x1c5)))return{'type':_0x5d9e36(0x1c5),'isSelectOnly':![],'isDangerous':_0x565164,'reason':_0x565164?_0x5d9e36(0x1d6):undefined};if(_0x16d69d===_0x5d9e36(0x19e)||!_0x16d69d&&_0x63f348[_0x5d9e36(0x1e3)]('DELETE'))return{'type':'DELETE','isSelectOnly':![],'isDangerous':!![],'reason':_0x5d9e36(0x1ed)};if(/^(CREATE|ALTER|DROP|TRUNCATE)/i[_0x5d9e36(0x197)](_0x63f348))return{'type':'DDL','isSelectOnly':![],'isDangerous':!![],'reason':_0x5d9e36(0x1a5)};return{'type':_0x5d9e36(0x19f),'isSelectOnly':![],'isDangerous':![]};}function stripStaticAnalysisMarkers(_0x4fbd26){const _0x30dea9=a256_0x55358a;return _0x4fbd26[_0x30dea9(0x1cc)](MYBATIS_DYNAMIC_START_MARKER,'\x20')[_0x30dea9(0x1cc)](MYBATIS_DYNAMIC_END_MARKER,'\x20')[_0x30dea9(0x1cc)](MYBATIS_INCLUDE_MARKER,'\x20'+UNRESOLVED_SQL_FRAGMENT+'\x20');}function maskSqlTextForBlockedKeywordScan(_0x1803c4){const _0x19d337=a256_0x55358a;return _0x1803c4[_0x19d337(0x1ba)](/'(?:''|\\.|[^'])*'/g,'\x20')[_0x19d337(0x1ba)](/"(?:""|\\.|[^"])*"/g,'\x20')[_0x19d337(0x1ba)](/`(?:``|\\.|[^`])*`/g,'\x20')[_0x19d337(0x1ba)](/--.*$/gm,'\x20')[_0x19d337(0x1ba)](/#.*$/gm,'\x20')[_0x19d337(0x1ba)](/\/\*[\s\S]*?\*\//g,'\x20');}function extractTables(_0x63725b){const _0x148af2=a256_0x55358a,_0x287f27=_0x63725b[_0x148af2(0x1ba)](/#\{[^}]*\}/g,'?')[_0x148af2(0x1ba)](/\$\{[^}]*\}/g,'?')[_0x148af2(0x1ba)](/'[^']*'/g,'\x27\x27')['replace'](/--.*$/gm,'')[_0x148af2(0x1ba)](/\/\*[\s\S]*?\*\//g,''),_0x3d84f8=[],_0x36cde6=_0x287f27[_0x148af2(0x1e0)](/FROM\s+([^\s,)(]+)/i);addTable(_0x3d84f8,_0x36cde6?.[0x1]);for(const _0x421bfa of _0x287f27[_0x148af2(0x1de)](/(?:INNER|LEFT|RIGHT|FULL|CROSS)?\s*JOIN\s+([^\s,)(]+)/gi)){addTable(_0x3d84f8,_0x421bfa[0x1]);}const _0x2944fa=_0x287f27['match'](/INTO\s+([^\s(]+)/i);addTable(_0x3d84f8,_0x2944fa?.[0x1]);const _0x285133=_0x287f27['match'](/UPDATE\s+([^\s,)(]+)/i);return addTable(_0x3d84f8,_0x285133?.[0x1]),_0x3d84f8;}function addTable(_0x5cafe6,_0x27a942){const _0x58590c=a256_0x55358a,_0x1f6f1a=_0x27a942?.['replace'](/[`"]/g,'');_0x1f6f1a&&_0x1f6f1a!==UNRESOLVED_SQL_FRAGMENT&&!_0x5cafe6[_0x58590c(0x19d)](_0x1f6f1a)&&_0x5cafe6[_0x58590c(0x1d4)](_0x1f6f1a);}function a256_0x56f0(){const _0x334847=['66ltLOcv','\x20SET\x20','fromCodePoint','MyBatis\x20<property>\x20must\x20be\x20a\x20self-closing\x20direct\x20child\x20of\x20<include>.','delete','SQL\x20content\x20is\x20empty','outer','Unsupported\x20MyBatis\x20XML\x20tag:\x20<','bind','select','Unterminated\x20XML\x20comment.','INSERT','CDATA\x20sections\x20must\x20be\x20inside\x20the\x20MyBatis\x20statement\x20wrapper.','otherwise','keys','exec','trim',']]>','\x20with\x20parameters:\x20','replace','"','slice','583uOvLmF','indexOf','Multiple\x20MyBatis\x20statement\x20wrappers\x20are\x20not\x20supported.',''','Invalid\x20XML\x20entity\x20reference.','has','parseInt','MyBatis\x20dynamic\x20tag\x20names\x20must\x20be\x20lowercase:\x20<','UPDATE','sql','Invalid\x20MyBatis\x20XML\x20closing\x20tag:\x20</','8691eYgbGs','695235okqBlc','include','choose','replaceAll','unknown\x20table(s)','when','update','Unterminated\x20XML\x20declaration.','Invalid\x20MyBatis\x20XML\x20tag.','where','>','push','error','SQL\x20contains\x20blocked\x20DELETE\x20or\x20DDL\x20statements','split','736WYpUhY','\x20WHERE\x20','<','tagName','length','add','matchAll','12307946OUeuGD','match','foreach','380539OftyJQ','startsWith','&','Mismatched\x20MyBatis\x20XML\x20closing\x20tag:\x20</','<!--','join','toUpperCase',')\x5cb','__RABETBASE_MYBATIS_DYNAMIC_END__','string','SELECT','DELETE\x20statements\x20are\x20blocked\x20from\x20auto-save','__RABETBASE_UNRESOLVED_SQL_FRAGMENT__','type','__RABETBASE_MYBATIS_INCLUDE_UNRESOLVED__','6935670JMqsHk','get','-->','property','Unterminated\x20CDATA\x20section.','XML\x20declarations\x20must\x20precede\x20the\x20MyBatis\x20statement\x20wrapper.','test','Unable\x20to\x20detect\x20SQL\x20type.\x20Please\x20check\x20the\x20SQL\x20content.','Unable\x20to\x20detect\x20SQL\x20type.\x20','set','MyBatis\x20dynamic\x20tag\x20must\x20be\x20inside\x20the\x20statement\x20wrapper:\x20<','reason','includes','DELETE','UNKNOWN','2581072dRqmAb','4AJFhMo','961450YdzUOC','mybatisXml','isDangerous','DDL\x20statements\x20are\x20blocked\x20from\x20auto-save','from'];a256_0x56f0=function(){return _0x334847;};return a256_0x56f0();}function extractParameters(_0x1bf2ef){const _0x3f525d=a256_0x55358a,_0x54bc43=new Set();for(const _0x2c006e of _0x1bf2ef['matchAll'](/[#$]\{\s*([A-Za-z_][\w.]*)\s*(?=[,}])/g)){if(_0x2c006e[0x1])_0x54bc43[_0x3f525d(0x1dd)](_0x2c006e[0x1]);}return Array[_0x3f525d(0x1a6)](_0x54bc43);}export function validateSql(_0x1b05ec){const _0xc66b48=a256_0x55358a,_0x1cf970=normalizeSqlForStaticAnalysis(_0x1b05ec),_0x190082=detectNormalizedSqlType(_0x1cf970),_0x4140f7=stripStaticAnalysisMarkers(_0x1cf970[_0xc66b48(0x1c6)]),_0x3b4e3e=_0x1cf970[_0xc66b48(0x1d5)]?[]:extractTables(_0x4140f7),_0x532802=_0x1cf970[_0xc66b48(0x1d5)]?[]:extractParameters(_0x4140f7);if(_0x190082[_0xc66b48(0x1a4)])return{'valid':![],'sqlType':_0x190082,'tables':_0x3b4e3e,'parameters':_0x532802,'message':_0x190082[_0xc66b48(0x19c)]||_0x190082[_0xc66b48(0x18f)]+'\x20statements\x20cannot\x20be\x20auto-saved.\x20Please\x20operate\x20manually\x20on\x20the\x20platform.'};if(_0x190082[_0xc66b48(0x18f)]===_0xc66b48(0x19f))return{'valid':![],'sqlType':_0x190082,'tables':_0x3b4e3e,'parameters':_0x532802,'message':_0x1cf970[_0xc66b48(0x1d5)]?_0xc66b48(0x199)+_0x1cf970[_0xc66b48(0x1d5)]:_0xc66b48(0x198)};return{'valid':!![],'sqlType':_0x190082,'tables':_0x3b4e3e,'parameters':_0x532802,'message':_0x190082[_0xc66b48(0x18f)]+'\x20query\x20targeting\x20'+(_0x3b4e3e[_0xc66b48(0x1dc)]?_0x3b4e3e[_0xc66b48(0x1e7)](',\x20'):_0xc66b48(0x1cd))+(_0x532802[_0xc66b48(0x1dc)]?_0xc66b48(0x1b9)+_0x532802[_0xc66b48(0x1e7)](',\x20'):'')};}
|
|
1
|
+
const a255_0x580350=a255_0x1537;(function(_0x59c076,_0x755a2b){const _0x36b52a=a255_0x1537,_0x57bd39=_0x59c076();while(!![]){try{const _0x584ded=parseInt(_0x36b52a(0x112))/0x1*(-parseInt(_0x36b52a(0x106))/0x2)+parseInt(_0x36b52a(0xdd))/0x3*(parseInt(_0x36b52a(0x11a))/0x4)+-parseInt(_0x36b52a(0xdb))/0x5+parseInt(_0x36b52a(0x10b))/0x6*(-parseInt(_0x36b52a(0xeb))/0x7)+parseInt(_0x36b52a(0x139))/0x8*(parseInt(_0x36b52a(0x130))/0x9)+parseInt(_0x36b52a(0x102))/0xa+parseInt(_0x36b52a(0xfa))/0xb;if(_0x584ded===_0x755a2b)break;else _0x57bd39['push'](_0x57bd39['shift']());}catch(_0x503c0c){_0x57bd39['push'](_0x57bd39['shift']());}}}(a255_0x521a,0xcaf47));const MYBATIS_OUTER_TAGS=new Map([[a255_0x580350(0xf8),a255_0x580350(0xfd)],[a255_0x580350(0xee),a255_0x580350(0xfb)],['update','UPDATE'],['delete','DELETE']]),MYBATIS_DYNAMIC_TAGS=new Set(['if','where',a255_0x580350(0x11b),'choose','when',a255_0x580350(0x12d),a255_0x580350(0x127),a255_0x580350(0x129),a255_0x580350(0x118),a255_0x580350(0xf5),'property']),MYBATIS_BRANCH_TAGS=new Set(['if',a255_0x580350(0x11b),a255_0x580350(0x10c),a255_0x580350(0xfe),a255_0x580350(0x12d)]);export const MYBATIS_DYNAMIC_START_MARKER=a255_0x580350(0xd9);export const MYBATIS_DYNAMIC_END_MARKER=a255_0x580350(0x126);export const MYBATIS_INCLUDE_MARKER=a255_0x580350(0x11e);const UNRESOLVED_SQL_FRAGMENT=a255_0x580350(0x105),MYBATIS_OUTER_TAG_PATTERN=new RegExp(a255_0x580350(0x107)+[...MYBATIS_OUTER_TAGS[a255_0x580350(0x121)]()][a255_0x580350(0xe3)]('|')+a255_0x580350(0x12e),'i');export function normalizeSqlForStaticAnalysis(_0x4ef783){const _0x2fcde2=a255_0x580350,_0x3de257=typeof _0x4ef783===_0x2fcde2(0x101)?_0x4ef783:'';if(!startsWithMybatisStatementWrapper(_0x3de257))return{'sql':_0x3de257,'mode':'sql'};let _0x397173=0x0,_0x5e6393='',_0x1a481d,_0x2b95b1=![],_0x300a6a=![];const _0x544e00=[];while(_0x397173<_0x3de257[_0x2fcde2(0xdf)]){if(_0x3de257[_0x2fcde2(0x109)](_0x2fcde2(0x120),_0x397173)){const _0x512035=_0x3de257[_0x2fcde2(0x10d)](_0x2fcde2(0xd8),_0x397173+0x4);if(_0x512035<0x0)return invalidMybatisSource('Unterminated\x20XML\x20comment.');_0x5e6393+='\x20',_0x397173=_0x512035+0x3;continue;}if(_0x3de257[_0x2fcde2(0x109)](_0x2fcde2(0xf1),_0x397173)){if(!_0x2b95b1||_0x300a6a)return invalidMybatisSource(_0x2fcde2(0xed));const _0x16788f=_0x3de257[_0x2fcde2(0x10d)](_0x2fcde2(0xf2),_0x397173+0x9);if(_0x16788f<0x0)return invalidMybatisSource(_0x2fcde2(0xf4));_0x5e6393+=_0x3de257['slice'](_0x397173+0x9,_0x16788f),_0x397173=_0x16788f+0x3;continue;}if(_0x3de257['startsWith']('<?',_0x397173)){if(_0x2b95b1)return invalidMybatisSource('XML\x20declarations\x20must\x20precede\x20the\x20MyBatis\x20statement\x20wrapper.');const _0x3f4815=_0x3de257['indexOf']('?>',_0x397173+0x2);if(_0x3f4815<0x0)return invalidMybatisSource(_0x2fcde2(0xe0));_0x5e6393+='\x20',_0x397173=_0x3f4815+0x2;continue;}if(_0x3de257[_0x397173]!=='<'){const _0x2064cb=_0x3de257[_0x2fcde2(0x10d)]('<',_0x397173),_0x594fc8=_0x2064cb<0x0?_0x3de257['length']:_0x2064cb,_0x4bff9f=_0x3de257[_0x2fcde2(0x125)](_0x397173,_0x594fc8);if((!_0x2b95b1||_0x300a6a)&&_0x4bff9f[_0x2fcde2(0x127)]())return invalidMybatisSource(_0x2fcde2(0x124));if(_0x2b95b1&&!_0x300a6a){const _0x3e332e=decodeXmlEntities(_0x4bff9f);if(_0x3e332e===null)return invalidMybatisSource('Invalid\x20XML\x20entity\x20reference.');_0x5e6393+=_0x3e332e;}else _0x5e6393+='\x20';_0x397173=_0x594fc8;continue;}const _0xca79e7=findXmlTagEnd(_0x3de257,_0x397173);if(_0xca79e7<0x0)return invalidMybatisSource(_0x2fcde2(0xf3));const _0x4bf7aa=_0x3de257[_0x2fcde2(0x125)](_0x397173,_0xca79e7+0x1),_0x27423a=/^<\s*(\/?)\s*([A-Za-z][\w:-]*)([\s\S]*?)(\/?)\s*>$/[_0x2fcde2(0x11d)](_0x4bf7aa);if(!_0x27423a)return invalidMybatisSource(_0x2fcde2(0x115));const _0x2efbdf=_0x27423a[0x1]==='/',_0x34aa08=_0x27423a[0x2]??'',_0x38ea95=_0x34aa08[_0x2fcde2(0xf7)](),_0x5a8220=_0x27423a[0x3]??'',_0x1b1f78=_0x27423a[0x4]==='/',_0x3de0b9=MYBATIS_OUTER_TAGS[_0x2fcde2(0xe1)](_0x38ea95);if(!_0x3de0b9&&!MYBATIS_DYNAMIC_TAGS['has'](_0x38ea95))return invalidMybatisSource('Unsupported\x20MyBatis\x20XML\x20tag:\x20<'+_0x38ea95+'>.');if(!_0x3de0b9&&_0x34aa08!==_0x38ea95)return invalidMybatisSource(_0x2fcde2(0x135)+_0x34aa08+'>.');if(_0x2efbdf){if(_0x5a8220['trim']()||_0x1b1f78)return invalidMybatisSource('Invalid\x20MyBatis\x20XML\x20closing\x20tag:\x20</'+_0x34aa08+'>.');const _0x20e145=_0x544e00['at'](-0x1);if(!_0x20e145||(_0x20e145[_0x2fcde2(0xfc)]?_0x20e145[_0x2fcde2(0x119)]!==_0x38ea95:_0x20e145[_0x2fcde2(0x11c)]!==_0x34aa08))return invalidMybatisSource('Mismatched\x20MyBatis\x20XML\x20closing\x20tag:\x20</'+_0x34aa08+'>.');_0x544e00[_0x2fcde2(0x128)]();if(_0x20e145['outer'])_0x300a6a=!![];_0x5e6393+=MYBATIS_BRANCH_TAGS['has'](_0x38ea95)?'\x20'+MYBATIS_DYNAMIC_END_MARKER+'\x20':'\x20';}else{if(!hasWellFormedXmlAttributes(_0x5a8220))return invalidMybatisSource('Invalid\x20attributes\x20on\x20MyBatis\x20XML\x20tag:\x20<'+_0x34aa08+'>.');if(_0x38ea95===_0x2fcde2(0x114)&&(!_0x1b1f78||_0x544e00['at'](-0x1)?.[_0x2fcde2(0x119)]!=='include'))return invalidMybatisSource(_0x2fcde2(0x10a));if(_0x3de0b9){if(_0x2b95b1||_0x544e00[_0x2fcde2(0xdf)]>0x0)return invalidMybatisSource(_0x2fcde2(0x117));_0x2b95b1=!![],_0x300a6a=_0x1b1f78,_0x1a481d=_0x3de0b9;}else{if(!_0x2b95b1||_0x300a6a)return invalidMybatisSource(_0x2fcde2(0x137)+_0x34aa08+'>.');}_0x5e6393+=_0x38ea95==='where'?_0x2fcde2(0xe9):_0x38ea95==='set'?_0x2fcde2(0x136):_0x38ea95===_0x2fcde2(0xf5)?'\x20'+MYBATIS_INCLUDE_MARKER+'\x20':MYBATIS_BRANCH_TAGS[_0x2fcde2(0x10f)](_0x38ea95)&&!_0x1b1f78?'\x20'+MYBATIS_DYNAMIC_START_MARKER+'\x20':'\x20',!_0x1b1f78&&_0x544e00[_0x2fcde2(0xe2)]({'rawName':_0x34aa08,'tagName':_0x38ea95,'outer':!!_0x3de0b9});}_0x397173=_0xca79e7+0x1;}if(_0x544e00[_0x2fcde2(0xdf)]>0x0)return invalidMybatisSource('Unclosed\x20MyBatis\x20XML\x20tag:\x20<'+_0x544e00['at'](-0x1)?.[_0x2fcde2(0x11c)]+'>.');if(!_0x2b95b1||!_0x300a6a)return invalidMybatisSource(_0x2fcde2(0x12c));return{'sql':_0x5e6393[_0x2fcde2(0x127)](),'mode':_0x2fcde2(0x104),..._0x1a481d?{'statementType':_0x1a481d}:{}};}function hasWellFormedXmlAttributes(_0x4a9adf){const _0x48e156=a255_0x580350;let _0x1f26d2=0x0;const _0x246e49=new Set();while(_0x1f26d2<_0x4a9adf['length']){while(_0x1f26d2<_0x4a9adf['length']&&/\s/[_0x48e156(0x111)](_0x4a9adf[_0x1f26d2]??''))_0x1f26d2+=0x1;if(_0x1f26d2>=_0x4a9adf[_0x48e156(0xdf)])return!![];const _0x3be1c0=/^[A-Za-z_:][\w:.-]*/[_0x48e156(0x11d)](_0x4a9adf[_0x48e156(0x125)](_0x1f26d2)),_0x209426=_0x3be1c0?.[0x0];if(!_0x209426||_0x246e49[_0x48e156(0x10f)](_0x209426))return![];_0x246e49[_0x48e156(0x133)](_0x209426),_0x1f26d2+=_0x209426['length'];while(_0x1f26d2<_0x4a9adf[_0x48e156(0xdf)]&&/\s/[_0x48e156(0x111)](_0x4a9adf[_0x1f26d2]??''))_0x1f26d2+=0x1;if(_0x4a9adf[_0x1f26d2]!=='=')return![];_0x1f26d2+=0x1;while(_0x1f26d2<_0x4a9adf[_0x48e156(0xdf)]&&/\s/['test'](_0x4a9adf[_0x1f26d2]??''))_0x1f26d2+=0x1;const _0x1fafc0=_0x4a9adf[_0x1f26d2];if(_0x1fafc0!=='\x22'&&_0x1fafc0!=='\x27')return![];_0x1f26d2+=0x1;const _0x619d28=_0x4a9adf[_0x48e156(0x10d)](_0x1fafc0,_0x1f26d2);if(_0x619d28<0x0)return![];if(decodeXmlEntities(_0x4a9adf['slice'](_0x1f26d2,_0x619d28))===null)return![];_0x1f26d2=_0x619d28+0x1;}return!![];}function a255_0x1537(_0x1d44c5,_0x225ed5){_0x1d44c5=_0x1d44c5-0xd8;const _0x521ad3=a255_0x521a();let _0x153729=_0x521ad3[_0x1d44c5];return _0x153729;}function startsWithMybatisStatementWrapper(_0x33a3e9){const _0x2e8a47=a255_0x580350;let _0x387755=0x0;const _0x49ac28=()=>{const _0x425ec3=a255_0x1537;while(_0x387755<_0x33a3e9['length']&&/\s/[_0x425ec3(0x111)](_0x33a3e9[_0x387755]??''))_0x387755+=0x1;};_0x49ac28();while(_0x387755<_0x33a3e9['length']){if(_0x33a3e9[_0x2e8a47(0x109)]('<!--',_0x387755)){const _0x272279=_0x33a3e9[_0x2e8a47(0x10d)](_0x2e8a47(0xd8),_0x387755+0x4);if(_0x272279<0x0)return!![];_0x387755=_0x272279+0x3,_0x49ac28();continue;}if(_0x33a3e9[_0x2e8a47(0x109)]('<?',_0x387755)){const _0x4e218d=_0x33a3e9[_0x2e8a47(0x10d)]('?>',_0x387755+0x2);if(_0x4e218d<0x0)return!![];_0x387755=_0x4e218d+0x2,_0x49ac28();continue;}break;}return MYBATIS_OUTER_TAG_PATTERN[_0x2e8a47(0x111)](_0x33a3e9['slice'](_0x387755));}function invalidMybatisSource(_0x472a7c){const _0x32e0c3=a255_0x580350;return{'sql':'','mode':_0x32e0c3(0x104),'error':_0x472a7c};}function findXmlTagEnd(_0x573a5a,_0x4b98e2){let _0x35b37b;for(let _0x487ed6=_0x4b98e2+0x1;_0x487ed6<_0x573a5a['length'];_0x487ed6+=0x1){const _0x250486=_0x573a5a[_0x487ed6];if(_0x35b37b){if(_0x250486===_0x35b37b)_0x35b37b=undefined;continue;}if(_0x250486==='\x22'||_0x250486==='\x27'){_0x35b37b=_0x250486;continue;}if(_0x250486==='>')return _0x487ed6;}return-0x1;}function decodeXmlEntities(_0x575bfe){const _0x78e79d=a255_0x580350;let _0x331f9a=![];const _0x49ee1c=_0x575bfe[_0x78e79d(0x113)](/&(?:#x[0-9a-f]+;|#[0-9]+;|[A-Za-z_:][\w:.-]*;)?/g,_0x58a256=>{const _0x51a2d8=_0x78e79d;if(_0x58a256===_0x51a2d8(0xea))return'<';if(_0x58a256===_0x51a2d8(0xf0))return'>';if(_0x58a256==='"')return'\x22';if(_0x58a256===_0x51a2d8(0x103))return'\x27';if(_0x58a256===_0x51a2d8(0x116))return'&';const _0x2565b0=/^&#(?:x([0-9a-f]+)|([0-9]+));$/[_0x51a2d8(0x11d)](_0x58a256);if(_0x2565b0){const _0x366034=_0x2565b0[0x1],_0x4e0937=_0x2565b0[0x2],_0xd24d2a=Number[_0x51a2d8(0xe6)](_0x366034??_0x4e0937??'',_0x366034?0x10:0xa);if(isValidXmlCharacter(_0xd24d2a))return String['fromCodePoint'](_0xd24d2a);}return _0x331f9a=!![],'';});return _0x331f9a?null:_0x49ee1c;}function isValidXmlCharacter(_0x21484f){return _0x21484f===0x9||_0x21484f===0xa||_0x21484f===0xd||_0x21484f>=0x20&&_0x21484f<=0xd7ff||_0x21484f>=0xe000&&_0x21484f<=0xfffd||_0x21484f>=0x10000&&_0x21484f<=0x10ffff;}export function detectSqlType(_0x1e2ba5){return detectNormalizedSqlType(normalizeSqlForStaticAnalysis(_0x1e2ba5));}function detectNormalizedSqlType(_0x13b91e){const _0x27d1d1=a255_0x580350;if(_0x13b91e[_0x27d1d1(0x12a)])return{'type':_0x27d1d1(0x123),'isSelectOnly':![],'isDangerous':![],'reason':_0x13b91e[_0x27d1d1(0x12a)]};if(!_0x13b91e[_0x27d1d1(0xf6)][_0x27d1d1(0x127)]())return{'type':_0x27d1d1(0x123),'isSelectOnly':![],'isDangerous':![],'reason':_0x27d1d1(0xe7)};const _0x234e89=stripStaticAnalysisMarkers(_0x13b91e['sql'])[_0x27d1d1(0x113)](/#\{[^}]*\}/g,'?')[_0x27d1d1(0x113)](/\$\{[^}]*\}/g,'?')[_0x27d1d1(0x113)](/@[^(\s]+(\([^)]*\))?/g,'')[_0x27d1d1(0x113)](/\/\*[\s\S]*?\*\//g,'')[_0x27d1d1(0x127)](),_0x48ac41=_0x234e89[_0x27d1d1(0xe8)]('\x0a');let _0x4e63d2='';for(const _0x36f7b1 of _0x48ac41){const _0x14f984=_0x36f7b1[_0x27d1d1(0x127)]();if(!_0x14f984||_0x14f984[_0x27d1d1(0x109)]('--')||_0x14f984[_0x27d1d1(0x109)]('/*'))continue;_0x4e63d2=_0x14f984;break;}const _0x4c0188=_0x4e63d2[_0x27d1d1(0xde)](),_0xd58f29=_0x13b91e[_0x27d1d1(0x100)],_0x2ff079=maskSqlTextForBlockedKeywordScan(_0x234e89),_0x1b69b4=/\b(DELETE|DROP|ALTER|CREATE|TRUNCATE)\b/i[_0x27d1d1(0x111)](_0x2ff079);if(_0xd58f29===_0x27d1d1(0xfd)||!_0xd58f29&&(_0x4c0188['startsWith'](_0x27d1d1(0xfd))||_0x4c0188[_0x27d1d1(0x109)](_0x27d1d1(0xdc)))){const _0x5edc81=/\b(INSERT|UPDATE|DELETE|DROP|ALTER|CREATE|TRUNCATE)\b/i[_0x27d1d1(0x111)](_0x234e89);return{'type':'SELECT','isSelectOnly':!_0x5edc81,'isDangerous':_0x5edc81,'reason':_0x5edc81?_0x27d1d1(0x110):undefined};}if(_0xd58f29===_0x27d1d1(0xfb)||!_0xd58f29&&_0x4c0188['startsWith'](_0x27d1d1(0xfb)))return{'type':'INSERT','isSelectOnly':![],'isDangerous':_0x1b69b4,'reason':_0x1b69b4?_0x27d1d1(0x12b):undefined};if(_0xd58f29==='UPDATE'||!_0xd58f29&&_0x4c0188[_0x27d1d1(0x109)]('UPDATE'))return{'type':'UPDATE','isSelectOnly':![],'isDangerous':_0x1b69b4,'reason':_0x1b69b4?_0x27d1d1(0x12b):undefined};if(_0xd58f29===_0x27d1d1(0x122)||!_0xd58f29&&_0x4c0188[_0x27d1d1(0x109)](_0x27d1d1(0x122)))return{'type':_0x27d1d1(0x122),'isSelectOnly':![],'isDangerous':!![],'reason':_0x27d1d1(0x108)};if(/^(CREATE|ALTER|DROP|TRUNCATE)/i['test'](_0x4c0188))return{'type':_0x27d1d1(0xec),'isSelectOnly':![],'isDangerous':!![],'reason':_0x27d1d1(0x11f)};return{'type':_0x27d1d1(0x123),'isSelectOnly':![],'isDangerous':![]};}function stripStaticAnalysisMarkers(_0x3e5448){const _0x2d2fa4=a255_0x580350;return _0x3e5448['replaceAll'](MYBATIS_DYNAMIC_START_MARKER,'\x20')['replaceAll'](MYBATIS_DYNAMIC_END_MARKER,'\x20')[_0x2d2fa4(0x131)](MYBATIS_INCLUDE_MARKER,'\x20'+UNRESOLVED_SQL_FRAGMENT+'\x20');}function maskSqlTextForBlockedKeywordScan(_0x3c1149){const _0x29954f=a255_0x580350;return _0x3c1149['replace'](/'(?:''|\\.|[^'])*'/g,'\x20')[_0x29954f(0x113)](/"(?:""|\\.|[^"])*"/g,'\x20')[_0x29954f(0x113)](/`(?:``|\\.|[^`])*`/g,'\x20')[_0x29954f(0x113)](/--.*$/gm,'\x20')[_0x29954f(0x113)](/#.*$/gm,'\x20')[_0x29954f(0x113)](/\/\*[\s\S]*?\*\//g,'\x20');}function extractTables(_0x5bc90c){const _0xf1e602=a255_0x580350,_0x4befa5=_0x5bc90c['replace'](/#\{[^}]*\}/g,'?')[_0xf1e602(0x113)](/\$\{[^}]*\}/g,'?')[_0xf1e602(0x113)](/'[^']*'/g,'\x27\x27')['replace'](/--.*$/gm,'')[_0xf1e602(0x113)](/\/\*[\s\S]*?\*\//g,''),_0x180beb=[],_0x365643=_0x4befa5[_0xf1e602(0x12f)](/FROM\s+([^\s,)(]+)/i);addTable(_0x180beb,_0x365643?.[0x1]);for(const _0x27396f of _0x4befa5['matchAll'](/(?:INNER|LEFT|RIGHT|FULL|CROSS)?\s*JOIN\s+([^\s,)(]+)/gi)){addTable(_0x180beb,_0x27396f[0x1]);}const _0x22e931=_0x4befa5[_0xf1e602(0x12f)](/INTO\s+([^\s(]+)/i);addTable(_0x180beb,_0x22e931?.[0x1]);const _0x2f3b8a=_0x4befa5['match'](/UPDATE\s+([^\s,)(]+)/i);return addTable(_0x180beb,_0x2f3b8a?.[0x1]),_0x180beb;}function a255_0x521a(){const _0x271bdf=['unknown\x20table(s)','>','<![CDATA[',']]>','Unterminated\x20MyBatis\x20XML\x20tag.','Unterminated\x20CDATA\x20section.','include','sql','toLowerCase','select','matchAll','16989368qSFNAT','INSERT','outer','SELECT','when','Unable\x20to\x20detect\x20SQL\x20type.\x20Please\x20check\x20the\x20SQL\x20content.','statementType','string','9293240pRlfiH',''','mybatisXml','__RABETBASE_UNRESOLVED_SQL_FRAGMENT__','1566758UdMsTP','^<\x5cs*(?:','DELETE\x20statements\x20are\x20blocked\x20from\x20auto-save','startsWith','MyBatis\x20<property>\x20must\x20be\x20a\x20self-closing\x20direct\x20child\x20of\x20<include>.','646746HfvsMS','choose','indexOf','Unable\x20to\x20detect\x20SQL\x20type.\x20','has','SQL\x20contains\x20modification\x20statements\x20alongside\x20SELECT','test','1fufBfB','replace','property','Invalid\x20MyBatis\x20XML\x20tag.','&','Multiple\x20MyBatis\x20statement\x20wrappers\x20are\x20not\x20supported.','bind','tagName','4539716ixnzbJ','foreach','rawName','exec','__RABETBASE_MYBATIS_INCLUDE_UNRESOLVED__','DDL\x20statements\x20are\x20blocked\x20from\x20auto-save','<!--','keys','DELETE','UNKNOWN','SQL\x20text\x20must\x20be\x20inside\x20the\x20MyBatis\x20statement\x20wrapper.','slice','__RABETBASE_MYBATIS_DYNAMIC_END__','trim','pop','set','error','SQL\x20contains\x20blocked\x20DELETE\x20or\x20DDL\x20statements','MyBatis\x20XML\x20must\x20contain\x20exactly\x20one\x20complete\x20statement\x20wrapper.','otherwise',')\x5cb','match','2178mjsjTo','replaceAll','\x20query\x20targeting\x20','add','type','MyBatis\x20dynamic\x20tag\x20names\x20must\x20be\x20lowercase:\x20<','\x20SET\x20','MyBatis\x20dynamic\x20tag\x20must\x20be\x20inside\x20the\x20statement\x20wrapper:\x20<','\x20statements\x20cannot\x20be\x20auto-saved.\x20Please\x20operate\x20manually\x20on\x20the\x20platform.','6296VbsTIS','-->','__RABETBASE_MYBATIS_DYNAMIC_START__','includes','3916150rjKspR','WITH','3ADlGXV','toUpperCase','length','Unterminated\x20XML\x20declaration.','get','push','join','from','\x20with\x20parameters:\x20','parseInt','SQL\x20content\x20is\x20empty','split','\x20WHERE\x20','<','91BHtdsP','DDL','CDATA\x20sections\x20must\x20be\x20inside\x20the\x20MyBatis\x20statement\x20wrapper.','insert'];a255_0x521a=function(){return _0x271bdf;};return a255_0x521a();}function addTable(_0x1782e0,_0x4bdbf5){const _0x6207af=a255_0x580350,_0x47be33=_0x4bdbf5?.[_0x6207af(0x113)](/[`"]/g,'');_0x47be33&&_0x47be33!==UNRESOLVED_SQL_FRAGMENT&&!_0x1782e0[_0x6207af(0xda)](_0x47be33)&&_0x1782e0['push'](_0x47be33);}function extractParameters(_0x2b3256){const _0x56f950=a255_0x580350,_0x3c92fd=new Set();for(const _0x19ded8 of _0x2b3256[_0x56f950(0xf9)](/[#$]\{\s*([A-Za-z_][\w.]*)\s*(?=[,}])/g)){if(_0x19ded8[0x1])_0x3c92fd[_0x56f950(0x133)](_0x19ded8[0x1]);}return Array[_0x56f950(0xe4)](_0x3c92fd);}export function validateSql(_0x51f173){const _0x36d100=a255_0x580350,_0x586d27=normalizeSqlForStaticAnalysis(_0x51f173),_0x14def0=detectNormalizedSqlType(_0x586d27),_0x5d128b=stripStaticAnalysisMarkers(_0x586d27[_0x36d100(0xf6)]),_0x3ac902=_0x586d27[_0x36d100(0x12a)]?[]:extractTables(_0x5d128b),_0x354b49=_0x586d27[_0x36d100(0x12a)]?[]:extractParameters(_0x5d128b);if(_0x14def0['isDangerous'])return{'valid':![],'sqlType':_0x14def0,'tables':_0x3ac902,'parameters':_0x354b49,'message':_0x14def0['reason']||_0x14def0['type']+_0x36d100(0x138)};if(_0x14def0[_0x36d100(0x134)]==='UNKNOWN')return{'valid':![],'sqlType':_0x14def0,'tables':_0x3ac902,'parameters':_0x354b49,'message':_0x586d27[_0x36d100(0x12a)]?_0x36d100(0x10e)+_0x586d27[_0x36d100(0x12a)]:_0x36d100(0xff)};return{'valid':!![],'sqlType':_0x14def0,'tables':_0x3ac902,'parameters':_0x354b49,'message':_0x14def0[_0x36d100(0x134)]+_0x36d100(0x132)+(_0x3ac902[_0x36d100(0xdf)]?_0x3ac902[_0x36d100(0xe3)](',\x20'):_0x36d100(0xef))+(_0x354b49[_0x36d100(0xdf)]?_0x36d100(0xe5)+_0x354b49[_0x36d100(0xe3)](',\x20'):'')};}
|