@claritylabs/cl-sdk 3.2.13 → 4.0.1

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.
@@ -262,8 +262,291 @@ function createSqliteMemoryStore(db, embed) {
262
262
  }
263
263
 
264
264
  // src/source/schemas.ts
265
+ import { z as z2 } from "zod";
266
+
267
+ // src/schemas/lines-of-business.ts
265
268
  import { z } from "zod";
266
- var SourceSpanKindSchema = z.enum([
269
+ var ACORD_LOB_CODES = [
270
+ "AAPPL",
271
+ "AGLIA",
272
+ "AGPP",
273
+ "AGPR",
274
+ "AIRC",
275
+ "AIRPFB",
276
+ "APKG",
277
+ "APKGE",
278
+ "APROD",
279
+ "ARVP",
280
+ "AUTO",
281
+ "AUTOB",
282
+ "AUTOP",
283
+ "AVPKG",
284
+ "BANDM",
285
+ "BLANK",
286
+ "BMISC",
287
+ "BOAT",
288
+ "BOP",
289
+ "BOPGL",
290
+ "BOPPR",
291
+ "CAVN",
292
+ "CEQFL",
293
+ "CFIRE",
294
+ "CFRM",
295
+ "CGL",
296
+ "COMAR",
297
+ "COMR",
298
+ "CONTR",
299
+ "CPKGE",
300
+ "CPMP",
301
+ "CRIME",
302
+ "DFIRE",
303
+ "DISAB",
304
+ "DO",
305
+ "EDP",
306
+ "EL",
307
+ "EO",
308
+ "EPLI",
309
+ "EQ",
310
+ "EQPFL",
311
+ "EXLIA",
312
+ "FIDTY",
313
+ "FIDUC",
314
+ "FINEA",
315
+ "FLOOD",
316
+ "GARAG",
317
+ "GL",
318
+ "GLASS",
319
+ "HANG",
320
+ "HBB",
321
+ "HOME",
322
+ "INBR",
323
+ "INMAR",
324
+ "INMRC",
325
+ "INMRP",
326
+ "JUDCL",
327
+ "KIDRA",
328
+ "LL",
329
+ "MHOME",
330
+ "MMAL",
331
+ "Motorcycle",
332
+ "MTRTK",
333
+ "OLIB",
334
+ "PHYS",
335
+ "PKG",
336
+ "PL",
337
+ "PLMSC",
338
+ "PPKGE",
339
+ "PROP",
340
+ "PROPC",
341
+ "PUBOF",
342
+ "RECV",
343
+ "SCHPR",
344
+ "SIGNS",
345
+ "SMP",
346
+ "SURE",
347
+ "TRANS",
348
+ "TRUCK",
349
+ "UMBRC",
350
+ "UMBRL",
351
+ "UMBRP",
352
+ "UN",
353
+ "WCMA",
354
+ "WIND",
355
+ "WORK",
356
+ "WORKP",
357
+ "WORKV"
358
+ ];
359
+ var AcordLobCodeSchema = z.enum(ACORD_LOB_CODES);
360
+ var ACORD_LOB_LABELS = {
361
+ AAPPL: "Aircraft / Aerial Applicator",
362
+ AGLIA: "Agricultural Liability",
363
+ AGPP: "Agricultural Personal Property",
364
+ AGPR: "Agricultural Property",
365
+ AIRC: "Aircraft",
366
+ AIRPFB: "Airport / Fixed Base Operator",
367
+ APKG: "Agricultural Package",
368
+ APKGE: "Agricultural Package (Extended)",
369
+ APROD: "Agricultural Products",
370
+ ARVP: "Recreational Vehicle Package",
371
+ AUTO: "Automobile",
372
+ AUTOB: "Business Auto",
373
+ AUTOP: "Personal Auto",
374
+ AVPKG: "Aviation Package",
375
+ BANDM: "Boiler & Machinery",
376
+ BLANK: "Blanket",
377
+ BMISC: "Business Miscellaneous",
378
+ BOAT: "Boat",
379
+ BOP: "Businessowners Policy",
380
+ BOPGL: "BOP - General Liability",
381
+ BOPPR: "BOP - Property",
382
+ CAVN: "Commercial Aviation",
383
+ CEQFL: "Contractors Equipment Floater",
384
+ CFIRE: "Commercial Fire",
385
+ CFRM: "Commercial Farm",
386
+ CGL: "Commercial General Liability",
387
+ COMAR: "Commercial Marine / Ocean Marine",
388
+ COMR: "Commercial (misc.)",
389
+ CONTR: "Contractors",
390
+ CPKGE: "Commercial Package",
391
+ CPMP: "Commercial Package (multi-peril)",
392
+ CRIME: "Crime",
393
+ DFIRE: "Dwelling Fire",
394
+ DISAB: "Disability",
395
+ DO: "Directors & Officers Liability",
396
+ EDP: "Electronic Data Processing",
397
+ EL: "Employers Liability",
398
+ EO: "Errors & Omissions",
399
+ EPLI: "Employment Practices Liability",
400
+ EQ: "Earthquake",
401
+ EQPFL: "Equipment Floater",
402
+ EXLIA: "Excess Liability",
403
+ FIDTY: "Fidelity",
404
+ FIDUC: "Fiduciary Liability",
405
+ FINEA: "Fine Arts",
406
+ FLOOD: "Flood",
407
+ GARAG: "Garage",
408
+ GL: "General Liability",
409
+ GLASS: "Glass",
410
+ HANG: "Hangar (Aviation)",
411
+ HBB: "Home-Based Business",
412
+ HOME: "Homeowners",
413
+ INBR: "Inland Marine - Brokers",
414
+ INMAR: "Inland Marine",
415
+ INMRC: "Inland Marine - Commercial",
416
+ INMRP: "Inland Marine - Personal",
417
+ JUDCL: "Judicial Bonds",
418
+ KIDRA: "Kidnap & Ransom",
419
+ LL: "Liquor Liability",
420
+ MHOME: "Mobile Home",
421
+ MMAL: "Medical Malpractice",
422
+ Motorcycle: "Motorcycle",
423
+ MTRTK: "Motor Truck Cargo",
424
+ OLIB: "Other Liability",
425
+ PHYS: "Physical Damage",
426
+ PKG: "Package",
427
+ PL: "Professional Liability",
428
+ PLMSC: "Personal Lines Miscellaneous",
429
+ PPKGE: "Personal Package",
430
+ PROP: "Property",
431
+ PROPC: "Property - Commercial",
432
+ PUBOF: "Public Officials Liability",
433
+ RECV: "Recreational Vehicle",
434
+ SCHPR: "Scheduled Property",
435
+ SIGNS: "Signs",
436
+ SMP: "Special Multi-Peril",
437
+ SURE: "Surety",
438
+ TRANS: "Transportation",
439
+ TRUCK: "Trucking",
440
+ UMBRC: "Umbrella - Commercial",
441
+ UMBRL: "Umbrella",
442
+ UMBRP: "Umbrella - Personal",
443
+ UN: "Unspecified / Unknown",
444
+ WCMA: "Workers Comp - Monopolistic/State",
445
+ WIND: "Wind",
446
+ WORK: "Workers Compensation",
447
+ WORKP: "Workers Compensation (Personal/Package)",
448
+ WORKV: "Workers Compensation (Voluntary)"
449
+ };
450
+ var LEGACY_POLICY_TYPE_TO_LOB = {
451
+ general_liability: ["CGL"],
452
+ commercial_property: ["PROPC"],
453
+ commercial_auto: ["AUTOB"],
454
+ non_owned_auto: ["AUTOB"],
455
+ workers_comp: ["WORK"],
456
+ umbrella: ["UMBRC"],
457
+ excess_liability: ["EXLIA"],
458
+ professional_liability: ["EO"],
459
+ cyber: ["OLIB"],
460
+ epli: ["EPLI"],
461
+ directors_officers: ["DO"],
462
+ fiduciary_liability: ["FIDUC"],
463
+ crime_fidelity: ["CRIME"],
464
+ inland_marine: ["INMRC"],
465
+ builders_risk: ["INMRC"],
466
+ environmental: ["OLIB"],
467
+ ocean_marine: ["COMAR"],
468
+ surety: ["SURE"],
469
+ product_liability: ["OLIB"],
470
+ bop: ["BOP"],
471
+ management_liability_package: ["DO", "EPLI", "FIDUC"],
472
+ property: ["PROP"],
473
+ homeowners_ho3: ["HOME"],
474
+ homeowners_ho5: ["HOME"],
475
+ renters_ho4: ["HOME"],
476
+ condo_ho6: ["HOME"],
477
+ dwelling_fire: ["DFIRE"],
478
+ mobile_home: ["MHOME"],
479
+ personal_auto: ["AUTOP"],
480
+ personal_umbrella: ["UMBRP"],
481
+ flood_nfip: ["FLOOD"],
482
+ flood_private: ["FLOOD"],
483
+ earthquake: ["EQ"],
484
+ personal_inland_marine: ["INMRP"],
485
+ watercraft: ["BOAT"],
486
+ recreational_vehicle: ["RECV"],
487
+ farm_ranch: ["CFRM"],
488
+ life: ["UN"],
489
+ critical_illness: ["DISAB"],
490
+ disability: ["DISAB"],
491
+ long_term_care: ["UN"],
492
+ pet: ["UN"],
493
+ travel: ["UN"],
494
+ identity_theft: ["UN"],
495
+ title: ["UN"],
496
+ other: ["UN"],
497
+ unknown: ["UN"],
498
+ auto: ["AUTOB"],
499
+ crime: ["CRIME"],
500
+ crim: ["CRIME"],
501
+ fiduciary: ["FIDUC"],
502
+ d_and_o: ["DO"],
503
+ d_o: ["DO"],
504
+ homeowners: ["HOME"],
505
+ renters: ["HOME"],
506
+ flood: ["FLOOD"],
507
+ boat: ["BOAT"],
508
+ motorcycle: ["Motorcycle"]
509
+ };
510
+ function hasOwn(object, key) {
511
+ return Object.prototype.hasOwnProperty.call(object, key);
512
+ }
513
+ function canonicalLegacyKey(value) {
514
+ return value.trim().toLowerCase().replace(/&/g, " and ").replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "").replace(/_+/g, "_");
515
+ }
516
+ function isLobCode(value) {
517
+ return typeof value === "string" && hasOwn(ACORD_LOB_LABELS, value);
518
+ }
519
+ function toLobCodes(values) {
520
+ const source = values?.filter((value) => typeof value === "string" && value.trim()) ?? [];
521
+ if (source.length === 0) return ["UN"];
522
+ const codes = [];
523
+ for (const value of source) {
524
+ const trimmed = value.trim();
525
+ if (isLobCode(trimmed)) {
526
+ codes.push(trimmed);
527
+ continue;
528
+ }
529
+ if (trimmed.toUpperCase() === "CRIM") {
530
+ codes.push("CRIME");
531
+ continue;
532
+ }
533
+ const mapped = LEGACY_POLICY_TYPE_TO_LOB[canonicalLegacyKey(trimmed)];
534
+ if (mapped) {
535
+ codes.push(...mapped);
536
+ continue;
537
+ }
538
+ const upper = trimmed.toUpperCase();
539
+ if (isLobCode(upper)) {
540
+ codes.push(upper);
541
+ continue;
542
+ }
543
+ codes.push("UN");
544
+ }
545
+ return Array.from(new Set(codes));
546
+ }
547
+
548
+ // src/source/schemas.ts
549
+ var SourceSpanKindSchema = z2.enum([
267
550
  "pdf_text",
268
551
  "pdf_image",
269
552
  "html",
@@ -271,7 +554,7 @@ var SourceSpanKindSchema = z.enum([
271
554
  "plain_text",
272
555
  "structured_field"
273
556
  ]);
274
- var SourceSpanUnitSchema = z.enum([
557
+ var SourceSpanUnitSchema = z2.enum([
275
558
  "page",
276
559
  "section",
277
560
  "table",
@@ -280,78 +563,78 @@ var SourceSpanUnitSchema = z.enum([
280
563
  "key_value",
281
564
  "text"
282
565
  ]);
283
- var SourceKindSchema = z.enum([
566
+ var SourceKindSchema = z2.enum([
284
567
  "policy_pdf",
285
568
  "application_pdf",
286
569
  "email",
287
570
  "attachment",
288
571
  "manual_note"
289
572
  ]);
290
- var SourceSpanBBoxSchema = z.object({
291
- page: z.number().int().positive(),
292
- x: z.number(),
293
- y: z.number(),
294
- width: z.number(),
295
- height: z.number()
573
+ var SourceSpanBBoxSchema = z2.object({
574
+ page: z2.number().int().positive(),
575
+ x: z2.number(),
576
+ y: z2.number(),
577
+ width: z2.number(),
578
+ height: z2.number()
296
579
  });
297
- var SourceSpanLocationSchema = z.object({
298
- page: z.number().int().positive().optional(),
299
- startPage: z.number().int().positive().optional(),
300
- endPage: z.number().int().positive().optional(),
301
- charStart: z.number().int().nonnegative().optional(),
302
- charEnd: z.number().int().nonnegative().optional(),
303
- lineStart: z.number().int().positive().optional(),
304
- lineEnd: z.number().int().positive().optional(),
305
- fieldPath: z.string().optional()
580
+ var SourceSpanLocationSchema = z2.object({
581
+ page: z2.number().int().positive().optional(),
582
+ startPage: z2.number().int().positive().optional(),
583
+ endPage: z2.number().int().positive().optional(),
584
+ charStart: z2.number().int().nonnegative().optional(),
585
+ charEnd: z2.number().int().nonnegative().optional(),
586
+ lineStart: z2.number().int().positive().optional(),
587
+ lineEnd: z2.number().int().positive().optional(),
588
+ fieldPath: z2.string().optional()
306
589
  });
307
- var SourceSpanTableLocationSchema = z.object({
308
- tableId: z.string().optional(),
309
- rowIndex: z.number().int().nonnegative().optional(),
310
- columnIndex: z.number().int().nonnegative().optional(),
311
- columnName: z.string().optional(),
312
- rowSpanId: z.string().optional(),
313
- tableSpanId: z.string().optional(),
314
- isHeader: z.boolean().optional()
590
+ var SourceSpanTableLocationSchema = z2.object({
591
+ tableId: z2.string().optional(),
592
+ rowIndex: z2.number().int().nonnegative().optional(),
593
+ columnIndex: z2.number().int().nonnegative().optional(),
594
+ columnName: z2.string().optional(),
595
+ rowSpanId: z2.string().optional(),
596
+ tableSpanId: z2.string().optional(),
597
+ isHeader: z2.boolean().optional()
315
598
  });
316
- var SourceSpanSchema = z.object({
317
- id: z.string().min(1),
318
- documentId: z.string().min(1),
599
+ var SourceSpanSchema = z2.object({
600
+ id: z2.string().min(1),
601
+ documentId: z2.string().min(1),
319
602
  sourceKind: SourceKindSchema.optional(),
320
- chunkId: z.string().optional(),
603
+ chunkId: z2.string().optional(),
321
604
  kind: SourceSpanKindSchema,
322
- text: z.string(),
323
- hash: z.string().min(1),
324
- textHash: z.string().optional(),
325
- pageStart: z.number().int().positive().optional(),
326
- pageEnd: z.number().int().positive().optional(),
327
- sectionId: z.string().optional(),
328
- formNumber: z.string().optional(),
605
+ text: z2.string(),
606
+ hash: z2.string().min(1),
607
+ textHash: z2.string().optional(),
608
+ pageStart: z2.number().int().positive().optional(),
609
+ pageEnd: z2.number().int().positive().optional(),
610
+ sectionId: z2.string().optional(),
611
+ formNumber: z2.string().optional(),
329
612
  sourceUnit: SourceSpanUnitSchema.optional(),
330
- parentSpanId: z.string().optional(),
613
+ parentSpanId: z2.string().optional(),
331
614
  table: SourceSpanTableLocationSchema.optional(),
332
- bbox: z.array(SourceSpanBBoxSchema).optional(),
615
+ bbox: z2.array(SourceSpanBBoxSchema).optional(),
333
616
  location: SourceSpanLocationSchema.optional(),
334
- metadata: z.record(z.string(), z.string()).optional()
617
+ metadata: z2.record(z2.string(), z2.string()).optional()
335
618
  });
336
- var SourceSpanRefSchema = z.object({
337
- sourceSpanId: z.string().min(1),
338
- documentId: z.string().min(1).optional(),
339
- chunkId: z.string().optional(),
340
- quote: z.string().optional(),
341
- hash: z.string().optional(),
619
+ var SourceSpanRefSchema = z2.object({
620
+ sourceSpanId: z2.string().min(1),
621
+ documentId: z2.string().min(1).optional(),
622
+ chunkId: z2.string().optional(),
623
+ quote: z2.string().optional(),
624
+ hash: z2.string().optional(),
342
625
  location: SourceSpanLocationSchema.optional()
343
626
  });
344
- var SourceChunkSchema = z.object({
345
- id: z.string().min(1),
346
- documentId: z.string().min(1),
347
- sourceSpanIds: z.array(z.string().min(1)),
348
- text: z.string(),
349
- textHash: z.string().min(1),
350
- pageStart: z.number().int().positive().optional(),
351
- pageEnd: z.number().int().positive().optional(),
352
- metadata: z.record(z.string(), z.string()).default({})
627
+ var SourceChunkSchema = z2.object({
628
+ id: z2.string().min(1),
629
+ documentId: z2.string().min(1),
630
+ sourceSpanIds: z2.array(z2.string().min(1)),
631
+ text: z2.string(),
632
+ textHash: z2.string().min(1),
633
+ pageStart: z2.number().int().positive().optional(),
634
+ pageEnd: z2.number().int().positive().optional(),
635
+ metadata: z2.record(z2.string(), z2.string()).default({})
353
636
  });
354
- var DocumentSourceNodeKindSchema = z.enum([
637
+ var DocumentSourceNodeKindSchema = z2.enum([
355
638
  "document",
356
639
  "page_group",
357
640
  "page",
@@ -365,31 +648,31 @@ var DocumentSourceNodeKindSchema = z.enum([
365
648
  "table_cell",
366
649
  "text"
367
650
  ]);
368
- var DocumentSourceNodeSchema = z.object({
369
- id: z.string().min(1),
370
- documentId: z.string().min(1),
371
- parentId: z.string().optional(),
651
+ var DocumentSourceNodeSchema = z2.object({
652
+ id: z2.string().min(1),
653
+ documentId: z2.string().min(1),
654
+ parentId: z2.string().optional(),
372
655
  kind: DocumentSourceNodeKindSchema,
373
- title: z.string(),
374
- description: z.string(),
375
- textExcerpt: z.string().optional(),
376
- sourceSpanIds: z.array(z.string().min(1)),
377
- pageStart: z.number().int().positive().optional(),
378
- pageEnd: z.number().int().positive().optional(),
379
- bbox: z.array(SourceSpanBBoxSchema).optional(),
380
- order: z.number().int().nonnegative(),
381
- path: z.string(),
382
- metadata: z.record(z.string(), z.unknown()).optional()
656
+ title: z2.string(),
657
+ description: z2.string(),
658
+ textExcerpt: z2.string().optional(),
659
+ sourceSpanIds: z2.array(z2.string().min(1)),
660
+ pageStart: z2.number().int().positive().optional(),
661
+ pageEnd: z2.number().int().positive().optional(),
662
+ bbox: z2.array(SourceSpanBBoxSchema).optional(),
663
+ order: z2.number().int().nonnegative(),
664
+ path: z2.string(),
665
+ metadata: z2.record(z2.string(), z2.unknown()).optional()
383
666
  });
384
- var SourceBackedValueSchema = z.object({
385
- value: z.string(),
386
- normalizedValue: z.string().optional(),
387
- confidence: z.enum(["low", "medium", "high"]).default("medium"),
388
- sourceNodeIds: z.array(z.string().min(1)).default([]),
389
- sourceSpanIds: z.array(z.string().min(1)).default([])
667
+ var SourceBackedValueSchema = z2.object({
668
+ value: z2.string(),
669
+ normalizedValue: z2.string().optional(),
670
+ confidence: z2.enum(["low", "medium", "high"]).default("medium"),
671
+ sourceNodeIds: z2.array(z2.string().min(1)).default([]),
672
+ sourceSpanIds: z2.array(z2.string().min(1)).default([])
390
673
  });
391
- var OperationalCoverageTermSchema = z.object({
392
- kind: z.enum([
674
+ var OperationalCoverageTermSchema = z2.object({
675
+ kind: z2.enum([
393
676
  "each_claim_limit",
394
677
  "each_occurrence_limit",
395
678
  "each_loss_limit",
@@ -401,334 +684,75 @@ var OperationalCoverageTermSchema = z.object({
401
684
  "premium",
402
685
  "other"
403
686
  ]).default("other"),
404
- label: z.string(),
405
- value: z.string(),
406
- amount: z.number().optional(),
407
- appliesTo: z.string().optional(),
408
- sourceNodeIds: z.array(z.string().min(1)).default([]),
409
- sourceSpanIds: z.array(z.string().min(1)).default([])
410
- });
411
- var OperationalCoverageLineSchema = z.object({
412
- name: z.string(),
413
- coverageCode: z.string().optional(),
414
- limit: z.string().optional(),
415
- deductible: z.string().optional(),
416
- premium: z.string().optional(),
417
- retroactiveDate: z.string().optional(),
418
- formNumber: z.string().optional(),
419
- sectionRef: z.string().optional(),
420
- endorsementNumber: z.string().optional(),
421
- limits: z.array(OperationalCoverageTermSchema).default([]),
422
- sourceNodeIds: z.array(z.string().min(1)).default([]),
423
- sourceSpanIds: z.array(z.string().min(1)).default([])
687
+ label: z2.string(),
688
+ value: z2.string(),
689
+ amount: z2.number().optional(),
690
+ appliesTo: z2.string().optional(),
691
+ sourceNodeIds: z2.array(z2.string().min(1)).default([]),
692
+ sourceSpanIds: z2.array(z2.string().min(1)).default([])
424
693
  });
425
- var OperationalPartySchema = z.object({
426
- role: z.string(),
427
- name: z.string(),
428
- sourceNodeIds: z.array(z.string().min(1)).default([]),
429
- sourceSpanIds: z.array(z.string().min(1)).default([])
694
+ var OperationalCoverageLineSchema = z2.object({
695
+ name: z2.string(),
696
+ coverageCode: z2.string().optional(),
697
+ limit: z2.string().optional(),
698
+ deductible: z2.string().optional(),
699
+ premium: z2.string().optional(),
700
+ retroactiveDate: z2.string().optional(),
701
+ formNumber: z2.string().optional(),
702
+ sectionRef: z2.string().optional(),
703
+ endorsementNumber: z2.string().optional(),
704
+ limits: z2.array(OperationalCoverageTermSchema).default([]),
705
+ sourceNodeIds: z2.array(z2.string().min(1)).default([]),
706
+ sourceSpanIds: z2.array(z2.string().min(1)).default([])
430
707
  });
431
- var OperationalEndorsementSupportSchema = z.object({
432
- kind: z.string(),
433
- status: z.enum(["supported", "excluded", "requires_review"]),
434
- summary: z.string(),
435
- sourceNodeIds: z.array(z.string().min(1)).default([]),
436
- sourceSpanIds: z.array(z.string().min(1)).default([])
708
+ var OperationalPartySchema = z2.object({
709
+ role: z2.string(),
710
+ name: z2.string(),
711
+ sourceNodeIds: z2.array(z2.string().min(1)).default([]),
712
+ sourceSpanIds: z2.array(z2.string().min(1)).default([])
437
713
  });
438
- var PolicyOperationalProfileSchema = z.object({
439
- documentType: z.enum(["policy", "quote"]).default("policy"),
440
- policyTypes: z.array(z.string()).default(["other"]),
441
- policyNumber: SourceBackedValueSchema.optional(),
442
- namedInsured: SourceBackedValueSchema.optional(),
443
- insurer: SourceBackedValueSchema.optional(),
444
- broker: SourceBackedValueSchema.optional(),
445
- effectiveDate: SourceBackedValueSchema.optional(),
446
- expirationDate: SourceBackedValueSchema.optional(),
447
- retroactiveDate: SourceBackedValueSchema.optional(),
448
- premium: SourceBackedValueSchema.optional(),
449
- coverages: z.array(OperationalCoverageLineSchema).default([]),
450
- parties: z.array(OperationalPartySchema).default([]),
451
- endorsementSupport: z.array(OperationalEndorsementSupportSchema).default([]),
452
- sourceNodeIds: z.array(z.string().min(1)).default([]),
453
- sourceSpanIds: z.array(z.string().min(1)).default([]),
454
- warnings: z.array(z.string()).default([])
714
+ var OperationalEndorsementSupportSchema = z2.object({
715
+ kind: z2.string(),
716
+ status: z2.enum(["supported", "excluded", "requires_review"]),
717
+ summary: z2.string(),
718
+ sourceNodeIds: z2.array(z2.string().min(1)).default([]),
719
+ sourceSpanIds: z2.array(z2.string().min(1)).default([])
455
720
  });
456
-
457
- // src/schemas/enums.ts
458
- import { z as z2 } from "zod";
459
- var PolicyTypeSchema = z2.enum([
460
- // Commercial lines
461
- "general_liability",
462
- "commercial_property",
463
- "commercial_auto",
464
- "non_owned_auto",
465
- "workers_comp",
466
- "umbrella",
467
- "excess_liability",
468
- "professional_liability",
469
- "cyber",
470
- "epli",
471
- "directors_officers",
472
- "fiduciary_liability",
473
- "crime_fidelity",
474
- "inland_marine",
475
- "builders_risk",
476
- "environmental",
477
- "ocean_marine",
478
- "surety",
479
- "product_liability",
480
- "bop",
481
- "management_liability_package",
482
- "property",
483
- // Personal lines
484
- "homeowners_ho3",
485
- "homeowners_ho5",
486
- "renters_ho4",
487
- "condo_ho6",
488
- "dwelling_fire",
489
- "mobile_home",
490
- "personal_auto",
491
- "personal_umbrella",
492
- "flood_nfip",
493
- "flood_private",
494
- "earthquake",
495
- "personal_inland_marine",
496
- "watercraft",
497
- "recreational_vehicle",
498
- "farm_ranch",
499
- "life",
500
- "critical_illness",
501
- "disability",
502
- "long_term_care",
503
- "pet",
504
- "travel",
505
- "identity_theft",
506
- "title",
507
- "other"
508
- ]);
509
- var POLICY_TYPES = PolicyTypeSchema.options;
510
- var EndorsementTypeSchema = z2.enum([
511
- "additional_insured",
512
- "waiver_of_subrogation",
513
- "primary_noncontributory",
514
- "blanket_additional_insured",
515
- "loss_payee",
516
- "mortgage_holder",
517
- "broadening",
518
- "restriction",
519
- "exclusion",
520
- "amendatory",
521
- "notice_of_cancellation",
522
- "designated_premises",
523
- "classification_change",
524
- "schedule_update",
525
- "deductible_change",
526
- "limit_change",
527
- "territorial_extension",
528
- "other"
529
- ]);
530
- var ENDORSEMENT_TYPES = EndorsementTypeSchema.options;
531
- var ConditionTypeSchema = z2.enum([
532
- "duties_after_loss",
533
- "notice_requirements",
534
- "other_insurance",
535
- "cancellation",
536
- "nonrenewal",
537
- "transfer_of_rights",
538
- "liberalization",
539
- "arbitration",
540
- "concealment_fraud",
541
- "examination_under_oath",
542
- "legal_action",
543
- "loss_payment",
544
- "appraisal",
545
- "mortgage_holders",
546
- "policy_territory",
547
- "separation_of_insureds",
548
- "other"
549
- ]);
550
- var CONDITION_TYPES = ConditionTypeSchema.options;
551
- var PolicySectionTypeSchema = z2.enum([
552
- "declarations",
553
- "insuring_agreement",
554
- "policy_form",
555
- "endorsement",
556
- "application",
557
- "exclusion",
558
- "condition",
559
- "definition",
560
- "schedule",
561
- "notice",
562
- "regulatory",
563
- "other"
564
- ]);
565
- var POLICY_SECTION_TYPES = PolicySectionTypeSchema.options;
566
- var QuoteSectionTypeSchema = z2.enum([
567
- "terms_summary",
568
- "premium_indication",
569
- "underwriting_condition",
570
- "subjectivity",
571
- "coverage_summary",
572
- "exclusion",
573
- "other"
574
- ]);
575
- var QUOTE_SECTION_TYPES = QuoteSectionTypeSchema.options;
576
- var CoverageFormSchema = z2.enum(["occurrence", "claims_made", "accident"]);
577
- var COVERAGE_FORMS = CoverageFormSchema.options;
578
- var PolicyTermTypeSchema = z2.enum(["fixed", "continuous"]);
579
- var POLICY_TERM_TYPES = PolicyTermTypeSchema.options;
580
- var CoverageTriggerSchema = z2.enum(["occurrence", "claims_made", "accident"]);
581
- var COVERAGE_TRIGGERS = CoverageTriggerSchema.options;
582
- var LimitTypeSchema = z2.enum([
583
- "per_occurrence",
584
- "per_claim",
585
- "aggregate",
586
- "per_person",
587
- "per_accident",
588
- "statutory",
589
- "blanket",
590
- "scheduled"
591
- ]);
592
- var LIMIT_TYPES = LimitTypeSchema.options;
593
- var DeductibleTypeSchema = z2.enum([
594
- "per_occurrence",
595
- "per_claim",
596
- "aggregate",
597
- "percentage",
598
- "waiting_period"
599
- ]);
600
- var DEDUCTIBLE_TYPES = DeductibleTypeSchema.options;
601
- var ValuationMethodSchema = z2.enum([
602
- "replacement_cost",
603
- "actual_cash_value",
604
- "agreed_value",
605
- "functional_replacement"
606
- ]);
607
- var VALUATION_METHODS = ValuationMethodSchema.options;
608
- var DefenseCostTreatmentSchema = z2.enum(["inside_limits", "outside_limits", "supplementary"]);
609
- var DEFENSE_COST_TREATMENTS = DefenseCostTreatmentSchema.options;
610
- var EntityTypeSchema = z2.enum([
611
- "corporation",
612
- "llc",
613
- "partnership",
614
- "sole_proprietor",
615
- "joint_venture",
616
- "trust",
617
- "nonprofit",
618
- "municipality",
619
- "individual",
620
- "married_couple",
621
- "other"
622
- ]);
623
- var ENTITY_TYPES = EntityTypeSchema.options;
624
- var AdmittedStatusSchema = z2.enum(["admitted", "non_admitted", "surplus_lines"]);
625
- var ADMITTED_STATUSES = AdmittedStatusSchema.options;
626
- var AuditTypeSchema = z2.enum([
627
- "annual",
628
- "semi_annual",
629
- "quarterly",
630
- "monthly",
631
- "self",
632
- "physical",
633
- "none"
634
- ]);
635
- var AUDIT_TYPES = AuditTypeSchema.options;
636
- var EndorsementPartyRoleSchema = z2.enum([
637
- "additional_insured",
638
- "loss_payee",
639
- "mortgage_holder",
640
- "certificate_holder",
641
- "notice_recipient",
642
- "other"
643
- ]);
644
- var ENDORSEMENT_PARTY_ROLES = EndorsementPartyRoleSchema.options;
645
- var ClaimStatusSchema = z2.enum(["open", "closed", "reopened"]);
646
- var CLAIM_STATUSES = ClaimStatusSchema.options;
647
- var SubjectivityCategorySchema = z2.enum(["pre_binding", "post_binding", "information"]);
648
- var SUBJECTIVITY_CATEGORIES = SubjectivityCategorySchema.options;
649
- var DocumentTypeSchema = z2.enum(["policy", "quote", "binder", "endorsement", "certificate"]);
650
- var DOCUMENT_TYPES = DocumentTypeSchema.options;
651
- var ChunkTypeSchema = z2.enum([
652
- "declarations",
653
- "coverage_form",
654
- "endorsement",
655
- "schedule",
656
- "conditions",
657
- "mixed"
658
- ]);
659
- var CHUNK_TYPES = ChunkTypeSchema.options;
660
- var RatingBasisTypeSchema = z2.enum([
661
- "payroll",
662
- "revenue",
663
- "area",
664
- "units",
665
- "vehicle_count",
666
- "employee_count",
667
- "per_capita",
668
- "dwelling_value",
669
- "vehicle_value",
670
- "contents_value",
671
- "other"
672
- ]);
673
- var RATING_BASIS_TYPES = RatingBasisTypeSchema.options;
674
- var VehicleCoverageTypeSchema = z2.enum([
675
- "liability",
676
- "collision",
677
- "comprehensive",
678
- "uninsured_motorist",
679
- "underinsured_motorist",
680
- "medical_payments",
681
- "hired_auto",
682
- "non_owned_auto",
683
- "cargo",
684
- "physical_damage"
685
- ]);
686
- var VEHICLE_COVERAGE_TYPES = VehicleCoverageTypeSchema.options;
687
- var HomeownersFormTypeSchema = z2.enum(["HO-3", "HO-5", "HO-4", "HO-6", "HO-7", "HO-8"]);
688
- var HOMEOWNERS_FORM_TYPES = HomeownersFormTypeSchema.options;
689
- var DwellingFireFormTypeSchema = z2.enum(["DP-1", "DP-2", "DP-3"]);
690
- var DWELLING_FIRE_FORM_TYPES = DwellingFireFormTypeSchema.options;
691
- var FloodZoneSchema = z2.enum(["A", "AE", "AH", "AO", "AR", "V", "VE", "B", "C", "X", "D"]);
692
- var FLOOD_ZONES = FloodZoneSchema.options;
693
- var ConstructionTypeSchema = z2.enum(["frame", "masonry", "superior", "mixed", "other"]);
694
- var CONSTRUCTION_TYPES = ConstructionTypeSchema.options;
695
- var RoofTypeSchema = z2.enum(["asphalt_shingle", "tile", "metal", "slate", "flat", "wood_shake", "other"]);
696
- var ROOF_TYPES = RoofTypeSchema.options;
697
- var FoundationTypeSchema = z2.enum(["basement", "crawl_space", "slab", "pier", "other"]);
698
- var FOUNDATION_TYPES = FoundationTypeSchema.options;
699
- var PersonalAutoUsageSchema = z2.enum(["pleasure", "commute", "business", "farm"]);
700
- var PERSONAL_AUTO_USAGES = PersonalAutoUsageSchema.options;
701
- var LossSettlementSchema = z2.enum([
702
- "replacement_cost",
703
- "actual_cash_value",
704
- "extended_replacement_cost",
705
- "guaranteed_replacement_cost"
706
- ]);
707
- var LOSS_SETTLEMENTS = LossSettlementSchema.options;
708
- var BoatTypeSchema = z2.enum(["sailboat", "powerboat", "pontoon", "jet_ski", "kayak_canoe", "yacht", "other"]);
709
- var BOAT_TYPES = BoatTypeSchema.options;
710
- var RVTypeSchema = z2.enum(["rv_motorhome", "travel_trailer", "atv", "snowmobile", "golf_cart", "dirt_bike", "other"]);
711
- var RV_TYPES = RVTypeSchema.options;
712
- var ScheduledItemCategorySchema = z2.enum([
713
- "jewelry",
714
- "fine_art",
715
- "musical_instruments",
716
- "silverware",
717
- "furs",
718
- "cameras",
719
- "collectibles",
720
- "firearms",
721
- "golf_equipment",
722
- "other"
723
- ]);
724
- var SCHEDULED_ITEM_CATEGORIES = ScheduledItemCategorySchema.options;
725
- var TitlePolicyTypeSchema = z2.enum(["owners", "lenders"]);
726
- var TITLE_POLICY_TYPES = TitlePolicyTypeSchema.options;
727
- var PetSpeciesSchema = z2.enum(["dog", "cat", "other"]);
728
- var PET_SPECIES = PetSpeciesSchema.options;
729
-
730
- // src/source/policy-types.ts
731
- var POLICY_TYPE_KEYS = new Set(POLICY_TYPES);
721
+ function legacyOperationalProfileInput(value) {
722
+ if (!value || typeof value !== "object" || Array.isArray(value)) return value;
723
+ const record = value;
724
+ if ("linesOfBusiness" in record) return value;
725
+ if (!("policyTypes" in record)) return value;
726
+ return {
727
+ ...record,
728
+ linesOfBusiness: record.policyTypes
729
+ };
730
+ }
731
+ var OperationalLinesOfBusinessSchema = z2.preprocess(
732
+ (value) => Array.isArray(value) ? toLobCodes(value.filter((item) => typeof item === "string")) : void 0,
733
+ z2.array(AcordLobCodeSchema).default(["UN"])
734
+ );
735
+ var PolicyOperationalProfileSchema = z2.preprocess(
736
+ legacyOperationalProfileInput,
737
+ z2.object({
738
+ documentType: z2.enum(["policy", "quote"]).default("policy"),
739
+ linesOfBusiness: OperationalLinesOfBusinessSchema,
740
+ policyNumber: SourceBackedValueSchema.optional(),
741
+ namedInsured: SourceBackedValueSchema.optional(),
742
+ insurer: SourceBackedValueSchema.optional(),
743
+ broker: SourceBackedValueSchema.optional(),
744
+ effectiveDate: SourceBackedValueSchema.optional(),
745
+ expirationDate: SourceBackedValueSchema.optional(),
746
+ retroactiveDate: SourceBackedValueSchema.optional(),
747
+ premium: SourceBackedValueSchema.optional(),
748
+ coverages: z2.array(OperationalCoverageLineSchema).default([]),
749
+ parties: z2.array(OperationalPartySchema).default([]),
750
+ endorsementSupport: z2.array(OperationalEndorsementSupportSchema).default([]),
751
+ sourceNodeIds: z2.array(z2.string().min(1)).default([]),
752
+ sourceSpanIds: z2.array(z2.string().min(1)).default([]),
753
+ warnings: z2.array(z2.string()).default([])
754
+ })
755
+ );
732
756
 
733
757
  // src/source/retrieval.ts
734
758
  function evidenceTieBreakId(evidence) {