Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@eventual/core-runtime

Package Overview
Dependencies
Maintainers
2
Versions
100
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@eventual/core-runtime - npm Package Compare versions

Comparing version 0.25.0 to 0.25.1

70

lib/cjs/handlers/command-worker.js

@@ -81,38 +81,40 @@ "use strict";

const shouldValidate = command.validate !== false;
// RPC route takes a POST request and passes the parsed JSON body as input to the input
router.post((0, core_1.commandRpcPath)(command), withMiddleware(async (request, context) => {
if (command.passThrough) {
// if passthrough is enabled, just proxy the request-response to the handler
return command.handler(request, context);
}
let input = await request.tryJson();
if (command.input && shouldValidate) {
try {
input = command.input.parse(input);
if (!command.passThrough) {
// RPC route takes a POST request and passes the parsed JSON body as input to the input
router.post((0, core_1.commandRpcPath)(command), withMiddleware(async (request, context) => {
if (command.passThrough) {
// if passthrough is enabled, just proxy the request-response to the handler
return command.handler(request, context);
}
catch (err) {
console.error("Invalid input", err, input);
return new core_1.HttpResponse(JSON.stringify(err), {
status: 400,
statusText: "Invalid input",
});
let input = await request.tryJson();
if (command.input && shouldValidate) {
try {
input = command.input.parse(input);
}
catch (err) {
console.error("Invalid input", err, input);
return new core_1.HttpResponse(JSON.stringify(err), {
status: 400,
statusText: "Invalid input",
});
}
}
}
let output = await command.handler(input, context);
if (command.output && shouldValidate) {
try {
output = command.output.parse(output);
let output = await command.handler(input, context);
if (command.output && shouldValidate) {
try {
output = command.output.parse(output);
}
catch (err) {
console.error("RPC output did not match schema", output, err);
return new core_1.HttpResponse(JSON.stringify(err), {
status: 500,
statusText: "RPC output did not match schema",
});
}
}
catch (err) {
console.error("RPC output did not match schema", output, err);
return new core_1.HttpResponse(JSON.stringify(err), {
status: 500,
statusText: "RPC output did not match schema",
});
}
}
return new core_1.HttpResponse(JSON.stringify(output, jsonReplacer), {
status: 200,
});
}));
return new core_1.HttpResponse(JSON.stringify(output, jsonReplac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CByZXNwb25zZSA9IGF3YWl0IHJvdXRlci5oYW5kbGUocmVxdWVzdCk7XG4gICAgICAgIGlmIChyZXNwb25zZSA9PT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgaWYgKHJlcXVlc3QubWV0aG9kID09PSBcIk9QVElPTlNcIikge1xuICAgICAgICAgICAgcmV0dXJuIG5ldyBIdHRwUmVzcG9uc2UodW5kZWZpbmVkLCB7XG4gICAgICAgICAgICAgIC8vIENPUlMgZXhwZWN0cyBhIDIwNCBvciAyMDAsIHVzaW5nIDIwNCB0byBtYXRjaCBBUEkgR2F0ZXdheVxuICAgICAgICAgICAgICAvLyBhbmQgYWNjdXJhdGVseSByZWZsZWN0IE5PIENPTlRFTlRcbiAgICAgICAgICAgICAgc3RhdHVzOiAyMDQsXG4gICAgICAgICAgICB9KTtcbiAgICAgICAgICB9XG4gICAgICAgICAgcmV0dXJuIG5ldyBIdHRwUmVzcG9uc2UoXG4gICAgICAgICAgICBgTm90IEZvdW5kOiAke3JlcXVlc3QubWV0aG9kfSAke3JlcXVlc3QudXJsfWAsXG4gICAgICAgICAgICB7XG4gICAgICAgICAgICAgIHN0YXR1czogNDA0LFxuICAgICAgICAgICAgICBzdGF0dXNUZXh0OiBcIk5vdCBGb3VuZFwiLFxuICAgICAgICAgICAgfVxuICAgICAgICAgICk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHJlc3BvbnNlO1xuICAgICAgfSBjYXRjaCAoZXJyKSB7XG4gICAgICAgIGlmIChpc0h0dHBFcnJvcihlcnIpKSB7XG4gICAgICAgICAgcmV0dXJuIG5ldyBIdHRwUmVzcG9uc2UoXG4gICAgICAgICAgICBKU09OLnN0cmluZ2lmeSh7XG4gICAgICAgICAgICAgIG1lc3NhZ2U6IGVyci5tZXNzYWdlLFxuICAgICAgICAgICAgICBkYXRhOiBlcnIuZGF0YSxcbiAgICAgICAgICAgIH0pLFxuICAgICAgICAgICAge1xuICAgICAgICAgICAgICBzdGF0dXM6IGVy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aChjb21tYW5kKSxcbiAgICAgIHdpdGhNaWRkbGV3YXJlKGFzeW5jIChyZXF1ZXN0LCBjb250ZXh0KSA9PiB7XG4gICAgICAgIGlmIChjb21tYW5kLnBhc3NUaHJvdWdoKSB7XG4gICAgICAgICAgLy8gaWYgcGFzc3Rocm91Z2ggaXMgZW5hYmxlZCwganVzdCBwcm94eSB0aGUgcmVxdWVzdC1yZXNwb25zZSB0byB0aGUgaGFuZGxlclxuICAgICAgICAgIHJldHVybiBjb21tYW5kLmhhbmRsZXIocmVxdWVzdCwgY29udGV4dCk7XG4gICAgICAgIH1cblxuICAgICAgICBsZXQgaW5wdXQ6IGFueSA9IGF3YWl0IHJlcXVlc3QudHJ5SnNvbigpO1xuICAgICAgICBpZiAoY29tbWFuZC5pbnB1dCAmJiBzaG91bGRWYWxpZGF0ZSkge1xuICAgICAgICAgIHRyeSB7XG4gICAgICAgICAgICBpbnB1dCA9IGNvbW1hbmQuaW5wdXQucGFyc2UoaW5wdXQpO1xuICAgICAgICAgIH0gY2F0Y2ggKGVycikge1xuICAgICAgICAgICAgY29uc29sZS5lcnJvcihcIkludmFsaWQgaW5wdXRcIiwgZXJyLCBpbnB1dCk7XG4gICAgICAgICAgICByZXR1cm4gbmV3IEh0dHBSZXNwb25zZShKU09OLnN0cmluZ2lmeShlcnIpLCB7XG4gICAgICAgICAgICAgIHN0YXR1czogNDAwLFxuICAgICAgICAgICAgICBzdGF0dXNUZXh0OiBcIkludmFsaWQgaW5wdXRcIixcbiAgICAgICAgICAgIH0pO1xuICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIGxldCBvdXRwdXQ6IGFueSA9IGF3YWl0IGNvbW1hbmQuaGFuZGxlcihpbnB1dCwgY29udGV4dCk7XG4gICAgICAgIGlmIChjb21tYW5kLm91dHB1dCAmJiBzaG91bGRWYWxpZGF0ZSkge1xuICAgICAgICAgIHRyeSB7XG4gICAgICAgICAgICBvdXRwdXQgPSBjb21tYW5kLm91dHB1dC5w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ICBmdW5jdGlvbiByZXNvbHZlSW5wdXQobmFtZTogc3RyaW5nLCBzcGVjOiBSZXN0UGFyYW1TcGVjKTogYW55IHtcbiAgICAgICAgICAgIGlmIChzcGVjID09PSBcImJvZHlcIikge1xuICAgICAgICAgICAgICByZXR1cm4gYm9keT8uW25hbWVdO1xuICAgICAgICAgICAgfSBlbHNlIGlmIChzcGVjID09PSBcInF1ZXJ5XCIpIHtcbiAgICAgICAgICAgICAgcmV0dXJuIHJlcXVlc3QucXVlcnk/LltuYW1lXTtcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoc3BlYyA9PT0gXCJoZWFkZXJcIikge1xuICAgICAgICAgICAgICByZXR1cm4gcmVxdWVzdC5oZWFkZXJzLmdldChuYW1lKTtcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoc3BlYyA9PT0gXCJwYXRoXCIpIHtcbiAgICAgICAgICAgICAgcmV0dXJuIHJlcXVlc3QucGFyYW1zPy5bbmFtZV07XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICByZXR1cm4gcmVzb2x2ZUlucHV0KHNwZWMubmFtZSA/PyBuYW1lLCBzcGVjLmluKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgIH0pXG4gICAgICApO1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIEFwcGxpZXMgdGhlIGNoYWluIG9mIG1pZGRsZXdhcmUgY2FsbGJhY2tzIHRvIHRoZSByZXF1ZXN0IHRvIGJ1aWxkIHVwXG4gICAgICogY29udGV4dCBhbmQgcGFzcyBpdCB0aHJvdWdoIHRoZSBjaGFpbiBhbmQgZmluYWxseSB0byB0aGUgaGFuZGxlci5cbiAgICAgKlxuICAgICAqIEVhY2ggY29udGV4dCBjYW4gYWRkIHRvIG9yIGNvbXBsZXRlbHkgcmVwbGFjZSB0aGUgY29udGV4dC4gVGhleSBjYW5cbiAgICAgKiBhbHNvIGJyZWFrIHRoZSBjaGFpbiBhdCBhbnkgdGlt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uXG4gICAqXG4gICAqIEVhY2ggd2ViaG9vayByZWdpc3RlcnMgcm91dGVzIG9uIHRoZSBjZW50cmFsIHtAbGluayByb3V0ZXJ9IHdoaWNoXG4gICAqIHRoZW4gaGFuZGxlcyB0aGUgcmVxdWVzdC5cbiAgICovXG4gIHJldHVybiBmdW5jdGlvbiAocmVxdWVzdCkge1xuICAgIGNvbnNvbGUubG9nKFwicmVxdWVzdFwiLCByZXF1ZXN0KTtcbiAgICByZXR1cm4gc2VydmljZVR5cGVTY29wZShTZXJ2aWNlVHlwZS5Db21tYW5kV29ya2VyLCBhc3luYyAoKSA9PiB7XG4gICAgICB0cnkge1xuICAgICAgICBjb25zdCByZXNwb25zZSA9IGF3YWl0IHJvdXRlci5oYW5kbGUocmVxdWVzdCk7XG4gICAgICAgIGlmIChyZXNwb25zZSA9PT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgaWYgKHJlcXVlc3QubWV0aG9kID09PSBcIk9QVElPTlNcIikge1xuICAgICAgICAgICAgcmV0dXJuIG5ldyBIdHRwUmVzcG9uc2UodW5kZWZpbmVkLCB7XG4gICAgICAgICAgICAgIC8vIENPUlMgZXhwZWN0cyBhIDIwNCBvciAyMDAsIHVzaW5nIDIwNCB0byBtYXRjaCBBUEkgR2F0ZXdheVxuICAgICAgICAgICAgICAvLyBhbmQgYWNjdXJhdGVseSByZWZsZWN0IE5PIENPTlRFTlRcbiAgICAgICAgICAgICAgc3RhdHVzOiAyMDQsXG4gICAgICAgICAgICB9KTtcbiAgICAgICAgICB9XG4gICAgICAgICAgcmV0dXJuIG5ldyBIdHRwUmVzcG9uc2UoXG4gICAgICAgICAgICBgTm90IEZvdW5kOiAke3JlcXVlc3QubWV0aG9kfSAke3JlcXVlc3QudXJsfWAsXG4gICAgICAgICAgICB7XG4gICAgICAgICAgICAgIHN0YXR1czogNDA0LFxuICAgICAgICAgICAgICBzdGF0dXNUZXh0OiBcIk5vdCBGb3VuZFwiLFxuICAgICAgICAgICAgfVxuICAgICAgICAgICk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHJlc3BvbnNlO1xuICAgICAgfSBjYXRjaCAoZXJyKSB7XG4gICAgICAgIGlmIChpc0h0dHBFcnJvcihlcnIpKSB7XG4gICAgICAgICAgcmV0dXJuIG5ldyBIdHRwUmVzcG9uc2UoXG4gICAgICAgICAgICBKU09OLnN0cmluZ2lmeSh7XG4gICAgICAgICAgICAgIG1lc3NhZ2U6IGVyci5tZXNzYWdlLFxuICAgICAgICAgICAgICBkYXRhOiBlcnIuZGF0YSxcbiAgICAgICAgICAgIH0pLFxuICAgICAgICAgICAge1xuICAgICAgICAgICAgICBzdGF0dXM6IGVyci5jb2RlLFxuICAgICAgICAgICAgfVxuICAgICAgICAgICk7XG4gICAgICAgIH0gZWxzZSBpZiAoZXJyIGluc3RhbmNlb2YgRXJyb3IpIHtcbiAgICAgICAgICBjb25zb2xlLmVycm9yKGVycik7XG4gICAgICAgICAgcmV0dXJuIG5ldyBIdHRwUmVzcG9uc2UoZXJyLm1lc3NhZ2UsIHtcbiAgICAgICAgICAgIHN0YXR1czogNTAwLFxuICAgICAgICAgICAgc3RhdHVzVGV4dDogXCJJbnRlcm5hbCBTZXJ2ZXIgRXJyb3JcIixcbiAgICAgICAgICB9KTtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICByZXR1cm4gbmV3IEh0dHBSZXNwb25zZShcIkludGVybmFsIFNlcnZlciBFcnJvclwiLCB7XG4gICAgICAgICAgICBzdGF0dXM6IDUwMCxcbiAgICAgICAgICB9KTtcbiAgICAgICAgfVxuICAgICAgfVxuICAgIH0pO1xuICB9O1xufVxuXG5mdW5jdGlvbiBpbml0Um91dGVyKCkge1xuICBjb25zdCByb3V0ZXI6IFJvdXRlciA9IGl0dHkuUm91dGVyPEh0dHBSZXF1ZXN0LCBSb3V0ZXI+KHtcbiAgICAvLyBwYXRocyBhbHdheXMgc3RhcnQgd2l0aCBzbGFzaCwgdGhlIHJvdXRlciB3aWx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yciwgaW5wdXQpO1xuICAgICAgICAgICAgICByZXR1cm4gbmV3IEh0dHBSZXNwb25zZShKU09OLnN0cmluZ2lmeShlcnIpLCB7XG4gICAgICAgICAgICAgICAgc3RhdHVzOiA0MDAsXG4gICAgICAgICAgICAgICAgc3RhdHVzVGV4dDogXCJJbnZhbGlkIGlucHV0XCIsXG4gICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cblxuICAgICAgICAgIGxldCBvdXRwdXQ6IGFueSA9IGF3YWl0IGNvbW1hbmQuaGFuZGxlcihpbnB1dCwgY29udGV4dCk7XG4gICAgICAgICAgaWYgKGNvbW1hbmQub3V0cHV0ICYmIHNob3VsZFZhbGlkYXRlKSB7XG4gICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICBvdXRwdXQgPSBjb21tYW5kLm91dHB1dC5wYXJzZShvdXRwdXQpO1xuICAgICAgICAgICAgfSBjYXRjaCAoZXJyKSB7XG4gICAgICAgICAgICAgIGNvbnNvbGUuZXJyb3IoXCJSUEMgb3V0cHV0IGRpZCBub3QgbWF0Y2ggc2NoZW1hXCIsIG91dHB1dCwgZXJyKTtcbiAgICAgICAgICAgICAgcmV0dXJuIG5ldyBIdHRwUmVzcG9uc2UoSlNPTi5zdHJpbmdpZnkoZXJyKSwge1xuICAgICAgICAgICAgICAgIHN0YXR1czogNTAwLFxuICAgICAgICAgICAgICAgIHN0YXR1c1RleHQ6IFwiUlBDIG91dHB1dCBkaWQgbm90IG1hdGNoIHNjaGVtYVwiLFxuICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgICAgcmV0dXJuIG5ldyBIdHRwUmVzcG9uc2UoSlNPTi5zdHJpbmdpZnkob3V0cHV0LCBqc29uUmVwbGFjZXIpLCB7XG4gICAgICAgICAgICBzdGF0dXM6IDIwMCxcbiAgICAgICAgICB9KTtcbiAgICAgICAgfSlcbiAgICAgICk7XG4gICAgfVxuXG4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cHBvcnQgbWFwcGluZyBSUEMgb3V0cHV0IGJhY2sgdG8gSFRUUCBwcm9wZXJ0aWVzIHN1Y2ggYXMgSGVhZGVyc1xuICAgICAgICAgIC8vIFRPRE86IHN1cHBvcnQgYWx0ZXJuYXRpdmUgc3RhdHVzIGNvZGUgaHR0cHM6Ly9naXRodWIuY29tL2Z1bmN0aW9ubGVzcy9ldmVudHVhbC9pc3N1ZXMvMjc2XG5cbiAgICAgICAgICByZXR1cm4gbmV3IEh0dHBSZXNwb25zZShKU09OLnN0cmluZ2lmeShvdXRwdXQsIGpzb25SZXBsYWNlciksIHtcbiAgICAgICAgICAgIHN0YXR1czogMjAwLFxuICAgICAgICAgICAgaGVhZGVyczoge1xuICAgICAgICAgICAgICBcIkNvbnRlbnQtVHlwZVwiOiBcImFwcGxpY2F0aW9uL2pzb25cIixcbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgfSk7XG5cbiAgICAgICAgICBmdW5jdGlvbiByZXNvbHZlSW5wdXQobmFtZTogc3RyaW5nLCBzcGVjOiBSZXN0UGFyYW1TcGVjKTogYW55IHtcbiAgICAgICAgICAgIGlmIChzcGVjID09PSBcImJvZHlcIikge1xuICAgICAgICAgICAgICByZXR1cm4gYm9keT8uW25hbWVdO1xuICAgICAgICAgICAgfSBlbHNlIGlmIChzcGVjID09PSBcInF1ZXJ5XCIpIHtcbiAgICAgICAgICAgICAgcmV0dXJuIHJlcXVlc3QucXVlcnk/LltuYW1lXTtcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoc3BlYyA9PT0gXCJoZWFkZXJcIikge1xuICAgICAgICAgICAgICByZXR1cm4gcmVxdWVzdC5oZWFkZXJzLmdldChuYW1lKTtcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoc3BlYyA9PT0gXCJwYXRoXCIpIHtcbiAgICAgICAgICAgICAgcmV0dXJuIHJlcXVlc3QucGFyYW1zPy5bbmFtZV07XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICBy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0KFxuICAgICAgICAgIHJlcXVlc3Q6IEh0dHBSZXF1ZXN0LFxuICAgICAgICAgIGNvbnRleHQ6IGFueVxuICAgICAgICApOiBQcm9taXNlPEh0dHBSZXNwb25zZT4ge1xuICAgICAgICAgIGxldCBjb25zdW1lZCA9IGZhbHNlO1xuICAgICAgICAgIGNvbnN0IG1pZGRsZXdhcmUgPSBjaGFpbi5uZXh0KCk7XG4gICAgICAgICAgaWYgKG1pZGRsZXdhcmUuZG9uZSkge1xuICAgICAgICAgICAgcmV0dXJuIGhhbmRsZXIocmVxdWVzdCwgY29udGV4dCk7XG4gICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHJldHVybiBtaWRkbGV3YXJlLnZhbHVlKHtcbiAgICAgICAgICAgICAgcmVxdWVzdCxcbiAgICAgICAgICAgICAgY29udGV4dCxcbiAgICAgICAgICAgICAgbmV4dDogYXN5bmMgKGNvbnRleHQpID0+IHtcbiAgICAgICAgICAgICAgICBpZiAoY29uc3VtZWQpIHtcbiAgICAgICAgICAgICAgICAgIGNvbnN1bWVkID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcbiAgICAgICAgICAgICAgICAgICAgYE1pZGRsZXdhcmUgY2Fubm90IGNhbGwgJ25leHQnIG1vcmUgdGhhbiBvbmNlYFxuICAgICAgICAgICAgICAgICAgKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgcmV0dXJuIG5leHQocmVxdWVzdCwgY29udGV4dCk7XG4gICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICB9KTtcbiAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgIH07XG4gICAgfVxuICB9XG5cbiAgcmV0dXJuIHJvdXRlcjtcbn1cblxuaW50ZXJmYWNlIFJvdXRlciB7XG4gIGhhbmRsZTogKHJlcXVlc3Q6IEh0dHBSZXF1ZXN0LCAuLi5leHRyYTogYW55KSA9PiBQcm9taXNlPEh0dHBSZXNwb25zZT47XG4gIGdldDogUm91dGVGYWN0b3J5O1xuICBoZWFkOiBSb3V0ZUZhY3Rvcnk7XG4gIHBvc3Q6IFJvdXRlRmFjdG9yeTtcbiAgcHV0OiBSb3V0ZUZhY3Rvcnk7XG4gIGRlbGV0ZTogUm91dGVGYWN0b3J5O1xuICBjb25uZWN0OiBSb3V0ZUZhY3Rvcnk7XG4gIG9wdGlvbnM6IFJvdXRlRmFjdG9yeTtcbiAgdHJhY2U6IFJvdXRlRmFjdG9yeTtcbiAgcGF0Y2g6IFJvdXRlRmFjdG9yeTtcbn1cblxuaW50ZXJmYWNlIFJvdXRlRmFjdG9yeSB7XG4gIChwYXRoOiBzdHJpbmcsIGhhbmRsZXJzOiBSb3V0ZUhhbmRsZXIpOiBSb3V0ZXI7XG59XG5cbnR5cGUgUm91dGVIYW5kbGVyID0gKFxuICByZXF1ZXN0OiBIdHRwUmVxdWVzdCxcbiAgLi4uYXJnczogYW55XG4pID0+IEh0dHBSZXNwb25zZSB8IFByb21pc2U8SHR0cFJlc3BvbnNlPjtcblxuLyoqXG4gKiBJbXBsZW1lbnRzIEpTT04gc2VyaWFsaXphdGlvbiBmb3Igd2VsbCBrbm93biB0eXBlcy5cbiAqL1xuZnVuY3Rpb24ganNvblJlcGxhY2VyKF9rZXk6IHN0cmluZywgdmFsdWU6IGFueSkge1xuICBpZiAodmFsdWUgaW5zdGFuY2VvZiBEYXRlKSB7XG4gICAgcmV0dXJuIHZhbHVlLnRvSVNPU3RyaW5nKCk7XG4gIH1cbiAgcmV0dXJuIHZhbHVlO1xufVxuIl19

@@ -74,38 +74,40 @@ import { isHttpError, HttpResponse, commandRpcPath, } from "@eventual/core";

const shouldValidate = command.validate !== false;
// RPC route takes a POST request and passes the parsed JSON body as input to the input
router.post(commandRpcPath(command), withMiddleware(async (request, context) => {
if (command.passThrough) {
// if passthrough is enabled, just proxy the request-response to the handler
return command.handler(request, context);
}
let input = await request.tryJson();
if (command.input && shouldValidate) {
try {
input = command.input.parse(input);
if (!command.passThrough) {
// RPC route takes a POST request and passes the parsed JSON body as input to the input
router.post(commandRpcPath(command), withMiddleware(async (request, context) => {
if (command.passThrough) {
// if passthrough is enabled, just proxy the request-response to the handler
return command.handler(request, context);
}
catch (err) {
console.error("Invalid input", err, input);
return new HttpResponse(JSON.stringify(err), {
status: 400,
statusText: "Invalid input",
});
let input = await request.tryJson();
if (command.input && shouldValidate) {
try {
input = command.input.parse(input);
}
catch (err) {
console.error("Invalid input", err, input);
return new HttpResponse(JSON.stringify(err), {
status: 400,
statusText: "Invalid input",
});
}
}
}
let output = await command.handler(input, context);
if (command.output && shouldValidate) {
try {
output = command.output.parse(output);
let output = await command.handler(input, context);
if (command.output && shouldValidate) {
try {
output = command.output.parse(output);
}
catch (err) {
console.error("RPC output did not match schema", output, err);
return new HttpResponse(JSON.stringify(err), {
status: 500,
statusText: "RPC output did not match schema",
});
}
}
catch (err) {
console.error("RPC output did not match schema", output, err);
return new HttpResponse(JSON.stringify(err), {
status: 500,
statusText: "RPC output did not match schema",
});
}
}
return new HttpResponse(JSON.stringify(output, jsonReplacer), {
status: 200,
});
}));
return new HttpResponse(JSON.stringify(output, jsonReplacer), {
status: 200,
});
}));
}
const path = command.path;

@@ -219,2 +221,2 @@ if (path) {

}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29tbWFuZC13b3JrZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvaGFuZGxlcnMvY29tbWFuZC13b3JrZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUVMLFdBQVcsRUFFWCxZQUFZLEVBRVosY0FBYyxHQUNmLE1BQU0sZ0JBQWdCLENBQUM7QUFDeEIsT0FBTyxFQUNMLHFCQUFxQixFQUNyQixnQkFBZ0IsRUFDaEIsV0FBVyxFQUNYLFFBQVEsR0FDVCxNQUFNLHlCQUF5QixDQUFDO0FBQ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AgICAgICAgLy8gYW5kIGFjY3VyYXRlbHkgcmVmbGVjdCBOTyBDT05URU5UXG4gICAgICAgICAgICAgIHN0YXR1czogMjA0LFxuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgfVxuICAgICAgICAgIHJldHVybiBuZXcgSHR0cFJlc3BvbnNlKFxuICAgICAgICAgICAgYE5vdCBGb3VuZDogJHtyZXF1ZXN0Lm1ldGhvZH0gJHtyZXF1ZXN0LnVybH1gLFxuICAgICAgICAgICAge1xuICAgICAgICAgICAgICBzdGF0dXM6IDQwNCxcbiAgICAgICAgICAgICAgc3RhdHVzVGV4dDogXCJOb3QgRm91bmRcIixcbiAgICAgICAgICAgIH1cbiAgICAgICAgICApO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiByZXNwb25zZTtcbiAgICAgIH0gY2F0Y2ggKGVycikge1xuICAgICAgICBpZiAoaXNIdHRwRXJyb3IoZXJyKSkge1xuICAgICAgICAgIHJldHVybiBuZXcgSHR0cFJlc3BvbnNlKFxuICAgICAgICAgICAgSlNPTi5zdHJpbmdpZnkoe1xuICAgICAgICAgICAgICBtZXNzYWdlOiBlcnIubWVzc2FnZSxcbiAgICAgICAgICAgICAgZGF0YTogZXJyLmRhdGEsXG4gICAgICAgICAgICB9KSxcbiAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgc3RhdHVzOiBlcnIuY29kZSxcbiAgICAgICAgICAgIH1cbiAgICAgICAgICApO1xuICAgICAgICB9IGVsc2UgaWYgKGVyciBpbnN0YW5jZW9mIEVycm9yKSB7XG4gICAgICAgICAgY29uc29sZS5lcnJvcihlcnIpO1xuICAgICAgICAgIHJldHVybiBuZXcgSHR0cFJlc3BvbnNlKGVyci5tZXNzYWdlLCB7XG4gICAgICAgICAgICBzdGF0dXM6IDUwMCxcbiAgICAgICAgICAgIHN0YXR1c1RleHQ6IFwiSW50ZXJuYWwgU2VydmVyIEVycm9yXCIsXG4gICAgICAgICAgfSk7XG4gICAgICAgIH0gZWxzZSB7X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ZHkgPSBhd2FpdCByZXF1ZXN0LnRyeUpzb24oKTtcbiAgICAgICAgICBsZXQgaW5wdXQ6IGFueSA9IHtcbiAgICAgICAgICAgIC4uLnJlcXVlc3QucGFyYW1zLFxuICAgICAgICAgICAgLi4uKGJvZHkgJiYgdHlwZW9mIGJvZHkgPT09IFwib2JqZWN0XCIgPyBib2R5IDoge30pLFxuICAgICAgICAgIH07XG5cbiAgICAgICAgICAvLyBwYXJzZSBoZWFkZXJzL3BhcmFtcy9xdWVyaWVzL2JvZHkgaW50byB0aGUgUlBDIGludGVyZmFjZVxuICAgICAgICAgIGlmIChjb21tYW5kLnBhcmFtcykge1xuICAgICAgICAgICAgT2JqZWN0LmVudHJpZXMoY29tbWFuZC5wYXJhbXMgYXMgUmVjb3JkPHN0cmluZywgUmVzdFBhcmFtU3BlYz4pLm1hcChcbiAgICAgICAgICAgICAgKFtuYW1lLCBzcGVjXSkgPT4ge1xuICAgICAgICAgICAgICAgIGlucHV0W25hbWVdID0gcmVzb2x2ZUlucHV0KG5hbWUsIHNwZWMpO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICApO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIGlmIChjb21tYW5kLmlucHV0ICYmIHNob3VsZFZhbGlkYXRlKSB7XG4gICAgICAgICAgICAvLyB2YWxpZGF0ZSB0aGUgem9kIGlucHV0IHNjaGVtYSBpZiBvbmUgaXMgc3BlY2lmaWVkXG4gICAgICAgICAgICBpbnB1dCA9IGNvbW1hbmQuaW5wdXQucGFyc2UoaW5wdXQpO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIC8vIGNhbGwgdGhlIGNvbW1hbmQgUlBDIGhhbmRsZXJcbiAgICAgICAgICBsZXQgb3V0cHV0OiBhbnkgPSBhd2FpdCBjb21tYW5kLmhhbmRsZXIoaW5wdXQsIGNvbnRleHQpO1xuXG4gICAgICAgICAgaWYgKGNvbW1hbmQub3V0cHV0ICYmIHNob3VsZFZhbGlkYXRlKSB7XG4g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ICAgIHJldHVybiBhc3luYyAocmVxdWVzdDogSHR0cFJlcXVlc3QpOiBQcm9taXNlPEh0dHBSZXNwb25zZT4gPT4ge1xuICAgICAgICBjb25zdCBjaGFpbiA9IChjb21tYW5kLm1pZGRsZXdhcmVzID8/IFtdKS52YWx1ZXMoKTtcblxuICAgICAgICByZXR1cm4gbmV4dChyZXF1ZXN0LCB7fSk7XG5cbiAgICAgICAgYXN5bmMgZnVuY3Rpb24gbmV4dChcbiAgICAgICAgICByZXF1ZXN0OiBIdHRwUmVxdWVzdCxcbiAgICAgICAgICBjb250ZXh0OiBhbnlcbiAgICAgICAgKTogUHJvbWlzZTxIdHRwUmVzcG9uc2U+IHtcbiAgICAgICAgICBsZXQgY29uc3VtZWQgPSBmYWxzZTtcbiAgICAgICAgICBjb25zdCBtaWRkbGV3YXJlID0gY2hhaW4ubmV4dCgpO1xuICAgICAgICAgIGlmIChtaWRkbGV3YXJlLmRvbmUpIHtcbiAgICAgICAgICAgIHJldHVybiBoYW5kbGVyKHJlcXVlc3QsIGNvbnRleHQpO1xuICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICByZXR1cm4gbWlkZGxld2FyZS52YWx1ZSh7XG4gICAgICAgICAgICAgIHJlcXVlc3QsXG4gICAgICAgICAgICAgIGNvbnRleHQsXG4gICAgICAgICAgICAgIG5leHQ6IGFzeW5jIChjb250ZXh0KSA9PiB7XG4gICAgICAgICAgICAgICAgaWYgKGNvbnN1bWVkKSB7XG4gICAgICAgICAgICAgICAgICBjb25zdW1lZCA9IHRydWU7XG4gICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXG4gICAgICAgICAgICAgICAgICAgIGBNaWRkbGV3YXJlIGNhbm5vdCBjYWxsICduZXh0JyBtb3JlIHRoYW4gb25jZWBcbiAgICAgICAgICAgICAgICAgICk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHJldHVybiBuZXh0KHJlcXVlc3QsIGNvbnRleHQpO1x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c3RcIiwgcmVxdWVzdCk7XG4gICAgcmV0dXJuIHNlcnZpY2VUeXBlU2NvcGUoU2VydmljZVR5cGUuQ29tbWFuZFdvcmtlciwgYXN5bmMgKCkgPT4ge1xuICAgICAgdHJ5IHtcbiAgICAgICAgY29uc3QgcmVzcG9uc2UgPSBhd2FpdCByb3V0ZXIuaGFuZGxlKHJlcXVlc3QpO1xuICAgICAgICBpZiAocmVzcG9uc2UgPT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgIGlmIChyZXF1ZXN0Lm1ldGhvZCA9PT0gXCJPUFRJT05TXCIpIHtcbiAgICAgICAgICAgIHJldHVybiBuZXcgSHR0cFJlc3BvbnNlKHVuZGVmaW5lZCwge1xuICAgICAgICAgICAgICAvLyBDT1JTIGV4cGVjdHMgYSAyMDQgb3IgMjAwLCB1c2luZyAyMDQgdG8gbWF0Y2ggQVBJIEdhdGV3YXlcbiAgICAgICAgICAgICAgLy8gYW5kIGFjY3VyYXRlbHkgcmVmbGVjdCBOTyBDT05URU5UXG4gICAgICAgICAgICAgIHN0YXR1czogMjA0LFxuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgfVxuICAgICAgICAgIHJldHVybiBuZXcgSHR0cFJlc3BvbnNlKFxuICAgICAgICAgICAgYE5vdCBGb3VuZDogJHtyZXF1ZXN0Lm1ldGhvZH0gJHtyZXF1ZXN0LnVybH1gLFxuICAgICAgICAgICAge1xuICAgICAgICAgICAgICBzdGF0dXM6IDQwNCxcbiAgICAgICAgICAgICAgc3RhdHVzVGV4dDogXCJOb3QgRm91bmRcIixcbiAgICAgICAgICAgIH1cbiAgICAgICAgICApO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiByZXNwb25zZTtcbiAgICAgIH0gY2F0Y2ggKGVycikge1xuICAgICAgICBpZiAoaXNIdHRwRXJyb3IoZXJyKSkge1xuICAgICAgICAgIHJldHVybiBuZXcgSHR0cFJlc3BvbnNlKFxuICAgICAgICAgICAgSlNPTi5zdHJpbmdpZnko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gICAgICB9KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG5cbiAgICAgICAgICBsZXQgb3V0cHV0OiBhbnkgPSBhd2FpdCBjb21tYW5kLmhhbmRsZXIoaW5wdXQsIGNvbnRleHQpO1xuICAgICAgICAgIGlmIChjb21tYW5kLm91dHB1dCAmJiBzaG91bGRWYWxpZGF0ZSkge1xuICAgICAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgICAgb3V0cHV0ID0gY29tbWFuZC5vdXRwdXQucGFyc2Uob3V0cHV0KTtcbiAgICAgICAgICAgIH0gY2F0Y2ggKGVycikge1xuICAgICAgICAgICAgICBjb25zb2xlLmVycm9yKFwiUlBDIG91dHB1dCBkaWQgbm90IG1hdGNoIHNjaGVtYVwiLCBvdXRwdXQsIGVycik7XG4gICAgICAgICAgICAgIHJldHVybiBuZXcgSHR0cFJlc3BvbnNlKEpTT04uc3RyaW5naWZ5KGVyciksIHtcbiAgICAgICAgICAgICAgICBzdGF0dXM6IDUwMCxcbiAgICAgICAgICAgICAgICBzdGF0dXNUZXh0OiBcIlJQQyBvdXRwdXQgZGlkIG5vdCBtYXRjaCBzY2hlbWFcIixcbiAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuICAgICAgICAgIHJldHVybiBuZXcgSHR0cFJlc3BvbnNlKEpTT04uc3RyaW5naWZ5KG91dHB1dCwganNvblJlcGxhY2VyKSwge1xuICAgICAgICAgICAgc3RhdHVzOiAyMDAsXG4gICAgICAgICAgfSk7XG4gICAgICAgIH0pXG4gICAgICApO1xuICAgIH1cblxuICAgIGNvbnN0IHBhdGggPSBjb21tYW5kLnBhdGg7XG5cbiAgICBpZiAocGF0aCkge1xuICAgICAgY29uc3QgbWV0aG9kID0gKGNvbW1hbmQubWV0aG9kPy50b0xvY2FsZUxvd2VyQ2FzZSgpID8/XG4gICAgICAgIFwiYWxsXCIpIGFzIGtleW9mIFJvdXRlcjtcblxuICAgICAgLy8gUkVTVC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WVzLzI3NlxuXG4gICAgICAgICAgcmV0dXJuIG5ldyBIdHRwUmVzcG9uc2UoSlNPTi5zdHJpbmdpZnkob3V0cHV0LCBqc29uUmVwbGFjZXIpLCB7XG4gICAgICAgICAgICBzdGF0dXM6IDIwMCxcbiAgICAgICAgICAgIGhlYWRlcnM6IHtcbiAgICAgICAgICAgICAgXCJDb250ZW50LVR5cGVcIjogXCJhcHBsaWNhdGlvbi9qc29uXCIsXG4gICAgICAgICAgICB9LFxuICAgICAgICAgIH0pO1xuXG4gICAgICAgICAgZnVuY3Rpb24gcmVzb2x2ZUlucHV0KG5hbWU6IHN0cmluZywgc3BlYzogUmVzdFBhcmFtU3BlYyk6IGFueSB7XG4gICAgICAgICAgICBpZiAoc3BlYyA9PT0gXCJib2R5XCIpIHtcbiAgICAgICAgICAgICAgcmV0dXJuIGJvZHk/LltuYW1lXTtcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoc3BlYyA9PT0gXCJxdWVyeVwiKSB7XG4gICAgICAgICAgICAgIHJldHVybiByZXF1ZXN0LnF1ZXJ5Py5bbmFtZV07XG4gICAgICAgICAgICB9IGVsc2UgaWYgKHNwZWMgPT09IFwiaGVhZGVyXCIpIHtcbiAgICAgICAgICAgICAgcmV0dXJuIHJlcXVlc3QuaGVhZGVycy5nZXQobmFtZSk7XG4gICAgICAgICAgICB9IGVsc2UgaWYgKHNwZWMgPT09IFwicGF0aFwiKSB7XG4gICAgICAgICAgICAgIHJldHVybiByZXF1ZXN0LnBhcmFtcz8uW25hbWVdO1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgcmV0dXJuIHJlc29sdmVJbnB1dChzcGVjLm5hbWUgPz8gbmFtZSwgc3BlYy5pbik7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuICAgICAgICB9KVxuICAgICAgKTtcbiAgICB9XG5cbiAgICAvKipcbiAgICAgKiBBcHBsaWVzIHRoZSBjaGFpbiBvZiBtaWRkbGV3YXJlIGNh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aW4ubmV4dCgpO1xuICAgICAgICAgIGlmIChtaWRkbGV3YXJlLmRvbmUpIHtcbiAgICAgICAgICAgIHJldHVybiBoYW5kbGVyKHJlcXVlc3QsIGNvbnRleHQpO1xuICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICByZXR1cm4gbWlkZGxld2FyZS52YWx1ZSh7XG4gICAgICAgICAgICAgIHJlcXVlc3QsXG4gICAgICAgICAgICAgIGNvbnRleHQsXG4gICAgICAgICAgICAgIG5leHQ6IGFzeW5jIChjb250ZXh0KSA9PiB7XG4gICAgICAgICAgICAgICAgaWYgKGNvbnN1bWVkKSB7XG4gICAgICAgICAgICAgICAgICBjb25zdW1lZCA9IHRydWU7XG4gICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXG4gICAgICAgICAgICAgICAgICAgIGBNaWRkbGV3YXJlIGNhbm5vdCBjYWxsICduZXh0JyBtb3JlIHRoYW4gb25jZWBcbiAgICAgICAgICAgICAgICAgICk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHJldHVybiBuZXh0KHJlcXVlc3QsIGNvbnRleHQpO1xuICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICB9O1xuICAgIH1cbiAgfVxuXG4gIHJldHVybiByb3V0ZXI7XG59XG5cbmludGVyZmFjZSBSb3V0ZXIge1xuICBoYW5kbGU6IChyZXF1ZXN0OiBIdHRwUmVxdWVzdCwgLi4uZXh0cmE6IGFueSkgPT4gUHJvbWlzZTxIdHRwUmVzcG9uc2U+O1xuICBnZXQ6IFJvdXRlRmFjdG9yeTtcbiAgaGVhZDogUm91dGVGYWN0b3J5O1xuICBwb3N0OiBSb3V0ZUZhY3Rvcnk7XG4gIHB1dDogUm91dGVGYWN0b3J5O1xuICBkZWxldGU6IFJvdXRlRmFjdG9yeTtcbiAgY29ubmVjdDogUm91dGVGYWN0b3J5O1xuICBvcHRpb25zOiBSb3V0ZUZhY3Rvcnk7XG4gIHRyYWNlOiBSb3V0ZUZhY3Rvcnk7XG4gIHBhdGNoOiBSb3V0ZUZhY3Rvcnk7XG59XG5cbmludGVyZmFjZSBSb3V0ZUZhY3Rvcnkge1xuICAocGF0aDogc3RyaW5nLCBoYW5kbGVyczogUm91dGVIYW5kbGVyKTogUm91dGVyO1xufVxuXG50eXBlIFJvdXRlSGFuZGxlciA9IChcbiAgcmVxdWVzdDogSHR0cFJlcXVlc3QsXG4gIC4uLmFyZ3M6IGFueVxuKSA9PiBIdHRwUmVzcG9uc2UgfCBQcm9taXNlPEh0dHBSZXNwb25zZT47XG5cbi8qKlxuICogSW1wbGVtZW50cyBKU09OIHNlcmlhbGl6YXRpb24gZm9yIHdlbGwga25vd24gdHlwZXMuXG4gKi9cbmZ1bmN0aW9uIGpzb25SZXBsYWNlcihfa2V5OiBzdHJpbmcsIHZhbHVlOiBhbnkpIHtcbiAgaWYgKHZhbHVlIGluc3RhbmNlb2YgRGF0ZSkge1xuICAgIHJldHVybiB2YWx1ZS50b0lTT1N0cmluZygpO1xuICB9XG4gIHJldHVybiB2YWx1ZTtcbn1cbiJdfQ==
{
"name": "@eventual/core-runtime",
"version": "0.25.0",
"version": "0.25.1",
"exports": {

@@ -16,3 +16,3 @@ ".": {

"dependencies": {
"@eventual/core": "^0.25.0",
"@eventual/core": "^0.25.1",
"itty-router": "^2.6.6",

@@ -19,0 +19,0 @@ "ulidx": "^0.3.0",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc