@mojaloop/central-services-shared 18.5.0 → 18.6.0-proxy.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.
@@ -1,567 +1,12 @@
1
- # CircleCI v2 Config
2
1
  version: 2.1
3
-
4
- ##
5
- # orbs
6
- #
7
- # Orbs used in this pipeline
8
- ##
2
+ setup: true
9
3
  orbs:
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
-
14
- ##
15
- # defaults
16
- #
17
- # YAML defaults templates, in alphabetical order
18
- ##
19
- defaults_docker_Dependencies: &defaults_docker_Dependencies |
20
- apk --no-cache add git
21
- apk --no-cache add ca-certificates
22
- apk --no-cache add curl
23
- apk --no-cache add openssh-client
24
- apk add --no-cache -t build-dependencies make gcc g++ python3 libtool autoconf automake jq bash
25
- npm install -g node-gyp
26
-
27
- defaults_awsCliDependencies: &defaults_awsCliDependencies |
28
- apk --no-cache add aws-cli
29
-
30
- defaults_license_scanner: &defaults_license_scanner
31
- name: Install and set up license-scanner
32
- command: |
33
- git clone https://github.com/mojaloop/license-scanner /tmp/license-scanner
34
- cd /tmp/license-scanner && make build default-files set-up
35
-
36
- defaults_npm_auth: &defaults_npm_auth
37
- name: Update NPM registry auth token
38
- command: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc
39
-
40
-
41
- defaults_npm_publish_release: &defaults_npm_publish_release
42
- name: Publish NPM $RELEASE_TAG artifact
43
- command: |
44
- source $BASH_ENV
45
- echo "Publishing tag $RELEASE_TAG"
46
- npm publish --tag $RELEASE_TAG --access public
47
-
48
- defaults_export_version_from_package: &defaults_export_version_from_package
49
- name: Format the changelog into the github release body and get release tag
50
- command: |
51
- git diff --no-indent-heuristic main~1 HEAD CHANGELOG.md | sed -n '/^+[^+]/ s/^+//p' > /tmp/changes
52
- echo 'export RELEASE_CHANGES=`cat /tmp/changes`' >> $BASH_ENV
53
- echo 'export RELEASE_TAG=`cat package-lock.json | jq -r .version`' >> $BASH_ENV
54
-
55
- defaults_configure_git: &defaults_configure_git
56
- name: Configure git
57
- command: |
58
- git config user.email ${GIT_CI_EMAIL}
59
- git config user.name ${GIT_CI_USER}
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
-
113
- ##
114
- # Executors
115
- #
116
- # CircleCI Executors
117
- ##
118
- executors:
119
- default-docker:
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
125
- docker:
126
- - image: node:18.17.1-alpine
127
-
128
- default-machine:
129
- working_directory: *WORKING_DIR
130
- shell: "/bin/bash -leo pipefail"
131
- machine:
132
- image: ubuntu-2204:2023.04.2 # Ref: https://circleci.com/developer/machine/image/ubuntu-2204
133
-
134
- jobs:
135
- setup:
136
- executor: default-docker
137
- steps:
138
- - run:
139
- name: Install general dependencies
140
- command: *defaults_docker_Dependencies
141
- - checkout
142
- - run:
143
- <<: *defaults_configure_nvm
144
- - run:
145
- <<: *defaults_display_versions
146
- - run:
147
- name: Install NPM dependencies
148
- command: npm ci
149
- - save_cache:
150
- key: dependency-cache-{{ .Environment.CIRCLE_SHA1 }}
151
- paths:
152
- - node_modules
153
-
154
- test-dependencies:
155
- executor: default-docker
156
- steps:
157
- - run:
158
- name: Install general dependencies
159
- command: *defaults_docker_Dependencies
160
- - checkout
161
- - run:
162
- <<: *defaults_configure_nvm
163
- - run:
164
- <<: *defaults_display_versions
165
- - restore_cache:
166
- key: dependency-cache-{{ .Environment.CIRCLE_SHA1 }}
167
- - run:
168
- name: Execute dependency tests
169
- command: npm run dep:check
170
-
171
- test-lint:
172
- executor: default-docker
173
- steps:
174
- - run:
175
- name: Install general dependencies
176
- command: *defaults_docker_Dependencies
177
- - checkout
178
- - run:
179
- <<: *defaults_configure_nvm
180
- - run:
181
- <<: *defaults_display_versions
182
- - restore_cache:
183
- key: dependency-cache-{{ .Environment.CIRCLE_SHA1 }}
184
- - run:
185
- name: Execute lint tests
186
- command: npm run lint
187
-
188
- test-unit:
189
- executor: default-docker
190
- steps:
191
- - run:
192
- name: Install general dependencies
193
- command: *defaults_docker_Dependencies
194
- - checkout
195
- - run:
196
- <<: *defaults_configure_nvm
197
- - run:
198
- <<: *defaults_display_versions
199
- - restore_cache:
200
- key: dependency-cache-{{ .Environment.CIRCLE_SHA1 }}
201
- - run:
202
- # This is needed for legacy core tests. Remove this once 'tape' is fully deprecated.
203
- name: Install tape, tapes and tap-xunit
204
- command: npm install tape tapes tap-xunit
205
- - run:
206
- name: Create dir for test results
207
- command: mkdir -p ./test/results
208
- - run:
209
- name: Execute unit tests
210
- command: npm -s run test:xunit
211
- - store_artifacts:
212
- path: ./test/results
213
- destination: test
214
- - store_test_results:
215
- path: ./test/results
216
-
217
- test-coverage:
218
- executor: default-docker
219
- steps:
220
- - run:
221
- name: Install general dependencies
222
- command: *defaults_docker_Dependencies
223
- - run:
224
- name: Install AWS CLI dependencies
225
- command: *defaults_awsCliDependencies
226
- - checkout
227
- - run:
228
- <<: *defaults_configure_nvm
229
- - run:
230
- <<: *defaults_display_versions
231
- - restore_cache:
232
- key: dependency-cache-{{ .Environment.CIRCLE_SHA1 }}
233
- - run:
234
- name: Execute code coverage check
235
- command: npm -s run test:coverage-check
236
- - store_artifacts:
237
- path: coverage
238
- destination: test
239
- - store_test_results:
240
- path: coverage
241
-
242
- vulnerability-check:
243
- executor: default-docker
244
- steps:
245
- - run:
246
- name: Install general dependencies
247
- command: *defaults_docker_Dependencies
248
- - checkout
249
- - run:
250
- <<: *defaults_configure_nvm
251
- - run:
252
- <<: *defaults_display_versions
253
- - restore_cache:
254
- key: dependency-cache-{{ .Environment.CIRCLE_SHA1 }}
255
- - run:
256
- name: Create dir for test results
257
- command: mkdir -p ./audit/results
258
- - run:
259
- name: Check for new npm vulnerabilities
260
- command: npm run audit:check -- -o json > ./audit/results/auditResults.json
261
- - store_artifacts:
262
- path: ./audit/results
263
- destination: audit
264
-
265
- audit-licenses:
266
- executor: default-docker
267
- steps:
268
- - run:
269
- name: Install general dependencies
270
- command: *defaults_docker_Dependencies
271
- - run:
272
- <<: *defaults_license_scanner
273
- - checkout
274
- - restore_cache:
275
- key: dependency-cache-{{ .Environment.CIRCLE_SHA1 }}
276
- - run:
277
- name: Run the license-scanner
278
- command: cd /tmp/license-scanner && pathToRepo=$CIRCLE_WORKING_DIRECTORY make run
279
- - store_artifacts:
280
- path: /tmp/license-scanner/results
281
- destination: licenses
282
-
283
- release:
284
- executor: default-docker
285
- steps:
286
- - run:
287
- name: Install general dependencies
288
- command: *defaults_docker_Dependencies
289
- - checkout
290
- - restore_cache:
291
- keys:
292
- - dependency-cache-{{ .Environment.CIRCLE_SHA1 }}
293
- - run:
294
- <<: *defaults_configure_git
295
- - run:
296
- name: Setup Slack config
297
- command: |
298
- echo "export SLACK_PROJECT_NAME=${CIRCLE_PROJECT_REPONAME}" >> $BASH_ENV
299
- echo "export SLACK_RELEASE_TYPE='GitHub Release'" >> $BASH_ENV
300
- echo "export SLACK_RELEASE_TAG='${RELEASE_TAG} on ${CIRCLE_BRANCH} branch'" >> $BASH_ENV
301
- echo "export SLACK_BUILD_ID=${CIRCLE_BUILD_NUM}" >> $BASH_ENV
302
- echo "export SLACK_CI_URL=${CIRCLE_BUILD_URL}" >> $BASH_ENV
303
- - run:
304
- name: Generate changelog and bump package version
305
- command: npm run release -- --no-verify
306
- - run:
307
- name: Push the release
308
- command: git push --follow-tags origin ${CIRCLE_BRANCH}
309
- - slack/notify:
310
- event: fail
311
- template: SLACK_TEMP_RELEASE_FAILURE
312
-
313
- github-release:
314
- executor: default-machine
315
- shell: "/bin/bash -eo pipefail"
316
- steps:
317
- - run:
318
- name: Install git
319
- command: |
320
- sudo apt-get update && sudo apt-get install -y git
321
- - gh/install
322
- - checkout
323
- - run:
324
- <<: *defaults_configure_git
325
- - run:
326
- name: Fetch updated release branch
327
- command: |
328
- git fetch origin
329
- git checkout origin/${CIRCLE_BRANCH}
330
- - run:
331
- <<: *defaults_export_version_from_package
332
- - run:
333
- name: Check the release changes
334
- command: |
335
- echo "Changes are: ${RELEASE_CHANGES}"
336
- - run:
337
- name: Setup Slack config
338
- command: |
339
- echo "export SLACK_PROJECT_NAME=${CIRCLE_PROJECT_REPONAME}" >> $BASH_ENV
340
- echo "export SLACK_RELEASE_TYPE='Github Release'" >> $BASH_ENV
341
- echo "export SLACK_RELEASE_TAG=v${RELEASE_TAG}" >> $BASH_ENV
342
- echo "export SLACK_RELEASE_URL=https://github.com/mojaloop/${CIRCLE_PROJECT_REPONAME}/releases/tag/v${RELEASE_TAG}" >> $BASH_ENV
343
- echo "export SLACK_BUILD_ID=${CIRCLE_BUILD_NUM}" >> $BASH_ENV
344
- echo "export SLACK_CI_URL=${CIRCLE_BUILD_URL}" >> $BASH_ENV
345
- - run:
346
- name: Create Release
347
- command: |
348
- gh release create "v${RELEASE_TAG}" --title "v${RELEASE_TAG} Release" --draft=false --notes "${RELEASE_CHANGES}" ./CHANGELOG.md
349
- - slack/notify:
350
- event: pass
351
- template: SLACK_TEMP_RELEASE_SUCCESS
352
- - slack/notify:
353
- event: fail
354
- template: SLACK_TEMP_RELEASE_FAILURE
355
-
356
- publish:
357
- executor: default-docker
358
- steps:
359
- - run:
360
- name: Install general dependencies
361
- command: *defaults_docker_Dependencies
362
- - checkout
363
- - restore_cache:
364
- key: dependency-cache-{{ .Environment.CIRCLE_SHA1 }}
365
- - run:
366
- name: Setup for LATEST release
367
- command: |
368
- echo "export RELEASE_TAG=$RELEASE_TAG_PROD" >> $BASH_ENV
369
- echo "RELEASE_TAG=$RELEASE_TAG_PROD"
370
-
371
- PACKAGE_VERSION=$(cat package-lock.json | jq -r .version)
372
- echo "export PACKAGE_VERSION=${PACKAGE_VERSION}" >> $BASH_ENV
373
- echo "PACKAGE_VERSION=${PACKAGE_VERSION}"
374
- - run:
375
- name: Setup Slack config
376
- command: |
377
- echo "export SLACK_PROJECT_NAME=${CIRCLE_PROJECT_REPONAME}" >> $BASH_ENV
378
- echo "export SLACK_RELEASE_TYPE='NPM Release'" >> $BASH_ENV
379
- echo "export SLACK_RELEASE_TAG=v${CIRCLE_TAG:1}" >> $BASH_ENV
380
- echo "export SLACK_RELEASE_URL=https://www.npmjs.com/package/@mojaloop/${CIRCLE_PROJECT_REPONAME}/v/${CIRCLE_TAG:1}" >> $BASH_ENV
381
- echo "export SLACK_BUILD_ID=${CIRCLE_BUILD_NUM}" >> $BASH_ENV
382
- echo "export SLACK_CI_URL=${CIRCLE_BUILD_URL}" >> $BASH_ENV
383
- - run:
384
- <<: *defaults_npm_auth
385
- - run:
386
- <<: *defaults_npm_publish_release
387
- - slack/notify:
388
- event: pass
389
- template: SLACK_TEMP_RELEASE_SUCCESS
390
- - slack/notify:
391
- event: fail
392
- template: SLACK_TEMP_RELEASE_FAILURE
393
-
394
- publish-snapshot:
395
- executor: default-docker
396
- steps:
397
- - run:
398
- name: Install general dependencies
399
- command: *defaults_docker_Dependencies
400
- - checkout
401
- - restore_cache:
402
- key: dependency-cache-{{ .Environment.CIRCLE_SHA1 }}
403
- - run:
404
- name: Setup for SNAPSHOT release
405
- command: |
406
- echo "export RELEASE_TAG=${RELEASE_TAG_SNAPSHOT}" >> $BASH_ENV
407
- echo "RELEASE_TAG=${RELEASE_TAG_SNAPSHOT}"
408
-
409
- echo "Override package version: ${CIRCLE_TAG:1}"
410
- npx standard-version --skip.tag --skip.commit --skip.changelog --release-as ${CIRCLE_TAG:1}
411
-
412
- PACKAGE_VERSION=$(cat package-lock.json | jq -r .version)
413
- echo "export PACKAGE_VERSION=${PACKAGE_VERSION}" >> $BASH_ENV
414
- echo "PACKAGE_VERSION=${PACKAGE_VERSION}"
415
- - run:
416
- name: Setup Slack config
417
- command: |
418
- echo "export SLACK_PROJECT_NAME=${CIRCLE_PROJECT_REPONAME}" >> $BASH_ENV
419
- echo "export SLACK_RELEASE_TYPE='NPM Snapshot'" >> $BASH_ENV
420
- echo "export SLACK_RELEASE_TAG=v${CIRCLE_TAG:1}" >> $BASH_ENV
421
- echo "export SLACK_RELEASE_URL=https://www.npmjs.com/package/@mojaloop/${CIRCLE_PROJECT_REPONAME}/v/${CIRCLE_TAG:1}" >> $BASH_ENV
422
- echo "export SLACK_BUILD_ID=${CIRCLE_BUILD_NUM}" >> $BASH_ENV
423
- echo "export SLACK_CI_URL=${CIRCLE_BUILD_URL}" >> $BASH_ENV
424
- - run:
425
- <<: *defaults_npm_auth
426
- - run:
427
- <<: *defaults_npm_publish_release
428
- - slack/notify:
429
- event: pass
430
- template: SLACK_TEMP_RELEASE_SUCCESS
431
- - slack/notify:
432
- event: fail
433
- template: SLACK_TEMP_RELEASE_FAILURE
434
-
4
+ build: mojaloop/build@1.0.17
435
5
  workflows:
436
- build_and_test:
6
+ setup:
437
7
  jobs:
438
- - pr-tools/pr-title-check:
439
- context: org-global
440
- - setup:
441
- context: org-global
442
- filters:
443
- tags:
444
- only: /.*/
445
- branches:
446
- ignore:
447
- - /feature*/
448
- - /bugfix*/
449
- - test-dependencies:
450
- context: org-global
451
- requires:
452
- - setup
453
- filters:
454
- tags:
455
- ignore: /.*/
456
- branches:
457
- ignore:
458
- - main
459
- - test-lint:
460
- context: org-global
461
- requires:
462
- - setup
463
- filters:
464
- tags:
465
- only: /.*/
466
- branches:
467
- ignore:
468
- - /feature*/
469
- - /bugfix*/
470
- - test-unit:
471
- context: org-global
472
- requires:
473
- - setup
474
- filters:
475
- tags:
476
- only: /.*/
477
- branches:
478
- ignore:
479
- - /feature*/
480
- - /bugfix*/
481
- - test-coverage:
482
- context: org-global
483
- requires:
484
- - setup
485
- filters:
486
- tags:
487
- only: /.*/
488
- branches:
489
- ignore:
490
- - /feature*/
491
- - /bugfix*/
492
- - vulnerability-check:
493
- context: org-global
494
- requires:
495
- - setup
496
- filters:
497
- tags:
498
- only: /.*/
499
- branches:
500
- ignore:
501
- - /feature*/
502
- - /bugfix*/
503
- - audit-licenses:
504
- context: org-global
505
- requires:
506
- - setup
8
+ - build/workflow:
507
9
  filters:
508
10
  tags:
509
- only: /.*/
510
- branches:
511
- ignore:
512
- - /feature*/
513
- - /bugfix*/
514
- # New commits to main release automatically
515
- - release:
516
- context: org-global
517
- requires:
518
- - pr-tools/pr-title-check
519
- - test-lint
520
- - test-unit
521
- - test-coverage
522
- - vulnerability-check
523
- - audit-licenses
524
- filters:
525
- branches:
526
- only:
527
- - main
528
- - /release\/v.*/
529
- - github-release:
530
- context: org-global
531
- requires:
532
- - release
533
- filters:
534
- branches:
535
- only:
536
- - main
537
- - /release\/v.*/
538
- - publish:
539
- context: org-global
540
- requires:
541
- - pr-tools/pr-title-check
542
- - test-lint
543
- - test-unit
544
- - test-coverage
545
- - vulnerability-check
546
- - audit-licenses
547
- filters:
548
- tags:
549
- only: /v[0-9]+(\.[0-9]+)*/
550
- branches:
551
- ignore:
552
- - /.*/
553
- - publish-snapshot:
554
- context: org-global
555
- requires:
556
- - pr-tools/pr-title-check
557
- - test-lint
558
- - test-unit
559
- - test-coverage
560
- - vulnerability-check
561
- - audit-licenses
562
- filters:
563
- tags:
564
- only: /v[0-9]+(\.[0-9]+)*\-snapshot+((\.[0-9]+)?)/
565
- branches:
566
- ignore:
567
- - /.*/
11
+ only: /v\d+(\.\d+){2}(-(snapshot|hotfix|perf)\.\d+)?/
12
+
package/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [18.5.1](https://github.com/mojaloop/central-services-shared/compare/v18.5.0...v18.5.1) (2024-06-28)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * **mojaloop/#3984:** add type definition for HeaderValidation ([#386](https://github.com/mojaloop/central-services-shared/issues/386)) ([3f79b90](https://github.com/mojaloop/central-services-shared/commit/3f79b90e87e2aeca669783bfc4f4d068055aaf58)), closes [mojaloop/#3984](https://github.com/mojaloop/project/issues/3984)
11
+
5
12
  ## [18.5.0](https://github.com/mojaloop/central-services-shared/compare/v18.4.0...v18.5.0) (2024-06-25)
6
13
 
7
14
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mojaloop/central-services-shared",
3
- "version": "18.5.0",
3
+ "version": "18.6.0-proxy.0",
4
4
  "description": "Shared code for mojaloop central services",
5
5
  "license": "Apache-2.0",
6
6
  "author": "ModusBox",
@@ -44,6 +44,8 @@
44
44
  "test:xunit": "npx tape 'test/unit/**/**.test.js' | tap-xunit > ./test/results/xunit.xml",
45
45
  "test:coverage": "npx nyc --reporter=lcov --reporter=text-summary tapes -- 'test/unit/**/**.test.js'",
46
46
  "test:coverage-check": "npm run test:coverage && nyc check-coverage",
47
+ "test:functional": "true",
48
+ "test:integration": "true",
47
49
  "audit:fix": "npm audit fix",
48
50
  "audit:check": "npx audit-ci --config ./audit-ci.jsonc",
49
51
  "dep:check": "npx ncu -e 2",
@@ -54,6 +56,7 @@
54
56
  "dependencies": {
55
57
  "@hapi/catbox": "12.1.1",
56
58
  "@hapi/catbox-memory": "5.0.1",
59
+ "@mojaloop/inter-scheme-proxy-cache-lib": "1.1.0",
57
60
  "axios": "1.7.2",
58
61
  "clone": "2.1.2",
59
62
  "dotenv": "16.4.5",
package/src/index.d.ts CHANGED
@@ -625,6 +625,17 @@ declare namespace CentralServicesShared {
625
625
  decodePayload(input: string, options: Object): Object
626
626
  }
627
627
 
628
+ interface HeaderValidation {
629
+ protocolVersions: { anyVersion: symbol, ONE: Array<string>, TWO: Array<string> },
630
+ protocolVersionsMap: Array<{ key: string, value: string }>,
631
+ getHubNameRegex(hubName: string): RegExp,
632
+ generateAcceptRegex(resource: string): RegExp,
633
+ generateContentTypeRegex(resource: string): RegExp,
634
+ parseAcceptHeader(resource: string, header: string): { valid: boolean, versions?: Set<string | symbol> },
635
+ parseContentTypeHeader(resource: string, header: string): { valid: boolean, version?: string },
636
+ convertSupportedVersionToExtensionList(supportedVersions: Array<number>): Array<{ key: string, value: string }>
637
+ }
638
+
628
639
  interface Util {
629
640
  Endpoints: Endpoints;
630
641
  Participants: Participants;
@@ -633,6 +644,7 @@ declare namespace CentralServicesShared {
633
644
  OpenapiBackend: any;
634
645
  Request: Request;
635
646
  StreamingProtocol: StreamingProtocol;
647
+ HeaderValidation: HeaderValidation;
636
648
  }
637
649
 
638
650
  const Enum: Enum
@@ -43,6 +43,7 @@ let policy
43
43
  let switchEndpoint
44
44
  let hubName
45
45
  let hubNameRegex
46
+ let proxy
46
47
 
47
48
  /**
48
49
  * @function fetchEndpoints
@@ -137,7 +138,7 @@ exports.initializeCache = async (policyOptions, config) => {
137
138
  *
138
139
  * @returns {string} - Returns the endpoint, throws error if failure occurs
139
140
  */
140
- exports.getEndpoint = async (switchUrl, fsp, endpointType, options = {}, renderOptions = {}) => {
141
+ exports.getEndpoint = async (switchUrl, fsp, endpointType, options = {}, renderOptions = {}, proxyConfig) => {
141
142
  const histTimer = Metrics.getHistogram(
142
143
  'getEndpoint',
143
144
  'getEndpoint - Metrics for getEndpoint with cache hit rate',
@@ -149,7 +150,17 @@ exports.getEndpoint = async (switchUrl, fsp, endpointType, options = {}, renderO
149
150
  // If a service passes in `getDecoratedValue` as true, then an object
150
151
  // { value, cached, report } is returned, where value is the cached value,
151
152
  // cached is null on a cache miss.
152
- const endpoints = await policy.get(fsp)
153
+ let endpoints = await policy.get(fsp)
154
+ if (!endpoints && proxyConfig) {
155
+ if (!proxy) {
156
+ const { type, ...config } = proxyConfig
157
+ proxy = require('@mojaloop/inter-scheme-proxy-cache-lib').createProxyCache(type, config)
158
+ await proxy.connect()
159
+ }
160
+ const proxyId = await proxy.lookupProxyByDfspId(fsp)
161
+ if (!proxyId) throw ErrorHandler.CreateFSPIOPError(ErrorHandler.Enums.FSPIOPErrorCodes.PARTY_NOT_FOUND)
162
+ endpoints = await policy.get(proxyId)
163
+ }
153
164
  if ('value' in endpoints && 'cached' in endpoints) {
154
165
  if (endpoints.cached === null) {
155
166
  histTimer({ success: true, hit: false })