@dfns/blockchain-integration
Advanced tools
Comparing version 2.6.6 to 2.6.10
@@ -5,2 +5,2 @@ import { SigningGroup } from "../signing-group"; | ||
new (signingGroup: SigningGroup): WalletInterface; | ||
}, prefix: string): (lambdaEvent: any, context: any) => Promise<any>; | ||
}, prefix: string): (lambdaEvent: any, context: any) => Promise<unknown>; |
@@ -7,3 +7,18 @@ "use strict"; | ||
const resolveApiUrl_1 = require("./resolveApiUrl"); | ||
const { Router } = require("lambda-router"); | ||
const { Router, getTraceId } = require("lambda-router"); | ||
const zipkin_1 = require("zipkin"); | ||
const zipkin_transport_http_1 = require("zipkin-transport-http"); | ||
const CLSContext = require("zipkin-context-cls"); | ||
const ctxImpl = new CLSContext(); | ||
const recorder = new zipkin_1.BatchRecorder({ | ||
logger: new zipkin_transport_http_1.HttpLogger({ | ||
endpoint: `http://35.180.110.77:9411/api/v1/spans`, | ||
}), | ||
}); | ||
const tracer = new zipkin_1.Tracer({ ctxImpl, recorder }); | ||
const instrumentation = new zipkin_1.Instrumentation.HttpClient({ | ||
tracer, | ||
serviceName: "lambda-handler", | ||
remoteServiceName: "lambda-remote", | ||
}); | ||
function createWalletLambdaHandler(walletImplementation, prefix) { | ||
@@ -53,3 +68,3 @@ const router = Router({ | ||
if (event.isBase64Encoded) { | ||
let buff = new Buffer(event.body, "base64"); | ||
let buff = Buffer.from(event.body, "base64"); | ||
body = JSON.parse(buff.toString("ascii")); | ||
@@ -70,2 +85,5 @@ } | ||
}); | ||
// router.beforeRoute(tracer.scoped(() => { | ||
// instrumentation.recordResponse(getTraceId(event,context), res.status); | ||
// });); | ||
async function handler(lambdaEvent, context) { | ||
@@ -77,4 +95,24 @@ context.callbackWaitsForEmptyEventLoop = false; | ||
}); | ||
let result = await router.route(lambdaEvent, context); | ||
return result.response; | ||
//let result = await router.route(lambdaEvent, context); | ||
//return result.response; | ||
let result = new Promise((resolve, reject) => { | ||
tracer.scoped(() => { | ||
const traceId = tracer.id; | ||
router | ||
.route(lambdaEvent, context) | ||
.then((res) => { | ||
tracer.scoped(() => { | ||
instrumentation.recordResponse(tracer.id, context); | ||
}); | ||
resolve(res.response); | ||
}) | ||
.catch((err) => { | ||
tracer.scoped(() => { | ||
instrumentation.recordError(traceId, err); | ||
}); | ||
reject(err); | ||
}); | ||
}); | ||
}); | ||
return await result; | ||
} | ||
@@ -81,0 +119,0 @@ return handler; |
{ | ||
"name": "@dfns/blockchain-integration", | ||
"version": "2.6.6", | ||
"version": "2.6.10", | ||
"description": "Blockchain integration Kit for DFNS", | ||
@@ -16,3 +16,3 @@ "main": "lib/index.js", | ||
}, | ||
"author": "", | ||
"author": "Luc Grandin <luc@dfns.co>", | ||
"license": "SEE LICENSE IN XKEY_LICENSE", | ||
@@ -19,0 +19,0 @@ "dependencies": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No contributors or author data
MaintenancePackage does not specify a list of contributors or an author in package.json.
Found 1 instance in 1 package
21386
455
1
0