@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 CHANGED
@@ -500,7 +500,10 @@ async function safeGenerateObject(generateObject, params, options) {
500
500
  () => generateObject(strictParams),
501
501
  options?.log
502
502
  );
503
- return result;
503
+ return {
504
+ ...result,
505
+ object: params.schema.parse(sanitizeNulls(result.object))
506
+ };
504
507
  } catch (error) {
505
508
  lastError = error;
506
509
  options?.onError?.(error, attempt);
@@ -3864,29 +3867,41 @@ function mergeOperationalProfile(base, candidate, validNodeIds, validSpanIds) {
3864
3867
  };
3865
3868
  const coverages = base.coverages.length > 0 ? base.coverages : Array.isArray(candidate.coverages) ? candidate.coverages.map((coverage) => {
3866
3869
  const record = coverage;
3870
+ const name = typeof record.name === "string" ? cleanValue(record.name) : void 0;
3871
+ const sourceNodeIds = keepIds(record.sourceNodeIds, validNodeIds);
3872
+ const sourceSpanIds = keepIds(record.sourceSpanIds, validSpanIds);
3867
3873
  const limits = Array.isArray(record.limits) ? record.limits.filter(
3868
3874
  (term) => Boolean(term) && typeof term === "object" && !Array.isArray(term)
3869
3875
  ).flatMap((term) => {
3870
3876
  const label = typeof term.label === "string" ? cleanValue(term.label) : void 0;
3871
3877
  const value = typeof term.value === "string" ? cleanValue(term.value) : void 0;
3872
- const sourceNodeIds = keepIds(term.sourceNodeIds, validNodeIds);
3873
- const sourceSpanIds = keepIds(term.sourceSpanIds, validSpanIds);
3874
- if (!label || !value || sourceNodeIds.length === 0 && sourceSpanIds.length === 0) return [];
3878
+ const sourceNodeIds2 = keepIds(term.sourceNodeIds, validNodeIds);
3879
+ const sourceSpanIds2 = keepIds(term.sourceSpanIds, validSpanIds);
3880
+ if (!label || !value || sourceNodeIds2.length === 0 && sourceSpanIds2.length === 0) return [];
3875
3881
  return [{
3876
3882
  kind: normalizeTermKind(term.kind, label, value),
3877
3883
  label,
3878
3884
  value,
3879
3885
  amount: typeof term.amount === "number" && Number.isFinite(term.amount) ? term.amount : void 0,
3880
3886
  appliesTo: typeof term.appliesTo === "string" ? term.appliesTo : void 0,
3881
- sourceNodeIds,
3882
- sourceSpanIds
3887
+ sourceNodeIds: sourceNodeIds2,
3888
+ sourceSpanIds: sourceSpanIds2
3883
3889
  }];
3884
3890
  }) : [];
3885
3891
  return {
3886
- ...coverage,
3892
+ name,
3893
+ coverageCode: typeof record.coverageCode === "string" ? cleanValue(record.coverageCode) : void 0,
3894
+ limit: typeof record.limit === "string" ? cleanValue(record.limit) : void 0,
3895
+ deductible: typeof record.deductible === "string" ? cleanValue(record.deductible) : void 0,
3896
+ premium: typeof record.premium === "string" ? cleanValue(record.premium) : void 0,
3897
+ retroactiveDate: typeof record.retroactiveDate === "string" ? cleanValue(record.retroactiveDate) : void 0,
3898
+ formNumber: typeof record.formNumber === "string" ? cleanValue(record.formNumber) : void 0,
3899
+ sectionRef: typeof record.sectionRef === "string" ? cleanValue(record.sectionRef) : void 0,
3900
+ coverageOrigin: record.coverageOrigin === "core" || record.coverageOrigin === "endorsement" ? record.coverageOrigin : void 0,
3901
+ endorsementNumber: typeof record.endorsementNumber === "string" ? cleanValue(record.endorsementNumber) : void 0,
3887
3902
  limits,
3888
- sourceNodeIds: keepIds(record.sourceNodeIds, validNodeIds),
3889
- sourceSpanIds: keepIds(record.sourceSpanIds, validSpanIds)
3903
+ sourceNodeIds,
3904
+ sourceSpanIds
3890
3905
  };
3891
3906
  }).filter((coverage) => coverage.name && (coverage.sourceNodeIds.length > 0 || coverage.sourceSpanIds.length > 0)) : base.coverages;
3892
3907
  return PolicyOperationalProfileSchema.parse({