@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.
58 lines (57 loc) • 2.16 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/trigger/sqs.d.ts
// SQS
// https://docs.aws.amazon.com/lambda/latest/dg/invoking-lambda-function.html#supported-event-source-sqs
interface SQSRecord {
messageId: string;
receiptHandle: string;
body: string;
attributes: SQSRecordAttributes;
messageAttributes: SQSMessageAttributes;
md5OfBody: string;
md5OfMessageAttributes?: string;
eventSource: string;
eventSourceARN: string;
awsRegion: string;
}
interface SQSEvent {
Records: SQSRecord[];
}
interface SQSRecordAttributes {
AWSTraceHeader?: string | undefined;
ApproximateReceiveCount: string;
SentTimestamp: string;
SenderId: string;
ApproximateFirstReceiveTimestamp: string;
SequenceNumber?: string | undefined;
MessageGroupId?: string | undefined;
MessageDeduplicationId?: string | undefined;
DeadLetterQueueSourceArn?: string | undefined; // Undocumented, but used by AWS to support their re-drive functionality in the console
}
type SQSMessageAttributeDataType = "String" | "Number" | "Binary" | string;
interface SQSMessageAttribute {
stringValue?: string | undefined;
binaryValue?: string | undefined;
stringListValues?: string[] | undefined; // Not implemented. Reserved for future use.
binaryListValues?: string[] | undefined; // Not implemented. Reserved for future use.
dataType: SQSMessageAttributeDataType;
}
interface SQSMessageAttributes {
[name: string]: SQSMessageAttribute;
}
// https://docs.aws.amazon.com/lambda/latest/dg/with-sqs.html#services-sqs-batchfailurereporting
interface SQSBatchResponse {
batchItemFailures: SQSBatchItemFailure[];
}
interface SQSBatchItemFailure {
itemIdentifier: string;
}
//#endregion
//#region src/api/sqsHandler.d.ts
type JsonSQSRecord = Omit<SQSRecord, 'body'> & {
body: Record<string, unknown>;
};
declare function sqsHandler(handler: (event: JsonSQSRecord, context: Context) => Promise<void>): (event: SQSEvent, context: Context) => Promise<SQSBatchResponse>;
//#endregion
export { JsonSQSRecord, sqsHandler };
//# sourceMappingURL=sqsHandler.d.cts.map