@chainlink/external-adapter-framework 0.12.1 → 0.13.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.
Files changed (57) hide show
  1. package/adapter/basic.js +3 -3
  2. package/adapter/basic.js.map +1 -1
  3. package/adapter/endpoint.d.ts +9 -1
  4. package/adapter/endpoint.js +23 -0
  5. package/adapter/endpoint.js.map +1 -1
  6. package/cache/index.d.ts +2 -2
  7. package/cache/index.js +1 -1
  8. package/cache/index.js.map +1 -1
  9. package/cache/local.js +7 -3
  10. package/cache/local.js.map +1 -1
  11. package/cache/metrics.d.ts +1 -1
  12. package/cache/metrics.js +9 -1
  13. package/cache/metrics.js.map +1 -1
  14. package/cache/redis.js +12 -4
  15. package/cache/redis.js.map +1 -1
  16. package/cache/response.d.ts +36 -0
  17. package/cache/response.js +58 -0
  18. package/cache/response.js.map +1 -0
  19. package/config/index.d.ts +6 -6
  20. package/config/index.js +6 -10
  21. package/config/index.js.map +1 -1
  22. package/index.js +4 -1
  23. package/index.js.map +1 -1
  24. package/metrics/util.d.ts +1 -1
  25. package/metrics/util.js +2 -2
  26. package/metrics/util.js.map +1 -1
  27. package/package.json +1 -1
  28. package/rate-limiting/metrics.js +1 -1
  29. package/rate-limiting/metrics.js.map +1 -1
  30. package/transports/abstract/streaming.d.ts +34 -0
  31. package/transports/abstract/streaming.js +44 -0
  32. package/transports/abstract/streaming.js.map +1 -0
  33. package/transports/abstract/subscription.d.ts +38 -0
  34. package/transports/abstract/subscription.js +63 -0
  35. package/transports/abstract/subscription.js.map +1 -0
  36. package/transports/batch-warming.d.ts +7 -12
  37. package/transports/batch-warming.js +42 -28
  38. package/transports/batch-warming.js.map +1 -1
  39. package/transports/index.d.ts +20 -13
  40. package/transports/index.js +0 -35
  41. package/transports/index.js.map +1 -1
  42. package/transports/metrics.d.ts +11 -4
  43. package/transports/metrics.js +30 -20
  44. package/transports/metrics.js.map +1 -1
  45. package/transports/rest.d.ts +10 -7
  46. package/transports/rest.js +22 -12
  47. package/transports/rest.js.map +1 -1
  48. package/transports/routing.d.ts +9 -3
  49. package/transports/routing.js +4 -4
  50. package/transports/routing.js.map +1 -1
  51. package/transports/sse.d.ts +8 -12
  52. package/transports/sse.js +29 -39
  53. package/transports/sse.js.map +1 -1
  54. package/transports/websocket.d.ts +14 -14
  55. package/transports/websocket.js +76 -60
  56. package/transports/websocket.js.map +1 -1
  57. package/util/request.d.ts +90 -11
@@ -30,8 +30,8 @@ exports.WebSocketTransport = exports.WebSocketClassProvider = exports.WebSocket
30
30
  const ws_1 = __importDefault(require("ws"));
31
31
  exports.WebSocket = ws_1.default;
32
32
  const util_1 = require("../util");
33
- const _1 = require("./");
34
33
  const transportMetrics = __importStar(require("./metrics"));
34
+ const streaming_1 = require("./abstract/streaming");
35
35
  const logger = (0, util_1.makeLogger)('WebSocketTransport');
36
36
  class WebSocketClassProvider {
37
37
  static set(ctor) {
@@ -49,22 +49,15 @@ WebSocketClassProvider.ctor = ws_1.default;
49
49
  *
50
50
  * @typeParam T - Helper struct type that will be used to pass types to the generic parameters (check [[WebsocketTransportGenerics]])
51
51
  */
52
- class WebSocketTransport {
52
+ class WebSocketTransport extends streaming_1.StreamingTransport {
53
53
  constructor(config) {
54
+ super();
54
55
  this.config = config;
55
- // The double sets serve to create a simple polling mechanism instead of needing a subscription
56
- // This one would not; this is always local state
57
- this.localSubscriptions = [];
58
56
  this.currentUrl = '';
57
+ this.lastMessageReceivedAt = 0;
59
58
  }
60
- async initialize(dependencies, config, endpointName) {
61
- this.cache = dependencies.cache;
62
- this.rateLimiter = dependencies.backgroundExecuteRateLimiter;
63
- this.subscriptionSet = dependencies.subscriptionSetFactory.buildSet(endpointName);
64
- }
65
- async registerRequest(req, config) {
66
- logger.debug(`Adding entry to subscription set (ttl: ${config.WS_SUBSCRIPTION_TTL}): [${req.requestContext.cacheKey}] = ${req.requestContext.data}`);
67
- await this.subscriptionSet.add(req.requestContext.cacheKey, req.requestContext.data, config.WS_SUBSCRIPTION_TTL);
59
+ getSubscriptionTtlFromConfig(config) {
60
+ return config.WS_SUBSCRIPTION_TTL;
68
61
  }
69
62
  connectionClosed() {
70
63
  return !this.wsConnection || this.wsConnection.readyState === ws_1.default.CLOSED;
@@ -75,11 +68,10 @@ class WebSocketTransport {
75
68
  deserializeMessage(data) {
76
69
  return JSON.parse(data.toString());
77
70
  }
78
- establishWsConnection(context, url, options) {
79
- return new Promise((resolve) => {
80
- const ctor = WebSocketClassProvider.get();
81
- this.wsConnection = new ctor(url, undefined, options);
82
- this.wsConnection.addEventListener('open', async (event) => {
71
+ buildConnectionHandlers(context, connectionReadyResolve) {
72
+ return {
73
+ // Called when the WS connection is opened
74
+ open: async (event) => {
83
75
  logger.debug(`Opened websocket connection. (event type ${event.type})`);
84
76
  if (this.config.handlers.open) {
85
77
  await this.config.handlers.open(this.wsConnection, context);
@@ -87,31 +79,64 @@ class WebSocketTransport {
87
79
  }
88
80
  // Record active ws connections by incrementing count on open
89
81
  transportMetrics.wsConnectionActive.inc();
90
- resolve(true);
91
- });
92
- this.wsConnection.addEventListener('message', async (event) => {
82
+ connectionReadyResolve(true);
83
+ },
84
+ // Called when any message is received by the open connection
85
+ message: async (event) => {
93
86
  const parsed = this.deserializeMessage(event.data);
94
87
  logger.trace(`Got ws message: ${event.data}`);
95
- const results = this.config.handlers.message(parsed, context);
88
+ const providerDataReceived = Date.now();
89
+ const results = this.config.handlers.message(parsed, context)?.map((r) => {
90
+ const result = r;
91
+ const partialResponse = r.response;
92
+ result.response.timestamps = {
93
+ providerDataStreamEstablished: this.providerDataStreamEstablished,
94
+ providerDataReceived,
95
+ providerIndicatedTime: partialResponse.timestamps?.providerIndicatedTime,
96
+ };
97
+ return result;
98
+ });
96
99
  if (Array.isArray(results)) {
97
- const responses = (0, _1.buildCacheEntriesFromResults)(results, context);
98
- logger.trace(`Writing ${responses.length} responses to cache`);
99
- await this.cache.setMany(responses, context.adapterConfig.CACHE_MAX_AGE);
100
+ // Updating the last message received time here, to only care about messages we use
101
+ this.lastMessageReceivedAt = Date.now();
102
+ logger.trace(`Writing ${results.length} responses to cache`);
103
+ await this.responseCache.write(results);
100
104
  }
101
- });
102
- this.wsConnection.addEventListener('error', async (event) => {
105
+ // Do this after writing so we get the values to the cache ASAP
106
+ // We're not calculating feedId or subscription because this is only a single message,
107
+ // and it could in theory contain more than one value to set to the cache
108
+ transportMetrics.wsMessageTotal
109
+ .labels({
110
+ direction: 'received',
111
+ })
112
+ .inc();
113
+ },
114
+ // Called when an error is thrown by the connection
115
+ error: async (event) => {
103
116
  logger.debug(`Error occurred in web socket connection. Error: ${event.error} ; Message: ${event.message}`);
104
117
  // Record connection error count
105
118
  transportMetrics.wsConnectionErrors
106
119
  .labels(transportMetrics.connectionErrorLabels(event.message))
107
120
  .inc();
108
- });
109
- this.wsConnection.addEventListener('close', (event) => {
121
+ },
122
+ // Called when the WS connection closes for any reason
123
+ close: (event) => {
110
124
  logger.debug(`Closed websocket connection. Code: ${event.code} ; reason: ${event.reason?.toString()}`);
111
125
  // Record active ws connections by decrementing count on close
112
126
  // Using URL in label since connection_key is removed from v3
113
127
  transportMetrics.wsConnectionActive.dec();
114
- });
128
+ },
129
+ };
130
+ }
131
+ establishWsConnection(context, url, options) {
132
+ return new Promise((resolve) => {
133
+ const ctor = WebSocketClassProvider.get();
134
+ const handlers = this.buildConnectionHandlers(context, resolve);
135
+ this.wsConnection = new ctor(url, undefined, options);
136
+ this.wsConnection.addEventListener('open', handlers.open);
137
+ this.wsConnection.addEventListener('message', handlers.message);
138
+ this.wsConnection.addEventListener('error', handlers.error);
139
+ this.wsConnection.addEventListener('close', handlers.close);
115
140
  });
116
141
  }
117
142
  async sendMessages(context, subscribes, unsubscribes) {
@@ -122,59 +147,50 @@ class WebSocketTransport {
122
147
  this.wsConnection.send(message);
123
148
  }
124
149
  }
125
- // Unlike cache warming, this execute will manage subscriptions
126
- async backgroundExecute(context) {
127
- logger.debug('Starting background execute, getting subscriptions from sorted set');
128
- const desiredSubs = await this.subscriptionSet.getAll();
129
- // Keep track of active subscriptions for background execute
130
- transportMetrics.bgExecuteSubscriptionSetCount
131
- .labels({ endpoint: context.endpointName, transport_type: 'websocket' })
132
- .set(desiredSubs.length);
133
- logger.debug('Generating delta (subscribes & unsubscribes)');
134
- const subscribes = desiredSubs.filter((s) => !this.localSubscriptions.map((ls) => JSON.stringify(ls)).includes(JSON.stringify(s)));
135
- const unsubscribes = this.localSubscriptions.filter((s) => !desiredSubs.map((ds) => JSON.stringify(ds)).includes(JSON.stringify(s)));
136
- logger.debug(`${subscribes.length} new subscriptions; ${unsubscribes.length} to unsubscribe`);
137
- if (subscribes.length) {
138
- logger.trace(`Will subscribe to: ${JSON.stringify(subscribes)}`);
139
- }
140
- if (unsubscribes.length) {
141
- logger.trace(`Will unsubscribe to: ${JSON.stringify(unsubscribes)}`);
142
- }
150
+ async streamHandler(context, subscriptions) {
143
151
  // New subs && no connection -> connect -> add subs
144
152
  // No new subs && no connection -> skip
145
153
  // New subs && connection -> add subs
146
154
  // No new subs && connection -> unsubs only
147
- if (!subscribes.length && !this.wsConnection) {
155
+ if (!subscriptions.new.length && !this.wsConnection) {
148
156
  logger.debug('No entries in subscription set and no established connection, skipping');
149
- return this.rateLimiter.msUntilNextExecution(context.endpointName);
157
+ return;
150
158
  }
151
- const urlFromConfig = await this.config.url(context, desiredSubs);
159
+ const urlFromConfig = await this.config.url(context, subscriptions.desired);
152
160
  const urlChanged = this.currentUrl !== urlFromConfig;
161
+ const timeSinceLastMessage = Date.now() - this.lastMessageReceivedAt;
162
+ const connectionUnresponsive = timeSinceLastMessage > context.adapterConfig.WS_SUBSCRIPTION_UNRESPONSIVE_TTL;
153
163
  let connectionClosed = this.connectionClosed();
154
164
  // Check if we should close the current connection
155
- if (!connectionClosed && urlChanged) {
156
- logger.info(`Websocket url has changed from ${this.currentUrl} to ${urlFromConfig}, closing connection...`);
165
+ if (!connectionClosed && (urlChanged || connectionUnresponsive)) {
166
+ const reason = urlChanged
167
+ ? `Websocket url has changed from ${this.currentUrl} to ${urlFromConfig}, closing connection...`
168
+ : `Last message was received ${timeSinceLastMessage} ago, exceeding the threshold of ${context.adapterConfig.WS_SUBSCRIPTION_UNRESPONSIVE_TTL}ms, closing connection...`;
169
+ logger.info(reason);
157
170
  this.wsConnection.close();
158
171
  connectionClosed = true;
172
+ // If the connection was closed, the new subscriptions should be the desired ones
173
+ subscriptions.new = subscriptions.desired;
174
+ if (subscriptions.new.length) {
175
+ logger.trace(`Connection will be reopened and will subscribe to new and resubscribe to existing: ${JSON.stringify(subscriptions.new)}`);
176
+ }
159
177
  }
160
178
  // Check if we need to open a new connection
161
- if (connectionClosed && desiredSubs.length) {
179
+ if (connectionClosed && subscriptions.desired.length) {
162
180
  logger.debug('No established connection and new subscriptions available, connecting to WS');
163
181
  const options = this.config.options && (await this.config.options(context));
164
182
  this.currentUrl = urlFromConfig;
165
183
  await this.establishWsConnection(context, urlFromConfig, options);
184
+ this.providerDataStreamEstablished = Date.now();
166
185
  }
167
186
  if (this.config.builders) {
168
187
  logger.debug('Sending subs/unsubs if there are any');
169
188
  const { subscribeMessage, unsubscribeMessage } = this.config.builders;
170
- await this.sendMessages(context, subscribeMessage ? subscribes.map(subscribeMessage) : subscribes, unsubscribeMessage ? unsubscribes.map(unsubscribeMessage) : unsubscribes);
189
+ await this.sendMessages(context, subscribeMessage ? subscriptions.new.map(subscribeMessage) : subscriptions.new, unsubscribeMessage ? subscriptions.stale.map(unsubscribeMessage) : subscriptions.stale);
171
190
  }
172
191
  // Record WS message and subscription metrics
173
- transportMetrics.recordWsMessageMetrics(context, subscribes, unsubscribes);
174
- logger.debug('Setting local state to cache value');
175
- this.localSubscriptions = desiredSubs;
176
- logger.debug('Background execute complete');
177
- return this.rateLimiter.msUntilNextExecution(context.endpointName);
192
+ transportMetrics.recordWsMessageMetrics(context, subscriptions.new, subscriptions.stale);
193
+ return;
178
194
  }
179
195
  }
180
196
  exports.WebSocketTransport = WebSocketTransport;
@@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5C,IAAI,gBAAgB,IAAI,aAAa,CAAC,OAAO,CAAC,MAAM,EAAE;YACpD,MAAM,CAAC,KAAK,CAAC,6EAA6E,CAAC,CAAA;YAC3F,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,IAAI,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAA;YAC3E,IAAI,CAAC,UAAU,GAAG,aAAa,CAAA;YAC/B,MAAM,IAAI,CAAC,qBAAqB,CAAC,OAAO,EAAE,aAAa,EAAE,OAAO,CAAC,CAAA;YACjE,IAAI,CAAC,6BAA6B,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;SAChD;QAED,IAAI,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE;YACxB,MAAM,CAAC,KAAK,CAAC,sCAAsC,CAAC,CAAA;YACpD,MAAM,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAA;YACrE,MAAM,IAAI,CAAC,YAAY,CACrB,OAAO,EACP,gBAAgB,CAAC,CAAC,CAAC,aAAa,CAAC,GAAG,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,GAAG,EAC9E,kBAAkB,CAAC,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,KAAK,CACvF,CAAA;SACF;QAED,6CAA6C;QAC7C,gBAAgB,CAAC,sBAAsB,CAAC,OAAO,EAAE,aAAa,CAAC,GAAG,EAAE,aAAa,CAAC,KAAK,CAAC,CAAA;QAExF,OAAM;IACR,CAAC;CACF;AA9LD,gDA8LC"}
package/util/request.d.ts CHANGED
@@ -76,18 +76,27 @@ export interface AdapterMetricsMeta {
76
76
  export declare type AdapterRequestData = Record<string, unknown> & {
77
77
  endpoint?: string;
78
78
  };
79
+ export declare type ProviderResultGenerics = {
80
+ Request: RequestGenerics;
81
+ Response: ResponseGenerics;
82
+ };
79
83
  /**
80
84
  * Helper type to hold the value from responses from a provider, and the adapter params they correspond to.
81
85
  */
82
- export interface ProviderResult<T extends {
83
- Request: RequestGenerics;
84
- Response: ResponseGenerics;
85
- }> {
86
+ export declare type ProviderResult<T extends ProviderResultGenerics> = {
86
87
  /** The set of parameters that uniquely relate to the response */
87
88
  params: T['Request']['Params'];
88
89
  /** Value that will be included in the result property of the response */
89
- value: T['Response']['Result'];
90
- }
90
+ response: PartialAdapterResponse<T['Response']>;
91
+ };
92
+ export declare type TimestampedProviderResult<T extends ProviderResultGenerics> = Pick<ProviderResult<T>, 'params'> & {
93
+ /** Value that will be included in the result property of the response, with timestamps applied */
94
+ response: TimestampedAdapterResponse<T['Response']>;
95
+ };
96
+ /**
97
+ * Here we do actually want an object, since unknown could be a primitive.
98
+ * The rule itself does say "marginally better"
99
+ */
91
100
  export declare type EmptyObject = Object;
92
101
  /**
93
102
  * Helper struct type that provides detail about the incoming Adapter Request
@@ -113,20 +122,90 @@ export declare type ResponseGenerics = {
113
122
  Result: string | number | null;
114
123
  };
115
124
  /**
116
- * Shape of the response body from the adapter
125
+ * Details for timestamps to be included in the response
126
+ */
127
+ declare type ResponseTimestamps = {
128
+ /** Time at which data was received from the provider */
129
+ providerDataReceived: number;
130
+ /** Time indicated by the provider representing the time at which this value was calculated/set/valid */
131
+ providerIndicatedTime: number | undefined;
132
+ } & ({
133
+ /**
134
+ * For sync protocols (request -\> response).
135
+ * Time at which data was requested from the provider.
136
+ */
137
+ providerDataRequested: number;
138
+ providerDataStreamEstablished?: never;
139
+ } | {
140
+ /**
141
+ * For async protocols (subscription -\> n events received).
142
+ * Time at which a data stream was established for the provider.
143
+ */
144
+ providerDataStreamEstablished: number;
145
+ providerDataRequested?: never;
146
+ });
147
+ /**
148
+ * Object with timestamps that will be present in both successful and provider error responses
149
+ */
150
+ declare type TimestampedResponseObject = {
151
+ /** Timestamps relevant for data provider timings */
152
+ timestamps: ResponseTimestamps;
153
+ };
154
+ /**
155
+ * Response from the EA to send when manually storing an error in the cache
117
156
  */
118
- export declare type AdapterResponse<T extends ResponseGenerics = ResponseGenerics> = {
119
- /** HTTP status code */
157
+ declare type ProviderErrorResponse = {
158
+ /** Status code for the errored response */
120
159
  statusCode: number;
160
+ /** Error message that will be sent back from the adapter */
161
+ errorMessage: string;
162
+ } & {
163
+ data?: never;
164
+ result?: never;
165
+ meta?: never;
166
+ };
167
+ /**
168
+ * Provider error response with timestamps added
169
+ */
170
+ export declare type TimestampedProviderErrorResponse = ProviderErrorResponse & TimestampedResponseObject;
171
+ /**
172
+ * The most basic data that needs to be manually set for an adapter response.
173
+ */
174
+ export declare type PartialSuccessfulResponse<T extends ResponseGenerics> = {
121
175
  /** Response data, holds "result" for Flux Monitor */
122
176
  data: T['Data'];
123
177
  /** Result value used for OCR */
124
178
  result: T['Result'];
125
- /** Number detailing the maximum age of the result in the cache, will be replaced by telemetry eventually */
126
- maxAge?: number;
179
+ /** Optionally, specify manually some of the timestamps here */
180
+ timestamps?: Pick<ResponseTimestamps, 'providerIndicatedTime'>;
181
+ } & {
182
+ errorMessage?: never;
183
+ };
184
+ /**
185
+ * Partial EA response, with timestamps added
186
+ */
187
+ declare type TimestampedSuccessfulResponse<T extends ResponseGenerics> = PartialSuccessfulResponse<T> & TimestampedResponseObject;
188
+ /**
189
+ * Full EA successful response, with metadata and defaults added
190
+ */
191
+ declare type SuccessfulResponse<T extends ResponseGenerics> = TimestampedSuccessfulResponse<T> & {
127
192
  /** Metadata relevant to this request */
128
193
  meta?: AdapterRequestMeta;
194
+ /** HTTP status code, by default will be set to 200 */
195
+ statusCode: number;
129
196
  };
197
+ /**
198
+ * Response body from the EA, before timestamps, defaults and metadata are filled in
199
+ */
200
+ export declare type PartialAdapterResponse<T extends ResponseGenerics = ResponseGenerics> = PartialSuccessfulResponse<T> | ProviderErrorResponse;
201
+ /**
202
+ * Response body from the EA with timestamps, before defaults and metadata are filled in
203
+ */
204
+ export declare type TimestampedAdapterResponse<T extends ResponseGenerics = ResponseGenerics> = TimestampedSuccessfulResponse<T> | TimestampedProviderErrorResponse;
205
+ /**
206
+ * Shape of the response body from the adapter
207
+ */
208
+ export declare type AdapterResponse<T extends ResponseGenerics = ResponseGenerics> = SuccessfulResponse<T> | TimestampedProviderErrorResponse;
130
209
  export declare type SingleNumberResultResponse = {
131
210
  Result: number;
132
211
  Data: {