@chainlink/external-adapter-framework 2.13.2 → 2.13.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.
@@ -60,10 +60,14 @@ export const httpTransport = new HttpTransport<HttpTransportTypes>({
60
60
  <% } -%>
61
61
  parseResponse: (params, response) => {
62
62
  <% if (includeComments) { -%>
63
- // In case error was received, it's a good practice to return meaningful information to user
63
+ // For each 'param' a new response object is created and returned as an array
64
64
  <% } -%>
65
- if (!response.data) {
66
- return params.map((param) => {
65
+ return params.map((param) => {
66
+ <% if (includeComments) { -%>
67
+ // In case error was received, it's a good practice to return meaningful information to user
68
+ <% } -%>
69
+ const baseSymbol = param.base.toUpperCase()
70
+ if (!response.data || !response.data[baseSymbol]) {
67
71
  return {
68
72
  params: param,
69
73
  response: {
@@ -71,14 +75,9 @@ export const httpTransport = new HttpTransport<HttpTransportTypes>({
71
75
  statusCode: 502,
72
76
  },
73
77
  }
74
- })
75
- }
78
+ }
76
79
 
77
- <% if (includeComments) { -%>
78
- // For successful responses for each 'param' a new response object is created and returned as an array
79
- <% } -%>
80
- return params.map((param) => {
81
- const result = response.data[param.base.toUpperCase()].price
80
+ const result = response.data[baseSymbol].price
82
81
  <% if (includeComments) { -%>
83
82
  // Response objects, whether successful or errors, contain two properties, 'params' and 'response'. 'response' is what will be
84
83
  // stored in the cache and returned as adapter response and 'params' determines the identifier so that the next request with same 'params'
@@ -2,7 +2,8 @@
2
2
  "extends": "<%- standalone ? "./tsconfig.base.json" : "../../tsconfig.base.json" %>",
3
3
  "compilerOptions": {
4
4
  "outDir": "dist",
5
- "rootDir": "src"
5
+ "rootDir": "src",
6
+ "noUncheckedIndexedAccess": true
6
7
  },
7
8
  "include": ["src/**/*", "src/**/*.json"],
8
9
  "exclude": ["dist", "**/*.spec.ts", "**/*.test.ts"]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chainlink/external-adapter-framework",
3
- "version": "2.13.2",
3
+ "version": "2.13.3",
4
4
  "main": "dist/index.js",
5
5
  "license": "MIT",
6
6
  "repository": "git://github.com/smartcontractkit/ea-framework-js.git",