Skip to content

Commit 15c2d86

Browse files
authored
Merge branch 'main' into ep/functions-strict-api
2 parents 2441f58 + c50a9b5 commit 15c2d86

File tree

33 files changed

+1078
-628
lines changed

33 files changed

+1078
-628
lines changed

firebase-crashlytics-ndk/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# Unreleased
2+
* [changed] Updated `firebase-crashlytics` dependency to v19.2.1
3+
24

35
# 19.2.0
46
* [changed] Updated `firebase-crashlytics` dependency to v19.2.0

firebase-dataconnect/connectors/src/androidTest/kotlin/com/google/firebase/dataconnect/connectors/demo/DateScalarIntegrationTest.kt

Lines changed: 156 additions & 149 deletions
Large diffs are not rendered by default.

firebase-dataconnect/testutil/src/main/kotlin/com/google/firebase/dataconnect/testutil/Arbs.kt

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ package com.google.firebase.dataconnect.testutil
1919
import com.google.firebase.dataconnect.ConnectorConfig
2020
import com.google.firebase.dataconnect.DataConnectSettings
2121
import com.google.firebase.dataconnect.FirebaseDataConnect.CallerSdkType
22+
import com.google.firebase.dataconnect.testutil.EdgeCases.Dates.MAX_YEAR
23+
import com.google.firebase.dataconnect.testutil.EdgeCases.Dates.MIN_YEAR
2224
import com.google.firebase.util.nextAlphanumericString
2325
import io.kotest.property.Arb
2426
import io.kotest.property.arbitrary.Codepoint
@@ -35,11 +37,14 @@ import io.kotest.property.arbitrary.filter
3537
import io.kotest.property.arbitrary.filterIsInstance
3638
import io.kotest.property.arbitrary.filterNot
3739
import io.kotest.property.arbitrary.int
40+
import io.kotest.property.arbitrary.long
3841
import io.kotest.property.arbitrary.map
3942
import io.kotest.property.arbitrary.merge
4043
import io.kotest.property.arbitrary.next
4144
import io.kotest.property.arbitrary.of
4245
import io.kotest.property.arbitrary.string
46+
import java.util.Date
47+
import kotlin.random.nextInt
4348

4449
fun <A> Arb<A>.filterNotNull(): Arb<A & Any> = filter { it !== null }.map { it!! }
4550

@@ -168,3 +173,55 @@ fun Arb.Companion.callerSdkType(): Arb<CallerSdkType> = arbitrary {
168173
fun Arb.Companion.tag(): Arb<String> = arbitrary {
169174
"tag" + Arb.string(size = 10, Codepoint.alphanumeric()).bind()
170175
}
176+
177+
private fun maxDayForMonth(month: Int): Int {
178+
return when (month) {
179+
1 -> 31
180+
2 -> 28
181+
3 -> 31
182+
4 -> 30
183+
5 -> 31
184+
6 -> 30
185+
7 -> 31
186+
8 -> 31
187+
9 -> 30
188+
10 -> 31
189+
11 -> 30
190+
12 -> 31
191+
else ->
192+
throw IllegalArgumentException("invalid month: $month (must be between 1 and 12, inclusive)")
193+
}
194+
}
195+
196+
data class DateAndString(val date: Date, val string: String)
197+
198+
fun Arb.Companion.dateAndString(): Arb<DateAndString> =
199+
arbitrary(edgecases = EdgeCases.dateAndStrings) { rs ->
200+
val year = rs.random.nextInt(MIN_YEAR..MAX_YEAR)
201+
val month = rs.random.nextInt(1..12)
202+
val day = rs.random.nextInt(1..maxDayForMonth(month))
203+
204+
val date = dateFromYearMonthDayUTC(year, month, day)
205+
206+
val yearStr = "$year"
207+
val monthStr = "$month".padStart(2, '0')
208+
val dayStr = "$day".padStart(2, '0')
209+
val string = "$yearStr-$monthStr-$dayStr"
210+
211+
DateAndString(date, string)
212+
}
213+
214+
fun Arb.Companion.dateAndStringOffDayBoundary(): Arb<DateAndString> =
215+
arbitrary(edgecases = EdgeCases.dateAndStringOffDayBoundary) {
216+
// Skip dates with the maximum year, as adding non-zero milliseconds will result in the year
217+
// 10,000, which is invalid.
218+
val dateAndStrings = Arb.dateAndString().filterNot { it.string.contains("9999") }
219+
// Don't add more than 86_400_000L, the number of milliseconds per day, to the date.
220+
val millisOffsets = Arb.long(0L until 86_400_000L)
221+
222+
val dateAndString = dateAndStrings.bind()
223+
val millisOffset = millisOffsets.bind()
224+
val dateOffDayBoundary = Date(dateAndString.date.time + millisOffset)
225+
226+
DateAndString(dateOffDayBoundary, dateAndString.string)
227+
}

firebase-dataconnect/testutil/src/main/kotlin/com/google/firebase/dataconnect/testutil/EdgeCases.kt

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616

1717
package com.google.firebase.dataconnect.testutil
1818

19+
import java.util.Date
20+
import java.util.GregorianCalendar
21+
import java.util.TimeZone
22+
1923
object EdgeCases {
2024

2125
val numbers: List<Double> =
@@ -82,4 +86,50 @@ object EdgeCases {
8286
}
8387

8488
val anyScalars: List<Any?> = primitives + lists + maps + listOf(null)
89+
90+
object Dates {
91+
const val MIN_YEAR = 1583
92+
const val MAX_YEAR = 9999
93+
94+
val MIN: Date
95+
get() = dateFromYearMonthDayUTC(MIN_YEAR, 1, 1)
96+
val MIN_DATE_AND_STRING: DateAndString
97+
get() = DateAndString(MIN, "$MIN_YEAR-01-01")
98+
99+
val MAX: Date
100+
get() = dateFromYearMonthDayUTC(MAX_YEAR, 12, 31)
101+
val MAX_DATE_AND_STRING: DateAndString
102+
get() = DateAndString(MAX, "$MAX_YEAR-12-31")
103+
104+
val ZERO: Date
105+
get() = GregorianCalendar(TimeZone.getTimeZone("UTC")).apply { timeInMillis = 0 }.time
106+
val ZERO_DATE_AND_STRING: DateAndString
107+
get() = DateAndString(ZERO, "1970-01-01")
108+
}
109+
110+
val dates: List<Date> = listOf(Dates.MIN, Dates.MAX, Dates.ZERO)
111+
112+
val dateAndStrings: List<DateAndString> =
113+
listOf(
114+
Dates.MIN_DATE_AND_STRING,
115+
Dates.MAX_DATE_AND_STRING,
116+
Dates.ZERO_DATE_AND_STRING,
117+
)
118+
119+
val dateAndStringOffDayBoundary: List<DateAndString> =
120+
listOf(
121+
DateAndString(
122+
Date(Dates.MIN_DATE_AND_STRING.date.time + 1),
123+
Dates.MIN_DATE_AND_STRING.string
124+
),
125+
DateAndString(
126+
Date(Dates.MAX_DATE_AND_STRING.date.time + 1),
127+
Dates.MAX_DATE_AND_STRING.string
128+
),
129+
DateAndString(
130+
Date(Dates.ZERO_DATE_AND_STRING.date.time + 1),
131+
Dates.ZERO_DATE_AND_STRING.string
132+
),
133+
DateAndString(Date(Dates.ZERO_DATE_AND_STRING.date.time - 1), "1969-12-31"),
134+
)
85135
}

firebase-firestore/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Unreleased
2+
* [changed] Update Firestore proto definitions. [#6369](//github.com/firebase/firebase-android-sdk/pull/6369)
23
* [changed] Updated protobuf dependency to `3.25.5` to fix
34
[CVE-2024-7254](https://github.com/advisories/GHSA-735f-pc8j-v9w8).
45

firebase-firestore/src/proto/google/firestore/v1/aggregation_result.proto

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2022 Google LLC
1+
// Copyright 2024 Google LLC
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -19,7 +19,7 @@ package google.firestore.v1;
1919
import "google/firestore/v1/document.proto";
2020

2121
option csharp_namespace = "Google.Cloud.Firestore.V1";
22-
option go_package = "google.golang.org/genproto/googleapis/firestore/v1;firestore";
22+
option go_package = "cloud.google.com/go/firestore/apiv1/firestorepb;firestorepb";
2323
option java_multiple_files = true;
2424
option java_outer_classname = "AggregationResultProto";
2525
option java_package = "com.google.firestore.v1";
@@ -35,7 +35,8 @@ option ruby_package = "Google::Cloud::Firestore::V1";
3535
message AggregationResult {
3636
// The result of the aggregation functions, ex: `COUNT(*) AS total_docs`.
3737
//
38-
// The key is the [alias][google.firestore.v1.StructuredAggregationQuery.Aggregation.alias]
38+
// The key is the
39+
// [alias][google.firestore.v1.StructuredAggregationQuery.Aggregation.alias]
3940
// assigned to the aggregation function on input and the size of this map
4041
// equals the number of aggregation functions in the query.
4142
map<string, Value> aggregate_fields = 2;

firebase-firestore/src/proto/google/firestore/v1/bloom_filter.proto

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2023 Google LLC
1+
// Copyright 2024 Google LLC
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -17,7 +17,7 @@ syntax = "proto3";
1717
package google.firestore.v1;
1818

1919
option csharp_namespace = "Google.Cloud.Firestore.V1";
20-
option go_package = "google.golang.org/genproto/googleapis/firestore/v1;firestore";
20+
option go_package = "cloud.google.com/go/firestore/apiv1/firestorepb;firestorepb";
2121
option java_multiple_files = true;
2222
option java_outer_classname = "BloomFilterProto";
2323
option java_package = "com.google.firestore.v1";
@@ -32,21 +32,21 @@ option ruby_package = "Google::Cloud::Firestore::V1";
3232
// defines the number of bits of the last byte to be ignored as "padding". The
3333
// values of these "padding" bits are unspecified and must be ignored.
3434
//
35-
// To retrieve the first bit, bit 0, calculate: (bitmap[0] & 0x01) != 0.
36-
// To retrieve the second bit, bit 1, calculate: (bitmap[0] & 0x02) != 0.
37-
// To retrieve the third bit, bit 2, calculate: (bitmap[0] & 0x04) != 0.
38-
// To retrieve the fourth bit, bit 3, calculate: (bitmap[0] & 0x08) != 0.
39-
// To retrieve bit n, calculate: (bitmap[n / 8] & (0x01 << (n % 8))) != 0.
35+
// To retrieve the first bit, bit 0, calculate: `(bitmap[0] & 0x01) != 0`.
36+
// To retrieve the second bit, bit 1, calculate: `(bitmap[0] & 0x02) != 0`.
37+
// To retrieve the third bit, bit 2, calculate: `(bitmap[0] & 0x04) != 0`.
38+
// To retrieve the fourth bit, bit 3, calculate: `(bitmap[0] & 0x08) != 0`.
39+
// To retrieve bit n, calculate: `(bitmap[n / 8] & (0x01 << (n % 8))) != 0`.
4040
//
4141
// The "size" of a `BitSequence` (the number of bits it contains) is calculated
42-
// by this formula: (bitmap.length * 8) - padding.
42+
// by this formula: `(bitmap.length * 8) - padding`.
4343
message BitSequence {
4444
// The bytes that encode the bit sequence.
4545
// May have a length of zero.
4646
bytes bitmap = 1;
4747

4848
// The number of bits of the last byte in `bitmap` to ignore as "padding".
49-
// If the length of `bitmap` is zero, then this value must be 0.
49+
// If the length of `bitmap` is zero, then this value must be `0`.
5050
// Otherwise, this value must be between 0 and 7, inclusive.
5151
int32 padding = 2;
5252
}
@@ -57,10 +57,10 @@ message BitSequence {
5757
// hash as 2 distinct 64-bit hash values, interpreted as unsigned integers
5858
// using 2's complement encoding.
5959
//
60-
// These two hash values, named h1 and h2, are then used to compute the
61-
// `hash_count` hash values using the formula, starting at i=0:
60+
// These two hash values, named `h1` and `h2`, are then used to compute the
61+
// `hash_count` hash values using the formula, starting at `i=0`:
6262
//
63-
// h(i) = h1 + (i * h2)
63+
// h(i) = h1 + (i * h2)
6464
//
6565
// These resulting values are then taken modulo the number of bits in the bloom
6666
// filter to get the bits of the bloom filter to test for the given entry.
@@ -70,4 +70,4 @@ message BloomFilter {
7070

7171
// The number of hashes used by the algorithm.
7272
int32 hash_count = 2;
73-
}
73+
}

firebase-firestore/src/proto/google/firestore/v1/common.proto

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2018 Google LLC.
1+
// Copyright 2024 Google LLC
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -11,32 +11,32 @@
1111
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
14-
//
1514

1615
syntax = "proto3";
1716

1817
package google.firestore.v1;
1918

20-
import "google/api/annotations.proto";
2119
import "google/protobuf/timestamp.proto";
2220

2321
option csharp_namespace = "Google.Cloud.Firestore.V1";
24-
option go_package = "google.golang.org/genproto/googleapis/firestore/v1;firestore";
22+
option go_package = "cloud.google.com/go/firestore/apiv1/firestorepb;firestorepb";
2523
option java_multiple_files = true;
2624
option java_outer_classname = "CommonProto";
2725
option java_package = "com.google.firestore.v1";
2826
option objc_class_prefix = "GCFS";
2927
option php_namespace = "Google\\Cloud\\Firestore\\V1";
30-
28+
option ruby_package = "Google::Cloud::Firestore::V1";
3129

3230
// A set of field paths on a document.
3331
// Used to restrict a get or update operation on a document to a subset of its
3432
// fields.
3533
// This is different from standard field masks, as this is always scoped to a
36-
// [Document][google.firestore.v1.Document], and takes in account the dynamic nature of [Value][google.firestore.v1.Value].
34+
// [Document][google.firestore.v1.Document], and takes in account the dynamic
35+
// nature of [Value][google.firestore.v1.Value].
3736
message DocumentMask {
38-
// The list of field paths in the mask. See [Document.fields][google.firestore.v1.Document.fields] for a field
39-
// path syntax reference.
37+
// The list of field paths in the mask. See
38+
// [Document.fields][google.firestore.v1.Document.fields] for a field path
39+
// syntax reference.
4040
repeated string field_paths = 1;
4141
}
4242

@@ -49,14 +49,17 @@ message Precondition {
4949
bool exists = 1;
5050

5151
// When set, the target document must exist and have been last updated at
52-
// that time.
52+
// that time. Timestamp must be microsecond aligned.
5353
google.protobuf.Timestamp update_time = 2;
5454
}
5555
}
5656

5757
// Options for creating a new transaction.
5858
message TransactionOptions {
5959
// Options for a transaction that can be used to read and write documents.
60+
//
61+
// Firestore does not allow 3rd party auth requests to create read-write.
62+
// transactions.
6063
message ReadWrite {
6164
// An optional transaction to retry.
6265
bytes retry_transaction = 1;
@@ -68,7 +71,10 @@ message TransactionOptions {
6871
// consistency.
6972
oneof consistency_selector {
7073
// Reads documents at the given time.
71-
// This may not be older than 60 seconds.
74+
//
75+
// This must be a microsecond precision timestamp within the past one
76+
// hour, or if Point-in-Time Recovery is enabled, can additionally be a
77+
// whole minute timestamp within the past 7 days.
7278
google.protobuf.Timestamp read_time = 2;
7379
}
7480
}

0 commit comments

Comments
 (0)