@smooai/utils
Version:
A collection of shared utilities and tools used across SmooAI projects. This package provides common functionality to standardize and simplify development across all SmooAI repositories.
115 lines (114 loc) • 3.89 kB
text/typescript
import { t as Context } from "./handler-CXmfhYC_.cjs";
//#region node_modules/.pnpm/@types+aws-lambda@8.10.147/node_modules/@types/aws-lambda/common/api-gateway.d.ts
interface APIGatewayEventClientCertificate {
clientCertPem: string;
serialNumber: string;
subjectDN: string;
issuerDN: string;
validity: {
notAfter: string;
notBefore: string;
};
}
//#endregion
//#region node_modules/.pnpm/@types+aws-lambda@8.10.147/node_modules/@types/aws-lambda/trigger/api-gateway-proxy.d.ts
interface APIGatewayProxyEventHeaders {
[name: string]: string | undefined;
}
interface APIGatewayProxyEventPathParameters {
[name: string]: string | undefined;
}
interface APIGatewayProxyEventQueryStringParameters {
[name: string]: string | undefined;
}
interface APIGatewayProxyEventStageVariables {
[name: string]: string | undefined;
}
/**
* Works with HTTP API integration Payload Format version 2.0
* @see - https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html
*/
interface APIGatewayEventRequestContextV2 {
accountId: string;
apiId: string;
authentication?: {
clientCert: APIGatewayEventClientCertificate;
};
domainName: string;
domainPrefix: string;
http: {
method: string;
path: string;
protocol: string;
sourceIp: string;
userAgent: string;
};
requestId: string;
routeKey: string;
stage: string;
time: string;
timeEpoch: number;
}
/**
* Proxy Event with adaptable requestContext for different authorizer scenarios
*/
interface APIGatewayProxyEventV2WithRequestContext<TRequestContext> {
version: string;
routeKey: string;
rawPath: string;
rawQueryString: string;
cookies?: string[];
headers: APIGatewayProxyEventHeaders;
queryStringParameters?: APIGatewayProxyEventQueryStringParameters;
requestContext: TRequestContext;
body?: string;
pathParameters?: APIGatewayProxyEventPathParameters;
isBase64Encoded: boolean;
stageVariables?: APIGatewayProxyEventStageVariables;
}
/**
* Default Proxy event with no Authorizer
*/
type APIGatewayProxyEventV2 = APIGatewayProxyEventV2WithRequestContext<APIGatewayEventRequestContextV2>;
/**
* Interface for structured response with `statusCode` and`headers`
* Works with HTTP API integration Payload Format version 2.0
* @see - https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html
*/
interface APIGatewayProxyStructuredResultV2 {
statusCode?: number | undefined;
headers?: {
[header: string]: boolean | number | string;
} | undefined;
body?: string | undefined;
isBase64Encoded?: boolean | undefined;
cookies?: string[] | undefined;
}
//#endregion
//#region node_modules/.pnpm/@types+aws-lambda@8.10.147/node_modules/@types/aws-lambda/trigger/eventbridge.d.ts
interface EventBridgeEvent<TDetailType extends string, TDetail> {
id: string;
version: string;
account: string;
time: string;
region: string;
resources: string[];
source: string;
"detail-type": TDetailType;
detail: TDetail;
"replay-name"?: string;
}
//#endregion
//#region src/api/apiHandler.d.ts
type LambdaResponseOrError<T = any> = Omit<APIGatewayProxyStructuredResultV2, 'body'> & {
body?: T | string | {
error: {
message: string;
} & Record<string, any>;
};
};
declare function lambdaApiHandler<T = any>(event: APIGatewayProxyEventV2, context: Context, handler: (event: APIGatewayProxyEventV2, context: Context) => Promise<LambdaResponseOrError<T>>): Promise<APIGatewayProxyStructuredResultV2>;
declare function eventBridgeHandler(event: EventBridgeEvent<any, any>, context: Context, handler: (event: EventBridgeEvent<any, any>, context: Context) => Promise<void>): Promise<void>;
//#endregion
export { eventBridgeHandler as n, lambdaApiHandler as r, LambdaResponseOrError as t };
//# sourceMappingURL=apiHandler--6ocVipA.d.cts.map