Skip to content

Commit f773110

Browse files
committed
Add docstring comments to utility functions.
1 parent d0cc907 commit f773110

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

packages/functions/src/service.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,12 @@ async function postJSON(
275275
};
276276
}
277277

278+
/**
279+
* Creates authorization headers for Firebase Functions requests.
280+
* @param functionsInstance The Firebase Functions service instance.
281+
* @param options Options for the callable function, including AppCheck token settings.
282+
* @return A Promise that resolves a headers map to include in outgoing fetch request.
283+
*/
278284
async function makeAuthHeaders(
279285
functionsInstance: FunctionsService,
280286
options: HttpsCallableOptions
@@ -493,6 +499,21 @@ async function streamAtURL(
493499
};
494500
}
495501

502+
/**
503+
* Creates a ReadableStream that processes a streaming response from a streaming
504+
* callable function that returns data in server-sent event format.
505+
*
506+
* @param reader The underlying reader providing raw response data
507+
* @param resultResolver Callback to resolve the final result when received
508+
* @param resultRejecter Callback to reject with an error if encountered
509+
* @param signal Optional AbortSignal to cancel the stream processing
510+
* @returns A ReadableStream that emits decoded messages from the response
511+
*
512+
* The returned ReadableStream:
513+
* 1. Emits individual messages when "message" data is received
514+
* 2. Resolves with the final result when a "result" message is received
515+
* 3. Rejects with an error if an "error" message is received
516+
*/
496517
function createResponseStream(
497518
reader: ReadableStreamDefaultReader<Uint8Array>,
498519
resultResolver: (value: unknown) => void,

0 commit comments

Comments
 (0)