@claritylabs/cl-sdk 3.0.26 → 3.0.28
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/index.js +27 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +27 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -144,7 +144,10 @@ async function safeGenerateObject(generateObject, params, options) {
|
|
|
144
144
|
() => generateObject(strictParams),
|
|
145
145
|
options?.log
|
|
146
146
|
);
|
|
147
|
-
return
|
|
147
|
+
return {
|
|
148
|
+
...result,
|
|
149
|
+
object: params.schema.parse(sanitizeNulls(result.object))
|
|
150
|
+
};
|
|
148
151
|
} catch (error) {
|
|
149
152
|
lastError = error;
|
|
150
153
|
options?.onError?.(error, attempt);
|
|
@@ -3080,6 +3083,9 @@ function isNameCell(label, value) {
|
|
|
3080
3083
|
if (/\b(coverage|coverage part|insuring agreement|description|item|name)\b/.test(normalizedLabel)) {
|
|
3081
3084
|
return true;
|
|
3082
3085
|
}
|
|
3086
|
+
if (/^column\s+1$/.test(normalizedLabel) && !/^(item\s+\d+|nwc-|iso-|cg |il |form\b|page\b)/i.test(normalizedValue)) {
|
|
3087
|
+
return true;
|
|
3088
|
+
}
|
|
3083
3089
|
if (/^column\s+\d+$/.test(normalizedLabel) && /\b(coverage|sub[-\s]?limit|liability|expense|part\s+[a-z])\b/.test(normalizedValue)) {
|
|
3084
3090
|
return true;
|
|
3085
3091
|
}
|
|
@@ -3505,29 +3511,41 @@ function mergeOperationalProfile(base, candidate, validNodeIds, validSpanIds) {
|
|
|
3505
3511
|
};
|
|
3506
3512
|
const coverages = base.coverages.length > 0 ? base.coverages : Array.isArray(candidate.coverages) ? candidate.coverages.map((coverage) => {
|
|
3507
3513
|
const record = coverage;
|
|
3514
|
+
const name = typeof record.name === "string" ? cleanValue(record.name) : void 0;
|
|
3515
|
+
const sourceNodeIds = keepIds(record.sourceNodeIds, validNodeIds);
|
|
3516
|
+
const sourceSpanIds = keepIds(record.sourceSpanIds, validSpanIds);
|
|
3508
3517
|
const limits = Array.isArray(record.limits) ? record.limits.filter(
|
|
3509
3518
|
(term) => Boolean(term) && typeof term === "object" && !Array.isArray(term)
|
|
3510
3519
|
).flatMap((term) => {
|
|
3511
3520
|
const label = typeof term.label === "string" ? cleanValue(term.label) : void 0;
|
|
3512
3521
|
const value = typeof term.value === "string" ? cleanValue(term.value) : void 0;
|
|
3513
|
-
const
|
|
3514
|
-
const
|
|
3515
|
-
if (!label || !value ||
|
|
3522
|
+
const sourceNodeIds2 = keepIds(term.sourceNodeIds, validNodeIds);
|
|
3523
|
+
const sourceSpanIds2 = keepIds(term.sourceSpanIds, validSpanIds);
|
|
3524
|
+
if (!label || !value || sourceNodeIds2.length === 0 && sourceSpanIds2.length === 0) return [];
|
|
3516
3525
|
return [{
|
|
3517
3526
|
kind: normalizeTermKind(term.kind, label, value),
|
|
3518
3527
|
label,
|
|
3519
3528
|
value,
|
|
3520
3529
|
amount: typeof term.amount === "number" && Number.isFinite(term.amount) ? term.amount : void 0,
|
|
3521
3530
|
appliesTo: typeof term.appliesTo === "string" ? term.appliesTo : void 0,
|
|
3522
|
-
sourceNodeIds,
|
|
3523
|
-
sourceSpanIds
|
|
3531
|
+
sourceNodeIds: sourceNodeIds2,
|
|
3532
|
+
sourceSpanIds: sourceSpanIds2
|
|
3524
3533
|
}];
|
|
3525
3534
|
}) : [];
|
|
3526
3535
|
return {
|
|
3527
|
-
|
|
3536
|
+
name,
|
|
3537
|
+
coverageCode: typeof record.coverageCode === "string" ? cleanValue(record.coverageCode) : void 0,
|
|
3538
|
+
limit: typeof record.limit === "string" ? cleanValue(record.limit) : void 0,
|
|
3539
|
+
deductible: typeof record.deductible === "string" ? cleanValue(record.deductible) : void 0,
|
|
3540
|
+
premium: typeof record.premium === "string" ? cleanValue(record.premium) : void 0,
|
|
3541
|
+
retroactiveDate: typeof record.retroactiveDate === "string" ? cleanValue(record.retroactiveDate) : void 0,
|
|
3542
|
+
formNumber: typeof record.formNumber === "string" ? cleanValue(record.formNumber) : void 0,
|
|
3543
|
+
sectionRef: typeof record.sectionRef === "string" ? cleanValue(record.sectionRef) : void 0,
|
|
3544
|
+
coverageOrigin: record.coverageOrigin === "core" || record.coverageOrigin === "endorsement" ? record.coverageOrigin : void 0,
|
|
3545
|
+
endorsementNumber: typeof record.endorsementNumber === "string" ? cleanValue(record.endorsementNumber) : void 0,
|
|
3528
3546
|
limits,
|
|
3529
|
-
sourceNodeIds
|
|
3530
|
-
sourceSpanIds
|
|
3547
|
+
sourceNodeIds,
|
|
3548
|
+
sourceSpanIds
|
|
3531
3549
|
};
|
|
3532
3550
|
}).filter((coverage) => coverage.name && (coverage.sourceNodeIds.length > 0 || coverage.sourceSpanIds.length > 0)) : base.coverages;
|
|
3533
3551
|
return PolicyOperationalProfileSchema.parse({
|