From e35aa44d626ae556d9b5fd18f3b98c8a655ca7eb Mon Sep 17 00:00:00 2001 From: Feynman Date: Mon, 27 Jul 2026 18:00:39 +0800 Subject: [PATCH] feat: add JSON5 support and enhance MQL editor functionality - Introduced JSON5 language support in the Monaco editor for improved JSON handling. - Updated MQL editor to validate and normalize JSON5 input. - Enhanced Drawer component to utilize normalized custom queries for customer queries. - Added json5 dependency to package.json and pnpm-lock.yaml for compatibility. --- packages/business/package.json | 1 + .../business/src/views/data-server/Drawer.vue | 11 +- .../src/views/data-server/MqlEditor.vue | 167 ++++++++++++++---- packages/ldp/src/DataTracePage.vue | 25 ++- pnpm-lock.yaml | 3 + 5 files changed, 166 insertions(+), 41 deletions(-) diff --git a/packages/business/package.json b/packages/business/package.json index 7756e8b28..079c23410 100644 --- a/packages/business/package.json +++ b/packages/business/package.json @@ -20,6 +20,7 @@ "axios": "catalog:", "cron-parser": "catalog:", "dayjs": "catalog:", + "json5": "^2.2.3", "juice": "catalog:", "lodash": "catalog:", "monaco-editor": "catalog:", diff --git a/packages/business/src/views/data-server/Drawer.vue b/packages/business/src/views/data-server/Drawer.vue index b9c81c7e0..31ced82c5 100644 --- a/packages/business/src/views/data-server/Drawer.vue +++ b/packages/business/src/views/data-server/Drawer.vue @@ -453,6 +453,11 @@ const save = async (type?: boolean) => { } } + const normalizedCustomWhere = + apiType === 'customerQuery' && fullCustomQuery + ? mqlEditor.value?.normalize(customWhere) ?? customWhere + : customWhere + const params = form.value?.params ?.filter((t: any) => t.name) .map((t: any) => { @@ -537,12 +542,16 @@ const save = async (type?: boolean) => { fields, path, fullCustomQuery, - customWhere, + customWhere: normalizedCustomWhere, }, ], pathSetting: pathSettingList, } + if (apiType === 'customerQuery' && fullCustomQuery) { + form.value.customWhere = normalizedCustomWhere + } + if (!type && connectionId && tableName) { formData.fields = allFields.value // const fieldList = await getAllFields() diff --git a/packages/business/src/views/data-server/MqlEditor.vue b/packages/business/src/views/data-server/MqlEditor.vue index 39eb2def1..fb8dfc5fd 100644 --- a/packages/business/src/views/data-server/MqlEditor.vue +++ b/packages/business/src/views/data-server/MqlEditor.vue @@ -1,10 +1,12 @@