@hedeqiang/dsh-nl2sql 0.12.1 → 0.13.0
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/CHANGELOG.md +39 -1
- package/README.md +22 -0
- package/README.zh-CN.md +22 -0
- package/analysis.js +4 -1
- package/bin/nl2sql-mcp.mjs +103 -0
- package/channels/dingtalk.js +11 -9
- package/channels/lark.js +17 -9
- package/channels/message.js +48 -12
- package/channels/telegram.js +13 -6
- package/channels/wecom.js +10 -9
- package/cordis.patch.yml +4 -0
- package/docs/mcp.md +119 -0
- package/filters.js +87 -33
- package/index.js +21 -3
- package/lib/client.js +2122 -153
- package/package.json +6 -1
- package/service/alerts.js +60 -26
- package/service/bots.js +38 -12
- package/service/channels.js +26 -5
- package/service/dashboards.js +5 -2
- package/service/datasources.js +16 -3
- package/service/features.js +21 -0
- package/service/forecast.js +252 -0
- package/service/freshness.js +747 -0
- package/service/mcp.js +677 -0
- package/service/pptx.js +362 -0
- package/service/present.js +516 -0
- package/service/proactive.js +531 -0
- package/service/query.js +39 -10
- package/service/reconcile.js +565 -0
- package/service/shared.js +27 -0
- package/service/subscriptions.js +563 -0
- package/service/uploads.js +4 -1
- package/sql-guard.js +33 -2
- package/xlsx.js +12 -2
package/xlsx.js
CHANGED
|
@@ -208,6 +208,16 @@ const STYLES_XML = XML_HEAD +
|
|
|
208
208
|
|
|
209
209
|
const SHEET_NAME_BAD_RE = /[\[\]:*?/\\]/g;
|
|
210
210
|
|
|
211
|
+
/** First `max` UTF-16 units of `s` (Excel's sheet-name limit), never splitting a surrogate pair. */
|
|
212
|
+
function utf16Prefix(s, max) {
|
|
213
|
+
let out = '';
|
|
214
|
+
for (const ch of s) {
|
|
215
|
+
if (out.length + ch.length > max) break;
|
|
216
|
+
out += ch;
|
|
217
|
+
}
|
|
218
|
+
return out;
|
|
219
|
+
}
|
|
220
|
+
|
|
211
221
|
/** Make Excel-safe, unique (case-insensitive), non-empty sheet names. */
|
|
212
222
|
function sanitizeSheetNames(names) {
|
|
213
223
|
const used = new Set(['history']); // "History" is reserved by Excel
|
|
@@ -215,11 +225,11 @@ function sanitizeSheetNames(names) {
|
|
|
215
225
|
let base = stripIllegal(String(raw ?? '')).replace(SHEET_NAME_BAD_RE, '_').replace(/[\r\n\t]/g, ' ').trim();
|
|
216
226
|
base = base.replace(/^'+|'+$/g, '').trim();
|
|
217
227
|
if (!base) base = `Sheet${i + 1}`;
|
|
218
|
-
base =
|
|
228
|
+
base = utf16Prefix(base, 31);
|
|
219
229
|
let name = base;
|
|
220
230
|
for (let n = 2; used.has(name.toLowerCase()); n++) {
|
|
221
231
|
const suffix = ` (${n})`;
|
|
222
|
-
name =
|
|
232
|
+
name = utf16Prefix(base, 31 - suffix.length).trimEnd() + suffix;
|
|
223
233
|
}
|
|
224
234
|
used.add(name.toLowerCase());
|
|
225
235
|
return name;
|