lambda-extension-service
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

Lambda extension service

SDK to easily build Lambda extensions in NodeJs and typescript.

Inspired by Simplifying internal AWS Lambda APIs

Installation

pnpm add lambda-extension-service

or if using yarn

yarn add lambda-extension-service

or if using npm

npm install lambda-extension-service

Usage

import { EventTypes, ExtensionAPIService, TelemetryEventTypes } from "lambda-extension-service";

(async () => {
  const extensionApiService = new ExtensionAPIService({ extensionName: "my-extension" });
  await extensionApiService.register([EventTypes.Invoke, EventTypes.Shutdown]);
  extensionApiService.onTelemetryEvent((event) => 
      console.log("Telemetry event received: ", JSON.stringify(event))
  );
  await extensionApiService.registerTelemetry([
      TelemetryEventTypes.Function,
      TelemetryEventTypes.Platform,
      TelemetryEventTypes.Extension,
  ]);

  while (true) {
      const event = await extensionApiService.next();
      console.log("Next lambda event received: ", JSON.stringify(event));
  }
})().catch((err) => console.error(err));

A complete example can be found on Example repository

Documentation

To fully understand the lambda extensions, I recommend reading or watching:

Readme

Keywords

Package Sidebar

Install

npm i lambda-extension-service

Weekly Downloads

357

Version

0.0.2

License

MIT

Unpacked Size

48.6 kB

Total Files

11

Last publish

Collaborators

  • corentindoue