@finsys/core 3.5.0 → 4.0.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/form-field-base-specs.json +134 -20
- package/dist/index.cjs +204 -76
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +57 -13
- package/dist/index.d.ts +57 -13
- package/dist/index.js +201 -75
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -519,8 +519,15 @@ declare function getDisplayNames(): Record<string, string>;
|
|
|
519
519
|
declare function getDisplayName(fieldName: string): string;
|
|
520
520
|
declare function extractTimePeriods(columnNames: string[]): string[];
|
|
521
521
|
declare function groupColumnsByTimePeriod(columnNames: string[]): Record<string, Record<string, string>>;
|
|
522
|
+
/**
|
|
523
|
+
* Groups fields by their catalog-declared document_group (falling back to
|
|
524
|
+
* the field's own name for anything untagged). Was a hardcoded, closed
|
|
525
|
+
* prefix-matching table (FIELD_GROUP_PREFIXES) requiring a code edit for
|
|
526
|
+
* every new document type; now reads the same document_group tag the
|
|
527
|
+
* catalog already carries for document-types.ts, so adding a document
|
|
528
|
+
* type is a catalog-only data change.
|
|
529
|
+
*/
|
|
522
530
|
declare function groupFieldsByPattern(fields: FieldData[]): Record<string, FieldData[]>;
|
|
523
|
-
/** Returns human-friendly display names for field groups. */
|
|
524
531
|
declare function getGroupDisplayNames(): Record<string, string>;
|
|
525
532
|
declare function buildFileFieldTables(ihsData: Record<string, unknown>, fieldProvenance?: Record<string, IhsFieldProvenance>): Record<string, FileFieldTableData>;
|
|
526
533
|
/** IHS doc-field key → human label (the fields that become document sections). */
|
|
@@ -583,19 +590,56 @@ declare enum ExtractionJobStatus {
|
|
|
583
590
|
Failed = "failed"
|
|
584
591
|
}
|
|
585
592
|
/**
|
|
586
|
-
* Document types that go through FinXtract extraction.
|
|
587
|
-
*
|
|
588
|
-
*
|
|
593
|
+
* Document types that go through FinXtract extraction. Values must match
|
|
594
|
+
* the `type` field on finsys-api's File entity and the config keys in
|
|
595
|
+
* finXtractApi.api.
|
|
596
|
+
*
|
|
597
|
+
* Was a closed enum (FinancialStatement/BankStatement/Epf/Payslip/Ssm/
|
|
598
|
+
* Form9/Ic) requiring a core release to add a new document type, even
|
|
599
|
+
* though nothing outside finsys-api's own request validation actually
|
|
600
|
+
* needed it to be a closed set (confirmed: zero external consumers
|
|
601
|
+
* import a specific member by name). Now an open string, matching the
|
|
602
|
+
* AdapterCategory precedent (SYS-2500) -- the authoritative set of valid
|
|
603
|
+
* values lives in document-types.ts, derived from the field-spec catalog.
|
|
604
|
+
* Use isDocumentType()/assertDocumentType() from document-types.ts for
|
|
605
|
+
* the runtime validation that used to be the enum's job.
|
|
589
606
|
*/
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
607
|
+
type ExtractionFileType = string;
|
|
608
|
+
|
|
609
|
+
type WireFormat = 'path_array' | 'url_string' | 'path_only';
|
|
610
|
+
type TimePeriodUnit = 'month' | 'year';
|
|
611
|
+
interface DocumentTypeGroup {
|
|
612
|
+
/** Wire/dispatch value, e.g. "bankStatements". */
|
|
613
|
+
readonly documentType: string;
|
|
614
|
+
/** Render/table grouping key, e.g. "ssm_documents". Distinct from documentType -- see module doc. */
|
|
615
|
+
readonly documentGroup: string;
|
|
616
|
+
/** Human-friendly label, e.g. "Bank Statements". */
|
|
617
|
+
readonly label: string;
|
|
618
|
+
/** Reserved for a future borrower-client payload-routing consolidation. Taken from the group's first entry; not enforced consistent across entries (all groups agree today, but a future mixed-format group would silently inherit the first entry's value). */
|
|
619
|
+
readonly wireFormat?: WireFormat;
|
|
620
|
+
/**
|
|
621
|
+
* The catalog's own `type: 'file'` entries belonging to this group, in
|
|
622
|
+
* catalog order. Each entry may carry its own document_slot/
|
|
623
|
+
* time_period_unit -- see TaggedFieldData and the module doc.
|
|
624
|
+
*/
|
|
625
|
+
readonly fields: readonly TaggedFieldData[];
|
|
626
|
+
}
|
|
627
|
+
interface TaggedFieldData extends FieldData {
|
|
628
|
+
document_type?: string;
|
|
629
|
+
document_group?: string;
|
|
630
|
+
document_group_label?: string;
|
|
631
|
+
wire_format?: WireFormat;
|
|
632
|
+
/** Which upload position this field represents (1st document, 2nd, etc). See module doc for why this is distinct from a "time period". */
|
|
633
|
+
document_slot?: number;
|
|
634
|
+
/** What unit document_slot's number measures for this field. */
|
|
635
|
+
time_period_unit?: TimePeriodUnit;
|
|
598
636
|
}
|
|
637
|
+
/** Every registered document type, in catalog declaration order. */
|
|
638
|
+
declare function getDocumentTypeGroups(): readonly DocumentTypeGroup[];
|
|
639
|
+
/** True if `id` is a registered document type (the wire/dispatch value). */
|
|
640
|
+
declare function isDocumentType(id: string): boolean;
|
|
641
|
+
/** Returns `id` if it's a registered document type, otherwise throws. */
|
|
642
|
+
declare function assertDocumentType(id: string): string;
|
|
599
643
|
|
|
600
644
|
/**
|
|
601
645
|
* IHS application status — canonical source of truth, mirroring finsys-api's
|
|
@@ -1348,4 +1392,4 @@ interface FieldMapEntry {
|
|
|
1348
1392
|
readonly transform?: "identity" | "pct_to_ratio01" | "to_boolean" | "to_integer";
|
|
1349
1393
|
}
|
|
1350
1394
|
|
|
1351
|
-
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 Choice, DEFAULT_VALIDATOR_DEFINITIONS, type DeclarativeImplementation, type DocExtractionResult, DocExtractionStatus, type DocumentFileMetadata, type DocumentRow, type DocumentRowCapabilities, type DropdownOption, type EditorValidator, 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_TERMINAL_STATUSES, IHS_VALID_STATUSES, type IhsDetailCategory, type IhsFieldDetail, type IhsFieldProvenance, IhsStatus, IhsValueFormat, type InstanceValue, type PageConfig, type RHFSchemaOutput, type RHFStep, type RawPayload, type ResolvedField, Role, type SourceAdapter, type SurveyElementJSON, type SurveyJSON, type SurveyPageJSON, type TypescriptImplementation, type UnifiedFormConfig, type Validator, allCategories, applyAggregation, applyDynamicTitles, assertAdapterCategory, buildDocumentRows, buildFileFieldTables, categoryFieldsOf, categoryForField, categorySchemaOf, evaluateExpression, extractTimePeriods, formatDocumentSize, formatDocumentType, formatDocumentUploaded, generateRHFSchema, generateSurveyJson, getBaseCategories, getBaseFieldNames, getBaseFieldSpecMap, getBaseFieldSpecs, getCategoryName, getDisplayName, getDisplayNames, getDocDisplayNames, getExtractableDocTypes, getGroupDisplayNames, getPastMonthLabel, getPastYearLabel, getReuploadableDocTypes, getStepDefaultValues, getStepSchema, groupColumnsByTimePeriod, groupDetailsByCategory, groupFieldsByCategory, groupFieldsByPattern, isAdapterCategory, isFailureIhsStatus, isTerminalIhsStatus, isValidIhsStatus, parseFileField, processIhsDetails, resolveExtractionStatus, resolvePageFields, validateFormConfig, validateFormSpec, validatePagesConfig };
|
|
1395
|
+
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 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_TERMINAL_STATUSES, IHS_VALID_STATUSES, type IhsDetailCategory, type IhsFieldDetail, type IhsFieldProvenance, IhsStatus, IhsValueFormat, 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, 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, groupColumnsByTimePeriod, groupDetailsByCategory, groupFieldsByCategory, groupFieldsByPattern, isAdapterCategory, isDocumentType, isFailureIhsStatus, isTerminalIhsStatus, isValidIhsStatus, parseFileField, processIhsDetails, resolveExtractionStatus, resolvePageFields, validateFormConfig, validateFormSpec, validatePagesConfig };
|
package/dist/index.d.ts
CHANGED
|
@@ -519,8 +519,15 @@ declare function getDisplayNames(): Record<string, string>;
|
|
|
519
519
|
declare function getDisplayName(fieldName: string): string;
|
|
520
520
|
declare function extractTimePeriods(columnNames: string[]): string[];
|
|
521
521
|
declare function groupColumnsByTimePeriod(columnNames: string[]): Record<string, Record<string, string>>;
|
|
522
|
+
/**
|
|
523
|
+
* Groups fields by their catalog-declared document_group (falling back to
|
|
524
|
+
* the field's own name for anything untagged). Was a hardcoded, closed
|
|
525
|
+
* prefix-matching table (FIELD_GROUP_PREFIXES) requiring a code edit for
|
|
526
|
+
* every new document type; now reads the same document_group tag the
|
|
527
|
+
* catalog already carries for document-types.ts, so adding a document
|
|
528
|
+
* type is a catalog-only data change.
|
|
529
|
+
*/
|
|
522
530
|
declare function groupFieldsByPattern(fields: FieldData[]): Record<string, FieldData[]>;
|
|
523
|
-
/** Returns human-friendly display names for field groups. */
|
|
524
531
|
declare function getGroupDisplayNames(): Record<string, string>;
|
|
525
532
|
declare function buildFileFieldTables(ihsData: Record<string, unknown>, fieldProvenance?: Record<string, IhsFieldProvenance>): Record<string, FileFieldTableData>;
|
|
526
533
|
/** IHS doc-field key → human label (the fields that become document sections). */
|
|
@@ -583,19 +590,56 @@ declare enum ExtractionJobStatus {
|
|
|
583
590
|
Failed = "failed"
|
|
584
591
|
}
|
|
585
592
|
/**
|
|
586
|
-
* Document types that go through FinXtract extraction.
|
|
587
|
-
*
|
|
588
|
-
*
|
|
593
|
+
* Document types that go through FinXtract extraction. Values must match
|
|
594
|
+
* the `type` field on finsys-api's File entity and the config keys in
|
|
595
|
+
* finXtractApi.api.
|
|
596
|
+
*
|
|
597
|
+
* Was a closed enum (FinancialStatement/BankStatement/Epf/Payslip/Ssm/
|
|
598
|
+
* Form9/Ic) requiring a core release to add a new document type, even
|
|
599
|
+
* though nothing outside finsys-api's own request validation actually
|
|
600
|
+
* needed it to be a closed set (confirmed: zero external consumers
|
|
601
|
+
* import a specific member by name). Now an open string, matching the
|
|
602
|
+
* AdapterCategory precedent (SYS-2500) -- the authoritative set of valid
|
|
603
|
+
* values lives in document-types.ts, derived from the field-spec catalog.
|
|
604
|
+
* Use isDocumentType()/assertDocumentType() from document-types.ts for
|
|
605
|
+
* the runtime validation that used to be the enum's job.
|
|
589
606
|
*/
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
607
|
+
type ExtractionFileType = string;
|
|
608
|
+
|
|
609
|
+
type WireFormat = 'path_array' | 'url_string' | 'path_only';
|
|
610
|
+
type TimePeriodUnit = 'month' | 'year';
|
|
611
|
+
interface DocumentTypeGroup {
|
|
612
|
+
/** Wire/dispatch value, e.g. "bankStatements". */
|
|
613
|
+
readonly documentType: string;
|
|
614
|
+
/** Render/table grouping key, e.g. "ssm_documents". Distinct from documentType -- see module doc. */
|
|
615
|
+
readonly documentGroup: string;
|
|
616
|
+
/** Human-friendly label, e.g. "Bank Statements". */
|
|
617
|
+
readonly label: string;
|
|
618
|
+
/** Reserved for a future borrower-client payload-routing consolidation. Taken from the group's first entry; not enforced consistent across entries (all groups agree today, but a future mixed-format group would silently inherit the first entry's value). */
|
|
619
|
+
readonly wireFormat?: WireFormat;
|
|
620
|
+
/**
|
|
621
|
+
* The catalog's own `type: 'file'` entries belonging to this group, in
|
|
622
|
+
* catalog order. Each entry may carry its own document_slot/
|
|
623
|
+
* time_period_unit -- see TaggedFieldData and the module doc.
|
|
624
|
+
*/
|
|
625
|
+
readonly fields: readonly TaggedFieldData[];
|
|
626
|
+
}
|
|
627
|
+
interface TaggedFieldData extends FieldData {
|
|
628
|
+
document_type?: string;
|
|
629
|
+
document_group?: string;
|
|
630
|
+
document_group_label?: string;
|
|
631
|
+
wire_format?: WireFormat;
|
|
632
|
+
/** Which upload position this field represents (1st document, 2nd, etc). See module doc for why this is distinct from a "time period". */
|
|
633
|
+
document_slot?: number;
|
|
634
|
+
/** What unit document_slot's number measures for this field. */
|
|
635
|
+
time_period_unit?: TimePeriodUnit;
|
|
598
636
|
}
|
|
637
|
+
/** Every registered document type, in catalog declaration order. */
|
|
638
|
+
declare function getDocumentTypeGroups(): readonly DocumentTypeGroup[];
|
|
639
|
+
/** True if `id` is a registered document type (the wire/dispatch value). */
|
|
640
|
+
declare function isDocumentType(id: string): boolean;
|
|
641
|
+
/** Returns `id` if it's a registered document type, otherwise throws. */
|
|
642
|
+
declare function assertDocumentType(id: string): string;
|
|
599
643
|
|
|
600
644
|
/**
|
|
601
645
|
* IHS application status — canonical source of truth, mirroring finsys-api's
|
|
@@ -1348,4 +1392,4 @@ interface FieldMapEntry {
|
|
|
1348
1392
|
readonly transform?: "identity" | "pct_to_ratio01" | "to_boolean" | "to_integer";
|
|
1349
1393
|
}
|
|
1350
1394
|
|
|
1351
|
-
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 Choice, DEFAULT_VALIDATOR_DEFINITIONS, type DeclarativeImplementation, type DocExtractionResult, DocExtractionStatus, type DocumentFileMetadata, type DocumentRow, type DocumentRowCapabilities, type DropdownOption, type EditorValidator, 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_TERMINAL_STATUSES, IHS_VALID_STATUSES, type IhsDetailCategory, type IhsFieldDetail, type IhsFieldProvenance, IhsStatus, IhsValueFormat, type InstanceValue, type PageConfig, type RHFSchemaOutput, type RHFStep, type RawPayload, type ResolvedField, Role, type SourceAdapter, type SurveyElementJSON, type SurveyJSON, type SurveyPageJSON, type TypescriptImplementation, type UnifiedFormConfig, type Validator, allCategories, applyAggregation, applyDynamicTitles, assertAdapterCategory, buildDocumentRows, buildFileFieldTables, categoryFieldsOf, categoryForField, categorySchemaOf, evaluateExpression, extractTimePeriods, formatDocumentSize, formatDocumentType, formatDocumentUploaded, generateRHFSchema, generateSurveyJson, getBaseCategories, getBaseFieldNames, getBaseFieldSpecMap, getBaseFieldSpecs, getCategoryName, getDisplayName, getDisplayNames, getDocDisplayNames, getExtractableDocTypes, getGroupDisplayNames, getPastMonthLabel, getPastYearLabel, getReuploadableDocTypes, getStepDefaultValues, getStepSchema, groupColumnsByTimePeriod, groupDetailsByCategory, groupFieldsByCategory, groupFieldsByPattern, isAdapterCategory, isFailureIhsStatus, isTerminalIhsStatus, isValidIhsStatus, parseFileField, processIhsDetails, resolveExtractionStatus, resolvePageFields, validateFormConfig, validateFormSpec, validatePagesConfig };
|
|
1395
|
+
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 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_TERMINAL_STATUSES, IHS_VALID_STATUSES, type IhsDetailCategory, type IhsFieldDetail, type IhsFieldProvenance, IhsStatus, IhsValueFormat, 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, 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, groupColumnsByTimePeriod, groupDetailsByCategory, groupFieldsByCategory, groupFieldsByPattern, isAdapterCategory, isDocumentType, isFailureIhsStatus, isTerminalIhsStatus, isValidIhsStatus, parseFileField, processIhsDetails, resolveExtractionStatus, resolvePageFields, validateFormConfig, validateFormSpec, validatePagesConfig };
|