@mojaloop/central-ledger 17.1.2 → 17.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ## [17.2.0](https://github.com/mojaloop/central-ledger/compare/v17.1.2...v17.2.0) (2023-09-07)
6
+
7
+
8
+ ### Features
9
+
10
+ * **mojaloop/#3519:** add topic name override config map logic ([#969](https://github.com/mojaloop/central-ledger/issues/969)) ([b99d091](https://github.com/mojaloop/central-ledger/commit/b99d09129f328aab60e4059035be4d263ecd9f98)), closes [mojaloop/#3519](https://github.com/mojaloop/project/issues/3519)
11
+
5
12
  ### [17.1.2](https://github.com/mojaloop/central-ledger/compare/v17.1.1...v17.1.2) (2023-09-06)
6
13
 
7
14
 
package/README.md CHANGED
@@ -88,6 +88,26 @@ The Central Ledger has many options that can be configured through environment v
88
88
  | CLEDG\_AMOUNT__PRECISION | Numeric value used to determine precision recorded for transfer amounts on this ledger. | 10 |
89
89
  | CLEDG\_AMOUNT__SCALE | Numeric value used to determine scale recorded for transfer amounts on this ledger. | 2 |
90
90
 
91
+ ### Kafka Position Event Type Action Topic Map
92
+
93
+ In some cases, you might want to publish position type messages onto a customized topic name that
94
+ diverges from the defaults.
95
+
96
+ You can configure the customized topic names in the config. Each position action key
97
+ refers to position messages with associated actions.
98
+
99
+ NOTE: Only POSITION.PREPARE is supported at this time, with additional event-type-actions being added later when required.
100
+
101
+ ```
102
+ "KAFKA": {
103
+ "EVENT_TYPE_ACTION_TOPIC_MAP" : {
104
+ "POSITION":{
105
+ "PREPARE": "topic-transfer-position-batch"
106
+ }
107
+ }
108
+ }
109
+ ```
110
+
91
111
  ## API
92
112
 
93
113
  For endpoint documentation, see the [API documentation](API.md).
@@ -165,6 +185,11 @@ If you want to run integration tests in a repetitive manner, you can startup the
165
185
  npm run test:int
166
186
  ```
167
187
 
188
+ If you want to run override position topic tests you can repeat the above and use `npm run test:int-override` after configuring settings found [here](#kafka-position-event-type-action-topic-map)
189
+
190
+ If you want to just run all of the integration suite non-interactively then use npm run `test:integration`.
191
+ It will handle docker start up, migration, service starting and testing. Be sure to exit any previously ran handlers or docker commands.
192
+
168
193
  ### Running Functional Tests
169
194
 
170
195
  If you want to run functional tests locally utilizing the [ml-core-test-harness](https://github.com/mojaloop/ml-core-test-harness), you can run the following commands:
@@ -221,7 +246,7 @@ Configuration modifiers:
221
246
  ```bash
222
247
  sh ./test/util/scripts/populateTestData.sh
223
248
  ```
224
-
249
+
225
250
  View Logs for Mockserver (i.e. Payee Receiver) and ML-API-Adapter:
226
251
 
227
252
  ```bash
@@ -85,6 +85,11 @@
85
85
  },
86
86
  "API_DOC_ENDPOINTS_ENABLED": true,
87
87
  "KAFKA": {
88
+ "EVENT_TYPE_ACTION_TOPIC_MAP" : {
89
+ "POSITION":{
90
+ "PREPARE": null
91
+ }
92
+ },
88
93
  "TOPIC_TEMPLATES": {
89
94
  "PARTICIPANT_TOPIC_TEMPLATE": {
90
95
  "TEMPLATE": "topic-{{participantName}}-{{functionality}}-{{action}}",
@@ -25,7 +25,8 @@ topics=(
25
25
  "topic-bulk-prepare"
26
26
  "topic-bulk-fulfil"
27
27
  "topic-bulk-processing"
28
- "topic-bulk-get"
28
+ "topic-bulk-get",
29
+ "topic-transfer-position-batch"
29
30
  )
30
31
 
31
32
  # Loop through the topics and create them using kafka-topics.sh
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mojaloop/central-ledger",
3
- "version": "17.1.2",
3
+ "version": "17.2.0",
4
4
  "description": "Central ledger hosted by a scheme to record and settle transfers",
5
5
  "license": "Apache-2.0",
6
6
  "author": "ModusBox",
@@ -47,9 +47,12 @@
47
47
  "test:xunit": "npm run test:unit | tap-xunit > ./test/results/xunit.xml",
48
48
  "test:coverage": "npx nyc --reporter=lcov --reporter=text-summary tapes -- 'test/unit/**/**.test.js'",
49
49
  "test:coverage-check": "npm run test:coverage && nyc check-coverage",
50
- "test:int": "npx tape 'test/integration/**/*.test.js'",
51
- "test:int:spec": "npm run test:int | tap-spec",
50
+ "test:int": "npx tape 'test/integration/**/*.test.js' ",
51
+ "test:int-override": "npx tape 'test/integration-override/**/*.test.js'",
52
+ "test:int:spec": "npm run test:int | npx tap-spec",
52
53
  "test:xint": "npm run test:int | tap-xunit > ./test/results/xunit-integration.xml",
54
+ "test:xint-override": "npm run test:int-override | tap-xunit > ./test/results/xunit-integration-override.xml",
55
+ "test:integration": "sh ./test/scripts/test-integration.sh",
53
56
  "test:functional": "sh ./test/scripts/test-functional.sh",
54
57
  "migrate": "npm run migrate:latest && npm run seed:run",
55
58
  "migrate:latest": "npx knex $npm_package_config_knex migrate:latest",
@@ -87,7 +90,7 @@
87
90
  "@mojaloop/central-services-health": "14.0.2",
88
91
  "@mojaloop/central-services-logger": "11.2.2",
89
92
  "@mojaloop/central-services-metrics": "12.0.8",
90
- "@mojaloop/central-services-shared": "18.0.0",
93
+ "@mojaloop/central-services-shared": "18.1.0",
91
94
  "@mojaloop/central-services-stream": "11.1.1",
92
95
  "@mojaloop/event-sdk": "12.0.2",
93
96
  "@mojaloop/ml-number": "11.2.3",
@@ -126,7 +129,7 @@
126
129
  "jsdoc": "4.0.2",
127
130
  "jsonpath": "1.1.1",
128
131
  "nodemon": "3.0.1",
129
- "npm-check-updates": "16.13.2",
132
+ "npm-check-updates": "16.13.3",
130
133
  "nyc": "15.1.0",
131
134
  "pre-commit": "1.2.2",
132
135
  "proxyquire": "2.1.3",
@@ -136,7 +139,7 @@
136
139
  "standard-version": "^9.5.0",
137
140
  "tap-spec": "^5.0.0",
138
141
  "tap-xunit": "2.4.1",
139
- "tape": "4.13.2",
142
+ "tape": "4.16.2",
140
143
  "tapes": "4.1.0"
141
144
  },
142
145
  "config": {
@@ -200,7 +200,7 @@ const prepare = async (error, messages) => {
200
200
  const eventDetail = { functionality, action }
201
201
  // Key position prepare message with payer account id
202
202
  const payerAccount = await Participant.getAccountByNameAndCurrency(payload.payerFsp, payload.amount.currency, Enum.Accounts.LedgerAccountType.POSITION)
203
- await Kafka.proceed(Config.KAFKA_CONFIG, params, { consumerCommit, eventDetail, messageKey: payerAccount.participantCurrencyId.toString() })
203
+ await Kafka.proceed(Config.KAFKA_CONFIG, params, { consumerCommit, eventDetail, messageKey: payerAccount.participantCurrencyId.toString(), topicNameOverride: Config.KAFKA_CONFIG.EVENT_TYPE_ACTION_TOPIC_MAP?.POSITION?.PREPARE })
204
204
  histTimerEnd({ success: true, fspId: Config.INSTRUMENTATION_METRICS_LABELS.fspId })
205
205
  return true
206
206
  } else {