@ims-view/server 1.1.0 → 1.2.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/README.md +18 -1
- package/lib/excel/excel-parse.worker.cjs +279 -0
- package/lib/server/src/app.module.js.map +1 -0
- package/lib/server/src/config/env.d.ts +40 -0
- package/lib/server/src/config/env.js +35 -0
- package/lib/server/src/config/env.js.map +1 -0
- package/lib/server/src/excel/dto/excel-task-id.dto.d.ts +19 -0
- package/lib/server/src/excel/dto/excel-task-id.dto.js +17 -0
- package/lib/server/src/excel/dto/excel-task-id.dto.js.map +1 -0
- package/lib/server/src/excel/dto/export-excel.dto.d.ts +67 -0
- package/lib/server/src/excel/dto/export-excel.dto.js +48 -0
- package/lib/server/src/excel/dto/export-excel.dto.js.map +1 -0
- package/lib/server/src/excel/excel-storage.service.d.ts +54 -0
- package/lib/server/src/excel/excel-storage.service.js +258 -0
- package/lib/server/src/excel/excel-storage.service.js.map +1 -0
- package/lib/server/src/excel/excel.controller.d.ts +17 -0
- package/lib/{excel → server/src/excel}/excel.controller.js +40 -11
- package/lib/server/src/excel/excel.controller.js.map +1 -0
- package/lib/server/src/excel/excel.converter.d.ts +15 -0
- package/lib/server/src/excel/excel.converter.js +53 -0
- package/lib/server/src/excel/excel.converter.js.map +1 -0
- package/lib/{excel → server/src/excel}/excel.module.js +3 -2
- package/lib/server/src/excel/excel.module.js.map +1 -0
- package/lib/server/src/excel/excel.service.d.ts +33 -0
- package/lib/server/src/excel/excel.service.js +244 -0
- package/lib/server/src/excel/excel.service.js.map +1 -0
- package/lib/server/src/excel/types.d.ts +6 -0
- package/lib/server/src/excel/types.js +44 -0
- package/lib/server/src/excel/types.js.map +1 -0
- package/lib/server/src/index.d.ts +12 -0
- package/lib/server/src/index.js +32 -0
- package/lib/server/src/index.js.map +1 -0
- package/lib/server/src/main.d.ts +1 -0
- package/lib/{main.js → server/src/main.js} +55 -2
- package/lib/server/src/main.js.map +1 -0
- package/lib/server/src/shared/create-zod-base-model.d.ts +29 -0
- package/lib/server/src/shared/create-zod-base-model.js +55 -0
- package/lib/server/src/shared/create-zod-base-model.js.map +1 -0
- package/lib/server/src/shared/index.d.ts +5 -0
- package/lib/server/src/shared/index.js +16 -0
- package/lib/server/src/shared/index.js.map +1 -0
- package/lib/server/src/shared/response-entity.d.ts +32 -0
- package/lib/server/src/shared/response-entity.js +74 -0
- package/lib/server/src/shared/response-entity.js.map +1 -0
- package/lib/server/src/shared/zod-exception.filter.d.ts +5 -0
- package/lib/server/src/shared/zod-exception.filter.js +25 -0
- package/lib/server/src/shared/zod-exception.filter.js.map +1 -0
- package/lib/server/src/shared/zod-validation.pipe.d.ts +4 -0
- package/lib/server/src/shared/zod-validation.pipe.js +25 -0
- package/lib/server/src/shared/zod-validation.pipe.js.map +1 -0
- package/lib/utils/src/excel/converter.d.ts +8 -0
- package/lib/utils/src/excel/converter.js +144 -0
- package/lib/utils/src/excel/converter.js.map +1 -0
- package/lib/utils/src/excel/exceljsChunked.d.ts +75 -0
- package/lib/utils/src/excel/exceljsChunked.js +338 -0
- package/lib/utils/src/excel/exceljsChunked.js.map +1 -0
- package/lib/utils/src/excel/index.d.ts +9 -0
- package/lib/utils/src/excel/index.js +39 -0
- package/lib/utils/src/excel/index.js.map +1 -0
- package/lib/utils/src/excel/luckyexcel.d.ts +9 -0
- package/lib/utils/src/excel/luckyexcel.js +137 -0
- package/lib/utils/src/excel/luckyexcel.js.map +1 -0
- package/lib/utils/src/excel/sheetjsConverter.d.ts +6 -0
- package/lib/utils/src/excel/sheetjsConverter.js +224 -0
- package/lib/utils/src/excel/sheetjsConverter.js.map +1 -0
- package/lib/utils/src/excel/types.d.ts +88 -0
- package/lib/utils/src/excel/types.js +11 -0
- package/lib/utils/src/excel/types.js.map +1 -0
- package/lib/utils/src/excel/workbookChunked.d.ts +13 -0
- package/lib/utils/src/excel/workbookChunked.js +152 -0
- package/lib/utils/src/excel/workbookChunked.js.map +1 -0
- package/package.json +10 -5
- package/lib/app.module.js.map +0 -1
- package/lib/excel/excel.controller.d.ts +0 -13
- package/lib/excel/excel.controller.js.map +0 -1
- package/lib/excel/excel.converter.d.ts +0 -2
- package/lib/excel/excel.converter.js +0 -11
- package/lib/excel/excel.converter.js.map +0 -1
- package/lib/excel/excel.module.js.map +0 -1
- package/lib/excel/excel.service.d.ts +0 -9
- package/lib/excel/excel.service.js +0 -33
- package/lib/excel/excel.service.js.map +0 -1
- package/lib/excel/types.d.ts +0 -6
- package/lib/excel/types.js +0 -6
- package/lib/excel/types.js.map +0 -1
- package/lib/index.d.ts +0 -7
- package/lib/index.js +0 -14
- package/lib/index.js.map +0 -1
- package/lib/main.d.ts +0 -1
- package/lib/main.js.map +0 -1
- /package/lib/{app.module.d.ts → server/src/app.module.d.ts} +0 -0
- /package/lib/{app.module.js → server/src/app.module.js} +0 -0
- /package/lib/{excel → server/src/excel}/excel.module.d.ts +0 -0
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
19
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
20
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
21
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
22
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23
|
+
};
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
41
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
42
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
43
|
+
};
|
|
44
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
45
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
46
|
+
};
|
|
47
|
+
var ExcelService_1;
|
|
48
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
49
|
+
exports.ExcelService = void 0;
|
|
50
|
+
const common_1 = require("@nestjs/common");
|
|
51
|
+
const promises_1 = require("fs/promises");
|
|
52
|
+
const path = __importStar(require("path"));
|
|
53
|
+
const excel_converter_1 = require("./excel.converter");
|
|
54
|
+
const excel_storage_service_1 = require("./excel-storage.service");
|
|
55
|
+
const getChunkBytesThreshold = () => {
|
|
56
|
+
const raw = Number(process.env.IMS_EXCEL_CHUNK_BYTES || excel_converter_1.CHUNKED_FILE_BYTES);
|
|
57
|
+
return Number.isFinite(raw) && raw > 0 ? raw : excel_converter_1.CHUNKED_FILE_BYTES;
|
|
58
|
+
};
|
|
59
|
+
const getBlockRowSize = () => {
|
|
60
|
+
const raw = Number(process.env.IMS_EXCEL_BLOCK_ROWS || excel_converter_1.DEFAULT_BLOCK_ROW_SIZE);
|
|
61
|
+
return Number.isFinite(raw) && raw >= 100 ? raw : excel_converter_1.DEFAULT_BLOCK_ROW_SIZE;
|
|
62
|
+
};
|
|
63
|
+
const getMaxRows = () => {
|
|
64
|
+
const raw = Number(process.env.IMS_EXCEL_MAX_ROWS ?? excel_converter_1.DEFAULT_MAX_ROWS);
|
|
65
|
+
if (!Number.isFinite(raw) || raw < 0)
|
|
66
|
+
return excel_converter_1.DEFAULT_MAX_ROWS;
|
|
67
|
+
return raw;
|
|
68
|
+
};
|
|
69
|
+
const getParseTimeoutMs = () => {
|
|
70
|
+
const raw = Number(process.env.IMS_EXCEL_PARSE_TIMEOUT_MS || excel_converter_1.DEFAULT_PARSE_TIMEOUT_MS);
|
|
71
|
+
return Number.isFinite(raw) && raw > 0 ? raw : excel_converter_1.DEFAULT_PARSE_TIMEOUT_MS;
|
|
72
|
+
};
|
|
73
|
+
let ExcelService = ExcelService_1 = class ExcelService {
|
|
74
|
+
constructor(storage) {
|
|
75
|
+
this.storage = storage;
|
|
76
|
+
this.logger = new common_1.Logger(ExcelService_1.name);
|
|
77
|
+
}
|
|
78
|
+
async uploadFile(file, publicBaseUrl) {
|
|
79
|
+
if (!file?.buffer?.length) {
|
|
80
|
+
throw new common_1.BadRequestException('请上传 Excel 文件(.xlsx)');
|
|
81
|
+
}
|
|
82
|
+
const name = file.originalname || 'workbook.xlsx';
|
|
83
|
+
if (/\.xls$/i.test(name) && !/\.xlsx$/i.test(name)) {
|
|
84
|
+
throw new common_1.BadRequestException('仅支持 .xlsx,不支持旧版 .xls');
|
|
85
|
+
}
|
|
86
|
+
const sizeMb = (file.buffer.byteLength / (1024 * 1024)).toFixed(2);
|
|
87
|
+
const started = Date.now();
|
|
88
|
+
this.logger.log(`upload start name=${name} size=${sizeMb}MB`);
|
|
89
|
+
const buffer = Buffer.from(file.buffer);
|
|
90
|
+
const stored = await this.storage.saveXlsx(buffer, name);
|
|
91
|
+
const base = (publicBaseUrl || '').replace(/\/$/, '');
|
|
92
|
+
const url = base ? `${base}${stored.path}` : stored.path;
|
|
93
|
+
const taskPath = `/excel/task/${stored.id}`;
|
|
94
|
+
const taskUrl = base ? `${base}${taskPath}` : taskPath;
|
|
95
|
+
const useChunked = (0, excel_converter_1.shouldUseChunkedImport)(buffer.byteLength, {
|
|
96
|
+
bytesThreshold: getChunkBytesThreshold(),
|
|
97
|
+
});
|
|
98
|
+
this.storage.setTaskMode(stored.id, useChunked ? 'chunked' : 'snapshot');
|
|
99
|
+
this.logger.log(`upload done id=${stored.id} cost=${Date.now() - started}ms → parse async (${useChunked ? 'chunked-luckyexcel' : 'snapshot'})`);
|
|
100
|
+
setImmediate(() => {
|
|
101
|
+
if (useChunked) {
|
|
102
|
+
void this.parseChunkedLuckyExcel(stored.id, stored.fileName);
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
void this.parseToSnapshot(stored.id, buffer, stored.fileName);
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
return {
|
|
109
|
+
mode: 'async-snapshot',
|
|
110
|
+
id: stored.id,
|
|
111
|
+
fileName: stored.fileName,
|
|
112
|
+
path: stored.path,
|
|
113
|
+
url,
|
|
114
|
+
taskPath,
|
|
115
|
+
taskUrl,
|
|
116
|
+
size: stored.size,
|
|
117
|
+
expiresAt: stored.expiresAt,
|
|
118
|
+
parseHint: useChunked ? 'chunked' : 'snapshot',
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
getTask(id, publicBaseUrl) {
|
|
122
|
+
const task = this.storage.getTask(id);
|
|
123
|
+
if (!task) {
|
|
124
|
+
throw new common_1.NotFoundException(`任务不存在或已过期: ${id}`);
|
|
125
|
+
}
|
|
126
|
+
const base = (publicBaseUrl || '').replace(/\/$/, '');
|
|
127
|
+
return {
|
|
128
|
+
...task,
|
|
129
|
+
xlsxUrl: base ? `${base}${task.xlsxPath}` : task.xlsxPath,
|
|
130
|
+
snapshotUrl: task.snapshotPath
|
|
131
|
+
? base
|
|
132
|
+
? `${base}${task.snapshotPath}`
|
|
133
|
+
: task.snapshotPath
|
|
134
|
+
: undefined,
|
|
135
|
+
metaUrl: task.metaPath
|
|
136
|
+
? base
|
|
137
|
+
? `${base}${task.metaPath}`
|
|
138
|
+
: task.metaPath
|
|
139
|
+
: undefined,
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
async parseToSnapshot(id, buffer, fileName) {
|
|
143
|
+
const started = Date.now();
|
|
144
|
+
this.logger.log(`parse snapshot start id=${id} name=${fileName}`);
|
|
145
|
+
this.storage.updateTaskProgress(id, 10);
|
|
146
|
+
const timeoutMs = getParseTimeoutMs();
|
|
147
|
+
const timer = setTimeout(() => {
|
|
148
|
+
this.storage.markTaskError(id, `解析超时(>${Math.round(timeoutMs / 1000)}s)`);
|
|
149
|
+
this.logger.error(`parse snapshot timeout id=${id}`);
|
|
150
|
+
}, timeoutMs);
|
|
151
|
+
try {
|
|
152
|
+
const result = await (0, excel_converter_1.importExcelBinary)(buffer, fileName);
|
|
153
|
+
const task = this.storage.getTask(id);
|
|
154
|
+
if (task?.status === 'error')
|
|
155
|
+
return;
|
|
156
|
+
const snapshotPath = await this.storage.saveSnapshot(id, result.workbookData);
|
|
157
|
+
this.logger.log(`parse snapshot done id=${id} cost=${Date.now() - started}ms snapshot=${snapshotPath}`);
|
|
158
|
+
}
|
|
159
|
+
catch (error) {
|
|
160
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
161
|
+
this.storage.markTaskError(id, message);
|
|
162
|
+
this.logger.error(`parse snapshot failed id=${id} cost=${Date.now() - started}ms: ${message}`, error instanceof Error ? error.stack : undefined);
|
|
163
|
+
}
|
|
164
|
+
finally {
|
|
165
|
+
clearTimeout(timer);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
async parseChunkedLuckyExcel(id, fileName) {
|
|
169
|
+
const started = Date.now();
|
|
170
|
+
this.logger.log(`parse chunked(luckyexcel) start id=${id} name=${fileName}`);
|
|
171
|
+
this.storage.updateTaskProgress(id, 5);
|
|
172
|
+
const timeoutMs = getParseTimeoutMs();
|
|
173
|
+
let settled = false;
|
|
174
|
+
const timer = setTimeout(() => {
|
|
175
|
+
if (settled)
|
|
176
|
+
return;
|
|
177
|
+
settled = true;
|
|
178
|
+
this.storage.markTaskError(id, `解析超时(>${Math.round(timeoutMs / 1000)}s)`);
|
|
179
|
+
this.logger.error(`parse chunked timeout id=${id}`);
|
|
180
|
+
}, timeoutMs);
|
|
181
|
+
try {
|
|
182
|
+
const buffer = await (0, promises_1.readFile)(this.storage.getXlsxFullPath(id));
|
|
183
|
+
this.storage.updateTaskProgress(id, 15);
|
|
184
|
+
const result = await (0, excel_converter_1.importExcelBinary)(buffer, fileName);
|
|
185
|
+
if (settled)
|
|
186
|
+
return;
|
|
187
|
+
this.storage.updateTaskProgress(id, 35);
|
|
188
|
+
const uploadDir = this.storage.getUploadDir();
|
|
189
|
+
const { meta } = await (0, excel_converter_1.splitWorkbookDataToChunks)(result.workbookData, {
|
|
190
|
+
fileName,
|
|
191
|
+
blockRowSize: getBlockRowSize(),
|
|
192
|
+
maxRows: getMaxRows(),
|
|
193
|
+
onProgress: (progress) => {
|
|
194
|
+
if (settled)
|
|
195
|
+
return;
|
|
196
|
+
this.storage.updateTaskProgress(id, progress.percent, progress.parsedBlocks, progress.totalBlocks);
|
|
197
|
+
},
|
|
198
|
+
onBlock: async (block) => {
|
|
199
|
+
const name = (0, excel_converter_1.chunkedBlockFileName)(id, block.sheetIndex, block.blockIndex);
|
|
200
|
+
await (0, promises_1.writeFile)(path.join(uploadDir, name), JSON.stringify(block), 'utf8');
|
|
201
|
+
},
|
|
202
|
+
});
|
|
203
|
+
if (settled)
|
|
204
|
+
return;
|
|
205
|
+
const metaFileName = (0, excel_converter_1.chunkedMetaFileName)(id);
|
|
206
|
+
await (0, promises_1.writeFile)(path.join(uploadDir, metaFileName), JSON.stringify(meta), 'utf8');
|
|
207
|
+
const totalBlocks = meta.sheets.reduce((sum, sheet) => sum + sheet.blockCount, 0);
|
|
208
|
+
settled = true;
|
|
209
|
+
clearTimeout(timer);
|
|
210
|
+
this.storage.markTaskChunkedDone(id, metaFileName, {
|
|
211
|
+
parsedBlocks: totalBlocks,
|
|
212
|
+
totalBlocks,
|
|
213
|
+
truncated: meta.truncated,
|
|
214
|
+
});
|
|
215
|
+
this.logger.log(`parse chunked(luckyexcel) done id=${id} cost=${Date.now() - started}ms blocks=${totalBlocks} truncated=${Boolean(meta.truncated)}`);
|
|
216
|
+
}
|
|
217
|
+
catch (error) {
|
|
218
|
+
if (settled)
|
|
219
|
+
return;
|
|
220
|
+
settled = true;
|
|
221
|
+
clearTimeout(timer);
|
|
222
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
223
|
+
this.storage.markTaskError(id, message);
|
|
224
|
+
this.logger.error(`parse chunked(luckyexcel) failed id=${id} cost=${Date.now() - started}ms: ${message}`, error instanceof Error ? error.stack : undefined);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
async exportFile(body) {
|
|
228
|
+
const data = body?.data;
|
|
229
|
+
if (!data) {
|
|
230
|
+
throw new common_1.BadRequestException('缺少工作簿数据 data');
|
|
231
|
+
}
|
|
232
|
+
const buffer = await (0, excel_converter_1.workbookDataToExcelBuffer)(data);
|
|
233
|
+
const rawName = body.fileName?.trim() || data.name || 'workbook';
|
|
234
|
+
const fileName = rawName.endsWith('.xlsx') ? rawName : `${rawName}.xlsx`;
|
|
235
|
+
return { buffer, fileName };
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
exports.ExcelService = ExcelService;
|
|
239
|
+
exports.ExcelService = ExcelService = ExcelService_1 = __decorate([
|
|
240
|
+
(0, common_1.Injectable)(),
|
|
241
|
+
__param(0, (0, common_1.Inject)(excel_storage_service_1.ExcelStorageService)),
|
|
242
|
+
__metadata("design:paramtypes", [excel_storage_service_1.ExcelStorageService])
|
|
243
|
+
], ExcelService);
|
|
244
|
+
//# sourceMappingURL=excel.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"excel.service.js","sourceRoot":"","sources":["../../../../src/excel/excel.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAAoG;AACpG,0CAAkD;AAClD,2CAA6B;AAC7B,uDAW2B;AAC3B,mEAA8D;AA2B9D,MAAM,sBAAsB,GAAG,GAAG,EAAE;IAClC,MAAM,GAAG,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,qBAAqB,IAAI,oCAAkB,CAAC,CAAC;IAC5E,OAAO,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,oCAAkB,CAAC;AACpE,CAAC,CAAC;AAEF,MAAM,eAAe,GAAG,GAAG,EAAE;IAC3B,MAAM,GAAG,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,IAAI,wCAAsB,CAAC,CAAC;IAC/E,OAAO,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,wCAAsB,CAAC;AAC3E,CAAC,CAAC;AAEF,MAAM,UAAU,GAAG,GAAG,EAAE;IACtB,MAAM,GAAG,GAAG,MAAM,CAAC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,SAAS,IAAI,CAAC,GAAG,EAAE,GAAG,OAAO,OAAO,OAAO,EAAE,EACtF,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CACjD,CAAC;QACJ,CAAC;IACH,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,IAAoB;QACnC,MAAM,IAAI,GAAG,IAAI,EAAE,IAAI,CAAC;QACxB,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,MAAM,IAAI,4BAAmB,CAAC,cAAc,CAAC,CAAC;QAChD,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,IAAA,2CAAyB,EAAC,IAAI,CAAC,CAAC;QACrD,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,EAAE,IAAI,EAAE,IAAI,IAAI,CAAC,IAAI,IAAI,UAAU,CAAC;QACjE,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,OAAO,CAAC;QAEzE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;IAC9B,CAAC;CACF,CAAA;AA1MY,oCAAY;uBAAZ,YAAY;IADxB,IAAA,mBAAU,GAAE;IAIE,WAAA,IAAA,eAAM,EAAC,2CAAmB,CAAC,CAAA;qCAA2B,2CAAmB;GAH3E,YAAY,CA0MxB"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type { ICellData, IRange, IWorkbookData, IWorksheetData, } from '../../../utils/src/excel';
|
|
2
|
+
export declare const CellValueType: any;
|
|
3
|
+
export type { ExportExcelDto, ExportExcelPlain } from './dto/export-excel.dto';
|
|
4
|
+
export { exportExcelSchema } from './dto/export-excel.dto';
|
|
5
|
+
export type { ExcelTaskIdDto, ExcelTaskIdPlain } from './dto/excel-task-id.dto';
|
|
6
|
+
export { excelTaskIdSchema } from './dto/excel-task-id.dto';
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.excelTaskIdSchema = exports.exportExcelSchema = exports.CellValueType = void 0;
|
|
37
|
+
const ExcelNS = __importStar(require("../../../utils/src/excel"));
|
|
38
|
+
const Excel = ExcelNS.default ?? ExcelNS;
|
|
39
|
+
exports.CellValueType = Excel.CellValueType;
|
|
40
|
+
var export_excel_dto_1 = require("./dto/export-excel.dto");
|
|
41
|
+
Object.defineProperty(exports, "exportExcelSchema", { enumerable: true, get: function () { return export_excel_dto_1.exportExcelSchema; } });
|
|
42
|
+
var excel_task_id_dto_1 = require("./dto/excel-task-id.dto");
|
|
43
|
+
Object.defineProperty(exports, "excelTaskIdSchema", { enumerable: true, get: function () { return excel_task_id_dto_1.excelTaskIdSchema; } });
|
|
44
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/excel/types.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kEAAoD;AAEpD,MAAM,KAAK,GAAS,OAAe,CAAC,OAAO,IAAI,OAAO,CAAC;AAS1C,QAAA,aAAa,GAAG,KAAK,CAAC,aAAa,CAAC;AAGjD,2DAA2D;AAAlD,qHAAA,iBAAiB,OAAA;AAE1B,6DAA4D;AAAnD,sHAAA,iBAAiB,OAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { AppModule } from './app.module';
|
|
2
|
+
export { ExcelController } from './excel/excel.controller';
|
|
3
|
+
export { ExcelModule } from './excel/excel.module';
|
|
4
|
+
export { ExcelService } from './excel/excel.service';
|
|
5
|
+
export { ExcelStorageService, EXCEL_STATIC_PREFIX, getExcelUploadDir, } from './excel/excel-storage.service';
|
|
6
|
+
export type { ExportExcelDto, ExportExcelPlain } from './excel/types';
|
|
7
|
+
export { exportExcelSchema, excelTaskIdSchema } from './excel/types';
|
|
8
|
+
export type { ICellData, IRange, IWorkbookData, IWorksheetData, } from './excel/types';
|
|
9
|
+
export { CellValueType } from './excel/types';
|
|
10
|
+
export { createZodBaseModel, isZodModel, ResponseEntity, StatusCode, ZodExceptionFilter, ZodValidationError, ZodValidationPipe, } from './shared';
|
|
11
|
+
export { loadServerEnv, serverEnvSchema } from './config/env';
|
|
12
|
+
export type { ServerEnv } from './config/env';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.serverEnvSchema = exports.loadServerEnv = exports.ZodValidationPipe = exports.ZodValidationError = exports.ZodExceptionFilter = exports.StatusCode = exports.ResponseEntity = exports.isZodModel = exports.createZodBaseModel = exports.CellValueType = exports.excelTaskIdSchema = exports.exportExcelSchema = exports.getExcelUploadDir = exports.EXCEL_STATIC_PREFIX = exports.ExcelStorageService = exports.ExcelService = exports.ExcelModule = exports.ExcelController = exports.AppModule = void 0;
|
|
4
|
+
var app_module_1 = require("./app.module");
|
|
5
|
+
Object.defineProperty(exports, "AppModule", { enumerable: true, get: function () { return app_module_1.AppModule; } });
|
|
6
|
+
var excel_controller_1 = require("./excel/excel.controller");
|
|
7
|
+
Object.defineProperty(exports, "ExcelController", { enumerable: true, get: function () { return excel_controller_1.ExcelController; } });
|
|
8
|
+
var excel_module_1 = require("./excel/excel.module");
|
|
9
|
+
Object.defineProperty(exports, "ExcelModule", { enumerable: true, get: function () { return excel_module_1.ExcelModule; } });
|
|
10
|
+
var excel_service_1 = require("./excel/excel.service");
|
|
11
|
+
Object.defineProperty(exports, "ExcelService", { enumerable: true, get: function () { return excel_service_1.ExcelService; } });
|
|
12
|
+
var excel_storage_service_1 = require("./excel/excel-storage.service");
|
|
13
|
+
Object.defineProperty(exports, "ExcelStorageService", { enumerable: true, get: function () { return excel_storage_service_1.ExcelStorageService; } });
|
|
14
|
+
Object.defineProperty(exports, "EXCEL_STATIC_PREFIX", { enumerable: true, get: function () { return excel_storage_service_1.EXCEL_STATIC_PREFIX; } });
|
|
15
|
+
Object.defineProperty(exports, "getExcelUploadDir", { enumerable: true, get: function () { return excel_storage_service_1.getExcelUploadDir; } });
|
|
16
|
+
var types_1 = require("./excel/types");
|
|
17
|
+
Object.defineProperty(exports, "exportExcelSchema", { enumerable: true, get: function () { return types_1.exportExcelSchema; } });
|
|
18
|
+
Object.defineProperty(exports, "excelTaskIdSchema", { enumerable: true, get: function () { return types_1.excelTaskIdSchema; } });
|
|
19
|
+
var types_2 = require("./excel/types");
|
|
20
|
+
Object.defineProperty(exports, "CellValueType", { enumerable: true, get: function () { return types_2.CellValueType; } });
|
|
21
|
+
var shared_1 = require("./shared");
|
|
22
|
+
Object.defineProperty(exports, "createZodBaseModel", { enumerable: true, get: function () { return shared_1.createZodBaseModel; } });
|
|
23
|
+
Object.defineProperty(exports, "isZodModel", { enumerable: true, get: function () { return shared_1.isZodModel; } });
|
|
24
|
+
Object.defineProperty(exports, "ResponseEntity", { enumerable: true, get: function () { return shared_1.ResponseEntity; } });
|
|
25
|
+
Object.defineProperty(exports, "StatusCode", { enumerable: true, get: function () { return shared_1.StatusCode; } });
|
|
26
|
+
Object.defineProperty(exports, "ZodExceptionFilter", { enumerable: true, get: function () { return shared_1.ZodExceptionFilter; } });
|
|
27
|
+
Object.defineProperty(exports, "ZodValidationError", { enumerable: true, get: function () { return shared_1.ZodValidationError; } });
|
|
28
|
+
Object.defineProperty(exports, "ZodValidationPipe", { enumerable: true, get: function () { return shared_1.ZodValidationPipe; } });
|
|
29
|
+
var env_1 = require("./config/env");
|
|
30
|
+
Object.defineProperty(exports, "loadServerEnv", { enumerable: true, get: function () { return env_1.loadServerEnv; } });
|
|
31
|
+
Object.defineProperty(exports, "serverEnvSchema", { enumerable: true, get: function () { return env_1.serverEnvSchema; } });
|
|
32
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":";;;AAIA,2CAAyC;AAAhC,uGAAA,SAAS,OAAA;AAClB,6DAA2D;AAAlD,mHAAA,eAAe,OAAA;AACxB,qDAAmD;AAA1C,2GAAA,WAAW,OAAA;AACpB,uDAAqD;AAA5C,6GAAA,YAAY,OAAA;AACrB,uEAIuC;AAHrC,4HAAA,mBAAmB,OAAA;AACnB,4HAAA,mBAAmB,OAAA;AACnB,0HAAA,iBAAiB,OAAA;AAGnB,uCAAqE;AAA5D,0GAAA,iBAAiB,OAAA;AAAE,0GAAA,iBAAiB,OAAA;AAO7C,uCAA8C;AAArC,sGAAA,aAAa,OAAA;AACtB,mCAQkB;AAPhB,4GAAA,kBAAkB,OAAA;AAClB,oGAAA,UAAU,OAAA;AACV,wGAAA,cAAc,OAAA;AACd,oGAAA,UAAU,OAAA;AACV,4GAAA,kBAAkB,OAAA;AAClB,4GAAA,kBAAkB,OAAA;AAClB,2GAAA,iBAAiB,OAAA;AAEnB,oCAA8D;AAArD,oGAAA,aAAa,OAAA;AAAE,sGAAA,eAAe,OAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
@@ -32,11 +32,22 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
32
32
|
return result;
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
35
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
require("reflect-metadata");
|
|
36
40
|
const core_1 = require("@nestjs/core");
|
|
41
|
+
const compression_1 = __importDefault(require("compression"));
|
|
37
42
|
const app_module_1 = require("./app.module");
|
|
43
|
+
const env_1 = require("./config/env");
|
|
44
|
+
const excel_storage_service_1 = require("./excel/excel-storage.service");
|
|
45
|
+
const shared_1 = require("./shared");
|
|
38
46
|
const net = __importStar(require("net"));
|
|
39
|
-
const
|
|
47
|
+
const env = (0, env_1.loadServerEnv)();
|
|
48
|
+
const BODY_LIMIT = env.IMS_SERVER_BODY_LIMIT || '50mb';
|
|
49
|
+
const GZIP_THRESHOLD = env.IMS_SERVER_GZIP_THRESHOLD;
|
|
50
|
+
const getPreferredPort = () => env.IMS_SERVER_PORT || env.PORT || 3010;
|
|
40
51
|
const isPortFree = (port) => new Promise((resolve) => {
|
|
41
52
|
const server = net.createServer();
|
|
42
53
|
server.unref();
|
|
@@ -61,13 +72,55 @@ async function bootstrap() {
|
|
|
61
72
|
if (port !== preferred) {
|
|
62
73
|
console.warn(`[@ims-view/server] 端口 ${preferred} 已被占用,自动切换到 ${port}。请设置 IMS_EXCHANGE_ENDPOINT=http://localhost:${port}`);
|
|
63
74
|
}
|
|
64
|
-
const app = await core_1.NestFactory.create(app_module_1.AppModule
|
|
75
|
+
const app = await core_1.NestFactory.create(app_module_1.AppModule, {
|
|
76
|
+
bodyParser: false,
|
|
77
|
+
});
|
|
78
|
+
app.useGlobalPipes(new shared_1.ZodValidationPipe());
|
|
79
|
+
app.useGlobalFilters(new shared_1.ZodExceptionFilter());
|
|
65
80
|
app.enableCors({
|
|
66
81
|
origin: true,
|
|
67
82
|
credentials: true,
|
|
83
|
+
methods: ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS'],
|
|
84
|
+
allowedHeaders: ['Content-Type', 'Authorization', 'Accept'],
|
|
85
|
+
});
|
|
86
|
+
app.useBodyParser('json', { limit: BODY_LIMIT });
|
|
87
|
+
app.useBodyParser('urlencoded', { limit: BODY_LIMIT, extended: true });
|
|
88
|
+
const uploadDir = (0, excel_storage_service_1.getExcelUploadDir)();
|
|
89
|
+
app.use((0, compression_1.default)({
|
|
90
|
+
threshold: Number.isFinite(GZIP_THRESHOLD) ? GZIP_THRESHOLD : 1024,
|
|
91
|
+
level: 6,
|
|
92
|
+
filter: (req, res) => {
|
|
93
|
+
if (req.headers['x-no-compression'])
|
|
94
|
+
return false;
|
|
95
|
+
const contentType = String(res.getHeader('Content-Type') || '');
|
|
96
|
+
if (contentType.includes('spreadsheetml') ||
|
|
97
|
+
contentType.includes('octet-stream') ||
|
|
98
|
+
contentType.includes('ms-excel')) {
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
return compression_1.default.filter(req, res);
|
|
102
|
+
},
|
|
103
|
+
}));
|
|
104
|
+
app.useStaticAssets(uploadDir, {
|
|
105
|
+
prefix: excel_storage_service_1.EXCEL_STATIC_PREFIX,
|
|
106
|
+
setHeaders: (res, filePath) => {
|
|
107
|
+
res.setHeader('Cache-Control', 'public, max-age=300');
|
|
108
|
+
res.setHeader('Access-Control-Allow-Origin', '*');
|
|
109
|
+
res.setHeader('Access-Control-Allow-Methods', 'GET,OPTIONS');
|
|
110
|
+
if (filePath.endsWith('.snapshot.json') ||
|
|
111
|
+
filePath.endsWith('.meta.json') ||
|
|
112
|
+
/\.block\.\d+\.\d+\.json$/i.test(filePath)) {
|
|
113
|
+
res.setHeader('Content-Type', 'application/json; charset=utf-8');
|
|
114
|
+
}
|
|
115
|
+
else if (filePath.endsWith('.xlsx')) {
|
|
116
|
+
res.setHeader('Content-Type', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
|
117
|
+
}
|
|
118
|
+
},
|
|
68
119
|
});
|
|
69
120
|
await app.listen(port);
|
|
70
121
|
console.log(`[@ims-view/server] listening on http://localhost:${port}`);
|
|
122
|
+
console.log(`[@ims-view/server] body limit=${BODY_LIMIT}`);
|
|
123
|
+
console.log(`[@ims-view/server] excel static ${excel_storage_service_1.EXCEL_STATIC_PREFIX} -> ${uploadDir}`);
|
|
71
124
|
console.log(`[@ims-view/server] 前端可通过 IMS_EXCHANGE_ENDPOINT=http://localhost:${port} 对接`);
|
|
72
125
|
}
|
|
73
126
|
bootstrap().catch((error) => {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../../src/main.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4BAA0B;AAC1B,uCAA2C;AAE3C,8DAAsC;AAEtC,6CAAyC;AACzC,sCAA6C;AAC7C,yEAAuF;AACvF,qCAAiE;AACjE,yC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M,CAAC,IAAI,CAAC,CAAC;IAEvB,OAAO,CAAC,GAAG,CAAC,oDAAoD,IAAI,EAAE,CAAC,CAAC;IAExE,OAAO,CAAC,GAAG,CAAC,iCAAiC,UAAU,EAAE,CAAC,CAAC;IAE3D,OAAO,CAAC,GAAG,CAAC,mCAAmC,2CAAmB,OAAO,SAAS,EAAE,CAAC,CAAC;IAEtF,OAAO,CAAC,GAAG,CACT,mEAAmE,IAAI,KAAK,CAC7E,CAAC;AACJ,CAAC;AAED,SAAS,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IAE1B,OAAO,CAAC,KAAK,CAAC,0BAA0B,EAAE,KAAK,CAAC,CAAC;IACjD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const zodSchemaSymbol = "$$zod-schema";
|
|
3
|
+
export declare class ZodValidationError extends TypeError {
|
|
4
|
+
readonly cause: {
|
|
5
|
+
raw: unknown;
|
|
6
|
+
schema: z.ZodTypeAny;
|
|
7
|
+
error: z.ZodError;
|
|
8
|
+
};
|
|
9
|
+
constructor(message: string, cause: {
|
|
10
|
+
raw: unknown;
|
|
11
|
+
schema: z.ZodTypeAny;
|
|
12
|
+
error: z.ZodError;
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
export declare function isZodModel(o: unknown): o is ZodBaseModel;
|
|
16
|
+
export interface ZodBaseModel<T extends z.ZodTypeAny = z.ZodTypeAny> {
|
|
17
|
+
new (raw?: unknown): z.infer<T> & {
|
|
18
|
+
getRaw(): unknown;
|
|
19
|
+
getPlain(): z.infer<T>;
|
|
20
|
+
getSchema(): T;
|
|
21
|
+
getConfig(): ZodBaseModelConfig;
|
|
22
|
+
};
|
|
23
|
+
[zodSchemaSymbol]: T;
|
|
24
|
+
getSchema(): T;
|
|
25
|
+
}
|
|
26
|
+
interface ZodBaseModelConfig {
|
|
27
|
+
}
|
|
28
|
+
export declare function createZodBaseModel<T extends z.ZodTypeAny>(schema: T, config?: ZodBaseModelConfig): ZodBaseModel<T>;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ZodValidationError = exports.zodSchemaSymbol = void 0;
|
|
4
|
+
exports.isZodModel = isZodModel;
|
|
5
|
+
exports.createZodBaseModel = createZodBaseModel;
|
|
6
|
+
exports.zodSchemaSymbol = '$$zod-schema';
|
|
7
|
+
class ZodValidationError extends TypeError {
|
|
8
|
+
constructor(message, cause) {
|
|
9
|
+
super(message);
|
|
10
|
+
this.name = 'ZodValidationError';
|
|
11
|
+
this.cause = cause;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.ZodValidationError = ZodValidationError;
|
|
15
|
+
function isZodModel(o) {
|
|
16
|
+
if (!o)
|
|
17
|
+
return false;
|
|
18
|
+
return Boolean(o[exports.zodSchemaSymbol]);
|
|
19
|
+
}
|
|
20
|
+
function createZodBaseModel(schema, config = {}) {
|
|
21
|
+
function ZodBaseModelCtor(raw) {
|
|
22
|
+
const res = schema.safeParse(raw ?? {});
|
|
23
|
+
if (!res.success) {
|
|
24
|
+
const message = res.error.issues[0]?.message ||
|
|
25
|
+
res.error.message ||
|
|
26
|
+
'参数校验失败';
|
|
27
|
+
throw new ZodValidationError(message, { raw, schema, error: res.error });
|
|
28
|
+
}
|
|
29
|
+
const plain = res.data;
|
|
30
|
+
return Object.assign({}, plain, {
|
|
31
|
+
__raw__: raw,
|
|
32
|
+
getRaw() {
|
|
33
|
+
return this.__raw__;
|
|
34
|
+
},
|
|
35
|
+
__plain__: plain,
|
|
36
|
+
getPlain() {
|
|
37
|
+
return this.__plain__;
|
|
38
|
+
},
|
|
39
|
+
__schema__: schema,
|
|
40
|
+
getSchema() {
|
|
41
|
+
return this.__schema__;
|
|
42
|
+
},
|
|
43
|
+
__config__: config,
|
|
44
|
+
getConfig() {
|
|
45
|
+
return this.__config__;
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
ZodBaseModelCtor.getSchema = function getSchema() {
|
|
50
|
+
return schema;
|
|
51
|
+
};
|
|
52
|
+
ZodBaseModelCtor[exports.zodSchemaSymbol] = schema;
|
|
53
|
+
return ZodBaseModelCtor;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=create-zod-base-model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-zod-base-model.js","sourceRoot":"","sources":["../../../../src/shared/create-zod-base-model.ts"],"names":[],"mappings":";;;AAqBA,gCAGC;AAeD,gDAuCC;AA5EY,QAAA,eAAe,GAAG,cAAc,CAAC;AAE9C,MAAa,kBAAmB,SAAQ,SAAS;IAO/C,YACE,OAAe,EACf,KAAgE;QAEhE,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;QACjC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;CACF;AAfD,gDAeC;AAED,SAAgB,UAAU,CAAC,CAAU;IACnC,IAAI,CAAC,CAAC;QAAE,OAAO,KAAK,CAAC;IACrB,OAAO,OAAO,CAAE,CAAqC,CAAC,uBAAe,CAAC,CAAC,CAAC;AAC1E,CAAC;AAeD,SAAgB,kBAAkB,CAChC,MAAS,EACT,SAA6B,EAAE;IAE/B,SAAS,gBAAgB,CAAC,GAAY;QACpC,MAAM,GAAG,GAAG,MAAM,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC;QACxC,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;YACjB,MAAM,OAAO,GACX,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,OAAO;gBAC5B,GAAG,CAAC,KAAK,CAAC,OAAO;gBACjB,QAAQ,CAAC;YACX,MAAM,IAAI,kBAAkB,CAAC,OAAO,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC;QAC3E,CAAC;QACD,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC;QACvB,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK,EAAE;YAC9B,OAAO,EAAE,GAAG;YACZ,MAAM;gBACJ,OAAO,IAAI,CAAC,OAAO,CAAC;YACtB,CAAC;YACD,SAAS,EAAE,KAAK;YAChB,QAAQ;gBACN,OAAO,IAAI,CAAC,SAAS,CAAC;YACxB,CAAC;YACD,UAAU,EAAE,MAAM;YAClB,SAAS;gBACP,OAAO,IAAI,CAAC,UAAU,CAAC;YACzB,CAAC;YACD,UAAU,EAAE,MAAM;YAClB,SAAS;gBACP,OAAO,IAAI,CAAC,UAAU,CAAC;YACzB,CAAC;SACF,CAAC,CAAC;IACL,CAAC;IAED,gBAAgB,CAAC,SAAS,GAAG,SAAS,SAAS;QAC7C,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;IACD,gBAA+C,CAAC,uBAAe,CAAC,GAAG,MAAM,CAAC;IAC3E,OAAO,gBAA8C,CAAC;AACxD,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { createZodBaseModel, isZodModel, zodSchemaSymbol, ZodValidationError, } from './create-zod-base-model';
|
|
2
|
+
export type { ZodBaseModel } from './create-zod-base-model';
|
|
3
|
+
export { ZodValidationPipe } from './zod-validation.pipe';
|
|
4
|
+
export { ResponseEntity, StatusCode } from './response-entity';
|
|
5
|
+
export { ZodExceptionFilter } from './zod-exception.filter';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ZodExceptionFilter = exports.StatusCode = exports.ResponseEntity = exports.ZodValidationPipe = exports.ZodValidationError = exports.zodSchemaSymbol = exports.isZodModel = exports.createZodBaseModel = void 0;
|
|
4
|
+
var create_zod_base_model_1 = require("./create-zod-base-model");
|
|
5
|
+
Object.defineProperty(exports, "createZodBaseModel", { enumerable: true, get: function () { return create_zod_base_model_1.createZodBaseModel; } });
|
|
6
|
+
Object.defineProperty(exports, "isZodModel", { enumerable: true, get: function () { return create_zod_base_model_1.isZodModel; } });
|
|
7
|
+
Object.defineProperty(exports, "zodSchemaSymbol", { enumerable: true, get: function () { return create_zod_base_model_1.zodSchemaSymbol; } });
|
|
8
|
+
Object.defineProperty(exports, "ZodValidationError", { enumerable: true, get: function () { return create_zod_base_model_1.ZodValidationError; } });
|
|
9
|
+
var zod_validation_pipe_1 = require("./zod-validation.pipe");
|
|
10
|
+
Object.defineProperty(exports, "ZodValidationPipe", { enumerable: true, get: function () { return zod_validation_pipe_1.ZodValidationPipe; } });
|
|
11
|
+
var response_entity_1 = require("./response-entity");
|
|
12
|
+
Object.defineProperty(exports, "ResponseEntity", { enumerable: true, get: function () { return response_entity_1.ResponseEntity; } });
|
|
13
|
+
Object.defineProperty(exports, "StatusCode", { enumerable: true, get: function () { return response_entity_1.StatusCode; } });
|
|
14
|
+
var zod_exception_filter_1 = require("./zod-exception.filter");
|
|
15
|
+
Object.defineProperty(exports, "ZodExceptionFilter", { enumerable: true, get: function () { return zod_exception_filter_1.ZodExceptionFilter; } });
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/shared/index.ts"],"names":[],"mappings":";;;AAAA,iEAKiC;AAJ/B,2HAAA,kBAAkB,OAAA;AAClB,mHAAA,UAAU,OAAA;AACV,wHAAA,eAAe,OAAA;AACf,2HAAA,kBAAkB,OAAA;AAGpB,6DAA0D;AAAjD,wHAAA,iBAAiB,OAAA;AAC1B,qDAA+D;AAAtD,iHAAA,cAAc,OAAA;AAAE,6GAAA,UAAU,OAAA;AACnC,+DAA4D;AAAnD,0HAAA,kBAAkB,OAAA"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export declare enum StatusCode {
|
|
2
|
+
OK = 0,
|
|
3
|
+
BAD_REQUEST = 400,
|
|
4
|
+
NOT_FOUND = 404,
|
|
5
|
+
INTERNAL_SERVER_ERROR = 999
|
|
6
|
+
}
|
|
7
|
+
export declare class ResponseEntity<T> {
|
|
8
|
+
static default: {
|
|
9
|
+
code: ResponseEntity<unknown>['code'];
|
|
10
|
+
data: ResponseEntity<unknown>['data'];
|
|
11
|
+
msg: ResponseEntity<unknown>['msg'];
|
|
12
|
+
retriable: ResponseEntity<unknown>['retriable'];
|
|
13
|
+
};
|
|
14
|
+
static of<T>(...args: ConstructorParameters<typeof ResponseEntity<T>>): ResponseEntity<T>;
|
|
15
|
+
static ofSuccess<T>(data?: T, code?: number): ResponseEntity<T>;
|
|
16
|
+
static ofSuccessWithMsg<T>(data: T, msg?: string, code?: number): ResponseEntity<T>;
|
|
17
|
+
static ofFailure(err: unknown, code?: number): ResponseEntity<null>;
|
|
18
|
+
static from<T>(object?: Record<string, unknown>): ResponseEntity<T>;
|
|
19
|
+
code: number;
|
|
20
|
+
msg?: string;
|
|
21
|
+
data?: T;
|
|
22
|
+
retriable?: boolean;
|
|
23
|
+
constructor(code: ResponseEntity<T>['code'], data?: ResponseEntity<T>['data'], msg?: ResponseEntity<T>['msg'], retriable?: ResponseEntity<T>['retriable']);
|
|
24
|
+
getCode(): number;
|
|
25
|
+
setCode(code: ResponseEntity<T>['code']): this;
|
|
26
|
+
getData(): T | undefined;
|
|
27
|
+
setData(data: ResponseEntity<T>['data']): this;
|
|
28
|
+
getMsg(): string | undefined;
|
|
29
|
+
setMsg(msg: ResponseEntity<T>['msg']): this;
|
|
30
|
+
getRetriable(): boolean | undefined;
|
|
31
|
+
setRetriable(retriable: ResponseEntity<T>['retriable']): this;
|
|
32
|
+
}
|