@chainlink/external-adapter-framework 0.0.59 → 0.0.62
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.js +6 -0
- package/package.json +4 -4
- package/util/logger.js +3 -3
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/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chainlink/external-adapter-framework",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.62",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"dependencies": {
|
|
7
|
+
"ajv": "^8.11.0",
|
|
7
8
|
"axios": "^0.27.2",
|
|
8
9
|
"eventsource": "^2.0.2",
|
|
9
10
|
"fastify": "^4.5.3",
|
|
@@ -20,8 +21,8 @@
|
|
|
20
21
|
"generate-docs": "typedoc src/**/*.ts",
|
|
21
22
|
"lint-fix": "eslint --fix ./src && prettier --write ./src/**/*.ts ./*.{json,js,yaml}",
|
|
22
23
|
"lint": "eslint ./src && prettier --check ./src/**/*.ts ./*.{json,js,yaml}",
|
|
23
|
-
"test-debug": "LOG_LEVEL=trace DEBUG=true EA_PORT=0 c8 ava --verbose",
|
|
24
|
-
"test": "LOG_LEVEL=error EA_PORT=0 c8 ava",
|
|
24
|
+
"test-debug": "SKIP_METRICS_CLEAR=true LOG_LEVEL=trace DEBUG=true EA_PORT=0 c8 ava --verbose",
|
|
25
|
+
"test": "SKIP_METRICS_CLEAR=true LOG_LEVEL=error EA_PORT=0 c8 ava",
|
|
25
26
|
"verify": "yarn lint && yarn build && yarn build -p ./test/tsconfig.json && yarn test"
|
|
26
27
|
},
|
|
27
28
|
"devDependencies": {
|
|
@@ -34,7 +35,6 @@
|
|
|
34
35
|
"@types/ws": "^8.5.3",
|
|
35
36
|
"@typescript-eslint/eslint-plugin": "^5.17.0",
|
|
36
37
|
"@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/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',
|
|
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'] === 'true') {
|
|
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
|
|
80
|
+
return stringified;
|
|
81
81
|
}
|