UNPKG

inngest

Version:

Official SDK for Inngest.com. Inngest is the reliability layer for modern applications. Inngest combines durable execution, events, and queues into a zero-infra platform with built-in observability.

1 lines 1.21 kB
{"version":3,"file":"dependencyInjection.cjs","names":["Middleware"],"sources":["../../src/middleware/dependencyInjection.ts"],"sourcesContent":["import { Middleware } from \"../components/middleware/middleware.ts\";\n\n/**\n * Adds properties to the function input for every function created using this\n * app.\n */\n// biome-ignore lint/suspicious/noExplicitAny: unknown can be troublesome here\nexport const dependencyInjectionMiddleware = <TCtx extends Record<string, any>>(\n /**\n * The context to inject into the function input.\n */\n ctx: TCtx,\n) => {\n class DependencyInjectionMiddleware extends Middleware.BaseMiddleware {\n readonly id = \"inngest:dependency-injection\";\n\n override transformFunctionInput(\n arg: Middleware.TransformFunctionInputArgs,\n ): Middleware.TransformFunctionInputArgs & { ctx: TCtx } {\n return {\n ...arg,\n ctx: {\n ...arg.ctx,\n ...ctx,\n },\n };\n }\n }\n\n return DependencyInjectionMiddleware;\n};\n"],"mappings":";;;;;;;AAOA,MAAa,iCAIX,QACG;CACH,MAAM,sCAAsCA,8BAAW,eAAe;EACpE,AAAS,KAAK;EAEd,AAAS,uBACP,KACuD;AACvD,UAAO;IACL,GAAG;IACH,KAAK;KACH,GAAG,IAAI;KACP,GAAG;KACJ;IACF;;;AAIL,QAAO"}