@mojaloop/central-ledger 19.14.0 → 20.1.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/.grype.yaml +3 -0
- package/.license-scanner.json +16 -0
- package/.ncurc.yaml +19 -13
- package/.nvmrc +1 -1
- package/.nycrc.yml +14 -2
- package/CHANGELOG.md +51 -0
- package/Dockerfile +13 -10
- package/README.md +39 -89
- package/audit-ci.jsonc +1 -1
- package/config/default.json +60 -3
- package/config/deprecated.default-settlement.json +160 -0
- package/docker/ml-api-adapter/default.json +28 -0
- package/docker-compose.yml +6 -0
- package/nodemon.json +6 -0
- package/package.json +128 -64
- package/{sbom-v19.13.2.csv → sbom-v20.0.0.csv} +886 -736
- package/scripts/_wait4_all.js +5 -5
- package/scripts/transferSettlementTemp/interchangeFeeCalculation.js +51 -0
- package/src/api/index.ts +30 -0
- package/src/api/interface/swagger.json +2249 -2054
- package/src/api/participants/routes.js +1 -1
- package/src/api/root/handler.int.ts +55 -0
- package/src/api/routes.js +7 -6
- package/src/api/server.ts +27 -0
- package/src/api/server.unit.ts +16 -0
- package/src/api/settlementModels/routes.js +4 -4
- package/src/domain/participant/index.d.ts +47 -0
- package/src/domain/participant/index.int.ts +724 -0
- package/src/domain/participant/index.js +4 -5
- package/src/domain/position/fx-prepare.js +1 -1
- package/src/domain/position/fx-timeout-reserved.js +6 -0
- package/src/domain/position/prepare.js +1 -1
- package/src/handlers/admin/handler.js +1 -1
- package/src/handlers/index.js +30 -0
- package/src/handlers/positions/handler.js +0 -2
- package/src/handlers/positions/handlerBatch.js +5 -5
- package/src/handlers/register.js +44 -29
- package/src/handlers/timeouts/handler.js +1 -4
- package/src/handlers/transfers/fx-abort.int.ts +209 -0
- package/src/handlers/transfers/fx-handlers.int.ts +275 -0
- package/src/handlers/transfers/fx-timeout.int.ts +284 -0
- package/src/handlers/transfers/handler.js +1 -3
- package/src/handlers/transfers/handlers.int.ts +538 -0
- package/src/handlers/transfers/prepare.int.ts +1283 -0
- package/src/handlers/transfers/prepare.js +2 -2
- package/src/knexfile.js +19 -0
- package/src/lib/cache.js +1 -1
- package/src/lib/config/index.ts +60 -0
- package/src/lib/config/resolver.ts +231 -0
- package/src/lib/config/resolver.unit.ts +72 -0
- package/src/lib/config/types.ts +372 -0
- package/src/lib/config/util.ts +523 -0
- package/src/lib/config/util.unit.ts +825 -0
- package/src/lib/migrator.js +3 -3
- package/src/lib/proxyCache.js +3 -3
- package/{migrations → src/migrations}/100100_event.js +1 -1
- package/{migrations → src/migrations}/110100_contactType.js +1 -1
- package/{migrations → src/migrations}/110200_currency.js +1 -1
- package/{migrations → src/migrations}/110201_currency-scale.js +1 -1
- package/{migrations → src/migrations}/110300_endpointType.js +1 -1
- package/{migrations → src/migrations}/110400_ledgerEntryType.js +1 -1
- package/{migrations → src/migrations}/110450_ledgerAccountType.js +1 -1
- package/{migrations → src/migrations}/110500_participantLimitType.js +1 -1
- package/{migrations → src/migrations}/110600_transferParticipantRoleType.js +1 -1
- package/{migrations → src/migrations}/110700_transferState.js +1 -1
- package/{migrations → src/migrations}/110900_settlementState.js +1 -1
- package/{migrations → src/migrations}/112000_bulkTransferState.js +1 -1
- package/{migrations → src/migrations}/112100_bulkProcessingState.js +1 -1
- package/{migrations → src/migrations}/200100_participant.js +1 -1
- package/{migrations → src/migrations}/200200_participantContact.js +1 -1
- package/{migrations → src/migrations}/200300_participantEndpoint.js +1 -1
- package/{migrations → src/migrations}/200400_participantParty.js +1 -1
- package/{migrations → src/migrations}/200600_token.js +1 -1
- package/{migrations → src/migrations}/200601_token-indexes.js +1 -1
- package/{migrations → src/migrations}/300100_transferDuplicateCheck.js +2 -2
- package/{migrations → src/migrations}/300150_bulkTransferDuplicateCheck.js +2 -2
- package/{migrations → src/migrations}/300200_transfer.js +2 -2
- package/{migrations → src/migrations}/300202_transfer-decimal184.js +1 -1
- package/{migrations → src/migrations}/300250_bulkTransfer.js +2 -3
- package/{migrations → src/migrations}/300275_bulkTransferAssociation.js +2 -3
- package/{migrations → src/migrations}/300300_ilpPacket.js +1 -1
- package/{migrations → src/migrations}/300400_transferStateChange.js +1 -1
- package/{migrations → src/migrations}/300450_bulkTransferStateChange.js +1 -1
- package/{migrations → src/migrations}/300500_segment.js +1 -1
- package/{migrations → src/migrations}/310100_participantCurrency.js +1 -1
- package/{migrations → src/migrations}/310200_transferParticipant.js +1 -1
- package/{migrations → src/migrations}/310202_transferParticipant-decimal184.js +1 -1
- package/{migrations → src/migrations}/310204_transferParticipant-participantId.js +2 -2
- package/{migrations → src/migrations}/310300_participantPosition.js +1 -1
- package/{migrations → src/migrations}/310302_participantPosition-decimal184.js +1 -1
- package/{migrations → src/migrations}/310400_participantPositionChange.js +1 -1
- package/{migrations → src/migrations}/310402_participantPositionChange-decimal184.js +1 -1
- package/{migrations → src/migrations}/310403_participantPositionChange-participantCurrencyId.js +2 -2
- package/{migrations → src/migrations}/310404_participantPositionChange-change.js +2 -2
- package/{migrations → src/migrations}/310500_participantLimit.js +1 -1
- package/{migrations → src/migrations}/310502_participantLimit-decimal184.js +1 -1
- package/{migrations → src/migrations}/400100_settlementWindow.js +1 -1
- package/{migrations → src/migrations}/400200_settlement.js +1 -1
- package/{migrations → src/migrations}/400300_settlementSettlementWindow.js +1 -1
- package/{migrations → src/migrations}/400301_settlementSettlementWindow-indexes.js +0 -1
- package/{migrations → src/migrations}/400400_settlementWindowStateChange.js +1 -1
- package/{migrations → src/migrations}/400500_settlementTransferParticipant.js +1 -1
- package/{migrations → src/migrations}/400502_settlementTransferParticipant-decimal184.js +1 -1
- package/{migrations → src/migrations}/400600_settlementParticipantCurrency.js +1 -1
- package/{migrations → src/migrations}/400602_settlementParticipantCurrency-decimal184.js +1 -1
- package/{migrations → src/migrations}/400700_settlementParticipantCurrencyStateChange.js +1 -1
- package/{migrations → src/migrations}/400800_settlementStateChange.js +1 -1
- package/{migrations → src/migrations}/400900_settlementWindowContent.js +1 -1
- package/{migrations → src/migrations}/401000_settlementWindowContentStateChange.js +1 -1
- package/{migrations → src/migrations}/401001_settlementWindowContentStateChange-indexes.js +6 -6
- package/{migrations → src/migrations}/401200_settlementContentAggregation.js +1 -1
- package/{migrations → src/migrations}/401300_settlementModel.js +1 -1
- package/{migrations → src/migrations}/410100_transferFulfilmentDuplicateCheck.js +1 -1
- package/{migrations → src/migrations}/410102_transferFulfilmentDuplicateCheck-dropForeignTransferId.js +1 -1
- package/{migrations → src/migrations}/410103_transferFulfilmentDuplicateCheck-hashNullable.js +1 -1
- package/{migrations → src/migrations}/410200_transferFulfilment.js +1 -1
- package/{migrations → src/migrations}/410202_transferFulfilment-ilpFulfilment.js +1 -1
- package/{migrations → src/migrations}/410203_transferFulfilment-foreignTransferFulfilmentId.js +1 -1
- package/{migrations → src/migrations}/410240_bulkTransferFulfilmentDuplicateCheck.js +1 -1
- package/{migrations → src/migrations}/410250_bulkTransferFulfilment.js +1 -1
- package/{migrations → src/migrations}/410300_transferExtension.js +1 -1
- package/{migrations → src/migrations}/410302_transferExtension-transferErrorId.js +1 -1
- package/{migrations → src/migrations}/410350_bulkTransferExtension.js +1 -1
- package/{migrations → src/migrations}/410400_transferTimeout.js +1 -1
- package/{migrations → src/migrations}/410450_transferErrorDuplicateCheck.js +1 -1
- package/{migrations → src/migrations}/410500_transferError.js +1 -1
- package/{migrations → src/migrations}/410502_transferError-foreignTransferErrorDuplicateCheckId.js +1 -1
- package/{migrations → src/migrations}/410550_bulkTransferError.js +1 -1
- package/{migrations → src/migrations}/410600_expiringTransfer.js +1 -1
- package/{migrations → src/migrations}/500401_quote-hotfix-2719.js +8 -8
- package/{migrations → src/migrations}/500501_feature-fixSubIdRef.js +12 -12
- package/{migrations → src/migrations}/500601_party-2480.js +3 -3
- package/{migrations → src/migrations}/501001_quoteExtension-quote-service-174.js +1 -2
- package/{migrations → src/migrations}/501002_quoteExtension-2522.js +3 -3
- package/{migrations → src/migrations}/600010_fxTransferType.js +1 -1
- package/{migrations → src/migrations}/600012_fxParticipantCurrencyType.js +1 -1
- package/{migrations → src/migrations}/600100_fxTransferDuplicateCheck.js +2 -2
- package/{migrations → src/migrations}/600110_fxTransferErrorDuplicateCheck.js.js +1 -1
- package/{migrations → src/migrations}/600200_fxTransfer.js +2 -2
- package/{migrations → src/migrations}/600400_fxTransferStateChange.js +1 -1
- package/{migrations → src/migrations}/600501_fxWatchList.js +2 -2
- package/{migrations → src/migrations}/600600_fxTransferFulfilmentDuplicateCheck.js +1 -1
- package/{migrations → src/migrations}/600700_fxTransferFulfilment.js +1 -1
- package/{migrations → src/migrations}/600800_fxTransferExtension.js +1 -1
- package/{migrations → src/migrations}/601400_fxTransferTimeout.js +1 -1
- package/{migrations → src/migrations}/601500_fxTransferError.js +1 -1
- package/{migrations → src/migrations}/610200_fxTransferParticipant.js +1 -1
- package/{migrations → src/migrations}/610202_fxTransferParticipant-participantId.js +2 -2
- package/{migrations → src/migrations}/610403_participantPositionChange-fxTransfer.js +1 -1
- package/{migrations → src/migrations}/800100_quotePartyView.js +1 -1
- package/{migrations → src/migrations}/800101_feature-fixSubIdRef.js +1 -1
- package/{migrations → src/migrations}/800200_quoteView.js +1 -1
- package/{migrations → src/migrations}/800300_quoteResponseView.js +1 -1
- package/{migrations → src/migrations}/900100_foreign-keys.js +18 -18
- package/{migrations → src/migrations}/900101_foreign-keys.js +6 -6
- package/{migrations → src/migrations}/910100_feature904DDL.js +7 -7
- package/{migrations → src/migrations}/910101_feature904DataMigration.js +1 -1
- package/{migrations → src/migrations}/910102_feature949DataMigration.js +1 -1
- package/{migrations → src/migrations}/910103_feature1093SettlementByCurrency.js +3 -3
- package/{migrations → src/migrations}/940101_quotePartyIdInfoExtension-2522.js +25 -25
- package/{migrations → src/migrations}/950101_transferParticipantStateChange.js +2 -2
- package/{migrations → src/migrations}/950102_settlementModel-adjustPosition.js +2 -2
- package/{migrations → src/migrations}/950103_dropTransferParticipantStateChange.js +3 -3
- package/{migrations → src/migrations}/950104_settlementModel-settlementAccountTypeId.js +3 -3
- package/src/migrations/950107_settlementWindowContent_foreign_settlementModel.js +63 -0
- package/{migrations → src/migrations}/950108_participantProxy.js +1 -2
- package/{migrations → src/migrations}/950120_fxQuoteConversionTerms_sourceAmount_nullable.js +1 -1
- package/{migrations → src/migrations}/960100_create_externalParticipant.js +2 -2
- package/{migrations → src/migrations}/960110_alter_transferParticipant__addFiled_externalParticipantId.js +2 -2
- package/{migrations → src/migrations}/961001_transferForwarded.js +1 -1
- package/{migrations → src/migrations}/961002_fxTransferForwarded.js +1 -1
- package/src/models/participant/externalParticipant.int.ts +85 -0
- package/src/models/participant/facade.js +4 -2
- package/src/models/participant/participantCurrencyCached.js +1 -1
- package/src/models/position/facade.js +8 -2
- package/src/models/transfer/facade.int.ts +139 -0
- package/src/models/transfer/facade.js +8 -3
- package/src/models/transfer/transferDuplicateCheck.js +2 -2
- package/src/models/transfer/transferError.int.ts +112 -0
- package/src/models/transfer/transferExtension.int.ts +137 -0
- package/src/models/transfer/transferStateChange.int.ts +117 -0
- package/{seeds → src/seeds}/participant.js +1 -1
- package/{seeds → src/seeds}/settlementInterchange.js +1 -0
- package/src/settlement/api/handlerRoutes.js +71 -0
- package/src/settlement/api/handlers/health.js +10 -0
- package/src/settlement/api/handlers/index.js +57 -0
- package/src/settlement/api/handlers/settlementWindows/{id}.js +103 -0
- package/src/settlement/api/handlers/settlementWindows.js +77 -0
- package/src/settlement/api/handlers/settlements/{id}.js +133 -0
- package/src/settlement/api/handlers/settlements/{sid}/participants/{pid}/accounts/{aid}.js +127 -0
- package/src/settlement/api/handlers/settlements/{sid}/participants/{pid}.js +127 -0
- package/src/settlement/api/handlers/settlements.js +114 -0
- package/src/settlement/api/openapiRouting.js +87 -0
- package/src/settlement/api/routes.js +176 -0
- package/src/settlement/domain/rules/index.js +46 -0
- package/src/settlement/domain/settlement/index.js +405 -0
- package/src/settlement/domain/settlementWindow/index.js +117 -0
- package/src/settlement/domain/transactions/index.js +83 -0
- package/src/settlement/domain/transferSettlement/index.js +57 -0
- package/src/settlement/handlers/deferredSettlement/handler.js +180 -0
- package/src/settlement/handlers/grossSettlement/handler.js +180 -0
- package/src/settlement/handlers/index.js +101 -0
- package/src/settlement/handlers/register.js +92 -0
- package/src/settlement/handlers/rules/handler.js +164 -0
- package/src/settlement/interface/swagger-handler.json +34 -0
- package/src/settlement/interface/swagger.json +1560 -0
- package/src/settlement/lib/db.js +32 -0
- package/src/settlement/lib/kafka/index.js +41 -0
- package/src/settlement/lib/kafka/producer.js +142 -0
- package/src/settlement/lib/scriptEngine.js +99 -0
- package/src/settlement/lib/scriptsLoader.js +175 -0
- package/src/settlement/lib/utility.js +243 -0
- package/src/settlement/models/ilpPackets/ilpPacket.js +42 -0
- package/src/settlement/models/lib/enums.js +192 -0
- package/src/settlement/models/misc/migrationLock.js +53 -0
- package/src/settlement/models/settlement/facade.js +1652 -0
- package/src/settlement/models/settlement/index.js +55 -0
- package/src/settlement/models/settlement/participantCurrency.js +48 -0
- package/src/settlement/models/settlement/settlement.js +49 -0
- package/src/settlement/models/settlement/settlementModel.js +44 -0
- package/src/settlement/models/settlement/settlementParticipantCurrency.js +61 -0
- package/src/settlement/models/settlement/settlementStateChange.js +44 -0
- package/src/settlement/models/settlement/settlementTransferParticipant.js +46 -0
- package/src/settlement/models/settlementWindow/facade.js +345 -0
- package/src/settlement/models/settlementWindow/index.js +47 -0
- package/src/settlement/models/settlementWindow/settlementWindowStateChange.js +55 -0
- package/src/settlement/models/settlementWindowContent/facade.js +79 -0
- package/src/settlement/models/settlementWindowContent/index.js +40 -0
- package/src/settlement/models/settlementWindowContent/settlementWindowContentStateChange.js +53 -0
- package/src/settlement/models/transferSettlement/facade.js +363 -0
- package/src/settlement/models/transferSettlement/index.js +42 -0
- package/src/settlement/shared/logger/index.js +7 -0
- package/src/settlement/shared/plugins.js +88 -0
- package/src/settlement/shared/setup.js +224 -0
- package/src/settlement/utils/truthyProperty.js +37 -0
- package/src/shared/legacyUtilShim.js +20 -0
- package/src/shared/plugins.js +3 -3
- package/src/shared/results.ts +22 -0
- package/src/shared/results.unit.ts +38 -0
- package/src/shared/setup.js +14 -1
- package/src/testing/api-helpers.ts +1222 -0
- package/src/testing/exec-async.ts +67 -0
- package/src/testing/harness.snapshot.sql +3895 -0
- package/src/testing/harness.test.ts +15 -0
- package/src/testing/harness.ts +1160 -0
- package/src/testing/kafka.ts +221 -0
- package/src/testing/prng.ts +82 -0
- package/src/testing/rdkafka.test.ts +263 -0
- package/src/testing/run.ts +559 -0
- package/src/testing/snapshot.test.ts +92 -0
- package/src/testing/snapshot.ts +549 -0
- package/src/testing/tap-stream.ts +164 -0
- package/src/testing/types.ts +95 -0
- package/src/testing/util.ts +333 -0
- package/src/types/central-services-error-handling.d.ts +72 -0
- package/src/types/central-services-stream.d.ts +148 -0
- package/test-integration.Dockerfile +0 -2
- package/test.Dockerfile +0 -2
- package/tsconfig.json +40 -0
- package/config/knexfile.js +0 -19
- package/migrations/950107_settlementWindowContent_foreign_settlementModel.js +0 -63
- package/src/api/index.js +0 -16
- package/src/lib/config.js +0 -81
- /package/{migrations → src/migrations}/110101_contactType-indexes.js +0 -0
- /package/{migrations → src/migrations}/110301_endpointType-indexes.js +0 -0
- /package/{migrations → src/migrations}/110401_ledgerEntryType-indexes.js +0 -0
- /package/{migrations → src/migrations}/110451_ledgerAccountType-indexes.js +0 -0
- /package/{migrations → src/migrations}/110501_participantLimitType-indexes.js +0 -0
- /package/{migrations → src/migrations}/110601_transferParticipantRoleType-indexes.js +0 -0
- /package/{migrations → src/migrations}/110800_settlementWindowState.js +0 -0
- /package/{migrations → src/migrations}/111000_amountType.js +0 -0
- /package/{migrations → src/migrations}/111001_amountType-indexes.js +0 -0
- /package/{migrations → src/migrations}/111100_balanceOfPayments.js +0 -0
- /package/{migrations → src/migrations}/111101_balanceOfPayments-indexes.js +0 -0
- /package/{migrations → src/migrations}/111200_partyIdentifierType.js +0 -0
- /package/{migrations → src/migrations}/111201_partyIdentifierType-indexes.js +0 -0
- /package/{migrations → src/migrations}/111300_partyType.js +0 -0
- /package/{migrations → src/migrations}/111301_partyType-indexes.js +0 -0
- /package/{migrations → src/migrations}/111400_quoteDuplicateCheck.js +0 -0
- /package/{migrations → src/migrations}/111500_transactionInitiator.js +0 -0
- /package/{migrations → src/migrations}/111501_transactionInitiator-indexes.js +0 -0
- /package/{migrations → src/migrations}/111600_transactionInitiatorType.js +0 -0
- /package/{migrations → src/migrations}/111601_transactionInitiatorType-indexes.js +0 -0
- /package/{migrations → src/migrations}/111700_settlementDelay.js +0 -0
- /package/{migrations → src/migrations}/111701_settlementDelay-indexes.js +0 -0
- /package/{migrations → src/migrations}/111800_settlementInterchange.js +0 -0
- /package/{migrations → src/migrations}/111801_settlementInterchange-indexes.js +0 -0
- /package/{migrations → src/migrations}/111900_settlementGranularity.js +0 -0
- /package/{migrations → src/migrations}/111901_settlementGranularity-indexes.js +0 -0
- /package/{migrations → src/migrations}/112101_bulkProcessingState-indexes.js +0 -0
- /package/{migrations → src/migrations}/200101_participant-indexes.js +0 -0
- /package/{migrations → src/migrations}/200201_participantContact-indexes.js +0 -0
- /package/{migrations → src/migrations}/200301_participantEndpoint-indexes.js +0 -0
- /package/{migrations → src/migrations}/200401_participantParty-indexes.js +0 -0
- /package/{migrations → src/migrations}/300201_transfer-indexes.js +0 -0
- /package/{migrations → src/migrations}/300251_bulkTransfer-indexes.js +0 -0
- /package/{migrations → src/migrations}/300276_bulkTransferAssociation-indexes.js +0 -0
- /package/{migrations → src/migrations}/300401_transferStateChange-indexes.js +0 -0
- /package/{migrations → src/migrations}/300451_bulkTransferStateChange-indexes.js +0 -0
- /package/{migrations → src/migrations}/300501_segment-indexes.js +0 -0
- /package/{migrations → src/migrations}/310101_participantCurrency-indexes.js +0 -0
- /package/{migrations → src/migrations}/310201_transferParticipant-indexes.js +0 -0
- /package/{migrations → src/migrations}/310203_transferParticipant-indexes.js +0 -0
- /package/{migrations → src/migrations}/310301_participantPosition-indexes.js +0 -0
- /package/{migrations → src/migrations}/310401_participantPositionChange-indexes.js +0 -0
- /package/{migrations → src/migrations}/310405_participantPositionChange-positionChange.js +0 -0
- /package/{migrations → src/migrations}/310406_participantPositionChange-positionChange-revert.js +0 -0
- /package/{migrations → src/migrations}/310501_participantLimit-indexes.js +0 -0
- /package/{migrations → src/migrations}/310503_participantLimit-indexes-composite.js +0 -0
- /package/{migrations → src/migrations}/400401_settlmentWindowStateChange-indexes.js +0 -0
- /package/{migrations → src/migrations}/400501_settlementTransferParticipant-indexes.js +0 -0
- /package/{migrations → src/migrations}/400601_settlementParticipantCurrency-indexes.js +0 -0
- /package/{migrations → src/migrations}/400701_settlementParticipantCurrencyStateChange-indexes.js +0 -0
- /package/{migrations → src/migrations}/400801_settlementStateChange-indexes.js +0 -0
- /package/{migrations → src/migrations}/401002_settlementWindowContent-indexes.js +0 -0
- /package/{migrations → src/migrations}/401201_settlementContentAggregation-indexes.js +0 -0
- /package/{migrations → src/migrations}/401301_settlementModel-indexes.js +0 -0
- /package/{migrations → src/migrations}/410101_transferFulfilmentDuplicateCheck-indexes.js +0 -0
- /package/{migrations → src/migrations}/410201_transferFulfilment-indexes.js +0 -0
- /package/{migrations → src/migrations}/410301_transferExtension-indexes.js +0 -0
- /package/{migrations → src/migrations}/410351_bulkTransferExtension-indexes.js +0 -0
- /package/{migrations → src/migrations}/410401_transferTimeout-indexes.js +0 -0
- /package/{migrations → src/migrations}/410501_transferError-indexes.js +0 -0
- /package/{migrations → src/migrations}/410551_bulkTransferError-indexes.js +0 -0
- /package/{migrations → src/migrations}/410601_expiringTransfer-indexes.js +0 -0
- /package/{migrations → src/migrations}/500100_transactionReference.js +0 -0
- /package/{migrations → src/migrations}/500101_transactionReference-indexes.js +0 -0
- /package/{migrations → src/migrations}/500200_transactionScenario.js +0 -0
- /package/{migrations → src/migrations}/500201_transactionScenario-indexes.js +0 -0
- /package/{migrations → src/migrations}/500300_transactionSubScenario.js +0 -0
- /package/{migrations → src/migrations}/500400_quote.js +0 -0
- /package/{migrations → src/migrations}/500500_quoteParty.js +0 -0
- /package/{migrations → src/migrations}/500600_party.js +0 -0
- /package/{migrations → src/migrations}/500700_quoteResponse.js +0 -0
- /package/{migrations → src/migrations}/500800_quoteResponseIlpPacket.js +0 -0
- /package/{migrations → src/migrations}/500900_geoCode.js +0 -0
- /package/{migrations → src/migrations}/501000_quoteExtension.js +0 -0
- /package/{migrations → src/migrations}/501100_quoteResponseDuplicateCheck.js +0 -0
- /package/{migrations → src/migrations}/501200_quoteError.js +0 -0
- /package/{migrations → src/migrations}/501300_transferRules.js +0 -0
- /package/{migrations → src/migrations}/600011_fxTransferType-indexes.js +0 -0
- /package/{migrations → src/migrations}/600013_fxParticipantCurrencyType-indexes.js +0 -0
- /package/{migrations → src/migrations}/600201_fxTransfer-indexes.js +0 -0
- /package/{migrations → src/migrations}/600401_fxTransferStateChange-indexes.js +0 -0
- /package/{migrations → src/migrations}/600502_fxWatchList-indexes.js +0 -0
- /package/{migrations → src/migrations}/600601_fxTransferFulfilmentDuplicateCheck-indexes.js +0 -0
- /package/{migrations → src/migrations}/600701_fxTransferFulfilment-indexes.js +0 -0
- /package/{migrations → src/migrations}/601401_fxTransferTimeout-indexes.js +0 -0
- /package/{migrations → src/migrations}/601501_fxTransferError-indexes.js +0 -0
- /package/{migrations → src/migrations}/610201_fxTransferParticipant-indexes.js +0 -0
- /package/{migrations → src/migrations}/910102_hotfix954.js +0 -0
- /package/{migrations → src/migrations}/940100_quotePartyIdInfoExtension.js +0 -0
- /package/{migrations → src/migrations}/950100_settlementContentAggregation-decimal184.js +0 -0
- /package/{migrations → src/migrations}/950106_unique_settlement_model_ledger_account_currency.js +0 -0
- /package/{migrations → src/migrations}/950109_fxQuote.js +0 -0
- /package/{migrations → src/migrations}/950110_fxQuoteResponse.js +0 -0
- /package/{migrations → src/migrations}/950111_fxQuoteError.js +0 -0
- /package/{migrations → src/migrations}/950113_fxQuoteDuplicateCheck.js +0 -0
- /package/{migrations → src/migrations}/950114_fxQuoteResponseDuplicateCheck.js +0 -0
- /package/{migrations → src/migrations}/950115_fxQuoteConversionTerms.js +0 -0
- /package/{migrations → src/migrations}/950116_fxQuoteConversionTermsExtension.js +0 -0
- /package/{migrations → src/migrations}/950117_fxQuoteResponseConversionTerms.js +0 -0
- /package/{migrations → src/migrations}/950118_fxQuoteResponseConversionTermsExtension.js +0 -0
- /package/{migrations → src/migrations}/950119_fxCharge.js +0 -0
- /package/{migrations → src/migrations}/960111_alter_fxTransferParticipant__addFiled_externalParticipantId.js +0 -0
- /package/{migrations → src/migrations}/960112_fxTransfer-indexes2.js +0 -0
- /package/{migrations → src/migrations}/960113_fxTransferExtension-indexes.js +0 -0
- /package/{migrations → src/migrations}/960114_fxTransferTimeout-indexes2.js +0 -0
- /package/{migrations → src/migrations}/961000_participantEndpoint_unique.js +0 -0
- /package/{migrations → src/migrations}/migration.template +0 -0
- /package/{seeds → src/seeds}/amountType.js +0 -0
- /package/{seeds → src/seeds}/balanceOfPayments.js +0 -0
- /package/{seeds → src/seeds}/bulkProcessingState.js +0 -0
- /package/{seeds → src/seeds}/bulkTransferState.js +0 -0
- /package/{seeds → src/seeds}/currency.js +0 -0
- /package/{seeds → src/seeds}/endpointType.js +0 -0
- /package/{seeds → src/seeds}/fxParticipantCurrencyType.js +0 -0
- /package/{seeds → src/seeds}/fxTransferType.js +0 -0
- /package/{seeds → src/seeds}/ledgerAccountType.js +0 -0
- /package/{seeds → src/seeds}/ledgerEntryType.js +0 -0
- /package/{seeds → src/seeds}/participantLimitType.js +0 -0
- /package/{seeds → src/seeds}/partyIdentifierType.js +0 -0
- /package/{seeds → src/seeds}/partyType.js +0 -0
- /package/{seeds → src/seeds}/settlementDelay.js +0 -0
- /package/{seeds → src/seeds}/settlementGranularity.js +0 -0
- /package/{seeds → src/seeds}/settlementState.js +0 -0
- /package/{seeds → src/seeds}/settlementWindow1State.js +0 -0
- /package/{seeds → src/seeds}/settlementWindow2Open.js +0 -0
- /package/{seeds → src/seeds}/transactionInitiator.js +0 -0
- /package/{seeds → src/seeds}/transactionInitiatorType.js +0 -0
- /package/{seeds → src/seeds}/transactionScenario.js +0 -0
- /package/{seeds → src/seeds}/transferParticipantRoleType.js +0 -0
- /package/{seeds → src/seeds}/transferState.js +0 -0
- /package/{seeds → src/seeds}/z1000_settlementModel-deprecated.js- +0 -0
package/.grype.yaml
CHANGED
|
@@ -85,6 +85,9 @@ ignore:
|
|
|
85
85
|
- vulnerability: GHSA-2g4f-4pwh-qvx6
|
|
86
86
|
include-aliases: true
|
|
87
87
|
reason: "Unfixable npm transitive vulnerability: ajv (moderate severity) as of 2026-02-23"
|
|
88
|
+
- vulnerability: GHSA-rpr9-rxv7-x643
|
|
89
|
+
include-aliases: true
|
|
90
|
+
reason: "Unfixable npm transitive vulnerability: sanitize-html (critical severity) as of 2026-05-18"
|
|
88
91
|
output:
|
|
89
92
|
- table
|
|
90
93
|
- json
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"exceptions": {
|
|
3
|
+
"markdown-it-attrs@1.2.1": {
|
|
4
|
+
"reason": "MIT per https://www.npmjs.com/package/markdown-it-attrs#license; empty license field in package.json.",
|
|
5
|
+
"expires": "2027-01-01"
|
|
6
|
+
},
|
|
7
|
+
"pause-stream@0.0.11": {
|
|
8
|
+
"reason": "MIT/Apache 2.0 per https://github.com/dominictarr/pause-stream/blob/master/LICENSE.",
|
|
9
|
+
"expires": "2027-01-01"
|
|
10
|
+
},
|
|
11
|
+
"fsevents@2.3.3": {
|
|
12
|
+
"reason": "MIT per https://github.com/fsevents/fsevents/blob/master/LICENSE.",
|
|
13
|
+
"expires": "2027-01-01"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
package/.ncurc.yaml
CHANGED
|
@@ -1,17 +1,23 @@
|
|
|
1
|
-
## Add a
|
|
1
|
+
## Add a comment indicating the reason for each rejected dependency upgrade added to this list.
|
|
2
2
|
reject: [
|
|
3
|
-
#
|
|
4
|
-
#
|
|
3
|
+
# central-services-shared 18.38.x ships two behavioural regressions in a minor release, both
|
|
4
|
+
# reproduced here on 2026-08-19: (1) Util.omitNil/mergeAndOmitNil were de-lodashed and the
|
|
5
|
+
# replacement filters only null, so undefined-valued keys survive - TransformService.toTransfer
|
|
6
|
+
# gains an "expiration: undefined" key and 3 unit tests fail (test/unit/domain/transfer/
|
|
7
|
+
# transform.test.js); (2) the APIDocumentation plugin option was renamed documentPath ->
|
|
8
|
+
# pathToSwaggerFile, breaking plugin registration. Hold at 18.37.0 (same as main) until a
|
|
9
|
+
# shared release restores omitNil nil-semantics; then re-apply the option rename with the bump.
|
|
10
|
+
"@mojaloop/central-services-shared",
|
|
11
|
+
# tape 5.x enforces strict .end()/plan semantics that break this repo's stream-style event tests
|
|
12
|
+
# (verified against the tape 5.10.x line); the suite also runs under the tapes wrapper, which is bound to tape 4.
|
|
5
13
|
"tape",
|
|
6
|
-
#
|
|
14
|
+
# ilp-packet >2.2.0 (3.x is currently an alpha prerelease) implements a newer ILP packet format
|
|
15
|
+
# that is not compatible with the Mojaloop Specification.
|
|
7
16
|
"ilp-packet",
|
|
8
|
-
#
|
|
9
|
-
|
|
10
|
-
#
|
|
11
|
-
#
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
"glob",
|
|
15
|
-
# joi v18.0.1 has dependency issues with other packages
|
|
16
|
-
"joi"
|
|
17
|
+
# database-lib 11.3.8 regression (verified 2026-07-07): Table._addWhere now runs `assert(value)` on every
|
|
18
|
+
# criteria value, so legitimate falsy filters throw, e.g. transferExtension.getByTransferId's
|
|
19
|
+
# { isFulfilment: false, isError: false } fails with "AssertionError [ERR_ASSERTION]: The expression
|
|
20
|
+
# evaluated to a falsy value: assert(value)" (@mojaloop/database-lib/src/table.js:111). Hold at 11.3.7
|
|
21
|
+
# until the upstream assert is fixed to allow falsy (non-undefined/null) criteria values.
|
|
22
|
+
"@mojaloop/database-lib"
|
|
17
23
|
]
|
package/.nvmrc
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
24.18.0
|
package/.nycrc.yml
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
temp-directory: "./.nyc_output"
|
|
2
|
+
# Cache must be disabled for ts-node transpilation to work correctly with nyc.
|
|
3
|
+
cache: false
|
|
2
4
|
check-coverage: true
|
|
3
5
|
per-file: true
|
|
4
6
|
lines: 90
|
|
@@ -7,7 +9,12 @@ functions: 90
|
|
|
7
9
|
branches: 90
|
|
8
10
|
all: true
|
|
9
11
|
include: [
|
|
10
|
-
"src/**/*.js"
|
|
12
|
+
"src/**/*.js",
|
|
13
|
+
"src/**/*.ts"
|
|
14
|
+
]
|
|
15
|
+
extension: [
|
|
16
|
+
".js",
|
|
17
|
+
".ts"
|
|
11
18
|
]
|
|
12
19
|
reporter: [
|
|
13
20
|
"lcov",
|
|
@@ -31,6 +38,11 @@ exclude: [
|
|
|
31
38
|
'src/models/participant/externalParticipantCached.js', # todo: figure out why it shows only 50% coverage in Branch
|
|
32
39
|
'src/models/transfer/facade.js', ## add more test coverage
|
|
33
40
|
'src/shared/fspiopErrorFactory.js',
|
|
34
|
-
'src/lib/proxyCache.js' # todo: remove this line after adding test coverage
|
|
41
|
+
'src/lib/proxyCache.js', # todo: remove this line after adding test coverage
|
|
42
|
+
'src/seeds/**',
|
|
43
|
+
'src/**/*.test.ts',
|
|
44
|
+
'src/testing/**', # Test runner.
|
|
45
|
+
'src/**/*.unit.ts', # Unit test files.
|
|
46
|
+
'src/**/*.int.ts' # Integration test tests.
|
|
35
47
|
]
|
|
36
48
|
## todo: increase test coverage before merging feat/fx-impl to main branch
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,57 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [20.1.0](https://github.com/mojaloop/central-ledger/compare/v20.0.0...v20.1.0) (2026-09-16)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* commit kafka messages asynchronously instead of blocking commit ([#1301](https://github.com/mojaloop/central-ledger/issues/1301)) ([128174a](https://github.com/mojaloop/central-ledger/commit/128174a757bb7aa4ca8b76f51ef560a4a1e0f9cb))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Chore
|
|
14
|
+
|
|
15
|
+
* **sbom:** update sbom [skip ci] ([9dbc9a0](https://github.com/mojaloop/central-ledger/commit/9dbc9a084a5af742247a43efcf1a7a1c893de239))
|
|
16
|
+
|
|
17
|
+
## [20.0.0](https://github.com/mojaloop/central-ledger/compare/v19.14.0...v20.0.0) (2026-09-08)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### ⚠ BREAKING CHANGES
|
|
21
|
+
|
|
22
|
+
* malformed-request validation errors now return FSPIOP 3100 (Ajv) where joi returned 3101 "Malformed syntax" (GP test 'Check Settlements Error #956')
|
|
23
|
+
|
|
24
|
+
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
|
25
|
+
|
|
26
|
+
### Features
|
|
27
|
+
|
|
28
|
+
* add strict typing to config values, along with comprehensive validation ([#1247](https://github.com/mojaloop/central-ledger/issues/1247)) ([771b9c8](https://github.com/mojaloop/central-ledger/commit/771b9c85768742f804d3b82e50b2f67bb66363da))
|
|
29
|
+
* add typescript and basic `tsc` build ([#1243](https://github.com/mojaloop/central-ledger/issues/1243)) ([f84f8a6](https://github.com/mojaloop/central-ledger/commit/f84f8a6447de6e17769330680d5acbefed5f7975))
|
|
30
|
+
* migrate admin and settlement APIs to OpenAPI 3.1 and openapi-… ([#1291](https://github.com/mojaloop/central-ledger/issues/1291)) ([3c26529](https://github.com/mojaloop/central-ledger/commit/3c265297bd6ae54ff209556f57e962915ca9c8cf)), closes [mojaloop/#4479](https://github.com/mojaloop/project/issues/4479)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
### Bug Fixes
|
|
34
|
+
|
|
35
|
+
* config and unit tests for merged settlement codebase ([5738fdd](https://github.com/mojaloop/central-ledger/commit/5738fdd2dc78ad7b4efbd7d6d7bdcc7313f06d1e))
|
|
36
|
+
* return thresholdAlarmPercentage from participant limit facade fo… ([#1288](https://github.com/mojaloop/central-ledger/issues/1288)) ([35b8dfa](https://github.com/mojaloop/central-ledger/commit/35b8dfa4c40ae3b36de43ec45767029768d6c777)), closes [mojaloop/#4479](https://github.com/mojaloop/project/issues/4479)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
### Refactors
|
|
40
|
+
|
|
41
|
+
* copy in central-settlement codebase ([#1286](https://github.com/mojaloop/central-ledger/issues/1286)) ([3f65163](https://github.com/mojaloop/central-ledger/commit/3f65163c6dc48d6c63eab3edbc46d577f6834d36))
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
### Tests
|
|
45
|
+
|
|
46
|
+
* rewrite integration tests in Typescript, using new test harness ([#1287](https://github.com/mojaloop/central-ledger/issues/1287)) ([1fe6767](https://github.com/mojaloop/central-ledger/commit/1fe67675a67fee630e3763649238ceaaecb22355))
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
### Chore
|
|
50
|
+
|
|
51
|
+
* npm audit fixes ([27c4ee1](https://github.com/mojaloop/central-ledger/commit/27c4ee181d9d0bcc8ba2cb9069f835cc4d54443c))
|
|
52
|
+
* override vulns ([457f0b7](https://github.com/mojaloop/central-ledger/commit/457f0b7fc4e36477b16e7f68e824273e74d3a879))
|
|
53
|
+
* **sbom:** update sbom [skip ci] ([ddc7fe3](https://github.com/mojaloop/central-ledger/commit/ddc7fe3af88e5c327a46ec59f3cf46a7cda47b18))
|
|
54
|
+
* update config imports, add test override for global tests ([#1270](https://github.com/mojaloop/central-ledger/issues/1270)) ([bd47d26](https://github.com/mojaloop/central-ledger/commit/bd47d262af2da2f98a1da3b461362c5a03decfa3))
|
|
55
|
+
|
|
5
56
|
## [19.14.0](https://github.com/mojaloop/central-ledger/compare/v19.13.2...v19.14.0) (2026-03-19)
|
|
6
57
|
|
|
7
58
|
|
package/Dockerfile
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# Arguments
|
|
2
|
-
ARG NODE_VERSION=
|
|
2
|
+
ARG NODE_VERSION=24.18.0-alpine3.24
|
|
3
3
|
|
|
4
4
|
# NOTE: Ensure you set NODE_VERSION Build Argument as follows...
|
|
5
5
|
#
|
|
@@ -16,13 +16,20 @@ FROM node:${NODE_VERSION} AS builder
|
|
|
16
16
|
WORKDIR /opt/app
|
|
17
17
|
|
|
18
18
|
RUN apk --no-cache add git
|
|
19
|
-
RUN apk add --no-cache
|
|
20
|
-
&& cd $(npm root -g)/npm \
|
|
21
|
-
&& npm install -g node-gyp
|
|
19
|
+
RUN apk add --no-cache --virtual .build-deps autoconf automake bash g++ gcc libtool make openssl-dev py3-setuptools python3
|
|
22
20
|
|
|
23
|
-
COPY package.json package-lock.json* /opt/app/
|
|
21
|
+
COPY package.json package-lock.json* tsconfig.json /opt/app/
|
|
24
22
|
|
|
25
|
-
RUN
|
|
23
|
+
RUN stat package.json
|
|
24
|
+
RUN stat package-lock.json
|
|
25
|
+
|
|
26
|
+
# Lifecycle scripts are skipped for supply-chain safety (docker:S6505); node-rdkafka
|
|
27
|
+
# is the only production dependency that needs its native build, so run it explicitly.
|
|
28
|
+
RUN npm ci --ignore-scripts
|
|
29
|
+
RUN npm rebuild node-rdkafka
|
|
30
|
+
|
|
31
|
+
COPY src /opt/app/src
|
|
32
|
+
RUN npm run build
|
|
26
33
|
RUN npm prune --omit=dev
|
|
27
34
|
|
|
28
35
|
FROM node:${NODE_VERSION}
|
|
@@ -38,11 +45,7 @@ USER ml-user
|
|
|
38
45
|
|
|
39
46
|
COPY --chown=ml-user --from=builder /opt/app .
|
|
40
47
|
|
|
41
|
-
COPY src /opt/app/src
|
|
42
48
|
COPY config /opt/app/config
|
|
43
|
-
COPY migrations /opt/app/migrations
|
|
44
|
-
COPY seeds /opt/app/seeds
|
|
45
|
-
COPY test /opt/app/test
|
|
46
49
|
|
|
47
50
|
EXPOSE 3001
|
|
48
51
|
CMD ["npm", "run", "start"]
|
package/README.md
CHANGED
|
@@ -25,7 +25,6 @@ The following documentation represents the services, APIs and endpoints responsi
|
|
|
25
25
|
- [API](#api)
|
|
26
26
|
- [Logging](#logging)
|
|
27
27
|
- [Tests](#tests)
|
|
28
|
-
- [Running Integration Tests interactively](#running-integration-tests-interactively)
|
|
29
28
|
- [Development environment](#development-environment)
|
|
30
29
|
- [Auditing Dependencies](#auditing-dependencies)
|
|
31
30
|
- [Container Scans](#container-scans)
|
|
@@ -88,6 +87,31 @@ The Central Ledger has many options that can be configured through environment v
|
|
|
88
87
|
| CLEDG\_AMOUNT__PRECISION | Numeric value used to determine precision recorded for transfer amounts on this ledger. | 10 |
|
|
89
88
|
| CLEDG\_AMOUNT__SCALE | Numeric value used to determine scale recorded for transfer amounts on this ledger. | 2 |
|
|
90
89
|
|
|
90
|
+
### ERROR_HANDLING_AJV_JOI_PARITY
|
|
91
|
+
|
|
92
|
+
**Set `ERROR_HANDLING_AJV_JOI_PARITY=true` for this service.**
|
|
93
|
+
|
|
94
|
+
The Settlement API (`src/settlement`) was migrated from `hapi-openapi` (joi request validation) to `openapi-backend` (ajv), and `@mojaloop/central-services-error-handling` was updated from 13.1.7 to 13.2.0. 13.2.0 makes the ajv mapping that matches joi's opt-in behind this environment variable ([central-services-error-handling#216](https://github.com/mojaloop/central-services-error-handling/issues/216)), so leaving it unset changes the FSPIOP error code this service returns for requests that used to fail joi validation:
|
|
95
|
+
|
|
96
|
+
| ajv keyword (openapi-backend) | unset / `false` | `ERROR_HANDLING_AJV_JOI_PARITY=true` | joi (before the migration) |
|
|
97
|
+
| ----------------------------- | --------------- | ------------------------------------ | -------------------------- |
|
|
98
|
+
| `enum`, `const`, `format`, `pattern` | 3100 Generic validation error | **3101 Malformed syntax** | 3101 Malformed syntax |
|
|
99
|
+
| `type` | 3101 Malformed syntax | 3101 Malformed syntax | 3101 Malformed syntax |
|
|
100
|
+
| `required` | 3102 Missing mandatory element | 3102 Missing mandatory element | 3102 Missing mandatory element |
|
|
101
|
+
| `additionalProperties` | 3103 Too many elements | 3103 Too many elements | 3103 Too many elements |
|
|
102
|
+
|
|
103
|
+
Why it matters here: `src/settlement/interface/swagger.json` constrains the settlement window and settlement `state` query parameters with `enum` (`OPEN`, `CLOSED`, `PENDING_SETTLEMENT`, ...), the settlement update payload `state` with `enum` (`ABORTED`, `INVALID`), and `fromDateTime`/`toDateTime` with `format: date-time`. Those requests returned 3101 before the migration (Golden Path 'Check Settlements Error #956'); with the flag unset they return 3100.
|
|
104
|
+
|
|
105
|
+
With the flag set, both `errorInformation.errorCode` and the `errorDescription` prefix (`Malformed syntax - ...`) match the pre-migration responses. The detail after the dash is generated by ajv and is worded differently to joi's.
|
|
106
|
+
|
|
107
|
+
The Admin API (`src/api`) still validates with joi on the hapi routes, so its error codes are unaffected either way.
|
|
108
|
+
|
|
109
|
+
The variable is read from `process.env` on every call and has no `config/default.json` equivalent, so set it in the service's runtime environment - the container `env` in the deployment values, or the `environment:` block of `docker-compose.yml`:
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
ERROR_HANDLING_AJV_JOI_PARITY=true
|
|
113
|
+
```
|
|
114
|
+
|
|
91
115
|
### Kafka Position Event Type Action Topic Map
|
|
92
116
|
|
|
93
117
|
In some cases, you might want to publish position type messages onto a customized topic name that
|
|
@@ -182,104 +206,30 @@ Running the tests:
|
|
|
182
206
|
|
|
183
207
|
Tests include code coverage via istanbul. See the test/ folder for testing scripts.
|
|
184
208
|
|
|
185
|
-
###
|
|
186
|
-
|
|
187
|
-
If you want to run integration tests in a repetitive manner, you can startup the test containers using `docker-compose` via one of the following methods:
|
|
188
|
-
|
|
189
|
-
- Running locally
|
|
190
|
-
|
|
191
|
-
Start containers required for Integration Tests
|
|
192
|
-
|
|
193
|
-
```bash
|
|
194
|
-
docker compose up -d mysql kafka init-kafka redis-node-0 redis-node-1 redis-node-2 redis-node-3 redis-node-4 redis-node-5
|
|
195
|
-
```
|
|
196
|
-
|
|
197
|
-
Run wait script which will report once all required containers are up and running
|
|
198
|
-
|
|
199
|
-
```bash
|
|
200
|
-
npm run wait-4-docker
|
|
201
|
-
```
|
|
202
|
-
|
|
203
|
-
Start the Central-Ledger Service in the background, capturing the Process ID, so we can kill it when we are done. Alternatively you could also start the process in a separate terminal. This is a temporary work-around until the following issue can be addressed: https://github.com/mojaloop/project/issues/3112.
|
|
204
|
-
|
|
205
|
-
```bash
|
|
206
|
-
npm start > cl-service.log &
|
|
207
|
-
echo $! > /tmp/int-test-service.pid
|
|
208
|
-
```
|
|
209
|
+
### Integration Tests
|
|
209
210
|
|
|
210
|
-
|
|
211
|
+
Integration tests end with `.int.ts`. Each test has a [harness](./src/testing//harness.ts) which
|
|
212
|
+
brings up a file in an isolated testing environment.
|
|
211
213
|
|
|
212
|
-
|
|
214
|
+
#### Running using `run.ts`:
|
|
213
215
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
Kill the background Central-Ledger Service
|
|
219
|
-
|
|
220
|
-
```bash
|
|
221
|
-
kill $(cat /tmp/int-test-service.pid)
|
|
222
|
-
```
|
|
223
|
-
|
|
224
|
-
- Running inside docker
|
|
225
|
-
|
|
226
|
-
Start containers required for Integration Tests, including a `central-ledger` container which will be used as a proxy shell.
|
|
227
|
-
|
|
228
|
-
```bash
|
|
229
|
-
docker-compose -f docker-compose.yml -f docker-compose.integration.yml up -d kafka mysql central-ledger init-kafka redis-node-0 redis-node-1 redis-node-2 redis-node-3 redis-node-4 redis-node-5
|
|
230
|
-
```
|
|
231
|
-
|
|
232
|
-
Run the Integration Tests from the `central-ledger` container
|
|
216
|
+
```bash
|
|
217
|
+
npm run test:integration
|
|
218
|
+
```
|
|
233
219
|
|
|
234
|
-
|
|
235
|
-
docker exec -it cl_central-ledger sh
|
|
236
|
-
export CL_DATABASE_HOST=mysql
|
|
237
|
-
npm run test:int
|
|
238
|
-
```
|
|
220
|
+
#### Run a single test
|
|
239
221
|
|
|
240
|
-
|
|
222
|
+
To run a single integration test file, you can simply pass in the file to `node --test` like so:
|
|
241
223
|
|
|
242
|
-
#### For running integration tests for batch processing interactively
|
|
243
|
-
- Run dependecies
|
|
244
224
|
```bash
|
|
245
|
-
|
|
246
|
-
npm run wait-4-docker
|
|
247
|
-
```
|
|
248
|
-
- Run central-ledger services
|
|
249
|
-
```
|
|
250
|
-
nvm use
|
|
251
|
-
npm run migrate
|
|
252
|
-
export CLEDG_KAFKA__EVENT_TYPE_ACTION_TOPIC_MAP__POSITION__PREPARE=topic-transfer-position-batch
|
|
253
|
-
export CLEDG_KAFKA__EVENT_TYPE_ACTION_TOPIC_MAP__POSITION__COMMIT=topic-transfer-position-batch
|
|
254
|
-
export CLEDG_KAFKA__EVENT_TYPE_ACTION_TOPIC_MAP__POSITION__RESERVE=topic-transfer-position-batch
|
|
255
|
-
export CLEDG_KAFKA__EVENT_TYPE_ACTION_TOPIC_MAP__POSITION__TIMEOUT_RESERVED=topic-transfer-position-batch
|
|
256
|
-
export CLEDG_KAFKA__EVENT_TYPE_ACTION_TOPIC_MAP__POSITION__FX_TIMEOUT_RESERVED=topic-transfer-position-batch
|
|
257
|
-
export CLEDG_KAFKA__EVENT_TYPE_ACTION_TOPIC_MAP__POSITION__ABORT=topic-transfer-position-batch
|
|
258
|
-
export CLEDG_KAFKA__EVENT_TYPE_ACTION_TOPIC_MAP__POSITION__FX_ABORT=topic-transfer-position-batch
|
|
259
|
-
npm start
|
|
260
|
-
```
|
|
261
|
-
- Additionally, run position batch handler in a new terminal
|
|
262
|
-
```
|
|
263
|
-
nvm use
|
|
264
|
-
export CLEDG_KAFKA__EVENT_TYPE_ACTION_TOPIC_MAP__POSITION__PREPARE=topic-transfer-position-batch
|
|
265
|
-
export CLEDG_KAFKA__EVENT_TYPE_ACTION_TOPIC_MAP__POSITION__FX_PREPARE=topic-transfer-position-batch
|
|
266
|
-
export CLEDG_KAFKA__EVENT_TYPE_ACTION_TOPIC_MAP__POSITION__COMMIT=topic-transfer-position-batch
|
|
267
|
-
export CLEDG_KAFKA__EVENT_TYPE_ACTION_TOPIC_MAP__POSITION__TIMEOUT_RESERVED=topic-transfer-position-batch
|
|
268
|
-
export CLEDG_KAFKA__EVENT_TYPE_ACTION_TOPIC_MAP__POSITION__FX_TIMEOUT_RESERVED=topic-transfer-position-batch
|
|
269
|
-
export CLEDG_KAFKA__EVENT_TYPE_ACTION_TOPIC_MAP__POSITION__ABORT=topic-transfer-position-batch
|
|
270
|
-
export CLEDG_KAFKA__EVENT_TYPE_ACTION_TOPIC_MAP__POSITION__FX_ABORT=topic-transfer-position-batch
|
|
271
|
-
export CLEDG_HANDLERS__API__DISABLED=true
|
|
272
|
-
node src/handlers/index.js handler --positionbatch
|
|
273
|
-
```
|
|
274
|
-
- Run tests using the following commands in a new terminal
|
|
275
|
-
```
|
|
276
|
-
nvm use
|
|
277
|
-
npm run test:int-override
|
|
225
|
+
node --test --require ts-node/register <path to file>
|
|
278
226
|
```
|
|
279
227
|
|
|
228
|
+
For example, to run `src/domain/participant/index.int.ts`:
|
|
229
|
+
```bash
|
|
230
|
+
node --test --require ts-node/register src/domain/participant/index.int.ts
|
|
231
|
+
```
|
|
280
232
|
|
|
281
|
-
If you want to just run all of the integration suite non-interactively then use npm run `test:integration`.
|
|
282
|
-
It will handle docker start up, migration, service starting and testing. Be sure to exit any previously ran handlers or docker commands.
|
|
283
233
|
|
|
284
234
|
### Running Functional Tests
|
|
285
235
|
|
package/audit-ci.jsonc
CHANGED
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
// audit-ci supports reading JSON, JSONC, and JSON5 config files.
|
|
4
4
|
// Only use one of ["low": true, "moderate": true, "high": true, "critical": true]
|
|
5
5
|
"moderate": true,
|
|
6
|
-
"allowlist": [ // NOTE: Please add as much information as possible to any items added to the allowList
|
|
6
|
+
"allowlist": [ // NOTE": Please add as much information as possible to any items added to the allowList
|
|
7
7
|
]
|
|
8
8
|
}
|
package/config/default.json
CHANGED
|
@@ -60,6 +60,14 @@
|
|
|
60
60
|
"retryJitter": 100,
|
|
61
61
|
"redisConfigs": [{ "type": "redis-cluster", "cluster": [{ "host": "localhost", "port": 6379 }] }]
|
|
62
62
|
}
|
|
63
|
+
},
|
|
64
|
+
"SETTINGS": {
|
|
65
|
+
"RULES": {
|
|
66
|
+
"SCRIPTS_FOLDER": "./scripts/transferSettlementTemp",
|
|
67
|
+
"SCRIPT_TIMEOUT": 100,
|
|
68
|
+
"CONSUMER_COMMIT": true,
|
|
69
|
+
"FROM_SWITCH": true
|
|
70
|
+
}
|
|
63
71
|
}
|
|
64
72
|
},
|
|
65
73
|
"INSTRUMENTATION": {
|
|
@@ -105,6 +113,10 @@
|
|
|
105
113
|
}
|
|
106
114
|
},
|
|
107
115
|
"API_DOC_ENDPOINTS_ENABLED": true,
|
|
116
|
+
"WINDOW_AGGREGATION": {
|
|
117
|
+
"RETRY_COUNT": 3,
|
|
118
|
+
"RETRY_INTERVAL": 3000
|
|
119
|
+
},
|
|
108
120
|
"KAFKA": {
|
|
109
121
|
"EVENT_TYPE_ACTION_TOPIC_MAP" : {
|
|
110
122
|
"POSITION":{
|
|
@@ -148,7 +160,6 @@
|
|
|
148
160
|
"rdkafkaConf": {
|
|
149
161
|
"client.id": "cl-con-bulk-prepare",
|
|
150
162
|
"group.id": "cl-group-bulk-prepare",
|
|
151
|
-
"metadata.broker.list": "localhost:9092",
|
|
152
163
|
"socket.keepalive.enable": true,
|
|
153
164
|
"allow.auto.create.topics": true
|
|
154
165
|
},
|
|
@@ -172,7 +183,6 @@
|
|
|
172
183
|
"rdkafkaConf": {
|
|
173
184
|
"client.id": "cl-con-bulk-processing",
|
|
174
185
|
"group.id": "cl-group-bulk-processing",
|
|
175
|
-
"metadata.broker.list": "localhost:9092",
|
|
176
186
|
"socket.keepalive.enable": true,
|
|
177
187
|
"allow.auto.create.topics": true
|
|
178
188
|
},
|
|
@@ -405,6 +415,32 @@
|
|
|
405
415
|
}
|
|
406
416
|
}
|
|
407
417
|
}
|
|
418
|
+
},
|
|
419
|
+
"DEFERREDSETTLEMENT": {
|
|
420
|
+
"CLOSE": {
|
|
421
|
+
"config": {
|
|
422
|
+
"options": {
|
|
423
|
+
"mode": 2,
|
|
424
|
+
"batchSize": 1,
|
|
425
|
+
"pollFrequency": 10,
|
|
426
|
+
"recursiveTimeout": 100,
|
|
427
|
+
"messageCharset": "utf8",
|
|
428
|
+
"messageAsJSON": true,
|
|
429
|
+
"sync": true,
|
|
430
|
+
"consumeTimeout": 1000
|
|
431
|
+
},
|
|
432
|
+
"rdkafkaConf": {
|
|
433
|
+
"client.id": "cs-con-deferredsettlement-close",
|
|
434
|
+
"group.id": "cs-group-deferredsettlement-close",
|
|
435
|
+
"metadata.broker.list": "localhost:9092",
|
|
436
|
+
"socket.keepalive.enable": true,
|
|
437
|
+
"allow.auto.create.topics": true
|
|
438
|
+
},
|
|
439
|
+
"topicConf": {
|
|
440
|
+
"auto.offset.reset": "earliest"
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
}
|
|
408
444
|
}
|
|
409
445
|
},
|
|
410
446
|
"PRODUCER": {
|
|
@@ -500,7 +536,8 @@
|
|
|
500
536
|
"event_cb": true,
|
|
501
537
|
"dr_cb": true,
|
|
502
538
|
"socket.keepalive.enable": true,
|
|
503
|
-
"queue.buffering.max.messages": 10000000
|
|
539
|
+
"queue.buffering.max.messages": 10000000,
|
|
540
|
+
"log.connection.close": false
|
|
504
541
|
},
|
|
505
542
|
"topicConf": {
|
|
506
543
|
"request.required.acks": "all",
|
|
@@ -529,6 +566,26 @@
|
|
|
529
566
|
}
|
|
530
567
|
}
|
|
531
568
|
}
|
|
569
|
+
},
|
|
570
|
+
"DEFERREDSETTLEMENT": {
|
|
571
|
+
"CLOSE": {
|
|
572
|
+
"config": {
|
|
573
|
+
"options": {
|
|
574
|
+
"messageCharset": "utf8"
|
|
575
|
+
},
|
|
576
|
+
"rdkafkaConf": {
|
|
577
|
+
"metadata.broker.list": "localhost:9092",
|
|
578
|
+
"client.id": "cs-prod-deferredsettlement-close",
|
|
579
|
+
"event_cb": true,
|
|
580
|
+
"dr_cb": true,
|
|
581
|
+
"socket.keepalive.enable": true,
|
|
582
|
+
"queue.buffering.max.messages": 10000000
|
|
583
|
+
},
|
|
584
|
+
"topicConf": {
|
|
585
|
+
"request.required.acks": "all"
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
}
|
|
532
589
|
}
|
|
533
590
|
}
|
|
534
591
|
}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
{
|
|
2
|
+
"PORT": 3007,
|
|
3
|
+
"HOSTNAME": "http://central-settlement",
|
|
4
|
+
"DATABASE": {
|
|
5
|
+
"DIALECT": "mysql",
|
|
6
|
+
"HOST": "localhost",
|
|
7
|
+
"PORT": 3306,
|
|
8
|
+
"USER": "central_ledger",
|
|
9
|
+
"PASSWORD": "password",
|
|
10
|
+
"SCHEMA": "central_ledger",
|
|
11
|
+
"POOL_MIN_SIZE": 10,
|
|
12
|
+
"POOL_MAX_SIZE": 10,
|
|
13
|
+
"ACQUIRE_TIMEOUT_MILLIS": 30000,
|
|
14
|
+
"CREATE_TIMEOUT_MILLIS": 30000,
|
|
15
|
+
"DESTROY_TIMEOUT_MILLIS": 5000,
|
|
16
|
+
"IDLE_TIMEOUT_MILLIS": 30000,
|
|
17
|
+
"REAP_INTERVAL_MILLIS": 1000,
|
|
18
|
+
"CREATE_RETRY_INTERVAL_MILLIS": 200,
|
|
19
|
+
"DEBUG": false
|
|
20
|
+
},
|
|
21
|
+
"WINDOW_AGGREGATION": {
|
|
22
|
+
"RETRY_COUNT": 3,
|
|
23
|
+
"RETRY_INTERVAL": 3000
|
|
24
|
+
},
|
|
25
|
+
"TRANSFER_VALIDITY_SECONDS": "432000",
|
|
26
|
+
"HUB_PARTICIPANT": {
|
|
27
|
+
"ID": 1,
|
|
28
|
+
"NAME": "Hub"
|
|
29
|
+
},
|
|
30
|
+
"HANDLERS": {
|
|
31
|
+
"DISABLED": false,
|
|
32
|
+
"API": {
|
|
33
|
+
"DISABLED": false
|
|
34
|
+
},
|
|
35
|
+
"SETTINGS": {
|
|
36
|
+
"RULES": {
|
|
37
|
+
"SCRIPTS_FOLDER": "./scripts/transferSettlementTemp",
|
|
38
|
+
"SCRIPT_TIMEOUT": 100,
|
|
39
|
+
"CONSUMER_COMMIT": true,
|
|
40
|
+
"FROM_SWITCH": true
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"API_DOC_ENDPOINTS_ENABLED": true,
|
|
45
|
+
"SWITCH_ENDPOINT": "http://localhost:3001",
|
|
46
|
+
"AMOUNT": {
|
|
47
|
+
"PRECISION": 18,
|
|
48
|
+
"SCALE": 4
|
|
49
|
+
},
|
|
50
|
+
"KAFKA": {
|
|
51
|
+
"TOPIC_TEMPLATES": {
|
|
52
|
+
"GENERAL_TOPIC_TEMPLATE": {
|
|
53
|
+
"TEMPLATE": "topic-{{functionality}}-{{action}}",
|
|
54
|
+
"REGEX": "topic-(.*)-(.*)"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"CONSUMER": {
|
|
58
|
+
"DEFERREDSETTLEMENT": {
|
|
59
|
+
"CLOSE": {
|
|
60
|
+
"config": {
|
|
61
|
+
"options": {
|
|
62
|
+
"mode": 2,
|
|
63
|
+
"batchSize": 1,
|
|
64
|
+
"pollFrequency": 10,
|
|
65
|
+
"recursiveTimeout": 100,
|
|
66
|
+
"messageCharset": "utf8",
|
|
67
|
+
"messageAsJSON": true,
|
|
68
|
+
"sync": true,
|
|
69
|
+
"consumeTimeout": 1000
|
|
70
|
+
},
|
|
71
|
+
"rdkafkaConf": {
|
|
72
|
+
"client.id": "cs-con-deferredsettlement-close",
|
|
73
|
+
"group.id": "cs-group-deferredsettlement-close",
|
|
74
|
+
"metadata.broker.list": "localhost:9092",
|
|
75
|
+
"socket.keepalive.enable": true,
|
|
76
|
+
"allow.auto.create.topics": true
|
|
77
|
+
},
|
|
78
|
+
"topicConf": {
|
|
79
|
+
"auto.offset.reset": "earliest"
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
"NOTIFICATION": {
|
|
85
|
+
"EVENT": {
|
|
86
|
+
"config": {
|
|
87
|
+
"options": {
|
|
88
|
+
"mode": 2,
|
|
89
|
+
"batchSize": 1,
|
|
90
|
+
"pollFrequency": 10,
|
|
91
|
+
"recursiveTimeout": 100,
|
|
92
|
+
"messageCharset": "utf8",
|
|
93
|
+
"messageAsJSON": true,
|
|
94
|
+
"sync": true,
|
|
95
|
+
"consumeTimeout": 1000
|
|
96
|
+
},
|
|
97
|
+
"rdkafkaConf": {
|
|
98
|
+
"client.id": "cs-con-notification-event",
|
|
99
|
+
"group.id": "cs-group-notification-event",
|
|
100
|
+
"metadata.broker.list": "localhost:9092",
|
|
101
|
+
"socket.keepalive.enable": true,
|
|
102
|
+
"allow.auto.create.topics": true
|
|
103
|
+
},
|
|
104
|
+
"topicConf": {
|
|
105
|
+
"auto.offset.reset": "earliest"
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
"PRODUCER": {
|
|
112
|
+
"NOTIFICATION": {
|
|
113
|
+
"EVENT": {
|
|
114
|
+
"config": {
|
|
115
|
+
"options": {
|
|
116
|
+
"messageCharset": "utf8"
|
|
117
|
+
},
|
|
118
|
+
"rdkafkaConf": {
|
|
119
|
+
"debug": "all",
|
|
120
|
+
"metadata.broker.list": "localhost:9092",
|
|
121
|
+
"client.id": "cs-prod-notification-event",
|
|
122
|
+
"event_cb": true,
|
|
123
|
+
"compression.codec": "none",
|
|
124
|
+
"retry.backoff.ms": 100,
|
|
125
|
+
"message.send.max.retries": 2,
|
|
126
|
+
"socket.keepalive.enable": true,
|
|
127
|
+
"queue.buffering.max.messages": 10000000,
|
|
128
|
+
"batch.num.messages": 100,
|
|
129
|
+
"dr_cb": true,
|
|
130
|
+
"socket.blocking.max.ms": 1,
|
|
131
|
+
"queue.buffering.max.ms": 1,
|
|
132
|
+
"broker.version.fallback": "0.10.1.0",
|
|
133
|
+
"api.version.request": true
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
"DEFERREDSETTLEMENT": {
|
|
139
|
+
"CLOSE": {
|
|
140
|
+
"config": {
|
|
141
|
+
"options": {
|
|
142
|
+
"messageCharset": "utf8"
|
|
143
|
+
},
|
|
144
|
+
"rdkafkaConf": {
|
|
145
|
+
"metadata.broker.list": "localhost:9092",
|
|
146
|
+
"client.id": "cs-prod-deferredsettlement-close",
|
|
147
|
+
"event_cb": true,
|
|
148
|
+
"dr_cb": true,
|
|
149
|
+
"socket.keepalive.enable": true,
|
|
150
|
+
"queue.buffering.max.messages": 10000000
|
|
151
|
+
},
|
|
152
|
+
"topicConf": {
|
|
153
|
+
"request.required.acks": "all"
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|