sa2kit 1.6.23 → 1.6.24
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/dist/{chunk-7XLFSPDG.mjs → chunk-LFB5EIIM.mjs} +2 -2
- package/dist/chunk-LFB5EIIM.mjs.map +1 -0
- package/dist/{chunk-GCVOKQZP.js → chunk-UIYKZ73N.js} +2 -2
- package/dist/chunk-UIYKZ73N.js.map +1 -0
- package/dist/{types-XTo80Oi_.d.mts → types-DszP7SAQ.d.mts} +1 -1
- package/dist/{types-XTo80Oi_.d.ts → types-DszP7SAQ.d.ts} +1 -1
- package/dist/universalExport/index.d.mts +5 -3
- package/dist/universalExport/index.d.ts +5 -3
- package/dist/universalExport/index.js +97 -53
- package/dist/universalExport/index.js.map +1 -1
- package/dist/universalExport/index.mjs +93 -49
- package/dist/universalExport/index.mjs.map +1 -1
- package/dist/universalExport/server/index.d.mts +1 -1
- package/dist/universalExport/server/index.d.ts +1 -1
- package/dist/universalExport/server/index.js +23 -18
- package/dist/universalExport/server/index.js.map +1 -1
- package/dist/universalExport/server/index.mjs +9 -4
- package/dist/universalExport/server/index.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-7XLFSPDG.mjs.map +0 -1
- package/dist/chunk-GCVOKQZP.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkUIYKZ73N_js = require('../../chunk-UIYKZ73N.js');
|
|
4
4
|
var chunk6PRFP5EG_js = require('../../chunk-6PRFP5EG.js');
|
|
5
5
|
require('../../chunk-DGUM43GV.js');
|
|
6
6
|
var XLSX = require('xlsx');
|
|
@@ -112,7 +112,7 @@ var UniversalExportService = class {
|
|
|
112
112
|
updatedAt: /* @__PURE__ */ new Date()
|
|
113
113
|
});
|
|
114
114
|
if (!this.client) {
|
|
115
|
-
throw new
|
|
115
|
+
throw new chunkUIYKZ73N_js.ExportConfigError("\u672A\u63D0\u4F9B\u5BFC\u51FA\u5BA2\u6237\u7AEF\u670D\u52A1", config);
|
|
116
116
|
}
|
|
117
117
|
const newConfig = await this.client.createConfig(config);
|
|
118
118
|
this.configCache.set(newConfig.id, {
|
|
@@ -127,7 +127,7 @@ var UniversalExportService = class {
|
|
|
127
127
|
});
|
|
128
128
|
return newConfig;
|
|
129
129
|
} catch (error) {
|
|
130
|
-
throw new
|
|
130
|
+
throw new chunkUIYKZ73N_js.ExportConfigError(
|
|
131
131
|
`\u521B\u5EFA\u5BFC\u51FA\u914D\u7F6E\u5931\u8D25: ${error instanceof Error ? error.message : "\u672A\u77E5\u9519\u8BEF"}`,
|
|
132
132
|
{ originalError: error }
|
|
133
133
|
);
|
|
@@ -149,7 +149,7 @@ var UniversalExportService = class {
|
|
|
149
149
|
async updateConfig(configId, updates) {
|
|
150
150
|
const existing = await this.getConfig(configId);
|
|
151
151
|
if (!existing) {
|
|
152
|
-
throw new
|
|
152
|
+
throw new chunkUIYKZ73N_js.ExportConfigError(`\u914D\u7F6E\u4E0D\u5B58\u5728: ${configId}`);
|
|
153
153
|
}
|
|
154
154
|
const updatedConfig = {
|
|
155
155
|
...existing,
|
|
@@ -175,7 +175,7 @@ var UniversalExportService = class {
|
|
|
175
175
|
async deleteConfig(configId) {
|
|
176
176
|
const existing = await this.getConfig(configId);
|
|
177
177
|
if (!existing) {
|
|
178
|
-
throw new
|
|
178
|
+
throw new chunkUIYKZ73N_js.ExportConfigError(`\u914D\u7F6E\u4E0D\u5B58\u5728: ${configId}`);
|
|
179
179
|
}
|
|
180
180
|
this.configCache.delete(configId);
|
|
181
181
|
this.emitEvent({
|
|
@@ -190,7 +190,7 @@ var UniversalExportService = class {
|
|
|
190
190
|
*/
|
|
191
191
|
async getConfigsByModule(moduleId, businessId) {
|
|
192
192
|
if (!this.client) {
|
|
193
|
-
throw new
|
|
193
|
+
throw new chunkUIYKZ73N_js.ExportConfigError("\u672A\u63D0\u4F9B\u5BFC\u51FA\u5BA2\u6237\u7AEF\u670D\u52A1", { moduleId, businessId });
|
|
194
194
|
}
|
|
195
195
|
return await this.client.getConfigsByModule(moduleId, businessId);
|
|
196
196
|
}
|
|
@@ -225,7 +225,7 @@ var UniversalExportService = class {
|
|
|
225
225
|
logger.info("\u{1F50D} [UniversalExportService] \u4ECE\u7F13\u5B58\u83B7\u53D6\u914D\u7F6E:", request.configId);
|
|
226
226
|
const cachedConfig = await this.getConfig(request.configId);
|
|
227
227
|
if (!cachedConfig) {
|
|
228
|
-
throw new
|
|
228
|
+
throw new chunkUIYKZ73N_js.ExportConfigError(`\u5BFC\u51FA\u914D\u7F6E\u4E0D\u5B58\u5728: ${request.configId}`);
|
|
229
229
|
}
|
|
230
230
|
config = cachedConfig;
|
|
231
231
|
logger.info("\u2705 [UniversalExportService] \u6210\u529F\u83B7\u53D6\u7F13\u5B58\u914D\u7F6E:", {
|
|
@@ -388,19 +388,19 @@ var UniversalExportService = class {
|
|
|
388
388
|
*/
|
|
389
389
|
validateConfig(config) {
|
|
390
390
|
if (!config.name || config.name.trim() === "") {
|
|
391
|
-
throw new
|
|
391
|
+
throw new chunkUIYKZ73N_js.ExportConfigError("\u914D\u7F6E\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A");
|
|
392
392
|
}
|
|
393
393
|
if (!config.fields || config.fields.length === 0) {
|
|
394
|
-
throw new
|
|
394
|
+
throw new chunkUIYKZ73N_js.ExportConfigError("\u81F3\u5C11\u9700\u8981\u5B9A\u4E49\u4E00\u4E2A\u5B57\u6BB5");
|
|
395
395
|
}
|
|
396
396
|
const enabledFields = config.fields.filter((f) => f.enabled);
|
|
397
397
|
if (enabledFields.length === 0) {
|
|
398
|
-
throw new
|
|
398
|
+
throw new chunkUIYKZ73N_js.ExportConfigError("\u81F3\u5C11\u9700\u8981\u542F\u7528\u4E00\u4E2A\u5B57\u6BB5");
|
|
399
399
|
}
|
|
400
400
|
const keys = config.fields.map((f) => f.key);
|
|
401
401
|
const uniqueKeys = new Set(keys);
|
|
402
402
|
if (keys.length !== uniqueKeys.size) {
|
|
403
|
-
throw new
|
|
403
|
+
throw new chunkUIYKZ73N_js.ExportConfigError("\u5B57\u6BB5\u952E\u540D\u5FC5\u987B\u552F\u4E00");
|
|
404
404
|
}
|
|
405
405
|
}
|
|
406
406
|
/**
|
|
@@ -409,6 +409,12 @@ var UniversalExportService = class {
|
|
|
409
409
|
async getData(request) {
|
|
410
410
|
logger.info("\u{1F50D} [UniversalExportService] getData \u5F00\u59CB\u6267\u884C...");
|
|
411
411
|
try {
|
|
412
|
+
if (Array.isArray(request.dataSource)) {
|
|
413
|
+
logger.info("\u{1F4E6} [UniversalExportService] \u4F7F\u7528\u76F4\u63A5\u4F20\u9012\u7684\u6570\u636E\u6570\u7EC4:", {
|
|
414
|
+
length: request.dataSource.length
|
|
415
|
+
});
|
|
416
|
+
return request.dataSource;
|
|
417
|
+
}
|
|
412
418
|
if (typeof request.dataSource === "function") {
|
|
413
419
|
logger.info("\u{1F4DE} [UniversalExportService] \u8C03\u7528\u6570\u636E\u6E90\u51FD\u6570...");
|
|
414
420
|
const data = await request.dataSource();
|
|
@@ -418,13 +424,12 @@ var UniversalExportService = class {
|
|
|
418
424
|
length: Array.isArray(data) ? data.length : "N/A"
|
|
419
425
|
});
|
|
420
426
|
return data;
|
|
421
|
-
} else {
|
|
422
|
-
console.error("\u274C [UniversalExportService] \u6570\u636E\u6E90\u4E0D\u662F\u51FD\u6570:", typeof request.dataSource);
|
|
423
|
-
throw new chunkGCVOKQZP_js.ExportDataError("\u6682\u4E0D\u652F\u6301\u5B57\u7B26\u4E32\u6570\u636E\u6E90");
|
|
424
427
|
}
|
|
428
|
+
console.error("\u274C [UniversalExportService] \u6570\u636E\u6E90\u7C7B\u578B\u4E0D\u652F\u6301:", typeof request.dataSource);
|
|
429
|
+
throw new chunkUIYKZ73N_js.ExportDataError("\u4E0D\u652F\u6301\u7684\u6570\u636E\u6E90\u7C7B\u578B");
|
|
425
430
|
} catch (error) {
|
|
426
431
|
console.error("\u274C [UniversalExportService] \u83B7\u53D6\u6570\u636E\u5931\u8D25:", error);
|
|
427
|
-
throw new
|
|
432
|
+
throw new chunkUIYKZ73N_js.ExportDataError(
|
|
428
433
|
`\u83B7\u53D6\u6570\u636E\u5931\u8D25: ${error instanceof Error ? error.message : "\u672A\u77E5\u9519\u8BEF"}`,
|
|
429
434
|
{ originalError: error }
|
|
430
435
|
);
|
|
@@ -662,11 +667,11 @@ var UniversalExportService = class {
|
|
|
662
667
|
break;
|
|
663
668
|
default:
|
|
664
669
|
console.error("\u274C [UniversalExportService] \u4E0D\u652F\u6301\u7684\u683C\u5F0F:", config.format);
|
|
665
|
-
throw new
|
|
670
|
+
throw new chunkUIYKZ73N_js.ExportFileError(`\u4E0D\u652F\u6301\u7684\u5BFC\u51FA\u683C\u5F0F: ${config.format}`);
|
|
666
671
|
}
|
|
667
672
|
const blob = new Blob([content], { type: this.getMimeType(config.format) });
|
|
668
673
|
if (blob.size > this.config.maxFileSize) {
|
|
669
|
-
throw new
|
|
674
|
+
throw new chunkUIYKZ73N_js.ExportFileError(`\u6587\u4EF6\u5927\u5C0F\u8D85\u8FC7\u9650\u5236: ${blob.size} > ${this.config.maxFileSize}`);
|
|
670
675
|
}
|
|
671
676
|
const endTime = /* @__PURE__ */ new Date();
|
|
672
677
|
const duration = endTime.getTime() - startTime.getTime();
|
|
@@ -687,7 +692,7 @@ var UniversalExportService = class {
|
|
|
687
692
|
}
|
|
688
693
|
};
|
|
689
694
|
} catch (error) {
|
|
690
|
-
throw new
|
|
695
|
+
throw new chunkUIYKZ73N_js.ExportFileError(
|
|
691
696
|
`\u751F\u6210\u6587\u4EF6\u5931\u8D25: ${error instanceof Error ? error.message : "\u672A\u77E5\u9519\u8BEF"}`,
|
|
692
697
|
{ originalError: error }
|
|
693
698
|
);
|