-
Notifications
You must be signed in to change notification settings - Fork 938
Support streaming streaming responses for callable functions. #8609
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
48eca40
21db516
d28863c
a02b25f
ab99970
8ec2787
4aee03e
fdc70d8
55d9266
9a430cc
785e906
861edce
4b188d0
39c44d5
1c1f533
b481220
9f4c973
ebd74cb
cf56623
cfbcd46
1801c53
bf4f5e9
c6ef6a0
31998c2
72e87b4
d8ebbb8
fd2cb15
9a85bb2
f581b61
b9a42e5
d0cc907
f773110
aa993f0
9ae31c0
327c1cb
5fb40f1
9ea463d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'@firebase/functions': minor | ||
'firebase': minor | ||
--- | ||
|
||
Add `.stream()` api for callable functions for consuming streaming responses. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Uncomment this if you'd like others to create their own Firebase project. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
Project: /docs/reference/js/_project.yaml | ||
Book: /docs/reference/_book.yaml | ||
page_type: reference | ||
|
||
{% comment %} | ||
DO NOT EDIT THIS FILE! | ||
This is generated by the JS SDK team, and any local changes will be | ||
overwritten. Changes should be made in the source code at | ||
https://github.com/firebase/firebase-js-sdk | ||
{% endcomment %} | ||
|
||
# HttpsCallable interface | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm puzzled about why this is new/green/add when it seems to have existed already in line 43 of public_types.ts, iiuc. In any case, it would be great to have clarity on whether we really mean "Google Cloud Functions" or whether we should stick with just "Cloud Functions" or even "Cloud Functions for Firebase." There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's been a while since we made significant changes to this code, and it's possible the these type definition preceeds the devsite doc generation process I'm running here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll stick with Cloud Functions? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. SG, thanks! |
||
A reference to a "callable" HTTP trigger in Cloud Functions. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
export interface HttpsCallable<RequestData = unknown, ResponseData = unknown, StreamData = unknown> | ||
``` | ||
|
||
## Properties | ||
|
||
| Property | Type | Description | | ||
| --- | --- | --- | | ||
| [stream](./functions.httpscallable.md#httpscallablestream) | (data?: RequestData \| null, options?: [HttpsCallableStreamOptions](./functions.httpscallablestreamoptions.md#httpscallablestreamoptions_interface)<!-- -->) => Promise<[HttpsCallableStreamResult](./functions.httpscallablestreamresult.md#httpscallablestreamresult_interface)<!-- --><ResponseData, StreamData>> | | | ||
|
||
## HttpsCallable.stream | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
stream: (data?: RequestData | null, options?: HttpsCallableStreamOptions) => Promise<HttpsCallableStreamResult<ResponseData, StreamData>>; | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
Project: /docs/reference/js/_project.yaml | ||
Book: /docs/reference/_book.yaml | ||
page_type: reference | ||
|
||
{% comment %} | ||
DO NOT EDIT THIS FILE! | ||
This is generated by the JS SDK team, and any local changes will be | ||
overwritten. Changes should be made in the source code at | ||
https://github.com/firebase/firebase-js-sdk | ||
{% endcomment %} | ||
|
||
# HttpsCallableStreamOptions interface | ||
An interface for metadata about how a stream call should be executed. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
export interface HttpsCallableStreamOptions | ||
``` | ||
|
||
## Properties | ||
|
||
| Property | Type | Description | | ||
| --- | --- | --- | | ||
| [limitedUseAppCheckTokens](./functions.httpscallablestreamoptions.md#httpscallablestreamoptionslimiteduseappchecktokens) | boolean | If set to true, uses a limited-use App Check token for callable function requests from this instance of [Functions](./functions.functions.md#functions_interface)<!-- -->. You must use limited-use tokens to call functions with replay protection enabled. By default, this is false. | | ||
| [signal](./functions.httpscallablestreamoptions.md#httpscallablestreamoptionssignal) | AbortSignal | An <code>AbortSignal</code> that can be used to cancel the streaming response. When the signal is aborted, the underlying HTTP connection will be terminated. | | ||
|
||
## HttpsCallableStreamOptions.limitedUseAppCheckTokens | ||
|
||
If set to true, uses a limited-use App Check token for callable function requests from this instance of [Functions](./functions.functions.md#functions_interface)<!-- -->. You must use limited-use tokens to call functions with replay protection enabled. By default, this is false. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
limitedUseAppCheckTokens?: boolean; | ||
``` | ||
|
||
## HttpsCallableStreamOptions.signal | ||
|
||
An `AbortSignal` that can be used to cancel the streaming response. When the signal is aborted, the underlying HTTP connection will be terminated. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
signal?: AbortSignal; | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
Project: /docs/reference/js/_project.yaml | ||
Book: /docs/reference/_book.yaml | ||
page_type: reference | ||
|
||
{% comment %} | ||
DO NOT EDIT THIS FILE! | ||
This is generated by the JS SDK team, and any local changes will be | ||
overwritten. Changes should be made in the source code at | ||
https://github.com/firebase/firebase-js-sdk | ||
{% endcomment %} | ||
|
||
# HttpsCallableStreamResult interface | ||
An `HttpsCallableStreamResult` wraps a single streaming result from a function call. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
export interface HttpsCallableStreamResult<ResponseData = unknown, StreamData = unknown> | ||
``` | ||
|
||
## Properties | ||
|
||
| Property | Type | Description | | ||
| --- | --- | --- | | ||
| [data](./functions.httpscallablestreamresult.md#httpscallablestreamresultdata) | Promise<ResponseData> | | | ||
| [stream](./functions.httpscallablestreamresult.md#httpscallablestreamresultstream) | AsyncIterable<StreamData> | | | ||
|
||
## HttpsCallableStreamResult.data | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
readonly data: Promise<ResponseData>; | ||
``` | ||
|
||
## HttpsCallableStreamResult.stream | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
readonly stream: AsyncIterable<StreamData>; | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,7 +37,7 @@ | |
"test:browser": "karma start", | ||
"test:browser:debug": "karma start --browsers=Chrome --auto-watch", | ||
"test:node": "TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' nyc --reporter lcovonly -- mocha 'src/{,!(browser)/**/}*.test.ts' --file src/index.ts --config ../../config/mocharc.node.js", | ||
"test:emulator": "env FIREBASE_FUNCTIONS_EMULATOR_ORIGIN=http://localhost:5005 run-p --npm-path npm test:node", | ||
"test:emulator": "env FIREBASE_FUNCTIONS_EMULATOR_ORIGIN=http://127.0.0.1:5005 run-p --npm-path npm test:node", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is my github diff wonky or are these two lines with the same script name? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. whoops i think this is an artifact of a merge gone wrong. Reverted. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this change to use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On my dev machine, only 127.0.0.1 works (due to changes in recent Mac version that resolves localhost to ipv6), but I can revert the change if preferred. |
||
"trusted-type-check": "tsec -p tsconfig.json --noEmit", | ||
"api-report": "api-extractor run --local --verbose", | ||
"doc": "api-documenter markdown --input temp --output docs", | ||
|
Uh oh!
There was an error while loading. Please reload this page.