@mojaloop/database-lib 11.0.0 → 11.0.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.
- package/.circleci/config.yml +330 -136
- package/.nvmrc +1 -1
- package/CHANGELOG.md +6 -0
- package/README.md +1 -1
- package/audit-ci.jsonc +15 -0
- package/package.json +16 -15
- package/audit-resolve.json +0 -10
- package/sonar-project.properties +0 -16
package/.circleci/config.yml
CHANGED
|
@@ -7,34 +7,30 @@ version: 2.1
|
|
|
7
7
|
# Orbs used in this pipeline
|
|
8
8
|
##
|
|
9
9
|
orbs:
|
|
10
|
-
slack: circleci/slack@
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
slack: circleci/slack@4.12.5 # 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.2.0
|
|
13
13
|
|
|
14
14
|
##
|
|
15
15
|
# defaults
|
|
16
16
|
#
|
|
17
17
|
# YAML defaults templates, in alphabetical order
|
|
18
18
|
##
|
|
19
|
-
|
|
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 --no-cache
|
|
25
|
-
apk add --no-cache -t build-dependencies make gcc g++ python libtool autoconf automake jq
|
|
26
|
-
npm config set unsafe-perm true
|
|
27
|
-
npm install -g node-gyp
|
|
24
|
+
apk add --no-cache -t build-dependencies make gcc g++ python3 libtool autoconf automake jq bash
|
|
28
25
|
|
|
29
26
|
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
|
|
27
|
+
apk --no-cache add aws-cli
|
|
28
|
+
|
|
29
|
+
defaults_license_scanner: &defaults_license_scanner
|
|
30
|
+
name: Install and set up license-scanner
|
|
31
|
+
command: |
|
|
32
|
+
git clone https://github.com/mojaloop/license-scanner /tmp/license-scanner
|
|
33
|
+
cd /tmp/license-scanner && make build default-files set-up
|
|
38
34
|
|
|
39
35
|
defaults_npm_auth: &defaults_npm_auth
|
|
40
36
|
name: Update NPM registry auth token
|
|
@@ -47,18 +43,70 @@ defaults_npm_publish_release: &defaults_npm_publish_release
|
|
|
47
43
|
echo "Publishing tag $RELEASE_TAG"
|
|
48
44
|
npm publish --tag $RELEASE_TAG --access public
|
|
49
45
|
|
|
50
|
-
|
|
51
|
-
name:
|
|
46
|
+
defaults_export_version_from_package: &defaults_export_version_from_package
|
|
47
|
+
name: Format the changelog into the github release body and get release tag
|
|
52
48
|
command: |
|
|
53
|
-
|
|
54
|
-
echo
|
|
55
|
-
|
|
49
|
+
git diff --no-indent-heuristic main~1 HEAD CHANGELOG.md | sed -n '/^+[^+]/ s/^+//p' > /tmp/changes
|
|
50
|
+
echo 'export RELEASE_CHANGES=`cat /tmp/changes`' >> $BASH_ENV
|
|
51
|
+
echo 'export RELEASE_TAG=`cat package-lock.json | jq -r .version`' >> $BASH_ENV
|
|
56
52
|
|
|
57
|
-
|
|
58
|
-
name:
|
|
53
|
+
defaults_configure_git: &defaults_configure_git
|
|
54
|
+
name: Configure git
|
|
59
55
|
command: |
|
|
60
|
-
git
|
|
61
|
-
|
|
56
|
+
git config user.email ${GIT_CI_EMAIL}
|
|
57
|
+
git config user.name ${GIT_CI_USER}
|
|
58
|
+
|
|
59
|
+
defaults_configure_nvm: &defaults_configure_nvm
|
|
60
|
+
name: Configure NVM
|
|
61
|
+
command: |
|
|
62
|
+
cd $HOME
|
|
63
|
+
|
|
64
|
+
export ENV_DOT_PROFILE=$HOME/.profile
|
|
65
|
+
touch $ENV_DOT_PROFILE
|
|
66
|
+
|
|
67
|
+
echo "1. Export env variable"
|
|
68
|
+
export NVM_DIR="$HOME/.nvm"
|
|
69
|
+
if [ -z "$NVMRC_VERSION" ]; then
|
|
70
|
+
echo "==> Configuring NVMRC_VERSION!"
|
|
71
|
+
export NVMRC_VERSION=$(cat $CIRCLE_WORKING_DIRECTORY/.nvmrc)
|
|
72
|
+
echo "export NVMRC_VERSION=$NVMRC_VERSION" >> $ENV_DOT_PROFILE
|
|
73
|
+
fi
|
|
74
|
+
|
|
75
|
+
if [ -f "$NVM_DIR" ]; then
|
|
76
|
+
echo "==> $NVM_DIR exists. Skipping steps 2-4!"
|
|
77
|
+
else
|
|
78
|
+
echo "==> $NVM_DIR does not exists. Executing steps 2-4!"
|
|
79
|
+
|
|
80
|
+
echo "2. Installing NVM"
|
|
81
|
+
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
|
|
82
|
+
|
|
83
|
+
echo "3. Executing $NVM_DIR/nvm.sh"
|
|
84
|
+
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
|
|
85
|
+
fi
|
|
86
|
+
|
|
87
|
+
## Ref: https://github.com/nvm-sh/nvm/issues/1102#issuecomment-550572252
|
|
88
|
+
if [ ! -z "$NVM_ARCH_UNOFFICIAL_OVERRIDE" ]; then
|
|
89
|
+
echo "==> Handle NVM_ARCH_UNOFFICIAL_OVERRIDE=$NVM_ARCH_UNOFFICIAL_OVERRIDE!"
|
|
90
|
+
echo "nvm_get_arch() { nvm_echo \"${NVM_ARCH_UNOFFICIAL_OVERRIDE}\"; }" >> $ENV_DOT_PROFILE
|
|
91
|
+
echo "export NVM_NODEJS_ORG_MIRROR=https://unofficial-builds.nodejs.org/download/release" >> $ENV_DOT_PROFILE
|
|
92
|
+
source $ENV_DOT_PROFILE
|
|
93
|
+
fi
|
|
94
|
+
|
|
95
|
+
echo "4. Installing Node version: $NVMRC_VERSION"
|
|
96
|
+
nvm install $NVMRC_VERSION
|
|
97
|
+
nvm alias default $NVMRC_VERSION
|
|
98
|
+
nvm use $NVMRC_VERSION
|
|
99
|
+
|
|
100
|
+
cd $CIRCLE_WORKING_DIRECTORY
|
|
101
|
+
|
|
102
|
+
defaults_display_versions: &defaults_display_versions
|
|
103
|
+
name: Display Versions
|
|
104
|
+
command: |
|
|
105
|
+
echo "What is the active version of Nodejs?"
|
|
106
|
+
echo "node: $(node --version)"
|
|
107
|
+
echo "yarn: $(yarn --version)"
|
|
108
|
+
echo "npm: $(npm --version)"
|
|
109
|
+
echo "nvm: $(nvm --version)"
|
|
62
110
|
|
|
63
111
|
##
|
|
64
112
|
# Executors
|
|
@@ -67,241 +115,356 @@ defaults_license_scanner: &defaults_license_scanner
|
|
|
67
115
|
##
|
|
68
116
|
executors:
|
|
69
117
|
default-docker:
|
|
70
|
-
working_directory: /home/circleci/project
|
|
118
|
+
working_directory: &WORKING_DIR /home/circleci/project
|
|
119
|
+
shell: "/bin/sh -leo pipefail" ## Ref: https://circleci.com/docs/env-vars/#alpine-linux
|
|
120
|
+
environment:
|
|
121
|
+
BASH_ENV: /etc/profile ## Ref: https://circleci.com/docs/env-vars/#alpine-linux
|
|
122
|
+
NVM_ARCH_UNOFFICIAL_OVERRIDE: x64-musl ## Ref: https://github.com/nvm-sh/nvm/issues/1102#issuecomment-550572252
|
|
71
123
|
docker:
|
|
72
|
-
- image: node:
|
|
124
|
+
- image: node:lts-alpine
|
|
73
125
|
|
|
74
126
|
default-machine:
|
|
127
|
+
working_directory: *WORKING_DIR
|
|
128
|
+
shell: "/bin/bash -leo pipefail"
|
|
75
129
|
machine:
|
|
76
|
-
image: ubuntu-
|
|
130
|
+
image: ubuntu-2204:2023.04.2 # Ref: https://circleci.com/developer/machine/image/ubuntu-2204
|
|
77
131
|
|
|
78
|
-
##
|
|
79
|
-
# Jobs
|
|
80
|
-
#
|
|
81
|
-
# A map of CircleCI jobs
|
|
82
|
-
##
|
|
83
132
|
jobs:
|
|
84
133
|
setup:
|
|
85
134
|
executor: default-docker
|
|
86
135
|
steps:
|
|
87
136
|
- run:
|
|
88
137
|
name: Install general dependencies
|
|
89
|
-
command: *
|
|
138
|
+
command: *defaults_docker_Dependencies
|
|
90
139
|
- checkout
|
|
91
|
-
- restore_cache:
|
|
92
|
-
keys:
|
|
93
|
-
- dependency-cache-{{ checksum "package-lock.json" }}
|
|
94
140
|
- run:
|
|
95
|
-
|
|
96
|
-
command: cd $(npm root -g)/npm
|
|
141
|
+
<<: *defaults_configure_nvm
|
|
97
142
|
- run:
|
|
98
|
-
|
|
99
|
-
command: npm ci
|
|
143
|
+
<<: *defaults_display_versions
|
|
100
144
|
- run:
|
|
101
|
-
name:
|
|
102
|
-
command:
|
|
145
|
+
name: Install NPM dependencies
|
|
146
|
+
command: npm ci
|
|
103
147
|
- save_cache:
|
|
104
|
-
key: dependency-cache-{{
|
|
148
|
+
key: dependency-cache-{{ .Environment.CIRCLE_SHA1 }}
|
|
105
149
|
paths:
|
|
106
150
|
- node_modules
|
|
107
151
|
|
|
152
|
+
test-dependencies:
|
|
153
|
+
executor: default-docker
|
|
154
|
+
steps:
|
|
155
|
+
- run:
|
|
156
|
+
name: Install general dependencies
|
|
157
|
+
command: *defaults_docker_Dependencies
|
|
158
|
+
- checkout
|
|
159
|
+
- run:
|
|
160
|
+
<<: *defaults_configure_nvm
|
|
161
|
+
- run:
|
|
162
|
+
<<: *defaults_display_versions
|
|
163
|
+
- restore_cache:
|
|
164
|
+
key: dependency-cache-{{ .Environment.CIRCLE_SHA1 }}
|
|
165
|
+
- run:
|
|
166
|
+
name: Execute dependency tests
|
|
167
|
+
command: npm run dep:check
|
|
168
|
+
|
|
169
|
+
test-lint:
|
|
170
|
+
executor: default-docker
|
|
171
|
+
steps:
|
|
172
|
+
- run:
|
|
173
|
+
name: Install general dependencies
|
|
174
|
+
command: *defaults_docker_Dependencies
|
|
175
|
+
- checkout
|
|
176
|
+
- run:
|
|
177
|
+
<<: *defaults_configure_nvm
|
|
178
|
+
- run:
|
|
179
|
+
<<: *defaults_display_versions
|
|
180
|
+
- restore_cache:
|
|
181
|
+
key: dependency-cache-{{ .Environment.CIRCLE_SHA1 }}
|
|
182
|
+
- run:
|
|
183
|
+
name: Execute lint tests
|
|
184
|
+
command: npm run lint
|
|
185
|
+
|
|
108
186
|
test-unit:
|
|
109
187
|
executor: default-docker
|
|
110
188
|
steps:
|
|
111
189
|
- run:
|
|
112
190
|
name: Install general dependencies
|
|
113
|
-
command: *
|
|
191
|
+
command: *defaults_docker_Dependencies
|
|
114
192
|
- checkout
|
|
193
|
+
- run:
|
|
194
|
+
<<: *defaults_configure_nvm
|
|
195
|
+
- run:
|
|
196
|
+
<<: *defaults_display_versions
|
|
115
197
|
- restore_cache:
|
|
116
|
-
key: dependency-cache-{{
|
|
198
|
+
key: dependency-cache-{{ .Environment.CIRCLE_SHA1 }}
|
|
199
|
+
- run:
|
|
200
|
+
# This is needed for legacy core tests. Remove this once 'tape' is fully deprecated.
|
|
201
|
+
name: Install tape, tapes and tap-xunit
|
|
202
|
+
command: npm install tape tapes tap-xunit
|
|
117
203
|
- run:
|
|
118
204
|
name: Create dir for test results
|
|
119
205
|
command: mkdir -p ./test/results
|
|
120
|
-
- run:
|
|
121
|
-
name: Install testing dependencies
|
|
122
|
-
command: npm install tape tapes tap-xunit
|
|
123
206
|
- run:
|
|
124
207
|
name: Execute unit tests
|
|
125
|
-
command: npm -s run test:xunit
|
|
208
|
+
command: npm -s run test:xunit
|
|
126
209
|
- store_artifacts:
|
|
127
210
|
path: ./test/results
|
|
128
|
-
|
|
211
|
+
destination: test
|
|
129
212
|
- store_test_results:
|
|
130
213
|
path: ./test/results
|
|
131
|
-
|
|
214
|
+
|
|
132
215
|
test-coverage:
|
|
133
216
|
executor: default-docker
|
|
134
217
|
steps:
|
|
135
218
|
- run:
|
|
136
219
|
name: Install general dependencies
|
|
137
|
-
command: *
|
|
220
|
+
command: *defaults_docker_Dependencies
|
|
138
221
|
- run:
|
|
139
222
|
name: Install AWS CLI dependencies
|
|
140
223
|
command: *defaults_awsCliDependencies
|
|
141
224
|
- checkout
|
|
142
|
-
- restore_cache:
|
|
143
|
-
key: dependency-cache-{{ checksum "package-lock.json" }}
|
|
144
225
|
- run:
|
|
145
|
-
|
|
146
|
-
|
|
226
|
+
<<: *defaults_configure_nvm
|
|
227
|
+
- run:
|
|
228
|
+
<<: *defaults_display_versions
|
|
229
|
+
- restore_cache:
|
|
230
|
+
key: dependency-cache-{{ .Environment.CIRCLE_SHA1 }}
|
|
147
231
|
- run:
|
|
148
232
|
name: Execute code coverage check
|
|
149
233
|
command: npm -s run test:coverage-check
|
|
150
234
|
- store_artifacts:
|
|
151
235
|
path: coverage
|
|
152
|
-
|
|
236
|
+
destination: test
|
|
153
237
|
- store_test_results:
|
|
154
|
-
path: coverage
|
|
155
|
-
|
|
156
|
-
name: Copy code coverage to SonarQube
|
|
157
|
-
command: |
|
|
158
|
-
if [ "${CIRCLE_BRANCH}" == "master" ];
|
|
159
|
-
then
|
|
160
|
-
echo "Sending lcov.info to SonarQube..."
|
|
161
|
-
aws s3 cp coverage/lcov.info $AWS_S3_DIR_SONARQUBE/${CIRCLE_PROJECT_REPONAME}/lcov.info
|
|
162
|
-
else
|
|
163
|
-
echo "Not a release (env CIRCLE_BRANCH != 'master'), skipping sending lcov.info to SonarQube."
|
|
164
|
-
fi
|
|
238
|
+
path: coverage
|
|
239
|
+
|
|
165
240
|
vulnerability-check:
|
|
166
241
|
executor: default-docker
|
|
167
242
|
steps:
|
|
168
243
|
- run:
|
|
169
244
|
name: Install general dependencies
|
|
170
|
-
command: *
|
|
245
|
+
command: *defaults_docker_Dependencies
|
|
171
246
|
- checkout
|
|
247
|
+
- run:
|
|
248
|
+
<<: *defaults_configure_nvm
|
|
249
|
+
- run:
|
|
250
|
+
<<: *defaults_display_versions
|
|
172
251
|
- restore_cache:
|
|
173
|
-
key: dependency-cache-{{
|
|
252
|
+
key: dependency-cache-{{ .Environment.CIRCLE_SHA1 }}
|
|
174
253
|
- run:
|
|
175
254
|
name: Create dir for test results
|
|
176
255
|
command: mkdir -p ./audit/results
|
|
177
256
|
- run:
|
|
178
257
|
name: Check for new npm vulnerabilities
|
|
179
|
-
command: npm run audit:check --
|
|
258
|
+
command: npm run audit:check -- -o json > ./audit/results/auditResults.json
|
|
180
259
|
- store_artifacts:
|
|
181
260
|
path: ./audit/results
|
|
182
|
-
|
|
261
|
+
destination: audit
|
|
183
262
|
|
|
184
263
|
audit-licenses:
|
|
185
264
|
executor: default-docker
|
|
186
265
|
steps:
|
|
187
266
|
- run:
|
|
188
267
|
name: Install general dependencies
|
|
189
|
-
command: *
|
|
190
|
-
- checkout
|
|
268
|
+
command: *defaults_docker_Dependencies
|
|
191
269
|
- run:
|
|
192
270
|
<<: *defaults_license_scanner
|
|
271
|
+
- checkout
|
|
193
272
|
- restore_cache:
|
|
194
|
-
key: dependency-cache-{{
|
|
195
|
-
- run:
|
|
196
|
-
name: Prune non-production packages before running license-scanner
|
|
197
|
-
command: npm prune --production
|
|
273
|
+
key: dependency-cache-{{ .Environment.CIRCLE_SHA1 }}
|
|
198
274
|
- run:
|
|
199
275
|
name: Run the license-scanner
|
|
200
276
|
command: cd /tmp/license-scanner && pathToRepo=$CIRCLE_WORKING_DIRECTORY make run
|
|
201
277
|
- store_artifacts:
|
|
202
278
|
path: /tmp/license-scanner/results
|
|
203
|
-
|
|
279
|
+
destination: licenses
|
|
204
280
|
|
|
205
281
|
release:
|
|
206
282
|
executor: default-docker
|
|
207
283
|
steps:
|
|
208
284
|
- run:
|
|
209
285
|
name: Install general dependencies
|
|
210
|
-
command: *
|
|
286
|
+
command: *defaults_docker_Dependencies
|
|
211
287
|
- checkout
|
|
212
288
|
- restore_cache:
|
|
213
289
|
keys:
|
|
214
|
-
- dependency-cache-{{
|
|
290
|
+
- dependency-cache-{{ .Environment.CIRCLE_SHA1 }}
|
|
215
291
|
- run:
|
|
216
|
-
|
|
217
|
-
command: |
|
|
218
|
-
git config user.email ${GIT_CI_EMAIL}
|
|
219
|
-
git config user.name ${GIT_CI_USER}
|
|
220
|
-
git checkout ${CIRCLE_BRANCH}
|
|
292
|
+
<<: *defaults_configure_git
|
|
221
293
|
- run:
|
|
222
|
-
name:
|
|
294
|
+
name: Setup Slack config
|
|
223
295
|
command: |
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
296
|
+
echo "export SLACK_PROJECT_NAME=${CIRCLE_PROJECT_REPONAME}" >> $BASH_ENV
|
|
297
|
+
echo "export SLACK_RELEASE_TYPE='GitHub Release'" >> $BASH_ENV
|
|
298
|
+
echo "export SLACK_RELEASE_TAG='${RELEASE_TAG} on ${CIRCLE_BRANCH} branch'" >> $BASH_ENV
|
|
299
|
+
echo "export SLACK_BUILD_ID=${CIRCLE_BUILD_NUM}" >> $BASH_ENV
|
|
300
|
+
echo "export SLACK_CI_URL=${CIRCLE_BUILD_URL}" >> $BASH_ENV
|
|
227
301
|
- run:
|
|
228
302
|
name: Generate changelog and bump package version
|
|
229
|
-
command: npm run release
|
|
303
|
+
command: npm run release -- --no-verify
|
|
230
304
|
- run:
|
|
231
305
|
name: Push the release
|
|
232
306
|
command: git push --follow-tags origin ${CIRCLE_BRANCH}
|
|
307
|
+
- slack/notify:
|
|
308
|
+
event: fail
|
|
309
|
+
template: SLACK_TEMP_RELEASE_FAILURE
|
|
233
310
|
|
|
234
311
|
github-release:
|
|
235
312
|
executor: default-machine
|
|
313
|
+
shell: "/bin/bash -eo pipefail"
|
|
236
314
|
steps:
|
|
237
315
|
- run:
|
|
238
316
|
name: Install git
|
|
239
317
|
command: |
|
|
240
318
|
sudo apt-get update && sudo apt-get install -y git
|
|
319
|
+
- gh/install
|
|
241
320
|
- checkout
|
|
321
|
+
- run:
|
|
322
|
+
<<: *defaults_configure_git
|
|
242
323
|
- run:
|
|
243
324
|
name: Fetch updated release branch
|
|
244
325
|
command: |
|
|
245
|
-
git config user.email ${GIT_CI_EMAIL}
|
|
246
|
-
git config user.name ${GIT_CI_USER}
|
|
247
326
|
git fetch origin
|
|
248
327
|
git checkout origin/${CIRCLE_BRANCH}
|
|
249
328
|
- run:
|
|
250
|
-
|
|
251
|
-
command: |
|
|
252
|
-
git diff --no-indent-heuristic master~1 HEAD CHANGELOG.md | sed -n '/^+[^+]/ s/^+//p' > /tmp/changes
|
|
253
|
-
echo 'export RELEASE_CHANGES=`cat /tmp/changes`' >> $BASH_ENV
|
|
254
|
-
echo 'export RELEASE_TAG=`cat package.json | jq -r .version`' >> $BASH_ENV
|
|
329
|
+
<<: *defaults_export_version_from_package
|
|
255
330
|
- run:
|
|
256
|
-
name:
|
|
331
|
+
name: Check the release changes
|
|
257
332
|
command: |
|
|
258
333
|
echo "Changes are: ${RELEASE_CHANGES}"
|
|
259
|
-
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
334
|
+
- run:
|
|
335
|
+
name: Setup Slack config
|
|
336
|
+
command: |
|
|
337
|
+
echo "export SLACK_PROJECT_NAME=${CIRCLE_PROJECT_REPONAME}" >> $BASH_ENV
|
|
338
|
+
echo "export SLACK_RELEASE_TYPE='Github Release'" >> $BASH_ENV
|
|
339
|
+
echo "export SLACK_RELEASE_TAG=v${RELEASE_TAG}" >> $BASH_ENV
|
|
340
|
+
echo "export SLACK_RELEASE_URL=https://github.com/mojaloop/${CIRCLE_PROJECT_REPONAME}/releases/tag/v${RELEASE_TAG}" >> $BASH_ENV
|
|
341
|
+
echo "export SLACK_BUILD_ID=${CIRCLE_BUILD_NUM}" >> $BASH_ENV
|
|
342
|
+
echo "export SLACK_CI_URL=${CIRCLE_BUILD_URL}" >> $BASH_ENV
|
|
343
|
+
- run:
|
|
344
|
+
name: Create Release
|
|
345
|
+
command: |
|
|
346
|
+
gh release create "v${RELEASE_TAG}" --title "v${RELEASE_TAG} Release" --draft=false --notes "${RELEASE_CHANGES}" ./CHANGELOG.md
|
|
347
|
+
- slack/notify:
|
|
348
|
+
event: pass
|
|
349
|
+
template: SLACK_TEMP_RELEASE_SUCCESS
|
|
350
|
+
- slack/notify:
|
|
351
|
+
event: fail
|
|
352
|
+
template: SLACK_TEMP_RELEASE_FAILURE
|
|
268
353
|
|
|
269
354
|
publish:
|
|
270
355
|
executor: default-docker
|
|
271
356
|
steps:
|
|
272
357
|
- run:
|
|
273
358
|
name: Install general dependencies
|
|
274
|
-
command: *
|
|
359
|
+
command: *defaults_docker_Dependencies
|
|
275
360
|
- checkout
|
|
276
361
|
- restore_cache:
|
|
277
|
-
key: dependency-cache-{{
|
|
362
|
+
key: dependency-cache-{{ .Environment.CIRCLE_SHA1 }}
|
|
278
363
|
- run:
|
|
279
|
-
name:
|
|
364
|
+
name: Setup for LATEST release
|
|
280
365
|
command: |
|
|
281
|
-
echo
|
|
366
|
+
echo "export RELEASE_TAG=$RELEASE_TAG_PROD" >> $BASH_ENV
|
|
367
|
+
echo "RELEASE_TAG=$RELEASE_TAG_PROD"
|
|
368
|
+
|
|
369
|
+
PACKAGE_VERSION=$(cat package-lock.json | jq -r .version)
|
|
370
|
+
echo "export PACKAGE_VERSION=${PACKAGE_VERSION}" >> $BASH_ENV
|
|
371
|
+
echo "PACKAGE_VERSION=${PACKAGE_VERSION}"
|
|
372
|
+
- run:
|
|
373
|
+
name: Setup Slack config
|
|
374
|
+
command: |
|
|
375
|
+
echo "export SLACK_PROJECT_NAME=${CIRCLE_PROJECT_REPONAME}" >> $BASH_ENV
|
|
376
|
+
echo "export SLACK_RELEASE_TYPE='NPM Release'" >> $BASH_ENV
|
|
377
|
+
echo "export SLACK_RELEASE_TAG=v${CIRCLE_TAG:1}" >> $BASH_ENV
|
|
378
|
+
echo "export SLACK_RELEASE_URL=https://www.npmjs.com/package/@mojaloop/${CIRCLE_PROJECT_REPONAME}/v/${CIRCLE_TAG:1}" >> $BASH_ENV
|
|
379
|
+
echo "export SLACK_BUILD_ID=${CIRCLE_BUILD_NUM}" >> $BASH_ENV
|
|
380
|
+
echo "export SLACK_CI_URL=${CIRCLE_BUILD_URL}" >> $BASH_ENV
|
|
282
381
|
- run:
|
|
283
382
|
<<: *defaults_npm_auth
|
|
284
383
|
- run:
|
|
285
384
|
<<: *defaults_npm_publish_release
|
|
385
|
+
- slack/notify:
|
|
386
|
+
event: pass
|
|
387
|
+
template: SLACK_TEMP_RELEASE_SUCCESS
|
|
388
|
+
- slack/notify:
|
|
389
|
+
event: fail
|
|
390
|
+
template: SLACK_TEMP_RELEASE_FAILURE
|
|
391
|
+
|
|
392
|
+
publish-snapshot:
|
|
393
|
+
executor: default-docker
|
|
394
|
+
steps:
|
|
395
|
+
- run:
|
|
396
|
+
name: Install general dependencies
|
|
397
|
+
command: *defaults_docker_Dependencies
|
|
398
|
+
- checkout
|
|
399
|
+
- restore_cache:
|
|
400
|
+
key: dependency-cache-{{ .Environment.CIRCLE_SHA1 }}
|
|
401
|
+
- run:
|
|
402
|
+
name: Setup for SNAPSHOT release
|
|
403
|
+
command: |
|
|
404
|
+
echo "export RELEASE_TAG=${RELEASE_TAG_SNAPSHOT}" >> $BASH_ENV
|
|
405
|
+
echo "RELEASE_TAG=${RELEASE_TAG_SNAPSHOT}"
|
|
406
|
+
|
|
407
|
+
echo "Override package version: ${CIRCLE_TAG:1}"
|
|
408
|
+
npx standard-version --skip.tag --skip.commit --skip.changelog --release-as ${CIRCLE_TAG:1}
|
|
409
|
+
|
|
410
|
+
PACKAGE_VERSION=$(cat package-lock.json | jq -r .version)
|
|
411
|
+
echo "export PACKAGE_VERSION=${PACKAGE_VERSION}" >> $BASH_ENV
|
|
412
|
+
echo "PACKAGE_VERSION=${PACKAGE_VERSION}"
|
|
413
|
+
- run:
|
|
414
|
+
name: Setup Slack config
|
|
415
|
+
command: |
|
|
416
|
+
echo "export SLACK_PROJECT_NAME=${CIRCLE_PROJECT_REPONAME}" >> $BASH_ENV
|
|
417
|
+
echo "export SLACK_RELEASE_TYPE='NPM Snapshot'" >> $BASH_ENV
|
|
418
|
+
echo "export SLACK_RELEASE_TAG=v${CIRCLE_TAG:1}" >> $BASH_ENV
|
|
419
|
+
echo "export SLACK_RELEASE_URL=https://www.npmjs.com/package/@mojaloop/${CIRCLE_PROJECT_REPONAME}/v/${CIRCLE_TAG:1}" >> $BASH_ENV
|
|
420
|
+
echo "export SLACK_BUILD_ID=${CIRCLE_BUILD_NUM}" >> $BASH_ENV
|
|
421
|
+
echo "export SLACK_CI_URL=${CIRCLE_BUILD_URL}" >> $BASH_ENV
|
|
422
|
+
- run:
|
|
423
|
+
<<: *defaults_npm_auth
|
|
424
|
+
- run:
|
|
425
|
+
<<: *defaults_npm_publish_release
|
|
426
|
+
- slack/notify:
|
|
427
|
+
event: pass
|
|
428
|
+
template: SLACK_TEMP_RELEASE_SUCCESS
|
|
429
|
+
- slack/notify:
|
|
430
|
+
event: fail
|
|
431
|
+
template: SLACK_TEMP_RELEASE_FAILURE
|
|
286
432
|
|
|
287
|
-
##
|
|
288
|
-
# Workflows
|
|
289
|
-
#
|
|
290
|
-
# CircleCI Workflow config
|
|
291
|
-
##
|
|
292
433
|
workflows:
|
|
293
|
-
version: 2
|
|
294
434
|
build_and_test:
|
|
295
435
|
jobs:
|
|
296
436
|
- pr-tools/pr-title-check:
|
|
297
437
|
context: org-global
|
|
298
|
-
|
|
299
438
|
- setup:
|
|
300
439
|
context: org-global
|
|
301
440
|
filters:
|
|
302
441
|
tags:
|
|
303
442
|
only: /.*/
|
|
304
|
-
|
|
443
|
+
branches:
|
|
444
|
+
ignore:
|
|
445
|
+
- /feature*/
|
|
446
|
+
- /bugfix*/
|
|
447
|
+
- test-dependencies:
|
|
448
|
+
context: org-global
|
|
449
|
+
requires:
|
|
450
|
+
- setup
|
|
451
|
+
filters:
|
|
452
|
+
tags:
|
|
453
|
+
only: /.*/
|
|
454
|
+
branches:
|
|
455
|
+
ignore:
|
|
456
|
+
- main
|
|
457
|
+
- test-lint:
|
|
458
|
+
context: org-global
|
|
459
|
+
requires:
|
|
460
|
+
- setup
|
|
461
|
+
filters:
|
|
462
|
+
tags:
|
|
463
|
+
only: /.*/
|
|
464
|
+
branches:
|
|
465
|
+
ignore:
|
|
466
|
+
- /feature*/
|
|
467
|
+
- /bugfix*/
|
|
305
468
|
- test-unit:
|
|
306
469
|
context: org-global
|
|
307
470
|
requires:
|
|
@@ -309,7 +472,10 @@ workflows:
|
|
|
309
472
|
filters:
|
|
310
473
|
tags:
|
|
311
474
|
only: /.*/
|
|
312
|
-
|
|
475
|
+
branches:
|
|
476
|
+
ignore:
|
|
477
|
+
- /feature*/
|
|
478
|
+
- /bugfix*/
|
|
313
479
|
- test-coverage:
|
|
314
480
|
context: org-global
|
|
315
481
|
requires:
|
|
@@ -317,38 +483,47 @@ workflows:
|
|
|
317
483
|
filters:
|
|
318
484
|
tags:
|
|
319
485
|
only: /.*/
|
|
320
|
-
|
|
486
|
+
branches:
|
|
487
|
+
ignore:
|
|
488
|
+
- /feature*/
|
|
489
|
+
- /bugfix*/
|
|
321
490
|
- vulnerability-check:
|
|
322
491
|
context: org-global
|
|
323
492
|
requires:
|
|
324
493
|
- setup
|
|
325
|
-
- test-unit
|
|
326
|
-
- test-coverage
|
|
327
494
|
filters:
|
|
328
495
|
tags:
|
|
329
496
|
only: /.*/
|
|
330
|
-
|
|
497
|
+
branches:
|
|
498
|
+
ignore:
|
|
499
|
+
- /feature*/
|
|
500
|
+
- /bugfix*/
|
|
331
501
|
- audit-licenses:
|
|
332
502
|
context: org-global
|
|
333
503
|
requires:
|
|
334
504
|
- setup
|
|
335
|
-
- test-unit
|
|
336
|
-
- test-coverage
|
|
337
505
|
filters:
|
|
338
506
|
tags:
|
|
339
507
|
only: /.*/
|
|
340
|
-
|
|
341
|
-
|
|
508
|
+
branches:
|
|
509
|
+
ignore:
|
|
510
|
+
- /feature*/
|
|
511
|
+
- /bugfix*/
|
|
512
|
+
# New commits to main release automatically
|
|
342
513
|
- release:
|
|
343
514
|
context: org-global
|
|
344
515
|
requires:
|
|
345
|
-
-
|
|
516
|
+
- pr-tools/pr-title-check
|
|
517
|
+
- test-lint
|
|
518
|
+
- test-unit
|
|
519
|
+
- test-coverage
|
|
346
520
|
- vulnerability-check
|
|
521
|
+
- audit-licenses
|
|
347
522
|
filters:
|
|
348
523
|
branches:
|
|
349
524
|
only:
|
|
350
|
-
-
|
|
351
|
-
|
|
525
|
+
- main
|
|
526
|
+
- /release\/v.*/
|
|
352
527
|
- github-release:
|
|
353
528
|
context: org-global
|
|
354
529
|
requires:
|
|
@@ -356,16 +531,35 @@ workflows:
|
|
|
356
531
|
filters:
|
|
357
532
|
branches:
|
|
358
533
|
only:
|
|
359
|
-
-
|
|
360
|
-
|
|
534
|
+
- main
|
|
535
|
+
- /release\/v.*/
|
|
361
536
|
- publish:
|
|
362
537
|
context: org-global
|
|
363
538
|
requires:
|
|
539
|
+
- pr-tools/pr-title-check
|
|
540
|
+
- test-lint
|
|
541
|
+
- test-unit
|
|
542
|
+
- test-coverage
|
|
364
543
|
- vulnerability-check
|
|
365
544
|
- audit-licenses
|
|
366
545
|
filters:
|
|
367
546
|
tags:
|
|
368
|
-
only:
|
|
547
|
+
only: /v[0-9]+(\.[0-9]+)*/
|
|
548
|
+
branches:
|
|
549
|
+
ignore:
|
|
550
|
+
- /.*/
|
|
551
|
+
- publish-snapshot:
|
|
552
|
+
context: org-global
|
|
553
|
+
requires:
|
|
554
|
+
- pr-tools/pr-title-check
|
|
555
|
+
- test-lint
|
|
556
|
+
- test-unit
|
|
557
|
+
- test-coverage
|
|
558
|
+
- vulnerability-check
|
|
559
|
+
- audit-licenses
|
|
560
|
+
filters:
|
|
561
|
+
tags:
|
|
562
|
+
only: /v[0-9]+(\.[0-9]+)*\-snapshot+((\.[0-9]+)?)/
|
|
369
563
|
branches:
|
|
370
564
|
ignore:
|
|
371
565
|
- /.*/
|
package/.nvmrc
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
18.17.1
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
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
|
+
### [11.0.3](https://github.com/mojaloop/database-lib/compare/v11.0.2...v11.0.3) (2023-09-06)
|
|
6
|
+
|
|
7
|
+
### [11.0.2](https://github.com/mojaloop/database-lib/compare/v11.0.1...v11.0.2) (2023-09-06)
|
|
8
|
+
|
|
9
|
+
### [11.0.1](https://github.com/mojaloop/database-lib/compare/v11.0.0...v11.0.1) (2023-09-06)
|
|
10
|
+
|
|
5
11
|
## [11.0.0](https://github.com/mojaloop/database-lib/compare/v10.7.0...v11.0.0) (2021-10-20)
|
|
6
12
|
|
|
7
13
|
|
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# database-lib
|
|
2
|
-
[](https://github.com/mojaloop/database-lib/commits/
|
|
2
|
+
[](https://github.com/mojaloop/database-lib/commits/main)
|
|
3
3
|
[](https://github.com/mojaloop/database-lib/releases)
|
|
4
4
|
[](https://www.npmjs.com/package/@mojaloop/database-lib)
|
|
5
5
|
[](https://www.npmjs.com/package/@mojaloop/database-lib)
|
package/audit-ci.jsonc
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
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": [
|
|
7
|
+
"GHSA-pfrx-2q88-qq97",
|
|
8
|
+
"GHSA-4jv9-3563-23j3",
|
|
9
|
+
"GHSA-vh95-rmgr-6w4m",
|
|
10
|
+
"GHSA-xvch-5gv4-984h",
|
|
11
|
+
"GHSA-p8p7-x288-28g6",
|
|
12
|
+
"GHSA-72xf-g2v4-qvf3",
|
|
13
|
+
"GHSA-w5p7-h5w8-2hfq"
|
|
14
|
+
]
|
|
15
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mojaloop/database-lib",
|
|
3
|
-
"version": "11.0.
|
|
3
|
+
"version": "11.0.3",
|
|
4
4
|
"description": "Shared database code for central services",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -28,34 +28,35 @@
|
|
|
28
28
|
"standard:fix": "npx standard --fix",
|
|
29
29
|
"lint": "npm run standard",
|
|
30
30
|
"lint:fix": "npm run standard:fix",
|
|
31
|
-
"test": "npm run test:unit
|
|
32
|
-
"test:unit": "tape 'test/unit/**/*.test.js'",
|
|
33
|
-
"test:
|
|
34
|
-
"test:
|
|
31
|
+
"test": "npm run test:unit:spec",
|
|
32
|
+
"test:unit": "npx tape 'test/unit/**/*.test.js'",
|
|
33
|
+
"test:unit:spec": "npm run test:unit | tap-spec",
|
|
34
|
+
"test:xunit": "npm run test:unit | tap-xunit > ./test/results/xunit.xml",
|
|
35
|
+
"test:coverage": "npx nyc --reporter=lcov --reporter=text-summary tapes -- 'test/unit/**/**.test.js'",
|
|
35
36
|
"test:coverage-check": "npm run test:coverage && nyc check-coverage",
|
|
36
|
-
"audit:
|
|
37
|
-
"audit:check": "
|
|
37
|
+
"audit:fix": "npm audit fix",
|
|
38
|
+
"audit:check": "npx audit-ci --config ./audit-ci.jsonc",
|
|
38
39
|
"dep:check": "npx ncu -e 2",
|
|
39
40
|
"dep:update": "npx ncu -u",
|
|
40
41
|
"release": "standard-version --releaseCommitMessageFormat 'chore(release): {{currentTag}} [skip ci]'"
|
|
41
42
|
},
|
|
42
43
|
"dependencies": {
|
|
43
|
-
"knex": "
|
|
44
|
+
"knex": "2.5.1",
|
|
44
45
|
"lodash": "4.17.21",
|
|
45
46
|
"mysql": "2.18.1"
|
|
46
47
|
},
|
|
47
48
|
"devDependencies": {
|
|
48
|
-
"
|
|
49
|
+
"audit-ci": "^6.6.1",
|
|
50
|
+
"npm-check-updates": "16.13.2",
|
|
49
51
|
"nyc": "15.1.0",
|
|
50
|
-
"npm-audit-resolver": "2.3.0",
|
|
51
|
-
"npm-check-updates": "11.5.11",
|
|
52
52
|
"pre-commit": "1.2.2",
|
|
53
53
|
"proxyquire": "2.1.3",
|
|
54
|
-
"sinon": "
|
|
55
|
-
"standard": "
|
|
56
|
-
"standard-version": "9.
|
|
54
|
+
"sinon": "15.2.0",
|
|
55
|
+
"standard": "17.1.0",
|
|
56
|
+
"standard-version": "9.5.0",
|
|
57
|
+
"tap-spec": "^5.0.0",
|
|
57
58
|
"tap-xunit": "2.4.1",
|
|
58
|
-
"tape": "5.
|
|
59
|
+
"tape": "5.6.6",
|
|
59
60
|
"tapes": "4.1.0"
|
|
60
61
|
},
|
|
61
62
|
"publishConfig": {
|
package/audit-resolve.json
DELETED
package/sonar-project.properties
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
# Required metadata
|
|
2
|
-
sonar.projectKey=database-lib
|
|
3
|
-
sonar.projectName=database-lib
|
|
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
|