@chainlink/external-adapter-framework 0.0.58 → 0.0.60
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 +6 -0
- package/cache/metrics.js +0 -3
- package/package.json +1 -1
- package/transports/index.js +0 -4
- package/validation/index.js +1 -3
- package/validation/input-validator.d.ts +1 -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
|
@@ -35,7 +35,13 @@ const util_1 = require("./util");
|
|
|
35
35
|
const censor_list_1 = __importDefault(require("./util/censor/censor-list"));
|
|
36
36
|
const cacheMetrics = __importStar(require("./cache/metrics"));
|
|
37
37
|
const input_validator_1 = require("./validation/input-validator");
|
|
38
|
+
const client = __importStar(require("prom-client"));
|
|
38
39
|
const logger = (0, util_1.makeLogger)('Adapter');
|
|
40
|
+
/**
|
|
41
|
+
* `prom-client` is shared between v2 and v3 when both are dependencies, resulting in metric collision errors
|
|
42
|
+
* Clearing metrics on import will wipe v2's existing register so we can replace them with v3's metrics
|
|
43
|
+
**/
|
|
44
|
+
client.register.clear();
|
|
39
45
|
class AdapterEndpoint {
|
|
40
46
|
constructor(params) {
|
|
41
47
|
this.name = params.name;
|
package/cache/metrics.js
CHANGED
|
@@ -73,9 +73,6 @@ 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
|
-
}
|
|
79
76
|
const cacheDataGetCount = new client.Counter({
|
|
80
77
|
name: 'cache_data_get_count',
|
|
81
78
|
help: 'A counter that increments every time a value is fetched from the cache',
|
package/package.json
CHANGED
package/transports/index.js
CHANGED
|
@@ -30,7 +30,6 @@ 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"));
|
|
34
33
|
__exportStar(require("./batch-warming"), exports);
|
|
35
34
|
__exportStar(require("./rest"), exports);
|
|
36
35
|
__exportStar(require("./websocket"), exports);
|
|
@@ -111,6 +110,3 @@ const buildTransportHandler = (adapter) => async (req, reply) => {
|
|
|
111
110
|
return reply.send();
|
|
112
111
|
};
|
|
113
112
|
exports.buildTransportHandler = buildTransportHandler;
|
|
114
|
-
if (process.env['METRICS_ENABLED'] === 'false') {
|
|
115
|
-
client.register.clear();
|
|
116
|
-
}
|
package/validation/index.js
CHANGED
|
@@ -40,9 +40,7 @@ const validatorMiddleware = (adapter) => (req, reply, done) => {
|
|
|
40
40
|
statusCode: 404,
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
|
-
const validatedData = endpoint.validator
|
|
44
|
-
? endpoint.validator.validateInput(req.body?.['data'])
|
|
45
|
-
: req.body?.['data'];
|
|
43
|
+
const validatedData = endpoint.validator.validateInput(req.body?.['data']);
|
|
46
44
|
req.requestContext = {
|
|
47
45
|
cacheKey: '',
|
|
48
46
|
data: validatedData,
|
|
@@ -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: Record<string, unknown>): NormalizedInput;
|
|
8
8
|
private initializeInputs;
|
|
9
9
|
private validateInputParamsSchema;
|
|
10
10
|
private validateRequiredConfig;
|