@finsys/core 4.1.0 → 4.3.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
@@ -990,6 +990,30 @@ interface AdapterExtraction {
990
990
  * The canonical field values for this instance.
991
991
  */
992
992
  readonly values: CanonicalFieldValues;
993
+ /**
994
+ * SYS-2502: when this instance's data was OBSERVED at the source
995
+ * (ISO-8601) — the statement's own date, the partner snapshot's
996
+ * timestamp — as distinct from when the adapter RAN. Optional for
997
+ * backward compatibility with already-shipped adapters (the host
998
+ * falls back to the run's ranAt when absent, exactly the inference
999
+ * it always did), but new adapters should treat it as required:
1000
+ * ranAt-inference conflates "when we fetched" with "when it was
1001
+ * true", which corrupts recency ordering for backfilled or delayed
1002
+ * data. Expected to become mandatory at the next major version.
1003
+ */
1004
+ readonly observedAt?: string;
1005
+ /**
1006
+ * SYS-2502 (prototyped in finsys-api under SYS-2977): optional
1007
+ * per-field extraction confidence, 0..1, keyed by canonical field
1008
+ * name. This is the provenance slot SYS-2819 identified as the
1009
+ * missing precondition for FinXtract-as-adapter — probabilistic
1010
+ * extractors (OCR/LLM) carry real per-field confidence; partner-API
1011
+ * adapters (a telco returning a number) simply omit it. `null` marks
1012
+ * a field whose value is derived/computed rather than directly
1013
+ * extracted (renders as "no confidence" rather than low confidence,
1014
+ * matching IhsFieldProvenance.origin semantics).
1015
+ */
1016
+ readonly confidence?: Partial<Record<CanonicalFieldName, number | null>>;
993
1017
  }
994
1018
  /**
995
1019
  * Allowed value shapes for canonical fields. Per-field type narrowing
@@ -1383,8 +1407,47 @@ interface AdapterManifest {
1383
1407
  * code is loaded.
1384
1408
  * - `typescript` — TS/JS adapter; `entryPoint` is required, the
1385
1409
  * host imports it dynamically.
1410
+ * - `form-intake` — SYS-2501: data-only adapter declaring
1411
+ * form-field-id → canonical-field mappings. No code is loaded and
1412
+ * no fetch()/extract() ever runs; the host's form submission
1413
+ * handler IS the runtime, and this manifest is how a
1414
+ * borrower-entered scalar becomes a canonical, provenance-carrying
1415
+ * field instead of a hand-wired column write.
1416
+ * - `manual-override` — SYS-2501: data-only adapter declaring that
1417
+ * this category's fields may be operator-overridden
1418
+ * post-extraction. `produces` IS the override surface (a separate
1419
+ * list could only duplicate or contradict it); the host's
1420
+ * override endpoints gate on membership.
1386
1421
  */
1387
- readonly implementation: DeclarativeImplementation | TypescriptImplementation;
1422
+ readonly implementation: DeclarativeImplementation | TypescriptImplementation | FormIntakeImplementation | ManualOverrideImplementation;
1423
+ /**
1424
+ * SYS-2502: explicit instance cardinality.
1425
+ *
1426
+ * - `single` — at most one instance per applicant; extract() returns
1427
+ * one AdapterExtraction with `instanceKey: ""`.
1428
+ * - `multi` — unbounded instances per applicant, each with a stable,
1429
+ * non-empty instanceKey.
1430
+ *
1431
+ * OPTIONAL for backward compatibility: manifests written before this
1432
+ * field existed rely on the original implicit convention
1433
+ * (instanceKey `""` → single, non-empty → multi), and the host infers
1434
+ * accordingly when the field is absent. New manifests should declare
1435
+ * it — an explicit declaration lets the host REJECT a mismatched
1436
+ * extraction (a multi-keyed instance from a declared-single adapter,
1437
+ * or vice versa) at persistence time instead of silently storing it.
1438
+ */
1439
+ readonly cardinality?: "single" | "multi";
1440
+ /**
1441
+ * SYS-2502: per-applicant singleton fields on a multi-instance
1442
+ * category — fields whose value describes the APPLICANT (one value
1443
+ * regardless of how many instances exist) rather than the instance,
1444
+ * e.g. accountHolderName on bank statements. Every entry MUST also
1445
+ * appear in `produces` (host validates at registration, same as
1446
+ * `produces` ⊆ category fields). Only meaningful when cardinality is
1447
+ * `multi`; the host treats a singleton field's value as shared across
1448
+ * the instance set.
1449
+ */
1450
+ readonly singletonFields?: ReadonlyArray<CanonicalFieldName>;
1388
1451
  /**
1389
1452
  * v2.7.0 — partner-specific identity fields the adapter needs from
1390
1453
  * the IHS row when fetch() is invoked. Strings name the keys that
@@ -1407,6 +1470,30 @@ interface AdapterManifest {
1407
1470
  * present — declaring them is harmless but unnecessary.
1408
1471
  */
1409
1472
  readonly requiredIdentityFields?: ReadonlyArray<string>;
1473
+ /**
1474
+ * SYS-2503: declarative per-field authorization gating. Keyed by
1475
+ * canonical field name (every key MUST also appear in `produces` —
1476
+ * host validates at registration, same as `singletonFields`).
1477
+ *
1478
+ * Semantics, enforced by the HOST at read time (the manifest only
1479
+ * declares):
1480
+ *
1481
+ * - No entry for a field → visible to every reader (gating is
1482
+ * strictly opt-in; pre-existing manifests are unaffected).
1483
+ * - An entry restricts: the reader must satisfy EVERY dimension
1484
+ * the entry declares (AND across dimensions), matching ANY value
1485
+ * within a dimension's list (OR within a list).
1486
+ * - `lenderRoles` — reader's lender-role identifier must be listed.
1487
+ * - `programIds` — the application's program must be listed.
1488
+ *
1489
+ * Both dimensions are host-interpreted opaque strings: core neither
1490
+ * knows nor validates what a "role" or "program id" is, keeping the
1491
+ * contract deployment-agnostic. An entry must declare at least one
1492
+ * dimension, and a declared dimension must be non-empty — an empty
1493
+ * list would read as deny-all, which is better expressed by simply
1494
+ * not producing the field.
1495
+ */
1496
+ readonly fieldAuthorizations?: Readonly<Partial<Record<CanonicalFieldName, FieldAuthorization>>>;
1410
1497
  /**
1411
1498
  * Optional free-form notes — useful for partner-side documentation
1412
1499
  * (where to find the adapter's source, who owns it, what version of
@@ -1414,6 +1501,22 @@ interface AdapterManifest {
1414
1501
  */
1415
1502
  readonly notes?: string;
1416
1503
  }
1504
+ /**
1505
+ * SYS-2503: one field's authorization gate. See
1506
+ * {@link AdapterManifest.fieldAuthorizations} for semantics.
1507
+ *
1508
+ * A union rather than an all-optional interface so a no-op gate (`{}`)
1509
+ * is unrepresentable at COMPILE time too, not just rejected by the JSON
1510
+ * schema's `minProperties: 1` at runtime — the TS type and the schema
1511
+ * enforce the same invariant at their respective layers.
1512
+ */
1513
+ type FieldAuthorization = {
1514
+ readonly lenderRoles: ReadonlyArray<string>;
1515
+ readonly programIds?: ReadonlyArray<string>;
1516
+ } | {
1517
+ readonly lenderRoles?: ReadonlyArray<string>;
1518
+ readonly programIds: ReadonlyArray<string>;
1519
+ };
1417
1520
  interface DeclarativeImplementation {
1418
1521
  readonly type: "declarative";
1419
1522
  /**
@@ -1432,6 +1535,45 @@ interface TypescriptImplementation {
1432
1535
  */
1433
1536
  readonly entryPoint: string;
1434
1537
  }
1538
+ /**
1539
+ * SYS-2501: data-only implementation for borrower/operator form intake.
1540
+ * The manifest declares which form fields feed which canonical fields;
1541
+ * the host's form submission handler applies the mapping — no adapter
1542
+ * code exists to load, and neither fetch() nor extract() ever runs.
1543
+ */
1544
+ interface FormIntakeImplementation {
1545
+ readonly type: "form-intake";
1546
+ /**
1547
+ * form-field-id → canonical-field mappings. `formFieldId` is the form
1548
+ * spec's field name (the same identifier UnifiedFormConfig fields
1549
+ * carry); `canonical` MUST be declared by the adapter's category —
1550
+ * host validates at registration, exactly like declarative fieldMap
1551
+ * entries. Values arrive already typed from the form layer, so there
1552
+ * is deliberately no transform slot here: a form field needing value
1553
+ * transformation is a form-spec concern, not an adapter one.
1554
+ */
1555
+ readonly fieldMap: ReadonlyArray<FormIntakeFieldMapEntry>;
1556
+ }
1557
+ interface FormIntakeFieldMapEntry {
1558
+ /** The form spec's field name this mapping consumes. */
1559
+ readonly formFieldId: string;
1560
+ /**
1561
+ * Canonical field name this maps to. MUST be declared by the
1562
+ * adapter's category. Host validates at registration.
1563
+ */
1564
+ readonly canonical: CanonicalFieldName;
1565
+ }
1566
+ /**
1567
+ * SYS-2501: data-only implementation declaring that the adapter's
1568
+ * `produces` list is operator-overridable post-extraction. The manifest
1569
+ * gates the override surface; the host's override endpoints check
1570
+ * membership in `produces` before accepting a manual value. No code, no
1571
+ * fetch(), no extract() — the discriminator alone carries the meaning,
1572
+ * so this shape is intentionally empty beyond `type`.
1573
+ */
1574
+ interface ManualOverrideImplementation {
1575
+ readonly type: "manual-override";
1576
+ }
1435
1577
  interface FieldMapEntry {
1436
1578
  /**
1437
1579
  * JSONPath expression into the raw payload. E.g.
@@ -1459,4 +1601,4 @@ interface FieldMapEntry {
1459
1601
  readonly transform?: "identity" | "pct_to_ratio01" | "to_boolean" | "to_integer";
1460
1602
  }
1461
1603
 
1462
- 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, 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 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 };
1604
+ 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 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
@@ -990,6 +990,30 @@ interface AdapterExtraction {
990
990
  * The canonical field values for this instance.
991
991
  */
992
992
  readonly values: CanonicalFieldValues;
993
+ /**
994
+ * SYS-2502: when this instance's data was OBSERVED at the source
995
+ * (ISO-8601) — the statement's own date, the partner snapshot's
996
+ * timestamp — as distinct from when the adapter RAN. Optional for
997
+ * backward compatibility with already-shipped adapters (the host
998
+ * falls back to the run's ranAt when absent, exactly the inference
999
+ * it always did), but new adapters should treat it as required:
1000
+ * ranAt-inference conflates "when we fetched" with "when it was
1001
+ * true", which corrupts recency ordering for backfilled or delayed
1002
+ * data. Expected to become mandatory at the next major version.
1003
+ */
1004
+ readonly observedAt?: string;
1005
+ /**
1006
+ * SYS-2502 (prototyped in finsys-api under SYS-2977): optional
1007
+ * per-field extraction confidence, 0..1, keyed by canonical field
1008
+ * name. This is the provenance slot SYS-2819 identified as the
1009
+ * missing precondition for FinXtract-as-adapter — probabilistic
1010
+ * extractors (OCR/LLM) carry real per-field confidence; partner-API
1011
+ * adapters (a telco returning a number) simply omit it. `null` marks
1012
+ * a field whose value is derived/computed rather than directly
1013
+ * extracted (renders as "no confidence" rather than low confidence,
1014
+ * matching IhsFieldProvenance.origin semantics).
1015
+ */
1016
+ readonly confidence?: Partial<Record<CanonicalFieldName, number | null>>;
993
1017
  }
994
1018
  /**
995
1019
  * Allowed value shapes for canonical fields. Per-field type narrowing
@@ -1383,8 +1407,47 @@ interface AdapterManifest {
1383
1407
  * code is loaded.
1384
1408
  * - `typescript` — TS/JS adapter; `entryPoint` is required, the
1385
1409
  * host imports it dynamically.
1410
+ * - `form-intake` — SYS-2501: data-only adapter declaring
1411
+ * form-field-id → canonical-field mappings. No code is loaded and
1412
+ * no fetch()/extract() ever runs; the host's form submission
1413
+ * handler IS the runtime, and this manifest is how a
1414
+ * borrower-entered scalar becomes a canonical, provenance-carrying
1415
+ * field instead of a hand-wired column write.
1416
+ * - `manual-override` — SYS-2501: data-only adapter declaring that
1417
+ * this category's fields may be operator-overridden
1418
+ * post-extraction. `produces` IS the override surface (a separate
1419
+ * list could only duplicate or contradict it); the host's
1420
+ * override endpoints gate on membership.
1386
1421
  */
1387
- readonly implementation: DeclarativeImplementation | TypescriptImplementation;
1422
+ readonly implementation: DeclarativeImplementation | TypescriptImplementation | FormIntakeImplementation | ManualOverrideImplementation;
1423
+ /**
1424
+ * SYS-2502: explicit instance cardinality.
1425
+ *
1426
+ * - `single` — at most one instance per applicant; extract() returns
1427
+ * one AdapterExtraction with `instanceKey: ""`.
1428
+ * - `multi` — unbounded instances per applicant, each with a stable,
1429
+ * non-empty instanceKey.
1430
+ *
1431
+ * OPTIONAL for backward compatibility: manifests written before this
1432
+ * field existed rely on the original implicit convention
1433
+ * (instanceKey `""` → single, non-empty → multi), and the host infers
1434
+ * accordingly when the field is absent. New manifests should declare
1435
+ * it — an explicit declaration lets the host REJECT a mismatched
1436
+ * extraction (a multi-keyed instance from a declared-single adapter,
1437
+ * or vice versa) at persistence time instead of silently storing it.
1438
+ */
1439
+ readonly cardinality?: "single" | "multi";
1440
+ /**
1441
+ * SYS-2502: per-applicant singleton fields on a multi-instance
1442
+ * category — fields whose value describes the APPLICANT (one value
1443
+ * regardless of how many instances exist) rather than the instance,
1444
+ * e.g. accountHolderName on bank statements. Every entry MUST also
1445
+ * appear in `produces` (host validates at registration, same as
1446
+ * `produces` ⊆ category fields). Only meaningful when cardinality is
1447
+ * `multi`; the host treats a singleton field's value as shared across
1448
+ * the instance set.
1449
+ */
1450
+ readonly singletonFields?: ReadonlyArray<CanonicalFieldName>;
1388
1451
  /**
1389
1452
  * v2.7.0 — partner-specific identity fields the adapter needs from
1390
1453
  * the IHS row when fetch() is invoked. Strings name the keys that
@@ -1407,6 +1470,30 @@ interface AdapterManifest {
1407
1470
  * present — declaring them is harmless but unnecessary.
1408
1471
  */
1409
1472
  readonly requiredIdentityFields?: ReadonlyArray<string>;
1473
+ /**
1474
+ * SYS-2503: declarative per-field authorization gating. Keyed by
1475
+ * canonical field name (every key MUST also appear in `produces` —
1476
+ * host validates at registration, same as `singletonFields`).
1477
+ *
1478
+ * Semantics, enforced by the HOST at read time (the manifest only
1479
+ * declares):
1480
+ *
1481
+ * - No entry for a field → visible to every reader (gating is
1482
+ * strictly opt-in; pre-existing manifests are unaffected).
1483
+ * - An entry restricts: the reader must satisfy EVERY dimension
1484
+ * the entry declares (AND across dimensions), matching ANY value
1485
+ * within a dimension's list (OR within a list).
1486
+ * - `lenderRoles` — reader's lender-role identifier must be listed.
1487
+ * - `programIds` — the application's program must be listed.
1488
+ *
1489
+ * Both dimensions are host-interpreted opaque strings: core neither
1490
+ * knows nor validates what a "role" or "program id" is, keeping the
1491
+ * contract deployment-agnostic. An entry must declare at least one
1492
+ * dimension, and a declared dimension must be non-empty — an empty
1493
+ * list would read as deny-all, which is better expressed by simply
1494
+ * not producing the field.
1495
+ */
1496
+ readonly fieldAuthorizations?: Readonly<Partial<Record<CanonicalFieldName, FieldAuthorization>>>;
1410
1497
  /**
1411
1498
  * Optional free-form notes — useful for partner-side documentation
1412
1499
  * (where to find the adapter's source, who owns it, what version of
@@ -1414,6 +1501,22 @@ interface AdapterManifest {
1414
1501
  */
1415
1502
  readonly notes?: string;
1416
1503
  }
1504
+ /**
1505
+ * SYS-2503: one field's authorization gate. See
1506
+ * {@link AdapterManifest.fieldAuthorizations} for semantics.
1507
+ *
1508
+ * A union rather than an all-optional interface so a no-op gate (`{}`)
1509
+ * is unrepresentable at COMPILE time too, not just rejected by the JSON
1510
+ * schema's `minProperties: 1` at runtime — the TS type and the schema
1511
+ * enforce the same invariant at their respective layers.
1512
+ */
1513
+ type FieldAuthorization = {
1514
+ readonly lenderRoles: ReadonlyArray<string>;
1515
+ readonly programIds?: ReadonlyArray<string>;
1516
+ } | {
1517
+ readonly lenderRoles?: ReadonlyArray<string>;
1518
+ readonly programIds: ReadonlyArray<string>;
1519
+ };
1417
1520
  interface DeclarativeImplementation {
1418
1521
  readonly type: "declarative";
1419
1522
  /**
@@ -1432,6 +1535,45 @@ interface TypescriptImplementation {
1432
1535
  */
1433
1536
  readonly entryPoint: string;
1434
1537
  }
1538
+ /**
1539
+ * SYS-2501: data-only implementation for borrower/operator form intake.
1540
+ * The manifest declares which form fields feed which canonical fields;
1541
+ * the host's form submission handler applies the mapping — no adapter
1542
+ * code exists to load, and neither fetch() nor extract() ever runs.
1543
+ */
1544
+ interface FormIntakeImplementation {
1545
+ readonly type: "form-intake";
1546
+ /**
1547
+ * form-field-id → canonical-field mappings. `formFieldId` is the form
1548
+ * spec's field name (the same identifier UnifiedFormConfig fields
1549
+ * carry); `canonical` MUST be declared by the adapter's category —
1550
+ * host validates at registration, exactly like declarative fieldMap
1551
+ * entries. Values arrive already typed from the form layer, so there
1552
+ * is deliberately no transform slot here: a form field needing value
1553
+ * transformation is a form-spec concern, not an adapter one.
1554
+ */
1555
+ readonly fieldMap: ReadonlyArray<FormIntakeFieldMapEntry>;
1556
+ }
1557
+ interface FormIntakeFieldMapEntry {
1558
+ /** The form spec's field name this mapping consumes. */
1559
+ readonly formFieldId: string;
1560
+ /**
1561
+ * Canonical field name this maps to. MUST be declared by the
1562
+ * adapter's category. Host validates at registration.
1563
+ */
1564
+ readonly canonical: CanonicalFieldName;
1565
+ }
1566
+ /**
1567
+ * SYS-2501: data-only implementation declaring that the adapter's
1568
+ * `produces` list is operator-overridable post-extraction. The manifest
1569
+ * gates the override surface; the host's override endpoints check
1570
+ * membership in `produces` before accepting a manual value. No code, no
1571
+ * fetch(), no extract() — the discriminator alone carries the meaning,
1572
+ * so this shape is intentionally empty beyond `type`.
1573
+ */
1574
+ interface ManualOverrideImplementation {
1575
+ readonly type: "manual-override";
1576
+ }
1435
1577
  interface FieldMapEntry {
1436
1578
  /**
1437
1579
  * JSONPath expression into the raw payload. E.g.
@@ -1459,4 +1601,4 @@ interface FieldMapEntry {
1459
1601
  readonly transform?: "identity" | "pct_to_ratio01" | "to_boolean" | "to_integer";
1460
1602
  }
1461
1603
 
1462
- 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, 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 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 };
1604
+ 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 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 };