@finsys/core 4.4.0 → 4.6.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/data/adapter-categories.json +734 -0
- package/dist/index.cjs +734 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +119 -7
- package/dist/index.d.ts +119 -7
- package/dist/index.js +734 -0
- package/dist/index.js.map +1 -1
- package/dist/schema/adapter-manifest.schema.json +23 -0
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -974,6 +974,11 @@ type CanonicalFieldValues = Partial<Record<CanonicalFieldName, CanonicalFieldVal
|
|
|
974
974
|
* MUST be stable across re-extractions so the storage layer can
|
|
975
975
|
* replace-in-place rather than accumulating duplicates. Conventions:
|
|
976
976
|
* - For periodic data: encode the period (`'2026-Q1'`, `'2026-03'`)
|
|
977
|
+
* NOTE (SYS-3002): that is the multi-INSTANCE axis — one snapshot per
|
|
978
|
+
* instance. Do NOT encode a within-document period into the instance
|
|
979
|
+
* key; period-scoped values belong in `periods` (contractual 1-based
|
|
980
|
+
* positions). The two axes compose: instance = which document/snapshot,
|
|
981
|
+
* period = which declared position within it.
|
|
977
982
|
* - For per-line data: encode the line id (`'msisdn-60123456789'`,
|
|
978
983
|
* `'card-last4-1234'`)
|
|
979
984
|
* - For natively single-instance adapters: use the empty string `''`
|
|
@@ -1014,6 +1019,62 @@ interface AdapterExtraction {
|
|
|
1014
1019
|
* matching IhsFieldProvenance.origin semantics).
|
|
1015
1020
|
*/
|
|
1016
1021
|
readonly confidence?: Partial<Record<CanonicalFieldName, number | null>>;
|
|
1022
|
+
/**
|
|
1023
|
+
* SYS-3002: per-period value sets for adapters whose category
|
|
1024
|
+
* declares a period axis (see `AdapterManifest.periods`). Each entry
|
|
1025
|
+
* carries the values for ONE contractual position; `position` is
|
|
1026
|
+
* 1-based — period1 is the first declared period, there is no
|
|
1027
|
+
* period0.
|
|
1028
|
+
*
|
|
1029
|
+
* An instance carrying `periods` uses them for period-scoped fields,
|
|
1030
|
+
* while the instance-level `values` above remains the home for
|
|
1031
|
+
* period-less (singleton / instance-scoped) fields. Instances of
|
|
1032
|
+
* single-period adapters (no `periods` on the manifest) omit this
|
|
1033
|
+
* entirely and keep everything in `values` — the existing flat path
|
|
1034
|
+
* is unchanged and remains the single-period path.
|
|
1035
|
+
*
|
|
1036
|
+
* Periods are scoped WITHIN this instance: this instance's period1
|
|
1037
|
+
* and another instance's period1 are unrelated data points.
|
|
1038
|
+
*/
|
|
1039
|
+
readonly periods?: ReadonlyArray<PeriodValues>;
|
|
1040
|
+
}
|
|
1041
|
+
/**
|
|
1042
|
+
* SYS-3002: one period's value set within an AdapterExtraction
|
|
1043
|
+
* instance. Identity is `position` — the 1-based index into the
|
|
1044
|
+
* manifest's declared `periods` array — never the dates: declared
|
|
1045
|
+
* positions may overlap, nest, vary in length, or be staggered (e.g.
|
|
1046
|
+
* period1 = an annual table, periods 2–5 = the four quarters
|
|
1047
|
+
* overlapping it), so dates cannot identify a period and recency
|
|
1048
|
+
* ordering across positions is meaningless.
|
|
1049
|
+
*/
|
|
1050
|
+
interface PeriodValues {
|
|
1051
|
+
/**
|
|
1052
|
+
* 1-based contractual position into the manifest's `periods`
|
|
1053
|
+
* declaration. MUST be >= 1 — period1 is the first declared period;
|
|
1054
|
+
* there is no period0. This IS the period's identity.
|
|
1055
|
+
*/
|
|
1056
|
+
readonly position: number;
|
|
1057
|
+
/**
|
|
1058
|
+
* ISO-8601 date the period starts — display/temporal metadata only,
|
|
1059
|
+
* NEVER identity.
|
|
1060
|
+
*/
|
|
1061
|
+
readonly start?: string;
|
|
1062
|
+
/**
|
|
1063
|
+
* ISO-8601 date the period ends — display/temporal metadata only,
|
|
1064
|
+
* NEVER identity.
|
|
1065
|
+
*/
|
|
1066
|
+
readonly end?: string;
|
|
1067
|
+
/**
|
|
1068
|
+
* The canonical field values for this period, same shape as the
|
|
1069
|
+
* instance-level `values`.
|
|
1070
|
+
*/
|
|
1071
|
+
readonly values: CanonicalFieldValues;
|
|
1072
|
+
/**
|
|
1073
|
+
* Optional per-field extraction confidence for this period's values,
|
|
1074
|
+
* same semantics as the instance-level `confidence` (0..1 keyed by
|
|
1075
|
+
* canonical field name; `null` marks a derived/computed value).
|
|
1076
|
+
*/
|
|
1077
|
+
readonly confidence?: Partial<Record<CanonicalFieldName, number | null>>;
|
|
1017
1078
|
}
|
|
1018
1079
|
/**
|
|
1019
1080
|
* Allowed value shapes for canonical fields. Per-field type narrowing
|
|
@@ -1036,8 +1097,8 @@ type CanonicalFieldValue = number | string | boolean | null;
|
|
|
1036
1097
|
* stay assignment-compatible. A telco adapter that needs an MSISDN
|
|
1037
1098
|
* declares it once at the interface level:
|
|
1038
1099
|
*
|
|
1039
|
-
* interface
|
|
1040
|
-
* const
|
|
1100
|
+
* interface TelcoPartnerExt { msisdn: string }
|
|
1101
|
+
* const telcoAdapter: SourceAdapter<TelcoPartnerExt> = {
|
|
1041
1102
|
* async fetch(identity) {
|
|
1042
1103
|
* identity.msisdn // string (typed via E)
|
|
1043
1104
|
* identity.ic // string (core)
|
|
@@ -1051,7 +1112,7 @@ type CanonicalFieldValue = number | string | boolean | null;
|
|
|
1051
1112
|
interface SourceAdapter<E extends Record<string, unknown> = {}> {
|
|
1052
1113
|
/**
|
|
1053
1114
|
* Globally unique id for this adapter instance. By convention:
|
|
1054
|
-
* `<vendor>-<category-short>-v<n>` — e.g. `
|
|
1115
|
+
* `<vendor>-<category-short>-v<n>` — e.g. `example-telco-v1`. Vendor
|
|
1055
1116
|
* names appear here in deployment-specific code, NEVER in
|
|
1056
1117
|
* finsys-core. The id is what the registry uses to dedupe + what
|
|
1057
1118
|
* provenance records pin to.
|
|
@@ -1188,10 +1249,10 @@ interface SourceAdapter<E extends Record<string, unknown> = {}> {
|
|
|
1188
1249
|
*
|
|
1189
1250
|
* Narrowing example (the ergonomics win this type is designed to deliver):
|
|
1190
1251
|
*
|
|
1191
|
-
* interface
|
|
1252
|
+
* interface TelcoPartnerExt { msisdn: string; accountRef: string }
|
|
1192
1253
|
*
|
|
1193
1254
|
* // declare adapter with the extension shape baked in:
|
|
1194
|
-
* const
|
|
1255
|
+
* const telcoAdapter: SourceAdapter<TelcoPartnerExt> = {
|
|
1195
1256
|
* async fetch(identity) {
|
|
1196
1257
|
* identity.ic // string
|
|
1197
1258
|
* identity.msisdn // string (NOT unknown — narrowed by E)
|
|
@@ -1373,7 +1434,7 @@ interface AdapterManifest {
|
|
|
1373
1434
|
readonly manifestVersion: 1;
|
|
1374
1435
|
/**
|
|
1375
1436
|
* Globally unique adapter id. Conventional pattern:
|
|
1376
|
-
* `<vendor>-<category-short>-v<n>` (e.g. `
|
|
1437
|
+
* `<vendor>-<category-short>-v<n>` (e.g. `example-telco-v1`). The id is
|
|
1377
1438
|
* what `SourceAdapter#id` returns + what provenance records pin to.
|
|
1378
1439
|
*/
|
|
1379
1440
|
readonly id: string;
|
|
@@ -1501,6 +1562,41 @@ interface AdapterManifest {
|
|
|
1501
1562
|
* not producing the field.
|
|
1502
1563
|
*/
|
|
1503
1564
|
readonly fieldAuthorizations?: Readonly<Partial<Record<CanonicalFieldName, FieldAuthorization>>>;
|
|
1565
|
+
/**
|
|
1566
|
+
* SYS-3002: ordered period declarations — the contract for the
|
|
1567
|
+
* period axis of this adapter's category.
|
|
1568
|
+
*
|
|
1569
|
+
* The period axis is ordered BY CONTRACT: `periodN` is a POSITIONAL
|
|
1570
|
+
* identifier into this array. Numbering is 1-BASED — period1 is the
|
|
1571
|
+
* FIRST declared period (array index 0); there is no period0.
|
|
1572
|
+
* Position is the period's IDENTITY: two extractions' period1 values
|
|
1573
|
+
* are comparable because they occupy the same contractual slot, not
|
|
1574
|
+
* because their dates match.
|
|
1575
|
+
*
|
|
1576
|
+
* Declared positions may overlap, nest, vary in length, or be
|
|
1577
|
+
* staggered — e.g. period1 = an annual table, periods 2–5 = the four
|
|
1578
|
+
* quarters overlapping it. The declaration makes no statement about
|
|
1579
|
+
* dates; each extraction-time period carries its own dated metadata
|
|
1580
|
+
* (see `PeriodValues.start`/`end`) for display and temporal
|
|
1581
|
+
* reasoning, never for identity. Periods are scoped WITHIN one
|
|
1582
|
+
* instance: one document's period1 and another document's period1
|
|
1583
|
+
* are unrelated data points.
|
|
1584
|
+
*
|
|
1585
|
+
* ABSENT means the single-period convention: the adapter's output
|
|
1586
|
+
* has exactly one implicit period, and instance-level `values` is
|
|
1587
|
+
* that period's value set. Single-period categories (bank
|
|
1588
|
+
* statements, EPF, payslips) never need to declare. Non-empty when
|
|
1589
|
+
* present — declaring zero periods would contradict the implicit
|
|
1590
|
+
* single-period convention, so the schema requires at least one
|
|
1591
|
+
* entry.
|
|
1592
|
+
*
|
|
1593
|
+
* The motivating consumer is financial statements — one document
|
|
1594
|
+
* carries period1 (its current fiscal year) plus period2 (its prior
|
|
1595
|
+
* comparative year) — but any implementation type may declare
|
|
1596
|
+
* periods: the axis is a property of the contract, not of how the
|
|
1597
|
+
* adapter is implemented.
|
|
1598
|
+
*/
|
|
1599
|
+
readonly periods?: ReadonlyArray<PeriodDeclaration>;
|
|
1504
1600
|
/**
|
|
1505
1601
|
* Optional free-form notes — useful for partner-side documentation
|
|
1506
1602
|
* (where to find the adapter's source, who owns it, what version of
|
|
@@ -1508,6 +1604,22 @@ interface AdapterManifest {
|
|
|
1508
1604
|
*/
|
|
1509
1605
|
readonly notes?: string;
|
|
1510
1606
|
}
|
|
1607
|
+
/**
|
|
1608
|
+
* SYS-3002: one declared period on the adapter's period axis. See
|
|
1609
|
+
* {@link AdapterManifest.periods} for the positional (1-based) identity
|
|
1610
|
+
* semantics — the entry's position in the `periods` array IS the
|
|
1611
|
+
* period's identity; the entry itself only labels the role.
|
|
1612
|
+
*/
|
|
1613
|
+
interface PeriodDeclaration {
|
|
1614
|
+
/**
|
|
1615
|
+
* Human role label for the position, e.g. "Current fiscal year",
|
|
1616
|
+
* "Prior comparative year". Rendered in operator UIs; carries no
|
|
1617
|
+
* identity semantics.
|
|
1618
|
+
*/
|
|
1619
|
+
readonly name: string;
|
|
1620
|
+
/** Optional longer description of what this position holds. */
|
|
1621
|
+
readonly description?: string;
|
|
1622
|
+
}
|
|
1511
1623
|
/**
|
|
1512
1624
|
* SYS-2503: one field's authorization gate. See
|
|
1513
1625
|
* {@link AdapterManifest.fieldAuthorizations} for semantics.
|
|
@@ -1628,4 +1740,4 @@ interface FieldMapEntry {
|
|
|
1628
1740
|
readonly transform?: "identity" | "pct_to_ratio01" | "to_boolean" | "to_integer";
|
|
1629
1741
|
}
|
|
1630
1742
|
|
|
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 };
|
|
1743
|
+
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 PeriodDeclaration, type PeriodValues, 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
|
@@ -974,6 +974,11 @@ type CanonicalFieldValues = Partial<Record<CanonicalFieldName, CanonicalFieldVal
|
|
|
974
974
|
* MUST be stable across re-extractions so the storage layer can
|
|
975
975
|
* replace-in-place rather than accumulating duplicates. Conventions:
|
|
976
976
|
* - For periodic data: encode the period (`'2026-Q1'`, `'2026-03'`)
|
|
977
|
+
* NOTE (SYS-3002): that is the multi-INSTANCE axis — one snapshot per
|
|
978
|
+
* instance. Do NOT encode a within-document period into the instance
|
|
979
|
+
* key; period-scoped values belong in `periods` (contractual 1-based
|
|
980
|
+
* positions). The two axes compose: instance = which document/snapshot,
|
|
981
|
+
* period = which declared position within it.
|
|
977
982
|
* - For per-line data: encode the line id (`'msisdn-60123456789'`,
|
|
978
983
|
* `'card-last4-1234'`)
|
|
979
984
|
* - For natively single-instance adapters: use the empty string `''`
|
|
@@ -1014,6 +1019,62 @@ interface AdapterExtraction {
|
|
|
1014
1019
|
* matching IhsFieldProvenance.origin semantics).
|
|
1015
1020
|
*/
|
|
1016
1021
|
readonly confidence?: Partial<Record<CanonicalFieldName, number | null>>;
|
|
1022
|
+
/**
|
|
1023
|
+
* SYS-3002: per-period value sets for adapters whose category
|
|
1024
|
+
* declares a period axis (see `AdapterManifest.periods`). Each entry
|
|
1025
|
+
* carries the values for ONE contractual position; `position` is
|
|
1026
|
+
* 1-based — period1 is the first declared period, there is no
|
|
1027
|
+
* period0.
|
|
1028
|
+
*
|
|
1029
|
+
* An instance carrying `periods` uses them for period-scoped fields,
|
|
1030
|
+
* while the instance-level `values` above remains the home for
|
|
1031
|
+
* period-less (singleton / instance-scoped) fields. Instances of
|
|
1032
|
+
* single-period adapters (no `periods` on the manifest) omit this
|
|
1033
|
+
* entirely and keep everything in `values` — the existing flat path
|
|
1034
|
+
* is unchanged and remains the single-period path.
|
|
1035
|
+
*
|
|
1036
|
+
* Periods are scoped WITHIN this instance: this instance's period1
|
|
1037
|
+
* and another instance's period1 are unrelated data points.
|
|
1038
|
+
*/
|
|
1039
|
+
readonly periods?: ReadonlyArray<PeriodValues>;
|
|
1040
|
+
}
|
|
1041
|
+
/**
|
|
1042
|
+
* SYS-3002: one period's value set within an AdapterExtraction
|
|
1043
|
+
* instance. Identity is `position` — the 1-based index into the
|
|
1044
|
+
* manifest's declared `periods` array — never the dates: declared
|
|
1045
|
+
* positions may overlap, nest, vary in length, or be staggered (e.g.
|
|
1046
|
+
* period1 = an annual table, periods 2–5 = the four quarters
|
|
1047
|
+
* overlapping it), so dates cannot identify a period and recency
|
|
1048
|
+
* ordering across positions is meaningless.
|
|
1049
|
+
*/
|
|
1050
|
+
interface PeriodValues {
|
|
1051
|
+
/**
|
|
1052
|
+
* 1-based contractual position into the manifest's `periods`
|
|
1053
|
+
* declaration. MUST be >= 1 — period1 is the first declared period;
|
|
1054
|
+
* there is no period0. This IS the period's identity.
|
|
1055
|
+
*/
|
|
1056
|
+
readonly position: number;
|
|
1057
|
+
/**
|
|
1058
|
+
* ISO-8601 date the period starts — display/temporal metadata only,
|
|
1059
|
+
* NEVER identity.
|
|
1060
|
+
*/
|
|
1061
|
+
readonly start?: string;
|
|
1062
|
+
/**
|
|
1063
|
+
* ISO-8601 date the period ends — display/temporal metadata only,
|
|
1064
|
+
* NEVER identity.
|
|
1065
|
+
*/
|
|
1066
|
+
readonly end?: string;
|
|
1067
|
+
/**
|
|
1068
|
+
* The canonical field values for this period, same shape as the
|
|
1069
|
+
* instance-level `values`.
|
|
1070
|
+
*/
|
|
1071
|
+
readonly values: CanonicalFieldValues;
|
|
1072
|
+
/**
|
|
1073
|
+
* Optional per-field extraction confidence for this period's values,
|
|
1074
|
+
* same semantics as the instance-level `confidence` (0..1 keyed by
|
|
1075
|
+
* canonical field name; `null` marks a derived/computed value).
|
|
1076
|
+
*/
|
|
1077
|
+
readonly confidence?: Partial<Record<CanonicalFieldName, number | null>>;
|
|
1017
1078
|
}
|
|
1018
1079
|
/**
|
|
1019
1080
|
* Allowed value shapes for canonical fields. Per-field type narrowing
|
|
@@ -1036,8 +1097,8 @@ type CanonicalFieldValue = number | string | boolean | null;
|
|
|
1036
1097
|
* stay assignment-compatible. A telco adapter that needs an MSISDN
|
|
1037
1098
|
* declares it once at the interface level:
|
|
1038
1099
|
*
|
|
1039
|
-
* interface
|
|
1040
|
-
* const
|
|
1100
|
+
* interface TelcoPartnerExt { msisdn: string }
|
|
1101
|
+
* const telcoAdapter: SourceAdapter<TelcoPartnerExt> = {
|
|
1041
1102
|
* async fetch(identity) {
|
|
1042
1103
|
* identity.msisdn // string (typed via E)
|
|
1043
1104
|
* identity.ic // string (core)
|
|
@@ -1051,7 +1112,7 @@ type CanonicalFieldValue = number | string | boolean | null;
|
|
|
1051
1112
|
interface SourceAdapter<E extends Record<string, unknown> = {}> {
|
|
1052
1113
|
/**
|
|
1053
1114
|
* Globally unique id for this adapter instance. By convention:
|
|
1054
|
-
* `<vendor>-<category-short>-v<n>` — e.g. `
|
|
1115
|
+
* `<vendor>-<category-short>-v<n>` — e.g. `example-telco-v1`. Vendor
|
|
1055
1116
|
* names appear here in deployment-specific code, NEVER in
|
|
1056
1117
|
* finsys-core. The id is what the registry uses to dedupe + what
|
|
1057
1118
|
* provenance records pin to.
|
|
@@ -1188,10 +1249,10 @@ interface SourceAdapter<E extends Record<string, unknown> = {}> {
|
|
|
1188
1249
|
*
|
|
1189
1250
|
* Narrowing example (the ergonomics win this type is designed to deliver):
|
|
1190
1251
|
*
|
|
1191
|
-
* interface
|
|
1252
|
+
* interface TelcoPartnerExt { msisdn: string; accountRef: string }
|
|
1192
1253
|
*
|
|
1193
1254
|
* // declare adapter with the extension shape baked in:
|
|
1194
|
-
* const
|
|
1255
|
+
* const telcoAdapter: SourceAdapter<TelcoPartnerExt> = {
|
|
1195
1256
|
* async fetch(identity) {
|
|
1196
1257
|
* identity.ic // string
|
|
1197
1258
|
* identity.msisdn // string (NOT unknown — narrowed by E)
|
|
@@ -1373,7 +1434,7 @@ interface AdapterManifest {
|
|
|
1373
1434
|
readonly manifestVersion: 1;
|
|
1374
1435
|
/**
|
|
1375
1436
|
* Globally unique adapter id. Conventional pattern:
|
|
1376
|
-
* `<vendor>-<category-short>-v<n>` (e.g. `
|
|
1437
|
+
* `<vendor>-<category-short>-v<n>` (e.g. `example-telco-v1`). The id is
|
|
1377
1438
|
* what `SourceAdapter#id` returns + what provenance records pin to.
|
|
1378
1439
|
*/
|
|
1379
1440
|
readonly id: string;
|
|
@@ -1501,6 +1562,41 @@ interface AdapterManifest {
|
|
|
1501
1562
|
* not producing the field.
|
|
1502
1563
|
*/
|
|
1503
1564
|
readonly fieldAuthorizations?: Readonly<Partial<Record<CanonicalFieldName, FieldAuthorization>>>;
|
|
1565
|
+
/**
|
|
1566
|
+
* SYS-3002: ordered period declarations — the contract for the
|
|
1567
|
+
* period axis of this adapter's category.
|
|
1568
|
+
*
|
|
1569
|
+
* The period axis is ordered BY CONTRACT: `periodN` is a POSITIONAL
|
|
1570
|
+
* identifier into this array. Numbering is 1-BASED — period1 is the
|
|
1571
|
+
* FIRST declared period (array index 0); there is no period0.
|
|
1572
|
+
* Position is the period's IDENTITY: two extractions' period1 values
|
|
1573
|
+
* are comparable because they occupy the same contractual slot, not
|
|
1574
|
+
* because their dates match.
|
|
1575
|
+
*
|
|
1576
|
+
* Declared positions may overlap, nest, vary in length, or be
|
|
1577
|
+
* staggered — e.g. period1 = an annual table, periods 2–5 = the four
|
|
1578
|
+
* quarters overlapping it. The declaration makes no statement about
|
|
1579
|
+
* dates; each extraction-time period carries its own dated metadata
|
|
1580
|
+
* (see `PeriodValues.start`/`end`) for display and temporal
|
|
1581
|
+
* reasoning, never for identity. Periods are scoped WITHIN one
|
|
1582
|
+
* instance: one document's period1 and another document's period1
|
|
1583
|
+
* are unrelated data points.
|
|
1584
|
+
*
|
|
1585
|
+
* ABSENT means the single-period convention: the adapter's output
|
|
1586
|
+
* has exactly one implicit period, and instance-level `values` is
|
|
1587
|
+
* that period's value set. Single-period categories (bank
|
|
1588
|
+
* statements, EPF, payslips) never need to declare. Non-empty when
|
|
1589
|
+
* present — declaring zero periods would contradict the implicit
|
|
1590
|
+
* single-period convention, so the schema requires at least one
|
|
1591
|
+
* entry.
|
|
1592
|
+
*
|
|
1593
|
+
* The motivating consumer is financial statements — one document
|
|
1594
|
+
* carries period1 (its current fiscal year) plus period2 (its prior
|
|
1595
|
+
* comparative year) — but any implementation type may declare
|
|
1596
|
+
* periods: the axis is a property of the contract, not of how the
|
|
1597
|
+
* adapter is implemented.
|
|
1598
|
+
*/
|
|
1599
|
+
readonly periods?: ReadonlyArray<PeriodDeclaration>;
|
|
1504
1600
|
/**
|
|
1505
1601
|
* Optional free-form notes — useful for partner-side documentation
|
|
1506
1602
|
* (where to find the adapter's source, who owns it, what version of
|
|
@@ -1508,6 +1604,22 @@ interface AdapterManifest {
|
|
|
1508
1604
|
*/
|
|
1509
1605
|
readonly notes?: string;
|
|
1510
1606
|
}
|
|
1607
|
+
/**
|
|
1608
|
+
* SYS-3002: one declared period on the adapter's period axis. See
|
|
1609
|
+
* {@link AdapterManifest.periods} for the positional (1-based) identity
|
|
1610
|
+
* semantics — the entry's position in the `periods` array IS the
|
|
1611
|
+
* period's identity; the entry itself only labels the role.
|
|
1612
|
+
*/
|
|
1613
|
+
interface PeriodDeclaration {
|
|
1614
|
+
/**
|
|
1615
|
+
* Human role label for the position, e.g. "Current fiscal year",
|
|
1616
|
+
* "Prior comparative year". Rendered in operator UIs; carries no
|
|
1617
|
+
* identity semantics.
|
|
1618
|
+
*/
|
|
1619
|
+
readonly name: string;
|
|
1620
|
+
/** Optional longer description of what this position holds. */
|
|
1621
|
+
readonly description?: string;
|
|
1622
|
+
}
|
|
1511
1623
|
/**
|
|
1512
1624
|
* SYS-2503: one field's authorization gate. See
|
|
1513
1625
|
* {@link AdapterManifest.fieldAuthorizations} for semantics.
|
|
@@ -1628,4 +1740,4 @@ interface FieldMapEntry {
|
|
|
1628
1740
|
readonly transform?: "identity" | "pct_to_ratio01" | "to_boolean" | "to_integer";
|
|
1629
1741
|
}
|
|
1630
1742
|
|
|
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 };
|
|
1743
|
+
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 PeriodDeclaration, type PeriodValues, 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 };
|