diff --git a/.ncurc.json b/.ncurc.json index 6f49027cc..921b45cfc 100644 --- a/.ncurc.json +++ b/.ncurc.json @@ -1,5 +1,3 @@ { - "reject": [ - - ] + "reject": [] } diff --git a/audit-resolve.json b/audit-resolve.json index b42916449..8b1378917 100644 --- a/audit-resolve.json +++ b/audit-resolve.json @@ -1,48 +1 @@ -{ - "decisions": { - "1164|hapi-swagger>handlebars": { - "decision": "fix", - "madeAt": 1569472078085 - }, - "1164|nyc>istanbul-reports>handlebars": { - "decision": "fix", - "madeAt": 1569472078086 - }, - "1184|npm-check-updates>pacote>make-fetch-happen>https-proxy-agent": { - "decision": "ignore", - "madeAt": 1571649787349, - "expiresAt": 1574241710583 - }, - "1184|npm-check-updates>pacote>npm-registry-fetch>make-fetch-happen>https-proxy-agent": { - "decision": "ignore", - "madeAt": 1571649787349, - "expiresAt": 1574241710583 - }, - "1316|hapi-swagger>handlebars": { - "decision": "fix", - "madeAt": 1574855424585 - }, - "1316|nyc>istanbul-reports>handlebars": { - "decision": "fix", - "madeAt": 1574855424585 - }, - "1324|hapi-swagger>handlebars": { - "decision": "fix", - "madeAt": 1574855424585 - }, - "1324|nyc>istanbul-reports>handlebars": { - "decision": "fix", - "madeAt": 1574855424585 - }, - "1325|hapi-swagger>handlebars": { - "decision": "fix", - "madeAt": 1574855424585 - }, - "1325|nyc>istanbul-reports>handlebars": { - "decision": "fix", - "madeAt": 1574855424585 - } - }, - "rules": {}, - "version": 1 -} \ No newline at end of file + diff --git a/migrations/100100_event.js b/migrations/100100_event.js index 4ac11ebab..b7f44442b 100644 --- a/migrations/100100_event.js +++ b/migrations/100100_event.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/110100_contactType.js b/migrations/110100_contactType.js index a64df999c..7aef5b28a 100644 --- a/migrations/110100_contactType.js +++ b/migrations/110100_contactType.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/110101_contactType-indexes.js b/migrations/110101_contactType-indexes.js index 46dfb6b59..9693420d2 100644 --- a/migrations/110101_contactType-indexes.js +++ b/migrations/110101_contactType-indexes.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/110200_currency.js b/migrations/110200_currency.js index a0e646e13..cc9394b40 100644 --- a/migrations/110200_currency.js +++ b/migrations/110200_currency.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/110201_currency-scale.js b/migrations/110201_currency-scale.js index 69e42ea1e..b8e9aff13 100644 --- a/migrations/110201_currency-scale.js +++ b/migrations/110201_currency-scale.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/110300_endpointType.js b/migrations/110300_endpointType.js index 6eeb3ffc8..84d1a7356 100644 --- a/migrations/110300_endpointType.js +++ b/migrations/110300_endpointType.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/110301_endpointType-indexes.js b/migrations/110301_endpointType-indexes.js index 5afb0ff2f..e60dfdc92 100644 --- a/migrations/110301_endpointType-indexes.js +++ b/migrations/110301_endpointType-indexes.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/110400_ledgerEntryType.js b/migrations/110400_ledgerEntryType.js index 2d5d8e65e..cd859423d 100644 --- a/migrations/110400_ledgerEntryType.js +++ b/migrations/110400_ledgerEntryType.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/110401_ledgerEntryType-indexes.js b/migrations/110401_ledgerEntryType-indexes.js index c69b63583..ecf0ed081 100644 --- a/migrations/110401_ledgerEntryType-indexes.js +++ b/migrations/110401_ledgerEntryType-indexes.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/110450_ledgerAccountType.js b/migrations/110450_ledgerAccountType.js index b5b7b1f20..aa42d2b79 100644 --- a/migrations/110450_ledgerAccountType.js +++ b/migrations/110450_ledgerAccountType.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/110451_ledgerAccountType-indexes.js b/migrations/110451_ledgerAccountType-indexes.js index 483fd2b4a..07a3413b7 100644 --- a/migrations/110451_ledgerAccountType-indexes.js +++ b/migrations/110451_ledgerAccountType-indexes.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/110500_participantLimitType.js b/migrations/110500_participantLimitType.js index 90f36fce9..59baafef6 100644 --- a/migrations/110500_participantLimitType.js +++ b/migrations/110500_participantLimitType.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/110501_participantLimitType-indexes.js b/migrations/110501_participantLimitType-indexes.js index 0678cfef8..8f9e83cdd 100644 --- a/migrations/110501_participantLimitType-indexes.js +++ b/migrations/110501_participantLimitType-indexes.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/110600_transferParticipantRoleType.js b/migrations/110600_transferParticipantRoleType.js index 47898232f..3521daa7d 100644 --- a/migrations/110600_transferParticipantRoleType.js +++ b/migrations/110600_transferParticipantRoleType.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/110601_transferParticipantRoleType-indexes.js b/migrations/110601_transferParticipantRoleType-indexes.js index 796d62acd..955e7743a 100644 --- a/migrations/110601_transferParticipantRoleType-indexes.js +++ b/migrations/110601_transferParticipantRoleType-indexes.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/110700_transferState.js b/migrations/110700_transferState.js index 86f3671b2..38f73fd0a 100644 --- a/migrations/110700_transferState.js +++ b/migrations/110700_transferState.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/110800_settlementWindowState.js b/migrations/110800_settlementWindowState.js index 91d5cda3e..372c14313 100644 --- a/migrations/110800_settlementWindowState.js +++ b/migrations/110800_settlementWindowState.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/110900_settlementState.js b/migrations/110900_settlementState.js index 7811a1cfd..f4e98e1b7 100644 --- a/migrations/110900_settlementState.js +++ b/migrations/110900_settlementState.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/111000_amountType.js b/migrations/111000_amountType.js index 52b738199..5f5bda6e8 100644 --- a/migrations/111000_amountType.js +++ b/migrations/111000_amountType.js @@ -24,7 +24,8 @@ Contributors * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/111001_amountType-indexes.js b/migrations/111001_amountType-indexes.js index 916fda98c..29d0bfd2d 100644 --- a/migrations/111001_amountType-indexes.js +++ b/migrations/111001_amountType-indexes.js @@ -24,7 +24,8 @@ Contributors * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/111100_balanceOfPayments.js b/migrations/111100_balanceOfPayments.js index 7f8c4caf3..667d4f8b4 100644 --- a/migrations/111100_balanceOfPayments.js +++ b/migrations/111100_balanceOfPayments.js @@ -24,7 +24,8 @@ Contributors * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/111101_balanceOfPayments-indexes.js b/migrations/111101_balanceOfPayments-indexes.js index 0dca4a266..46b6c1b9d 100644 --- a/migrations/111101_balanceOfPayments-indexes.js +++ b/migrations/111101_balanceOfPayments-indexes.js @@ -24,7 +24,8 @@ Contributors * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/111200_partyIdentifierType.js b/migrations/111200_partyIdentifierType.js index dbb68e1f0..ae3a479b5 100644 --- a/migrations/111200_partyIdentifierType.js +++ b/migrations/111200_partyIdentifierType.js @@ -24,7 +24,8 @@ Contributors * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/111201_partyIdentifierType-indexes.js b/migrations/111201_partyIdentifierType-indexes.js index 3f24519cc..36e72ae16 100644 --- a/migrations/111201_partyIdentifierType-indexes.js +++ b/migrations/111201_partyIdentifierType-indexes.js @@ -24,7 +24,8 @@ Contributors * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/111300_partyType.js b/migrations/111300_partyType.js index 3eefc1c46..59986b35e 100644 --- a/migrations/111300_partyType.js +++ b/migrations/111300_partyType.js @@ -24,7 +24,8 @@ Contributors * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/111301_partyType-indexes.js b/migrations/111301_partyType-indexes.js index 3dd7e234b..27e6484f3 100644 --- a/migrations/111301_partyType-indexes.js +++ b/migrations/111301_partyType-indexes.js @@ -24,7 +24,8 @@ Contributors * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/111400_quoteDuplicateCheck.js b/migrations/111400_quoteDuplicateCheck.js index 4ebcc2d29..c60cb28dd 100644 --- a/migrations/111400_quoteDuplicateCheck.js +++ b/migrations/111400_quoteDuplicateCheck.js @@ -24,7 +24,8 @@ Contributors * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/111500_transactionInitiator.js b/migrations/111500_transactionInitiator.js index 053a33357..c8330b5db 100644 --- a/migrations/111500_transactionInitiator.js +++ b/migrations/111500_transactionInitiator.js @@ -24,7 +24,8 @@ Contributors * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/111501_transactionInitiator-indexes.js b/migrations/111501_transactionInitiator-indexes.js index 511be7bb4..34bf7e64e 100644 --- a/migrations/111501_transactionInitiator-indexes.js +++ b/migrations/111501_transactionInitiator-indexes.js @@ -24,7 +24,8 @@ Contributors * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/111600_transactionInitiatorType.js b/migrations/111600_transactionInitiatorType.js index 6ab689d6b..8c2b1465d 100644 --- a/migrations/111600_transactionInitiatorType.js +++ b/migrations/111600_transactionInitiatorType.js @@ -24,7 +24,8 @@ Contributors * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/111601_transactionInitiatorType-indexes.js b/migrations/111601_transactionInitiatorType-indexes.js index d61e433ad..02047801f 100644 --- a/migrations/111601_transactionInitiatorType-indexes.js +++ b/migrations/111601_transactionInitiatorType-indexes.js @@ -24,7 +24,8 @@ Contributors * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/111700_settlementDelay.js b/migrations/111700_settlementDelay.js new file mode 100644 index 000000000..7244b62d6 --- /dev/null +++ b/migrations/111700_settlementDelay.js @@ -0,0 +1,50 @@ +/***** + License + -------------- + Copyright © 2017 Bill & Melinda Gates Foundation + 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 + http://www.apache.org/licenses/LICENSE-2.0 + 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. + + Initial contribution + -------------------- + The initial functionality and code base was donated by the Mowali project working in conjunction with MTN and Orange as service provides. + * Project: Mowali + +Contributors + -------------- + This is the official list of the Mojaloop project contributors for this file. + Names of the original copyright holders (individuals or organizations) + should be listed with a '*' in the first column. People who have + contributed from an organization can be listed under the organization + that actually holds the copyright for their contributions (see the + Gates Foundation organization for an example). Those individuals should have + their names indented and be marked with a '-'. Email address can be added + optionally within square brackets . + * Gates Foundation + - Name Surname + + * ModusBox + - Georgi Georgiev + -------------- + ******/ + +'use strict' + +exports.up = (knex, Promise) => { + return knex.schema.hasTable('settlementDelay').then((exists) => { + if (!exists) { + return knex.schema.createTable('settlementDelay', (t) => { + t.increments('settlementDelayId').primary().notNullable() + t.string('name', 50).notNullable() + t.string('description', 512).defaultTo(null).nullable() + t.boolean('isActive').defaultTo(true).notNullable() + t.dateTime('createdDate').defaultTo(knex.fn.now()).notNullable().comment('System dateTime stamp pertaining to the inserted record') + }) + } + }) +} + +exports.down = (knex, Promise) => { + return knex.schema.dropTableIfExists('settlementDelay') +} diff --git a/migrations/111701_settlementDelay-indexes.js b/migrations/111701_settlementDelay-indexes.js new file mode 100644 index 000000000..9a80551e4 --- /dev/null +++ b/migrations/111701_settlementDelay-indexes.js @@ -0,0 +1,44 @@ +/***** + License + -------------- + Copyright © 2017 Bill & Melinda Gates Foundation + 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 + http://www.apache.org/licenses/LICENSE-2.0 + 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. + + Initial contribution + -------------------- + The initial functionality and code base was donated by the Mowali project working in conjunction with MTN and Orange as service provides. + * Project: Mowali + +Contributors + -------------- + This is the official list of the Mojaloop project contributors for this file. + Names of the original copyright holders (individuals or organizations) + should be listed with a '*' in the first column. People who have + contributed from an organization can be listed under the organization + that actually holds the copyright for their contributions (see the + Gates Foundation organization for an example). Those individuals should have + their names indented and be marked with a '-'. Email address can be added + optionally within square brackets . + * Gates Foundation + - Name Surname + + * ModusBox + - Georgi Georgiev + -------------- + ******/ + +'use strict' + +exports.up = function (knex, Promise) { + return knex.schema.table('settlementDelay', (t) => { + t.unique('name') + }) +} + +exports.down = function (knex, Promise) { + return knex.schema.table('settlementDelay', (t) => { + t.dropUnique('name') + }) +} \ No newline at end of file diff --git a/migrations/111800_settlementInterchange.js b/migrations/111800_settlementInterchange.js new file mode 100644 index 000000000..e969c1a37 --- /dev/null +++ b/migrations/111800_settlementInterchange.js @@ -0,0 +1,50 @@ +/***** + License + -------------- + Copyright © 2017 Bill & Melinda Gates Foundation + 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 + http://www.apache.org/licenses/LICENSE-2.0 + 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. + + Initial contribution + -------------------- + The initial functionality and code base was donated by the Mowali project working in conjunction with MTN and Orange as service provides. + * Project: Mowali + +Contributors + -------------- + This is the official list of the Mojaloop project contributors for this file. + Names of the original copyright holders (individuals or organizations) + should be listed with a '*' in the first column. People who have + contributed from an organization can be listed under the organization + that actually holds the copyright for their contributions (see the + Gates Foundation organization for an example). Those individuals should have + their names indented and be marked with a '-'. Email address can be added + optionally within square brackets . + * Gates Foundation + - Name Surname + + * ModusBox + - Georgi Georgiev + -------------- + ******/ + +'use strict' + +exports.up = (knex, Promise) => { + return knex.schema.hasTable('settlementInterchange').then((exists) => { + if (!exists) { + return knex.schema.createTable('settlementInterchange', (t) => { + t.increments('settlementInterchangeId').primary().notNullable() + t.string('name', 50).notNullable() + t.string('description', 512).defaultTo(null).nullable() + t.boolean('isActive').defaultTo(true).notNullable() + t.dateTime('createdDate').defaultTo(knex.fn.now()).notNullable().comment('System dateTime stamp pertaining to the inserted record') + }) + } + }) +} + +exports.down = (knex, Promise) => { + return knex.schema.dropTableIfExists('settlementInterchange') +} diff --git a/migrations/111801_settlementInterchange-indexes.js b/migrations/111801_settlementInterchange-indexes.js new file mode 100644 index 000000000..7bc0b3cee --- /dev/null +++ b/migrations/111801_settlementInterchange-indexes.js @@ -0,0 +1,45 @@ +/***** + License + -------------- + Copyright © 2017 Bill & Melinda Gates Foundation + 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 + http://www.apache.org/licenses/LICENSE-2.0 + 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. + + Initial contribution + -------------------- + The initial functionality and code base was donated by the Mowali project working in conjunction with MTN and Orange as service provides. + * Project: Mowali + +Contributors + -------------- + This is the official list of the Mojaloop project contributors for this file. + Names of the original copyright holders (individuals or organizations) + should be listed with a '*' in the first column. People who have + contributed from an organization can be listed under the organization + that actually holds the copyright for their contributions (see the + Gates Foundation organization for an example). Those individuals should have + their names indented and be marked with a '-'. Email address can be added + optionally within square brackets . + * Gates Foundation + - Name Surname + + * ModusBox + - Georgi Georgiev + -------------- + ******/ + +// Notes: these changes are required for the quoting-service and are not used by central-ledger +'use strict' + +exports.up = function (knex, Promise) { + return knex.schema.table('settlementInterchange', (t) => { + t.unique('name') + }) +} + +exports.down = function (knex, Promise) { + return knex.schema.table('settlementInterchange', (t) => { + t.dropUnique('name') + }) +} \ No newline at end of file diff --git a/migrations/111900_settlementGranularity.js b/migrations/111900_settlementGranularity.js new file mode 100644 index 000000000..00593108b --- /dev/null +++ b/migrations/111900_settlementGranularity.js @@ -0,0 +1,50 @@ +/***** + License + -------------- + Copyright © 2017 Bill & Melinda Gates Foundation + 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 + http://www.apache.org/licenses/LICENSE-2.0 + 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. + + Initial contribution + -------------------- + The initial functionality and code base was donated by the Mowali project working in conjunction with MTN and Orange as service provides. + * Project: Mowali + +Contributors + -------------- + This is the official list of the Mojaloop project contributors for this file. + Names of the original copyright holders (individuals or organizations) + should be listed with a '*' in the first column. People who have + contributed from an organization can be listed under the organization + that actually holds the copyright for their contributions (see the + Gates Foundation organization for an example). Those individuals should have + their names indented and be marked with a '-'. Email address can be added + optionally within square brackets . + * Gates Foundation + - Name Surname + + * ModusBox + - Georgi Georgiev + -------------- + ******/ + +'use strict' + +exports.up = (knex, Promise) => { + return knex.schema.hasTable('settlementGranularity').then((exists) => { + if (!exists) { + return knex.schema.createTable('settlementGranularity', (t) => { + t.increments('settlementGranularityId').primary().notNullable() + t.string('name', 50).notNullable() + t.string('description', 512).defaultTo(null).nullable() + t.boolean('isActive').defaultTo(true).notNullable() + t.dateTime('createdDate').defaultTo(knex.fn.now()).notNullable().comment('System dateTime stamp pertaining to the inserted record') + }) + } + }) +} + +exports.down = (knex, Promise) => { + return knex.schema.dropTableIfExists('settlementGranularity') +} diff --git a/migrations/111901_settlementGranularity-indexes.js b/migrations/111901_settlementGranularity-indexes.js new file mode 100644 index 000000000..659525022 --- /dev/null +++ b/migrations/111901_settlementGranularity-indexes.js @@ -0,0 +1,45 @@ +/***** + License + -------------- + Copyright © 2017 Bill & Melinda Gates Foundation + 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 + http://www.apache.org/licenses/LICENSE-2.0 + 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. + + Initial contribution + -------------------- + The initial functionality and code base was donated by the Mowali project working in conjunction with MTN and Orange as service provides. + * Project: Mowali + +Contributors + -------------- + This is the official list of the Mojaloop project contributors for this file. + Names of the original copyright holders (individuals or organizations) + should be listed with a '*' in the first column. People who have + contributed from an organization can be listed under the organization + that actually holds the copyright for their contributions (see the + Gates Foundation organization for an example). Those individuals should have + their names indented and be marked with a '-'. Email address can be added + optionally within square brackets . + * Gates Foundation + - Name Surname + + * ModusBox + - Georgi Georgiev + -------------- + ******/ + +// Notes: these changes are required for the quoting-service and are not used by central-ledger +'use strict' + +exports.up = function (knex, Promise) { + return knex.schema.table('settlementGranularity', (t) => { + t.unique('name') + }) +} + +exports.down = function (knex, Promise) { + return knex.schema.table('settlementGranularity', (t) => { + t.dropUnique('name') + }) +} \ No newline at end of file diff --git a/migrations/112000_bulkTransferState.js b/migrations/112000_bulkTransferState.js index 299d9fe91..77db634c9 100644 --- a/migrations/112000_bulkTransferState.js +++ b/migrations/112000_bulkTransferState.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/112100_bulkProcessingState.js b/migrations/112100_bulkProcessingState.js index 589b24aa0..60cba67a6 100644 --- a/migrations/112100_bulkProcessingState.js +++ b/migrations/112100_bulkProcessingState.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/112101_bulkProcessingState-indexes.js b/migrations/112101_bulkProcessingState-indexes.js index c67d6ef86..172d2844c 100644 --- a/migrations/112101_bulkProcessingState-indexes.js +++ b/migrations/112101_bulkProcessingState-indexes.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/200100_participant.js b/migrations/200100_participant.js index 3d7495646..24466d655 100644 --- a/migrations/200100_participant.js +++ b/migrations/200100_participant.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/200101_participant-indexes.js b/migrations/200101_participant-indexes.js index c3c5a2e89..8e000d9b8 100644 --- a/migrations/200101_participant-indexes.js +++ b/migrations/200101_participant-indexes.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/200200_participantContact.js b/migrations/200200_participantContact.js index 189267273..e8f0a4b70 100644 --- a/migrations/200200_participantContact.js +++ b/migrations/200200_participantContact.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/200201_participantContact-indexes.js b/migrations/200201_participantContact-indexes.js index eb9e902b5..5507f3e3b 100644 --- a/migrations/200201_participantContact-indexes.js +++ b/migrations/200201_participantContact-indexes.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/200300_participantEndpoint.js b/migrations/200300_participantEndpoint.js index 36c472808..7340f9a16 100644 --- a/migrations/200300_participantEndpoint.js +++ b/migrations/200300_participantEndpoint.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/200301_participantEndpoint-indexes.js b/migrations/200301_participantEndpoint-indexes.js index 822cdc0eb..948f3ebc7 100644 --- a/migrations/200301_participantEndpoint-indexes.js +++ b/migrations/200301_participantEndpoint-indexes.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/200400_participantParty.js b/migrations/200400_participantParty.js index e10195df8..a89039f6b 100644 --- a/migrations/200400_participantParty.js +++ b/migrations/200400_participantParty.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/200401_participantParty-indexes.js b/migrations/200401_participantParty-indexes.js index 39b40966b..e6e2ed859 100644 --- a/migrations/200401_participantParty-indexes.js +++ b/migrations/200401_participantParty-indexes.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/200600_token.js b/migrations/200600_token.js index 17b550ecd..ccc4ba08d 100644 --- a/migrations/200600_token.js +++ b/migrations/200600_token.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/200601_token-indexes.js b/migrations/200601_token-indexes.js index 55c14f432..6a5a7a449 100644 --- a/migrations/200601_token-indexes.js +++ b/migrations/200601_token-indexes.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/300100_transferDuplicateCheck.js b/migrations/300100_transferDuplicateCheck.js index 6da1da4ec..139b90a7f 100644 --- a/migrations/300100_transferDuplicateCheck.js +++ b/migrations/300100_transferDuplicateCheck.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/300150_bulkTransferDuplicateCheck.js b/migrations/300150_bulkTransferDuplicateCheck.js index 372627d94..5cb648c22 100644 --- a/migrations/300150_bulkTransferDuplicateCheck.js +++ b/migrations/300150_bulkTransferDuplicateCheck.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/300200_transfer.js b/migrations/300200_transfer.js index 84c4b9144..2dbf3bbe4 100644 --- a/migrations/300200_transfer.js +++ b/migrations/300200_transfer.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/300201_transfer-indexes.js b/migrations/300201_transfer-indexes.js index 463a6a54a..9a938c5a0 100644 --- a/migrations/300201_transfer-indexes.js +++ b/migrations/300201_transfer-indexes.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/300202_transfer-decimal184.js b/migrations/300202_transfer-decimal184.js index db1577afd..283af64b5 100644 --- a/migrations/300202_transfer-decimal184.js +++ b/migrations/300202_transfer-decimal184.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/300250_bulkTransfer.js b/migrations/300250_bulkTransfer.js index 0ed82888f..8131fe017 100644 --- a/migrations/300250_bulkTransfer.js +++ b/migrations/300250_bulkTransfer.js @@ -19,7 +19,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/300251_bulkTransfer-indexes.js b/migrations/300251_bulkTransfer-indexes.js index 5d9e213ca..c43d62729 100644 --- a/migrations/300251_bulkTransfer-indexes.js +++ b/migrations/300251_bulkTransfer-indexes.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/300275_bulkTransferAssociation.js b/migrations/300275_bulkTransferAssociation.js index 377e81b28..70807d5bd 100644 --- a/migrations/300275_bulkTransferAssociation.js +++ b/migrations/300275_bulkTransferAssociation.js @@ -19,7 +19,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/300276_bulkTransferAssociation-indexes.js b/migrations/300276_bulkTransferAssociation-indexes.js index 8bb5b5ba6..71d2b9be6 100644 --- a/migrations/300276_bulkTransferAssociation-indexes.js +++ b/migrations/300276_bulkTransferAssociation-indexes.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/300300_ilpPacket.js b/migrations/300300_ilpPacket.js index 9a1951ad5..36d18a790 100644 --- a/migrations/300300_ilpPacket.js +++ b/migrations/300300_ilpPacket.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/300400_transferStateChange.js b/migrations/300400_transferStateChange.js index 352117a37..58bebb820 100644 --- a/migrations/300400_transferStateChange.js +++ b/migrations/300400_transferStateChange.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/300401_transferStateChange-indexes.js b/migrations/300401_transferStateChange-indexes.js index 9d1e616aa..1f9a077c9 100644 --- a/migrations/300401_transferStateChange-indexes.js +++ b/migrations/300401_transferStateChange-indexes.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/300450_bulkTransferStateChange.js b/migrations/300450_bulkTransferStateChange.js index 553175522..424711b8d 100644 --- a/migrations/300450_bulkTransferStateChange.js +++ b/migrations/300450_bulkTransferStateChange.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/300451_bulkTransferStateChange-indexes.js b/migrations/300451_bulkTransferStateChange-indexes.js index 691851cf1..d6590d444 100644 --- a/migrations/300451_bulkTransferStateChange-indexes.js +++ b/migrations/300451_bulkTransferStateChange-indexes.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/300500_segment.js b/migrations/300500_segment.js index deedd800f..0d5a3ba81 100644 --- a/migrations/300500_segment.js +++ b/migrations/300500_segment.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/300501_segment-indexes.js b/migrations/300501_segment-indexes.js index bc7ba4b10..73241efda 100644 --- a/migrations/300501_segment-indexes.js +++ b/migrations/300501_segment-indexes.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/310100_participantCurrency.js b/migrations/310100_participantCurrency.js index d47494645..ed557a95c 100644 --- a/migrations/310100_participantCurrency.js +++ b/migrations/310100_participantCurrency.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/310101_participantCurrency-indexes.js b/migrations/310101_participantCurrency-indexes.js index a964e6b07..1276b2a9c 100644 --- a/migrations/310101_participantCurrency-indexes.js +++ b/migrations/310101_participantCurrency-indexes.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/310200_transferParticipant.js b/migrations/310200_transferParticipant.js index b9145eebd..ea1641112 100644 --- a/migrations/310200_transferParticipant.js +++ b/migrations/310200_transferParticipant.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/310201_transferParticipant-indexes.js b/migrations/310201_transferParticipant-indexes.js index ea0c20303..a7d4ea532 100644 --- a/migrations/310201_transferParticipant-indexes.js +++ b/migrations/310201_transferParticipant-indexes.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/310202_transferParticipant-decimal184.js b/migrations/310202_transferParticipant-decimal184.js index 14782d1f7..eb7c30144 100644 --- a/migrations/310202_transferParticipant-decimal184.js +++ b/migrations/310202_transferParticipant-decimal184.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/310300_participantPosition.js b/migrations/310300_participantPosition.js index 3f7c00535..5521fce1b 100644 --- a/migrations/310300_participantPosition.js +++ b/migrations/310300_participantPosition.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/310301_participantPosition-indexes.js b/migrations/310301_participantPosition-indexes.js index eba935849..4c69c22f0 100644 --- a/migrations/310301_participantPosition-indexes.js +++ b/migrations/310301_participantPosition-indexes.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/310302_participantPosition-decimal184.js b/migrations/310302_participantPosition-decimal184.js index a9e19dd5c..3d2d14a5d 100644 --- a/migrations/310302_participantPosition-decimal184.js +++ b/migrations/310302_participantPosition-decimal184.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/310400_participantPositionChange.js b/migrations/310400_participantPositionChange.js index fefff189d..3e6f31c6d 100644 --- a/migrations/310400_participantPositionChange.js +++ b/migrations/310400_participantPositionChange.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/310401_participantPositionChange-indexes.js b/migrations/310401_participantPositionChange-indexes.js index 069c8824c..8acd89ecd 100644 --- a/migrations/310401_participantPositionChange-indexes.js +++ b/migrations/310401_participantPositionChange-indexes.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/310402_participantPositionChange-decimal184.js b/migrations/310402_participantPositionChange-decimal184.js index eaf53244d..1977bb15b 100644 --- a/migrations/310402_participantPositionChange-decimal184.js +++ b/migrations/310402_participantPositionChange-decimal184.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/310500_participantLimit.js b/migrations/310500_participantLimit.js index 62d9a92aa..cc20a208b 100644 --- a/migrations/310500_participantLimit.js +++ b/migrations/310500_participantLimit.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/310501_participantLimit-indexes.js b/migrations/310501_participantLimit-indexes.js index 2f1d9ece9..6bd67f94e 100644 --- a/migrations/310501_participantLimit-indexes.js +++ b/migrations/310501_participantLimit-indexes.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/310502_participantLimit-decimal184.js b/migrations/310502_participantLimit-decimal184.js index d8e32dd96..dc2853489 100644 --- a/migrations/310502_participantLimit-decimal184.js +++ b/migrations/310502_participantLimit-decimal184.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/400100_settlementWindow.js b/migrations/400100_settlementWindow.js index 7914ab578..547b40467 100644 --- a/migrations/400100_settlementWindow.js +++ b/migrations/400100_settlementWindow.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/400200_settlement.js b/migrations/400200_settlement.js index ba4286a44..09ac3bb19 100644 --- a/migrations/400200_settlement.js +++ b/migrations/400200_settlement.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/400300_settlementSettlementWindow.js b/migrations/400300_settlementSettlementWindow.js index abd948791..30664c865 100644 --- a/migrations/400300_settlementSettlementWindow.js +++ b/migrations/400300_settlementSettlementWindow.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/400301_settlementSettlementWindow-indexes.js b/migrations/400301_settlementSettlementWindow-indexes.js index 3d57d5219..cabee0d0e 100644 --- a/migrations/400301_settlementSettlementWindow-indexes.js +++ b/migrations/400301_settlementSettlementWindow-indexes.js @@ -19,7 +19,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/400400_settlementWindowStateChange.js b/migrations/400400_settlementWindowStateChange.js index c87f38e21..42463454f 100644 --- a/migrations/400400_settlementWindowStateChange.js +++ b/migrations/400400_settlementWindowStateChange.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/400401_settlmentWindowStateChange-indexes.js b/migrations/400401_settlementWindowStateChange-indexes.js similarity index 96% rename from migrations/400401_settlmentWindowStateChange-indexes.js rename to migrations/400401_settlementWindowStateChange-indexes.js index af00c222b..283840d52 100644 --- a/migrations/400401_settlmentWindowStateChange-indexes.js +++ b/migrations/400401_settlementWindowStateChange-indexes.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/400500_settlementTransferParticipant.js b/migrations/400500_settlementTransferParticipant.js index 2cee29da8..dd0fe6194 100644 --- a/migrations/400500_settlementTransferParticipant.js +++ b/migrations/400500_settlementTransferParticipant.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/400501_settlementTransferParticipant-indexes.js b/migrations/400501_settlementTransferParticipant-indexes.js index 948be36cc..3e72e723a 100644 --- a/migrations/400501_settlementTransferParticipant-indexes.js +++ b/migrations/400501_settlementTransferParticipant-indexes.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/400502_settlementTransferParticipant-decimal184.js b/migrations/400502_settlementTransferParticipant-decimal184.js index 670021ccf..ba475d451 100644 --- a/migrations/400502_settlementTransferParticipant-decimal184.js +++ b/migrations/400502_settlementTransferParticipant-decimal184.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/400600_settlementParticipantCurrency.js b/migrations/400600_settlementParticipantCurrency.js index e8d4e1a49..b8b32c4ae 100644 --- a/migrations/400600_settlementParticipantCurrency.js +++ b/migrations/400600_settlementParticipantCurrency.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/400601_settlementParticipantCurrency-indexes.js b/migrations/400601_settlementParticipantCurrency-indexes.js index ddfdc78d9..0180ca412 100644 --- a/migrations/400601_settlementParticipantCurrency-indexes.js +++ b/migrations/400601_settlementParticipantCurrency-indexes.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/400602_settlementParticipantCurrency-decimal184.js b/migrations/400602_settlementParticipantCurrency-decimal184.js index 45ae7bbb1..3bd7690c7 100644 --- a/migrations/400602_settlementParticipantCurrency-decimal184.js +++ b/migrations/400602_settlementParticipantCurrency-decimal184.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/400700_settlementParticipantCurrencyStateChange.js b/migrations/400700_settlementParticipantCurrencyStateChange.js index c48c4409e..0fb7d7ff9 100644 --- a/migrations/400700_settlementParticipantCurrencyStateChange.js +++ b/migrations/400700_settlementParticipantCurrencyStateChange.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/400701_settlementParticipantCurrencyStateChange-indexes.js b/migrations/400701_settlementParticipantCurrencyStateChange-indexes.js index 764d7c95a..075e37d93 100644 --- a/migrations/400701_settlementParticipantCurrencyStateChange-indexes.js +++ b/migrations/400701_settlementParticipantCurrencyStateChange-indexes.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/400800_settlementStateChange.js b/migrations/400800_settlementStateChange.js index b1170ba74..92d4da88e 100644 --- a/migrations/400800_settlementStateChange.js +++ b/migrations/400800_settlementStateChange.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/400801_settlementStateChange-indexes.js b/migrations/400801_settlementStateChange-indexes.js index f495234f2..502f2181c 100644 --- a/migrations/400801_settlementStateChange-indexes.js +++ b/migrations/400801_settlementStateChange-indexes.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/400900_settlementWindowContent.js b/migrations/400900_settlementWindowContent.js new file mode 100644 index 000000000..d55dc1ec0 --- /dev/null +++ b/migrations/400900_settlementWindowContent.js @@ -0,0 +1,50 @@ +/***** + License + -------------- + Copyright © 2017 Bill & Melinda Gates Foundation + 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 + http://www.apache.org/licenses/LICENSE-2.0 + 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. + Contributors + -------------- + This is the official list of the Mojaloop project contributors for this file. + Names of the original copyright holders (individuals or organizations) + should be listed with a '*' in the first column. People who have + contributed from an organization can be listed under the organization + that actually holds the copyright for their contributions (see the + Gates Foundation organization for an example). Those individuals should have + their names indented and be marked with a '-'. Email address can be added + optionally within square brackets . + * Gates Foundation + - Name Surname + + * ModusBox + - Georgi Georgiev + -------------- + ******/ + +'use strict' + +exports.up = async (knex, Promise) => { + return await knex.schema.hasTable('settlementWindowContent').then(function(exists) { + if (!exists) { + return knex.schema.createTable('settlementWindowContent', (t) => { + t.bigIncrements('settlementWindowContentId').primary().notNullable() + t.bigInteger('settlementWindowId').unsigned().notNullable() + t.foreign('settlementWindowId').references('settlementWindowId').inTable('settlementWindow') + t.integer('ledgerAccountTypeId').unsigned().notNullable() + t.foreign('ledgerAccountTypeId').references('ledgerAccountTypeId').inTable('ledgerAccountType') + t.string('currencyId', 3).notNullable() + t.foreign('currencyId').references('currencyId').inTable('currency') + t.dateTime('createdDate').defaultTo(knex.fn.now()).notNullable() + t.bigInteger('currentStateChangeId').unsigned().nullable() + t.bigInteger('settlementId').unsigned() + t.foreign('settlementId').references('settlementId').inTable('settlement') + }) + } + }) +} + +exports.down = function (knex, Promise) { + return knex.schema.dropTableIfExists('settlementWindowContent') +} diff --git a/migrations/401000_settlementWindowContentStateChange.js b/migrations/401000_settlementWindowContentStateChange.js new file mode 100644 index 000000000..99af8e3c3 --- /dev/null +++ b/migrations/401000_settlementWindowContentStateChange.js @@ -0,0 +1,46 @@ +/***** + License + -------------- + Copyright © 2017 Bill & Melinda Gates Foundation + 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 + http://www.apache.org/licenses/LICENSE-2.0 + 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. + Contributors + -------------- + This is the official list of the Mojaloop project contributors for this file. + Names of the original copyright holders (individuals or organizations) + should be listed with a '*' in the first column. People who have + contributed from an organization can be listed under the organization + that actually holds the copyright for their contributions (see the + Gates Foundation organization for an example). Those individuals should have + their names indented and be marked with a '-'. Email address can be added + optionally within square brackets . + * Gates Foundation + - Name Surname + + * ModusBox + - Georgi Georgiev + -------------- + ******/ + +'use strict' + +exports.up = async (knex, Promise) => { + return await knex.schema.hasTable('settlementWindowContentStateChange').then(function(exists) { + if (!exists) { + return knex.schema.createTable('settlementWindowContentStateChange', (t) => { + t.bigIncrements('settlementWindowContentStateChangeId').primary().notNullable() + t.bigInteger('settlementWindowContentId').unsigned().notNullable() + t.foreign('settlementWindowContentId', 'swc_settlementwindowcontentid_foreign').references('settlementWindowContentId').inTable('settlementWindowContent') + t.string('settlementWindowStateId', 50).notNullable() + t.foreign('settlementWindowStateId', 'sws1_settlementwindowstateid_foreign').references('settlementWindowStateId').inTable('settlementWindowState') + t.string('reason', 512).defaultTo(null).nullable() + t.dateTime('createdDate').defaultTo(knex.fn.now()).notNullable() + }) + } + }) +} + +exports.down = function (knex, Promise) { + return knex.schema.dropTableIfExists('settlementWindowContentStateChange') +} diff --git a/migrations/401001_settlementWindowContentStateChange-indexes.js b/migrations/401001_settlementWindowContentStateChange-indexes.js new file mode 100644 index 000000000..fd46206d8 --- /dev/null +++ b/migrations/401001_settlementWindowContentStateChange-indexes.js @@ -0,0 +1,46 @@ +/***** + License + -------------- + Copyright © 2017 Bill & Melinda Gates Foundation + 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 + http://www.apache.org/licenses/LICENSE-2.0 + 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. + Contributors + -------------- + This is the official list of the Mojaloop project contributors for this file. + Names of the original copyright holders (individuals or organizations) + should be listed with a '*' in the first column. People who have + contributed from an organization can be listed under the organization + that actually holds the copyright for their contributions (see the + Gates Foundation organization for an example). Those individuals should have + their names indented and be marked with a '-'. Email address can be added + optionally within square brackets . + * Gates Foundation + - Name Surname + + * ModusBox + - Georgi Georgiev + -------------- + ******/ + +'use strict' + +exports.up = function (knex, Promise) { + return knex.schema.table('settlementWindowContentStateChange', (t) => { + t.index('settlementWindowContentId', 'swcsc_settlementwindowcontentid_index') + t.index('settlementWindowStateId', 'swcsc_settlementwindowstateid_index') + }) + .table('settlementWindowContent', (t) => { + t.foreign('currentStateChangeId').references('settlementWindowContentStateChange.settlementWindowContentStateChangeId') + }) +} + +exports.down = function (knex, Promise) { + return knex.schema.table('settlementWindowContentStateChange', (t) => { + t.dropIndex('settlementWindowContentId', 'swcsc_settlementwindowcontentid_index') + t.dropIndex('settlementWindowStateId', 'swcsc_settlementwindowstateid_index') + }) + .table('settlementWindowContent', (t) => { + t.dropForeign('currentStateChangeId') + }) +} diff --git a/migrations/401002_settlementWindowContent-indexes.js b/migrations/401002_settlementWindowContent-indexes.js new file mode 100644 index 000000000..122db29fa --- /dev/null +++ b/migrations/401002_settlementWindowContent-indexes.js @@ -0,0 +1,46 @@ +/***** + License + -------------- + Copyright © 2017 Bill & Melinda Gates Foundation + 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 + http://www.apache.org/licenses/LICENSE-2.0 + 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. + Contributors + -------------- + This is the official list of the Mojaloop project contributors for this file. + Names of the original copyright holders (individuals or organizations) + should be listed with a '*' in the first column. People who have + contributed from an organization can be listed under the organization + that actually holds the copyright for their contributions (see the + Gates Foundation organization for an example). Those individuals should have + their names indented and be marked with a '-'. Email address can be added + optionally within square brackets . + * Gates Foundation + - Name Surname + + * ModusBox + - Georgi Georgiev + -------------- + ******/ + +'use strict' + +exports.up = function (knex, Promise) { + return knex.schema.table('settlementWindowContent', (t) => { + t.index('settlementWindowId') + t.index('ledgerAccountTypeId') + t.index('currencyId') + t.index('currentStateChangeId') + t.index('settlementId') + }) +} + +exports.down = function (knex, Promise) { + return knex.schema.table('settlementWindowContent', (t) => { + t.dropIndex('settlementWindowId') + t.dropIndex('ledgerAccountTypeId') + t.dropIndex('currencyId') + t.dropIndex('currentStateChangeId') + t.dropIndex('settlementId') + }) +} diff --git a/migrations/401200_settlementContentAggregation.js b/migrations/401200_settlementContentAggregation.js new file mode 100644 index 000000000..027cfd31a --- /dev/null +++ b/migrations/401200_settlementContentAggregation.js @@ -0,0 +1,54 @@ +/***** + License + -------------- + Copyright © 2017 Bill & Melinda Gates Foundation + 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 + http://www.apache.org/licenses/LICENSE-2.0 + 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. + Contributors + -------------- + This is the official list of the Mojaloop project contributors for this file. + Names of the original copyright holders (individuals or organizations) + should be listed with a '*' in the first column. People who have + contributed from an organization can be listed under the organization + that actually holds the copyright for their contributions (see the + Gates Foundation organization for an example). Those individuals should have + their names indented and be marked with a '-'. Email address can be added + optionally within square brackets . + * Gates Foundation + - Name Surname + + * ModusBox + - Georgi Georgiev + -------------- + ******/ + +'use strict' + +exports.up = async (knex, Promise) => { + return await knex.schema.hasTable('settlementContentAggregation').then(function(exists) { + if (!exists) { + return knex.schema.createTable('settlementContentAggregation', (t) => { + t.bigIncrements('settlementContentAggregationId').primary().notNullable() + t.bigInteger('settlementWindowContentId').unsigned().notNullable() + t.foreign('settlementWindowContentId').references('settlementWindowContentId').inTable('settlementWindowContent') + t.integer('participantCurrencyId').unsigned().notNullable() + t.foreign('participantCurrencyId').references('participantCurrencyId').inTable('participantCurrency') + t.integer('transferParticipantRoleTypeId').unsigned().notNullable() + t.foreign('transferParticipantRoleTypeId', 'sca_transferparticipantroletypeid_foreign').references('transferParticipantRoleTypeId').inTable('transferParticipantRoleType') + t.integer('ledgerEntryTypeId').unsigned().notNullable() + t.foreign('ledgerEntryTypeId').references('ledgerEntryTypeId').inTable('ledgerEntryType') + t.decimal('amount', 18, 2).notNullable() + t.dateTime('createdDate').defaultTo(knex.fn.now()).notNullable() + t.string('currentStateId', 50).notNullable() + t.foreign('currentStateId').references('settlementWindowStateId').inTable('settlementWindowState') + t.bigInteger('settlementId').unsigned() + t.foreign('settlementId').references('settlementId').inTable('settlement') + }) + } + }) +} + +exports.down = function (knex, Promise) { + return knex.schema.dropTableIfExists('settlementContentAggregation') +} diff --git a/migrations/401201_settlementContentAggregation-indexes.js b/migrations/401201_settlementContentAggregation-indexes.js new file mode 100644 index 000000000..a2a620d8d --- /dev/null +++ b/migrations/401201_settlementContentAggregation-indexes.js @@ -0,0 +1,48 @@ +/***** + License + -------------- + Copyright © 2017 Bill & Melinda Gates Foundation + 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 + http://www.apache.org/licenses/LICENSE-2.0 + 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. + Contributors + -------------- + This is the official list of the Mojaloop project contributors for this file. + Names of the original copyright holders (individuals or organizations) + should be listed with a '*' in the first column. People who have + contributed from an organization can be listed under the organization + that actually holds the copyright for their contributions (see the + Gates Foundation organization for an example). Those individuals should have + their names indented and be marked with a '-'. Email address can be added + optionally within square brackets . + * Gates Foundation + - Name Surname + + * ModusBox + - Georgi Georgiev + -------------- + ******/ + +'use strict' + +exports.up = function (knex, Promise) { + return knex.schema.table('settlementContentAggregation', (t) => { + t.index('settlementWindowContentId') + t.index('participantCurrencyId') + t.index('transferParticipantRoleTypeId') + t.index('ledgerEntryTypeId') + t.index('currentStateId') + t.index('settlementId') + }) +} + +exports.down = function (knex, Promise) { + return knex.schema.table('settlementContentAggregation', (t) => { + t.dropIndex('settlementWindowContentId') + t.dropIndex('participantCurrencyId') + t.dropIndex('transferParticipantRoleTypeId') + t.dropIndex('ledgerEntryTypeId') + t.dropIndex('currentStateId') + t.dropIndex('settlementId') + }) +} diff --git a/migrations/401300_settlementModel.js b/migrations/401300_settlementModel.js new file mode 100644 index 000000000..2d9e53960 --- /dev/null +++ b/migrations/401300_settlementModel.js @@ -0,0 +1,54 @@ +/***** + License + -------------- + Copyright © 2017 Bill & Melinda Gates Foundation + 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 + http://www.apache.org/licenses/LICENSE-2.0 + 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. + Contributors + -------------- + This is the official list of the Mojaloop project contributors for this file. + Names of the original copyright holders (individuals or organizations) + should be listed with a '*' in the first column. People who have + contributed from an organization can be listed under the organization + that actually holds the copyright for their contributions (see the + Gates Foundation organization for an example). Those individuals should have + their names indented and be marked with a '-'. Email address can be added + optionally within square brackets . + * Gates Foundation + - Name Surname + + * ModusBox + - Georgi Georgiev + -------------- + ******/ + +'use strict' + +exports.up = async (knex, Promise) => { + return await knex.schema.hasTable('settlementModel').then(function(exists) { + if (!exists) { + return knex.schema.createTable('settlementModel', (t) => { + t.increments('settlementModelId').primary().notNullable() + t.string('name', 50).notNullable() + t.boolean('isActive').defaultTo(true).notNullable() + t.integer('settlementGranularityId').unsigned().notNullable() + t.foreign('settlementGranularityId').references('settlementGranularityId').inTable('settlementGranularity') + t.integer('settlementInterchangeId').unsigned().notNullable() + t.foreign('settlementInterchangeId').references('settlementInterchangeId').inTable('settlementInterchange') + t.integer('settlementDelayId').unsigned().notNullable() + t.foreign('settlementDelayId').references('settlementDelayId').inTable('settlementDelay') + t.string('currencyId', 3).nullable() + t.foreign('currencyId').references('currencyId').inTable('currency') + t.boolean('requireLiquidityCheck').defaultTo(true).notNullable() + t.integer('ledgerAccountTypeId').unsigned().notNullable() + t.foreign('ledgerAccountTypeId').references('ledgerAccountTypeId').inTable('ledgerAccountType') + t.boolean('autoPositionReset').defaultTo(false).notNullable() + }) + } + }) +} + +exports.down = function (knex, Promise) { + return knex.schema.dropTableIfExists('settlementModel') +} diff --git a/migrations/401301_settlementModel-indexes.js b/migrations/401301_settlementModel-indexes.js new file mode 100644 index 000000000..5a7ee1233 --- /dev/null +++ b/migrations/401301_settlementModel-indexes.js @@ -0,0 +1,50 @@ +/***** + License + -------------- + Copyright © 2017 Bill & Melinda Gates Foundation + 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 + http://www.apache.org/licenses/LICENSE-2.0 + 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. + Contributors + -------------- + This is the official list of the Mojaloop project contributors for this file. + Names of the original copyright holders (individuals or organizations) + should be listed with a '*' in the first column. People who have + contributed from an organization can be listed under the organization + that actually holds the copyright for their contributions (see the + Gates Foundation organization for an example). Those individuals should have + their names indented and be marked with a '-'. Email address can be added + optionally within square brackets . + * Gates Foundation + - Name Surname + + * ModusBox + - Georgi Georgiev + -------------- + ******/ + +'use strict' + +exports.up = function (knex, Promise) { + return knex.schema.table('settlementModel', (t) => { + t.unique('name') + t.unique(['settlementGranularityId', 'settlementInterchangeId', 'settlementDelayId', 'ledgerAccountTypeId', 'currencyId'], 'settlementmodel_unique') + t.index('settlementGranularityId') + t.index('settlementInterchangeId') + t.index('settlementDelayId') + t.index('currencyId') + t.index('ledgerAccountTypeId') + }) +} + +exports.down = function (knex, Promise) { + return knex.schema.table('settlementModel', (t) => { + t.dropUnique('name') + t.dropUnique(['settlementGranularityId', 'settlementInterchangeId', 'settlementDelayId', 'ledgerAccountTypeId', 'currencyId'], 'settlementmodel_unique') + t.dropIndex('settlementGranularityId') + t.dropIndex('settlementInterchangeId') + t.dropIndex('settlementDelayId') + t.dropIndex('currencyId') + t.dropIndex('ledgerAccountTypeId') + }) +} diff --git a/migrations/410100_transferFulfilmentDuplicateCheck.js b/migrations/410100_transferFulfilmentDuplicateCheck.js index 32c729dcf..29960f6f1 100644 --- a/migrations/410100_transferFulfilmentDuplicateCheck.js +++ b/migrations/410100_transferFulfilmentDuplicateCheck.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/410101_transferFulfilmentDuplicateCheck-indexes.js b/migrations/410101_transferFulfilmentDuplicateCheck-indexes.js index 1f2302386..822d255fd 100644 --- a/migrations/410101_transferFulfilmentDuplicateCheck-indexes.js +++ b/migrations/410101_transferFulfilmentDuplicateCheck-indexes.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/410102_transferFulfilmentDuplicateCheck-dropForeignTransferId.js b/migrations/410102_transferFulfilmentDuplicateCheck-dropForeignTransferId.js index b858a0fbe..e9639575a 100644 --- a/migrations/410102_transferFulfilmentDuplicateCheck-dropForeignTransferId.js +++ b/migrations/410102_transferFulfilmentDuplicateCheck-dropForeignTransferId.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/410103_transferFulfilmentDuplicateCheck-hashNullable.js b/migrations/410103_transferFulfilmentDuplicateCheck-hashNullable.js index 474bba6f0..07937e3c2 100644 --- a/migrations/410103_transferFulfilmentDuplicateCheck-hashNullable.js +++ b/migrations/410103_transferFulfilmentDuplicateCheck-hashNullable.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/410200_transferFulfilment.js b/migrations/410200_transferFulfilment.js index 70fda080c..a9ef3469a 100644 --- a/migrations/410200_transferFulfilment.js +++ b/migrations/410200_transferFulfilment.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/410201_transferFulfilment-indexes.js b/migrations/410201_transferFulfilment-indexes.js index 809f6cdf8..69c6a1a05 100644 --- a/migrations/410201_transferFulfilment-indexes.js +++ b/migrations/410201_transferFulfilment-indexes.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/410202_transferFulfilment-ilpFulfilment.js b/migrations/410202_transferFulfilment-ilpFulfilment.js index 5dd17cfc8..f5dc8ea93 100644 --- a/migrations/410202_transferFulfilment-ilpFulfilment.js +++ b/migrations/410202_transferFulfilment-ilpFulfilment.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/410203_transferFulfilment-foreignTransferFulfilmentId.js b/migrations/410203_transferFulfilment-foreignTransferFulfilmentId.js index 99110369c..d74ff7bfc 100644 --- a/migrations/410203_transferFulfilment-foreignTransferFulfilmentId.js +++ b/migrations/410203_transferFulfilment-foreignTransferFulfilmentId.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/410240_bulkTransferFulfilmentDuplicateCheck.js b/migrations/410240_bulkTransferFulfilmentDuplicateCheck.js index b16fe9a7e..6eb9b72f1 100644 --- a/migrations/410240_bulkTransferFulfilmentDuplicateCheck.js +++ b/migrations/410240_bulkTransferFulfilmentDuplicateCheck.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/410250_bulkTransferFulfilment.js b/migrations/410250_bulkTransferFulfilment.js index 9f36adee5..7c7807fe4 100644 --- a/migrations/410250_bulkTransferFulfilment.js +++ b/migrations/410250_bulkTransferFulfilment.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/410300_transferExtension.js b/migrations/410300_transferExtension.js index 96e1d7e2a..8e49e8224 100644 --- a/migrations/410300_transferExtension.js +++ b/migrations/410300_transferExtension.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/410301_transferExtension-indexes.js b/migrations/410301_transferExtension-indexes.js index 29db0cbef..3f0ab5788 100644 --- a/migrations/410301_transferExtension-indexes.js +++ b/migrations/410301_transferExtension-indexes.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/410302_transferExtension-transferErrorId.js b/migrations/410302_transferExtension-transferErrorId.js index 03feec2aa..898c787d4 100644 --- a/migrations/410302_transferExtension-transferErrorId.js +++ b/migrations/410302_transferExtension-transferErrorId.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/410350_bulkTransferExtension.js b/migrations/410350_bulkTransferExtension.js index 378ac1226..751127c79 100644 --- a/migrations/410350_bulkTransferExtension.js +++ b/migrations/410350_bulkTransferExtension.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/410351_bulkTransferExtension-indexes.js b/migrations/410351_bulkTransferExtension-indexes.js index 74c0e7cad..6237f5dea 100644 --- a/migrations/410351_bulkTransferExtension-indexes.js +++ b/migrations/410351_bulkTransferExtension-indexes.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/410400_transferTimeout.js b/migrations/410400_transferTimeout.js index 0677a767e..8db21c1e2 100644 --- a/migrations/410400_transferTimeout.js +++ b/migrations/410400_transferTimeout.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/410401_transferTimeout-indexes.js b/migrations/410401_transferTimeout-indexes.js index 07333acbe..ecfb5344b 100644 --- a/migrations/410401_transferTimeout-indexes.js +++ b/migrations/410401_transferTimeout-indexes.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/410450_transferErrorDuplicateCheck.js b/migrations/410450_transferErrorDuplicateCheck.js index 49f669471..99b4adf12 100644 --- a/migrations/410450_transferErrorDuplicateCheck.js +++ b/migrations/410450_transferErrorDuplicateCheck.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/410500_transferError.js b/migrations/410500_transferError.js index 5db1ea785..a14fa3492 100644 --- a/migrations/410500_transferError.js +++ b/migrations/410500_transferError.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/410501_transferError-indexes.js b/migrations/410501_transferError-indexes.js index a20757211..9c202732d 100644 --- a/migrations/410501_transferError-indexes.js +++ b/migrations/410501_transferError-indexes.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/410502_transferError-foreignTransferErrorDuplicateCheckId.js b/migrations/410502_transferError-foreignTransferErrorDuplicateCheckId.js index 6c891eb4f..5f6d83518 100644 --- a/migrations/410502_transferError-foreignTransferErrorDuplicateCheckId.js +++ b/migrations/410502_transferError-foreignTransferErrorDuplicateCheckId.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/410550_bulkTransferError.js b/migrations/410550_bulkTransferError.js index 9ed7637b3..65fca0536 100644 --- a/migrations/410550_bulkTransferError.js +++ b/migrations/410550_bulkTransferError.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/410551_bulkTransferError-indexes.js b/migrations/410551_bulkTransferError-indexes.js index 1ffc7da06..b6c87feb0 100644 --- a/migrations/410551_bulkTransferError-indexes.js +++ b/migrations/410551_bulkTransferError-indexes.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/500100_transactionReference.js b/migrations/500100_transactionReference.js index cfeab9e06..31e111d2c 100644 --- a/migrations/500100_transactionReference.js +++ b/migrations/500100_transactionReference.js @@ -24,7 +24,8 @@ Contributors * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/500101_transactionReference-indexes.js b/migrations/500101_transactionReference-indexes.js index eb8651cc0..37a0bb31c 100644 --- a/migrations/500101_transactionReference-indexes.js +++ b/migrations/500101_transactionReference-indexes.js @@ -24,7 +24,8 @@ Contributors * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/500200_transactionScenario.js b/migrations/500200_transactionScenario.js index 616f50023..7f14ba229 100644 --- a/migrations/500200_transactionScenario.js +++ b/migrations/500200_transactionScenario.js @@ -24,7 +24,8 @@ Contributors * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/500201_transactionScenario-indexes.js b/migrations/500201_transactionScenario-indexes.js index 8f1880f54..d8d2f3680 100644 --- a/migrations/500201_transactionScenario-indexes.js +++ b/migrations/500201_transactionScenario-indexes.js @@ -24,7 +24,8 @@ Contributors * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/500300_transactionSubScenario.js b/migrations/500300_transactionSubScenario.js index 166f2042d..9076806e8 100644 --- a/migrations/500300_transactionSubScenario.js +++ b/migrations/500300_transactionSubScenario.js @@ -24,7 +24,8 @@ Contributors * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/500400_quote.js b/migrations/500400_quote.js index acb6012ee..e4a1f716d 100644 --- a/migrations/500400_quote.js +++ b/migrations/500400_quote.js @@ -24,7 +24,8 @@ Contributors * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/500500_quoteParty.js b/migrations/500500_quoteParty.js index a0315ca15..9ce769ad9 100644 --- a/migrations/500500_quoteParty.js +++ b/migrations/500500_quoteParty.js @@ -24,7 +24,8 @@ Contributors * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/500600_party.js b/migrations/500600_party.js index 65f250c78..2516ae4b5 100644 --- a/migrations/500600_party.js +++ b/migrations/500600_party.js @@ -24,7 +24,8 @@ Contributors * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/500700_quoteResponse.js b/migrations/500700_quoteResponse.js index 397e748c2..dd7fd9718 100644 --- a/migrations/500700_quoteResponse.js +++ b/migrations/500700_quoteResponse.js @@ -24,7 +24,8 @@ Contributors * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/500800_quoteResponseIlpPacket.js b/migrations/500800_quoteResponseIlpPacket.js index 280f55645..5b44455ac 100644 --- a/migrations/500800_quoteResponseIlpPacket.js +++ b/migrations/500800_quoteResponseIlpPacket.js @@ -24,7 +24,8 @@ Contributors * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/500900_geoCode.js b/migrations/500900_geoCode.js index 0be60adc4..a4097c445 100644 --- a/migrations/500900_geoCode.js +++ b/migrations/500900_geoCode.js @@ -24,7 +24,8 @@ Contributors * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/501000_quoteExtension.js b/migrations/501000_quoteExtension.js index 1bc9f0e0c..366d2cf12 100644 --- a/migrations/501000_quoteExtension.js +++ b/migrations/501000_quoteExtension.js @@ -24,7 +24,8 @@ Contributors * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/501100_quoteResponseDuplicateCheck.js b/migrations/501100_quoteResponseDuplicateCheck.js index 04270da0b..be7e21e07 100644 --- a/migrations/501100_quoteResponseDuplicateCheck.js +++ b/migrations/501100_quoteResponseDuplicateCheck.js @@ -24,7 +24,8 @@ Contributors * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/501200_quoteError.js b/migrations/501200_quoteError.js index 93a8ae716..847cb7636 100644 --- a/migrations/501200_quoteError.js +++ b/migrations/501200_quoteError.js @@ -24,7 +24,8 @@ Contributors * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/501300_transferRules.js b/migrations/501300_transferRules.js index a30dcf92f..42954011e 100644 --- a/migrations/501300_transferRules.js +++ b/migrations/501300_transferRules.js @@ -24,7 +24,8 @@ Contributors * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/800100_quotePartyView.js b/migrations/800100_quotePartyView.js index 38bfa9194..9027942a0 100644 --- a/migrations/800100_quotePartyView.js +++ b/migrations/800100_quotePartyView.js @@ -24,7 +24,8 @@ Contributors * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/800200_quoteView.js b/migrations/800200_quoteView.js index a1e99d982..ca1b9c8da 100644 --- a/migrations/800200_quoteView.js +++ b/migrations/800200_quoteView.js @@ -24,7 +24,8 @@ Contributors * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/800300_quoteResponseView.js b/migrations/800300_quoteResponseView.js index 0e92c8e83..d1c4a1ec8 100644 --- a/migrations/800300_quoteResponseView.js +++ b/migrations/800300_quoteResponseView.js @@ -24,7 +24,8 @@ Contributors * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/900100_foreign-keys.js b/migrations/900100_foreign-keys.js index 76fe6133d..dd39c9f55 100644 --- a/migrations/900100_foreign-keys.js +++ b/migrations/900100_foreign-keys.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/900101_foreign-keys.js b/migrations/900101_foreign-keys.js index cb139dd23..56b324a54 100644 --- a/migrations/900101_foreign-keys.js +++ b/migrations/900101_foreign-keys.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/910100_feature904DDL.js b/migrations/910100_feature904DDL.js index 975ddec5a..96752833f 100644 --- a/migrations/910100_feature904DDL.js +++ b/migrations/910100_feature904DDL.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/910101_feature904DataMigration.js b/migrations/910101_feature904DataMigration.js index dcaacf4ac..e798759e1 100644 --- a/migrations/910101_feature904DataMigration.js +++ b/migrations/910101_feature904DataMigration.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/910102_feature949DataMigration.js b/migrations/910102_feature949DataMigration.js index d778e2a2e..30bc7dee4 100644 --- a/migrations/910102_feature949DataMigration.js +++ b/migrations/910102_feature949DataMigration.js @@ -18,7 +18,8 @@ * Gates Foundation - Name Surname - * Georgi Georgiev + * ModusBox + - Georgi Georgiev -------------- ******/ diff --git a/migrations/910102_hotfix954.js b/migrations/910102_hotfix954.js index 1def80ee0..b6d593883 100644 --- a/migrations/910102_hotfix954.js +++ b/migrations/910102_hotfix954.js @@ -25,33 +25,7 @@ 'use strict' -/***** - License - -------------- - Copyright © 2017 Bill & Melinda Gates Foundation - 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 - http://www.apache.org/licenses/LICENSE-2.0 - 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. - Contributors - -------------- - This is the official list of the Mojaloop project contributors for this file. - Names of the original copyright holders (individuals or organizations) - should be listed with a '*' in the first column. People who have - contributed from an organization can be listed under the organization - that actually holds the copyright for their contributions (see the - Gates Foundation organization for an example). Those individuals should have - their names indented and be marked with a '-'. Email address can be added - optionally within square brackets . - * Gates Foundation - - Name Surname - - * Miguel de Barros - -------------- - ******/ - -'use strict' - -exports.up = async (knex) => { +exports.up = async (knex, Promise) => { return knex.schema.table('transferError', (t) => { // Dropping foreign keys for the transferError table to allow the error to be logged without any record existing in the transferErrorDuplicateCheck t.dropForeign('transferId') diff --git a/migrations/910103_feature1093SettlementByCurrency.js b/migrations/910103_feature1093SettlementByCurrency.js new file mode 100644 index 000000000..350bbdb65 --- /dev/null +++ b/migrations/910103_feature1093SettlementByCurrency.js @@ -0,0 +1,60 @@ +/***** + License + -------------- + Copyright © 2017 Bill & Melinda Gates Foundation + 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 + http://www.apache.org/licenses/LICENSE-2.0 + 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. + Contributors + -------------- + This is the official list of the Mojaloop project contributors for this file. + Names of the original copyright holders (individuals or organizations) + should be listed with a '*' in the first column. People who have + contributed from an organization can be listed under the organization + that actually holds the copyright for their contributions (see the + Gates Foundation organization for an example). Those individuals should have + their names indented and be marked with a '-'. Email address can be added + optionally within square brackets . + * Gates Foundation + - Name Surname + + * ModusBox + - Georgi Georgiev + -------------- + ******/ + +'use strict' + +exports.up = async (knex, Promise) => { + await knex.schema.hasTable('ledgerAccountType').then(function(exists) { + if (exists) { + return knex.schema.alterTable('ledgerAccountType', (t) => { + t.boolean('isSettleable').defaultTo(false).notNullable() + }) + } + }) + await knex.schema.hasTable('ledgerEntryType').then(function(exists) { + if (exists) { + return knex.schema.alterTable('ledgerEntryType', (t) => { + t.integer('ledgerAccountTypeId').unsigned().nullable() + t.foreign('ledgerAccountTypeId').references('ledgerAccountTypeId').inTable('ledgerAccountType') + }) + } + }) + await knex.schema.hasTable('settlement').then(function(exists) { + if (exists) { + return knex.schema.alterTable('settlement', (t) => { + t.integer('settlementModelId').unsigned().nullable() + t.foreign('settlementModelId').references('settlementModelId').inTable('settlementModel') + }) + } + }) + return 0 +} + +exports.down = async (knex, Promise) => { + await knex.schema.dropTableIfExists('ledgerAccountType') + await knex.schema.dropTableIfExists('ledgerEntryType') + await knex.schema.dropTableIfExists('settlement') + return 0 +} diff --git a/package-lock.json b/package-lock.json index e5a5be899..be1ba3a31 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@mojaloop/central-ledger", - "version": "9.2.1", + "version": "9.2.2", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -418,12 +418,13 @@ "integrity": "sha512-vzXR5MY7n4XeIvLpfl3HtE3coZYO4raKXW766R6DZw/6aLqR26iuZ109K7a0NtF2Db0jxqh7xz2AxkUwpUFybw==" }, "@hapi/podium": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/@hapi/podium/-/podium-4.0.0.tgz", - "integrity": "sha512-2T74rkS4OZjbsSdx4jIMbjb3cF/X6BpEE2kar71ascgL+9lf+5eczirlw3WWQ9ng2YDU469IVrADd6LYMzhEdw==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/@hapi/podium/-/podium-4.1.0.tgz", + "integrity": "sha512-k/n0McAu8PvonfQRLyKKUvvdb+Gh/O5iAeIwv535Hpxw9B1qZcrYdZyWtHZ8O5PkA9/b/Kk+BdvtgcxeKMB/2g==", "requires": { "@hapi/hoek": "9.x.x", - "@hapi/joi": "17.x.x" + "@hapi/joi": "17.x.x", + "@hapi/teamwork": "4.x.x" } }, "@hapi/shot": { @@ -801,9 +802,26 @@ "protobufjs": "6.8.8", "rc": "1.2.8", "serialize-error": "4.1.0", + "sinon": "8.1.1", "traceparent": "1.0.0", "tslib": "1.10.0", "uuid4": "1.1.4" + }, + "dependencies": { + "sinon": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/sinon/-/sinon-8.1.1.tgz", + "integrity": "sha512-E+tWr3acRdoe1nXbHMu86SSqA1WGM7Yw3jZRLvlCMnXwTHP8lgFFVn5BnKnF26uc5SfZ3D7pA9sN7S3Y2jG4Ew==", + "requires": { + "@sinonjs/commons": "^1.7.0", + "@sinonjs/formatio": "^4.0.1", + "@sinonjs/samsam": "^4.2.2", + "diff": "^4.0.2", + "lolex": "^5.1.2", + "nise": "^3.0.1", + "supports-color": "^7.1.0" + } + } } }, "@mojaloop/forensic-logging-client": { @@ -957,9 +975,9 @@ "dev": true }, "@sinonjs/commons": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.7.0.tgz", - "integrity": "sha512-qbk9AP+cZUsKdW1GJsBpxPKFmCJ0T8swwzVje3qFd+AkQb74Q/tiuzrdfFg8AD2g5HH/XbE/I8Uc1KYHVYWfhg==", + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.7.1.tgz", + "integrity": "sha512-Debi3Baff1Qu1Unc3mjJ96MgpbwTn43S1+9yJ0llWygPwDNu2aaWBD6yc9y/Z8XDRNhx7U+u2UDg2OGQXkclUQ==", "requires": { "type-detect": "4.0.8" } @@ -1006,6 +1024,12 @@ "defer-to-connect": "^1.0.1" } }, + "@tootallnate/once": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-1.0.0.tgz", + "integrity": "sha512-KYyTT/T6ALPkIRd2Ge080X/BsXvy9O0hcWTtMWkPvwAwF99+vn6Dv4GzrFT/Nn1LePr+FFDbRXXlqmsy9lw2zA==", + "dev": true + }, "@types/bytebuffer": { "version": "5.0.40", "resolved": "https://registry.npmjs.org/@types/bytebuffer/-/bytebuffer-5.0.40.tgz", @@ -1027,9 +1051,9 @@ "integrity": "sha512-5tXH6Bx/kNGd3MgffdmP4dy2Z+G4eaXw0SE81Tq3BNadtnMR5/ySMzX4SLEzHJzSmPNn4HIdpQsBvXMUykr58w==" }, "@types/node": { - "version": "10.17.15", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.15.tgz", - "integrity": "sha512-daFGV9GSs6USfPgxceDA8nlSe48XrVCJfDeYm7eokxq/ye7iuOH87hKXgMtEAVLFapkczbZsx868PMDT1Y0a6A==" + "version": "10.17.16", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.16.tgz", + "integrity": "sha512-A4283YSA1OmnIivcpy/4nN86YlnKRiQp8PYwI2KdPCONEBN093QTb0gCtERtkLyVNGKKIGazTZ2nAmVzQU51zA==" }, "@types/protobufjs": { "version": "6.0.0", @@ -1063,10 +1087,24 @@ "dev": true }, "agent-base": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-5.1.1.tgz", - "integrity": "sha512-TMeqbNl2fMW0nMjTEPOwe3J/PRFP4vqeoNuQMG0HlMrtm5QxKqdvAkZ1pRBQ/ulIyDD5Yq0nJ7YbdD8ey0TO3g==", - "dev": true + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.0.tgz", + "integrity": "sha512-j1Q7cSCqN+AwrmDd+pzgqc0/NpC655x2bUf5ZjRIO77DcNBFmh+OgRNzF6OKdCC9RSCb19fGd99+bhXFdkRNqw==", + "dev": true, + "requires": { + "debug": "4" + }, + "dependencies": { + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + } + } }, "agentkeepalive": { "version": "4.1.0", @@ -1101,9 +1139,9 @@ } }, "ajv": { - "version": "6.11.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.11.0.tgz", - "integrity": "sha512-nCprB/0syFYy9fVYU1ox1l2KN8S9I+tziH8D4zdZuLT3N6RMlGSGt5FSTpAiHB/Whv8Qs1cWHma1aMKZyaHRKA==", + "version": "6.12.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.0.tgz", + "integrity": "sha512-D6gFiFA0RRLyUbvijN74DWAjXSFxWKaWP7mldxkVhyhAV3+SWA9HEJPHQ2c9soIeTFJqcSdFDGFgdqs1iUU2Hw==", "requires": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", @@ -1700,19 +1738,17 @@ "integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg==" }, "cacache": { - "version": "14.0.0", - "resolved": "https://registry.npmjs.org/cacache/-/cacache-14.0.0.tgz", - "integrity": "sha512-+Nr/BnA/tjAUXza9gH8F+FSP+1HvWqCKt4c95dQr4EDVJVafbzmPZpLKCkLYexs6vSd2B/1TOXrAoNnqVPfvRA==", + "version": "15.0.0", + "resolved": "https://registry.npmjs.org/cacache/-/cacache-15.0.0.tgz", + "integrity": "sha512-L0JpXHhplbJSiDGzyJJnJCTL7er7NzbBgxzVqLswEb4bO91Zbv17OUMuUeu/q0ZwKn3V+1HM4wb9tO4eVE/K8g==", "dev": true, "requires": { "chownr": "^1.1.2", - "figgy-pudding": "^3.5.1", "fs-minipass": "^2.0.0", "glob": "^7.1.4", - "graceful-fs": "^4.2.2", "infer-owner": "^1.0.4", "lru-cache": "^5.1.1", - "minipass": "^3.0.0", + "minipass": "^3.1.1", "minipass-collect": "^1.0.2", "minipass-flush": "^1.0.5", "minipass-pipeline": "^1.2.2", @@ -1721,8 +1757,8 @@ "p-map": "^3.0.0", "promise-inflight": "^1.0.1", "rimraf": "^2.7.1", - "ssri": "^7.0.0", - "tar": "^6.0.0", + "ssri": "^8.0.0", + "tar": "^6.0.1", "unique-filename": "^1.1.1" }, "dependencies": { @@ -1820,9 +1856,9 @@ "dev": true }, "write-file-atomic": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-3.0.1.tgz", - "integrity": "sha512-JPStrIyyVJ6oCSz/691fAjFtefZ6q+fP6tm+OS4Qw6o+TGQxNp1ziY2PgS+X/m0V8OWhZiO/m4xSj+Pr4RrZvw==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-3.0.3.tgz", + "integrity": "sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q==", "dev": true, "requires": { "imurmurhash": "^0.1.4", @@ -2743,21 +2779,12 @@ "integrity": "sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg==", "dev": true }, - "es6-promise": { - "version": "4.2.8", - "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", - "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==", + "escape-goat": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/escape-goat/-/escape-goat-2.1.1.tgz", + "integrity": "sha512-8/uIhbG12Csjy2JEW7D9pHbreaVaS/OpN3ycnyvElTdwM5n6GY6W6e2IPemfvGZeUMqZ9A/3GqIZMgKnBhAw/Q==", "dev": true }, - "es6-promisify": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz", - "integrity": "sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM=", - "dev": true, - "requires": { - "es6-promise": "^4.0.3" - } - }, "escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", @@ -3545,13 +3572,13 @@ } }, "find-cache-dir": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.2.0.tgz", - "integrity": "sha512-1JKclkYYsf1q9WIJKLZa9S9muC+08RIjzAlLrK4QcYLJMS6mk9yombQ9qf+zJ7H9LS800k0s44L4sDq9VYzqyg==", + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.3.0.tgz", + "integrity": "sha512-PtXtQb7IrD8O+h6Cq1dbpJH5NzD8+9keN1zZ0YlpDzl1PwXEJEBj6u1Xa92t1Hwluoozd9TNKul5Hi2iqpsWwg==", "dev": true, "requires": { "commondir": "^1.0.1", - "make-dir": "^3.0.0", + "make-dir": "^3.0.2", "pkg-dir": "^4.1.0" }, "dependencies": { @@ -4530,9 +4557,9 @@ } }, "hapi-swagger": { - "version": "12.1.0", - "resolved": "https://registry.npmjs.org/hapi-swagger/-/hapi-swagger-12.1.0.tgz", - "integrity": "sha512-SXFUMqTnNnXeXilHWOLZPnSMRDqwMQSk0cASqBDGCdH5ORsk+amkaGpBrZSRPO3UELpCMSsk4qgdqhJl6Slqyg==", + "version": "12.1.1", + "resolved": "https://registry.npmjs.org/hapi-swagger/-/hapi-swagger-12.1.1.tgz", + "integrity": "sha512-gk2QKv7f71Y8N5ZKb1i76TD86gGg6BA+oZ94UBV2ycdi3K6hJ6iqJxB0vZEIiChxiGUx1Vqud+8pYwrONPEhhw==", "requires": { "@hapi/boom": "^8.0.1", "@hapi/hoek": "^9.0.2", @@ -4675,9 +4702,9 @@ } }, "hosted-git-info": { - "version": "2.8.5", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.5.tgz", - "integrity": "sha512-kssjab8CvdXfcXMXVcvsXum4Hwdq9XGtRD3TteMEvEbq0LXyiNQr6AprqKqfeaDXze7SxWvRxdpwE6ku7ikLkg==" + "version": "2.8.6", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.6.tgz", + "integrity": "sha512-Kp6rShEsCHhF5dD3EWKdkgVA8ix90oSUJ0VY4g9goxxa0+f4lx63muTftn0mlJ/+8IESGWyKnP//V2D7S4ZbIQ==" }, "html-escaper": { "version": "2.0.0", @@ -4704,12 +4731,13 @@ } }, "http-proxy-agent": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-3.0.0.tgz", - "integrity": "sha512-uGuJaBWQWDQCJI5ip0d/VTYZW0nRrlLWXA4A7P1jrsa+f77rW2yXz315oBt6zGCF6l8C2tlMxY7ffULCj+5FhA==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-4.0.1.tgz", + "integrity": "sha512-k0zdNgqWTGA6aeIRVpvfVob4fL52dTfaehylg0Y4UvSySvOq/Y+BOyPrgpUrA7HylqvU8vIZGsRuXmspskV0Tg==", "dev": true, "requires": { - "agent-base": "5", + "@tootallnate/once": "1", + "agent-base": "6", "debug": "4" }, "dependencies": { @@ -4740,12 +4768,12 @@ "integrity": "sha512-mBnIohUwRw9NyXMEMMv8/GANnzEYUj0Y8d3uL01zDWFkxUjYyZ6rgCaAI2zZ1Wb34Oqtbx/nFZolPRDc8Xlm5A==" }, "https-proxy-agent": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-4.0.0.tgz", - "integrity": "sha512-zoDhWrkR3of1l9QAL8/scJZyLu8j/gBkcwcaQOZh7Gyh/+uJQzGVETdgT30akuwkpL8HTRfssqI3BZuV18teDg==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz", + "integrity": "sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA==", "dev": true, "requires": { - "agent-base": "5", + "agent-base": "6", "debug": "4" }, "dependencies": { @@ -5719,9 +5747,9 @@ } }, "just-extend": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-4.0.2.tgz", - "integrity": "sha512-FrLwOgm+iXrPV+5zDU6Jqu4gCRXbWEQg2O3SKONsWE4w7AXFRkryS53bpWdaL9cNol+AmR3AEYz6kn+o0fCPnw==" + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-4.1.0.tgz", + "integrity": "sha512-ApcjaOdVTJ7y4r08xI5wIqpvwS48Q0PBG4DJROcEkH1f8MdAiNFyFxz3xoL0LWAVwjrwPYZdVHHxhRHcx/uGLA==" }, "jwa": { "version": "1.4.1", @@ -6034,16 +6062,16 @@ } }, "make-fetch-happen": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-7.1.1.tgz", - "integrity": "sha512-7fNjiOXNZhNGQzG5P15nU97aZQtzPU2GVgVd7pnqnl5gnpLzMAD8bAe5YG4iW2s0PTqaZy9xGv4Wfqe872kRNQ==", + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-8.0.2.tgz", + "integrity": "sha512-jRqI9zjLyz8ufXfLSbEObJ6a8sv8geeKYEPFpI+b39JjYU14MZtCiJGazSWPZMjCm7161b4r57N/na5fBXpooQ==", "dev": true, "requires": { "agentkeepalive": "^4.1.0", - "cacache": "^14.0.0", - "http-cache-semantics": "^4.0.3", - "http-proxy-agent": "^3.0.0", - "https-proxy-agent": "^4.0.0", + "cacache": "^15.0.0", + "http-cache-semantics": "^4.0.4", + "http-proxy-agent": "^4.0.1", + "https-proxy-agent": "^5.0.0", "is-lambda": "^1.0.1", "lru-cache": "^5.1.1", "minipass": "^3.0.0", @@ -6052,8 +6080,8 @@ "minipass-flush": "^1.0.5", "minipass-pipeline": "^1.2.2", "promise-retry": "^1.1.1", - "socks-proxy-agent": "^4.0.0", - "ssri": "^7.0.1" + "socks-proxy-agent": "^5.0.0", + "ssri": "^8.0.0" } }, "make-iterator": { @@ -6357,9 +6385,9 @@ "integrity": "sha512-bV7f+6l2QigeBBZSM/6yTNq4P2fNpSWj/0e7jQcy87A8e7o2nAfP/34/2ky5Vw4B9S446EtIhodAzkFCcR4dQg==" }, "moment-timezone": { - "version": "0.5.27", - "resolved": "https://registry.npmjs.org/moment-timezone/-/moment-timezone-0.5.27.tgz", - "integrity": "sha512-EIKQs7h5sAsjhPCqN6ggx6cEbs94GK050254TIJySD1bzoM5JTYDwAU1IoVOeTOL6Gm27kYJ51/uuvq1kIlrbw==", + "version": "0.5.28", + "resolved": "https://registry.npmjs.org/moment-timezone/-/moment-timezone-0.5.28.tgz", + "integrity": "sha512-TDJkZvAyKIVWg5EtVqRzU97w0Rb0YVbfpqyjgu6GwXCAohVRqwZjf4fOzDE6p1Ch98Sro/8hQQi65WDXW5STPw==", "requires": { "moment": ">= 2.9.0" } @@ -6686,15 +6714,15 @@ } }, "npm-check-updates": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/npm-check-updates/-/npm-check-updates-4.0.1.tgz", - "integrity": "sha512-rDrKAqhQuTYq2EkndroPMZGA9N6tpTotOVOIJoxRa3ZKnb/mOcq2TZv4A4LLSM8+9kZlP+sBwE+XAGh8wWZw/w==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/npm-check-updates/-/npm-check-updates-4.0.2.tgz", + "integrity": "sha512-EVJzwOIIdm58ug0vInAlkvkvfX603Szl614c/FFpttzexXG8KXQXj+Cf0GJ+9HEfBb8hPc8rLk4Csq9h7kL+ig==", "dev": true, "requires": { "chalk": "^3.0.0", "cint": "^8.2.1", "cli-table": "^0.3.1", - "commander": "^4.0.1", + "commander": "^4.1.1", "fast-diff": "^1.2.0", "find-up": "4.1.0", "get-stdin": "^7.0.0", @@ -6702,15 +6730,15 @@ "libnpmconfig": "^1.2.1", "lodash": "^4.17.15", "node-alias": "^1.0.4", - "pacote": "^10.2.0", + "pacote": "^11.1.0", "progress": "^2.0.3", - "prompts": "^2.3.0", + "prompts": "^2.3.1", "rc-config-loader": "^3.0.0", "requireg": "^0.2.2", - "semver": "^6.3.0", + "semver": "^7.1.3", "semver-utils": "^1.1.4", "spawn-please": "^0.3.0", - "update-notifier": "^3.0.1" + "update-notifier": "^4.1.0" }, "dependencies": { "ansi-align": { @@ -6720,6 +6748,19 @@ "dev": true, "requires": { "string-width": "^3.0.0" + }, + "dependencies": { + "string-width": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "dev": true, + "requires": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + } + } } }, "ansi-regex": { @@ -6739,65 +6780,19 @@ } }, "boxen": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/boxen/-/boxen-3.2.0.tgz", - "integrity": "sha512-cU4J/+NodM3IHdSL2yN8bqYqnmlBTidDR4RC7nJs61ZmtGz8VZzM3HLQX0zY5mrSmPtR3xWwsq2jOUQqFZN8+A==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/boxen/-/boxen-4.2.0.tgz", + "integrity": "sha512-eB4uT9RGzg2odpER62bBwSLvUeGC+WbRjjyyFhGsKnc8wp/m0+hQsMUvUe3H2V0D5vw0nBdO1hCJoZo5mKeuIQ==", "dev": true, "requires": { "ansi-align": "^3.0.0", "camelcase": "^5.3.1", - "chalk": "^2.4.2", + "chalk": "^3.0.0", "cli-boxes": "^2.2.0", - "string-width": "^3.0.0", - "term-size": "^1.2.0", - "type-fest": "^0.3.0", - "widest-line": "^2.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", - "dev": true - }, - "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } + "string-width": "^4.1.0", + "term-size": "^2.1.0", + "type-fest": "^0.8.1", + "widest-line": "^3.1.0" } }, "camelcase": { @@ -6844,17 +6839,32 @@ "dev": true }, "configstore": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/configstore/-/configstore-4.0.0.tgz", - "integrity": "sha512-CmquAXFBocrzaSM8mtGPMM/HiWmyIpr4CcJl/rgY2uCObZ/S7cKU0silxslqJejl+t/T9HS8E0PUNQD81JGUEQ==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/configstore/-/configstore-5.0.1.tgz", + "integrity": "sha512-aMKprgk5YhBNyH25hj8wGt2+D52Sw1DRRIzqBwLp2Ya9mFmY8KPvvtvmna8SxVR9JMZ4kzMD68N22vlaRpkeFA==", "dev": true, "requires": { - "dot-prop": "^4.1.0", + "dot-prop": "^5.2.0", "graceful-fs": "^4.1.2", - "make-dir": "^1.0.0", - "unique-string": "^1.0.0", - "write-file-atomic": "^2.0.0", - "xdg-basedir": "^3.0.0" + "make-dir": "^3.0.0", + "unique-string": "^2.0.0", + "write-file-atomic": "^3.0.0", + "xdg-basedir": "^4.0.0" + } + }, + "crypto-random-string": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-2.0.0.tgz", + "integrity": "sha512-v1plID3y9r/lPhviJ1wrXpLeyUIGAZ2SHNYTEapm7/8A9nLPoyvVp3RK/EPFqn5kEznyWgYZNsRtYYIWbuG8KA==", + "dev": true + }, + "dot-prop": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.2.0.tgz", + "integrity": "sha512-uEUyaDKoSQ1M4Oq8l45hSE26SnTxL6snNnqvK/VWx5wJhmff5z0FUVJDKDanor/6w3kzE3i7XZOk+7wC0EXr1A==", + "dev": true, + "requires": { + "is-obj": "^2.0.0" } }, "find-up": { @@ -6876,6 +6886,15 @@ "pump": "^3.0.0" } }, + "global-dirs": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/global-dirs/-/global-dirs-2.0.1.tgz", + "integrity": "sha512-5HqUqdhkEovj2Of/ms3IeS/EekcO54ytHRLV4PEY2rhRwrHXLQjeVEES0Lhka0xwNDtGYn58wyC4s5+MHsOO6A==", + "dev": true, + "requires": { + "ini": "^1.3.5" + } + }, "got": { "version": "9.6.0", "resolved": "https://registry.npmjs.org/got/-/got-9.6.0.tgz", @@ -6895,12 +6914,6 @@ "url-parse-lax": "^3.0.0" } }, - "has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", - "dev": true - }, "is-ci": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-2.0.0.tgz", @@ -6916,10 +6929,32 @@ "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", "dev": true }, + "is-installed-globally": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/is-installed-globally/-/is-installed-globally-0.3.1.tgz", + "integrity": "sha512-oiEcGoQbGc+3/iijAijrK2qFpkNoNjsHOm/5V5iaeydyrS/hnwaRCEgH5cpW0P3T1lSjV5piB7S5b5lEugNLhg==", + "dev": true, + "requires": { + "global-dirs": "^2.0.1", + "is-path-inside": "^3.0.1" + } + }, "is-npm": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-npm/-/is-npm-3.0.0.tgz", - "integrity": "sha512-wsigDr1Kkschp2opC4G3yA6r9EgVA6NjRpWzIi9axXqeIaAATPRJc4uLujXe3Nd9uO8KoDyA4MD6aZSeXTADhA==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-npm/-/is-npm-4.0.0.tgz", + "integrity": "sha512-96ECIfh9xtDDlPylNPXhzjsykHsMJZ18ASpaWzQyBr4YRTcVjUvzaHayDAES2oU/3KpljhHUjtSRNiDwi0F0ig==", + "dev": true + }, + "is-obj": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz", + "integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==", + "dev": true + }, + "is-path-inside": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.2.tgz", + "integrity": "sha512-/2UGPSgmtqwo1ktx8NDHjuPwZWmHhO+gj0f93EkhLB5RgW9RZevWYYlIkS6zePc6U2WpOdQYIwHe9YC4DWEBVg==", "dev": true }, "latest-version": { @@ -6940,6 +6975,23 @@ "p-locate": "^4.1.0" } }, + "make-dir": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.0.2.tgz", + "integrity": "sha512-rYKABKutXa6vXTXhoV18cBE7PaewPXHe/Bdq4v+ZLMhxbWApkFFplT0LcbMW+6BbjnQXzZ/sAvSE/JdguApG5w==", + "dev": true, + "requires": { + "semver": "^6.0.0" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + } + } + }, "p-locate": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", @@ -6959,6 +7011,14 @@ "registry-auth-token": "^4.0.0", "registry-url": "^5.0.0", "semver": "^6.2.0" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + } } }, "path-exists": { @@ -7002,20 +7062,66 @@ } }, "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.1.3.tgz", + "integrity": "sha512-ekM0zfiA9SCBlsKa2X1hxyxiI4L3B6EbVJkkdgQXnSEEaHlGdvyodMruTiulSRWMMB4NeIuYNMC9rTKTz97GxA==", "dev": true }, + "semver-diff": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/semver-diff/-/semver-diff-3.1.1.tgz", + "integrity": "sha512-GX0Ix/CJcHyB8c4ykpHGIAvLyOwOobtM/8d+TQkAd81/bEjgPHrfba41Vpesr7jX/t8Uh+R3EX9eAS5be+jQYg==", + "dev": true, + "requires": { + "semver": "^6.3.0" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + } + } + }, "string-width": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", - "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", + "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==", "dev": true, "requires": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "dev": true + }, + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true + }, + "strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.0" + } + } } }, "strip-ansi": { @@ -7027,70 +7133,46 @@ "ansi-regex": "^4.1.0" } }, + "term-size": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/term-size/-/term-size-2.2.0.tgz", + "integrity": "sha512-a6sumDlzyHVJWb8+YofY4TW112G6p2FCPEAFk+59gIYHv3XHRhm9ltVQ9kli4hNWeQBwSpe8cRN25x0ROunMOw==", + "dev": true + }, + "type-fest": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", + "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", + "dev": true + }, + "unique-string": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/unique-string/-/unique-string-2.0.0.tgz", + "integrity": "sha512-uNaeirEPvpZWSgzwsPGtU2zVSTrn/8L5q/IexZmH0eH6SA73CmAA5U4GwORTxQAZs95TAXLNqeLoPPNO5gZfWg==", + "dev": true, + "requires": { + "crypto-random-string": "^2.0.0" + } + }, "update-notifier": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/update-notifier/-/update-notifier-3.0.1.tgz", - "integrity": "sha512-grrmrB6Zb8DUiyDIaeRTBCkgISYUgETNe7NglEbVsrLWXeESnlCSP50WfRSj/GmzMPl6Uchj24S/p80nP/ZQrQ==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/update-notifier/-/update-notifier-4.1.0.tgz", + "integrity": "sha512-w3doE1qtI0/ZmgeoDoARmI5fjDoT93IfKgEGqm26dGUOh8oNpaSTsGNdYRN/SjOuo10jcJGwkEL3mroKzktkew==", "dev": true, "requires": { - "boxen": "^3.0.0", - "chalk": "^2.0.1", - "configstore": "^4.0.0", + "boxen": "^4.2.0", + "chalk": "^3.0.0", + "configstore": "^5.0.1", "has-yarn": "^2.1.0", "import-lazy": "^2.1.0", "is-ci": "^2.0.0", - "is-installed-globally": "^0.1.0", - "is-npm": "^3.0.0", + "is-installed-globally": "^0.3.1", + "is-npm": "^4.0.0", "is-yarn-global": "^0.3.0", "latest-version": "^5.0.0", - "semver-diff": "^2.0.0", - "xdg-basedir": "^3.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", - "dev": true - }, - "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } + "pupa": "^2.0.1", + "semver-diff": "^3.1.1", + "xdg-basedir": "^4.0.0" } }, "url-parse-lax": { @@ -7101,6 +7183,50 @@ "requires": { "prepend-http": "^2.0.0" } + }, + "widest-line": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-3.1.0.tgz", + "integrity": "sha512-NsmoXalsWVDMGupxZ5R08ka9flZjjiLvHVAWYOKtiKM8ujtZWr9cRffak+uSE48+Ob8ObalXpwyeUiyDD6QFgg==", + "dev": true, + "requires": { + "string-width": "^4.0.0" + } + }, + "write-file-atomic": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-3.0.3.tgz", + "integrity": "sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q==", + "dev": true, + "requires": { + "imurmurhash": "^0.1.4", + "is-typedarray": "^1.0.0", + "signal-exit": "^3.0.2", + "typedarray-to-buffer": "^3.1.5" + } + }, + "xdg-basedir": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-4.0.0.tgz", + "integrity": "sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q==", + "dev": true + } + } + }, + "npm-install-checks": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/npm-install-checks/-/npm-install-checks-4.0.0.tgz", + "integrity": "sha512-09OmyDkNLYwqKPOnbI8exiOZU2GVVmQp7tgez2BPi5OZC8M82elDAps7sxC4l//uSUtotWqoEIDwjRvWH4qz8w==", + "dev": true, + "requires": { + "semver": "^7.1.1" + }, + "dependencies": { + "semver": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.1.3.tgz", + "integrity": "sha512-ekM0zfiA9SCBlsKa2X1hxyxiI4L3B6EbVJkkdgQXnSEEaHlGdvyodMruTiulSRWMMB4NeIuYNMC9rTKTz97GxA==", + "dev": true } } }, @@ -7123,9 +7249,9 @@ }, "dependencies": { "hosted-git-info": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-3.0.2.tgz", - "integrity": "sha512-ezZMWtHXm7Eb7Rq4Mwnx2vs79WUx2QmRg3+ZqeGroKzfDO+EprOcgRPYghsOP9JuYBfK18VojmRTGCg8Ma+ktw==", + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-3.0.4.tgz", + "integrity": "sha512-4oT62d2jwSDBbLLFLZE+1vPuQ1h8p9wjrJ8Mqx5TjsyWmBMV5B13eJqn8pvluqubLf3cJPTfiYCIwNwDNmzScQ==", "dev": true, "requires": { "lru-cache": "^5.1.1" @@ -7152,12 +7278,12 @@ } }, "npm-pick-manifest": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/npm-pick-manifest/-/npm-pick-manifest-5.0.0.tgz", - "integrity": "sha512-YUW9xObM7Y1OkQ/gSmU5VQyI3vCkG5lwOrdycw0dpj9/3dE8h9CKY8tVyHTIp50+mV8jOAGH4m4Lts7zz2rN4Q==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/npm-pick-manifest/-/npm-pick-manifest-6.0.0.tgz", + "integrity": "sha512-PdJpXMvjqt4nftNEDpCgjBUF8yI3Q3MyuAmVB9nemnnCg32F4BPL/JFBfdj8DubgHCYUFQhtLWmBPvdsFtjWMg==", "dev": true, "requires": { - "figgy-pudding": "^3.5.1", + "npm-install-checks": "^4.0.0", "npm-package-arg": "^8.0.0", "semver": "^7.0.0" }, @@ -7171,36 +7297,19 @@ } }, "npm-registry-fetch": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/npm-registry-fetch/-/npm-registry-fetch-6.0.2.tgz", - "integrity": "sha512-fffWUYR6J5u11URMuCSOsrr35YO3lNa41ckzIj1XPaznsRTFemIcLCU59A347xQcliUFSB2CJJeQVy5OiIVBcg==", + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/npm-registry-fetch/-/npm-registry-fetch-8.0.0.tgz", + "integrity": "sha512-975WwLvZjX97y9UWWQ8nAyr7bw02s9xKPHqvEm5T900LQsB1HXb8Gb9ebYtCBLSX+K8gSOrO5KS/9yV/naLZmQ==", "dev": true, "requires": { "@npmcli/ci-detect": "^1.0.0", - "figgy-pudding": "^3.4.1", "lru-cache": "^5.1.1", - "make-fetch-happen": "^7.1.0", + "make-fetch-happen": "^8.0.2", "minipass": "^3.0.0", "minipass-fetch": "^1.1.2", "minipass-json-stream": "^1.0.1", "minizlib": "^2.0.0", - "npm-package-arg": "^8.0.0", - "safe-buffer": "^5.2.0", - "semver": "^7.0.0" - }, - "dependencies": { - "safe-buffer": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.0.tgz", - "integrity": "sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg==", - "dev": true - }, - "semver": { - "version": "7.1.3", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.1.3.tgz", - "integrity": "sha512-ekM0zfiA9SCBlsKa2X1hxyxiI4L3B6EbVJkkdgQXnSEEaHlGdvyodMruTiulSRWMMB4NeIuYNMC9rTKTz97GxA==", - "dev": true - } + "npm-package-arg": "^8.0.0" } }, "npm-run-all": { @@ -7806,14 +7915,14 @@ } }, "pacote": { - "version": "10.3.2", - "resolved": "https://registry.npmjs.org/pacote/-/pacote-10.3.2.tgz", - "integrity": "sha512-Hem2RkLAHhNaJSbhjouhbCAXlinNsv9W75s6JNxv9GypIjFkHtxCBoV6+GYBPttVOpZqnTAHmYRLs8yc2X2Dnw==", + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/pacote/-/pacote-11.1.0.tgz", + "integrity": "sha512-JcMmHiK6h6rcncj2HLayiyJZg28iJXJafXcmEGw2NjKH3WE8ZgSwyMZs7+f+aliPD57PDhB31IEgUtLXp0YZxA==", "dev": true, "requires": { "@npmcli/installed-package-contents": "^1.0.5", - "cacache": "^14.0.0", - "chownr": "^1.1.3", + "cacache": "^15.0.0", + "chownr": "^1.1.4", "fs-minipass": "^2.1.0", "infer-owner": "^1.0.4", "lru-cache": "^5.1.1", @@ -7821,16 +7930,16 @@ "minipass-fetch": "^1.2.1", "mkdirp": "^1.0.3", "npm-package-arg": "^8.0.0", - "npm-packlist": "^2.0.3", - "npm-pick-manifest": "^5.0.0", - "npm-registry-fetch": "^6.0.0", + "npm-packlist": "^2.1.0", + "npm-pick-manifest": "^6.0.0", + "npm-registry-fetch": "^8.0.0", "osenv": "^0.1.5", "promise-inflight": "^1.0.1", "promise-retry": "^1.1.1", "read-package-json-fast": "^1.1.3", - "semver": "^7.1.1", - "ssri": "^7.1.0", - "tar": "^6.0.0", + "semver": "^7.1.3", + "ssri": "^8.0.0", + "tar": "^6.0.1", "which": "^2.0.2" }, "dependencies": { @@ -8319,6 +8428,15 @@ "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" }, + "pupa": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pupa/-/pupa-2.0.1.tgz", + "integrity": "sha512-hEJH0s8PXLY/cdXh66tNEQGndDrIKNqNC5xmrysZy3i5C3oEoLna7YAOad+7u125+zH1HNXUmGEkrhb3c2VriA==", + "dev": true, + "requires": { + "escape-goat": "^2.0.0" + } + }, "qs": { "version": "6.5.2", "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", @@ -9177,22 +9295,23 @@ } }, "socks-proxy-agent": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-4.0.2.tgz", - "integrity": "sha512-NT6syHhI9LmuEMSK6Kd2V7gNv5KFZoLE7V5udWmn0de+3Mkj3UMA/AJPLyeNUVmElCurSHtUdM3ETpR3z770Wg==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-5.0.0.tgz", + "integrity": "sha512-lEpa1zsWCChxiynk+lCycKuC502RxDWLKJZoIhnxrWNjLSDGYRFflHA1/228VkRcnv9TIb8w98derGbpKxJRgA==", "dev": true, "requires": { - "agent-base": "~4.2.1", - "socks": "~2.3.2" + "agent-base": "6", + "debug": "4", + "socks": "^2.3.3" }, "dependencies": { - "agent-base": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.2.1.tgz", - "integrity": "sha512-JVwXMr9nHYTUXsBFKUqhJwvlcYU/blreOEUkhNR2eXZIvwd+c+o5V4MgDPKWnMS/56awN3TRzIP+KoPn+roQtg==", + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", "dev": true, "requires": { - "es6-promisify": "^5.0.0" + "ms": "^2.1.1" } } } @@ -9373,12 +9492,11 @@ } }, "ssri": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/ssri/-/ssri-7.1.0.tgz", - "integrity": "sha512-77/WrDZUWocK0mvA5NTRQyveUf+wsrIc6vyrxpS8tVvYBcX215QbafrJR3KtkpskIzoFLqqNuuYQvxaMjXJ/0g==", + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/ssri/-/ssri-8.0.0.tgz", + "integrity": "sha512-aq/pz989nxVYwn16Tsbj1TqFpD5LLrQxHf5zaHuieFV+R0Bbr4y8qUsOA45hXT/N4/9UNXTarBjnjVmjSOVaAA==", "dev": true, "requires": { - "figgy-pudding": "^3.5.1", "minipass": "^3.1.1" } }, @@ -10093,9 +10211,9 @@ "dev": true }, "uglify-js": { - "version": "3.7.7", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.7.7.tgz", - "integrity": "sha512-FeSU+hi7ULYy6mn8PKio/tXsdSXN35lm4KgV2asx00kzrLU9Pi3oAslcJT70Jdj7PHX29gGUPOT6+lXGBbemhA==", + "version": "3.8.0", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.8.0.tgz", + "integrity": "sha512-ugNSTT8ierCsDHso2jkBHXYrU8Y5/fY2ZUprfrJUiD7YpuFvV4jODLFmb3h4btQjqr5Nh4TX4XtgDfCU1WdioQ==", "optional": true, "requires": { "commander": "~2.20.3", @@ -10122,9 +10240,9 @@ "integrity": "sha1-5z3T17DXxe2G+6xrCufYxqadUPo=" }, "undefsafe": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.2.tgz", - "integrity": "sha1-Il9rngM3Zj4Njnz9aG/Cg2zKznY=", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.3.tgz", + "integrity": "sha512-nrXZwwXrD/T/JXeygJqdCO6NZZ1L66HrxM/Z7mIq2oPanoN0F1nLx3lwJMu6AwJY69hdixaFQOuoYsMjE5/C2A==", "dev": true, "requires": { "debug": "^2.2.0" diff --git a/package.json b/package.json index 23cf90229..4af88bea8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@mojaloop/central-ledger", - "version": "9.2.1", + "version": "9.2.2", "description": "Central ledger hosted by a scheme to record and settle transfers", "license": "Apache-2.0", "author": "ModusBox", @@ -10,7 +10,8 @@ "Lewis Daly ", "Miguel de Barros ", "Rajiv Mothilal ", - "Steven Oderayi " + "Steven Oderayi ", + "Lazola Lucas " ], "repository": { "type": "git", @@ -100,7 +101,7 @@ "glob": "7.1.6", "hapi-auth-basic": "5.0.0", "hapi-auth-bearer-token": "6.2.1", - "hapi-swagger": "12.1.0", + "hapi-swagger": "12.1.1", "knex": "0.20.10", "lodash": "4.17.15", "moment": "2.24.0", @@ -121,7 +122,7 @@ "jsonpath": "1.0.2", "nodemon": "2.0.2", "npm-audit-resolver": "2.2.0", - "npm-check-updates": "4.0.1", + "npm-check-updates": "4.0.2", "nyc": "15.0.0", "pre-commit": "1.2.2", "proxyquire": "2.1.3", diff --git a/seeds/ledgerAccountType.js b/seeds/ledgerAccountType.js index b382b97c4..481646c8c 100644 --- a/seeds/ledgerAccountType.js +++ b/seeds/ledgerAccountType.js @@ -19,6 +19,7 @@ - Name Surname * Georgi Georgiev + * Lazola Lucas -------------- ******/ @@ -27,7 +28,8 @@ const ledgerAccountTypes = [ { name: 'POSITION', - description: 'Typical accounts from which a DFSP provisions transfers ' + description: 'Typical accounts from which a DFSP provisions transfers', + isSettleable: 1 }, { name: 'SETTLEMENT', @@ -44,10 +46,19 @@ const ledgerAccountTypes = [ { name: 'HUB_FEE', description: 'An account to which fees will be charged or collected' + }, + { + name: 'INTERCHANGE_FEE', + description: null, + isSettleable: 1 } ] - -exports.seed = async function (knex) { +const ledgerAccountList = ledgerAccountTypes.filter(currentValue => { + return currentValue.isSettleable +}).map(currentValue => { + return currentValue.name +}).sort() +const seed = async function (knex) { try { return await knex('ledgerAccountType').insert(ledgerAccountTypes) } catch (err) { @@ -58,3 +69,7 @@ exports.seed = async function (knex) { } } } +module.exports = { + ledgerAccountList, + seed +} diff --git a/seeds/ledgerEntryType.js b/seeds/ledgerEntryType.js index 298780be5..9e63ec40a 100644 --- a/seeds/ledgerEntryType.js +++ b/seeds/ledgerEntryType.js @@ -27,11 +27,13 @@ const ledgerEntryTypes = [ { name: 'PRINCIPLE_VALUE', - description: 'The principle amount to be settled between parties, derived on quotes between DFSPs' + description: 'The principle amount to be settled between parties, derived on quotes between DFSPs', + ledgerAccountTypeId: 1 // POSITION }, { name: 'INTERCHANGE_FEE', - description: 'Fees to be paid between DFSP' + description: 'Fees to be paid between DFSP', + ledgerAccountTypeId: 6 // INTERCHANGE_FEE }, { name: 'HUB_FEE', diff --git a/seeds/settlementDelay.js b/seeds/settlementDelay.js new file mode 100644 index 000000000..00b0d2232 --- /dev/null +++ b/seeds/settlementDelay.js @@ -0,0 +1,55 @@ +/***** + License + -------------- + Copyright © 2017 Bill & Melinda Gates Foundation + 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 + http://www.apache.org/licenses/LICENSE-2.0 + 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. + Contributors + -------------- + This is the official list of the Mojaloop project contributors for this file. + Names of the original copyright holders (individuals or organizations) + should be listed with a '*' in the first column. People who have + contributed from an organization can be listed under the organization + that actually holds the copyright for their contributions (see the + Gates Foundation organization for an example). Those individuals should have + their names indented and be marked with a '-'. Email address can be added + optionally within square brackets . + * Gates Foundation + - Name Surname + + * Georgi Georgiev + * Lazola Lucas + -------------- + ******/ + +'use strict' + +const settlementDelayTypes = [ + { + name: 'IMMEDIATE', + description: null + }, + { + name: 'DEFERRED', + description: null + } +] +const settlementDelayList = settlementDelayTypes.map(currentValue => { + return currentValue.name +}).sort() +const seed = async function (knex) { + try { + return await knex('settlementDelay').insert(settlementDelayTypes) + } catch (err) { + if (err.code === 'ER_DUP_ENTRY') return -1001 + else { + console.log(`Uploading seeds for settlementDelay has failed with the following error: ${err}`) + return -1000 + } + } +} +module.exports = { + settlementDelayList, + seed +} diff --git a/seeds/settlementGranularity.js b/seeds/settlementGranularity.js new file mode 100644 index 000000000..0a63e0b58 --- /dev/null +++ b/seeds/settlementGranularity.js @@ -0,0 +1,57 @@ +/***** + License + -------------- + Copyright © 2017 Bill & Melinda Gates Foundation + 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 + http://www.apache.org/licenses/LICENSE-2.0 + 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. + Contributors + -------------- + This is the official list of the Mojaloop project contributors for this file. + Names of the original copyright holders (individuals or organizations) + should be listed with a '*' in the first column. People who have + contributed from an organization can be listed under the organization + that actually holds the copyright for their contributions (see the + Gates Foundation organization for an example). Those individuals should have + their names indented and be marked with a '-'. Email address can be added + optionally within square brackets . + * Gates Foundation + - Name Surname + + * Georgi Georgiev + * Lazola Lucas + -------------- + ******/ + +'use strict' + +const settlementGranularityTypes = [ + { + name: 'GROSS', + description: null + }, + { + name: 'NET', + description: null + } +] +const settlementGranularityList = settlementGranularityTypes.map(currentValue => { + return currentValue.name +}).sort() + +const seed = async function (knex) { + try { + return await knex('settlementGranularity').insert(settlementGranularityTypes) + } catch (err) { + if (err.code === 'ER_DUP_ENTRY') return -1001 + else { + console.log(`Uploading seeds for settlementGranularity has failed with the following error: ${err}`) + return -1000 + } + } +} + +module.exports = { + settlementGranularityList, + seed +} diff --git a/seeds/settlementInterchange.js b/seeds/settlementInterchange.js new file mode 100644 index 000000000..458a36905 --- /dev/null +++ b/seeds/settlementInterchange.js @@ -0,0 +1,56 @@ +/***** + License + -------------- + Copyright © 2017 Bill & Melinda Gates Foundation + 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 + http://www.apache.org/licenses/LICENSE-2.0 + 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. + Contributors + -------------- + This is the official list of the Mojaloop project contributors for this file. + Names of the original copyright holders (individuals or organizations) + should be listed with a '*' in the first column. People who have + contributed from an organization can be listed under the organization + that actually holds the copyright for their contributions (see the + Gates Foundation organization for an example). Those individuals should have + their names indented and be marked with a '-'. Email address can be added + optionally within square brackets . + * Gates Foundation + - Name Surname + + * Georgi Georgiev + * Lazola Lucas + -------------- + ******/ + +'use strict' + +const settlementInterchangeTypes = [ + { + name: 'BILATERAL', + description: null + }, + { + name: 'MULTILATERAL', + description: null + } +] +const settlementInterchangeList = settlementInterchangeTypes.map(currentValue => { + return currentValue.name +}).sort() + +const seed = async function (knex) { + try { + return await knex('settlementInterchange').insert(settlementInterchangeTypes) + } catch (err) { + if (err.code === 'ER_DUP_ENTRY') return -1001 + else { + console.log(`Uploading seeds for settlementInterchange has failed with the following error: ${err}`) + return -1000 + } + } +} +module.exports = { + settlementInterchangeList, + seed +} diff --git a/seeds/settlementWindow1State.js b/seeds/settlementWindow1State.js index f0f468012..abfa89a0a 100644 --- a/seeds/settlementWindow1State.js +++ b/seeds/settlementWindow1State.js @@ -49,6 +49,16 @@ const settlementWindowStates = [ settlementWindowStateId: 'ABORTED', enumeration: 'ABORTED', description: 'Window returned to this state when the settlement was not possible. This window may now be included in a future settlement.' + }, + { + settlementWindowStateId: 'PROCESSING', + enumeration: 'PROCESSING', + description: 'Intermediate state when closing a window.' + }, + { + settlementWindowStateId: 'FAILED', + enumeration: 'FAILED', + description: 'Used when close window processing failed and all retries have been exhausted.' } ] diff --git a/seeds/z1000_settlementModel-deprecated.js- b/seeds/z1000_settlementModel-deprecated.js- new file mode 100644 index 000000000..1f3feb2f0 --- /dev/null +++ b/seeds/z1000_settlementModel-deprecated.js- @@ -0,0 +1,61 @@ +/***** + License + -------------- + Copyright © 2017 Bill & Melinda Gates Foundation + 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 + http://www.apache.org/licenses/LICENSE-2.0 + 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. + Contributors + -------------- + This is the official list of the Mojaloop project contributors for this file. + Names of the original copyright holders (individuals or organizations) + should be listed with a '*' in the first column. People who have + contributed from an organization can be listed under the organization + that actually holds the copyright for their contributions (see the + Gates Foundation organization for an example). Those individuals should have + their names indented and be marked with a '-'. Email address can be added + optionally within square brackets . + * Gates Foundation + - Name Surname + + * Georgi Georgiev + -------------- + ******/ + + /* Note: this seed script is currently not in use, but will should remain available + until it is confirmed no settlement models will be set as default for all schemas. + It might be also used for development purposes to easily instantiate settlement + models. z filename prefix is used to ensure proper script run order. */ + +'use strict' + +const settlementModels = [ + { + name: 'DEFERRED_NET', + settlementGranularityId: 2, // NET + settlementInterchangeId: 2, // MULTILATERAL + settlementDelayId: 2, // DEFERRED + ledgerAccountTypeId: 1, // POSITION + currencyId: null + }, + { + name: 'DEFERRED_NET_USD', + settlementGranularityId: 2, // NET + settlementInterchangeId: 2, // MULTILATERAL + settlementDelayId: 2, // DEFERRED + ledgerAccountTypeId: 1, // POSITION + currencyId: 'USD' + } +] + +exports.seed = async function (knex) { + try { + return await knex('settlementModel').insert(settlementModels) + } catch (err) { + if (err.code === 'ER_DUP_ENTRY') return -1001 + else { + console.log(`Uploading seeds for settlementModel has failed with the following error: ${err}`) + return -1000 + } + } +} diff --git a/src/api/settlementModels/handler.js b/src/api/settlementModels/handler.js new file mode 100644 index 000000000..cd6fb4d6a --- /dev/null +++ b/src/api/settlementModels/handler.js @@ -0,0 +1,129 @@ +/***** + License + -------------- + Copyright © 2017 Bill & Melinda Gates Foundation + 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 + http://www.apache.org/licenses/LICENSE-2.0 + 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. + Contributors + -------------- + This is the official list of the Mojaloop project contributors for this file. + Names of the original copyright holders (individuals or organizations) + should be listed with a '*' in the first column. People who have + contributed from an organization can be listed under the organization + that actually holds the copyright for their contributions (see the + Gates Foundation organization for an example). Those individuals should have + their names indented and be marked with a '-'. Email address can be added + optionally within square brackets . + * Gates Foundation + - Name Surname + + * ModusBox + - Georgi Georgiev + - Lazola Lucas + -------------- + ******/ +'use strict' + +const SettlementService = require('../../domain/settlement') +const Sidecar = require('../../lib/sidecar') +const ErrorHandler = require('@mojaloop/central-services-error-handling') +const Cache = require('../../lib/cache') +const Util = require('@mojaloop/central-services-shared').Util +const Enum = require('@mojaloop/central-services-shared').Enum.Settlements +const Logger = require('@mojaloop/central-services-logger') + +const entityItem = ({ settlementModelId, name, isActive, settlementGranularityId, settlementInterchangeId, settlementDelayId, currencyId, requireLiquidityCheck, ledgerAccountTypeId, autoPositionReset }, ledgerAccountIds, settlementGranularityIds, settlementInterchangeIds, settlementDelayIds) => { + return { + settlementModelId, + name, + isActive: Enum.booleanType[isActive], + settlementGranularity: settlementGranularityIds[settlementGranularityId], + settlementInterchange: settlementInterchangeIds[settlementInterchangeId], + settlementDelay: settlementDelayIds[settlementDelayId], + currency: currencyId, + requireLiquidityCheck: Enum.booleanType[requireLiquidityCheck], + ledgerAccountTypeId: ledgerAccountIds[ledgerAccountTypeId], + autoPositionReset: Enum.booleanType[autoPositionReset] + + } +} +const handleMissingRecord = (entity) => { + if (!entity) { + throw ErrorHandler.Factory.createFSPIOPError(ErrorHandler.Enums.FSPIOPErrorCodes.ID_NOT_FOUND, 'The requested resource could not be found.') + } + return entity +} + +const getByName = async function (request) { + const entity = await SettlementService.getByName(request.params.name) + handleMissingRecord(entity) + const ledgerAccountTypes = await Cache.getEnums('ledgerAccountType') + const ledgerAccountIds = Util.transpose(ledgerAccountTypes) + const settlementGranularityIds = Util.transpose(Enum.SettlementGranularity) + const settlementInterchangeIds = Util.transpose(Enum.SettlementInterchange) + const settlementDelayIds = Util.transpose(Enum.SettlementDelay) + + return entityItem(entity, ledgerAccountIds, settlementGranularityIds, settlementInterchangeIds, settlementDelayIds) +} +const getAll = async function () { + const results = await SettlementService.getAll() + const ledgerAccountTypes = await Cache.getEnums('ledgerAccountType') + const ledgerAccountIds = Util.transpose(ledgerAccountTypes) + const settlementGranularityIds = Util.transpose(Enum.SettlementGranularity) + const settlementInterchangeIds = Util.transpose(Enum.SettlementInterchange) + const settlementDelayIds = Util.transpose(Enum.SettlementDelay) + return results.map(record => entityItem(record, ledgerAccountIds, settlementGranularityIds, settlementInterchangeIds, settlementDelayIds)) +} + +const update = async function (request) { + Sidecar.logRequest(request) + try { + const updatedEntity = await SettlementService.update(request.params.name, request.payload) + if (request.payload.isActive !== undefined) { + const isActiveText = request.payload.isActive ? Enum.isActiveText.activated : Enum.isActiveText.disabled + const changeLog = JSON.stringify(Object.assign({}, request.params, { isActive: request.payload.isActive })) + Logger.info(`Settlement Model has been ${isActiveText} :: ${changeLog}`) + } + const ledgerAccountTypes = await Cache.getEnums('ledgerAccountType') + const ledgerAccountIds = Util.transpose(ledgerAccountTypes) + const settlementGranularityIds = Util.transpose(Enum.SettlementGranularity) + const settlementInterchangeIds = Util.transpose(Enum.SettlementInterchange) + const settlementDelayIds = Util.transpose(Enum.SettlementDelay) + return entityItem(updatedEntity, ledgerAccountIds, settlementGranularityIds, settlementInterchangeIds, settlementDelayIds) + } catch (err) { + throw ErrorHandler.Factory.reformatFSPIOPError(err) + } +} +const create = async function (request, h) { + Sidecar.logRequest(request) + try { + const settlementGranularity = Enum.SettlementGranularity[request.payload.settlementGranularity] + const settlementInterchange = Enum.SettlementInterchange[request.payload.settlementInterchange] + const settlementDelay = Enum.SettlementDelay[request.payload.settlementDelay] + const { isValid, reasons } = Util.Settlement.validateSettlementModel(settlementDelay, settlementGranularity, settlementInterchange) + if (!isValid) { + throw ErrorHandler.Factory.createFSPIOPError(ErrorHandler.Enums.FSPIOPErrorCodes.CLIENT_ERROR, reasons.join('. ')) + } + const ledgerAccountType = await SettlementService.getLedgerAccountTypeName(request.payload.ledgerAccountType) + if (!ledgerAccountType) { + throw ErrorHandler.Factory.createFSPIOPError(ErrorHandler.Enums.FSPIOPErrorCodes.ADD_PARTY_INFO_ERROR, 'Ledger account type was not found') + } + const settlementModelExist = await SettlementService.getByName(request.payload.name) + if (settlementModelExist) { + throw ErrorHandler.Factory.createFSPIOPError(ErrorHandler.Enums.FSPIOPErrorCodes.CLIENT_ERROR, 'This Settlement Model already exists') + } else { + await SettlementService.createSettlementModel(request.payload.name, true, settlementGranularity, settlementInterchange, settlementDelay, request.payload.currency, request.payload.requireLiquidityCheck, ledgerAccountType.ledgerAccountTypeId, request.payload.autoPositionReset) + return h.response().code(201) + } + } catch (err) { + throw ErrorHandler.Factory.reformatFSPIOPError(err) + } +} + +module.exports = { + create, + getByName, + getAll, + update +} diff --git a/src/api/settlementModels/routes.js b/src/api/settlementModels/routes.js new file mode 100644 index 000000000..99ba7c4f6 --- /dev/null +++ b/src/api/settlementModels/routes.js @@ -0,0 +1,103 @@ +/***** + License + -------------- + Copyright © 2017 Bill & Melinda Gates Foundation + 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 + http://www.apache.org/licenses/LICENSE-2.0 + 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. + Contributors + -------------- + This is the official list of the Mojaloop project contributors for this file. + Names of the original copyright holders (individuals or organizations) + should be listed with a '*' in the first column. People who have + contributed from an organization can be listed under the organization + that actually holds the copyright for their contributions (see the + Gates Foundation organization for an example). Those individuals should have + their names indented and be marked with a '-'. Email address can be added + optionally within square brackets . + * Gates Foundation + - Name Surname + + * ModusBox + - Georgi Georgiev + - Lazola Lucas + -------------- + ******/ +'use strict' + +const Handler = require('./handler') +const Joi = require('@hapi/joi') +const currencyList = require('../../../seeds/currency.js').currencyList +const settlementGranularityList = require('../../../seeds/settlementGranularity.js').settlementGranularityList +const settlementInterchangeList = require('../../../seeds/settlementInterchange.js').settlementInterchangeList +const settlementDelayList = require('../../../seeds/settlementDelay.js').settlementDelayList +const ledgerAccountList = require('../../../seeds/ledgerAccountType.js').ledgerAccountList +const tags = ['api', 'settlement'] + +module.exports = [ + { + method: 'GET', + path: '/settlementModels', + handler: Handler.getAll, + options: { + tags + } + }, + { + method: 'GET', + path: '/settlementModels/{name}', + handler: Handler.getByName, + options: { + tags, + validate: { + params: Joi.object({ + name: Joi.string().required().description('SettlementModel name') + }) + } + } + }, + { + method: 'POST', + path: '/settlementModels', + handler: Handler.create, + options: { + tags, + payload: { + allow: ['application/json'], + failAction: 'error' + }, + validate: { + payload: Joi.object({ + name: Joi.string().alphanum().min(2).max(30).required().description('Name of the settlement model'), + settlementGranularity: Joi.string().required().valid(...settlementGranularityList).description('Granularity type for the settlement model GROSS or NET'), + settlementInterchange: Joi.string().required().valid(...settlementInterchangeList).description('Interchange type for the settlement model BILATERAL or MULTILATERAL'), + settlementDelay: Joi.string().required().valid(...settlementDelayList).description('Delay type for the settlement model IMMEDIATE or DEFERRED'), + currency: Joi.string().valid(...currencyList).description('Currency code'), + requireLiquidityCheck: Joi.boolean().required().description('Liquidity Check boolean'), + ledgerAccountType: Joi.string().required().valid(...ledgerAccountList).description('Account type for the settlement model POSITION, SETTLEMENT or INTERCHANGE_FEE'), + autoPositionReset: Joi.boolean().required().description('Automatic position reset setting, which determines whether to execute the settlement transfer or not') + }) + } + } + }, + { + method: 'PUT', + path: '/settlementModels/{name}', + handler: Handler.update, + options: { + tags, + payload: { + allow: ['application/json'], + failAction: 'error' + }, + validate: { + payload: Joi.object({ + isActive: Joi.boolean().required().description('settlementModel isActive boolean') + }), + params: Joi.object({ + name: Joi.string().required().description('settlementModel name') + }) + } + } + } +] diff --git a/src/domain/settlement/index.js b/src/domain/settlement/index.js new file mode 100644 index 000000000..e5572489d --- /dev/null +++ b/src/domain/settlement/index.js @@ -0,0 +1,87 @@ +/***** + License + -------------- + Copyright © 2017 Bill & Melinda Gates Foundation + 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 + http://www.apache.org/licenses/LICENSE-2.0 + 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. + Contributors + -------------- + This is the official list of the Mojaloop project contributors for this file. + Names of the original copyright holders (individuals or organizations) + should be listed with a '*' in the first column. People who have + contributed from an organization can be listed under the organization + that actually holds the copyright for their contributions (see the + Gates Foundation organization for an example). Those individuals should have + their names indented and be marked with a '-'. Email address can be added + optionally within square brackets . + * Gates Foundation + - Name Surname + + * ModusBox + - Georgi Georgiev + - Lazola Lucas + -------------- + ******/ +'use strict' + +const SettlementModelModel = require('../../models/settlement/settlementModel') +const LedgerAccountTypeModel = require('../../models/ledgerAccountType/ledgerAccountType') + +const ErrorHandler = require('@mojaloop/central-services-error-handling') + +const createSettlementModel = async (name, isActive = true, settlementGranularityId, settlementInterchangeId, settlementDelayId, currencyId = null, requireLiquidityCheck = true, ledgerAccountTypeId, autoPositionReset = false) => { + try { + await SettlementModelModel.create(name, isActive, settlementGranularityId, settlementInterchangeId, settlementDelayId, currencyId, requireLiquidityCheck, ledgerAccountTypeId, autoPositionReset) + return true + } catch (err) { + throw ErrorHandler.Factory.reformatFSPIOPError(err) + } +} +const getByName = async (name) => { + try { + return await SettlementModelModel.getByName(name) + } catch (err) { + throw ErrorHandler.Factory.reformatFSPIOPError(err) + } +} +const getAll = async () => { + try { + return await SettlementModelModel.getAll() + } catch (err) { + throw ErrorHandler.Factory.reformatFSPIOPError(err) + } +} +const getLedgerAccountTypeName = async (name) => { + try { + return await LedgerAccountTypeModel.getLedgerAccountByName(name) + } catch (err) { + throw ErrorHandler.Factory.reformatFSPIOPError(err) + } +} + +const update = async (name, payload) => { + try { + const settlementModel = await SettlementModelModel.getByName(name) + settlementModeExists(settlementModel) + await SettlementModelModel.update(settlementModel, payload.isActive) + settlementModel.isActive = +payload.isActive + return settlementModel + } catch (err) { + throw ErrorHandler.Factory.reformatFSPIOPError(err) + } +} + +const settlementModeExists = (settlementModel) => { + if (settlementModel) { + return settlementModel + } + throw ErrorHandler.Factory.createInternalServerFSPIOPError('Settlement Model does not exist') +} +module.exports = { + createSettlementModel, + getLedgerAccountTypeName, + getByName, + getAll, + update +} diff --git a/src/models/settlement/settlementModel.js b/src/models/settlement/settlementModel.js new file mode 100644 index 000000000..07ed25d97 --- /dev/null +++ b/src/models/settlement/settlementModel.js @@ -0,0 +1,69 @@ +/***** + License + -------------- + Copyright © 2017 Bill & Melinda Gates Foundation + 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 + http://www.apache.org/licenses/LICENSE-2.0 + 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. + Contributors + -------------- + This is the official list of the Mojaloop project contributors for this file. + Names of the original copyright holders (individuals or organizations) + should be listed with a '*' in the first column. People who have + contributed from an organization can be listed under the organization + that actually holds the copyright for their contributions (see the + Gates Foundation organization for an example). Those individuals should have + their names indented and be marked with a '-'. Email address can be added + optionally within square brackets . + * Gates Foundation + - Name Surname + + * ModusBox + - Georgi Georgiev + - Lazola Lucas + -------------- + ******/ +'use strict' + +const Db = require('../../lib/db') +const ErrorHandler = require('@mojaloop/central-services-error-handling') + +exports.create = async (name, isActive, settlementGranularityId, settlementInterchangeId, settlementDelayId, currencyId, requireLiquidityCheck, ledgerAccountTypeId, autoPositionReset) => { + try { + return await Db.settlementModel.insert({ + name, + isActive, + settlementGranularityId, + settlementInterchangeId, + settlementDelayId, + currencyId, + requireLiquidityCheck, + ledgerAccountTypeId, + autoPositionReset + }) + } catch (err) { + throw ErrorHandler.Factory.reformatFSPIOPError(err) + } +} +exports.getByName = async (name) => { + try { + const result = await Db.settlementModel.find({ name: name }) + return result[0] + } catch (err) { + throw ErrorHandler.Factory.reformatFSPIOPError(err) + } +} +exports.getAll = async () => { + try { + return await Db.settlementModel.find() + } catch (err) { + throw ErrorHandler.Factory.reformatFSPIOPError(err) + } +} +exports.update = async (settlementModel, isActive) => { + try { + return await Db.settlementModel.update({ settlementModelId: settlementModel.settlementModelId }, { isActive }) + } catch (err) { + throw ErrorHandler.Factory.reformatFSPIOPError(err) + } +} diff --git a/test/unit/api/settlementModels/handler.test.js b/test/unit/api/settlementModels/handler.test.js new file mode 100644 index 000000000..683ce3fc6 --- /dev/null +++ b/test/unit/api/settlementModels/handler.test.js @@ -0,0 +1,279 @@ +/***** + License + -------------- + Copyright © 2017 Bill & Melinda Gates Foundation + 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 + http://www.apache.org/licenses/LICENSE-2.0 + 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. + Contributors + -------------- + This is the official list of the Mojaloop project contributors for this file. + Names of the original copyright holders (individuals or organizations) + should be listed with a '*' in the first column. People who have + contributed from an organization can be listed under the organization + that actually holds the copyright for their contributions (see the + Gates Foundation organization for an example). Those individuals should have + their names indented and be marked with a '-'. Email address can be added + optionally within square brackets . + * Gates Foundation + - Name Surname + + * ModusBox + - Georgi Georgiev + - Lazola Lucas + -------------- + ******/ +'use strict' + +const Test = require('tapes')(require('tape')) +const Sinon = require('sinon') +const Logger = require('@mojaloop/central-services-logger') +const Handler = require('../../../../src/api/settlementModels/handler') +const Sidecar = require('../../../../src/lib/sidecar') +const SettlementService = require('../../../../src/domain/settlement') +const Cache = require('../../../../src/lib/cache') +const FSPIOPError = require('@mojaloop/central-services-error-handling').Factory.FSPIOPError + +const createRequest = ({ payload, params, query }) => { + const sandbox = Sinon.createSandbox() + const requestPayload = payload || {} + const requestParams = params || {} + const requestQuery = query || {} + const enums = sandbox.stub() + enums.withArgs('ledgerAccountType').returns({ POSITION: 1, SETTLEMENT: 2, HUB_RECONCILIATION: 3, HUB_MULTILATERAL_SETTLEMENT: 4, HUB_FEE: 5 }) + return { + payload: requestPayload, + params: requestParams, + query: requestQuery, + server: { + log: () => { }, + methods: { + enums + } + } + } +} + +Test('SettlementModel', settlementModelHandlerTest => { + let sandbox + const ledgerAccountType = { + ledgerAccountTypeId: 2, + name: 'SETTLEMENT', + description: 'An account to which fees will be charged or collected', + isActive: 1, + createdDate: '2018-07-17T16:04:24.185Z' + } + const settlementModelService = [ + + { + settlementModelId: 106, + name: 'DEFERRED_NET', + isActive: 1, + settlementGranularityId: 1, + settlementInterchangeId: 1, + settlementDelayId: 2, + currencyId: null, + requireLiquidityCheck: 1, + ledgerAccountTypeId: 2, + autoPositionReset: 1 + } + ] + const settlementModel = [ + + { + settlementModelId: 106, + name: 'DEFERRED_NET', + isActive: true, + settlementGranularity: 'GROSS', + settlementInterchange: 'BILATERAL', + settlementDelay: 'DEFERRED', + currency: null, + requireLiquidityCheck: true, + ledgerAccountTypeId: 'SETTLEMENT', + autoPositionReset: true + } + ] + settlementModelHandlerTest.beforeEach(test => { + sandbox = Sinon.createSandbox() + sandbox.stub(Sidecar) + sandbox.stub(Logger) + sandbox.stub(SettlementService) + sandbox.stub(Cache) + Cache.getEnums.returns(Promise.resolve({ POSITION: 1, SETTLEMENT: 2, HUB_RECONCILIATION: 3, HUB_MULTILATERAL_SETTLEMENT: 4, HUB_FEE: 5 })) + test.end() + }) + + settlementModelHandlerTest.afterEach(test => { + sandbox.restore() + test.end() + }) + settlementModelHandlerTest.test('Handler Test', async handlerTest => { + handlerTest.test('create should create a new settlement model and return a 201', async function (test) { + const payload = { + name: 'IMMEDIATE_GROSS', + settlementGranularity: 'GROSS', + settlementInterchange: 'BILATERAL', + settlementDelay: 'IMMEDIATE', + settlementCurrency: 'USD', + requireLiquidityCheck: true, + type: 'POSITION', + autoPositionReset: true + } + SettlementService.getLedgerAccountTypeName.returns(Promise.resolve(ledgerAccountType)) + SettlementService.getByName.returns(Promise.resolve(false)) + const reply = { + response: () => { + return { + code: statusCode => { + test.equal(statusCode, 201) + test.end() + } + } + } + } + await Handler.create({ payload }, reply) + }) + + handlerTest.test('create should fail if the settlement model exists', async function (test) { + const payload = { + name: 'IMMEDIATE_GROSS', + settlementGranularity: 'GROSS', + settlementInterchange: 'BILATERAL', + settlementDelay: 'IMMEDIATE', + settlementCurrency: 'USD', + requireLiquidityCheck: true, + type: 'POSITION', + autoPositionReset: true + } + SettlementService.getLedgerAccountTypeName.returns(Promise.resolve(ledgerAccountType)) + SettlementService.getByName.returns(Promise.resolve(true)) + try { + await Handler.create({ payload }) + test.fail('Error not thrown') + } catch (e) { + test.ok(e instanceof Error) + test.equal(e.message, 'This Settlement Model already exists') + test.end() + } + }) + + handlerTest.test('create should fail if account type does not exists', async function (test) { + const payload = { + name: 'DEFERRED_NET', + settlementGranularity: 'NET', + settlementInterchange: 'MULTILATERAL', + settlementDelay: 'DEFERRED', + settlementCurrency: 'USD', + requireLiquidityCheck: true, + type: 'POSITION', + autoPositionReset: true + } + SettlementService.getLedgerAccountTypeName.returns(Promise.resolve(false)) + + try { + await Handler.create({ payload }) + test.fail('Error not thrown') + } catch (e) { + test.ok(e instanceof Error) + test.equal(e.message, 'Ledger account type was not found') + test.end() + } + }) + + handlerTest.test('create should fail if definition is not supported', async function (test) { + const payload = { + name: 'DEFERRED_NET', + settlementGranularity: 'GROSS', + settlementInterchange: 'MULTILATERAL', + settlementDelay: 'DEFERRED', + settlementCurrency: 'USD', + requireLiquidityCheck: true, + type: 'POSITION', + autoPositionReset: true + } + SettlementService.getLedgerAccountTypeName.returns(Promise.resolve(false)) + + try { + await Handler.create({ payload }) + test.fail('Error not thrown') + } catch (e) { + test.ok(e instanceof Error) + test.equal(e.message, 'Invalid settlement model definition - delay-granularity-interchange combination is not supported') + test.end() + } + }) + + handlerTest.test('getAll should return all the settlement models', async function (test) { + SettlementService.getLedgerAccountTypeName.returns(Promise.resolve(ledgerAccountType)) + SettlementService.getAll.returns(Promise.resolve(settlementModelService)) + const result = await Handler.getAll() + test.deepEqual(result, settlementModel, 'The results match') + test.end() + }) + + handlerTest.test('getByName should return the settlement model', async function (test) { + SettlementService.getByName.withArgs(settlementModel[0].name).returns(Promise.resolve(settlementModelService[0])) + const result = await Handler.getByName(createRequest({ params: { name: settlementModel[0].name } })) + test.deepEqual(result, settlementModel[0], 'The results match') + test.end() + }) + + handlerTest.test('getByName should throw error', async function (test) { + SettlementService.getByName.withArgs(settlementModel[0].name).returns(Promise.resolve(null)) + try { + await Handler.getByName(createRequest({ params: { name: settlementModel[0].name } })) + } catch (e) { + test.ok(e instanceof Error) + test.equal(e.message, 'The requested resource could not be found.') + test.end() + } + }) + + handlerTest.test('update should update, return settlement model and utilize logger', async function (test) { + SettlementService.update.withArgs(settlementModel[0].name, { isActive: 1 }).returns(Promise.resolve(settlementModelService[0])) + try { + const result = await Handler.update(createRequest({ + params: { name: settlementModel[0].name }, + payload: { isActive: 1 } + })) + test.deepEqual(result, settlementModel[0], 'The results match') + test.ok(Logger.info.withArgs('SettlementModel has been activated :: {"name":"DEFERRED_NET","isActive":1}')) + test.end() + } catch (err) { + test.fail('Error thrown') + test.end() + } + }) + + handlerTest.test('update should update, return settlement model if settlement model when inactive and utilize', async function (test) { + SettlementService.update.withArgs(settlementModel[0].name, { isActive: 0 }).returns(Promise.resolve(settlementModelService[0])) + try { + const result = await Handler.update(createRequest({ + params: { name: settlementModel[0].name }, + payload: { isActive: 0 } + })) + test.deepEqual(result, settlementModel[0], 'The results match') + test.ok(Logger.info.withArgs('SettlementModel has been disabled :: {"name":"DEFERRED_NET","isActive":0}')) + test.end() + } catch (err) { + test.fail('Error thrown') + test.end() + } + }) + + handlerTest.test('update should throw error', async function (test) { + SettlementService.update.withArgs(settlementModel[0].name, { isActive: 1 }).throws(new Error('Test error')) + try { + await Handler.update(createRequest({ params: { name: settlementModelService[0].name }, payload: { isActive: 1 } })) + } catch (e) { + test.ok(e instanceof FSPIOPError) + test.equal(e.message, 'Test error') + test.end() + } + }) + + handlerTest.end() + }) + + settlementModelHandlerTest.end() +}) diff --git a/test/unit/api/settlementModels/routes.test.js b/test/unit/api/settlementModels/routes.test.js new file mode 100644 index 000000000..900d0facc --- /dev/null +++ b/test/unit/api/settlementModels/routes.test.js @@ -0,0 +1,39 @@ +/***** + License + -------------- + Copyright © 2017 Bill & Melinda Gates Foundation + 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 + http://www.apache.org/licenses/LICENSE-2.0 + 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. + Contributors + -------------- + This is the official list of the Mojaloop project contributors for this file. + Names of the original copyright holders (individuals or organizations) + should be listed with a '*' in the first column. People who have + contributed from an organization can be listed under the organization + that actually holds the copyright for their contributions (see the + Gates Foundation organization for an example). Those individuals should have + their names indented and be marked with a '-'. Email address can be added + optionally within square brackets . + * Gates Foundation + - Name Surname + + * ModusBox + - Georgi Georgiev + - Lazola Lucas + -------------- + ******/ +'use strict' + +const Test = require('tape') +const Base = require('../../base') +const AdminRoutes = require('../../../../src/api/routes') + +Test('test settlementModels routes', async function (assert) { + const req = Base.buildRequest({ url: '/settlementModels', method: 'POST' }) + const server = await Base.setup(AdminRoutes) + const res = await server.inject(req) + assert.ok(res) + await server.stop() + assert.end() +}) diff --git a/test/unit/domain/settlement/index.test.js b/test/unit/domain/settlement/index.test.js new file mode 100644 index 000000000..56b3cd56e --- /dev/null +++ b/test/unit/domain/settlement/index.test.js @@ -0,0 +1,233 @@ +/***** + License + -------------- + Copyright © 2017 Bill & Melinda Gates Foundation + 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 + http://www.apache.org/licenses/LICENSE-2.0 + 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. + Contributors + -------------- + This is the official list of the Mojaloop project contributors for this file. + Names of the original copyright holders (individuals or organizations) + should be listed with a '*' in the first column. People who have + contributed from an organization can be listed under the organization + that actually holds the copyright for their contributions (see the + Gates Foundation organization for an example). Those individuals should have + their names indented and be marked with a '-'. Email address can be added + optionally within square brackets . + * Gates Foundation + - Name Surname + + * ModusBox + - Georgi Georgiev + - Lazola Lucas + -------------- + ******/ +'use strict' + +const Test = require('tapes')(require('tape')) +const Sinon = require('sinon') +const Db = require('../../../../src/lib/db') +const SettlementModel = require('../../../../src/models/settlement/settlementModel') +const LedgerAccountTypeModel = require('../../../../src/models/ledgerAccountType/ledgerAccountType') +const Logger = require('@mojaloop/central-services-logger') + +const SettlementService = require('../../../../src/domain/settlement/index') + +Test('SettlementModel SettlementService', async (settlementModelTest) => { + let sandbox + + settlementModelTest.beforeEach(t => { + sandbox = Sinon.createSandbox() + sandbox.stub(LedgerAccountTypeModel, 'getLedgerAccountByName') + + Db.settlementModel = { + insert: sandbox.stub(), + update: sandbox.stub(), + findOne: sandbox.stub(), + find: sandbox.stub(), + destroy: sandbox.stub() + } + t.end() + }) + + settlementModelTest.afterEach(t => { + sandbox.restore() + t.end() + }) + + const settlementModel = [ + + { + settlementModelId: 106, + name: 'DEFERRED_NET', + isActive: 1, + settlementGranularityId: 1, + settlementInterchangeId: 1, + settlementDelayId: 2, + currencyId: null, + requireLiquidityCheck: 1, + ledgerAccountTypeId: 6 + } + ] + + await settlementModelTest.test('create settlement model', async (assert) => { + try { + sandbox.stub(SettlementModel, 'create') + const expected = await SettlementService.createSettlementModel('IMMEDIATE_GROSS', true, 1, 1, 1, 'USD', true, 'POSITION', true) + assert.equal(expected, true) + assert.end() + } catch (err) { + assert.assert(err instanceof Error, ` throws ${err} `) + assert.end() + } + }) + + await settlementModelTest.test('create settlement model should throw an error', async (assert) => { + try { + sandbox.stub(SettlementModel, 'create').throws(new Error()) + await SettlementService.createSettlementModel() + assert.fail('Error not thrown') + assert.end() + } catch (err) { + assert.ok(err instanceof Error) + assert.end() + } + }) + await settlementModelTest.test('getLedgerAccountType by name name should return ledgerAccountType', async (assert) => { + const name = { + currency: 'AFA', + type: 'POSITION' + } + const ledgerAccountsMock = { + ledgerAccountTypeId: 1, + name: 'POSITION', + description: 'Typical accounts from which a DFSP provisions transfers', + isActive: 1, + createdDate: '2018-10-11T11:45:00.000Z' + } + + try { + LedgerAccountTypeModel.getLedgerAccountByName.withArgs(name.type).returns(ledgerAccountsMock) + const expected = await SettlementService.getLedgerAccountTypeName(name.type) + assert.deepEqual(expected, ledgerAccountsMock, 'Results matched') + assert.end() + } catch (err) { + assert.assert(err instanceof Error, ` throws ${err} `) + assert.end() + } + }) + + await settlementModelTest.test('getLedgerAccountType by name name should throw an error if the name is invalid', async (assert) => { + const name = { + currency: 'AFA', + type: 'POSITION' + } + const ledgerAccountsMock = { + ledgerAccountTypeId: 1, + name: 'POSITION', + description: 'Typical accounts from which a DFSP provisions transfers', + isActive: 1, + createdDate: '2018-10-11T11:45:00.000Z' + } + + try { + LedgerAccountTypeModel.getLedgerAccountByName.withArgs(name.type).throws(new Error()) + const expected = await SettlementService.getLedgerAccountTypeName(name.type) + assert.deepEqual(expected, ledgerAccountsMock, 'Results matched') + assert.end() + } catch (err) { + assert.assert(err instanceof Error, ` throws ${err} `) + assert.end() + } + }) + await settlementModelTest.test('get settlement model by name', async (assert) => { + try { + sandbox.stub(SettlementModel, 'getByName').returns(settlementModel) + const expected = await SettlementService.getByName('test') + assert.equal(expected, settlementModel) + assert.end() + } catch (err) { + assert.assert(err instanceof Error, ` throws ${err} `) + assert.end() + } + }) + + await settlementModelTest.test('get settlement model by name should throw an error', async (assert) => { + try { + sandbox.stub(SettlementModel, 'getByName').throws(new Error()) + await SettlementService.getByName('test') + assert.fail('Error not thrown') + assert.end() + } catch (err) { + assert.ok(err instanceof Error) + assert.end() + } + }) + + await settlementModelTest.test('getAll', async (assert) => { + try { + sandbox.stub(SettlementModel, 'getAll').returns(settlementModel) + const result = await SettlementService.getAll() + assert.deepEqual(result, settlementModel) + assert.end() + } catch (err) { + Logger.error(`get all settlement models failed with error - ${err}`) + assert.fail() + assert.end() + } + }) + + await settlementModelTest.test('getAll', async (assert) => { + try { + sandbox.stub(SettlementModel, 'getAll').throws(new Error()) + await SettlementService.getAll() + assert.fail('Error not thrown') + assert.end() + } catch (err) { + assert.ok(err instanceof Error) + assert.end() + } + }) + + await settlementModelTest.test('update', async (assert) => { + try { + sandbox.stub(SettlementModel, 'getByName').returns(settlementModel) + sandbox.stub(SettlementModel, 'update').returns(settlementModel) + const result = await SettlementService.update('DEFERRED_NET', { isActive: 1 }) + assert.deepEqual(result, settlementModel) + assert.end() + } catch (err) { + Logger.error(`get all settlement models failed with error - ${err}`) + assert.fail() + assert.end() + } + }) + + await settlementModelTest.test('update should throw an error', async (assert) => { + try { + sandbox.stub(SettlementModel, 'getByName').throws(new Error()) + sandbox.stub(SettlementModel, 'update').returns(settlementModel) + await SettlementService.update('DEFERRED_NET', { isActive: 1 }) + assert.fail('Error not thrown') + assert.end() + } catch (err) { + assert.ok(err instanceof Error) + assert.end() + } + }) + await settlementModelTest.test('update should throw an error when settlement model does not exists', async (assert) => { + try { + sandbox.stub(SettlementModel, 'getByName').returns(false) + sandbox.stub(SettlementModel, 'update').returns(settlementModel) + await SettlementService.update('DEFERRED_NET', { isActive: 1 }) + assert.fail('Error not thrown') + assert.end() + } catch (err) { + assert.ok(err instanceof Error) + assert.end() + } + }) + + await settlementModelTest.end() +}) diff --git a/test/unit/models/settlement/settlementModel.test.js b/test/unit/models/settlement/settlementModel.test.js new file mode 100644 index 000000000..de87fa0cf --- /dev/null +++ b/test/unit/models/settlement/settlementModel.test.js @@ -0,0 +1,210 @@ +/***** + License + -------------- + Copyright © 2017 Bill & Melinda Gates Foundation + 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 + http://www.apache.org/licenses/LICENSE-2.0 + 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. + Contributors + -------------- + This is the official list of the Mojaloop project contributors for this file. + Names of the original copyright holders (individuals or organizations) + should be listed with a '*' in the first column. People who have + contributed from an organization can be listed under the organization + that actually holds the copyright for their contributions (see the + Gates Foundation organization for an example). Those individuals should have + their names indented and be marked with a '-'. Email address can be added + optionally within square brackets . + * Gates Foundation + - Name Surname + + * ModusBox + - Georgi Georgiev + - Lazola Lucas + -------------- + ******/ +'use strict' + +const Test = require('tapes')(require('tape')) +const Sinon = require('sinon') +const Db = require('../../../../src/lib/db') +const Logger = require('@mojaloop/central-services-logger') +const SettlementModelModel = require('../../../../src/models/settlement/settlementModel') + +Test('Settlement model', async (settlementTest) => { + const settlementModelId = 1 + const settlementModel = [ + + { + settlementModelId: 106, + name: 'DEFERRED_NET', + isActive: 1, + settlementGranularityId: 1, + settlementInterchangeId: 1, + settlementDelayId: 2, + currencyId: null, + requireLiquidityCheck: 1, + ledgerAccountTypeId: 6 + } + ] + + const sandbox = Sinon.createSandbox() + await settlementTest.test('create settlement model', async (assert) => { + Db.settlementModel = { + insert: sandbox.stub().returns(true), + find: sandbox.stub(), + update: sandbox.stub() + } + try { + const r = await SettlementModelModel.create({ name: 'DEFERRED_NET', settlementGranularityId: 2, settlementInterchangeId: 2, settlementDelayId: 2, ledgerAccountTypeId: 1 }) + assert.ok(r) + assert.end() + } catch (err) { + Logger.error(`create settlement model failed with error - ${err}`) + assert.pass('Error thrown') + assert.end() + } + }) + + await settlementTest.test('create settlement model should throw an error', async (assert) => { + Db.settlementModel.insert.throws(new Error('message')) + try { + const r = await SettlementModelModel.create({ name: 'DEFERRED_NET', settlementGranularityId: 2, settlementInterchangeId: 2, settlementDelayId: 2, ledgerAccountTypeId: 1 }) + assert.comment(r) + assert.fail(' should throw') + } catch (err) { + assert.assert(err instanceof Error) + Logger.error(`create settlement model failed with error - ${err}`) + assert.pass('Error thrown') + } + assert.end() + }) + + await settlementTest.test('get settlement model', async (assert) => { + try { + Db.settlementModel.find.withArgs({ name: 'test' }).returns([ + { + settlementModelId: 106, + name: 'testingSevennnnN91', + isActive: 1, + settlementGranularityId: 1, + settlementInterchangeId: 1, + settlementDelayId: 2, + currencyId: null, + requireLiquidityCheck: 1, + ledgerAccountTypeId: 6 + }]) + const expected = { + settlementModelId: 106, + name: 'testingSevennnnN91', + isActive: 1, + settlementGranularityId: 1, + settlementInterchangeId: 1, + settlementDelayId: 2, + currencyId: null, + requireLiquidityCheck: 1, + ledgerAccountTypeId: 6 + } + const result = await SettlementModelModel.getByName('test') + assert.equal(JSON.stringify(result), JSON.stringify(expected)) + assert.end() + } catch (err) { + Logger.error(`get settlement model by name failed with error - ${err}`) + assert.fail() + assert.end() + } + }) + + await settlementTest.test('get with empty name', async (assert) => { + Db.settlementModel.find.withArgs({ name: '' }).throws(new Error()) + try { + await SettlementModelModel.getByName('') + assert.fail(' should throws with empty name ') + } catch (err) { + assert.assert(err instanceof Error, ` throws ${err} `) + } + assert.end() + }) + + await settlementTest.test('get all settlement models', async (assert) => { + try { + Db.settlementModel.find.withArgs().returns([ + { + settlementModelId: 106, + name: 'testingSevennnnN91', + isActive: 1, + settlementGranularityId: 1, + settlementInterchangeId: 1, + settlementDelayId: 2, + currencyId: null, + requireLiquidityCheck: 1, + ledgerAccountTypeId: 6 + }]) + const expected = [{ + settlementModelId: 106, + name: 'testingSevennnnN91', + isActive: 1, + settlementGranularityId: 1, + settlementInterchangeId: 1, + settlementDelayId: 2, + currencyId: null, + requireLiquidityCheck: 1, + ledgerAccountTypeId: 6 + }] + const result = await SettlementModelModel.getAll() + assert.equal(JSON.stringify(result), JSON.stringify(expected)) + assert.end() + } catch (err) { + Logger.error(`get settlement model by name failed with error - ${err}`) + assert.fail() + assert.end() + } + }) + + await settlementTest.test('getAl throws an error', async (assert) => { + Db.settlementModel.find.withArgs().throws(new Error()) + try { + await SettlementModelModel.getAll() + assert.fail(' should throws an error ') + } catch (err) { + assert.assert(err instanceof Error, ` throws ${err} `) + } + assert.end() + }) + + await settlementTest.test('update', async (assert) => { + try { + Db.settlementModel.update.withArgs( + { settlementModelId: 1 }, { isActive: 1 } + ).returns(settlementModelId) + const updatedId = await SettlementModelModel.update(Object.assign(settlementModel[0], { settlementModelId: 1 }), 1) + assert.equal(updatedId, settlementModelId) + sandbox.restore() + assert.end() + } catch (err) { + Logger.error(`update settlementModel failed with error - ${err}`) + sandbox.restore() + assert.fail() + assert.end() + } + }) + + await settlementTest.test('update should throw an error', async (test) => { + try { + Db.settlementModel.update.withArgs( + { settlementModelId: 1 }, { isActive: 1 } + ).throws(new Error()) + const updatedId = await SettlementModelModel.update(Object.assign(settlementModel[0], { settlementModelId: 1 }), 1) + test.equal(updatedId, settlementModelId) + test.fail('Error not thrown') + sandbox.restore() + test.end() + } catch (err) { + Logger.error(`update settlementModel failed with error - ${err}`) + test.pass('Error thrown') + sandbox.restore() + test.end() + } + }) + await settlementTest.end() +})