@mojaloop/central-services-shared 17.6.1 → 17.6.3

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.
@@ -7,22 +7,21 @@ version: 2.1
7
7
  # Orbs used in this pipeline
8
8
  ##
9
9
  orbs:
10
- slack: circleci/slack@4.9.3 # Ref: https://github.com/mojaloop/ci-config/tree/master/slack-templates
10
+ slack: circleci/slack@4.12.5 # Ref: https://github.com/mojaloop/ci-config/tree/master/slack-templates
11
11
  pr-tools: mojaloop/pr-tools@0.1.10 # Ref: https://github.com/mojaloop/ci-config/
12
- gh: circleci/github-cli@2.1.0
12
+ gh: circleci/github-cli@2.2.0
13
13
 
14
14
  ##
15
15
  # defaults
16
16
  #
17
17
  # YAML defaults templates, in alphabetical order
18
18
  ##
19
- defaults_Dependencies: &defaults_Dependencies |
19
+ defaults_docker_Dependencies: &defaults_docker_Dependencies |
20
20
  apk --no-cache add git
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 add --no-cache -t build-dependencies make gcc g++ python3 libtool autoconf automake jq
25
- npm config set unsafe-perm true
24
+ apk add --no-cache -t build-dependencies make gcc g++ python3 libtool autoconf automake jq bash
26
25
  npm install -g node-gyp
27
26
 
28
27
  defaults_awsCliDependencies: &defaults_awsCliDependencies |
@@ -59,6 +58,58 @@ defaults_configure_git: &defaults_configure_git
59
58
  git config user.email ${GIT_CI_EMAIL}
60
59
  git config user.name ${GIT_CI_USER}
61
60
 
61
+ defaults_configure_nvm: &defaults_configure_nvm
62
+ name: Configure NVM
63
+ command: |
64
+ cd $HOME
65
+
66
+ export ENV_DOT_PROFILE=$HOME/.profile
67
+ touch $ENV_DOT_PROFILE
68
+
69
+ echo "1. Export env variable"
70
+ export NVM_DIR="$HOME/.nvm"
71
+ if [ -z "$NVMRC_VERSION" ]; then
72
+ echo "==> Configuring NVMRC_VERSION!"
73
+ export NVMRC_VERSION=$(cat $CIRCLE_WORKING_DIRECTORY/.nvmrc)
74
+ echo "export NVMRC_VERSION=$NVMRC_VERSION" >> $ENV_DOT_PROFILE
75
+ fi
76
+
77
+ if [ -f "$NVM_DIR" ]; then
78
+ echo "==> $NVM_DIR exists. Skipping steps 2-4!"
79
+ else
80
+ echo "==> $NVM_DIR does not exists. Executing steps 2-4!"
81
+
82
+ echo "2. Installing NVM"
83
+ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
84
+
85
+ echo "3. Executing $NVM_DIR/nvm.sh"
86
+ [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
87
+ fi
88
+
89
+ ## Ref: https://github.com/nvm-sh/nvm/issues/1102#issuecomment-550572252
90
+ if [ ! -z "$NVM_ARCH_UNOFFICIAL_OVERRIDE" ]; then
91
+ echo "==> Handle NVM_ARCH_UNOFFICIAL_OVERRIDE=$NVM_ARCH_UNOFFICIAL_OVERRIDE!"
92
+ echo "nvm_get_arch() { nvm_echo \"${NVM_ARCH_UNOFFICIAL_OVERRIDE}\"; }" >> $ENV_DOT_PROFILE
93
+ echo "export NVM_NODEJS_ORG_MIRROR=https://unofficial-builds.nodejs.org/download/release" >> $ENV_DOT_PROFILE
94
+ source $ENV_DOT_PROFILE
95
+ fi
96
+
97
+ echo "4. Installing Node version: $NVMRC_VERSION"
98
+ nvm install $NVMRC_VERSION
99
+ nvm alias default $NVMRC_VERSION
100
+ nvm use $NVMRC_VERSION
101
+
102
+ cd $CIRCLE_WORKING_DIRECTORY
103
+
104
+ defaults_display_versions: &defaults_display_versions
105
+ name: Display Versions
106
+ command: |
107
+ echo "What is the active version of Nodejs?"
108
+ echo "node: $(node --version)"
109
+ echo "yarn: $(yarn --version)"
110
+ echo "npm: $(npm --version)"
111
+ echo "nvm: $(nvm --version)"
112
+
62
113
  ##
63
114
  # Executors
64
115
  #
@@ -67,13 +118,18 @@ defaults_configure_git: &defaults_configure_git
67
118
  executors:
68
119
  default-docker:
69
120
  working_directory: &WORKING_DIR /home/circleci/project
121
+ shell: "/bin/sh -leo pipefail" ## Ref: https://circleci.com/docs/env-vars/#alpine-linux
122
+ environment:
123
+ BASH_ENV: /etc/profile ## Ref: https://circleci.com/docs/env-vars/#alpine-linux
124
+ NVM_ARCH_UNOFFICIAL_OVERRIDE: x64-musl ## Ref: https://github.com/nvm-sh/nvm/issues/1102#issuecomment-550572252
70
125
  docker:
71
- - image: node:16.15.0-alpine
126
+ - image: node:lts-alpine
72
127
 
73
128
  default-machine:
74
129
  working_directory: *WORKING_DIR
130
+ shell: "/bin/bash -leo pipefail"
75
131
  machine:
76
- image: ubuntu-2004:current
132
+ image: ubuntu-2204:2023.04.2 # Ref: https://circleci.com/developer/machine/image/ubuntu-2204
77
133
 
78
134
  jobs:
79
135
  setup:
@@ -81,10 +137,14 @@ jobs:
81
137
  steps:
82
138
  - run:
83
139
  name: Install general dependencies
84
- command: *defaults_Dependencies
140
+ command: *defaults_docker_Dependencies
85
141
  - checkout
86
142
  - run:
87
- name: Update NPM install
143
+ <<: *defaults_configure_nvm
144
+ - run:
145
+ <<: *defaults_display_versions
146
+ - run:
147
+ name: Install NPM dependencies
88
148
  command: npm ci
89
149
  - save_cache:
90
150
  key: dependency-cache-{{ .Environment.CIRCLE_SHA1 }}
@@ -96,8 +156,12 @@ jobs:
96
156
  steps:
97
157
  - run:
98
158
  name: Install general dependencies
99
- command: *defaults_Dependencies
159
+ command: *defaults_docker_Dependencies
100
160
  - checkout
161
+ - run:
162
+ <<: *defaults_configure_nvm
163
+ - run:
164
+ <<: *defaults_display_versions
101
165
  - restore_cache:
102
166
  key: dependency-cache-{{ .Environment.CIRCLE_SHA1 }}
103
167
  - run:
@@ -109,8 +173,12 @@ jobs:
109
173
  steps:
110
174
  - run:
111
175
  name: Install general dependencies
112
- command: *defaults_Dependencies
176
+ command: *defaults_docker_Dependencies
113
177
  - checkout
178
+ - run:
179
+ <<: *defaults_configure_nvm
180
+ - run:
181
+ <<: *defaults_display_versions
114
182
  - restore_cache:
115
183
  key: dependency-cache-{{ .Environment.CIRCLE_SHA1 }}
116
184
  - run:
@@ -122,8 +190,12 @@ jobs:
122
190
  steps:
123
191
  - run:
124
192
  name: Install general dependencies
125
- command: *defaults_Dependencies
193
+ command: *defaults_docker_Dependencies
126
194
  - checkout
195
+ - run:
196
+ <<: *defaults_configure_nvm
197
+ - run:
198
+ <<: *defaults_display_versions
127
199
  - restore_cache:
128
200
  key: dependency-cache-{{ .Environment.CIRCLE_SHA1 }}
129
201
  - run:
@@ -138,7 +210,7 @@ jobs:
138
210
  command: npm -s run test:xunit
139
211
  - store_artifacts:
140
212
  path: ./test/results
141
- prefix: test
213
+ destination: test
142
214
  - store_test_results:
143
215
  path: ./test/results
144
216
 
@@ -147,11 +219,15 @@ jobs:
147
219
  steps:
148
220
  - run:
149
221
  name: Install general dependencies
150
- command: *defaults_Dependencies
222
+ command: *defaults_docker_Dependencies
151
223
  - run:
152
224
  name: Install AWS CLI dependencies
153
225
  command: *defaults_awsCliDependencies
154
226
  - checkout
227
+ - run:
228
+ <<: *defaults_configure_nvm
229
+ - run:
230
+ <<: *defaults_display_versions
155
231
  - restore_cache:
156
232
  key: dependency-cache-{{ .Environment.CIRCLE_SHA1 }}
157
233
  - run:
@@ -159,27 +235,21 @@ jobs:
159
235
  command: npm -s run test:coverage-check
160
236
  - store_artifacts:
161
237
  path: coverage
162
- prefix: test
238
+ destination: test
163
239
  - store_test_results:
164
240
  path: coverage
165
- - run:
166
- name: Copy code coverage to SonarQube
167
- command: |
168
- if [ "${CIRCLE_BRANCH}" == "master" ];
169
- then
170
- echo "Sending lcov.info to SonarQube..."
171
- aws s3 cp coverage/lcov.info $AWS_S3_DIR_SONARQUBE/${CIRCLE_PROJECT_REPONAME}/lcov.info
172
- else
173
- echo "Not a release (env CIRCLE_BRANCH != 'master'), skipping sending lcov.info to SonarQube."
174
- fi
175
241
 
176
242
  vulnerability-check:
177
243
  executor: default-docker
178
244
  steps:
179
245
  - run:
180
246
  name: Install general dependencies
181
- command: *defaults_Dependencies
247
+ command: *defaults_docker_Dependencies
182
248
  - checkout
249
+ - run:
250
+ <<: *defaults_configure_nvm
251
+ - run:
252
+ <<: *defaults_display_versions
183
253
  - restore_cache:
184
254
  key: dependency-cache-{{ .Environment.CIRCLE_SHA1 }}
185
255
  - run:
@@ -190,14 +260,14 @@ jobs:
190
260
  command: npm run audit:check -- -o json > ./audit/results/auditResults.json
191
261
  - store_artifacts:
192
262
  path: ./audit/results
193
- prefix: audit
263
+ destination: audit
194
264
 
195
265
  audit-licenses:
196
266
  executor: default-docker
197
267
  steps:
198
268
  - run:
199
269
  name: Install general dependencies
200
- command: *defaults_Dependencies
270
+ command: *defaults_docker_Dependencies
201
271
  - run:
202
272
  <<: *defaults_license_scanner
203
273
  - checkout
@@ -208,14 +278,14 @@ jobs:
208
278
  command: cd /tmp/license-scanner && pathToRepo=$CIRCLE_WORKING_DIRECTORY make run
209
279
  - store_artifacts:
210
280
  path: /tmp/license-scanner/results
211
- prefix: licenses
281
+ destination: licenses
212
282
 
213
283
  release:
214
284
  executor: default-docker
215
285
  steps:
216
286
  - run:
217
287
  name: Install general dependencies
218
- command: *defaults_Dependencies
288
+ command: *defaults_docker_Dependencies
219
289
  - checkout
220
290
  - restore_cache:
221
291
  keys:
@@ -242,6 +312,7 @@ jobs:
242
312
 
243
313
  github-release:
244
314
  executor: default-machine
315
+ shell: "/bin/bash -eo pipefail"
245
316
  steps:
246
317
  - run:
247
318
  name: Install git
@@ -287,7 +358,7 @@ jobs:
287
358
  steps:
288
359
  - run:
289
360
  name: Install general dependencies
290
- command: *defaults_Dependencies
361
+ command: *defaults_docker_Dependencies
291
362
  - checkout
292
363
  - restore_cache:
293
364
  key: dependency-cache-{{ .Environment.CIRCLE_SHA1 }}
@@ -325,7 +396,7 @@ jobs:
325
396
  steps:
326
397
  - run:
327
398
  name: Install general dependencies
328
- command: *defaults_Dependencies
399
+ command: *defaults_docker_Dependencies
329
400
  - checkout
330
401
  - restore_cache:
331
402
  key: dependency-cache-{{ .Environment.CIRCLE_SHA1 }}
@@ -362,7 +433,6 @@ jobs:
362
433
  template: SLACK_TEMP_RELEASE_FAILURE
363
434
 
364
435
  workflows:
365
- version: 2
366
436
  build_and_test:
367
437
  jobs:
368
438
  - pr-tools/pr-title-check:
package/.nvmrc CHANGED
@@ -1 +1 @@
1
- 16.15.0
1
+ 18.17.1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
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.6.3](https://github.com/mojaloop/central-services-shared/compare/v17.6.2...v17.6.3) (2023-08-29)
6
+
7
+ ### [17.6.2](https://github.com/mojaloop/central-services-shared/compare/v17.6.1...v17.6.2) (2023-08-24)
8
+
5
9
  ### [17.6.1](https://github.com/mojaloop/central-services-shared/compare/v17.6.0...v17.6.1) (2023-08-17)
6
10
 
7
11
  ## [17.6.0](https://github.com/mojaloop/central-services-shared/compare/v17.5.3...v17.6.0) (2023-08-17)
package/README.md CHANGED
@@ -9,12 +9,12 @@ Shared code for central services
9
9
 
10
10
  ## Auditing Dependencies
11
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.
12
+ 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.
13
13
 
14
14
  To start a new resolution process, run:
15
15
 
16
16
  ```bash
17
- npm run audit:resolve
17
+ npm run audit:fix
18
18
  ```
19
19
 
20
20
  You can then check to see if the CI will pass based on the current dependencies with:
@@ -23,7 +23,7 @@ You can then check to see if the CI will pass based on the current dependencies
23
23
  npm run audit:check
24
24
  ```
25
25
 
26
- And commit the changed `audit-resolve.json` to ensure that CircleCI will build correctly.
26
+ The [audit-ci.jsonc](./audit-ci.jsonc) contains any audit-exceptions that cannot be fixed to ensure that CircleCI will build correctly.
27
27
 
28
28
  ## Automated Releases
29
29
 
package/audit-ci.jsonc CHANGED
@@ -9,20 +9,9 @@
9
9
  "GHSA-phwq-j96m-2c2q",
10
10
  "GHSA-282f-qqgm-c34q",
11
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
12
  "GHSA-mjxr-4v3x-q3m4",
17
13
  "GHSA-rjqq-98f6-6j3r",
18
14
  "GHSA-w5p7-h5w8-2hfq",
19
- "GHSA-p9pc-299p-vxgp",
20
- // TODO: There is a conflict with the sub-dependency jsonwebtoken. Not able to fix with 'npm audit fix'. Need too investigate the root cause.
21
- "GHSA-hjrf-2m68-5959",
22
- "GHSA-8cf7-32gw-wr33",
23
- "GHSA-qwph-4952-7xr6",
24
- "GHSA-27h2-hvpr-p74q",
25
- "GHSA-h755-8qp9-cq85", // https://github.com/advisories/GHSA-h755-8qp9-cq85
26
- "GHSA-c2qf-rxjj-qqgw" // https://github.com/advisories/GHSA-c2qf-rxjj-qqgw
15
+ "GHSA-p9pc-299p-vxgp"
27
16
  ]
28
17
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mojaloop/central-services-shared",
3
- "version": "17.6.1",
3
+ "version": "17.6.3",
4
4
  "description": "Shared code for mojaloop central services",
5
5
  "license": "Apache-2.0",
6
6
  "author": "ModusBox",
@@ -24,9 +24,6 @@
24
24
  ],
25
25
  "main": "src/index.js",
26
26
  "types": "src/index.d.ts",
27
- "engines": {
28
- "node": "=16.x"
29
- },
30
27
  "imports": {
31
28
  "#src/*": "./src/*.js",
32
29
  "#test/*": "./test/*.js"
@@ -57,12 +54,12 @@
57
54
  "dependencies": {
58
55
  "@hapi/catbox": "12.0.0",
59
56
  "@hapi/catbox-memory": "5.0.1",
60
- "axios": "1.4.0",
57
+ "axios": "1.5.0",
61
58
  "clone": "2.1.2",
62
59
  "dotenv": "16.3.1",
63
- "env-var": "7.3.1",
60
+ "env-var": "7.4.1",
64
61
  "event-stream": "4.0.1",
65
- "immutable": "4.3.2",
62
+ "immutable": "4.3.4",
66
63
  "lodash": "4.17.21",
67
64
  "mustache": "4.2.0",
68
65
  "openapi-backend": "5.9.2",
@@ -71,7 +68,7 @@
71
68
  "shins": "2.6.0",
72
69
  "uuid4": "2.0.3",
73
70
  "widdershins": "^4.0.1",
74
- "yaml": "2.3.1"
71
+ "yaml": "2.3.2"
75
72
  },
76
73
  "devDependencies": {
77
74
  "@hapi/hapi": "21.3.2",
@@ -79,7 +76,7 @@
79
76
  "audit-ci": "^6.6.1",
80
77
  "base64url": "3.0.1",
81
78
  "chance": "1.1.11",
82
- "npm-check-updates": "16.12.2",
79
+ "npm-check-updates": "16.13.2",
83
80
  "nyc": "15.1.0",
84
81
  "pre-commit": "1.2.2",
85
82
  "proxyquire": "2.1.3",
@@ -94,10 +91,10 @@
94
91
  "tapes": "4.1.0"
95
92
  },
96
93
  "peerDependencies": {
97
- "@mojaloop/central-services-error-handling": "12.x.x",
98
- "@mojaloop/central-services-logger": "11.x.x",
99
- "@mojaloop/central-services-metrics": "12.x.x",
100
- "@mojaloop/event-sdk": "11.x.x",
94
+ "@mojaloop/central-services-error-handling": ">=12.x.x",
95
+ "@mojaloop/central-services-logger": ">=11.x.x",
96
+ "@mojaloop/central-services-metrics": ">=12.x.x",
97
+ "@mojaloop/event-sdk": ">=12.x.x",
101
98
  "ajv": "8.x.x",
102
99
  "ajv-keywords": "5.x.x"
103
100
  },