account-lookup-service 15.5.0-iso.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (209) hide show
  1. package/.circleci/config.yml +11 -0
  2. package/.ncurc.yaml +6 -0
  3. package/.nvmrc +1 -0
  4. package/.nycrc.yml +20 -0
  5. package/.versionrc +15 -0
  6. package/CHANGELOG.md +330 -0
  7. package/CODEOWNERS +38 -0
  8. package/Dockerfile +45 -0
  9. package/LICENSE.md +10 -0
  10. package/README.md +252 -0
  11. package/audit-ci.jsonc +32 -0
  12. package/audit-resolve.json +161 -0
  13. package/config/default.json +109 -0
  14. package/config/knexfile.js +21 -0
  15. package/docker/account-lookup-service/default.json +106 -0
  16. package/docker/account-lookup-service/make-default-json.sh +5 -0
  17. package/docker/account-lookup-service/override.json +15 -0
  18. package/docker/central-ledger/default.json +458 -0
  19. package/docker/config-modifier/account-lookup-service.js +31 -0
  20. package/docker/kafka/consumer.properties +26 -0
  21. package/docker/kafka/producer.properties +45 -0
  22. package/docker/kafka/server.properties +143 -0
  23. package/docker/kafka/tools-log4j.properties +21 -0
  24. package/docker/mock-proxy/Dockerfile +15 -0
  25. package/docker/mock-proxy/package-lock.json +4986 -0
  26. package/docker/mock-proxy/package.json +24 -0
  27. package/docker/mock-proxy/src/config.ts +14 -0
  28. package/docker/mock-proxy/src/server.ts +94 -0
  29. package/docker/mock-proxy/src/utils.ts +29 -0
  30. package/docker/mock-proxy/tsconfig.json +24 -0
  31. package/docker/sql-init/01_permissions.sql +2 -0
  32. package/docker/sql-init-central-ledger/01_permissions.sql +2 -0
  33. package/docker/wait-for/wait-for-account-lookup-service.sh +10 -0
  34. package/docker/wait-for/wait-for-central-ledger.sh +11 -0
  35. package/docker/wait-for/wait-for-kafka.sh +7 -0
  36. package/docker/wait-for/wait-for-ml-api-adapter.sh +9 -0
  37. package/docker/wait-for/wait-for-mockserver.sh +20 -0
  38. package/docker/wait-for/wait-for-mysql-als.sh +14 -0
  39. package/docker/wait-for/wait-for-mysql-central-ledger.sh +11 -0
  40. package/docker/wait-for/wait-for-mysql.sh +11 -0
  41. package/docker/wait-for/wait-for-objstore.sh +12 -0
  42. package/docker/wait-for/wait-for.env +18 -0
  43. package/docker/wait-for/wait-for.sh +81 -0
  44. package/docker-compose.integration.yml +29 -0
  45. package/docker-compose.yml +243 -0
  46. package/jest-int.config.js +8 -0
  47. package/jest.config.js +16 -0
  48. package/jsdoc.json +38 -0
  49. package/migrations/01_currency.js +42 -0
  50. package/migrations/02_endpointType.js +43 -0
  51. package/migrations/03_endpointType-indexes.js +37 -0
  52. package/migrations/04_partyIdType.js +43 -0
  53. package/migrations/05_partyIdType-indexes.js +38 -0
  54. package/migrations/08_oracleEndpoint.js +51 -0
  55. package/migrations/09_oracleEndpoint-indexes.js +41 -0
  56. package/migrations/10_oracleEndpoint-remove-constraints.js +38 -0
  57. package/package.json +180 -0
  58. package/scripts/_wait4_all.js +143 -0
  59. package/scripts/test-functional.sh +76 -0
  60. package/secrets/jwsSigningKey.key +27 -0
  61. package/seeds/currency.js +765 -0
  62. package/seeds/endpointType.js +65 -0
  63. package/seeds/partyIdType.js +79 -0
  64. package/src/api/endpointcache.js +67 -0
  65. package/src/api/health.js +66 -0
  66. package/src/api/index.js +85 -0
  67. package/src/api/oracles/{ID}.js +100 -0
  68. package/src/api/oracles.js +96 -0
  69. package/src/api/participants/{ID}/error.js +44 -0
  70. package/src/api/participants/{ID}.js +44 -0
  71. package/src/api/participants/{Type}/{ID}/error.js +74 -0
  72. package/src/api/participants/{Type}/{ID}/{SubId}/error.js +68 -0
  73. package/src/api/participants/{Type}/{ID}/{SubId}.js +113 -0
  74. package/src/api/participants/{Type}/{ID}.js +133 -0
  75. package/src/api/participants.js +63 -0
  76. package/src/api/parties/{Type}/{ID}/error.js +66 -0
  77. package/src/api/parties/{Type}/{ID}/{SubId}/error.js +56 -0
  78. package/src/api/parties/{Type}/{ID}/{SubId}.js +77 -0
  79. package/src/api/parties/{Type}/{ID}.js +98 -0
  80. package/src/api/routes.js +294 -0
  81. package/src/constants.js +16 -0
  82. package/src/domain/oracle/index.js +33 -0
  83. package/src/domain/oracle/oracle.js +234 -0
  84. package/src/domain/participants/index.js +35 -0
  85. package/src/domain/participants/participants.js +560 -0
  86. package/src/domain/parties/getPartiesByTypeAndID.js +239 -0
  87. package/src/domain/parties/index.js +32 -0
  88. package/src/domain/parties/parties.js +215 -0
  89. package/src/domain/parties/utils.js +84 -0
  90. package/src/domain/timeout/dto.js +48 -0
  91. package/src/domain/timeout/index.js +104 -0
  92. package/src/handlers/TimeoutHandler.js +94 -0
  93. package/src/handlers/index.js +70 -0
  94. package/src/handlers/monitoring/index.js +51 -0
  95. package/src/handlers/monitoring/plugins/health.js +61 -0
  96. package/src/handlers/monitoring/plugins/metrics.js +48 -0
  97. package/src/handlers/register.js +102 -0
  98. package/src/index.js +66 -0
  99. package/src/interface/admin-swagger.yaml +804 -0
  100. package/src/interface/admin_swagger.json +959 -0
  101. package/src/interface/api-swagger-iso20022-parties.yaml +1734 -0
  102. package/src/interface/api-swagger.yaml +1733 -0
  103. package/src/interface/api_swagger.json +3046 -0
  104. package/src/interface/fspiop-rest-v2.0-ISO20022_parties.yaml +2256 -0
  105. package/src/interface/thirdparty/admin-swagger.yaml +808 -0
  106. package/src/interface/thirdparty/admin_swagger.json +961 -0
  107. package/src/interface/thirdparty/api-swagger.yaml +1739 -0
  108. package/src/interface/thirdparty/api_swagger.json +3142 -0
  109. package/src/lib/argv.js +39 -0
  110. package/src/lib/cache.js +126 -0
  111. package/src/lib/config.js +183 -0
  112. package/src/lib/db.js +26 -0
  113. package/src/lib/headers.js +53 -0
  114. package/src/lib/healthCheck/subServiceHealth.js +84 -0
  115. package/src/lib/index.js +11 -0
  116. package/src/lib/migrator.js +17 -0
  117. package/src/lib/requestLogger.js +54 -0
  118. package/src/lib/util.js +66 -0
  119. package/src/metrics/handler.js +33 -0
  120. package/src/metrics/plugin.js +52 -0
  121. package/src/metrics/routes.js +43 -0
  122. package/src/models/currency/currency.js +48 -0
  123. package/src/models/currency/index.js +32 -0
  124. package/src/models/endpointType/endpointType.js +48 -0
  125. package/src/models/endpointType/index.js +32 -0
  126. package/src/models/misc/migrationLock.js +49 -0
  127. package/src/models/oracle/facade.js +341 -0
  128. package/src/models/oracle/index.js +41 -0
  129. package/src/models/oracle/oracleEndpoint.js +192 -0
  130. package/src/models/oracle/oracleEndpointCached.js +108 -0
  131. package/src/models/participantEndpoint/facade.js +238 -0
  132. package/src/models/partyIdType/index.js +32 -0
  133. package/src/models/partyIdType/partyIdType.js +41 -0
  134. package/src/plugins.js +139 -0
  135. package/src/server.js +199 -0
  136. package/test/fixtures/index.js +131 -0
  137. package/test/fixtures/iso.js +110 -0
  138. package/test/integration/.env +8 -0
  139. package/test/integration/api/parties.test.js +137 -0
  140. package/test/integration/constants.js +20 -0
  141. package/test/integration/domain/oracle/index.test.js +324 -0
  142. package/test/integration/domain/timeout/index.test.js +75 -0
  143. package/test/integration/env.sh +15 -0
  144. package/test/integration/example.test.js +12 -0
  145. package/test/integration/models/currency/currency.test.js +68 -0
  146. package/test/integration/plugins.test.js +62 -0
  147. package/test/integration/prepareTestParticipants.js +30 -0
  148. package/test/integration/setup.js +5 -0
  149. package/test/integration-config.json +81 -0
  150. package/test/integration-runner.sh +108 -0
  151. package/test/unit/api/health.test.js +142 -0
  152. package/test/unit/api/oracles/{ID}.test.js +264 -0
  153. package/test/unit/api/oracles.test.js +173 -0
  154. package/test/unit/api/participants/participants.test.js +117 -0
  155. package/test/unit/api/participants/{Type}/{ID}/error.test.js +155 -0
  156. package/test/unit/api/participants/{Type}/{ID}/{SubId}/error.test.js +131 -0
  157. package/test/unit/api/participants/{Type}/{ID}/{SubId}.test.js +377 -0
  158. package/test/unit/api/participants/{Type}/{ID}.test.js +383 -0
  159. package/test/unit/api/participants.test.js +108 -0
  160. package/test/unit/api/parties/endpointcache.test.js +83 -0
  161. package/test/unit/api/parties/parties.test.js +102 -0
  162. package/test/unit/api/parties/{Type}/{ID}/error.test.js +145 -0
  163. package/test/unit/api/parties/{Type}/{ID}/{SubId}/error.test.js +141 -0
  164. package/test/unit/api/parties/{Type}/{ID}/{SubId}.test.js +241 -0
  165. package/test/unit/api/parties/{Type}/{ID}.test.js +240 -0
  166. package/test/unit/domain/oracle/oracle.test.js +505 -0
  167. package/test/unit/domain/participants/participants.test.js +1724 -0
  168. package/test/unit/domain/parties/parties.test.js +940 -0
  169. package/test/unit/domain/timeout/dto.test.js +28 -0
  170. package/test/unit/domain/timeout/index.test.js +81 -0
  171. package/test/unit/handlers/TimeoutHandler.test.js +125 -0
  172. package/test/unit/handlers/index.test.js +56 -0
  173. package/test/unit/handlers/register.test.js +90 -0
  174. package/test/unit/index.test.js +139 -0
  175. package/test/unit/iso20022/partiesValidation.test.js +129 -0
  176. package/test/unit/lib/TransformFacades.test.js +18 -0
  177. package/test/unit/lib/argv.test.js +40 -0
  178. package/test/unit/lib/cache.test.js +172 -0
  179. package/test/unit/lib/config.test.js +108 -0
  180. package/test/unit/lib/healthCheck/subServiceHealth.test.js +89 -0
  181. package/test/unit/lib/migrator.test.js +52 -0
  182. package/test/unit/lib/requestLogger.test.js +115 -0
  183. package/test/unit/lib/util.test.js +68 -0
  184. package/test/unit/mocks.js +66 -0
  185. package/test/unit/models/currency/currency.test.js +91 -0
  186. package/test/unit/models/endpointType/endpointType.test.js +69 -0
  187. package/test/unit/models/misc/migrationLock.test.js +96 -0
  188. package/test/unit/models/oracle/facade.test.js +546 -0
  189. package/test/unit/models/oracle/oracleEndpoint.test.js +409 -0
  190. package/test/unit/models/oracle/oracleEndpointCached.test.js +153 -0
  191. package/test/unit/models/participantEndpoint/facade.test.js +295 -0
  192. package/test/unit/models/partyIdType/partyIdType.test.js +88 -0
  193. package/test/unit/plugins.test.js +89 -0
  194. package/test/unit/setup.js +7 -0
  195. package/test/util/apiClients/AlsApiClient.js +44 -0
  196. package/test/util/apiClients/BasicApiClient.js +34 -0
  197. package/test/util/apiClients/ProxyApiClient.js +25 -0
  198. package/test/util/apiClients/index.js +7 -0
  199. package/test/util/helper.js +332 -0
  200. package/test/util/index.js +11 -0
  201. package/test/util/mockgen.js +43 -0
  202. package/test/util/onboarding.js +132 -0
  203. package/test/util/scripts/addAlsDb.sh +33 -0
  204. package/test/util/scripts/configureMockServer.sh +35 -0
  205. package/test/util/scripts/env.sh +19 -0
  206. package/test/util/scripts/populateTestData.sh +62 -0
  207. package/test/util/scripts/startMockCentralServer.sh +45 -0
  208. package/test/util/scripts/startMockOracleServer.sh +45 -0
  209. package/test/util/testConfig.js +44 -0
package/README.md ADDED
@@ -0,0 +1,252 @@
1
+ # Account Lookup Service
2
+
3
+ [![Git Commit](https://img.shields.io/github/last-commit/mojaloop/account-lookup-service.svg?style=flat)](https://github.com/mojaloop/account-lookup-service/commits/main)
4
+ [![Git Releases](https://img.shields.io/github/release/mojaloop/account-lookup-service.svg?style=flat)](https://github.com/mojaloop/account-lookup-service/releases)
5
+ [![Docker pulls](https://img.shields.io/docker/pulls/mojaloop/account-lookup-service.svg?style=flat)](https://hub.docker.com/r/mojaloop/account-lookup-service)
6
+ [![CircleCI](https://circleci.com/gh/mojaloop/account-lookup-service.svg?style=svg)](https://app.circleci.com/pipelines/github/mojaloop/account-lookup-service)
7
+
8
+ ## Documentation
9
+
10
+ - [Documentation](http://docs.mojaloop.io/documentation/mojaloop-technical-overview/account-lookup-service/)
11
+ - [API Swagger Reference](/src/interface/api-swagger.yaml)
12
+ - [Admin Swagger Referemce](/src/interface/admin-swagger.yaml)
13
+
14
+ ## Database initialisation
15
+
16
+ You can start the database easily within docker, using docker-compose:
17
+
18
+ ```bash
19
+ docker-compose up mysql-als
20
+ ```
21
+
22
+ To populate the database with tables and seeded valued, ensure that the correct database URI is in the `default.json` file, or set the `ALS_DATABASE_URI` accordingly, and run the following command:
23
+
24
+ ```bash
25
+ npm run migrate
26
+ ```
27
+
28
+ ## Caching
29
+
30
+ This services uses Mojaloop's `central-services-shared` library to fetch participants and participant endpoints from
31
+ the central ledger. The cache's are initialized in `server.js`.
32
+
33
+ ```
34
+ await ParticipantEndpointCache.initializeCache(Config.ENDPOINT_CACHE_CONFIG)
35
+ await ParticipantCache.initializeCache(Config.PARTICIPANT_CACHE_CONFIG)
36
+ ```
37
+
38
+ with the default config structure being
39
+ ```
40
+ {
41
+ "expiresIn": 180000,
42
+ "generateTimeout": 30000,
43
+ "getDecoratedValue": true
44
+ }
45
+ ```
46
+
47
+ `getDecorated` used by the library for cache statistics and needs to be `true` for Prometheus metrics to display
48
+ cache hits.
49
+
50
+ Further configuration reading can be found here https://hapi.dev/module/catbox/api/?v=12.1.1#policy
51
+
52
+ ## Start API
53
+
54
+ To run the API and/or Admin servers run the following commands
55
+
56
+ ### Both Admin + API
57
+
58
+ ```bash
59
+ #NPM:
60
+ npm start
61
+
62
+ #CLI:
63
+ node src/index.js server
64
+ ```
65
+
66
+ ### API
67
+
68
+ ```bash
69
+ #NPM:
70
+ npm run start:api
71
+
72
+ #CLI:
73
+ node src/index.js server --api
74
+ ```
75
+
76
+ ### Admin
77
+
78
+ ```bash
79
+ #NPM:
80
+ npm run start:admin
81
+
82
+ #CLI:
83
+ node src/index.js server --admin
84
+ ```
85
+
86
+ ## Tests
87
+
88
+ ### Unit Testing
89
+
90
+ Running unit tests
91
+
92
+ ```bash
93
+ npm run test:unit
94
+ ```
95
+
96
+ ### Code Coverage
97
+
98
+ ```bash
99
+ npm run test:coverage-check
100
+ ```
101
+
102
+ ### Integration tests
103
+
104
+ The integration tests use `docker-compose` to spin up a test environment for running the integration tests.
105
+ The tests are executed inside a standalone `account-lookup-service-int` container, defined in `docker-compose.integration.yml`.
106
+
107
+ Run the tests in a standalone mode with:
108
+
109
+ ```bash
110
+ npm run test:integration
111
+ ```
112
+
113
+ By default, the test results will be available in `/tmp/junit.xml`. See below to configure the output directory and file name of the test results.
114
+
115
+ #### Running integration tests repetitively
116
+
117
+ In order to debug and fix broken integration tests, you may want to run the tests without tearing down the environment every time. To do this, you can set `TEST_MODE` to `wait`, which sets up the integration runner to start the docker containers, run the migrations, and then wait for you to log into the `account-lookup-service-int` container and run the tests yourself.
118
+
119
+ >*Note: The docker-compose.integration.yml file mounts the `./src` and `./test` directories inside the docker-container, so you can re-run your tests repeatedly without removing and rebuilding your containers each time.*
120
+
121
+ For example:
122
+
123
+ ```bash
124
+ export TEST_MODE=wait
125
+ npm run test:integration
126
+ # containers will now be ready and waiting for the tests
127
+
128
+ # log into the `account-lookup-service-int` container
129
+ docker exec -it als_account-lookup-service-int sh
130
+
131
+ # now run the integration tests
132
+ npm run test:int
133
+
134
+ ```
135
+
136
+ You can then stop and remove the containers with the following commands:
137
+
138
+ ```bash
139
+ docker-compose -f docker-compose.yml -f docker-compose.integration.yml stop
140
+ docker-compose -f docker-compose.yml -f docker-compose.integration.yml rm -f
141
+ ```
142
+
143
+ ### Running Integration Tests interactively
144
+
145
+ If you want to run integration tests in a repetitive manner, you can startup the test containers using `docker-compose` via one of the following methods:
146
+
147
+ - Running locally
148
+
149
+ Start containers required for Integration Tests
150
+
151
+ ```bash
152
+ npm run dc:up
153
+ ```
154
+
155
+ Run wait script which will report once all required containers are up and running
156
+
157
+ ```bash
158
+ npm run wait-4-docker
159
+ ```
160
+
161
+ Run the Integration Tests
162
+
163
+ ```bash
164
+ npm run test:int
165
+ ```
166
+
167
+ - Running inside docker
168
+
169
+ Start containers required for Integration Tests, including a `account-lookup-service` container which will be used as a proxy shell.
170
+
171
+ ```bash
172
+ docker-compose -f docker-compose.yml -f docker-compose.integration.yml up -d
173
+ ```
174
+
175
+ Run the Integration Tests from the `account-lookup-service-int` container
176
+
177
+ ```bash
178
+ docker exec -it als_account-lookup-service-int sh
179
+ npm run test:int
180
+ ```
181
+
182
+ #### Environment Variables
183
+
184
+ | Environment variable | Description | Example values | Default Value |
185
+ | ------------------------- | ----------- | -------------- | ------------- |
186
+ | `TEST_MODE` | The mode that `integration-runner.sh` uses. See `./test/integration-runner.sh` for more information. | `default`, `wait`, `rm` | `default` |
187
+ | `JEST_JUNIT_OUTPUT_DIR` | The output directory (inside the docker container) for the jest runner | `/tmp`, `/opt/app/test/results` | `/tmp` |
188
+ | `JEST_JUNIT_OUTPUT_NAME` | The filename (inside the docker container) for the jest runner | `junit.xml` | `junit.xml` |
189
+ | `RESULTS_DIR` | The output directory (on the host machine) that the test results is copied to | `/tmp` | `/tmp` |
190
+
191
+ ## Auditing Dependencies
192
+
193
+ We use `audit-ci` along with `npm audit` to check dependencies for node vulnerabilities, and keep track of resolved dependencies with an `audit-ci.jsonc` file.
194
+
195
+ To start a new resolution process, run:
196
+
197
+ ```bash
198
+ npm run audit:fix
199
+ ```
200
+
201
+ You can then check to see if the CI will pass based on the current dependencies with:
202
+
203
+ ```bash
204
+ npm run audit:check
205
+ ```
206
+
207
+ The [audit-ci.jsonc](./audit-ci.jsonc) contains any audit-exceptions that cannot be fixed to ensure that CircleCI will build correctly.
208
+
209
+ ## Container Scans
210
+
211
+ As part of our CI/CD process, we use anchore-cli to scan our built docker container for vulnerabilities upon release.
212
+
213
+ If you find your release builds are failing, refer to the [container scanning](https://github.com/mojaloop/ci-config#container-scanning) in our shared Mojaloop CI config repo. There is a good chance you simply need to update the `mojaloop-policy-generator.js` file and re-run the circleci workflow.
214
+
215
+ For more information on anchore and anchore-cli, refer to:
216
+
217
+ - [Anchore CLI](https://github.com/anchore/anchore-cli)
218
+ - [Circle Orb Registry](https://circleci.com/orbs/registry/orb/anchore/anchore-engine)
219
+
220
+ ## Automated Releases
221
+
222
+ As part of our CI/CD process, we use a combination of CircleCI, standard-version
223
+ npm package and github-release CircleCI orb to automatically trigger our releases
224
+ and image builds. This process essentially mimics a manual tag and release.
225
+
226
+ On a merge to main, CircleCI is configured to use the mojaloopci github account
227
+ to push the latest generated CHANGELOG and package version number.
228
+
229
+ Once those changes are pushed, CircleCI will pull the updated main, tag and
230
+ push a release triggering another subsequent build that also publishes a docker image.
231
+
232
+ ### Potential problems
233
+
234
+ - There is a case where the merge to main workflow will resolve successfully, triggering
235
+ a release. Then that tagged release workflow subsequently failing due to the image scan,
236
+ audit check, vulnerability check or other "live" checks.
237
+
238
+ This will leave main without an associated published build. Fixes that require
239
+ a new merge will essentially cause a skip in version number or require a clean up
240
+ of the main branch to the commit before the CHANGELOG and bump.
241
+
242
+ This may be resolved by relying solely on the previous checks of the
243
+ merge to main workflow to assume that our tagged release is of sound quality.
244
+ We are still mulling over this solution since catching bugs/vulnerabilities/etc earlier
245
+ is a boon.
246
+
247
+ - It is unknown if a race condition might occur with multiple merges with main in
248
+ quick succession, but this is a suspected edge case.
249
+
250
+ ## Additional Notes
251
+
252
+ - For all put parties callbacks `FSPIOP-Destination` header is considered to be mandatory.
package/audit-ci.jsonc ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "$schema": "https://github.com/IBM/audit-ci/raw/main/docs/schema.json",
3
+ // audit-ci supports reading JSON, JSONC, and JSON5 config files.
4
+ // Only use one of ["low": true, "moderate": true, "high": true, "critical": true]
5
+ "moderate": true,
6
+ "allowlist": [ // NOTE: Please add as much information as possible to any items added to the allowList
7
+ // Currently no fixes available for the following
8
+ "GHSA-2p57-rm9w-gvfp", // socks>ip
9
+ "GHSA-v88g-cgmw-v5xw",
10
+ "GHSA-phwq-j96m-2c2q",
11
+ "GHSA-282f-qqgm-c34q",
12
+ "GHSA-6vfc-qv3f-vr6c",
13
+ "GHSA-wc69-rhjr-hc9g",
14
+ "GHSA-g954-5hwp-pp24",
15
+ "GHSA-rjqq-98f6-6j3r",
16
+ "GHSA-mjxr-4v3x-q3m4",
17
+ "GHSA-qgmg-gppg-76g5",
18
+ "GHSA-p9pc-299p-vxgp",
19
+ "GHSA-8cf7-32gw-wr33",
20
+ // The following issues are related to central-services-shared upgrade skip
21
+ // Issue to resolve this: https://github.com/mojaloop/project/issues/3260
22
+ "GHSA-hjrf-2m68-5959",
23
+ "GHSA-qwph-4952-7xr6",
24
+ "GHSA-4jv9-3563-23j3",
25
+ "GHSA-h755-8qp9-cq85",
26
+ "GHSA-f9xv-q969-pqx4",
27
+ "GHSA-7fh5-64p2-3v2j",
28
+ "GHSA-rm97-x556-q36h", // https://github.com/advisories/GHSA-rm97-x556-q36h
29
+ "GHSA-rv95-896h-c2vc", // https://github.com/advisories/GHSA-rv95-896h-c2vc
30
+ "GHSA-952p-6rrq-rcjv" // https://github.com/advisories/GHSA-952p-6rrq-rcjv
31
+ ]
32
+ }
@@ -0,0 +1,161 @@
1
+ {
2
+ "decisions": {
3
+ "1004869|@mojaloop/central-services-shared>widdershins>swagger2openapi>better-ajv-errors>jsonpointer": {
4
+ "decision": "ignore",
5
+ "madeAt": 1646314027498,
6
+ "expiresAt": 1648906020140
7
+ },
8
+ "1004869|@mojaloop/central-services-shared>widdershins>swagger2openapi>oas-validator>better-ajv-errors>jsonpointer": {
9
+ "decision": "ignore",
10
+ "madeAt": 1646314027498,
11
+ "expiresAt": 1648906020140
12
+ },
13
+ "1004946|@mojaloop/central-services-shared>widdershins>yargs>string-width>strip-ansi>ansi-regex": {
14
+ "decision": "ignore",
15
+ "madeAt": 1646314028698,
16
+ "expiresAt": 1648906020140
17
+ },
18
+ "1004946|@mojaloop/central-services-shared>widdershins>yargs>cliui>string-width>strip-ansi>ansi-regex": {
19
+ "decision": "ignore",
20
+ "madeAt": 1646314028698,
21
+ "expiresAt": 1648906020140
22
+ },
23
+ "1005383|@mojaloop/central-services-shared>shins>sanitize-html": {
24
+ "decision": "ignore",
25
+ "madeAt": 1646314031153,
26
+ "expiresAt": 1648906020140
27
+ },
28
+ "1005384|@mojaloop/central-services-shared>shins>sanitize-html": {
29
+ "decision": "ignore",
30
+ "madeAt": 1646314031153,
31
+ "expiresAt": 1648906020140
32
+ },
33
+ "1005534|@mojaloop/central-services-shared>widdershins>yargs>yargs-parser": {
34
+ "decision": "ignore",
35
+ "madeAt": 1646314033221,
36
+ "expiresAt": 1648906020140
37
+ },
38
+ "1006886|@mojaloop/central-services-shared>shins>markdown-it": {
39
+ "decision": "ignore",
40
+ "madeAt": 1646314034388,
41
+ "expiresAt": 1648906020140
42
+ },
43
+ "1007017|@mojaloop/central-services-shared>widdershins>swagger2openapi>oas-validator>ajv": {
44
+ "decision": "ignore",
45
+ "madeAt": 1646314035466,
46
+ "expiresAt": 1648906020140
47
+ },
48
+ "1007144|@mojaloop/central-services-shared>shins>markdown-it": {
49
+ "decision": "ignore",
50
+ "madeAt": 1646392223212,
51
+ "expiresAt": 1648984217062
52
+ },
53
+ "1007244|@mojaloop/central-services-shared>widdershins>swagger2openapi>better-ajv-errors>jsonpointer": {
54
+ "decision": "ignore",
55
+ "madeAt": 1646392224816,
56
+ "expiresAt": 1648984217062
57
+ },
58
+ "1007244|@mojaloop/central-services-shared>widdershins>swagger2openapi>oas-validator>better-ajv-errors>jsonpointer": {
59
+ "decision": "ignore",
60
+ "madeAt": 1646392224816,
61
+ "expiresAt": 1648984217062
62
+ },
63
+ "1007326|@mojaloop/central-services-shared>widdershins>yargs>string-width>strip-ansi>ansi-regex": {
64
+ "decision": "ignore",
65
+ "madeAt": 1646392226942,
66
+ "expiresAt": 1648984217062
67
+ },
68
+ "1007326|@mojaloop/central-services-shared>widdershins>yargs>cliui>string-width>strip-ansi>ansi-regex": {
69
+ "decision": "ignore",
70
+ "madeAt": 1646392226942,
71
+ "expiresAt": 1648984217062
72
+ },
73
+ "1007644|@mojaloop/central-services-shared>widdershins>swagger2openapi>oas-validator>ajv": {
74
+ "decision": "ignore",
75
+ "madeAt": 1646392228458,
76
+ "expiresAt": 1648984217062
77
+ },
78
+ "1007852|@mojaloop/central-services-shared>shins>sanitize-html": {
79
+ "decision": "ignore",
80
+ "madeAt": 1646392229584,
81
+ "expiresAt": 1648984217062
82
+ },
83
+ "1007853|@mojaloop/central-services-shared>shins>sanitize-html": {
84
+ "decision": "ignore",
85
+ "madeAt": 1646392229584,
86
+ "expiresAt": 1648984217062
87
+ },
88
+ "1008008|@mojaloop/central-services-shared>widdershins>yargs>yargs-parser": {
89
+ "decision": "ignore",
90
+ "madeAt": 1646392230752,
91
+ "expiresAt": 1648984217062
92
+ },
93
+ "1070483|@mojaloop/central-services-shared>@mojaloop/event-sdk>grpc>protobufjs": {
94
+ "decision": "ignore",
95
+ "madeAt": 1655472315199,
96
+ "expiresAt": 1658064309843
97
+ },
98
+ "1070483|@mojaloop/event-sdk>grpc>protobufjs": {
99
+ "decision": "ignore",
100
+ "madeAt": 1655472315199,
101
+ "expiresAt": 1658064309843
102
+ },
103
+ "1070030|@mojaloop/central-services-shared>@mojaloop/event-sdk>grpc>protobufjs>widdershins>markdown-it": {
104
+ "decision": "ignore",
105
+ "madeAt": 1655472316304,
106
+ "expiresAt": 1658064309843
107
+ },
108
+ "1070030|shins>markdown-it": {
109
+ "decision": "ignore",
110
+ "madeAt": 1655472316304,
111
+ "expiresAt": 1658064309843
112
+ },
113
+ "1068310|@mojaloop/central-services-shared>@mojaloop/event-sdk>grpc>protobufjs>widdershins>markdown-it>yargs>yargs-parser": {
114
+ "decision": "ignore",
115
+ "madeAt": 1655472317385,
116
+ "expiresAt": 1658064309843
117
+ },
118
+ "1070273|ansi-regex": {
119
+ "decision": "ignore",
120
+ "madeAt": 1655472318782,
121
+ "expiresAt": 1658064309843
122
+ },
123
+ "1070412|ejs": {
124
+ "decision": "ignore",
125
+ "madeAt": 1655472319944,
126
+ "expiresAt": 1658064309843
127
+ },
128
+ "1068155|shins>markdown-it>sanitize-html": {
129
+ "decision": "ignore",
130
+ "madeAt": 1655472321029,
131
+ "expiresAt": 1658064309843
132
+ },
133
+ "1070260|shins>markdown-it>sanitize-html": {
134
+ "decision": "ignore",
135
+ "madeAt": 1655472322173,
136
+ "expiresAt": 1658064309843
137
+ },
138
+ "1067553|swagger2openapi>better-ajv-errors>jsonpointer": {
139
+ "decision": "ignore",
140
+ "madeAt": 1655472323260,
141
+ "expiresAt": 1658064309843
142
+ },
143
+ "1067946|swagger2openapi>better-ajv-errors>jsonpointer>oas-validator>ajv": {
144
+ "decision": "ignore",
145
+ "madeAt": 1655472324971,
146
+ "expiresAt": 1658064309843
147
+ },
148
+ "1067384|urijs": {
149
+ "decision": "ignore",
150
+ "madeAt": 1655472326095,
151
+ "expiresAt": 1658064309843
152
+ },
153
+ "1069987|urijs": {
154
+ "decision": "ignore",
155
+ "madeAt": 1655472327208,
156
+ "expiresAt": 1658064309843
157
+ }
158
+ },
159
+ "rules": {},
160
+ "version": 1
161
+ }
@@ -0,0 +1,109 @@
1
+ {
2
+ "HUB_PARTICIPANT": {
3
+ "ID": 1,
4
+ "NAME": "Hub"
5
+ },
6
+ "ADMIN_PORT": 4001,
7
+ "API_PORT": 4002,
8
+ "API_TYPE": "fspiop",
9
+ "DATABASE": {
10
+ "DIALECT": "mysql",
11
+ "HOST": "localhost",
12
+ "PORT": 3306,
13
+ "USER": "account_lookup",
14
+ "PASSWORD": "password",
15
+ "DATABASE": "account_lookup",
16
+ "POOL_MIN_SIZE": 10,
17
+ "POOL_MAX_SIZE": 10,
18
+ "ACQUIRE_TIMEOUT_MILLIS": 30000,
19
+ "CREATE_TIMEOUT_MILLIS": 30000,
20
+ "DESTROY_TIMEOUT_MILLIS": 5000,
21
+ "IDLE_TIMEOUT_MILLIS": 30000,
22
+ "REAP_INTERVAL_MILLIS": 1000,
23
+ "CREATE_RETRY_INTERVAL_MILLIS": 200
24
+ },
25
+ "PROTOCOL_VERSIONS": {
26
+ "CONTENT": {
27
+ "DEFAULT": "2.0",
28
+ "VALIDATELIST": [
29
+ "1.1",
30
+ "1.0",
31
+ "2.0"
32
+ ]
33
+ },
34
+ "ACCEPT": {
35
+ "DEFAULT": "2",
36
+ "VALIDATELIST": [
37
+ "1",
38
+ "1.0",
39
+ "1.1",
40
+ "2",
41
+ "2.0"
42
+ ]
43
+ }
44
+ },
45
+ "DISPLAY_ROUTES": true,
46
+ "RUN_MIGRATIONS": true,
47
+ "CENTRAL_SHARED_ENDPOINT_CACHE_CONFIG": {
48
+ "expiresIn": 180000,
49
+ "generateTimeout": 30000,
50
+ "getDecoratedValue": true
51
+ },
52
+ "CENTRAL_SHARED_PARTICIPANT_CACHE_CONFIG": {
53
+ "expiresIn": 61000,
54
+ "generateTimeout": 30000,
55
+ "getDecoratedValue": true
56
+ },
57
+ "GENERAL_CACHE_CONFIG": {
58
+ "CACHE_ENABLED": false,
59
+ "MAX_BYTE_SIZE": 10000000,
60
+ "EXPIRES_IN_MS": 61000
61
+ },
62
+ "PROXY_CACHE": {
63
+ "enabled": true,
64
+ "type": "redis-cluster",
65
+ "proxyConfig": {
66
+ "cluster": [
67
+ { "host": "localhost", "port": 6379 }
68
+ ]
69
+ }
70
+ },
71
+ "ERROR_HANDLING": {
72
+ "includeCauseExtension": false,
73
+ "truncateExtensions": true
74
+ },
75
+ "HANDLERS": {
76
+ "DISABLED": false,
77
+ "MONITORING_PORT": 4003,
78
+ "TIMEOUT": {
79
+ "DISABLED": false,
80
+ "TIMEXP": "*/30 * * * * *",
81
+ "TIMEZONE": "UTC",
82
+ "BATCH_SIZE": 100
83
+ }
84
+ },
85
+ "SWITCH_ENDPOINT": "http://localhost:3001",
86
+ "INSTRUMENTATION": {
87
+ "METRICS": {
88
+ "DISABLED": false,
89
+ "labels": {
90
+ "fspId": "*"
91
+ },
92
+ "config": {
93
+ "timeout": 5000,
94
+ "prefix": "moja_als_",
95
+ "defaultLabels": {
96
+ "serviceName": "account-lookup-service"
97
+ }
98
+ }
99
+ }
100
+ },
101
+ "ENDPOINT_SECURITY":{
102
+ "JWS": {
103
+ "JWS_SIGN": false,
104
+ "JWS_SIGNING_KEY_PATH": "secrets/jwsSigningKey.key"
105
+ }
106
+ },
107
+ "API_DOC_ENDPOINTS_ENABLED": true,
108
+ "FEATURE_ENABLE_EXTENDED_PARTY_ID_TYPE": false
109
+ }
@@ -0,0 +1,21 @@
1
+ 'use strict'
2
+
3
+ const migrationsDirectory = '../migrations'
4
+ const seedsDirectory = '../seeds'
5
+
6
+ const Config = require('../src/lib/config')
7
+
8
+ module.exports = {
9
+ client: 'mysql',
10
+ version: '5.7',
11
+ connection: Config.DATABASE.connection,
12
+ pool: Config.DATABASE.pool,
13
+ migrations: {
14
+ directory: migrationsDirectory,
15
+ tableName: 'migration'
16
+ },
17
+ seeds: {
18
+ directory: seedsDirectory,
19
+ loadExtensions: ['.js']
20
+ }
21
+ }
@@ -0,0 +1,106 @@
1
+ {
2
+ "HUB_PARTICIPANT": {
3
+ "ID": 1,
4
+ "NAME": "Hub"
5
+ },
6
+ "LOG_LEVEL": "debug",
7
+ "ADMIN_PORT": 4001,
8
+ "API_PORT": 4002,
9
+ "DATABASE": {
10
+ "DIALECT": "mysql",
11
+ "HOST": "mysql-als",
12
+ "PORT": 3306,
13
+ "USER": "account_lookup",
14
+ "PASSWORD": "password",
15
+ "DATABASE": "account_lookup",
16
+ "POOL_MIN_SIZE": 10,
17
+ "POOL_MAX_SIZE": 10,
18
+ "ACQUIRE_TIMEOUT_MILLIS": 30000,
19
+ "CREATE_TIMEOUT_MILLIS": 30000,
20
+ "DESTROY_TIMEOUT_MILLIS": 5000,
21
+ "IDLE_TIMEOUT_MILLIS": 30000,
22
+ "REAP_INTERVAL_MILLIS": 1000,
23
+ "CREATE_RETRY_INTERVAL_MILLIS": 200
24
+ },
25
+ "PROTOCOL_VERSIONS": {
26
+ "CONTENT": {
27
+ "DEFAULT": "1.1",
28
+ "VALIDATELIST": [
29
+ "1.1",
30
+ "1.0"
31
+ ]
32
+ },
33
+ "ACCEPT": {
34
+ "DEFAULT": "1",
35
+ "VALIDATELIST": [
36
+ "1",
37
+ "1.0",
38
+ "1.1"
39
+ ]
40
+ }
41
+ },
42
+ "DISPLAY_ROUTES": true,
43
+ "RUN_MIGRATIONS": true,
44
+ "CENTRAL_SHARED_ENDPOINT_CACHE_CONFIG": {
45
+ "expiresIn": 180000,
46
+ "generateTimeout": 30000,
47
+ "getDecoratedValue": true
48
+ },
49
+ "CENTRAL_SHARED_PARTICIPANT_CACHE_CONFIG": {
50
+ "expiresIn": 61000,
51
+ "generateTimeout": 30000,
52
+ "getDecoratedValue": true
53
+ },
54
+ "GENERAL_CACHE_CONFIG": {
55
+ "CACHE_ENABLED": false,
56
+ "MAX_BYTE_SIZE": 10000000,
57
+ "EXPIRES_IN_MS": 61000
58
+ },
59
+ "PROXY_CACHE": {
60
+ "enabled": true,
61
+ "type": "redis-cluster",
62
+ "proxyConfig": {
63
+ "cluster": [
64
+ { "host": "redis-node-0", "port": 6379 }
65
+ ]
66
+ }
67
+ },
68
+ "ERROR_HANDLING": {
69
+ "includeCauseExtension": false,
70
+ "truncateExtensions": true
71
+ },
72
+ "HANDLERS": {
73
+ "DISABLED": false,
74
+ "MONITORING_PORT": 4003,
75
+ "TIMEOUT": {
76
+ "DISABLED": false,
77
+ "TIMEXP": "*/10 * * * * *",
78
+ "TIMEZONE": "UTC",
79
+ "BATCH_SIZE": 100
80
+ }
81
+ },
82
+ "SWITCH_ENDPOINT": "http://central-ledger:3001",
83
+ "INSTRUMENTATION": {
84
+ "METRICS": {
85
+ "DISABLED": false,
86
+ "labels": {
87
+ "fspId": "*"
88
+ },
89
+ "config": {
90
+ "timeout": 5000,
91
+ "prefix": "moja_als_",
92
+ "defaultLabels": {
93
+ "serviceName": "account-lookup-service"
94
+ }
95
+ }
96
+ }
97
+ },
98
+ "ENDPOINT_SECURITY": {
99
+ "JWS": {
100
+ "JWS_SIGN": false,
101
+ "JWS_SIGNING_KEY_PATH": "secrets/jwsSigningKey.key"
102
+ }
103
+ },
104
+ "API_DOC_ENDPOINTS_ENABLED": true,
105
+ "FEATURE_ENABLE_EXTENDED_PARTY_ID_TYPE": false
106
+ }
@@ -0,0 +1,5 @@
1
+ #!/bin/sh
2
+
3
+ # script to merge local config/default.json and override.json into one file default.json
4
+
5
+ jq -s 'reduce .[] as $item ({}; . * $item)' ../../config/default.json ./override.json > ./default.json