Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
@serverless/fdk
Advanced tools
Node.js library to improve developer experience developing Serverless applications.
Node.js library to improve developer experience developing Serverless applications.
It contains a client to configure and interact with the Event Gateway.
npm install @serverless/fdk
<script type="text/javascript" src="https://unpkg.com/@serverless/fdk@latest/dist/fdk.min.js"></script>
The FDK then will be attached to window e.g. and you can access it via window.fdk
const fdk = require('@serverless/fdk');
const eventGateway = fdk.eventGateway({
url: 'http://localhost',
})
Optional Properties for eventGateway
{
// defaults to the provide URL + default config port 4001
configurationUrl: 'http://localhost:4001'
// optional property to provide their own http lib
fetchClient: fetch
}
eventGateway.invoke({
functionId: "createUser",
data: { name: "Max" },
})
Returns a Promise with the response.
The value of data is converted using JSON.stringify
by default since the default dataType is application/json
. This is not happening and the value is passed as it is when the property dataType
is provided.
eventGateway.invoke({
functionId: "createUser",
data: "Max",
dataType: "text/plain",
})
eventGateway.emit({
event: "userCreated",
data: { name: "Max" },
})
Returns a Promise and when resolved the response only indicates if the Event Gateway received the event. Responses from any subscribed functions are not part of the response.
The value of data is converted using JSON.stringify
by default since the default dataType is application/json
. This is not happening and the value is passed as it is when the property dataType
is provided.
eventGateway.emit({
event: "userCreated",
data: "This is a string message.",
dataType: "text/plain",
})
Configure accepts an object of function and subscription definitions. The idea of exposing one configuration function is to provide developers with convenient utility to configure an Event Gateway in one call rather then dealing with a chain of Promise based calls. Nevertheless in addition we expose a wrapper function for each low-level API call to the Event Gateway described in this section.
eventGateway.configure({
// list of all the functions that should be registered
functions: [
{
functionId: "helloWorld"
provider: {
type: "awslambda"
arn: "xxx",
region: "us-west-2",
}
},
{
functionId: "sendWelcomeMail"
provider: {
type: "gcloudfunction"
name: "sendWelcomeEmail",
region: "us-west-2",
}
}
],
// list of all the subscriptions that should be created
subscriptions: [
{
event: "http",
method: "GET",
path: "/users",
functionId: "helloWorld"
},
{
event: "user.created",
functionId: "sendEmail"
}
]
})
Returns a promise which contains all the same list of functions and subscriptions in the same structure and order as provided in the configuration argument.
eventGateway.configure({ config })
.then((response) => {
console.log(response)
// {
// functions: [
// { functionId: 'xxx', … },
// { functionId: 'xxx', … }
// ],
// subscriptions: [
// { subscriptionId: 'xxx', … },
// { subscriptionId: 'xxx', … }
// ]
// }
})
Reset removes all the existing subscriptions and functions.
eventGateway.resetConfiguration()
// Returns a function
eventGateway.registerFunction({
functionId: "sendEmail"
provider: {
type: "awslambda"
arn: "xxx",
region: "us-west-2",
}
})
// Returns undefined
eventGateway.deleteFunction({ functionId: "sendEmail" })
// Returns an Array of functions
eventGateway.listFunctions()
// Returns a subscription: { subscriptionId, event, functionId}
eventGateway.subscribe({
event: "user.created",
functionId: "sendEmail"
})
// Returns undefined
eventGateway.unsubscribe({
subscriptionId: "user.created-sendEmail"
})
// Returns an Array of subscriptions
eventGateway.listSubscriptions()
If you are interested to contribute we recommend to check out the Contributing document as it explains how to get started and some of the design decisions for this library.
FAQs
Node.js library to improve developer experience developing Serverless applications.
The npm package @serverless/fdk receives a total of 346 weekly downloads. As such, @serverless/fdk popularity was classified as not popular.
We found that @serverless/fdk demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 7 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.