@cosyte/x12 0.1.2 → 0.1.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/dist/index.d.cts CHANGED
@@ -1979,8 +1979,9 @@ interface X12ProfileSpec {
1979
1979
  * an 835 claim, a dropped decimal is the wrong dollar amount in someone's
1980
1980
  * cash post. `X12Decimal` preserves the inbound lexical form verbatim for
1981
1981
  * byte-exact round-trip and exposes exact `BigInt`-backed arithmetic for
1982
- * balance invariants (CLP-04 + CLP-05 + ΣCAS = CLP-03;
1983
- * ΣSVC paid + ΣCAS = CLP-04; Σclaim CLP-04 + PLB = BPR-02).
1982
+ * the 835 balance invariants (`SVC-02 == SVC-03 + Σ(line CAS)`;
1983
+ * `CLP-03 == CLP-04 + Σ(claim CAS + line CAS)`;
1984
+ * `BPR-02 == Σ(CLP-04) - Σ(PLB amounts)`, each PLB amount in its raw EDI sign).
1984
1985
  *
1985
1986
  * Internal representation:
1986
1987
  *
@@ -5029,8 +5030,9 @@ interface X12Remittance {
5029
5030
  * Decoded BPR - Financial Information / payment header. The PAYMENT
5030
5031
  * MOVEMENT primitive: actual payment amount, credit/debit flag, method
5031
5032
  * (`ACH`/`CHK`/`NON`/`BOP`/`FWT`), payment date. **`totalActualPayment`
5032
- * is the sum the bank actually moved** - `Σ(claim CLP-04) + Σ(PLB
5033
- * adjustments) === BPR-02` is the top-level balance invariant.
5033
+ * is the sum the bank actually moved**, and `BPR-02 === Σ(claim CLP-04) -
5034
+ * Σ(PLB amounts)` is the top-level balance invariant, with each PLB amount
5035
+ * in its raw EDI sign (a positive amount is a take-back).
5034
5036
  *
5035
5037
  * @example
5036
5038
  * ```ts
@@ -5376,9 +5378,10 @@ interface X12RemitRemark {
5376
5378
  }
5377
5379
  /**
5378
5380
  * Decoded Loop 2110 - Service Payment Information. One per service line
5379
- * adjudicated. Line-level CAS adjustments roll up into the claim-level
5380
- * balance invariant (`Σ(SVC paid) + Σ(line CAS) === CLP-04`); a mismatch
5381
- * fires `X12_835_REMIT_BALANCE_MISMATCH` on the parent claim.
5381
+ * adjudicated. Line-level CAS adjustments enter two balance invariants:
5382
+ * this line's own `SVC-02 === SVC-03 + Σ(line CAS)`, and the parent claim's
5383
+ * `CLP-03 === CLP-04 + Σ(claim CAS + line CAS)`. A mismatch in either fires
5384
+ * `X12_835_REMIT_BALANCE_MISMATCH`.
5382
5385
  *
5383
5386
  * `productServiceIdQualifier` is the SVC-01-1 procedure-code system
5384
5387
  * (`HC` HCPCS/CPT, `AD` ADA dental, `N4` NDC, `WK` Advanced Billing
@@ -5457,12 +5460,15 @@ interface X12RemitServiceLine {
5457
5460
  * **Sign convention:** a POSITIVE PLB amount REDUCES the provider's
5458
5461
  * payment (recoupment / take-back); a NEGATIVE PLB amount ADDS to the
5459
5462
  * payment (interest / advance payment). The 835 balance invariant
5460
- * `Σ(claim CLP-04) + Σ(PLB amounts) === BPR-02` works because PLB
5461
- * amounts already carry the correct sign.
5463
+ * `BPR-02 === Σ(claim CLP-04) - Σ(PLB amounts)` subtracts the amounts as
5464
+ * the wire states them, so a positive PLB lowers BPR-02 and a negative one
5465
+ * raises it.
5462
5466
  *
5463
- * `reasonCode` is the **composite** PLB reason code (the qualifier +
5464
- * optional reference together, e.g. `WO:123456` for "withholding for
5465
- * claim 123456"); `subCode` carries the optional second component.
5467
+ * `reasonCode` is the adjustment reason code, the first component of the
5468
+ * PLB composite (e.g. `WO`, withholding); `subCode` is its optional second
5469
+ * component, the reference identifier (e.g. `123456`, the claim the
5470
+ * withholding relates to). A composite sent as `WO:123456` reads as
5471
+ * `reasonCode: "WO"` and `subCode: "123456"`.
5466
5472
  *
5467
5473
  * @example
5468
5474
  * ```ts
@@ -18498,8 +18504,9 @@ declare const AUTH_278_LOOP_2000A: LoopSpec;
18498
18504
  * the host machine's zone would make the answer depend on where the code ran.
18499
18505
  * So `toDate` returns `undefined` unless the caller states the offset, and
18500
18506
  * nothing here ever reads `Intl`, `getTimezoneOffset` or the local zone. That
18501
- * is the same stance `parseDocumentDate` already takes for the date-aware
18502
- * code-list queries, and this module does not soften it.
18507
+ * is the same stance the date-aware code-list queries, `checkCarcValidity` and
18508
+ * `checkRarcValidity`, already take for a document date, and this module does
18509
+ * not soften it.
18503
18510
  *
18504
18511
  * **What it decodes is exactly what this package already parses or builds.**
18505
18512
  * DTP-02 is the date/time period format qualifier, and the readers and
@@ -18517,12 +18524,12 @@ declare const AUTH_278_LOOP_2000A: LoopSpec;
18517
18524
  * **None of the three ever throws.** An undecodable carrier, a value whose
18518
18525
  * digits do not match the format its own qualifier declares, a calendar-invalid
18519
18526
  * day, `null` and `undefined` all answer `undefined`. That is the deliberate
18520
- * divergence from {@link "../../code-lists/document-date.js".parseDocumentDate},
18521
- * which THROWS on its own invalid input and keeps that contract unchanged: it
18522
- * answers a caller who asked a validity question and cannot state the day,
18523
- * while these three answer a caller reading a document that has already been
18524
- * parsed leniently, where a warning has already been raised and an exception
18525
- * would be a second, worse report of the same thing.
18527
+ * divergence from `checkCarcValidity` and `checkRarcValidity`, which THROW an
18528
+ * `X12CodeListError` on a document date they refuse and keep that contract
18529
+ * unchanged: they answer a caller who asked a validity question and cannot
18530
+ * state the day, while these three answer a caller reading a document that
18531
+ * has already been parsed leniently, where a warning has already been raised
18532
+ * and an exception would be a second, worse report of the same thing.
18526
18533
  */
18527
18534
  /**
18528
18535
  * Any date carrier this package's typed readers surface, read structurally
package/dist/index.d.ts CHANGED
@@ -1979,8 +1979,9 @@ interface X12ProfileSpec {
1979
1979
  * an 835 claim, a dropped decimal is the wrong dollar amount in someone's
1980
1980
  * cash post. `X12Decimal` preserves the inbound lexical form verbatim for
1981
1981
  * byte-exact round-trip and exposes exact `BigInt`-backed arithmetic for
1982
- * balance invariants (CLP-04 + CLP-05 + ΣCAS = CLP-03;
1983
- * ΣSVC paid + ΣCAS = CLP-04; Σclaim CLP-04 + PLB = BPR-02).
1982
+ * the 835 balance invariants (`SVC-02 == SVC-03 + Σ(line CAS)`;
1983
+ * `CLP-03 == CLP-04 + Σ(claim CAS + line CAS)`;
1984
+ * `BPR-02 == Σ(CLP-04) - Σ(PLB amounts)`, each PLB amount in its raw EDI sign).
1984
1985
  *
1985
1986
  * Internal representation:
1986
1987
  *
@@ -5029,8 +5030,9 @@ interface X12Remittance {
5029
5030
  * Decoded BPR - Financial Information / payment header. The PAYMENT
5030
5031
  * MOVEMENT primitive: actual payment amount, credit/debit flag, method
5031
5032
  * (`ACH`/`CHK`/`NON`/`BOP`/`FWT`), payment date. **`totalActualPayment`
5032
- * is the sum the bank actually moved** - `Σ(claim CLP-04) + Σ(PLB
5033
- * adjustments) === BPR-02` is the top-level balance invariant.
5033
+ * is the sum the bank actually moved**, and `BPR-02 === Σ(claim CLP-04) -
5034
+ * Σ(PLB amounts)` is the top-level balance invariant, with each PLB amount
5035
+ * in its raw EDI sign (a positive amount is a take-back).
5034
5036
  *
5035
5037
  * @example
5036
5038
  * ```ts
@@ -5376,9 +5378,10 @@ interface X12RemitRemark {
5376
5378
  }
5377
5379
  /**
5378
5380
  * Decoded Loop 2110 - Service Payment Information. One per service line
5379
- * adjudicated. Line-level CAS adjustments roll up into the claim-level
5380
- * balance invariant (`Σ(SVC paid) + Σ(line CAS) === CLP-04`); a mismatch
5381
- * fires `X12_835_REMIT_BALANCE_MISMATCH` on the parent claim.
5381
+ * adjudicated. Line-level CAS adjustments enter two balance invariants:
5382
+ * this line's own `SVC-02 === SVC-03 + Σ(line CAS)`, and the parent claim's
5383
+ * `CLP-03 === CLP-04 + Σ(claim CAS + line CAS)`. A mismatch in either fires
5384
+ * `X12_835_REMIT_BALANCE_MISMATCH`.
5382
5385
  *
5383
5386
  * `productServiceIdQualifier` is the SVC-01-1 procedure-code system
5384
5387
  * (`HC` HCPCS/CPT, `AD` ADA dental, `N4` NDC, `WK` Advanced Billing
@@ -5457,12 +5460,15 @@ interface X12RemitServiceLine {
5457
5460
  * **Sign convention:** a POSITIVE PLB amount REDUCES the provider's
5458
5461
  * payment (recoupment / take-back); a NEGATIVE PLB amount ADDS to the
5459
5462
  * payment (interest / advance payment). The 835 balance invariant
5460
- * `Σ(claim CLP-04) + Σ(PLB amounts) === BPR-02` works because PLB
5461
- * amounts already carry the correct sign.
5463
+ * `BPR-02 === Σ(claim CLP-04) - Σ(PLB amounts)` subtracts the amounts as
5464
+ * the wire states them, so a positive PLB lowers BPR-02 and a negative one
5465
+ * raises it.
5462
5466
  *
5463
- * `reasonCode` is the **composite** PLB reason code (the qualifier +
5464
- * optional reference together, e.g. `WO:123456` for "withholding for
5465
- * claim 123456"); `subCode` carries the optional second component.
5467
+ * `reasonCode` is the adjustment reason code, the first component of the
5468
+ * PLB composite (e.g. `WO`, withholding); `subCode` is its optional second
5469
+ * component, the reference identifier (e.g. `123456`, the claim the
5470
+ * withholding relates to). A composite sent as `WO:123456` reads as
5471
+ * `reasonCode: "WO"` and `subCode: "123456"`.
5466
5472
  *
5467
5473
  * @example
5468
5474
  * ```ts
@@ -18498,8 +18504,9 @@ declare const AUTH_278_LOOP_2000A: LoopSpec;
18498
18504
  * the host machine's zone would make the answer depend on where the code ran.
18499
18505
  * So `toDate` returns `undefined` unless the caller states the offset, and
18500
18506
  * nothing here ever reads `Intl`, `getTimezoneOffset` or the local zone. That
18501
- * is the same stance `parseDocumentDate` already takes for the date-aware
18502
- * code-list queries, and this module does not soften it.
18507
+ * is the same stance the date-aware code-list queries, `checkCarcValidity` and
18508
+ * `checkRarcValidity`, already take for a document date, and this module does
18509
+ * not soften it.
18503
18510
  *
18504
18511
  * **What it decodes is exactly what this package already parses or builds.**
18505
18512
  * DTP-02 is the date/time period format qualifier, and the readers and
@@ -18517,12 +18524,12 @@ declare const AUTH_278_LOOP_2000A: LoopSpec;
18517
18524
  * **None of the three ever throws.** An undecodable carrier, a value whose
18518
18525
  * digits do not match the format its own qualifier declares, a calendar-invalid
18519
18526
  * day, `null` and `undefined` all answer `undefined`. That is the deliberate
18520
- * divergence from {@link "../../code-lists/document-date.js".parseDocumentDate},
18521
- * which THROWS on its own invalid input and keeps that contract unchanged: it
18522
- * answers a caller who asked a validity question and cannot state the day,
18523
- * while these three answer a caller reading a document that has already been
18524
- * parsed leniently, where a warning has already been raised and an exception
18525
- * would be a second, worse report of the same thing.
18527
+ * divergence from `checkCarcValidity` and `checkRarcValidity`, which THROW an
18528
+ * `X12CodeListError` on a document date they refuse and keep that contract
18529
+ * unchanged: they answer a caller who asked a validity question and cannot
18530
+ * state the day, while these three answer a caller reading a document that
18531
+ * has already been parsed leniently, where a warning has already been raised
18532
+ * and an exception would be a second, worse report of the same thing.
18526
18533
  */
18527
18534
  /**
18528
18535
  * Any date carrier this package's typed readers surface, read structurally
package/dist/index.mjs CHANGED
@@ -15393,7 +15393,7 @@ var profiles = Object.freeze({
15393
15393
  });
15394
15394
 
15395
15395
  // src/index.ts
15396
- var VERSION = "0.1.2";
15396
+ var VERSION = "0.1.3";
15397
15397
 
15398
15398
  export { AAA_CONDITION_LEVELS, AAA_FOLLOW_UP_ACTION_CODES, AAA_LEVEL_CONTEXTS, AAA_REJECT_REASON_CODES, ACK_BUILD_ERROR_CODES, ALL_WARNING_MESSAGES, ATTACHMENT_275_BUILD_ERROR_CODES, 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, Attachment275BuildError, BALANCE_INVARIANTS, BUILD_REFUSAL_VALUE_MAX_LENGTH, BUILD_REFUSAL_VALUE_MAX_RENDERED, 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_276_BUILD_ERROR_CODES, CLAIM_STATUS_277_BUILD_ERROR_CODES, CLAIM_STATUS_CATEGORY_CODES, CLAIM_STATUS_CODES, CLP_STATUS, CODE_VALIDITY, CODE_VALIDITY_REASONS, CONTROL_NUMBER_PAIRS, CORE_BUSINESS_SCENARIOS, CORE_CODE_COMBINATION_ERROR_CODES, CORE_CODE_COMBINATION_OUTCOMES, CORE_CODE_COMBINATION_UNEVALUATED_REASONS, Claim837BuildError, ClaimStatus276BuildError, ClaimStatus277BuildError, CoreCodeCombinationTableError, DELIMITER_POSITIONS, ELIGIBILITY_270_BUILD_ERROR_CODES, 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, Eligibility270BuildError, Eligibility271BuildError, Enrollment834BuildError, FATAL_CODES, HI_QUALIFIERS, HL_LEVEL_CODES, IK3_SYNTAX_ERROR_CODES, IK4_SYNTAX_ERROR_CODES, INQUIRY_270_LOOP_2000A, INQUIRY_270_LOOP_2000B, INQUIRY_270_LOOP_2000C, INQUIRY_270_LOOP_2000D, INQUIRY_270_LOOP_2100C, INQUIRY_270_LOOP_2100D, INQUIRY_270_LOOP_2110, ISA_MIN_LENGTH, LoopSpecDefinitionError, MAINTENANCE_TYPE_CODES, NM1_QUALIFIERS, NON_SPEC_SEGMENT_ID, 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, 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, RFAI_277_BUILD_ERROR_CODES, RFAI_277_LOOP_1000, RFAI_277_LOOP_2000, RFAI_277_LOOP_2100, RFAI_277_LOOP_2200, RFAI_277_LOOP_2220, Remit835BuildError, Rfai277BuildError, SERVICE_TYPE_CODES, STATUS_276_LOOP_2000A, STATUS_276_LOOP_2000B, STATUS_276_LOOP_2000C, STATUS_276_LOOP_2000D, STATUS_276_LOOP_2000E, STATUS_276_LOOP_2200, STATUS_276_LOOP_2210, 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, ServicesReview278BuildError, TA1_ACK_CODES, TA1_NOTE_CODES, UNEXPECTED_SEGMENT_CONTEXTS, VERSION, WARNING_CODES, X12AttachmentData, X12BuildError, X12CodeListError, X12Decimal, X12ParseError, X12ProfileError, X12_ACK_DISPOSITION_CODES, X12_BUILD_ERROR_CODES, X12_CODE_LIST_ERROR_CODES, X12_TR3_CONFORMANCE, aaaLoopUnidentified, aaaProvenanceIsComplete, aaaRejectReasonAbsent, aaaSegmentMalformed, aaaUnknownCode, ambiguous837Variant, amountRowDropped, attachmentAbsent, balanceNotEvaluable, binaryDataTruncated, binaryLengthInvalid, binaryLengthMismatch, binaryLengthUnverifiable, build270, build271, build275, build276, build277, build277CA, build277RequestForAdditionalInformation, build278Request, build278Response, build820, build834, build835, build837D, build837I, build837P, build999, buildInterchange, buildTA1, bundleAaaCodes, checkCarcValidity, checkClaimBalance, checkCoreCodeCombination, checkRarcValidity, checkRemitTotalBalance, checkServiceLineBalance, codeListRedistributionIsPermitted, collectElementValues, componentOptional, controlNumberMismatch, danglingReleaseChar, dateRowDropped, decodeSegment, defineLoopSpec, defineProfile, detectDelimiters, duplicateHierarchyId, elementDecimal, elementDecimalOrZero, elementOptional, elementValue, entitySegmentDiscardedAfterLx, escapeRelease, get270Inquiry, get271Eligibility, get275Attachments, get276StatusInquiry, get277CADisposition, get277RequestForAdditionalInformation, get277Status, get278Request, get278Response, get820Payments, get834Enrollments, get834Header, get835, get837Claims, getAllSegmentValues, getDefaultProfile, getSegmentValue, groupCountMismatch, guideNotDeclared, guideNotImplemented, hierarchyCycle, hlParentLevelInvalid, hlParentMismatch, interSegmentLineBreak, isAcceptDisposition, isClaimAdjustmentGroupCode, isDiagnosisQualifier, isProcedureQualifier, isaExtraElementSeparator, levelDetached, lookupAaaFollowUpAction, lookupAaaRejectReason, lookupCarc, lookupClaimStatus, lookupClaimStatusCategory, lookupClpStatus, lookupMaintenanceType, lookupRarc, lookupServiceType, missingGe, missingIea, missingRequiredLoop, missingSe, nonConventionalDelimiter, parse270Inquiries, parse276StatusInquiries, parse999, parseTA1, parseX12, partitionWarnings, payToAddressRepeated, pre005010, profiles, readElementDecimal, remitBalanceMismatch, renderCallerValue, resolveHiQualifier, rfaiHeaderAbsent, rfaiLevelAbsent, rfaiRequestAbsent, segmentCountMismatch, serializeX12, serviceLineDropped, serviceLineNotDecoded, serviceSegmentRepeated, serviceSegmentWithoutLx, setDefaultProfile, statedAmountDiscarded, statusInquiryDateRowDropped, statusInquiryDuplicateHierarchyId, statusInquiryHierarchyCycle, statusInquiryLevelDetached, statusInquiryReferenceRowDropped, toDate, toISO, toObject, trailingGarbage, transactionCountMismatch, unescapeRelease, unexpectedSegment, unknown837Variant, unknownCarc, unknownClaimStatus, unknownClaimStatusCategory, unknownHiQualifier, unknownMaintenanceType, unknownRarc, unparseableDecimal };
15399
15399
  //# sourceMappingURL=index.mjs.map