@cosyte/x12 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -4276,12 +4276,25 @@ declare const REMIT_835_LOOP_1000B: LoopSpec;
4276
4276
  * What the offset guarantees is non-collision across claims: a claim with
4277
4277
  * `n` service lines spans at least `n + 1` body segments, so the next CLP
4278
4278
  * always sits past the previous claim's last line position.
4279
- * - **Remit-level** ({@link checkRemitTotalBalance}): `segmentIndex` is
4280
- * **`0`**, not a CLP and not the BPR. The top-of-remit equation spans the
4281
- * whole transaction set and has no single offending segment, and there is
4282
- * at most one such warning per transaction, so it needs no locator to stay
4283
- * distinct. Read it as "this transaction set", and take the amounts from
4284
- * `remit.paymentAmount` and `remit.claims`.
4279
+ * - **Remit-level** ({@link checkRemitTotalBalance}): `segmentIndex` is the
4280
+ * **BPR's** own 1-based body index, so `tx.segments[position.segmentIndex]`
4281
+ * is that exact BPR. The equation spans the whole transaction set, so no
4282
+ * single segment is uniquely "at fault" - but BPR-02 is the one element the
4283
+ * invariant compares against, and the BPR is the only segment a reader can
4284
+ * act on. `get835` was passing a literal `0` here, and `0` is not a neutral
4285
+ * sentinel: `tx.segments[0]` is the ST, so a consumer resolving the position
4286
+ * landed on the ST. The one remaining `0` is the transaction that carries no
4287
+ * BPR at all (malformed - TR3 005010X221A1 makes BPR mandatory - but
4288
+ * reachable, since the check still runs against an all-zero payment header).
4289
+ * Take the amounts from `remit.payment.totalActualPayment` and
4290
+ * `remit.claims`; the message names the equation and carries no value.
4291
+ *
4292
+ * **A caller that constructs the position itself gets whatever it passes.**
4293
+ * These three functions are exported, and they do not derive a position - they
4294
+ * forward one. `build835` exploits that: it hands in a synthetic position
4295
+ * because it has no parsed segment stream to index into, and it uses only
4296
+ * `.message`, which is a registry lookup keyed by the invariant and therefore
4297
+ * position-independent.
4285
4298
  */
4286
4299
 
4287
4300
  /**
@@ -12514,6 +12527,124 @@ interface InterchangeSpec {
12514
12527
  */
12515
12528
  declare function buildInterchange(spec: InterchangeSpec): X12Interchange;
12516
12529
 
12530
+ /**
12531
+ * The single route a caller-supplied value takes into a `build*` refusal
12532
+ * message.
12533
+ *
12534
+ * ## Why this exists
12535
+ *
12536
+ * The parse side closed its equivalent hole first: no warning factory takes a
12537
+ * value parameter at all, and `message` is a lookup into the frozen
12538
+ * `ALL_WARNING_MESSAGES` table, so a *document's* bytes cannot reach a
12539
+ * diagnostic (`PHI-WARNING-MESSAGE-LEAK`). The builder side is the mirror
12540
+ * image with one material asymmetry, and the claim made here is deliberately
12541
+ * narrower because of it:
12542
+ *
12543
+ * > **A builder refusal echoes a value the CALLER passed in, which is usually
12544
+ * > but NOT ALWAYS their own.** They just handed it to the builder, so bounding
12545
+ * > it is **robustness and log hygiene, not redaction**. This module does not
12546
+ * > make a builder refusal PHI-safe, and nothing in this library claims it
12547
+ * > does. If a caller puts PHI in a control number, the refusal will show up
12548
+ * > to {@link BUILD_REFUSAL_VALUE_MAX_LENGTH} characters of it.
12549
+ *
12550
+ * **Do not state that dichotomy categorically, because the ack builders break
12551
+ * it.** `build999` renders the AK2-02 transaction-set control number and
12552
+ * `buildTA1` exists to echo an inbound ISA-13: TR3 005010X231A1 requires AK2-02
12553
+ * to be a verbatim copy of the acknowledged transaction set's ST-02, so on the
12554
+ * ack path a *document's* bytes reach the spec by the standard's own design,
12555
+ * and from there a refusal message. They are envelope control numbers rather
12556
+ * than clinical content, and they are bounded here like everything else - but
12557
+ * "the value is always the caller's own" is false, and this library should not
12558
+ * say it.
12559
+ *
12560
+ * What it does guarantee is that `Error.message` from a `build*` refusal has a
12561
+ * **fixed ceiling**. Before this, **twenty-three** refusal sites across ten builder
12562
+ * modules interpolated a caller value verbatim, so a 120,000-character control
12563
+ * number produced a 120,066-**character** `X12BuildError.message` - measured on
12564
+ * this tree, and the length grew without limit with the input. An unbounded
12565
+ * `Error.message` is a real operational hazard independent of PHI: it is what
12566
+ * gets serialized into a log line, a crash report, or a JSON error envelope.
12567
+ *
12568
+ * ## What is bounded and what is not
12569
+ *
12570
+ * - **Bounded:** the number of UTF-16 code units. The rendered fragment never
12571
+ * exceeds {@link BUILD_REFUSAL_VALUE_MAX_RENDERED}. **Code units, not bytes** -
12572
+ * an all-astral value renders 86 units but 152 UTF-8 bytes, and a CJK one
12573
+ * around 216. Every figure this package publishes says "characters" for that
12574
+ * reason. A slice at the bound can also split a surrogate pair, leaving a lone
12575
+ * surrogate that becomes U+FFFD once the message is UTF-8 encoded; the bound
12576
+ * holds regardless, and the fragment is diagnostic text, not data.
12577
+ * - **NOT escaped, and this is not an oversight.** The surviving characters are
12578
+ * whatever the caller supplied, including a segment terminator, a quote, or a
12579
+ * newline. A refusal message is therefore bounded but not guaranteed to be a
12580
+ * single log line. Escaping was considered and left out: it would expand the
12581
+ * rendered length by up to 6x per character for a hazard the caller creates
12582
+ * in their own data, and this slice makes the claim it can support and no
12583
+ * wider.
12584
+ *
12585
+ * @see `src/parser/errors.ts` for the parse-side `SNIPPET_MAX_INPUT` bound this
12586
+ * mirrors, which is the one deliberate place a *document's* bytes are copied.
12587
+ */
12588
+ /**
12589
+ * How many characters of a caller-supplied value survive into a `build*`
12590
+ * refusal message. Set to mirror the parser's own `SNIPPET_MAX_INPUT` (63),
12591
+ * so the two bounded copies in this library agree rather than each picking a
12592
+ * number. Comfortably wider than every slot it guards: an ISA-13 / IEA-02
12593
+ * control number is 9, a TA1-05 note code 3, an ST-01 transaction set id 3, an
12594
+ * 834 maintenance type 2-3, an 837 service-line variant 1.
12595
+ *
12596
+ * @example
12597
+ * ```ts
12598
+ * import { BUILD_REFUSAL_VALUE_MAX_LENGTH } from "@cosyte/x12";
12599
+ * BUILD_REFUSAL_VALUE_MAX_LENGTH; // 63
12600
+ * ```
12601
+ */
12602
+ declare const BUILD_REFUSAL_VALUE_MAX_LENGTH = 63;
12603
+ /**
12604
+ * Hard ceiling, in characters, on the fragment {@link renderCallerValue}
12605
+ * returns: {@link BUILD_REFUSAL_VALUE_MAX_LENGTH} surviving characters, two
12606
+ * quotes, one ellipsis, and the ` (N characters)` suffix at its widest.
12607
+ *
12608
+ * **This is the bound on the FRAGMENT, not on the message.** A refusal message
12609
+ * is this plus the site's own fixed template text, which differs per site, so
12610
+ * the message is bounded by a constant but not by *this* constant. Measured on
12611
+ * this tree: a 120,000-character control number gives an 86-character fragment
12612
+ * and a **150-character** `X12BuildError.message` from `buildInterchange`. Do
12613
+ * not quote the ceiling as though it were a message length - an earlier
12614
+ * revision of the docs did exactly that, reporting "now 90 bytes" for a message
12615
+ * that is 150. The suite asserts the fragment against this constant and each
12616
+ * message against its own site.
12617
+ *
12618
+ * @example
12619
+ * ```ts
12620
+ * import { BUILD_REFUSAL_VALUE_MAX_RENDERED } from "@cosyte/x12";
12621
+ * BUILD_REFUSAL_VALUE_MAX_RENDERED; // 90
12622
+ * ```
12623
+ */
12624
+ declare const BUILD_REFUSAL_VALUE_MAX_RENDERED: number;
12625
+ /**
12626
+ * Render a caller-supplied value as a bounded, quoted fragment for a `build*`
12627
+ * refusal message. **This is the only sanctioned route a caller value takes
12628
+ * into a thrown message**, and `test/builder-refusal-bounds.test.ts` scans
12629
+ * `src/` for any other route - a twenty-fourth refusal site that interpolates a
12630
+ * value directly reds that test. That scan keys on `throw new *BuildError(` and
12631
+ * on template-literal holes, so it is a strong tripwire for the shape this
12632
+ * library uses rather than a proof over every shape one could write.
12633
+ *
12634
+ * Returns the value quoted when it fits, and otherwise the first
12635
+ * {@link BUILD_REFUSAL_VALUE_MAX_LENGTH} characters, an ellipsis, and the true
12636
+ * length - the length is the diagnostically useful part when the value is
12637
+ * over-long, since that is usually *why* the builder refused.
12638
+ *
12639
+ * @example
12640
+ * ```ts
12641
+ * import { renderCallerValue } from "@cosyte/x12";
12642
+ * renderCallerValue("000000001"); // '"000000001"'
12643
+ * renderCallerValue("9".repeat(120000)); // '"999…" (120000 characters)'
12644
+ * ```
12645
+ */
12646
+ declare function renderCallerValue(value: string | number): string;
12647
+
12517
12648
  /**
12518
12649
  * Thrown errors emitted by the general-purpose interchange builder
12519
12650
  * (`buildInterchange`). Distinct from `X12ParseError` (the parser stays
@@ -12860,4 +12991,4 @@ declare const profiles: {
12860
12991
  */
12861
12992
  declare const VERSION: string;
12862
12993
 
12863
- export { ACK_BUILD_ERROR_CODES, ALL_WARNING_MESSAGES, AUTH_278_BUILD_ERROR_CODES, AUTH_278_LOOP_2000A, AUTH_278_LOOP_2000B, AUTH_278_LOOP_2000C, AUTH_278_LOOP_2000D, AUTH_278_LOOP_2000E, AUTH_278_LOOP_2000F, AckBuildError, type AckBuildErrorCode, BALANCE_INVARIANTS, type Build271AddressSpec, type Build271BenefitSpec, type Build271DateSpec, type Build271DependentSpec, type Build271EntitySpec, type Build271EnvelopeSpec, type Build271InformationReceiverSpec, type Build271InformationSourceSpec, type Build271MemberSpec, type Build271ReferenceSpec, type Build271ServiceTypeSpec, type Build271Spec, type Build271SubscriberSpec, type Build271TraceSpec, type Build277ClaimSpec, type Build277DateSpec, type Build277DependentSpec, type Build277EntitySpec, type Build277EnvelopeSpec, type Build277InformationReceiverSpec, type Build277InformationSourceSpec, type Build277MemberSpec, type Build277ProviderSpec, type Build277ReferenceSpec, type Build277ServiceLineSpec, type Build277Spec, type Build277StatusCodeSpec, type Build277StatusSpec, type Build277SubscriberSpec, type Build277TraceSpec, type Build278DateSpec, type Build278DecisionSpec, type Build278DependentSpec, type Build278DiagnosisSpec, type Build278EntitySpec, type Build278EnvelopeSpec, type Build278HeaderSpec, type Build278MemberSpec, type Build278ReferenceSpec, type Build278ReviewSpec, type Build278Spec, type Build278SubscriberSpec, type Build278TraceSpec, type Build820AddressSpec, type Build820AdjustmentSpec, type Build820DateSpec, type Build820EntitySpec, type Build820EnvelopeSpec, type Build820OpenItemSpec, type Build820PartySpec, type Build820PaymentSpec, type Build820PersonSpec, type Build820ReferenceSpec, type Build820RemittanceSpec, type Build820Spec, type Build820TraceSpec, type Build834AddressSpec, type Build834AmountSpec, type Build834CoordinationOfBenefitsSpec, type Build834CoverageSpec, type Build834DateSpec, type Build834EnvelopeSpec, type Build834HeaderSpec, type Build834MemberNameSpec, type Build834MemberSpec, type Build834PartySpec, type Build834ReferenceSpec, type Build834Spec, type Build835AddressSpec, type Build835AdjustmentSpec, type Build835AmountSpec, type Build835ClaimSpec, type Build835ContactSpec, type Build835EnvelopeSpec, type Build835PartySpec, type Build835PaymentSpec, type Build835PersonSpec, type Build835ProviderAdjustmentSpec, type Build835ProviderSpec, type Build835ReferenceSpec, type Build835RemarkSpec, type Build835ServiceLineSpec, type Build835Spec, type Build835TraceSpec, type Build837AddressSpec, type Build837AdjudicationSpec, type Build837AdjustmentSpec, type Build837AmountSpec, type Build837BillingProviderSpec, type Build837ClaimSpec, type Build837ContactSpec, type Build837DateSpec, type Build837DrugSpec, type Build837EntitySpec, type Build837EnvelopeSpec, type Build837HiCodeSpec, type Build837NoteSpec, type Build837OtherSubscriberSpec, type Build837PatientSpec, type Build837ReferenceSpec, type Build837ServiceLineBaseSpec, type Build837ServiceLineDentalSpec, type Build837ServiceLineInstitutionalSpec, type Build837ServiceLineProfessionalSpec, type Build837ServiceLineSpec, type Build837Spec, type Build837SubscriberInfoSpec, type Build837SubscriberSpec, type Build837ToothSpec, type Build999ElementErrorSpec, type Build999EnvelopeSpec, type Build999FunctionalGroupSpec, type Build999SegmentErrorSpec, type Build999Spec, type Build999TransactionResponseSpec, type BuildTA1Options, type BuildTA1Spec, CARC, CLAIM_837D_LOOP_2000A, CLAIM_837D_LOOP_2300, CLAIM_837D_LOOP_2400, CLAIM_837I_LOOP_2000A, CLAIM_837I_LOOP_2300, CLAIM_837I_LOOP_2400, CLAIM_837P_LOOP_2000A, CLAIM_837P_LOOP_2300, CLAIM_837P_LOOP_2400, CLAIM_837P_LOOP_2410, CLAIM_837_BUILD_ERROR_CODES, CLAIM_837_LOOP_1000A, CLAIM_837_LOOP_1000B, CLAIM_837_LOOP_2010AA, CLAIM_837_LOOP_2010BA, CLAIM_837_LOOP_2010BB, CLAIM_837_LOOP_2010CA, CLAIM_837_LOOP_2430, CLAIM_ADJUSTMENT_GROUP_CODES, CLAIM_STATUS_277_BUILD_ERROR_CODES, CLAIM_STATUS_CATEGORY_CODES, CLAIM_STATUS_CODES, CLP_STATUS, CONTROL_NUMBER_PAIRS, Claim837BuildError, type Claim837BuildErrorCode, type ClaimAdjustmentGroupCode, ClaimStatus277BuildError, type ClaimStatus277BuildErrorCode, type CodeListEntry, type CodeListMeta, type CodeListSnapshot, DELIMITER_POSITIONS, type DefineLoopSpecInput, type Delimiters, ELIGIBILITY_271_BUILD_ERROR_CODES, ELIGIBILITY_271_LOOP_2000A, ELIGIBILITY_271_LOOP_2000B, ELIGIBILITY_271_LOOP_2000C, ELIGIBILITY_271_LOOP_2000D, ELIGIBILITY_271_LOOP_2100C, ELIGIBILITY_271_LOOP_2100D, ELIGIBILITY_271_LOOP_2110, ENROLLMENT_834_BUILD_ERROR_CODES, ENROLLMENT_834_LOOP_1000A, ENROLLMENT_834_LOOP_1000B, ENROLLMENT_834_LOOP_2000, ENROLLMENT_834_LOOP_2100A, ENROLLMENT_834_LOOP_2300, ENROLLMENT_834_LOOP_2320, Eligibility271BuildError, type Eligibility271BuildErrorCode, Enrollment834BuildError, type Enrollment834BuildErrorCode, FATAL_CODES, type FunctionalGroupSpec, type GeSegment, type GsSegment, HI_QUALIFIERS, HL_LEVEL_CODES, IK3_SYNTAX_ERROR_CODES, IK4_SYNTAX_ERROR_CODES, ISA_MIN_LENGTH, type IeaSegment, type Ik304Code, type Ik403Code, type InterchangeSpec, type IsaSegment, type LoopMax, type LoopSegmentSpec, type LoopSpec, LoopSpecDefinitionError, type LoopUsage, MAINTENANCE_TYPE_CODES, NM1_QUALIFIERS, NON_SPEC_SEGMENT_ID, type OnWarningCallback, PREMIUM_820_BUILD_ERROR_CODES, PREMIUM_820_LOOP_1000A, PREMIUM_820_LOOP_1000B, PREMIUM_820_LOOP_2000A, PREMIUM_820_LOOP_2100A, PREMIUM_820_LOOP_2300A, PREMIUM_820_LOOP_2310A, Premium820BuildError, type Premium820BuildErrorCode, RARC, RELEASE_CHAR, REMIT_835_BUILD_ERROR_CODES, REMIT_835_LOOP_1000A, REMIT_835_LOOP_1000B, REMIT_835_LOOP_2000, REMIT_835_LOOP_2100, REMIT_835_LOOP_2110, REQUIRED_LOOPS, Remit835BuildError, type Remit835BuildErrorCode, SERVICE_TYPE_CODES, STATUS_277_LOOP_2000A, STATUS_277_LOOP_2000B, STATUS_277_LOOP_2000C, STATUS_277_LOOP_2000D, STATUS_277_LOOP_2000E, STATUS_277_LOOP_2200, STATUS_277_LOOP_2220, type SegmentSpec, type SerializeOptions, ServicesReview278BuildError, type ServicesReview278BuildErrorCode, TA1_ACK_CODES, TA1_NOTE_CODES, type Ta1AckCode, type Ta1NoteCode, type Ta1Segment, type TransactionSetSpec, UNEXPECTED_SEGMENT_CONTEXTS, VERSION, WARNING_CODES, type X12Ack999, type X12Ack999Ak1, type X12Ack999Ak2, type X12Ack999Ak9, type X12Ack999ElementNote, type X12Ack999Ik3, type X12Ack999Ik4, type X12Ack999Ik4Position, type X12Ack999Ik5, type X12Ack999SegmentNote, type X12Ack999TransactionResponse, type X12AckDispositionCode, type X12AckTA1, type X12AuthDate, type X12AuthDiagnosis, type X12AuthEntity, type X12AuthHeader, type X12AuthMember, type X12AuthReference, type X12AuthTrace, type X12BalanceInvariant, X12BuildError, type X12BuildErrorCode, type X12Claim, type X12Claim837Variant, type X12ClaimAddress, type X12ClaimAmount, type X12ClaimContact, type X12ClaimDate, type X12ClaimEntity, type X12ClaimHiCode, type X12ClaimMember, type X12ClaimNote, type X12ClaimReference, type X12ClaimStatus, type X12ClaimStatusResponse, type X12ControlNumberPair, type X12CoordinationOfBenefits, X12Decimal, type X12Eligibility, type X12EligibilityAddress, type X12EligibilityBenefit, type X12EligibilityDate, type X12EligibilityDependent, type X12EligibilityEntity, type X12EligibilityMember, type X12EligibilityReference, type X12EligibilityServiceType, type X12EligibilitySubscriber, type X12EligibilityTrace, type X12Enrollment, type X12EnrollmentAddress, type X12EnrollmentAmount, type X12EnrollmentDate, type X12EnrollmentHeader, type X12EnrollmentMember, type X12EnrollmentParty, type X12EnrollmentReference, type X12FatalCode, type X12FunctionalGroup, type X12HealthCoverage, type X12HiCategory, type X12HiCodeSystem, type X12HiQualifier, type X12HierarchicalLevel, type X12Hl, type X12Interchange, type X12LineAdjudication, type X12LineDrug, type X12OrphanAnchor, type X12OrphanAnchorKind, type X12OrphanSegment, type X12OtherSubscriber, X12ParseError, type X12ParseOptions, type X12ParseWarning, type X12Position, type X12PremiumAddress, type X12PremiumAdjustment, type X12PremiumDate, type X12PremiumEntity, type X12PremiumOpenItem, type X12PremiumParty, type X12PremiumPaymentHeader, type X12PremiumPayments, type X12PremiumPerson, type X12PremiumReference, type X12PremiumRemittance, type X12PremiumTrace, type X12Profile, type X12ProfileDescription, type X12ProfileEffect, X12ProfileError, type X12ProfileQuirk, type X12ProfileSpec, type X12RemitAddress, type X12RemitAdjustment, type X12RemitAmount, type X12RemitClaim, type X12RemitContact, type X12RemitParty, type X12RemitPaymentHeader, type X12RemitPerson, type X12RemitProvider, type X12RemitProviderAdjustment, type X12RemitReference, type X12RemitRemark, type X12RemitServiceLine, type X12RemitTrace, type X12Remittance, type X12RequiredLoop, type X12ReviewDecision, type X12Segment, type X12ServiceLineStatus, type X12ServiceReview, type X12ServicesReview, type X12StatusCode, type X12StatusDate, type X12StatusEntity, type X12StatusInfo, type X12StatusMember, type X12StatusReference, type X12StatusTrace, type X12SubscriberInfo, type X12ToothInformation, type X12TransactionSet, type X12UnexpectedSegmentContext, type X12WarningCode, type X12WarningPartition, type X12_837ServiceLine, type X12_837ServiceLineDental, type X12_837ServiceLineInstitutional, type X12_837ServiceLineProfessional, type X12_837Submission, X12_ACK_DISPOSITION_CODES, X12_BUILD_ERROR_CODES, build271, build277, build277CA, build278Request, build278Response, build820, build834, build835, build837D, build837I, build837P, build999, buildInterchange, buildTA1, checkClaimBalance, checkRemitTotalBalance, checkServiceLineBalance, collectElementValues, componentOptional, controlNumberMismatch, danglingReleaseChar, decodeSegment, defineLoopSpec, defineProfile, detectDelimiters, elementDecimal, elementDecimalOrZero, elementOptional, elementValue, escapeRelease, get271Eligibility, get277CADisposition, get277Status, get278Request, get278Response, get820Payments, get834Enrollments, get834Header, get835, get837Claims, getAllSegmentValues, getDefaultProfile, getSegmentValue, groupCountMismatch, hlParentLevelInvalid, hlParentMismatch, isAcceptDisposition, isClaimAdjustmentGroupCode, isDiagnosisQualifier, isProcedureQualifier, lookupCarc, lookupClaimStatus, lookupClaimStatusCategory, lookupClpStatus, lookupMaintenanceType, lookupRarc, lookupServiceType, missingGe, missingIea, missingRequiredLoop, missingSe, parse999, parseTA1, parseX12, partitionWarnings, pre005010, profiles, remitBalanceMismatch, resolveHiQualifier, segmentCountMismatch, serializeX12, setDefaultProfile, trailingGarbage, transactionCountMismatch, unescapeRelease, unexpectedSegment, unknown837Variant, unknownCarc, unknownClaimStatus, unknownClaimStatusCategory, unknownHiQualifier, unknownMaintenanceType, unknownRarc };
12994
+ export { ACK_BUILD_ERROR_CODES, ALL_WARNING_MESSAGES, AUTH_278_BUILD_ERROR_CODES, AUTH_278_LOOP_2000A, AUTH_278_LOOP_2000B, AUTH_278_LOOP_2000C, AUTH_278_LOOP_2000D, AUTH_278_LOOP_2000E, AUTH_278_LOOP_2000F, AckBuildError, type AckBuildErrorCode, BALANCE_INVARIANTS, BUILD_REFUSAL_VALUE_MAX_LENGTH, BUILD_REFUSAL_VALUE_MAX_RENDERED, type Build271AddressSpec, type Build271BenefitSpec, type Build271DateSpec, type Build271DependentSpec, type Build271EntitySpec, type Build271EnvelopeSpec, type Build271InformationReceiverSpec, type Build271InformationSourceSpec, type Build271MemberSpec, type Build271ReferenceSpec, type Build271ServiceTypeSpec, type Build271Spec, type Build271SubscriberSpec, type Build271TraceSpec, type Build277ClaimSpec, type Build277DateSpec, type Build277DependentSpec, type Build277EntitySpec, type Build277EnvelopeSpec, type Build277InformationReceiverSpec, type Build277InformationSourceSpec, type Build277MemberSpec, type Build277ProviderSpec, type Build277ReferenceSpec, type Build277ServiceLineSpec, type Build277Spec, type Build277StatusCodeSpec, type Build277StatusSpec, type Build277SubscriberSpec, type Build277TraceSpec, type Build278DateSpec, type Build278DecisionSpec, type Build278DependentSpec, type Build278DiagnosisSpec, type Build278EntitySpec, type Build278EnvelopeSpec, type Build278HeaderSpec, type Build278MemberSpec, type Build278ReferenceSpec, type Build278ReviewSpec, type Build278Spec, type Build278SubscriberSpec, type Build278TraceSpec, type Build820AddressSpec, type Build820AdjustmentSpec, type Build820DateSpec, type Build820EntitySpec, type Build820EnvelopeSpec, type Build820OpenItemSpec, type Build820PartySpec, type Build820PaymentSpec, type Build820PersonSpec, type Build820ReferenceSpec, type Build820RemittanceSpec, type Build820Spec, type Build820TraceSpec, type Build834AddressSpec, type Build834AmountSpec, type Build834CoordinationOfBenefitsSpec, type Build834CoverageSpec, type Build834DateSpec, type Build834EnvelopeSpec, type Build834HeaderSpec, type Build834MemberNameSpec, type Build834MemberSpec, type Build834PartySpec, type Build834ReferenceSpec, type Build834Spec, type Build835AddressSpec, type Build835AdjustmentSpec, type Build835AmountSpec, type Build835ClaimSpec, type Build835ContactSpec, type Build835EnvelopeSpec, type Build835PartySpec, type Build835PaymentSpec, type Build835PersonSpec, type Build835ProviderAdjustmentSpec, type Build835ProviderSpec, type Build835ReferenceSpec, type Build835RemarkSpec, type Build835ServiceLineSpec, type Build835Spec, type Build835TraceSpec, type Build837AddressSpec, type Build837AdjudicationSpec, type Build837AdjustmentSpec, type Build837AmountSpec, type Build837BillingProviderSpec, type Build837ClaimSpec, type Build837ContactSpec, type Build837DateSpec, type Build837DrugSpec, type Build837EntitySpec, type Build837EnvelopeSpec, type Build837HiCodeSpec, type Build837NoteSpec, type Build837OtherSubscriberSpec, type Build837PatientSpec, type Build837ReferenceSpec, type Build837ServiceLineBaseSpec, type Build837ServiceLineDentalSpec, type Build837ServiceLineInstitutionalSpec, type Build837ServiceLineProfessionalSpec, type Build837ServiceLineSpec, type Build837Spec, type Build837SubscriberInfoSpec, type Build837SubscriberSpec, type Build837ToothSpec, type Build999ElementErrorSpec, type Build999EnvelopeSpec, type Build999FunctionalGroupSpec, type Build999SegmentErrorSpec, type Build999Spec, type Build999TransactionResponseSpec, type BuildTA1Options, type BuildTA1Spec, CARC, CLAIM_837D_LOOP_2000A, CLAIM_837D_LOOP_2300, CLAIM_837D_LOOP_2400, CLAIM_837I_LOOP_2000A, CLAIM_837I_LOOP_2300, CLAIM_837I_LOOP_2400, CLAIM_837P_LOOP_2000A, CLAIM_837P_LOOP_2300, CLAIM_837P_LOOP_2400, CLAIM_837P_LOOP_2410, CLAIM_837_BUILD_ERROR_CODES, CLAIM_837_LOOP_1000A, CLAIM_837_LOOP_1000B, CLAIM_837_LOOP_2010AA, CLAIM_837_LOOP_2010BA, CLAIM_837_LOOP_2010BB, CLAIM_837_LOOP_2010CA, CLAIM_837_LOOP_2430, CLAIM_ADJUSTMENT_GROUP_CODES, CLAIM_STATUS_277_BUILD_ERROR_CODES, CLAIM_STATUS_CATEGORY_CODES, CLAIM_STATUS_CODES, CLP_STATUS, CONTROL_NUMBER_PAIRS, Claim837BuildError, type Claim837BuildErrorCode, type ClaimAdjustmentGroupCode, ClaimStatus277BuildError, type ClaimStatus277BuildErrorCode, type CodeListEntry, type CodeListMeta, type CodeListSnapshot, DELIMITER_POSITIONS, type DefineLoopSpecInput, type Delimiters, ELIGIBILITY_271_BUILD_ERROR_CODES, ELIGIBILITY_271_LOOP_2000A, ELIGIBILITY_271_LOOP_2000B, ELIGIBILITY_271_LOOP_2000C, ELIGIBILITY_271_LOOP_2000D, ELIGIBILITY_271_LOOP_2100C, ELIGIBILITY_271_LOOP_2100D, ELIGIBILITY_271_LOOP_2110, ENROLLMENT_834_BUILD_ERROR_CODES, ENROLLMENT_834_LOOP_1000A, ENROLLMENT_834_LOOP_1000B, ENROLLMENT_834_LOOP_2000, ENROLLMENT_834_LOOP_2100A, ENROLLMENT_834_LOOP_2300, ENROLLMENT_834_LOOP_2320, Eligibility271BuildError, type Eligibility271BuildErrorCode, Enrollment834BuildError, type Enrollment834BuildErrorCode, FATAL_CODES, type FunctionalGroupSpec, type GeSegment, type GsSegment, HI_QUALIFIERS, HL_LEVEL_CODES, IK3_SYNTAX_ERROR_CODES, IK4_SYNTAX_ERROR_CODES, ISA_MIN_LENGTH, type IeaSegment, type Ik304Code, type Ik403Code, type InterchangeSpec, type IsaSegment, type LoopMax, type LoopSegmentSpec, type LoopSpec, LoopSpecDefinitionError, type LoopUsage, MAINTENANCE_TYPE_CODES, NM1_QUALIFIERS, NON_SPEC_SEGMENT_ID, type OnWarningCallback, PREMIUM_820_BUILD_ERROR_CODES, PREMIUM_820_LOOP_1000A, PREMIUM_820_LOOP_1000B, PREMIUM_820_LOOP_2000A, PREMIUM_820_LOOP_2100A, PREMIUM_820_LOOP_2300A, PREMIUM_820_LOOP_2310A, Premium820BuildError, type Premium820BuildErrorCode, RARC, RELEASE_CHAR, REMIT_835_BUILD_ERROR_CODES, REMIT_835_LOOP_1000A, REMIT_835_LOOP_1000B, REMIT_835_LOOP_2000, REMIT_835_LOOP_2100, REMIT_835_LOOP_2110, REQUIRED_LOOPS, Remit835BuildError, type Remit835BuildErrorCode, SERVICE_TYPE_CODES, STATUS_277_LOOP_2000A, STATUS_277_LOOP_2000B, STATUS_277_LOOP_2000C, STATUS_277_LOOP_2000D, STATUS_277_LOOP_2000E, STATUS_277_LOOP_2200, STATUS_277_LOOP_2220, type SegmentSpec, type SerializeOptions, ServicesReview278BuildError, type ServicesReview278BuildErrorCode, TA1_ACK_CODES, TA1_NOTE_CODES, type Ta1AckCode, type Ta1NoteCode, type Ta1Segment, type TransactionSetSpec, UNEXPECTED_SEGMENT_CONTEXTS, VERSION, WARNING_CODES, type X12Ack999, type X12Ack999Ak1, type X12Ack999Ak2, type X12Ack999Ak9, type X12Ack999ElementNote, type X12Ack999Ik3, type X12Ack999Ik4, type X12Ack999Ik4Position, type X12Ack999Ik5, type X12Ack999SegmentNote, type X12Ack999TransactionResponse, type X12AckDispositionCode, type X12AckTA1, type X12AuthDate, type X12AuthDiagnosis, type X12AuthEntity, type X12AuthHeader, type X12AuthMember, type X12AuthReference, type X12AuthTrace, type X12BalanceInvariant, X12BuildError, type X12BuildErrorCode, type X12Claim, type X12Claim837Variant, type X12ClaimAddress, type X12ClaimAmount, type X12ClaimContact, type X12ClaimDate, type X12ClaimEntity, type X12ClaimHiCode, type X12ClaimMember, type X12ClaimNote, type X12ClaimReference, type X12ClaimStatus, type X12ClaimStatusResponse, type X12ControlNumberPair, type X12CoordinationOfBenefits, X12Decimal, type X12Eligibility, type X12EligibilityAddress, type X12EligibilityBenefit, type X12EligibilityDate, type X12EligibilityDependent, type X12EligibilityEntity, type X12EligibilityMember, type X12EligibilityReference, type X12EligibilityServiceType, type X12EligibilitySubscriber, type X12EligibilityTrace, type X12Enrollment, type X12EnrollmentAddress, type X12EnrollmentAmount, type X12EnrollmentDate, type X12EnrollmentHeader, type X12EnrollmentMember, type X12EnrollmentParty, type X12EnrollmentReference, type X12FatalCode, type X12FunctionalGroup, type X12HealthCoverage, type X12HiCategory, type X12HiCodeSystem, type X12HiQualifier, type X12HierarchicalLevel, type X12Hl, type X12Interchange, type X12LineAdjudication, type X12LineDrug, type X12OrphanAnchor, type X12OrphanAnchorKind, type X12OrphanSegment, type X12OtherSubscriber, X12ParseError, type X12ParseOptions, type X12ParseWarning, type X12Position, type X12PremiumAddress, type X12PremiumAdjustment, type X12PremiumDate, type X12PremiumEntity, type X12PremiumOpenItem, type X12PremiumParty, type X12PremiumPaymentHeader, type X12PremiumPayments, type X12PremiumPerson, type X12PremiumReference, type X12PremiumRemittance, type X12PremiumTrace, type X12Profile, type X12ProfileDescription, type X12ProfileEffect, X12ProfileError, type X12ProfileQuirk, type X12ProfileSpec, type X12RemitAddress, type X12RemitAdjustment, type X12RemitAmount, type X12RemitClaim, type X12RemitContact, type X12RemitParty, type X12RemitPaymentHeader, type X12RemitPerson, type X12RemitProvider, type X12RemitProviderAdjustment, type X12RemitReference, type X12RemitRemark, type X12RemitServiceLine, type X12RemitTrace, type X12Remittance, type X12RequiredLoop, type X12ReviewDecision, type X12Segment, type X12ServiceLineStatus, type X12ServiceReview, type X12ServicesReview, type X12StatusCode, type X12StatusDate, type X12StatusEntity, type X12StatusInfo, type X12StatusMember, type X12StatusReference, type X12StatusTrace, type X12SubscriberInfo, type X12ToothInformation, type X12TransactionSet, type X12UnexpectedSegmentContext, type X12WarningCode, type X12WarningPartition, type X12_837ServiceLine, type X12_837ServiceLineDental, type X12_837ServiceLineInstitutional, type X12_837ServiceLineProfessional, type X12_837Submission, X12_ACK_DISPOSITION_CODES, X12_BUILD_ERROR_CODES, build271, build277, build277CA, build278Request, build278Response, build820, build834, build835, build837D, build837I, build837P, build999, buildInterchange, buildTA1, checkClaimBalance, checkRemitTotalBalance, checkServiceLineBalance, collectElementValues, componentOptional, controlNumberMismatch, danglingReleaseChar, decodeSegment, defineLoopSpec, defineProfile, detectDelimiters, elementDecimal, elementDecimalOrZero, elementOptional, elementValue, escapeRelease, get271Eligibility, get277CADisposition, get277Status, get278Request, get278Response, get820Payments, get834Enrollments, get834Header, get835, get837Claims, getAllSegmentValues, getDefaultProfile, getSegmentValue, groupCountMismatch, hlParentLevelInvalid, hlParentMismatch, isAcceptDisposition, isClaimAdjustmentGroupCode, isDiagnosisQualifier, isProcedureQualifier, lookupCarc, lookupClaimStatus, lookupClaimStatusCategory, lookupClpStatus, lookupMaintenanceType, lookupRarc, lookupServiceType, missingGe, missingIea, missingRequiredLoop, missingSe, parse999, parseTA1, parseX12, partitionWarnings, pre005010, profiles, remitBalanceMismatch, renderCallerValue, resolveHiQualifier, segmentCountMismatch, serializeX12, setDefaultProfile, trailingGarbage, transactionCountMismatch, unescapeRelease, unexpectedSegment, unknown837Variant, unknownCarc, unknownClaimStatus, unknownClaimStatusCategory, unknownHiQualifier, unknownMaintenanceType, unknownRarc };
package/dist/index.d.ts CHANGED
@@ -4276,12 +4276,25 @@ declare const REMIT_835_LOOP_1000B: LoopSpec;
4276
4276
  * What the offset guarantees is non-collision across claims: a claim with
4277
4277
  * `n` service lines spans at least `n + 1` body segments, so the next CLP
4278
4278
  * always sits past the previous claim's last line position.
4279
- * - **Remit-level** ({@link checkRemitTotalBalance}): `segmentIndex` is
4280
- * **`0`**, not a CLP and not the BPR. The top-of-remit equation spans the
4281
- * whole transaction set and has no single offending segment, and there is
4282
- * at most one such warning per transaction, so it needs no locator to stay
4283
- * distinct. Read it as "this transaction set", and take the amounts from
4284
- * `remit.paymentAmount` and `remit.claims`.
4279
+ * - **Remit-level** ({@link checkRemitTotalBalance}): `segmentIndex` is the
4280
+ * **BPR's** own 1-based body index, so `tx.segments[position.segmentIndex]`
4281
+ * is that exact BPR. The equation spans the whole transaction set, so no
4282
+ * single segment is uniquely "at fault" - but BPR-02 is the one element the
4283
+ * invariant compares against, and the BPR is the only segment a reader can
4284
+ * act on. `get835` was passing a literal `0` here, and `0` is not a neutral
4285
+ * sentinel: `tx.segments[0]` is the ST, so a consumer resolving the position
4286
+ * landed on the ST. The one remaining `0` is the transaction that carries no
4287
+ * BPR at all (malformed - TR3 005010X221A1 makes BPR mandatory - but
4288
+ * reachable, since the check still runs against an all-zero payment header).
4289
+ * Take the amounts from `remit.payment.totalActualPayment` and
4290
+ * `remit.claims`; the message names the equation and carries no value.
4291
+ *
4292
+ * **A caller that constructs the position itself gets whatever it passes.**
4293
+ * These three functions are exported, and they do not derive a position - they
4294
+ * forward one. `build835` exploits that: it hands in a synthetic position
4295
+ * because it has no parsed segment stream to index into, and it uses only
4296
+ * `.message`, which is a registry lookup keyed by the invariant and therefore
4297
+ * position-independent.
4285
4298
  */
4286
4299
 
4287
4300
  /**
@@ -12514,6 +12527,124 @@ interface InterchangeSpec {
12514
12527
  */
12515
12528
  declare function buildInterchange(spec: InterchangeSpec): X12Interchange;
12516
12529
 
12530
+ /**
12531
+ * The single route a caller-supplied value takes into a `build*` refusal
12532
+ * message.
12533
+ *
12534
+ * ## Why this exists
12535
+ *
12536
+ * The parse side closed its equivalent hole first: no warning factory takes a
12537
+ * value parameter at all, and `message` is a lookup into the frozen
12538
+ * `ALL_WARNING_MESSAGES` table, so a *document's* bytes cannot reach a
12539
+ * diagnostic (`PHI-WARNING-MESSAGE-LEAK`). The builder side is the mirror
12540
+ * image with one material asymmetry, and the claim made here is deliberately
12541
+ * narrower because of it:
12542
+ *
12543
+ * > **A builder refusal echoes a value the CALLER passed in, which is usually
12544
+ * > but NOT ALWAYS their own.** They just handed it to the builder, so bounding
12545
+ * > it is **robustness and log hygiene, not redaction**. This module does not
12546
+ * > make a builder refusal PHI-safe, and nothing in this library claims it
12547
+ * > does. If a caller puts PHI in a control number, the refusal will show up
12548
+ * > to {@link BUILD_REFUSAL_VALUE_MAX_LENGTH} characters of it.
12549
+ *
12550
+ * **Do not state that dichotomy categorically, because the ack builders break
12551
+ * it.** `build999` renders the AK2-02 transaction-set control number and
12552
+ * `buildTA1` exists to echo an inbound ISA-13: TR3 005010X231A1 requires AK2-02
12553
+ * to be a verbatim copy of the acknowledged transaction set's ST-02, so on the
12554
+ * ack path a *document's* bytes reach the spec by the standard's own design,
12555
+ * and from there a refusal message. They are envelope control numbers rather
12556
+ * than clinical content, and they are bounded here like everything else - but
12557
+ * "the value is always the caller's own" is false, and this library should not
12558
+ * say it.
12559
+ *
12560
+ * What it does guarantee is that `Error.message` from a `build*` refusal has a
12561
+ * **fixed ceiling**. Before this, **twenty-three** refusal sites across ten builder
12562
+ * modules interpolated a caller value verbatim, so a 120,000-character control
12563
+ * number produced a 120,066-**character** `X12BuildError.message` - measured on
12564
+ * this tree, and the length grew without limit with the input. An unbounded
12565
+ * `Error.message` is a real operational hazard independent of PHI: it is what
12566
+ * gets serialized into a log line, a crash report, or a JSON error envelope.
12567
+ *
12568
+ * ## What is bounded and what is not
12569
+ *
12570
+ * - **Bounded:** the number of UTF-16 code units. The rendered fragment never
12571
+ * exceeds {@link BUILD_REFUSAL_VALUE_MAX_RENDERED}. **Code units, not bytes** -
12572
+ * an all-astral value renders 86 units but 152 UTF-8 bytes, and a CJK one
12573
+ * around 216. Every figure this package publishes says "characters" for that
12574
+ * reason. A slice at the bound can also split a surrogate pair, leaving a lone
12575
+ * surrogate that becomes U+FFFD once the message is UTF-8 encoded; the bound
12576
+ * holds regardless, and the fragment is diagnostic text, not data.
12577
+ * - **NOT escaped, and this is not an oversight.** The surviving characters are
12578
+ * whatever the caller supplied, including a segment terminator, a quote, or a
12579
+ * newline. A refusal message is therefore bounded but not guaranteed to be a
12580
+ * single log line. Escaping was considered and left out: it would expand the
12581
+ * rendered length by up to 6x per character for a hazard the caller creates
12582
+ * in their own data, and this slice makes the claim it can support and no
12583
+ * wider.
12584
+ *
12585
+ * @see `src/parser/errors.ts` for the parse-side `SNIPPET_MAX_INPUT` bound this
12586
+ * mirrors, which is the one deliberate place a *document's* bytes are copied.
12587
+ */
12588
+ /**
12589
+ * How many characters of a caller-supplied value survive into a `build*`
12590
+ * refusal message. Set to mirror the parser's own `SNIPPET_MAX_INPUT` (63),
12591
+ * so the two bounded copies in this library agree rather than each picking a
12592
+ * number. Comfortably wider than every slot it guards: an ISA-13 / IEA-02
12593
+ * control number is 9, a TA1-05 note code 3, an ST-01 transaction set id 3, an
12594
+ * 834 maintenance type 2-3, an 837 service-line variant 1.
12595
+ *
12596
+ * @example
12597
+ * ```ts
12598
+ * import { BUILD_REFUSAL_VALUE_MAX_LENGTH } from "@cosyte/x12";
12599
+ * BUILD_REFUSAL_VALUE_MAX_LENGTH; // 63
12600
+ * ```
12601
+ */
12602
+ declare const BUILD_REFUSAL_VALUE_MAX_LENGTH = 63;
12603
+ /**
12604
+ * Hard ceiling, in characters, on the fragment {@link renderCallerValue}
12605
+ * returns: {@link BUILD_REFUSAL_VALUE_MAX_LENGTH} surviving characters, two
12606
+ * quotes, one ellipsis, and the ` (N characters)` suffix at its widest.
12607
+ *
12608
+ * **This is the bound on the FRAGMENT, not on the message.** A refusal message
12609
+ * is this plus the site's own fixed template text, which differs per site, so
12610
+ * the message is bounded by a constant but not by *this* constant. Measured on
12611
+ * this tree: a 120,000-character control number gives an 86-character fragment
12612
+ * and a **150-character** `X12BuildError.message` from `buildInterchange`. Do
12613
+ * not quote the ceiling as though it were a message length - an earlier
12614
+ * revision of the docs did exactly that, reporting "now 90 bytes" for a message
12615
+ * that is 150. The suite asserts the fragment against this constant and each
12616
+ * message against its own site.
12617
+ *
12618
+ * @example
12619
+ * ```ts
12620
+ * import { BUILD_REFUSAL_VALUE_MAX_RENDERED } from "@cosyte/x12";
12621
+ * BUILD_REFUSAL_VALUE_MAX_RENDERED; // 90
12622
+ * ```
12623
+ */
12624
+ declare const BUILD_REFUSAL_VALUE_MAX_RENDERED: number;
12625
+ /**
12626
+ * Render a caller-supplied value as a bounded, quoted fragment for a `build*`
12627
+ * refusal message. **This is the only sanctioned route a caller value takes
12628
+ * into a thrown message**, and `test/builder-refusal-bounds.test.ts` scans
12629
+ * `src/` for any other route - a twenty-fourth refusal site that interpolates a
12630
+ * value directly reds that test. That scan keys on `throw new *BuildError(` and
12631
+ * on template-literal holes, so it is a strong tripwire for the shape this
12632
+ * library uses rather than a proof over every shape one could write.
12633
+ *
12634
+ * Returns the value quoted when it fits, and otherwise the first
12635
+ * {@link BUILD_REFUSAL_VALUE_MAX_LENGTH} characters, an ellipsis, and the true
12636
+ * length - the length is the diagnostically useful part when the value is
12637
+ * over-long, since that is usually *why* the builder refused.
12638
+ *
12639
+ * @example
12640
+ * ```ts
12641
+ * import { renderCallerValue } from "@cosyte/x12";
12642
+ * renderCallerValue("000000001"); // '"000000001"'
12643
+ * renderCallerValue("9".repeat(120000)); // '"999…" (120000 characters)'
12644
+ * ```
12645
+ */
12646
+ declare function renderCallerValue(value: string | number): string;
12647
+
12517
12648
  /**
12518
12649
  * Thrown errors emitted by the general-purpose interchange builder
12519
12650
  * (`buildInterchange`). Distinct from `X12ParseError` (the parser stays
@@ -12860,4 +12991,4 @@ declare const profiles: {
12860
12991
  */
12861
12992
  declare const VERSION: string;
12862
12993
 
12863
- export { ACK_BUILD_ERROR_CODES, ALL_WARNING_MESSAGES, AUTH_278_BUILD_ERROR_CODES, AUTH_278_LOOP_2000A, AUTH_278_LOOP_2000B, AUTH_278_LOOP_2000C, AUTH_278_LOOP_2000D, AUTH_278_LOOP_2000E, AUTH_278_LOOP_2000F, AckBuildError, type AckBuildErrorCode, BALANCE_INVARIANTS, type Build271AddressSpec, type Build271BenefitSpec, type Build271DateSpec, type Build271DependentSpec, type Build271EntitySpec, type Build271EnvelopeSpec, type Build271InformationReceiverSpec, type Build271InformationSourceSpec, type Build271MemberSpec, type Build271ReferenceSpec, type Build271ServiceTypeSpec, type Build271Spec, type Build271SubscriberSpec, type Build271TraceSpec, type Build277ClaimSpec, type Build277DateSpec, type Build277DependentSpec, type Build277EntitySpec, type Build277EnvelopeSpec, type Build277InformationReceiverSpec, type Build277InformationSourceSpec, type Build277MemberSpec, type Build277ProviderSpec, type Build277ReferenceSpec, type Build277ServiceLineSpec, type Build277Spec, type Build277StatusCodeSpec, type Build277StatusSpec, type Build277SubscriberSpec, type Build277TraceSpec, type Build278DateSpec, type Build278DecisionSpec, type Build278DependentSpec, type Build278DiagnosisSpec, type Build278EntitySpec, type Build278EnvelopeSpec, type Build278HeaderSpec, type Build278MemberSpec, type Build278ReferenceSpec, type Build278ReviewSpec, type Build278Spec, type Build278SubscriberSpec, type Build278TraceSpec, type Build820AddressSpec, type Build820AdjustmentSpec, type Build820DateSpec, type Build820EntitySpec, type Build820EnvelopeSpec, type Build820OpenItemSpec, type Build820PartySpec, type Build820PaymentSpec, type Build820PersonSpec, type Build820ReferenceSpec, type Build820RemittanceSpec, type Build820Spec, type Build820TraceSpec, type Build834AddressSpec, type Build834AmountSpec, type Build834CoordinationOfBenefitsSpec, type Build834CoverageSpec, type Build834DateSpec, type Build834EnvelopeSpec, type Build834HeaderSpec, type Build834MemberNameSpec, type Build834MemberSpec, type Build834PartySpec, type Build834ReferenceSpec, type Build834Spec, type Build835AddressSpec, type Build835AdjustmentSpec, type Build835AmountSpec, type Build835ClaimSpec, type Build835ContactSpec, type Build835EnvelopeSpec, type Build835PartySpec, type Build835PaymentSpec, type Build835PersonSpec, type Build835ProviderAdjustmentSpec, type Build835ProviderSpec, type Build835ReferenceSpec, type Build835RemarkSpec, type Build835ServiceLineSpec, type Build835Spec, type Build835TraceSpec, type Build837AddressSpec, type Build837AdjudicationSpec, type Build837AdjustmentSpec, type Build837AmountSpec, type Build837BillingProviderSpec, type Build837ClaimSpec, type Build837ContactSpec, type Build837DateSpec, type Build837DrugSpec, type Build837EntitySpec, type Build837EnvelopeSpec, type Build837HiCodeSpec, type Build837NoteSpec, type Build837OtherSubscriberSpec, type Build837PatientSpec, type Build837ReferenceSpec, type Build837ServiceLineBaseSpec, type Build837ServiceLineDentalSpec, type Build837ServiceLineInstitutionalSpec, type Build837ServiceLineProfessionalSpec, type Build837ServiceLineSpec, type Build837Spec, type Build837SubscriberInfoSpec, type Build837SubscriberSpec, type Build837ToothSpec, type Build999ElementErrorSpec, type Build999EnvelopeSpec, type Build999FunctionalGroupSpec, type Build999SegmentErrorSpec, type Build999Spec, type Build999TransactionResponseSpec, type BuildTA1Options, type BuildTA1Spec, CARC, CLAIM_837D_LOOP_2000A, CLAIM_837D_LOOP_2300, CLAIM_837D_LOOP_2400, CLAIM_837I_LOOP_2000A, CLAIM_837I_LOOP_2300, CLAIM_837I_LOOP_2400, CLAIM_837P_LOOP_2000A, CLAIM_837P_LOOP_2300, CLAIM_837P_LOOP_2400, CLAIM_837P_LOOP_2410, CLAIM_837_BUILD_ERROR_CODES, CLAIM_837_LOOP_1000A, CLAIM_837_LOOP_1000B, CLAIM_837_LOOP_2010AA, CLAIM_837_LOOP_2010BA, CLAIM_837_LOOP_2010BB, CLAIM_837_LOOP_2010CA, CLAIM_837_LOOP_2430, CLAIM_ADJUSTMENT_GROUP_CODES, CLAIM_STATUS_277_BUILD_ERROR_CODES, CLAIM_STATUS_CATEGORY_CODES, CLAIM_STATUS_CODES, CLP_STATUS, CONTROL_NUMBER_PAIRS, Claim837BuildError, type Claim837BuildErrorCode, type ClaimAdjustmentGroupCode, ClaimStatus277BuildError, type ClaimStatus277BuildErrorCode, type CodeListEntry, type CodeListMeta, type CodeListSnapshot, DELIMITER_POSITIONS, type DefineLoopSpecInput, type Delimiters, ELIGIBILITY_271_BUILD_ERROR_CODES, ELIGIBILITY_271_LOOP_2000A, ELIGIBILITY_271_LOOP_2000B, ELIGIBILITY_271_LOOP_2000C, ELIGIBILITY_271_LOOP_2000D, ELIGIBILITY_271_LOOP_2100C, ELIGIBILITY_271_LOOP_2100D, ELIGIBILITY_271_LOOP_2110, ENROLLMENT_834_BUILD_ERROR_CODES, ENROLLMENT_834_LOOP_1000A, ENROLLMENT_834_LOOP_1000B, ENROLLMENT_834_LOOP_2000, ENROLLMENT_834_LOOP_2100A, ENROLLMENT_834_LOOP_2300, ENROLLMENT_834_LOOP_2320, Eligibility271BuildError, type Eligibility271BuildErrorCode, Enrollment834BuildError, type Enrollment834BuildErrorCode, FATAL_CODES, type FunctionalGroupSpec, type GeSegment, type GsSegment, HI_QUALIFIERS, HL_LEVEL_CODES, IK3_SYNTAX_ERROR_CODES, IK4_SYNTAX_ERROR_CODES, ISA_MIN_LENGTH, type IeaSegment, type Ik304Code, type Ik403Code, type InterchangeSpec, type IsaSegment, type LoopMax, type LoopSegmentSpec, type LoopSpec, LoopSpecDefinitionError, type LoopUsage, MAINTENANCE_TYPE_CODES, NM1_QUALIFIERS, NON_SPEC_SEGMENT_ID, type OnWarningCallback, PREMIUM_820_BUILD_ERROR_CODES, PREMIUM_820_LOOP_1000A, PREMIUM_820_LOOP_1000B, PREMIUM_820_LOOP_2000A, PREMIUM_820_LOOP_2100A, PREMIUM_820_LOOP_2300A, PREMIUM_820_LOOP_2310A, Premium820BuildError, type Premium820BuildErrorCode, RARC, RELEASE_CHAR, REMIT_835_BUILD_ERROR_CODES, REMIT_835_LOOP_1000A, REMIT_835_LOOP_1000B, REMIT_835_LOOP_2000, REMIT_835_LOOP_2100, REMIT_835_LOOP_2110, REQUIRED_LOOPS, Remit835BuildError, type Remit835BuildErrorCode, SERVICE_TYPE_CODES, STATUS_277_LOOP_2000A, STATUS_277_LOOP_2000B, STATUS_277_LOOP_2000C, STATUS_277_LOOP_2000D, STATUS_277_LOOP_2000E, STATUS_277_LOOP_2200, STATUS_277_LOOP_2220, type SegmentSpec, type SerializeOptions, ServicesReview278BuildError, type ServicesReview278BuildErrorCode, TA1_ACK_CODES, TA1_NOTE_CODES, type Ta1AckCode, type Ta1NoteCode, type Ta1Segment, type TransactionSetSpec, UNEXPECTED_SEGMENT_CONTEXTS, VERSION, WARNING_CODES, type X12Ack999, type X12Ack999Ak1, type X12Ack999Ak2, type X12Ack999Ak9, type X12Ack999ElementNote, type X12Ack999Ik3, type X12Ack999Ik4, type X12Ack999Ik4Position, type X12Ack999Ik5, type X12Ack999SegmentNote, type X12Ack999TransactionResponse, type X12AckDispositionCode, type X12AckTA1, type X12AuthDate, type X12AuthDiagnosis, type X12AuthEntity, type X12AuthHeader, type X12AuthMember, type X12AuthReference, type X12AuthTrace, type X12BalanceInvariant, X12BuildError, type X12BuildErrorCode, type X12Claim, type X12Claim837Variant, type X12ClaimAddress, type X12ClaimAmount, type X12ClaimContact, type X12ClaimDate, type X12ClaimEntity, type X12ClaimHiCode, type X12ClaimMember, type X12ClaimNote, type X12ClaimReference, type X12ClaimStatus, type X12ClaimStatusResponse, type X12ControlNumberPair, type X12CoordinationOfBenefits, X12Decimal, type X12Eligibility, type X12EligibilityAddress, type X12EligibilityBenefit, type X12EligibilityDate, type X12EligibilityDependent, type X12EligibilityEntity, type X12EligibilityMember, type X12EligibilityReference, type X12EligibilityServiceType, type X12EligibilitySubscriber, type X12EligibilityTrace, type X12Enrollment, type X12EnrollmentAddress, type X12EnrollmentAmount, type X12EnrollmentDate, type X12EnrollmentHeader, type X12EnrollmentMember, type X12EnrollmentParty, type X12EnrollmentReference, type X12FatalCode, type X12FunctionalGroup, type X12HealthCoverage, type X12HiCategory, type X12HiCodeSystem, type X12HiQualifier, type X12HierarchicalLevel, type X12Hl, type X12Interchange, type X12LineAdjudication, type X12LineDrug, type X12OrphanAnchor, type X12OrphanAnchorKind, type X12OrphanSegment, type X12OtherSubscriber, X12ParseError, type X12ParseOptions, type X12ParseWarning, type X12Position, type X12PremiumAddress, type X12PremiumAdjustment, type X12PremiumDate, type X12PremiumEntity, type X12PremiumOpenItem, type X12PremiumParty, type X12PremiumPaymentHeader, type X12PremiumPayments, type X12PremiumPerson, type X12PremiumReference, type X12PremiumRemittance, type X12PremiumTrace, type X12Profile, type X12ProfileDescription, type X12ProfileEffect, X12ProfileError, type X12ProfileQuirk, type X12ProfileSpec, type X12RemitAddress, type X12RemitAdjustment, type X12RemitAmount, type X12RemitClaim, type X12RemitContact, type X12RemitParty, type X12RemitPaymentHeader, type X12RemitPerson, type X12RemitProvider, type X12RemitProviderAdjustment, type X12RemitReference, type X12RemitRemark, type X12RemitServiceLine, type X12RemitTrace, type X12Remittance, type X12RequiredLoop, type X12ReviewDecision, type X12Segment, type X12ServiceLineStatus, type X12ServiceReview, type X12ServicesReview, type X12StatusCode, type X12StatusDate, type X12StatusEntity, type X12StatusInfo, type X12StatusMember, type X12StatusReference, type X12StatusTrace, type X12SubscriberInfo, type X12ToothInformation, type X12TransactionSet, type X12UnexpectedSegmentContext, type X12WarningCode, type X12WarningPartition, type X12_837ServiceLine, type X12_837ServiceLineDental, type X12_837ServiceLineInstitutional, type X12_837ServiceLineProfessional, type X12_837Submission, X12_ACK_DISPOSITION_CODES, X12_BUILD_ERROR_CODES, build271, build277, build277CA, build278Request, build278Response, build820, build834, build835, build837D, build837I, build837P, build999, buildInterchange, buildTA1, checkClaimBalance, checkRemitTotalBalance, checkServiceLineBalance, collectElementValues, componentOptional, controlNumberMismatch, danglingReleaseChar, decodeSegment, defineLoopSpec, defineProfile, detectDelimiters, elementDecimal, elementDecimalOrZero, elementOptional, elementValue, escapeRelease, get271Eligibility, get277CADisposition, get277Status, get278Request, get278Response, get820Payments, get834Enrollments, get834Header, get835, get837Claims, getAllSegmentValues, getDefaultProfile, getSegmentValue, groupCountMismatch, hlParentLevelInvalid, hlParentMismatch, isAcceptDisposition, isClaimAdjustmentGroupCode, isDiagnosisQualifier, isProcedureQualifier, lookupCarc, lookupClaimStatus, lookupClaimStatusCategory, lookupClpStatus, lookupMaintenanceType, lookupRarc, lookupServiceType, missingGe, missingIea, missingRequiredLoop, missingSe, parse999, parseTA1, parseX12, partitionWarnings, pre005010, profiles, remitBalanceMismatch, resolveHiQualifier, segmentCountMismatch, serializeX12, setDefaultProfile, trailingGarbage, transactionCountMismatch, unescapeRelease, unexpectedSegment, unknown837Variant, unknownCarc, unknownClaimStatus, unknownClaimStatusCategory, unknownHiQualifier, unknownMaintenanceType, unknownRarc };
12994
+ export { ACK_BUILD_ERROR_CODES, ALL_WARNING_MESSAGES, AUTH_278_BUILD_ERROR_CODES, AUTH_278_LOOP_2000A, AUTH_278_LOOP_2000B, AUTH_278_LOOP_2000C, AUTH_278_LOOP_2000D, AUTH_278_LOOP_2000E, AUTH_278_LOOP_2000F, AckBuildError, type AckBuildErrorCode, BALANCE_INVARIANTS, BUILD_REFUSAL_VALUE_MAX_LENGTH, BUILD_REFUSAL_VALUE_MAX_RENDERED, type Build271AddressSpec, type Build271BenefitSpec, type Build271DateSpec, type Build271DependentSpec, type Build271EntitySpec, type Build271EnvelopeSpec, type Build271InformationReceiverSpec, type Build271InformationSourceSpec, type Build271MemberSpec, type Build271ReferenceSpec, type Build271ServiceTypeSpec, type Build271Spec, type Build271SubscriberSpec, type Build271TraceSpec, type Build277ClaimSpec, type Build277DateSpec, type Build277DependentSpec, type Build277EntitySpec, type Build277EnvelopeSpec, type Build277InformationReceiverSpec, type Build277InformationSourceSpec, type Build277MemberSpec, type Build277ProviderSpec, type Build277ReferenceSpec, type Build277ServiceLineSpec, type Build277Spec, type Build277StatusCodeSpec, type Build277StatusSpec, type Build277SubscriberSpec, type Build277TraceSpec, type Build278DateSpec, type Build278DecisionSpec, type Build278DependentSpec, type Build278DiagnosisSpec, type Build278EntitySpec, type Build278EnvelopeSpec, type Build278HeaderSpec, type Build278MemberSpec, type Build278ReferenceSpec, type Build278ReviewSpec, type Build278Spec, type Build278SubscriberSpec, type Build278TraceSpec, type Build820AddressSpec, type Build820AdjustmentSpec, type Build820DateSpec, type Build820EntitySpec, type Build820EnvelopeSpec, type Build820OpenItemSpec, type Build820PartySpec, type Build820PaymentSpec, type Build820PersonSpec, type Build820ReferenceSpec, type Build820RemittanceSpec, type Build820Spec, type Build820TraceSpec, type Build834AddressSpec, type Build834AmountSpec, type Build834CoordinationOfBenefitsSpec, type Build834CoverageSpec, type Build834DateSpec, type Build834EnvelopeSpec, type Build834HeaderSpec, type Build834MemberNameSpec, type Build834MemberSpec, type Build834PartySpec, type Build834ReferenceSpec, type Build834Spec, type Build835AddressSpec, type Build835AdjustmentSpec, type Build835AmountSpec, type Build835ClaimSpec, type Build835ContactSpec, type Build835EnvelopeSpec, type Build835PartySpec, type Build835PaymentSpec, type Build835PersonSpec, type Build835ProviderAdjustmentSpec, type Build835ProviderSpec, type Build835ReferenceSpec, type Build835RemarkSpec, type Build835ServiceLineSpec, type Build835Spec, type Build835TraceSpec, type Build837AddressSpec, type Build837AdjudicationSpec, type Build837AdjustmentSpec, type Build837AmountSpec, type Build837BillingProviderSpec, type Build837ClaimSpec, type Build837ContactSpec, type Build837DateSpec, type Build837DrugSpec, type Build837EntitySpec, type Build837EnvelopeSpec, type Build837HiCodeSpec, type Build837NoteSpec, type Build837OtherSubscriberSpec, type Build837PatientSpec, type Build837ReferenceSpec, type Build837ServiceLineBaseSpec, type Build837ServiceLineDentalSpec, type Build837ServiceLineInstitutionalSpec, type Build837ServiceLineProfessionalSpec, type Build837ServiceLineSpec, type Build837Spec, type Build837SubscriberInfoSpec, type Build837SubscriberSpec, type Build837ToothSpec, type Build999ElementErrorSpec, type Build999EnvelopeSpec, type Build999FunctionalGroupSpec, type Build999SegmentErrorSpec, type Build999Spec, type Build999TransactionResponseSpec, type BuildTA1Options, type BuildTA1Spec, CARC, CLAIM_837D_LOOP_2000A, CLAIM_837D_LOOP_2300, CLAIM_837D_LOOP_2400, CLAIM_837I_LOOP_2000A, CLAIM_837I_LOOP_2300, CLAIM_837I_LOOP_2400, CLAIM_837P_LOOP_2000A, CLAIM_837P_LOOP_2300, CLAIM_837P_LOOP_2400, CLAIM_837P_LOOP_2410, CLAIM_837_BUILD_ERROR_CODES, CLAIM_837_LOOP_1000A, CLAIM_837_LOOP_1000B, CLAIM_837_LOOP_2010AA, CLAIM_837_LOOP_2010BA, CLAIM_837_LOOP_2010BB, CLAIM_837_LOOP_2010CA, CLAIM_837_LOOP_2430, CLAIM_ADJUSTMENT_GROUP_CODES, CLAIM_STATUS_277_BUILD_ERROR_CODES, CLAIM_STATUS_CATEGORY_CODES, CLAIM_STATUS_CODES, CLP_STATUS, CONTROL_NUMBER_PAIRS, Claim837BuildError, type Claim837BuildErrorCode, type ClaimAdjustmentGroupCode, ClaimStatus277BuildError, type ClaimStatus277BuildErrorCode, type CodeListEntry, type CodeListMeta, type CodeListSnapshot, DELIMITER_POSITIONS, type DefineLoopSpecInput, type Delimiters, ELIGIBILITY_271_BUILD_ERROR_CODES, ELIGIBILITY_271_LOOP_2000A, ELIGIBILITY_271_LOOP_2000B, ELIGIBILITY_271_LOOP_2000C, ELIGIBILITY_271_LOOP_2000D, ELIGIBILITY_271_LOOP_2100C, ELIGIBILITY_271_LOOP_2100D, ELIGIBILITY_271_LOOP_2110, ENROLLMENT_834_BUILD_ERROR_CODES, ENROLLMENT_834_LOOP_1000A, ENROLLMENT_834_LOOP_1000B, ENROLLMENT_834_LOOP_2000, ENROLLMENT_834_LOOP_2100A, ENROLLMENT_834_LOOP_2300, ENROLLMENT_834_LOOP_2320, Eligibility271BuildError, type Eligibility271BuildErrorCode, Enrollment834BuildError, type Enrollment834BuildErrorCode, FATAL_CODES, type FunctionalGroupSpec, type GeSegment, type GsSegment, HI_QUALIFIERS, HL_LEVEL_CODES, IK3_SYNTAX_ERROR_CODES, IK4_SYNTAX_ERROR_CODES, ISA_MIN_LENGTH, type IeaSegment, type Ik304Code, type Ik403Code, type InterchangeSpec, type IsaSegment, type LoopMax, type LoopSegmentSpec, type LoopSpec, LoopSpecDefinitionError, type LoopUsage, MAINTENANCE_TYPE_CODES, NM1_QUALIFIERS, NON_SPEC_SEGMENT_ID, type OnWarningCallback, PREMIUM_820_BUILD_ERROR_CODES, PREMIUM_820_LOOP_1000A, PREMIUM_820_LOOP_1000B, PREMIUM_820_LOOP_2000A, PREMIUM_820_LOOP_2100A, PREMIUM_820_LOOP_2300A, PREMIUM_820_LOOP_2310A, Premium820BuildError, type Premium820BuildErrorCode, RARC, RELEASE_CHAR, REMIT_835_BUILD_ERROR_CODES, REMIT_835_LOOP_1000A, REMIT_835_LOOP_1000B, REMIT_835_LOOP_2000, REMIT_835_LOOP_2100, REMIT_835_LOOP_2110, REQUIRED_LOOPS, Remit835BuildError, type Remit835BuildErrorCode, SERVICE_TYPE_CODES, STATUS_277_LOOP_2000A, STATUS_277_LOOP_2000B, STATUS_277_LOOP_2000C, STATUS_277_LOOP_2000D, STATUS_277_LOOP_2000E, STATUS_277_LOOP_2200, STATUS_277_LOOP_2220, type SegmentSpec, type SerializeOptions, ServicesReview278BuildError, type ServicesReview278BuildErrorCode, TA1_ACK_CODES, TA1_NOTE_CODES, type Ta1AckCode, type Ta1NoteCode, type Ta1Segment, type TransactionSetSpec, UNEXPECTED_SEGMENT_CONTEXTS, VERSION, WARNING_CODES, type X12Ack999, type X12Ack999Ak1, type X12Ack999Ak2, type X12Ack999Ak9, type X12Ack999ElementNote, type X12Ack999Ik3, type X12Ack999Ik4, type X12Ack999Ik4Position, type X12Ack999Ik5, type X12Ack999SegmentNote, type X12Ack999TransactionResponse, type X12AckDispositionCode, type X12AckTA1, type X12AuthDate, type X12AuthDiagnosis, type X12AuthEntity, type X12AuthHeader, type X12AuthMember, type X12AuthReference, type X12AuthTrace, type X12BalanceInvariant, X12BuildError, type X12BuildErrorCode, type X12Claim, type X12Claim837Variant, type X12ClaimAddress, type X12ClaimAmount, type X12ClaimContact, type X12ClaimDate, type X12ClaimEntity, type X12ClaimHiCode, type X12ClaimMember, type X12ClaimNote, type X12ClaimReference, type X12ClaimStatus, type X12ClaimStatusResponse, type X12ControlNumberPair, type X12CoordinationOfBenefits, X12Decimal, type X12Eligibility, type X12EligibilityAddress, type X12EligibilityBenefit, type X12EligibilityDate, type X12EligibilityDependent, type X12EligibilityEntity, type X12EligibilityMember, type X12EligibilityReference, type X12EligibilityServiceType, type X12EligibilitySubscriber, type X12EligibilityTrace, type X12Enrollment, type X12EnrollmentAddress, type X12EnrollmentAmount, type X12EnrollmentDate, type X12EnrollmentHeader, type X12EnrollmentMember, type X12EnrollmentParty, type X12EnrollmentReference, type X12FatalCode, type X12FunctionalGroup, type X12HealthCoverage, type X12HiCategory, type X12HiCodeSystem, type X12HiQualifier, type X12HierarchicalLevel, type X12Hl, type X12Interchange, type X12LineAdjudication, type X12LineDrug, type X12OrphanAnchor, type X12OrphanAnchorKind, type X12OrphanSegment, type X12OtherSubscriber, X12ParseError, type X12ParseOptions, type X12ParseWarning, type X12Position, type X12PremiumAddress, type X12PremiumAdjustment, type X12PremiumDate, type X12PremiumEntity, type X12PremiumOpenItem, type X12PremiumParty, type X12PremiumPaymentHeader, type X12PremiumPayments, type X12PremiumPerson, type X12PremiumReference, type X12PremiumRemittance, type X12PremiumTrace, type X12Profile, type X12ProfileDescription, type X12ProfileEffect, X12ProfileError, type X12ProfileQuirk, type X12ProfileSpec, type X12RemitAddress, type X12RemitAdjustment, type X12RemitAmount, type X12RemitClaim, type X12RemitContact, type X12RemitParty, type X12RemitPaymentHeader, type X12RemitPerson, type X12RemitProvider, type X12RemitProviderAdjustment, type X12RemitReference, type X12RemitRemark, type X12RemitServiceLine, type X12RemitTrace, type X12Remittance, type X12RequiredLoop, type X12ReviewDecision, type X12Segment, type X12ServiceLineStatus, type X12ServiceReview, type X12ServicesReview, type X12StatusCode, type X12StatusDate, type X12StatusEntity, type X12StatusInfo, type X12StatusMember, type X12StatusReference, type X12StatusTrace, type X12SubscriberInfo, type X12ToothInformation, type X12TransactionSet, type X12UnexpectedSegmentContext, type X12WarningCode, type X12WarningPartition, type X12_837ServiceLine, type X12_837ServiceLineDental, type X12_837ServiceLineInstitutional, type X12_837ServiceLineProfessional, type X12_837Submission, X12_ACK_DISPOSITION_CODES, X12_BUILD_ERROR_CODES, build271, build277, build277CA, build278Request, build278Response, build820, build834, build835, build837D, build837I, build837P, build999, buildInterchange, buildTA1, checkClaimBalance, checkRemitTotalBalance, checkServiceLineBalance, collectElementValues, componentOptional, controlNumberMismatch, danglingReleaseChar, decodeSegment, defineLoopSpec, defineProfile, detectDelimiters, elementDecimal, elementDecimalOrZero, elementOptional, elementValue, escapeRelease, get271Eligibility, get277CADisposition, get277Status, get278Request, get278Response, get820Payments, get834Enrollments, get834Header, get835, get837Claims, getAllSegmentValues, getDefaultProfile, getSegmentValue, groupCountMismatch, hlParentLevelInvalid, hlParentMismatch, isAcceptDisposition, isClaimAdjustmentGroupCode, isDiagnosisQualifier, isProcedureQualifier, lookupCarc, lookupClaimStatus, lookupClaimStatusCategory, lookupClpStatus, lookupMaintenanceType, lookupRarc, lookupServiceType, missingGe, missingIea, missingRequiredLoop, missingSe, parse999, parseTA1, parseX12, partitionWarnings, pre005010, profiles, remitBalanceMismatch, renderCallerValue, resolveHiQualifier, segmentCountMismatch, serializeX12, setDefaultProfile, trailingGarbage, transactionCountMismatch, unescapeRelease, unexpectedSegment, unknown837Variant, unknownCarc, unknownClaimStatus, unknownClaimStatusCategory, unknownHiQualifier, unknownMaintenanceType, unknownRarc };