@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.cjs
CHANGED
|
@@ -37,7 +37,6 @@ __export(index_exports, {
|
|
|
37
37
|
BasicFormField: () => BasicFormField,
|
|
38
38
|
DEFAULT_VALIDATOR_DEFINITIONS: () => DEFAULT_VALIDATOR_DEFINITIONS,
|
|
39
39
|
DocExtractionStatus: () => DocExtractionStatus,
|
|
40
|
-
ExtractionFileType: () => ExtractionFileType,
|
|
41
40
|
ExtractionJobStatus: () => ExtractionJobStatus,
|
|
42
41
|
FIELD_TYPE_DEFINITIONS: () => FIELD_TYPE_DEFINITIONS,
|
|
43
42
|
FieldType: () => FieldType,
|
|
@@ -57,6 +56,7 @@ __export(index_exports, {
|
|
|
57
56
|
applyAggregation: () => applyAggregation,
|
|
58
57
|
applyDynamicTitles: () => applyDynamicTitles,
|
|
59
58
|
assertAdapterCategory: () => assertAdapterCategory,
|
|
59
|
+
assertDocumentType: () => assertDocumentType,
|
|
60
60
|
buildDocumentRows: () => buildDocumentRows,
|
|
61
61
|
buildFileFieldTables: () => buildFileFieldTables,
|
|
62
62
|
categoryFieldsOf: () => categoryFieldsOf,
|
|
@@ -77,6 +77,7 @@ __export(index_exports, {
|
|
|
77
77
|
getDisplayName: () => getDisplayName,
|
|
78
78
|
getDisplayNames: () => getDisplayNames,
|
|
79
79
|
getDocDisplayNames: () => getDocDisplayNames,
|
|
80
|
+
getDocumentTypeGroups: () => getDocumentTypeGroups,
|
|
80
81
|
getExtractableDocTypes: () => getExtractableDocTypes,
|
|
81
82
|
getGroupDisplayNames: () => getGroupDisplayNames,
|
|
82
83
|
getPastMonthLabel: () => getPastMonthLabel,
|
|
@@ -89,6 +90,7 @@ __export(index_exports, {
|
|
|
89
90
|
groupFieldsByCategory: () => groupFieldsByCategory,
|
|
90
91
|
groupFieldsByPattern: () => groupFieldsByPattern,
|
|
91
92
|
isAdapterCategory: () => isAdapterCategory,
|
|
93
|
+
isDocumentType: () => isDocumentType,
|
|
92
94
|
isFailureIhsStatus: () => isFailureIhsStatus,
|
|
93
95
|
isTerminalIhsStatus: () => isTerminalIhsStatus,
|
|
94
96
|
isValidIhsStatus: () => isValidIhsStatus,
|
|
@@ -8002,7 +8004,13 @@ var form_field_base_specs_default = {
|
|
|
8002
8004
|
"openingBalanceT1",
|
|
8003
8005
|
"bankBalanceT1"
|
|
8004
8006
|
],
|
|
8005
|
-
category: "13"
|
|
8007
|
+
category: "13",
|
|
8008
|
+
document_type: "bankStatements",
|
|
8009
|
+
document_group: "bank_statements",
|
|
8010
|
+
document_group_label: "Bank Statements",
|
|
8011
|
+
wire_format: "path_array",
|
|
8012
|
+
document_slot: 1,
|
|
8013
|
+
time_period_unit: "month"
|
|
8006
8014
|
},
|
|
8007
8015
|
{
|
|
8008
8016
|
name: "bank_statement_t2",
|
|
@@ -8018,7 +8026,13 @@ var form_field_base_specs_default = {
|
|
|
8018
8026
|
"openingBalanceT2",
|
|
8019
8027
|
"bankBalanceT2"
|
|
8020
8028
|
],
|
|
8021
|
-
category: "13"
|
|
8029
|
+
category: "13",
|
|
8030
|
+
document_type: "bankStatements",
|
|
8031
|
+
document_group: "bank_statements",
|
|
8032
|
+
document_group_label: "Bank Statements",
|
|
8033
|
+
wire_format: "path_array",
|
|
8034
|
+
document_slot: 2,
|
|
8035
|
+
time_period_unit: "month"
|
|
8022
8036
|
},
|
|
8023
8037
|
{
|
|
8024
8038
|
name: "bank_statement_t3",
|
|
@@ -8034,7 +8048,13 @@ var form_field_base_specs_default = {
|
|
|
8034
8048
|
"openingBalanceT3",
|
|
8035
8049
|
"bankBalanceT3"
|
|
8036
8050
|
],
|
|
8037
|
-
category: "13"
|
|
8051
|
+
category: "13",
|
|
8052
|
+
document_type: "bankStatements",
|
|
8053
|
+
document_group: "bank_statements",
|
|
8054
|
+
document_group_label: "Bank Statements",
|
|
8055
|
+
wire_format: "path_array",
|
|
8056
|
+
document_slot: 3,
|
|
8057
|
+
time_period_unit: "month"
|
|
8038
8058
|
},
|
|
8039
8059
|
{
|
|
8040
8060
|
name: "bank_statement_t4",
|
|
@@ -8050,7 +8070,13 @@ var form_field_base_specs_default = {
|
|
|
8050
8070
|
"openingBalanceT4",
|
|
8051
8071
|
"bankBalanceT4"
|
|
8052
8072
|
],
|
|
8053
|
-
category: "13"
|
|
8073
|
+
category: "13",
|
|
8074
|
+
document_type: "bankStatements",
|
|
8075
|
+
document_group: "bank_statements",
|
|
8076
|
+
document_group_label: "Bank Statements",
|
|
8077
|
+
wire_format: "path_array",
|
|
8078
|
+
document_slot: 4,
|
|
8079
|
+
time_period_unit: "month"
|
|
8054
8080
|
},
|
|
8055
8081
|
{
|
|
8056
8082
|
name: "bank_statement_t5",
|
|
@@ -8066,7 +8092,13 @@ var form_field_base_specs_default = {
|
|
|
8066
8092
|
"openingBalanceT5",
|
|
8067
8093
|
"bankBalanceT5"
|
|
8068
8094
|
],
|
|
8069
|
-
category: "13"
|
|
8095
|
+
category: "13",
|
|
8096
|
+
document_type: "bankStatements",
|
|
8097
|
+
document_group: "bank_statements",
|
|
8098
|
+
document_group_label: "Bank Statements",
|
|
8099
|
+
wire_format: "path_array",
|
|
8100
|
+
document_slot: 5,
|
|
8101
|
+
time_period_unit: "month"
|
|
8070
8102
|
},
|
|
8071
8103
|
{
|
|
8072
8104
|
name: "bank_statement_t6",
|
|
@@ -8082,7 +8114,13 @@ var form_field_base_specs_default = {
|
|
|
8082
8114
|
"openingBalanceT6",
|
|
8083
8115
|
"bankBalanceT6"
|
|
8084
8116
|
],
|
|
8085
|
-
category: "13"
|
|
8117
|
+
category: "13",
|
|
8118
|
+
document_type: "bankStatements",
|
|
8119
|
+
document_group: "bank_statements",
|
|
8120
|
+
document_group_label: "Bank Statements",
|
|
8121
|
+
wire_format: "path_array",
|
|
8122
|
+
document_slot: 6,
|
|
8123
|
+
time_period_unit: "month"
|
|
8086
8124
|
},
|
|
8087
8125
|
{
|
|
8088
8126
|
name: "financials",
|
|
@@ -8103,7 +8141,13 @@ var form_field_base_specs_default = {
|
|
|
8103
8141
|
"netOperatingCashFlow",
|
|
8104
8142
|
"ebitda"
|
|
8105
8143
|
],
|
|
8106
|
-
category: "13"
|
|
8144
|
+
category: "13",
|
|
8145
|
+
document_type: "financialStatements",
|
|
8146
|
+
document_group: "financials",
|
|
8147
|
+
document_group_label: "Audited Financial Statements",
|
|
8148
|
+
wire_format: "path_array",
|
|
8149
|
+
document_slot: 1,
|
|
8150
|
+
time_period_unit: "year"
|
|
8107
8151
|
},
|
|
8108
8152
|
{
|
|
8109
8153
|
name: "financials_fincap_t1",
|
|
@@ -8347,7 +8391,13 @@ var form_field_base_specs_default = {
|
|
|
8347
8391
|
"depreciationOfInvestmentSecuritiesT2",
|
|
8348
8392
|
"endOfYearCashT2"
|
|
8349
8393
|
],
|
|
8350
|
-
category: "13"
|
|
8394
|
+
category: "13",
|
|
8395
|
+
document_type: "financialStatements",
|
|
8396
|
+
document_group: "financials",
|
|
8397
|
+
document_group_label: "Audited Financial Statements",
|
|
8398
|
+
wire_format: "path_array",
|
|
8399
|
+
document_slot: 1,
|
|
8400
|
+
time_period_unit: "year"
|
|
8351
8401
|
},
|
|
8352
8402
|
{
|
|
8353
8403
|
name: "financials_fincap_t2",
|
|
@@ -8473,7 +8523,13 @@ var form_field_base_specs_default = {
|
|
|
8473
8523
|
"depreciationOfInvestmentSecuritiesT3",
|
|
8474
8524
|
"endOfYearCashT3"
|
|
8475
8525
|
],
|
|
8476
|
-
category: "13"
|
|
8526
|
+
category: "13",
|
|
8527
|
+
document_type: "financialStatements",
|
|
8528
|
+
document_group: "financials",
|
|
8529
|
+
document_group_label: "Audited Financial Statements",
|
|
8530
|
+
wire_format: "path_array",
|
|
8531
|
+
document_slot: 2,
|
|
8532
|
+
time_period_unit: "year"
|
|
8477
8533
|
},
|
|
8478
8534
|
{
|
|
8479
8535
|
name: "form9",
|
|
@@ -8484,7 +8540,11 @@ var form_field_base_specs_default = {
|
|
|
8484
8540
|
"companyName",
|
|
8485
8541
|
"companyRegNo"
|
|
8486
8542
|
],
|
|
8487
|
-
category: "13"
|
|
8543
|
+
category: "13",
|
|
8544
|
+
document_type: "form9",
|
|
8545
|
+
document_group: "form9",
|
|
8546
|
+
document_group_label: "Form 9 / Section 17 / Form D",
|
|
8547
|
+
wire_format: "url_string"
|
|
8488
8548
|
},
|
|
8489
8549
|
{
|
|
8490
8550
|
name: "ssm",
|
|
@@ -8508,7 +8568,11 @@ var form_field_base_specs_default = {
|
|
|
8508
8568
|
"businessOrigin",
|
|
8509
8569
|
"registeredAddress"
|
|
8510
8570
|
],
|
|
8511
|
-
category: "13"
|
|
8571
|
+
category: "13",
|
|
8572
|
+
document_type: "ssm",
|
|
8573
|
+
document_group: "ssm_documents",
|
|
8574
|
+
document_group_label: "SSM Company Information",
|
|
8575
|
+
wire_format: "url_string"
|
|
8512
8576
|
},
|
|
8513
8577
|
{
|
|
8514
8578
|
name: "ic",
|
|
@@ -8525,7 +8589,11 @@ var form_field_base_specs_default = {
|
|
|
8525
8589
|
"icNationality",
|
|
8526
8590
|
"icRace"
|
|
8527
8591
|
],
|
|
8528
|
-
category: "13"
|
|
8592
|
+
category: "13",
|
|
8593
|
+
document_type: "ic",
|
|
8594
|
+
document_group: "ic_documents",
|
|
8595
|
+
document_group_label: "Identification Card",
|
|
8596
|
+
wire_format: "url_string"
|
|
8529
8597
|
},
|
|
8530
8598
|
{
|
|
8531
8599
|
name: "epf_statement_t1",
|
|
@@ -8542,7 +8610,13 @@ var form_field_base_specs_default = {
|
|
|
8542
8610
|
"epfTotalContributionT1",
|
|
8543
8611
|
"epfTotalCurrentContributionT1"
|
|
8544
8612
|
],
|
|
8545
|
-
category: "13"
|
|
8613
|
+
category: "13",
|
|
8614
|
+
document_type: "epfStatements",
|
|
8615
|
+
document_group: "epf_statements",
|
|
8616
|
+
document_group_label: "EPF Statements",
|
|
8617
|
+
wire_format: "path_array",
|
|
8618
|
+
document_slot: 1,
|
|
8619
|
+
time_period_unit: "year"
|
|
8546
8620
|
},
|
|
8547
8621
|
{
|
|
8548
8622
|
name: "epf_statement_t2",
|
|
@@ -8559,7 +8633,13 @@ var form_field_base_specs_default = {
|
|
|
8559
8633
|
"epfTotalContributionT2",
|
|
8560
8634
|
"epfTotalCurrentContributionT2"
|
|
8561
8635
|
],
|
|
8562
|
-
category: "13"
|
|
8636
|
+
category: "13",
|
|
8637
|
+
document_type: "epfStatements",
|
|
8638
|
+
document_group: "epf_statements",
|
|
8639
|
+
document_group_label: "EPF Statements",
|
|
8640
|
+
wire_format: "path_array",
|
|
8641
|
+
document_slot: 2,
|
|
8642
|
+
time_period_unit: "year"
|
|
8563
8643
|
},
|
|
8564
8644
|
{
|
|
8565
8645
|
name: "payslip_statement_t1",
|
|
@@ -8582,7 +8662,13 @@ var form_field_base_specs_default = {
|
|
|
8582
8662
|
"payslipEmployeeTaxT1",
|
|
8583
8663
|
"payslipOtherDeductionT1"
|
|
8584
8664
|
],
|
|
8585
|
-
category: "13"
|
|
8665
|
+
category: "13",
|
|
8666
|
+
document_type: "payslips",
|
|
8667
|
+
document_group: "payslip_statements",
|
|
8668
|
+
document_group_label: "Payslip Statements",
|
|
8669
|
+
wire_format: "path_array",
|
|
8670
|
+
document_slot: 1,
|
|
8671
|
+
time_period_unit: "month"
|
|
8586
8672
|
},
|
|
8587
8673
|
{
|
|
8588
8674
|
name: "payslip_statement_t2",
|
|
@@ -8605,7 +8691,13 @@ var form_field_base_specs_default = {
|
|
|
8605
8691
|
"payslipEmployeeTaxT2",
|
|
8606
8692
|
"payslipOtherDeductionT2"
|
|
8607
8693
|
],
|
|
8608
|
-
category: "13"
|
|
8694
|
+
category: "13",
|
|
8695
|
+
document_type: "payslips",
|
|
8696
|
+
document_group: "payslip_statements",
|
|
8697
|
+
document_group_label: "Payslip Statements",
|
|
8698
|
+
wire_format: "path_array",
|
|
8699
|
+
document_slot: 2,
|
|
8700
|
+
time_period_unit: "month"
|
|
8609
8701
|
},
|
|
8610
8702
|
{
|
|
8611
8703
|
name: "payslip_statement_t3",
|
|
@@ -8628,7 +8720,13 @@ var form_field_base_specs_default = {
|
|
|
8628
8720
|
"payslipEmployeeTaxT3",
|
|
8629
8721
|
"payslipOtherDeductionT3"
|
|
8630
8722
|
],
|
|
8631
|
-
category: "13"
|
|
8723
|
+
category: "13",
|
|
8724
|
+
document_type: "payslips",
|
|
8725
|
+
document_group: "payslip_statements",
|
|
8726
|
+
document_group_label: "Payslip Statements",
|
|
8727
|
+
wire_format: "path_array",
|
|
8728
|
+
document_slot: 3,
|
|
8729
|
+
time_period_unit: "month"
|
|
8632
8730
|
},
|
|
8633
8731
|
{
|
|
8634
8732
|
name: "payslip_statement_t4",
|
|
@@ -8651,7 +8749,13 @@ var form_field_base_specs_default = {
|
|
|
8651
8749
|
"payslipEmployeeTaxT4",
|
|
8652
8750
|
"payslipOtherDeductionT4"
|
|
8653
8751
|
],
|
|
8654
|
-
category: "13"
|
|
8752
|
+
category: "13",
|
|
8753
|
+
document_type: "payslips",
|
|
8754
|
+
document_group: "payslip_statements",
|
|
8755
|
+
document_group_label: "Payslip Statements",
|
|
8756
|
+
wire_format: "path_array",
|
|
8757
|
+
document_slot: 4,
|
|
8758
|
+
time_period_unit: "month"
|
|
8655
8759
|
},
|
|
8656
8760
|
{
|
|
8657
8761
|
name: "payslip_statement_t5",
|
|
@@ -8674,7 +8778,13 @@ var form_field_base_specs_default = {
|
|
|
8674
8778
|
"payslipEmployeeTaxT5",
|
|
8675
8779
|
"payslipOtherDeductionT5"
|
|
8676
8780
|
],
|
|
8677
|
-
category: "13"
|
|
8781
|
+
category: "13",
|
|
8782
|
+
document_type: "payslips",
|
|
8783
|
+
document_group: "payslip_statements",
|
|
8784
|
+
document_group_label: "Payslip Statements",
|
|
8785
|
+
wire_format: "path_array",
|
|
8786
|
+
document_slot: 5,
|
|
8787
|
+
time_period_unit: "month"
|
|
8678
8788
|
},
|
|
8679
8789
|
{
|
|
8680
8790
|
name: "payslip_statement_t6",
|
|
@@ -8697,7 +8807,13 @@ var form_field_base_specs_default = {
|
|
|
8697
8807
|
"payslipEmployeeTaxT6",
|
|
8698
8808
|
"payslipOtherDeductionT6"
|
|
8699
8809
|
],
|
|
8700
|
-
category: "13"
|
|
8810
|
+
category: "13",
|
|
8811
|
+
document_type: "payslips",
|
|
8812
|
+
document_group: "payslip_statements",
|
|
8813
|
+
document_group_label: "Payslip Statements",
|
|
8814
|
+
wire_format: "path_array",
|
|
8815
|
+
document_slot: 6,
|
|
8816
|
+
time_period_unit: "month"
|
|
8701
8817
|
}
|
|
8702
8818
|
]
|
|
8703
8819
|
};
|
|
@@ -9191,6 +9307,55 @@ var FileFieldTableType = /* @__PURE__ */ ((FileFieldTableType2) => {
|
|
|
9191
9307
|
return FileFieldTableType2;
|
|
9192
9308
|
})(FileFieldTableType || {});
|
|
9193
9309
|
|
|
9310
|
+
// src/document-types.ts
|
|
9311
|
+
var cached = null;
|
|
9312
|
+
function buildDocumentTypeGroups() {
|
|
9313
|
+
const fileFields = getBaseFieldSpecs().filter(
|
|
9314
|
+
(f) => f.type === "file" && !!f.name
|
|
9315
|
+
);
|
|
9316
|
+
const order = [];
|
|
9317
|
+
const byDocumentType = /* @__PURE__ */ new Map();
|
|
9318
|
+
for (const f of fileFields) {
|
|
9319
|
+
const documentType = f.document_type ?? f.name;
|
|
9320
|
+
const documentGroup = f.document_group ?? documentType;
|
|
9321
|
+
const label = f.document_group_label ?? f.displayName ?? documentType;
|
|
9322
|
+
if (!byDocumentType.has(documentType)) {
|
|
9323
|
+
order.push(documentType);
|
|
9324
|
+
byDocumentType.set(documentType, {
|
|
9325
|
+
documentGroup,
|
|
9326
|
+
label,
|
|
9327
|
+
wireFormat: f.wire_format,
|
|
9328
|
+
fields: []
|
|
9329
|
+
});
|
|
9330
|
+
}
|
|
9331
|
+
byDocumentType.get(documentType).fields.push(f);
|
|
9332
|
+
}
|
|
9333
|
+
return order.map((documentType) => {
|
|
9334
|
+
const entry = byDocumentType.get(documentType);
|
|
9335
|
+
return {
|
|
9336
|
+
documentType,
|
|
9337
|
+
documentGroup: entry.documentGroup,
|
|
9338
|
+
label: entry.label,
|
|
9339
|
+
wireFormat: entry.wireFormat,
|
|
9340
|
+
fields: entry.fields
|
|
9341
|
+
};
|
|
9342
|
+
});
|
|
9343
|
+
}
|
|
9344
|
+
function getDocumentTypeGroups() {
|
|
9345
|
+
if (!cached) cached = buildDocumentTypeGroups();
|
|
9346
|
+
return cached;
|
|
9347
|
+
}
|
|
9348
|
+
function isDocumentType(id) {
|
|
9349
|
+
return getDocumentTypeGroups().some((g) => g.documentType === id);
|
|
9350
|
+
}
|
|
9351
|
+
function assertDocumentType(id) {
|
|
9352
|
+
if (!isDocumentType(id)) {
|
|
9353
|
+
const known = getDocumentTypeGroups().map((g) => g.documentType);
|
|
9354
|
+
throw new Error(`Unknown document type: "${id}". Available: ${known.join(", ")}`);
|
|
9355
|
+
}
|
|
9356
|
+
return id;
|
|
9357
|
+
}
|
|
9358
|
+
|
|
9194
9359
|
// src/data/form-field-display-names.json
|
|
9195
9360
|
var form_field_display_names_default = {
|
|
9196
9361
|
accountHolderName: "Account Holder Name",
|
|
@@ -9399,42 +9564,26 @@ function groupColumnsByTimePeriod(columnNames) {
|
|
|
9399
9564
|
}
|
|
9400
9565
|
return groups;
|
|
9401
9566
|
}
|
|
9402
|
-
var FIELD_GROUP_PREFIXES = [
|
|
9403
|
-
["bank_statement", "bank_statements"],
|
|
9404
|
-
["financials", "financials"],
|
|
9405
|
-
["epf_statement", "epf_statements"],
|
|
9406
|
-
["payslip_statement", "payslip_statements"],
|
|
9407
|
-
["ssm", "ssm_documents"],
|
|
9408
|
-
["form9", "form9"],
|
|
9409
|
-
["ic", "ic_documents"]
|
|
9410
|
-
];
|
|
9411
9567
|
function groupFieldsByPattern(fields) {
|
|
9412
9568
|
const groups = {};
|
|
9413
9569
|
for (const field of fields) {
|
|
9414
9570
|
if (!field.name) continue;
|
|
9415
|
-
|
|
9416
|
-
for (const [prefix, group] of FIELD_GROUP_PREFIXES) {
|
|
9417
|
-
if (field.name.startsWith(prefix)) {
|
|
9418
|
-
groupName = group;
|
|
9419
|
-
break;
|
|
9420
|
-
}
|
|
9421
|
-
}
|
|
9571
|
+
const groupName = field.document_group ?? field.name;
|
|
9422
9572
|
if (!groups[groupName]) groups[groupName] = [];
|
|
9423
9573
|
groups[groupName].push(field);
|
|
9424
9574
|
}
|
|
9425
9575
|
return groups;
|
|
9426
9576
|
}
|
|
9427
|
-
var
|
|
9428
|
-
bank_statements: "Bank Statements",
|
|
9429
|
-
financials: "Audited Financial Statements",
|
|
9430
|
-
epf_statements: "EPF Statements",
|
|
9431
|
-
payslip_statements: "Payslip Statements",
|
|
9432
|
-
form9: "Form 9 / Section 17 / Form D",
|
|
9433
|
-
ssm_documents: "SSM Company Information",
|
|
9434
|
-
ic_documents: "Identification Card"
|
|
9435
|
-
};
|
|
9577
|
+
var cachedGroupDisplayNames = null;
|
|
9436
9578
|
function getGroupDisplayNames() {
|
|
9437
|
-
|
|
9579
|
+
if (!cachedGroupDisplayNames) {
|
|
9580
|
+
const names = {};
|
|
9581
|
+
for (const group of getDocumentTypeGroups()) {
|
|
9582
|
+
names[group.documentGroup] = group.label;
|
|
9583
|
+
}
|
|
9584
|
+
cachedGroupDisplayNames = names;
|
|
9585
|
+
}
|
|
9586
|
+
return cachedGroupDisplayNames;
|
|
9438
9587
|
}
|
|
9439
9588
|
function isNumericField(fieldName) {
|
|
9440
9589
|
const patterns = [
|
|
@@ -9479,7 +9628,7 @@ function buildTableForGroup(groupName, fields, ihsData, fieldProvenance) {
|
|
|
9479
9628
|
const periods = extractTimePeriods(allColumns);
|
|
9480
9629
|
const isTimeSeries = periods.length > 0;
|
|
9481
9630
|
const tableType = isTimeSeries ? "timeSeries" /* TIME_SERIES */ : "keyValue" /* KEY_VALUE */;
|
|
9482
|
-
const groupDisplayName =
|
|
9631
|
+
const groupDisplayName = getGroupDisplayNames()[groupName] || fields[0]?.displayName || getDisplayName(groupName);
|
|
9483
9632
|
if (isTimeSeries) {
|
|
9484
9633
|
const columnGroups = groupColumnsByTimePeriod(allColumns);
|
|
9485
9634
|
const items = [];
|
|
@@ -9800,16 +9949,6 @@ var ExtractionJobStatus = /* @__PURE__ */ ((ExtractionJobStatus2) => {
|
|
|
9800
9949
|
ExtractionJobStatus2["Failed"] = "failed";
|
|
9801
9950
|
return ExtractionJobStatus2;
|
|
9802
9951
|
})(ExtractionJobStatus || {});
|
|
9803
|
-
var ExtractionFileType = /* @__PURE__ */ ((ExtractionFileType2) => {
|
|
9804
|
-
ExtractionFileType2["FinancialStatement"] = "financialStatements";
|
|
9805
|
-
ExtractionFileType2["BankStatement"] = "bankStatements";
|
|
9806
|
-
ExtractionFileType2["Epf"] = "epfStatements";
|
|
9807
|
-
ExtractionFileType2["Payslip"] = "payslips";
|
|
9808
|
-
ExtractionFileType2["Ssm"] = "ssm";
|
|
9809
|
-
ExtractionFileType2["Form9"] = "form9";
|
|
9810
|
-
ExtractionFileType2["Ic"] = "ic";
|
|
9811
|
-
return ExtractionFileType2;
|
|
9812
|
-
})(ExtractionFileType || {});
|
|
9813
9952
|
|
|
9814
9953
|
// src/ihs-status.ts
|
|
9815
9954
|
var IhsStatus = /* @__PURE__ */ ((IhsStatus2) => {
|
|
@@ -9869,19 +10008,6 @@ var DocExtractionStatus = /* @__PURE__ */ ((DocExtractionStatus2) => {
|
|
|
9869
10008
|
DocExtractionStatus2["Unknown"] = "unknown";
|
|
9870
10009
|
return DocExtractionStatus2;
|
|
9871
10010
|
})(DocExtractionStatus || {});
|
|
9872
|
-
var FILE_TYPE_TO_GROUP = {
|
|
9873
|
-
["bankStatements" /* BankStatement */]: "bank_statements",
|
|
9874
|
-
["financialStatements" /* FinancialStatement */]: "financials",
|
|
9875
|
-
["epfStatements" /* Epf */]: "epf_statements",
|
|
9876
|
-
["payslips" /* Payslip */]: "payslip_statements",
|
|
9877
|
-
["ssm" /* Ssm */]: "ssm_documents",
|
|
9878
|
-
["form9" /* Form9 */]: "form9",
|
|
9879
|
-
["ic" /* Ic */]: "ic_documents"
|
|
9880
|
-
};
|
|
9881
|
-
var _specs = getBaseFieldSpecs();
|
|
9882
|
-
var _fileFields = _specs.filter((f) => f.type === "file" && f.ihs_column_names?.length);
|
|
9883
|
-
var _grouped = groupFieldsByPattern(_fileFields);
|
|
9884
|
-
var _groupDisplayNames = getGroupDisplayNames();
|
|
9885
10011
|
function isPopulated(value) {
|
|
9886
10012
|
if (value === null || value === void 0 || value === "") return false;
|
|
9887
10013
|
if (value === "Not Specified") return false;
|
|
@@ -9945,10 +10071,10 @@ function resolveDocStatus(columns, ihsRecord, uploaded, jobRecord, hasJobRecords
|
|
|
9945
10071
|
function resolveExtractionStatus(ihsRecord, jobRecords) {
|
|
9946
10072
|
const documents = [];
|
|
9947
10073
|
const hasJobRecords = jobRecords !== void 0;
|
|
9948
|
-
for (const
|
|
9949
|
-
const
|
|
9950
|
-
const fields =
|
|
9951
|
-
const displayName =
|
|
10074
|
+
for (const group of getDocumentTypeGroups()) {
|
|
10075
|
+
const fileType = group.documentType;
|
|
10076
|
+
const fields = group.fields;
|
|
10077
|
+
const displayName = group.label;
|
|
9952
10078
|
const uploadedCount = countUploadedFiles(ihsRecord, fileType);
|
|
9953
10079
|
const isUploaded = uploadedCount > 0 || fields.some((f) => f.name && isPopulated(ihsRecord[f.name]));
|
|
9954
10080
|
const matchingJobs = jobRecords?.filter((j) => j.fileType === fileType) ?? [];
|
|
@@ -10598,7 +10724,6 @@ function assertAdapterCategory(id) {
|
|
|
10598
10724
|
BasicFormField,
|
|
10599
10725
|
DEFAULT_VALIDATOR_DEFINITIONS,
|
|
10600
10726
|
DocExtractionStatus,
|
|
10601
|
-
ExtractionFileType,
|
|
10602
10727
|
ExtractionJobStatus,
|
|
10603
10728
|
FIELD_TYPE_DEFINITIONS,
|
|
10604
10729
|
FieldType,
|
|
@@ -10618,6 +10743,7 @@ function assertAdapterCategory(id) {
|
|
|
10618
10743
|
applyAggregation,
|
|
10619
10744
|
applyDynamicTitles,
|
|
10620
10745
|
assertAdapterCategory,
|
|
10746
|
+
assertDocumentType,
|
|
10621
10747
|
buildDocumentRows,
|
|
10622
10748
|
buildFileFieldTables,
|
|
10623
10749
|
categoryFieldsOf,
|
|
@@ -10638,6 +10764,7 @@ function assertAdapterCategory(id) {
|
|
|
10638
10764
|
getDisplayName,
|
|
10639
10765
|
getDisplayNames,
|
|
10640
10766
|
getDocDisplayNames,
|
|
10767
|
+
getDocumentTypeGroups,
|
|
10641
10768
|
getExtractableDocTypes,
|
|
10642
10769
|
getGroupDisplayNames,
|
|
10643
10770
|
getPastMonthLabel,
|
|
@@ -10650,6 +10777,7 @@ function assertAdapterCategory(id) {
|
|
|
10650
10777
|
groupFieldsByCategory,
|
|
10651
10778
|
groupFieldsByPattern,
|
|
10652
10779
|
isAdapterCategory,
|
|
10780
|
+
isDocumentType,
|
|
10653
10781
|
isFailureIhsStatus,
|
|
10654
10782
|
isTerminalIhsStatus,
|
|
10655
10783
|
isValidIhsStatus,
|