Skip to content

Commit 4eaddd9

Browse files
Merge main into release
2 parents ffbf5a6 + 1e8edb7 commit 4eaddd9

32 files changed

+3189
-2185
lines changed

.changeset/bright-scissors-care.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@firebase/functions': minor
3+
'firebase': minor
4+
---
5+
6+
Add `.stream()` api for callable functions for consuming streaming responses.

.changeset/four-baboons-behave.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@firebase/vertexai': patch
3+
---
4+
5+
Clear fetch timeout after request completion. Fixes an issue that caused Node scripts to hang due to a pending timeout.

.changeset/funny-weeks-attack.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@firebase/data-connect": patch
3+
---
4+
5+
Fixed issue where multiple calls to connectDataConnectEmulator caused an exception

.changeset/neat-beans-rescue.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@firebase/messaging': patch
3+
---
4+
5+
Fix an issue where PushManager.subscribe() is called too soon after registering the default service worker.

common/api-review/functions.api.md

+22-3
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,18 @@ export type FunctionsErrorCodeCore = 'ok' | 'cancelled' | 'unknown' | 'invalid-a
3535
export function getFunctions(app?: FirebaseApp, regionOrCustomDomain?: string): Functions;
3636

3737
// @public
38-
export type HttpsCallable<RequestData = unknown, ResponseData = unknown> = (data?: RequestData | null) => Promise<HttpsCallableResult<ResponseData>>;
38+
export interface HttpsCallable<RequestData = unknown, ResponseData = unknown, StreamData = unknown> {
39+
// (undocumented)
40+
(data?: RequestData | null): Promise<HttpsCallableResult<ResponseData>>;
41+
// (undocumented)
42+
stream: (data?: RequestData | null, options?: HttpsCallableStreamOptions) => Promise<HttpsCallableStreamResult<ResponseData, StreamData>>;
43+
}
3944

4045
// @public
41-
export function httpsCallable<RequestData = unknown, ResponseData = unknown>(functionsInstance: Functions, name: string, options?: HttpsCallableOptions): HttpsCallable<RequestData, ResponseData>;
46+
export function httpsCallable<RequestData = unknown, ResponseData = unknown, StreamData = unknown>(functionsInstance: Functions, name: string, options?: HttpsCallableOptions): HttpsCallable<RequestData, ResponseData, StreamData>;
4247

4348
// @public
44-
export function httpsCallableFromURL<RequestData = unknown, ResponseData = unknown>(functionsInstance: Functions, url: string, options?: HttpsCallableOptions): HttpsCallable<RequestData, ResponseData>;
49+
export function httpsCallableFromURL<RequestData = unknown, ResponseData = unknown, StreamData = unknown>(functionsInstance: Functions, url: string, options?: HttpsCallableOptions): HttpsCallable<RequestData, ResponseData, StreamData>;
4550

4651
// @public
4752
export interface HttpsCallableOptions {
@@ -54,5 +59,19 @@ export interface HttpsCallableResult<ResponseData = unknown> {
5459
readonly data: ResponseData;
5560
}
5661

62+
// @public
63+
export interface HttpsCallableStreamOptions {
64+
limitedUseAppCheckTokens?: boolean;
65+
signal?: AbortSignal;
66+
}
67+
68+
// @public
69+
export interface HttpsCallableStreamResult<ResponseData = unknown, StreamData = unknown> {
70+
// (undocumented)
71+
readonly data: Promise<ResponseData>;
72+
// (undocumented)
73+
readonly stream: AsyncIterable<StreamData>;
74+
}
75+
5776

5877
```

config/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Uncomment this if you'd like others to create their own Firebase project.

docs-devsite/_toc.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -375,10 +375,16 @@ toc:
375375
path: /docs/reference/js/functions.functions.md
376376
- title: FunctionsError
377377
path: /docs/reference/js/functions.functionserror.md
378+
- title: HttpsCallable
379+
path: /docs/reference/js/functions.httpscallable.md
378380
- title: HttpsCallableOptions
379381
path: /docs/reference/js/functions.httpscallableoptions.md
380382
- title: HttpsCallableResult
381383
path: /docs/reference/js/functions.httpscallableresult.md
384+
- title: HttpsCallableStreamOptions
385+
path: /docs/reference/js/functions.httpscallablestreamoptions.md
386+
- title: HttpsCallableStreamResult
387+
path: /docs/reference/js/functions.httpscallablestreamresult.md
382388
- title: installations
383389
path: /docs/reference/js/installations.md
384390
section:
+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
Project: /docs/reference/js/_project.yaml
2+
Book: /docs/reference/_book.yaml
3+
page_type: reference
4+
5+
{% comment %}
6+
DO NOT EDIT THIS FILE!
7+
This is generated by the JS SDK team, and any local changes will be
8+
overwritten. Changes should be made in the source code at
9+
https://github.com/firebase/firebase-js-sdk
10+
{% endcomment %}
11+
12+
# HttpsCallable interface
13+
A reference to a "callable" HTTP trigger in Cloud Functions.
14+
15+
<b>Signature:</b>
16+
17+
```typescript
18+
export interface HttpsCallable<RequestData = unknown, ResponseData = unknown, StreamData = unknown>
19+
```
20+
21+
## Properties
22+
23+
| Property | Type | Description |
24+
| --- | --- | --- |
25+
| [stream](./functions.httpscallable.md#httpscallablestream) | (data?: RequestData \| null, options?: [HttpsCallableStreamOptions](./functions.httpscallablestreamoptions.md#httpscallablestreamoptions_interface)<!-- -->) =&gt; Promise&lt;[HttpsCallableStreamResult](./functions.httpscallablestreamresult.md#httpscallablestreamresult_interface)<!-- -->&lt;ResponseData, StreamData&gt;&gt; | |
26+
27+
## HttpsCallable.stream
28+
29+
<b>Signature:</b>
30+
31+
```typescript
32+
stream: (data?: RequestData | null, options?: HttpsCallableStreamOptions) => Promise<HttpsCallableStreamResult<ResponseData, StreamData>>;
33+
```

docs-devsite/functions.httpscallableoptions.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ export interface HttpsCallableOptions
2222

2323
| Property | Type | Description |
2424
| --- | --- | --- |
25-
| [limitedUseAppCheckTokens](./functions.httpscallableoptions.md#httpscallableoptionslimiteduseappchecktokens) | boolean | If set to true, uses 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. |
25+
| [limitedUseAppCheckTokens](./functions.httpscallableoptions.md#httpscallableoptionslimiteduseappchecktokens) | 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. |
2626
| [timeout](./functions.httpscallableoptions.md#httpscallableoptionstimeout) | number | Time in milliseconds after which to cancel if there is no response. Default is 70000. |
2727

2828
## HttpsCallableOptions.limitedUseAppCheckTokens
2929

30-
If set to true, uses 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.
30+
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.
3131

3232
<b>Signature:</b>
3333

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
Project: /docs/reference/js/_project.yaml
2+
Book: /docs/reference/_book.yaml
3+
page_type: reference
4+
5+
{% comment %}
6+
DO NOT EDIT THIS FILE!
7+
This is generated by the JS SDK team, and any local changes will be
8+
overwritten. Changes should be made in the source code at
9+
https://github.com/firebase/firebase-js-sdk
10+
{% endcomment %}
11+
12+
# HttpsCallableStreamOptions interface
13+
An interface for metadata about how a stream call should be executed.
14+
15+
<b>Signature:</b>
16+
17+
```typescript
18+
export interface HttpsCallableStreamOptions
19+
```
20+
21+
## Properties
22+
23+
| Property | Type | Description |
24+
| --- | --- | --- |
25+
| [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. |
26+
| [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. |
27+
28+
## HttpsCallableStreamOptions.limitedUseAppCheckTokens
29+
30+
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.
31+
32+
<b>Signature:</b>
33+
34+
```typescript
35+
limitedUseAppCheckTokens?: boolean;
36+
```
37+
38+
## HttpsCallableStreamOptions.signal
39+
40+
An `AbortSignal` that can be used to cancel the streaming response. When the signal is aborted, the underlying HTTP connection will be terminated.
41+
42+
<b>Signature:</b>
43+
44+
```typescript
45+
signal?: AbortSignal;
46+
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
Project: /docs/reference/js/_project.yaml
2+
Book: /docs/reference/_book.yaml
3+
page_type: reference
4+
5+
{% comment %}
6+
DO NOT EDIT THIS FILE!
7+
This is generated by the JS SDK team, and any local changes will be
8+
overwritten. Changes should be made in the source code at
9+
https://github.com/firebase/firebase-js-sdk
10+
{% endcomment %}
11+
12+
# HttpsCallableStreamResult interface
13+
An `HttpsCallableStreamResult` wraps a single streaming result from a function call.
14+
15+
<b>Signature:</b>
16+
17+
```typescript
18+
export interface HttpsCallableStreamResult<ResponseData = unknown, StreamData = unknown>
19+
```
20+
21+
## Properties
22+
23+
| Property | Type | Description |
24+
| --- | --- | --- |
25+
| [data](./functions.httpscallablestreamresult.md#httpscallablestreamresultdata) | Promise&lt;ResponseData&gt; | |
26+
| [stream](./functions.httpscallablestreamresult.md#httpscallablestreamresultstream) | AsyncIterable&lt;StreamData&gt; | |
27+
28+
## HttpsCallableStreamResult.data
29+
30+
<b>Signature:</b>
31+
32+
```typescript
33+
readonly data: Promise<ResponseData>;
34+
```
35+
36+
## HttpsCallableStreamResult.stream
37+
38+
<b>Signature:</b>
39+
40+
```typescript
41+
readonly stream: AsyncIterable<StreamData>;
42+
```

docs-devsite/functions.md

+7-15
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,18 @@ Cloud Functions for Firebase
3434
| Interface | Description |
3535
| --- | --- |
3636
| [Functions](./functions.functions.md#functions_interface) | A <code>Functions</code> instance. |
37+
| [HttpsCallable](./functions.httpscallable.md#httpscallable_interface) | A reference to a "callable" HTTP trigger in Cloud Functions. |
3738
| [HttpsCallableOptions](./functions.httpscallableoptions.md#httpscallableoptions_interface) | An interface for metadata about how calls should be executed. |
3839
| [HttpsCallableResult](./functions.httpscallableresult.md#httpscallableresult_interface) | An <code>HttpsCallableResult</code> wraps a single result from a function call. |
40+
| [HttpsCallableStreamOptions](./functions.httpscallablestreamoptions.md#httpscallablestreamoptions_interface) | An interface for metadata about how a stream call should be executed. |
41+
| [HttpsCallableStreamResult](./functions.httpscallablestreamresult.md#httpscallablestreamresult_interface) | An <code>HttpsCallableStreamResult</code> wraps a single streaming result from a function call. |
3942

4043
## Type Aliases
4144

4245
| Type Alias | Description |
4346
| --- | --- |
4447
| [FunctionsErrorCode](./functions.md#functionserrorcode) | The set of Firebase Functions status codes. The codes are the same at the ones exposed by gRPC here: https://github.com/grpc/grpc/blob/master/doc/statuscodes.md<!-- -->Possible values: - 'cancelled': The operation was cancelled (typically by the caller). - 'unknown': Unknown error or an error from a different error domain. - 'invalid-argument': Client specified an invalid argument. Note that this differs from 'failed-precondition'. 'invalid-argument' indicates arguments that are problematic regardless of the state of the system (e.g. an invalid field name). - 'deadline-exceeded': Deadline expired before operation could complete. For operations that change the state of the system, this error may be returned even if the operation has completed successfully. For example, a successful response from a server could have been delayed long enough for the deadline to expire. - 'not-found': Some requested document was not found. - 'already-exists': Some document that we attempted to create already exists. - 'permission-denied': The caller does not have permission to execute the specified operation. - 'resource-exhausted': Some resource has been exhausted, perhaps a per-user quota, or perhaps the entire file system is out of space. - 'failed-precondition': Operation was rejected because the system is not in a state required for the operation's execution. - 'aborted': The operation was aborted, typically due to a concurrency issue like transaction aborts, etc. - 'out-of-range': Operation was attempted past the valid range. - 'unimplemented': Operation is not implemented or not supported/enabled. - 'internal': Internal errors. Means some invariants expected by underlying system has been broken. If you see one of these errors, something is very broken. - 'unavailable': The service is currently unavailable. This is most likely a transient condition and may be corrected by retrying with a backoff. - 'data-loss': Unrecoverable data loss or corruption. - 'unauthenticated': The request does not have valid authentication credentials for the operation. |
4548
| [FunctionsErrorCodeCore](./functions.md#functionserrorcodecore) | Functions error code string appended after "functions/" product prefix. See [FunctionsErrorCode](./functions.md#functionserrorcode) for full documentation of codes. |
46-
| [HttpsCallable](./functions.md#httpscallable) | A reference to a "callable" HTTP trigger in Google Cloud Functions. |
4749

4850
## function(app, ...)
4951

@@ -101,7 +103,7 @@ Returns a reference to the callable HTTPS trigger with the given name.
101103
<b>Signature:</b>
102104

103105
```typescript
104-
export declare function httpsCallable<RequestData = unknown, ResponseData = unknown>(functionsInstance: Functions, name: string, options?: HttpsCallableOptions): HttpsCallable<RequestData, ResponseData>;
106+
export declare function httpsCallable<RequestData = unknown, ResponseData = unknown, StreamData = unknown>(functionsInstance: Functions, name: string, options?: HttpsCallableOptions): HttpsCallable<RequestData, ResponseData, StreamData>;
105107
```
106108

107109
#### Parameters
@@ -114,7 +116,7 @@ export declare function httpsCallable<RequestData = unknown, ResponseData = unkn
114116

115117
<b>Returns:</b>
116118

117-
[HttpsCallable](./functions.md#httpscallable)<!-- -->&lt;RequestData, ResponseData&gt;
119+
[HttpsCallable](./functions.httpscallable.md#httpscallable_interface)<!-- -->&lt;RequestData, ResponseData, StreamData&gt;
118120

119121
### httpsCallableFromURL(functionsInstance, url, options) {:#httpscallablefromurl_7af6987}
120122

@@ -123,7 +125,7 @@ Returns a reference to the callable HTTPS trigger with the specified url.
123125
<b>Signature:</b>
124126

125127
```typescript
126-
export declare function httpsCallableFromURL<RequestData = unknown, ResponseData = unknown>(functionsInstance: Functions, url: string, options?: HttpsCallableOptions): HttpsCallable<RequestData, ResponseData>;
128+
export declare function httpsCallableFromURL<RequestData = unknown, ResponseData = unknown, StreamData = unknown>(functionsInstance: Functions, url: string, options?: HttpsCallableOptions): HttpsCallable<RequestData, ResponseData, StreamData>;
127129
```
128130

129131
#### Parameters
@@ -136,7 +138,7 @@ export declare function httpsCallableFromURL<RequestData = unknown, ResponseData
136138

137139
<b>Returns:</b>
138140

139-
[HttpsCallable](./functions.md#httpscallable)<!-- -->&lt;RequestData, ResponseData&gt;
141+
[HttpsCallable](./functions.httpscallable.md#httpscallable_interface)<!-- -->&lt;RequestData, ResponseData, StreamData&gt;
140142

141143
## FunctionsErrorCode
142144

@@ -159,13 +161,3 @@ Functions error code string appended after "functions/" product prefix. See [Fun
159161
```typescript
160162
export type FunctionsErrorCodeCore = 'ok' | 'cancelled' | 'unknown' | 'invalid-argument' | 'deadline-exceeded' | 'not-found' | 'already-exists' | 'permission-denied' | 'resource-exhausted' | 'failed-precondition' | 'aborted' | 'out-of-range' | 'unimplemented' | 'internal' | 'unavailable' | 'data-loss' | 'unauthenticated';
161163
```
162-
163-
## HttpsCallable
164-
165-
A reference to a "callable" HTTP trigger in Google Cloud Functions.
166-
167-
<b>Signature:</b>
168-
169-
```typescript
170-
export type HttpsCallable<RequestData = unknown, ResponseData = unknown> = (data?: RequestData | null) => Promise<HttpsCallableResult<ResponseData>>;
171-
```

e2e/babel.config.js

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/**
2+
* @license
3+
* Copyright 2024 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
module.exports = {
19+
presets: [
20+
['@babel/preset-env', { targets: { node: 'current' } }],
21+
'@babel/preset-typescript'
22+
]
23+
};

e2e/context-template.html

-59
This file was deleted.

0 commit comments

Comments
 (0)