@claritylabs/cl-sdk 3.0.27 → 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 +24 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +24 -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);
|
|
@@ -3508,29 +3511,41 @@ function mergeOperationalProfile(base, candidate, validNodeIds, validSpanIds) {
|
|
|
3508
3511
|
};
|
|
3509
3512
|
const coverages = base.coverages.length > 0 ? base.coverages : Array.isArray(candidate.coverages) ? candidate.coverages.map((coverage) => {
|
|
3510
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);
|
|
3511
3517
|
const limits = Array.isArray(record.limits) ? record.limits.filter(
|
|
3512
3518
|
(term) => Boolean(term) && typeof term === "object" && !Array.isArray(term)
|
|
3513
3519
|
).flatMap((term) => {
|
|
3514
3520
|
const label = typeof term.label === "string" ? cleanValue(term.label) : void 0;
|
|
3515
3521
|
const value = typeof term.value === "string" ? cleanValue(term.value) : void 0;
|
|
3516
|
-
const
|
|
3517
|
-
const
|
|
3518
|
-
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 [];
|
|
3519
3525
|
return [{
|
|
3520
3526
|
kind: normalizeTermKind(term.kind, label, value),
|
|
3521
3527
|
label,
|
|
3522
3528
|
value,
|
|
3523
3529
|
amount: typeof term.amount === "number" && Number.isFinite(term.amount) ? term.amount : void 0,
|
|
3524
3530
|
appliesTo: typeof term.appliesTo === "string" ? term.appliesTo : void 0,
|
|
3525
|
-
sourceNodeIds,
|
|
3526
|
-
sourceSpanIds
|
|
3531
|
+
sourceNodeIds: sourceNodeIds2,
|
|
3532
|
+
sourceSpanIds: sourceSpanIds2
|
|
3527
3533
|
}];
|
|
3528
3534
|
}) : [];
|
|
3529
3535
|
return {
|
|
3530
|
-
|
|
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,
|
|
3531
3546
|
limits,
|
|
3532
|
-
sourceNodeIds
|
|
3533
|
-
sourceSpanIds
|
|
3547
|
+
sourceNodeIds,
|
|
3548
|
+
sourceSpanIds
|
|
3534
3549
|
};
|
|
3535
3550
|
}).filter((coverage) => coverage.name && (coverage.sourceNodeIds.length > 0 || coverage.sourceSpanIds.length > 0)) : base.coverages;
|
|
3536
3551
|
return PolicyOperationalProfileSchema.parse({
|