npm.io
1.0.3 • Published 2 years ago

@types/scaleway-functions

Licence
MIT
Version
1.0.3
Deps
0
Size
5 kB
Vulns
0
Weekly
0
Stars
51.4K

Installation

npm install --save @types/scaleway-functions

Summary

This package contains type definitions for scaleway-functions (https://www.scaleway.com/en/serverless-functions/).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/scaleway-functions.

index.d.ts

export type Handler<TResult = Response | object> = (
    event: Event,
    context: Context,
    callback: Callback<TResult>,
    // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
) => void | TResult | Promise<TResult>;

export type Callback<TResult = Response | object> = (error?: Error | string | null, result?: TResult) => void;

// https://github.com/scaleway/scaleway-functions-runtimes/blob/master/events/context.go
export interface Context {
    memoryLimitInMb: number;
    functionName: string;
    functionVersion: string;
}

// https://github.com/scaleway/scaleway-functions-runtimes/blob/master/events/http.go
export interface Event {
    path: string;
    httpMethod: string;
    headers: Record<string, string>;
    queryStringParameters: Record<string, string>;
    stageVariables: Record<string, string>;
    body: string;
    isBase64Encoded: boolean;
    requestContext: RequestContext;
}

export interface RequestContext {
    stage: string;
    httpMethod: string;
}

// https://github.com/scaleway/scaleway-functions-runtimes/blob/master/handler/utils.go
export interface Response {
    statusCode: number;
    body?: string | object;
    headers?: Record<string, string>;
    isBase64Encoded?: boolean;
}

Additional Details

  • Last updated: Wed, 22 Nov 2023 0048 GMT
  • Dependencies: none

Credits

These definitions were written by MrMicky.