@chainlink/external-adapter-framework 0.30.2 → 0.31.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.
- package/adapter/por.d.ts +112 -0
- package/adapter/por.js +76 -0
- package/adapter/por.js.map +1 -0
- package/adapter/price.js +2 -1
- package/adapter/price.js.map +1 -1
- package/adapter-generator.js +9 -0
- package/config/index.d.ts +21 -1
- package/config/index.js +19 -0
- package/config/index.js.map +1 -1
- package/debug/router.d.ts +10 -0
- package/debug/router.js +49 -0
- package/debug/router.js.map +1 -0
- package/debug/settings-page.d.ts +9 -0
- package/debug/settings-page.js +116 -0
- package/debug/settings-page.js.map +1 -0
- package/generator-adapter/generators/app/index.js +337 -0
- package/generator-adapter/generators/app/templates/CHANGELOG.md +0 -0
- package/generator-adapter/generators/app/templates/README.md +3 -0
- package/generator-adapter/generators/app/templates/babel.config.js +3 -0
- package/generator-adapter/generators/app/templates/jest.config.js +3 -0
- package/generator-adapter/generators/app/templates/package.json +30 -0
- package/generator-adapter/generators/app/templates/src/config/index.ts +25 -0
- package/generator-adapter/generators/app/templates/src/config/overrides.json +3 -0
- package/generator-adapter/generators/app/templates/src/endpoint/base.ts.ejs +21 -0
- package/generator-adapter/generators/app/templates/src/endpoint/endpoint-router.ts.ejs +33 -0
- package/generator-adapter/generators/app/templates/src/endpoint/endpoint.ts.ejs +26 -0
- package/generator-adapter/generators/app/templates/src/endpoint/index.ts.ejs +1 -0
- package/generator-adapter/generators/app/templates/src/index.ts.ejs +21 -0
- package/generator-adapter/generators/app/templates/src/transport/custom.ts.ejs +87 -0
- package/generator-adapter/generators/app/templates/src/transport/http.ts.ejs +98 -0
- package/generator-adapter/generators/app/templates/src/transport/ws.ts.ejs +94 -0
- package/generator-adapter/generators/app/templates/test/adapter-ws.test.ts.ejs +58 -0
- package/generator-adapter/generators/app/templates/test/adapter.test.ts.ejs +50 -0
- package/generator-adapter/generators/app/templates/test/fixtures.ts.ejs +44 -0
- package/generator-adapter/generators/app/templates/test-payload.json +6 -0
- package/generator-adapter/generators/app/templates/tsconfig.base.json +40 -0
- package/generator-adapter/generators/app/templates/tsconfig.json +9 -0
- package/generator-adapter/generators/app/templates/tsconfig.test.json +7 -0
- package/generator-adapter/package.json +12 -0
- package/index.js +6 -0
- package/index.js.map +1 -1
- package/package.json +11 -5
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { HttpTransport } from '@chainlink/external-adapter-framework/transports'
|
|
2
|
+
import { BaseEndpointTypes } from '../endpoint/<%= inputEndpointName %>'
|
|
3
|
+
|
|
4
|
+
export interface ResponseSchema {
|
|
5
|
+
[key: string]: {
|
|
6
|
+
price: number
|
|
7
|
+
errorMessage?: string
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
<% if (includeComments) { -%>
|
|
12
|
+
// HttpTransport extends base types from endpoint and adds additional, Provider-specific types like 'RequestBody', which is the type of
|
|
13
|
+
// request body (not the request to adapter, but the request that adapter sends to Data Provider), and 'ResponseBody' which is
|
|
14
|
+
// the type of raw response from Data Provider
|
|
15
|
+
<% } -%>
|
|
16
|
+
export type HttpTransportTypes = BaseEndpointTypes & {
|
|
17
|
+
Provider: {
|
|
18
|
+
RequestBody: never
|
|
19
|
+
ResponseBody: ResponseSchema
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
<% if (includeComments) { -%>
|
|
23
|
+
// HttpTransport is used to fetch and process data from a Provider using HTTP(S) protocol. It usually needs two methods
|
|
24
|
+
// `prepareRequests` and `parseResponse`
|
|
25
|
+
<% } -%>
|
|
26
|
+
export const httpTransport = new HttpTransport<HttpTransportTypes>({
|
|
27
|
+
<% if (includeComments) { -%>
|
|
28
|
+
// `prepareRequests` method receives request payloads sent to associated endpoint alongside adapter config(environment variables)
|
|
29
|
+
// and should return 'request information' to the Data Provider. Use this method to construct one or many requests, and the framework
|
|
30
|
+
// will send them to Data Provider
|
|
31
|
+
<% } -%>
|
|
32
|
+
prepareRequests: (params, config) => {
|
|
33
|
+
return params.map((param) => {
|
|
34
|
+
return {
|
|
35
|
+
<% if (includeComments) { -%>
|
|
36
|
+
// `params` are parameters associated to this single request and will also be available in the 'parseResponse' method.
|
|
37
|
+
<% } -%>
|
|
38
|
+
params: [param],
|
|
39
|
+
<% if (includeComments) { -%>
|
|
40
|
+
// `request` contains any valid axios request configuration
|
|
41
|
+
<% } -%>
|
|
42
|
+
request: {
|
|
43
|
+
baseURL: config.API_ENDPOINT,
|
|
44
|
+
url: '/cryptocurrency/price',
|
|
45
|
+
headers: {
|
|
46
|
+
'X_API_KEY': config.API_KEY,
|
|
47
|
+
},
|
|
48
|
+
params: {
|
|
49
|
+
symbol: param.base.toUpperCase(),
|
|
50
|
+
convert: param.quote.toUpperCase(),
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
}
|
|
54
|
+
})
|
|
55
|
+
},
|
|
56
|
+
<% if (includeComments) { -%>
|
|
57
|
+
// `parseResponse` takes the 'params' specified in the `prepareRequests` and the 'response' from Data Provider and should return
|
|
58
|
+
// an array of response objects to be stored in cache. Use this method to construct a list of response objects for every parameter in 'params'
|
|
59
|
+
// and the framework will save them in cache and return to user
|
|
60
|
+
<% } -%>
|
|
61
|
+
parseResponse: (params, response) => {
|
|
62
|
+
<% if (includeComments) { -%>
|
|
63
|
+
// In case error was received, it's a good practice to return meaningful information to user
|
|
64
|
+
<% } -%>
|
|
65
|
+
if (!response.data) {
|
|
66
|
+
return params.map((param) => {
|
|
67
|
+
return {
|
|
68
|
+
params: param,
|
|
69
|
+
response: {
|
|
70
|
+
errorMessage: `The data provider didn't return any value for ${param.base}/${param.quote}`,
|
|
71
|
+
statusCode: 502,
|
|
72
|
+
},
|
|
73
|
+
}
|
|
74
|
+
})
|
|
75
|
+
}
|
|
76
|
+
|
|
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
|
|
82
|
+
<% if (includeComments) { -%>
|
|
83
|
+
// Response objects, whether successful or errors, contain two properties, 'params' and 'response'. 'response' is what will be
|
|
84
|
+
// stored in the cache and returned as adapter response and 'params' determines the identifier so that the next request with same 'params'
|
|
85
|
+
// will immediately return the response from the cache
|
|
86
|
+
<% } -%>
|
|
87
|
+
return {
|
|
88
|
+
params: param,
|
|
89
|
+
response: {
|
|
90
|
+
result,
|
|
91
|
+
data: {
|
|
92
|
+
result
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
}
|
|
96
|
+
})
|
|
97
|
+
},
|
|
98
|
+
})
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { WebSocketTransport } from '@chainlink/external-adapter-framework/transports'
|
|
2
|
+
import { BaseEndpointTypes } from '../endpoint/<%= inputEndpointName %>'
|
|
3
|
+
|
|
4
|
+
export interface WSResponse {
|
|
5
|
+
success: boolean
|
|
6
|
+
price: number
|
|
7
|
+
base: string
|
|
8
|
+
quote: string
|
|
9
|
+
time: number
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
<% if (includeComments) { -%>
|
|
13
|
+
// WsTransport extends base types from endpoint and adds additional, Provider-specific types like 'WsMessage', which is the type of
|
|
14
|
+
// websocket received message
|
|
15
|
+
<% } -%>
|
|
16
|
+
export type WsTransportTypes = BaseEndpointTypes & {
|
|
17
|
+
Provider: {
|
|
18
|
+
WsMessage: WSResponse
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
<% if (includeComments) { -%>
|
|
22
|
+
// WebSocketTransport is used to fetch and process data from a Provider using Websocket protocol.
|
|
23
|
+
<% } -%>
|
|
24
|
+
export const wsTransport = new WebSocketTransport<WsTransportTypes>({
|
|
25
|
+
<% if (includeComments) { -%>
|
|
26
|
+
// use `url` method to provide connection url. It accepts adapter context, so you have access to adapter config(environment variables) and
|
|
27
|
+
// request payload if needed
|
|
28
|
+
<% } -%>
|
|
29
|
+
url: (context) => context.adapterSettings.WS_API_ENDPOINT,
|
|
30
|
+
<% if (includeComments) { -%>
|
|
31
|
+
// 'handler' contains two helpful methods. one of them is `message`. This method is called when there is a new websocket message.
|
|
32
|
+
// The other one is 'open' method. It is called when the websocket connection is successfully opened. Use this method to execute some logic
|
|
33
|
+
// when the connection is established (custom authentication, logging, ...)
|
|
34
|
+
<% } -%>
|
|
35
|
+
handlers: {
|
|
36
|
+
<% if (includeComments) { -%>
|
|
37
|
+
// 'message' handler receives a raw websocket message as first argument and adapter context as second and should return an array of
|
|
38
|
+
// response objects. Use this method to construct a list of response objects, and the framework will save them in cache and return to user
|
|
39
|
+
<% } -%>
|
|
40
|
+
message(message) {
|
|
41
|
+
<% if (includeComments) { -%>
|
|
42
|
+
// in cases when error or unknown message is received, use 'return' to skip the iteration.
|
|
43
|
+
<% } -%>
|
|
44
|
+
if (message.success === false) {
|
|
45
|
+
return
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
<% if (includeComments) { -%>
|
|
49
|
+
// Response objects, whether successful or errors (if not skipped), contain two properties, 'params' and 'response'. 'response' is what
|
|
50
|
+
// will be stored in the cache and returned as adapter response and 'params' determines the identifier so that the next request with
|
|
51
|
+
// same 'params' will immediately return the response from the cache
|
|
52
|
+
<% } -%>
|
|
53
|
+
return [
|
|
54
|
+
{
|
|
55
|
+
params: { base: message.base, quote: message.quote },
|
|
56
|
+
response: {
|
|
57
|
+
result: message.price,
|
|
58
|
+
data: {
|
|
59
|
+
result: message.price
|
|
60
|
+
},
|
|
61
|
+
timestamps: {
|
|
62
|
+
providerIndicatedTimeUnixMs: message.time,
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
]
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
<% if (includeComments) { -%>
|
|
70
|
+
// `builders` are builder methods, that will be used to prepare specific WS messages to be sent to Data Provider
|
|
71
|
+
<% } -%>
|
|
72
|
+
builders: {
|
|
73
|
+
<% if (includeComments) { -%>
|
|
74
|
+
// `subscribeMessage` accepts request parameters and should construct and return a payload that will be sent to Data Provider
|
|
75
|
+
// Use this method to subscribe to live feeds
|
|
76
|
+
<% } -%>
|
|
77
|
+
subscribeMessage: (params) => {
|
|
78
|
+
return {
|
|
79
|
+
type: 'subscribe',
|
|
80
|
+
symbols: `${params.base}/${params.quote}`.toUpperCase()
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
<% if (includeComments) { -%>
|
|
84
|
+
// `unsubscribeMessage` accepts request parameters and should construct and return a payload that will be sent to Data Provider
|
|
85
|
+
// Use this method to unsubscribe from live feeds
|
|
86
|
+
<% } -%>
|
|
87
|
+
unsubscribeMessage: (params) => {
|
|
88
|
+
return {
|
|
89
|
+
type: 'unsubscribe',
|
|
90
|
+
symbols: `${params.base}/${params.quote}`.toUpperCase()
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
})
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { WebSocketClassProvider } from '@chainlink/external-adapter-framework/transports'
|
|
2
|
+
import {
|
|
3
|
+
TestAdapter,
|
|
4
|
+
setEnvVariables,
|
|
5
|
+
mockWebSocketProvider,
|
|
6
|
+
MockWebsocketServer,
|
|
7
|
+
} from '@chainlink/external-adapter-framework/util/testing-utils'
|
|
8
|
+
import FakeTimers from '@sinonjs/fake-timers'
|
|
9
|
+
import { mockWebsocketServer } from './fixtures'
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
describe('websocket', () => {
|
|
13
|
+
let mockWsServer: MockWebsocketServer | undefined
|
|
14
|
+
let testAdapter: TestAdapter
|
|
15
|
+
const wsEndpoint = 'ws://localhost:9090'
|
|
16
|
+
let oldEnv: NodeJS.ProcessEnv
|
|
17
|
+
<% for(let i=0; i<endpoints.length; i++) {%>
|
|
18
|
+
const data<%- endpoints[i].normalizedEndpointNameCap %> = {
|
|
19
|
+
base: 'ETH',
|
|
20
|
+
quote: 'USD',
|
|
21
|
+
endpoint: '<%- endpoints[i].inputEndpointName %>',
|
|
22
|
+
transport: 'ws'
|
|
23
|
+
}
|
|
24
|
+
<% } %>
|
|
25
|
+
beforeAll(async () => {
|
|
26
|
+
oldEnv = JSON.parse(JSON.stringify(process.env))
|
|
27
|
+
process.env['WS_API_ENDPOINT'] = wsEndpoint
|
|
28
|
+
process.env['API_KEY'] = 'fake-api-key'
|
|
29
|
+
mockWebSocketProvider(WebSocketClassProvider)
|
|
30
|
+
mockWsServer = mockWebsocketServer(wsEndpoint)
|
|
31
|
+
|
|
32
|
+
const adapter = (await import('./../../src')).adapter
|
|
33
|
+
testAdapter = await TestAdapter.startWithMockedCache(adapter, {
|
|
34
|
+
clock: FakeTimers.install(),
|
|
35
|
+
testAdapter: {} as TestAdapter<never>,
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
// Send initial request to start background execute and wait for cache to be filled with results
|
|
39
|
+
<% for(var i=0; i<endpoints.length; i++) {%>
|
|
40
|
+
await testAdapter.request(data<%- endpoints[i].normalizedEndpointNameCap %>) <% } %>
|
|
41
|
+
await testAdapter.waitForCache(<%- endpoints.length %>)
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
afterAll(async () => {
|
|
45
|
+
setEnvVariables(oldEnv)
|
|
46
|
+
mockWsServer?.close()
|
|
47
|
+
testAdapter.clock?.uninstall()
|
|
48
|
+
await testAdapter.api.close()
|
|
49
|
+
})
|
|
50
|
+
<% for(var i=0; i<endpoints.length; i++) {%>
|
|
51
|
+
describe('<%= endpoints[i].inputEndpointName %> endpoint', () => {
|
|
52
|
+
it('should return success', async () => {
|
|
53
|
+
const response = await testAdapter.request(data<%- endpoints[i].normalizedEndpointNameCap %>)
|
|
54
|
+
expect(response.json()).toMatchSnapshot()
|
|
55
|
+
})
|
|
56
|
+
})
|
|
57
|
+
<% } %>
|
|
58
|
+
})
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import {
|
|
2
|
+
TestAdapter,
|
|
3
|
+
setEnvVariables,
|
|
4
|
+
} from '@chainlink/external-adapter-framework/util/testing-utils'
|
|
5
|
+
import * as nock from 'nock'
|
|
6
|
+
import { mockResponseSuccess } from './fixtures'
|
|
7
|
+
|
|
8
|
+
describe('execute', () => {
|
|
9
|
+
let spy: jest.SpyInstance
|
|
10
|
+
let testAdapter: TestAdapter
|
|
11
|
+
let oldEnv: NodeJS.ProcessEnv
|
|
12
|
+
|
|
13
|
+
beforeAll(async () => {
|
|
14
|
+
oldEnv = JSON.parse(JSON.stringify(process.env))
|
|
15
|
+
process.env.API_KEY = process.env.API_KEY ?? 'fake-api-key'
|
|
16
|
+
const mockDate = new Date('2001-01-01T11:11:11.111Z')
|
|
17
|
+
spy = jest.spyOn(Date, 'now').mockReturnValue(mockDate.getTime())
|
|
18
|
+
|
|
19
|
+
const adapter = (await import('./../../src')).adapter
|
|
20
|
+
adapter.rateLimiting = undefined
|
|
21
|
+
testAdapter = await TestAdapter.startWithMockedCache(adapter, {
|
|
22
|
+
testAdapter: {} as TestAdapter<never>,
|
|
23
|
+
})
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
afterAll(async () => {
|
|
27
|
+
setEnvVariables(oldEnv)
|
|
28
|
+
await testAdapter.api.close()
|
|
29
|
+
nock.restore()
|
|
30
|
+
nock.cleanAll()
|
|
31
|
+
spy.mockRestore()
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
<% for(var i=0; i<endpoints.length; i++) {%>
|
|
35
|
+
describe('<%= endpoints[i].inputEndpointName %> endpoint', () => {
|
|
36
|
+
it('should return success', async () => {
|
|
37
|
+
const data = {
|
|
38
|
+
base: 'ETH',
|
|
39
|
+
quote: 'USD',
|
|
40
|
+
endpoint: '<%= endpoints[i].inputEndpointName %>',
|
|
41
|
+
transport: '<%= transportName %>'
|
|
42
|
+
}
|
|
43
|
+
mockResponseSuccess()
|
|
44
|
+
const response = await testAdapter.request(data)
|
|
45
|
+
expect(response.statusCode).toBe(200)
|
|
46
|
+
expect(response.json()).toMatchSnapshot()
|
|
47
|
+
})
|
|
48
|
+
})
|
|
49
|
+
<% } %>
|
|
50
|
+
})
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<% if (includeHttpFixtures) { %>import nock from 'nock'<% } %>
|
|
2
|
+
<% if (includeWsFixtures) { %>import { MockWebsocketServer } from '@chainlink/external-adapter-framework/util/testing-utils'<% } %>
|
|
3
|
+
<% if (includeHttpFixtures) { %>
|
|
4
|
+
export const mockResponseSuccess = (): nock.Scope =>
|
|
5
|
+
nock('https://dataproviderapi.com', {
|
|
6
|
+
encodedQueryParams: true,
|
|
7
|
+
})
|
|
8
|
+
.get('/cryptocurrency/price')
|
|
9
|
+
.query({
|
|
10
|
+
symbol: 'ETH',
|
|
11
|
+
convert: 'USD',
|
|
12
|
+
})
|
|
13
|
+
.reply(200, () => ({ ETH: { price: 10000 } }), [
|
|
14
|
+
'Content-Type',
|
|
15
|
+
'application/json',
|
|
16
|
+
'Connection',
|
|
17
|
+
'close',
|
|
18
|
+
'Vary',
|
|
19
|
+
'Accept-Encoding',
|
|
20
|
+
'Vary',
|
|
21
|
+
'Origin',
|
|
22
|
+
])
|
|
23
|
+
.persist()
|
|
24
|
+
<% } %>
|
|
25
|
+
<% if (includeWsFixtures) { %>
|
|
26
|
+
export const mockWebsocketServer = (URL: string): MockWebsocketServer => {
|
|
27
|
+
const mockWsServer = new MockWebsocketServer(URL, { mock: false })
|
|
28
|
+
mockWsServer.on('connection', (socket) => {
|
|
29
|
+
socket.on('message', (message) => {
|
|
30
|
+
return socket.send(
|
|
31
|
+
JSON.stringify({
|
|
32
|
+
success: true,
|
|
33
|
+
price: 1000,
|
|
34
|
+
base: 'ETH',
|
|
35
|
+
quote: 'USD',
|
|
36
|
+
time: '1999999'
|
|
37
|
+
}),
|
|
38
|
+
)
|
|
39
|
+
})
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
return mockWsServer
|
|
43
|
+
}
|
|
44
|
+
<% } %>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
/* Basic Options */
|
|
4
|
+
"incremental": true /* Enable incremental compilation */,
|
|
5
|
+
"target": "ES2020" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */,
|
|
6
|
+
"module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */,
|
|
7
|
+
"composite": true /* Enable project compilation */,
|
|
8
|
+
"declaration": true /* Generates corresponding '.d.ts' file. */,
|
|
9
|
+
"declarationMap": true /* Generates a sourcemap for each corresponding '.d.ts' file. */,
|
|
10
|
+
"noEmit": false /* Do not emit outputs. */,
|
|
11
|
+
"noErrorTruncation": true /* Do not truncate error messages */,
|
|
12
|
+
"skipLibCheck": true /* Skip type checking of declaration files. Requires TypeScript version 2.0 or later. */,
|
|
13
|
+
"importHelpers": true /* Import emit helpers from 'tslib'. */,
|
|
14
|
+
|
|
15
|
+
/* Strict Type-Checking Options */
|
|
16
|
+
"strict": true /* Enable all strict type-checking options. */,
|
|
17
|
+
|
|
18
|
+
/* Additional Checks */
|
|
19
|
+
"noUnusedLocals": true /* Report errors on unused locals. */,
|
|
20
|
+
"noUnusedParameters": true /* Report errors on unused parameters. */,
|
|
21
|
+
"noImplicitReturns": true /* Report error when not all code paths in function return a value. */,
|
|
22
|
+
"noFallthroughCasesInSwitch": true /* Report errors for fallthrough cases in switch statement. */,
|
|
23
|
+
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */,
|
|
24
|
+
|
|
25
|
+
/* Module Resolution Options */
|
|
26
|
+
"moduleResolution": "node" /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */,
|
|
27
|
+
"allowSyntheticDefaultImports": true /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */,
|
|
28
|
+
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */,
|
|
29
|
+
|
|
30
|
+
/* Source Map Options */
|
|
31
|
+
"inlineSourceMap": true /* Emit a single file with source maps instead of having a separate file. */,
|
|
32
|
+
"inlineSources": true /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */,
|
|
33
|
+
|
|
34
|
+
/* Experimental Options */
|
|
35
|
+
"experimentalDecorators": true /* Enables experimental support for ES7 decorators. */,
|
|
36
|
+
"emitDecoratorMetadata": true /* Enables experimental support for emitting type metadata for decorators. */,
|
|
37
|
+
|
|
38
|
+
"resolveJsonModule": true /* Allows importing modules with a ‘.json’ extension */
|
|
39
|
+
}
|
|
40
|
+
}
|
package/index.js
CHANGED
|
@@ -9,6 +9,7 @@ const path_1 = require("path");
|
|
|
9
9
|
const redlock_1 = require("redlock");
|
|
10
10
|
const adapter_1 = require("./adapter");
|
|
11
11
|
const background_executor_1 = require("./background-executor");
|
|
12
|
+
const router_1 = __importDefault(require("./debug/router"));
|
|
12
13
|
const metrics_1 = require("./metrics");
|
|
13
14
|
const util_1 = require("./util");
|
|
14
15
|
const validation_1 = require("./validation");
|
|
@@ -145,6 +146,11 @@ async function buildRestApi(adapter) {
|
|
|
145
146
|
app.get((0, path_1.join)(adapter.config.settings.BASE_URL, 'health'), (req, res) => {
|
|
146
147
|
res.status(200).send({ message: 'OK', version: VERSION });
|
|
147
148
|
});
|
|
149
|
+
// If specified, serve debug endpoints to assist in issue triaging
|
|
150
|
+
if (adapter.config.settings.DEBUG_ENDPOINTS === true) {
|
|
151
|
+
(0, router_1.default)(app, adapter);
|
|
152
|
+
logger.info('Serving debug endpoints');
|
|
153
|
+
}
|
|
148
154
|
// Use global error handling
|
|
149
155
|
app.setErrorHandler(validation_1.errorCatchingMiddleware);
|
|
150
156
|
// Always reply with json content
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRo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QAAQ;YACrC,MAAM,EAAE,MAAM;YACd,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE;gBAC5B,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,aAAa,CAC1C,GAA2C,EAC3C,KAAoC,CACrC,CAAA;gBACD,OAAO,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;YAC9D,CAAC;SACF,CAAC,CAAA;QAEF,IACE,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,eAAe;YACvC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,4BAA4B,EACpD;YACA,MAAM,CAAC,OAAO,CAAsB,YAAY,EAAE,gCAAsB,CAAC,CAAA;SAC1E;IACH,CAAC,CAAC,CAAA;IAEF,OAAO,GAAG,CAAA;AACZ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chainlink/external-adapter-framework",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.31.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"dependencies": {
|
|
@@ -9,15 +9,17 @@
|
|
|
9
9
|
"eventsource": "2.0.2",
|
|
10
10
|
"fastify": "4.13.0",
|
|
11
11
|
"ioredis": "5.2.3",
|
|
12
|
+
"mock-socket": "9.1.5",
|
|
12
13
|
"pino": "8.6.1",
|
|
13
14
|
"pino-pretty": "9.1.0",
|
|
14
15
|
"prom-client": "13.2.0",
|
|
15
|
-
"ws": "8.9.0",
|
|
16
16
|
"redlock": "5.0.0-beta.2",
|
|
17
|
-
"
|
|
17
|
+
"yeoman-generator": "3.1.1",
|
|
18
|
+
"ws": "8.9.0"
|
|
18
19
|
},
|
|
19
20
|
"scripts": {
|
|
20
|
-
"build": "mkdir -p ./dist/src && cp package.json dist/src && cp README.md dist/src && tsc",
|
|
21
|
+
"build": "mkdir -p ./dist/src && cp package.json dist/src && cp README.md dist/src && tsc && yarn build-generator",
|
|
22
|
+
"build-generator": "mkdir -p ./dist/src/generator-adapter/generators/app/templates && cp -R scripts/generator-adapter/generators/app/templates dist/src/generator-adapter/generators/app && cp scripts/generator-adapter/package.json dist/src/generator-adapter && tsc --project scripts/generator-adapter/tsconfig.json && tsc scripts/adapter-generator.ts --outDir dist/src",
|
|
21
23
|
"generate-docs": "typedoc src/**/*.ts",
|
|
22
24
|
"generate-ref-tables": "ts-node scripts/metrics-table.ts > docs/reference-tables/metrics.md && ts-node scripts/ea-settings-table.ts > docs/reference-tables/ea-settings.md && yarn prettier --write docs/reference-tables",
|
|
23
25
|
"lint-fix": "eslint --max-warnings=0 --fix . && prettier --write ./src/**/*.ts ./test/**/*.ts ./*.{json,js,yaml}",
|
|
@@ -28,6 +30,9 @@
|
|
|
28
30
|
"verify": "yarn lint && yarn build && yarn build -p ./test/tsconfig.json && yarn test && yarn code-coverage",
|
|
29
31
|
"code-coverage": "c8 check-coverage --statements 95 --lines 95 --functions 95 --branches 90"
|
|
30
32
|
},
|
|
33
|
+
"bin": {
|
|
34
|
+
"create-external-adapter": "adapter-generator.js"
|
|
35
|
+
},
|
|
31
36
|
"devDependencies": {
|
|
32
37
|
"@sinonjs/fake-timers": "9.1.2",
|
|
33
38
|
"@types/eventsource": "1.1.11",
|
|
@@ -47,7 +52,8 @@
|
|
|
47
52
|
"ts-node": "10.9.1",
|
|
48
53
|
"ts-node-dev": "2.0.0",
|
|
49
54
|
"typedoc": "0.23.21",
|
|
50
|
-
"typescript": "5.0.4"
|
|
55
|
+
"typescript": "5.0.4",
|
|
56
|
+
"@types/yeoman-generator": "5.2.11"
|
|
51
57
|
},
|
|
52
58
|
"prettier": {
|
|
53
59
|
"semi": false,
|