From a83fba68e9257f42f03d666a04a007f6debc76d1 Mon Sep 17 00:00:00 2001 From: Dario Piotrowicz Date: Wed, 25 Sep 2024 10:35:02 +0100 Subject: [PATCH] add ts-doc comment to getCloudflareContext function --- .../cloudflare/src/api/get-cloudflare-context.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/packages/cloudflare/src/api/get-cloudflare-context.ts b/packages/cloudflare/src/api/get-cloudflare-context.ts index 258a74fa..eef72ff0 100644 --- a/packages/cloudflare/src/api/get-cloudflare-context.ts +++ b/packages/cloudflare/src/api/get-cloudflare-context.ts @@ -16,6 +16,19 @@ export type CloudflareContext< const cloudflareContextSymbol = Symbol.for("__cloudflare-context__"); +/** + * Utility to get the current Cloudflare context. + * + * Such context contains three values: + * - `env`: object containing the worker's bindings + * (https://developers.cloudflare.com/workers/runtime-apis/bindings/) + * - `ctx`: the current execution context object + * (https://developers.cloudflare.com/workers/runtime-apis/context) + * - `cf`: object containing information regarding the current request + * (https://developers.cloudflare.com/workers/runtime-apis/request/#the-cf-property-requestinitcfproperties) + * + * @returns the cloudflare context + */ export async function getCloudflareContext< CfProperties extends Record = IncomingRequestCfProperties, Context = ExecutionContext,