@finsys/core 2.3.1 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -469,6 +469,60 @@ declare enum ExtractionFileType {
469
469
  Ic = "ic"
470
470
  }
471
471
 
472
+ /**
473
+ * IHS application status — canonical source of truth, mirroring finsys-api's
474
+ * `IHS_STATUS` enum and `allowedIhsStatus` list in src/utils/appHelper.ts.
475
+ *
476
+ * finsys-api originates these values (it writes them to the `ihs.status`
477
+ * column). Consumer apps (finhub-adonisjs, finsys-client) read them off the
478
+ * wire and use them for validation and display.
479
+ *
480
+ * Lender rejection is not represented by a distinct status: when a lender
481
+ * rejects an application, finsys-api transitions the record back to
482
+ * `APPLICATION_FINALIZED` from `LENDER_EVALUATION`.
483
+ */
484
+ declare enum IhsStatus {
485
+ CreatingApplication = "CREATING_APPLICATION",
486
+ ApplicationFinalized = "APPLICATION_FINALIZED",
487
+ LenderEvaluation = "LENDER_EVALUATION",
488
+ Approved = "APPROVED",
489
+ LouDelivered = "LOU_DELIVERED",
490
+ AwaitingDisbursement = "AWAITING_DISBURSEMENT",
491
+ Disbursement = "DISBURSEMENT",
492
+ Declined = "DECLINED",
493
+ Expired = "EXPIRED",
494
+ Canceled = "CANCELED"
495
+ }
496
+ /**
497
+ * All valid IHS status values, in display order (earliest lifecycle stage
498
+ * first, terminal states last).
499
+ */
500
+ declare const IHS_VALID_STATUSES: readonly IhsStatus[];
501
+ /**
502
+ * Terminal statuses — the application lifecycle has completed and no further
503
+ * transitions are expected. Useful for suppressing action UI (e.g. re-extract,
504
+ * status update controls) on the application detail view.
505
+ */
506
+ declare const IHS_TERMINAL_STATUSES: readonly IhsStatus[];
507
+ /**
508
+ * Failure statuses — a subset of terminal statuses that represent an
509
+ * unsuccessful outcome. Useful for badge colour / messaging.
510
+ */
511
+ declare const IHS_FAILURE_STATUSES: readonly IhsStatus[];
512
+ /**
513
+ * Type guard: narrows an unknown value to `IhsStatus` iff it is one of the
514
+ * canonical status strings.
515
+ */
516
+ declare function isValidIhsStatus(status: unknown): status is IhsStatus;
517
+ /**
518
+ * Type guard: terminal (no further transitions expected).
519
+ */
520
+ declare function isTerminalIhsStatus(status: unknown): status is IhsStatus;
521
+ /**
522
+ * Type guard: terminal and unsuccessful.
523
+ */
524
+ declare function isFailureIhsStatus(status: unknown): status is IhsStatus;
525
+
472
526
  declare enum DocExtractionStatus {
473
527
  NotUploaded = "not_uploaded",
474
528
  Uploaded = "uploaded",
@@ -516,4 +570,4 @@ interface ExtractionStatusResult {
516
570
  */
517
571
  declare function resolveExtractionStatus(ihsRecord: Record<string, unknown>, jobRecords?: ExtractionJobRecord[]): ExtractionStatusResult;
518
572
 
519
- export { BASE_FIELD_SPECS, BasicFormField, type Category, type Choice, DEFAULT_VALIDATOR_DEFINITIONS, type DocExtractionResult, DocExtractionStatus, type DropdownOption, type EditorValidator, ExtractionFileType, type ExtractionJobRecord, ExtractionJobStatus, type ExtractionStatusResult, FIELD_TYPE_DEFINITIONS, type FieldData, type FieldGroup, type FieldReference, FieldType, type FileFieldTableData, type FileFieldTableItem, FileFieldTableType, FileFormField, FormField, FormFieldCategory, type FormFieldInputType, type FormFieldType, type FormFieldTypeDefinitions, FormFieldValidator, FormSpec, type FormValidatorDefinitions, type IhsDetailCategory, type IhsFieldDetail, IhsValueFormat, type PageConfig, type RHFSchemaOutput, type RHFStep, type ResolvedField, Role, type SurveyElementJSON, type SurveyJSON, type SurveyPageJSON, type UnifiedFormConfig, type Validator, applyDynamicTitles, buildFileFieldTables, evaluateExpression, extractTimePeriods, generateRHFSchema, generateSurveyJson, getBaseCategories, getBaseFieldNames, getBaseFieldSpecMap, getBaseFieldSpecs, getCategoryName, getDisplayName, getDisplayNames, getGroupDisplayNames, getPastMonthLabel, getPastYearLabel, getStepDefaultValues, getStepSchema, groupColumnsByTimePeriod, groupDetailsByCategory, groupFieldsByCategory, groupFieldsByPattern, processIhsDetails, resolveExtractionStatus, resolvePageFields, validateFormConfig, validateFormSpec, validatePagesConfig };
573
+ export { BASE_FIELD_SPECS, BasicFormField, type Category, type Choice, DEFAULT_VALIDATOR_DEFINITIONS, type DocExtractionResult, DocExtractionStatus, type DropdownOption, type EditorValidator, ExtractionFileType, type ExtractionJobRecord, ExtractionJobStatus, type ExtractionStatusResult, FIELD_TYPE_DEFINITIONS, type FieldData, type FieldGroup, 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 PageConfig, type RHFSchemaOutput, type RHFStep, type ResolvedField, Role, type SurveyElementJSON, type SurveyJSON, type SurveyPageJSON, type UnifiedFormConfig, type Validator, applyDynamicTitles, buildFileFieldTables, 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 };
package/dist/index.d.ts CHANGED
@@ -469,6 +469,60 @@ declare enum ExtractionFileType {
469
469
  Ic = "ic"
470
470
  }
471
471
 
472
+ /**
473
+ * IHS application status — canonical source of truth, mirroring finsys-api's
474
+ * `IHS_STATUS` enum and `allowedIhsStatus` list in src/utils/appHelper.ts.
475
+ *
476
+ * finsys-api originates these values (it writes them to the `ihs.status`
477
+ * column). Consumer apps (finhub-adonisjs, finsys-client) read them off the
478
+ * wire and use them for validation and display.
479
+ *
480
+ * Lender rejection is not represented by a distinct status: when a lender
481
+ * rejects an application, finsys-api transitions the record back to
482
+ * `APPLICATION_FINALIZED` from `LENDER_EVALUATION`.
483
+ */
484
+ declare enum IhsStatus {
485
+ CreatingApplication = "CREATING_APPLICATION",
486
+ ApplicationFinalized = "APPLICATION_FINALIZED",
487
+ LenderEvaluation = "LENDER_EVALUATION",
488
+ Approved = "APPROVED",
489
+ LouDelivered = "LOU_DELIVERED",
490
+ AwaitingDisbursement = "AWAITING_DISBURSEMENT",
491
+ Disbursement = "DISBURSEMENT",
492
+ Declined = "DECLINED",
493
+ Expired = "EXPIRED",
494
+ Canceled = "CANCELED"
495
+ }
496
+ /**
497
+ * All valid IHS status values, in display order (earliest lifecycle stage
498
+ * first, terminal states last).
499
+ */
500
+ declare const IHS_VALID_STATUSES: readonly IhsStatus[];
501
+ /**
502
+ * Terminal statuses — the application lifecycle has completed and no further
503
+ * transitions are expected. Useful for suppressing action UI (e.g. re-extract,
504
+ * status update controls) on the application detail view.
505
+ */
506
+ declare const IHS_TERMINAL_STATUSES: readonly IhsStatus[];
507
+ /**
508
+ * Failure statuses — a subset of terminal statuses that represent an
509
+ * unsuccessful outcome. Useful for badge colour / messaging.
510
+ */
511
+ declare const IHS_FAILURE_STATUSES: readonly IhsStatus[];
512
+ /**
513
+ * Type guard: narrows an unknown value to `IhsStatus` iff it is one of the
514
+ * canonical status strings.
515
+ */
516
+ declare function isValidIhsStatus(status: unknown): status is IhsStatus;
517
+ /**
518
+ * Type guard: terminal (no further transitions expected).
519
+ */
520
+ declare function isTerminalIhsStatus(status: unknown): status is IhsStatus;
521
+ /**
522
+ * Type guard: terminal and unsuccessful.
523
+ */
524
+ declare function isFailureIhsStatus(status: unknown): status is IhsStatus;
525
+
472
526
  declare enum DocExtractionStatus {
473
527
  NotUploaded = "not_uploaded",
474
528
  Uploaded = "uploaded",
@@ -516,4 +570,4 @@ interface ExtractionStatusResult {
516
570
  */
517
571
  declare function resolveExtractionStatus(ihsRecord: Record<string, unknown>, jobRecords?: ExtractionJobRecord[]): ExtractionStatusResult;
518
572
 
519
- export { BASE_FIELD_SPECS, BasicFormField, type Category, type Choice, DEFAULT_VALIDATOR_DEFINITIONS, type DocExtractionResult, DocExtractionStatus, type DropdownOption, type EditorValidator, ExtractionFileType, type ExtractionJobRecord, ExtractionJobStatus, type ExtractionStatusResult, FIELD_TYPE_DEFINITIONS, type FieldData, type FieldGroup, type FieldReference, FieldType, type FileFieldTableData, type FileFieldTableItem, FileFieldTableType, FileFormField, FormField, FormFieldCategory, type FormFieldInputType, type FormFieldType, type FormFieldTypeDefinitions, FormFieldValidator, FormSpec, type FormValidatorDefinitions, type IhsDetailCategory, type IhsFieldDetail, IhsValueFormat, type PageConfig, type RHFSchemaOutput, type RHFStep, type ResolvedField, Role, type SurveyElementJSON, type SurveyJSON, type SurveyPageJSON, type UnifiedFormConfig, type Validator, applyDynamicTitles, buildFileFieldTables, evaluateExpression, extractTimePeriods, generateRHFSchema, generateSurveyJson, getBaseCategories, getBaseFieldNames, getBaseFieldSpecMap, getBaseFieldSpecs, getCategoryName, getDisplayName, getDisplayNames, getGroupDisplayNames, getPastMonthLabel, getPastYearLabel, getStepDefaultValues, getStepSchema, groupColumnsByTimePeriod, groupDetailsByCategory, groupFieldsByCategory, groupFieldsByPattern, processIhsDetails, resolveExtractionStatus, resolvePageFields, validateFormConfig, validateFormSpec, validatePagesConfig };
573
+ export { BASE_FIELD_SPECS, BasicFormField, type Category, type Choice, DEFAULT_VALIDATOR_DEFINITIONS, type DocExtractionResult, DocExtractionStatus, type DropdownOption, type EditorValidator, ExtractionFileType, type ExtractionJobRecord, ExtractionJobStatus, type ExtractionStatusResult, FIELD_TYPE_DEFINITIONS, type FieldData, type FieldGroup, 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 PageConfig, type RHFSchemaOutput, type RHFStep, type ResolvedField, Role, type SurveyElementJSON, type SurveyJSON, type SurveyPageJSON, type UnifiedFormConfig, type Validator, applyDynamicTitles, buildFileFieldTables, 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 };
package/dist/index.js CHANGED
@@ -9573,6 +9573,53 @@ var ExtractionFileType = /* @__PURE__ */ ((ExtractionFileType2) => {
9573
9573
  return ExtractionFileType2;
9574
9574
  })(ExtractionFileType || {});
9575
9575
 
9576
+ // src/ihs-status.ts
9577
+ var IhsStatus = /* @__PURE__ */ ((IhsStatus2) => {
9578
+ IhsStatus2["CreatingApplication"] = "CREATING_APPLICATION";
9579
+ IhsStatus2["ApplicationFinalized"] = "APPLICATION_FINALIZED";
9580
+ IhsStatus2["LenderEvaluation"] = "LENDER_EVALUATION";
9581
+ IhsStatus2["Approved"] = "APPROVED";
9582
+ IhsStatus2["LouDelivered"] = "LOU_DELIVERED";
9583
+ IhsStatus2["AwaitingDisbursement"] = "AWAITING_DISBURSEMENT";
9584
+ IhsStatus2["Disbursement"] = "DISBURSEMENT";
9585
+ IhsStatus2["Declined"] = "DECLINED";
9586
+ IhsStatus2["Expired"] = "EXPIRED";
9587
+ IhsStatus2["Canceled"] = "CANCELED";
9588
+ return IhsStatus2;
9589
+ })(IhsStatus || {});
9590
+ var IHS_VALID_STATUSES = [
9591
+ "CREATING_APPLICATION" /* CreatingApplication */,
9592
+ "APPLICATION_FINALIZED" /* ApplicationFinalized */,
9593
+ "LENDER_EVALUATION" /* LenderEvaluation */,
9594
+ "APPROVED" /* Approved */,
9595
+ "LOU_DELIVERED" /* LouDelivered */,
9596
+ "AWAITING_DISBURSEMENT" /* AwaitingDisbursement */,
9597
+ "DISBURSEMENT" /* Disbursement */,
9598
+ "DECLINED" /* Declined */,
9599
+ "EXPIRED" /* Expired */,
9600
+ "CANCELED" /* Canceled */
9601
+ ];
9602
+ var IHS_TERMINAL_STATUSES = [
9603
+ "DISBURSEMENT" /* Disbursement */,
9604
+ "DECLINED" /* Declined */,
9605
+ "EXPIRED" /* Expired */,
9606
+ "CANCELED" /* Canceled */
9607
+ ];
9608
+ var IHS_FAILURE_STATUSES = [
9609
+ "DECLINED" /* Declined */,
9610
+ "EXPIRED" /* Expired */,
9611
+ "CANCELED" /* Canceled */
9612
+ ];
9613
+ function isValidIhsStatus(status) {
9614
+ return typeof status === "string" && IHS_VALID_STATUSES.includes(status);
9615
+ }
9616
+ function isTerminalIhsStatus(status) {
9617
+ return typeof status === "string" && IHS_TERMINAL_STATUSES.includes(status);
9618
+ }
9619
+ function isFailureIhsStatus(status) {
9620
+ return typeof status === "string" && IHS_FAILURE_STATUSES.includes(status);
9621
+ }
9622
+
9576
9623
  // src/extraction-status.ts
9577
9624
  var DocExtractionStatus = /* @__PURE__ */ ((DocExtractionStatus2) => {
9578
9625
  DocExtractionStatus2["NotUploaded"] = "not_uploaded";
@@ -9738,6 +9785,10 @@ export {
9738
9785
  FormFieldCategory,
9739
9786
  FormFieldValidator,
9740
9787
  FormSpec,
9788
+ IHS_FAILURE_STATUSES,
9789
+ IHS_TERMINAL_STATUSES,
9790
+ IHS_VALID_STATUSES,
9791
+ IhsStatus,
9741
9792
  IhsValueFormat,
9742
9793
  Role,
9743
9794
  applyDynamicTitles,
@@ -9762,6 +9813,9 @@ export {
9762
9813
  groupDetailsByCategory,
9763
9814
  groupFieldsByCategory,
9764
9815
  groupFieldsByPattern,
9816
+ isFailureIhsStatus,
9817
+ isTerminalIhsStatus,
9818
+ isValidIhsStatus,
9765
9819
  processIhsDetails,
9766
9820
  resolveExtractionStatus,
9767
9821
  resolvePageFields,