@chenchaolong/plugin-trade-compliance-workbench 1.0.77 → 1.0.78
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.
|
@@ -2483,7 +2483,7 @@ let TradeComplianceWorkbenchService = class TradeComplianceWorkbenchService {
|
|
|
2483
2483
|
return saved;
|
|
2484
2484
|
}
|
|
2485
2485
|
async saveCustomerContractDraft(scope, importTaskId, draft) {
|
|
2486
|
-
const normalizedDraft = { ...draft, clauses: draft.clauses.map(normalizeCustomerContractDraftClause) };
|
|
2486
|
+
const normalizedDraft = { ...draft, clauses: draft.clauses.map(clause => normalizeCustomerContractDraftClause(clause)) };
|
|
2487
2487
|
const effectiveAnalyses = completeCustomerClauseAnalyses(normalizedDraft);
|
|
2488
2488
|
const contract = await this.dataSource.transaction(async (manager) => {
|
|
2489
2489
|
const taskRepo = manager.getRepository(ImportTask);
|
|
@@ -4206,10 +4206,11 @@ function normalizeCustomerContractAnalysisInput(value, enforceInvariant = true)
|
|
|
4206
4206
|
throw new DomainError(DomainErrorCodes.INVALID_INPUT, '未找到条款不能填写人工审核内容');
|
|
4207
4207
|
return { reviewedText, extractionStatus: value.extractionStatus };
|
|
4208
4208
|
}
|
|
4209
|
-
function normalizeCustomerContractDraftClause(value) {
|
|
4209
|
+
function normalizeCustomerContractDraftClause(value, options = {}) {
|
|
4210
4210
|
const sourceText = firstStringValue(value, ['sourceText', 'originalText', 'sourceContent']);
|
|
4211
4211
|
const reviewedText = firstStringValue(value, ['reviewedText', 'translatedText', 'clauseSummary', 'summary', 'originalText']);
|
|
4212
|
-
const
|
|
4212
|
+
const hasReviewableText = Boolean(sourceText || reviewedText || firstStringValue(value, ['sourceContent']));
|
|
4213
|
+
const extractionStatus = options.inferFoundFromText && hasReviewableText ? 'FOUND' : value.extractionStatus ?? (hasReviewableText ? 'FOUND' : 'NOT_FOUND');
|
|
4213
4214
|
const normalized = normalizeCustomerContractAnalysisInput({ extractionStatus, reviewedText });
|
|
4214
4215
|
return {
|
|
4215
4216
|
...value,
|
|
@@ -4225,7 +4226,7 @@ function normalizeCustomerContractDraftPayload(payload) {
|
|
|
4225
4226
|
clauses: Array.isArray(payload.clauses) ? payload.clauses.map(clause => {
|
|
4226
4227
|
if (!clause || typeof clause !== 'object' || Array.isArray(clause))
|
|
4227
4228
|
return clause;
|
|
4228
|
-
return normalizeCustomerContractDraftClause(clause);
|
|
4229
|
+
return normalizeCustomerContractDraftClause(clause, { inferFoundFromText: true });
|
|
4229
4230
|
}) : payload.clauses
|
|
4230
4231
|
};
|
|
4231
4232
|
assertCustomerContractImportDraftPayload(normalized);
|