New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

@awsless/lambda

Package Overview
Dependencies
Maintainers
2
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@awsless/lambda

- Rename ViewableError to ExpectedError - Think of ways to type errors (TypeScript might need to figure this out first.)

latest
Source
npmnpm
Version
0.0.42
Version published
Maintainers
2
Created
Source

TODO

  • Rename ViewableError to ExpectedError
  • Think of ways to type errors (TypeScript might need to figure this out first.)

Basic usage

import { lambda } from "@awsless/lambda";

// simple echo function
export default lambda({
  handle(event) {
    return event
  }
})
import { lambda } from "@awsless/lambda";
import { object, string } from "@awsless/validate";
import { bugsnag } from "@awsless/bugsnag";

export default lambda({

  // Validate the input
  schema: object({
    message: string()
  }),

  // Log errors to bugsnag
  logger: bugsnag(),

  handle({ message }) {
    return message
  }
})

Invoking a lambda

import { lambda, invoke } from "@awsless/lambda";
import { string } from "@awsless/validate";

export const echo = lambda({
  schema: string(),
  handle(value) {
    return value
  }
})

export default lambda({
  handle() {
    // Providing the type definition of the lambda you want to invoke will give you type hinting for the payload and return value.
    return invoke<typeof echo>({
      name: 'echo',
      payload: 'Hi'
    })
  }
})

Mock invoking lambda's

import { mockLambda } from "@awsless/lambda";

const lambdas = mockLambda({
  echo: a => a,
})

it('your test', async () => {
  const result = await invoke({
    name: 'echo',
    payload: 'Hi'
  })

  expect(result).toBe('Hi')
  expect(lambdas.echo).toBeCalled()
})

FAQs

Package last updated on 09 Apr 2026

Did you know?

Socket

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.

Install

Related posts