@chainlink/external-adapter-framework 0.0.55 → 0.0.57
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.d.ts +1 -1
- package/adapter.js +0 -1
- package/background-executor.js +0 -1
- package/cache/factory.js +0 -1
- package/cache/index.js +0 -1
- package/cache/local.js +0 -1
- package/cache/metrics.js +3 -1
- package/cache/redis.js +0 -1
- package/config/index.d.ts +1 -1
- package/config/index.js +0 -1
- package/config/provider-limits.js +0 -1
- package/examples/bank-frick/accounts.js +0 -1
- package/examples/bank-frick/config/index.d.ts +1 -1
- package/examples/bank-frick/config/index.js +0 -1
- package/examples/bank-frick/index.js +0 -1
- package/examples/bank-frick/util.js +0 -1
- package/examples/coingecko/src/config/index.js +0 -1
- package/examples/coingecko/src/crypto-utils.js +0 -1
- package/examples/coingecko/src/endpoint/coins.js +0 -1
- package/examples/coingecko/src/endpoint/crypto-marketcap.js +0 -1
- package/examples/coingecko/src/endpoint/crypto-volume.js +0 -1
- package/examples/coingecko/src/endpoint/crypto.js +0 -1
- package/examples/coingecko/src/endpoint/dominance.js +0 -1
- package/examples/coingecko/src/endpoint/global-marketcap.js +0 -1
- package/examples/coingecko/src/endpoint/index.js +0 -1
- package/examples/coingecko/src/global-utils.d.ts +1 -1
- package/examples/coingecko/src/global-utils.js +0 -1
- package/examples/coingecko/src/index.d.ts +1 -1
- package/examples/coingecko/src/index.js +0 -1
- package/examples/coingecko-old/batch-warming.js +0 -1
- package/examples/coingecko-old/index.js +0 -1
- package/examples/coingecko-old/rest.js +0 -1
- package/examples/genesis/config/index.js +0 -1
- package/examples/genesis/index.js +0 -1
- package/examples/genesis/sseStream.js +0 -1
- package/examples/ncfx/config/index.js +0 -1
- package/examples/ncfx/index.js +0 -1
- package/examples/ncfx/websocket.js +0 -1
- package/index.d.ts +1 -1
- package/index.js +0 -1
- package/metrics/constants.js +0 -1
- package/metrics/index.js +0 -1
- package/metrics/util.js +0 -1
- package/package.json +1 -1
- package/rate-limiting/background/fixed-frequency.js +0 -1
- package/rate-limiting/index.d.ts +2 -2
- package/rate-limiting/index.js +0 -1
- package/rate-limiting/metrics.js +0 -1
- package/rate-limiting/request/simple-counting.js +0 -1
- package/transports/batch-warming.js +0 -1
- package/transports/index.js +4 -1
- package/transports/metrics.d.ts +1 -1
- package/transports/metrics.js +0 -1
- package/transports/rest.js +0 -1
- package/transports/sse.js +0 -1
- package/transports/util.js +0 -1
- package/transports/websocket.js +0 -1
- package/util/censor/censor-list.js +0 -1
- package/util/index.js +0 -1
- package/util/logger.js +0 -1
- package/util/request.js +0 -1
- package/util/subscription-set/expiring-sorted-set.js +0 -1
- package/util/subscription-set/redis-sorted-set.js +0 -1
- package/util/subscription-set/subscription-set.js +0 -1
- package/util/test-payload-loader.js +0 -1
- package/validation/error.js +0 -1
- package/validation/index.js +3 -2
- package/validation/input-params.js +0 -1
- package/validation/input-validator.d.ts +1 -1
- package/validation/input-validator.js +0 -1
- package/validation/override-functions.js +0 -1
package/adapter.d.ts
CHANGED
|
@@ -100,7 +100,7 @@ export declare class AdapterEndpoint<Params, Result, CustomSettings extends Sett
|
|
|
100
100
|
transport: Transport<Params, Result, CustomSettings>;
|
|
101
101
|
inputParameters: InputParameters;
|
|
102
102
|
rateLimiting?: EndpointRateLimitingConfig | undefined;
|
|
103
|
-
validator
|
|
103
|
+
validator?: InputValidator;
|
|
104
104
|
constructor(params: AdapterEndpointParams<Params, Result, CustomSettings>);
|
|
105
105
|
}
|
|
106
106
|
declare type CustomAdapterSettings = SettingsMap & NegatedAdapterSettings;
|
package/adapter.js
CHANGED
package/background-executor.js
CHANGED
package/cache/factory.js
CHANGED
package/cache/index.js
CHANGED
package/cache/local.js
CHANGED
package/cache/metrics.js
CHANGED
|
@@ -73,6 +73,9 @@ const baseLabels = [
|
|
|
73
73
|
// labelNames: [...baseLabels, 'cache_hit'] as const,
|
|
74
74
|
// buckets: [0.01, 0.1, 1, 10],
|
|
75
75
|
// })
|
|
76
|
+
if (process.env['METRICS_ENABLED'] === 'false') {
|
|
77
|
+
client.register.clear();
|
|
78
|
+
}
|
|
76
79
|
const cacheDataGetCount = new client.Counter({
|
|
77
80
|
name: 'cache_data_get_count',
|
|
78
81
|
help: 'A counter that increments every time a value is fetched from the cache',
|
|
@@ -118,4 +121,3 @@ exports.cacheWarmerCount = new client.Gauge({
|
|
|
118
121
|
help: 'The number of cache warmers running',
|
|
119
122
|
labelNames: ['isBatched'],
|
|
120
123
|
});
|
|
121
|
-
//# sourceMappingURL=metrics.js.map
|
package/cache/redis.js
CHANGED
package/config/index.d.ts
CHANGED
|
@@ -191,7 +191,7 @@ export declare const BaseSettings: {
|
|
|
191
191
|
readonly description: "Maximum amount of characters that the common part of the cache key or feed ID can have";
|
|
192
192
|
readonly type: "number";
|
|
193
193
|
readonly default: 300;
|
|
194
|
-
readonly validate: (value?: number
|
|
194
|
+
readonly validate: (value?: number) => "MAX_COMMON_KEY_SIZE must be a number between 150 and 500" | undefined;
|
|
195
195
|
};
|
|
196
196
|
readonly REST_TRANSPORT_MAX_RATE_LIMIT_RETRIES: {
|
|
197
197
|
readonly description: "Maximum amount of times the Rest Transport will attempt to set up a request when blocked by the rate limiter";
|
package/config/index.js
CHANGED
|
@@ -6,7 +6,7 @@ export declare const customSettings: {
|
|
|
6
6
|
readonly type: "number";
|
|
7
7
|
readonly required: false;
|
|
8
8
|
readonly default: 500;
|
|
9
|
-
readonly validate: (value?: number
|
|
9
|
+
readonly validate: (value?: number) => string | undefined;
|
|
10
10
|
};
|
|
11
11
|
readonly PRIVATE_KEY: {
|
|
12
12
|
readonly description: "";
|
|
@@ -3,4 +3,3 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.PRO_API_ENDPOINT = exports.DEFAULT_API_ENDPOINT = void 0;
|
|
4
4
|
exports.DEFAULT_API_ENDPOINT = 'https://api.coingecko.com/api/v3';
|
|
5
5
|
exports.PRO_API_ENDPOINT = 'https://pro-api.coingecko.com/api/v3';
|
|
6
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -13,4 +13,3 @@ var dominance_1 = require("./dominance");
|
|
|
13
13
|
Object.defineProperty(exports, "dominance", { enumerable: true, get: function () { return dominance_1.endpoint; } });
|
|
14
14
|
var crypto_volume_1 = require("./crypto-volume");
|
|
15
15
|
Object.defineProperty(exports, "cryptoVolume", { enumerable: true, get: function () { return crypto_volume_1.endpoint; } });
|
|
16
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -22,6 +22,6 @@ interface ResultEntry {
|
|
|
22
22
|
value: number;
|
|
23
23
|
params: AdapterRequestParams;
|
|
24
24
|
}
|
|
25
|
-
export declare const buildGlobalRequestBody: (apiKey?: string
|
|
25
|
+
export declare const buildGlobalRequestBody: (apiKey?: string) => AxiosRequestConfig<never>;
|
|
26
26
|
export declare const constructEntry: (res: AxiosResponse<ProviderResponseBody>, requestPayload: AdapterRequestParams, resultPath: 'total_market_cap' | 'market_cap_percentage') => ResultEntry | undefined;
|
|
27
27
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { Adapter } from '../../../../src/adapter';
|
|
3
3
|
export declare const adapter: Adapter<import("../../../config").SettingsMap>;
|
|
4
|
-
export declare const server: () => Promise<import("fastify").FastifyInstance<import("
|
|
4
|
+
export declare const server: () => Promise<import("fastify").FastifyInstance<import("fastify").RawServerDefault, import("http").IncomingMessage, import("http").ServerResponse<import("http").IncomingMessage>, import("fastify").FastifyBaseLogger, import("fastify").FastifyTypeProviderDefault> | undefined>;
|
package/examples/ncfx/index.js
CHANGED
package/index.d.ts
CHANGED
|
@@ -8,4 +8,4 @@ import { Adapter, AdapterDependencies } from './adapter';
|
|
|
8
8
|
* @param dependencies - an optional object with adapter dependencies to inject
|
|
9
9
|
* @returns a Promise that resolves to the http.Server listening for connections
|
|
10
10
|
*/
|
|
11
|
-
export declare const expose: (adapter: Adapter, dependencies?: Partial<AdapterDependencies>
|
|
11
|
+
export declare const expose: (adapter: Adapter, dependencies?: Partial<AdapterDependencies>) => Promise<FastifyInstance | undefined>;
|
package/index.js
CHANGED
package/metrics/constants.js
CHANGED
|
@@ -23,4 +23,3 @@ var HttpRequestType;
|
|
|
23
23
|
exports.MAX_FEED_ID_LENGTH = 300;
|
|
24
24
|
// We should tune these as we collect data, this is the default bucket distribution that prom comes with
|
|
25
25
|
exports.requestDurationBuckets = [0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 2.5, 5, 10];
|
|
26
|
-
//# sourceMappingURL=constants.js.map
|
package/metrics/index.js
CHANGED
package/metrics/util.js
CHANGED
package/package.json
CHANGED
package/rate-limiting/index.d.ts
CHANGED
|
@@ -44,7 +44,7 @@ export interface BackgroundExecuteRateLimiter extends RateLimiter {
|
|
|
44
44
|
* @param limits - the rate limit tier set for the adapter
|
|
45
45
|
* @returns the most restrictive of the set options, in requests per second
|
|
46
46
|
*/
|
|
47
|
-
export declare const consolidateTierLimits: (limits?: AdapterRateLimitTier
|
|
47
|
+
export declare const consolidateTierLimits: (limits?: AdapterRateLimitTier) => number;
|
|
48
48
|
/**
|
|
49
49
|
* Validates rate limiting tiers specified for the adapter, and returns the one to use.
|
|
50
50
|
*
|
|
@@ -52,5 +52,5 @@ export declare const consolidateTierLimits: (limits?: AdapterRateLimitTier | und
|
|
|
52
52
|
* @param tiers - the adapter config listing the different available API tiers
|
|
53
53
|
* @returns the specified API tier, or a default one if none are specified
|
|
54
54
|
*/
|
|
55
|
-
export declare const getRateLimitingTier: (config: AdapterConfig, tiers?: Record<string, AdapterRateLimitTier>
|
|
55
|
+
export declare const getRateLimitingTier: (config: AdapterConfig, tiers?: Record<string, AdapterRateLimitTier>) => AdapterRateLimitTier | undefined;
|
|
56
56
|
export declare const buildRateLimitTiersFromConfig: (config: AdapterConfig) => AdapterRateLimitTier | undefined;
|
package/rate-limiting/index.js
CHANGED
package/rate-limiting/metrics.js
CHANGED
package/transports/index.js
CHANGED
|
@@ -30,6 +30,7 @@ exports.buildTransportHandler = exports.buildCacheEntriesFromResults = void 0;
|
|
|
30
30
|
const cache_1 = require("../cache");
|
|
31
31
|
const util_1 = require("../util");
|
|
32
32
|
const transportMetrics = __importStar(require("./metrics"));
|
|
33
|
+
const client = __importStar(require("prom-client"));
|
|
33
34
|
__exportStar(require("./batch-warming"), exports);
|
|
34
35
|
__exportStar(require("./rest"), exports);
|
|
35
36
|
__exportStar(require("./websocket"), exports);
|
|
@@ -110,4 +111,6 @@ const buildTransportHandler = (adapter) => async (req, reply) => {
|
|
|
110
111
|
return reply.send();
|
|
111
112
|
};
|
|
112
113
|
exports.buildTransportHandler = buildTransportHandler;
|
|
113
|
-
|
|
114
|
+
if (process.env['METRICS_ENABLED'] === 'false') {
|
|
115
|
+
client.register.clear();
|
|
116
|
+
}
|
package/transports/metrics.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as client from 'prom-client';
|
|
2
2
|
import { AdapterContext } from '../adapter';
|
|
3
3
|
import { SettingsMap } from '../config';
|
|
4
|
-
export declare const dataProviderMetricsLabel: (providerStatusCode?: number
|
|
4
|
+
export declare const dataProviderMetricsLabel: (providerStatusCode?: number, method?: string) => {
|
|
5
5
|
provider_status_code: number | undefined;
|
|
6
6
|
method: string;
|
|
7
7
|
};
|
package/transports/metrics.js
CHANGED
package/transports/rest.js
CHANGED
package/transports/sse.js
CHANGED
package/transports/util.js
CHANGED
package/transports/websocket.js
CHANGED
package/util/index.js
CHANGED
package/util/logger.js
CHANGED
package/util/request.js
CHANGED
package/validation/error.js
CHANGED
package/validation/index.js
CHANGED
|
@@ -40,7 +40,9 @@ const validatorMiddleware = (adapter) => (req, reply, done) => {
|
|
|
40
40
|
statusCode: 404,
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
|
-
const validatedData = endpoint.validator
|
|
43
|
+
const validatedData = endpoint.validator
|
|
44
|
+
? endpoint.validator.validateInput(req.body?.['data'])
|
|
45
|
+
: req.body?.['data'];
|
|
44
46
|
req.requestContext = {
|
|
45
47
|
cacheKey: '',
|
|
46
48
|
data: validatedData,
|
|
@@ -90,4 +92,3 @@ const errorCatchingMiddleware = (err, req, res) => {
|
|
|
90
92
|
}
|
|
91
93
|
};
|
|
92
94
|
exports.errorCatchingMiddleware = errorCatchingMiddleware;
|
|
93
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -28,4 +28,3 @@ exports.baseInputParameters = {
|
|
|
28
28
|
// Type: 'string', TODO: Once complex types are supported this could be { from: string, to: string, includes: [{ from: string, to: string, adapters: string[], inverse: boolean, tokens: boolean }] } }[]
|
|
29
29
|
},
|
|
30
30
|
};
|
|
31
|
-
//# sourceMappingURL=input-params.js.map
|
|
@@ -4,7 +4,7 @@ export declare class InputValidator {
|
|
|
4
4
|
private readonly inputConfig;
|
|
5
5
|
private aliases;
|
|
6
6
|
constructor(inputConfig: InputParameters);
|
|
7
|
-
validateInput(input:
|
|
7
|
+
validateInput(input: any): NormalizedInput;
|
|
8
8
|
private initializeInputs;
|
|
9
9
|
private validateInputParamsSchema;
|
|
10
10
|
private validateRequiredConfig;
|