@mojaloop/central-services-shared 16.0.0 → 17.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.circleci/config.yml +237 -111
- package/.ncurc.yaml +6 -0
- package/.nvmrc +1 -1
- package/CHANGELOG.md +36 -4
- package/CODEOWNERS +38 -0
- package/README.md +48 -0
- package/audit-ci.jsonc +21 -0
- package/package.json +64 -60
- package/src/enums/events.js +1 -0
- package/src/enums/kafka.js +4 -0
- package/src/index.d.ts +2 -0
- package/src/util/request.js +1 -1
- package/src/util/streaming/protocol/index.js +2 -2
- package/.env +0 -1
- package/.ncurc.json +0 -4
- package/audit-resolve.json +0 -110
- package/sonar-project.properties +0 -16
package/.circleci/config.yml
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# CircleCI v2
|
|
1
|
+
# CircleCI v2 Config
|
|
2
2
|
version: 2.1
|
|
3
3
|
|
|
4
4
|
##
|
|
@@ -7,9 +7,9 @@ version: 2.1
|
|
|
7
7
|
# Orbs used in this pipeline
|
|
8
8
|
##
|
|
9
9
|
orbs:
|
|
10
|
-
slack: circleci/slack@3.
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
slack: circleci/slack@4.9.3 # Ref: https://github.com/mojaloop/ci-config/tree/master/slack-templates
|
|
11
|
+
pr-tools: mojaloop/pr-tools@0.1.10 # Ref: https://github.com/mojaloop/ci-config/
|
|
12
|
+
gh: circleci/github-cli@2.1.0
|
|
13
13
|
|
|
14
14
|
##
|
|
15
15
|
# defaults
|
|
@@ -21,25 +21,24 @@ defaults_Dependencies: &defaults_Dependencies |
|
|
|
21
21
|
apk --no-cache add ca-certificates
|
|
22
22
|
apk --no-cache add curl
|
|
23
23
|
apk --no-cache add openssh-client
|
|
24
|
-
apk --no-cache
|
|
25
|
-
apk add --no-cache -t build-dependencies make gcc g++ python libtool autoconf automake jq
|
|
24
|
+
apk add --no-cache -t build-dependencies make gcc g++ python3 libtool autoconf automake jq
|
|
26
25
|
npm config set unsafe-perm true
|
|
27
26
|
npm install -g node-gyp
|
|
28
27
|
|
|
29
28
|
defaults_awsCliDependencies: &defaults_awsCliDependencies |
|
|
30
|
-
apk
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
pip3 install --upgrade pip awscli==1.14.5 s3cmd==2.0.1 python-magic
|
|
29
|
+
apk --no-cache add aws-cli
|
|
30
|
+
|
|
31
|
+
defaults_license_scanner: &defaults_license_scanner
|
|
32
|
+
name: Install and set up license-scanner
|
|
33
|
+
command: |
|
|
34
|
+
git clone https://github.com/mojaloop/license-scanner /tmp/license-scanner
|
|
35
|
+
cd /tmp/license-scanner && make build default-files set-up
|
|
38
36
|
|
|
39
37
|
defaults_npm_auth: &defaults_npm_auth
|
|
40
38
|
name: Update NPM registry auth token
|
|
41
39
|
command: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc
|
|
42
40
|
|
|
41
|
+
|
|
43
42
|
defaults_npm_publish_release: &defaults_npm_publish_release
|
|
44
43
|
name: Publish NPM $RELEASE_TAG artifact
|
|
45
44
|
command: |
|
|
@@ -47,18 +46,18 @@ defaults_npm_publish_release: &defaults_npm_publish_release
|
|
|
47
46
|
echo "Publishing tag $RELEASE_TAG"
|
|
48
47
|
npm publish --tag $RELEASE_TAG --access public
|
|
49
48
|
|
|
50
|
-
|
|
51
|
-
name:
|
|
49
|
+
defaults_export_version_from_package: &defaults_export_version_from_package
|
|
50
|
+
name: Format the changelog into the github release body and get release tag
|
|
52
51
|
command: |
|
|
53
|
-
|
|
54
|
-
echo
|
|
55
|
-
|
|
52
|
+
git diff --no-indent-heuristic master~1 HEAD CHANGELOG.md | sed -n '/^+[^+]/ s/^+//p' > /tmp/changes
|
|
53
|
+
echo 'export RELEASE_CHANGES=`cat /tmp/changes`' >> $BASH_ENV
|
|
54
|
+
echo 'export RELEASE_TAG=`cat package-lock.json | jq -r .version`' >> $BASH_ENV
|
|
56
55
|
|
|
57
|
-
|
|
58
|
-
name:
|
|
56
|
+
defaults_configure_git: &defaults_configure_git
|
|
57
|
+
name: Configure git
|
|
59
58
|
command: |
|
|
60
|
-
git
|
|
61
|
-
|
|
59
|
+
git config user.email ${GIT_CI_EMAIL}
|
|
60
|
+
git config user.name ${GIT_CI_USER}
|
|
62
61
|
|
|
63
62
|
##
|
|
64
63
|
# Executors
|
|
@@ -67,19 +66,15 @@ defaults_license_scanner: &defaults_license_scanner
|
|
|
67
66
|
##
|
|
68
67
|
executors:
|
|
69
68
|
default-docker:
|
|
70
|
-
working_directory: /home/circleci/project
|
|
69
|
+
working_directory: &WORKING_DIR /home/circleci/project
|
|
71
70
|
docker:
|
|
72
|
-
- image: node:
|
|
71
|
+
- image: node:16.15.0-alpine
|
|
73
72
|
|
|
74
73
|
default-machine:
|
|
74
|
+
working_directory: *WORKING_DIR
|
|
75
75
|
machine:
|
|
76
|
-
image: ubuntu-
|
|
76
|
+
image: ubuntu-2004:current
|
|
77
77
|
|
|
78
|
-
##
|
|
79
|
-
# Jobs
|
|
80
|
-
#
|
|
81
|
-
# A map of CircleCI jobs
|
|
82
|
-
##
|
|
83
78
|
jobs:
|
|
84
79
|
setup:
|
|
85
80
|
executor: default-docker
|
|
@@ -88,23 +83,40 @@ jobs:
|
|
|
88
83
|
name: Install general dependencies
|
|
89
84
|
command: *defaults_Dependencies
|
|
90
85
|
- checkout
|
|
91
|
-
- restore_cache:
|
|
92
|
-
keys:
|
|
93
|
-
- dependency-cache-{{ checksum "package-lock.json" }}
|
|
94
|
-
- run:
|
|
95
|
-
name: Access npm folder as root
|
|
96
|
-
command: cd $(npm root -g)/npm
|
|
97
86
|
- run:
|
|
98
87
|
name: Update NPM install
|
|
99
88
|
command: npm ci
|
|
100
|
-
- run:
|
|
101
|
-
name: Delete build dependencies
|
|
102
|
-
command: apk del build-dependencies
|
|
103
89
|
- save_cache:
|
|
104
|
-
key: dependency-cache-{{
|
|
90
|
+
key: dependency-cache-{{ .Environment.CIRCLE_SHA1 }}
|
|
105
91
|
paths:
|
|
106
92
|
- node_modules
|
|
107
93
|
|
|
94
|
+
test-dependencies:
|
|
95
|
+
executor: default-docker
|
|
96
|
+
steps:
|
|
97
|
+
- run:
|
|
98
|
+
name: Install general dependencies
|
|
99
|
+
command: *defaults_Dependencies
|
|
100
|
+
- checkout
|
|
101
|
+
- restore_cache:
|
|
102
|
+
key: dependency-cache-{{ .Environment.CIRCLE_SHA1 }}
|
|
103
|
+
- run:
|
|
104
|
+
name: Execute dependency tests
|
|
105
|
+
command: npm run dep:check
|
|
106
|
+
|
|
107
|
+
test-lint:
|
|
108
|
+
executor: default-docker
|
|
109
|
+
steps:
|
|
110
|
+
- run:
|
|
111
|
+
name: Install general dependencies
|
|
112
|
+
command: *defaults_Dependencies
|
|
113
|
+
- checkout
|
|
114
|
+
- restore_cache:
|
|
115
|
+
key: dependency-cache-{{ .Environment.CIRCLE_SHA1 }}
|
|
116
|
+
- run:
|
|
117
|
+
name: Execute lint tests
|
|
118
|
+
command: npm run lint
|
|
119
|
+
|
|
108
120
|
test-unit:
|
|
109
121
|
executor: default-docker
|
|
110
122
|
steps:
|
|
@@ -113,22 +125,23 @@ jobs:
|
|
|
113
125
|
command: *defaults_Dependencies
|
|
114
126
|
- checkout
|
|
115
127
|
- restore_cache:
|
|
116
|
-
key: dependency-cache-{{
|
|
128
|
+
key: dependency-cache-{{ .Environment.CIRCLE_SHA1 }}
|
|
129
|
+
- run:
|
|
130
|
+
# This is needed for legacy core tests. Remove this once 'tape' is fully deprecated.
|
|
131
|
+
name: Install tape, tapes and tap-xunit
|
|
132
|
+
command: npm install tape tapes tap-xunit
|
|
117
133
|
- run:
|
|
118
134
|
name: Create dir for test results
|
|
119
135
|
command: mkdir -p ./test/results
|
|
120
|
-
- run:
|
|
121
|
-
name: Install testing dependencies
|
|
122
|
-
command: npm install tape tapes tap-xunit
|
|
123
136
|
- run:
|
|
124
137
|
name: Execute unit tests
|
|
125
|
-
command: npm -s run test:xunit
|
|
138
|
+
command: npm -s run test:xunit
|
|
126
139
|
- store_artifacts:
|
|
127
140
|
path: ./test/results
|
|
128
141
|
prefix: test
|
|
129
142
|
- store_test_results:
|
|
130
143
|
path: ./test/results
|
|
131
|
-
|
|
144
|
+
|
|
132
145
|
test-coverage:
|
|
133
146
|
executor: default-docker
|
|
134
147
|
steps:
|
|
@@ -140,10 +153,7 @@ jobs:
|
|
|
140
153
|
command: *defaults_awsCliDependencies
|
|
141
154
|
- checkout
|
|
142
155
|
- restore_cache:
|
|
143
|
-
key: dependency-cache-{{
|
|
144
|
-
- run:
|
|
145
|
-
name: Install testing dependencies
|
|
146
|
-
command: npm install tape tapes tap-xunit
|
|
156
|
+
key: dependency-cache-{{ .Environment.CIRCLE_SHA1 }}
|
|
147
157
|
- run:
|
|
148
158
|
name: Execute code coverage check
|
|
149
159
|
command: npm -s run test:coverage-check
|
|
@@ -151,14 +161,14 @@ jobs:
|
|
|
151
161
|
path: coverage
|
|
152
162
|
prefix: test
|
|
153
163
|
- store_test_results:
|
|
154
|
-
path: coverage
|
|
164
|
+
path: coverage
|
|
155
165
|
- run:
|
|
156
166
|
name: Copy code coverage to SonarQube
|
|
157
167
|
command: |
|
|
158
168
|
if [ "${CIRCLE_BRANCH}" == "master" ];
|
|
159
169
|
then
|
|
160
170
|
echo "Sending lcov.info to SonarQube..."
|
|
161
|
-
aws s3 cp coverage/lcov.info $AWS_S3_DIR_SONARQUBE/
|
|
171
|
+
aws s3 cp coverage/lcov.info $AWS_S3_DIR_SONARQUBE/${CIRCLE_PROJECT_REPONAME}/lcov.info
|
|
162
172
|
else
|
|
163
173
|
echo "Not a release (env CIRCLE_BRANCH != 'master'), skipping sending lcov.info to SonarQube."
|
|
164
174
|
fi
|
|
@@ -171,13 +181,13 @@ jobs:
|
|
|
171
181
|
command: *defaults_Dependencies
|
|
172
182
|
- checkout
|
|
173
183
|
- restore_cache:
|
|
174
|
-
key: dependency-cache-{{
|
|
184
|
+
key: dependency-cache-{{ .Environment.CIRCLE_SHA1 }}
|
|
175
185
|
- run:
|
|
176
186
|
name: Create dir for test results
|
|
177
187
|
command: mkdir -p ./audit/results
|
|
178
188
|
- run:
|
|
179
189
|
name: Check for new npm vulnerabilities
|
|
180
|
-
command: npm run audit:check --
|
|
190
|
+
command: npm run audit:check -- -o json > ./audit/results/auditResults.json
|
|
181
191
|
- store_artifacts:
|
|
182
192
|
path: ./audit/results
|
|
183
193
|
prefix: audit
|
|
@@ -188,14 +198,11 @@ jobs:
|
|
|
188
198
|
- run:
|
|
189
199
|
name: Install general dependencies
|
|
190
200
|
command: *defaults_Dependencies
|
|
191
|
-
- checkout
|
|
192
201
|
- run:
|
|
193
202
|
<<: *defaults_license_scanner
|
|
203
|
+
- checkout
|
|
194
204
|
- restore_cache:
|
|
195
|
-
key: dependency-cache-{{
|
|
196
|
-
- run:
|
|
197
|
-
name: Prune non-production packages before running license-scanner
|
|
198
|
-
command: npm prune --production
|
|
205
|
+
key: dependency-cache-{{ .Environment.CIRCLE_SHA1 }}
|
|
199
206
|
- run:
|
|
200
207
|
name: Run the license-scanner
|
|
201
208
|
command: cd /tmp/license-scanner && pathToRepo=$CIRCLE_WORKING_DIRECTORY make run
|
|
@@ -212,25 +219,26 @@ jobs:
|
|
|
212
219
|
- checkout
|
|
213
220
|
- restore_cache:
|
|
214
221
|
keys:
|
|
215
|
-
- dependency-cache-{{
|
|
222
|
+
- dependency-cache-{{ .Environment.CIRCLE_SHA1 }}
|
|
216
223
|
- run:
|
|
217
|
-
|
|
218
|
-
command: |
|
|
219
|
-
git config user.email ${GIT_CI_EMAIL}
|
|
220
|
-
git config user.name ${GIT_CI_USER}
|
|
221
|
-
git checkout ${CIRCLE_BRANCH}
|
|
224
|
+
<<: *defaults_configure_git
|
|
222
225
|
- run:
|
|
223
|
-
name:
|
|
226
|
+
name: Setup Slack config
|
|
224
227
|
command: |
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
+
echo "export SLACK_PROJECT_NAME=${CIRCLE_PROJECT_REPONAME}" >> $BASH_ENV
|
|
229
|
+
echo "export SLACK_RELEASE_TYPE='GitHub Release'" >> $BASH_ENV
|
|
230
|
+
echo "export SLACK_RELEASE_TAG='${RELEASE_TAG} on ${CIRCLE_BRANCH} branch'" >> $BASH_ENV
|
|
231
|
+
echo "export SLACK_BUILD_ID=${CIRCLE_BUILD_NUM}" >> $BASH_ENV
|
|
232
|
+
echo "export SLACK_CI_URL=${CIRCLE_BUILD_URL}" >> $BASH_ENV
|
|
228
233
|
- run:
|
|
229
234
|
name: Generate changelog and bump package version
|
|
230
|
-
command: npm run release
|
|
235
|
+
command: npm run release -- --no-verify
|
|
231
236
|
- run:
|
|
232
237
|
name: Push the release
|
|
233
238
|
command: git push --follow-tags origin ${CIRCLE_BRANCH}
|
|
239
|
+
- slack/notify:
|
|
240
|
+
event: fail
|
|
241
|
+
template: SLACK_TEMP_RELEASE_FAILURE
|
|
234
242
|
|
|
235
243
|
github-release:
|
|
236
244
|
executor: default-machine
|
|
@@ -239,34 +247,40 @@ jobs:
|
|
|
239
247
|
name: Install git
|
|
240
248
|
command: |
|
|
241
249
|
sudo apt-get update && sudo apt-get install -y git
|
|
250
|
+
- gh/install
|
|
242
251
|
- checkout
|
|
252
|
+
- run:
|
|
253
|
+
<<: *defaults_configure_git
|
|
243
254
|
- run:
|
|
244
255
|
name: Fetch updated release branch
|
|
245
256
|
command: |
|
|
246
|
-
git config user.email ${GIT_CI_EMAIL}
|
|
247
|
-
git config user.name ${GIT_CI_USER}
|
|
248
257
|
git fetch origin
|
|
249
258
|
git checkout origin/${CIRCLE_BRANCH}
|
|
250
259
|
- run:
|
|
251
|
-
|
|
252
|
-
name: Format the changelog into the github release body and get release tag
|
|
253
|
-
command: |
|
|
254
|
-
git diff --no-indent-heuristic master~1 HEAD CHANGELOG.md | sed -n '/^+[^+]/ s/^+//p' > /tmp/changes
|
|
255
|
-
echo 'export RELEASE_CHANGES=`cat /tmp/changes`' >> $BASH_ENV
|
|
256
|
-
echo 'export RELEASE_TAG=`cat package.json | jq -r .version`' >> $BASH_ENV
|
|
260
|
+
<<: *defaults_export_version_from_package
|
|
257
261
|
- run:
|
|
258
|
-
name:
|
|
262
|
+
name: Check the release changes
|
|
259
263
|
command: |
|
|
260
264
|
echo "Changes are: ${RELEASE_CHANGES}"
|
|
261
|
-
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
265
|
+
- run:
|
|
266
|
+
name: Setup Slack config
|
|
267
|
+
command: |
|
|
268
|
+
echo "export SLACK_PROJECT_NAME=${CIRCLE_PROJECT_REPONAME}" >> $BASH_ENV
|
|
269
|
+
echo "export SLACK_RELEASE_TYPE='Github Release'" >> $BASH_ENV
|
|
270
|
+
echo "export SLACK_RELEASE_TAG=v${RELEASE_TAG}" >> $BASH_ENV
|
|
271
|
+
echo "export SLACK_RELEASE_URL=https://github.com/mojaloop/${CIRCLE_PROJECT_REPONAME}/releases/tag/v${RELEASE_TAG}" >> $BASH_ENV
|
|
272
|
+
echo "export SLACK_BUILD_ID=${CIRCLE_BUILD_NUM}" >> $BASH_ENV
|
|
273
|
+
echo "export SLACK_CI_URL=${CIRCLE_BUILD_URL}" >> $BASH_ENV
|
|
274
|
+
- run:
|
|
275
|
+
name: Create Release
|
|
276
|
+
command: |
|
|
277
|
+
gh release create "v${RELEASE_TAG}" --title "v${RELEASE_TAG} Release" --draft=false --notes "${RELEASE_CHANGES}" ./CHANGELOG.md
|
|
278
|
+
- slack/notify:
|
|
279
|
+
event: pass
|
|
280
|
+
template: SLACK_TEMP_RELEASE_SUCCESS
|
|
281
|
+
- slack/notify:
|
|
282
|
+
event: fail
|
|
283
|
+
template: SLACK_TEMP_RELEASE_FAILURE
|
|
270
284
|
|
|
271
285
|
publish:
|
|
272
286
|
executor: default-docker
|
|
@@ -276,34 +290,114 @@ jobs:
|
|
|
276
290
|
command: *defaults_Dependencies
|
|
277
291
|
- checkout
|
|
278
292
|
- restore_cache:
|
|
279
|
-
key: dependency-cache-{{
|
|
293
|
+
key: dependency-cache-{{ .Environment.CIRCLE_SHA1 }}
|
|
294
|
+
- run:
|
|
295
|
+
name: Setup for LATEST release
|
|
296
|
+
command: |
|
|
297
|
+
echo "export RELEASE_TAG=$RELEASE_TAG_PROD" >> $BASH_ENV
|
|
298
|
+
echo "RELEASE_TAG=$RELEASE_TAG_PROD"
|
|
299
|
+
|
|
300
|
+
PACKAGE_VERSION=$(cat package-lock.json | jq -r .version)
|
|
301
|
+
echo "export PACKAGE_VERSION=${PACKAGE_VERSION}" >> $BASH_ENV
|
|
302
|
+
echo "PACKAGE_VERSION=${PACKAGE_VERSION}"
|
|
280
303
|
- run:
|
|
281
|
-
name:
|
|
304
|
+
name: Setup Slack config
|
|
282
305
|
command: |
|
|
283
|
-
echo
|
|
306
|
+
echo "export SLACK_PROJECT_NAME=${CIRCLE_PROJECT_REPONAME}" >> $BASH_ENV
|
|
307
|
+
echo "export SLACK_RELEASE_TYPE='NPM Release'" >> $BASH_ENV
|
|
308
|
+
echo "export SLACK_RELEASE_TAG=v${CIRCLE_TAG:1}" >> $BASH_ENV
|
|
309
|
+
echo "export SLACK_RELEASE_URL=https://www.npmjs.com/package/@mojaloop/${CIRCLE_PROJECT_REPONAME}/v/${CIRCLE_TAG:1}" >> $BASH_ENV
|
|
310
|
+
echo "export SLACK_BUILD_ID=${CIRCLE_BUILD_NUM}" >> $BASH_ENV
|
|
311
|
+
echo "export SLACK_CI_URL=${CIRCLE_BUILD_URL}" >> $BASH_ENV
|
|
284
312
|
- run:
|
|
285
313
|
<<: *defaults_npm_auth
|
|
286
314
|
- run:
|
|
287
315
|
<<: *defaults_npm_publish_release
|
|
316
|
+
- slack/notify:
|
|
317
|
+
event: pass
|
|
318
|
+
template: SLACK_TEMP_RELEASE_SUCCESS
|
|
319
|
+
- slack/notify:
|
|
320
|
+
event: fail
|
|
321
|
+
template: SLACK_TEMP_RELEASE_FAILURE
|
|
322
|
+
|
|
323
|
+
publish-snapshot:
|
|
324
|
+
executor: default-docker
|
|
325
|
+
steps:
|
|
326
|
+
- run:
|
|
327
|
+
name: Install general dependencies
|
|
328
|
+
command: *defaults_Dependencies
|
|
329
|
+
- checkout
|
|
330
|
+
- restore_cache:
|
|
331
|
+
key: dependency-cache-{{ .Environment.CIRCLE_SHA1 }}
|
|
332
|
+
- run:
|
|
333
|
+
name: Setup for SNAPSHOT release
|
|
334
|
+
command: |
|
|
335
|
+
echo "export RELEASE_TAG=${RELEASE_TAG_SNAPSHOT}" >> $BASH_ENV
|
|
336
|
+
echo "RELEASE_TAG=${RELEASE_TAG_SNAPSHOT}"
|
|
337
|
+
|
|
338
|
+
echo "Override package version: ${CIRCLE_TAG:1}"
|
|
339
|
+
npx standard-version --skip.tag --skip.commit --skip.changelog --release-as ${CIRCLE_TAG:1}
|
|
340
|
+
|
|
341
|
+
PACKAGE_VERSION=$(cat package-lock.json | jq -r .version)
|
|
342
|
+
echo "export PACKAGE_VERSION=${PACKAGE_VERSION}" >> $BASH_ENV
|
|
343
|
+
echo "PACKAGE_VERSION=${PACKAGE_VERSION}"
|
|
344
|
+
- run:
|
|
345
|
+
name: Setup Slack config
|
|
346
|
+
command: |
|
|
347
|
+
echo "export SLACK_PROJECT_NAME=${CIRCLE_PROJECT_REPONAME}" >> $BASH_ENV
|
|
348
|
+
echo "export SLACK_RELEASE_TYPE='NPM Snapshot'" >> $BASH_ENV
|
|
349
|
+
echo "export SLACK_RELEASE_TAG=v${CIRCLE_TAG:1}" >> $BASH_ENV
|
|
350
|
+
echo "export SLACK_RELEASE_URL=https://www.npmjs.com/package/@mojaloop/${CIRCLE_PROJECT_REPONAME}/v/${CIRCLE_TAG:1}" >> $BASH_ENV
|
|
351
|
+
echo "export SLACK_BUILD_ID=${CIRCLE_BUILD_NUM}" >> $BASH_ENV
|
|
352
|
+
echo "export SLACK_CI_URL=${CIRCLE_BUILD_URL}" >> $BASH_ENV
|
|
353
|
+
- run:
|
|
354
|
+
<<: *defaults_npm_auth
|
|
355
|
+
- run:
|
|
356
|
+
<<: *defaults_npm_publish_release
|
|
357
|
+
- slack/notify:
|
|
358
|
+
event: pass
|
|
359
|
+
template: SLACK_TEMP_RELEASE_SUCCESS
|
|
360
|
+
- slack/notify:
|
|
361
|
+
event: fail
|
|
362
|
+
template: SLACK_TEMP_RELEASE_FAILURE
|
|
288
363
|
|
|
289
|
-
##
|
|
290
|
-
# Workflows
|
|
291
|
-
#
|
|
292
|
-
# CircleCI Workflow config
|
|
293
|
-
##
|
|
294
364
|
workflows:
|
|
295
365
|
version: 2
|
|
296
366
|
build_and_test:
|
|
297
367
|
jobs:
|
|
298
368
|
- pr-tools/pr-title-check:
|
|
299
369
|
context: org-global
|
|
300
|
-
|
|
301
370
|
- setup:
|
|
302
371
|
context: org-global
|
|
303
372
|
filters:
|
|
304
373
|
tags:
|
|
305
374
|
only: /.*/
|
|
306
|
-
|
|
375
|
+
branches:
|
|
376
|
+
ignore:
|
|
377
|
+
- /feature*/
|
|
378
|
+
- /bugfix*/
|
|
379
|
+
- test-dependencies:
|
|
380
|
+
context: org-global
|
|
381
|
+
requires:
|
|
382
|
+
- setup
|
|
383
|
+
filters:
|
|
384
|
+
tags:
|
|
385
|
+
only: /.*/
|
|
386
|
+
branches:
|
|
387
|
+
ignore:
|
|
388
|
+
- /feature*/
|
|
389
|
+
- /bugfix*/
|
|
390
|
+
- test-lint:
|
|
391
|
+
context: org-global
|
|
392
|
+
requires:
|
|
393
|
+
- setup
|
|
394
|
+
filters:
|
|
395
|
+
tags:
|
|
396
|
+
only: /.*/
|
|
397
|
+
branches:
|
|
398
|
+
ignore:
|
|
399
|
+
- /feature*/
|
|
400
|
+
- /bugfix*/
|
|
307
401
|
- test-unit:
|
|
308
402
|
context: org-global
|
|
309
403
|
requires:
|
|
@@ -311,7 +405,10 @@ workflows:
|
|
|
311
405
|
filters:
|
|
312
406
|
tags:
|
|
313
407
|
only: /.*/
|
|
314
|
-
|
|
408
|
+
branches:
|
|
409
|
+
ignore:
|
|
410
|
+
- /feature*/
|
|
411
|
+
- /bugfix*/
|
|
315
412
|
- test-coverage:
|
|
316
413
|
context: org-global
|
|
317
414
|
requires:
|
|
@@ -319,38 +416,48 @@ workflows:
|
|
|
319
416
|
filters:
|
|
320
417
|
tags:
|
|
321
418
|
only: /.*/
|
|
322
|
-
|
|
419
|
+
branches:
|
|
420
|
+
ignore:
|
|
421
|
+
- /feature*/
|
|
422
|
+
- /bugfix*/
|
|
323
423
|
- vulnerability-check:
|
|
324
424
|
context: org-global
|
|
325
425
|
requires:
|
|
326
426
|
- setup
|
|
327
|
-
- test-unit
|
|
328
|
-
- test-coverage
|
|
329
427
|
filters:
|
|
330
428
|
tags:
|
|
331
429
|
only: /.*/
|
|
332
|
-
|
|
430
|
+
branches:
|
|
431
|
+
ignore:
|
|
432
|
+
- /feature*/
|
|
433
|
+
- /bugfix*/
|
|
333
434
|
- audit-licenses:
|
|
334
435
|
context: org-global
|
|
335
436
|
requires:
|
|
336
437
|
- setup
|
|
337
|
-
- test-unit
|
|
338
|
-
- test-coverage
|
|
339
438
|
filters:
|
|
340
439
|
tags:
|
|
341
440
|
only: /.*/
|
|
342
|
-
|
|
441
|
+
branches:
|
|
442
|
+
ignore:
|
|
443
|
+
- /feature*/
|
|
444
|
+
- /bugfix*/
|
|
343
445
|
# New commits to master release automatically
|
|
344
446
|
- release:
|
|
345
447
|
context: org-global
|
|
346
448
|
requires:
|
|
347
|
-
-
|
|
449
|
+
- pr-tools/pr-title-check
|
|
450
|
+
- test-dependencies
|
|
451
|
+
- test-lint
|
|
452
|
+
- test-unit
|
|
453
|
+
- test-coverage
|
|
348
454
|
- vulnerability-check
|
|
455
|
+
- audit-licenses
|
|
349
456
|
filters:
|
|
350
457
|
branches:
|
|
351
458
|
only:
|
|
352
459
|
- master
|
|
353
|
-
|
|
460
|
+
- /release\/v.*/
|
|
354
461
|
- github-release:
|
|
355
462
|
context: org-global
|
|
356
463
|
requires:
|
|
@@ -359,15 +466,34 @@ workflows:
|
|
|
359
466
|
branches:
|
|
360
467
|
only:
|
|
361
468
|
- master
|
|
362
|
-
|
|
469
|
+
- /release\/v.*/
|
|
363
470
|
- publish:
|
|
364
471
|
context: org-global
|
|
365
472
|
requires:
|
|
473
|
+
- pr-tools/pr-title-check
|
|
474
|
+
- test-lint
|
|
475
|
+
- test-unit
|
|
476
|
+
- test-coverage
|
|
366
477
|
- vulnerability-check
|
|
367
478
|
- audit-licenses
|
|
368
479
|
filters:
|
|
369
480
|
tags:
|
|
370
|
-
only:
|
|
481
|
+
only: /v[0-9]+(\.[0-9]+)*/
|
|
482
|
+
branches:
|
|
483
|
+
ignore:
|
|
484
|
+
- /.*/
|
|
485
|
+
- publish-snapshot:
|
|
486
|
+
context: org-global
|
|
487
|
+
requires:
|
|
488
|
+
- pr-tools/pr-title-check
|
|
489
|
+
- test-lint
|
|
490
|
+
- test-unit
|
|
491
|
+
- test-coverage
|
|
492
|
+
- vulnerability-check
|
|
493
|
+
- audit-licenses
|
|
494
|
+
filters:
|
|
495
|
+
tags:
|
|
496
|
+
only: /v[0-9]+(\.[0-9]+)*\-snapshot+((\.[0-9]+)?)/
|
|
371
497
|
branches:
|
|
372
498
|
ignore:
|
|
373
499
|
- /.*/
|
package/.ncurc.yaml
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# Add a TODO comment indicating the reason for each rejected dependency upgrade added to this list, and what should be done to resolve it (i.e. handle it through a story, etc).
|
|
2
|
+
reject: [
|
|
3
|
+
# TODO: Added "@hapi/catbox", "@hapi/catbox-memory" to ncurc for dep:check to ignore updates due to breaking changes which should be handled by another story
|
|
4
|
+
"@hapi/catbox",
|
|
5
|
+
"@hapi/catbox-memory"
|
|
6
|
+
]
|
package/.nvmrc
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
16.15.0
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,38 @@
|
|
|
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.1.0](https://github.com/mojaloop/central-services-shared/compare/v17.0.2...v17.1.0) (2022-08-05)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **mojaloop/#2796:** duplicate transaction not getting callback for post /bulkTransfers ([#331](https://github.com/mojaloop/central-services-shared/issues/331)) ([b7f6ba6](https://github.com/mojaloop/central-services-shared/commit/b7f6ba6cb90565b1f50a6574408f33f41388be68)), closes [mojaloop/#2796](https://github.com/mojaloop/project/issues/2796)
|
|
11
|
+
|
|
12
|
+
### [17.0.2](https://github.com/mojaloop/central-services-shared/compare/v17.0.1...v17.0.2) (2022-05-19)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* updated peerDependencies as NPM v7+ handles their resolution for us ([968da97](https://github.com/mojaloop/central-services-shared/commit/968da97051e0a59f6108ff86b1b51c0670b967bd))
|
|
18
|
+
|
|
19
|
+
### [17.0.1](https://github.com/mojaloop/central-services-shared/compare/v17.0.0...v17.0.1) (2022-05-19)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Bug Fixes
|
|
23
|
+
|
|
24
|
+
* removed typescript build from ci config ([cc75c8a](https://github.com/mojaloop/central-services-shared/commit/cc75c8ab6326b2ef3fb1116a328f3aa3792bcd7e))
|
|
25
|
+
|
|
26
|
+
## [17.0.0](https://github.com/mojaloop/central-services-shared/compare/v16.0.0...v17.0.0) (2022-05-19)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### ⚠ BREAKING CHANGES
|
|
30
|
+
|
|
31
|
+
* **mojaloop/#2092:** major version bump for node v16 LTS support, and re-structuring of project directories to align to core Mojaloop repositories!
|
|
32
|
+
|
|
33
|
+
### Features
|
|
34
|
+
|
|
35
|
+
* **mojaloop/#2092:** upgrade nodeJS version for core services ([#330](https://github.com/mojaloop/central-services-shared/issues/330)) ([4778864](https://github.com/mojaloop/central-services-shared/commit/477886485299940b08a29d3db5a4ceaab431d47d)), closes [mojaloop/#2092](https://github.com/mojaloop/project/issues/2092)
|
|
36
|
+
|
|
5
37
|
## [16.0.0](https://github.com/mojaloop/central-services-shared/compare/v15.3.0...v16.0.0) (2022-03-03)
|
|
6
38
|
|
|
7
39
|
|
|
@@ -11,7 +43,7 @@ All notable changes to this project will be documented in this file. See [standa
|
|
|
11
43
|
|
|
12
44
|
### Features
|
|
13
45
|
|
|
14
|
-
* **mojaloop/#2704:** core-services support for non-breaking backward api compatibility ([#325](https://github.com/mojaloop/central-services-shared/issues/325)) ([cb81f7e](https://github.com/mojaloop/central-services-shared/commit/cb81f7ec92376e0d6ce45e2ce046379ce1996167)), closes [mojaloop/#2704](https://github.com/mojaloop/
|
|
46
|
+
* **mojaloop/#2704:** core-services support for non-breaking backward api compatibility ([#325](https://github.com/mojaloop/central-services-shared/issues/325)) ([cb81f7e](https://github.com/mojaloop/central-services-shared/commit/cb81f7ec92376e0d6ce45e2ce046379ce1996167)), closes [mojaloop/#2704](https://github.com/mojaloop/project/issues/2704)
|
|
15
47
|
|
|
16
48
|
## [15.3.0](https://github.com/mojaloop/central-services-shared/compare/v15.2.0...v15.3.0) (2022-02-07)
|
|
17
49
|
|
|
@@ -25,7 +57,7 @@ All notable changes to this project will be documented in this file. See [standa
|
|
|
25
57
|
|
|
26
58
|
### Features
|
|
27
59
|
|
|
28
|
-
* **mojaloop/#2608:** injected resource versions config for outbound requests ([#319](https://github.com/mojaloop/central-services-shared/issues/319)) ([13a3d9d](https://github.com/mojaloop/central-services-shared/commit/13a3d9dc8ab8d4815db2aea22563317e3670a19b)), closes [mojaloop/#2608](https://github.com/mojaloop/
|
|
60
|
+
* **mojaloop/#2608:** injected resource versions config for outbound requests ([#319](https://github.com/mojaloop/central-services-shared/issues/319)) ([13a3d9d](https://github.com/mojaloop/central-services-shared/commit/13a3d9dc8ab8d4815db2aea22563317e3670a19b)), closes [mojaloop/#2608](https://github.com/mojaloop/project/issues/2608)
|
|
29
61
|
|
|
30
62
|
## [15.1.0](https://github.com/mojaloop/central-services-shared/compare/v15.0.1...v15.1.0) (2021-11-17)
|
|
31
63
|
|
|
@@ -50,7 +82,7 @@ All notable changes to this project will be documented in this file. See [standa
|
|
|
50
82
|
|
|
51
83
|
### Bug Fixes
|
|
52
84
|
|
|
53
|
-
* **mojaloop/#2536:** fspiop api version negotiation not handled by transfers service ([#315](https://github.com/mojaloop/central-services-shared/issues/315)) ([e3a8748](https://github.com/mojaloop/central-services-shared/commit/e3a874829794ed8b85b6487dd58bcb58f31a5dd1)), closes [mojaloop/#2536](https://github.com/mojaloop/
|
|
85
|
+
* **mojaloop/#2536:** fspiop api version negotiation not handled by transfers service ([#315](https://github.com/mojaloop/central-services-shared/issues/315)) ([e3a8748](https://github.com/mojaloop/central-services-shared/commit/e3a874829794ed8b85b6487dd58bcb58f31a5dd1)), closes [mojaloop/#2536](https://github.com/mojaloop/project/issues/2536)
|
|
54
86
|
|
|
55
87
|
## [14.0.0](https://github.com/mojaloop/central-services-shared/compare/v13.4.1...v14.0.0) (2021-09-10)
|
|
56
88
|
|
|
@@ -61,7 +93,7 @@ All notable changes to this project will be documented in this file. See [standa
|
|
|
61
93
|
|
|
62
94
|
### Bug Fixes
|
|
63
95
|
|
|
64
|
-
* **mojaloop/#2470:** central-services-shared streamingprotocol encode/decode functionality fix ([#313](https://github.com/mojaloop/central-services-shared/issues/313)) ([cedc359](https://github.com/mojaloop/central-services-shared/commit/cedc3595508ebe2fd67517f732e8e1da35635171)), closes [mojaloop/#2470](https://github.com/mojaloop/
|
|
96
|
+
* **mojaloop/#2470:** central-services-shared streamingprotocol encode/decode functionality fix ([#313](https://github.com/mojaloop/central-services-shared/issues/313)) ([cedc359](https://github.com/mojaloop/central-services-shared/commit/cedc3595508ebe2fd67517f732e8e1da35635171)), closes [mojaloop/#2470](https://github.com/mojaloop/project/issues/2470)
|
|
65
97
|
|
|
66
98
|
### [13.4.1](https://github.com/mojaloop/central-services-shared/compare/v13.4.0...v13.4.1) (2021-08-25)
|
|
67
99
|
|
package/CODEOWNERS
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# This is a comment.
|
|
2
|
+
# Each line is a file pattern followed by one or more owners.
|
|
3
|
+
|
|
4
|
+
## These owners will be the default owners for everything in
|
|
5
|
+
## the repo. Unless a later match takes precedence,
|
|
6
|
+
## @global-owner1 and @global-owner2 will be requested for
|
|
7
|
+
## review when someone opens a pull request.
|
|
8
|
+
#* @global-owner1 @global-owner2
|
|
9
|
+
* @mdebarros @elnyry-sam-k @vijayg10 @kleyow
|
|
10
|
+
|
|
11
|
+
## Order is important; the last matching pattern takes the most
|
|
12
|
+
## precedence. When someone opens a pull request that only
|
|
13
|
+
## modifies JS files, only @js-owner and not the global
|
|
14
|
+
## owner(s) will be requested for a review.
|
|
15
|
+
# *.js @js-owner
|
|
16
|
+
|
|
17
|
+
## You can also use email addresses if you prefer. They'll be
|
|
18
|
+
## used to look up users just like we do for commit author
|
|
19
|
+
## emails.
|
|
20
|
+
#*.go docs@example.com
|
|
21
|
+
|
|
22
|
+
# In this example, @doctocat owns any files in the build/logs
|
|
23
|
+
# directory at the root of the repository and any of its
|
|
24
|
+
# subdirectories.
|
|
25
|
+
# /build/logs/ @doctocat
|
|
26
|
+
|
|
27
|
+
## The `docs/*` pattern will match files like
|
|
28
|
+
## `docs/getting-started.md` but not further nested files like
|
|
29
|
+
## `docs/build-app/troubleshooting.md`.
|
|
30
|
+
# docs/* docs@example.com
|
|
31
|
+
|
|
32
|
+
## In this example, @octocat owns any file in an apps directory
|
|
33
|
+
## anywhere in your repository.
|
|
34
|
+
#apps/ @octocat
|
|
35
|
+
|
|
36
|
+
## In this example, @doctocat owns any file in the `/docs`
|
|
37
|
+
## directory in the root of your repository.
|
|
38
|
+
#/docs/ @doctocat
|
package/README.md
CHANGED
|
@@ -6,3 +6,51 @@
|
|
|
6
6
|
[](https://circleci.com/gh/mojaloop/central-services-shared)
|
|
7
7
|
|
|
8
8
|
Shared code for central services
|
|
9
|
+
|
|
10
|
+
## Auditing Dependencies
|
|
11
|
+
|
|
12
|
+
We use `npm-audit-resolver` along with `npm audit` to check dependencies for node vulnerabilities, and keep track of resolved dependencies with an `audit-resolve.json` file.
|
|
13
|
+
|
|
14
|
+
To start a new resolution process, run:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm run audit:resolve
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
You can then check to see if the CI will pass based on the current dependencies with:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm run audit:check
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
And commit the changed `audit-resolve.json` to ensure that CircleCI will build correctly.
|
|
27
|
+
|
|
28
|
+
## Automated Releases
|
|
29
|
+
|
|
30
|
+
As part of our CI/CD process, we use a combination of CircleCI, standard-version
|
|
31
|
+
npm package and github-release CircleCI orb to automatically trigger our releases
|
|
32
|
+
and image builds. This process essentially mimics a manual tag and release.
|
|
33
|
+
|
|
34
|
+
On a merge to master, CircleCI is configured to use the mojaloopci github account
|
|
35
|
+
to push the latest generated CHANGELOG and package version number.
|
|
36
|
+
|
|
37
|
+
Once those changes are pushed, CircleCI will pull the updated master, tag and
|
|
38
|
+
push a release triggering another subsequent build that also publishes a docker image.
|
|
39
|
+
|
|
40
|
+
### Potential problems
|
|
41
|
+
|
|
42
|
+
* There is a case where the merge to master workflow will resolve successfully, triggering
|
|
43
|
+
a release. Then that tagged release workflow subsequently failing due to the image scan,
|
|
44
|
+
audit check, vulnerability check or other "live" checks.
|
|
45
|
+
|
|
46
|
+
This will leave master without an associated published build. Fixes that require
|
|
47
|
+
a new merge will essentially cause a skip in version number or require a clean up
|
|
48
|
+
of the master branch to the commit before the CHANGELOG and bump.
|
|
49
|
+
|
|
50
|
+
This may be resolved by relying solely on the previous checks of the
|
|
51
|
+
merge to master workflow to assume that our tagged release is of sound quality.
|
|
52
|
+
We are still mulling over this solution since catching bugs/vulnerabilities/etc earlier
|
|
53
|
+
is a boon.
|
|
54
|
+
|
|
55
|
+
* It is unknown if a race condition might occur with multiple merges with master in
|
|
56
|
+
quick succession, but this is a suspected edge case.
|
package/audit-ci.jsonc
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
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-v88g-cgmw-v5xw",
|
|
9
|
+
"GHSA-phwq-j96m-2c2q",
|
|
10
|
+
"GHSA-282f-qqgm-c34q",
|
|
11
|
+
"GHSA-6vfc-qv3f-vr6c",
|
|
12
|
+
"GHSA-6vfc-qv3f-vr6c",
|
|
13
|
+
"GHSA-wc69-rhjr-hc9g",
|
|
14
|
+
"GHSA-g954-5hwp-pp24",
|
|
15
|
+
"GHSA-g954-5hwp-pp24",
|
|
16
|
+
"GHSA-mjxr-4v3x-q3m4",
|
|
17
|
+
"GHSA-rjqq-98f6-6j3r",
|
|
18
|
+
"GHSA-w5p7-h5w8-2hfq",
|
|
19
|
+
"GHSA-p9pc-299p-vxgp"
|
|
20
|
+
]
|
|
21
|
+
}
|
package/package.json
CHANGED
|
@@ -1,102 +1,101 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mojaloop/central-services-shared",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "17.1.0",
|
|
4
4
|
"description": "Shared code for mojaloop central services",
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"standard:fix": "standard --fix",
|
|
11
|
-
"lint": "npm run standard",
|
|
12
|
-
"lint:fix": "npm run standard:fix",
|
|
13
|
-
"test": "npm run test:unit",
|
|
14
|
-
"test:unit": "tape 'test/unit/**/*.test.js' | tap-spec",
|
|
15
|
-
"test:xunit": "tape 'test/unit/**/*.test.js' | tap-xunit",
|
|
16
|
-
"test:coverage": "nyc --reporter=lcov --reporter=text-summary tapes -- 'test/unit/**/**.test.js'",
|
|
17
|
-
"test:coverage-check": "npm run test:coverage && nyc check-coverage",
|
|
18
|
-
"audit:resolve": "SHELL=sh resolve-audit --production",
|
|
19
|
-
"audit:check": "SHELL=sh check-audit --production",
|
|
20
|
-
"dep:check": "npx ncu -e 2",
|
|
21
|
-
"dep:update": "npx ncu -u",
|
|
22
|
-
"release": "standard-version --releaseCommitMessageFormat 'chore(release): {{currentTag}} [skip ci]'"
|
|
23
|
-
},
|
|
24
|
-
"pre-commit": [
|
|
25
|
-
"lint",
|
|
26
|
-
"dep:check",
|
|
27
|
-
"test"
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"author": "ModusBox",
|
|
7
|
+
"contributors": [
|
|
8
|
+
"ModusBox",
|
|
9
|
+
"Dwolla"
|
|
28
10
|
],
|
|
11
|
+
"homepage": "https://github.com/mojaloop/central-services-shared#readme",
|
|
29
12
|
"repository": {
|
|
30
13
|
"type": "git",
|
|
31
14
|
"url": "git+https://github.com/mojaloop/central-services-shared.git"
|
|
32
15
|
},
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/mojaloop/central-services-shared/issues"
|
|
18
|
+
},
|
|
33
19
|
"keywords": [
|
|
34
20
|
"shared",
|
|
35
21
|
"central",
|
|
36
|
-
"services"
|
|
22
|
+
"services",
|
|
23
|
+
"mojaloop"
|
|
37
24
|
],
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
|
|
41
|
-
"
|
|
25
|
+
"main": "src/index.js",
|
|
26
|
+
"types": "src/index.d.ts",
|
|
27
|
+
"engines": {
|
|
28
|
+
"node": "=16.x"
|
|
29
|
+
},
|
|
30
|
+
"pre-commit": [
|
|
31
|
+
"lint",
|
|
32
|
+
"dep:check",
|
|
33
|
+
"test"
|
|
42
34
|
],
|
|
43
|
-
"
|
|
44
|
-
|
|
45
|
-
"
|
|
35
|
+
"scripts": {
|
|
36
|
+
"pretest": "npm run lint",
|
|
37
|
+
"standard": "npx standard",
|
|
38
|
+
"standard:fix": "npm run standard -- --fix",
|
|
39
|
+
"lint": "npm run standard",
|
|
40
|
+
"lint:fix": "npm run standard:fix",
|
|
41
|
+
"test": "npm run test:unit",
|
|
42
|
+
"test:unit": "npx tape 'test/unit/**/*.test.js' | tap-spec",
|
|
43
|
+
"test:xunit": "npx tape 'test/unit/**/**.test.js' | tap-xunit > ./test/results/xunit.xml",
|
|
44
|
+
"test:coverage": "npx nyc --reporter=lcov --reporter=text-summary tapes -- 'test/unit/**/**.test.js'",
|
|
45
|
+
"test:coverage-check": "npm run test:coverage && nyc check-coverage",
|
|
46
|
+
"audit:fix": "npm audit fix",
|
|
47
|
+
"audit:check": "npx audit-ci --config ./audit-ci.jsonc",
|
|
48
|
+
"dep:check": "npx ncu -e 2",
|
|
49
|
+
"dep:update": "npx ncu -u",
|
|
50
|
+
"release": "npx standard-version --no-verify --releaseCommitMessageFormat 'chore(release): {{currentTag}} [skip ci]'",
|
|
51
|
+
"snapshot": "npx standard-version --no-verify --skip.changelog --prerelease snapshot --releaseCommitMessageFormat 'chore(snapshot): {{currentTag}}'"
|
|
46
52
|
},
|
|
47
|
-
"homepage": "https://github.com/mojaloop/central-services-shared#readme",
|
|
48
53
|
"dependencies": {
|
|
49
|
-
"@hapi/catbox": "
|
|
54
|
+
"@hapi/catbox": "12.0.0",
|
|
50
55
|
"@hapi/catbox-memory": "5.0.1",
|
|
51
|
-
"axios": "0.
|
|
56
|
+
"axios": "0.27.2",
|
|
52
57
|
"clone": "2.1.2",
|
|
53
|
-
"dotenv": "16.0.
|
|
58
|
+
"dotenv": "16.0.1",
|
|
54
59
|
"env-var": "7.1.1",
|
|
55
60
|
"event-stream": "4.0.1",
|
|
56
|
-
"immutable": "4.
|
|
61
|
+
"immutable": "4.1.0",
|
|
57
62
|
"lodash": "4.17.21",
|
|
58
63
|
"mustache": "4.2.0",
|
|
59
|
-
"openapi-backend": "5.
|
|
64
|
+
"openapi-backend": "5.3.0",
|
|
60
65
|
"raw-body": "2.5.1",
|
|
61
66
|
"rc": "1.2.8",
|
|
62
67
|
"shins": "2.6.0",
|
|
63
68
|
"uuid4": "2.0.2",
|
|
64
|
-
"widdershins": "4.0.1",
|
|
65
|
-
"yaml": "1.
|
|
69
|
+
"widdershins": "^4.0.1",
|
|
70
|
+
"yaml": "2.1.1"
|
|
66
71
|
},
|
|
67
72
|
"devDependencies": {
|
|
68
|
-
"@hapi/hapi": "20.2.
|
|
73
|
+
"@hapi/hapi": "20.2.2",
|
|
69
74
|
"@hapi/joi": "17.1.1",
|
|
70
|
-
"
|
|
71
|
-
"@mojaloop/central-services-logger": "10.6.2",
|
|
72
|
-
"@mojaloop/central-services-metrics": "11.0.0",
|
|
73
|
-
"@mojaloop/event-sdk": "10.7.1",
|
|
74
|
-
"@mojaloop/sdk-standard-components": "15.13.0",
|
|
75
|
-
"ajv": "8.10.0",
|
|
76
|
-
"ajv-keywords": "5.1.0",
|
|
75
|
+
"audit-ci": "^6.3.0",
|
|
77
76
|
"base64url": "3.0.1",
|
|
78
77
|
"chance": "1.1.8",
|
|
79
|
-
"npm-
|
|
80
|
-
"npm-check-updates": "12.5.0",
|
|
78
|
+
"npm-check-updates": "16.0.5",
|
|
81
79
|
"nyc": "15.1.0",
|
|
82
80
|
"pre-commit": "1.2.2",
|
|
83
81
|
"proxyquire": "2.1.3",
|
|
82
|
+
"replace": "^1.2.1",
|
|
84
83
|
"rewire": "6.0.0",
|
|
85
|
-
"sinon": "
|
|
86
|
-
"standard": "
|
|
87
|
-
"standard-version": "9.
|
|
84
|
+
"sinon": "14.0.0",
|
|
85
|
+
"standard": "17.0.0",
|
|
86
|
+
"standard-version": "9.5.0",
|
|
88
87
|
"tap-spec": "^5.0.0",
|
|
89
88
|
"tap-xunit": "2.4.1",
|
|
90
|
-
"tape": "5.5.
|
|
89
|
+
"tape": "5.5.3",
|
|
91
90
|
"tapes": "4.1.0"
|
|
92
91
|
},
|
|
93
92
|
"peerDependencies": {
|
|
94
|
-
"@mojaloop/central-services-error-handling": "
|
|
95
|
-
"@mojaloop/central-services-logger": "
|
|
96
|
-
"@mojaloop/central-services-metrics": "
|
|
97
|
-
"@mojaloop/event-sdk": "
|
|
98
|
-
"ajv": "8.
|
|
99
|
-
"ajv-keywords": "5.
|
|
93
|
+
"@mojaloop/central-services-error-handling": "12.x.x",
|
|
94
|
+
"@mojaloop/central-services-logger": "11.x.x",
|
|
95
|
+
"@mojaloop/central-services-metrics": "12.x.x",
|
|
96
|
+
"@mojaloop/event-sdk": "11.x.x",
|
|
97
|
+
"ajv": "8.x.x",
|
|
98
|
+
"ajv-keywords": "5.x.x"
|
|
100
99
|
},
|
|
101
100
|
"peerDependenciesMeta": {
|
|
102
101
|
"@mojaloop/central-services-error-handling": {
|
|
@@ -123,5 +122,10 @@
|
|
|
123
122
|
},
|
|
124
123
|
"publishConfig": {
|
|
125
124
|
"registry": "https://registry.npmjs.org/"
|
|
125
|
+
},
|
|
126
|
+
"standard-version": {
|
|
127
|
+
"scripts": {
|
|
128
|
+
"postchangelog": "replace '\\[mojaloop/#(\\d+)\\]\\(https://github.com/mojaloop/(.*)/issues/(\\d+)\\)' '[mojaloop/#$1](https://github.com/mojaloop/project/issues/$1)' CHANGELOG.md"
|
|
129
|
+
}
|
|
126
130
|
}
|
|
127
131
|
}
|
package/src/enums/events.js
CHANGED
|
@@ -65,6 +65,7 @@ const Event = {
|
|
|
65
65
|
BULK_ABORT: 'bulk-abort',
|
|
66
66
|
BULK_COMMIT: 'bulk-commit',
|
|
67
67
|
BULK_PREPARE: 'bulk-prepare',
|
|
68
|
+
BULK_PREPARE_DUPLICATE: 'bulk-prepare-duplicate',
|
|
68
69
|
BULK_PROCESSING: 'bulk-processing',
|
|
69
70
|
BULK_TIMEOUT_RECEIVED: 'bulk-timeout-received',
|
|
70
71
|
BULK_TIMEOUT_RESERVED: 'bulk-timeout-reserved',
|
package/src/enums/kafka.js
CHANGED
|
@@ -106,6 +106,10 @@ const TopicMap = {
|
|
|
106
106
|
functionality: transferEventType.NOTIFICATION,
|
|
107
107
|
action: transferEventAction.EVENT
|
|
108
108
|
},
|
|
109
|
+
'bulk-prepare-duplicate': {
|
|
110
|
+
functionality: transferEventType.NOTIFICATION,
|
|
111
|
+
action: transferEventAction.EVENT
|
|
112
|
+
},
|
|
109
113
|
'bulk-processing': {
|
|
110
114
|
functionality: transferEventType.NOTIFICATION,
|
|
111
115
|
action: transferEventAction.EVENT
|
package/src/index.d.ts
CHANGED
|
@@ -268,6 +268,7 @@ declare namespace CentralServicesShared {
|
|
|
268
268
|
BULK_PROCESSING = 'bulk-processing',
|
|
269
269
|
BULK_TIMEOUT_RECEIVED = 'bulk-timeout-received',
|
|
270
270
|
BULK_TIMEOUT_RESERVED = 'bulk-timeout-reserved',
|
|
271
|
+
BULK_PREPARE_DUPLICATE = 'bulk-prepare-duplicate',
|
|
271
272
|
BULK_GET = 'bulk-get',
|
|
272
273
|
CLOSE = 'close',
|
|
273
274
|
COMMIT = 'commit',
|
|
@@ -324,6 +325,7 @@ declare namespace CentralServicesShared {
|
|
|
324
325
|
BULK_ABORT: EventActionEnum.BULK_ABORT;
|
|
325
326
|
BULK_COMMIT: EventActionEnum.BULK_COMMIT;
|
|
326
327
|
BULK_PREPARE: EventActionEnum.BULK_PREPARE;
|
|
328
|
+
BULK_PREPARE_DUPLICATE: EventActionEnum.BULK_PREPARE_DUPLICATE;
|
|
327
329
|
BULK_PROCESSING: EventActionEnum.BULK_PROCESSING;
|
|
328
330
|
BULK_TIMEOUT_RECEIVED: EventActionEnum.BULK_TIMEOUT_RECEIVED;
|
|
329
331
|
BULK_TIMEOUT_RESERVED: EventActionEnum.BULK_TIMEOUT_RESERVED;
|
package/src/util/request.js
CHANGED
|
@@ -48,7 +48,7 @@ const updateMessageProtocolMetadata = (messageProtocol, metadataType, metadataAc
|
|
|
48
48
|
id: Uuid(),
|
|
49
49
|
type: metadataType,
|
|
50
50
|
action: metadataAction,
|
|
51
|
-
state
|
|
51
|
+
state
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
} else {
|
|
@@ -85,7 +85,7 @@ const createMessage = (id, to, from, metadata, headers, payload, uriParams = und
|
|
|
85
85
|
type: type || Enum.Http.Headers.DEFAULT.APPLICATION_JSON,
|
|
86
86
|
content: {
|
|
87
87
|
uriParams: uriParams || undefined,
|
|
88
|
-
headers
|
|
88
|
+
headers,
|
|
89
89
|
payload: payload || {}
|
|
90
90
|
},
|
|
91
91
|
metadata
|
package/.env
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
LOG_LEVEL = info
|
package/.ncurc.json
DELETED
package/audit-resolve.json
DELETED
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"decisions": {
|
|
3
|
-
"1002401|widdershins>yargs>string-width>strip-ansi>ansi-regex": {
|
|
4
|
-
"decision": "ignore",
|
|
5
|
-
"madeAt": 1636372052422,
|
|
6
|
-
"expiresAt": 1638964045850
|
|
7
|
-
},
|
|
8
|
-
"1002401|widdershins>yargs>cliui>string-width>strip-ansi>ansi-regex": {
|
|
9
|
-
"decision": "ignore",
|
|
10
|
-
"madeAt": 1636372052422,
|
|
11
|
-
"expiresAt": 1638964045850
|
|
12
|
-
},
|
|
13
|
-
"1002865|shins>sanitize-html": {
|
|
14
|
-
"decision": "ignore",
|
|
15
|
-
"madeAt": 1636372053964,
|
|
16
|
-
"expiresAt": 1638964045850
|
|
17
|
-
},
|
|
18
|
-
"1002866|shins>sanitize-html": {
|
|
19
|
-
"decision": "ignore",
|
|
20
|
-
"madeAt": 1636372053964,
|
|
21
|
-
"expiresAt": 1638964045850
|
|
22
|
-
},
|
|
23
|
-
"1003019|widdershins>yargs>yargs-parser": {
|
|
24
|
-
"decision": "ignore",
|
|
25
|
-
"madeAt": 1636372055094,
|
|
26
|
-
"expiresAt": 1638964045850
|
|
27
|
-
},
|
|
28
|
-
"1004809|widdershins>openapi-sampler>json-pointer": {
|
|
29
|
-
"decision": "ignore",
|
|
30
|
-
"madeAt": 1636956486789,
|
|
31
|
-
"expiresAt": 1639548471465
|
|
32
|
-
},
|
|
33
|
-
"1004812|widdershins>swagger2openapi>better-ajv-errors>jsonpointer": {
|
|
34
|
-
"decision": "ignore",
|
|
35
|
-
"madeAt": 1636956491233,
|
|
36
|
-
"expiresAt": 1639548471465
|
|
37
|
-
},
|
|
38
|
-
"1004812|widdershins>swagger2openapi>oas-validator>better-ajv-errors>jsonpointer": {
|
|
39
|
-
"decision": "ignore",
|
|
40
|
-
"madeAt": 1636956491233,
|
|
41
|
-
"expiresAt": 1639548471465
|
|
42
|
-
},
|
|
43
|
-
"1004854|widdershins>openapi-sampler>json-pointer": {
|
|
44
|
-
"decision": "ignore",
|
|
45
|
-
"madeAt": 1644227612906,
|
|
46
|
-
"expiresAt": 1646819457744
|
|
47
|
-
},
|
|
48
|
-
"1004869|widdershins>swagger2openapi>better-ajv-errors>jsonpointer": {
|
|
49
|
-
"decision": "ignore",
|
|
50
|
-
"madeAt": 1644227615371,
|
|
51
|
-
"expiresAt": 1646819457744
|
|
52
|
-
},
|
|
53
|
-
"1004869|widdershins>swagger2openapi>oas-validator>better-ajv-errors>jsonpointer": {
|
|
54
|
-
"decision": "ignore",
|
|
55
|
-
"madeAt": 1644227615371,
|
|
56
|
-
"expiresAt": 1646819457744
|
|
57
|
-
},
|
|
58
|
-
"1004946|widdershins>yargs>string-width>strip-ansi>ansi-regex": {
|
|
59
|
-
"decision": "ignore",
|
|
60
|
-
"madeAt": 1644227616947,
|
|
61
|
-
"expiresAt": 1646819457744
|
|
62
|
-
},
|
|
63
|
-
"1004946|widdershins>yargs>cliui>string-width>strip-ansi>ansi-regex": {
|
|
64
|
-
"decision": "ignore",
|
|
65
|
-
"madeAt": 1644227616947,
|
|
66
|
-
"expiresAt": 1646819457744
|
|
67
|
-
},
|
|
68
|
-
"1005383|shins>sanitize-html": {
|
|
69
|
-
"decision": "ignore",
|
|
70
|
-
"madeAt": 1644227618453,
|
|
71
|
-
"expiresAt": 1646819457744
|
|
72
|
-
},
|
|
73
|
-
"1005384|shins>sanitize-html": {
|
|
74
|
-
"decision": "ignore",
|
|
75
|
-
"madeAt": 1644227618454,
|
|
76
|
-
"expiresAt": 1646819457744
|
|
77
|
-
},
|
|
78
|
-
"1005534|widdershins>yargs>yargs-parser": {
|
|
79
|
-
"decision": "ignore",
|
|
80
|
-
"madeAt": 1644227619978,
|
|
81
|
-
"expiresAt": 1646819457744
|
|
82
|
-
},
|
|
83
|
-
"1006899|widdershins>node-fetch": {
|
|
84
|
-
"decision": "fix",
|
|
85
|
-
"madeAt": 1644227510867
|
|
86
|
-
},
|
|
87
|
-
"1006846|shins>sanitize-html>postcss": {
|
|
88
|
-
"decision": "ignore",
|
|
89
|
-
"madeAt": 1644227621510,
|
|
90
|
-
"expiresAt": 1646819457744
|
|
91
|
-
},
|
|
92
|
-
"1006886|shins>markdown-it": {
|
|
93
|
-
"decision": "ignore",
|
|
94
|
-
"madeAt": 1644227622831,
|
|
95
|
-
"expiresAt": 1646819457744
|
|
96
|
-
},
|
|
97
|
-
"1007050|widdershins>urijs": {
|
|
98
|
-
"decision": "ignore",
|
|
99
|
-
"madeAt": 1646234133511,
|
|
100
|
-
"expiresAt": 1648826119845
|
|
101
|
-
},
|
|
102
|
-
"1007017|widdershins>swagger2openapi>oas-validator>ajv": {
|
|
103
|
-
"decision": "ignore",
|
|
104
|
-
"madeAt": 1646234136454,
|
|
105
|
-
"expiresAt": 1648826119845
|
|
106
|
-
}
|
|
107
|
-
},
|
|
108
|
-
"rules": {},
|
|
109
|
-
"version": 1
|
|
110
|
-
}
|
package/sonar-project.properties
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
# Required metadata
|
|
2
|
-
sonar.projectKey=central-services-shared
|
|
3
|
-
sonar.projectName=central-services-shared
|
|
4
|
-
sonar.projectVersion=1.0
|
|
5
|
-
|
|
6
|
-
# Comma-separated paths to directories with sources (required)
|
|
7
|
-
sonar.sources=src,test
|
|
8
|
-
|
|
9
|
-
# Language
|
|
10
|
-
sonar.language=js
|
|
11
|
-
|
|
12
|
-
# Encoding of the source files
|
|
13
|
-
sonar.sourceEncoding=UTF-8
|
|
14
|
-
|
|
15
|
-
# To import the LCOV report
|
|
16
|
-
sonar.javascript.lcov.reportPath=lcov.info
|