@claritylabs/cl-sdk 0.7.1 → 0.7.3
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/README.md +33 -4
- package/dist/index.d.mts +179 -168
- package/dist/index.d.ts +179 -168
- package/dist/index.js +1016 -962
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1015 -962
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
// src/core/retry.ts
|
|
2
2
|
var MAX_RETRIES = 5;
|
|
3
3
|
var BASE_DELAY_MS = 2e3;
|
|
4
|
-
function
|
|
4
|
+
function isRetryableError(error) {
|
|
5
5
|
if (error instanceof Error) {
|
|
6
6
|
const msg = error.message.toLowerCase();
|
|
7
7
|
if (msg.includes("rate limit") || msg.includes("rate_limit") || msg.includes("too many requests")) {
|
|
8
8
|
return true;
|
|
9
9
|
}
|
|
10
|
+
if (msg.includes("grammar compilation timed out")) return true;
|
|
11
|
+
if (msg.includes("no output generated")) return true;
|
|
12
|
+
if (msg.includes("overloaded")) return true;
|
|
13
|
+
if (msg.includes("internal server error")) return true;
|
|
14
|
+
if (msg.includes("service unavailable")) return true;
|
|
15
|
+
if (msg.includes("gateway timeout")) return true;
|
|
10
16
|
}
|
|
11
17
|
if (typeof error === "object" && error !== null) {
|
|
12
18
|
const status = error.status ?? error.statusCode;
|
|
13
|
-
if (status === 429) return true;
|
|
19
|
+
if (status === 429 || status === 500 || status === 502 || status === 503 || status === 504) return true;
|
|
14
20
|
}
|
|
15
21
|
return false;
|
|
16
22
|
}
|
|
@@ -19,12 +25,12 @@ async function withRetry(fn, log) {
|
|
|
19
25
|
try {
|
|
20
26
|
return await fn();
|
|
21
27
|
} catch (error) {
|
|
22
|
-
if (!
|
|
28
|
+
if (!isRetryableError(error) || attempt >= MAX_RETRIES) {
|
|
23
29
|
throw error;
|
|
24
30
|
}
|
|
25
31
|
const jitter = Math.random() * 1e3;
|
|
26
32
|
const delay = BASE_DELAY_MS * Math.pow(2, attempt) + jitter;
|
|
27
|
-
await log?.(`
|
|
33
|
+
await log?.(`Retryable error, retrying in ${(delay / 1e3).toFixed(1)}s (attempt ${attempt + 1}/${MAX_RETRIES})...`);
|
|
28
34
|
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
29
35
|
}
|
|
30
36
|
}
|
|
@@ -71,14 +77,59 @@ function sanitizeNulls(obj) {
|
|
|
71
77
|
return obj;
|
|
72
78
|
}
|
|
73
79
|
|
|
80
|
+
// src/core/strict-schema.ts
|
|
81
|
+
import { z } from "zod";
|
|
82
|
+
function toStrictSchema(schema) {
|
|
83
|
+
const def = schema._zod?.def;
|
|
84
|
+
const typeName = def?.type ?? schema.type;
|
|
85
|
+
if (typeName === "object") {
|
|
86
|
+
const shape = schema.shape;
|
|
87
|
+
if (!shape) return schema;
|
|
88
|
+
const newShape = {};
|
|
89
|
+
for (const [key, value] of Object.entries(shape)) {
|
|
90
|
+
const field = value;
|
|
91
|
+
const fieldDef = field._zod?.def;
|
|
92
|
+
const fieldType = fieldDef?.type ?? field.type;
|
|
93
|
+
if (fieldType === "optional") {
|
|
94
|
+
const innerType = fieldDef?.innerType;
|
|
95
|
+
if (innerType) {
|
|
96
|
+
const transformed = toStrictSchema(innerType);
|
|
97
|
+
newShape[key] = z.nullable(transformed);
|
|
98
|
+
} else {
|
|
99
|
+
newShape[key] = z.nullable(field);
|
|
100
|
+
}
|
|
101
|
+
} else {
|
|
102
|
+
newShape[key] = toStrictSchema(field);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return z.object(newShape);
|
|
106
|
+
}
|
|
107
|
+
if (typeName === "array") {
|
|
108
|
+
const element = def?.element ?? schema.element;
|
|
109
|
+
if (element) {
|
|
110
|
+
return z.array(toStrictSchema(element));
|
|
111
|
+
}
|
|
112
|
+
return schema;
|
|
113
|
+
}
|
|
114
|
+
if (typeName === "nullable") {
|
|
115
|
+
const innerType = def?.innerType;
|
|
116
|
+
if (innerType) {
|
|
117
|
+
return z.nullable(toStrictSchema(innerType));
|
|
118
|
+
}
|
|
119
|
+
return schema;
|
|
120
|
+
}
|
|
121
|
+
return schema;
|
|
122
|
+
}
|
|
123
|
+
|
|
74
124
|
// src/core/safe-generate.ts
|
|
75
125
|
async function safeGenerateObject(generateObject, params, options) {
|
|
76
126
|
const maxRetries = options?.maxRetries ?? 1;
|
|
77
127
|
let lastError;
|
|
128
|
+
const strictParams = { ...params, schema: toStrictSchema(params.schema) };
|
|
78
129
|
for (let attempt = 0; attempt <= maxRetries; attempt++) {
|
|
79
130
|
try {
|
|
80
131
|
const result = await withRetry(
|
|
81
|
-
() => generateObject(
|
|
132
|
+
() => generateObject(strictParams),
|
|
82
133
|
options?.log
|
|
83
134
|
);
|
|
84
135
|
return result;
|
|
@@ -135,8 +186,8 @@ function createPipelineContext(opts) {
|
|
|
135
186
|
}
|
|
136
187
|
|
|
137
188
|
// src/schemas/enums.ts
|
|
138
|
-
import { z } from "zod";
|
|
139
|
-
var PolicyTypeSchema =
|
|
189
|
+
import { z as z2 } from "zod";
|
|
190
|
+
var PolicyTypeSchema = z2.enum([
|
|
140
191
|
// Commercial lines
|
|
141
192
|
"general_liability",
|
|
142
193
|
"commercial_property",
|
|
@@ -183,7 +234,7 @@ var PolicyTypeSchema = z.enum([
|
|
|
183
234
|
"other"
|
|
184
235
|
]);
|
|
185
236
|
var POLICY_TYPES = PolicyTypeSchema.options;
|
|
186
|
-
var EndorsementTypeSchema =
|
|
237
|
+
var EndorsementTypeSchema = z2.enum([
|
|
187
238
|
"additional_insured",
|
|
188
239
|
"waiver_of_subrogation",
|
|
189
240
|
"primary_noncontributory",
|
|
@@ -204,7 +255,7 @@ var EndorsementTypeSchema = z.enum([
|
|
|
204
255
|
"other"
|
|
205
256
|
]);
|
|
206
257
|
var ENDORSEMENT_TYPES = EndorsementTypeSchema.options;
|
|
207
|
-
var ConditionTypeSchema =
|
|
258
|
+
var ConditionTypeSchema = z2.enum([
|
|
208
259
|
"duties_after_loss",
|
|
209
260
|
"notice_requirements",
|
|
210
261
|
"other_insurance",
|
|
@@ -224,7 +275,7 @@ var ConditionTypeSchema = z.enum([
|
|
|
224
275
|
"other"
|
|
225
276
|
]);
|
|
226
277
|
var CONDITION_TYPES = ConditionTypeSchema.options;
|
|
227
|
-
var PolicySectionTypeSchema =
|
|
278
|
+
var PolicySectionTypeSchema = z2.enum([
|
|
228
279
|
"declarations",
|
|
229
280
|
"insuring_agreement",
|
|
230
281
|
"policy_form",
|
|
@@ -239,7 +290,7 @@ var PolicySectionTypeSchema = z.enum([
|
|
|
239
290
|
"other"
|
|
240
291
|
]);
|
|
241
292
|
var POLICY_SECTION_TYPES = PolicySectionTypeSchema.options;
|
|
242
|
-
var QuoteSectionTypeSchema =
|
|
293
|
+
var QuoteSectionTypeSchema = z2.enum([
|
|
243
294
|
"terms_summary",
|
|
244
295
|
"premium_indication",
|
|
245
296
|
"underwriting_condition",
|
|
@@ -249,13 +300,13 @@ var QuoteSectionTypeSchema = z.enum([
|
|
|
249
300
|
"other"
|
|
250
301
|
]);
|
|
251
302
|
var QUOTE_SECTION_TYPES = QuoteSectionTypeSchema.options;
|
|
252
|
-
var CoverageFormSchema =
|
|
303
|
+
var CoverageFormSchema = z2.enum(["occurrence", "claims_made", "accident"]);
|
|
253
304
|
var COVERAGE_FORMS = CoverageFormSchema.options;
|
|
254
|
-
var PolicyTermTypeSchema =
|
|
305
|
+
var PolicyTermTypeSchema = z2.enum(["fixed", "continuous"]);
|
|
255
306
|
var POLICY_TERM_TYPES = PolicyTermTypeSchema.options;
|
|
256
|
-
var CoverageTriggerSchema =
|
|
307
|
+
var CoverageTriggerSchema = z2.enum(["occurrence", "claims_made", "accident"]);
|
|
257
308
|
var COVERAGE_TRIGGERS = CoverageTriggerSchema.options;
|
|
258
|
-
var LimitTypeSchema =
|
|
309
|
+
var LimitTypeSchema = z2.enum([
|
|
259
310
|
"per_occurrence",
|
|
260
311
|
"per_claim",
|
|
261
312
|
"aggregate",
|
|
@@ -266,7 +317,7 @@ var LimitTypeSchema = z.enum([
|
|
|
266
317
|
"scheduled"
|
|
267
318
|
]);
|
|
268
319
|
var LIMIT_TYPES = LimitTypeSchema.options;
|
|
269
|
-
var DeductibleTypeSchema =
|
|
320
|
+
var DeductibleTypeSchema = z2.enum([
|
|
270
321
|
"per_occurrence",
|
|
271
322
|
"per_claim",
|
|
272
323
|
"aggregate",
|
|
@@ -274,16 +325,16 @@ var DeductibleTypeSchema = z.enum([
|
|
|
274
325
|
"waiting_period"
|
|
275
326
|
]);
|
|
276
327
|
var DEDUCTIBLE_TYPES = DeductibleTypeSchema.options;
|
|
277
|
-
var ValuationMethodSchema =
|
|
328
|
+
var ValuationMethodSchema = z2.enum([
|
|
278
329
|
"replacement_cost",
|
|
279
330
|
"actual_cash_value",
|
|
280
331
|
"agreed_value",
|
|
281
332
|
"functional_replacement"
|
|
282
333
|
]);
|
|
283
334
|
var VALUATION_METHODS = ValuationMethodSchema.options;
|
|
284
|
-
var DefenseCostTreatmentSchema =
|
|
335
|
+
var DefenseCostTreatmentSchema = z2.enum(["inside_limits", "outside_limits", "supplementary"]);
|
|
285
336
|
var DEFENSE_COST_TREATMENTS = DefenseCostTreatmentSchema.options;
|
|
286
|
-
var EntityTypeSchema =
|
|
337
|
+
var EntityTypeSchema = z2.enum([
|
|
287
338
|
"corporation",
|
|
288
339
|
"llc",
|
|
289
340
|
"partnership",
|
|
@@ -297,9 +348,9 @@ var EntityTypeSchema = z.enum([
|
|
|
297
348
|
"other"
|
|
298
349
|
]);
|
|
299
350
|
var ENTITY_TYPES = EntityTypeSchema.options;
|
|
300
|
-
var AdmittedStatusSchema =
|
|
351
|
+
var AdmittedStatusSchema = z2.enum(["admitted", "non_admitted", "surplus_lines"]);
|
|
301
352
|
var ADMITTED_STATUSES = AdmittedStatusSchema.options;
|
|
302
|
-
var AuditTypeSchema =
|
|
353
|
+
var AuditTypeSchema = z2.enum([
|
|
303
354
|
"annual",
|
|
304
355
|
"semi_annual",
|
|
305
356
|
"quarterly",
|
|
@@ -309,7 +360,7 @@ var AuditTypeSchema = z.enum([
|
|
|
309
360
|
"none"
|
|
310
361
|
]);
|
|
311
362
|
var AUDIT_TYPES = AuditTypeSchema.options;
|
|
312
|
-
var EndorsementPartyRoleSchema =
|
|
363
|
+
var EndorsementPartyRoleSchema = z2.enum([
|
|
313
364
|
"additional_insured",
|
|
314
365
|
"loss_payee",
|
|
315
366
|
"mortgage_holder",
|
|
@@ -318,13 +369,13 @@ var EndorsementPartyRoleSchema = z.enum([
|
|
|
318
369
|
"other"
|
|
319
370
|
]);
|
|
320
371
|
var ENDORSEMENT_PARTY_ROLES = EndorsementPartyRoleSchema.options;
|
|
321
|
-
var ClaimStatusSchema =
|
|
372
|
+
var ClaimStatusSchema = z2.enum(["open", "closed", "reopened"]);
|
|
322
373
|
var CLAIM_STATUSES = ClaimStatusSchema.options;
|
|
323
|
-
var SubjectivityCategorySchema =
|
|
374
|
+
var SubjectivityCategorySchema = z2.enum(["pre_binding", "post_binding", "information"]);
|
|
324
375
|
var SUBJECTIVITY_CATEGORIES = SubjectivityCategorySchema.options;
|
|
325
|
-
var DocumentTypeSchema =
|
|
376
|
+
var DocumentTypeSchema = z2.enum(["policy", "quote", "binder", "endorsement", "certificate"]);
|
|
326
377
|
var DOCUMENT_TYPES = DocumentTypeSchema.options;
|
|
327
|
-
var ChunkTypeSchema =
|
|
378
|
+
var ChunkTypeSchema = z2.enum([
|
|
328
379
|
"declarations",
|
|
329
380
|
"coverage_form",
|
|
330
381
|
"endorsement",
|
|
@@ -333,7 +384,7 @@ var ChunkTypeSchema = z.enum([
|
|
|
333
384
|
"mixed"
|
|
334
385
|
]);
|
|
335
386
|
var CHUNK_TYPES = ChunkTypeSchema.options;
|
|
336
|
-
var RatingBasisTypeSchema =
|
|
387
|
+
var RatingBasisTypeSchema = z2.enum([
|
|
337
388
|
"payroll",
|
|
338
389
|
"revenue",
|
|
339
390
|
"area",
|
|
@@ -347,7 +398,7 @@ var RatingBasisTypeSchema = z.enum([
|
|
|
347
398
|
"other"
|
|
348
399
|
]);
|
|
349
400
|
var RATING_BASIS_TYPES = RatingBasisTypeSchema.options;
|
|
350
|
-
var VehicleCoverageTypeSchema =
|
|
401
|
+
var VehicleCoverageTypeSchema = z2.enum([
|
|
351
402
|
"liability",
|
|
352
403
|
"collision",
|
|
353
404
|
"comprehensive",
|
|
@@ -360,32 +411,32 @@ var VehicleCoverageTypeSchema = z.enum([
|
|
|
360
411
|
"physical_damage"
|
|
361
412
|
]);
|
|
362
413
|
var VEHICLE_COVERAGE_TYPES = VehicleCoverageTypeSchema.options;
|
|
363
|
-
var HomeownersFormTypeSchema =
|
|
414
|
+
var HomeownersFormTypeSchema = z2.enum(["HO-3", "HO-5", "HO-4", "HO-6", "HO-7", "HO-8"]);
|
|
364
415
|
var HOMEOWNERS_FORM_TYPES = HomeownersFormTypeSchema.options;
|
|
365
|
-
var DwellingFireFormTypeSchema =
|
|
416
|
+
var DwellingFireFormTypeSchema = z2.enum(["DP-1", "DP-2", "DP-3"]);
|
|
366
417
|
var DWELLING_FIRE_FORM_TYPES = DwellingFireFormTypeSchema.options;
|
|
367
|
-
var FloodZoneSchema =
|
|
418
|
+
var FloodZoneSchema = z2.enum(["A", "AE", "AH", "AO", "AR", "V", "VE", "B", "C", "X", "D"]);
|
|
368
419
|
var FLOOD_ZONES = FloodZoneSchema.options;
|
|
369
|
-
var ConstructionTypeSchema =
|
|
420
|
+
var ConstructionTypeSchema = z2.enum(["frame", "masonry", "superior", "mixed", "other"]);
|
|
370
421
|
var CONSTRUCTION_TYPES = ConstructionTypeSchema.options;
|
|
371
|
-
var RoofTypeSchema =
|
|
422
|
+
var RoofTypeSchema = z2.enum(["asphalt_shingle", "tile", "metal", "slate", "flat", "wood_shake", "other"]);
|
|
372
423
|
var ROOF_TYPES = RoofTypeSchema.options;
|
|
373
|
-
var FoundationTypeSchema =
|
|
424
|
+
var FoundationTypeSchema = z2.enum(["basement", "crawl_space", "slab", "pier", "other"]);
|
|
374
425
|
var FOUNDATION_TYPES = FoundationTypeSchema.options;
|
|
375
|
-
var PersonalAutoUsageSchema =
|
|
426
|
+
var PersonalAutoUsageSchema = z2.enum(["pleasure", "commute", "business", "farm"]);
|
|
376
427
|
var PERSONAL_AUTO_USAGES = PersonalAutoUsageSchema.options;
|
|
377
|
-
var LossSettlementSchema =
|
|
428
|
+
var LossSettlementSchema = z2.enum([
|
|
378
429
|
"replacement_cost",
|
|
379
430
|
"actual_cash_value",
|
|
380
431
|
"extended_replacement_cost",
|
|
381
432
|
"guaranteed_replacement_cost"
|
|
382
433
|
]);
|
|
383
434
|
var LOSS_SETTLEMENTS = LossSettlementSchema.options;
|
|
384
|
-
var BoatTypeSchema =
|
|
435
|
+
var BoatTypeSchema = z2.enum(["sailboat", "powerboat", "pontoon", "jet_ski", "kayak_canoe", "yacht", "other"]);
|
|
385
436
|
var BOAT_TYPES = BoatTypeSchema.options;
|
|
386
|
-
var RVTypeSchema =
|
|
437
|
+
var RVTypeSchema = z2.enum(["rv_motorhome", "travel_trailer", "atv", "snowmobile", "golf_cart", "dirt_bike", "other"]);
|
|
387
438
|
var RV_TYPES = RVTypeSchema.options;
|
|
388
|
-
var ScheduledItemCategorySchema =
|
|
439
|
+
var ScheduledItemCategorySchema = z2.enum([
|
|
389
440
|
"jewelry",
|
|
390
441
|
"fine_art",
|
|
391
442
|
"musical_instruments",
|
|
@@ -398,691 +449,691 @@ var ScheduledItemCategorySchema = z.enum([
|
|
|
398
449
|
"other"
|
|
399
450
|
]);
|
|
400
451
|
var SCHEDULED_ITEM_CATEGORIES = ScheduledItemCategorySchema.options;
|
|
401
|
-
var TitlePolicyTypeSchema =
|
|
452
|
+
var TitlePolicyTypeSchema = z2.enum(["owners", "lenders"]);
|
|
402
453
|
var TITLE_POLICY_TYPES = TitlePolicyTypeSchema.options;
|
|
403
|
-
var PetSpeciesSchema =
|
|
454
|
+
var PetSpeciesSchema = z2.enum(["dog", "cat", "other"]);
|
|
404
455
|
var PET_SPECIES = PetSpeciesSchema.options;
|
|
405
456
|
|
|
406
457
|
// src/schemas/shared.ts
|
|
407
|
-
import { z as
|
|
408
|
-
var AddressSchema =
|
|
409
|
-
street1:
|
|
410
|
-
street2:
|
|
411
|
-
city:
|
|
412
|
-
state:
|
|
413
|
-
zip:
|
|
414
|
-
country:
|
|
458
|
+
import { z as z3 } from "zod";
|
|
459
|
+
var AddressSchema = z3.object({
|
|
460
|
+
street1: z3.string(),
|
|
461
|
+
street2: z3.string().optional(),
|
|
462
|
+
city: z3.string(),
|
|
463
|
+
state: z3.string(),
|
|
464
|
+
zip: z3.string(),
|
|
465
|
+
country: z3.string().optional()
|
|
415
466
|
});
|
|
416
|
-
var ContactSchema =
|
|
417
|
-
name:
|
|
418
|
-
title:
|
|
419
|
-
type:
|
|
420
|
-
phone:
|
|
421
|
-
fax:
|
|
422
|
-
email:
|
|
467
|
+
var ContactSchema = z3.object({
|
|
468
|
+
name: z3.string().optional(),
|
|
469
|
+
title: z3.string().optional(),
|
|
470
|
+
type: z3.string().optional(),
|
|
471
|
+
phone: z3.string().optional(),
|
|
472
|
+
fax: z3.string().optional(),
|
|
473
|
+
email: z3.string().optional(),
|
|
423
474
|
address: AddressSchema.optional(),
|
|
424
|
-
hours:
|
|
475
|
+
hours: z3.string().optional()
|
|
425
476
|
});
|
|
426
|
-
var FormReferenceSchema =
|
|
427
|
-
formNumber:
|
|
428
|
-
editionDate:
|
|
429
|
-
title:
|
|
430
|
-
formType:
|
|
477
|
+
var FormReferenceSchema = z3.object({
|
|
478
|
+
formNumber: z3.string(),
|
|
479
|
+
editionDate: z3.string().optional(),
|
|
480
|
+
title: z3.string().optional(),
|
|
481
|
+
formType: z3.enum(["coverage", "endorsement", "declarations", "application", "notice", "other"])
|
|
431
482
|
});
|
|
432
|
-
var TaxFeeItemSchema =
|
|
433
|
-
name:
|
|
434
|
-
amount:
|
|
435
|
-
type:
|
|
436
|
-
description:
|
|
483
|
+
var TaxFeeItemSchema = z3.object({
|
|
484
|
+
name: z3.string(),
|
|
485
|
+
amount: z3.string(),
|
|
486
|
+
type: z3.enum(["tax", "fee", "surcharge", "assessment"]).optional(),
|
|
487
|
+
description: z3.string().optional()
|
|
437
488
|
});
|
|
438
|
-
var RatingBasisSchema =
|
|
489
|
+
var RatingBasisSchema = z3.object({
|
|
439
490
|
type: RatingBasisTypeSchema,
|
|
440
|
-
amount:
|
|
441
|
-
description:
|
|
491
|
+
amount: z3.string().optional(),
|
|
492
|
+
description: z3.string().optional()
|
|
442
493
|
});
|
|
443
|
-
var SublimitSchema =
|
|
444
|
-
name:
|
|
445
|
-
limit:
|
|
446
|
-
appliesTo:
|
|
447
|
-
deductible:
|
|
494
|
+
var SublimitSchema = z3.object({
|
|
495
|
+
name: z3.string(),
|
|
496
|
+
limit: z3.string(),
|
|
497
|
+
appliesTo: z3.string().optional(),
|
|
498
|
+
deductible: z3.string().optional()
|
|
448
499
|
});
|
|
449
|
-
var SharedLimitSchema =
|
|
450
|
-
description:
|
|
451
|
-
limit:
|
|
452
|
-
coverageParts:
|
|
500
|
+
var SharedLimitSchema = z3.object({
|
|
501
|
+
description: z3.string(),
|
|
502
|
+
limit: z3.string(),
|
|
503
|
+
coverageParts: z3.array(z3.string())
|
|
453
504
|
});
|
|
454
|
-
var ExtendedReportingPeriodSchema =
|
|
455
|
-
basicDays:
|
|
456
|
-
supplementalYears:
|
|
457
|
-
supplementalPremium:
|
|
505
|
+
var ExtendedReportingPeriodSchema = z3.object({
|
|
506
|
+
basicDays: z3.number().optional(),
|
|
507
|
+
supplementalYears: z3.number().optional(),
|
|
508
|
+
supplementalPremium: z3.string().optional()
|
|
458
509
|
});
|
|
459
|
-
var NamedInsuredSchema =
|
|
460
|
-
name:
|
|
461
|
-
relationship:
|
|
510
|
+
var NamedInsuredSchema = z3.object({
|
|
511
|
+
name: z3.string(),
|
|
512
|
+
relationship: z3.string().optional(),
|
|
462
513
|
address: AddressSchema.optional()
|
|
463
514
|
});
|
|
464
515
|
|
|
465
516
|
// src/schemas/coverage.ts
|
|
466
|
-
import { z as
|
|
467
|
-
var CoverageSchema =
|
|
468
|
-
name:
|
|
469
|
-
limit:
|
|
470
|
-
deductible:
|
|
471
|
-
pageNumber:
|
|
472
|
-
sectionRef:
|
|
517
|
+
import { z as z4 } from "zod";
|
|
518
|
+
var CoverageSchema = z4.object({
|
|
519
|
+
name: z4.string(),
|
|
520
|
+
limit: z4.string(),
|
|
521
|
+
deductible: z4.string().optional(),
|
|
522
|
+
pageNumber: z4.number().optional(),
|
|
523
|
+
sectionRef: z4.string().optional()
|
|
473
524
|
});
|
|
474
|
-
var EnrichedCoverageSchema =
|
|
475
|
-
name:
|
|
476
|
-
coverageCode:
|
|
477
|
-
formNumber:
|
|
478
|
-
formEditionDate:
|
|
479
|
-
limit:
|
|
525
|
+
var EnrichedCoverageSchema = z4.object({
|
|
526
|
+
name: z4.string(),
|
|
527
|
+
coverageCode: z4.string().optional(),
|
|
528
|
+
formNumber: z4.string().optional(),
|
|
529
|
+
formEditionDate: z4.string().optional(),
|
|
530
|
+
limit: z4.string(),
|
|
480
531
|
limitType: LimitTypeSchema.optional(),
|
|
481
|
-
deductible:
|
|
532
|
+
deductible: z4.string().optional(),
|
|
482
533
|
deductibleType: DeductibleTypeSchema.optional(),
|
|
483
|
-
sir:
|
|
484
|
-
sublimit:
|
|
485
|
-
coinsurance:
|
|
534
|
+
sir: z4.string().optional(),
|
|
535
|
+
sublimit: z4.string().optional(),
|
|
536
|
+
coinsurance: z4.string().optional(),
|
|
486
537
|
valuation: ValuationMethodSchema.optional(),
|
|
487
|
-
territory:
|
|
538
|
+
territory: z4.string().optional(),
|
|
488
539
|
trigger: CoverageTriggerSchema.optional(),
|
|
489
|
-
retroactiveDate:
|
|
490
|
-
included:
|
|
491
|
-
premium:
|
|
492
|
-
pageNumber:
|
|
493
|
-
sectionRef:
|
|
540
|
+
retroactiveDate: z4.string().optional(),
|
|
541
|
+
included: z4.boolean(),
|
|
542
|
+
premium: z4.string().optional(),
|
|
543
|
+
pageNumber: z4.number().optional(),
|
|
544
|
+
sectionRef: z4.string().optional()
|
|
494
545
|
});
|
|
495
546
|
|
|
496
547
|
// src/schemas/endorsement.ts
|
|
497
|
-
import { z as
|
|
498
|
-
var EndorsementPartySchema =
|
|
499
|
-
name:
|
|
548
|
+
import { z as z5 } from "zod";
|
|
549
|
+
var EndorsementPartySchema = z5.object({
|
|
550
|
+
name: z5.string(),
|
|
500
551
|
role: EndorsementPartyRoleSchema,
|
|
501
552
|
address: AddressSchema.optional(),
|
|
502
|
-
relationship:
|
|
503
|
-
scope:
|
|
553
|
+
relationship: z5.string().optional(),
|
|
554
|
+
scope: z5.string().optional()
|
|
504
555
|
});
|
|
505
|
-
var EndorsementSchema =
|
|
506
|
-
formNumber:
|
|
507
|
-
editionDate:
|
|
508
|
-
title:
|
|
556
|
+
var EndorsementSchema = z5.object({
|
|
557
|
+
formNumber: z5.string(),
|
|
558
|
+
editionDate: z5.string().optional(),
|
|
559
|
+
title: z5.string(),
|
|
509
560
|
endorsementType: EndorsementTypeSchema,
|
|
510
|
-
effectiveDate:
|
|
511
|
-
affectedCoverageParts:
|
|
512
|
-
namedParties:
|
|
513
|
-
keyTerms:
|
|
514
|
-
premiumImpact:
|
|
515
|
-
content:
|
|
516
|
-
pageStart:
|
|
517
|
-
pageEnd:
|
|
561
|
+
effectiveDate: z5.string().optional(),
|
|
562
|
+
affectedCoverageParts: z5.array(z5.string()).optional(),
|
|
563
|
+
namedParties: z5.array(EndorsementPartySchema).optional(),
|
|
564
|
+
keyTerms: z5.array(z5.string()).optional(),
|
|
565
|
+
premiumImpact: z5.string().optional(),
|
|
566
|
+
content: z5.string(),
|
|
567
|
+
pageStart: z5.number(),
|
|
568
|
+
pageEnd: z5.number().optional()
|
|
518
569
|
});
|
|
519
570
|
|
|
520
571
|
// src/schemas/exclusion.ts
|
|
521
|
-
import { z as
|
|
522
|
-
var ExclusionSchema =
|
|
523
|
-
name:
|
|
524
|
-
formNumber:
|
|
525
|
-
excludedPerils:
|
|
526
|
-
isAbsolute:
|
|
527
|
-
exceptions:
|
|
528
|
-
buybackAvailable:
|
|
529
|
-
buybackEndorsement:
|
|
530
|
-
appliesTo:
|
|
531
|
-
content:
|
|
532
|
-
pageNumber:
|
|
572
|
+
import { z as z6 } from "zod";
|
|
573
|
+
var ExclusionSchema = z6.object({
|
|
574
|
+
name: z6.string(),
|
|
575
|
+
formNumber: z6.string().optional(),
|
|
576
|
+
excludedPerils: z6.array(z6.string()).optional(),
|
|
577
|
+
isAbsolute: z6.boolean().optional(),
|
|
578
|
+
exceptions: z6.array(z6.string()).optional(),
|
|
579
|
+
buybackAvailable: z6.boolean().optional(),
|
|
580
|
+
buybackEndorsement: z6.string().optional(),
|
|
581
|
+
appliesTo: z6.array(z6.string()).optional(),
|
|
582
|
+
content: z6.string(),
|
|
583
|
+
pageNumber: z6.number().optional()
|
|
533
584
|
});
|
|
534
585
|
|
|
535
586
|
// src/schemas/condition.ts
|
|
536
|
-
import { z as
|
|
537
|
-
var ConditionKeyValueSchema =
|
|
538
|
-
key:
|
|
539
|
-
value:
|
|
587
|
+
import { z as z7 } from "zod";
|
|
588
|
+
var ConditionKeyValueSchema = z7.object({
|
|
589
|
+
key: z7.string(),
|
|
590
|
+
value: z7.string()
|
|
540
591
|
});
|
|
541
|
-
var PolicyConditionSchema =
|
|
542
|
-
name:
|
|
592
|
+
var PolicyConditionSchema = z7.object({
|
|
593
|
+
name: z7.string(),
|
|
543
594
|
conditionType: ConditionTypeSchema,
|
|
544
|
-
content:
|
|
545
|
-
keyValues:
|
|
546
|
-
pageNumber:
|
|
595
|
+
content: z7.string(),
|
|
596
|
+
keyValues: z7.array(ConditionKeyValueSchema).optional(),
|
|
597
|
+
pageNumber: z7.number().optional()
|
|
547
598
|
});
|
|
548
599
|
|
|
549
600
|
// src/schemas/parties.ts
|
|
550
|
-
import { z as
|
|
551
|
-
var InsurerInfoSchema =
|
|
552
|
-
legalName:
|
|
553
|
-
naicNumber:
|
|
554
|
-
amBestRating:
|
|
555
|
-
amBestNumber:
|
|
601
|
+
import { z as z8 } from "zod";
|
|
602
|
+
var InsurerInfoSchema = z8.object({
|
|
603
|
+
legalName: z8.string(),
|
|
604
|
+
naicNumber: z8.string().optional(),
|
|
605
|
+
amBestRating: z8.string().optional(),
|
|
606
|
+
amBestNumber: z8.string().optional(),
|
|
556
607
|
admittedStatus: AdmittedStatusSchema.optional(),
|
|
557
|
-
stateOfDomicile:
|
|
608
|
+
stateOfDomicile: z8.string().optional()
|
|
558
609
|
});
|
|
559
|
-
var ProducerInfoSchema =
|
|
560
|
-
agencyName:
|
|
561
|
-
contactName:
|
|
562
|
-
licenseNumber:
|
|
563
|
-
phone:
|
|
564
|
-
email:
|
|
610
|
+
var ProducerInfoSchema = z8.object({
|
|
611
|
+
agencyName: z8.string(),
|
|
612
|
+
contactName: z8.string().optional(),
|
|
613
|
+
licenseNumber: z8.string().optional(),
|
|
614
|
+
phone: z8.string().optional(),
|
|
615
|
+
email: z8.string().optional(),
|
|
565
616
|
address: AddressSchema.optional()
|
|
566
617
|
});
|
|
567
618
|
|
|
568
619
|
// src/schemas/financial.ts
|
|
569
|
-
import { z as
|
|
570
|
-
var PaymentInstallmentSchema =
|
|
571
|
-
dueDate:
|
|
572
|
-
amount:
|
|
573
|
-
description:
|
|
620
|
+
import { z as z9 } from "zod";
|
|
621
|
+
var PaymentInstallmentSchema = z9.object({
|
|
622
|
+
dueDate: z9.string(),
|
|
623
|
+
amount: z9.string(),
|
|
624
|
+
description: z9.string().optional()
|
|
574
625
|
});
|
|
575
|
-
var PaymentPlanSchema =
|
|
576
|
-
installments:
|
|
577
|
-
financeCharge:
|
|
626
|
+
var PaymentPlanSchema = z9.object({
|
|
627
|
+
installments: z9.array(PaymentInstallmentSchema),
|
|
628
|
+
financeCharge: z9.string().optional()
|
|
578
629
|
});
|
|
579
|
-
var LocationPremiumSchema =
|
|
580
|
-
locationNumber:
|
|
581
|
-
premium:
|
|
582
|
-
description:
|
|
630
|
+
var LocationPremiumSchema = z9.object({
|
|
631
|
+
locationNumber: z9.number(),
|
|
632
|
+
premium: z9.string(),
|
|
633
|
+
description: z9.string().optional()
|
|
583
634
|
});
|
|
584
635
|
|
|
585
636
|
// src/schemas/loss-history.ts
|
|
586
|
-
import { z as
|
|
587
|
-
var ClaimRecordSchema =
|
|
588
|
-
dateOfLoss:
|
|
589
|
-
claimNumber:
|
|
590
|
-
description:
|
|
637
|
+
import { z as z10 } from "zod";
|
|
638
|
+
var ClaimRecordSchema = z10.object({
|
|
639
|
+
dateOfLoss: z10.string(),
|
|
640
|
+
claimNumber: z10.string().optional(),
|
|
641
|
+
description: z10.string(),
|
|
591
642
|
status: ClaimStatusSchema,
|
|
592
|
-
paid:
|
|
593
|
-
reserved:
|
|
594
|
-
incurred:
|
|
595
|
-
claimant:
|
|
596
|
-
coverageLine:
|
|
643
|
+
paid: z10.string().optional(),
|
|
644
|
+
reserved: z10.string().optional(),
|
|
645
|
+
incurred: z10.string().optional(),
|
|
646
|
+
claimant: z10.string().optional(),
|
|
647
|
+
coverageLine: z10.string().optional()
|
|
597
648
|
});
|
|
598
|
-
var LossSummarySchema =
|
|
599
|
-
period:
|
|
600
|
-
totalClaims:
|
|
601
|
-
totalIncurred:
|
|
602
|
-
totalPaid:
|
|
603
|
-
totalReserved:
|
|
604
|
-
lossRatio:
|
|
649
|
+
var LossSummarySchema = z10.object({
|
|
650
|
+
period: z10.string().optional(),
|
|
651
|
+
totalClaims: z10.number().optional(),
|
|
652
|
+
totalIncurred: z10.string().optional(),
|
|
653
|
+
totalPaid: z10.string().optional(),
|
|
654
|
+
totalReserved: z10.string().optional(),
|
|
655
|
+
lossRatio: z10.string().optional()
|
|
605
656
|
});
|
|
606
|
-
var ExperienceModSchema =
|
|
607
|
-
factor:
|
|
608
|
-
effectiveDate:
|
|
609
|
-
state:
|
|
657
|
+
var ExperienceModSchema = z10.object({
|
|
658
|
+
factor: z10.number(),
|
|
659
|
+
effectiveDate: z10.string().optional(),
|
|
660
|
+
state: z10.string().optional()
|
|
610
661
|
});
|
|
611
662
|
|
|
612
663
|
// src/schemas/underwriting.ts
|
|
613
|
-
import { z as
|
|
614
|
-
var EnrichedSubjectivitySchema =
|
|
615
|
-
description:
|
|
664
|
+
import { z as z11 } from "zod";
|
|
665
|
+
var EnrichedSubjectivitySchema = z11.object({
|
|
666
|
+
description: z11.string(),
|
|
616
667
|
category: SubjectivityCategorySchema.optional(),
|
|
617
|
-
dueDate:
|
|
618
|
-
status:
|
|
619
|
-
pageNumber:
|
|
668
|
+
dueDate: z11.string().optional(),
|
|
669
|
+
status: z11.enum(["open", "satisfied", "waived"]).optional(),
|
|
670
|
+
pageNumber: z11.number().optional()
|
|
620
671
|
});
|
|
621
|
-
var EnrichedUnderwritingConditionSchema =
|
|
622
|
-
description:
|
|
623
|
-
category:
|
|
624
|
-
pageNumber:
|
|
672
|
+
var EnrichedUnderwritingConditionSchema = z11.object({
|
|
673
|
+
description: z11.string(),
|
|
674
|
+
category: z11.string().optional(),
|
|
675
|
+
pageNumber: z11.number().optional()
|
|
625
676
|
});
|
|
626
|
-
var BindingAuthoritySchema =
|
|
627
|
-
authorizedBy:
|
|
628
|
-
method:
|
|
629
|
-
expiration:
|
|
630
|
-
conditions:
|
|
677
|
+
var BindingAuthoritySchema = z11.object({
|
|
678
|
+
authorizedBy: z11.string().optional(),
|
|
679
|
+
method: z11.string().optional(),
|
|
680
|
+
expiration: z11.string().optional(),
|
|
681
|
+
conditions: z11.array(z11.string()).optional()
|
|
631
682
|
});
|
|
632
683
|
|
|
633
684
|
// src/schemas/declarations/index.ts
|
|
634
|
-
import { z as
|
|
685
|
+
import { z as z15 } from "zod";
|
|
635
686
|
|
|
636
687
|
// src/schemas/declarations/personal.ts
|
|
637
|
-
import { z as
|
|
688
|
+
import { z as z13 } from "zod";
|
|
638
689
|
|
|
639
690
|
// src/schemas/declarations/shared.ts
|
|
640
|
-
import { z as
|
|
641
|
-
var EmployersLiabilityLimitsSchema =
|
|
642
|
-
eachAccident:
|
|
643
|
-
diseasePolicyLimit:
|
|
644
|
-
diseaseEachEmployee:
|
|
691
|
+
import { z as z12 } from "zod";
|
|
692
|
+
var EmployersLiabilityLimitsSchema = z12.object({
|
|
693
|
+
eachAccident: z12.string(),
|
|
694
|
+
diseasePolicyLimit: z12.string(),
|
|
695
|
+
diseaseEachEmployee: z12.string()
|
|
645
696
|
});
|
|
646
|
-
var LimitScheduleSchema =
|
|
647
|
-
perOccurrence:
|
|
648
|
-
generalAggregate:
|
|
649
|
-
productsCompletedOpsAggregate:
|
|
650
|
-
personalAdvertisingInjury:
|
|
651
|
-
eachEmployee:
|
|
652
|
-
fireDamage:
|
|
653
|
-
medicalExpense:
|
|
654
|
-
combinedSingleLimit:
|
|
655
|
-
bodilyInjuryPerPerson:
|
|
656
|
-
bodilyInjuryPerAccident:
|
|
657
|
-
propertyDamage:
|
|
658
|
-
eachOccurrenceUmbrella:
|
|
659
|
-
umbrellaAggregate:
|
|
660
|
-
umbrellaRetention:
|
|
661
|
-
statutory:
|
|
697
|
+
var LimitScheduleSchema = z12.object({
|
|
698
|
+
perOccurrence: z12.string().optional(),
|
|
699
|
+
generalAggregate: z12.string().optional(),
|
|
700
|
+
productsCompletedOpsAggregate: z12.string().optional(),
|
|
701
|
+
personalAdvertisingInjury: z12.string().optional(),
|
|
702
|
+
eachEmployee: z12.string().optional(),
|
|
703
|
+
fireDamage: z12.string().optional(),
|
|
704
|
+
medicalExpense: z12.string().optional(),
|
|
705
|
+
combinedSingleLimit: z12.string().optional(),
|
|
706
|
+
bodilyInjuryPerPerson: z12.string().optional(),
|
|
707
|
+
bodilyInjuryPerAccident: z12.string().optional(),
|
|
708
|
+
propertyDamage: z12.string().optional(),
|
|
709
|
+
eachOccurrenceUmbrella: z12.string().optional(),
|
|
710
|
+
umbrellaAggregate: z12.string().optional(),
|
|
711
|
+
umbrellaRetention: z12.string().optional(),
|
|
712
|
+
statutory: z12.boolean().optional(),
|
|
662
713
|
employersLiability: EmployersLiabilityLimitsSchema.optional(),
|
|
663
|
-
sublimits:
|
|
664
|
-
sharedLimits:
|
|
714
|
+
sublimits: z12.array(SublimitSchema).optional(),
|
|
715
|
+
sharedLimits: z12.array(SharedLimitSchema).optional(),
|
|
665
716
|
defenseCostTreatment: DefenseCostTreatmentSchema.optional()
|
|
666
717
|
});
|
|
667
|
-
var DeductibleScheduleSchema =
|
|
668
|
-
perClaim:
|
|
669
|
-
perOccurrence:
|
|
670
|
-
aggregateDeductible:
|
|
671
|
-
selfInsuredRetention:
|
|
672
|
-
corridorDeductible:
|
|
673
|
-
waitingPeriod:
|
|
674
|
-
appliesTo:
|
|
718
|
+
var DeductibleScheduleSchema = z12.object({
|
|
719
|
+
perClaim: z12.string().optional(),
|
|
720
|
+
perOccurrence: z12.string().optional(),
|
|
721
|
+
aggregateDeductible: z12.string().optional(),
|
|
722
|
+
selfInsuredRetention: z12.string().optional(),
|
|
723
|
+
corridorDeductible: z12.string().optional(),
|
|
724
|
+
waitingPeriod: z12.string().optional(),
|
|
725
|
+
appliesTo: z12.enum(["damages_only", "damages_and_defense", "defense_only"]).optional()
|
|
675
726
|
});
|
|
676
|
-
var InsuredLocationSchema =
|
|
677
|
-
number:
|
|
727
|
+
var InsuredLocationSchema = z12.object({
|
|
728
|
+
number: z12.number(),
|
|
678
729
|
address: AddressSchema,
|
|
679
|
-
description:
|
|
680
|
-
buildingValue:
|
|
681
|
-
contentsValue:
|
|
682
|
-
businessIncomeValue:
|
|
683
|
-
constructionType:
|
|
684
|
-
yearBuilt:
|
|
685
|
-
squareFootage:
|
|
686
|
-
protectionClass:
|
|
687
|
-
sprinklered:
|
|
688
|
-
alarmType:
|
|
689
|
-
occupancy:
|
|
730
|
+
description: z12.string().optional(),
|
|
731
|
+
buildingValue: z12.string().optional(),
|
|
732
|
+
contentsValue: z12.string().optional(),
|
|
733
|
+
businessIncomeValue: z12.string().optional(),
|
|
734
|
+
constructionType: z12.string().optional(),
|
|
735
|
+
yearBuilt: z12.number().optional(),
|
|
736
|
+
squareFootage: z12.number().optional(),
|
|
737
|
+
protectionClass: z12.string().optional(),
|
|
738
|
+
sprinklered: z12.boolean().optional(),
|
|
739
|
+
alarmType: z12.string().optional(),
|
|
740
|
+
occupancy: z12.string().optional()
|
|
690
741
|
});
|
|
691
|
-
var VehicleCoverageSchema =
|
|
742
|
+
var VehicleCoverageSchema = z12.object({
|
|
692
743
|
type: VehicleCoverageTypeSchema,
|
|
693
|
-
limit:
|
|
694
|
-
deductible:
|
|
695
|
-
included:
|
|
744
|
+
limit: z12.string().optional(),
|
|
745
|
+
deductible: z12.string().optional(),
|
|
746
|
+
included: z12.boolean()
|
|
696
747
|
});
|
|
697
|
-
var InsuredVehicleSchema =
|
|
698
|
-
number:
|
|
699
|
-
year:
|
|
700
|
-
make:
|
|
701
|
-
model:
|
|
702
|
-
vin:
|
|
703
|
-
costNew:
|
|
704
|
-
statedValue:
|
|
705
|
-
garageLocation:
|
|
706
|
-
coverages:
|
|
707
|
-
radius:
|
|
708
|
-
vehicleType:
|
|
748
|
+
var InsuredVehicleSchema = z12.object({
|
|
749
|
+
number: z12.number(),
|
|
750
|
+
year: z12.number(),
|
|
751
|
+
make: z12.string(),
|
|
752
|
+
model: z12.string(),
|
|
753
|
+
vin: z12.string(),
|
|
754
|
+
costNew: z12.string().optional(),
|
|
755
|
+
statedValue: z12.string().optional(),
|
|
756
|
+
garageLocation: z12.number().optional(),
|
|
757
|
+
coverages: z12.array(VehicleCoverageSchema).optional(),
|
|
758
|
+
radius: z12.string().optional(),
|
|
759
|
+
vehicleType: z12.string().optional()
|
|
709
760
|
});
|
|
710
|
-
var ClassificationCodeSchema =
|
|
711
|
-
code:
|
|
712
|
-
description:
|
|
713
|
-
premiumBasis:
|
|
714
|
-
basisAmount:
|
|
715
|
-
rate:
|
|
716
|
-
premium:
|
|
717
|
-
locationNumber:
|
|
761
|
+
var ClassificationCodeSchema = z12.object({
|
|
762
|
+
code: z12.string(),
|
|
763
|
+
description: z12.string(),
|
|
764
|
+
premiumBasis: z12.string(),
|
|
765
|
+
basisAmount: z12.string().optional(),
|
|
766
|
+
rate: z12.string().optional(),
|
|
767
|
+
premium: z12.string().optional(),
|
|
768
|
+
locationNumber: z12.number().optional()
|
|
718
769
|
});
|
|
719
|
-
var DwellingDetailsSchema =
|
|
770
|
+
var DwellingDetailsSchema = z12.object({
|
|
720
771
|
constructionType: ConstructionTypeSchema.optional(),
|
|
721
|
-
yearBuilt:
|
|
722
|
-
squareFootage:
|
|
723
|
-
stories:
|
|
772
|
+
yearBuilt: z12.number().optional(),
|
|
773
|
+
squareFootage: z12.number().optional(),
|
|
774
|
+
stories: z12.number().optional(),
|
|
724
775
|
roofType: RoofTypeSchema.optional(),
|
|
725
|
-
roofAge:
|
|
726
|
-
heatingType:
|
|
776
|
+
roofAge: z12.number().optional(),
|
|
777
|
+
heatingType: z12.enum(["central", "baseboard", "radiant", "space_heater", "heat_pump", "other"]).optional(),
|
|
727
778
|
foundationType: FoundationTypeSchema.optional(),
|
|
728
|
-
plumbingType:
|
|
729
|
-
electricalType:
|
|
730
|
-
electricalAmps:
|
|
731
|
-
hasSwimmingPool:
|
|
732
|
-
poolType:
|
|
733
|
-
hasTrampoline:
|
|
734
|
-
hasDog:
|
|
735
|
-
dogBreed:
|
|
736
|
-
protectiveDevices:
|
|
737
|
-
distanceToFireStation:
|
|
738
|
-
distanceToHydrant:
|
|
739
|
-
fireProtectionClass:
|
|
779
|
+
plumbingType: z12.enum(["copper", "pex", "galvanized", "polybutylene", "cpvc", "other"]).optional(),
|
|
780
|
+
electricalType: z12.enum(["circuit_breaker", "fuse_box", "knob_and_tube", "other"]).optional(),
|
|
781
|
+
electricalAmps: z12.number().optional(),
|
|
782
|
+
hasSwimmingPool: z12.boolean().optional(),
|
|
783
|
+
poolType: z12.enum(["in_ground", "above_ground"]).optional(),
|
|
784
|
+
hasTrampoline: z12.boolean().optional(),
|
|
785
|
+
hasDog: z12.boolean().optional(),
|
|
786
|
+
dogBreed: z12.string().optional(),
|
|
787
|
+
protectiveDevices: z12.array(z12.string()).optional(),
|
|
788
|
+
distanceToFireStation: z12.string().optional(),
|
|
789
|
+
distanceToHydrant: z12.string().optional(),
|
|
790
|
+
fireProtectionClass: z12.string().optional()
|
|
740
791
|
});
|
|
741
|
-
var DriverRecordSchema =
|
|
742
|
-
name:
|
|
743
|
-
dateOfBirth:
|
|
744
|
-
licenseNumber:
|
|
745
|
-
licenseState:
|
|
746
|
-
relationship:
|
|
747
|
-
yearsLicensed:
|
|
748
|
-
gender:
|
|
749
|
-
maritalStatus:
|
|
750
|
-
goodStudentDiscount:
|
|
751
|
-
defensiveDriverDiscount:
|
|
752
|
-
violations:
|
|
753
|
-
date:
|
|
754
|
-
type:
|
|
755
|
-
description:
|
|
792
|
+
var DriverRecordSchema = z12.object({
|
|
793
|
+
name: z12.string(),
|
|
794
|
+
dateOfBirth: z12.string().optional(),
|
|
795
|
+
licenseNumber: z12.string().optional(),
|
|
796
|
+
licenseState: z12.string().optional(),
|
|
797
|
+
relationship: z12.enum(["named_insured", "spouse", "child", "other_household", "other"]).optional(),
|
|
798
|
+
yearsLicensed: z12.number().optional(),
|
|
799
|
+
gender: z12.string().optional(),
|
|
800
|
+
maritalStatus: z12.string().optional(),
|
|
801
|
+
goodStudentDiscount: z12.boolean().optional(),
|
|
802
|
+
defensiveDriverDiscount: z12.boolean().optional(),
|
|
803
|
+
violations: z12.array(z12.object({
|
|
804
|
+
date: z12.string().optional(),
|
|
805
|
+
type: z12.string().optional(),
|
|
806
|
+
description: z12.string().optional()
|
|
756
807
|
})).optional(),
|
|
757
|
-
accidents:
|
|
758
|
-
date:
|
|
759
|
-
atFault:
|
|
760
|
-
description:
|
|
761
|
-
amountPaid:
|
|
808
|
+
accidents: z12.array(z12.object({
|
|
809
|
+
date: z12.string().optional(),
|
|
810
|
+
atFault: z12.boolean().optional(),
|
|
811
|
+
description: z12.string().optional(),
|
|
812
|
+
amountPaid: z12.string().optional()
|
|
762
813
|
})).optional(),
|
|
763
|
-
sr22Required:
|
|
814
|
+
sr22Required: z12.boolean().optional()
|
|
764
815
|
});
|
|
765
|
-
var PersonalVehicleDetailsSchema =
|
|
766
|
-
number:
|
|
767
|
-
year:
|
|
768
|
-
make:
|
|
769
|
-
model:
|
|
770
|
-
vin:
|
|
771
|
-
bodyType:
|
|
816
|
+
var PersonalVehicleDetailsSchema = z12.object({
|
|
817
|
+
number: z12.number().optional(),
|
|
818
|
+
year: z12.number().optional(),
|
|
819
|
+
make: z12.string().optional(),
|
|
820
|
+
model: z12.string().optional(),
|
|
821
|
+
vin: z12.string().optional(),
|
|
822
|
+
bodyType: z12.string().optional(),
|
|
772
823
|
garagingAddress: AddressSchema.optional(),
|
|
773
824
|
usage: PersonalAutoUsageSchema.optional(),
|
|
774
|
-
annualMileage:
|
|
775
|
-
odometerReading:
|
|
776
|
-
driverAssignment:
|
|
825
|
+
annualMileage: z12.number().optional(),
|
|
826
|
+
odometerReading: z12.number().optional(),
|
|
827
|
+
driverAssignment: z12.string().optional(),
|
|
777
828
|
lienHolder: EndorsementPartySchema.optional(),
|
|
778
|
-
collisionDeductible:
|
|
779
|
-
comprehensiveDeductible:
|
|
780
|
-
rentalReimbursement:
|
|
781
|
-
towing:
|
|
829
|
+
collisionDeductible: z12.string().optional(),
|
|
830
|
+
comprehensiveDeductible: z12.string().optional(),
|
|
831
|
+
rentalReimbursement: z12.boolean().optional(),
|
|
832
|
+
towing: z12.boolean().optional()
|
|
782
833
|
});
|
|
783
834
|
|
|
784
835
|
// src/schemas/declarations/personal.ts
|
|
785
|
-
var HomeownersDeclarationsSchema =
|
|
786
|
-
line:
|
|
836
|
+
var HomeownersDeclarationsSchema = z13.object({
|
|
837
|
+
line: z13.literal("homeowners"),
|
|
787
838
|
formType: HomeownersFormTypeSchema,
|
|
788
|
-
coverageA:
|
|
789
|
-
coverageB:
|
|
790
|
-
coverageC:
|
|
791
|
-
coverageD:
|
|
792
|
-
coverageE:
|
|
793
|
-
coverageF:
|
|
794
|
-
allPerilDeductible:
|
|
795
|
-
windHailDeductible:
|
|
796
|
-
hurricaneDeductible:
|
|
839
|
+
coverageA: z13.string().optional(),
|
|
840
|
+
coverageB: z13.string().optional(),
|
|
841
|
+
coverageC: z13.string().optional(),
|
|
842
|
+
coverageD: z13.string().optional(),
|
|
843
|
+
coverageE: z13.string().optional(),
|
|
844
|
+
coverageF: z13.string().optional(),
|
|
845
|
+
allPerilDeductible: z13.string().optional(),
|
|
846
|
+
windHailDeductible: z13.string().optional(),
|
|
847
|
+
hurricaneDeductible: z13.string().optional(),
|
|
797
848
|
lossSettlement: LossSettlementSchema.optional(),
|
|
798
849
|
dwelling: DwellingDetailsSchema,
|
|
799
850
|
mortgagee: EndorsementPartySchema.optional(),
|
|
800
|
-
additionalMortgagees:
|
|
851
|
+
additionalMortgagees: z13.array(EndorsementPartySchema).optional()
|
|
801
852
|
});
|
|
802
|
-
var PersonalAutoDeclarationsSchema =
|
|
803
|
-
line:
|
|
804
|
-
vehicles:
|
|
805
|
-
drivers:
|
|
806
|
-
liabilityLimits:
|
|
807
|
-
bodilyInjuryPerPerson:
|
|
808
|
-
bodilyInjuryPerAccident:
|
|
809
|
-
propertyDamage:
|
|
810
|
-
combinedSingleLimit:
|
|
853
|
+
var PersonalAutoDeclarationsSchema = z13.object({
|
|
854
|
+
line: z13.literal("personal_auto"),
|
|
855
|
+
vehicles: z13.array(PersonalVehicleDetailsSchema),
|
|
856
|
+
drivers: z13.array(DriverRecordSchema),
|
|
857
|
+
liabilityLimits: z13.object({
|
|
858
|
+
bodilyInjuryPerPerson: z13.string().optional(),
|
|
859
|
+
bodilyInjuryPerAccident: z13.string().optional(),
|
|
860
|
+
propertyDamage: z13.string().optional(),
|
|
861
|
+
combinedSingleLimit: z13.string().optional()
|
|
811
862
|
}).optional(),
|
|
812
|
-
umLimits:
|
|
813
|
-
bodilyInjuryPerPerson:
|
|
814
|
-
bodilyInjuryPerAccident:
|
|
863
|
+
umLimits: z13.object({
|
|
864
|
+
bodilyInjuryPerPerson: z13.string().optional(),
|
|
865
|
+
bodilyInjuryPerAccident: z13.string().optional()
|
|
815
866
|
}).optional(),
|
|
816
|
-
uimLimits:
|
|
817
|
-
bodilyInjuryPerPerson:
|
|
818
|
-
bodilyInjuryPerAccident:
|
|
867
|
+
uimLimits: z13.object({
|
|
868
|
+
bodilyInjuryPerPerson: z13.string().optional(),
|
|
869
|
+
bodilyInjuryPerAccident: z13.string().optional()
|
|
819
870
|
}).optional(),
|
|
820
|
-
pipLimit:
|
|
821
|
-
medPayLimit:
|
|
871
|
+
pipLimit: z13.string().optional(),
|
|
872
|
+
medPayLimit: z13.string().optional()
|
|
822
873
|
});
|
|
823
|
-
var DwellingFireDeclarationsSchema =
|
|
824
|
-
line:
|
|
874
|
+
var DwellingFireDeclarationsSchema = z13.object({
|
|
875
|
+
line: z13.literal("dwelling_fire"),
|
|
825
876
|
formType: DwellingFireFormTypeSchema,
|
|
826
|
-
dwellingLimit:
|
|
827
|
-
otherStructuresLimit:
|
|
828
|
-
personalPropertyLimit:
|
|
829
|
-
fairRentalValueLimit:
|
|
830
|
-
liabilityLimit:
|
|
831
|
-
medicalPaymentsLimit:
|
|
832
|
-
deductible:
|
|
877
|
+
dwellingLimit: z13.string().optional(),
|
|
878
|
+
otherStructuresLimit: z13.string().optional(),
|
|
879
|
+
personalPropertyLimit: z13.string().optional(),
|
|
880
|
+
fairRentalValueLimit: z13.string().optional(),
|
|
881
|
+
liabilityLimit: z13.string().optional(),
|
|
882
|
+
medicalPaymentsLimit: z13.string().optional(),
|
|
883
|
+
deductible: z13.string().optional(),
|
|
833
884
|
dwelling: DwellingDetailsSchema
|
|
834
885
|
});
|
|
835
|
-
var FloodDeclarationsSchema =
|
|
836
|
-
line:
|
|
837
|
-
programType:
|
|
886
|
+
var FloodDeclarationsSchema = z13.object({
|
|
887
|
+
line: z13.literal("flood"),
|
|
888
|
+
programType: z13.enum(["nfip", "private"]),
|
|
838
889
|
floodZone: FloodZoneSchema.optional(),
|
|
839
|
-
communityNumber:
|
|
840
|
-
communityRating:
|
|
841
|
-
buildingCoverage:
|
|
842
|
-
contentsCoverage:
|
|
843
|
-
iccCoverage:
|
|
844
|
-
deductible:
|
|
845
|
-
waitingPeriodDays:
|
|
846
|
-
elevationCertificate:
|
|
847
|
-
elevationDifference:
|
|
848
|
-
buildingDiagramNumber:
|
|
849
|
-
basementOrEnclosure:
|
|
850
|
-
postFirmConstruction:
|
|
890
|
+
communityNumber: z13.string().optional(),
|
|
891
|
+
communityRating: z13.number().optional(),
|
|
892
|
+
buildingCoverage: z13.string().optional(),
|
|
893
|
+
contentsCoverage: z13.string().optional(),
|
|
894
|
+
iccCoverage: z13.string().optional(),
|
|
895
|
+
deductible: z13.string().optional(),
|
|
896
|
+
waitingPeriodDays: z13.number().optional(),
|
|
897
|
+
elevationCertificate: z13.boolean().optional(),
|
|
898
|
+
elevationDifference: z13.string().optional(),
|
|
899
|
+
buildingDiagramNumber: z13.number().optional(),
|
|
900
|
+
basementOrEnclosure: z13.boolean().optional(),
|
|
901
|
+
postFirmConstruction: z13.boolean().optional()
|
|
851
902
|
});
|
|
852
|
-
var EarthquakeDeclarationsSchema =
|
|
853
|
-
line:
|
|
854
|
-
dwellingCoverage:
|
|
855
|
-
contentsCoverage:
|
|
856
|
-
lossOfUseCoverage:
|
|
857
|
-
deductiblePercent:
|
|
858
|
-
retrofitDiscount:
|
|
859
|
-
masonryVeneerCoverage:
|
|
903
|
+
var EarthquakeDeclarationsSchema = z13.object({
|
|
904
|
+
line: z13.literal("earthquake"),
|
|
905
|
+
dwellingCoverage: z13.string().optional(),
|
|
906
|
+
contentsCoverage: z13.string().optional(),
|
|
907
|
+
lossOfUseCoverage: z13.string().optional(),
|
|
908
|
+
deductiblePercent: z13.number().optional(),
|
|
909
|
+
retrofitDiscount: z13.boolean().optional(),
|
|
910
|
+
masonryVeneerCoverage: z13.boolean().optional()
|
|
860
911
|
});
|
|
861
|
-
var PersonalUmbrellaDeclarationsSchema =
|
|
862
|
-
line:
|
|
863
|
-
perOccurrenceLimit:
|
|
864
|
-
aggregateLimit:
|
|
865
|
-
retainedLimit:
|
|
866
|
-
underlyingPolicies:
|
|
867
|
-
carrier:
|
|
868
|
-
policyNumber:
|
|
869
|
-
policyType:
|
|
870
|
-
limits:
|
|
912
|
+
var PersonalUmbrellaDeclarationsSchema = z13.object({
|
|
913
|
+
line: z13.literal("personal_umbrella"),
|
|
914
|
+
perOccurrenceLimit: z13.string().optional(),
|
|
915
|
+
aggregateLimit: z13.string().optional(),
|
|
916
|
+
retainedLimit: z13.string().optional(),
|
|
917
|
+
underlyingPolicies: z13.array(z13.object({
|
|
918
|
+
carrier: z13.string().optional(),
|
|
919
|
+
policyNumber: z13.string().optional(),
|
|
920
|
+
policyType: z13.string().optional(),
|
|
921
|
+
limits: z13.string().optional()
|
|
871
922
|
}))
|
|
872
923
|
});
|
|
873
|
-
var PersonalArticlesDeclarationsSchema =
|
|
874
|
-
line:
|
|
875
|
-
scheduledItems:
|
|
876
|
-
itemNumber:
|
|
924
|
+
var PersonalArticlesDeclarationsSchema = z13.object({
|
|
925
|
+
line: z13.literal("personal_articles"),
|
|
926
|
+
scheduledItems: z13.array(z13.object({
|
|
927
|
+
itemNumber: z13.number().optional(),
|
|
877
928
|
category: ScheduledItemCategorySchema.optional(),
|
|
878
|
-
description:
|
|
879
|
-
appraisedValue:
|
|
880
|
-
appraisalDate:
|
|
929
|
+
description: z13.string(),
|
|
930
|
+
appraisedValue: z13.string(),
|
|
931
|
+
appraisalDate: z13.string().optional()
|
|
881
932
|
})),
|
|
882
|
-
blanketCoverage:
|
|
883
|
-
deductible:
|
|
884
|
-
worldwideCoverage:
|
|
885
|
-
breakageCoverage:
|
|
933
|
+
blanketCoverage: z13.string().optional(),
|
|
934
|
+
deductible: z13.string().optional(),
|
|
935
|
+
worldwideCoverage: z13.boolean().optional(),
|
|
936
|
+
breakageCoverage: z13.boolean().optional()
|
|
886
937
|
});
|
|
887
|
-
var WatercraftDeclarationsSchema =
|
|
888
|
-
line:
|
|
938
|
+
var WatercraftDeclarationsSchema = z13.object({
|
|
939
|
+
line: z13.literal("watercraft"),
|
|
889
940
|
boatType: BoatTypeSchema.optional(),
|
|
890
|
-
year:
|
|
891
|
-
make:
|
|
892
|
-
model:
|
|
893
|
-
length:
|
|
894
|
-
hullMaterial:
|
|
895
|
-
hullValue:
|
|
896
|
-
motorHorsepower:
|
|
897
|
-
motorType:
|
|
898
|
-
navigationLimits:
|
|
899
|
-
layupPeriod:
|
|
900
|
-
liabilityLimit:
|
|
901
|
-
medicalPaymentsLimit:
|
|
902
|
-
physicalDamageDeductible:
|
|
903
|
-
uninsuredBoaterLimit:
|
|
904
|
-
trailerCovered:
|
|
905
|
-
trailerValue:
|
|
941
|
+
year: z13.number().optional(),
|
|
942
|
+
make: z13.string().optional(),
|
|
943
|
+
model: z13.string().optional(),
|
|
944
|
+
length: z13.string().optional(),
|
|
945
|
+
hullMaterial: z13.enum(["fiberglass", "aluminum", "wood", "steel", "inflatable", "other"]).optional(),
|
|
946
|
+
hullValue: z13.string().optional(),
|
|
947
|
+
motorHorsepower: z13.number().optional(),
|
|
948
|
+
motorType: z13.enum(["outboard", "inboard", "inboard_outboard", "jet"]).optional(),
|
|
949
|
+
navigationLimits: z13.string().optional(),
|
|
950
|
+
layupPeriod: z13.string().optional(),
|
|
951
|
+
liabilityLimit: z13.string().optional(),
|
|
952
|
+
medicalPaymentsLimit: z13.string().optional(),
|
|
953
|
+
physicalDamageDeductible: z13.string().optional(),
|
|
954
|
+
uninsuredBoaterLimit: z13.string().optional(),
|
|
955
|
+
trailerCovered: z13.boolean().optional(),
|
|
956
|
+
trailerValue: z13.string().optional()
|
|
906
957
|
});
|
|
907
|
-
var RecreationalVehicleDeclarationsSchema =
|
|
908
|
-
line:
|
|
958
|
+
var RecreationalVehicleDeclarationsSchema = z13.object({
|
|
959
|
+
line: z13.literal("recreational_vehicle"),
|
|
909
960
|
vehicleType: RVTypeSchema,
|
|
910
|
-
year:
|
|
911
|
-
make:
|
|
912
|
-
model:
|
|
913
|
-
vin:
|
|
914
|
-
value:
|
|
915
|
-
liabilityLimit:
|
|
916
|
-
collisionDeductible:
|
|
917
|
-
comprehensiveDeductible:
|
|
918
|
-
personalEffectsCoverage:
|
|
919
|
-
fullTimerCoverage:
|
|
961
|
+
year: z13.number().optional(),
|
|
962
|
+
make: z13.string().optional(),
|
|
963
|
+
model: z13.string().optional(),
|
|
964
|
+
vin: z13.string().optional(),
|
|
965
|
+
value: z13.string().optional(),
|
|
966
|
+
liabilityLimit: z13.string().optional(),
|
|
967
|
+
collisionDeductible: z13.string().optional(),
|
|
968
|
+
comprehensiveDeductible: z13.string().optional(),
|
|
969
|
+
personalEffectsCoverage: z13.string().optional(),
|
|
970
|
+
fullTimerCoverage: z13.boolean().optional()
|
|
920
971
|
});
|
|
921
|
-
var FarmRanchDeclarationsSchema =
|
|
922
|
-
line:
|
|
923
|
-
dwellingCoverage:
|
|
924
|
-
farmPersonalPropertyCoverage:
|
|
925
|
-
farmLiabilityLimit:
|
|
926
|
-
farmAutoIncluded:
|
|
927
|
-
livestock:
|
|
928
|
-
type:
|
|
929
|
-
headCount:
|
|
930
|
-
value:
|
|
972
|
+
var FarmRanchDeclarationsSchema = z13.object({
|
|
973
|
+
line: z13.literal("farm_ranch"),
|
|
974
|
+
dwellingCoverage: z13.string().optional(),
|
|
975
|
+
farmPersonalPropertyCoverage: z13.string().optional(),
|
|
976
|
+
farmLiabilityLimit: z13.string().optional(),
|
|
977
|
+
farmAutoIncluded: z13.boolean().optional(),
|
|
978
|
+
livestock: z13.array(z13.object({
|
|
979
|
+
type: z13.string(),
|
|
980
|
+
headCount: z13.number(),
|
|
981
|
+
value: z13.string().optional()
|
|
931
982
|
})).optional(),
|
|
932
|
-
equipmentSchedule:
|
|
933
|
-
description:
|
|
934
|
-
value:
|
|
983
|
+
equipmentSchedule: z13.array(z13.object({
|
|
984
|
+
description: z13.string(),
|
|
985
|
+
value: z13.string()
|
|
935
986
|
})).optional(),
|
|
936
|
-
acreage:
|
|
987
|
+
acreage: z13.number().optional(),
|
|
937
988
|
dwelling: DwellingDetailsSchema.optional()
|
|
938
989
|
});
|
|
939
|
-
var TitleDeclarationsSchema =
|
|
940
|
-
line:
|
|
990
|
+
var TitleDeclarationsSchema = z13.object({
|
|
991
|
+
line: z13.literal("title"),
|
|
941
992
|
policyType: TitlePolicyTypeSchema,
|
|
942
|
-
policyAmount:
|
|
943
|
-
legalDescription:
|
|
993
|
+
policyAmount: z13.string(),
|
|
994
|
+
legalDescription: z13.string().optional(),
|
|
944
995
|
propertyAddress: AddressSchema.optional(),
|
|
945
|
-
effectiveDate:
|
|
946
|
-
exceptions:
|
|
947
|
-
number:
|
|
948
|
-
description:
|
|
996
|
+
effectiveDate: z13.string().optional(),
|
|
997
|
+
exceptions: z13.array(z13.object({
|
|
998
|
+
number: z13.number(),
|
|
999
|
+
description: z13.string()
|
|
949
1000
|
})).optional(),
|
|
950
|
-
underwriter:
|
|
1001
|
+
underwriter: z13.string().optional()
|
|
951
1002
|
});
|
|
952
|
-
var PetDeclarationsSchema =
|
|
953
|
-
line:
|
|
1003
|
+
var PetDeclarationsSchema = z13.object({
|
|
1004
|
+
line: z13.literal("pet"),
|
|
954
1005
|
species: PetSpeciesSchema,
|
|
955
|
-
breed:
|
|
956
|
-
petName:
|
|
957
|
-
age:
|
|
958
|
-
annualLimit:
|
|
959
|
-
perIncidentLimit:
|
|
960
|
-
deductible:
|
|
961
|
-
reimbursementPercent:
|
|
962
|
-
waitingPeriodDays:
|
|
963
|
-
preExistingConditionsExcluded:
|
|
964
|
-
wellnessCoverage:
|
|
1006
|
+
breed: z13.string().optional(),
|
|
1007
|
+
petName: z13.string().optional(),
|
|
1008
|
+
age: z13.number().optional(),
|
|
1009
|
+
annualLimit: z13.string().optional(),
|
|
1010
|
+
perIncidentLimit: z13.string().optional(),
|
|
1011
|
+
deductible: z13.string().optional(),
|
|
1012
|
+
reimbursementPercent: z13.number().optional(),
|
|
1013
|
+
waitingPeriodDays: z13.number().optional(),
|
|
1014
|
+
preExistingConditionsExcluded: z13.boolean().optional(),
|
|
1015
|
+
wellnessCoverage: z13.boolean().optional()
|
|
965
1016
|
});
|
|
966
|
-
var TravelDeclarationsSchema =
|
|
967
|
-
line:
|
|
968
|
-
tripDepartureDate:
|
|
969
|
-
tripReturnDate:
|
|
970
|
-
destinations:
|
|
971
|
-
travelers:
|
|
972
|
-
name:
|
|
973
|
-
age:
|
|
1017
|
+
var TravelDeclarationsSchema = z13.object({
|
|
1018
|
+
line: z13.literal("travel"),
|
|
1019
|
+
tripDepartureDate: z13.string().optional(),
|
|
1020
|
+
tripReturnDate: z13.string().optional(),
|
|
1021
|
+
destinations: z13.array(z13.string()).optional(),
|
|
1022
|
+
travelers: z13.array(z13.object({
|
|
1023
|
+
name: z13.string(),
|
|
1024
|
+
age: z13.number().optional()
|
|
974
1025
|
})).optional(),
|
|
975
|
-
tripCost:
|
|
976
|
-
tripCancellationLimit:
|
|
977
|
-
medicalLimit:
|
|
978
|
-
evacuationLimit:
|
|
979
|
-
baggageLimit:
|
|
1026
|
+
tripCost: z13.string().optional(),
|
|
1027
|
+
tripCancellationLimit: z13.string().optional(),
|
|
1028
|
+
medicalLimit: z13.string().optional(),
|
|
1029
|
+
evacuationLimit: z13.string().optional(),
|
|
1030
|
+
baggageLimit: z13.string().optional()
|
|
980
1031
|
});
|
|
981
|
-
var IdentityTheftDeclarationsSchema =
|
|
982
|
-
line:
|
|
983
|
-
coverageLimit:
|
|
984
|
-
expenseReimbursement:
|
|
985
|
-
creditMonitoring:
|
|
986
|
-
restorationServices:
|
|
987
|
-
lostWagesLimit:
|
|
1032
|
+
var IdentityTheftDeclarationsSchema = z13.object({
|
|
1033
|
+
line: z13.literal("identity_theft"),
|
|
1034
|
+
coverageLimit: z13.string().optional(),
|
|
1035
|
+
expenseReimbursement: z13.string().optional(),
|
|
1036
|
+
creditMonitoring: z13.boolean().optional(),
|
|
1037
|
+
restorationServices: z13.boolean().optional(),
|
|
1038
|
+
lostWagesLimit: z13.string().optional()
|
|
988
1039
|
});
|
|
989
1040
|
|
|
990
1041
|
// src/schemas/declarations/commercial.ts
|
|
991
|
-
import { z as
|
|
992
|
-
var GLDeclarationsSchema =
|
|
993
|
-
line:
|
|
1042
|
+
import { z as z14 } from "zod";
|
|
1043
|
+
var GLDeclarationsSchema = z14.object({
|
|
1044
|
+
line: z14.literal("gl"),
|
|
994
1045
|
coverageForm: CoverageFormSchema.optional(),
|
|
995
|
-
perOccurrenceLimit:
|
|
996
|
-
generalAggregate:
|
|
997
|
-
productsCompletedOpsAggregate:
|
|
998
|
-
personalAdvertisingInjury:
|
|
999
|
-
fireDamage:
|
|
1000
|
-
medicalExpense:
|
|
1046
|
+
perOccurrenceLimit: z14.string().optional(),
|
|
1047
|
+
generalAggregate: z14.string().optional(),
|
|
1048
|
+
productsCompletedOpsAggregate: z14.string().optional(),
|
|
1049
|
+
personalAdvertisingInjury: z14.string().optional(),
|
|
1050
|
+
fireDamage: z14.string().optional(),
|
|
1051
|
+
medicalExpense: z14.string().optional(),
|
|
1001
1052
|
defenseCostTreatment: DefenseCostTreatmentSchema.optional(),
|
|
1002
|
-
deductible:
|
|
1003
|
-
classifications:
|
|
1004
|
-
retroactiveDate:
|
|
1053
|
+
deductible: z14.string().optional(),
|
|
1054
|
+
classifications: z14.array(ClassificationCodeSchema).optional(),
|
|
1055
|
+
retroactiveDate: z14.string().optional()
|
|
1005
1056
|
});
|
|
1006
|
-
var CommercialPropertyDeclarationsSchema =
|
|
1007
|
-
line:
|
|
1008
|
-
causesOfLossForm:
|
|
1009
|
-
coinsurancePercent:
|
|
1057
|
+
var CommercialPropertyDeclarationsSchema = z14.object({
|
|
1058
|
+
line: z14.literal("commercial_property"),
|
|
1059
|
+
causesOfLossForm: z14.enum(["basic", "broad", "special"]).optional(),
|
|
1060
|
+
coinsurancePercent: z14.number().optional(),
|
|
1010
1061
|
valuationMethod: ValuationMethodSchema.optional(),
|
|
1011
|
-
locations:
|
|
1012
|
-
blanketLimit:
|
|
1013
|
-
businessIncomeLimit:
|
|
1014
|
-
extraExpenseLimit:
|
|
1062
|
+
locations: z14.array(InsuredLocationSchema),
|
|
1063
|
+
blanketLimit: z14.string().optional(),
|
|
1064
|
+
businessIncomeLimit: z14.string().optional(),
|
|
1065
|
+
extraExpenseLimit: z14.string().optional()
|
|
1015
1066
|
});
|
|
1016
|
-
var CommercialAutoDeclarationsSchema =
|
|
1017
|
-
line:
|
|
1018
|
-
vehicles:
|
|
1019
|
-
coveredAutoSymbols:
|
|
1020
|
-
liabilityLimit:
|
|
1021
|
-
umLimit:
|
|
1022
|
-
uimLimit:
|
|
1023
|
-
hiredAutoLiability:
|
|
1024
|
-
nonOwnedAutoLiability:
|
|
1067
|
+
var CommercialAutoDeclarationsSchema = z14.object({
|
|
1068
|
+
line: z14.literal("commercial_auto"),
|
|
1069
|
+
vehicles: z14.array(InsuredVehicleSchema),
|
|
1070
|
+
coveredAutoSymbols: z14.array(z14.number()).optional(),
|
|
1071
|
+
liabilityLimit: z14.string().optional(),
|
|
1072
|
+
umLimit: z14.string().optional(),
|
|
1073
|
+
uimLimit: z14.string().optional(),
|
|
1074
|
+
hiredAutoLiability: z14.boolean().optional(),
|
|
1075
|
+
nonOwnedAutoLiability: z14.boolean().optional()
|
|
1025
1076
|
});
|
|
1026
|
-
var WorkersCompDeclarationsSchema =
|
|
1027
|
-
line:
|
|
1028
|
-
coveredStates:
|
|
1029
|
-
classifications:
|
|
1077
|
+
var WorkersCompDeclarationsSchema = z14.object({
|
|
1078
|
+
line: z14.literal("workers_comp"),
|
|
1079
|
+
coveredStates: z14.array(z14.string()).optional(),
|
|
1080
|
+
classifications: z14.array(ClassificationCodeSchema),
|
|
1030
1081
|
experienceMod: ExperienceModSchema.optional(),
|
|
1031
1082
|
employersLiability: EmployersLiabilityLimitsSchema.optional()
|
|
1032
1083
|
});
|
|
1033
|
-
var UmbrellaExcessDeclarationsSchema =
|
|
1034
|
-
line:
|
|
1035
|
-
perOccurrenceLimit:
|
|
1036
|
-
aggregateLimit:
|
|
1037
|
-
retention:
|
|
1038
|
-
underlyingPolicies:
|
|
1039
|
-
carrier:
|
|
1040
|
-
policyNumber:
|
|
1041
|
-
policyType:
|
|
1042
|
-
limits:
|
|
1084
|
+
var UmbrellaExcessDeclarationsSchema = z14.object({
|
|
1085
|
+
line: z14.literal("umbrella_excess"),
|
|
1086
|
+
perOccurrenceLimit: z14.string().optional(),
|
|
1087
|
+
aggregateLimit: z14.string().optional(),
|
|
1088
|
+
retention: z14.string().optional(),
|
|
1089
|
+
underlyingPolicies: z14.array(z14.object({
|
|
1090
|
+
carrier: z14.string().optional(),
|
|
1091
|
+
policyNumber: z14.string().optional(),
|
|
1092
|
+
policyType: z14.string().optional(),
|
|
1093
|
+
limits: z14.string().optional()
|
|
1043
1094
|
}))
|
|
1044
1095
|
});
|
|
1045
|
-
var ProfessionalLiabilityDeclarationsSchema =
|
|
1046
|
-
line:
|
|
1047
|
-
perClaimLimit:
|
|
1048
|
-
aggregateLimit:
|
|
1049
|
-
retroactiveDate:
|
|
1096
|
+
var ProfessionalLiabilityDeclarationsSchema = z14.object({
|
|
1097
|
+
line: z14.literal("professional_liability"),
|
|
1098
|
+
perClaimLimit: z14.string().optional(),
|
|
1099
|
+
aggregateLimit: z14.string().optional(),
|
|
1100
|
+
retroactiveDate: z14.string().optional(),
|
|
1050
1101
|
defenseCostTreatment: DefenseCostTreatmentSchema.optional(),
|
|
1051
1102
|
extendedReportingPeriod: ExtendedReportingPeriodSchema.optional()
|
|
1052
1103
|
});
|
|
1053
|
-
var CyberDeclarationsSchema =
|
|
1054
|
-
line:
|
|
1055
|
-
aggregateLimit:
|
|
1056
|
-
retroactiveDate:
|
|
1057
|
-
waitingPeriodHours:
|
|
1058
|
-
sublimits:
|
|
1059
|
-
coverageName:
|
|
1060
|
-
limit:
|
|
1104
|
+
var CyberDeclarationsSchema = z14.object({
|
|
1105
|
+
line: z14.literal("cyber"),
|
|
1106
|
+
aggregateLimit: z14.string().optional(),
|
|
1107
|
+
retroactiveDate: z14.string().optional(),
|
|
1108
|
+
waitingPeriodHours: z14.number().optional(),
|
|
1109
|
+
sublimits: z14.array(z14.object({
|
|
1110
|
+
coverageName: z14.string(),
|
|
1111
|
+
limit: z14.string()
|
|
1061
1112
|
})).optional()
|
|
1062
1113
|
});
|
|
1063
|
-
var DODeclarationsSchema =
|
|
1064
|
-
line:
|
|
1065
|
-
sideALimit:
|
|
1066
|
-
sideBLimit:
|
|
1067
|
-
sideCLimit:
|
|
1068
|
-
sideARetention:
|
|
1069
|
-
sideBRetention:
|
|
1070
|
-
sideCRetention:
|
|
1071
|
-
continuityDate:
|
|
1114
|
+
var DODeclarationsSchema = z14.object({
|
|
1115
|
+
line: z14.literal("directors_officers"),
|
|
1116
|
+
sideALimit: z14.string().optional(),
|
|
1117
|
+
sideBLimit: z14.string().optional(),
|
|
1118
|
+
sideCLimit: z14.string().optional(),
|
|
1119
|
+
sideARetention: z14.string().optional(),
|
|
1120
|
+
sideBRetention: z14.string().optional(),
|
|
1121
|
+
sideCRetention: z14.string().optional(),
|
|
1122
|
+
continuityDate: z14.string().optional()
|
|
1072
1123
|
});
|
|
1073
|
-
var CrimeDeclarationsSchema =
|
|
1074
|
-
line:
|
|
1075
|
-
formType:
|
|
1076
|
-
agreements:
|
|
1077
|
-
agreement:
|
|
1078
|
-
coverageName:
|
|
1079
|
-
limit:
|
|
1080
|
-
deductible:
|
|
1124
|
+
var CrimeDeclarationsSchema = z14.object({
|
|
1125
|
+
line: z14.literal("crime"),
|
|
1126
|
+
formType: z14.enum(["discovery", "loss_sustained"]).optional(),
|
|
1127
|
+
agreements: z14.array(z14.object({
|
|
1128
|
+
agreement: z14.string(),
|
|
1129
|
+
coverageName: z14.string(),
|
|
1130
|
+
limit: z14.string(),
|
|
1131
|
+
deductible: z14.string()
|
|
1081
1132
|
}))
|
|
1082
1133
|
});
|
|
1083
1134
|
|
|
1084
1135
|
// src/schemas/declarations/index.ts
|
|
1085
|
-
var DeclarationsSchema =
|
|
1136
|
+
var DeclarationsSchema = z15.discriminatedUnion("line", [
|
|
1086
1137
|
// Personal lines
|
|
1087
1138
|
HomeownersDeclarationsSchema,
|
|
1088
1139
|
PersonalAutoDeclarationsSchema,
|
|
@@ -1111,137 +1162,137 @@ var DeclarationsSchema = z14.discriminatedUnion("line", [
|
|
|
1111
1162
|
]);
|
|
1112
1163
|
|
|
1113
1164
|
// src/schemas/document.ts
|
|
1114
|
-
import { z as
|
|
1115
|
-
var SubsectionSchema =
|
|
1116
|
-
title:
|
|
1117
|
-
sectionNumber:
|
|
1118
|
-
pageNumber:
|
|
1119
|
-
content:
|
|
1165
|
+
import { z as z16 } from "zod";
|
|
1166
|
+
var SubsectionSchema = z16.object({
|
|
1167
|
+
title: z16.string(),
|
|
1168
|
+
sectionNumber: z16.string().optional(),
|
|
1169
|
+
pageNumber: z16.number().optional(),
|
|
1170
|
+
content: z16.string()
|
|
1120
1171
|
});
|
|
1121
|
-
var SectionSchema =
|
|
1122
|
-
title:
|
|
1123
|
-
sectionNumber:
|
|
1124
|
-
pageStart:
|
|
1125
|
-
pageEnd:
|
|
1126
|
-
type:
|
|
1127
|
-
coverageType:
|
|
1128
|
-
content:
|
|
1129
|
-
subsections:
|
|
1172
|
+
var SectionSchema = z16.object({
|
|
1173
|
+
title: z16.string(),
|
|
1174
|
+
sectionNumber: z16.string().optional(),
|
|
1175
|
+
pageStart: z16.number(),
|
|
1176
|
+
pageEnd: z16.number().optional(),
|
|
1177
|
+
type: z16.string(),
|
|
1178
|
+
coverageType: z16.string().optional(),
|
|
1179
|
+
content: z16.string(),
|
|
1180
|
+
subsections: z16.array(SubsectionSchema).optional()
|
|
1130
1181
|
});
|
|
1131
|
-
var SubjectivitySchema =
|
|
1132
|
-
description:
|
|
1133
|
-
category:
|
|
1182
|
+
var SubjectivitySchema = z16.object({
|
|
1183
|
+
description: z16.string(),
|
|
1184
|
+
category: z16.string().optional()
|
|
1134
1185
|
});
|
|
1135
|
-
var UnderwritingConditionSchema =
|
|
1136
|
-
description:
|
|
1186
|
+
var UnderwritingConditionSchema = z16.object({
|
|
1187
|
+
description: z16.string()
|
|
1137
1188
|
});
|
|
1138
|
-
var PremiumLineSchema =
|
|
1139
|
-
line:
|
|
1140
|
-
amount:
|
|
1189
|
+
var PremiumLineSchema = z16.object({
|
|
1190
|
+
line: z16.string(),
|
|
1191
|
+
amount: z16.string()
|
|
1141
1192
|
});
|
|
1142
1193
|
var BaseDocumentFields = {
|
|
1143
|
-
id:
|
|
1144
|
-
carrier:
|
|
1145
|
-
security:
|
|
1146
|
-
insuredName:
|
|
1147
|
-
premium:
|
|
1148
|
-
summary:
|
|
1149
|
-
policyTypes:
|
|
1150
|
-
coverages:
|
|
1151
|
-
sections:
|
|
1194
|
+
id: z16.string(),
|
|
1195
|
+
carrier: z16.string(),
|
|
1196
|
+
security: z16.string().optional(),
|
|
1197
|
+
insuredName: z16.string(),
|
|
1198
|
+
premium: z16.string().optional(),
|
|
1199
|
+
summary: z16.string().optional(),
|
|
1200
|
+
policyTypes: z16.array(z16.string()).optional(),
|
|
1201
|
+
coverages: z16.array(CoverageSchema),
|
|
1202
|
+
sections: z16.array(SectionSchema).optional(),
|
|
1152
1203
|
// Enriched fields (v1.2+)
|
|
1153
|
-
carrierLegalName:
|
|
1154
|
-
carrierNaicNumber:
|
|
1155
|
-
carrierAmBestRating:
|
|
1156
|
-
carrierAdmittedStatus:
|
|
1157
|
-
mga:
|
|
1158
|
-
underwriter:
|
|
1159
|
-
brokerAgency:
|
|
1160
|
-
brokerContactName:
|
|
1161
|
-
brokerLicenseNumber:
|
|
1162
|
-
priorPolicyNumber:
|
|
1163
|
-
programName:
|
|
1164
|
-
isRenewal:
|
|
1165
|
-
isPackage:
|
|
1166
|
-
insuredDba:
|
|
1204
|
+
carrierLegalName: z16.string().optional(),
|
|
1205
|
+
carrierNaicNumber: z16.string().optional(),
|
|
1206
|
+
carrierAmBestRating: z16.string().optional(),
|
|
1207
|
+
carrierAdmittedStatus: z16.string().optional(),
|
|
1208
|
+
mga: z16.string().optional(),
|
|
1209
|
+
underwriter: z16.string().optional(),
|
|
1210
|
+
brokerAgency: z16.string().optional(),
|
|
1211
|
+
brokerContactName: z16.string().optional(),
|
|
1212
|
+
brokerLicenseNumber: z16.string().optional(),
|
|
1213
|
+
priorPolicyNumber: z16.string().optional(),
|
|
1214
|
+
programName: z16.string().optional(),
|
|
1215
|
+
isRenewal: z16.boolean().optional(),
|
|
1216
|
+
isPackage: z16.boolean().optional(),
|
|
1217
|
+
insuredDba: z16.string().optional(),
|
|
1167
1218
|
insuredAddress: AddressSchema.optional(),
|
|
1168
1219
|
insuredEntityType: EntityTypeSchema.optional(),
|
|
1169
|
-
additionalNamedInsureds:
|
|
1170
|
-
insuredSicCode:
|
|
1171
|
-
insuredNaicsCode:
|
|
1172
|
-
insuredFein:
|
|
1173
|
-
enrichedCoverages:
|
|
1174
|
-
endorsements:
|
|
1175
|
-
exclusions:
|
|
1176
|
-
conditions:
|
|
1220
|
+
additionalNamedInsureds: z16.array(NamedInsuredSchema).optional(),
|
|
1221
|
+
insuredSicCode: z16.string().optional(),
|
|
1222
|
+
insuredNaicsCode: z16.string().optional(),
|
|
1223
|
+
insuredFein: z16.string().optional(),
|
|
1224
|
+
enrichedCoverages: z16.array(EnrichedCoverageSchema).optional(),
|
|
1225
|
+
endorsements: z16.array(EndorsementSchema).optional(),
|
|
1226
|
+
exclusions: z16.array(ExclusionSchema).optional(),
|
|
1227
|
+
conditions: z16.array(PolicyConditionSchema).optional(),
|
|
1177
1228
|
limits: LimitScheduleSchema.optional(),
|
|
1178
1229
|
deductibles: DeductibleScheduleSchema.optional(),
|
|
1179
|
-
locations:
|
|
1180
|
-
vehicles:
|
|
1181
|
-
classifications:
|
|
1182
|
-
formInventory:
|
|
1230
|
+
locations: z16.array(InsuredLocationSchema).optional(),
|
|
1231
|
+
vehicles: z16.array(InsuredVehicleSchema).optional(),
|
|
1232
|
+
classifications: z16.array(ClassificationCodeSchema).optional(),
|
|
1233
|
+
formInventory: z16.array(FormReferenceSchema).optional(),
|
|
1183
1234
|
declarations: DeclarationsSchema.optional(),
|
|
1184
1235
|
coverageForm: CoverageFormSchema.optional(),
|
|
1185
|
-
retroactiveDate:
|
|
1236
|
+
retroactiveDate: z16.string().optional(),
|
|
1186
1237
|
extendedReportingPeriod: ExtendedReportingPeriodSchema.optional(),
|
|
1187
1238
|
insurer: InsurerInfoSchema.optional(),
|
|
1188
1239
|
producer: ProducerInfoSchema.optional(),
|
|
1189
|
-
claimsContacts:
|
|
1190
|
-
regulatoryContacts:
|
|
1191
|
-
thirdPartyAdministrators:
|
|
1192
|
-
additionalInsureds:
|
|
1193
|
-
lossPayees:
|
|
1194
|
-
mortgageHolders:
|
|
1195
|
-
taxesAndFees:
|
|
1196
|
-
totalCost:
|
|
1197
|
-
minimumPremium:
|
|
1198
|
-
depositPremium:
|
|
1240
|
+
claimsContacts: z16.array(ContactSchema).optional(),
|
|
1241
|
+
regulatoryContacts: z16.array(ContactSchema).optional(),
|
|
1242
|
+
thirdPartyAdministrators: z16.array(ContactSchema).optional(),
|
|
1243
|
+
additionalInsureds: z16.array(EndorsementPartySchema).optional(),
|
|
1244
|
+
lossPayees: z16.array(EndorsementPartySchema).optional(),
|
|
1245
|
+
mortgageHolders: z16.array(EndorsementPartySchema).optional(),
|
|
1246
|
+
taxesAndFees: z16.array(TaxFeeItemSchema).optional(),
|
|
1247
|
+
totalCost: z16.string().optional(),
|
|
1248
|
+
minimumPremium: z16.string().optional(),
|
|
1249
|
+
depositPremium: z16.string().optional(),
|
|
1199
1250
|
paymentPlan: PaymentPlanSchema.optional(),
|
|
1200
1251
|
auditType: AuditTypeSchema.optional(),
|
|
1201
|
-
ratingBasis:
|
|
1202
|
-
premiumByLocation:
|
|
1252
|
+
ratingBasis: z16.array(RatingBasisSchema).optional(),
|
|
1253
|
+
premiumByLocation: z16.array(LocationPremiumSchema).optional(),
|
|
1203
1254
|
lossSummary: LossSummarySchema.optional(),
|
|
1204
|
-
individualClaims:
|
|
1255
|
+
individualClaims: z16.array(ClaimRecordSchema).optional(),
|
|
1205
1256
|
experienceMod: ExperienceModSchema.optional(),
|
|
1206
|
-
cancellationNoticeDays:
|
|
1207
|
-
nonrenewalNoticeDays:
|
|
1257
|
+
cancellationNoticeDays: z16.number().optional(),
|
|
1258
|
+
nonrenewalNoticeDays: z16.number().optional()
|
|
1208
1259
|
};
|
|
1209
|
-
var PolicyDocumentSchema =
|
|
1260
|
+
var PolicyDocumentSchema = z16.object({
|
|
1210
1261
|
...BaseDocumentFields,
|
|
1211
|
-
type:
|
|
1212
|
-
policyNumber:
|
|
1213
|
-
effectiveDate:
|
|
1214
|
-
expirationDate:
|
|
1262
|
+
type: z16.literal("policy"),
|
|
1263
|
+
policyNumber: z16.string(),
|
|
1264
|
+
effectiveDate: z16.string(),
|
|
1265
|
+
expirationDate: z16.string().optional(),
|
|
1215
1266
|
policyTermType: PolicyTermTypeSchema.optional(),
|
|
1216
|
-
nextReviewDate:
|
|
1217
|
-
effectiveTime:
|
|
1267
|
+
nextReviewDate: z16.string().optional(),
|
|
1268
|
+
effectiveTime: z16.string().optional()
|
|
1218
1269
|
});
|
|
1219
|
-
var QuoteDocumentSchema =
|
|
1270
|
+
var QuoteDocumentSchema = z16.object({
|
|
1220
1271
|
...BaseDocumentFields,
|
|
1221
|
-
type:
|
|
1222
|
-
quoteNumber:
|
|
1223
|
-
proposedEffectiveDate:
|
|
1224
|
-
proposedExpirationDate:
|
|
1225
|
-
quoteExpirationDate:
|
|
1226
|
-
subjectivities:
|
|
1227
|
-
underwritingConditions:
|
|
1228
|
-
premiumBreakdown:
|
|
1272
|
+
type: z16.literal("quote"),
|
|
1273
|
+
quoteNumber: z16.string(),
|
|
1274
|
+
proposedEffectiveDate: z16.string().optional(),
|
|
1275
|
+
proposedExpirationDate: z16.string().optional(),
|
|
1276
|
+
quoteExpirationDate: z16.string().optional(),
|
|
1277
|
+
subjectivities: z16.array(SubjectivitySchema).optional(),
|
|
1278
|
+
underwritingConditions: z16.array(UnderwritingConditionSchema).optional(),
|
|
1279
|
+
premiumBreakdown: z16.array(PremiumLineSchema).optional(),
|
|
1229
1280
|
// Enriched quote fields (v1.2+)
|
|
1230
|
-
enrichedSubjectivities:
|
|
1231
|
-
enrichedUnderwritingConditions:
|
|
1232
|
-
warrantyRequirements:
|
|
1233
|
-
lossControlRecommendations:
|
|
1281
|
+
enrichedSubjectivities: z16.array(EnrichedSubjectivitySchema).optional(),
|
|
1282
|
+
enrichedUnderwritingConditions: z16.array(EnrichedUnderwritingConditionSchema).optional(),
|
|
1283
|
+
warrantyRequirements: z16.array(z16.string()).optional(),
|
|
1284
|
+
lossControlRecommendations: z16.array(z16.string()).optional(),
|
|
1234
1285
|
bindingAuthority: BindingAuthoritySchema.optional()
|
|
1235
1286
|
});
|
|
1236
|
-
var InsuranceDocumentSchema =
|
|
1287
|
+
var InsuranceDocumentSchema = z16.discriminatedUnion("type", [
|
|
1237
1288
|
PolicyDocumentSchema,
|
|
1238
1289
|
QuoteDocumentSchema
|
|
1239
1290
|
]);
|
|
1240
1291
|
|
|
1241
1292
|
// src/schemas/platform.ts
|
|
1242
|
-
import { z as
|
|
1243
|
-
var PlatformSchema =
|
|
1244
|
-
var CommunicationIntentSchema =
|
|
1293
|
+
import { z as z17 } from "zod";
|
|
1294
|
+
var PlatformSchema = z17.enum(["email", "chat", "sms", "slack", "discord"]);
|
|
1295
|
+
var CommunicationIntentSchema = z17.enum(["direct", "mediated", "observed"]);
|
|
1245
1296
|
var PLATFORM_CONFIGS = {
|
|
1246
1297
|
email: {
|
|
1247
1298
|
supportsMarkdown: false,
|
|
@@ -1469,10 +1520,11 @@ async function runExtractor(params) {
|
|
|
1469
1520
|
[Document pages ${startPage}-${endPage} are provided as images above.]` : `${prompt}
|
|
1470
1521
|
|
|
1471
1522
|
[Document pages ${startPage}-${endPage} are provided as a PDF file above.]`;
|
|
1523
|
+
const strictSchema = toStrictSchema(schema);
|
|
1472
1524
|
const result = await withRetry(
|
|
1473
1525
|
() => generateObject({
|
|
1474
1526
|
prompt: fullPrompt,
|
|
1475
|
-
schema,
|
|
1527
|
+
schema: strictSchema,
|
|
1476
1528
|
maxTokens,
|
|
1477
1529
|
providerOptions
|
|
1478
1530
|
})
|
|
@@ -2551,11 +2603,11 @@ function getTemplate(policyType) {
|
|
|
2551
2603
|
}
|
|
2552
2604
|
|
|
2553
2605
|
// src/prompts/coordinator/classify.ts
|
|
2554
|
-
import { z as
|
|
2555
|
-
var ClassifyResultSchema =
|
|
2556
|
-
documentType:
|
|
2557
|
-
policyTypes:
|
|
2558
|
-
confidence:
|
|
2606
|
+
import { z as z18 } from "zod";
|
|
2607
|
+
var ClassifyResultSchema = z18.object({
|
|
2608
|
+
documentType: z18.enum(["policy", "quote"]),
|
|
2609
|
+
policyTypes: z18.array(PolicyTypeSchema),
|
|
2610
|
+
confidence: z18.number()
|
|
2559
2611
|
});
|
|
2560
2612
|
function buildClassifyPrompt() {
|
|
2561
2613
|
return `You are classifying an insurance document. Examine the first few pages and determine:
|
|
@@ -2579,20 +2631,20 @@ Respond with JSON only.`;
|
|
|
2579
2631
|
}
|
|
2580
2632
|
|
|
2581
2633
|
// src/prompts/coordinator/plan.ts
|
|
2582
|
-
import { z as
|
|
2583
|
-
var ExtractionTaskSchema =
|
|
2584
|
-
extractorName:
|
|
2585
|
-
startPage:
|
|
2586
|
-
endPage:
|
|
2587
|
-
description:
|
|
2634
|
+
import { z as z19 } from "zod";
|
|
2635
|
+
var ExtractionTaskSchema = z19.object({
|
|
2636
|
+
extractorName: z19.string(),
|
|
2637
|
+
startPage: z19.number(),
|
|
2638
|
+
endPage: z19.number(),
|
|
2639
|
+
description: z19.string()
|
|
2588
2640
|
});
|
|
2589
|
-
var PageMapEntrySchema =
|
|
2590
|
-
section:
|
|
2591
|
-
pages:
|
|
2641
|
+
var PageMapEntrySchema = z19.object({
|
|
2642
|
+
section: z19.string(),
|
|
2643
|
+
pages: z19.string()
|
|
2592
2644
|
});
|
|
2593
|
-
var ExtractionPlanSchema =
|
|
2594
|
-
tasks:
|
|
2595
|
-
pageMap:
|
|
2645
|
+
var ExtractionPlanSchema = z19.object({
|
|
2646
|
+
tasks: z19.array(ExtractionTaskSchema),
|
|
2647
|
+
pageMap: z19.array(PageMapEntrySchema).optional()
|
|
2596
2648
|
});
|
|
2597
2649
|
function buildPlanPrompt(templateHints) {
|
|
2598
2650
|
return `You are planning the extraction of an insurance document. You have already classified this document. Now scan the full document and create a page map + extraction plan.
|
|
@@ -2633,15 +2685,15 @@ Respond with JSON only.`;
|
|
|
2633
2685
|
}
|
|
2634
2686
|
|
|
2635
2687
|
// src/prompts/coordinator/review.ts
|
|
2636
|
-
import { z as
|
|
2637
|
-
var ReviewResultSchema =
|
|
2638
|
-
complete:
|
|
2639
|
-
missingFields:
|
|
2640
|
-
additionalTasks:
|
|
2641
|
-
extractorName:
|
|
2642
|
-
startPage:
|
|
2643
|
-
endPage:
|
|
2644
|
-
description:
|
|
2688
|
+
import { z as z20 } from "zod";
|
|
2689
|
+
var ReviewResultSchema = z20.object({
|
|
2690
|
+
complete: z20.boolean(),
|
|
2691
|
+
missingFields: z20.array(z20.string()),
|
|
2692
|
+
additionalTasks: z20.array(z20.object({
|
|
2693
|
+
extractorName: z20.string(),
|
|
2694
|
+
startPage: z20.number(),
|
|
2695
|
+
endPage: z20.number(),
|
|
2696
|
+
description: z20.string()
|
|
2645
2697
|
}))
|
|
2646
2698
|
});
|
|
2647
2699
|
function buildReviewPrompt(templateExpected, extractedKeys) {
|
|
@@ -2673,20 +2725,20 @@ Respond with JSON only.`;
|
|
|
2673
2725
|
}
|
|
2674
2726
|
|
|
2675
2727
|
// src/prompts/extractors/carrier-info.ts
|
|
2676
|
-
import { z as
|
|
2677
|
-
var CarrierInfoSchema =
|
|
2678
|
-
carrierName:
|
|
2679
|
-
carrierLegalName:
|
|
2680
|
-
naicNumber:
|
|
2681
|
-
amBestRating:
|
|
2682
|
-
admittedStatus:
|
|
2683
|
-
mga:
|
|
2684
|
-
underwriter:
|
|
2685
|
-
policyNumber:
|
|
2686
|
-
effectiveDate:
|
|
2687
|
-
expirationDate:
|
|
2688
|
-
quoteNumber:
|
|
2689
|
-
proposedEffectiveDate:
|
|
2728
|
+
import { z as z21 } from "zod";
|
|
2729
|
+
var CarrierInfoSchema = z21.object({
|
|
2730
|
+
carrierName: z21.string().describe("Primary insurance company name for display"),
|
|
2731
|
+
carrierLegalName: z21.string().optional().describe("Legal entity name of insurer"),
|
|
2732
|
+
naicNumber: z21.string().optional().describe("NAIC company code"),
|
|
2733
|
+
amBestRating: z21.string().optional().describe("AM Best rating, e.g. 'A+ XV'"),
|
|
2734
|
+
admittedStatus: z21.enum(["admitted", "non_admitted", "surplus_lines"]).optional().describe("Admitted status of the carrier"),
|
|
2735
|
+
mga: z21.string().optional().describe("Managing General Agent or Program Administrator name"),
|
|
2736
|
+
underwriter: z21.string().optional().describe("Named individual underwriter"),
|
|
2737
|
+
policyNumber: z21.string().optional().describe("Policy or quote reference number"),
|
|
2738
|
+
effectiveDate: z21.string().optional().describe("Policy effective date (MM/DD/YYYY)"),
|
|
2739
|
+
expirationDate: z21.string().optional().describe("Policy expiration date (MM/DD/YYYY)"),
|
|
2740
|
+
quoteNumber: z21.string().optional().describe("Quote or proposal reference number"),
|
|
2741
|
+
proposedEffectiveDate: z21.string().optional().describe("Proposed effective date for quotes (MM/DD/YYYY)")
|
|
2690
2742
|
});
|
|
2691
2743
|
function buildCarrierInfoPrompt() {
|
|
2692
2744
|
return `You are an expert insurance document analyst. Extract carrier and policy identification information from this document.
|
|
@@ -2706,18 +2758,18 @@ Return JSON only.`;
|
|
|
2706
2758
|
}
|
|
2707
2759
|
|
|
2708
2760
|
// src/prompts/extractors/named-insured.ts
|
|
2709
|
-
import { z as
|
|
2710
|
-
var AddressSchema2 =
|
|
2711
|
-
street1:
|
|
2712
|
-
city:
|
|
2713
|
-
state:
|
|
2714
|
-
zip:
|
|
2761
|
+
import { z as z22 } from "zod";
|
|
2762
|
+
var AddressSchema2 = z22.object({
|
|
2763
|
+
street1: z22.string(),
|
|
2764
|
+
city: z22.string(),
|
|
2765
|
+
state: z22.string(),
|
|
2766
|
+
zip: z22.string()
|
|
2715
2767
|
});
|
|
2716
|
-
var NamedInsuredSchema2 =
|
|
2717
|
-
insuredName:
|
|
2718
|
-
insuredDba:
|
|
2768
|
+
var NamedInsuredSchema2 = z22.object({
|
|
2769
|
+
insuredName: z22.string().describe("Name of primary named insured"),
|
|
2770
|
+
insuredDba: z22.string().optional().describe("Doing-business-as name"),
|
|
2719
2771
|
insuredAddress: AddressSchema2.optional().describe("Primary insured mailing address"),
|
|
2720
|
-
insuredEntityType:
|
|
2772
|
+
insuredEntityType: z22.enum([
|
|
2721
2773
|
"corporation",
|
|
2722
2774
|
"llc",
|
|
2723
2775
|
"partnership",
|
|
@@ -2730,13 +2782,13 @@ var NamedInsuredSchema2 = z21.object({
|
|
|
2730
2782
|
"married_couple",
|
|
2731
2783
|
"other"
|
|
2732
2784
|
]).optional().describe("Legal entity type of the insured"),
|
|
2733
|
-
insuredFein:
|
|
2734
|
-
insuredSicCode:
|
|
2735
|
-
insuredNaicsCode:
|
|
2736
|
-
additionalNamedInsureds:
|
|
2737
|
-
|
|
2738
|
-
name:
|
|
2739
|
-
relationship:
|
|
2785
|
+
insuredFein: z22.string().optional().describe("Federal Employer Identification Number"),
|
|
2786
|
+
insuredSicCode: z22.string().optional().describe("SIC code"),
|
|
2787
|
+
insuredNaicsCode: z22.string().optional().describe("NAICS code"),
|
|
2788
|
+
additionalNamedInsureds: z22.array(
|
|
2789
|
+
z22.object({
|
|
2790
|
+
name: z22.string(),
|
|
2791
|
+
relationship: z22.string().optional().describe("e.g. subsidiary, affiliate"),
|
|
2740
2792
|
address: AddressSchema2.optional()
|
|
2741
2793
|
})
|
|
2742
2794
|
).optional().describe("Additional named insureds listed on the policy")
|
|
@@ -2757,19 +2809,19 @@ Return JSON only.`;
|
|
|
2757
2809
|
}
|
|
2758
2810
|
|
|
2759
2811
|
// src/prompts/extractors/coverage-limits.ts
|
|
2760
|
-
import { z as
|
|
2761
|
-
var CoverageLimitsSchema =
|
|
2762
|
-
coverages:
|
|
2763
|
-
|
|
2764
|
-
name:
|
|
2765
|
-
limit:
|
|
2766
|
-
deductible:
|
|
2767
|
-
coverageCode:
|
|
2768
|
-
formNumber:
|
|
2812
|
+
import { z as z23 } from "zod";
|
|
2813
|
+
var CoverageLimitsSchema = z23.object({
|
|
2814
|
+
coverages: z23.array(
|
|
2815
|
+
z23.object({
|
|
2816
|
+
name: z23.string().describe("Coverage name"),
|
|
2817
|
+
limit: z23.string().describe("Coverage limit, e.g. '$1,000,000'"),
|
|
2818
|
+
deductible: z23.string().optional().describe("Deductible amount"),
|
|
2819
|
+
coverageCode: z23.string().optional().describe("Coverage code or class code"),
|
|
2820
|
+
formNumber: z23.string().optional().describe("Associated form number, e.g. 'CG 00 01'")
|
|
2769
2821
|
})
|
|
2770
2822
|
).describe("All coverages with their limits"),
|
|
2771
|
-
coverageForm:
|
|
2772
|
-
retroactiveDate:
|
|
2823
|
+
coverageForm: z23.enum(["occurrence", "claims_made", "accident"]).optional().describe("Primary coverage trigger type"),
|
|
2824
|
+
retroactiveDate: z23.string().optional().describe("Retroactive date for claims-made policies (MM/DD/YYYY)")
|
|
2773
2825
|
});
|
|
2774
2826
|
function buildCoverageLimitsPrompt() {
|
|
2775
2827
|
return `You are an expert insurance document analyst. Extract all coverage limits and deductibles from this document.
|
|
@@ -2790,17 +2842,17 @@ Return JSON only.`;
|
|
|
2790
2842
|
}
|
|
2791
2843
|
|
|
2792
2844
|
// src/prompts/extractors/endorsements.ts
|
|
2793
|
-
import { z as
|
|
2794
|
-
var EndorsementsSchema =
|
|
2795
|
-
endorsements:
|
|
2796
|
-
|
|
2797
|
-
formNumber:
|
|
2798
|
-
title:
|
|
2799
|
-
type:
|
|
2800
|
-
content:
|
|
2801
|
-
effectiveDate:
|
|
2802
|
-
premium:
|
|
2803
|
-
parties:
|
|
2845
|
+
import { z as z24 } from "zod";
|
|
2846
|
+
var EndorsementsSchema = z24.object({
|
|
2847
|
+
endorsements: z24.array(
|
|
2848
|
+
z24.object({
|
|
2849
|
+
formNumber: z24.string().optional().describe("Form number, e.g. 'CG 21 47'"),
|
|
2850
|
+
title: z24.string().optional().describe("Endorsement title"),
|
|
2851
|
+
type: z24.enum(["broadening", "restrictive", "informational"]).optional().describe("Effect type: broadening adds coverage, restrictive limits it"),
|
|
2852
|
+
content: z24.string().optional().describe("Full verbatim text of the endorsement"),
|
|
2853
|
+
effectiveDate: z24.string().optional().describe("Endorsement effective date"),
|
|
2854
|
+
premium: z24.string().optional().describe("Additional premium or credit"),
|
|
2855
|
+
parties: z24.array(z24.string()).optional().describe("Named parties (additional insureds, loss payees, etc.)")
|
|
2804
2856
|
})
|
|
2805
2857
|
).describe("All endorsements found in the document")
|
|
2806
2858
|
});
|
|
@@ -2826,14 +2878,14 @@ Return JSON only.`;
|
|
|
2826
2878
|
}
|
|
2827
2879
|
|
|
2828
2880
|
// src/prompts/extractors/exclusions.ts
|
|
2829
|
-
import { z as
|
|
2830
|
-
var ExclusionsSchema =
|
|
2831
|
-
exclusions:
|
|
2832
|
-
|
|
2833
|
-
title:
|
|
2834
|
-
content:
|
|
2835
|
-
formNumber:
|
|
2836
|
-
appliesTo:
|
|
2881
|
+
import { z as z25 } from "zod";
|
|
2882
|
+
var ExclusionsSchema = z25.object({
|
|
2883
|
+
exclusions: z25.array(
|
|
2884
|
+
z25.object({
|
|
2885
|
+
title: z25.string().describe("Exclusion title or short description"),
|
|
2886
|
+
content: z25.string().optional().describe("Full verbatim exclusion text"),
|
|
2887
|
+
formNumber: z25.string().optional().describe("Form number if part of a named endorsement"),
|
|
2888
|
+
appliesTo: z25.string().optional().describe("Coverage type this exclusion applies to")
|
|
2837
2889
|
})
|
|
2838
2890
|
).describe("All exclusions found in the document")
|
|
2839
2891
|
});
|
|
@@ -2854,11 +2906,11 @@ Return JSON only.`;
|
|
|
2854
2906
|
}
|
|
2855
2907
|
|
|
2856
2908
|
// src/prompts/extractors/conditions.ts
|
|
2857
|
-
import { z as
|
|
2858
|
-
var ConditionsSchema =
|
|
2859
|
-
conditions:
|
|
2860
|
-
|
|
2861
|
-
type:
|
|
2909
|
+
import { z as z26 } from "zod";
|
|
2910
|
+
var ConditionsSchema = z26.object({
|
|
2911
|
+
conditions: z26.array(
|
|
2912
|
+
z26.object({
|
|
2913
|
+
type: z26.enum([
|
|
2862
2914
|
"duties_after_loss",
|
|
2863
2915
|
"cooperation",
|
|
2864
2916
|
"cancellation",
|
|
@@ -2872,9 +2924,9 @@ var ConditionsSchema = z25.object({
|
|
|
2872
2924
|
"liberalization",
|
|
2873
2925
|
"other"
|
|
2874
2926
|
]).optional().describe("Condition category"),
|
|
2875
|
-
title:
|
|
2876
|
-
content:
|
|
2877
|
-
noticeDays:
|
|
2927
|
+
title: z26.string().describe("Condition title"),
|
|
2928
|
+
content: z26.string().optional().describe("Full verbatim condition text"),
|
|
2929
|
+
noticeDays: z26.number().optional().describe("Notice period in days if specified (e.g. cancellation notice)")
|
|
2878
2930
|
})
|
|
2879
2931
|
).describe("All policy conditions found in the document")
|
|
2880
2932
|
});
|
|
@@ -2899,28 +2951,28 @@ Return JSON only.`;
|
|
|
2899
2951
|
}
|
|
2900
2952
|
|
|
2901
2953
|
// src/prompts/extractors/premium-breakdown.ts
|
|
2902
|
-
import { z as
|
|
2903
|
-
var PremiumBreakdownSchema =
|
|
2904
|
-
premium:
|
|
2905
|
-
totalCost:
|
|
2906
|
-
premiumBreakdown:
|
|
2907
|
-
|
|
2908
|
-
line:
|
|
2909
|
-
amount:
|
|
2954
|
+
import { z as z27 } from "zod";
|
|
2955
|
+
var PremiumBreakdownSchema = z27.object({
|
|
2956
|
+
premium: z27.string().optional().describe("Total premium amount, e.g. '$5,000'"),
|
|
2957
|
+
totalCost: z27.string().optional().describe("Total cost including taxes and fees, e.g. '$5,250'"),
|
|
2958
|
+
premiumBreakdown: z27.array(
|
|
2959
|
+
z27.object({
|
|
2960
|
+
line: z27.string().describe("Coverage line name"),
|
|
2961
|
+
amount: z27.string().describe("Premium amount for this line")
|
|
2910
2962
|
})
|
|
2911
2963
|
).optional().describe("Per-coverage-line premium breakdown"),
|
|
2912
|
-
taxesAndFees:
|
|
2913
|
-
|
|
2914
|
-
name:
|
|
2915
|
-
amount:
|
|
2916
|
-
type:
|
|
2964
|
+
taxesAndFees: z27.array(
|
|
2965
|
+
z27.object({
|
|
2966
|
+
name: z27.string().describe("Fee or tax name"),
|
|
2967
|
+
amount: z27.string().describe("Dollar amount"),
|
|
2968
|
+
type: z27.enum(["tax", "fee", "surcharge", "assessment"]).optional().describe("Fee category")
|
|
2917
2969
|
})
|
|
2918
2970
|
).optional().describe("Taxes, fees, surcharges, and assessments"),
|
|
2919
|
-
minimumPremium:
|
|
2920
|
-
depositPremium:
|
|
2921
|
-
paymentPlan:
|
|
2922
|
-
auditType:
|
|
2923
|
-
ratingBasis:
|
|
2971
|
+
minimumPremium: z27.string().optional().describe("Minimum premium if stated"),
|
|
2972
|
+
depositPremium: z27.string().optional().describe("Deposit premium if stated"),
|
|
2973
|
+
paymentPlan: z27.string().optional().describe("Payment plan description"),
|
|
2974
|
+
auditType: z27.enum(["annual", "semi_annual", "quarterly", "monthly", "final", "self"]).optional().describe("Premium audit type"),
|
|
2975
|
+
ratingBasis: z27.string().optional().describe("Rating basis, e.g. payroll, revenue, area, units")
|
|
2924
2976
|
});
|
|
2925
2977
|
function buildPremiumBreakdownPrompt() {
|
|
2926
2978
|
return `You are an expert insurance document analyst. Extract all premium and cost information from this document.
|
|
@@ -2940,14 +2992,14 @@ Return JSON only.`;
|
|
|
2940
2992
|
}
|
|
2941
2993
|
|
|
2942
2994
|
// src/prompts/extractors/declarations.ts
|
|
2943
|
-
import { z as
|
|
2944
|
-
var DeclarationsFieldSchema =
|
|
2945
|
-
field:
|
|
2946
|
-
value:
|
|
2947
|
-
section:
|
|
2995
|
+
import { z as z28 } from "zod";
|
|
2996
|
+
var DeclarationsFieldSchema = z28.object({
|
|
2997
|
+
field: z28.string().describe("Descriptive field name (e.g. 'policyNumber', 'effectiveDate', 'coverageALimit')"),
|
|
2998
|
+
value: z28.string().describe("Extracted value exactly as it appears in the document"),
|
|
2999
|
+
section: z28.string().optional().describe("Section or grouping this field belongs to (e.g. 'Coverage Limits', 'Vehicle Schedule')")
|
|
2948
3000
|
});
|
|
2949
|
-
var DeclarationsExtractSchema =
|
|
2950
|
-
fields:
|
|
3001
|
+
var DeclarationsExtractSchema = z28.object({
|
|
3002
|
+
fields: z28.array(DeclarationsFieldSchema).describe("All declarations page fields extracted as key-value pairs. Structure varies by line of business.")
|
|
2951
3003
|
});
|
|
2952
3004
|
function buildDeclarationsPrompt() {
|
|
2953
3005
|
return `You are an expert insurance document analyst. Extract all declarations page data from this document into a flexible key-value structure.
|
|
@@ -2987,21 +3039,21 @@ Preserve original values exactly as they appear. Return JSON only.`;
|
|
|
2987
3039
|
}
|
|
2988
3040
|
|
|
2989
3041
|
// src/prompts/extractors/loss-history.ts
|
|
2990
|
-
import { z as
|
|
2991
|
-
var LossHistorySchema =
|
|
2992
|
-
lossSummary:
|
|
2993
|
-
individualClaims:
|
|
2994
|
-
|
|
2995
|
-
date:
|
|
2996
|
-
type:
|
|
2997
|
-
description:
|
|
2998
|
-
amountPaid:
|
|
2999
|
-
amountReserved:
|
|
3000
|
-
status:
|
|
3001
|
-
claimNumber:
|
|
3042
|
+
import { z as z29 } from "zod";
|
|
3043
|
+
var LossHistorySchema = z29.object({
|
|
3044
|
+
lossSummary: z29.string().optional().describe("Summary of loss history, e.g. '3 claims in past 5 years totaling $125,000'"),
|
|
3045
|
+
individualClaims: z29.array(
|
|
3046
|
+
z29.object({
|
|
3047
|
+
date: z29.string().optional().describe("Date of loss or claim"),
|
|
3048
|
+
type: z29.string().optional().describe("Type of claim, e.g. 'property damage', 'bodily injury'"),
|
|
3049
|
+
description: z29.string().optional().describe("Brief description of the claim"),
|
|
3050
|
+
amountPaid: z29.string().optional().describe("Amount paid"),
|
|
3051
|
+
amountReserved: z29.string().optional().describe("Amount reserved"),
|
|
3052
|
+
status: z29.enum(["open", "closed", "reopened"]).optional().describe("Claim status"),
|
|
3053
|
+
claimNumber: z29.string().optional().describe("Claim reference number")
|
|
3002
3054
|
})
|
|
3003
3055
|
).optional().describe("Individual claim records"),
|
|
3004
|
-
experienceMod:
|
|
3056
|
+
experienceMod: z29.string().optional().describe("Experience modification factor for workers comp, e.g. '0.85'")
|
|
3005
3057
|
});
|
|
3006
3058
|
function buildLossHistoryPrompt() {
|
|
3007
3059
|
return `You are an expert insurance document analyst. Extract all loss history and claims information from this document.
|
|
@@ -3018,18 +3070,18 @@ Return JSON only.`;
|
|
|
3018
3070
|
}
|
|
3019
3071
|
|
|
3020
3072
|
// src/prompts/extractors/sections.ts
|
|
3021
|
-
import { z as
|
|
3022
|
-
var SubsectionSchema2 =
|
|
3023
|
-
title:
|
|
3024
|
-
sectionNumber:
|
|
3025
|
-
pageNumber:
|
|
3026
|
-
content:
|
|
3073
|
+
import { z as z30 } from "zod";
|
|
3074
|
+
var SubsectionSchema2 = z30.object({
|
|
3075
|
+
title: z30.string().describe("Subsection title"),
|
|
3076
|
+
sectionNumber: z30.string().optional().describe("Subsection number"),
|
|
3077
|
+
pageNumber: z30.number().optional().describe("Page number"),
|
|
3078
|
+
content: z30.string().describe("Full verbatim text")
|
|
3027
3079
|
});
|
|
3028
|
-
var SectionsSchema =
|
|
3029
|
-
sections:
|
|
3030
|
-
|
|
3031
|
-
title:
|
|
3032
|
-
type:
|
|
3080
|
+
var SectionsSchema = z30.object({
|
|
3081
|
+
sections: z30.array(
|
|
3082
|
+
z30.object({
|
|
3083
|
+
title: z30.string().describe("Section title"),
|
|
3084
|
+
type: z30.enum([
|
|
3033
3085
|
"declarations",
|
|
3034
3086
|
"insuring_agreement",
|
|
3035
3087
|
"policy_form",
|
|
@@ -3043,10 +3095,10 @@ var SectionsSchema = z29.object({
|
|
|
3043
3095
|
"regulatory",
|
|
3044
3096
|
"other"
|
|
3045
3097
|
]).describe("Section type classification"),
|
|
3046
|
-
content:
|
|
3047
|
-
pageStart:
|
|
3048
|
-
pageEnd:
|
|
3049
|
-
subsections:
|
|
3098
|
+
content: z30.string().describe("Full verbatim text of the section"),
|
|
3099
|
+
pageStart: z30.number().describe("Starting page number"),
|
|
3100
|
+
pageEnd: z30.number().optional().describe("Ending page number"),
|
|
3101
|
+
subsections: z30.array(SubsectionSchema2).optional().describe("Subsections within this section")
|
|
3050
3102
|
})
|
|
3051
3103
|
).describe("All document sections")
|
|
3052
3104
|
});
|
|
@@ -3070,20 +3122,20 @@ Return JSON only.`;
|
|
|
3070
3122
|
}
|
|
3071
3123
|
|
|
3072
3124
|
// src/prompts/extractors/supplementary.ts
|
|
3073
|
-
import { z as
|
|
3074
|
-
var ContactSchema2 =
|
|
3075
|
-
name:
|
|
3076
|
-
phone:
|
|
3077
|
-
email:
|
|
3078
|
-
address:
|
|
3079
|
-
type:
|
|
3125
|
+
import { z as z31 } from "zod";
|
|
3126
|
+
var ContactSchema2 = z31.object({
|
|
3127
|
+
name: z31.string().optional().describe("Organization or person name"),
|
|
3128
|
+
phone: z31.string().optional().describe("Phone number"),
|
|
3129
|
+
email: z31.string().optional().describe("Email address"),
|
|
3130
|
+
address: z31.string().optional().describe("Mailing address"),
|
|
3131
|
+
type: z31.string().optional().describe("Contact type, e.g. 'State Department of Insurance'")
|
|
3080
3132
|
});
|
|
3081
|
-
var SupplementarySchema =
|
|
3082
|
-
regulatoryContacts:
|
|
3083
|
-
claimsContacts:
|
|
3084
|
-
thirdPartyAdministrators:
|
|
3085
|
-
cancellationNoticeDays:
|
|
3086
|
-
nonrenewalNoticeDays:
|
|
3133
|
+
var SupplementarySchema = z31.object({
|
|
3134
|
+
regulatoryContacts: z31.array(ContactSchema2).optional().describe("Regulatory body contacts (state department of insurance, ombudsman)"),
|
|
3135
|
+
claimsContacts: z31.array(ContactSchema2).optional().describe("Claims reporting contacts and instructions"),
|
|
3136
|
+
thirdPartyAdministrators: z31.array(ContactSchema2).optional().describe("Third-party administrators for claims handling"),
|
|
3137
|
+
cancellationNoticeDays: z31.number().optional().describe("Required notice period for cancellation in days"),
|
|
3138
|
+
nonrenewalNoticeDays: z31.number().optional().describe("Required notice period for nonrenewal in days")
|
|
3087
3139
|
});
|
|
3088
3140
|
function buildSupplementaryPrompt() {
|
|
3089
3141
|
return `You are an expert insurance document analyst. Extract supplementary and regulatory information from this document.
|
|
@@ -3585,8 +3637,8 @@ Respond with JSON only:
|
|
|
3585
3637
|
}`;
|
|
3586
3638
|
|
|
3587
3639
|
// src/schemas/application.ts
|
|
3588
|
-
import { z as
|
|
3589
|
-
var FieldTypeSchema =
|
|
3640
|
+
import { z as z32 } from "zod";
|
|
3641
|
+
var FieldTypeSchema = z32.enum([
|
|
3590
3642
|
"text",
|
|
3591
3643
|
"numeric",
|
|
3592
3644
|
"currency",
|
|
@@ -3595,100 +3647,100 @@ var FieldTypeSchema = z31.enum([
|
|
|
3595
3647
|
"table",
|
|
3596
3648
|
"declaration"
|
|
3597
3649
|
]);
|
|
3598
|
-
var ApplicationFieldSchema =
|
|
3599
|
-
id:
|
|
3600
|
-
label:
|
|
3601
|
-
section:
|
|
3650
|
+
var ApplicationFieldSchema = z32.object({
|
|
3651
|
+
id: z32.string(),
|
|
3652
|
+
label: z32.string(),
|
|
3653
|
+
section: z32.string(),
|
|
3602
3654
|
fieldType: FieldTypeSchema,
|
|
3603
|
-
required:
|
|
3604
|
-
options:
|
|
3605
|
-
columns:
|
|
3606
|
-
requiresExplanationIfYes:
|
|
3607
|
-
condition:
|
|
3608
|
-
dependsOn:
|
|
3609
|
-
whenValue:
|
|
3655
|
+
required: z32.boolean(),
|
|
3656
|
+
options: z32.array(z32.string()).optional(),
|
|
3657
|
+
columns: z32.array(z32.string()).optional(),
|
|
3658
|
+
requiresExplanationIfYes: z32.boolean().optional(),
|
|
3659
|
+
condition: z32.object({
|
|
3660
|
+
dependsOn: z32.string(),
|
|
3661
|
+
whenValue: z32.string()
|
|
3610
3662
|
}).optional(),
|
|
3611
|
-
value:
|
|
3612
|
-
source:
|
|
3613
|
-
confidence:
|
|
3663
|
+
value: z32.string().optional(),
|
|
3664
|
+
source: z32.string().optional().describe("Where the value came from: auto-fill, user, lookup"),
|
|
3665
|
+
confidence: z32.enum(["confirmed", "high", "medium", "low"]).optional()
|
|
3614
3666
|
});
|
|
3615
|
-
var ApplicationClassifyResultSchema =
|
|
3616
|
-
isApplication:
|
|
3617
|
-
confidence:
|
|
3618
|
-
applicationType:
|
|
3667
|
+
var ApplicationClassifyResultSchema = z32.object({
|
|
3668
|
+
isApplication: z32.boolean(),
|
|
3669
|
+
confidence: z32.number().min(0).max(1),
|
|
3670
|
+
applicationType: z32.string().nullable()
|
|
3619
3671
|
});
|
|
3620
|
-
var FieldExtractionResultSchema =
|
|
3621
|
-
fields:
|
|
3672
|
+
var FieldExtractionResultSchema = z32.object({
|
|
3673
|
+
fields: z32.array(ApplicationFieldSchema)
|
|
3622
3674
|
});
|
|
3623
|
-
var AutoFillMatchSchema =
|
|
3624
|
-
fieldId:
|
|
3625
|
-
value:
|
|
3626
|
-
confidence:
|
|
3627
|
-
contextKey:
|
|
3675
|
+
var AutoFillMatchSchema = z32.object({
|
|
3676
|
+
fieldId: z32.string(),
|
|
3677
|
+
value: z32.string(),
|
|
3678
|
+
confidence: z32.enum(["confirmed"]),
|
|
3679
|
+
contextKey: z32.string()
|
|
3628
3680
|
});
|
|
3629
|
-
var AutoFillResultSchema =
|
|
3630
|
-
matches:
|
|
3681
|
+
var AutoFillResultSchema = z32.object({
|
|
3682
|
+
matches: z32.array(AutoFillMatchSchema)
|
|
3631
3683
|
});
|
|
3632
|
-
var QuestionBatchResultSchema =
|
|
3633
|
-
batches:
|
|
3684
|
+
var QuestionBatchResultSchema = z32.object({
|
|
3685
|
+
batches: z32.array(z32.array(z32.string()).describe("Array of field IDs in this batch"))
|
|
3634
3686
|
});
|
|
3635
|
-
var LookupRequestSchema =
|
|
3636
|
-
type:
|
|
3637
|
-
description:
|
|
3638
|
-
url:
|
|
3639
|
-
targetFieldIds:
|
|
3687
|
+
var LookupRequestSchema = z32.object({
|
|
3688
|
+
type: z32.string().describe("Type of lookup: 'records', 'website', 'policy'"),
|
|
3689
|
+
description: z32.string(),
|
|
3690
|
+
url: z32.string().optional(),
|
|
3691
|
+
targetFieldIds: z32.array(z32.string())
|
|
3640
3692
|
});
|
|
3641
|
-
var ReplyIntentSchema =
|
|
3642
|
-
primaryIntent:
|
|
3643
|
-
hasAnswers:
|
|
3644
|
-
questionText:
|
|
3645
|
-
questionFieldIds:
|
|
3646
|
-
lookupRequests:
|
|
3693
|
+
var ReplyIntentSchema = z32.object({
|
|
3694
|
+
primaryIntent: z32.enum(["answers_only", "question", "lookup_request", "mixed"]),
|
|
3695
|
+
hasAnswers: z32.boolean(),
|
|
3696
|
+
questionText: z32.string().optional(),
|
|
3697
|
+
questionFieldIds: z32.array(z32.string()).optional(),
|
|
3698
|
+
lookupRequests: z32.array(LookupRequestSchema).optional()
|
|
3647
3699
|
});
|
|
3648
|
-
var ParsedAnswerSchema =
|
|
3649
|
-
fieldId:
|
|
3650
|
-
value:
|
|
3651
|
-
explanation:
|
|
3700
|
+
var ParsedAnswerSchema = z32.object({
|
|
3701
|
+
fieldId: z32.string(),
|
|
3702
|
+
value: z32.string(),
|
|
3703
|
+
explanation: z32.string().optional()
|
|
3652
3704
|
});
|
|
3653
|
-
var AnswerParsingResultSchema =
|
|
3654
|
-
answers:
|
|
3655
|
-
unanswered:
|
|
3705
|
+
var AnswerParsingResultSchema = z32.object({
|
|
3706
|
+
answers: z32.array(ParsedAnswerSchema),
|
|
3707
|
+
unanswered: z32.array(z32.string()).describe("Field IDs that were not answered")
|
|
3656
3708
|
});
|
|
3657
|
-
var LookupFillSchema =
|
|
3658
|
-
fieldId:
|
|
3659
|
-
value:
|
|
3660
|
-
source:
|
|
3709
|
+
var LookupFillSchema = z32.object({
|
|
3710
|
+
fieldId: z32.string(),
|
|
3711
|
+
value: z32.string(),
|
|
3712
|
+
source: z32.string().describe("Specific citable reference, e.g. 'GL Policy #POL-12345 (Hartford)'")
|
|
3661
3713
|
});
|
|
3662
|
-
var LookupFillResultSchema =
|
|
3663
|
-
fills:
|
|
3664
|
-
unfillable:
|
|
3665
|
-
explanation:
|
|
3714
|
+
var LookupFillResultSchema = z32.object({
|
|
3715
|
+
fills: z32.array(LookupFillSchema),
|
|
3716
|
+
unfillable: z32.array(z32.string()),
|
|
3717
|
+
explanation: z32.string().optional()
|
|
3666
3718
|
});
|
|
3667
|
-
var FlatPdfPlacementSchema =
|
|
3668
|
-
fieldId:
|
|
3669
|
-
page:
|
|
3670
|
-
x:
|
|
3671
|
-
y:
|
|
3672
|
-
text:
|
|
3673
|
-
fontSize:
|
|
3674
|
-
isCheckmark:
|
|
3719
|
+
var FlatPdfPlacementSchema = z32.object({
|
|
3720
|
+
fieldId: z32.string(),
|
|
3721
|
+
page: z32.number(),
|
|
3722
|
+
x: z32.number().describe("Percentage from left edge (0-100)"),
|
|
3723
|
+
y: z32.number().describe("Percentage from top edge (0-100)"),
|
|
3724
|
+
text: z32.string(),
|
|
3725
|
+
fontSize: z32.number().optional(),
|
|
3726
|
+
isCheckmark: z32.boolean().optional()
|
|
3675
3727
|
});
|
|
3676
|
-
var AcroFormMappingSchema =
|
|
3677
|
-
fieldId:
|
|
3678
|
-
acroFormName:
|
|
3679
|
-
value:
|
|
3728
|
+
var AcroFormMappingSchema = z32.object({
|
|
3729
|
+
fieldId: z32.string(),
|
|
3730
|
+
acroFormName: z32.string(),
|
|
3731
|
+
value: z32.string()
|
|
3680
3732
|
});
|
|
3681
|
-
var ApplicationStateSchema =
|
|
3682
|
-
id:
|
|
3683
|
-
pdfBase64:
|
|
3684
|
-
title:
|
|
3685
|
-
applicationType:
|
|
3686
|
-
fields:
|
|
3687
|
-
batches:
|
|
3688
|
-
currentBatchIndex:
|
|
3689
|
-
status:
|
|
3690
|
-
createdAt:
|
|
3691
|
-
updatedAt:
|
|
3733
|
+
var ApplicationStateSchema = z32.object({
|
|
3734
|
+
id: z32.string(),
|
|
3735
|
+
pdfBase64: z32.string().optional().describe("Original PDF, omitted after extraction"),
|
|
3736
|
+
title: z32.string().optional(),
|
|
3737
|
+
applicationType: z32.string().nullable().optional(),
|
|
3738
|
+
fields: z32.array(ApplicationFieldSchema),
|
|
3739
|
+
batches: z32.array(z32.array(z32.string())).optional(),
|
|
3740
|
+
currentBatchIndex: z32.number().default(0),
|
|
3741
|
+
status: z32.enum(["classifying", "extracting", "auto_filling", "batching", "collecting", "confirming", "mapping", "complete"]),
|
|
3742
|
+
createdAt: z32.number(),
|
|
3743
|
+
updatedAt: z32.number()
|
|
3692
3744
|
});
|
|
3693
3745
|
|
|
3694
3746
|
// src/application/agents/classifier.ts
|
|
@@ -4716,73 +4768,73 @@ Respond with the final answer, deduplicated citations array, overall confidence
|
|
|
4716
4768
|
}
|
|
4717
4769
|
|
|
4718
4770
|
// src/schemas/query.ts
|
|
4719
|
-
import { z as
|
|
4720
|
-
var QueryIntentSchema =
|
|
4771
|
+
import { z as z33 } from "zod";
|
|
4772
|
+
var QueryIntentSchema = z33.enum([
|
|
4721
4773
|
"policy_question",
|
|
4722
4774
|
"coverage_comparison",
|
|
4723
4775
|
"document_search",
|
|
4724
4776
|
"claims_inquiry",
|
|
4725
4777
|
"general_knowledge"
|
|
4726
4778
|
]);
|
|
4727
|
-
var SubQuestionSchema =
|
|
4728
|
-
question:
|
|
4779
|
+
var SubQuestionSchema = z33.object({
|
|
4780
|
+
question: z33.string().describe("Atomic sub-question to retrieve and answer independently"),
|
|
4729
4781
|
intent: QueryIntentSchema,
|
|
4730
|
-
chunkTypes:
|
|
4731
|
-
documentFilters:
|
|
4732
|
-
type:
|
|
4733
|
-
carrier:
|
|
4734
|
-
insuredName:
|
|
4735
|
-
policyNumber:
|
|
4736
|
-
quoteNumber:
|
|
4782
|
+
chunkTypes: z33.array(z33.string()).optional().describe("Chunk types to filter retrieval (e.g. coverage, endorsement, declaration)"),
|
|
4783
|
+
documentFilters: z33.object({
|
|
4784
|
+
type: z33.enum(["policy", "quote"]).optional(),
|
|
4785
|
+
carrier: z33.string().optional(),
|
|
4786
|
+
insuredName: z33.string().optional(),
|
|
4787
|
+
policyNumber: z33.string().optional(),
|
|
4788
|
+
quoteNumber: z33.string().optional()
|
|
4737
4789
|
}).optional().describe("Structured filters to narrow document lookup")
|
|
4738
4790
|
});
|
|
4739
|
-
var QueryClassifyResultSchema =
|
|
4791
|
+
var QueryClassifyResultSchema = z33.object({
|
|
4740
4792
|
intent: QueryIntentSchema,
|
|
4741
|
-
subQuestions:
|
|
4742
|
-
requiresDocumentLookup:
|
|
4743
|
-
requiresChunkSearch:
|
|
4744
|
-
requiresConversationHistory:
|
|
4793
|
+
subQuestions: z33.array(SubQuestionSchema).min(1).describe("Decomposed atomic sub-questions"),
|
|
4794
|
+
requiresDocumentLookup: z33.boolean().describe("Whether structured document lookup is needed"),
|
|
4795
|
+
requiresChunkSearch: z33.boolean().describe("Whether semantic chunk search is needed"),
|
|
4796
|
+
requiresConversationHistory: z33.boolean().describe("Whether conversation history is relevant")
|
|
4745
4797
|
});
|
|
4746
|
-
var EvidenceItemSchema =
|
|
4747
|
-
source:
|
|
4748
|
-
chunkId:
|
|
4749
|
-
documentId:
|
|
4750
|
-
turnId:
|
|
4751
|
-
text:
|
|
4752
|
-
relevance:
|
|
4753
|
-
metadata:
|
|
4798
|
+
var EvidenceItemSchema = z33.object({
|
|
4799
|
+
source: z33.enum(["chunk", "document", "conversation"]),
|
|
4800
|
+
chunkId: z33.string().optional(),
|
|
4801
|
+
documentId: z33.string().optional(),
|
|
4802
|
+
turnId: z33.string().optional(),
|
|
4803
|
+
text: z33.string().describe("Text excerpt from the source"),
|
|
4804
|
+
relevance: z33.number().min(0).max(1),
|
|
4805
|
+
metadata: z33.array(z33.object({ key: z33.string(), value: z33.string() })).optional()
|
|
4754
4806
|
});
|
|
4755
|
-
var RetrievalResultSchema =
|
|
4756
|
-
subQuestion:
|
|
4757
|
-
evidence:
|
|
4807
|
+
var RetrievalResultSchema = z33.object({
|
|
4808
|
+
subQuestion: z33.string(),
|
|
4809
|
+
evidence: z33.array(EvidenceItemSchema)
|
|
4758
4810
|
});
|
|
4759
|
-
var CitationSchema =
|
|
4760
|
-
index:
|
|
4761
|
-
chunkId:
|
|
4762
|
-
documentId:
|
|
4763
|
-
documentType:
|
|
4764
|
-
field:
|
|
4765
|
-
quote:
|
|
4766
|
-
relevance:
|
|
4811
|
+
var CitationSchema = z33.object({
|
|
4812
|
+
index: z33.number().describe("Citation number [1], [2], etc."),
|
|
4813
|
+
chunkId: z33.string().describe("Source chunk ID, e.g. doc-123:coverage:2"),
|
|
4814
|
+
documentId: z33.string(),
|
|
4815
|
+
documentType: z33.enum(["policy", "quote"]).optional(),
|
|
4816
|
+
field: z33.string().optional().describe("Specific field path, e.g. coverages[0].deductible"),
|
|
4817
|
+
quote: z33.string().describe("Exact text from source that supports the claim"),
|
|
4818
|
+
relevance: z33.number().min(0).max(1)
|
|
4767
4819
|
});
|
|
4768
|
-
var SubAnswerSchema =
|
|
4769
|
-
subQuestion:
|
|
4770
|
-
answer:
|
|
4771
|
-
citations:
|
|
4772
|
-
confidence:
|
|
4773
|
-
needsMoreContext:
|
|
4820
|
+
var SubAnswerSchema = z33.object({
|
|
4821
|
+
subQuestion: z33.string(),
|
|
4822
|
+
answer: z33.string(),
|
|
4823
|
+
citations: z33.array(CitationSchema),
|
|
4824
|
+
confidence: z33.number().min(0).max(1),
|
|
4825
|
+
needsMoreContext: z33.boolean().describe("True if evidence was insufficient to answer fully")
|
|
4774
4826
|
});
|
|
4775
|
-
var VerifyResultSchema =
|
|
4776
|
-
approved:
|
|
4777
|
-
issues:
|
|
4778
|
-
retrySubQuestions:
|
|
4827
|
+
var VerifyResultSchema = z33.object({
|
|
4828
|
+
approved: z33.boolean().describe("Whether all sub-answers are adequately grounded"),
|
|
4829
|
+
issues: z33.array(z33.string()).describe("Specific grounding or consistency issues found"),
|
|
4830
|
+
retrySubQuestions: z33.array(z33.string()).optional().describe("Sub-questions that need additional retrieval or re-reasoning")
|
|
4779
4831
|
});
|
|
4780
|
-
var QueryResultSchema =
|
|
4781
|
-
answer:
|
|
4782
|
-
citations:
|
|
4832
|
+
var QueryResultSchema = z33.object({
|
|
4833
|
+
answer: z33.string(),
|
|
4834
|
+
citations: z33.array(CitationSchema),
|
|
4783
4835
|
intent: QueryIntentSchema,
|
|
4784
|
-
confidence:
|
|
4785
|
-
followUp:
|
|
4836
|
+
confidence: z33.number().min(0).max(1),
|
|
4837
|
+
followUp: z33.string().optional().describe("Suggested follow-up question if applicable")
|
|
4786
4838
|
});
|
|
4787
4839
|
|
|
4788
4840
|
// src/query/retriever.ts
|
|
@@ -5663,6 +5715,7 @@ export {
|
|
|
5663
5715
|
safeGenerateObject,
|
|
5664
5716
|
sanitizeNulls,
|
|
5665
5717
|
stripFences,
|
|
5718
|
+
toStrictSchema,
|
|
5666
5719
|
withRetry
|
|
5667
5720
|
};
|
|
5668
5721
|
//# sourceMappingURL=index.mjs.map
|