ml-testing-toolkit 18.13.1 → 18.13.2-rorfs.1

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ml-testing-toolkit",
3
3
  "description": "Testing Toolkit for Mojaloop implementations",
4
- "version": "18.13.1",
4
+ "version": "18.13.2-rorfs.1",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Vijaya Kumar Guthi, ModusBox Inc. ",
7
7
  "contributors": [
@@ -71,7 +71,7 @@
71
71
  "genexec": "pkg -t node8-win ."
72
72
  },
73
73
  "dependencies": {
74
- "@elastic/elasticsearch": "9.0.3",
74
+ "@elastic/elasticsearch": "9.1.0",
75
75
  "@hapi/basic": "7.0.2",
76
76
  "@hapi/boom": "10.0.1",
77
77
  "@hapi/good": "9.0.1",
@@ -108,7 +108,7 @@
108
108
  "json-rules-engine": "7.3.1",
109
109
  "jsonwebtoken": "9.0.2",
110
110
  "lodash": "4.17.21",
111
- "mongoose": "8.16.5",
111
+ "mongoose": "8.17.0",
112
112
  "multer": "2.0.2",
113
113
  "mustache": "4.2.0",
114
114
  "mv": "2.1.1",
@@ -31,6 +31,14 @@
31
31
 
32
32
  const dbAdapter = require('./db/adapters/dbAdapter')
33
33
  const fileAdapter = require('./fileAdapter')
34
+ const axios = require('axios').default
35
+
36
+ const cache = {} // make sure we return the same data after the first fetch
37
+ const fetch = async objectOrUrl => {
38
+ if (!/^https?:\/\//.test(objectOrUrl)) return objectOrUrl
39
+ if (!cache[objectOrUrl]) cache[objectOrUrl] = (await axios.get(objectOrUrl)).data
40
+ return cache[objectOrUrl]
41
+ }
34
42
 
35
43
  const read = async (id, user) => {
36
44
  let document
@@ -54,7 +62,7 @@ const read = async (id, user) => {
54
62
  if (id.endsWith('/')) {
55
63
  document = { data: await find(id) }
56
64
  } else {
57
- document = { data: await fileAdapter.read(id) }
65
+ document = { data: await fetch(await fileAdapter.read(id)) }
58
66
  }
59
67
  }
60
68
  return document