@finsys/core 2.7.0 → 3.2.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
@@ -571,16 +571,28 @@ interface ExtractionStatusResult {
571
571
  declare function resolveExtractionStatus(ihsRecord: Record<string, unknown>, jobRecords?: ExtractionJobRecord[]): ExtractionStatusResult;
572
572
 
573
573
  /**
574
- * Generic categories declared in this package. The set is union-typed
575
- * so consumers get TypeScript autocomplete (`'telco-carrier' |
576
- * 'payment-network' | ...`) and a compile-time error if they reference
577
- * a category that doesn't exist.
574
+ * Adapter category identifier.
578
575
  *
579
- * NB: adding a new category is a finsys-core minor version bump.
580
- * Vendor adapters can ship freely (deployment-time, no core change)
581
- * but the CATEGORY they implement must exist here.
576
+ * Open `string` type (SYS-2500). The authoritative set lives in the
577
+ * runtime registry built from `data/adapter-categories.json`; there is
578
+ * no compile-time union to enumerate. The trade-off vs. the old
579
+ * literal union is the loss of autocomplete + exhaustiveness on
580
+ * category ids — validate at boundaries with `isAdapterCategory()` /
581
+ * `assertAdapterCategory()` instead, and read the canonical set from
582
+ * `ADAPTER_CATEGORY_IDS` / `allCategories()`.
582
583
  */
583
- type AdapterCategory = "telco-carrier" | "payment-network" | "bank-statement";
584
+ type AdapterCategory = string;
585
+ /**
586
+ * Union of all canonical field names declared by any category. Loose-
587
+ * typed (string) because the set grows with each category-added minor;
588
+ * the runtime registry narrows against the data file.
589
+ *
590
+ * Adapter `produces` lists are typed as ReadonlyArray<CanonicalFieldName>
591
+ * — the host validates membership against the adapter's category at
592
+ * registration time, refusing adapters that promise fields outside
593
+ * their category.
594
+ */
595
+ type CanonicalFieldName = string;
584
596
  /**
585
597
  * Per-field metadata for a canonical field declared by a category.
586
598
  * Frozen at module load — the data file is authoritative.
@@ -607,20 +619,14 @@ interface CategorySchema {
607
619
  readonly fields: ReadonlyArray<CanonicalFieldSpec>;
608
620
  }
609
621
  /**
610
- * Union of all canonical field names declared by any category in this
611
- * package. Loose-typed at compile time (string) because the actual
612
- * union grows with each category-added minor; runtime helpers below
613
- * narrow against the data.
614
- *
615
- * Adapter `produces` lists are typed as ReadonlyArray<CanonicalFieldName>
616
- * — the host validates membership against the adapter's category at
617
- * registration time, refusing adapters that promise fields outside
618
- * their category.
622
+ * Every category id declared by this version of finsys-core, in
623
+ * data-file order. The runtime equivalent of the old hardcoded union —
624
+ * derived from the single source of truth rather than maintained by
625
+ * hand. Treat order as unstable across versions.
619
626
  */
620
- type CanonicalFieldName = string;
627
+ declare const ADAPTER_CATEGORY_IDS: ReadonlyArray<AdapterCategory>;
621
628
  /**
622
- * Look up a category schema by id. Throws if the id is unknown — this
623
- * is a programmer error (the type system should prevent it).
629
+ * Look up a category schema by id. Throws if the id is unknown.
624
630
  */
625
631
  declare function categorySchemaOf(id: AdapterCategory): CategorySchema;
626
632
  /**
@@ -640,9 +646,25 @@ declare function allCategories(): ReadonlyArray<CategorySchema>;
640
646
  * Returns null if the field name isn't declared by any category in
641
647
  * this version of finsys-core. Useful when the host app is reading
642
648
  * canonical field values back from storage + wants to identify the
643
- * producing category for rendering.
649
+ * producing category for rendering. O(1).
644
650
  */
645
651
  declare function categoryForField(field: CanonicalFieldName): AdapterCategory | null;
652
+ /**
653
+ * Runtime membership check — is `id` a category declared by this
654
+ * version of finsys-core? Use this at trust boundaries (parsing a
655
+ * manifest, validating an API parameter) now that `AdapterCategory` is
656
+ * an open `string` and the compiler can no longer reject unknown ids.
657
+ */
658
+ declare function isAdapterCategory(id: string): boolean;
659
+ /**
660
+ * Assert membership: returns `id` if it names a declared category,
661
+ * throws otherwise. Note this is a RUNTIME guard only — `AdapterCategory`
662
+ * is an open `string`, so there is no type-level narrowing to apply.
663
+ * The companion to `isAdapterCategory` for call sites that want a hard
664
+ * failure (e.g. the host rejecting a manifest whose category isn't in
665
+ * this finsys-core version's catalogue).
666
+ */
667
+ declare function assertAdapterCategory(id: string): AdapterCategory;
646
668
 
647
669
  /**
648
670
  * Source Adapter contract — the framework for ingesting unstructured
@@ -1198,4 +1220,4 @@ interface FieldMapEntry {
1198
1220
  readonly transform?: "identity" | "pct_to_ratio01" | "to_boolean" | "to_integer";
1199
1221
  }
1200
1222
 
1201
- export { 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 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, 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, buildFileFieldTables, categoryFieldsOf, categoryForField, categorySchemaOf, evaluateExpression, extractTimePeriods, generateRHFSchema, generateSurveyJson, getBaseCategories, getBaseFieldNames, getBaseFieldSpecMap, getBaseFieldSpecs, getCategoryName, getDisplayName, getDisplayNames, getGroupDisplayNames, getPastMonthLabel, getPastYearLabel, getStepDefaultValues, getStepSchema, groupColumnsByTimePeriod, groupDetailsByCategory, groupFieldsByCategory, groupFieldsByPattern, isFailureIhsStatus, isTerminalIhsStatus, isValidIhsStatus, processIhsDetails, resolveExtractionStatus, resolvePageFields, validateFormConfig, validateFormSpec, validatePagesConfig };
1223
+ 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 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, 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, buildFileFieldTables, categoryFieldsOf, categoryForField, categorySchemaOf, evaluateExpression, extractTimePeriods, generateRHFSchema, generateSurveyJson, getBaseCategories, getBaseFieldNames, getBaseFieldSpecMap, getBaseFieldSpecs, getCategoryName, getDisplayName, getDisplayNames, getGroupDisplayNames, getPastMonthLabel, getPastYearLabel, getStepDefaultValues, getStepSchema, groupColumnsByTimePeriod, groupDetailsByCategory, groupFieldsByCategory, groupFieldsByPattern, isAdapterCategory, isFailureIhsStatus, isTerminalIhsStatus, isValidIhsStatus, processIhsDetails, resolveExtractionStatus, resolvePageFields, validateFormConfig, validateFormSpec, validatePagesConfig };
package/dist/index.d.ts CHANGED
@@ -571,16 +571,28 @@ interface ExtractionStatusResult {
571
571
  declare function resolveExtractionStatus(ihsRecord: Record<string, unknown>, jobRecords?: ExtractionJobRecord[]): ExtractionStatusResult;
572
572
 
573
573
  /**
574
- * Generic categories declared in this package. The set is union-typed
575
- * so consumers get TypeScript autocomplete (`'telco-carrier' |
576
- * 'payment-network' | ...`) and a compile-time error if they reference
577
- * a category that doesn't exist.
574
+ * Adapter category identifier.
578
575
  *
579
- * NB: adding a new category is a finsys-core minor version bump.
580
- * Vendor adapters can ship freely (deployment-time, no core change)
581
- * but the CATEGORY they implement must exist here.
576
+ * Open `string` type (SYS-2500). The authoritative set lives in the
577
+ * runtime registry built from `data/adapter-categories.json`; there is
578
+ * no compile-time union to enumerate. The trade-off vs. the old
579
+ * literal union is the loss of autocomplete + exhaustiveness on
580
+ * category ids — validate at boundaries with `isAdapterCategory()` /
581
+ * `assertAdapterCategory()` instead, and read the canonical set from
582
+ * `ADAPTER_CATEGORY_IDS` / `allCategories()`.
582
583
  */
583
- type AdapterCategory = "telco-carrier" | "payment-network" | "bank-statement";
584
+ type AdapterCategory = string;
585
+ /**
586
+ * Union of all canonical field names declared by any category. Loose-
587
+ * typed (string) because the set grows with each category-added minor;
588
+ * the runtime registry narrows against the data file.
589
+ *
590
+ * Adapter `produces` lists are typed as ReadonlyArray<CanonicalFieldName>
591
+ * — the host validates membership against the adapter's category at
592
+ * registration time, refusing adapters that promise fields outside
593
+ * their category.
594
+ */
595
+ type CanonicalFieldName = string;
584
596
  /**
585
597
  * Per-field metadata for a canonical field declared by a category.
586
598
  * Frozen at module load — the data file is authoritative.
@@ -607,20 +619,14 @@ interface CategorySchema {
607
619
  readonly fields: ReadonlyArray<CanonicalFieldSpec>;
608
620
  }
609
621
  /**
610
- * Union of all canonical field names declared by any category in this
611
- * package. Loose-typed at compile time (string) because the actual
612
- * union grows with each category-added minor; runtime helpers below
613
- * narrow against the data.
614
- *
615
- * Adapter `produces` lists are typed as ReadonlyArray<CanonicalFieldName>
616
- * — the host validates membership against the adapter's category at
617
- * registration time, refusing adapters that promise fields outside
618
- * their category.
622
+ * Every category id declared by this version of finsys-core, in
623
+ * data-file order. The runtime equivalent of the old hardcoded union —
624
+ * derived from the single source of truth rather than maintained by
625
+ * hand. Treat order as unstable across versions.
619
626
  */
620
- type CanonicalFieldName = string;
627
+ declare const ADAPTER_CATEGORY_IDS: ReadonlyArray<AdapterCategory>;
621
628
  /**
622
- * Look up a category schema by id. Throws if the id is unknown — this
623
- * is a programmer error (the type system should prevent it).
629
+ * Look up a category schema by id. Throws if the id is unknown.
624
630
  */
625
631
  declare function categorySchemaOf(id: AdapterCategory): CategorySchema;
626
632
  /**
@@ -640,9 +646,25 @@ declare function allCategories(): ReadonlyArray<CategorySchema>;
640
646
  * Returns null if the field name isn't declared by any category in
641
647
  * this version of finsys-core. Useful when the host app is reading
642
648
  * canonical field values back from storage + wants to identify the
643
- * producing category for rendering.
649
+ * producing category for rendering. O(1).
644
650
  */
645
651
  declare function categoryForField(field: CanonicalFieldName): AdapterCategory | null;
652
+ /**
653
+ * Runtime membership check — is `id` a category declared by this
654
+ * version of finsys-core? Use this at trust boundaries (parsing a
655
+ * manifest, validating an API parameter) now that `AdapterCategory` is
656
+ * an open `string` and the compiler can no longer reject unknown ids.
657
+ */
658
+ declare function isAdapterCategory(id: string): boolean;
659
+ /**
660
+ * Assert membership: returns `id` if it names a declared category,
661
+ * throws otherwise. Note this is a RUNTIME guard only — `AdapterCategory`
662
+ * is an open `string`, so there is no type-level narrowing to apply.
663
+ * The companion to `isAdapterCategory` for call sites that want a hard
664
+ * failure (e.g. the host rejecting a manifest whose category isn't in
665
+ * this finsys-core version's catalogue).
666
+ */
667
+ declare function assertAdapterCategory(id: string): AdapterCategory;
646
668
 
647
669
  /**
648
670
  * Source Adapter contract — the framework for ingesting unstructured
@@ -1198,4 +1220,4 @@ interface FieldMapEntry {
1198
1220
  readonly transform?: "identity" | "pct_to_ratio01" | "to_boolean" | "to_integer";
1199
1221
  }
1200
1222
 
1201
- export { 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 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, 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, buildFileFieldTables, categoryFieldsOf, categoryForField, categorySchemaOf, evaluateExpression, extractTimePeriods, generateRHFSchema, generateSurveyJson, getBaseCategories, getBaseFieldNames, getBaseFieldSpecMap, getBaseFieldSpecs, getCategoryName, getDisplayName, getDisplayNames, getGroupDisplayNames, getPastMonthLabel, getPastYearLabel, getStepDefaultValues, getStepSchema, groupColumnsByTimePeriod, groupDetailsByCategory, groupFieldsByCategory, groupFieldsByPattern, isFailureIhsStatus, isTerminalIhsStatus, isValidIhsStatus, processIhsDetails, resolveExtractionStatus, resolvePageFields, validateFormConfig, validateFormSpec, validatePagesConfig };
1223
+ 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 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, 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, buildFileFieldTables, categoryFieldsOf, categoryForField, categorySchemaOf, evaluateExpression, extractTimePeriods, generateRHFSchema, generateSurveyJson, getBaseCategories, getBaseFieldNames, getBaseFieldSpecMap, getBaseFieldSpecs, getCategoryName, getDisplayName, getDisplayNames, getGroupDisplayNames, getPastMonthLabel, getPastYearLabel, getStepDefaultValues, getStepSchema, groupColumnsByTimePeriod, groupDetailsByCategory, groupFieldsByCategory, groupFieldsByPattern, isAdapterCategory, isFailureIhsStatus, isTerminalIhsStatus, isValidIhsStatus, processIhsDetails, resolveExtractionStatus, resolvePageFields, validateFormConfig, validateFormSpec, validatePagesConfig };