@mojaloop/central-ledger 9.2.2 → 15.1.3-snapshot.2
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/.circleci/config.yml +625 -204
- package/.env +3 -2
- package/.ncurc.yaml +9 -0
- package/.nvmrc +1 -1
- package/.versionrc +15 -0
- package/CHANGELOG.md +353 -0
- package/CODEOWNERS +31 -0
- package/Dockerfile +20 -14
- package/LICENSE.md +4 -4
- package/Onboarding.md +0 -7
- package/README.md +99 -22
- package/audit-resolve.json +136 -1
- package/config/default.json +82 -27
- package/docker/central-ledger/default.json +68 -21
- package/docker/ml-api-adapter/default.json +10 -1
- package/docker/wait-for/wait-for-objstore.sh +1 -6
- package/docker/wait-for/wait-for.env +1 -1
- package/docker-compose.integration.yml +8 -5
- package/docker-compose.yml +73 -16
- package/migrations/310203_transferParticipant-indexes.js +38 -0
- package/migrations/310503_participantLimit-indexes-composite.js +38 -0
- package/migrations/{400401_settlementWindowStateChange-indexes.js → 400401_settlmentWindowStateChange-indexes.js} +0 -0
- package/migrations/401301_settlementModel-indexes.js +2 -0
- package/migrations/500401_quote-hotfix-2719.js +58 -0
- package/migrations/500501_feature-fixSubIdRef.js +53 -0
- package/migrations/500601_party-2480.js +63 -0
- package/migrations/501001_quoteExtension-quote-service-174.js +46 -0
- package/migrations/501002_quoteExtension-2522.js +61 -0
- package/migrations/800101_feature-fixSubIdRef.js +90 -0
- package/migrations/910102_hotfix954.js +4 -1
- package/migrations/940100_quotePartyIdInfoExtension.js +52 -0
- package/migrations/940101_quotePartyIdInfoExtension-2522.js +64 -0
- package/migrations/950100_settlementContentAggregation-decimal184.js +40 -0
- package/migrations/950101_transferParticipantStateChange.js +46 -0
- package/migrations/950102_settlementModel-adjustPosition.js +42 -0
- package/migrations/950103_dropTransferParticipantStateChange.js +47 -0
- package/migrations/950104_settlementModel-settlementAccountTypeId.js +79 -0
- package/migrations/950106_unique_settlement_model_ledger_account_currency.js +38 -0
- package/migrations/950107_settlementWindowContent_foreign_settlementModel.js +60 -0
- package/package.json +99 -81
- package/scripts/_wait4_all.js +146 -0
- package/seeds/amountType.js +4 -6
- package/seeds/balanceOfPayments.js +4 -6
- package/seeds/bulkProcessingState.js +4 -6
- package/seeds/bulkTransferState.js +4 -6
- package/seeds/currency.js +4 -6
- package/seeds/endpointType.js +128 -7
- package/seeds/ledgerAccountType.js +11 -10
- package/seeds/ledgerEntryType.js +5 -7
- package/seeds/participant.js +4 -6
- package/seeds/participantLimitType.js +4 -6
- package/seeds/partyIdentifierType.js +4 -6
- package/seeds/partyType.js +4 -6
- package/seeds/settlementDelay.js +4 -6
- package/seeds/settlementGranularity.js +4 -6
- package/seeds/settlementInterchange.js +4 -6
- package/seeds/settlementState.js +4 -6
- package/seeds/settlementWindow1State.js +4 -6
- package/seeds/transactionInitiator.js +4 -6
- package/seeds/transactionInitiatorType.js +4 -6
- package/seeds/transactionScenario.js +4 -6
- package/seeds/transferParticipantRoleType.js +4 -6
- package/seeds/transferState.js +9 -6
- package/src/api/interface/swagger.json +728 -948
- package/src/api/ledgerAccountTypes/handler.js +55 -0
- package/src/api/ledgerAccountTypes/routes.js +63 -0
- package/src/api/metrics/handler.js +2 -2
- package/src/api/metrics/routes.js +1 -1
- package/src/api/participants/handler.js +43 -35
- package/src/api/participants/routes.js +13 -13
- package/src/api/root/routes.js +2 -2
- package/src/api/settlementModels/handler.js +9 -26
- package/src/api/settlementModels/routes.js +4 -4
- package/src/api/transactions/handler.js +46 -0
- package/src/api/transactions/routes.js +45 -0
- package/src/domain/bulkTransfer/index.js +6 -5
- package/src/domain/ledgerAccountTypes/index.js +58 -0
- package/src/domain/participant/index.js +55 -4
- package/src/domain/position/index.js +18 -2
- package/src/domain/settlement/index.js +39 -6
- package/src/domain/transactions/index.js +61 -0
- package/src/domain/transfer/index.js +22 -2
- package/src/domain/transfer/transform.js +3 -3
- package/src/handlers/admin/handler.js +24 -32
- package/src/handlers/bulk/fulfil/handler.js +89 -56
- package/src/handlers/bulk/get/handler.js +203 -0
- package/src/handlers/bulk/index.js +4 -1
- package/src/handlers/bulk/prepare/handler.js +30 -29
- package/src/handlers/bulk/processing/handler.js +61 -32
- package/src/handlers/bulk/shared/validator.js +13 -1
- package/src/handlers/index.js +18 -9
- package/src/handlers/positions/handler.js +67 -46
- package/src/handlers/register.js +7 -7
- package/src/handlers/timeouts/handler.js +9 -4
- package/src/handlers/transfers/handler.js +408 -182
- package/src/handlers/transfers/validator.js +41 -11
- package/src/lib/cache.js +8 -34
- package/src/lib/config.js +5 -7
- package/src/lib/enum.js +22 -22
- package/src/lib/enumCached.js +76 -0
- package/src/lib/healthCheck/subServiceHealth.js +2 -2
- package/src/lib/requestLogger.js +9 -9
- package/src/lib/urlParser.js +1 -1
- package/src/models/bulkTransfer/bulkTransfer.js +6 -6
- package/src/models/bulkTransfer/bulkTransferAssociation.js +3 -3
- package/src/models/bulkTransfer/bulkTransferDuplicateCheck.js +4 -4
- package/src/models/bulkTransfer/bulkTransferExtension.js +2 -2
- package/src/models/bulkTransfer/bulkTransferFulfilmentDuplicateCheck.js +4 -4
- package/src/models/bulkTransfer/bulkTransferStateChange.js +7 -7
- package/src/models/bulkTransfer/facade.js +54 -3
- package/src/models/bulkTransfer/individualTransfer.js +2 -2
- package/src/models/ilpPackets/ilpPacket.js +36 -0
- package/src/models/ledgerAccountType/ledgerAccountType.js +139 -3
- package/src/models/misc/migrationLock.js +1 -1
- package/src/models/misc/segment.js +1 -1
- package/src/models/participant/facade.js +226 -76
- package/src/models/participant/participant.js +6 -5
- package/src/models/participant/participantCached.js +8 -0
- package/src/models/participant/participantCurrency.js +7 -7
- package/src/models/participant/participantCurrencyCached.js +11 -1
- package/src/models/participant/participantLimit.js +13 -13
- package/src/models/participant/participantLimitCached.js +124 -0
- package/src/models/participant/participantPosition.js +34 -5
- package/src/models/participant/participantPositionChange.js +10 -2
- package/src/models/position/facade.js +112 -18
- package/src/models/position/participantPosition.js +6 -6
- package/src/models/settlement/settlementModel.js +92 -17
- package/src/models/settlement/settlementModelCached.js +139 -0
- package/src/models/transfer/facade.js +97 -32
- package/src/models/transfer/ilpPacket.js +4 -4
- package/src/models/transfer/transfer.js +7 -7
- package/src/models/transfer/transferDuplicateCheck.js +21 -5
- package/src/models/transfer/transferError.js +5 -5
- package/src/models/transfer/transferErrorDuplicateCheck.js +4 -4
- package/src/models/transfer/transferExtension.js +4 -4
- package/src/models/transfer/transferFulfilment.js +5 -5
- package/src/models/transfer/transferFulfilmentDuplicateCheck.js +4 -4
- package/src/models/transfer/transferParticipant.js +3 -3
- package/src/models/transfer/transferStateChange.js +11 -11
- package/src/models/transfer/transferTimeout.js +5 -5
- package/src/schema/bulkTransfer.js +4 -4
- package/src/shared/plugins.js +10 -9
- package/src/shared/setup.js +69 -46
- package/test/integration/domain/participant/index.test.js +2 -0
- package/test/integration/handlers/handlers.test.js +605 -166
- package/test/integration/handlers/root.test.js +1 -1
- package/test/integration/helpers/hubAccounts.js +62 -0
- package/test/integration/helpers/ilpPacket.js +1 -1
- package/test/integration/helpers/participantFundsInOut.js +80 -0
- package/test/integration/helpers/participantLimit.js +6 -1
- package/test/integration/helpers/settlementModels.js +88 -0
- package/test/integration/helpers/testConsumer.js +163 -0
- package/test/integration/helpers/testProducer.js +0 -1
- package/test/integration/helpers/transferDuplicateCheck.js +1 -1
- package/test/integration/helpers/transferStateChange.js +1 -1
- package/test/integration/helpers/transferTestHelper.js +3 -5
- package/test/integration/models/transfer/transferStateChange.test.js +6 -0
- package/test/unit/api/ledgerAccountTypes/handler.test.js +126 -0
- package/test/unit/api/ledgerAccountTypes/routes.test.js +52 -0
- package/test/unit/api/participants/handler.test.js +75 -33
- package/test/unit/api/root/handler.test.js +1 -1
- package/test/unit/api/root/routes.test.js +2 -2
- package/test/unit/api/settlementModels/handler.test.js +21 -57
- package/test/unit/api/transactions/handler.test.js +108 -0
- package/test/unit/api/transactions/routes.test.js +38 -0
- package/test/unit/domain/ledgerAccountTypes/index.test.js +197 -0
- package/test/unit/domain/participant/index.test.js +115 -2
- package/test/unit/domain/settlement/index.test.js +199 -29
- package/test/unit/domain/transactions/index.test.js +128 -0
- package/test/unit/domain/transfer/index.test.js +1 -0
- package/test/unit/domain/transfer/transform.test.js +2 -0
- package/test/unit/handlers/admin/handler.test.js +5 -5
- package/test/unit/handlers/bulk/get/handler.test.js +401 -0
- package/test/unit/handlers/index.test.js +6 -0
- package/test/unit/handlers/positions/handler.test.js +26 -0
- package/test/unit/handlers/register.test.js +2 -0
- package/test/unit/handlers/transfers/handler.test.js +491 -36
- package/test/unit/handlers/transfers/validator.test.js +31 -31
- package/test/unit/lib/cache.test.js +0 -64
- package/test/unit/lib/cachingOfEnums.test.js +121 -0
- package/test/unit/lib/config.test.js +34 -0
- package/test/unit/lib/enum.test.js +6 -1
- package/test/unit/lib/enumCached.test.js +82 -0
- package/test/unit/lib/healthCheck/subServiceHealth.test.js +2 -0
- package/test/unit/lib/requestLogger.test.js +14 -12
- package/test/unit/models/ilpPackets/ilpPacket.test.js +89 -0
- package/test/unit/models/ledgerAccountType/ledgerAccountType.test.js +255 -6
- package/test/unit/models/misc/migrationLock.test.js +4 -0
- package/test/unit/models/misc/segment.test.js +5 -0
- package/test/unit/models/participant/facade.test.js +493 -54
- package/test/unit/models/participant/participant.test.js +4 -0
- package/test/unit/models/participant/participantCurrency.test.js +22 -9
- package/test/unit/models/participant/participantCurrencyCached.test.js +1 -1
- package/test/unit/models/participant/participantLimit.test.js +97 -0
- package/test/unit/models/participant/participantLimitCached.test.js +232 -0
- package/test/unit/models/participant/participantPosition.test.js +217 -0
- package/test/unit/models/participant/participantPositionChange.test.js +3 -0
- package/test/unit/models/position/facade.test.js +318 -29
- package/test/unit/models/position/participantPosition.test.js +22 -7
- package/test/unit/models/settlement/settlementModel.test.js +18 -37
- package/test/unit/models/settlement/settlementModelCached.test.js +171 -0
- package/test/unit/models/transfer/facade.test.js +115 -0
- package/test/unit/models/transfer/ilpPacket.test.js +28 -11
- package/test/unit/models/transfer/transfer.test.js +13 -4
- package/test/unit/models/transfer/transferDuplicateCheck.test.js +4 -0
- package/test/unit/models/transfer/transferError.test.js +5 -1
- package/test/unit/models/transfer/transferErrorDuplicateCheck.test.js +4 -0
- package/test/unit/models/transfer/transferExtension.test.js +26 -9
- package/test/unit/models/transfer/transferFulfilment.test.js +14 -5
- package/test/unit/models/transfer/transferFulfilmentDuplicateCheck.test.js +4 -0
- package/test/unit/models/transfer/transferParticipant.test.js +14 -5
- package/test/unit/models/transfer/transferStateChange.test.js +3 -0
- package/test/unit/models/transfer/transferTimeout.test.js +6 -0
- package/test/unit/seeds/amountType.test.js +6 -22
- package/test/unit/seeds/balanceOfPayments.test.js +6 -22
- package/test/unit/seeds/bulkProcessingState.test.js +84 -0
- package/test/unit/{lib/sidecar/nullClient.test.js → seeds/bulkTransferState.test.js} +36 -39
- package/test/unit/seeds/currency.test.js +6 -22
- package/test/unit/seeds/endpointType.test.js +6 -22
- package/test/unit/seeds/ledgerAccountType.test.js +5 -22
- package/test/unit/seeds/ledgerEntryType.test.js +6 -22
- package/test/unit/seeds/participant.test.js +5 -22
- package/test/unit/seeds/participantLimitType.test.js +6 -22
- package/test/unit/seeds/partyIdentifierType.test.js +6 -22
- package/test/unit/seeds/partyType.test.js +6 -22
- package/test/unit/seeds/settlementState.test.js +5 -22
- package/test/unit/seeds/settlementWindow1State.test.js +5 -22
- package/test/unit/seeds/transactionInitiator.test.js +6 -22
- package/test/unit/seeds/transactionInitiatorType.test.js +6 -22
- package/test/unit/seeds/transactionScenario.test.js +6 -22
- package/test/unit/seeds/transferParticipantRoleType.test.js +6 -22
- package/test/unit/seeds/transferState.test.js +6 -22
- package/test/unit/shared/plugins.test.js +31 -1
- package/test/unit/shared/setup.test.js +25 -36
- package/test/util/helpers.js +37 -2
- package/test/util/randomTransfers.js +1 -1
- package/test/util/scripts/env.sh +6 -5
- package/test/util/scripts/populateTestData.sh +204 -181
- package/test/util/scripts/populateTestDataForLegacySimulator.sh +261 -0
- package/test/util/scripts/restartObjStore.sh +1 -1
- package/test-integration.Dockerfile +15 -15
- package/test.Dockerfile +12 -12
- package/.circleci/_set_up_deploy_envs.sh +0 -47
- package/.dockerignore +0 -17
- package/.ncurc.json +0 -3
- package/server.sh +0 -4
- package/sonar-project.properties +0 -17
- package/src/lib/sidecar/index.js +0 -47
- package/src/lib/sidecar/nullClient.js +0 -18
- package/test/.env +0 -8
- package/test/integration-config.json +0 -367
- package/test/integration-runner.env +0 -31
- package/test/integration-runner.sh +0 -264
- package/test/spec-runner.sh +0 -132
- package/test/unit/lib/sidecar/index.test.js +0 -148
- package/test/unit/models/position/participantLimit.test.js +0 -135
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/*****
|
|
2
|
+
License
|
|
3
|
+
--------------
|
|
4
|
+
Copyright © 2017 Bill & Melinda Gates Foundation
|
|
5
|
+
The Mojaloop files are made available by the Bill & Melinda Gates Foundation under the Apache License, Version 2.0 (the "License") and you may not use these files except in compliance with the License. You may obtain a copy of the License at
|
|
6
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
Unless required by applicable law or agreed to in writing, the Mojaloop files are distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
|
8
|
+
Contributors
|
|
9
|
+
--------------
|
|
10
|
+
This is the official list of the Mojaloop project contributors for this file.
|
|
11
|
+
Names of the original copyright holders (individuals or organizations)
|
|
12
|
+
should be listed with a '*' in the first column. People who have
|
|
13
|
+
contributed from an organization can be listed under the organization
|
|
14
|
+
that actually holds the copyright for their contributions (see the
|
|
15
|
+
Gates Foundation organization for an example). Those individuals should have
|
|
16
|
+
their names indented and be marked with a '-'. Email address can be added
|
|
17
|
+
optionally within square brackets <email>.
|
|
18
|
+
* Gates Foundation
|
|
19
|
+
- Name Surname <name.surname@gatesfoundation.com>
|
|
20
|
+
|
|
21
|
+
* ModusBox
|
|
22
|
+
- Georgi Georgiev <georgi.georgiev@modusbox.com>
|
|
23
|
+
--------------
|
|
24
|
+
******/
|
|
25
|
+
|
|
26
|
+
'use strict'
|
|
27
|
+
|
|
28
|
+
exports.up = function (knex) {
|
|
29
|
+
return knex.schema.table('settlementModel', (t) => {
|
|
30
|
+
t.unique(['currencyId', 'ledgerAccountTypeId'])
|
|
31
|
+
})
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
exports.down = function (knex) {
|
|
35
|
+
return knex.schema.table('settlementModel', (t) => {
|
|
36
|
+
t.dropUnique(['currencyId', 'ledgerAccountTypeId'])
|
|
37
|
+
})
|
|
38
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/*****
|
|
2
|
+
License
|
|
3
|
+
--------------
|
|
4
|
+
Copyright © 2017 Bill & Melinda Gates Foundation
|
|
5
|
+
The Mojaloop files are made available by the Bill & Melinda Gates Foundation under the Apache License, Version 2.0 (the "License") and you may not use these files except in compliance with the License. You may obtain a copy of the License at
|
|
6
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
Unless required by applicable law or agreed to in writing, the Mojaloop files are distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
|
8
|
+
Contributors
|
|
9
|
+
--------------
|
|
10
|
+
This is the official list of the Mojaloop project contributors for this file.
|
|
11
|
+
Names of the original copyright holders (individuals or organizations)
|
|
12
|
+
should be listed with a '*' in the first column. People who have
|
|
13
|
+
contributed from an organization can be listed under the organization
|
|
14
|
+
that actually holds the copyright for their contributions (see the
|
|
15
|
+
Gates Foundation organization for an example). Those individuals should have
|
|
16
|
+
their names indented and be marked with a '-'. Email address can be added
|
|
17
|
+
optionally within square brackets <email>.
|
|
18
|
+
* Gates Foundation
|
|
19
|
+
- Name Surname <name.surname@gatesfoundation.com>
|
|
20
|
+
|
|
21
|
+
* ModusBox
|
|
22
|
+
- Valentin Genev <valentin.genev@modusbox.com>
|
|
23
|
+
--------------
|
|
24
|
+
******/
|
|
25
|
+
|
|
26
|
+
'use strict'
|
|
27
|
+
|
|
28
|
+
exports.up = async (knex) => {
|
|
29
|
+
return await knex.schema.hasTable('settlementWindowContent').then(async function (exists) {
|
|
30
|
+
if (exists) {
|
|
31
|
+
await knex.schema.hasColumn('settlementWindowContent', 'settlementModelId')
|
|
32
|
+
.then(async (columnExists) => {
|
|
33
|
+
if (!columnExists) {
|
|
34
|
+
return knex.schema.alterTable('settlementWindowContent', (t) => {
|
|
35
|
+
t.integer('SettlementModelId').unsigned().defaultTo(null)
|
|
36
|
+
t.foreign('SettlementModelId').references('SettlementModelId').inTable('settlementModel')
|
|
37
|
+
})
|
|
38
|
+
}
|
|
39
|
+
})
|
|
40
|
+
}
|
|
41
|
+
})
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
exports.down = async function (knex) {
|
|
45
|
+
return await knex.schema.hasTable('settlementWindowContent').then(async function (exists) {
|
|
46
|
+
if (exists) {
|
|
47
|
+
await knex.schema.hasColumn('settlementWindowContent', 'settlementModelId')
|
|
48
|
+
.then(async (columnExists) => {
|
|
49
|
+
if (columnExists) {
|
|
50
|
+
return knex.schema
|
|
51
|
+
.alterTable('settlementWindowContent', (t) => {
|
|
52
|
+
t.dropForeign('SettlementModelId')
|
|
53
|
+
t.dropColumn('SettlementModelId')
|
|
54
|
+
})
|
|
55
|
+
}
|
|
56
|
+
})
|
|
57
|
+
}
|
|
58
|
+
})
|
|
59
|
+
}
|
|
60
|
+
|
package/package.json
CHANGED
|
@@ -1,135 +1,153 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mojaloop/central-ledger",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "15.1.3-snapshot.2",
|
|
4
4
|
"description": "Central ledger hosted by a scheme to record and settle transfers",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "ModusBox",
|
|
7
7
|
"contributors": [
|
|
8
8
|
"Georgi Georgiev <georgi.georgiev@modusbox.com>",
|
|
9
|
+
"Georgi Logodazhki <georgi.logodazhki@modusbox.com>",
|
|
9
10
|
"Henk Kodde <henkkodde@modusbox.com>",
|
|
11
|
+
"Kevin Leyow <kevin.leyow@modusbox.com>",
|
|
12
|
+
"Lazola Lucas <lazola.lucas@modusbox.com>",
|
|
10
13
|
"Lewis Daly <lewisd@crosslaketech.com>",
|
|
11
14
|
"Miguel de Barros <miguel.debarros@modusbox.com>",
|
|
15
|
+
"Paweł Marzec <pawel.marzec@modusbox.com>",
|
|
12
16
|
"Rajiv Mothilal <rajiv.mothilal@modusbox.com>",
|
|
17
|
+
"Sam Kummary <sam@modusbox.com>",
|
|
18
|
+
"Shashikant Hirugade <shashikant.hirugade@modusbox.com>",
|
|
13
19
|
"Steven Oderayi <steven.oderayi@modusbox.com>",
|
|
14
|
-
"
|
|
20
|
+
"Valentin Genev <valentin.genev@modusbox.com>"
|
|
15
21
|
],
|
|
16
22
|
"repository": {
|
|
17
23
|
"type": "git",
|
|
18
24
|
"url": "git@github.com:mojaloop/central-ledger.git"
|
|
19
25
|
},
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"images": {
|
|
23
|
-
"api": "central-ledger",
|
|
24
|
-
"admin": "central-ledger-admin"
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
"standard": {
|
|
28
|
-
"ignore": [
|
|
29
|
-
"/migrations/**"
|
|
30
|
-
]
|
|
26
|
+
"engines": {
|
|
27
|
+
"node": "=16.x"
|
|
31
28
|
},
|
|
32
29
|
"pre-commit": [
|
|
33
|
-
"
|
|
30
|
+
"lint",
|
|
34
31
|
"dep:check",
|
|
35
32
|
"test"
|
|
36
33
|
],
|
|
37
34
|
"scripts": {
|
|
38
|
-
"start": "run
|
|
35
|
+
"start": "npm run start:api",
|
|
39
36
|
"start:api": "node src/api/index.js",
|
|
40
|
-
"watch:api": "nodemon src/api/index.js",
|
|
37
|
+
"watch:api": "npx nodemon src/api/index.js",
|
|
41
38
|
"start:handlers": "node src/handlers/index.js",
|
|
42
39
|
"dev": "npm run docker:stop && docker-compose -f docker-compose.yml -f docker-compose.dev.yml up --build -d",
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"test
|
|
46
|
-
"test:
|
|
47
|
-
"test:
|
|
48
|
-
"test:
|
|
49
|
-
"test:coverage": "nyc --reporter=lcov --reporter=text-summary tapes -- 'test/unit/**/**.test.js'",
|
|
40
|
+
"lint": "npx standard",
|
|
41
|
+
"lint:fix": "npx standard --fix",
|
|
42
|
+
"test": "npm run test:unit",
|
|
43
|
+
"test:unit": "npx tape 'test/unit/**/*.test.js' | tap-spec",
|
|
44
|
+
"test:xunit": "npx tape 'test/unit/**/**.test.js' | tap-xunit > ./test/results/xunit.xml",
|
|
45
|
+
"test:coverage": "npx nyc --reporter=lcov --reporter=text-summary tapes -- 'test/unit/**/**.test.js'",
|
|
50
46
|
"test:coverage-check": "npm run test:coverage && nyc check-coverage",
|
|
51
|
-
"test:
|
|
52
|
-
"
|
|
53
|
-
"migrate": "
|
|
54
|
-
"migrate:
|
|
55
|
-
"migrate:
|
|
56
|
-
"migrate:
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"docker:build": "run-s docker:build:test docker:build:api docker:build:admin",
|
|
47
|
+
"test:int": "npm run migrate && npx tape 'test/integration/**/*.test.js' | tap-spec",
|
|
48
|
+
"migrate": "npm run migrate:latest && npm run seed:run",
|
|
49
|
+
"migrate:latest": "npx knex $npm_package_config_knex migrate:latest",
|
|
50
|
+
"migrate:create": "npx knex migrate:make $npm_package_config_knex",
|
|
51
|
+
"migrate:rollback": "npx knex migrate:rollback $npm_package_config_knex",
|
|
52
|
+
"migrate:current": "npx knex migrate:currentVersion $npm_package_config_knex",
|
|
53
|
+
"seed:run": "npx knex seed:run $npm_package_config_knex",
|
|
54
|
+
"docker:build": "npm run docker:build:test && npm run docker:build:api",
|
|
60
55
|
"docker:build:test": "docker build --no-cache -f test.Dockerfile -t $npm_package_config_images_api:test .",
|
|
61
|
-
"docker:build:api": "docker build --no-cache -f
|
|
62
|
-
"docker:build:admin": "docker build --no-cache -f admin.Dockerfile -t $npm_package_config_images_admin:latest .",
|
|
56
|
+
"docker:build:api": "docker build --no-cache -f Dockerfile -t $npm_package_config_images_api:latest .",
|
|
63
57
|
"docker:up": "docker-compose -f docker-compose.yml up",
|
|
58
|
+
"docker:up:backend": "docker-compose up -d ml-api-adapter mysql mockserver kafka kowl temp_curl",
|
|
59
|
+
"docker:script:populateTestData": "sh ./test/util/scripts/populateTestData.sh",
|
|
64
60
|
"docker:stop": "docker-compose -f docker-compose.yml stop",
|
|
65
61
|
"docker:rm": "docker-compose -f docker-compose.yml rm -f -v",
|
|
66
62
|
"docker:down": "docker-compose -f docker-compose.yml down -v",
|
|
67
63
|
"docker:clean": "docker-compose -f docker-compose.yml down --rmi local",
|
|
68
|
-
"generate-docs": "
|
|
69
|
-
"audit:resolve": "
|
|
70
|
-
"audit:check": "
|
|
64
|
+
"generate-docs": "npx jsdoc -c jsdoc.json",
|
|
65
|
+
"audit:resolve": "npx resolve-audit --production",
|
|
66
|
+
"audit:check": "npx check-audit --production",
|
|
71
67
|
"dep:check": "npx ncu -e 2",
|
|
72
|
-
"dep:update": "npx ncu -u"
|
|
68
|
+
"dep:update": "npx ncu -u",
|
|
69
|
+
"release": "npx standard-version --no-verify --releaseCommitMessageFormat 'chore(release): {{currentTag}} [skip ci]'",
|
|
70
|
+
"snapshot": "npx standard-version --no-verify --skip.changelog --prerelease snapshot --releaseCommitMessageFormat 'chore(snapshot): {{currentTag}}'",
|
|
71
|
+
"wait-4-docker": "node ./scripts/_wait4_all.js"
|
|
73
72
|
},
|
|
74
73
|
"dependencies": {
|
|
75
|
-
"@hapi/good": "9.0.
|
|
76
|
-
"@hapi/hapi": "
|
|
77
|
-
"@hapi/inert": "6.0.
|
|
78
|
-
"@hapi/joi": "17.1.
|
|
79
|
-
"@hapi/vision": "6.
|
|
80
|
-
"@mojaloop/central-
|
|
81
|
-
"@mojaloop/central-services-
|
|
82
|
-
"@mojaloop/central-services-
|
|
83
|
-
"@mojaloop/central-services-
|
|
84
|
-
"@mojaloop/central-services-
|
|
85
|
-
"@mojaloop/central-services-
|
|
86
|
-
"@mojaloop/central-services-
|
|
87
|
-
"@mojaloop/
|
|
88
|
-
"@mojaloop/
|
|
89
|
-
"@mojaloop/
|
|
90
|
-
"@
|
|
91
|
-
"
|
|
92
|
-
"
|
|
74
|
+
"@hapi/good": "9.0.1",
|
|
75
|
+
"@hapi/hapi": "20.2.2",
|
|
76
|
+
"@hapi/inert": "6.0.5",
|
|
77
|
+
"@hapi/joi": "17.1.1",
|
|
78
|
+
"@hapi/vision": "6.1.0",
|
|
79
|
+
"@mojaloop/central-services-database": "10.7.0",
|
|
80
|
+
"@mojaloop/central-services-error-handling": "12.0.3",
|
|
81
|
+
"@mojaloop/central-services-health": "14.0.1",
|
|
82
|
+
"@mojaloop/central-services-logger": "11.0.1",
|
|
83
|
+
"@mojaloop/central-services-metrics": "12.0.5",
|
|
84
|
+
"@mojaloop/central-services-shared": "17.0.2",
|
|
85
|
+
"@mojaloop/central-services-stream": "11.0.0",
|
|
86
|
+
"@mojaloop/event-sdk": "11.0.2",
|
|
87
|
+
"@mojaloop/ml-number": "11.2.1",
|
|
88
|
+
"@mojaloop/object-store-lib": "12.0.0",
|
|
89
|
+
"@now-ims/hapi-now-auth": "2.1.0",
|
|
90
|
+
"ajv": "8.11.0",
|
|
91
|
+
"ajv-keywords": "5.1.0",
|
|
93
92
|
"base64url": "3.0.1",
|
|
94
|
-
"blipp": "4.0.
|
|
93
|
+
"blipp": "4.0.2",
|
|
95
94
|
"catbox-memory": "4.0.1",
|
|
96
|
-
"commander": "
|
|
97
|
-
"cron": "
|
|
98
|
-
"decimal.js": "10.
|
|
95
|
+
"commander": "9.3.0",
|
|
96
|
+
"cron": "2.0.0",
|
|
97
|
+
"decimal.js": "10.3.1",
|
|
99
98
|
"docdash": "1.2.0",
|
|
99
|
+
"event-stream": "4.0.1",
|
|
100
100
|
"five-bells-condition": "5.0.1",
|
|
101
|
-
"glob": "
|
|
101
|
+
"glob": "8.0.3",
|
|
102
102
|
"hapi-auth-basic": "5.0.0",
|
|
103
|
-
"hapi-auth-bearer-token": "
|
|
104
|
-
"hapi-swagger": "
|
|
105
|
-
"
|
|
106
|
-
"
|
|
107
|
-
"
|
|
108
|
-
"
|
|
109
|
-
"npm-run-all": "4.1.5",
|
|
103
|
+
"hapi-auth-bearer-token": "8.0.0",
|
|
104
|
+
"hapi-swagger": "14.5.5",
|
|
105
|
+
"ilp-packet": "2.2.0",
|
|
106
|
+
"knex": "2.1.0",
|
|
107
|
+
"lodash": "4.17.21",
|
|
108
|
+
"moment": "2.29.4",
|
|
110
109
|
"rc": "1.2.8",
|
|
111
|
-
"require-glob": "
|
|
112
|
-
"uuid4": "
|
|
110
|
+
"require-glob": "^4.1.0",
|
|
111
|
+
"uuid4": "2.0.2"
|
|
113
112
|
},
|
|
114
113
|
"optionalDependencies": {
|
|
115
114
|
"mysql": "2.18.1"
|
|
116
115
|
},
|
|
117
116
|
"devDependencies": {
|
|
118
|
-
"async-retry": "1.3.
|
|
119
|
-
"faucet": "0.0.1",
|
|
117
|
+
"async-retry": "1.3.3",
|
|
120
118
|
"get-port": "5.1.1",
|
|
121
|
-
"jsdoc": "3.6.
|
|
122
|
-
"jsonpath": "1.
|
|
123
|
-
"nodemon": "2.0.
|
|
124
|
-
"npm-audit-resolver": "
|
|
125
|
-
"npm-check-updates": "
|
|
126
|
-
"nyc": "15.
|
|
119
|
+
"jsdoc": "3.6.10",
|
|
120
|
+
"jsonpath": "1.1.1",
|
|
121
|
+
"nodemon": "2.0.19",
|
|
122
|
+
"npm-audit-resolver": "3.0.0-7",
|
|
123
|
+
"npm-check-updates": "15.2.6",
|
|
124
|
+
"nyc": "15.1.0",
|
|
127
125
|
"pre-commit": "1.2.2",
|
|
128
126
|
"proxyquire": "2.1.3",
|
|
129
|
-
"
|
|
130
|
-
"
|
|
127
|
+
"replace": "^1.2.1",
|
|
128
|
+
"sinon": "14.0.0",
|
|
129
|
+
"standard": "17.0.0",
|
|
130
|
+
"standard-version": "^9.5.0",
|
|
131
|
+
"tap-spec": "^5.0.0",
|
|
131
132
|
"tap-xunit": "2.4.1",
|
|
132
|
-
"tape": "4.13.
|
|
133
|
+
"tape": "4.13.2",
|
|
133
134
|
"tapes": "4.1.0"
|
|
135
|
+
},
|
|
136
|
+
"config": {
|
|
137
|
+
"knex": "--knexfile ./config/knexfile.js",
|
|
138
|
+
"images": {
|
|
139
|
+
"api": "central-ledger",
|
|
140
|
+
"admin": "central-ledger-admin"
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
"standard": {
|
|
144
|
+
"ignore": [
|
|
145
|
+
"/migrations/**"
|
|
146
|
+
]
|
|
147
|
+
},
|
|
148
|
+
"standard-version": {
|
|
149
|
+
"scripts": {
|
|
150
|
+
"postchangelog": "replace '\\[mojaloop/#(\\d+)\\]\\(https://github.com/mojaloop/(.*)/issues/(\\d+)\\)' '[mojaloop/#$1](https://github.com/mojaloop/project/issues/$1)' CHANGELOG.md"
|
|
151
|
+
}
|
|
134
152
|
}
|
|
135
153
|
}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { execSync } = require('child_process')
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @file _wait4_all.js
|
|
7
|
+
* @description Waits for all docker-compose services to be running and healthy
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
// Define the docker-compose containers you want to monitor here
|
|
11
|
+
const expectedContainers = [
|
|
12
|
+
'cl_mysql',
|
|
13
|
+
'cl_kafka'
|
|
14
|
+
// ## NOTE: These are not needed for Integration Tests
|
|
15
|
+
// 'cl_central-ledger',
|
|
16
|
+
// 'cl_ml-api-adapter',
|
|
17
|
+
// 'cl_simulator',
|
|
18
|
+
// 'mockserver',
|
|
19
|
+
// 'cl_objstore' //,
|
|
20
|
+
// 'kowl'
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
let retries = 40
|
|
24
|
+
const waitTimeMs = 60000
|
|
25
|
+
|
|
26
|
+
async function main () {
|
|
27
|
+
const waitingMap = {}
|
|
28
|
+
// serviceName => status, where status is healthy, unhealthy or starting
|
|
29
|
+
expectedContainers.forEach(serviceName => {
|
|
30
|
+
waitingMap[serviceName] = 'starting'
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
try {
|
|
34
|
+
let allHealthy = await areAllServicesHealthy(waitingMap, waitTimeMs)
|
|
35
|
+
|
|
36
|
+
while (!allHealthy && retries > 0) {
|
|
37
|
+
await sleep(waitTimeMs)
|
|
38
|
+
allHealthy = await areAllServicesHealthy(waitingMap, waitTimeMs)
|
|
39
|
+
|
|
40
|
+
if (retries === 0) {
|
|
41
|
+
throw new Error(`Out of retries waiting for service health.\nStill waiting for: ${getServicesForStatus(waitingMap, 'starting')}`)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
console.log('Still waiting for service health. Retries', retries)
|
|
45
|
+
console.log(`${getServicesForStatus(waitingMap, 'healthy').length} services are healthy. Expected: ${expectedContainers.length}`)
|
|
46
|
+
console.log('Waiting for', getServicesForStatus(waitingMap, 'starting'))
|
|
47
|
+
|
|
48
|
+
retries--
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
console.log('All services are healthy. Time to get to work!')
|
|
52
|
+
process.exit(0)
|
|
53
|
+
} catch (error) {
|
|
54
|
+
console.error(`_wait4_all: ${error}`)
|
|
55
|
+
process.exit(1)
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* @function areAllServicesHealthy
|
|
61
|
+
* @description Get Update the service status, and sleep for `waitTimeMs` if the services aren't healthy
|
|
62
|
+
* @param {*} waitingMap
|
|
63
|
+
* @returns boolean
|
|
64
|
+
*/
|
|
65
|
+
async function areAllServicesHealthy (waitingMap) {
|
|
66
|
+
await updateServiceStatus(waitingMap)
|
|
67
|
+
|
|
68
|
+
if (isSystemHealthy(waitingMap)) {
|
|
69
|
+
return true
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (isSystemFailing(waitingMap)) {
|
|
73
|
+
throw new Error(`One or more services went to unhealthy: \n\t${getServicesForStatus(waitingMap, 'unhealthy')}\n`)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return false
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* @function updateServiceStatus
|
|
81
|
+
* @description Go through all of the waiting services, and check their status
|
|
82
|
+
* @param {*} waitingMap
|
|
83
|
+
* @returns void
|
|
84
|
+
*/
|
|
85
|
+
async function updateServiceStatus (waitingMap) {
|
|
86
|
+
const startingServices = getServicesForStatus(waitingMap, 'starting')
|
|
87
|
+
|
|
88
|
+
Promise.all(startingServices.map(async serviceName => {
|
|
89
|
+
// TODO: This info may be useful in future!
|
|
90
|
+
// const currentStatus = waitingMap[serviceName]
|
|
91
|
+
const progress = await getProgress(serviceName)
|
|
92
|
+
waitingMap[serviceName] = progress
|
|
93
|
+
}))
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* @function getProgress
|
|
98
|
+
* @description Invokes the `docker inspect` command for the given container
|
|
99
|
+
* @param {string} containerName
|
|
100
|
+
* @returns {'healthy' | 'unhealthy' | 'starting'}
|
|
101
|
+
*/
|
|
102
|
+
function getProgress (containerName) {
|
|
103
|
+
const command = `docker inspect --format='{{json .State.Health.Status}}' ${containerName}`
|
|
104
|
+
return execSync(command).toString().replace(/['"]+|[\n]+/g, '')
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* @function isSystemHealthy
|
|
109
|
+
* @param {*} waitingMap
|
|
110
|
+
* @returns {boolean}
|
|
111
|
+
*/
|
|
112
|
+
function isSystemHealthy (waitingMap) {
|
|
113
|
+
return getServicesForStatus(waitingMap, 'healthy').length === expectedContainers.length
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* @function isSystemFailing
|
|
118
|
+
* @param {*} waitingMap
|
|
119
|
+
* @returns {boolean}
|
|
120
|
+
*/
|
|
121
|
+
function isSystemFailing (waitingMap) {
|
|
122
|
+
return getServicesForStatus(waitingMap, 'unhealthy').length > 0
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* @function getServicesForStatus
|
|
127
|
+
* @param {*} waitingMap
|
|
128
|
+
* @param {'healthy' | 'unhealthy' | 'starting'} status
|
|
129
|
+
* @returns {Array<string>}
|
|
130
|
+
*/
|
|
131
|
+
function getServicesForStatus (waitingMap, status) {
|
|
132
|
+
return Object
|
|
133
|
+
.keys(waitingMap)
|
|
134
|
+
.filter(k => waitingMap[k] === status)
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* @function sleep
|
|
139
|
+
* @param {*} timeMs - how long to sleep for
|
|
140
|
+
*/
|
|
141
|
+
async function sleep (timeMs) {
|
|
142
|
+
console.log(`Sleeping for ${timeMs} ms`)
|
|
143
|
+
return new Promise((resolve, reject) => setTimeout(() => resolve(), timeMs))
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
main()
|
package/seeds/amountType.js
CHANGED
|
@@ -25,6 +25,7 @@ Contributors
|
|
|
25
25
|
- Name Surname <name.surname@gatesfoundation.com>
|
|
26
26
|
|
|
27
27
|
* Georgi Georgiev <georgi.georgiev@modusbox.com>
|
|
28
|
+
* Shashikant Hirugade <shashikant.hirugade@modusbox.com>
|
|
28
29
|
--------------
|
|
29
30
|
******/
|
|
30
31
|
|
|
@@ -44,12 +45,9 @@ const amountType = [
|
|
|
44
45
|
|
|
45
46
|
exports.seed = async function (knex) {
|
|
46
47
|
try {
|
|
47
|
-
return await knex('amountType').insert(amountType)
|
|
48
|
+
return await knex('amountType').insert(amountType).onConflict('name').ignore()
|
|
48
49
|
} catch (err) {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
console.log(`Uploading seeds for amountType has failed with the following error: ${err}`)
|
|
52
|
-
return -1000
|
|
53
|
-
}
|
|
50
|
+
console.log(`Uploading seeds for amountType has failed with the following error: ${err}`)
|
|
51
|
+
return -1000
|
|
54
52
|
}
|
|
55
53
|
}
|
|
@@ -25,6 +25,7 @@ Contributors
|
|
|
25
25
|
- Name Surname <name.surname@gatesfoundation.com>
|
|
26
26
|
|
|
27
27
|
* Georgi Georgiev <georgi.georgiev@modusbox.com>
|
|
28
|
+
* Shashikant Hirugade <shashikant.hirugade@modusbox.com>
|
|
28
29
|
--------------
|
|
29
30
|
******/
|
|
30
31
|
|
|
@@ -510,12 +511,9 @@ const balanceOfPayments = [
|
|
|
510
511
|
|
|
511
512
|
exports.seed = async function (knex) {
|
|
512
513
|
try {
|
|
513
|
-
return await knex('balanceOfPayments').insert(balanceOfPayments)
|
|
514
|
+
return await knex('balanceOfPayments').insert(balanceOfPayments).onConflict('name').ignore()
|
|
514
515
|
} catch (err) {
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
console.log(`Uploading seeds for balanceOfPayments has failed with the following error: ${err}`)
|
|
518
|
-
return -1000
|
|
519
|
-
}
|
|
516
|
+
console.log(`Uploading seeds for balanceOfPayments has failed with the following error: ${err}`)
|
|
517
|
+
return -1000
|
|
520
518
|
}
|
|
521
519
|
}
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
- Name Surname <name.surname@gatesfoundation.com>
|
|
20
20
|
|
|
21
21
|
* Georgi Georgiev <georgi.georgiev@modusbox.com>
|
|
22
|
+
* Shashikant Hirugade <shashikant.hirugade@modusbox.com>
|
|
22
23
|
--------------
|
|
23
24
|
******/
|
|
24
25
|
|
|
@@ -69,12 +70,9 @@ const bulkProcessingStates = [
|
|
|
69
70
|
|
|
70
71
|
exports.seed = async function (knex) {
|
|
71
72
|
try {
|
|
72
|
-
return await knex('bulkProcessingState').insert(bulkProcessingStates)
|
|
73
|
+
return await knex('bulkProcessingState').insert(bulkProcessingStates).onConflict('name').ignore()
|
|
73
74
|
} catch (err) {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
console.log(`Uploading seeds for bulkProcessingState has failed with the following error: ${err}`)
|
|
77
|
-
return -1000
|
|
78
|
-
}
|
|
75
|
+
console.log(`Uploading seeds for bulkProcessingState has failed with the following error: ${err}`)
|
|
76
|
+
return -1000
|
|
79
77
|
}
|
|
80
78
|
}
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
- Name Surname <name.surname@gatesfoundation.com>
|
|
20
20
|
|
|
21
21
|
* Georgi Georgiev <georgi.georgiev@modusbox.com>
|
|
22
|
+
* Shashikant Hirugade <shashikant.hirugade@modusbox.com>
|
|
22
23
|
--------------
|
|
23
24
|
******/
|
|
24
25
|
|
|
@@ -84,12 +85,9 @@ const bulkTransferStates = [
|
|
|
84
85
|
|
|
85
86
|
exports.seed = async function (knex) {
|
|
86
87
|
try {
|
|
87
|
-
return await knex('bulkTransferState').insert(bulkTransferStates)
|
|
88
|
+
return await knex('bulkTransferState').insert(bulkTransferStates).onConflict('bulkTransferStateId').ignore()
|
|
88
89
|
} catch (err) {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
console.log(`Uploading seeds for bulkTransferState has failed with the following error: ${err}`)
|
|
92
|
-
return -1000
|
|
93
|
-
}
|
|
90
|
+
console.log(`Uploading seeds for bulkTransferState has failed with the following error: ${err}`)
|
|
91
|
+
return -1000
|
|
94
92
|
}
|
|
95
93
|
}
|
package/seeds/currency.js
CHANGED
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
- Name Surname <name.surname@gatesfoundation.com>
|
|
20
20
|
|
|
21
21
|
* Georgi Georgiev <georgi.georgiev@modusbox.com>
|
|
22
|
+
* Shashikant Hirugade <shashikant.hirugade@modusbox.com>
|
|
22
23
|
--------------
|
|
23
24
|
******/
|
|
24
25
|
|
|
@@ -224,13 +225,10 @@ const currencyList = currencies.map(currentValue => {
|
|
|
224
225
|
|
|
225
226
|
const seed = async function (knex) {
|
|
226
227
|
try {
|
|
227
|
-
return await knex('currency').insert(currencies)
|
|
228
|
+
return await knex('currency').insert(currencies).onConflict('currencyId').ignore()
|
|
228
229
|
} catch (err) {
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
console.log(`Uploading seeds for currency has failed with the following error: ${err}`)
|
|
232
|
-
return -1000
|
|
233
|
-
}
|
|
230
|
+
console.log(`Uploading seeds for currency has failed with the following error: ${err}`)
|
|
231
|
+
return -1000
|
|
234
232
|
}
|
|
235
233
|
}
|
|
236
234
|
|