@chainlink/external-adapter-framework 0.26.1 → 0.27.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/adapter/basic.d.ts +9 -19
- package/adapter/basic.js +43 -63
- package/adapter/basic.js.map +1 -1
- package/adapter/endpoint.d.ts +7 -7
- package/adapter/endpoint.js +17 -25
- package/adapter/endpoint.js.map +1 -1
- package/adapter/price.d.ts +3 -3
- package/adapter/price.js.map +1 -1
- package/adapter/types.d.ts +12 -14
- package/background-executor.js +7 -7
- package/background-executor.js.map +1 -1
- package/cache/index.d.ts +4 -5
- package/cache/index.js +8 -8
- package/cache/index.js.map +1 -1
- package/cache/response.d.ts +4 -4
- package/cache/response.js +7 -6
- package/cache/response.js.map +1 -1
- package/config/index.d.ts +64 -16
- package/config/index.js +88 -26
- package/config/index.js.map +1 -1
- package/index.d.ts +4 -4
- package/index.js +25 -21
- package/index.js.map +1 -1
- package/metrics/index.d.ts +10 -8
- package/metrics/index.js +23 -11
- package/metrics/index.js.map +1 -1
- package/metrics/util.d.ts +1 -2
- package/metrics/util.js.map +1 -1
- package/package.json +2 -2
- package/rate-limiting/index.d.ts +4 -4
- package/rate-limiting/index.js +13 -13
- package/rate-limiting/index.js.map +1 -1
- package/transports/abstract/subscription.d.ts +5 -6
- package/transports/abstract/subscription.js +4 -4
- package/transports/abstract/subscription.js.map +1 -1
- package/transports/http.d.ts +8 -9
- package/transports/http.js +14 -14
- package/transports/http.js.map +1 -1
- package/transports/index.d.ts +15 -8
- package/transports/index.js +28 -0
- package/transports/index.js.map +1 -1
- package/transports/metrics.d.ts +1 -2
- package/transports/metrics.js.map +1 -1
- package/transports/sse.d.ts +3 -4
- package/transports/sse.js +8 -8
- package/transports/sse.js.map +1 -1
- package/transports/websocket.d.ts +3 -4
- package/transports/websocket.js +34 -18
- package/transports/websocket.js.map +1 -1
- package/util/index.d.ts +10 -0
- package/util/index.js +23 -1
- package/util/index.js.map +1 -1
- package/util/logger.js +1 -1
- package/util/logger.js.map +1 -1
- package/util/requester.d.ts +2 -2
- package/util/requester.js +4 -4
- package/util/requester.js.map +1 -1
- package/util/subscription-set/subscription-set.d.ts +2 -2
- package/util/subscription-set/subscription-set.js +3 -3
- package/util/subscription-set/subscription-set.js.map +1 -1
- package/validation/index.js +11 -10
- package/validation/index.js.map +1 -1
package/adapter/basic.d.ts
CHANGED
|
@@ -1,32 +1,27 @@
|
|
|
1
|
-
import { AdapterConfig,
|
|
2
|
-
import { AdapterRequest, AdapterResponse
|
|
1
|
+
import { AdapterConfig, BaseAdapterSettings, SettingsDefinitionMap } from '../config';
|
|
2
|
+
import { AdapterRequest, AdapterResponse } from '../util';
|
|
3
3
|
import { AdapterEndpoint } from './endpoint';
|
|
4
|
-
import { AdapterDependencies, AdapterParams, AdapterRateLimitingConfig,
|
|
4
|
+
import { AdapterDependencies, AdapterParams, AdapterRateLimitingConfig, EndpointGenerics } from './types';
|
|
5
5
|
/**
|
|
6
6
|
* Main class to represent an External Adapter
|
|
7
7
|
*/
|
|
8
|
-
export declare class Adapter<
|
|
8
|
+
export declare class Adapter<CustomSettingsDefinition extends SettingsDefinitionMap = SettingsDefinitionMap> implements Omit<AdapterParams<CustomSettingsDefinition>, 'bootstrap'> {
|
|
9
9
|
name: Uppercase<string>;
|
|
10
10
|
defaultEndpoint?: string | undefined;
|
|
11
|
-
endpoints: AdapterEndpoint<
|
|
12
|
-
|
|
13
|
-
}>>[];
|
|
14
|
-
envDefaultOverrides?: Partial<BaseAdapterConfig> | undefined;
|
|
15
|
-
customSettings?: SettingsMap | undefined;
|
|
11
|
+
endpoints: AdapterEndpoint<EndpointGenerics>[];
|
|
12
|
+
envDefaultOverrides?: Partial<BaseAdapterSettings> | undefined;
|
|
16
13
|
rateLimiting?: AdapterRateLimitingConfig | undefined;
|
|
17
14
|
envVarsPrefix?: string;
|
|
18
15
|
initialized: boolean;
|
|
19
16
|
/** Object containing alias translations for all endpoints */
|
|
20
|
-
endpointsMap: Record<string, AdapterEndpoint<
|
|
21
|
-
CustomSettings: CustomSettings;
|
|
22
|
-
}>>>;
|
|
17
|
+
endpointsMap: Record<string, AdapterEndpoint<EndpointGenerics>>;
|
|
23
18
|
/** Initialized dependencies that the adapter will use */
|
|
24
19
|
dependencies: AdapterDependencies;
|
|
25
20
|
/** Configuration params for various adapter properties */
|
|
26
|
-
config: AdapterConfig<
|
|
21
|
+
config: AdapterConfig<CustomSettingsDefinition>;
|
|
27
22
|
/** Bootstrap function that will run when initializing the adapter */
|
|
28
23
|
private readonly bootstrap?;
|
|
29
|
-
constructor(params: AdapterParams<
|
|
24
|
+
constructor(params: AdapterParams<CustomSettingsDefinition>);
|
|
30
25
|
/**
|
|
31
26
|
* Initializes all of the [[Transport]]s in the adapter, passing along any [[AdapterDependencies]] and [[AdapterConfig]].
|
|
32
27
|
* Additionally, it builds a map out of all the endpoint names and aliases (checking for duplicates).
|
|
@@ -43,11 +38,6 @@ export declare class Adapter<CustomSettings extends CustomAdapterSettings = Sett
|
|
|
43
38
|
*
|
|
44
39
|
*/
|
|
45
40
|
private calculateRateLimitAllocations;
|
|
46
|
-
/**
|
|
47
|
-
* Creates a list of key/value pairs that need to be censored in the logs
|
|
48
|
-
* using the sensitive flag in the adapter config
|
|
49
|
-
*/
|
|
50
|
-
private buildCensorList;
|
|
51
41
|
/**
|
|
52
42
|
* Logs a warning for certain configs if set to particular values.
|
|
53
43
|
* Used to warn stakeholders of potential risks.
|
package/adapter/basic.js
CHANGED
|
@@ -11,7 +11,6 @@ const config_1 = require("../config");
|
|
|
11
11
|
const metrics_2 = require("../metrics");
|
|
12
12
|
const rate_limiting_1 = require("../rate-limiting");
|
|
13
13
|
const util_1 = require("../util");
|
|
14
|
-
const censor_list_1 = __importDefault(require("../util/censor/censor-list"));
|
|
15
14
|
const requester_1 = require("../util/requester");
|
|
16
15
|
const error_1 = require("../validation/error");
|
|
17
16
|
const logger = (0, util_1.makeLogger)('Adapter');
|
|
@@ -28,15 +27,11 @@ class Adapter {
|
|
|
28
27
|
this.name = params.name;
|
|
29
28
|
this.defaultEndpoint = params.defaultEndpoint?.toLowerCase();
|
|
30
29
|
this.endpoints = params.endpoints;
|
|
31
|
-
this.envDefaultOverrides = params.envDefaultOverrides;
|
|
32
|
-
this.customSettings = params.customSettings;
|
|
33
30
|
this.rateLimiting = params.rateLimiting;
|
|
34
31
|
this.bootstrap = params.bootstrap;
|
|
35
|
-
this.config =
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
envVarsPrefix: this.envVarsPrefix,
|
|
39
|
-
});
|
|
32
|
+
this.config =
|
|
33
|
+
params.config || new config_1.AdapterConfig({});
|
|
34
|
+
this.config.initialize();
|
|
40
35
|
this.normalizeEndpointNames();
|
|
41
36
|
this.calculateRateLimitAllocations();
|
|
42
37
|
}
|
|
@@ -51,7 +46,7 @@ class Adapter {
|
|
|
51
46
|
// Initialize metrics to register them with the prom-client
|
|
52
47
|
metrics_2.metrics.initialize();
|
|
53
48
|
// Building configs during initialization to avoid validation errors during construction
|
|
54
|
-
|
|
49
|
+
this.config.validate();
|
|
55
50
|
// Log warnings for risks associated with certain configs and values
|
|
56
51
|
this.logConfigWarnings();
|
|
57
52
|
if (this.bootstrap) {
|
|
@@ -68,11 +63,11 @@ class Adapter {
|
|
|
68
63
|
this.endpointsMap[alias] = endpoint;
|
|
69
64
|
}
|
|
70
65
|
logger.debug(`Initializing endpoint "${endpoint.name}"...`);
|
|
71
|
-
await endpoint.initialize(this.name, this.dependencies, this.config);
|
|
66
|
+
await endpoint.initialize(this.name, this.dependencies, this.config.settings);
|
|
72
67
|
}
|
|
73
68
|
// Build list of key/values that need to be redacted in logs
|
|
74
69
|
// Populates the static array in CensorList to use in censor-transport
|
|
75
|
-
this.buildCensorList();
|
|
70
|
+
this.config.buildCensorList();
|
|
76
71
|
logger.debug('Adapter initialization complete.');
|
|
77
72
|
this.initialized = true;
|
|
78
73
|
}
|
|
@@ -115,43 +110,24 @@ class Adapter {
|
|
|
115
110
|
logger.debug(`Endpoint [${endpoint.name}] - ${endpoint.rateLimiting?.allocationPercentage}%`);
|
|
116
111
|
}
|
|
117
112
|
}
|
|
118
|
-
/**
|
|
119
|
-
* Creates a list of key/value pairs that need to be censored in the logs
|
|
120
|
-
* using the sensitive flag in the adapter config
|
|
121
|
-
*/
|
|
122
|
-
buildCensorList() {
|
|
123
|
-
const censorList = Object.entries(config_1.BaseSettings)
|
|
124
|
-
.concat(Object.entries(this.customSettings || {}))
|
|
125
|
-
.filter(([name, setting]) => setting &&
|
|
126
|
-
setting.type === 'string' &&
|
|
127
|
-
setting.sensitive &&
|
|
128
|
-
this.config[name])
|
|
129
|
-
.map(([name]) => ({
|
|
130
|
-
key: name,
|
|
131
|
-
// Escaping potential special characters in values before creating regex
|
|
132
|
-
value: new RegExp(
|
|
133
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
134
|
-
this.config[name].replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&'), 'gi'),
|
|
135
|
-
}));
|
|
136
|
-
censor_list_1.default.set(censorList);
|
|
137
|
-
}
|
|
138
113
|
/**
|
|
139
114
|
* Logs a warning for certain configs if set to particular values.
|
|
140
115
|
* Used to warn stakeholders of potential risks.
|
|
141
116
|
*/
|
|
142
117
|
logConfigWarnings() {
|
|
143
|
-
if (this.config.LOG_LEVEL.toUpperCase() === 'DEBUG' ||
|
|
144
|
-
this.config.LOG_LEVEL.toUpperCase() === 'TRACE') {
|
|
145
|
-
logger.warn(`LOG_LEVEL has been set to ${this.config.LOG_LEVEL.toUpperCase()}. Setting higher log levels results in increased memory usage and potentially slower performance.`);
|
|
118
|
+
if (this.config.settings.LOG_LEVEL.toUpperCase() === 'DEBUG' ||
|
|
119
|
+
this.config.settings.LOG_LEVEL.toUpperCase() === 'TRACE') {
|
|
120
|
+
logger.warn(`LOG_LEVEL has been set to ${this.config.settings.LOG_LEVEL.toUpperCase()}. Setting higher log levels results in increased memory usage and potentially slower performance.`);
|
|
146
121
|
}
|
|
147
|
-
if (this.config.DEBUG === true) {
|
|
122
|
+
if (this.config.settings.DEBUG === true) {
|
|
148
123
|
logger.warn(`The adapter is running with DEBUG mode on.`);
|
|
149
124
|
}
|
|
150
|
-
if (this.config.METRICS_ENABLED === false) {
|
|
125
|
+
if (this.config.settings.METRICS_ENABLED === false) {
|
|
151
126
|
logger.warn(`METRICS_ENABLED has been set to false. Metrics should not be disabled in a production environment.`);
|
|
152
127
|
}
|
|
153
|
-
if (this.config.MAX_PAYLOAD_SIZE_LIMIT !==
|
|
154
|
-
|
|
128
|
+
if (this.config.settings.MAX_PAYLOAD_SIZE_LIMIT !==
|
|
129
|
+
config_1.BaseSettingsDefinition.MAX_PAYLOAD_SIZE_LIMIT.default) {
|
|
130
|
+
logger.warn(`MAX_PAYLOAD_SIZE_LIMIT has been set to ${this.config.settings.MAX_PAYLOAD_SIZE_LIMIT}. This setting should only be set when absolutely necessary.`);
|
|
155
131
|
}
|
|
156
132
|
}
|
|
157
133
|
/**
|
|
@@ -164,25 +140,25 @@ class Adapter {
|
|
|
164
140
|
initializeDependencies(inputDependencies) {
|
|
165
141
|
const dependencies = inputDependencies || {};
|
|
166
142
|
if (!dependencies.redisClient) {
|
|
167
|
-
if (this.config.CACHE_TYPE === 'redis') {
|
|
168
|
-
const maxCooldown = this.config.CACHE_REDIS_MAX_RECONNECT_COOLDOWN;
|
|
143
|
+
if (this.config.settings.CACHE_TYPE === 'redis') {
|
|
144
|
+
const maxCooldown = this.config.settings.CACHE_REDIS_MAX_RECONNECT_COOLDOWN;
|
|
169
145
|
const redisOptions = {
|
|
170
146
|
enableAutoPipelining: true,
|
|
171
|
-
host: this.config.CACHE_REDIS_HOST,
|
|
172
|
-
port: this.config.CACHE_REDIS_PORT,
|
|
173
|
-
password: this.config.CACHE_REDIS_PASSWORD,
|
|
174
|
-
path: this.config.CACHE_REDIS_PATH,
|
|
175
|
-
timeout: this.config.CACHE_REDIS_TIMEOUT,
|
|
147
|
+
host: this.config.settings.CACHE_REDIS_HOST,
|
|
148
|
+
port: this.config.settings.CACHE_REDIS_PORT,
|
|
149
|
+
password: this.config.settings.CACHE_REDIS_PASSWORD,
|
|
150
|
+
path: this.config.settings.CACHE_REDIS_PATH,
|
|
151
|
+
timeout: this.config.settings.CACHE_REDIS_TIMEOUT,
|
|
176
152
|
retryStrategy(times) {
|
|
177
153
|
metrics_2.metrics.get('redisRetriesCount').inc();
|
|
178
154
|
logger.warn(`Redis reconnect attempt #${times}`);
|
|
179
155
|
return Math.min(times * 100, maxCooldown); // Next reconnect attempt time
|
|
180
156
|
},
|
|
181
|
-
connectTimeout: this.config.CACHE_REDIS_CONNECTION_TIMEOUT,
|
|
157
|
+
connectTimeout: this.config.settings.CACHE_REDIS_CONNECTION_TIMEOUT,
|
|
182
158
|
maxRetriesPerRequest: 30, // Limits the number of retries before the adapter shuts down
|
|
183
159
|
};
|
|
184
|
-
if (this.config.CACHE_REDIS_URL) {
|
|
185
|
-
dependencies.redisClient = new ioredis_1.default(this.config.CACHE_REDIS_URL, redisOptions);
|
|
160
|
+
if (this.config.settings.CACHE_REDIS_URL) {
|
|
161
|
+
dependencies.redisClient = new ioredis_1.default(this.config.settings.CACHE_REDIS_URL, redisOptions);
|
|
186
162
|
}
|
|
187
163
|
else {
|
|
188
164
|
dependencies.redisClient = new ioredis_1.default(redisOptions);
|
|
@@ -193,18 +169,21 @@ class Adapter {
|
|
|
193
169
|
}
|
|
194
170
|
}
|
|
195
171
|
if (!dependencies.cache) {
|
|
196
|
-
dependencies.cache = cache_1.CacheFactory.buildCache({
|
|
172
|
+
dependencies.cache = cache_1.CacheFactory.buildCache({
|
|
173
|
+
cacheType: this.config.settings.CACHE_TYPE,
|
|
174
|
+
maxSizeForLocalCache: this.config.settings.CACHE_MAX_ITEMS,
|
|
175
|
+
}, dependencies.redisClient);
|
|
197
176
|
}
|
|
198
|
-
const rateLimitingTier = (0, rate_limiting_1.getRateLimitingTier)(this.config, this.rateLimiting?.tiers);
|
|
177
|
+
const rateLimitingTier = (0, rate_limiting_1.getRateLimitingTier)(this.config.settings, this.rateLimiting?.tiers);
|
|
199
178
|
const highestTierValue = (0, rate_limiting_1.highestRateLimitTiers)(this.rateLimiting?.tiers);
|
|
200
|
-
const rateLimitTierFromConfig = (0, rate_limiting_1.buildRateLimitTiersFromConfig)(this.config);
|
|
179
|
+
const rateLimitTierFromConfig = (0, rate_limiting_1.buildRateLimitTiersFromConfig)(this.config.settings);
|
|
201
180
|
const perSecRateLimit = rateLimitTierFromConfig?.rateLimit1s || 0;
|
|
202
181
|
const perMinuteRateLimit = (rateLimitTierFromConfig?.rateLimit1m || 0) * 60;
|
|
203
182
|
if (perSecRateLimit > highestTierValue) {
|
|
204
183
|
logger.warn(`The configured RATE_LIMIT_CAPACITY_SECOND value is higher than the highest tier value in the adapter rate limiting configurations ${highestTierValue}`);
|
|
205
184
|
}
|
|
206
185
|
if (perMinuteRateLimit > highestTierValue) {
|
|
207
|
-
logger.warn(`The configured ${this.config.RATE_LIMIT_CAPACITY_MINUTE
|
|
186
|
+
logger.warn(`The configured ${this.config.settings.RATE_LIMIT_CAPACITY_MINUTE
|
|
208
187
|
? 'RATE_LIMIT_CAPACITY_MINUTE'
|
|
209
188
|
: 'RATE_LIMIT_CAPACITY'}
|
|
210
189
|
value is higher than the highest tier value the adapter rate limiting configurations ${highestTierValue}`);
|
|
@@ -213,10 +192,10 @@ class Adapter {
|
|
|
213
192
|
dependencies.rateLimiter = new rate_limiting_1.SimpleCountingRateLimiter().initialize(this.endpoints, rateLimitingTier);
|
|
214
193
|
}
|
|
215
194
|
if (!dependencies.subscriptionSetFactory) {
|
|
216
|
-
dependencies.subscriptionSetFactory = new util_1.SubscriptionSetFactory(this.config, this.name, dependencies.redisClient);
|
|
195
|
+
dependencies.subscriptionSetFactory = new util_1.SubscriptionSetFactory(this.config.settings, this.name, dependencies.redisClient);
|
|
217
196
|
}
|
|
218
197
|
if (!dependencies.requester) {
|
|
219
|
-
dependencies.requester = new requester_1.Requester(dependencies.rateLimiter, this.config);
|
|
198
|
+
dependencies.requester = new requester_1.Requester(dependencies.rateLimiter, this.config.settings);
|
|
220
199
|
}
|
|
221
200
|
return dependencies;
|
|
222
201
|
}
|
|
@@ -229,8 +208,9 @@ class Adapter {
|
|
|
229
208
|
async findResponseInCache(req) {
|
|
230
209
|
const response = await this.dependencies.cache.get(req.requestContext.cacheKey);
|
|
231
210
|
if (response) {
|
|
232
|
-
if (this.config.METRICS_ENABLED &&
|
|
233
|
-
|
|
211
|
+
if (this.config.settings.METRICS_ENABLED &&
|
|
212
|
+
this.config.settings.EXPERIMENTAL_METRICS_ENABLED) {
|
|
213
|
+
const label = (0, metrics_1.cacheMetricsLabel)(req.requestContext.cacheKey, req.requestContext.meta?.metrics?.feedId || 'N/A', this.config.settings.CACHE_TYPE);
|
|
234
214
|
// Record cache staleness and cache get count and value
|
|
235
215
|
const now = Date.now();
|
|
236
216
|
(0, metrics_1.cacheGet)(label, response.result, {
|
|
@@ -257,7 +237,7 @@ class Adapter {
|
|
|
257
237
|
async handleRequest(req, replySent) {
|
|
258
238
|
// Get transport, must be here because it's already checked in the validator
|
|
259
239
|
const endpoint = this.endpointsMap[req.requestContext.endpointName];
|
|
260
|
-
const transport = endpoint.
|
|
240
|
+
const transport = endpoint.transportRoutes.get(req.requestContext.transportName);
|
|
261
241
|
// First try to find the response in our cache, keep it ready
|
|
262
242
|
const cachedResponse = await this.findResponseInCache(req);
|
|
263
243
|
// Next we fire off the transport's registration of the request if defined, regardless of if we already have a cached response.
|
|
@@ -275,7 +255,7 @@ class Adapter {
|
|
|
275
255
|
// `await` is required to catch the error, you'll get an unhandled promise rejection otherwise
|
|
276
256
|
// Disable non-null assertion operator because we already checked for the existence of registerRequest
|
|
277
257
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
278
|
-
return await transport.registerRequest(req, this.config);
|
|
258
|
+
return await transport.registerRequest(req, this.config.settings);
|
|
279
259
|
}
|
|
280
260
|
catch (err) {
|
|
281
261
|
logger.error(`Error registering request: ${err}`);
|
|
@@ -292,7 +272,7 @@ class Adapter {
|
|
|
292
272
|
return cachedResponse;
|
|
293
273
|
}
|
|
294
274
|
// If there was no cached response, execute the foregroundExecute if defined
|
|
295
|
-
const immediateResponse = transport.foregroundExecute && (await transport.foregroundExecute(req, this.config));
|
|
275
|
+
const immediateResponse = transport.foregroundExecute && (await transport.foregroundExecute(req, this.config.settings));
|
|
296
276
|
if (immediateResponse) {
|
|
297
277
|
logger.debug('Got immediate response from transport, sending as response');
|
|
298
278
|
return immediateResponse;
|
|
@@ -308,12 +288,12 @@ class Adapter {
|
|
|
308
288
|
// Observe the idle time taken for polling response
|
|
309
289
|
const metricsTimer = metrics_2.metrics
|
|
310
290
|
.get('transportPollingDurationSeconds')
|
|
311
|
-
.labels({
|
|
291
|
+
.labels({ adapter_endpoint: req.requestContext.endpointName })
|
|
312
292
|
.startTimer();
|
|
313
293
|
logger.debug('Transport is set up, polling cache for response...');
|
|
314
294
|
const response = await (0, cache_1.pollResponseFromCache)(this.dependencies.cache, req.requestContext.cacheKey, {
|
|
315
|
-
maxRetries: this.config.CACHE_POLLING_MAX_RETRIES,
|
|
316
|
-
sleep: this.config.CACHE_POLLING_SLEEP_MS,
|
|
295
|
+
maxRetries: this.config.settings.CACHE_POLLING_MAX_RETRIES,
|
|
296
|
+
sleep: this.config.settings.CACHE_POLLING_SLEEP_MS,
|
|
317
297
|
});
|
|
318
298
|
metricsTimer({ succeeded: String(!!response) });
|
|
319
299
|
if (response) {
|
|
@@ -323,7 +303,7 @@ class Adapter {
|
|
|
323
303
|
// Record polling mechanism failure to return response
|
|
324
304
|
metrics_2.metrics
|
|
325
305
|
.get('transportPollingFailureCount')
|
|
326
|
-
.labels({
|
|
306
|
+
.labels({ adapter_endpoint: req.requestContext.endpointName })
|
|
327
307
|
.inc();
|
|
328
308
|
logger.debug('Ran out of polling attempts, returning timeout');
|
|
329
309
|
throw new error_1.AdapterTimeoutError({
|
package/adapter/basic.js.map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L,yLAAyL;YAC3L,UAAU,EAAE,GAAG;SAChB,CAAC,CAAA;IACJ,CAAC;CACF;AA5ZD,0BA4ZC"}
|
package/adapter/endpoint.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Transport } from '../transports';
|
|
1
|
+
import { TransportRoutes } from '../transports';
|
|
3
2
|
import { AdapterRequest } from '../util';
|
|
4
3
|
import { SpecificInputParameters } from '../validation';
|
|
5
4
|
import { InputValidator } from '../validation/input-validator';
|
|
6
5
|
import { AdapterDependencies, AdapterEndpointInterface, AdapterEndpointParams, CustomInputValidator, EndpointGenerics, EndpointRateLimitingConfig, RequestTransform } from './types';
|
|
6
|
+
export declare const DEFAULT_TRANSPORT_NAME = "default_single_transport";
|
|
7
7
|
/**
|
|
8
8
|
* Main class to represent an endpoint within an External Adapter
|
|
9
9
|
*/
|
|
10
10
|
export declare class AdapterEndpoint<T extends EndpointGenerics> implements AdapterEndpointInterface<T> {
|
|
11
11
|
name: string;
|
|
12
12
|
aliases?: string[] | undefined;
|
|
13
|
-
|
|
13
|
+
transportRoutes: TransportRoutes<T>;
|
|
14
14
|
inputParameters: SpecificInputParameters<T['Request']['Params']>;
|
|
15
15
|
rateLimiting?: EndpointRateLimitingConfig | undefined;
|
|
16
16
|
validator: InputValidator;
|
|
@@ -18,16 +18,16 @@ export declare class AdapterEndpoint<T extends EndpointGenerics> implements Adap
|
|
|
18
18
|
customInputValidation?: CustomInputValidator<T>;
|
|
19
19
|
requestTransforms?: RequestTransform<T>[];
|
|
20
20
|
overrides?: Record<string, string> | undefined;
|
|
21
|
-
customRouter?: (req: AdapterRequest<T['Request']>,
|
|
21
|
+
customRouter?: (req: AdapterRequest<T['Request']>, settings: T['Settings']) => string;
|
|
22
22
|
defaultTransport?: string;
|
|
23
23
|
constructor(params: AdapterEndpointParams<T>);
|
|
24
24
|
/**
|
|
25
25
|
* Performs all necessary initialization processes that are async or need async initialized dependencies
|
|
26
26
|
*
|
|
27
27
|
* @param dependencies - all dependencies initialized at the adapter level
|
|
28
|
-
* @param
|
|
28
|
+
* @param adapterSettings - configuration for the adapter
|
|
29
29
|
*/
|
|
30
|
-
initialize(adapterName: string, dependencies: AdapterDependencies,
|
|
30
|
+
initialize(adapterName: string, dependencies: AdapterDependencies, adapterSettings: T['Settings']): Promise<void>;
|
|
31
31
|
/**
|
|
32
32
|
* Takes the incoming request and applies all request transforms in the adapter
|
|
33
33
|
*
|
|
@@ -43,7 +43,7 @@ export declare class AdapterEndpoint<T extends EndpointGenerics> implements Adap
|
|
|
43
43
|
* @returns the modified (or new) request
|
|
44
44
|
*/
|
|
45
45
|
symbolOverrider(req: AdapterRequest): AdapterRequest<import("../util").RequestGenerics>;
|
|
46
|
-
getTransportNameForRequest(req: AdapterRequest<T['Request']>,
|
|
46
|
+
getTransportNameForRequest(req: AdapterRequest<T['Request']>, settings: T['Settings']): string;
|
|
47
47
|
/**
|
|
48
48
|
* Default routing strategy. Will try and use the transport input parameter if present in the request body.
|
|
49
49
|
*
|
package/adapter/endpoint.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AdapterEndpoint = void 0;
|
|
3
|
+
exports.AdapterEndpoint = exports.DEFAULT_TRANSPORT_NAME = void 0;
|
|
4
4
|
const response_1 = require("../cache/response");
|
|
5
|
+
const transports_1 = require("../transports");
|
|
5
6
|
const util_1 = require("../util");
|
|
6
7
|
const error_1 = require("../validation/error");
|
|
7
8
|
const input_validator_1 = require("../validation/input-validator");
|
|
8
9
|
const logger = (0, util_1.makeLogger)('AdapterEndpoint');
|
|
9
|
-
|
|
10
|
+
exports.DEFAULT_TRANSPORT_NAME = 'default_single_transport';
|
|
10
11
|
/**
|
|
11
12
|
* Main class to represent an endpoint within an External Adapter
|
|
12
13
|
*/
|
|
@@ -15,22 +16,13 @@ class AdapterEndpoint {
|
|
|
15
16
|
this.name = params.name;
|
|
16
17
|
this.aliases = params.aliases;
|
|
17
18
|
// These ifs are annoying but it's to make it type safe
|
|
18
|
-
if ('
|
|
19
|
-
this.
|
|
19
|
+
if ('transportRoutes' in params) {
|
|
20
|
+
this.transportRoutes = params.transportRoutes;
|
|
20
21
|
this.customRouter = params.customRouter;
|
|
21
22
|
this.defaultTransport = params.defaultTransport;
|
|
22
|
-
// Validate transport names
|
|
23
|
-
for (const transportName in this.transports) {
|
|
24
|
-
// This is intentional, to keep names to one word only
|
|
25
|
-
if (!/^[a-z]+$/.test(transportName)) {
|
|
26
|
-
throw new Error(`Transport name "${transportName}" is invalid. Names in the AdapterEndpoint transports map can only include lowercase letters.`);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
23
|
}
|
|
30
24
|
else {
|
|
31
|
-
this.
|
|
32
|
-
[DEFAULT_TRANSPORT_NAME]: params.transport,
|
|
33
|
-
};
|
|
25
|
+
this.transportRoutes = new transports_1.TransportRoutes().register(exports.DEFAULT_TRANSPORT_NAME, params.transport);
|
|
34
26
|
}
|
|
35
27
|
this.inputParameters = params.inputParameters;
|
|
36
28
|
this.rateLimiting = params.rateLimiting;
|
|
@@ -44,12 +36,12 @@ class AdapterEndpoint {
|
|
|
44
36
|
* Performs all necessary initialization processes that are async or need async initialized dependencies
|
|
45
37
|
*
|
|
46
38
|
* @param dependencies - all dependencies initialized at the adapter level
|
|
47
|
-
* @param
|
|
39
|
+
* @param adapterSettings - configuration for the adapter
|
|
48
40
|
*/
|
|
49
|
-
async initialize(adapterName, dependencies,
|
|
41
|
+
async initialize(adapterName, dependencies, adapterSettings) {
|
|
50
42
|
const responseCache = new response_1.ResponseCache({
|
|
51
43
|
dependencies,
|
|
52
|
-
|
|
44
|
+
adapterSettings: adapterSettings,
|
|
53
45
|
adapterName,
|
|
54
46
|
endpointName: this.name,
|
|
55
47
|
inputParameters: this.inputParameters,
|
|
@@ -59,8 +51,8 @@ class AdapterEndpoint {
|
|
|
59
51
|
responseCache,
|
|
60
52
|
};
|
|
61
53
|
logger.debug(`Initializing transports for endpoint "${this.name}"...`);
|
|
62
|
-
for (const [transportName, transport] of
|
|
63
|
-
await transport.initialize(transportDependencies,
|
|
54
|
+
for (const [transportName, transport] of this.transportRoutes.entries()) {
|
|
55
|
+
await transport.initialize(transportDependencies, adapterSettings, this.name, transportName);
|
|
64
56
|
}
|
|
65
57
|
}
|
|
66
58
|
/**
|
|
@@ -98,16 +90,16 @@ class AdapterEndpoint {
|
|
|
98
90
|
}
|
|
99
91
|
return req;
|
|
100
92
|
}
|
|
101
|
-
getTransportNameForRequest(req,
|
|
93
|
+
getTransportNameForRequest(req, settings) {
|
|
102
94
|
// If there's only one transport, return it
|
|
103
|
-
if (this.
|
|
104
|
-
return DEFAULT_TRANSPORT_NAME;
|
|
95
|
+
if (this.transportRoutes.get(exports.DEFAULT_TRANSPORT_NAME)) {
|
|
96
|
+
return exports.DEFAULT_TRANSPORT_NAME;
|
|
105
97
|
}
|
|
106
98
|
// Attempt to get the transport to use from:
|
|
107
99
|
// 1. Custom router (whatever logic the user wrote)
|
|
108
100
|
// 2. Default router (try to get it from the input params)
|
|
109
101
|
// 3. Default transport (if it was specified in the instance params)
|
|
110
|
-
const rawTransportName = (this.customRouter && this.customRouter(req,
|
|
102
|
+
const rawTransportName = (this.customRouter && this.customRouter(req, settings)) ||
|
|
111
103
|
this.defaultRouter(req) ||
|
|
112
104
|
this.defaultTransport;
|
|
113
105
|
if (!rawTransportName) {
|
|
@@ -117,10 +109,10 @@ class AdapterEndpoint {
|
|
|
117
109
|
});
|
|
118
110
|
}
|
|
119
111
|
const transportName = rawTransportName.toLowerCase();
|
|
120
|
-
if (!this.
|
|
112
|
+
if (!this.transportRoutes.get(transportName)) {
|
|
121
113
|
throw new error_1.AdapterError({
|
|
122
114
|
statusCode: 400,
|
|
123
|
-
message: `No transport found for key "${transportName}", must be one of ${JSON.stringify(
|
|
115
|
+
message: `No transport found for key "${transportName}", must be one of ${JSON.stringify(this.transportRoutes.routeNames())}`,
|
|
124
116
|
});
|
|
125
117
|
}
|
|
126
118
|
logger.debug(`Request will be routed to transport "${transportName}"`);
|
package/adapter/endpoint.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"endpoint.js","sourceRoot":"","sources":["../../../src/adapter/endpoint.ts"],"names":[],"mappings":";;;AAAA,gDAAiD;
|
|
1
|
+
{"version":3,"file":"endpoint.js","sourceRoot":"","sources":["../../../src/adapter/endpoint.ts"],"names":[],"mappings":";;;AAAA,gDAAiD;AAEjD,8CAA+C;AAC/C,kCAAwE;AAExE,+CAAkD;AAClD,mEAA8D;AAY9D,MAAM,MAAM,GAAG,IAAA,iBAAU,EAAC,iBAAiB,CAAC,CAAA;AAC/B,QAAA,sBAAsB,GAAG,0BAA0B,CAAA;AAEhE;;GAEG;AACH,MAAa,eAAe;IAc1B,YAAY,MAAgC;QAC1C,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAA;QACvB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAA;QAC7B,uDAAuD;QACvD,IAAI,iBAAiB,IAAI,MAAM,EAAE;YAC/B,IAAI,CAAC,eAAe,GAAG,MAAM,CAAC,eAAe,CAAA;YAC7C,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC,YAAY,CAAA;YACvC,IAAI,CAAC,gBAAgB,GAAG,MAAM,CAAC,gBAAgB,CAAA;SAChD;aAAM;YACL,IAAI,CAAC,eAAe,GAAG,IAAI,4BAAe,EAAK,CAAC,QAAQ,CACtD,8BAAsB,EACtB,MAAM,CAAC,SAAS,CACjB,CAAA;SACF;QAED,IAAI,CAAC,eAAe,GAAG,MAAM,CAAC,eAAe,CAAA;QAC7C,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC,YAAY,CAAA;QACvC,IAAI,CAAC,SAAS,GAAG,IAAI,gCAAc,CAAC,IAAI,CAAC,eAAe,CAAC,CAAA;QACzD,IAAI,CAAC,iBAAiB,GAAG,M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,CAAC,EAAE;YAC5C,MAAM,IAAI,oBAAY,CAAC;gBACrB,UAAU,EAAE,GAAG;gBACf,OAAO,EAAE,+BAA+B,aAAa,qBAAqB,IAAI,CAAC,SAAS,CACtF,IAAI,CAAC,eAAe,CAAC,UAAU,EAAE,CAClC,EAAE;aACJ,CAAC,CAAA;SACH;QAED,MAAM,CAAC,KAAK,CAAC,wCAAwC,aAAa,GAAG,CAAC,CAAA;QACtE,OAAO,aAAa,CAAA;IACtB,CAAC;IAED;;;;;OAKG;IACK,aAAa,CAAC,GAAiC;QACrD,MAAM,cAAc,GAAG,GAAG,CAAC,IAA+C,CAAA;QAC1E,OAAO,cAAc,CAAC,IAAI,EAAE,SAAS,CAAA;IACvC,CAAC;CACF;AAzJD,0CAyJC"}
|
package/adapter/price.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SettingsDefinitionMap } from '../config';
|
|
2
2
|
import { AdapterRequest, AdapterRequestContext, AdapterResponse, RequestGenerics } from '../util';
|
|
3
3
|
import { AdapterEndpoint } from './endpoint';
|
|
4
4
|
import { Adapter, AdapterEndpointParams, AdapterParams, PriceEndpointGenerics } from './index';
|
|
@@ -65,9 +65,9 @@ type PriceAdapterRequest<T extends RequestGenerics> = AdapterRequest<T> & {
|
|
|
65
65
|
/**
|
|
66
66
|
* A PriceAdapter is a specific kind of Adapter that includes at least one PriceEnpoint.
|
|
67
67
|
*/
|
|
68
|
-
export declare class PriceAdapter<
|
|
68
|
+
export declare class PriceAdapter<CustomSettingsDefinition extends SettingsDefinitionMap> extends Adapter<CustomSettingsDefinition> {
|
|
69
69
|
includesMap?: IncludesMap;
|
|
70
|
-
constructor(params: AdapterParams<
|
|
70
|
+
constructor(params: AdapterParams<CustomSettingsDefinition> & {
|
|
71
71
|
includes?: IncludesFile;
|
|
72
72
|
});
|
|
73
73
|
handleRequest(req: PriceAdapterRequest<{
|
package/adapter/price.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"price.js","sourceRoot":"","sources":["../../../src/adapter/price.ts"],"names":[],"mappings":";;;AAEA,yCAA4C;AAC5C,mCAA8F;AAoB9F;;GAEG;AACU,QAAA,4BAA4B,GAAiC;IACxE,IAAI,EAAE;QACJ,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;QACzB,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,gDAAgD;QAC7D,QAAQ,EAAE,IAAI;KACf;IACD,KAAK,EAAE;QACL,OAAO,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC;QACzB,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,0CAA0C;QACvD,QAAQ,EAAE,IAAI;KACf;CACF,CAAA;AA2BD;;;GAGG;AACH,MAAa,aAA+C,SAAQ,0BAAkB;IACpF,YACE,MAEC;QAED,KAAK,CAAC,MAAM,CAAC,CAAA;IACf,CAAC;CACF;AARD,sCAQC;AAED,MAAM,gBAAgB,GAAG,CAAC,YAA0B,EAAE,EAAE;IACtD,MAAM,WAAW,GAAgB,EAAE,CAAA;IAEnC,KAAK,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,YAAY,EAAE;QACjD,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE;YACtB,WAAW,CAAC,IAAI,CAAC,GAAG,EAAE,CAAA;SACvB;QACD,WAAW,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAA;KACpC;IAED,OAAO,WAAW,CAAA;AACpB,CAAC,CAAA;AAUD;;GAEG;AACH,MAAa,
|
|
1
|
+
{"version":3,"file":"price.js","sourceRoot":"","sources":["../../../src/adapter/price.ts"],"names":[],"mappings":";;;AAEA,yCAA4C;AAC5C,mCAA8F;AAoB9F;;GAEG;AACU,QAAA,4BAA4B,GAAiC;IACxE,IAAI,EAAE;QACJ,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;QACzB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I,CAAC,MAAM,GAAG,aAAa,CAAA;aAC5B;YACD,OAAO,aAAa,CAAA;SACrB;QAED,OAAO,QAAQ,CAAA;IACjB,CAAC;CACF;AAtED,oCAsEC;AAED,MAAM,eAAe,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;AAE3C;;;GAGG;AACH,MAAa,mBAAqD,SAAQ,aAAgB;IACxF,YACE,MAEC;QAED,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE;YACnB,MAAM,CAAC,OAAO,GAAG,EAAE,CAAA;SACpB;QACD,KAAK,MAAM,KAAK,IAAI,eAAe,EAAE;YACnC,IAAI,MAAM,CAAC,IAAI,KAAK,KAAK,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;gBAC5D,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;aAC3B;SACF;QAED,KAAK,CAAC,MAAM,CAAC,CAAA;IACf,CAAC;CACF;AAjBD,kDAiBC"}
|
package/adapter/types.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import type EventSource from 'eventsource';
|
|
2
2
|
import Redis from 'ioredis';
|
|
3
3
|
import { Cache } from '../cache';
|
|
4
|
-
import { AdapterConfig,
|
|
4
|
+
import { AdapterConfig, BaseAdapterSettings, SettingsDefinitionMap } from '../config';
|
|
5
5
|
import { AdapterRateLimitTier, RateLimiter } from '../rate-limiting';
|
|
6
|
-
import { Transport, TransportGenerics } from '../transports';
|
|
6
|
+
import { Transport, TransportGenerics, TransportRoutes } from '../transports';
|
|
7
7
|
import { AdapterRequest, SingleNumberResultResponse, SubscriptionSetFactory } from '../util';
|
|
8
8
|
import { Requester } from '../util/requester';
|
|
9
9
|
import { InputParameters, SpecificInputParameters } from '../validation';
|
|
10
10
|
import { AdapterError } from '../validation/error';
|
|
11
11
|
import { Adapter } from './basic';
|
|
12
12
|
import { AdapterEndpoint } from './endpoint';
|
|
13
|
-
export type CustomAdapterSettings =
|
|
13
|
+
export type CustomAdapterSettings = SettingsDefinitionMap & NegatedAdapterSettings;
|
|
14
14
|
type NegatedAdapterSettings = {
|
|
15
|
-
[K in keyof
|
|
15
|
+
[K in keyof BaseAdapterSettings]?: never;
|
|
16
16
|
};
|
|
17
17
|
/**
|
|
18
18
|
* Dependencies that will be injected into the Adapter on startup
|
|
@@ -41,7 +41,7 @@ export interface EndpointContext<T extends EndpointGenerics> {
|
|
|
41
41
|
/** Input parameters for this endpoint */
|
|
42
42
|
inputParameters: InputParameters;
|
|
43
43
|
/** Initialized config for the adapter that the Transport can access */
|
|
44
|
-
|
|
44
|
+
adapterSettings: T['Settings'];
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
47
47
|
* Structure to describe rate limits specs for the Adapter
|
|
@@ -65,7 +65,7 @@ export type Overrides = {
|
|
|
65
65
|
/**
|
|
66
66
|
* Main structure of an External Adapter
|
|
67
67
|
*/
|
|
68
|
-
export interface AdapterParams<
|
|
68
|
+
export interface AdapterParams<CustomSettingsDefinition extends SettingsDefinitionMap> {
|
|
69
69
|
/** Name of the adapter */
|
|
70
70
|
name: Uppercase<string>;
|
|
71
71
|
/** If present, the string that will be used for requests with no specified endpoint */
|
|
@@ -80,14 +80,12 @@ export interface AdapterParams<CustomSettings extends SettingsMap> {
|
|
|
80
80
|
* then those new types wouldn't match with each other.
|
|
81
81
|
*/
|
|
82
82
|
endpoints: AdapterEndpoint<any>[];
|
|
83
|
-
/** Map of overrides to the default config values for an Adapter */
|
|
84
|
-
envDefaultOverrides?: Partial<BaseAdapterConfig>;
|
|
85
|
-
/** List of custom env vars for this particular adapter (e.g. RPC_URL) */
|
|
86
|
-
customSettings?: SettingsMap;
|
|
87
83
|
/** Configuration relevant to outbound (EA --\> DP) communication rate limiting */
|
|
88
84
|
rateLimiting?: AdapterRateLimitingConfig;
|
|
89
85
|
/** Bootstrap function that will run when initializing the adapter */
|
|
90
|
-
bootstrap?: (adapter: Adapter<
|
|
86
|
+
bootstrap?: (adapter: Adapter<CustomSettingsDefinition>) => Promise<void>;
|
|
87
|
+
/** The custom [[AdapterConfig]] to use. If not provided, the default configuration will be used instead */
|
|
88
|
+
config?: AdapterConfig<CustomSettingsDefinition>;
|
|
91
89
|
}
|
|
92
90
|
/**
|
|
93
91
|
* Structure to describe rate limits specs for a specific adapter endpoint
|
|
@@ -110,7 +108,7 @@ export type EndpointGenerics = TransportGenerics;
|
|
|
110
108
|
export type PriceEndpointGenerics = TransportGenerics & {
|
|
111
109
|
Response: SingleNumberResultResponse;
|
|
112
110
|
};
|
|
113
|
-
export type CustomInputValidator<T extends EndpointGenerics> = (input: AdapterRequest<T['Request']>,
|
|
111
|
+
export type CustomInputValidator<T extends EndpointGenerics> = (input: AdapterRequest<T['Request']>, adapterSettings: T['Settings']) => AdapterError | undefined;
|
|
114
112
|
/**
|
|
115
113
|
* Structure to describe a specific endpoint in an [[Adapter]]
|
|
116
114
|
*/
|
|
@@ -138,9 +136,9 @@ type SingleTransportAdapterEndpointParams<T extends EndpointGenerics> = {
|
|
|
138
136
|
};
|
|
139
137
|
type MultiTransportAdapterEndpointParams<T extends EndpointGenerics> = {
|
|
140
138
|
/** Map of transports that will be used when routing the request through this endpoint */
|
|
141
|
-
|
|
139
|
+
transportRoutes: TransportRoutes<T>;
|
|
142
140
|
/** Custom function to direct an incoming request to the appropriate transport from the transports map */
|
|
143
|
-
customRouter?: (req: AdapterRequest<T['Request']>,
|
|
141
|
+
customRouter?: (req: AdapterRequest<T['Request']>, settings: T['Settings']) => string;
|
|
144
142
|
/** If no value is returned from the custom router or the default (transport param), which transport to use */
|
|
145
143
|
defaultTransport?: string;
|
|
146
144
|
};
|