@finsys/core 4.2.0 → 4.4.0

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
@@ -1418,8 +1418,15 @@ interface AdapterManifest {
1418
1418
  * post-extraction. `produces` IS the override surface (a separate
1419
1419
  * list could only duplicate or contradict it); the host's
1420
1420
  * override endpoints gate on membership.
1421
+ * - `extraction-pipeline` — SYS-2998: declaration-only adapter whose
1422
+ * implementation IS the host application's own document-extraction
1423
+ * pipeline. No code is loaded and neither fetch() nor extract()
1424
+ * ever runs — the host's pipeline writes the canonical rows and
1425
+ * records the adapter runs itself; the manifest exists purely as
1426
+ * the declaration plane (produces, cardinality,
1427
+ * fieldAuthorizations) for data the host was already producing.
1421
1428
  */
1422
- readonly implementation: DeclarativeImplementation | TypescriptImplementation | FormIntakeImplementation | ManualOverrideImplementation;
1429
+ readonly implementation: DeclarativeImplementation | TypescriptImplementation | FormIntakeImplementation | ManualOverrideImplementation | ExtractionPipelineImplementation;
1423
1430
  /**
1424
1431
  * SYS-2502: explicit instance cardinality.
1425
1432
  *
@@ -1470,6 +1477,30 @@ interface AdapterManifest {
1470
1477
  * present — declaring them is harmless but unnecessary.
1471
1478
  */
1472
1479
  readonly requiredIdentityFields?: ReadonlyArray<string>;
1480
+ /**
1481
+ * SYS-2503: declarative per-field authorization gating. Keyed by
1482
+ * canonical field name (every key MUST also appear in `produces` —
1483
+ * host validates at registration, same as `singletonFields`).
1484
+ *
1485
+ * Semantics, enforced by the HOST at read time (the manifest only
1486
+ * declares):
1487
+ *
1488
+ * - No entry for a field → visible to every reader (gating is
1489
+ * strictly opt-in; pre-existing manifests are unaffected).
1490
+ * - An entry restricts: the reader must satisfy EVERY dimension
1491
+ * the entry declares (AND across dimensions), matching ANY value
1492
+ * within a dimension's list (OR within a list).
1493
+ * - `lenderRoles` — reader's lender-role identifier must be listed.
1494
+ * - `programIds` — the application's program must be listed.
1495
+ *
1496
+ * Both dimensions are host-interpreted opaque strings: core neither
1497
+ * knows nor validates what a "role" or "program id" is, keeping the
1498
+ * contract deployment-agnostic. An entry must declare at least one
1499
+ * dimension, and a declared dimension must be non-empty — an empty
1500
+ * list would read as deny-all, which is better expressed by simply
1501
+ * not producing the field.
1502
+ */
1503
+ readonly fieldAuthorizations?: Readonly<Partial<Record<CanonicalFieldName, FieldAuthorization>>>;
1473
1504
  /**
1474
1505
  * Optional free-form notes — useful for partner-side documentation
1475
1506
  * (where to find the adapter's source, who owns it, what version of
@@ -1477,6 +1508,22 @@ interface AdapterManifest {
1477
1508
  */
1478
1509
  readonly notes?: string;
1479
1510
  }
1511
+ /**
1512
+ * SYS-2503: one field's authorization gate. See
1513
+ * {@link AdapterManifest.fieldAuthorizations} for semantics.
1514
+ *
1515
+ * A union rather than an all-optional interface so a no-op gate (`{}`)
1516
+ * is unrepresentable at COMPILE time too, not just rejected by the JSON
1517
+ * schema's `minProperties: 1` at runtime — the TS type and the schema
1518
+ * enforce the same invariant at their respective layers.
1519
+ */
1520
+ type FieldAuthorization = {
1521
+ readonly lenderRoles: ReadonlyArray<string>;
1522
+ readonly programIds?: ReadonlyArray<string>;
1523
+ } | {
1524
+ readonly lenderRoles?: ReadonlyArray<string>;
1525
+ readonly programIds: ReadonlyArray<string>;
1526
+ };
1480
1527
  interface DeclarativeImplementation {
1481
1528
  readonly type: "declarative";
1482
1529
  /**
@@ -1534,6 +1581,26 @@ interface FormIntakeFieldMapEntry {
1534
1581
  interface ManualOverrideImplementation {
1535
1582
  readonly type: "manual-override";
1536
1583
  }
1584
+ /**
1585
+ * SYS-2998: declaration-only implementation for adapters whose
1586
+ * implementation IS the host application's own extraction pipeline
1587
+ * (e.g. the FinXtract document-processing pipeline wrapped as
1588
+ * "finxtract-bank-statement-v1"). The host's pipeline code performs the
1589
+ * extraction, writes the canonical rows, and records the adapter runs —
1590
+ * this manifest is how that pipeline's output becomes declared,
1591
+ * provenance-carrying, per-field-gateable adapter data instead of
1592
+ * hand-wired writes. No code, no fetch(), no extract(); like
1593
+ * `manual-override`, the discriminator alone carries the meaning.
1594
+ *
1595
+ * Distinct from `form-intake` (whose runtime is the form submission
1596
+ * handler and which needs a fieldMap) and from `manual-override` (which
1597
+ * declares an override SURFACE): an extraction-pipeline manifest
1598
+ * declares the pipeline's produced fields verbatim — `produces` is the
1599
+ * contract, and the host validates the pipeline's writes against it.
1600
+ */
1601
+ interface ExtractionPipelineImplementation {
1602
+ readonly type: "extraction-pipeline";
1603
+ }
1537
1604
  interface FieldMapEntry {
1538
1605
  /**
1539
1606
  * JSONPath expression into the raw payload. E.g.
@@ -1561,4 +1628,4 @@ interface FieldMapEntry {
1561
1628
  readonly transform?: "identity" | "pct_to_ratio01" | "to_boolean" | "to_integer";
1562
1629
  }
1563
1630
 
1564
- export { ADAPTER_CATEGORY_IDS, ALL_AGGREGATION_OPS, type AdapterCategory, AdapterError, type AdapterErrorReason, type AdapterExtraction, type AdapterManifest, type AggregationOp, type ApplicantIdentity, BASE_FIELD_SPECS, BasicFormField, type CanonicalFieldName, type CanonicalFieldSpec, type CanonicalFieldValue, type CanonicalFieldValues, type Category, type CategorySchema, type CategorySpec, type Choice, DEFAULT_VALIDATOR_DEFINITIONS, type DeclarativeImplementation, type DocExtractionResult, DocExtractionStatus, type DocumentFileMetadata, type DocumentRow, type DocumentRowCapabilities, type DocumentTypeGroup, type DropdownOption, type EditorValidator, type ExtractionFileType, type ExtractionJobRecord, ExtractionJobStatus, type ExtractionStatusResult, FIELD_TYPE_DEFINITIONS, type FieldData, type FieldGroup, type FieldMapEntry, type FieldReference, FieldType, type FileFieldTableData, type FileFieldTableItem, FileFieldTableType, FileFormField, FormField, FormFieldCategory, type FormFieldInputType, type FormFieldType, type FormFieldTypeDefinitions, FormFieldValidator, type FormIntakeFieldMapEntry, type FormIntakeImplementation, FormSpec, type FormValidatorDefinitions, IHS_FAILURE_STATUSES, IHS_FIELD_ORIGINS, IHS_TERMINAL_STATUSES, IHS_VALID_STATUSES, type IhsDetailCategory, type IhsFieldDetail, type IhsFieldOrigin, type IhsFieldProvenance, IhsStatus, IhsValueFormat, type InstanceRow, type InstanceValue, type ManualOverrideImplementation, type PageConfig, type RHFSchemaOutput, type RHFStep, type RawPayload, type ResolvedField, Role, type SourceAdapter, type SurveyElementJSON, type SurveyJSON, type SurveyPageJSON, type TaggedFieldData, type TimePeriodUnit, type TypescriptImplementation, type UnifiedFormConfig, type Validator, type WireFormat, allCategories, applyAggregation, applyDynamicTitles, assertAdapterCategory, assertDocumentType, buildDocumentRows, buildFileFieldTables, buildFileFieldTablesFromInstances, categoryFieldsOf, categoryForField, categorySchemaOf, evaluateExpression, extractTimePeriods, formatDocumentSize, formatDocumentType, formatDocumentUploaded, generateRHFSchema, generateSurveyJson, getBaseCategories, getBaseFieldNames, getBaseFieldSpecMap, getBaseFieldSpecs, getCategoryName, getDisplayName, getDisplayNames, getDocDisplayNames, getDocumentTypeGroups, getExtractableDocTypes, getGroupDisplayNames, getPastMonthLabel, getPastYearLabel, getReuploadableDocTypes, getStepDefaultValues, getStepSchema, groupColumnsByInstance, groupColumnsByTimePeriod, groupDetailsByCategory, groupFieldsByCategory, groupFieldsByPattern, isAdapterCategory, isDocumentType, isFailureIhsStatus, isTerminalIhsStatus, isValidIhsFieldOrigin, isValidIhsStatus, parseFileField, processIhsDetails, resolveExtractionStatus, resolvePageFields, validateFormConfig, validateFormSpec, validatePagesConfig };
1631
+ export { ADAPTER_CATEGORY_IDS, ALL_AGGREGATION_OPS, type AdapterCategory, AdapterError, type AdapterErrorReason, type AdapterExtraction, type AdapterManifest, type AggregationOp, type ApplicantIdentity, BASE_FIELD_SPECS, BasicFormField, type CanonicalFieldName, type CanonicalFieldSpec, type CanonicalFieldValue, type CanonicalFieldValues, type Category, type CategorySchema, type CategorySpec, type Choice, DEFAULT_VALIDATOR_DEFINITIONS, type DeclarativeImplementation, type DocExtractionResult, DocExtractionStatus, type DocumentFileMetadata, type DocumentRow, type DocumentRowCapabilities, type DocumentTypeGroup, type DropdownOption, type EditorValidator, type ExtractionFileType, type ExtractionJobRecord, ExtractionJobStatus, type ExtractionPipelineImplementation, type ExtractionStatusResult, FIELD_TYPE_DEFINITIONS, type FieldAuthorization, type FieldData, type FieldGroup, type FieldMapEntry, type FieldReference, FieldType, type FileFieldTableData, type FileFieldTableItem, FileFieldTableType, FileFormField, FormField, FormFieldCategory, type FormFieldInputType, type FormFieldType, type FormFieldTypeDefinitions, FormFieldValidator, type FormIntakeFieldMapEntry, type FormIntakeImplementation, FormSpec, type FormValidatorDefinitions, IHS_FAILURE_STATUSES, IHS_FIELD_ORIGINS, IHS_TERMINAL_STATUSES, IHS_VALID_STATUSES, type IhsDetailCategory, type IhsFieldDetail, type IhsFieldOrigin, type IhsFieldProvenance, IhsStatus, IhsValueFormat, type InstanceRow, type InstanceValue, type ManualOverrideImplementation, type PageConfig, type RHFSchemaOutput, type RHFStep, type RawPayload, type ResolvedField, Role, type SourceAdapter, type SurveyElementJSON, type SurveyJSON, type SurveyPageJSON, type TaggedFieldData, type TimePeriodUnit, type TypescriptImplementation, type UnifiedFormConfig, type Validator, type WireFormat, allCategories, applyAggregation, applyDynamicTitles, assertAdapterCategory, assertDocumentType, buildDocumentRows, buildFileFieldTables, buildFileFieldTablesFromInstances, categoryFieldsOf, categoryForField, categorySchemaOf, evaluateExpression, extractTimePeriods, formatDocumentSize, formatDocumentType, formatDocumentUploaded, generateRHFSchema, generateSurveyJson, getBaseCategories, getBaseFieldNames, getBaseFieldSpecMap, getBaseFieldSpecs, getCategoryName, getDisplayName, getDisplayNames, getDocDisplayNames, getDocumentTypeGroups, getExtractableDocTypes, getGroupDisplayNames, getPastMonthLabel, getPastYearLabel, getReuploadableDocTypes, getStepDefaultValues, getStepSchema, groupColumnsByInstance, groupColumnsByTimePeriod, groupDetailsByCategory, groupFieldsByCategory, groupFieldsByPattern, isAdapterCategory, isDocumentType, isFailureIhsStatus, isTerminalIhsStatus, isValidIhsFieldOrigin, isValidIhsStatus, parseFileField, processIhsDetails, resolveExtractionStatus, resolvePageFields, validateFormConfig, validateFormSpec, validatePagesConfig };
package/dist/index.d.ts CHANGED
@@ -1418,8 +1418,15 @@ interface AdapterManifest {
1418
1418
  * post-extraction. `produces` IS the override surface (a separate
1419
1419
  * list could only duplicate or contradict it); the host's
1420
1420
  * override endpoints gate on membership.
1421
+ * - `extraction-pipeline` — SYS-2998: declaration-only adapter whose
1422
+ * implementation IS the host application's own document-extraction
1423
+ * pipeline. No code is loaded and neither fetch() nor extract()
1424
+ * ever runs — the host's pipeline writes the canonical rows and
1425
+ * records the adapter runs itself; the manifest exists purely as
1426
+ * the declaration plane (produces, cardinality,
1427
+ * fieldAuthorizations) for data the host was already producing.
1421
1428
  */
1422
- readonly implementation: DeclarativeImplementation | TypescriptImplementation | FormIntakeImplementation | ManualOverrideImplementation;
1429
+ readonly implementation: DeclarativeImplementation | TypescriptImplementation | FormIntakeImplementation | ManualOverrideImplementation | ExtractionPipelineImplementation;
1423
1430
  /**
1424
1431
  * SYS-2502: explicit instance cardinality.
1425
1432
  *
@@ -1470,6 +1477,30 @@ interface AdapterManifest {
1470
1477
  * present — declaring them is harmless but unnecessary.
1471
1478
  */
1472
1479
  readonly requiredIdentityFields?: ReadonlyArray<string>;
1480
+ /**
1481
+ * SYS-2503: declarative per-field authorization gating. Keyed by
1482
+ * canonical field name (every key MUST also appear in `produces` —
1483
+ * host validates at registration, same as `singletonFields`).
1484
+ *
1485
+ * Semantics, enforced by the HOST at read time (the manifest only
1486
+ * declares):
1487
+ *
1488
+ * - No entry for a field → visible to every reader (gating is
1489
+ * strictly opt-in; pre-existing manifests are unaffected).
1490
+ * - An entry restricts: the reader must satisfy EVERY dimension
1491
+ * the entry declares (AND across dimensions), matching ANY value
1492
+ * within a dimension's list (OR within a list).
1493
+ * - `lenderRoles` — reader's lender-role identifier must be listed.
1494
+ * - `programIds` — the application's program must be listed.
1495
+ *
1496
+ * Both dimensions are host-interpreted opaque strings: core neither
1497
+ * knows nor validates what a "role" or "program id" is, keeping the
1498
+ * contract deployment-agnostic. An entry must declare at least one
1499
+ * dimension, and a declared dimension must be non-empty — an empty
1500
+ * list would read as deny-all, which is better expressed by simply
1501
+ * not producing the field.
1502
+ */
1503
+ readonly fieldAuthorizations?: Readonly<Partial<Record<CanonicalFieldName, FieldAuthorization>>>;
1473
1504
  /**
1474
1505
  * Optional free-form notes — useful for partner-side documentation
1475
1506
  * (where to find the adapter's source, who owns it, what version of
@@ -1477,6 +1508,22 @@ interface AdapterManifest {
1477
1508
  */
1478
1509
  readonly notes?: string;
1479
1510
  }
1511
+ /**
1512
+ * SYS-2503: one field's authorization gate. See
1513
+ * {@link AdapterManifest.fieldAuthorizations} for semantics.
1514
+ *
1515
+ * A union rather than an all-optional interface so a no-op gate (`{}`)
1516
+ * is unrepresentable at COMPILE time too, not just rejected by the JSON
1517
+ * schema's `minProperties: 1` at runtime — the TS type and the schema
1518
+ * enforce the same invariant at their respective layers.
1519
+ */
1520
+ type FieldAuthorization = {
1521
+ readonly lenderRoles: ReadonlyArray<string>;
1522
+ readonly programIds?: ReadonlyArray<string>;
1523
+ } | {
1524
+ readonly lenderRoles?: ReadonlyArray<string>;
1525
+ readonly programIds: ReadonlyArray<string>;
1526
+ };
1480
1527
  interface DeclarativeImplementation {
1481
1528
  readonly type: "declarative";
1482
1529
  /**
@@ -1534,6 +1581,26 @@ interface FormIntakeFieldMapEntry {
1534
1581
  interface ManualOverrideImplementation {
1535
1582
  readonly type: "manual-override";
1536
1583
  }
1584
+ /**
1585
+ * SYS-2998: declaration-only implementation for adapters whose
1586
+ * implementation IS the host application's own extraction pipeline
1587
+ * (e.g. the FinXtract document-processing pipeline wrapped as
1588
+ * "finxtract-bank-statement-v1"). The host's pipeline code performs the
1589
+ * extraction, writes the canonical rows, and records the adapter runs —
1590
+ * this manifest is how that pipeline's output becomes declared,
1591
+ * provenance-carrying, per-field-gateable adapter data instead of
1592
+ * hand-wired writes. No code, no fetch(), no extract(); like
1593
+ * `manual-override`, the discriminator alone carries the meaning.
1594
+ *
1595
+ * Distinct from `form-intake` (whose runtime is the form submission
1596
+ * handler and which needs a fieldMap) and from `manual-override` (which
1597
+ * declares an override SURFACE): an extraction-pipeline manifest
1598
+ * declares the pipeline's produced fields verbatim — `produces` is the
1599
+ * contract, and the host validates the pipeline's writes against it.
1600
+ */
1601
+ interface ExtractionPipelineImplementation {
1602
+ readonly type: "extraction-pipeline";
1603
+ }
1537
1604
  interface FieldMapEntry {
1538
1605
  /**
1539
1606
  * JSONPath expression into the raw payload. E.g.
@@ -1561,4 +1628,4 @@ interface FieldMapEntry {
1561
1628
  readonly transform?: "identity" | "pct_to_ratio01" | "to_boolean" | "to_integer";
1562
1629
  }
1563
1630
 
1564
- export { ADAPTER_CATEGORY_IDS, ALL_AGGREGATION_OPS, type AdapterCategory, AdapterError, type AdapterErrorReason, type AdapterExtraction, type AdapterManifest, type AggregationOp, type ApplicantIdentity, BASE_FIELD_SPECS, BasicFormField, type CanonicalFieldName, type CanonicalFieldSpec, type CanonicalFieldValue, type CanonicalFieldValues, type Category, type CategorySchema, type CategorySpec, type Choice, DEFAULT_VALIDATOR_DEFINITIONS, type DeclarativeImplementation, type DocExtractionResult, DocExtractionStatus, type DocumentFileMetadata, type DocumentRow, type DocumentRowCapabilities, type DocumentTypeGroup, type DropdownOption, type EditorValidator, type ExtractionFileType, type ExtractionJobRecord, ExtractionJobStatus, type ExtractionStatusResult, FIELD_TYPE_DEFINITIONS, type FieldData, type FieldGroup, type FieldMapEntry, type FieldReference, FieldType, type FileFieldTableData, type FileFieldTableItem, FileFieldTableType, FileFormField, FormField, FormFieldCategory, type FormFieldInputType, type FormFieldType, type FormFieldTypeDefinitions, FormFieldValidator, type FormIntakeFieldMapEntry, type FormIntakeImplementation, FormSpec, type FormValidatorDefinitions, IHS_FAILURE_STATUSES, IHS_FIELD_ORIGINS, IHS_TERMINAL_STATUSES, IHS_VALID_STATUSES, type IhsDetailCategory, type IhsFieldDetail, type IhsFieldOrigin, type IhsFieldProvenance, IhsStatus, IhsValueFormat, type InstanceRow, type InstanceValue, type ManualOverrideImplementation, type PageConfig, type RHFSchemaOutput, type RHFStep, type RawPayload, type ResolvedField, Role, type SourceAdapter, type SurveyElementJSON, type SurveyJSON, type SurveyPageJSON, type TaggedFieldData, type TimePeriodUnit, type TypescriptImplementation, type UnifiedFormConfig, type Validator, type WireFormat, allCategories, applyAggregation, applyDynamicTitles, assertAdapterCategory, assertDocumentType, buildDocumentRows, buildFileFieldTables, buildFileFieldTablesFromInstances, categoryFieldsOf, categoryForField, categorySchemaOf, evaluateExpression, extractTimePeriods, formatDocumentSize, formatDocumentType, formatDocumentUploaded, generateRHFSchema, generateSurveyJson, getBaseCategories, getBaseFieldNames, getBaseFieldSpecMap, getBaseFieldSpecs, getCategoryName, getDisplayName, getDisplayNames, getDocDisplayNames, getDocumentTypeGroups, getExtractableDocTypes, getGroupDisplayNames, getPastMonthLabel, getPastYearLabel, getReuploadableDocTypes, getStepDefaultValues, getStepSchema, groupColumnsByInstance, groupColumnsByTimePeriod, groupDetailsByCategory, groupFieldsByCategory, groupFieldsByPattern, isAdapterCategory, isDocumentType, isFailureIhsStatus, isTerminalIhsStatus, isValidIhsFieldOrigin, isValidIhsStatus, parseFileField, processIhsDetails, resolveExtractionStatus, resolvePageFields, validateFormConfig, validateFormSpec, validatePagesConfig };
1631
+ export { ADAPTER_CATEGORY_IDS, ALL_AGGREGATION_OPS, type AdapterCategory, AdapterError, type AdapterErrorReason, type AdapterExtraction, type AdapterManifest, type AggregationOp, type ApplicantIdentity, BASE_FIELD_SPECS, BasicFormField, type CanonicalFieldName, type CanonicalFieldSpec, type CanonicalFieldValue, type CanonicalFieldValues, type Category, type CategorySchema, type CategorySpec, type Choice, DEFAULT_VALIDATOR_DEFINITIONS, type DeclarativeImplementation, type DocExtractionResult, DocExtractionStatus, type DocumentFileMetadata, type DocumentRow, type DocumentRowCapabilities, type DocumentTypeGroup, type DropdownOption, type EditorValidator, type ExtractionFileType, type ExtractionJobRecord, ExtractionJobStatus, type ExtractionPipelineImplementation, type ExtractionStatusResult, FIELD_TYPE_DEFINITIONS, type FieldAuthorization, type FieldData, type FieldGroup, type FieldMapEntry, type FieldReference, FieldType, type FileFieldTableData, type FileFieldTableItem, FileFieldTableType, FileFormField, FormField, FormFieldCategory, type FormFieldInputType, type FormFieldType, type FormFieldTypeDefinitions, FormFieldValidator, type FormIntakeFieldMapEntry, type FormIntakeImplementation, FormSpec, type FormValidatorDefinitions, IHS_FAILURE_STATUSES, IHS_FIELD_ORIGINS, IHS_TERMINAL_STATUSES, IHS_VALID_STATUSES, type IhsDetailCategory, type IhsFieldDetail, type IhsFieldOrigin, type IhsFieldProvenance, IhsStatus, IhsValueFormat, type InstanceRow, type InstanceValue, type ManualOverrideImplementation, type PageConfig, type RHFSchemaOutput, type RHFStep, type RawPayload, type ResolvedField, Role, type SourceAdapter, type SurveyElementJSON, type SurveyJSON, type SurveyPageJSON, type TaggedFieldData, type TimePeriodUnit, type TypescriptImplementation, type UnifiedFormConfig, type Validator, type WireFormat, allCategories, applyAggregation, applyDynamicTitles, assertAdapterCategory, assertDocumentType, buildDocumentRows, buildFileFieldTables, buildFileFieldTablesFromInstances, categoryFieldsOf, categoryForField, categorySchemaOf, evaluateExpression, extractTimePeriods, formatDocumentSize, formatDocumentType, formatDocumentUploaded, generateRHFSchema, generateSurveyJson, getBaseCategories, getBaseFieldNames, getBaseFieldSpecMap, getBaseFieldSpecs, getCategoryName, getDisplayName, getDisplayNames, getDocDisplayNames, getDocumentTypeGroups, getExtractableDocTypes, getGroupDisplayNames, getPastMonthLabel, getPastYearLabel, getReuploadableDocTypes, getStepDefaultValues, getStepSchema, groupColumnsByInstance, groupColumnsByTimePeriod, groupDetailsByCategory, groupFieldsByCategory, groupFieldsByPattern, isAdapterCategory, isDocumentType, isFailureIhsStatus, isTerminalIhsStatus, isValidIhsFieldOrigin, isValidIhsStatus, parseFileField, processIhsDetails, resolveExtractionStatus, resolvePageFields, validateFormConfig, validateFormSpec, validatePagesConfig };
package/dist/index.js CHANGED
@@ -10596,6 +10596,260 @@ var adapter_categories_default = {
10596
10596
  description: "Agreement between the inferred home anchor and the applicant's registered residential address. 1 = same premises, 0 = different state (summary instance only)."
10597
10597
  }
10598
10598
  ]
10599
+ },
10600
+ {
10601
+ id: "ic",
10602
+ displayName: "Identity Document (IC / Passport)",
10603
+ description: "Identity fields extracted from a Malaysian IC (MyKad) or passport document. Produced by the host's document-extraction pipeline; one instance per identity document.",
10604
+ canonicalTable: "ihs_alt_data_ic",
10605
+ fields: [
10606
+ {
10607
+ name: "icName",
10608
+ type: "string",
10609
+ description: "Full name as printed on the identity document."
10610
+ },
10611
+ {
10612
+ name: "icNumber",
10613
+ type: "string",
10614
+ description: "IC (MyKad) number, or passport number for passport documents."
10615
+ },
10616
+ {
10617
+ name: "icAddress",
10618
+ type: "string",
10619
+ description: "Registered address as printed on the document."
10620
+ },
10621
+ {
10622
+ name: "icGender",
10623
+ type: "string",
10624
+ description: "Gender as stated on the document."
10625
+ },
10626
+ {
10627
+ name: "icReligion",
10628
+ type: "string",
10629
+ description: "Religion as stated on the document (MyKad-only; absent on passports)."
10630
+ },
10631
+ {
10632
+ name: "icDateOfBirth",
10633
+ type: "string",
10634
+ description: "Date of birth as stated on the document."
10635
+ },
10636
+ {
10637
+ name: "icPlaceOfBirth",
10638
+ type: "string",
10639
+ description: "Place of birth as stated on the document."
10640
+ },
10641
+ {
10642
+ name: "icNationality",
10643
+ type: "string",
10644
+ description: "Nationality as stated on the document."
10645
+ },
10646
+ {
10647
+ name: "icRace",
10648
+ type: "string",
10649
+ description: "Race as stated on the document (MyKad-only; absent on passports)."
10650
+ }
10651
+ ]
10652
+ },
10653
+ {
10654
+ id: "finxtract-bank-statement",
10655
+ displayName: "Bank Statement (Document Extraction)",
10656
+ description: "Fields extracted from an uploaded bank-statement document by the host's extraction pipeline. One instance per statement document; each statement covers a single month. Distinct from the partner-API 'bank-statement' category: same real-world domain, different source and different canonical vocabulary.",
10657
+ canonicalTable: "ihsbankstatement",
10658
+ fields: [
10659
+ {
10660
+ name: "bankName",
10661
+ type: "string",
10662
+ description: "Issuing bank's name as printed on the statement."
10663
+ },
10664
+ {
10665
+ name: "accountHolderName",
10666
+ type: "string",
10667
+ description: "Account holder's name as printed on the statement."
10668
+ },
10669
+ {
10670
+ name: "accountNumber",
10671
+ type: "string",
10672
+ description: "Bank account number as printed on the statement."
10673
+ },
10674
+ {
10675
+ name: "statementDate",
10676
+ type: "string",
10677
+ description: "Statement date, normalized to ISO YYYY-MM-DD."
10678
+ },
10679
+ {
10680
+ name: "openingBalance",
10681
+ type: "number",
10682
+ unit: "MYR",
10683
+ description: "Opening balance for the statement period."
10684
+ },
10685
+ {
10686
+ name: "bankBalance",
10687
+ type: "number",
10688
+ unit: "MYR",
10689
+ description: "Closing balance for the statement period."
10690
+ },
10691
+ {
10692
+ name: "totalCredits",
10693
+ type: "number",
10694
+ unit: "MYR",
10695
+ description: "Sum of credit transactions in the statement period."
10696
+ },
10697
+ {
10698
+ name: "totalDebits",
10699
+ type: "number",
10700
+ unit: "MYR",
10701
+ description: "Sum of debit transactions in the statement period."
10702
+ }
10703
+ ]
10704
+ },
10705
+ {
10706
+ id: "finxtract-epf",
10707
+ displayName: "EPF Statement (Document Extraction)",
10708
+ description: "Fields extracted from an uploaded EPF (KWSP) statement document by the host's extraction pipeline. One instance per statement document. Field names carry the 'epf' prefix \u2014 the same prefix-namespaced vocabulary the host's flat read path and the eval engine already use, which also keeps canonical names globally unique across categories.",
10709
+ canonicalTable: "ihsepfstatement",
10710
+ fields: [
10711
+ {
10712
+ name: "epfAccountHolderName",
10713
+ type: "string",
10714
+ description: "Member's name as printed on the statement."
10715
+ },
10716
+ {
10717
+ name: "epfAccountHolderAddress",
10718
+ type: "string",
10719
+ description: "Member's address as printed on the statement."
10720
+ },
10721
+ {
10722
+ name: "epfStatementYear",
10723
+ type: "string",
10724
+ description: "The contribution year the statement covers."
10725
+ },
10726
+ {
10727
+ name: "epfKwspMemberNumber",
10728
+ type: "string",
10729
+ description: "KWSP membership number."
10730
+ },
10731
+ {
10732
+ name: "epfIcNumber",
10733
+ type: "string",
10734
+ description: "Member's IC number as printed on the statement."
10735
+ },
10736
+ {
10737
+ name: "epfEmployerNumber",
10738
+ type: "string",
10739
+ description: "Employer's KWSP reference number."
10740
+ },
10741
+ {
10742
+ name: "epfDateOfStatement",
10743
+ type: "string",
10744
+ description: "Statement issue date, normalized to ISO YYYY-MM-DD."
10745
+ },
10746
+ {
10747
+ name: "epfTotalContribution",
10748
+ type: "number",
10749
+ unit: "MYR",
10750
+ description: "Cumulative EPF balance as at the statement date."
10751
+ },
10752
+ {
10753
+ name: "epfTotalCurrentContribution",
10754
+ type: "number",
10755
+ unit: "MYR",
10756
+ description: "Contributions made within the statement's coverage year."
10757
+ }
10758
+ ]
10759
+ },
10760
+ {
10761
+ id: "finxtract-payslip",
10762
+ displayName: "Payslip (Document Extraction)",
10763
+ description: "Fields extracted from an uploaded payslip document by the host's extraction pipeline. One instance per payslip document; each payslip covers a single pay period. Field names carry the 'payslip' prefix \u2014 the same prefix-namespaced vocabulary the host's flat read path and the eval engine already use, which also keeps canonical names globally unique across categories.",
10764
+ canonicalTable: "ihspayslip",
10765
+ fields: [
10766
+ {
10767
+ name: "payslipEmployerName",
10768
+ type: "string",
10769
+ description: "Employer's name as printed on the payslip."
10770
+ },
10771
+ {
10772
+ name: "payslipEmployeeName",
10773
+ type: "string",
10774
+ description: "Employee's name as printed on the payslip."
10775
+ },
10776
+ {
10777
+ name: "payslipPayPeriod",
10778
+ type: "string",
10779
+ description: "The pay period the payslip covers, as printed."
10780
+ },
10781
+ {
10782
+ name: "payslipPayDate",
10783
+ type: "string",
10784
+ description: "Payment date, as printed."
10785
+ },
10786
+ {
10787
+ name: "payslipBasicPay",
10788
+ type: "number",
10789
+ unit: "MYR",
10790
+ description: "Basic salary for the period."
10791
+ },
10792
+ {
10793
+ name: "payslipGrossPay",
10794
+ type: "number",
10795
+ unit: "MYR",
10796
+ description: "Gross pay for the period."
10797
+ },
10798
+ {
10799
+ name: "payslipFixedAllowances",
10800
+ type: "number",
10801
+ unit: "MYR",
10802
+ description: "Fixed allowances for the period."
10803
+ },
10804
+ {
10805
+ name: "payslipVariableIncome",
10806
+ type: "number",
10807
+ unit: "MYR",
10808
+ description: "Variable income (overtime, commission, bonus) for the period."
10809
+ },
10810
+ {
10811
+ name: "payslipDeduction",
10812
+ type: "number",
10813
+ unit: "MYR",
10814
+ description: "Total statutory deductions for the period."
10815
+ },
10816
+ {
10817
+ name: "payslipOtherDeduction",
10818
+ type: "number",
10819
+ unit: "MYR",
10820
+ description: "Other (non-statutory) deductions for the period."
10821
+ },
10822
+ {
10823
+ name: "payslipEmployeeEpfContribution",
10824
+ type: "number",
10825
+ unit: "MYR",
10826
+ description: "Employee EPF contribution for the period."
10827
+ },
10828
+ {
10829
+ name: "payslipEmployeeSocsoContribution",
10830
+ type: "number",
10831
+ unit: "MYR",
10832
+ description: "Employee SOCSO contribution for the period."
10833
+ },
10834
+ {
10835
+ name: "payslipEmployeeEisContribution",
10836
+ type: "number",
10837
+ unit: "MYR",
10838
+ description: "Employee EIS contribution for the period."
10839
+ },
10840
+ {
10841
+ name: "payslipEmployeeTax",
10842
+ type: "number",
10843
+ unit: "MYR",
10844
+ description: "Employee income-tax (PCB) deduction for the period."
10845
+ },
10846
+ {
10847
+ name: "payslipNetPay",
10848
+ type: "number",
10849
+ unit: "MYR",
10850
+ description: "Net pay for the period."
10851
+ }
10852
+ ]
10599
10853
  }
10600
10854
  ]
10601
10855
  };
@@ -10634,9 +10888,9 @@ function buildCategoryRegistry(raw) {
10634
10888
  if (typeof cat.description !== "string" || cat.description.length === 0) {
10635
10889
  throw new Error(`adapter category data: ${where} needs a non-empty description`);
10636
10890
  }
10637
- if (typeof cat.canonicalTable !== "string" || !/^ihs_alt_data_/.test(cat.canonicalTable)) {
10891
+ if (typeof cat.canonicalTable !== "string" || !/^ihs[a-z0-9_]*$/.test(cat.canonicalTable)) {
10638
10892
  throw new Error(
10639
- `adapter category data: ${where} canonicalTable must start with "ihs_alt_data_" (got "${cat.canonicalTable}")`
10893
+ `adapter category data: ${where} canonicalTable must be an "ihs"-prefixed table identifier (got "${cat.canonicalTable}")`
10640
10894
  );
10641
10895
  }
10642
10896
  if (tables.has(cat.canonicalTable)) {