@chainlink/external-adapter-framework 0.0.58 → 0.0.59
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/cache/metrics.js +0 -3
- package/package.json +2 -2
- package/transports/index.js +0 -4
- package/util/logger.js +3 -3
- 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/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
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chainlink/external-adapter-framework",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.59",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"ajv": "^8.11.0",
|
|
8
7
|
"axios": "^0.27.2",
|
|
9
8
|
"eventsource": "^2.0.2",
|
|
10
9
|
"fastify": "^4.5.3",
|
|
@@ -35,6 +34,7 @@
|
|
|
35
34
|
"@types/ws": "^8.5.3",
|
|
36
35
|
"@typescript-eslint/eslint-plugin": "^5.17.0",
|
|
37
36
|
"@typescript-eslint/parser": "^5.17.0",
|
|
37
|
+
"ajv": "^8.11.0",
|
|
38
38
|
"ava": "^4.2.0",
|
|
39
39
|
"c8": "^7.11.2",
|
|
40
40
|
"eslint": "^8.14.0",
|
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/util/logger.js
CHANGED
|
@@ -15,7 +15,7 @@ const debugTransport = {
|
|
|
15
15
|
options: {
|
|
16
16
|
levelFirst: true,
|
|
17
17
|
levelLabel: 'level',
|
|
18
|
-
ignore: 'layer,pid,hostname',
|
|
18
|
+
ignore: 'layer,pid,hostname,correlationId',
|
|
19
19
|
messageFormat: '[{correlationId}][{layer}] {msg}',
|
|
20
20
|
translateTime: 'yyyy-mm-dd HH:MM:ss.l',
|
|
21
21
|
},
|
|
@@ -31,7 +31,7 @@ const baseLogger = (0, pino_1.default)({
|
|
|
31
31
|
},
|
|
32
32
|
},
|
|
33
33
|
mixin() {
|
|
34
|
-
if (process.env['CORRELATION_ID_ENABLED']
|
|
34
|
+
if (process.env['CORRELATION_ID_ENABLED'] !== 'false') {
|
|
35
35
|
const store = exports.asyncLocalStorage.getStore();
|
|
36
36
|
if (store) {
|
|
37
37
|
return store;
|
|
@@ -77,5 +77,5 @@ function censor(obj, censorList) {
|
|
|
77
77
|
censorList.forEach((entry) => {
|
|
78
78
|
stringified = stringified.replace(entry.value, `[${entry.key} REDACTED]`);
|
|
79
79
|
});
|
|
80
|
-
return stringified;
|
|
80
|
+
return JSON.parse(stringified);
|
|
81
81
|
}
|
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;
|