@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 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);
@@ -3436,6 +3439,9 @@ function isNameCell(label, value) {
3436
3439
  if (/\b(coverage|coverage part|insuring agreement|description|item|name)\b/.test(normalizedLabel)) {
3437
3440
  return true;
3438
3441
  }
3442
+ if (/^column\s+1$/.test(normalizedLabel) && !/^(item\s+\d+|nwc-|iso-|cg |il |form\b|page\b)/i.test(normalizedValue)) {
3443
+ return true;
3444
+ }
3439
3445
  if (/^column\s+\d+$/.test(normalizedLabel) && /\b(coverage|sub[-\s]?limit|liability|expense|part\s+[a-z])\b/.test(normalizedValue)) {
3440
3446
  return true;
3441
3447
  }
@@ -3861,29 +3867,41 @@ function mergeOperationalProfile(base, candidate, validNodeIds, validSpanIds) {
3861
3867
  };
3862
3868
  const coverages = base.coverages.length > 0 ? base.coverages : Array.isArray(candidate.coverages) ? candidate.coverages.map((coverage) => {
3863
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);
3864
3873
  const limits = Array.isArray(record.limits) ? record.limits.filter(
3865
3874
  (term) => Boolean(term) && typeof term === "object" && !Array.isArray(term)
3866
3875
  ).flatMap((term) => {
3867
3876
  const label = typeof term.label === "string" ? cleanValue(term.label) : void 0;
3868
3877
  const value = typeof term.value === "string" ? cleanValue(term.value) : void 0;
3869
- const sourceNodeIds = keepIds(term.sourceNodeIds, validNodeIds);
3870
- const sourceSpanIds = keepIds(term.sourceSpanIds, validSpanIds);
3871
- 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 [];
3872
3881
  return [{
3873
3882
  kind: normalizeTermKind(term.kind, label, value),
3874
3883
  label,
3875
3884
  value,
3876
3885
  amount: typeof term.amount === "number" && Number.isFinite(term.amount) ? term.amount : void 0,
3877
3886
  appliesTo: typeof term.appliesTo === "string" ? term.appliesTo : void 0,
3878
- sourceNodeIds,
3879
- sourceSpanIds
3887
+ sourceNodeIds: sourceNodeIds2,
3888
+ sourceSpanIds: sourceSpanIds2
3880
3889
  }];
3881
3890
  }) : [];
3882
3891
  return {
3883
- ...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,
3884
3902
  limits,
3885
- sourceNodeIds: keepIds(record.sourceNodeIds, validNodeIds),
3886
- sourceSpanIds: keepIds(record.sourceSpanIds, validSpanIds)
3903
+ sourceNodeIds,
3904
+ sourceSpanIds
3887
3905
  };
3888
3906
  }).filter((coverage) => coverage.name && (coverage.sourceNodeIds.length > 0 || coverage.sourceSpanIds.length > 0)) : base.coverages;
3889
3907
  return PolicyOperationalProfileSchema.parse({